void 0.1.6 → 0.7.0
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/AGENT_PROMPT.md +15 -0
- package/README.md +62 -123
- package/dist/auth-BdsJ0Aff.d.mts +43 -0
- package/dist/auth-cmd-Dx8oPKZC.mjs +43 -0
- package/dist/auth-migrations-BAtAck2g.mjs +117 -0
- package/dist/better-auth-shared-C9_GHSkR.d.mts +71 -0
- package/dist/better-auth-shared-CdYmQGry.mjs +163 -0
- package/dist/cache-W82I8ihI.mjs +47 -0
- package/dist/cancel-deploy-BOBTqqh0.mjs +59 -0
- package/dist/cf-access-Dee5cXxL.mjs +22 -0
- package/dist/chunk-DJd-R1mw.mjs +34 -0
- package/dist/cli/cli.d.mts +1 -0
- package/dist/cli/cli.mjs +1807 -0
- package/dist/client-snXOjrp1.mjs +565 -0
- package/dist/collect-CjeZgz5D.mjs +55 -0
- package/dist/config-BIa9HwVX.mjs +573 -0
- package/dist/config-BzM9Dy7T.mjs +37 -0
- package/dist/config-CvHtTM0q.mjs +30 -0
- package/dist/create-project-BIA15W7z.mjs +90 -0
- package/dist/db-DsRoMcfN.mjs +895 -0
- package/dist/defer-DcxEsVH1.mjs +49 -0
- package/dist/delete-DAP6yDc7.mjs +64 -0
- package/dist/deploy-BPKblFx6.mjs +2424 -0
- package/dist/discover-B7FkXBLB.mjs +40 -0
- package/dist/dist-DUyXJLkq.mjs +2667 -0
- package/dist/dist-Dayj3gCK.mjs +1287 -0
- package/dist/domain-BGofcQ6I.mjs +79 -0
- package/dist/dotenv-DwO4ti0Z.mjs +173 -0
- package/dist/drizzle-NnudE_UN.mjs +232 -0
- package/dist/env-CyG3tvU0.mjs +301 -0
- package/dist/env-helpers-Dr9Y7RnE.d.mts +52 -0
- package/dist/env-raw-BDL4TvdN.mjs +32 -0
- package/dist/env-types-DknSA4SO.mjs +64 -0
- package/dist/env-validation-DJKjR_8q.mjs +163 -0
- package/dist/fetch-error-BQ8sZ5Nd.mjs +266 -0
- package/dist/fetch-error-CVZ5CGA-.d.mts +20 -0
- package/dist/gen-U0Ktr4Zd.mjs +761 -0
- package/dist/handler-B0ds0OHJ.d.mts +269 -0
- package/dist/head-P-egrtFE.d.mts +45 -0
- package/dist/headers-DCXc7mDs.mjs +279 -0
- package/dist/index.d.mts +32 -0
- package/dist/index.mjs +4695 -0
- package/dist/init-C7wS5iGP.mjs +2625 -0
- package/dist/link-p2R6NbgN.mjs +49 -0
- package/dist/list-Bfel-QLc.mjs +113 -0
- package/dist/log-DXdqnmhF.mjs +26 -0
- package/dist/login-CkcXUiIu.mjs +72 -0
- package/dist/logs-DmkrRvx6.mjs +98 -0
- package/dist/magic-string.es-D6g9UnIy.mjs +1011 -0
- package/dist/mcp-CaQzfeUi.mjs +373 -0
- package/dist/node-DDfXj10V.mjs +54 -0
- package/dist/output-BwlcIYSR.mjs +139 -0
- package/dist/pages/client.d.mts +198 -0
- package/dist/pages/client.mjs +980 -0
- package/dist/pages/head-client.d.mts +15 -0
- package/dist/pages/head-client.mjs +90 -0
- package/dist/pages/head.d.mts +2 -0
- package/dist/pages/head.mjs +112 -0
- package/dist/pages/index.d.mts +38 -0
- package/dist/pages/index.mjs +76 -0
- package/dist/pages/islands-plugin.d.mts +50 -0
- package/dist/pages/islands-plugin.mjs +195 -0
- package/dist/pages/prefetch.d.mts +31 -0
- package/dist/pages/prefetch.mjs +90 -0
- package/dist/pages/protocol.d.mts +3 -0
- package/dist/pages/protocol.mjs +193 -0
- package/dist/pages/serialize.d.mts +10 -0
- package/dist/pages/serialize.mjs +14 -0
- package/dist/pathe.M-eThtNZ-D-kmWkCS.mjs +150 -0
- package/dist/plugin-inference-oZ6Ybu2_.mjs +2447 -0
- package/dist/prepare-BAtWufvm.mjs +99 -0
- package/dist/preset-D4I73kT4.mjs +221 -0
- package/dist/project-TqORyHn8.mjs +72 -0
- package/dist/project-cmd-B7lQp3F3.mjs +67 -0
- package/dist/project-slug-CKam8lF9.mjs +11 -0
- package/dist/project-tsconfig-DfkESbDL.mjs +63 -0
- package/dist/protocol-BWzXs2A2.d.mts +34 -0
- package/dist/providers-B3aMxWzP.mjs +67 -0
- package/dist/resolve-project-Br5BR03U.mjs +29 -0
- package/dist/rollback-gyC59l7U.mjs +92 -0
- package/dist/route-types-DReF1gUY.mjs +255 -0
- package/dist/routes-stub.d.mts +55 -0
- package/dist/routes-stub.mjs +1 -0
- package/dist/runner-6Ep3fNQu.mjs +123 -0
- package/dist/runner-pg-D0wWHYnr.mjs +57 -0
- package/dist/runtime/ai.d.mts +127 -0
- package/dist/runtime/ai.mjs +348 -0
- package/dist/runtime/auth-client-react.d.mts +8 -0
- package/dist/runtime/auth-client-react.mjs +6 -0
- package/dist/runtime/auth-client-solid.d.mts +8 -0
- package/dist/runtime/auth-client-solid.mjs +6 -0
- package/dist/runtime/auth-client-svelte.d.mts +8 -0
- package/dist/runtime/auth-client-svelte.mjs +6 -0
- package/dist/runtime/auth-client-vue.d.mts +8 -0
- package/dist/runtime/auth-client-vue.mjs +6 -0
- package/dist/runtime/auth-client.d.mts +8 -0
- package/dist/runtime/auth-client.mjs +6 -0
- package/dist/runtime/auth.d.mts +2 -0
- package/dist/runtime/auth.mjs +22 -0
- package/dist/runtime/better-auth-pg.d.mts +11 -0
- package/dist/runtime/better-auth-pg.mjs +51 -0
- package/dist/runtime/better-auth.d.mts +11 -0
- package/dist/runtime/better-auth.mjs +33 -0
- package/dist/runtime/client.d.mts +6 -0
- package/dist/runtime/client.mjs +5 -0
- package/dist/runtime/db-pg.d.mts +2 -0
- package/dist/runtime/db-pg.mjs +1 -0
- package/dist/runtime/db.d.mts +17 -0
- package/dist/runtime/db.mjs +30 -0
- package/dist/runtime/drizzle-arktype.d.mts +1 -0
- package/dist/runtime/drizzle-arktype.mjs +2 -0
- package/dist/runtime/drizzle-valibot.d.mts +1 -0
- package/dist/runtime/drizzle-valibot.mjs +2 -0
- package/dist/runtime/drizzle-zod.d.mts +1 -0
- package/dist/runtime/drizzle-zod.mjs +2 -0
- package/dist/runtime/env-helpers.d.mts +2 -0
- package/dist/runtime/env-helpers.mjs +173 -0
- package/dist/runtime/env-public-client.d.mts +22 -0
- package/dist/runtime/env-public-client.mjs +54 -0
- package/dist/runtime/env-public.d.mts +143 -0
- package/dist/runtime/env-public.mjs +366 -0
- package/dist/runtime/env.d.mts +13 -0
- package/dist/runtime/env.mjs +51 -0
- package/dist/runtime/fetch-stream.d.mts +51 -0
- package/dist/runtime/fetch-stream.mjs +81 -0
- package/dist/runtime/fetch.d.mts +59 -0
- package/dist/runtime/fetch.mjs +18 -0
- package/dist/runtime/handler.d.mts +3 -0
- package/dist/runtime/handler.mjs +85 -0
- package/dist/runtime/isr.d.mts +26 -0
- package/dist/runtime/isr.mjs +43 -0
- package/dist/runtime/kv.d.mts +48 -0
- package/dist/runtime/kv.mjs +106 -0
- package/dist/runtime/log.d.mts +24 -0
- package/dist/runtime/log.mjs +31 -0
- package/dist/runtime/migration-handler-pg.d.mts +6 -0
- package/dist/runtime/migration-handler-pg.mjs +85 -0
- package/dist/runtime/migration-handler.d.mts +19 -0
- package/dist/runtime/migration-handler.mjs +92 -0
- package/dist/runtime/queues.d.mts +7 -0
- package/dist/runtime/queues.mjs +8 -0
- package/dist/runtime/remote/binding-handler.d.mts +15 -0
- package/dist/runtime/remote/binding-handler.mjs +208 -0
- package/dist/runtime/remote/index.d.mts +8 -0
- package/dist/runtime/remote/index.mjs +461 -0
- package/dist/runtime/response.d.mts +14 -0
- package/dist/runtime/response.mjs +30 -0
- package/dist/runtime/sandbox.d.mts +17 -0
- package/dist/runtime/sandbox.mjs +19 -0
- package/dist/runtime/schema-d1.d.mts +1 -0
- package/dist/runtime/schema-d1.mjs +2 -0
- package/dist/runtime/schema-pg.d.mts +1 -0
- package/dist/runtime/schema-pg.mjs +2 -0
- package/dist/runtime/seed.d.mts +30 -0
- package/dist/runtime/seed.mjs +6 -0
- package/dist/runtime/storage.d.mts +7 -0
- package/dist/runtime/storage.mjs +14 -0
- package/dist/runtime/validator.d.mts +2 -0
- package/dist/runtime/validator.mjs +72 -0
- package/dist/runtime/ws-server.d.mts +26 -0
- package/dist/runtime/ws-server.mjs +296 -0
- package/dist/runtime/ws.d.mts +123 -0
- package/dist/runtime/ws.mjs +103 -0
- package/dist/scan-Ba4hFwlH.mjs +324 -0
- package/dist/scan-C6HMEIdW.mjs +318 -0
- package/dist/secret-CeRSukgM.mjs +109 -0
- package/dist/skills-ipldjlKE.mjs +62 -0
- package/dist/standard-schema-9CRjx-uR.d.mts +42 -0
- package/dist/subcommand-prompt-BKjuNAPb.mjs +349 -0
- package/dist/sveltekit.d.mts +20 -0
- package/dist/sveltekit.mjs +61 -0
- package/dist/types-mHOEwpW4.d.mts +57 -0
- package/dist/validate-CaMavMxu.mjs +146 -0
- package/dist/yarn-pnp-BFqMV_bl.mjs +196 -0
- package/getting-started-prompt.txt +26 -0
- package/package.json +322 -30
- package/schema.json +364 -0
- package/skills/migrate-vite-cloudflare-to-void/SKILL.md +175 -0
- package/skills/void/SKILL.md +75 -0
- package/skills/void/command/void.md +7 -0
- package/skills/void/docs/guide/ai.md +235 -0
- package/skills/void/docs/guide/app-types.md +103 -0
- package/skills/void/docs/guide/auth.md +257 -0
- package/skills/void/docs/guide/database/d1.md +106 -0
- package/skills/void/docs/guide/database/postgresql.md +106 -0
- package/skills/void/docs/guide/database.md +418 -0
- package/skills/void/docs/guide/deployment.md +98 -0
- package/skills/void/docs/guide/edge/headers.md +79 -0
- package/skills/void/docs/guide/edge/prerendering.md +83 -0
- package/skills/void/docs/guide/edge/redirects.md +116 -0
- package/skills/void/docs/guide/edge/revalidation.md +131 -0
- package/skills/void/docs/guide/edge/rewrites.md +354 -0
- package/skills/void/docs/guide/edge/static-assets.md +72 -0
- package/skills/void/docs/guide/env-vars.md +298 -0
- package/skills/void/docs/guide/index.md +80 -0
- package/skills/void/docs/guide/jobs.md +91 -0
- package/skills/void/docs/guide/kv.md +107 -0
- package/skills/void/docs/guide/pages-routing/actions-and-forms.md +419 -0
- package/skills/void/docs/guide/pages-routing/head.md +130 -0
- package/skills/void/docs/guide/pages-routing/islands.md +405 -0
- package/skills/void/docs/guide/pages-routing/layouts.md +362 -0
- package/skills/void/docs/guide/pages-routing/loaders.md +267 -0
- package/skills/void/docs/guide/pages-routing/markdown.md +625 -0
- package/skills/void/docs/guide/pages-routing/overview.md +236 -0
- package/skills/void/docs/guide/pages-routing/view-transitions.md +140 -0
- package/skills/void/docs/guide/queues.md +140 -0
- package/skills/void/docs/guide/quickstart.md +233 -0
- package/skills/void/docs/guide/remote-dev.md +67 -0
- package/skills/void/docs/guide/sandboxes.md +82 -0
- package/skills/void/docs/guide/server-routing.md +246 -0
- package/skills/void/docs/guide/ssg.md +74 -0
- package/skills/void/docs/guide/ssr.md +105 -0
- package/skills/void/docs/guide/storage.md +67 -0
- package/skills/void/docs/guide/type-safety.md +179 -0
- package/skills/void/docs/guide/typed-fetch.md +113 -0
- package/skills/void/docs/guide/websockets.md +190 -0
- package/skills/void/docs/index.md +48 -0
- package/skills/void/docs/integrations/agents.md +84 -0
- package/skills/void/docs/integrations/cloudflare.md +284 -0
- package/skills/void/docs/integrations/frameworks/analog.md +182 -0
- package/skills/void/docs/integrations/frameworks/astro.md +197 -0
- package/skills/void/docs/integrations/frameworks/nuxt.md +164 -0
- package/skills/void/docs/integrations/frameworks/overview.md +136 -0
- package/skills/void/docs/integrations/frameworks/react-router.md +137 -0
- package/skills/void/docs/integrations/frameworks/sveltekit.md +191 -0
- package/skills/void/docs/integrations/frameworks/tanstack-start.md +140 -0
- package/skills/void/docs/integrations/hono.md +97 -0
- package/skills/void/docs/integrations/nodejs-bun-deno.md +210 -0
- package/skills/void/docs/node_modules/@iconify/vue/README.md +408 -0
- package/skills/void/docs/node_modules/@iconify/vue/offline/readme.md +5 -0
- package/skills/void/docs/node_modules/@voidzero-dev/vitepress-theme/README.md +103 -0
- package/skills/void/docs/node_modules/oxc-minify/README.md +78 -0
- package/skills/void/docs/node_modules/reka-ui/README.md +80 -0
- package/skills/void/docs/node_modules/vitepress/README.md +28 -0
- package/skills/void/docs/node_modules/vitepress/template/api-examples.md +49 -0
- package/skills/void/docs/node_modules/vitepress/template/index.md +28 -0
- package/skills/void/docs/node_modules/vitepress/template/markdown-examples.md +85 -0
- package/skills/void/docs/node_modules/vitepress-plugin-group-icons/README.md +101 -0
- package/skills/void/docs/node_modules/void/AGENTS.md +204 -0
- package/skills/void/docs/node_modules/void/AGENT_PROMPT.md +15 -0
- package/skills/void/docs/node_modules/void/README.md +89 -0
- package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/CHANGELOG.md +591 -0
- package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/README.md +375 -0
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/sandbox/README.md +174 -0
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/vite-plugin/README.md +37 -0
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/workers-types/README.md +135 -0
- package/skills/void/docs/node_modules/void/node_modules/@electric-sql/pglite/README.md +189 -0
- package/skills/void/docs/node_modules/void/node_modules/@hono/oauth-providers/CHANGELOG.md +143 -0
- package/skills/void/docs/node_modules/void/node_modules/@hono/oauth-providers/README.md +1272 -0
- package/skills/void/docs/node_modules/void/node_modules/@napi-rs/keyring/README.md +19 -0
- package/skills/void/docs/node_modules/void/node_modules/@types/better-sqlite3/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@types/node/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@types/pg/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@typescript/native-preview/README.md +22 -0
- package/skills/void/docs/node_modules/void/node_modules/@typescript/native-preview/vendor/vscode-jsonrpc/README.md +69 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/README.md +152 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@shikijs/engine-javascript/README.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@shikijs/transformers/README.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@types/node/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/gray-matter/CHANGELOG.md +24 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/gray-matter/README.md +565 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-exit/README.md +124 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-anchor/README.md +600 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-attrs/README.md +386 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-container/README.md +95 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-emoji/README.md +101 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/pathe/README.md +73 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/shiki/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tinyglobby/README.md +25 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tsdown/README.md +55 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite/LICENSE.md +2230 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite/README.md +20 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vue/README.md +58 -0
- package/skills/void/docs/node_modules/void/node_modules/arktype/README.md +165 -0
- package/skills/void/docs/node_modules/void/node_modules/better-auth/LICENSE.md +20 -0
- package/skills/void/docs/node_modules/void/node_modules/better-auth/README.md +32 -0
- package/skills/void/docs/node_modules/void/node_modules/better-sqlite3/README.md +99 -0
- package/skills/void/docs/node_modules/void/node_modules/blake3-jit/README.md +108 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-arktype/README.md +51 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-kit/README.md +79 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-orm/README.md +44 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-valibot/README.md +51 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-zod/README.md +65 -0
- package/skills/void/docs/node_modules/void/node_modules/es-module-lexer/README.md +390 -0
- package/skills/void/docs/node_modules/void/node_modules/estree-walker/README.md +48 -0
- package/skills/void/docs/node_modules/void/node_modules/hono/README.md +85 -0
- package/skills/void/docs/node_modules/void/node_modules/ignore/README.md +452 -0
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/CHANGELOG.md +76 -0
- package/{LICENSE → skills/void/docs/node_modules/void/node_modules/jsonc-parser/LICENSE.md} +21 -21
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/README.md +364 -0
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/SECURITY.md +41 -0
- package/skills/void/docs/node_modules/void/node_modules/magic-string/README.md +325 -0
- package/skills/void/docs/node_modules/void/node_modules/ofetch/README.md +398 -0
- package/skills/void/docs/node_modules/void/node_modules/pathe/README.md +73 -0
- package/skills/void/docs/node_modules/void/node_modules/pg/README.md +95 -0
- package/skills/void/docs/node_modules/void/node_modules/pglite-server/LICENSE.md +21 -0
- package/skills/void/docs/node_modules/void/node_modules/pglite-server/README.md +135 -0
- package/skills/void/docs/node_modules/void/node_modules/picocolors/README.md +21 -0
- package/skills/void/docs/node_modules/void/node_modules/tinyglobby/README.md +25 -0
- package/skills/void/docs/node_modules/void/node_modules/tsdown/README.md +55 -0
- package/skills/void/docs/node_modules/void/node_modules/valibot/LICENSE.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/valibot/README.md +94 -0
- package/skills/void/docs/node_modules/void/node_modules/vite/LICENSE.md +2230 -0
- package/skills/void/docs/node_modules/void/node_modules/vite/README.md +20 -0
- package/skills/void/docs/node_modules/void/node_modules/wrangler/README.md +63 -0
- package/skills/void/docs/node_modules/void/node_modules/zod/README.md +191 -0
- package/skills/void/docs/node_modules/void/skills/migrate-vite-cloudflare-to-void/SKILL.md +175 -0
- package/skills/void/docs/node_modules/void/skills/void/SKILL.md +75 -0
- package/skills/void/docs/node_modules/void/skills/void/command/void.md +7 -0
- package/skills/void/docs/reference/api.md +917 -0
- package/skills/void/docs/reference/cli.md +561 -0
- package/skills/void/docs/reference/config.md +408 -0
- package/skills/void/docs/reference/resource-inference.md +149 -0
- package/skills/void/docs/reference/structure.md +176 -0
- package/.npmignore +0 -29
- package/.travis.yml +0 -9
- package/favicon.ico +0 -0
- package/index.js +0 -14
- package/lib/Job.js +0 -150
- package/lib/Void.js +0 -99
- package/lib/scan.js +0 -19
- package/test/credentials.js +0 -20
- package/test/job.js +0 -64
- package/test/static/dir1/test6.html +0 -0
- package/test/static/dir2/test7.html +0 -0
- package/test/static/dir2/test8.html +0 -0
- package/test/static/dir2/test9.html +0 -0
- package/test/static/test1.html +0 -0
- package/test/static/test2.html +0 -0
- package/test/static/test3.html +0 -0
- package/test/void.js +0 -31
- /package/{test/static/dir1/test4.html → skills/void/docs/integrations/auth-providers.md} +0 -0
- /package/{test/static/dir1/test5.html → skills/void/docs/integrations/payment-processors.md} +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
//#region src/runtime/ws.ts
|
|
2
|
+
function defineRoom(definition) {
|
|
3
|
+
return {
|
|
4
|
+
...definition,
|
|
5
|
+
__kind: "room"
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
function defineWebSocket(definition) {
|
|
9
|
+
return {
|
|
10
|
+
...definition,
|
|
11
|
+
__kind: "socket"
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
var VoidSocket = class {
|
|
15
|
+
socket = null;
|
|
16
|
+
listeners = {
|
|
17
|
+
message: /* @__PURE__ */ new Set(),
|
|
18
|
+
open: /* @__PURE__ */ new Set(),
|
|
19
|
+
close: /* @__PURE__ */ new Set(),
|
|
20
|
+
error: /* @__PURE__ */ new Set()
|
|
21
|
+
};
|
|
22
|
+
buffer = [];
|
|
23
|
+
reconnectAttempts = 0;
|
|
24
|
+
closedByUser = false;
|
|
25
|
+
constructor(url, options) {
|
|
26
|
+
this.url = url;
|
|
27
|
+
this.options = options;
|
|
28
|
+
this.connect();
|
|
29
|
+
}
|
|
30
|
+
emit(type, value) {
|
|
31
|
+
for (const listener of this.listeners[type]) listener(value);
|
|
32
|
+
}
|
|
33
|
+
connect() {
|
|
34
|
+
const WebSocketCtor = globalThis.WebSocket;
|
|
35
|
+
if (!WebSocketCtor) throw new Error("ws: WebSocket is not available in this runtime.");
|
|
36
|
+
this.socket = new WebSocketCtor(this.url, this.options.protocols);
|
|
37
|
+
this.socket.addEventListener("open", () => {
|
|
38
|
+
this.reconnectAttempts = 0;
|
|
39
|
+
const queued = this.buffer.splice(0);
|
|
40
|
+
for (const item of queued) this.socket?.send(JSON.stringify(item));
|
|
41
|
+
this.emit("open", void 0);
|
|
42
|
+
});
|
|
43
|
+
this.socket.addEventListener("message", (event) => {
|
|
44
|
+
try {
|
|
45
|
+
this.emit("message", JSON.parse(event.data));
|
|
46
|
+
} catch (error) {
|
|
47
|
+
this.emit("error", error);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
this.socket.addEventListener("error", (error) => {
|
|
51
|
+
this.emit("error", error);
|
|
52
|
+
});
|
|
53
|
+
this.socket.addEventListener("close", (event) => {
|
|
54
|
+
this.emit("close", {
|
|
55
|
+
code: event.code,
|
|
56
|
+
reason: event.reason,
|
|
57
|
+
wasClean: event.wasClean
|
|
58
|
+
});
|
|
59
|
+
if (this.closedByUser || this.options.reconnect === false) return;
|
|
60
|
+
if (this.options.maxReconnectAttempts != null && this.reconnectAttempts >= this.options.maxReconnectAttempts) return;
|
|
61
|
+
this.reconnectAttempts += 1;
|
|
62
|
+
const delay = this.options.reconnectDelayMs ?? 1e3;
|
|
63
|
+
setTimeout(() => this.connect(), delay);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
send(event) {
|
|
67
|
+
if (this.socket?.readyState === 1) {
|
|
68
|
+
this.socket.send(JSON.stringify(event));
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
this.buffer.push(event);
|
|
72
|
+
}
|
|
73
|
+
close(code, reason) {
|
|
74
|
+
this.closedByUser = true;
|
|
75
|
+
this.socket?.close(code, reason);
|
|
76
|
+
}
|
|
77
|
+
on(type, handler) {
|
|
78
|
+
this.listeners[type].add(handler);
|
|
79
|
+
return () => {
|
|
80
|
+
this.listeners[type].delete(handler);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
function resolveBaseUrl(baseURL) {
|
|
85
|
+
if (baseURL) return new URL(baseURL);
|
|
86
|
+
const location = globalThis.location;
|
|
87
|
+
if (!location) throw new Error("ws: connect() requires a browser-like runtime or an explicit \"baseURL\".");
|
|
88
|
+
return new URL(location.href);
|
|
89
|
+
}
|
|
90
|
+
function interpolateParams(path, params) {
|
|
91
|
+
let resolved = path;
|
|
92
|
+
if (params) for (const [key, value] of Object.entries(params)) resolved = resolved.replace(`:${key}`, encodeURIComponent(value));
|
|
93
|
+
return resolved;
|
|
94
|
+
}
|
|
95
|
+
function connect(path, options = {}) {
|
|
96
|
+
const base = resolveBaseUrl(options.baseURL);
|
|
97
|
+
const resolvedPath = interpolateParams(path, options.params);
|
|
98
|
+
const url = new URL(resolvedPath, base);
|
|
99
|
+
url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
|
|
100
|
+
return new VoidSocket(url.toString(), options);
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
export { VoidSocket, connect, defineRoom, defineWebSocket };
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { a as join, n as dirname, r as extname, t as basename } from "./pathe.M-eThtNZ-D-kmWkCS.mjs";
|
|
2
|
+
import { t as glob } from "./dist-DUyXJLkq.mjs";
|
|
3
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
+
//#region src/router/parse-filename.ts
|
|
5
|
+
const EXTENSIONS = [
|
|
6
|
+
".ts",
|
|
7
|
+
".mts",
|
|
8
|
+
".js",
|
|
9
|
+
".mjs"
|
|
10
|
+
];
|
|
11
|
+
const ENV_SUFFIXES = ["dev", "prod"];
|
|
12
|
+
function parsePath(relativePath, isWebSocketRoute) {
|
|
13
|
+
const filePath = relativePath;
|
|
14
|
+
let path = relativePath.replace(/\\/g, "/");
|
|
15
|
+
for (const ext of EXTENSIONS) if (path.endsWith(ext)) {
|
|
16
|
+
path = path.slice(0, -ext.length);
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
if (isWebSocketRoute && path.endsWith(".ws")) path = path.slice(0, -3);
|
|
20
|
+
const segments = path.split("/");
|
|
21
|
+
let filename = segments.pop();
|
|
22
|
+
let env = null;
|
|
23
|
+
for (const suffix of ENV_SUFFIXES) if (filename.endsWith(`.${suffix}`)) {
|
|
24
|
+
env = suffix;
|
|
25
|
+
filename = filename.slice(0, -(suffix.length + 1));
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
segments.push(filename);
|
|
29
|
+
if (segments[segments.length - 1] === "index") segments.pop();
|
|
30
|
+
const filtered = segments.filter((s) => !s.startsWith("(") || !s.endsWith(")"));
|
|
31
|
+
const params = [];
|
|
32
|
+
let catchAll = false;
|
|
33
|
+
return {
|
|
34
|
+
pattern: "/" + filtered.map((segment) => {
|
|
35
|
+
if (segment.startsWith("[...") && segment.endsWith("]")) {
|
|
36
|
+
const paramName = segment.slice(4, -1);
|
|
37
|
+
catchAll = true;
|
|
38
|
+
if (paramName) {
|
|
39
|
+
params.push(paramName);
|
|
40
|
+
return `:${paramName}{.+}`;
|
|
41
|
+
}
|
|
42
|
+
return "*";
|
|
43
|
+
}
|
|
44
|
+
if (segment.startsWith("[") && segment.endsWith("]")) {
|
|
45
|
+
const paramName = segment.slice(1, -1);
|
|
46
|
+
params.push(paramName);
|
|
47
|
+
return `:${paramName}`;
|
|
48
|
+
}
|
|
49
|
+
return segment;
|
|
50
|
+
}).join("/"),
|
|
51
|
+
methods: [],
|
|
52
|
+
params,
|
|
53
|
+
catchAll,
|
|
54
|
+
env,
|
|
55
|
+
filePath
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Parse a route filename (relative to routes/) into a RouteDefinition.
|
|
60
|
+
*
|
|
61
|
+
* Rules (applied in order):
|
|
62
|
+
* 1. Strip file extension (.ts, .js, .mts, .mjs)
|
|
63
|
+
* 2. Check for env suffix (.dev, .prod) → strip and record
|
|
64
|
+
* 3. Strip trailing "index" segment
|
|
65
|
+
* 4. Remove route group directories: (groupname)
|
|
66
|
+
* 5. Convert [param] → :param, [...param] → :param{.+}, [...] → *
|
|
67
|
+
* 6. Prefix with /
|
|
68
|
+
*/
|
|
69
|
+
function parseRouteFilename(relativePath) {
|
|
70
|
+
return parsePath(relativePath, false);
|
|
71
|
+
}
|
|
72
|
+
/** Parse a `.ws.*` route filename into a regular route definition. */
|
|
73
|
+
function parseWebSocketFilename(relativePath) {
|
|
74
|
+
return parsePath(relativePath, true);
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/pages/layout-resolution.ts
|
|
78
|
+
function isNamedLayout(layout) {
|
|
79
|
+
return "name" in layout;
|
|
80
|
+
}
|
|
81
|
+
function toLayoutId(layout) {
|
|
82
|
+
if (isNamedLayout(layout)) return layout.directory ? `${layout.directory}/_layouts/${layout.name}` : `_layouts/${layout.name}`;
|
|
83
|
+
return layout.directory ? `${layout.directory}/layout` : "layout";
|
|
84
|
+
}
|
|
85
|
+
/** Resolve the layout chain for a component (innermost last) */
|
|
86
|
+
function resolveLayoutChain(componentId, layouts) {
|
|
87
|
+
const parts = componentId.split("/");
|
|
88
|
+
const chain = [];
|
|
89
|
+
const root = layouts.find((l) => l.directory === "");
|
|
90
|
+
if (root) chain.push(root);
|
|
91
|
+
let dir = "";
|
|
92
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
93
|
+
dir = dir ? `${dir}/${parts[i]}` : parts[i];
|
|
94
|
+
const layout = layouts.find((l) => l.directory === dir);
|
|
95
|
+
if (layout) chain.push(layout);
|
|
96
|
+
}
|
|
97
|
+
return chain;
|
|
98
|
+
}
|
|
99
|
+
/** Walk up directory tree to find closest _layouts/<name> */
|
|
100
|
+
function resolveNamedLayout(name, componentId, namedLayouts) {
|
|
101
|
+
const parts = componentId.split("/");
|
|
102
|
+
const dirs = [];
|
|
103
|
+
let dir = "";
|
|
104
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
105
|
+
dir = dir ? `${dir}/${parts[i]}` : parts[i];
|
|
106
|
+
dirs.push(dir);
|
|
107
|
+
}
|
|
108
|
+
dirs.reverse();
|
|
109
|
+
dirs.push("");
|
|
110
|
+
for (const d of dirs) {
|
|
111
|
+
const found = namedLayouts.find((nl) => nl.name === name && nl.directory === d);
|
|
112
|
+
if (found) return found;
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
function resolveEffectiveLayoutEntries(page, layouts, namedLayouts) {
|
|
117
|
+
if (page.layout === false) return [];
|
|
118
|
+
const defaultChain = resolveLayoutChain(page.componentId, layouts).map((layout) => ({
|
|
119
|
+
id: toLayoutId(layout),
|
|
120
|
+
definition: layout
|
|
121
|
+
}));
|
|
122
|
+
if (page.layout === void 0) return defaultChain;
|
|
123
|
+
const isExclusive = page.layout.startsWith("!");
|
|
124
|
+
const name = isExclusive ? page.layout.slice(1) : page.layout;
|
|
125
|
+
if (name.startsWith(".") || name.startsWith("/")) return defaultChain;
|
|
126
|
+
const resolved = resolveNamedLayout(name, page.componentId, namedLayouts);
|
|
127
|
+
if (!resolved) return defaultChain;
|
|
128
|
+
const namedEntry = {
|
|
129
|
+
id: toLayoutId(resolved),
|
|
130
|
+
definition: resolved
|
|
131
|
+
};
|
|
132
|
+
if (isExclusive) return [namedEntry];
|
|
133
|
+
if (defaultChain.length === 0) return [namedEntry];
|
|
134
|
+
const chain = [...defaultChain];
|
|
135
|
+
chain[chain.length - 1] = namedEntry;
|
|
136
|
+
return chain;
|
|
137
|
+
}
|
|
138
|
+
/** Resolve effective layout chain accounting for named layout selection */
|
|
139
|
+
function resolveEffectiveLayoutChain(page, layouts, namedLayouts) {
|
|
140
|
+
return resolveEffectiveLayoutEntries(page, layouts, namedLayouts).map((layout) => layout.definition);
|
|
141
|
+
}
|
|
142
|
+
function resolveLayoutIds(page, layouts, namedLayouts) {
|
|
143
|
+
return resolveEffectiveLayoutEntries(page, layouts, namedLayouts).map((layout) => layout.id);
|
|
144
|
+
}
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/pages/scan.ts
|
|
147
|
+
const COMPONENT_EXTENSIONS = [
|
|
148
|
+
"vue",
|
|
149
|
+
"tsx",
|
|
150
|
+
"jsx",
|
|
151
|
+
"svelte",
|
|
152
|
+
"md"
|
|
153
|
+
];
|
|
154
|
+
const SERVER_EXTENSIONS = [
|
|
155
|
+
"ts",
|
|
156
|
+
"tsx",
|
|
157
|
+
"js",
|
|
158
|
+
"mjs",
|
|
159
|
+
"mts"
|
|
160
|
+
];
|
|
161
|
+
const PAGES_EXPORT_RE = /export\s+(?:const|function|async\s+function)\s+(loader|actions?)\b/g;
|
|
162
|
+
const REVALIDATE_RE = /export\s+const\s+revalidate\s*=\s*(\d+)\s*;/;
|
|
163
|
+
const PRERENDER_RE = /export\s+const\s+prerender\s*=\s*true\s*;/;
|
|
164
|
+
const PRERENDER_FALSE_RE = /export\s+const\s+prerender\s*=\s*false\s*;/;
|
|
165
|
+
const GET_PRERENDER_PATHS_RE = /export\s+(?:async\s+)?function\s+getPrerenderPaths\b/;
|
|
166
|
+
const LAYOUT_STRING_RE = /export\s+const\s+layout\s*=\s*["']([^"']+)["']\s*;?/;
|
|
167
|
+
const LAYOUT_FALSE_RE = /export\s+const\s+layout\s*=\s*false\s*;?/;
|
|
168
|
+
const MAX_REVALIDATE = 31536e3;
|
|
169
|
+
async function scanPages(root, options) {
|
|
170
|
+
const pagesDir = join(root, "pages");
|
|
171
|
+
if (!existsSync(pagesDir)) return {
|
|
172
|
+
pages: [],
|
|
173
|
+
layouts: [],
|
|
174
|
+
namedLayouts: []
|
|
175
|
+
};
|
|
176
|
+
const files = await glob(`**/*.{${COMPONENT_EXTENSIONS.join(",")}}`, {
|
|
177
|
+
cwd: pagesDir,
|
|
178
|
+
absolute: false
|
|
179
|
+
});
|
|
180
|
+
const pages = [];
|
|
181
|
+
const layouts = [];
|
|
182
|
+
const namedLayouts = [];
|
|
183
|
+
for (const file of files) {
|
|
184
|
+
const segments = file.split("/");
|
|
185
|
+
if (segments.some((s) => s.startsWith("_") && s !== "_layouts")) continue;
|
|
186
|
+
const ext = extname(file);
|
|
187
|
+
let base = basename(file, ext);
|
|
188
|
+
let island;
|
|
189
|
+
let hasIslandSuffix = false;
|
|
190
|
+
if (base.endsWith(".island")) {
|
|
191
|
+
island = true;
|
|
192
|
+
hasIslandSuffix = true;
|
|
193
|
+
base = base.slice(0, -7);
|
|
194
|
+
}
|
|
195
|
+
if (ext === ".md") island = true;
|
|
196
|
+
const layoutsDirIdx = segments.indexOf("_layouts");
|
|
197
|
+
if (layoutsDirIdx !== -1) {
|
|
198
|
+
if (layoutsDirIdx === segments.length - 2) namedLayouts.push({
|
|
199
|
+
name: base,
|
|
200
|
+
directory: segments.slice(0, layoutsDirIdx).join("/") || "",
|
|
201
|
+
filePath: file,
|
|
202
|
+
island
|
|
203
|
+
});
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
if (base === "layout") {
|
|
207
|
+
const dir = dirname(file);
|
|
208
|
+
layouts.push({
|
|
209
|
+
directory: dir === "." ? "" : dir,
|
|
210
|
+
filePath: file,
|
|
211
|
+
island
|
|
212
|
+
});
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
const route = parseRouteFilename(hasIslandSuffix ? file.replace(`.island${ext}`, ".ts") : file.replace(ext, ".ts"));
|
|
216
|
+
const componentId = file.replace(ext, "").replace(/\.island$/, "").replace(/\/index$/, "").replace(/^index$/, "") || "index";
|
|
217
|
+
let serverPath = null;
|
|
218
|
+
const methods = [];
|
|
219
|
+
let revalidate;
|
|
220
|
+
let prerender;
|
|
221
|
+
let prerenderExplicitlyFalse = false;
|
|
222
|
+
let hasGetPrerenderPaths;
|
|
223
|
+
const serverBase = hasIslandSuffix ? file.replace(`.island${ext}`, "") : file.replace(ext, "");
|
|
224
|
+
for (const serverExt of SERVER_EXTENSIONS) {
|
|
225
|
+
const candidate = `${serverBase}.server.${serverExt}`;
|
|
226
|
+
if (existsSync(join(pagesDir, candidate))) {
|
|
227
|
+
serverPath = candidate;
|
|
228
|
+
const content = readFileSync(join(pagesDir, candidate), "utf-8");
|
|
229
|
+
for (const m of content.matchAll(PAGES_EXPORT_RE)) methods.push(m[1]);
|
|
230
|
+
const revalidateMatch = content.match(REVALIDATE_RE);
|
|
231
|
+
if (revalidateMatch) revalidate = Number(revalidateMatch[1]);
|
|
232
|
+
if (PRERENDER_RE.test(content)) prerender = true;
|
|
233
|
+
if (PRERENDER_FALSE_RE.test(content)) prerenderExplicitlyFalse = true;
|
|
234
|
+
if (GET_PRERENDER_PATHS_RE.test(content)) hasGetPrerenderPaths = true;
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (options?.output === "static") {
|
|
239
|
+
if (!prerenderExplicitlyFalse && prerender !== true) {
|
|
240
|
+
if (!(route.params.length > 0 || route.catchAll) || hasGetPrerenderPaths) prerender = true;
|
|
241
|
+
}
|
|
242
|
+
} else if (island && !methods.includes("loader") && route.params.length === 0 && !route.catchAll && !prerenderExplicitlyFalse) prerender = true;
|
|
243
|
+
if (prerender && revalidate === void 0) revalidate = MAX_REVALIDATE;
|
|
244
|
+
let metadata;
|
|
245
|
+
let layout;
|
|
246
|
+
if (ext === ".md") {
|
|
247
|
+
const mdContent = readFileSync(join(pagesDir, file), "utf-8");
|
|
248
|
+
metadata = extractFrontmatterMeta(mdContent);
|
|
249
|
+
layout = extractFrontmatterLayout(mdContent);
|
|
250
|
+
} else {
|
|
251
|
+
const componentContent = readFileSync(join(pagesDir, file), "utf-8");
|
|
252
|
+
const layoutStringMatch = componentContent.match(LAYOUT_STRING_RE);
|
|
253
|
+
if (layoutStringMatch) layout = layoutStringMatch[1];
|
|
254
|
+
else if (LAYOUT_FALSE_RE.test(componentContent)) layout = false;
|
|
255
|
+
}
|
|
256
|
+
pages.push({
|
|
257
|
+
pattern: route.pattern,
|
|
258
|
+
params: route.params,
|
|
259
|
+
catchAll: route.catchAll,
|
|
260
|
+
componentPath: file,
|
|
261
|
+
serverPath,
|
|
262
|
+
methods,
|
|
263
|
+
componentId,
|
|
264
|
+
revalidate,
|
|
265
|
+
prerender,
|
|
266
|
+
hasGetPrerenderPaths,
|
|
267
|
+
island,
|
|
268
|
+
metadata,
|
|
269
|
+
layout
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
pages.sort((a, b) => {
|
|
273
|
+
if (a.catchAll !== b.catchAll) return a.catchAll ? 1 : -1;
|
|
274
|
+
const aDynamic = a.pattern.includes(":");
|
|
275
|
+
if (aDynamic !== b.pattern.includes(":")) return aDynamic ? 1 : -1;
|
|
276
|
+
return a.pattern.localeCompare(b.pattern);
|
|
277
|
+
});
|
|
278
|
+
for (const page of pages) {
|
|
279
|
+
if (page.island) continue;
|
|
280
|
+
const dir = dirname(page.componentPath);
|
|
281
|
+
const segments = dir === "." ? [] : dir.split("/");
|
|
282
|
+
let current = "";
|
|
283
|
+
if (layouts.some((l) => l.directory === "" && l.island)) throw new Error(`pages: Regular page '${page.componentPath}' is under an island layout. Add a .island suffix.`);
|
|
284
|
+
for (const seg of segments) {
|
|
285
|
+
current = current ? `${current}/${seg}` : seg;
|
|
286
|
+
if (layouts.some((l) => l.directory === current && l.island)) throw new Error(`pages: Regular page '${page.componentPath}' is under an island layout. Add a .island suffix.`);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
for (const page of pages) {
|
|
290
|
+
if (page.layout === void 0 || page.layout === false) continue;
|
|
291
|
+
const name = page.layout.startsWith("!") ? page.layout.slice(1) : page.layout;
|
|
292
|
+
if (name.startsWith(".") || name.startsWith("/")) continue;
|
|
293
|
+
if (!resolveNamedLayout(name, page.componentId, namedLayouts)) throw new Error(`pages: Page '${page.componentPath}' specifies layout '${page.layout}', but _layouts/${name}.vue was not found in any ancestor directory.`);
|
|
294
|
+
}
|
|
295
|
+
return {
|
|
296
|
+
pages,
|
|
297
|
+
layouts,
|
|
298
|
+
namedLayouts
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
/** Extract title and description from YAML frontmatter in markdown source. */
|
|
302
|
+
function extractFrontmatterMeta(source) {
|
|
303
|
+
const match = source.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
304
|
+
if (!match) return;
|
|
305
|
+
const yaml = match[1];
|
|
306
|
+
const title = yaml.match(/^title:\s*(.+)$/m)?.[1]?.trim().replace(/^["']|["']$/g, "");
|
|
307
|
+
const description = yaml.match(/^description:\s*(.+)$/m)?.[1]?.trim().replace(/^["']|["']$/g, "");
|
|
308
|
+
if (!title && !description) return;
|
|
309
|
+
return {
|
|
310
|
+
title,
|
|
311
|
+
description
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
/** Extract layout field from YAML frontmatter in markdown source. */
|
|
315
|
+
function extractFrontmatterLayout(source) {
|
|
316
|
+
const match = source.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
317
|
+
if (!match) return;
|
|
318
|
+
const value = match[1].match(/^layout:\s*(.+)$/m)?.[1]?.trim().replace(/^["']|["']$/g, "");
|
|
319
|
+
if (!value) return;
|
|
320
|
+
if (value === "false") return false;
|
|
321
|
+
return value;
|
|
322
|
+
}
|
|
323
|
+
//#endregion
|
|
324
|
+
export { resolveNamedLayout as a, resolveLayoutIds as i, resolveEffectiveLayoutChain as n, parseRouteFilename as o, resolveLayoutChain as r, parseWebSocketFilename as s, scanPages as t };
|