void 0.7.12 → 0.8.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.
Files changed (142) hide show
  1. package/AGENT_PROMPT.md +1 -1
  2. package/README.md +2 -2
  3. package/dist/{agents-DqkFfc2c.mjs → agents-Dkgafwfr.mjs} +1 -1
  4. package/dist/{auth-cmd-bS88H4Lb.mjs → auth-cmd-B1-7r6ng.mjs} +3 -3
  5. package/dist/{better-auth-shared-D2JaoCs4.mjs → better-auth-shared-CbAF6sOM.mjs} +1 -1
  6. package/dist/{better-auth-shared-HXlHRw02.d.mts → better-auth-shared-Fzyk5yS1.d.mts} +2 -7
  7. package/dist/{cache-DUDCNty6.mjs → cache-CGYC-2LW.mjs} +5 -5
  8. package/dist/{cancel-deploy-DOuSbPwX.mjs → cancel-deploy-B4j31z7d.mjs} +4 -4
  9. package/dist/canonical-json-CEyQaVDa.mjs +13 -0
  10. package/dist/cli/cli.mjs +44 -31
  11. package/dist/{client-C_DYiXeu.mjs → client-C-nH6yz3.mjs} +5 -5
  12. package/dist/{collect-HqAuilH6.mjs → collect-9rO3JFNM.mjs} +1 -1
  13. package/dist/{config-DyUSwbeX.mjs → config--wXmVOoe.mjs} +10 -8
  14. package/dist/{config-CeRQg3Lz.mjs → config-BVEC0lti.mjs} +11 -2
  15. package/dist/{config-CvHtTM0q.mjs → config-hhMYPVRT.mjs} +3 -12
  16. package/dist/{create-project-hvFe6rbI.mjs → create-project-BGnQMy5N.mjs} +44 -18
  17. package/dist/{db-YEYSTfGw.mjs → db-CT5Xg6ds.mjs} +42 -37
  18. package/dist/{delete-XyM_VD9o.mjs → delete-eMGTHHB9.mjs} +5 -5
  19. package/dist/{deploy-CPAEgVQm.mjs → deploy-7EA_lKq9.mjs} +169 -99
  20. package/dist/{discover-CKGQpis8.mjs → discover-C8N1I4tK.mjs} +9 -6
  21. package/dist/{domain-Dvj7u8tr.mjs → domain-UfLrp2vc.mjs} +64 -22
  22. package/dist/{drizzle-Cx7cVwrE.mjs → drizzle-DmaANP4-.mjs} +1 -1
  23. package/dist/{env-Bjl0rzuf.mjs → env-Cvdbbm_N.mjs} +7 -7
  24. package/dist/{env-helpers-Dw95CU8e.d.mts → env-helpers-Bt9yYg5I.d.mts} +1 -1
  25. package/dist/{env-types-BSQghXbx.mjs → env-types-D6qI1ThV.mjs} +8 -19
  26. package/dist/{env-validation-Buy5pe3u.mjs → env-validation-DBJsxZLz.mjs} +4 -4
  27. package/dist/{gen-DU8NIdrH.mjs → gen-Cn2hZ8RR.mjs} +37 -31
  28. package/dist/{handler-DJTuxB10.d.mts → handler-BPhL8AmU.d.mts} +3 -3
  29. package/dist/{headers-CuVHn6Kl.mjs → headers-wAPJigtE.mjs} +3 -3
  30. package/dist/index.d.mts +3 -3
  31. package/dist/index.mjs +273 -104
  32. package/dist/{init-iIiQWzyB.mjs → init-DL6syXuF.mjs} +124 -38
  33. package/dist/{link-DdXqlUiJ.mjs → link-C5x1E-XZ.mjs} +5 -5
  34. package/dist/{list-9Bxa5Odn.mjs → list-ezL7hqDV.mjs} +5 -5
  35. package/dist/{login-C_MfDjhu.mjs → login-CkLr-AaI.mjs} +3 -3
  36. package/dist/{logs-DjqCpEER.mjs → logs-MnGILmLz.mjs} +4 -4
  37. package/dist/{mcp-vA0880_K.mjs → mcp-B84MmVAW.mjs} +3 -3
  38. package/dist/{node-gxRQXIRT.mjs → node-fpywdcbN.mjs} +6 -6
  39. package/dist/{output-D3g5otMC.mjs → output-DeiS4oEX.mjs} +1 -1
  40. package/dist/pages/client.d.mts +1 -1
  41. package/dist/pages/head-client.d.mts +1 -1
  42. package/dist/pages/head.d.mts +1 -1
  43. package/dist/pages/index.d.mts +28 -3
  44. package/dist/pages/index.mjs +6 -5
  45. package/dist/pages/islands-plugin.d.mts +1 -1
  46. package/dist/pages/islands-plugin.mjs +15 -14
  47. package/dist/pages/protocol.d.mts +2 -2
  48. package/dist/pages/protocol.mjs +1 -1
  49. package/dist/{pathe.M-eThtNZ-D-kmWkCS.mjs → pathe.M-eThtNZ-BrPhGF_K.mjs} +1 -1
  50. package/dist/plan-aD3wRDqF.mjs +271 -0
  51. package/dist/{plugin-inference-BexV6LL3.mjs → plugin-inference-Ba1uGdIy.mjs} +26 -20
  52. package/dist/{prepare-BEkH89oX.mjs → prepare-BrAISonG.mjs} +29 -19
  53. package/dist/{preset-CYQh93UF.mjs → preset-BRsCi8ZB.mjs} +10 -8
  54. package/dist/{project-DhB4A8_g.mjs → project-CH9pdo16.mjs} +1 -1
  55. package/dist/{project-cmd-CeXO06hG.mjs → project-cmd-JQUzv3qF.mjs} +10 -10
  56. package/dist/project-paths-CCMrHYQm.mjs +100 -0
  57. package/dist/{project-slug-KRvHQEQI.mjs → project-slug-De4UjtD9.mjs} +0 -1
  58. package/dist/{project-tsconfig-Bfy55qvs.mjs → project-tsconfig-HAGjfY6w.mjs} +10 -5
  59. package/dist/{protocol-D7r_deVZ.d.mts → protocol-mcSsdMij.d.mts} +3 -3
  60. package/dist/providers--_pvxpNN.d.mts +7 -0
  61. package/dist/{resolve-project-DdjLQ2tB.mjs → resolve-project-CNpUbUHd.mjs} +1 -1
  62. package/dist/{rollback-C8OSMxmq.mjs → rollback-CoAAvC18.mjs} +4 -4
  63. package/dist/{route-types-qVL-v-CB.mjs → route-types-jxRfWuCb.mjs} +1 -1
  64. package/dist/{runner-C0d3lJo1.mjs → runner-BkGBfr4e.mjs} +4 -2
  65. package/dist/{runner-pg-Bd_172vF.mjs → runner-pg-BXP0JpHW.mjs} +1 -1
  66. package/dist/runtime/ai.mjs +2 -2
  67. package/dist/runtime/auth.d.mts +1 -1
  68. package/dist/runtime/better-auth-pg.d.mts +1 -1
  69. package/dist/runtime/better-auth-pg.mjs +2 -2
  70. package/dist/runtime/better-auth.d.mts +1 -1
  71. package/dist/runtime/better-auth.mjs +2 -2
  72. package/dist/runtime/client.d.mts +2 -2
  73. package/dist/runtime/client.mjs +1 -1
  74. package/dist/runtime/env-helpers.d.mts +1 -1
  75. package/dist/runtime/env-public-client.d.mts +1 -1
  76. package/dist/runtime/env-public.d.mts +2 -2
  77. package/dist/runtime/env-public.mjs +1 -1
  78. package/dist/runtime/env.mjs +1 -1
  79. package/dist/runtime/fetch-stream.d.mts +1 -1
  80. package/dist/runtime/fetch-stream.mjs +1 -1
  81. package/dist/runtime/fetch.d.mts +1 -1
  82. package/dist/runtime/fetch.mjs +1 -1
  83. package/dist/runtime/handler.d.mts +1 -1
  84. package/dist/runtime/handler.mjs +1 -1
  85. package/dist/runtime/isr.mjs +1 -1
  86. package/dist/runtime/live.d.mts +2 -2
  87. package/dist/runtime/live.mjs +1 -1
  88. package/dist/runtime/migration-handler.d.mts +33 -1
  89. package/dist/runtime/migration-handler.mjs +398 -23
  90. package/dist/runtime/remote/index.mjs +1 -1
  91. package/dist/runtime/sandbox.d.mts +73 -3
  92. package/dist/runtime/sandbox.mjs +239 -3
  93. package/dist/runtime/validator.d.mts +1 -1
  94. package/dist/runtime/ws-server.d.mts +2 -2
  95. package/dist/runtime/ws.d.mts +3 -3
  96. package/dist/{scan-CKpylFj9.mjs → scan-2YmJkYAf.mjs} +4 -3
  97. package/dist/{scan-CkK1Hzpa.mjs → scan-DzzHqtiT.mjs} +82 -43
  98. package/dist/{secret-NDvlqAN2.mjs → secret-mz8t_CML.mjs} +5 -5
  99. package/dist/{skills-SAG0WyVn.mjs → skills-B_ynF4lA.mjs} +3 -3
  100. package/dist/{subcommand-prompt-q9T06dpg.mjs → subcommand-prompt-CPuV7tPW.mjs} +2 -2
  101. package/dist/sveltekit.mjs +1 -1
  102. package/dist/{validate-DW3ViKTA.mjs → validate-CNWm-PsL.mjs} +49 -9
  103. package/dist/{yarn-pnp-6LD6_3Ej.mjs → yarn-pnp-QgEYVC3V.mjs} +1 -1
  104. package/getting-started-prompt.txt +2 -2
  105. package/package.json +3 -2
  106. package/schema.json +5 -0
  107. package/skills/void/SKILL.md +1 -1
  108. package/skills/void/docs/guide/ai.md +1 -1
  109. package/skills/void/docs/guide/app-types.md +1 -1
  110. package/skills/void/docs/guide/database/postgresql.md +1 -1
  111. package/skills/void/docs/guide/edge/headers.md +1 -1
  112. package/skills/void/docs/guide/edge/static-assets.md +34 -0
  113. package/skills/void/docs/guide/pages-routing/overview.md +1 -1
  114. package/skills/void/docs/guide/quickstart.md +2 -2
  115. package/skills/void/docs/guide/sandboxes.md +3 -2
  116. package/skills/void/docs/guide/ssr.md +25 -2
  117. package/skills/void/docs/integrations/cloudflare.md +5 -3
  118. package/skills/void/docs/integrations/frameworks/overview.md +1 -1
  119. package/skills/void/docs/integrations/nodejs-bun-deno.md +10 -9
  120. package/skills/void/docs/node_modules/void/AGENT_PROMPT.md +1 -1
  121. package/skills/void/docs/node_modules/void/README.md +2 -2
  122. package/skills/void/docs/node_modules/void/skills/void/SKILL.md +1 -1
  123. package/skills/void/docs/reference/api.md +204 -13
  124. package/skills/void/docs/reference/cli.md +55 -7
  125. package/skills/void/docs/reference/config.md +27 -4
  126. package/skills/void/docs/reference/resource-inference.md +1 -1
  127. /package/dist/{auth-DmuALf16.d.mts → auth-SfRBhXan.d.mts} +0 -0
  128. /package/dist/{auth-migrations-BwLPwRgH.mjs → auth-migrations-BqJoGqGQ.mjs} +0 -0
  129. /package/dist/{cf-access-BW8K93Fm.mjs → cf-access-DKDsgwOU.mjs} +0 -0
  130. /package/dist/{defer-2ARBu8Et.mjs → defer-DkoEwda-.mjs} +0 -0
  131. /package/dist/{dist-q8b2Mjgb.mjs → dist-DR9sIMbM.mjs} +0 -0
  132. /package/dist/{dist-D2L3_KTK.mjs → dist-abzUneor.mjs} +0 -0
  133. /package/dist/{dotenv-HQNhRalS.mjs → dotenv-Bkoqyq9r.mjs} +0 -0
  134. /package/dist/{env-raw-DtfQ9E31.mjs → env-raw-zk5JQKZe.mjs} +0 -0
  135. /package/dist/{fetch-error-DZ868Xq4.d.mts → fetch-error-BbixZ9vW.d.mts} +0 -0
  136. /package/dist/{fetch-error-CEr0ACTl.mjs → fetch-error-rXermVU3.mjs} +0 -0
  137. /package/dist/{head-C7QW7UY1.d.mts → head-CZs8dMxG.d.mts} +0 -0
  138. /package/dist/{log-7ChR5Fbc.mjs → log-CWWZV4V1.mjs} +0 -0
  139. /package/dist/{magic-string.es-DS_lmuBe.mjs → magic-string.es-C1Fb0uxq.mjs} +0 -0
  140. /package/dist/{providers-BlFNPYen.mjs → providers-uC0PJg1c.mjs} +0 -0
  141. /package/dist/{standard-schema-D2qvCEYV.d.mts → standard-schema-WhHcCaqJ.d.mts} +0 -0
  142. /package/dist/{types-DG_Ynnyd.d.mts → types-C8wsi1hv.d.mts} +0 -0
@@ -1,19 +1,20 @@
1
- import { a as join, i as isAbsolute, n as dirname, o as relative, s as resolve, t as basename } from "./pathe.M-eThtNZ-D-kmWkCS.mjs";
2
- import { n as cliTitle } from "./output-D3g5otMC.mjs";
3
- import { c as getToken, n as PlatformClient, u as isStagingMode } from "./client-C_DYiXeu.mjs";
4
- import { _ as me, c as R, g as ge, i as Ee, u as Se, v as ue, x as q, y as ye } from "./dist-D2L3_KTK.mjs";
5
- import { a as writeProjectConfig, r as readProjectConfig } from "./project-DhB4A8_g.mjs";
6
- import { c as getDatabaseDialect, f as readConfig } from "./config-CeRQg3Lz.mjs";
7
- import { r as detectFramework } from "./plugin-inference-BexV6LL3.mjs";
8
- import { r as parseDotenvFile, t as expandDotenv } from "./dotenv-HQNhRalS.mjs";
9
- import { n as ensureProjectTsconfig, t as createProjectTsconfig } from "./project-tsconfig-Bfy55qvs.mjs";
10
- import { t as MagicString } from "./magic-string.es-DS_lmuBe.mjs";
11
- import { n as writeDrizzleConfig } from "./config-DyUSwbeX.mjs";
12
- import { n as getAgentById, r as getPackageDir, t as detectAgents } from "./agents-DqkFfc2c.mjs";
13
- import { n as promptProjectSelection, t as promptAndCreateProject } from "./create-project-hvFe6rbI.mjs";
14
- import { t as promptForLoginToken } from "./login-C_MfDjhu.mjs";
15
- import { r as formatProjectCommand } from "./preset-CYQh93UF.mjs";
16
- import { n as findInstalledYarnPnpRuntime, r as hasLocalLockfile, t as buildDrizzleKitSpawnEnv } from "./yarn-pnp-6LD6_3Ej.mjs";
1
+ import { a as join, c as resolve, i as isAbsolute, n as dirname, s as relative, t as basename } from "./pathe.M-eThtNZ-BrPhGF_K.mjs";
2
+ import { n as cliTitle } from "./output-DeiS4oEX.mjs";
3
+ import { n as readProjectPaths } from "./project-paths-CCMrHYQm.mjs";
4
+ import { c as getToken, n as PlatformClient, u as isStagingMode } from "./client-C-nH6yz3.mjs";
5
+ import { _ as me, c as R, g as ge, i as Ee, l as Re, u as Se, v as ue, x as q, y as ye } from "./dist-abzUneor.mjs";
6
+ import { a as writeProjectConfig, r as readProjectConfig } from "./project-CH9pdo16.mjs";
7
+ import { c as getDatabaseDialect, f as readConfig } from "./config-BVEC0lti.mjs";
8
+ import { r as detectFramework } from "./plugin-inference-Ba1uGdIy.mjs";
9
+ import { r as parseDotenvFile, t as expandDotenv } from "./dotenv-Bkoqyq9r.mjs";
10
+ import { n as ensureProjectTsconfig, t as createProjectTsconfig } from "./project-tsconfig-HAGjfY6w.mjs";
11
+ import { t as MagicString } from "./magic-string.es-C1Fb0uxq.mjs";
12
+ import { n as writeDrizzleConfig } from "./config--wXmVOoe.mjs";
13
+ import { n as getAgentById, r as getPackageDir, t as detectAgents } from "./agents-Dkgafwfr.mjs";
14
+ import { n as promptAndCreateProject, r as promptProjectSelection } from "./create-project-BGnQMy5N.mjs";
15
+ import { t as promptForLoginToken } from "./login-CkLr-AaI.mjs";
16
+ import { r as formatProjectCommand } from "./preset-BRsCi8ZB.mjs";
17
+ import { n as findInstalledYarnPnpRuntime, r as hasLocalLockfile, t as buildDrizzleKitSpawnEnv } from "./yarn-pnp-QgEYVC3V.mjs";
17
18
  import { createRequire } from "node:module";
18
19
  import { existsSync, mkdirSync, readFileSync, readdirSync, rmdirSync, unlinkSync, writeFileSync } from "node:fs";
19
20
  import { fileURLToPath } from "node:url";
@@ -208,6 +209,16 @@ const SCAFFOLD_BASE_DEV_DEPENDENCIES = {
208
209
  vite: "^8.0.10",
209
210
  typescript: "^5.9.3"
210
211
  };
212
+ const SCAFFOLD_VITE_PLUS_DEV_DEPENDENCIES = { "vite-plus": "^0.1.21" };
213
+ const SCAFFOLD_TOOLCHAIN_OPTIONS = [{
214
+ value: "vite-plus",
215
+ label: "Vite+",
216
+ hint: "Uses the Vite+ toolchain and vp commands."
217
+ }, {
218
+ value: "vite",
219
+ label: "Vite",
220
+ hint: "Uses plain Vite commands without Vite+."
221
+ }];
211
222
  const REACT_SCAFFOLD_COMPILER_DEV_DEPENDENCIES = {
212
223
  "@rolldown/plugin-babel": "^0.2.3",
213
224
  "@vitejs/plugin-react": "^6.0.1",
@@ -294,7 +305,7 @@ function getScaffoldTsconfigCompilerOptions(framework) {
294
305
  return framework ? { ...SCAFFOLD_FRAMEWORKS[framework].tsconfigCompilerOptions } : {};
295
306
  }
296
307
  function createPagesStarterTemplate(options) {
297
- const { framework, starterMode, voidPackageSpec, adapterPackageSpec } = options;
308
+ const { framework, starterMode, toolchain = "vite", voidPackageSpec, adapterPackageSpec } = options;
298
309
  const config = SCAFFOLD_FRAMEWORKS[framework];
299
310
  const files = {
300
311
  "vite.config.ts": getViteConfig(framework, config),
@@ -308,9 +319,9 @@ function createPagesStarterTemplate(options) {
308
319
  }
309
320
  return {
310
321
  scripts: {
311
- dev: "vite",
312
- build: "vite build",
313
- preview: "vite preview"
322
+ dev: toolchain === "vite-plus" ? "vp dev" : "vite",
323
+ build: toolchain === "vite-plus" ? "vp build" : "vite build",
324
+ preview: toolchain === "vite-plus" ? "vp preview" : "vite preview"
314
325
  },
315
326
  dependencies: {
316
327
  ...SCAFFOLD_BASE_DEPENDENCIES,
@@ -319,6 +330,7 @@ function createPagesStarterTemplate(options) {
319
330
  devDependencies: {
320
331
  void: voidPackageSpec,
321
332
  ...SCAFFOLD_BASE_DEV_DEPENDENCIES,
333
+ ...toolchain === "vite-plus" ? SCAFFOLD_VITE_PLUS_DEV_DEPENDENCIES : {},
322
334
  [config.adapterPackage]: adapterPackageSpec,
323
335
  ...config.devDependencies
324
336
  },
@@ -654,6 +666,7 @@ const EMPTY_PROJECT_ALLOWED_ENTRIES = new Set([
654
666
  const PNPM_ALLOWED_BUILDS = [
655
667
  "better-sqlite3",
656
668
  "esbuild",
669
+ "sharp",
657
670
  "workerd"
658
671
  ];
659
672
  const drizzleKitBin = join(fileURLToPath(import.meta.resolve("drizzle-kit")), "..", "bin.cjs");
@@ -673,6 +686,7 @@ const VITE_CONFIG_FILES = [
673
686
  "vite.config.cjs"
674
687
  ];
675
688
  const VOID_CONFIG_FILE = "void.json";
689
+ const VOID_SCHEMA_PATH = "./node_modules/void/schema.json";
676
690
  function asRecord(value) {
677
691
  if (!value || typeof value !== "object" || Array.isArray(value)) return null;
678
692
  return value;
@@ -823,6 +837,53 @@ function isScaffoldableEmptyProject(root) {
823
837
  if (Object.keys(scripts).some((name) => name !== "test")) return false;
824
838
  return true;
825
839
  }
840
+ function shouldPromptForInitLocation(root) {
841
+ if (isScaffoldableEmptyProject(root)) return false;
842
+ if (existsSync(join(root, "package.json"))) return false;
843
+ if (existsSync(join(root, VOID_CONFIG_FILE))) return false;
844
+ return findViteConfig(root) === void 0;
845
+ }
846
+ function validateSubfolderName(root, value) {
847
+ const name = value?.trim() ?? "";
848
+ if (!name) return "Enter a folder name.";
849
+ if (name === "." || name === ".." || name.includes("/") || name.includes("\\")) return "Enter a single folder name, not a path.";
850
+ if (existsSync(join(root, name))) return "That folder already exists.";
851
+ }
852
+ async function resolveInitRoot(root) {
853
+ if (!shouldPromptForInitLocation(root)) return root;
854
+ const choice = await Ee({
855
+ message: "This folder is not empty. Where should Void initialize?",
856
+ initialValue: "subfolder",
857
+ options: [{
858
+ value: "subfolder",
859
+ label: "Create a new subfolder",
860
+ hint: "Scaffold a new app inside this directory."
861
+ }, {
862
+ value: "current",
863
+ label: "Continue here",
864
+ hint: "Add package.json, vite.config.ts, and Void files to this directory."
865
+ }]
866
+ });
867
+ if (q(choice)) {
868
+ me("Setup cancelled.");
869
+ process.exit(0);
870
+ }
871
+ if (choice === "current") return root;
872
+ const folder = await Re({
873
+ message: "New project folder name:",
874
+ placeholder: "my-void-app",
875
+ initialValue: "my-void-app",
876
+ validate: (value) => validateSubfolderName(root, value)
877
+ });
878
+ if (q(folder)) {
879
+ me("Setup cancelled.");
880
+ process.exit(0);
881
+ }
882
+ const nextRoot = join(root, folder.trim());
883
+ mkdirSync(nextRoot, { recursive: true });
884
+ R.info(`Scaffolding in ${nextRoot}`);
885
+ return nextRoot;
886
+ }
826
887
  function parsePackageManagerField(pkg) {
827
888
  if (!pkg || typeof pkg !== "object") return;
828
889
  const raw = pkg.packageManager;
@@ -1251,9 +1312,9 @@ function detectProjectState(root) {
1251
1312
  hasTypescript,
1252
1313
  hasTsconfig: existsSync(join(root, "tsconfig.json")),
1253
1314
  hasGithubWorkflows: existsSync(join(root, ".github", "workflows")),
1254
- hasRoutes: existsSync(join(root, "routes")),
1255
- hasMigrations: existsSync(join(root, "db", "migrations")) || existsSync(join(root, "migrations")),
1256
- hasPages: existsSync(join(root, "pages")),
1315
+ hasRoutes: existsSync(readProjectPaths(root).routesDir),
1316
+ hasMigrations: existsSync(readProjectPaths(root).migrationsDir) || existsSync(join(root, "migrations")),
1317
+ hasPages: existsSync(readProjectPaths(root).pagesDir),
1257
1318
  packageManager,
1258
1319
  typescriptWanted: hasTypescript
1259
1320
  };
@@ -1262,7 +1323,8 @@ function findViteConfig(root) {
1262
1323
  return VITE_CONFIG_FILES.find((file) => existsSync(join(root, file)));
1263
1324
  }
1264
1325
  function hasDrizzleSchema(root) {
1265
- return existsSync(join(root, "db", "schema.ts")) || existsSync(join(root, "db", "schema"));
1326
+ const paths = readProjectPaths(root);
1327
+ return existsSync(paths.schemaFile) || existsSync(paths.schemaDir);
1266
1328
  }
1267
1329
  function detectPagesFramework(root) {
1268
1330
  try {
@@ -1475,8 +1537,15 @@ function setupWranglerConfig(root, framework) {
1475
1537
  else R.success("Updated wrangler.jsonc with compatibility_date and nodejs_als");
1476
1538
  } else R.success("wrangler.jsonc looks good");
1477
1539
  }
1540
+ function withDefaultVoidSchema(config) {
1541
+ if (typeof config.$schema === "string" && config.$schema.length > 0) return config;
1542
+ return {
1543
+ $schema: VOID_SCHEMA_PATH,
1544
+ ...config
1545
+ };
1546
+ }
1478
1547
  function writeVoidConfig(root, config) {
1479
- writeFileSync(join(root, VOID_CONFIG_FILE), JSON.stringify(config, null, 2) + "\n");
1548
+ writeFileSync(join(root, VOID_CONFIG_FILE), JSON.stringify(withDefaultVoidSchema(config), null, 2) + "\n");
1480
1549
  }
1481
1550
  function ensureVoidWorkerCompatibilityDate(root) {
1482
1551
  const config = readConfig(root);
@@ -1526,7 +1595,7 @@ function applyDatabaseDialect(root, dialect) {
1526
1595
  }
1527
1596
  function detectDatabaseSetup(root) {
1528
1597
  if (getDatabaseDialect(readConfig(root)) === "postgresql") return "postgresql";
1529
- if (hasDrizzleSchema(root) || existsSync(join(root, "db", "migrations")) || existsSync(join(root, "migrations"))) return "sqlite";
1598
+ if (hasDrizzleSchema(root) || existsSync(readProjectPaths(root).migrationsDir) || existsSync(join(root, "migrations"))) return "sqlite";
1530
1599
  return "none";
1531
1600
  }
1532
1601
  function applyDatabaseSetup(root, choice) {
@@ -1566,6 +1635,18 @@ async function promptStarterMode() {
1566
1635
  }
1567
1636
  return choice;
1568
1637
  }
1638
+ async function promptScaffoldToolchain() {
1639
+ const choice = await Ee({
1640
+ message: "Choose a Pages scaffold toolchain:",
1641
+ initialValue: "vite-plus",
1642
+ options: [...SCAFFOLD_TOOLCHAIN_OPTIONS]
1643
+ });
1644
+ if (q(choice)) {
1645
+ me("Setup cancelled.");
1646
+ process.exit(0);
1647
+ }
1648
+ return choice;
1649
+ }
1569
1650
  async function promptScaffoldFramework() {
1570
1651
  const choice = await Ee({
1571
1652
  message: "Choose a Pages framework to scaffold:",
@@ -1794,7 +1875,7 @@ function installProjectDependencies(root, packageManager) {
1794
1875
  function generateStarterMigration(root, starterMode) {
1795
1876
  const dialect = starterMode === "postgresql" ? "postgresql" : "sqlite";
1796
1877
  const configPath = writeDrizzleConfig(root, dialect === "postgresql" ? "postgresql://dummy" : ":memory:", dialect);
1797
- const migrationsDir = join(root, "db", "migrations");
1878
+ const migrationsDir = readProjectPaths(root).migrationsDir;
1798
1879
  const metaDir = join(migrationsDir, "meta");
1799
1880
  const journalPath = join(metaDir, "_journal.json");
1800
1881
  const migrationsDirExistedBefore = existsSync(migrationsDir);
@@ -1850,11 +1931,12 @@ function generateStarterMigration(root, starterMode) {
1850
1931
  }
1851
1932
  R.success("Generated initial Drizzle migration");
1852
1933
  }
1853
- function scaffoldPagesApp(root, packageManager, framework, starterMode) {
1934
+ function scaffoldPagesApp(root, packageManager, framework, starterMode, toolchain) {
1854
1935
  const packageJsonPath = join(root, "package.json");
1855
1936
  const template = createPagesStarterTemplate({
1856
1937
  framework,
1857
1938
  starterMode,
1939
+ toolchain,
1858
1940
  voidPackageSpec: resolveScaffoldDependencySpec(root, "void", getOwnVersion()),
1859
1941
  adapterPackageSpec: resolveScaffoldDependencySpec(root, SCAFFOLD_FRAMEWORKS[framework].adapterPackage, getOwnVersion())
1860
1942
  });
@@ -1893,7 +1975,7 @@ function scaffoldPagesApp(root, packageManager, framework, starterMode) {
1893
1975
  for (const [name, version] of Object.entries(template.dependencies)) ensureDependency("dependencies", name, version);
1894
1976
  for (const [name, version] of Object.entries(template.devDependencies)) ensureDependency("devDependencies", name, version);
1895
1977
  if (isPnpmProject(root, pkg)) ensurePnpmAllowBuilds(root, pkg);
1896
- if (packageManager === "pnpm" && (!pkg.packageManager || typeof pkg.packageManager !== "string")) pkg.packageManager = "pnpm@11.0.9";
1978
+ if (packageManager === "pnpm" && resolveWorkspaceDeferral(root, pkg) === void 0 && (!pkg.packageManager || typeof pkg.packageManager !== "string")) pkg.packageManager = "pnpm@11.0.9";
1897
1979
  writeFileSync(packageJsonPath, JSON.stringify(pkg, null, 2) + "\n");
1898
1980
  R.success("Updated package.json with starter scripts and dependencies");
1899
1981
  for (const [filePath, content] of Object.entries(template.files)) writeFileIfMissing(root, filePath, content);
@@ -2304,9 +2386,10 @@ function setupExistingProject(root, framework) {
2304
2386
  */
2305
2387
  function scaffoldDemo(root) {
2306
2388
  const devCommand = getDevCommand(root);
2389
+ const paths = readProjectPaths(root);
2307
2390
  const packageJsonMutated = ensureVoidDependency(root);
2308
- mkdirSync(join(root, "db"), { recursive: true });
2309
- writeFileSync(join(root, "db", "schema.ts"), `import { sql } from "void/db";
2391
+ mkdirSync(paths.dbDir, { recursive: true });
2392
+ writeFileSync(paths.schemaFile, `import { sql } from "void/db";
2310
2393
  import { integer, sqliteTable, text } from "void/schema-d1";
2311
2394
 
2312
2395
  export const posts = sqliteTable("posts", {
@@ -2317,8 +2400,8 @@ export const posts = sqliteTable("posts", {
2317
2400
  });
2318
2401
  `);
2319
2402
  R.success("Created db/schema.ts");
2320
- mkdirSync(join(root, "routes", "api"), { recursive: true });
2321
- writeFileSync(join(root, "routes", "api", "posts.ts"), `import { defineHandler } from "void";
2403
+ mkdirSync(join(paths.routesDir, "api"), { recursive: true });
2404
+ writeFileSync(join(paths.routesDir, "api", "posts.ts"), `import { defineHandler } from "void";
2322
2405
  import { db } from "void/db";
2323
2406
  import { posts } from "@schema";
2324
2407
 
@@ -2328,9 +2411,9 @@ export const GET = defineHandler(async () => {
2328
2411
  });
2329
2412
  `);
2330
2413
  R.success("Created routes/api/posts.ts");
2331
- ensureProjectTsconfig(root, void 0, true, true);
2332
- mkdirSync(join(root, "src"), { recursive: true });
2333
- writeFileSync(join(root, "src", "demo.ts"), `import { fetch } from "void/client";
2414
+ ensureProjectTsconfig(root, void 0, true, true, { paths });
2415
+ mkdirSync(paths.ssrDir, { recursive: true });
2416
+ writeFileSync(join(paths.ssrDir, "demo.ts"), `import { fetch } from "void/client";
2334
2417
 
2335
2418
  // Fully typed: response type is inferred from the GET handler's return type,
2336
2419
  // which is derived from the migration schema. No manual types needed.
@@ -2547,6 +2630,7 @@ async function runInitCommand(root, initArgs) {
2547
2630
  console.log();
2548
2631
  ge(cliTitle("init"));
2549
2632
  const targeted = Boolean(initArgs && (initArgs.tsconfig || initArgs.github || initArgs.agents));
2633
+ if (!targeted) root = await resolveInitRoot(root);
2550
2634
  const framework = detectFramework(root);
2551
2635
  const preScaffoldState = detectProjectState(root);
2552
2636
  const detectedPagesFramework = detectPagesFramework(root);
@@ -2558,12 +2642,14 @@ async function runInitCommand(root, initArgs) {
2558
2642
  if (framework) R.info(`Detected ${framework.name} framework`);
2559
2643
  if (!targeted && !framework && isScaffoldableEmptyProject(root)) {
2560
2644
  R.info("Empty project detected. Scaffolding a Pages starter...");
2645
+ const scaffoldToolchain = await promptScaffoldToolchain();
2561
2646
  if (detectedPagesFramework) {
2562
2647
  scaffoldedPagesFramework = detectedPagesFramework;
2563
2648
  R.info(`Detected ${SCAFFOLD_FRAMEWORKS[detectedPagesFramework].label} adapter in package.json`);
2564
2649
  } else scaffoldedPagesFramework = await promptScaffoldFramework();
2565
2650
  const starterMode = await promptStarterMode();
2566
- const scaffoldWroteDeps = scaffoldPagesApp(root, preScaffoldState.packageManager, scaffoldedPagesFramework, starterMode);
2651
+ const scaffoldPackageManager = scaffoldToolchain === "vite-plus" ? "pnpm" : preScaffoldState.packageManager;
2652
+ const scaffoldWroteDeps = scaffoldPagesApp(root, scaffoldPackageManager, scaffoldedPagesFramework, starterMode, scaffoldToolchain);
2567
2653
  const deferral = resolveWorkspaceDeferral(root, readPackageJson(root));
2568
2654
  const voidResolvable = isVoidResolvableFrom(root);
2569
2655
  if (deferral && (!voidResolvable || scaffoldWroteDeps)) {
@@ -2605,7 +2691,7 @@ async function runInitCommand(root, initArgs) {
2605
2691
  const agentSetup = await resolveAgentSetup(root);
2606
2692
  injectAgentBlock(root, agentSetup.instructionFilePath);
2607
2693
  if (agentSetup.agents.length > 0) {
2608
- const { linkSkillsForSpecificAgents } = await import("./skills-SAG0WyVn.mjs");
2694
+ const { linkSkillsForSpecificAgents } = await import("./skills-B_ynF4lA.mjs");
2609
2695
  linkSkillsForSpecificAgents(root, agentSetup.agents);
2610
2696
  } else R.info("Skills linking skipped for generic agent setup");
2611
2697
  setupMcpConfig(root, agentSetup.agents);
@@ -1,8 +1,8 @@
1
- import { n as cliTitle, s as import_picocolors } from "./output-D3g5otMC.mjs";
2
- import { c as getToken, n as PlatformClient, s as getSiteDomain } from "./client-C_DYiXeu.mjs";
3
- import { _ as me, c as R, g as ge, y as ye } from "./dist-D2L3_KTK.mjs";
4
- import { a as writeProjectConfig, r as readProjectConfig } from "./project-DhB4A8_g.mjs";
5
- import { n as promptProjectSelection, t as promptAndCreateProject } from "./create-project-hvFe6rbI.mjs";
1
+ import { n as cliTitle, s as import_picocolors } from "./output-DeiS4oEX.mjs";
2
+ import { c as getToken, n as PlatformClient, s as getSiteDomain } from "./client-C-nH6yz3.mjs";
3
+ import { _ as me, c as R, g as ge, y as ye } from "./dist-abzUneor.mjs";
4
+ import { a as writeProjectConfig, r as readProjectConfig } from "./project-CH9pdo16.mjs";
5
+ import { n as promptAndCreateProject, r as promptProjectSelection } from "./create-project-BGnQMy5N.mjs";
6
6
  //#region src/cli/link.ts
7
7
  async function runLink(root, slug) {
8
8
  console.log();
@@ -1,8 +1,8 @@
1
- import { a as ensureUtc, i as dim, l as tablePrefix, n as cliTitle, s as import_picocolors } from "./output-D3g5otMC.mjs";
2
- import { c as getToken, n as PlatformClient } from "./client-C_DYiXeu.mjs";
3
- import { c as R, g as ge, y as ye } from "./dist-D2L3_KTK.mjs";
4
- import { r as readProjectConfig } from "./project-DhB4A8_g.mjs";
5
- import { r as resolveProjectBySlug } from "./resolve-project-DdjLQ2tB.mjs";
1
+ import { a as ensureUtc, i as dim, l as tablePrefix, n as cliTitle, s as import_picocolors } from "./output-DeiS4oEX.mjs";
2
+ import { c as getToken, n as PlatformClient } from "./client-C-nH6yz3.mjs";
3
+ import { c as R, g as ge, y as ye } from "./dist-abzUneor.mjs";
4
+ import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
5
+ import { r as resolveProjectBySlug } from "./resolve-project-CNpUbUHd.mjs";
6
6
  //#region src/cli/list.ts
7
7
  async function runListCommand(root, slug) {
8
8
  console.log();
@@ -1,6 +1,6 @@
1
- import { n as cliTitle, r as createSpinner, s as import_picocolors } from "./output-D3g5otMC.mjs";
2
- import { a as isExpiredTokenError, c as getToken, d as removeToken, f as runLogin, l as getTokenSource, n as PlatformClient, p as saveToken, u as isStagingMode } from "./client-C_DYiXeu.mjs";
3
- import { _ as me, c as R, g as ge, i as Ee, x as q, y as ye } from "./dist-D2L3_KTK.mjs";
1
+ import { n as cliTitle, r as createSpinner, s as import_picocolors } from "./output-DeiS4oEX.mjs";
2
+ import { a as isExpiredTokenError, c as getToken, d as removeToken, f as runLogin, l as getTokenSource, n as PlatformClient, p as saveToken, u as isStagingMode } from "./client-C-nH6yz3.mjs";
3
+ import { _ as me, c as R, g as ge, i as Ee, x as q, y as ye } from "./dist-abzUneor.mjs";
4
4
  //#region src/cli/login.ts
5
5
  async function promptForLoginToken(root = process.cwd()) {
6
6
  const provider = await Ee({
@@ -1,7 +1,7 @@
1
- import { i as dim, n as cliTitle, s as import_picocolors } from "./output-D3g5otMC.mjs";
2
- import { c as getToken, n as PlatformClient } from "./client-C_DYiXeu.mjs";
3
- import { c as R, g as ge, y as ye } from "./dist-D2L3_KTK.mjs";
4
- import { r as readProjectConfig } from "./project-DhB4A8_g.mjs";
1
+ import { i as dim, n as cliTitle, s as import_picocolors } from "./output-DeiS4oEX.mjs";
2
+ import { c as getToken, n as PlatformClient } from "./client-C-nH6yz3.mjs";
3
+ import { c as R, g as ge, y as ye } from "./dist-abzUneor.mjs";
4
+ import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
5
5
  //#region src/cli/logs.ts
6
6
  async function runLogsCommand(root, filter, range, deployment, level) {
7
7
  console.log();
@@ -1,6 +1,6 @@
1
- import { a as join, n as dirname } from "./pathe.M-eThtNZ-D-kmWkCS.mjs";
2
- import { c as getToken, n as PlatformClient } from "./client-C_DYiXeu.mjs";
3
- import { a as writeProjectConfig } from "./project-DhB4A8_g.mjs";
1
+ import { a as join, n as dirname } from "./pathe.M-eThtNZ-BrPhGF_K.mjs";
2
+ import { c as getToken, n as PlatformClient } from "./client-C-nH6yz3.mjs";
3
+ import { a as writeProjectConfig } from "./project-CH9pdo16.mjs";
4
4
  import { existsSync, readFileSync, readdirSync } from "node:fs";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import { createInterface } from "node:readline";
@@ -1,9 +1,9 @@
1
- import { a as join } from "./pathe.M-eThtNZ-D-kmWkCS.mjs";
2
- import { n as loadVoidAuthConfig, t as findVoidAuthConfig } from "./config-CvHtTM0q.mjs";
3
- import { f as readConfig } from "./config-CeRQg3Lz.mjs";
4
- import { r as resolveVoidAuthMigrationSchema } from "./drizzle-Cx7cVwrE.mjs";
5
- import { n as applySqliteAuthMigrations, t as applyPgAuthMigrations } from "./auth-migrations-BwLPwRgH.mjs";
6
- import { getMiniflareDatabasePath } from "./runner-C0d3lJo1.mjs";
1
+ import { a as join } from "./pathe.M-eThtNZ-BrPhGF_K.mjs";
2
+ import { n as loadVoidAuthConfig, t as findVoidAuthConfig } from "./config-hhMYPVRT.mjs";
3
+ import { f as readConfig } from "./config-BVEC0lti.mjs";
4
+ import { r as resolveVoidAuthMigrationSchema } from "./drizzle-DmaANP4-.mjs";
5
+ import { n as applySqliteAuthMigrations, t as applyPgAuthMigrations } from "./auth-migrations-BqJoGqGQ.mjs";
6
+ import { getMiniflareDatabasePath } from "./runner-BkGBfr4e.mjs";
7
7
  import { loadEnv } from "vite";
8
8
  //#region src/auth/node.ts
9
9
  async function runLocalVoidAuthMigrations(root, dialect, persistRoot = join(root, ".void"), databaseId = "local", configPath = findVoidAuthConfig(root)) {
@@ -1,5 +1,5 @@
1
1
  import { r as __toESM, t as __commonJSMin } from "./chunk-DJd-R1mw.mjs";
2
- import { c as R, f as at, h as ft } from "./dist-D2L3_KTK.mjs";
2
+ import { c as R, f as at, h as ft } from "./dist-abzUneor.mjs";
3
3
  //#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
4
4
  var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
5
  let p = process || {}, argv = p.argv || [], env = p.env || {};
@@ -1,4 +1,4 @@
1
- import { t as PageObject } from "../protocol-D7r_deVZ.mjs";
1
+ import { t as PageObject } from "../protocol-mcSsdMij.mjs";
2
2
  import { CacheForInput, CacheForResult } from "./prefetch.mjs";
3
3
 
4
4
  //#region src/pages/action-result.d.ts
@@ -1,4 +1,4 @@
1
- import { n as HeadDescriptor } from "../head-C7QW7UY1.mjs";
1
+ import { n as HeadDescriptor } from "../head-CZs8dMxG.mjs";
2
2
 
3
3
  //#region src/pages/head-client.d.ts
4
4
  /**
@@ -1,2 +1,2 @@
1
- import { a as renderHtmlAttrs, i as renderHeadToString, n as HeadDescriptor, o as resolveHead, r as renderBodyAttrs, t as HeadConfig } from "../head-C7QW7UY1.mjs";
1
+ import { a as renderHtmlAttrs, i as renderHeadToString, n as HeadDescriptor, o as resolveHead, r as renderBodyAttrs, t as HeadConfig } from "../head-CZs8dMxG.mjs";
2
2
  export { HeadConfig, HeadDescriptor, renderBodyAttrs, renderHeadToString, renderHtmlAttrs, resolveHead };
@@ -1,7 +1,30 @@
1
- import { a as renderHtmlAttrs, i as renderHeadToString, n as HeadDescriptor, o as resolveHead, r as renderBodyAttrs, t as HeadConfig } from "../head-C7QW7UY1.mjs";
2
- import { a as PageScanResult, i as PageDefinition, n as LayoutDefinition, r as NamedLayoutDefinition } from "../types-DG_Ynnyd.mjs";
1
+ import { a as renderHtmlAttrs, i as renderHeadToString, n as HeadDescriptor, o as resolveHead, r as renderBodyAttrs, t as HeadConfig } from "../head-CZs8dMxG.mjs";
2
+ import { a as PageScanResult, i as PageDefinition, n as LayoutDefinition, r as NamedLayoutDefinition } from "../types-C8wsi1hv.mjs";
3
3
  import { serializePageData } from "./serialize.mjs";
4
+ import { RewriteDestination } from "void/routes";
4
5
 
6
+ //#region src/project-paths.d.ts
7
+ type ProjectPaths = {
8
+ root: string;
9
+ sourceDir: string;
10
+ sourceRoot: string;
11
+ routesDir: string;
12
+ middlewareDir: string;
13
+ cronsDir: string;
14
+ queuesDir: string;
15
+ pagesDir: string;
16
+ dbDir: string;
17
+ migrationsDir: string;
18
+ schemaFile: string;
19
+ schemaDir: string;
20
+ srcDir: string;
21
+ ssrDir: string;
22
+ sourceRelative: (path: string) => string;
23
+ authConfigCandidates: ReadonlyArray<string>;
24
+ envFileCandidates: ReadonlyArray<string>;
25
+ };
26
+ declare function resolvePagesDir(root?: string): string;
27
+ //#endregion
5
28
  //#region src/pages/layout-resolution.d.ts
6
29
  /** Resolve the layout chain for a component (innermost last) */
7
30
  declare function resolveLayoutChain(componentId: string, layouts: Array<LayoutDefinition>): Array<LayoutDefinition>;
@@ -16,6 +39,8 @@ declare function resolveEffectiveLayoutChain(page: {
16
39
  //#region src/pages/scan.d.ts
17
40
  declare function scanPages(root: string, options?: {
18
41
  output?: "server" | "static";
42
+ paths?: ProjectPaths;
43
+ pagesDir?: string;
19
44
  }): Promise<PageScanResult>;
20
45
  //#endregion
21
46
  //#region src/pages/manifest.d.ts
@@ -35,4 +60,4 @@ type ResolveStaticPageDataBuildOptionsInput = {
35
60
  };
36
61
  declare function resolveStaticPageDataBuildOptions(root: string, options?: ResolveStaticPageDataBuildOptionsInput): StaticPageDataBuildOptions;
37
62
  //#endregion
38
- export { type HeadConfig, type HeadDescriptor, type LayoutDefinition, type NamedLayoutDefinition, type PageDefinition, type PageScanResult, type StaticPageDataBuildOptions, generateComponentManifest, renderBodyAttrs, renderHeadToString, renderHtmlAttrs, resolveEffectiveLayoutChain, resolveHead, resolveLayoutChain, resolveNamedLayout, resolveStaticPageDataBuildOptions, scanPages, serializePageData };
63
+ export { type HeadConfig, type HeadDescriptor, type LayoutDefinition, type NamedLayoutDefinition, type PageDefinition, type PageScanResult, type StaticPageDataBuildOptions, generateComponentManifest, renderBodyAttrs, renderHeadToString, renderHtmlAttrs, resolveEffectiveLayoutChain, resolveHead, resolveLayoutChain, resolveNamedLayout, resolvePagesDir, resolveStaticPageDataBuildOptions, scanPages, serializePageData };
@@ -1,7 +1,8 @@
1
- import { a as join } from "../pathe.M-eThtNZ-D-kmWkCS.mjs";
2
- import { f as readConfig } from "../config-CeRQg3Lz.mjs";
3
- import { a as resolveNamedLayout, i as resolveLayoutIds, n as resolveEffectiveLayoutChain, r as resolveLayoutChain, t as scanPages } from "../scan-CKpylFj9.mjs";
4
- import { i as parseRedirectsFile } from "../headers-CuVHn6Kl.mjs";
1
+ import { a as join } from "../pathe.M-eThtNZ-BrPhGF_K.mjs";
2
+ import { r as resolvePagesDir } from "../project-paths-CCMrHYQm.mjs";
3
+ import { f as readConfig } from "../config-BVEC0lti.mjs";
4
+ import { a as resolveNamedLayout, i as resolveLayoutIds, n as resolveEffectiveLayoutChain, r as resolveLayoutChain, t as scanPages } from "../scan-2YmJkYAf.mjs";
5
+ import { i as parseRedirectsFile } from "../headers-wAPJigtE.mjs";
5
6
  import { renderBodyAttrs, renderHeadToString, renderHtmlAttrs, resolveHead } from "./head.mjs";
6
7
  import { serializePageData } from "./serialize.mjs";
7
8
  //#region src/pages/manifest.ts
@@ -73,4 +74,4 @@ function resolveStaticPageDataBuildOptions(root, options = {}) {
73
74
  };
74
75
  }
75
76
  //#endregion
76
- export { generateComponentManifest, renderBodyAttrs, renderHeadToString, renderHtmlAttrs, resolveEffectiveLayoutChain, resolveHead, resolveLayoutChain, resolveNamedLayout, resolveStaticPageDataBuildOptions, scanPages, serializePageData };
77
+ export { generateComponentManifest, renderBodyAttrs, renderHeadToString, renderHtmlAttrs, resolveEffectiveLayoutChain, resolveHead, resolveLayoutChain, resolveNamedLayout, resolvePagesDir, resolveStaticPageDataBuildOptions, scanPages, serializePageData };
@@ -1,4 +1,4 @@
1
- import { a as PageScanResult } from "../types-DG_Ynnyd.mjs";
1
+ import { a as PageScanResult } from "../types-C8wsi1hv.mjs";
2
2
  import { ResolvedConfig, ViteDevServer } from "vite";
3
3
 
4
4
  //#region src/pages/islands-plugin.d.ts
@@ -1,10 +1,15 @@
1
- import { n as dirname, s as resolve } from "../pathe.M-eThtNZ-D-kmWkCS.mjs";
2
- import { n as resolveEffectiveLayoutChain, t as scanPages } from "../scan-CKpylFj9.mjs";
1
+ import { c as resolve, n as dirname } from "../pathe.M-eThtNZ-BrPhGF_K.mjs";
2
+ import { n as resolveEffectiveLayoutChain, t as scanPages } from "../scan-2YmJkYAf.mjs";
3
3
  import { existsSync, readFileSync, readdirSync } from "node:fs";
4
4
  import { normalizePath } from "vite";
5
5
  //#region src/pages/islands-plugin.ts
6
6
  const ISLANDS_RENDERER_ID = "virtual:void-islands-renderer";
7
7
  const ISLANDS_CLIENT_ENTRY_ID = "virtual:void-islands-client";
8
+ const ISLAND_IMPORT_RE = /import\s+([$_A-Za-z][$_\w]*)\s+from\s+("[^"]+"|'[^']+')\s+with\s*\{\s*island\s*:\s*("[^"]+"|'[^']+')\s*,?\s*\}/g;
9
+ function hasIslandImports(code) {
10
+ ISLAND_IMPORT_RE.lastIndex = 0;
11
+ return ISLAND_IMPORT_RE.test(code);
12
+ }
8
13
  /** Resolve a relative import specifier to an absolute path by checking extensions. */
9
14
  function resolveSpecifier(specifier, importerDir, extensions) {
10
15
  const base = normalizePath(resolve(importerDir, specifier));
@@ -18,7 +23,6 @@ function resolveSpecifier(specifier, importerDir, extensions) {
18
23
  * or any .md file has a `<script>` block.
19
24
  */
20
25
  function needsIslandClientBundle(dir, islandFilePattern, checkStyleBlocks) {
21
- const importAttrRe = /import\s+\w+\s+from\s+("[^"]+"|'[^']+')\s+with\s*\{\s*island\s*:/;
22
26
  const cssImportRe = /import\b[^"']*["'][^"']+\.(?:css|scss|sass|less|styl|stylus|pcss|postcss)["']/;
23
27
  const mdScriptRe = /^<script\b/m;
24
28
  const styleRe = checkStyleBlocks ? /<style\b/ : null;
@@ -31,7 +35,7 @@ function needsIslandClientBundle(dir, islandFilePattern, checkStyleBlocks) {
31
35
  const name = entry.name;
32
36
  if (islandFilePattern.test(name) || name.startsWith("layout.") || name.startsWith("_")) {
33
37
  const content = readFileSync(resolve(entry.parentPath, name), "utf-8");
34
- if (importAttrRe.test(content)) return true;
38
+ if (hasIslandImports(content)) return true;
35
39
  if (styleRe && styleRe.test(content)) return true;
36
40
  if (cssImportRe.test(content)) return true;
37
41
  }
@@ -67,13 +71,10 @@ function extractCssImports(filePath) {
67
71
  function computePagesNeedingClientJS(pageScan, pagesDir, resolvedConfig) {
68
72
  const mdPlugin = resolvedConfig?.plugins?.find((plugin) => plugin.name === "void-md");
69
73
  const mdScriptIds = new Set(mdPlugin?.api?.getClientScripts?.()?.keys() ?? []);
70
- const importAttrRe = /import\s+\w+\s+from\s+("[^"]+"|'[^']+')\s+with\s*\{\s*island\s*:\s*("[^"]+"|'[^']+')\s*\}/g;
71
74
  const layoutDirsWithIslands = /* @__PURE__ */ new Set();
72
75
  for (const layout of pageScan.layouts) {
73
76
  if (!layout.island) continue;
74
- const code = readFileSync(resolve(pagesDir, layout.filePath), "utf-8");
75
- importAttrRe.lastIndex = 0;
76
- if (importAttrRe.test(code)) layoutDirsWithIslands.add(layout.directory);
77
+ if (hasIslandImports(readFileSync(resolve(pagesDir, layout.filePath), "utf-8"))) layoutDirsWithIslands.add(layout.directory);
77
78
  }
78
79
  const result = /* @__PURE__ */ new Set();
79
80
  for (const page of pageScan.pages) {
@@ -82,9 +83,7 @@ function computePagesNeedingClientJS(pageScan, pagesDir, resolvedConfig) {
82
83
  result.add(page.componentId);
83
84
  continue;
84
85
  }
85
- const code = readFileSync(resolve(pagesDir, page.componentPath), "utf-8");
86
- importAttrRe.lastIndex = 0;
87
- if (importAttrRe.test(code)) {
86
+ if (hasIslandImports(readFileSync(resolve(pagesDir, page.componentPath), "utf-8"))) {
88
87
  result.add(page.componentId);
89
88
  continue;
90
89
  }
@@ -107,12 +106,14 @@ function computePagesNeedingClientJS(pageScan, pagesDir, resolvedConfig) {
107
106
  function watchPagesForRescan(server, pagesDir, root, onRescan) {
108
107
  let pending = null;
109
108
  let debounceTimer = null;
109
+ const normalizedPagesDir = normalizePath(pagesDir);
110
110
  const scheduleRescan = (path) => {
111
- if (!path.startsWith(pagesDir)) return;
111
+ const normalizedPath = normalizePath(path);
112
+ if (normalizedPath !== normalizedPagesDir && !normalizedPath.startsWith(normalizedPagesDir + "/")) return;
112
113
  if (debounceTimer) clearTimeout(debounceTimer);
113
114
  debounceTimer = setTimeout(() => {
114
115
  debounceTimer = null;
115
- pending = scanPages(root).then((pageScan) => {
116
+ pending = scanPages(root, { pagesDir }).then((pageScan) => {
116
117
  onRescan(pageScan);
117
118
  for (const env of Object.values(server.environments)) {
118
119
  const mod = env.moduleGraph.getModuleById("\0" + ISLANDS_RENDERER_ID);
@@ -125,7 +126,7 @@ function watchPagesForRescan(server, pagesDir, root, onRescan) {
125
126
  server.watcher.on("add", scheduleRescan);
126
127
  server.watcher.on("unlink", scheduleRescan);
127
128
  server.watcher.on("change", (path) => {
128
- if (path.endsWith(".md")) scheduleRescan(path);
129
+ if (normalizePath(path).endsWith(".md")) scheduleRescan(path);
129
130
  });
130
131
  return { flush: () => pending ?? Promise.resolve() };
131
132
  }
@@ -1,3 +1,3 @@
1
- import { S as ValidationError } from "../handler-DJTuxB10.mjs";
2
- import { a as handlePageMutation, i as handlePageGet, n as PageRenderResult, o as safeJsonStringify, r as flattenValidationErrors, t as PageObject } from "../protocol-D7r_deVZ.mjs";
1
+ import { S as ValidationError } from "../handler-BPhL8AmU.mjs";
2
+ import { a as handlePageMutation, i as handlePageGet, n as PageRenderResult, o as safeJsonStringify, r as flattenValidationErrors, t as PageObject } from "../protocol-mcSsdMij.mjs";
3
3
  export { PageObject, PageRenderResult, ValidationError, flattenValidationErrors, handlePageGet, handlePageMutation, safeJsonStringify };
@@ -1,5 +1,5 @@
1
1
  import { isConvertedResponse } from "../runtime/response.mjs";
2
- import { i as ValidationError, r as separateDeferred, t as DEFERRED } from "../defer-2ARBu8Et.mjs";
2
+ import { i as ValidationError, r as separateDeferred, t as DEFERRED } from "../defer-DkoEwda-.mjs";
3
3
  import { resolveHead } from "./head.mjs";
4
4
  //#region src/pages/protocol.ts
5
5
  const POWERED_BY = { "X-Powered-By": "Void" };
@@ -147,4 +147,4 @@ const basename = function(p, extension) {
147
147
  return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
148
148
  };
149
149
  //#endregion
150
- export { join as a, isAbsolute as i, dirname as n, relative as o, extname as r, resolve as s, basename as t };
150
+ export { join as a, resolve as c, isAbsolute as i, dirname as n, normalize as o, extname as r, relative as s, basename as t };