void 0.10.13 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS_TEMPLATE.md +6 -0
- package/{skills/void/docs/node_modules/void/node_modules/pglite-server/LICENSE.md → LICENSE} +1 -1
- package/README.md +34 -8
- package/dist/{auth-qgMlYp7Z.d.mts → auth-DkcFflXV.d.mts} +10 -11
- package/dist/auth-W9WII-mN.mjs +630 -0
- package/dist/{auth-cmd-BqsdZJp5.mjs → auth-cmd-CAH62yDU.mjs} +4 -3
- package/dist/{auth-migrations-BTZ-ATvQ.mjs → auth-migrations-9vif1uj8.mjs} +53 -12
- package/dist/{better-auth-shared-BQooDxbw.mjs → better-auth-shared-CYw1T3k4.mjs} +7 -10
- package/dist/{better-auth-shared-DealXecJ.d.mts → better-auth-shared-DSCeohOK.d.mts} +10 -5
- package/dist/{build-cmd-Bujrv5q-.mjs → build-cmd-CJvZvPQO.mjs} +6 -4
- package/dist/{cache-C11V8Fxq.mjs → cache-BlNeQjuP.mjs} +9 -5
- package/dist/{cancel-deploy-fwFYF04b.mjs → cancel-deploy-CmlAZ9P6.mjs} +3 -2
- package/dist/cf-access-AJ1ehiFR.mjs +42 -0
- package/dist/cf-access-DsSsZUPr.mjs +67 -0
- package/dist/cli/cli.d.mts +1 -1
- package/dist/cli/cli.mjs +1735 -165
- package/dist/cli/env-schema-probe.d.mts +48 -61
- package/dist/cli/env-schema-probe.mjs +10 -58
- package/dist/{client-Gb71-XkG.mjs → client-Clirrol3.mjs} +120 -463
- package/dist/cloudflare-auth-B1QtTO1b.mjs +217 -0
- package/dist/cloudflare-cmd-B6_OZx2V.mjs +62 -0
- package/dist/cloudflare-connect-j5D4hhrG.mjs +56 -0
- package/dist/cloudflare-operations-CPTpRW6d.mjs +566 -0
- package/dist/{config-qHGgPuWT.mjs → config-BQFq7QvD.mjs} +75 -41
- package/dist/{config-CutEMNGJ.mjs → config-NOG_U1aK.mjs} +10 -15
- package/dist/connect-C04Wdy_h.mjs +79 -0
- package/dist/{create-project-DsYvl3TB.mjs → create-project-ChGZ1DFd.mjs} +26 -16
- package/dist/database-provider.d.mts +21 -0
- package/dist/database-provider.mjs +6 -0
- package/dist/{db-C0i0sYMS.mjs → db-D2d_mUsB.mjs} +612 -117
- package/dist/{delete-mh6p-zkQ.mjs → delete-D8GigDk8.mjs} +9 -6
- package/dist/{deploy-jBJT1fUT.mjs → deploy-iXZ3F0N6.mjs} +3252 -1995
- package/dist/dev-inbox-DkgRWLkW.mjs +307 -0
- package/dist/{discover-CJHyvYfR.mjs → discover-xvfrgJeo.mjs} +3 -3
- package/dist/{magic-string.es-ZQjdJFFn.mjs → dist-BR1quN_w.mjs} +570 -216
- package/dist/{dist-DaKKDf8D.mjs → dist-BrsS7cai.mjs} +17 -2
- package/dist/{dist-BuiRJkTd.mjs → dist-m40_XgNh.mjs} +48 -33
- package/dist/{domain-DiaNQbrl.mjs → domain-B1VmoSr0.mjs} +41 -4
- package/dist/dotenv-VQxupEUv.mjs +181 -0
- package/dist/edge.d.mts +2 -0
- package/dist/edge.mjs +2 -0
- package/dist/email-Ce6SQq-i.mjs +182 -0
- package/dist/email-uKyQYUVY.mjs +1016 -0
- package/dist/{entry-D7yy4xVH.mjs → entry-DU3oDoQ3.mjs} +2 -2
- package/dist/env-BcQzYgoG.mjs +73 -0
- package/dist/env-D4Emu-M_.mjs +95 -0
- package/dist/env-helpers-CyKtOBpj.d.mts +22 -0
- package/dist/env-public-D_6u46fX.d.mts +135 -0
- package/dist/{env-types-QBj-ndax.mjs → env-types-BNPhro-M.mjs} +2 -2
- package/dist/{env-validation-Dea3v3ej.mjs → env-validation-ENpMy6Ez.mjs} +68 -122
- package/dist/{gen-BzXf3Jh2.mjs → gen-DI2YwdBM.mjs} +70 -15
- package/dist/generate-RTK8_kK1.mjs +47 -0
- package/dist/{github-cmd-DKcGUNsj.mjs → github-cmd-xItS5Zwf.mjs} +39 -31
- package/dist/{handler-Cjh8uM3Y.d.mts → handler-D1hLsObx.d.mts} +124 -122
- package/dist/{head-nmvOgFjd.d.mts → head-Do8P4puT.d.mts} +9 -8
- package/dist/{headers-ChAADPQu.mjs → headers-D8QfRX9Y.mjs} +12 -10
- package/dist/inbound-2d0zi2yS.mjs +706 -0
- package/dist/inbound-afAcWeQ9.d.mts +363 -0
- package/dist/index.d.mts +61 -34
- package/dist/index.mjs +1012 -293
- package/dist/{init-7JCAcKNQ.mjs → init-BD-9THgn.mjs} +329 -271
- package/dist/link-RMdgjF1v.mjs +52 -0
- package/dist/{list-CPwFDZ_c.mjs → list-3F52R_yO.mjs} +37 -5
- package/dist/{runner-kapo9aPs.mjs → local-d1-D2I6Ox5F.mjs} +116 -6
- package/dist/{login-BT3H8PN3.mjs → login-pV69H-ZO.mjs} +17 -15
- package/dist/{logs-Bt313ax7.mjs → logs-DFHHD6wE.mjs} +16 -2
- package/dist/mime-BJD7d_qL.mjs +1216 -0
- package/dist/neon-DHwd2zvC.mjs +54 -0
- package/dist/{node-pRg81HqV.mjs → node-Dk3H2jmU.mjs} +29 -8
- package/dist/operator-cmd-DYWRbWUA.mjs +348 -0
- package/dist/{agents-CtgBYqld.mjs → output-tFQLLj26.mjs} +676 -211
- package/dist/{package-json-Cx1osYo6.mjs → package-json-CPoWX79C.mjs} +1 -1
- package/dist/pages/client.d.mts +43 -41
- package/dist/pages/client.mjs +40 -33
- package/dist/pages/head-client.d.mts +10 -12
- package/dist/pages/head.d.mts +1 -1
- package/dist/pages/index.d.mts +37 -14
- package/dist/pages/index.mjs +5 -5
- package/dist/pages/islands-plugin.d.mts +25 -27
- package/dist/pages/islands-plugin.mjs +6 -4
- package/dist/pages/prefetch.d.mts +6 -7
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +2 -1
- package/dist/pages/serialize.d.mts +7 -8
- package/dist/platform-cmd-DxJ2FRwR.mjs +123 -0
- package/dist/platform-domain-ChvbJkdy.mjs +228 -0
- package/dist/platform-lifecycle-DN4MzJF_.mjs +4450 -0
- package/dist/platform-management-Db2PXw0B.mjs +698 -0
- package/dist/platform-recovery-C_YO-tIs.mjs +99 -0
- package/dist/{plugin-inference-DMeavIJ6.mjs → plugin-inference-BDRfZngg.mjs} +35 -19
- package/dist/prepare-BfJvFUtJ.mjs +14 -0
- package/dist/{prepare-BvvgAz-3.mjs → prepare-CBetXvsN.mjs} +15 -24
- package/dist/{preset-BjyR3lzz.mjs → preset-lAy0B0BQ.mjs} +25 -212
- package/dist/{project-cmd-D_w-4w5B.mjs → project-cmd-Mo0V9yKS.mjs} +25 -12
- package/dist/{project-paths-BQd7OmIo.mjs → project-paths-SK8nMHPp.mjs} +3 -1
- package/dist/{project-tsconfig-B-QtXjLQ.mjs → project-tsconfig-Ql2XsSQp.mjs} +2 -2
- package/dist/{protocol-Bnb0LFp3.d.mts → protocol-C-pqYJjE.d.mts} +3 -4
- package/dist/{provision-CPx2ZxsH.mjs → provision-Blnstcm2.mjs} +78 -45
- package/dist/r2-conditions-D1Wk8i7b.mjs +30 -0
- package/dist/{requests-B8sZxaFM.mjs → requests-BcKOVpRg.mjs} +5 -3
- package/dist/{resolve-project-BBMtLLV9.mjs → resolve-project--Vxawf7z.mjs} +2 -2
- package/dist/rollback-Bx85-0xh.mjs +166 -0
- package/dist/{rolldown-runtime-DJK8HYOj.mjs → rolldown-runtime-rQ84J-ij.mjs} +1 -1
- package/dist/{route-types-z1jtHEi_.mjs → route-types-Da-DpyUp.mjs} +77 -25
- package/dist/routes-stub.d.mts +22 -23
- package/dist/runner-mysql-7BPUNGmL.mjs +61 -0
- package/dist/{runner-pg-CHM76xuC.mjs → runner-pg-BkEza-dX.mjs} +18 -6
- package/dist/runtime/ai.d.mts +21 -14
- package/dist/runtime/ai.mjs +5 -4
- package/dist/runtime/auth-client-react.d.mts +3 -5
- package/dist/runtime/auth-client-solid.d.mts +3 -5
- package/dist/runtime/auth-client-svelte.d.mts +3 -5
- package/dist/runtime/auth-client-vue.d.mts +3 -5
- package/dist/runtime/auth-client.d.mts +3 -5
- package/dist/runtime/auth.d.mts +1 -1
- package/dist/runtime/better-auth-mysql.d.mts +10 -0
- package/dist/runtime/better-auth-mysql.mjs +49 -0
- package/dist/runtime/better-auth-pg.d.mts +8 -9
- package/dist/runtime/better-auth-pg.mjs +2 -2
- package/dist/runtime/better-auth.d.mts +8 -9
- package/dist/runtime/better-auth.mjs +2 -2
- package/dist/runtime/client-react.d.mts +1 -1
- package/dist/runtime/client-solid.d.mts +1 -1
- package/dist/runtime/client-svelte.d.mts +1 -1
- package/dist/runtime/client-vue.d.mts +1 -1
- package/dist/runtime/client.d.mts +1 -1
- package/dist/runtime/db-mysql.d.mts +2 -0
- package/dist/runtime/db-mysql.mjs +1 -0
- package/dist/runtime/db.d.mts +10 -11
- package/dist/runtime/durable.d.mts +47 -0
- package/dist/runtime/durable.mjs +146 -0
- package/dist/runtime/email/testing.d.mts +112 -0
- package/dist/runtime/email/testing.mjs +283 -0
- package/dist/runtime/email.d.mts +30 -0
- package/dist/runtime/email.mjs +573 -0
- package/dist/runtime/env-helpers.d.mts +2 -2
- package/dist/runtime/env-helpers.mjs +5 -42
- package/dist/runtime/env-public-client.d.mts +10 -11
- package/dist/runtime/env-public-client.mjs +1 -1
- package/dist/runtime/env-public.d.mts +2 -2
- package/dist/runtime/env-public.mjs +104 -49
- package/dist/runtime/env.d.mts +19 -18
- package/dist/runtime/env.mjs +15 -2
- package/dist/runtime/fetch-stream.d.mts +20 -21
- package/dist/runtime/fetch.d.mts +15 -16
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/isr.d.mts +21 -22
- package/dist/runtime/isr.mjs +26 -8
- package/dist/runtime/kv.d.mts +9 -10
- package/dist/runtime/live-client.d.mts +5 -7
- package/dist/runtime/live-client.mjs +9 -7
- package/dist/runtime/live-server.d.mts +4 -5
- package/dist/runtime/live.d.mts +22 -24
- package/dist/runtime/live.mjs +1 -1
- package/dist/runtime/log.d.mts +16 -17
- package/dist/runtime/migration-handler-mysql.d.mts +4 -0
- package/dist/runtime/migration-handler-mysql.mjs +81 -0
- package/dist/runtime/migration-handler-pg.d.mts +2 -4
- package/dist/runtime/migration-handler.d.mts +5 -6
- package/dist/runtime/migration-handler.mjs +4 -3
- package/dist/runtime/queues.d.mts +3 -4
- package/dist/runtime/queues.mjs +2 -1
- package/dist/runtime/remote/binding-handler.d.mts +10 -12
- package/dist/runtime/remote/binding-handler.mjs +24 -3
- package/dist/runtime/remote/index.d.mts +5 -6
- package/dist/runtime/remote/index.mjs +21 -18
- package/dist/runtime/response.d.mts +10 -11
- package/dist/runtime/sandbox.d.mts +56 -55
- package/dist/runtime/sandbox.mjs +57 -49
- package/dist/runtime/schema-mysql.d.mts +1 -0
- package/dist/runtime/schema-mysql.mjs +2 -0
- package/dist/runtime/seed.d.mts +14 -9
- package/dist/runtime/sse-client.d.mts +6 -7
- package/dist/runtime/sse.d.mts +11 -12
- package/dist/runtime/storage.d.mts +3 -4
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws-server.d.mts +12 -12
- package/dist/runtime/ws-server.mjs +32 -4
- package/dist/runtime/ws.d.mts +19 -21
- package/dist/{scan-ChWt4pX1.mjs → scan-BMH4rzlv.mjs} +42 -19
- package/dist/{scan-NU4xKGci.mjs → scan-CpK-57ug.mjs} +5 -4
- package/dist/{secret-Dt32J6RI.mjs → secret-ByhJ9AMl.mjs} +62 -5
- package/dist/{skills-CLjN0uUO.mjs → skills-Q46GZMO-.mjs} +6 -4
- package/dist/sqlite-validation-BzKMWnO4.mjs +25 -0
- package/dist/{standard-schema-DJ0HW7QP.d.mts → standard-schema-Fo_vCAZh.d.mts} +6 -6
- package/dist/{subcommand-prompt-BzV8iQZo.mjs → subcommand-prompt-WfySCQ7S.mjs} +67 -48
- package/dist/sveltekit.d.mts +12 -11
- package/dist/sveltekit.mjs +1 -1
- package/dist/types-BAp5AEBU.d.mts +79 -0
- package/dist/types-CKWnYgfy.d.mts +1 -0
- package/dist/{validate-Cw_RLeTj.mjs → validate-tBBN_dXH.mjs} +4 -3
- package/dist/wrangler--imS8n0d.mjs +1796 -0
- package/dist/{yarn-pnp-DJn3SAHF.mjs → yarn-pnp-DxSInkzL.mjs} +1 -1
- package/package.json +79 -65
- package/schema.json +22 -3
- package/skills/void/SKILL.md +59 -2
- package/skills/void/docs/guide/ai.md +32 -14
- package/skills/void/docs/guide/app-types.md +6 -6
- package/skills/void/docs/guide/auth.md +14 -16
- package/skills/void/docs/guide/database/d1.md +6 -0
- package/skills/void/docs/guide/database/mysql.md +60 -0
- package/skills/void/docs/guide/database/postgresql.md +14 -9
- package/skills/void/docs/guide/database.md +39 -26
- package/skills/void/docs/guide/deployment.md +99 -25
- package/skills/void/docs/guide/durable-state.md +140 -0
- package/skills/void/docs/guide/edge/headers.md +5 -5
- package/skills/void/docs/guide/edge/prerendering.md +2 -0
- package/skills/void/docs/guide/edge/revalidation.md +21 -6
- package/skills/void/docs/guide/edge/rewrites.md +18 -14
- package/skills/void/docs/guide/edge/static-assets.md +12 -10
- package/skills/void/docs/guide/email.md +640 -0
- package/skills/void/docs/guide/env-migration.md +109 -0
- package/skills/void/docs/guide/env-vars.md +70 -248
- package/skills/void/docs/guide/index.md +15 -17
- package/skills/void/docs/guide/jobs.md +8 -5
- package/skills/void/docs/guide/live.md +7 -15
- package/skills/void/docs/guide/pages-routing/actions-and-forms.md +8 -4
- package/skills/void/docs/guide/pages-routing/islands.md +3 -3
- package/skills/void/docs/guide/pages-routing/loaders.md +6 -4
- package/skills/void/docs/guide/pages-routing/overview.md +7 -7
- package/skills/void/docs/guide/platform-administration.md +212 -0
- package/skills/void/docs/guide/platform-development.md +264 -0
- package/skills/void/docs/guide/queues.md +10 -10
- package/skills/void/docs/guide/quickstart.md +46 -67
- package/skills/void/docs/guide/remote-dev.md +8 -6
- package/skills/void/docs/guide/sandboxes.md +33 -16
- package/skills/void/docs/guide/self-hosted-platform.md +553 -0
- package/skills/void/docs/guide/server-routing.md +5 -5
- package/skills/void/docs/guide/sse.md +4 -4
- package/skills/void/docs/guide/ssg.md +5 -3
- package/skills/void/docs/guide/storage.md +2 -2
- package/skills/void/docs/guide/websockets.md +15 -7
- package/skills/void/docs/index.md +3 -3
- package/skills/void/docs/integrations/agents.md +6 -64
- package/skills/void/docs/integrations/cloudflare.md +165 -146
- package/skills/void/docs/integrations/frameworks/analog.md +4 -4
- package/skills/void/docs/integrations/frameworks/astro.md +5 -5
- package/skills/void/docs/integrations/frameworks/nuxt.md +5 -5
- package/skills/void/docs/integrations/frameworks/overview.md +3 -3
- package/skills/void/docs/integrations/frameworks/react-router.md +3 -3
- package/skills/void/docs/integrations/frameworks/sveltekit.md +3 -3
- package/skills/void/docs/integrations/frameworks/tanstack-start.md +2 -2
- package/skills/void/docs/integrations/nodejs-bun-deno.md +11 -4
- package/skills/void/docs/reference/api.md +42 -6
- package/skills/void/docs/reference/cli.md +665 -160
- package/skills/void/docs/reference/config.md +67 -27
- package/skills/void/docs/reference/resource-inference.md +13 -9
- package/skills/void/docs/reference/structure.md +9 -11
- package/AGENT_PROMPT.md +0 -19
- package/dist/cf-access-Bqw81xAf.mjs +0 -22
- package/dist/env-CZy5MorI.mjs +0 -299
- package/dist/env-helpers-z4stu8uc.d.mts +0 -52
- package/dist/env-mask-Dd47NbR6.mjs +0 -90
- package/dist/env-public-BfiLcMBk.d.mts +0 -140
- package/dist/link-CdGHSIy-.mjs +0 -45
- package/dist/mcp-DoM3_nhd.mjs +0 -377
- package/dist/project-paths-GpziKeQQ.d.mts +0 -25
- package/dist/providers-BNKRacMr.d.mts +0 -7
- package/dist/proxy-D-3_D-Gl.mjs +0 -5
- package/dist/rollback-CkvTFXx5.mjs +0 -90
- package/dist/runtime/isr-cache.d.mts +0 -207
- package/dist/runtime/isr-cache.mjs +0 -523
- package/dist/types-lLjNE9Qp.d.mts +0 -51
- package/getting-started-prompt.txt +0 -28
- package/skills/void/command/void.md +0 -7
- package/skills/void/docs/integrations/auth-providers.md +0 -0
- package/skills/void/docs/integrations/payment-processors.md +0 -0
- package/skills/void/docs/node_modules/@iconify/vue/README.md +0 -408
- package/skills/void/docs/node_modules/@iconify/vue/offline/readme.md +0 -5
- package/skills/void/docs/node_modules/@voidzero-dev/vitepress-theme/README.md +0 -103
- package/skills/void/docs/node_modules/oxc-minify/README.md +0 -78
- package/skills/void/docs/node_modules/reka-ui/README.md +0 -80
- package/skills/void/docs/node_modules/vitepress/README.md +0 -28
- package/skills/void/docs/node_modules/vitepress/template/api-examples.md +0 -49
- package/skills/void/docs/node_modules/vitepress/template/index.md +0 -28
- package/skills/void/docs/node_modules/vitepress/template/markdown-examples.md +0 -85
- package/skills/void/docs/node_modules/vitepress-plugin-group-icons/README.md +0 -101
- package/skills/void/docs/node_modules/void/AGENT_PROMPT.md +0 -19
- package/skills/void/docs/node_modules/void/CLAUDE.md +0 -221
- package/skills/void/docs/node_modules/void/README.md +0 -90
- package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/CHANGELOG.md +0 -685
- package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/README.md +0 -396
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/sandbox/README.md +0 -219
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/vite-plugin/README.md +0 -37
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/workers-types/README.md +0 -135
- package/skills/void/docs/node_modules/void/node_modules/@electric-sql/pglite/README.md +0 -189
- package/skills/void/docs/node_modules/void/node_modules/@hono/oauth-providers/CHANGELOG.md +0 -143
- package/skills/void/docs/node_modules/void/node_modules/@hono/oauth-providers/README.md +0 -1272
- package/skills/void/docs/node_modules/void/node_modules/@napi-rs/keyring/README.md +0 -19
- package/skills/void/docs/node_modules/void/node_modules/@types/better-sqlite3/README.md +0 -15
- package/skills/void/docs/node_modules/void/node_modules/@types/node/README.md +0 -15
- package/skills/void/docs/node_modules/void/node_modules/@types/pg/README.md +0 -15
- package/skills/void/docs/node_modules/void/node_modules/@types/proper-lockfile/README.md +0 -51
- package/skills/void/docs/node_modules/void/node_modules/@typescript/native-preview/README.md +0 -22
- package/skills/void/docs/node_modules/void/node_modules/@typescript/native-preview/vendor/vscode-jsonrpc/README.md +0 -69
- package/skills/void/docs/node_modules/void/node_modules/@void/md/README.md +0 -153
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@shikijs/engine-javascript/README.md +0 -9
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@shikijs/transformers/README.md +0 -9
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@types/node/README.md +0 -15
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/gray-matter/CHANGELOG.md +0 -24
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/gray-matter/README.md +0 -565
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-exit/README.md +0 -127
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-anchor/README.md +0 -600
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-attrs/README.md +0 -386
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-container/README.md +0 -95
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-emoji/README.md +0 -101
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-footnote/README.md +0 -135
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/pathslash/README.md +0 -64
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/shiki/README.md +0 -15
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tinyglobby/README.md +0 -25
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/AGENTS.md +0 -16
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/README.md +0 -220
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/build.md +0 -21
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/check.md +0 -35
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/create.md +0 -70
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/fmt.md +0 -20
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/index.md +0 -35
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/lint.md +0 -26
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/pack.md +0 -17
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/run.md +0 -364
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/staged.md +0 -15
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/test.md +0 -18
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/automatic-data-tracking.md +0 -145
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/build.md +0 -40
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/cache.md +0 -107
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/check.md +0 -60
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/ci.md +0 -62
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/commit-hooks.md +0 -60
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/create.md +0 -341
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/dev.md +0 -24
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/docker.md +0 -175
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/env.md +0 -167
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/fmt.md +0 -41
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/github-actions-cache.md +0 -165
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/ide-integration.md +0 -101
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/implode.md +0 -23
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/index.md +0 -134
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/install.md +0 -199
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/lint.md +0 -50
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/migrate-rules.md +0 -347
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/migrate.md +0 -197
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/monorepo.md +0 -176
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/pack.md +0 -69
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/run.md +0 -356
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/test.md +0 -35
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/troubleshooting.md +0 -108
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/upgrade.md +0 -101
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/vpx.md +0 -66
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/why.md +0 -39
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/index.md +0 -12
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/team.md +0 -35
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/templates/generator/README.md +0 -35
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/templates/monorepo/README.md +0 -29
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vue/README.md +0 -58
- package/skills/void/docs/node_modules/void/node_modules/arktype/README.md +0 -165
- package/skills/void/docs/node_modules/void/node_modules/better-auth/LICENSE.md +0 -20
- package/skills/void/docs/node_modules/void/node_modules/better-auth/README.md +0 -32
- package/skills/void/docs/node_modules/void/node_modules/better-sqlite3/README.md +0 -99
- package/skills/void/docs/node_modules/void/node_modules/blake3-jit/README.md +0 -108
- package/skills/void/docs/node_modules/void/node_modules/drizzle-arktype/README.md +0 -51
- package/skills/void/docs/node_modules/void/node_modules/drizzle-kit/README.md +0 -79
- package/skills/void/docs/node_modules/void/node_modules/drizzle-orm/README.md +0 -44
- package/skills/void/docs/node_modules/void/node_modules/drizzle-valibot/README.md +0 -51
- package/skills/void/docs/node_modules/void/node_modules/drizzle-zod/README.md +0 -65
- package/skills/void/docs/node_modules/void/node_modules/es-module-lexer/README.md +0 -403
- package/skills/void/docs/node_modules/void/node_modules/estree-walker/README.md +0 -48
- package/skills/void/docs/node_modules/void/node_modules/hono/README.md +0 -85
- package/skills/void/docs/node_modules/void/node_modules/ignore/README.md +0 -452
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/CHANGELOG.md +0 -76
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/LICENSE.md +0 -21
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/README.md +0 -364
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/SECURITY.md +0 -41
- package/skills/void/docs/node_modules/void/node_modules/magic-string/README.md +0 -325
- package/skills/void/docs/node_modules/void/node_modules/ofetch/README.md +0 -398
- package/skills/void/docs/node_modules/void/node_modules/pathslash/README.md +0 -64
- package/skills/void/docs/node_modules/void/node_modules/pg/README.md +0 -96
- package/skills/void/docs/node_modules/void/node_modules/pglite-server/README.md +0 -135
- package/skills/void/docs/node_modules/void/node_modules/picocolors/README.md +0 -21
- package/skills/void/docs/node_modules/void/node_modules/proper-lockfile/CHANGELOG.md +0 -108
- package/skills/void/docs/node_modules/void/node_modules/proper-lockfile/README.md +0 -183
- package/skills/void/docs/node_modules/void/node_modules/tinyglobby/README.md +0 -25
- package/skills/void/docs/node_modules/void/node_modules/valibot/LICENSE.md +0 -9
- package/skills/void/docs/node_modules/void/node_modules/valibot/README.md +0 -94
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/AGENTS.md +0 -16
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/README.md +0 -220
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/build.md +0 -21
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/check.md +0 -35
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/create.md +0 -70
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/fmt.md +0 -20
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/index.md +0 -35
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/lint.md +0 -26
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/pack.md +0 -17
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/run.md +0 -364
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/staged.md +0 -15
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/test.md +0 -18
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/automatic-data-tracking.md +0 -145
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/build.md +0 -40
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/cache.md +0 -107
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/check.md +0 -60
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/ci.md +0 -62
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/commit-hooks.md +0 -60
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/create.md +0 -341
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/dev.md +0 -24
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/docker.md +0 -175
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/env.md +0 -167
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/fmt.md +0 -41
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/github-actions-cache.md +0 -165
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/ide-integration.md +0 -101
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/implode.md +0 -23
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/index.md +0 -134
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/install.md +0 -199
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/lint.md +0 -50
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/migrate-rules.md +0 -347
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/migrate.md +0 -197
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/monorepo.md +0 -176
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/pack.md +0 -69
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/run.md +0 -356
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/test.md +0 -35
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/troubleshooting.md +0 -108
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/upgrade.md +0 -101
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/vpx.md +0 -66
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/why.md +0 -39
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/index.md +0 -12
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/team.md +0 -35
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/templates/generator/README.md +0 -35
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/templates/monorepo/README.md +0 -29
- package/skills/void/docs/node_modules/void/node_modules/wrangler/README.md +0 -63
- package/skills/void/docs/node_modules/void/node_modules/zod/README.md +0 -191
- package/skills/void/docs/node_modules/void/skills/migrate-vite-cloudflare-to-void/SKILL.md +0 -175
- package/skills/void/docs/node_modules/void/skills/void/SKILL.md +0 -76
- package/skills/void/docs/node_modules/void/skills/void/command/void.md +0 -7
- package/skills/void/docs/node_modules/void/test/e2e/README.md +0 -85
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="@cloudflare/workers-types" />
|
|
2
|
-
import { c as
|
|
3
|
-
import { a as _getSchemaDefaults, c as defineEnv, i as _getRegisteredSchema, l as env, n as EnvValidationReport, o as _hasRegisteredSchema, r as ValidatedEnv, s as _validateEnvOnce, t as EnvValidationError, u as validateAllEnv } from "../env-public-
|
|
2
|
+
import { a as number, c as url, i as json, n as boolean, o as oneOf, r as email, s as string, t as EnvSchema } from "../env-helpers-CyKtOBpj.mjs";
|
|
3
|
+
import { a as _getSchemaDefaults, c as defineEnv, i as _getRegisteredSchema, l as env, n as EnvValidationReport, o as _hasRegisteredSchema, r as ValidatedEnv, s as _validateEnvOnce, t as EnvValidationError, u as validateAllEnv } from "../env-public-D_6u46fX.mjs";
|
|
4
4
|
export { type EnvSchema, EnvValidationError, EnvValidationReport, ValidatedEnv, _getRegisteredSchema, _getSchemaDefaults, _hasRegisteredSchema, _validateEnvOnce, boolean, defineEnv, email, env, json, number, oneOf, string, url, validateAllEnv };
|
|
@@ -1,7 +1,61 @@
|
|
|
1
|
-
import { boolean, email, getSecretOverride, json, number, oneOf, string, url } from "./env-helpers.mjs";
|
|
2
|
-
import { n as isUnmaskActive, r as redactMessage } from "../env-mask-Dd47NbR6.mjs";
|
|
3
1
|
import { a as getRawRuntimeEnv } from "../env-raw-Cx8ElDdj.mjs";
|
|
4
2
|
import { getRuntimeEnv, isInternalBinding } from "./env.mjs";
|
|
3
|
+
import { boolean, email, json, number, oneOf, string, url } from "./env-helpers.mjs";
|
|
4
|
+
//#region src/shared/env-mask.ts
|
|
5
|
+
/**
|
|
6
|
+
* Secret redaction helpers for env-validation output.
|
|
7
|
+
*
|
|
8
|
+
* Values are redacted (replaced with `<redacted>`) whenever they flow into
|
|
9
|
+
* a user-visible string — `EnvValidationError` messages, CLI reports, the
|
|
10
|
+
* dev-server warning block. The key name is never masked (the user needs
|
|
11
|
+
* it to locate the offending entry).
|
|
12
|
+
*
|
|
13
|
+
* Server env values are production secrets by definition, so validator
|
|
14
|
+
* messages redact the raw input unconditionally. The old `.secret()` /
|
|
15
|
+
* `.public()` masking axis was removed because it did not control storage.
|
|
16
|
+
*
|
|
17
|
+
* Users can opt out of the guard for local debugging via
|
|
18
|
+
* `VOID_ENV_UNMASK=1` in the environment; that path prints a one-shot
|
|
19
|
+
* notice on stderr so the loosened output is visibly attributed.
|
|
20
|
+
*
|
|
21
|
+
* This module is a leaf — no imports from non-leaf modules, safe to reach
|
|
22
|
+
* from both the runtime (worker bundle) and the CLI host.
|
|
23
|
+
*/
|
|
24
|
+
/** Sentinel emitted in place of a redacted value. */
|
|
25
|
+
const REDACTED = "<redacted>";
|
|
26
|
+
/** Environment variable that disables redaction when set to `1`. */
|
|
27
|
+
const UNMASK_ENV_VAR = "VOID_ENV_UNMASK";
|
|
28
|
+
/** Replace raw input in validator messages, regardless of its name or shape. */
|
|
29
|
+
function redactMessage(rawValue, message, options = {}) {
|
|
30
|
+
if (options.unmask) return message;
|
|
31
|
+
if (typeof rawValue !== "string" || rawValue.length === 0) return message;
|
|
32
|
+
return message.split(rawValue).join(REDACTED);
|
|
33
|
+
}
|
|
34
|
+
let unmaskResolved = null;
|
|
35
|
+
let unmaskNoticeShown = false;
|
|
36
|
+
/**
|
|
37
|
+
* Resolve the effective unmask flag, consulting `process.env` exactly once
|
|
38
|
+
* per process. On the first affirmative read, we print a one-shot notice to
|
|
39
|
+
* stderr so CI logs clearly show the guard is off.
|
|
40
|
+
*/
|
|
41
|
+
function isUnmaskActive() {
|
|
42
|
+
if (unmaskResolved !== null) return unmaskResolved;
|
|
43
|
+
let active = false;
|
|
44
|
+
try {
|
|
45
|
+
active = globalThis.process?.env?.[UNMASK_ENV_VAR] === "1";
|
|
46
|
+
} catch {
|
|
47
|
+
active = false;
|
|
48
|
+
}
|
|
49
|
+
unmaskResolved = active;
|
|
50
|
+
if (active && !unmaskNoticeShown) {
|
|
51
|
+
unmaskNoticeShown = true;
|
|
52
|
+
try {
|
|
53
|
+
console.error(`[void/env] ${UNMASK_ENV_VAR}=1 is set — env validation errors will include raw values. Unset it before sharing logs.`);
|
|
54
|
+
} catch {}
|
|
55
|
+
}
|
|
56
|
+
return active;
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
5
59
|
//#region src/runtime/env-public.ts
|
|
6
60
|
/**
|
|
7
61
|
* Public env API — `void/env`.
|
|
@@ -31,9 +85,19 @@ import { getRuntimeEnv, isInternalBinding } from "./env.mjs";
|
|
|
31
85
|
* Bindings (`DB`, `KV`, `STORAGE`, `AI`, queue handlers) and other env keys
|
|
32
86
|
* not declared in the schema pass through unchanged.
|
|
33
87
|
*/
|
|
34
|
-
|
|
35
|
-
|
|
88
|
+
const ENV_REGISTRY_SYMBOL = Symbol.for("void.env.registry");
|
|
89
|
+
const registryGlobal = globalThis;
|
|
90
|
+
const registry = registryGlobal[ENV_REGISTRY_SYMBOL] ??= {
|
|
91
|
+
schema: null,
|
|
92
|
+
hasDefineEnvBeenCalled: false,
|
|
93
|
+
bootValidation: null
|
|
94
|
+
};
|
|
36
95
|
const validatedCache = /* @__PURE__ */ new WeakMap();
|
|
96
|
+
/** Vite embeds the same public build inputs into server and browser bundles. */
|
|
97
|
+
function getClientEnvValues() {
|
|
98
|
+
const values = import.meta.env;
|
|
99
|
+
return Object.fromEntries(Object.entries(values ?? {}).filter(([key]) => key.startsWith("VITE_")));
|
|
100
|
+
}
|
|
37
101
|
/**
|
|
38
102
|
* Register an env schema and return the typed `env` proxy.
|
|
39
103
|
*
|
|
@@ -46,13 +110,12 @@ const validatedCache = /* @__PURE__ */ new WeakMap();
|
|
|
46
110
|
* `import { env } from "~/env"` pattern.
|
|
47
111
|
*/
|
|
48
112
|
function defineEnv(schema) {
|
|
49
|
-
|
|
50
|
-
hasDefineEnvBeenCalled = true;
|
|
113
|
+
registry.schema = schema;
|
|
114
|
+
registry.hasDefineEnvBeenCalled = true;
|
|
51
115
|
for (const map of validatedCacheValues()) map.clear();
|
|
52
|
-
|
|
116
|
+
registry.bootValidation = null;
|
|
53
117
|
return env;
|
|
54
118
|
}
|
|
55
|
-
let bootValidationState = null;
|
|
56
119
|
/**
|
|
57
120
|
* Internal: validate the entire schema against the worker's actual env on
|
|
58
121
|
* the first request per isolate. Catches bad remote-secret values and
|
|
@@ -71,15 +134,19 @@ let bootValidationState = null;
|
|
|
71
134
|
* throw with guidance pointing back to this boot-time pre-validation.
|
|
72
135
|
*/
|
|
73
136
|
async function _validateEnvOnce(envValues) {
|
|
74
|
-
if (
|
|
75
|
-
if (!
|
|
137
|
+
if (registry.bootValidation) {
|
|
138
|
+
if (!registry.bootValidation.ok) throw registry.bootValidation.error;
|
|
76
139
|
return;
|
|
77
140
|
}
|
|
78
|
-
if (!
|
|
79
|
-
|
|
141
|
+
if (!registry.schema) {
|
|
142
|
+
registry.bootValidation = { ok: true };
|
|
80
143
|
return;
|
|
81
144
|
}
|
|
82
|
-
const
|
|
145
|
+
const values = {
|
|
146
|
+
...envValues ?? {},
|
|
147
|
+
...getClientEnvValues()
|
|
148
|
+
};
|
|
149
|
+
const report = await validateAllEnvWithValues(registry.schema, values);
|
|
83
150
|
if (report.valid) {
|
|
84
151
|
try {
|
|
85
152
|
const cacheKey = getRawRuntimeEnv();
|
|
@@ -94,14 +161,14 @@ async function _validateEnvOnce(envValues) {
|
|
|
94
161
|
if (!cache.has(key)) cache.set(key, value);
|
|
95
162
|
}
|
|
96
163
|
} catch {}
|
|
97
|
-
|
|
164
|
+
registry.bootValidation = { ok: true };
|
|
98
165
|
return;
|
|
99
166
|
}
|
|
100
167
|
const lines = ["Env validation failed at worker boot:"];
|
|
101
168
|
for (const key of report.missing) lines.push(` • ${key} is required but missing`);
|
|
102
169
|
for (const { key, messages } of report.invalid) lines.push(` • ${key}: ${messages.join("; ")}`);
|
|
103
170
|
const error = new EnvValidationError("__init__", [{ message: lines.join("\n") }]);
|
|
104
|
-
|
|
171
|
+
registry.bootValidation = {
|
|
105
172
|
ok: false,
|
|
106
173
|
error
|
|
107
174
|
};
|
|
@@ -113,7 +180,7 @@ function validatedCacheValues() {
|
|
|
113
180
|
const cacheList = [];
|
|
114
181
|
/** Internal: framework-only access to the registered schema (for plugin/CLI). */
|
|
115
182
|
function _getRegisteredSchema() {
|
|
116
|
-
return
|
|
183
|
+
return registry.schema;
|
|
117
184
|
}
|
|
118
185
|
/**
|
|
119
186
|
* Internal: returns `true` once `defineEnv()` has been called at least once,
|
|
@@ -122,13 +189,11 @@ function _getRegisteredSchema() {
|
|
|
122
189
|
* `defineEnv({})` (an intentional empty schema) from "never called".
|
|
123
190
|
*/
|
|
124
191
|
function _hasRegisteredSchema() {
|
|
125
|
-
return hasDefineEnvBeenCalled;
|
|
192
|
+
return registry.hasDefineEnvBeenCalled;
|
|
126
193
|
}
|
|
127
194
|
/**
|
|
128
195
|
* Internal: extract `.default(value)` values from the registered schema as
|
|
129
|
-
* stringified env values. Used
|
|
130
|
-
* `vars` so `c.env.X` and `process.env.X` see the same fallback that the
|
|
131
|
-
* typed `env.X` proxy returns.
|
|
196
|
+
* stringified env values. Used for explicit build-time client fallbacks.
|
|
132
197
|
*
|
|
133
198
|
* Detection is schema-agnostic: probe each validator with `undefined` and,
|
|
134
199
|
* if it succeeds with a non-undefined value, that value is the default.
|
|
@@ -136,14 +201,12 @@ function _hasRegisteredSchema() {
|
|
|
136
201
|
* Schema validator with intrinsic default behaviour. Async validators are
|
|
137
202
|
* skipped (we can't get a sync default).
|
|
138
203
|
*
|
|
139
|
-
* Keys with no default — required keys
|
|
140
|
-
* from the result so they don't shadow user `.env*` entries with empty
|
|
141
|
-
* strings.
|
|
204
|
+
* Keys with no default — required keys and plain `.optional()` keys — are omitted.
|
|
142
205
|
*/
|
|
143
206
|
function _getSchemaDefaults() {
|
|
144
207
|
const defaults = {};
|
|
145
|
-
if (!
|
|
146
|
-
for (const [key, validator] of Object.entries(
|
|
208
|
+
if (!registry.schema) return defaults;
|
|
209
|
+
for (const [key, validator] of Object.entries(registry.schema)) {
|
|
147
210
|
let result;
|
|
148
211
|
try {
|
|
149
212
|
result = validator["~standard"].validate(void 0);
|
|
@@ -163,17 +226,19 @@ var EnvValidationError = class extends Error {
|
|
|
163
226
|
issues;
|
|
164
227
|
constructor(key, issues) {
|
|
165
228
|
super(`Invalid env "${key}": ${issues.map((i) => i.message).join(", ")}`);
|
|
229
|
+
this.name = "EnvValidationError";
|
|
166
230
|
this.key = key;
|
|
167
231
|
this.issues = issues;
|
|
168
|
-
this.name = "EnvValidationError";
|
|
169
232
|
}
|
|
170
233
|
};
|
|
171
234
|
function readKey(key) {
|
|
172
235
|
const rawEnv = getRawRuntimeEnv();
|
|
173
236
|
if (isInternalBinding(key, rawEnv)) return;
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
const
|
|
237
|
+
const filtered = getRuntimeEnv();
|
|
238
|
+
const clientValues = getClientEnvValues();
|
|
239
|
+
const rawValue = Object.hasOwn(clientValues, key) ? clientValues[key] : filtered[key];
|
|
240
|
+
if (!registry.schema) return rawValue;
|
|
241
|
+
const validator = registry.schema[key];
|
|
177
242
|
if (!validator) return rawValue;
|
|
178
243
|
const cacheKey = rawEnv;
|
|
179
244
|
let cache = validatedCache.get(cacheKey);
|
|
@@ -187,13 +252,9 @@ function readKey(key) {
|
|
|
187
252
|
if (result instanceof Promise) throw new Error(`env: Async validator for '${key}' cannot be resolved synchronously. Proxy property access is synchronous, so async Standard Schema validators must be pre-resolved by calling \`_validateEnvOnce(env)\` at worker boot (Void splices this into the generated entry) or by awaiting \`validateAllEnv(env)\` before the first \`env.${key}\` read. Once pre-validated, the resolved value is cached and served synchronously here.`);
|
|
188
253
|
if (result.issues) {
|
|
189
254
|
const unmask = isUnmaskActive();
|
|
190
|
-
const override = getSecretOverride(validator);
|
|
191
255
|
throw new EnvValidationError(key, result.issues.map((i) => ({
|
|
192
256
|
...i,
|
|
193
|
-
message: redactMessage(
|
|
194
|
-
override,
|
|
195
|
-
unmask
|
|
196
|
-
})
|
|
257
|
+
message: redactMessage(rawValue, i.message, { unmask })
|
|
197
258
|
})));
|
|
198
259
|
}
|
|
199
260
|
cache.set(key, result.value);
|
|
@@ -217,10 +278,10 @@ const env = new Proxy({}, {
|
|
|
217
278
|
},
|
|
218
279
|
has(_target, key) {
|
|
219
280
|
if (typeof key === "symbol") return false;
|
|
220
|
-
return Reflect.has(getRuntimeEnv(), key);
|
|
281
|
+
return Object.hasOwn(getClientEnvValues(), key) || Reflect.has(getRuntimeEnv(), key);
|
|
221
282
|
},
|
|
222
283
|
ownKeys() {
|
|
223
|
-
return Reflect.ownKeys(getRuntimeEnv());
|
|
284
|
+
return [.../* @__PURE__ */ new Set([...Reflect.ownKeys(getRuntimeEnv()), ...Object.keys(getClientEnvValues())])];
|
|
224
285
|
},
|
|
225
286
|
getOwnPropertyDescriptor(_target, key) {
|
|
226
287
|
if (typeof key === "symbol") return;
|
|
@@ -232,7 +293,7 @@ const env = new Proxy({}, {
|
|
|
232
293
|
}
|
|
233
294
|
});
|
|
234
295
|
/**
|
|
235
|
-
* Validate an env record (
|
|
296
|
+
* Validate an env record (local dotenv, build inputs, or runtime bindings) against
|
|
236
297
|
* the registered schema. Used by the dev plugin (warnings), the deploy CLI
|
|
237
298
|
* (hard error), and `_validateEnvOnce` at worker boot.
|
|
238
299
|
*
|
|
@@ -240,13 +301,13 @@ const env = new Proxy({}, {
|
|
|
240
301
|
* arktype narrows, etc.). Callers already run in async contexts.
|
|
241
302
|
*/
|
|
242
303
|
async function validateAllEnv(envValues) {
|
|
243
|
-
if (!
|
|
304
|
+
if (!registry.schema) return {
|
|
244
305
|
valid: true,
|
|
245
306
|
missing: [],
|
|
246
307
|
invalid: [],
|
|
247
308
|
values: /* @__PURE__ */ new Map()
|
|
248
309
|
};
|
|
249
|
-
return await validateAllEnvWithValues(
|
|
310
|
+
return await validateAllEnvWithValues(registry.schema, envValues);
|
|
250
311
|
}
|
|
251
312
|
/**
|
|
252
313
|
* Internal: shared core that validates a schema against values and also
|
|
@@ -267,16 +328,10 @@ async function validateAllEnvWithValues(schema, envValues) {
|
|
|
267
328
|
if (result.issues) {
|
|
268
329
|
report.valid = false;
|
|
269
330
|
if (raw === void 0 || raw === null || raw === "") report.missing.push(key);
|
|
270
|
-
else {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
messages: result.issues.map((i) => redactMessage(key, raw, i.message, {
|
|
275
|
-
override,
|
|
276
|
-
unmask
|
|
277
|
-
}))
|
|
278
|
-
});
|
|
279
|
-
}
|
|
331
|
+
else report.invalid.push({
|
|
332
|
+
key,
|
|
333
|
+
messages: result.issues.map((i) => redactMessage(raw, i.message, { unmask }))
|
|
334
|
+
});
|
|
280
335
|
} else report.values.set(key, result.value);
|
|
281
336
|
}
|
|
282
337
|
return report;
|
package/dist/runtime/env.d.mts
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
-
|
|
3
2
|
//#region src/runtime/env-raw.d.ts
|
|
4
3
|
type RuntimeEnv = Record<string, unknown>;
|
|
5
4
|
//#endregion
|
|
6
5
|
//#region src/runtime/env.d.ts
|
|
7
|
-
|
|
6
|
+
/** @internal Reuse a resource only within the current runtime request. */
|
|
7
|
+
export declare function getRuntimeRequestResource<T>(key: object, initialize: () => T): T;
|
|
8
|
+
export declare function withRuntimeEnv<T>(env: unknown, fn: () => T): T;
|
|
8
9
|
/**
|
|
9
|
-
* Shared internal-binding predicate. A binding is framework-internal — and must
|
|
10
|
-
* never be exposed to user code — when it carries an internal prefix
|
|
11
|
-
* (`__VOID_`, `__PROJECT_`; always hidden) or is an exact-name internal (e.g.
|
|
12
|
-
* `ISR_CACHE`; hidden ONLY while ISR is active for the isolate). `rawEnv` is the
|
|
13
|
-
* unfiltered runtime env, consulted via {@link isIsrActive} to gate the
|
|
14
|
-
* exact-name check so a non-ISR app's own `ISR_CACHE` binding stays visible —
|
|
15
|
-
* matching the build-time `isr` gate on the generated `c.env` filter.
|
|
16
|
-
*
|
|
17
|
-
* Single source of truth for the runtime `env` filter here and the public
|
|
18
|
-
* `void/env` proxy (`env-public.ts`).
|
|
19
|
-
*/
|
|
20
|
-
declare function isInternalBinding(name: string, rawEnv: RuntimeEnv): boolean;
|
|
10
|
+
* Shared internal-binding predicate. A binding is framework-internal — and must
|
|
11
|
+
* never be exposed to user code — when it carries an internal prefix
|
|
12
|
+
* (`__VOID_`, `__PROJECT_`; always hidden) or is an exact-name internal (e.g.
|
|
13
|
+
* `ISR_CACHE`; hidden ONLY while ISR is active for the isolate). `rawEnv` is the
|
|
14
|
+
* unfiltered runtime env, consulted via {@link isIsrActive} to gate the
|
|
15
|
+
* exact-name check so a non-ISR app's own `ISR_CACHE` binding stays visible —
|
|
16
|
+
* matching the build-time `isr` gate on the generated `c.env` filter.
|
|
17
|
+
*
|
|
18
|
+
* Single source of truth for the runtime `env` filter here and the public
|
|
19
|
+
* `void/env` proxy (`env-public.ts`).
|
|
20
|
+
*/
|
|
21
|
+
export declare function isInternalBinding(name: string, rawEnv: RuntimeEnv): boolean;
|
|
21
22
|
/** Returns the runtime env with internal platform bindings hidden. */
|
|
22
|
-
declare function getRuntimeEnv(): RuntimeEnv;
|
|
23
|
-
declare function getRuntimeBinding<T = unknown>(name: string): T | undefined;
|
|
24
|
-
declare function requireRuntimeBinding<T = unknown>(name: string): T;
|
|
23
|
+
export declare function getRuntimeEnv(): RuntimeEnv;
|
|
24
|
+
export declare function getRuntimeBinding<T = unknown>(name: string): T | undefined;
|
|
25
|
+
export declare function requireRuntimeBinding<T = unknown>(name: string): T;
|
|
25
26
|
//#endregion
|
|
26
|
-
export {
|
|
27
|
+
export type { RuntimeEnv };
|
package/dist/runtime/env.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { a as getRawRuntimeEnv, i as envContext, n as INTERNAL_BINDING_PREFIXES, o as isIsrActive, r as asEnv, t as INTERNAL_BINDING_EXACT_NAMES } from "../env-raw-Cx8ElDdj.mjs";
|
|
2
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
3
|
//#region src/runtime/env.ts
|
|
3
4
|
/**
|
|
4
5
|
* Public runtime env API — exposed via "void/_env".
|
|
@@ -7,10 +8,22 @@ import { a as getRawRuntimeEnv, i as envContext, n as INTERNAL_BINDING_PREFIXES,
|
|
|
7
8
|
* Internal platform bindings (__VOID_*, __PROJECT_*) are filtered
|
|
8
9
|
* from getRuntimeEnv() and blocked in getRuntimeBinding().
|
|
9
10
|
*/
|
|
11
|
+
const runtimeRequestContext = new AsyncLocalStorage();
|
|
12
|
+
/** @internal Reuse a resource only within the current runtime request. */
|
|
13
|
+
function getRuntimeRequestResource(key, initialize) {
|
|
14
|
+
const scope = runtimeRequestContext.getStore();
|
|
15
|
+
if (!scope) throw new Error("env: Request-scoped resource is unavailable outside a runtime handler.");
|
|
16
|
+
if (scope.resources.has(key)) return scope.resources.get(key);
|
|
17
|
+
const resource = initialize();
|
|
18
|
+
scope.resources.set(key, resource);
|
|
19
|
+
return resource;
|
|
20
|
+
}
|
|
10
21
|
function withRuntimeEnv(env, fn) {
|
|
11
22
|
const resolved = asEnv(env);
|
|
12
23
|
if (!resolved) return fn();
|
|
13
|
-
return envContext.run(resolved, fn);
|
|
24
|
+
if (runtimeRequestContext.getStore()) return envContext.run(resolved, fn);
|
|
25
|
+
const scope = { resources: /* @__PURE__ */ new Map() };
|
|
26
|
+
return envContext.run(resolved, () => runtimeRequestContext.run(scope, fn));
|
|
14
27
|
}
|
|
15
28
|
/**
|
|
16
29
|
* Shared internal-binding predicate. A binding is framework-internal — and must
|
|
@@ -62,4 +75,4 @@ function requireRuntimeBinding(name) {
|
|
|
62
75
|
throw new Error(`env: Missing Cloudflare binding '${name}'.`);
|
|
63
76
|
}
|
|
64
77
|
//#endregion
|
|
65
|
-
export { getRuntimeBinding, getRuntimeEnv, isInternalBinding, requireRuntimeBinding, withRuntimeEnv };
|
|
78
|
+
export { getRuntimeBinding, getRuntimeEnv, getRuntimeRequestResource, isInternalBinding, requireRuntimeBinding, withRuntimeEnv };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { t as FetchError } from "../fetch-error-Sp1R4mZv.mjs";
|
|
2
2
|
import { RouteMap } from "void/routes";
|
|
3
|
-
|
|
4
3
|
//#region src/runtime/fetch-stream.d.ts
|
|
5
4
|
type MethodsOf<P extends keyof RouteMap> = keyof RouteMap[P] & string;
|
|
6
5
|
type InputOf<P extends keyof RouteMap, M extends MethodsOf<P>> = RouteMap[P][M] extends {
|
|
@@ -28,24 +27,24 @@ type StreamOptions<P extends keyof RouteMap, M extends MethodsOf<P>> = BodyOptio
|
|
|
28
27
|
baseURL?: string;
|
|
29
28
|
};
|
|
30
29
|
/**
|
|
31
|
-
* Consume an SSE endpoint as an async generator of text chunks.
|
|
32
|
-
*
|
|
33
|
-
* Parses Workers AI SSE format (`data: {"response":"chunk"}` + `data: [DONE]`)
|
|
34
|
-
* and plain text SSE (`data: some text`).
|
|
35
|
-
*
|
|
36
|
-
* ```ts
|
|
37
|
-
* import { fetchStream } from "void/client";
|
|
38
|
-
*
|
|
39
|
-
* for await (const chunk of fetchStream("/api/ai/chat", {
|
|
40
|
-
* method: "POST",
|
|
41
|
-
* body: { messages: [{ role: "user", content: "Hello" }] },
|
|
42
|
-
* })) {
|
|
43
|
-
* output += chunk;
|
|
44
|
-
* }
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* @yields {string} Text chunks from SSE data frames.
|
|
48
|
-
*/
|
|
49
|
-
declare function fetchStream<P extends keyof RouteMap & string, M extends MethodsOf<P> =
|
|
30
|
+
* Consume an SSE endpoint as an async generator of text chunks.
|
|
31
|
+
*
|
|
32
|
+
* Parses Workers AI SSE format (`data: {"response":"chunk"}` + `data: [DONE]`)
|
|
33
|
+
* and plain text SSE (`data: some text`).
|
|
34
|
+
*
|
|
35
|
+
* ```ts
|
|
36
|
+
* import { fetchStream } from "void/client";
|
|
37
|
+
*
|
|
38
|
+
* for await (const chunk of fetchStream("/api/ai/chat", {
|
|
39
|
+
* method: "POST",
|
|
40
|
+
* body: { messages: [{ role: "user", content: "Hello" }] },
|
|
41
|
+
* })) {
|
|
42
|
+
* output += chunk;
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @yields {string} Text chunks from SSE data frames.
|
|
47
|
+
*/
|
|
48
|
+
export declare function fetchStream<P extends keyof RouteMap & string, M extends MethodsOf<P> = "POST" extends MethodsOf<P> ? "POST" : MethodsOf<P>>(path: P, options?: StreamOptions<P, M>): AsyncGenerator<string, void, undefined>;
|
|
50
49
|
//#endregion
|
|
51
|
-
export { FetchError as StreamError
|
|
50
|
+
export { FetchError as StreamError };
|
package/dist/runtime/fetch.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { t as FetchError } from "../fetch-error-Sp1R4mZv.mjs";
|
|
2
2
|
import { RouteMap } from "void/routes";
|
|
3
|
-
|
|
4
3
|
//#region src/runtime/fetch.d.ts
|
|
5
4
|
type MethodsOf<P extends keyof RouteMap> = keyof RouteMap[P] & string;
|
|
6
5
|
type DefaultMethod<P extends keyof RouteMap> = "GET" extends MethodsOf<P> ? "GET" : never;
|
|
@@ -41,19 +40,19 @@ type FetchOptions<P extends keyof RouteMap, M extends MethodsOf<P>> = BodyOption
|
|
|
41
40
|
timeout?: number;
|
|
42
41
|
};
|
|
43
42
|
/**
|
|
44
|
-
* Typed fetch client for Void API routes.
|
|
45
|
-
*
|
|
46
|
-
* Built on top of ofetch. Supports baseURL, retry, timeout, and all
|
|
47
|
-
* ofetch features while providing full route type safety.
|
|
48
|
-
*
|
|
49
|
-
* ```ts
|
|
50
|
-
* import { fetch } from "void/client";
|
|
51
|
-
*
|
|
52
|
-
* const users = await fetch("/api/users"); // typed!
|
|
53
|
-
* const user = await fetch("/api/users/:id", { params: { id: "1" } });
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
declare function fetch<P extends keyof RouteMap & string>(path: HasRequiredInput<P, DefaultMethod<P>> extends false ? P : never): Promise<OutputOf<P, DefaultMethod<P>>>;
|
|
57
|
-
declare function fetch<P extends keyof RouteMap & string, M extends MethodsOf<P> = DefaultMethod<P>>(path: P, options: FetchOptions<P, M>): Promise<OutputOf<P, M>>;
|
|
43
|
+
* Typed fetch client for Void API routes.
|
|
44
|
+
*
|
|
45
|
+
* Built on top of ofetch. Supports baseURL, retry, timeout, and all
|
|
46
|
+
* ofetch features while providing full route type safety.
|
|
47
|
+
*
|
|
48
|
+
* ```ts
|
|
49
|
+
* import { fetch } from "void/client";
|
|
50
|
+
*
|
|
51
|
+
* const users = await fetch("/api/users"); // typed!
|
|
52
|
+
* const user = await fetch("/api/users/:id", { params: { id: "1" } });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function fetch<P extends keyof RouteMap & string>(path: HasRequiredInput<P, DefaultMethod<P>> extends false ? P : never): Promise<OutputOf<P, DefaultMethod<P>>>;
|
|
56
|
+
export declare function fetch<P extends keyof RouteMap & string, M extends MethodsOf<P> = DefaultMethod<P>>(path: P, options: FetchOptions<P, M>): Promise<OutputOf<P, M>>;
|
|
58
57
|
//#endregion
|
|
59
|
-
export { FetchError
|
|
58
|
+
export { FetchError };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="@cloudflare/workers-types" />
|
|
2
|
-
import { C as defer, E as ValidatorSlots, S as InferProps, T as HandlerInput, _ as defineQueue, a as CloudEnv, b as Deferred, c as QueueRetryOptions, d as TypedQueueHandler, f as VoidAssetRewriteError, g as defineMiddleware, h as defineHead, i as CloudContextVariables, l as RenderAssetTags, m as defineHandler, n as CloudBindings, o as QueueBatch, p as basicAuth, r as CloudContext, s as QueueMessage, t as BasicAuthOptions, u as TypedHandler, v as defineRender, w as ValidationError, y as defineScheduled } from "../handler-
|
|
2
|
+
import { C as defer, E as ValidatorSlots, S as InferProps, T as HandlerInput, _ as defineQueue, a as CloudEnv, b as Deferred, c as QueueRetryOptions, d as TypedQueueHandler, f as VoidAssetRewriteError, g as defineMiddleware, h as defineHead, i as CloudContextVariables, l as RenderAssetTags, m as defineHandler, n as CloudBindings, o as QueueBatch, p as basicAuth, r as CloudContext, s as QueueMessage, t as BasicAuthOptions, u as TypedHandler, v as defineRender, w as ValidationError, y as defineScheduled } from "../handler-D1hLsObx.mjs";
|
|
3
3
|
export { BasicAuthOptions, CloudBindings, CloudContext, CloudContextVariables, CloudEnv, type Deferred, type HandlerInput, type InferProps, QueueBatch, QueueMessage, QueueRetryOptions, RenderAssetTags, TypedHandler, TypedQueueHandler, ValidationError, type ValidatorSlots, VoidAssetRewriteError, basicAuth, defer, defineHandler, defineHead, defineMiddleware, defineQueue, defineRender, defineScheduled };
|
package/dist/runtime/isr.d.mts
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
//#region src/runtime/isr.d.ts
|
|
2
|
-
type RevalidateOptions = {
|
|
2
|
+
export type RevalidateOptions = {
|
|
3
3
|
paths?: Array<string>;
|
|
4
4
|
all?: boolean;
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
|
-
* Revalidate ISR-cached pages on demand.
|
|
8
|
-
*
|
|
9
|
-
* On managed Void, calls the platform proxy via service binding which forwards
|
|
10
|
-
* to the API for R2 deletion + edge cache purge. On self-host, purges this
|
|
11
|
-
* worker's own ISR_CACHE (KV) entries plus the caches.default edge variants.
|
|
12
|
-
* When neither is configured (e.g. local dev with no ISR), this is a no-op.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* import { revalidate } from "void/isr";
|
|
17
|
-
*
|
|
18
|
-
* // Revalidate specific paths
|
|
19
|
-
* await revalidate({ paths: ["/", "/blog/hello"] });
|
|
20
|
-
*
|
|
21
|
-
* // Revalidate all ISR pages
|
|
22
|
-
* await revalidate({ all: true });
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
declare function revalidate(options: RevalidateOptions): Promise<void>;
|
|
26
|
-
//#endregion
|
|
27
|
-
export { RevalidateOptions, revalidate };
|
|
7
|
+
* Revalidate ISR-cached pages on demand.
|
|
8
|
+
*
|
|
9
|
+
* On managed Void, calls the platform proxy via service binding which forwards
|
|
10
|
+
* to the API for R2 deletion + edge cache purge. On self-host, purges this
|
|
11
|
+
* worker's own ISR_CACHE (KV) entries plus the caches.default edge variants.
|
|
12
|
+
* When neither is configured (e.g. local dev with no ISR), this is a no-op.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { revalidate } from "void/isr";
|
|
17
|
+
*
|
|
18
|
+
* // Revalidate specific paths
|
|
19
|
+
* await revalidate({ paths: ["/", "/blog/hello"] });
|
|
20
|
+
*
|
|
21
|
+
* // Revalidate all ISR pages
|
|
22
|
+
* await revalidate({ all: true });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function revalidate(options: RevalidateOptions): Promise<void>;
|
|
26
|
+
//#endregion
|
package/dist/runtime/isr.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { a as getRawRuntimeEnv } from "../env-raw-Cx8ElDdj.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { isrEdgeCacheUrlForToken, splitIsrCacheKey } from "@void/isr";
|
|
3
|
+
import { denormalizeIsrPath, isrKey, isrPrefix, isrVariantPrefix, listIsrHosts } from "@void/isr/runtime";
|
|
3
4
|
//#region src/runtime/isr.ts
|
|
4
5
|
/**
|
|
5
6
|
* Revalidate ISR-cached pages on demand.
|
|
@@ -28,16 +29,31 @@ async function revalidate(options) {
|
|
|
28
29
|
const id = rawEnv.__VOID_ISR_DEPLOYMENT_ID;
|
|
29
30
|
if (!kv || !id) return;
|
|
30
31
|
const requestHost = rawEnv.__VOID_ISR_HOST;
|
|
31
|
-
const
|
|
32
|
-
await kv.delete(
|
|
32
|
+
const purgeKey = async (host, path, key, variantToken) => {
|
|
33
|
+
await kv.delete(key);
|
|
33
34
|
try {
|
|
34
35
|
const cache = caches.default;
|
|
35
|
-
await cache.delete(
|
|
36
|
-
await cache.delete(
|
|
36
|
+
await cache.delete(isrEdgeCacheUrlForToken(host, path, id, "html", variantToken));
|
|
37
|
+
await cache.delete(isrEdgeCacheUrlForToken(host, path, id, "json", variantToken));
|
|
37
38
|
} catch {}
|
|
38
39
|
};
|
|
40
|
+
const purgePath = async (host, path) => {
|
|
41
|
+
await purgeKey(host, path, isrKey(id, host, path), null);
|
|
42
|
+
let cursor;
|
|
43
|
+
do {
|
|
44
|
+
const list = await kv.list({
|
|
45
|
+
prefix: isrVariantPrefix(id, host, path),
|
|
46
|
+
cursor
|
|
47
|
+
});
|
|
48
|
+
for (const key of list.keys) {
|
|
49
|
+
const { variantToken } = splitIsrCacheKey(key.name);
|
|
50
|
+
await purgeKey(host, path, key.name, variantToken);
|
|
51
|
+
}
|
|
52
|
+
cursor = list.list_complete ? void 0 : list.cursor;
|
|
53
|
+
} while (cursor);
|
|
54
|
+
};
|
|
39
55
|
if (options.all) {
|
|
40
|
-
const prefix =
|
|
56
|
+
const prefix = isrPrefix(id);
|
|
41
57
|
let cursor;
|
|
42
58
|
do {
|
|
43
59
|
const list = await kv.list({
|
|
@@ -48,7 +64,9 @@ async function revalidate(options) {
|
|
|
48
64
|
const tail = key.name.slice(prefix.length);
|
|
49
65
|
const slash = tail.indexOf("/");
|
|
50
66
|
if (slash < 0) continue;
|
|
51
|
-
|
|
67
|
+
const host = tail.slice(0, slash);
|
|
68
|
+
const { normalizedPath, variantToken } = splitIsrCacheKey(tail.slice(slash + 1));
|
|
69
|
+
await purgeKey(host, denormalizeIsrPath(normalizedPath), key.name, variantToken);
|
|
52
70
|
}
|
|
53
71
|
cursor = list.list_complete ? void 0 : list.cursor;
|
|
54
72
|
} while (cursor);
|
|
@@ -57,7 +75,7 @@ async function revalidate(options) {
|
|
|
57
75
|
if (paths.length === 0) return;
|
|
58
76
|
const hosts = new Set(await listIsrHosts(kv, id));
|
|
59
77
|
if (requestHost) hosts.add(requestHost);
|
|
60
|
-
for (const host of hosts) for (const path of paths) await
|
|
78
|
+
for (const host of hosts) for (const path of paths) await purgePath(host, path);
|
|
61
79
|
}
|
|
62
80
|
return;
|
|
63
81
|
}
|
package/dist/runtime/kv.d.mts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
//#region src/runtime/kv.d.ts
|
|
2
|
-
type PutOptions = {
|
|
2
|
+
export type PutOptions = {
|
|
3
3
|
ttl?: number;
|
|
4
4
|
expiration?: number;
|
|
5
5
|
metadata?: Record<string, unknown>;
|
|
6
6
|
};
|
|
7
|
-
type ListOptions = {
|
|
7
|
+
export type ListOptions = {
|
|
8
8
|
prefix?: string;
|
|
9
9
|
limit?: number;
|
|
10
10
|
cursor?: string;
|
|
11
11
|
};
|
|
12
|
-
type ListKey<M = unknown> = {
|
|
12
|
+
export type ListKey<M = unknown> = {
|
|
13
13
|
name: string;
|
|
14
14
|
expiration?: number;
|
|
15
15
|
metadata?: M;
|
|
16
16
|
};
|
|
17
|
-
type ListResult<M = unknown> = {
|
|
17
|
+
export type ListResult<M = unknown> = {
|
|
18
18
|
keys: Array<ListKey<M>>;
|
|
19
19
|
list_complete: boolean;
|
|
20
20
|
cursor?: string;
|
|
21
21
|
};
|
|
22
|
-
type KVMap<T> = {
|
|
22
|
+
export type KVMap<T> = {
|
|
23
23
|
get(key: string): Promise<T | null>;
|
|
24
24
|
put(key: string, value: T, options?: PutOptions): Promise<void>;
|
|
25
25
|
delete(key: string): Promise<void>;
|
|
@@ -29,7 +29,7 @@ type KVMap<T> = {
|
|
|
29
29
|
metadata: M | null;
|
|
30
30
|
}>;
|
|
31
31
|
};
|
|
32
|
-
type KVClient = {
|
|
32
|
+
export type KVClient = {
|
|
33
33
|
get<T = string>(key: string): Promise<T | null>;
|
|
34
34
|
put(key: string, value: unknown, options?: PutOptions): Promise<void>;
|
|
35
35
|
delete(key: string): Promise<void>;
|
|
@@ -41,8 +41,7 @@ type KVClient = {
|
|
|
41
41
|
map<T = unknown>(prefix: string): KVMap<T>;
|
|
42
42
|
};
|
|
43
43
|
/** Create a KV client for a specific KVNamespace instance. */
|
|
44
|
-
declare function createKV(namespace: KVNamespace): KVClient;
|
|
44
|
+
export declare function createKV(namespace: KVNamespace): KVClient;
|
|
45
45
|
/** Default KV client — resolves `KV` from the active runtime environment. */
|
|
46
|
-
declare const kv: KVClient;
|
|
47
|
-
//#endregion
|
|
48
|
-
export { KVClient, KVMap, ListKey, ListOptions, ListResult, PutOptions, createKV, kv };
|
|
46
|
+
export declare const kv: KVClient;
|
|
47
|
+
//#endregion
|