feat: support inlining FRESH_PUBLIC_ env vars (#3214)

Fixes https://github.com/denoland/fresh/issues/3213
This commit is contained in:
Marvin Hagemeister
2025-08-12 12:00:59 +02:00
committed by GitHub
parent d026375c3e
commit 477fcefed4
8 changed files with 227 additions and 195 deletions
+1 -1
View File
@@ -37,7 +37,7 @@
},
"imports": {
"@deno/doc": "jsr:@deno/doc@^0.172.0",
"@deno/esbuild-plugin": "jsr:@deno/esbuild-plugin@^1.1.5",
"@deno/esbuild-plugin": "jsr:@deno/esbuild-plugin@^1.2.0",
"@fresh/build-id": "jsr:@fresh/build-id@^1.0.0",
"@std/cli": "jsr:@std/cli@^1.0.19",
"@std/collections": "jsr:@std/collections@^1.1.2",
Generated
+58 -192
View File
@@ -3,73 +3,46 @@
"specifiers": {
"jsr:@astral/astral@~0.5.3": "0.5.3",
"jsr:@deno-library/progress@^1.5.1": "1.5.1",
"jsr:@deno/cache-dir@0.14": "0.14.0",
"jsr:@deno/doc@0.172": "0.172.0",
"jsr:@deno/esbuild-plugin@^1.1.5": "1.1.5",
"jsr:@deno/graph@0.86": "0.86.9",
"jsr:@deno/graph@~0.82.3": "0.82.3",
"jsr:@deno/loader@~0.3.2": "0.3.4",
"jsr:@deno/esbuild-plugin@^1.2.0": "1.2.0",
"jsr:@deno/loader@~0.3.3": "0.3.4",
"jsr:@fresh/build-id@1": "1.0.0",
"jsr:@fresh/core@^2.0.0-alpha.37": "2.0.0-alpha.57",
"jsr:@marvinh-test/fresh-island@^0.0.1": "0.0.1",
"jsr:@std/assert@^1.0.13": "1.0.13",
"jsr:@std/async@1": "1.0.14",
"jsr:@std/async@^1.0.13": "1.0.14",
"jsr:@std/bytes@^1.0.5": "1.0.6",
"jsr:@std/bytes@^1.0.6": "1.0.6",
"jsr:@std/cli@^1.0.19": "1.0.21",
"jsr:@std/cli@^1.0.21": "1.0.21",
"jsr:@std/collections@^1.0.11": "1.1.1",
"jsr:@std/collections@^1.1.1": "1.1.2",
"jsr:@std/collections@^1.1.2": "1.1.2",
"jsr:@std/crypto@^1.0.5": "1.0.5",
"jsr:@std/data-structures@^1.0.9": "1.0.9",
"jsr:@std/encoding@1": "1.0.10",
"jsr:@std/encoding@^1.0.10": "1.0.10",
"jsr:@std/expect@^1.0.16": "1.0.16",
"jsr:@std/fmt@1.0.3": "1.0.3",
"jsr:@std/fmt@^1.0.3": "1.0.8",
"jsr:@std/fmt@^1.0.7": "1.0.8",
"jsr:@std/fmt@^1.0.8": "1.0.8",
"jsr:@std/front-matter@^1.0.5": "1.0.9",
"jsr:@std/fs@1": "1.0.19",
"jsr:@std/fs@^1.0.19": "1.0.19",
"jsr:@std/fs@^1.0.6": "1.0.19",
"jsr:@std/html@1": "1.0.4",
"jsr:@std/html@^1.0.4": "1.0.4",
"jsr:@std/http@^1.0.15": "1.0.20",
"jsr:@std/internal@^1.0.10": "1.0.10",
"jsr:@std/internal@^1.0.6": "1.0.10",
"jsr:@std/internal@^1.0.7": "1.0.10",
"jsr:@std/internal@^1.0.9": "1.0.10",
"jsr:@std/io@0.225": "0.225.2",
"jsr:@std/io@0.225.0": "0.225.0",
"jsr:@std/json@^1.0.2": "1.0.2",
"jsr:@std/jsonc@1": "1.0.2",
"jsr:@std/media-types@1": "1.1.0",
"jsr:@std/media-types@^1.1.0": "1.1.0",
"jsr:@std/net@^1.0.4": "1.0.4",
"jsr:@std/path@1": "1.1.1",
"jsr:@std/path@^1.0.8": "1.1.1",
"jsr:@std/path@^1.1.1": "1.1.1",
"jsr:@std/semver@1": "1.0.5",
"jsr:@std/streams@1": "1.0.10",
"jsr:@std/streams@^1.0.10": "1.0.10",
"jsr:@std/testing@^1.0.12": "1.0.15",
"jsr:@std/toml@^1.0.3": "1.0.8",
"jsr:@std/uuid@^1.0.7": "1.0.9",
"jsr:@std/yaml@^1.0.5": "1.0.9",
"jsr:@zip-js/zip-js@^2.7.52": "2.7.72",
"npm:@babel/core@^7.28.0": "7.28.0",
"npm:@opentelemetry/api@^1.9.0": "1.9.0",
"npm:@preact/signals@^1.2.3": "1.3.2_preact@10.27.0",
"npm:@preact/signals@^2.2.1": "2.2.1_preact@10.27.0",
"npm:@prefresh/vite@^2.4.8": "2.4.8_preact@10.27.0_vite@7.0.6__@types+node@24.2.0__picomatch@4.0.3_@types+node@24.2.0_@types+node@22.15.15",
"npm:@prefresh/vite@^2.4.8": "2.4.8_preact@10.27.0_vite@7.1.2__@types+node@24.2.1__picomatch@4.0.3_@types+node@24.2.1_@types+node@22.15.15",
"npm:@tailwindcss/postcss@^4.1.10": "4.1.11",
"npm:@types/babel__core@^7.20.5": "7.20.5",
"npm:@types/node@*": "22.15.15",
"npm:@types/node@^24.1.0": "24.2.0",
"npm:@types/node@^24.1.0": "24.2.1",
"npm:autoprefixer@^10.4.21": "10.4.21_postcss@8.5.6",
"npm:cssnano@^6.1.2": "6.1.2_postcss@8.5.6",
"npm:esbuild-wasm@0.25.7": "0.25.7",
@@ -84,25 +57,22 @@
"npm:postcss@8.5.6": "8.5.6",
"npm:postcss@^8.5.6": "8.5.6",
"npm:preact-render-to-string@^6.5.11": "6.5.13_preact@10.27.0",
"npm:preact@^10.22.0": "10.27.0",
"npm:preact@^10.26.9": "10.27.0",
"npm:preact@^10.27.0": "10.27.0",
"npm:prismjs@^1.29.0": "1.30.0",
"npm:tailwindcss@^3.4.17": "3.4.17_postcss@8.5.6",
"npm:tailwindcss@^4.1.10": "4.1.11",
"npm:ts-morph@26": "26.0.0",
"npm:vite-plugin-inspect@^11.3.2": "11.3.2_vite@7.0.6__@types+node@24.2.0__picomatch@4.0.3_@types+node@24.2.0_@types+node@22.15.15",
"npm:vite@*": "7.0.6_@types+node@24.2.0_picomatch@4.0.3_@types+node@22.15.15",
"npm:vite@7.0.6": "7.0.6_@types+node@24.2.0_picomatch@4.0.3_@types+node@22.15.15",
"npm:vite@^7.0.6": "7.0.6_@types+node@24.2.0_picomatch@4.0.3_@types+node@22.15.15"
"npm:vite-plugin-inspect@^11.3.2": "11.3.2_vite@7.1.2__@types+node@24.2.1__picomatch@4.0.3_@types+node@24.2.1_@types+node@22.15.15",
"npm:vite@^7.0.6": "7.1.2_@types+node@24.2.1_picomatch@4.0.3_@types+node@22.15.15"
},
"jsr": {
"@astral/astral@0.5.3": {
"integrity": "d6a4628313d8be99aac0f51005c1dc090fa3b4c6b5c8335c26a52d4842aa1276",
"dependencies": [
"jsr:@deno-library/progress",
"jsr:@std/async@1",
"jsr:@std/fs@1",
"jsr:@std/async",
"jsr:@std/fs",
"jsr:@std/path@1",
"jsr:@zip-js/zip-js"
]
@@ -111,79 +81,20 @@
"integrity": "966611826b8bb27baae73ab1c4fa4317cd4edd2abb99750cd6f8488d22d5b121",
"dependencies": [
"jsr:@std/fmt@1.0.3",
"jsr:@std/io@0.225.0"
"jsr:@std/io"
]
},
"@deno/cache-dir@0.14.0": {
"integrity": "729f0b68e7fc96443c09c2c544b830ca70897bdd5168598446d752f7a4c731ad",
"@deno/esbuild-plugin@1.2.0": {
"integrity": "04ddd0fca9416d8a2866263928a53b9d5ed08dfca064d64504a0aaf9800c709e",
"dependencies": [
"jsr:@deno/graph@0.86",
"jsr:@std/fmt@^1.0.3",
"jsr:@std/fs@^1.0.6",
"jsr:@std/io@0.225",
"jsr:@std/path@^1.0.8"
]
},
"@deno/doc@0.172.0": {
"integrity": "72a68ed533576a06feb930a84784ad9ba6d83ca9d581fc734d498c58e32b7cf5",
"dependencies": [
"jsr:@deno/cache-dir",
"jsr:@deno/graph@~0.82.3"
]
},
"@deno/esbuild-plugin@1.1.5": {
"integrity": "c9cde95990b97802a0da6c73c26ab4a48f30d286818845e365dddcd8297abd7d",
"dependencies": [
"jsr:@deno/loader@~0.3.3",
"jsr:@deno/loader",
"jsr:@std/path@^1.1.1",
"npm:esbuild@~0.25.5"
]
},
"@deno/graph@0.82.3": {
"integrity": "5c1fe944368172a9c87588ac81b82eb027ca78002a57521567e6264be322637e"
},
"@deno/graph@0.86.9": {
"integrity": "c4f353a695bcc5246c099602977dabc6534eacea9999a35a8cb24e807192e6a1"
},
"@deno/loader@0.3.4": {
"integrity": "c56003bc7027606301c3fe62704723b207a9e508c9fb154cf5131abb9d4d2673"
},
"@fresh/build-id@1.0.0": {
"integrity": "c42a1dab0b0b8bcddf93657edf03f404d537ba8e1d44144b3c749727c5671d5a",
"dependencies": [
"jsr:@std/encoding@^1.0.10"
]
},
"@fresh/core@2.0.0-alpha.57": {
"integrity": "2de0656d32fe327482138a2b585d4560db05ed979bf20c071da2969a4a759550",
"dependencies": [
"jsr:@deno/esbuild-plugin",
"jsr:@std/encoding@1",
"jsr:@std/fmt@^1.0.8",
"jsr:@std/fs@1",
"jsr:@std/html@1",
"jsr:@std/http",
"jsr:@std/jsonc",
"jsr:@std/media-types@1",
"jsr:@std/path@1",
"jsr:@std/semver",
"jsr:@std/uuid",
"npm:@opentelemetry/api",
"npm:@preact/signals@^2.2.1",
"npm:esbuild-wasm",
"npm:esbuild@0.25.7",
"npm:preact-render-to-string",
"npm:preact@^10.27.0"
]
},
"@marvinh-test/fresh-island@0.0.1": {
"integrity": "890f2595e60b1aaeaa8d73c6ad2c1247d4c5b895387df230f7f3b2a4da29b585",
"dependencies": [
"npm:@preact/signals@^1.2.3",
"npm:preact@^10.22.0",
"npm:preact@^10.27.0"
]
},
"@std/assert@1.0.13": {
"integrity": "ae0d31e41919b12c656c742b22522c32fb26ed0cba32975cb0de2a273cb68b29",
"dependencies": [
@@ -199,21 +110,12 @@
"@std/bytes@1.0.6": {
"integrity": "f6ac6adbd8ccd99314045f5703e23af0a68d7f7e58364b47d2c7f408aeb5820a"
},
"@std/cli@1.0.21": {
"integrity": "cd25b050bdf6282e321854e3822bee624f07aca7636a3a76d95f77a3a919ca2a"
},
"@std/collections@1.1.1": {
"integrity": "eff6443fbd9d5a6697018fb39c5d13d5f662f0045f21392d640693d0008ab2af"
},
"@std/collections@1.1.2": {
"integrity": "f1685dd45c3ec27c39d0e8a642ccf810f391ec8a6cb5e7355926e6dacc64c43e"
},
"@std/crypto@1.0.5": {
"integrity": "0dcfbb319fe0bba1bd3af904ceb4f948cde1b92979ec1614528380ed308a3b40"
},
"@std/data-structures@1.0.9": {
"integrity": "033d6e17e64bf1f84a614e647c1b015fa2576ae3312305821e1a4cb20674bb4d"
},
"@std/encoding@1.0.10": {
"integrity": "8783c6384a2d13abd5e9e87a7ae0520a30e9f56aeeaa3bdf910a3eaaf5c811a1"
},
@@ -240,7 +142,6 @@
"@std/fs@1.0.19": {
"integrity": "051968c2b1eae4d2ea9f79a08a3845740ef6af10356aff43d3e2ef11ed09fb06",
"dependencies": [
"jsr:@std/internal@^1.0.9",
"jsr:@std/path@^1.1.1"
]
},
@@ -250,15 +151,7 @@
"@std/http@1.0.20": {
"integrity": "b5cc33fc001bccce65ed4c51815668c9891c69ccd908295997e983d8f56070a1",
"dependencies": [
"jsr:@std/cli@^1.0.21",
"jsr:@std/encoding@^1.0.10",
"jsr:@std/fmt@^1.0.8",
"jsr:@std/fs@^1.0.19",
"jsr:@std/html@^1.0.4",
"jsr:@std/media-types@^1.1.0",
"jsr:@std/net",
"jsr:@std/path@^1.1.1",
"jsr:@std/streams@^1.0.10"
"jsr:@std/encoding@^1.0.10"
]
},
"@std/internal@1.0.10": {
@@ -267,12 +160,6 @@
"@std/io@0.225.0": {
"integrity": "c1db7c5e5a231629b32d64b9a53139445b2ca640d828c26bf23e1c55f8c079b3"
},
"@std/io@0.225.2": {
"integrity": "3c740cd4ee4c082e6cfc86458f47e2ab7cb353dc6234d5e9b1f91a2de5f4d6c7",
"dependencies": [
"jsr:@std/bytes@^1.0.5"
]
},
"@std/json@1.0.2": {
"integrity": "d9e5497801c15fb679f55a2c01c7794ad7a5dfda4dd1bebab5e409cb5e0d34d4"
},
@@ -285,9 +172,6 @@
"@std/media-types@1.1.0": {
"integrity": "c9d093f0c05c3512932b330e3cc1fe1d627b301db33a4c2c2185c02471d6eaa4"
},
"@std/net@1.0.4": {
"integrity": "2f403b455ebbccf83d8a027d29c5a9e3a2452fea39bb2da7f2c04af09c8bc852"
},
"@std/path@1.1.0": {
"integrity": "ddc94f8e3c275627281cbc23341df6b8bcc874d70374f75fec2533521e3d6886"
},
@@ -303,18 +187,7 @@
"@std/streams@1.0.10": {
"integrity": "75c0b1431873cd0d8b3d679015220204d36d3c7420d93b60acfc379eb0dc30af",
"dependencies": [
"jsr:@std/bytes@^1.0.6"
]
},
"@std/testing@1.0.15": {
"integrity": "a490169f5ccb0f3ae9c94fbc69d2cd43603f2cffb41713a85f99bbb0e3087cbc",
"dependencies": [
"jsr:@std/assert",
"jsr:@std/async@^1.0.13",
"jsr:@std/data-structures",
"jsr:@std/fs@^1.0.19",
"jsr:@std/internal@^1.0.10",
"jsr:@std/path@^1.1.1"
"jsr:@std/bytes"
]
},
"@std/toml@1.0.8": {
@@ -326,8 +199,7 @@
"@std/uuid@1.0.9": {
"integrity": "44b627bf2d372fe1bd099e2ad41b2be41a777fc94e62a3151006895a037f1642",
"dependencies": [
"jsr:@std/bytes@^1.0.6",
"jsr:@std/crypto"
"jsr:@std/bytes"
]
},
"@std/yaml@1.0.8": {
@@ -1029,8 +901,8 @@
"minipass"
]
},
"@jridgewell/gen-mapping@0.3.12": {
"integrity": "sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg==",
"@jridgewell/gen-mapping@0.3.13": {
"integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
"dependencies": [
"@jridgewell/sourcemap-codec",
"@jridgewell/trace-mapping"
@@ -1039,11 +911,11 @@
"@jridgewell/resolve-uri@3.1.2": {
"integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="
},
"@jridgewell/sourcemap-codec@1.5.4": {
"integrity": "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw=="
"@jridgewell/sourcemap-codec@1.5.5": {
"integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="
},
"@jridgewell/trace-mapping@0.3.29": {
"integrity": "sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ==",
"@jridgewell/trace-mapping@0.3.30": {
"integrity": "sha512-GQ7Nw5G2lTu/BtHTKfXhKHok2WGetd4XYcVKGx00SjAk8GMwgJM3zr6zORiPGuOE+/vkc90KtTosSSvaCjKb2Q==",
"dependencies": [
"@jridgewell/resolve-uri",
"@jridgewell/sourcemap-codec"
@@ -1086,13 +958,6 @@
"@preact/signals-core@1.11.0": {
"integrity": "sha512-jglbibeWHuFRzEWVFY/TT7wB1PppJxmcSfUHcK+2J9vBRtiooMfw6tAPttojNYrrpdGViqAYCbPpmWYlMm+eMQ=="
},
"@preact/signals@1.3.2_preact@10.27.0": {
"integrity": "sha512-naxcJgUJ6BTOROJ7C3QML7KvwKwCXQJYTc5L/b0eEsdYgPB6SxwoQ1vDGcS0Q7GVjAenVq/tXrybVdFShHYZWg==",
"dependencies": [
"@preact/signals-core",
"preact"
]
},
"@preact/signals@2.2.1_preact@10.27.0": {
"integrity": "sha512-cX3mijdjHbbz3dBoJ6z687CGYEOp9ifj3uFnm4UKW+DxXKPMvE2y/VSdm0PXhXmHnr6F0iSnDJ+dLwmV7CYT5A==",
"dependencies": [
@@ -1112,7 +977,7 @@
"@prefresh/utils@1.2.1": {
"integrity": "sha512-vq/sIuN5nYfYzvyayXI4C2QkprfNaHUQ9ZX+3xLD8nL3rWyzpxOm1+K7RtMbhd+66QcaISViK7amjnheQ/4WZw=="
},
"@prefresh/vite@2.4.8_preact@10.27.0_vite@7.0.6__@types+node@24.2.0__picomatch@4.0.3_@types+node@24.2.0": {
"@prefresh/vite@2.4.8_preact@10.27.0_vite@7.1.2__@types+node@24.2.1__picomatch@4.0.3_@types+node@24.2.1": {
"integrity": "sha512-H7vlo9UbJInuRbZhRQrdgVqLP7qKjDoX7TgYWWwIVhEHeHO0hZ4zyicvwBrV1wX5A3EPOmArgRkUaN7cPI2VXQ==",
"dependencies": [
"@babel/core",
@@ -1121,10 +986,10 @@
"@prefresh/utils",
"@rollup/pluginutils",
"preact",
"vite@7.0.6_@types+node@24.2.0_picomatch@4.0.3"
"vite@7.1.2_@types+node@24.2.1_picomatch@4.0.3"
]
},
"@prefresh/vite@2.4.8_preact@10.27.0_vite@7.0.6__@types+node@24.2.0__picomatch@4.0.3_@types+node@24.2.0_@types+node@22.15.15": {
"@prefresh/vite@2.4.8_preact@10.27.0_vite@7.1.2__@types+node@24.2.1__picomatch@4.0.3_@types+node@24.2.1_@types+node@22.15.15": {
"integrity": "sha512-H7vlo9UbJInuRbZhRQrdgVqLP7qKjDoX7TgYWWwIVhEHeHO0hZ4zyicvwBrV1wX5A3EPOmArgRkUaN7cPI2VXQ==",
"dependencies": [
"@babel/core",
@@ -1133,7 +998,7 @@
"@prefresh/utils",
"@rollup/pluginutils",
"preact",
"vite@7.0.6_@types+node@24.2.0_picomatch@4.0.3_@types+node@22.15.15"
"vite@7.1.2_@types+node@24.2.1_picomatch@4.0.3_@types+node@22.15.15"
]
},
"@rollup/pluginutils@4.2.1": {
@@ -1415,8 +1280,8 @@
"undici-types@6.21.0"
]
},
"@types/node@24.2.0": {
"integrity": "sha512-3xyG3pMCq3oYCNg7/ZP+E1ooTaGB4cG8JWRsqqOYQdbWNY4zbaV0Ennrd7stjiJEFZCaybcIgpTjJWHRfBSIDw==",
"@types/node@24.2.1": {
"integrity": "sha512-DRh5K+ka5eJic8CjH7td8QpYEV6Zo10gfRkjHCO3weqZHWDtAaSTFtl4+VMqOJ4N5jcuhZ9/l+yy8rVgw7BQeQ==",
"dependencies": [
"undici-types@7.10.0"
]
@@ -1489,8 +1354,8 @@
"fill-range"
]
},
"browserslist@4.25.1": {
"integrity": "sha512-KGj0KoOMXLpSNkkEI6Z6mShmQy0bc1I+T7K9N81k4WWMrfz+6fQ6es80B/YLAeRoKvjYE1YSHHOW1qe9xIVzHw==",
"browserslist@4.25.2": {
"integrity": "sha512-0si2SJK3ooGzIawRu61ZdPCO1IncZwS8IzuX73sPZsXW6EQ/w/DAfPyKI8l1ETTCr2MnvqWitmlCUxgdul45jA==",
"dependencies": [
"caniuse-lite",
"electron-to-chromium",
@@ -1517,8 +1382,8 @@
"lodash.uniq"
]
},
"caniuse-lite@1.0.30001731": {
"integrity": "sha512-lDdp2/wrOmTRWuoB5DpfNkC0rJDU8DqRa6nYL6HK6sytw70QMopt/NIc/9SM7ylItlBWfACXk0tEn37UWM/+mg=="
"caniuse-lite@1.0.30001734": {
"integrity": "sha512-uhE1Ye5vgqju6OI71HTQqcBCZrvHugk0MjLak7Q+HfoBgoq5Bi+5YnwjP4fjDgrtYr/l8MVRBvzz9dPD4KyK0A=="
},
"chokidar@3.6.0": {
"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
@@ -1722,8 +1587,8 @@
"eastasianwidth@0.2.0": {
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA=="
},
"electron-to-chromium@1.5.197": {
"integrity": "sha512-m1xWB3g7vJ6asIFz+2pBUbq3uGmfmln1M9SSvBe4QIFWYrRHylP73zL/3nMjDmwz8V+1xAXQDfBd6+HPW0WvDQ=="
"electron-to-chromium@1.5.200": {
"integrity": "sha512-rFCxROw7aOe4uPTfIAx+rXv9cEcGx+buAF4npnhtTqCJk5KDFRnh3+KYj7rdVh6lsFt5/aPs+Irj9rZ33WMA7w=="
},
"emoji-regex@8.0.0": {
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
@@ -2743,7 +2608,7 @@
"picomatch@4.0.3"
]
},
"update-browserslist-db@1.1.3_browserslist@4.25.1": {
"update-browserslist-db@1.1.3_browserslist@4.25.2": {
"integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==",
"dependencies": [
"browserslist",
@@ -2755,35 +2620,35 @@
"util-deprecate@1.0.2": {
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
"vite-dev-rpc@1.1.0_vite@7.0.6__@types+node@24.2.0__picomatch@4.0.3_@types+node@24.2.0": {
"vite-dev-rpc@1.1.0_vite@7.1.2__@types+node@24.2.1__picomatch@4.0.3_@types+node@24.2.1": {
"integrity": "sha512-pKXZlgoXGoE8sEKiKJSng4hI1sQ4wi5YT24FCrwrLt6opmkjlqPPVmiPWWJn8M8byMxRGzp1CrFuqQs4M/Z39A==",
"dependencies": [
"birpc",
"vite@7.0.6_@types+node@24.2.0_picomatch@4.0.3",
"vite-hot-client@2.1.0_vite@7.0.6__@types+node@24.2.0__picomatch@4.0.3_@types+node@24.2.0"
"vite@7.1.2_@types+node@24.2.1_picomatch@4.0.3",
"vite-hot-client@2.1.0_vite@7.1.2__@types+node@24.2.1__picomatch@4.0.3_@types+node@24.2.1"
]
},
"vite-dev-rpc@1.1.0_vite@7.0.6__@types+node@24.2.0__picomatch@4.0.3_@types+node@24.2.0_@types+node@22.15.15": {
"vite-dev-rpc@1.1.0_vite@7.1.2__@types+node@24.2.1__picomatch@4.0.3_@types+node@24.2.1_@types+node@22.15.15": {
"integrity": "sha512-pKXZlgoXGoE8sEKiKJSng4hI1sQ4wi5YT24FCrwrLt6opmkjlqPPVmiPWWJn8M8byMxRGzp1CrFuqQs4M/Z39A==",
"dependencies": [
"birpc",
"vite@7.0.6_@types+node@24.2.0_picomatch@4.0.3_@types+node@22.15.15",
"vite-hot-client@2.1.0_vite@7.0.6__@types+node@24.2.0__picomatch@4.0.3_@types+node@24.2.0_@types+node@22.15.15"
"vite@7.1.2_@types+node@24.2.1_picomatch@4.0.3_@types+node@22.15.15",
"vite-hot-client@2.1.0_vite@7.1.2__@types+node@24.2.1__picomatch@4.0.3_@types+node@24.2.1_@types+node@22.15.15"
]
},
"vite-hot-client@2.1.0_vite@7.0.6__@types+node@24.2.0__picomatch@4.0.3_@types+node@24.2.0": {
"vite-hot-client@2.1.0_vite@7.1.2__@types+node@24.2.1__picomatch@4.0.3_@types+node@24.2.1": {
"integrity": "sha512-7SpgZmU7R+dDnSmvXE1mfDtnHLHQSisdySVR7lO8ceAXvM0otZeuQQ6C8LrS5d/aYyP/QZ0hI0L+dIPrm4YlFQ==",
"dependencies": [
"vite@7.0.6_@types+node@24.2.0_picomatch@4.0.3"
"vite@7.1.2_@types+node@24.2.1_picomatch@4.0.3"
]
},
"vite-hot-client@2.1.0_vite@7.0.6__@types+node@24.2.0__picomatch@4.0.3_@types+node@24.2.0_@types+node@22.15.15": {
"vite-hot-client@2.1.0_vite@7.1.2__@types+node@24.2.1__picomatch@4.0.3_@types+node@24.2.1_@types+node@22.15.15": {
"integrity": "sha512-7SpgZmU7R+dDnSmvXE1mfDtnHLHQSisdySVR7lO8ceAXvM0otZeuQQ6C8LrS5d/aYyP/QZ0hI0L+dIPrm4YlFQ==",
"dependencies": [
"vite@7.0.6_@types+node@24.2.0_picomatch@4.0.3_@types+node@22.15.15"
"vite@7.1.2_@types+node@24.2.1_picomatch@4.0.3_@types+node@22.15.15"
]
},
"vite-plugin-inspect@11.3.2_vite@7.0.6__@types+node@24.2.0__picomatch@4.0.3_@types+node@24.2.0": {
"vite-plugin-inspect@11.3.2_vite@7.1.2__@types+node@24.2.1__picomatch@4.0.3_@types+node@24.2.1": {
"integrity": "sha512-nzwvyFQg58XSMAmKVLr2uekAxNYvAbz1lyPmCAFVIBncCgN9S/HPM+2UM9Q9cvc4JEbC5ZBgwLAdaE2onmQuKg==",
"dependencies": [
"ansis",
@@ -2794,11 +2659,11 @@
"perfect-debounce",
"sirv",
"unplugin-utils",
"vite@7.0.6_@types+node@24.2.0_picomatch@4.0.3",
"vite-dev-rpc@1.1.0_vite@7.0.6__@types+node@24.2.0__picomatch@4.0.3_@types+node@24.2.0"
"vite@7.1.2_@types+node@24.2.1_picomatch@4.0.3",
"vite-dev-rpc@1.1.0_vite@7.1.2__@types+node@24.2.1__picomatch@4.0.3_@types+node@24.2.1"
]
},
"vite-plugin-inspect@11.3.2_vite@7.0.6__@types+node@24.2.0__picomatch@4.0.3_@types+node@24.2.0_@types+node@22.15.15": {
"vite-plugin-inspect@11.3.2_vite@7.1.2__@types+node@24.2.1__picomatch@4.0.3_@types+node@24.2.1_@types+node@22.15.15": {
"integrity": "sha512-nzwvyFQg58XSMAmKVLr2uekAxNYvAbz1lyPmCAFVIBncCgN9S/HPM+2UM9Q9cvc4JEbC5ZBgwLAdaE2onmQuKg==",
"dependencies": [
"ansis",
@@ -2809,14 +2674,14 @@
"perfect-debounce",
"sirv",
"unplugin-utils",
"vite@7.0.6_@types+node@24.2.0_picomatch@4.0.3_@types+node@22.15.15",
"vite-dev-rpc@1.1.0_vite@7.0.6__@types+node@24.2.0__picomatch@4.0.3_@types+node@24.2.0_@types+node@22.15.15"
"vite@7.1.2_@types+node@24.2.1_picomatch@4.0.3_@types+node@22.15.15",
"vite-dev-rpc@1.1.0_vite@7.1.2__@types+node@24.2.1__picomatch@4.0.3_@types+node@24.2.1_@types+node@22.15.15"
]
},
"vite@7.0.6_@types+node@24.2.0_picomatch@4.0.3": {
"integrity": "sha512-MHFiOENNBd+Bd9uvc8GEsIzdkn1JxMmEeYX35tI3fv0sJBUTfW5tQsoaOwuY4KhBI09A3dUJ/DXf2yxPVPUceg==",
"vite@7.1.2_@types+node@24.2.1_picomatch@4.0.3": {
"integrity": "sha512-J0SQBPlQiEXAF7tajiH+rUooJPo0l8KQgyg4/aMunNtrOa7bwuZJsJbDWzeljqQpgftxuq5yNJxQ91O9ts29UQ==",
"dependencies": [
"@types/node@24.2.0",
"@types/node@24.2.1",
"esbuild",
"fdir",
"picomatch@4.0.3",
@@ -2828,12 +2693,12 @@
"fsevents"
],
"optionalPeers": [
"@types/node@24.2.0"
"@types/node@24.2.1"
],
"bin": true
},
"vite@7.0.6_@types+node@24.2.0_picomatch@4.0.3_@types+node@22.15.15": {
"integrity": "sha512-MHFiOENNBd+Bd9uvc8GEsIzdkn1JxMmEeYX35tI3fv0sJBUTfW5tQsoaOwuY4KhBI09A3dUJ/DXf2yxPVPUceg==",
"vite@7.1.2_@types+node@24.2.1_picomatch@4.0.3_@types+node@22.15.15": {
"integrity": "sha512-J0SQBPlQiEXAF7tajiH+rUooJPo0l8KQgyg4/aMunNtrOa7bwuZJsJbDWzeljqQpgftxuq5yNJxQ91O9ts29UQ==",
"dependencies": [
"@types/node@22.15.15",
"esbuild",
@@ -2956,7 +2821,7 @@
"dependencies": [
"jsr:@astral/astral@~0.5.3",
"jsr:@deno/doc@0.172",
"jsr:@deno/esbuild-plugin@^1.1.5",
"jsr:@deno/esbuild-plugin@^1.2.0",
"jsr:@fresh/build-id@1",
"jsr:@fresh/core@^2.0.0-alpha.37",
"jsr:@marvinh-test/fresh-island@^0.0.1",
@@ -3002,7 +2867,8 @@
},
"packages/fresh": {
"dependencies": [
"jsr:@std/fmt@^1.0.8"
"jsr:@std/fmt@^1.0.8",
"npm:@types/node@^24.2.1"
]
},
"packages/plugin-tailwindcss-v3": {
@@ -0,0 +1,59 @@
---
description: |
Error pages can be used to customize the page that is shown when an error occurs in the application.
---
Environment variables in Deno are typically read via `Deno.env.get()` or
`process.env.*` calls or via an `.env` file if the `--env-file` flag is used,
see
[how to use Environment Variables in Deno](https://docs.deno.com/runtime/reference/env_variables/).
On top of that Fresh automatically inlines all environment variables whose names
start with `FRESH_PUBLIC_` during bundling of islands.
> [info]: This inlining step occurs when building the app (`deno task build`).
> Environment variables inside islands cannot be read at runtime.
Example:
```sh Terminal
$ FRESH_PUBLIC_FOO=bar deno task dev
```
```tsx
export function MyIsland() {
const value = Deno.env.get("FRESH_PUBLIC_FOO");
return <h1>{value}</h1>;
}
```
This code when bundled will be turned into this:
```tsx
export function MyIsland() {
const value = "bar";
return <h1>{value}</h1>;
}
```
This way you can use specific environment variables in the browser.
> [warn]: To make inlining work the code needs to be analyzable by our plugins.
> This means that not all forms of reading an environment variable in Deno are
> supported, even if it's perfectly valid JavaScript code.
>
> ```ts MyIsland.tsx
> // CORRECT
> Deno.env.get("FRESH_PUBLIC_FOO");
> Deno.env.get("FRESH_PUBLIC_FOO");
> process.env.FRESH_PUBLIC_FOO;
>
> // WRONG
> const name = "FRESH_PUBLIC_FOO";
> Deno.env.get(name);
> process.env[name];
>
> // WRONG
> const obj = Deno.env.toObject();
> obj.FRESH_PUBLIC_FOO;
> ```
+1
View File
@@ -53,6 +53,7 @@ const toc: RawTableOfContents = {
["partials", "Partials", "link:canary"],
["forms", "Forms", "link:canary"],
["define", "Define Helpers", "link:canary"],
["environment-variables", "Environment Variables", "link:canary"],
],
},
deployment: {
+2 -1
View File
@@ -12,6 +12,7 @@
"./internal-dev": "./src/internals_dev.ts"
},
"imports": {
"@std/fmt": "jsr:@std/fmt@^1.0.8"
"@std/fmt": "jsr:@std/fmt@^1.0.8",
"@types/node": "npm:@types/node@^24.2.1"
}
}
+5 -1
View File
@@ -84,7 +84,11 @@ export async function bundleJs(
preactDebugger(PREACT_ENV),
buildIdPlugin(options.buildId),
windowsPathFixer(),
denoPlugin({ preserveJsx: true, debug: false }),
denoPlugin({
preserveJsx: true,
debug: false,
publicEnvVarPrefix: "FRESH_PUBLIC_",
}),
],
});
@@ -0,0 +1,52 @@
// deno-lint-ignore-file no-process-global
import { useSignal } from "@preact/signals";
import { useEffect } from "preact/hooks";
export interface EnvIslandProps {
id?: string;
}
export function EnvIsland(props: EnvIslandProps) {
const active = useSignal(false);
useEffect(() => {
active.value = true;
}, []);
const deno = Deno.env.get("FRESH_PUBLIC_TEST_FOO");
const deno2 = Deno.env.get("FRESH_PUBLIC_TEST_FOO");
// @ts-ignore f
const processEnv = process.env.FRESH_PUBLIC_TEST_FOO;
let denoPrivateEnv = "not ok";
try {
Deno.env.get("FRESH_PRIVATE_TEST_FOO");
} catch {
denoPrivateEnv = "ok";
}
let denoPrivateEnv2 = "not ok";
try {
Deno.env.get("FRESH_PRIVATE_TEST_FOO");
} catch {
denoPrivateEnv2 = "ok";
}
let processEnvPrivate = "not ok";
try {
process.env.FRESH_PRIVATE_TEST_FOO;
} catch {
processEnvPrivate = "ok";
}
return (
<div id={props.id} class={active.value ? "ready" : ""}>
<pre class="deno-env">{deno}</pre>
<pre class="deno-env-2">{deno2}</pre>
<pre class="process-env">{processEnv}</pre>
<pre class="deno-env-private">{denoPrivateEnv}</pre>
<pre class="deno-env-private-2">{denoPrivateEnv2}</pre>
<pre class="process-env-private">{processEnvPrivate}</pre>
</div>
);
}
+49
View File
@@ -28,7 +28,10 @@ import { FreshAttrs } from "./fixtures_islands/FreshAttrs.tsx";
import { FakeServer } from "../src/test_utils.ts";
import { PARTIAL_SEARCH_PARAM } from "../src/constants.ts";
import { ComputedSignal } from "./fixtures_islands/Computed.tsx";
import { EnvIsland } from "./fixtures_islands/EnvIsland.tsx";
Deno.env.set("FRESH_PUBLIC_TEST_FOO", "test-env-value");
Deno.env.set("FRESH_PRIVATE_TEST_FOO", "i-should-not-be-visible");
const allIslandCache = await buildProd({ islandDir: ALL_ISLAND_DIR });
const islandGroupCache = await buildProd({ root: ISLAND_GROUP_DIR });
@@ -689,6 +692,52 @@ Deno.test({
},
});
Deno.test({
name: "islands - inlines FRESH_PUBLIC_* env vars",
fn: async () => {
const app = testApp()
.get("/", (ctx) =>
ctx.render(
<Doc>
<EnvIsland id="test" />
</Doc>,
));
await withBrowserApp(app, async (page, address) => {
await page.goto(address, { waitUntil: "load" });
await page.locator(".ready").wait();
const denoEnv = await page.locator<HTMLDivElement>(".deno-env")
.evaluate((el) => el.textContent);
const denoEnv2 = await page.locator<HTMLDivElement>(".deno-env-2")
.evaluate((el) => el.textContent);
const processEnv = await page.locator<HTMLDivElement>(".process-env")
.evaluate((el) => el.textContent);
const denoEnvPrivate = await page.locator<HTMLDivElement>(
".deno-env-private",
)
.evaluate((el) => el.textContent);
const denoEnvPrivate2 = await page.locator<HTMLDivElement>(
".deno-env-private-2",
)
.evaluate((el) => el.textContent);
const processEnvPrivate = await page.locator<HTMLDivElement>(
".process-env-private",
)
.evaluate((el) => el.textContent);
expect(denoEnv).toEqual("test-env-value");
expect(denoEnv2).toEqual("test-env-value");
expect(processEnv).toEqual("test-env-value");
expect(denoEnvPrivate).toEqual("ok");
expect(denoEnvPrivate2).toEqual("ok");
expect(processEnvPrivate).toEqual("ok");
});
},
});
Deno.test({
name: "fsRoutes - load islands from group folder",
fn: async () => {