void 0.8.11 → 0.9.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.
Files changed (109) hide show
  1. package/dist/{auth-cmd-DE2YDAk0.mjs → auth-cmd-CPkWrQR9.mjs} +2 -2
  2. package/dist/{better-auth-shared-BXdg2Sur.d.mts → better-auth-shared-CmEQZs1T.d.mts} +2 -2
  3. package/dist/{cache-ChOUXuMY.mjs → cache-1SVxZ7BK.mjs} +2 -2
  4. package/dist/{cancel-deploy-g6bC-mpl.mjs → cancel-deploy-JaFClLr7.mjs} +1 -1
  5. package/dist/cli/cli.mjs +77 -40
  6. package/dist/{client-CCOKwNUz.mjs → client-DIfOFf1W.mjs} +6 -1
  7. package/dist/{create-project-DmGoYMqF.mjs → create-project-DCUrFJxa.mjs} +13 -5
  8. package/dist/{db-CSn2p-PN.mjs → db-DiddQC2v.mjs} +192 -20
  9. package/dist/{delete-D446r1rC.mjs → delete-CYknzwXU.mjs} +2 -2
  10. package/dist/{deploy-OPo_tSWl.mjs → deploy-CRU9fGjE.mjs} +22 -22
  11. package/dist/{domain-Digh83lu.mjs → domain-DxTc6HDn.mjs} +1 -1
  12. package/dist/{env-CJMOHUbW.mjs → env-Bvw0wMTI.mjs} +1 -1
  13. package/dist/{env-helpers-GICENGaN.d.mts → env-helpers-Bd2wVdxz.d.mts} +1 -1
  14. package/dist/{gen-DVPMPTL1.mjs → gen-CZdNWIaA.mjs} +1 -1
  15. package/dist/{handler-2mA_-sst.d.mts → handler-xflsMwWM.d.mts} +3 -3
  16. package/dist/index.d.mts +3 -3
  17. package/dist/index.mjs +242 -107
  18. package/dist/{init-BaXYK2PD.mjs → init-BHupO7Fm.mjs} +9 -9
  19. package/dist/{link-PClO4q2M.mjs → link-7MoXUMaI.mjs} +8 -10
  20. package/dist/{list-G03-pEN-.mjs → list-N2mCHv8q.mjs} +2 -2
  21. package/dist/{login-BZ1Yk9Xw.mjs → login-tt1OmNVg.mjs} +1 -1
  22. package/dist/{logs-D0a_HhLn.mjs → logs-Cl7q2CjZ.mjs} +1 -1
  23. package/dist/{mcp-BLsmImuJ.mjs → mcp-BXD35N2J.mjs} +1 -1
  24. package/dist/{node-x1AzR6Yf.mjs → node-CHWVVjO6.mjs} +3 -3
  25. package/dist/package-json-B2TD0JLu.mjs +44 -0
  26. package/dist/pages/client.d.mts +1 -1
  27. package/dist/pages/head-client.d.mts +1 -1
  28. package/dist/pages/head.d.mts +1 -1
  29. package/dist/pages/index.d.mts +2 -2
  30. package/dist/pages/index.mjs +1 -1
  31. package/dist/pages/islands-plugin.d.mts +1 -1
  32. package/dist/pages/protocol.d.mts +2 -2
  33. package/dist/pages/protocol.mjs +1 -1
  34. package/dist/{plugin-inference-Ba1uGdIy.mjs → plugin-inference-BUBhHt_1.mjs} +6 -2
  35. package/dist/{prepare-D8znEv3-.mjs → prepare-CrlAVbWS.mjs} +3 -3
  36. package/dist/{preset-BRsCi8ZB.mjs → preset-CIJG2O7a.mjs} +6 -21
  37. package/dist/{project-cmd-CErG1vM7.mjs → project-cmd-CLrqSbqj.mjs} +8 -8
  38. package/dist/{protocol-DXs_1QcC.d.mts → protocol-DYca39yJ.d.mts} +3 -3
  39. package/dist/proxy-M3pxItg2.mjs +5 -0
  40. package/dist/{rollback-BtiabraI.mjs → rollback-CEbAwbHK.mjs} +1 -1
  41. package/dist/{runner-DCYwTlee.mjs → runner-DLZ9E_cX.mjs} +11 -3
  42. package/dist/runtime/ai.mjs +1 -1
  43. package/dist/runtime/auth.d.mts +1 -1
  44. package/dist/runtime/better-auth-pg.d.mts +1 -1
  45. package/dist/runtime/better-auth-pg.mjs +3 -3
  46. package/dist/runtime/better-auth.d.mts +1 -1
  47. package/dist/runtime/better-auth.mjs +2 -2
  48. package/dist/runtime/client-react.d.mts +6 -0
  49. package/dist/runtime/client-react.mjs +5 -0
  50. package/dist/runtime/client-solid.d.mts +6 -0
  51. package/dist/runtime/client-solid.mjs +5 -0
  52. package/dist/runtime/client-svelte.d.mts +6 -0
  53. package/dist/runtime/client-svelte.mjs +5 -0
  54. package/dist/runtime/client-vue.d.mts +6 -0
  55. package/dist/runtime/client-vue.mjs +5 -0
  56. package/dist/runtime/client.d.mts +2 -2
  57. package/dist/runtime/client.mjs +1 -1
  58. package/dist/runtime/env-helpers.d.mts +1 -1
  59. package/dist/runtime/env-public-client.d.mts +1 -1
  60. package/dist/runtime/env-public.d.mts +2 -2
  61. package/dist/runtime/env-public.mjs +1 -1
  62. package/dist/runtime/env.mjs +1 -1
  63. package/dist/runtime/fetch-stream.d.mts +1 -1
  64. package/dist/runtime/fetch-stream.mjs +1 -1
  65. package/dist/runtime/fetch.d.mts +1 -1
  66. package/dist/runtime/fetch.mjs +1 -1
  67. package/dist/runtime/handler.d.mts +1 -1
  68. package/dist/runtime/handler.mjs +1 -1
  69. package/dist/runtime/isr.mjs +1 -1
  70. package/dist/runtime/live.d.mts +2 -2
  71. package/dist/runtime/live.mjs +1 -1
  72. package/dist/runtime/migration-handler-pg.mjs +1 -1
  73. package/dist/runtime/remote/index.d.mts +5 -1
  74. package/dist/runtime/remote/index.mjs +7 -4
  75. package/dist/runtime/sandbox.mjs +1 -1
  76. package/dist/runtime/validator.d.mts +1 -1
  77. package/dist/runtime/ws-server.d.mts +2 -2
  78. package/dist/runtime/ws.d.mts +3 -3
  79. package/dist/{scan-DzzHqtiT.mjs → scan-BNC_1OsY.mjs} +1 -1
  80. package/dist/{secret-CNnequJa.mjs → secret-C_uTY7xx.mjs} +2 -2
  81. package/dist/{skills-C38GxuGT.mjs → skills-BRKc--As.mjs} +1 -1
  82. package/package.json +22 -2
  83. package/skills/void/docs/guide/auth.md +3 -3
  84. package/skills/void/docs/guide/env-vars.md +4 -1
  85. package/skills/void/docs/integrations/cloudflare.md +3 -2
  86. package/skills/void/docs/reference/api.md +42 -30
  87. package/skills/void/docs/reference/cli.md +46 -28
  88. package/skills/void/docs/reference/config.md +1 -1
  89. package/skills/void/docs/reference/resource-inference.md +11 -11
  90. /package/dist/{agents-Dkgafwfr.mjs → agents-MhSzNMiC.mjs} +0 -0
  91. /package/dist/{auth-CHfPhSta.d.mts → auth-CDeb2XAl.d.mts} +0 -0
  92. /package/dist/{auth-migrations-BqJoGqGQ.mjs → auth-migrations-CuQkjjWE.mjs} +0 -0
  93. /package/dist/{better-auth-shared-CbAF6sOM.mjs → better-auth-shared-ChVbrq52.mjs} +0 -0
  94. /package/dist/{defer-DkoEwda-.mjs → defer-CouVukrf.mjs} +0 -0
  95. /package/dist/{drizzle-DmaANP4-.mjs → drizzle-2fs1qTgy.mjs} +0 -0
  96. /package/dist/{env-raw-zk5JQKZe.mjs → env-raw-RDkMnSTC.mjs} +0 -0
  97. /package/dist/{fetch-error-rXermVU3.mjs → fetch-error-BFIoojjf.mjs} +0 -0
  98. /package/dist/{fetch-error-7aWl0RiD.d.mts → fetch-error-CimrygMq.d.mts} +0 -0
  99. /package/dist/{head-DnTAP4p-.d.mts → head-BsSTGnIe.d.mts} +0 -0
  100. /package/dist/{headers-wAPJigtE.mjs → headers-Y0jshugF.mjs} +0 -0
  101. /package/dist/{pg-BDQxUp3Q.mjs → pg-CMZ_5wsC.mjs} +0 -0
  102. /package/dist/{project-slug-De4UjtD9.mjs → project-slug-rX3kTOfY.mjs} +0 -0
  103. /package/dist/{providers--6L9uf7j.d.mts → providers-3Kkv63Ha.d.mts} +0 -0
  104. /package/dist/{resolve-project-CNpUbUHd.mjs → resolve-project-D4O1_fZz.mjs} +0 -0
  105. /package/dist/{runner-pg-CJ04wNk5.mjs → runner-pg-Cv9V7ydr.mjs} +0 -0
  106. /package/dist/{standard-schema-BDiIJgp5.d.mts → standard-schema-Dnsh2vnl.d.mts} +0 -0
  107. /package/dist/{subcommand-prompt-BLewBtNI.mjs → subcommand-prompt-OD-x_Tsm.mjs} +0 -0
  108. /package/dist/{types-C0AOcrPN.d.mts → types-Dm9kep2X.d.mts} +0 -0
  109. /package/dist/{yarn-pnp-CLFC1T3p.mjs → yarn-pnp-0SwYgQxx.mjs} +0 -0
package/dist/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  import { r as __toESM } from "./chunk-DJd-R1mw.mjs";
2
2
  import { a as join, n as dirname, s as relative } from "./pathe.M-eThtNZ-BrPhGF_K.mjs";
3
3
  import { u as require_picocolors } from "./output-DeiS4oEX.mjs";
4
- import { C as isSandboxEnabled, D as resolveAssetRoutingPolicy, E as hasDocumentRoutes, S as SANDBOX_MIGRATION_TAG, T as hasApiRoutes, _ as normalizeWranglerCompatibilityFlags, a as prerenderPagesNode, b as resolveLiveBindingConfig, c as filterLoadedEnv, d as LIVE_MIGRATION_TAG, f as ensureWranglerCompat, g as nextDurableObjectMigrationTag, h as hasDurableObjectSqliteMigration, i as prerenderPages, l as resolveRemoteMode, m as ensureWranglerNodejsAlsFlag, n as resolveDistDir, o as DEFAULT_PROXY_URL, p as ensureWranglerCompatibilityDate, r as resolveWorkerDirName, s as STAGING_PROXY_URL, u as stripInternalEnvKeys, v as readExistingLiveBindingConfig, w as resolveSandboxConfig, x as syncWranglerBindings, y as readWranglerCompat } from "./deploy-OPo_tSWl.mjs";
4
+ import { C as hasApiRoutes, S as resolveSandboxConfig, T as resolveAssetRoutingPolicy, _ as readWranglerCompat, a as prerenderPagesNode, b as SANDBOX_MIGRATION_TAG, c as stripInternalEnvKeys, d as ensureWranglerCompatibilityDate, f as ensureWranglerNodejsAlsFlag, g as readExistingLiveBindingConfig, h as normalizeWranglerCompatibilityFlags, i as prerenderPages, l as LIVE_MIGRATION_TAG, m as nextDurableObjectMigrationTag, n as resolveDistDir, o as filterLoadedEnv, p as hasDurableObjectSqliteMigration, r as resolveWorkerDirName, s as resolveRemoteMode, u as ensureWranglerCompat, v as resolveLiveBindingConfig, w as hasDocumentRoutes, x as isSandboxEnabled, y as syncWranglerBindings } from "./deploy-CRU9fGjE.mjs";
5
5
  import { i as resolveProjectPaths, n as readProjectPaths, t as assertNoRootSourceConventionConflicts } from "./project-paths-CCMrHYQm.mjs";
6
6
  import { n as loadVoidAuthConfig, t as findVoidAuthConfig } from "./config-hhMYPVRT.mjs";
7
- import { c as getToken, u as isStagingMode } from "./client-CCOKwNUz.mjs";
7
+ import { c as getToken, u as isStagingMode } from "./client-DIfOFf1W.mjs";
8
8
  import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
9
9
  import { c as getDatabaseDialect, f as readConfig, l as isNodeTarget, p as resolveBindingNames } from "./config-BVEC0lti.mjs";
10
- import { a as scanQueuesSync, i as scanWebSocketRoutesSync, n as scanRoutePatternsSync, o as scanJobsSync, r as scanRoutes, t as scanMiddlewareSync } from "./scan-DzzHqtiT.mjs";
11
- import { a as SSR_CLIENT_ENTRY_RELATIVE_PATHS, c as validateSsrEntries, f as isIdentifier, g as walk, i as inferProjectBindings, l as validateSsrEntry, m as isMemberExpression, n as FRAMEWORK_SCAN_DIRS, o as SSR_SERVER_ENTRY_RELATIVE_PATHS, p as isLiteral, r as detectFramework, t as DEFAULT_SCAN_DIRS, u as inferBindingsFromSource } from "./plugin-inference-Ba1uGdIy.mjs";
10
+ import { a as scanQueuesSync, i as scanWebSocketRoutesSync, n as scanRoutePatternsSync, o as scanJobsSync, r as scanRoutes, t as scanMiddlewareSync } from "./scan-BNC_1OsY.mjs";
11
+ import { a as SSR_CLIENT_ENTRY_RELATIVE_PATHS, c as validateSsrEntries, f as isIdentifier, g as walk, i as inferProjectBindings, l as validateSsrEntry, m as isMemberExpression, n as FRAMEWORK_SCAN_DIRS, o as SSR_SERVER_ENTRY_RELATIVE_PATHS, p as isLiteral, r as detectFramework, t as DEFAULT_SCAN_DIRS, u as inferBindingsFromSource } from "./plugin-inference-BUBhHt_1.mjs";
12
12
  import { i as voidWarn, n as voidError, r as voidLog, t as setShowTimestamp } from "./log-CWWZV4V1.mjs";
13
13
  import { r as parseDotenvFile } from "./dotenv-Bkoqyq9r.mjs";
14
14
  import { i as generateDbDts, n as generateQueueTypes, r as DRIZZLE_OPERATORS, t as generateRouteTypes } from "./route-types-jxRfWuCb.mjs";
@@ -18,10 +18,11 @@ import { t as MagicString } from "./magic-string.es-C1Fb0uxq.mjs";
18
18
  import { n as findEnvFileForPaths, r as generateEnvTypes, t as findEnvFile } from "./env-types-D6qI1ThV.mjs";
19
19
  import { a as loadUserEnvFile } from "./env-validation-DBJsxZLz.mjs";
20
20
  import { i as resolveLayoutIds } from "./scan-2YmJkYAf.mjs";
21
- import { n as lintDuplicateSources, r as mergeRoutingRules, t as lintDestinationSplats } from "./headers-wAPJigtE.mjs";
22
- import { n as generateVoidAuthDrizzleSchema, t as generateVoidAuthDatabaseModule } from "./drizzle-DmaANP4-.mjs";
23
- import { t as INTERNAL_BINDING_PREFIXES } from "./env-raw-zk5JQKZe.mjs";
24
- import { n as defer } from "./defer-DkoEwda-.mjs";
21
+ import { n as STAGING_PROXY_URL, t as DEFAULT_PROXY_URL } from "./proxy-M3pxItg2.mjs";
22
+ import { n as lintDuplicateSources, r as mergeRoutingRules, t as lintDestinationSplats } from "./headers-Y0jshugF.mjs";
23
+ import { n as generateVoidAuthDrizzleSchema, t as generateVoidAuthDatabaseModule } from "./drizzle-2fs1qTgy.mjs";
24
+ import { t as INTERNAL_BINDING_PREFIXES } from "./env-raw-RDkMnSTC.mjs";
25
+ import { n as defer } from "./defer-CouVukrf.mjs";
25
26
  import { VoidAssetRewriteError, defineHandler, defineHead, defineMiddleware, defineQueue, defineRender, defineScheduled } from "./runtime/handler.mjs";
26
27
  import { closeSync, existsSync, mkdirSync, openSync, readFileSync, readdirSync, rmSync, writeFileSync, writeSync } from "node:fs";
27
28
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -305,26 +306,25 @@ async function readDevCssResponse(response) {
305
306
  }
306
307
 
307
308
  export async function getVoidPagesDevCss(request, env, payload) {
308
- const controller = new AbortController();
309
- const timeout = setTimeout(() => controller.abort(), 1500);
310
309
  const attempts = [];
310
+ attempts.push({
311
+ fetcher: "global",
312
+ label: INTERNAL_ORIGIN,
313
+ url: new URL(ENDPOINT, INTERNAL_ORIGIN).toString(),
314
+ });
311
315
  if (env?.ASSETS && typeof env.ASSETS.fetch === "function") {
312
316
  attempts.push({
313
317
  fetcher: env.ASSETS,
314
318
  label: "ASSETS",
315
319
  url: new URL(ENDPOINT, request.url).toString(),
316
320
  });
317
- } else {
318
- attempts.push({
319
- fetcher: "global",
320
- label: INTERNAL_ORIGIN,
321
- url: new URL(ENDPOINT, INTERNAL_ORIGIN).toString(),
322
- });
323
321
  }
324
322
  try {
325
323
  let lastError;
326
324
  let lastLabel = "unknown";
327
325
  for (const attempt of attempts) {
326
+ const controller = new AbortController();
327
+ const timeout = setTimeout(() => controller.abort(), 1500);
328
328
  try {
329
329
  const request = createDevCssRequest(attempt.url, payload, controller.signal);
330
330
  const response =
@@ -335,6 +335,8 @@ export async function getVoidPagesDevCss(request, env, payload) {
335
335
  } catch (error) {
336
336
  lastError = error;
337
337
  lastLabel = attempt.label;
338
+ } finally {
339
+ clearTimeout(timeout);
338
340
  }
339
341
  }
340
342
  throw new Error(
@@ -343,8 +345,6 @@ export async function getVoidPagesDevCss(request, env, payload) {
343
345
  } catch (error) {
344
346
  console.warn("[void] dev CSS collection failed:", error instanceof Error ? error.message : String(error));
345
347
  return [];
346
- } finally {
347
- clearTimeout(timeout);
348
348
  }
349
349
  }
350
350
  `;
@@ -420,6 +420,59 @@ export async function getVoidPagesDevCss(request, env, payload) {
420
420
  }];
421
421
  }
422
422
  //#endregion
423
+ //#region src/plugin-binding-runtime.ts
424
+ const envModuleResolved$1 = fileURLToPath(import.meta.resolve("#self/_env"));
425
+ const kvModuleResolved = fileURLToPath(import.meta.resolve("void/kv"));
426
+ const storageModuleResolved = fileURLToPath(import.meta.resolve("void/storage"));
427
+ const VIRTUAL_KV_ID = "\0virtual:void-kv";
428
+ const VIRTUAL_STORAGE_ID = "\0virtual:void-storage";
429
+ function bindingRuntimePlugin(bindingNames) {
430
+ return {
431
+ name: "void:binding-runtime",
432
+ enforce: "pre",
433
+ resolveId: {
434
+ filter: { id: /^(void\/kv|void\/storage)$/ },
435
+ handler(id) {
436
+ if (this.environment?.name === "client") return;
437
+ if (id === "void/kv" && bindingNames?.kv) return VIRTUAL_KV_ID;
438
+ if (id === "void/storage" && bindingNames?.r2) return VIRTUAL_STORAGE_ID;
439
+ }
440
+ },
441
+ load: {
442
+ filter: { id: /^\0virtual:void-(?:kv|storage)$/ },
443
+ handler(id) {
444
+ if (id === VIRTUAL_KV_ID) return `
445
+ import { requireRuntimeBinding } from ${JSON.stringify(envModuleResolved$1)};
446
+ import { createKV } from ${JSON.stringify(kvModuleResolved)};
447
+
448
+ const namespace = new Proxy({}, {
449
+ get(_, prop) {
450
+ const ns = requireRuntimeBinding(${JSON.stringify(bindingNames?.kv)});
451
+ const value = Reflect.get(ns, prop, ns);
452
+ return typeof value === 'function' ? value.bind(ns) : value;
453
+ },
454
+ });
455
+
456
+ export { createKV };
457
+ export const kv = createKV(namespace);
458
+ `;
459
+ if (id === VIRTUAL_STORAGE_ID) return `
460
+ import { requireRuntimeBinding } from ${JSON.stringify(envModuleResolved$1)};
461
+ export { createStorage } from ${JSON.stringify(storageModuleResolved)};
462
+
463
+ export const storage = new Proxy({}, {
464
+ get(_, prop) {
465
+ const bucket = requireRuntimeBinding(${JSON.stringify(bindingNames?.r2)});
466
+ const value = Reflect.get(bucket, prop, bucket);
467
+ return typeof value === 'function' ? value.bind(bucket) : value;
468
+ },
469
+ });
470
+ `;
471
+ }
472
+ }
473
+ };
474
+ }
475
+ //#endregion
423
476
  //#region src/plugin-dev-triggers-hint.ts
424
477
  /**
425
478
  * Prints a one-shot hint on dev server start when the project has crons
@@ -489,6 +542,7 @@ function drizzlePlugin(root, hasRouteTypes, dialect = "sqlite", options = {}) {
489
542
  const paths = readProjectPaths(root);
490
543
  const schema = discoverSchema(root, paths);
491
544
  const hasDbRuntime = schema != null || options.forceVirtualDb === true;
545
+ const d1BindingName = options.d1BindingName ?? "DB";
492
546
  ensureProjectTsconfig(root, hasRouteTypes, hasDbRuntime, schema != null, {
493
547
  redirectDbModule: options.redirectDbTypePaths,
494
548
  paths
@@ -584,7 +638,7 @@ let _instance;
584
638
 
585
639
  export const db = new Proxy({}, {
586
640
  get(_, prop) {
587
- _instance ??= drizzle(requireRuntimeBinding("DB")${drizzleConfig});
641
+ _instance ??= drizzle(requireRuntimeBinding(${JSON.stringify(d1BindingName)})${drizzleConfig});
588
642
  return Reflect.get(_instance, prop);
589
643
  },
590
644
  });
@@ -600,7 +654,7 @@ export function createDb(d1) {
600
654
  const migrationsDir = paths.migrationsDir;
601
655
  if (!(existsSync(migrationsDir) && readdirSync(migrationsDir).some((f) => f.endsWith(".sql")))) {
602
656
  if (dialect === "sqlite") {
603
- const { getApplicationTables, getMiniflareDatabasePath } = await import("./runner-DCYwTlee.mjs");
657
+ const { getApplicationTables, getMiniflareDatabasePath } = await import("./runner-DLZ9E_cX.mjs");
604
658
  if ((await getApplicationTables(getMiniflareDatabasePath(options.localD1PersistRoot ?? join(root, ".void"), options.localD1DatabaseId ?? "local")).catch(() => [])).length > 0) return;
605
659
  }
606
660
  voidWarn(`Schema found but no migrations in ${paths.sourceRelative("db/migrations")}/.\n \`void db push\` syncs the schema to your local DB without creating migration files.
@@ -689,7 +743,7 @@ function pushHit(node, hits) {
689
743
  }
690
744
  }
691
745
  /** Default Vite `envPrefix`. */
692
- const DEFAULT_ENV_PREFIXES$1 = ["VITE_"];
746
+ const DEFAULT_ENV_PREFIXES$2 = ["VITE_"];
693
747
  /**
694
748
  * Build-time constant folding for client-only `env.FOO` reads.
695
749
  *
@@ -718,7 +772,7 @@ const DEFAULT_ENV_PREFIXES$1 = ["VITE_"];
718
772
  * and editing `.env.local` take effect without a full rebuild.
719
773
  */
720
774
  function envClientFoldPlugin() {
721
- let envPrefixes = DEFAULT_ENV_PREFIXES$1;
775
+ let envPrefixes = DEFAULT_ENV_PREFIXES$2;
722
776
  let loadedEnv = {};
723
777
  const schemaDefaults = {};
724
778
  /** The merged view the transform consults for each key. */
@@ -737,7 +791,7 @@ function envClientFoldPlugin() {
737
791
  const prefix = config.envPrefix;
738
792
  if (typeof prefix === "string") envPrefixes = [prefix];
739
793
  else if (Array.isArray(prefix) && prefix.length > 0) envPrefixes = prefix;
740
- else envPrefixes = DEFAULT_ENV_PREFIXES$1;
794
+ else envPrefixes = DEFAULT_ENV_PREFIXES$2;
741
795
  loadedEnv = { ...config.env ?? {} };
742
796
  try {
743
797
  const mod = await loadEnvPublic$1();
@@ -893,9 +947,9 @@ function recordHit(node, hits) {
893
947
  * are skipped — only the `client` environment is checked.
894
948
  */
895
949
  /** Default value matches Vite's default `envPrefix`. */
896
- const DEFAULT_ENV_PREFIXES = ["VITE_"];
950
+ const DEFAULT_ENV_PREFIXES$1 = ["VITE_"];
897
951
  function envClientGuardPlugin(root) {
898
- let envPrefixes = DEFAULT_ENV_PREFIXES;
952
+ let envPrefixes = DEFAULT_ENV_PREFIXES$1;
899
953
  return {
900
954
  name: "void:env-client-guard",
901
955
  enforce: "post",
@@ -982,11 +1036,18 @@ async function loadSchemaModule() {
982
1036
  */
983
1037
  /** Patterns Vite's `define` typically uses for env-shaped constants. */
984
1038
  const DEFINE_ENV_PATTERN = /^(?:globalThis\.)?(?:process\.env|import\.meta\.env)\.([A-Z_][A-Z0-9_]*)$/;
1039
+ const DEFAULT_ENV_PREFIXES = ["VITE_"];
1040
+ function resolveEnvPrefixes(prefix) {
1041
+ if (typeof prefix === "string") return [prefix];
1042
+ if (Array.isArray(prefix) && prefix.length > 0) return prefix;
1043
+ return DEFAULT_ENV_PREFIXES;
1044
+ }
985
1045
  function envSchemaPlugin(root, options = {}) {
986
1046
  const outDir = join(root, ".void");
987
1047
  let envFile = null;
988
1048
  let viteMode = "development";
989
1049
  let envDir = root;
1050
+ const appliedClientDefaults = /* @__PURE__ */ new Map();
990
1051
  async function emitDefaults() {
991
1052
  if (!envFile || !options.onDefaults) return;
992
1053
  const { _hasRegisteredSchema, _getSchemaDefaults } = await loadSchemaModule();
@@ -1039,6 +1100,20 @@ function envSchemaPlugin(root, options = {}) {
1039
1100
  for (const { key, messages } of report.invalid) lines.push(` • ${key}: ${messages.join("; ")}`);
1040
1101
  voidWarn(lines.join("\n"));
1041
1102
  }
1103
+ async function applyClientDefaultsToViteEnv(config) {
1104
+ if (!envFile) return;
1105
+ for (const [key, value] of appliedClientDefaults) if (config.env[key] === value) delete config.env[key];
1106
+ appliedClientDefaults.clear();
1107
+ const { _hasRegisteredSchema, _getSchemaDefaults } = await loadSchemaModule();
1108
+ if (!_hasRegisteredSchema()) return;
1109
+ const prefixes = resolveEnvPrefixes(config.envPrefix);
1110
+ for (const [key, value] of Object.entries(_getSchemaDefaults())) {
1111
+ if (!prefixes.some((prefix) => key.startsWith(prefix))) continue;
1112
+ if (config.env[key] !== void 0) continue;
1113
+ config.env[key] = value;
1114
+ appliedClientDefaults.set(key, value);
1115
+ }
1116
+ }
1042
1117
  return {
1043
1118
  name: "void:env-schema",
1044
1119
  async config() {
@@ -1051,6 +1126,7 @@ function envSchemaPlugin(root, options = {}) {
1051
1126
  async configResolved(config) {
1052
1127
  viteMode = config.mode;
1053
1128
  envDir = typeof config.envDir === "string" ? config.envDir : root;
1129
+ await applyClientDefaultsToViteEnv(config);
1054
1130
  if (envFile && config.define) await warnOnDefineOverlap(config.define);
1055
1131
  },
1056
1132
  async configureServer(server) {
@@ -1068,7 +1144,9 @@ function envSchemaPlugin(root, options = {}) {
1068
1144
  regenerateTypes();
1069
1145
  await importUserEnv();
1070
1146
  await emitDefaults();
1147
+ await applyClientDefaultsToViteEnv(server.config);
1071
1148
  await validateAndWarn();
1149
+ server.ws.send({ type: "full-reload" });
1072
1150
  }
1073
1151
  });
1074
1152
  },
@@ -1576,7 +1654,7 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
1576
1654
  else warn();
1577
1655
  return;
1578
1656
  }
1579
- const { runPgMigrations, getPgAppliedMigrations } = await import("./runner-pg-CJ04wNk5.mjs");
1657
+ const { runPgMigrations, getPgAppliedMigrations } = await import("./runner-pg-Cv9V7ydr.mjs");
1580
1658
  const { collectMigrations } = await import("./collect-9rO3JFNM.mjs").then((n) => n.n);
1581
1659
  const { validateMigrations } = await import("./validate-CNWm-PsL.mjs").then((n) => n.i);
1582
1660
  const allMigrations = collectMigrations(migrationsDir);
@@ -1591,7 +1669,7 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
1591
1669
  const applied = await runPgMigrations(migrationsDir, url);
1592
1670
  if (applied.length > 0) voidLog(`Applied ${applied.length} migration(s): ${applied.join(", ")}`);
1593
1671
  } else if (hasSqlMigrations) {
1594
- const { runMigrations, getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-DCYwTlee.mjs");
1672
+ const { runMigrations, getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-DLZ9E_cX.mjs");
1595
1673
  const { collectMigrations } = await import("./collect-9rO3JFNM.mjs").then((n) => n.n);
1596
1674
  const { validateMigrations } = await import("./validate-CNWm-PsL.mjs").then((n) => n.i);
1597
1675
  const dbPath = getMiniflareDatabasePath(persistRoot, databaseId);
@@ -1608,7 +1686,7 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
1608
1686
  if (applied.length > 0) voidLog(`Applied ${applied.length} migration(s): ${applied.join(", ")}`);
1609
1687
  }
1610
1688
  if (auth?.enabled) {
1611
- const { runLocalVoidAuthMigrations } = await import("./node-x1AzR6Yf.mjs");
1689
+ const { runLocalVoidAuthMigrations } = await import("./node-CHWVVjO6.mjs");
1612
1690
  await runLocalVoidAuthMigrations(root, dialect, persistRoot, databaseId, auth.configPath);
1613
1691
  voidLog("Applied Better Auth migrations");
1614
1692
  }
@@ -2940,16 +3018,23 @@ window.__vite_plugin_react_preamble_installed__ = true;
2940
3018
  lines.push("");
2941
3019
  }
2942
3020
  if (options.migrationHandlerPath && (options.migrations?.length || auth)) {
3021
+ const d1BindingName = options.bindingNames?.d1;
2943
3022
  lines.push(`import { createMigrationHandler as __createMigrationHandler } from ${JSON.stringify(options.migrationHandlerPath)};`);
2944
3023
  lines.push(`const __migrations = ${JSON.stringify(options.migrations)};`);
2945
3024
  lines.push(`const __migrationPlanBundle = ${JSON.stringify(options.migrationPlanBundle)};`);
2946
3025
  lines.push(`const __migrationDialect = ${JSON.stringify(options.migrationDialect ?? "sqlite")};`);
3026
+ if (d1BindingName) lines.push(`function __voidGetMigrationEnv() {
3027
+ const env = __getRawEnv();
3028
+ if (!env || env[${JSON.stringify(d1BindingName)}] == null) return env;
3029
+ return { ...env, DB: env[${JSON.stringify(d1BindingName)}] };
3030
+ }`);
3031
+ else lines.push("function __voidGetMigrationEnv() { return __getRawEnv(); }");
2947
3032
  lines.push("function __voidCreateMigrationRequestHandler(request, includeAuthMigrations, includePlanBundle) {");
2948
3033
  lines.push(" return __createMigrationHandler(");
2949
- lines.push(" __getRawEnv(),");
3034
+ lines.push(" __voidGetMigrationEnv(),");
2950
3035
  lines.push(" __migrations,");
2951
3036
  lines.push(" __migrationDialect,");
2952
- if (auth) lines.push(` includeAuthMigrations ? () => runVoidAuthMigrations(new Request(request.url), __getRawEnv(), __voidAuthOptions${auth.authSchemaPath ? ", __voidAuthMigrationSchema" : ""}) : undefined,`);
3037
+ if (auth) lines.push(` includeAuthMigrations ? () => runVoidAuthMigrations(new Request(request.url), __voidGetMigrationEnv(), __voidAuthOptions${auth.authSchemaPath ? ", __voidAuthMigrationSchema" : ""}) : undefined,`);
2953
3038
  else lines.push(" undefined,");
2954
3039
  lines.push(" includePlanBundle ? __migrationPlanBundle : undefined,");
2955
3040
  lines.push(" );");
@@ -2977,20 +3062,20 @@ window.__vite_plugin_react_preamble_installed__ = true;
2977
3062
  lines.push("}");
2978
3063
  lines.push("app.post(\"/__void/migrate\", async (c) => {");
2979
3064
  lines.push(" const __voidMigrationHandler = __createMigrationHandler(");
2980
- lines.push(" __getRawEnv(),");
3065
+ lines.push(" __voidGetMigrationEnv(),");
2981
3066
  lines.push(" __migrations,");
2982
3067
  lines.push(" __migrationDialect,");
2983
- if (auth) lines.push(` () => runVoidAuthMigrations(new Request(c.req.url), __getRawEnv(), __voidAuthOptions${auth.authSchemaPath ? ", __voidAuthMigrationSchema" : ""}),`);
3068
+ if (auth) lines.push(` () => runVoidAuthMigrations(new Request(c.req.url), __voidGetMigrationEnv(), __voidAuthOptions${auth.authSchemaPath ? ", __voidAuthMigrationSchema" : ""}),`);
2984
3069
  else lines.push(" undefined,");
2985
3070
  lines.push(" );");
2986
3071
  lines.push(" return __voidMigrationHandler(c.req.raw);");
2987
3072
  lines.push("});");
2988
3073
  lines.push("app.get(\"/__void/migrate/capabilities\", async (c) => {");
2989
3074
  lines.push(" const __voidMigrationHandler = __createMigrationHandler(");
2990
- lines.push(" __getRawEnv(),");
3075
+ lines.push(" __voidGetMigrationEnv(),");
2991
3076
  lines.push(" __migrations,");
2992
3077
  lines.push(" __migrationDialect,");
2993
- if (auth) lines.push(` () => runVoidAuthMigrations(new Request(c.req.url), __getRawEnv(), __voidAuthOptions${auth.authSchemaPath ? ", __voidAuthMigrationSchema" : ""}),`);
3078
+ if (auth) lines.push(` () => runVoidAuthMigrations(new Request(c.req.url), __voidGetMigrationEnv(), __voidAuthOptions${auth.authSchemaPath ? ", __voidAuthMigrationSchema" : ""}),`);
2994
3079
  else lines.push(" undefined,");
2995
3080
  lines.push(" __migrationPlanBundle,");
2996
3081
  lines.push(" );");
@@ -2998,7 +3083,7 @@ window.__vite_plugin_react_preamble_installed__ = true;
2998
3083
  lines.push("});");
2999
3084
  lines.push("app.post(\"/__void/migrate/app\", async (c) => {");
3000
3085
  lines.push(" const __voidMigrationHandler = __createMigrationHandler(");
3001
- lines.push(" __getRawEnv(),");
3086
+ lines.push(" __voidGetMigrationEnv(),");
3002
3087
  lines.push(" __migrations,");
3003
3088
  lines.push(" __migrationDialect,");
3004
3089
  lines.push(" undefined,");
@@ -3008,7 +3093,7 @@ window.__vite_plugin_react_preamble_installed__ = true;
3008
3093
  lines.push("});");
3009
3094
  lines.push("app.get(\"/__void/migrate/app/attempt/:attemptId\", async (c) => {");
3010
3095
  lines.push(" const __voidMigrationHandler = __createMigrationHandler(");
3011
- lines.push(" __getRawEnv(),");
3096
+ lines.push(" __voidGetMigrationEnv(),");
3012
3097
  lines.push(" __migrations,");
3013
3098
  lines.push(" __migrationDialect,");
3014
3099
  lines.push(" undefined,");
@@ -3019,10 +3104,10 @@ window.__vite_plugin_react_preamble_installed__ = true;
3019
3104
  if (auth) {
3020
3105
  lines.push("app.post(\"/__void/migrate/auth\", async (c) => {");
3021
3106
  lines.push(" const __voidMigrationHandler = __createMigrationHandler(");
3022
- lines.push(" __getRawEnv(),");
3107
+ lines.push(" __voidGetMigrationEnv(),");
3023
3108
  lines.push(" __migrations,");
3024
3109
  lines.push(" __migrationDialect,");
3025
- lines.push(` () => runVoidAuthMigrations(new Request(c.req.url), __getRawEnv(), __voidAuthOptions${auth.authSchemaPath ? ", __voidAuthMigrationSchema" : ""}),`);
3110
+ lines.push(` () => runVoidAuthMigrations(new Request(c.req.url), __voidGetMigrationEnv(), __voidAuthOptions${auth.authSchemaPath ? ", __voidAuthMigrationSchema" : ""}),`);
3026
3111
  lines.push(" __migrationPlanBundle,");
3027
3112
  lines.push(" );");
3028
3113
  lines.push(" return __voidMigrationHandler(c.req.raw);");
@@ -3465,6 +3550,50 @@ function compilePageRoutes(lines, scan, pages, options) {
3465
3550
  lines.push("");
3466
3551
  }
3467
3552
  /**
3553
+ * Generate the asset fallthrough helper shared by native Void workers and
3554
+ * Class A framework wrappers. If the app returns 404, check ASSETS binding
3555
+ * for static files and set cache headers. Edge caching of hashed assets
3556
+ * happens at the dispatch layer (see design doc 0042).
3557
+ */
3558
+ function compileAssetFallbackHelper(assetsDir = "assets", serveSpaFallback = false) {
3559
+ const spaFallbackCode = serveSpaFallback ? ` // SPA fallback: when HTML-owning features make
3560
+ // assetConfig.not_found_handling = 'none', the asset binding returns 404
3561
+ // instead of falling back to index.html itself. Do that fallback here, after
3562
+ // user routes/middleware have run, so auth gates and OAuth callbacks see the request first.
3563
+ // Pages and SSR apps leave this disabled so intentional HTML 404s stay 404.
3564
+ const accept = request.headers.get("accept") ?? "";
3565
+ if (accept.includes("text/html")) {
3566
+ const indexUrl = new URL("/index.html", request.url);
3567
+ const indexAsset = await env.ASSETS.fetch(new Request(indexUrl, { method: request.method }));
3568
+ if (indexAsset.status === 200) {
3569
+ const res = new Response(indexAsset.body, {
3570
+ status: 200,
3571
+ headers: indexAsset.headers,
3572
+ });
3573
+ res.headers.set("Cache-Control", "no-store");
3574
+ res.headers.set("Content-Type", "text/html; charset=utf-8");
3575
+ return res;
3576
+ }
3577
+ }
3578
+ return response;` : ` return response;`;
3579
+ return `
3580
+ async function serveWithAssets(request, env, response) {
3581
+ if (response.status !== 404 || !env.ASSETS || (request.method !== "GET" && request.method !== "HEAD")) return response;
3582
+ const asset = await env.ASSETS.fetch(new Request(request.url, { method: request.method, headers: request.headers }));
3583
+ if (asset.status !== 404) {
3584
+ const res = new Response(asset.body, asset);
3585
+ if (new URL(request.url).pathname.startsWith(${JSON.stringify("/" + assetsDir + "/")})) {
3586
+ res.headers.set("Cache-Control", "public, max-age=31536000, immutable");
3587
+ } else {
3588
+ res.headers.set("Cache-Control", "no-store");
3589
+ }
3590
+ return res;
3591
+ }
3592
+ ${spaFallbackCode}
3593
+ }
3594
+ `;
3595
+ }
3596
+ /**
3468
3597
  * Generate the Worker entry module code.
3469
3598
  * Re-exports the Hono app from the virtual module with an asset-serving
3470
3599
  * fallthrough: when the app returns 404, the entry tries env.ASSETS.fetch()
@@ -3481,6 +3610,8 @@ function compilePageRoutes(lines, scan, pages, options) {
3481
3610
  */
3482
3611
  function compileWorkerEntry(hasQueues = false, remote, assetsDir = "assets", webSocketClasses = [], runtimeEnvPath = "void/_env", envSchemaModule, sandbox, serveSpaFallback = false, live) {
3483
3612
  const remotePath = remote?.remotePath;
3613
+ const remoteBindingNames = JSON.stringify(remote?.bindingNames);
3614
+ const createRemoteEnvCall = `createRemoteEnv(env${remote?.bindingNames ? `, ${remoteBindingNames}` : ""})`;
3484
3615
  const hasSandbox = sandbox === true || typeof sandbox === "object";
3485
3616
  const sandboxClassName = typeof sandbox === "object" ? sandbox.className ?? "Sandbox" : "Sandbox";
3486
3617
  const sandboxBindingName = typeof sandbox === "object" ? sandbox.bindingName ?? "SANDBOX" : "SANDBOX";
@@ -3521,46 +3652,11 @@ function __filterInternalBindings(env) {
3521
3652
  });
3522
3653
  }
3523
3654
  `;
3524
- const spaFallbackCode = serveSpaFallback ? ` // SPA fallback: when HTML-owning features make
3525
- // assetConfig.not_found_handling = 'none', the asset binding returns 404
3526
- // instead of falling back to index.html itself. Do that fallback here, after
3527
- // user routes/middleware have run, so auth gates and OAuth callbacks see the request first.
3528
- // Pages and SSR apps leave this disabled so intentional HTML 404s stay 404.
3529
- const accept = request.headers.get("accept") ?? "";
3530
- if (accept.includes("text/html")) {
3531
- const indexUrl = new URL("/index.html", request.url);
3532
- const indexAsset = await env.ASSETS.fetch(new Request(indexUrl, { method: request.method }));
3533
- if (indexAsset.status === 200) {
3534
- const res = new Response(indexAsset.body, {
3535
- status: 200,
3536
- headers: indexAsset.headers,
3537
- });
3538
- res.headers.set("Cache-Control", "no-store");
3539
- res.headers.set("Content-Type", "text/html; charset=utf-8");
3540
- return res;
3541
- }
3542
- }
3543
- return response;` : ` return response;`;
3544
- const assetHelper = `
3545
- async function serveWithAssets(request, env, response) {
3546
- if (response.status !== 404 || !env.ASSETS || (request.method !== "GET" && request.method !== "HEAD")) return response;
3547
- const asset = await env.ASSETS.fetch(new Request(request.url, { method: request.method, headers: request.headers }));
3548
- if (asset.status !== 404) {
3549
- const res = new Response(asset.body, asset);
3550
- if (new URL(request.url).pathname.startsWith(${JSON.stringify("/" + assetsDir + "/")})) {
3551
- res.headers.set("Cache-Control", "public, max-age=31536000, immutable");
3552
- } else {
3553
- res.headers.set("Cache-Control", "no-store");
3554
- }
3555
- return res;
3556
- }
3557
- ${spaFallbackCode}
3558
- }
3559
- `;
3655
+ const assetHelper = compileAssetFallbackHelper(assetsDir, serveSpaFallback);
3560
3656
  const fetchHandler = remotePath ? `async (request, env, ctx) => {
3561
3657
  ${envValidateCall} const ws = await __voidHandleWebSocket(request, env);
3562
3658
  if (ws) return ws;
3563
- if (env.__VOID_REMOTE === "1") env = createRemoteEnv(env);
3659
+ if (env.__VOID_REMOTE === "1") env = ${createRemoteEnvCall};
3564
3660
  return __withRawEnv(env, () => {
3565
3661
  const userEnv = __filterInternalBindings(env);
3566
3662
  return withRuntimeEnv(env, async () => {
@@ -3602,7 +3698,7 @@ ${envValidateCall} const ws = await __voidHandleWebSocket(request, env);
3602
3698
  return Response.json({ paths });
3603
3699
  }`;
3604
3700
  const scheduledHandler = remotePath ? `async function handleScheduled(controller, env, ctx) {
3605
- ${envValidateCall} if (env.__VOID_REMOTE === "1") env = createRemoteEnv(env);
3701
+ ${envValidateCall} if (env.__VOID_REMOTE === "1") env = ${createRemoteEnvCall};
3606
3702
  const userEnv = __filterInternalBindings(env);
3607
3703
  return withRuntimeEnv(env, () => scheduled(controller, userEnv, ctx));
3608
3704
  }` : `async function handleScheduled(controller, env, ctx) {
@@ -3614,7 +3710,7 @@ ${runtimeEnvImport}${envSchemaImport}${remoteImport}${filterBindingsHelper}${ass
3614
3710
  ${internalRouteHelper}
3615
3711
  ${scheduledHandler}
3616
3712
  async function queue(batch, env, ctx) {
3617
- ${envValidateCall}${remotePath ? ` if (env.__VOID_REMOTE === "1") env = createRemoteEnv(env);\n` : ""} const userEnv = __filterInternalBindings(env);
3713
+ ${envValidateCall}${remotePath ? ` if (env.__VOID_REMOTE === "1") env = ${createRemoteEnvCall};\n` : ""} const userEnv = __filterInternalBindings(env);
3618
3714
  const messages = [...batch.messages].map(m => ({
3619
3715
  id: m.id, timestamp: m.timestamp.toISOString(),
3620
3716
  body: m.body, attempts: m.attempts,
@@ -4109,14 +4205,16 @@ export async function fetch(path, options) {
4109
4205
  const VIRTUAL_ROUTES_ID = "virtual:void-routes";
4110
4206
  const VIRTUAL_CLIENT_WORKER_ID = "virtual:void-client-worker";
4111
4207
  const VIRTUAL_CLIENT_BROWSER_ID = "virtual:void-client-browser";
4208
+ const CLIENT_IMPORT_RE = /^void\/client(?:\/(react|vue|svelte|solid))?$/;
4209
+ const VIRTUAL_CLIENT_RE = /^virtual:void-client-(browser|worker)(?::(react|vue|svelte|solid))?$/;
4112
4210
  const PAGE_VIRTUAL_MODULE_IDS = [
4113
4211
  "\0virtual:void-pages-renderer",
4114
4212
  "\0virtual:void-pages-client",
4115
4213
  "\0virtual:void-islands-renderer",
4116
4214
  "\0virtual:void-islands-client"
4117
4215
  ];
4118
- const RESOLVE_ID_FILTER = /^(virtual:void-(routes|client-worker|client-browser)|void(\/client|\/queues)?)$/;
4119
- const LOAD_ID_FILTER = /^virtual:void-(routes|client-worker|client-browser)$/;
4216
+ const RESOLVE_ID_FILTER = /^(virtual:void-(routes|client-worker(?::(react|vue|svelte|solid))?|client-browser(?::(react|vue|svelte|solid))?)|void(\/client(\/(react|vue|svelte|solid))?|\/queues)?)$/;
4217
+ const LOAD_ID_FILTER = /^virtual:void-(routes|client-worker(?::(react|vue|svelte|solid))?|client-browser(?::(react|vue|svelte|solid))?)$/;
4120
4218
  function routingPlugin(root, options) {
4121
4219
  let scan = null;
4122
4220
  let ssr = null;
@@ -4170,7 +4268,14 @@ function routingPlugin(root, options) {
4170
4268
  const sandboxRuntimePath = resolveFile("#self/sandbox");
4171
4269
  const drizzleAdapterPath = resolveFile("better-auth/adapters/drizzle");
4172
4270
  let authClientPath = join(runtimeDir, "auth-client.mjs");
4271
+ const explicitAuthClientPaths = {
4272
+ react: join(runtimeDir, "auth-client-react.mjs"),
4273
+ vue: join(runtimeDir, "auth-client-vue.mjs"),
4274
+ svelte: join(runtimeDir, "auth-client-svelte.mjs"),
4275
+ solid: join(runtimeDir, "auth-client-solid.mjs")
4276
+ };
4173
4277
  const remote = options.remoteMode ? {
4278
+ bindingNames: options.bindingNames,
4174
4279
  remotePath: resolveFile("#self/remote"),
4175
4280
  envPath: resolveFile("#self/_env")
4176
4281
  } : void 0;
@@ -4198,7 +4303,8 @@ function routingPlugin(root, options) {
4198
4303
  auth: null,
4199
4304
  nodeTarget: !!options.target,
4200
4305
  explicitPrerenderPaths: options.prerenderPaths,
4201
- bindingHandlerPath: options.target ? void 0 : resolveFile("#self/remote/binding-handler")
4306
+ bindingHandlerPath: options.target ? void 0 : resolveFile("#self/remote/binding-handler"),
4307
+ bindingNames: options.bindingNames
4202
4308
  };
4203
4309
  let publicDir = join(root, "public");
4204
4310
  function reloadFileRules() {
@@ -4252,12 +4358,21 @@ function routingPlugin(root, options) {
4252
4358
  }
4253
4359
  let resolvedConfig = null;
4254
4360
  function resolveAuthClientPath(config) {
4255
- if (config.plugins.some((plugin) => plugin.name === "void-react:pages")) return join(runtimeDir, "auth-client-react.mjs");
4256
- if (config.plugins.some((plugin) => plugin.name === "void-vue:pages")) return join(runtimeDir, "auth-client-vue.mjs");
4257
- if (config.plugins.some((plugin) => plugin.name === "void-svelte:pages")) return join(runtimeDir, "auth-client-svelte.mjs");
4258
- if (config.plugins.some((plugin) => plugin.name === "void-solid:pages")) return join(runtimeDir, "auth-client-solid.mjs");
4361
+ if (config.plugins.some((plugin) => plugin.name === "void-react:pages")) return explicitAuthClientPaths.react;
4362
+ if (config.plugins.some((plugin) => plugin.name === "void-vue:pages")) return explicitAuthClientPaths.vue;
4363
+ if (config.plugins.some((plugin) => plugin.name === "void-svelte:pages")) return explicitAuthClientPaths.svelte;
4364
+ if (config.plugins.some((plugin) => plugin.name === "void-solid:pages")) return explicitAuthClientPaths.solid;
4259
4365
  return join(runtimeDir, "auth-client.mjs");
4260
4366
  }
4367
+ function getClientAuthPath(id) {
4368
+ const framework = VIRTUAL_CLIENT_RE.exec(id)?.[2];
4369
+ return framework ? explicitAuthClientPaths[framework] : authClientPath;
4370
+ }
4371
+ function resolveVirtualClientId(id, environmentName) {
4372
+ const framework = CLIENT_IMPORT_RE.exec(id)?.[1];
4373
+ const base = environmentName === "client" ? VIRTUAL_CLIENT_BROWSER_ID : VIRTUAL_CLIENT_WORKER_ID;
4374
+ return framework ? `${base}:${framework}` : base;
4375
+ }
4261
4376
  function isPotentialAuthConfigPath(path) {
4262
4377
  return authConfigPaths.has(normalizePath(path));
4263
4378
  }
@@ -4391,16 +4506,17 @@ function routingPlugin(root, options) {
4391
4506
  if (id === VIRTUAL_CLIENT_BROWSER_ID) return VIRTUAL_CLIENT_BROWSER_ID;
4392
4507
  if (id === "void") return handlerFile;
4393
4508
  if (id === "void/queues") return resolveFile("#self/queues");
4394
- if (id === "void/client") return this.environment?.name === "client" ? VIRTUAL_CLIENT_BROWSER_ID : VIRTUAL_CLIENT_WORKER_ID;
4509
+ if (CLIENT_IMPORT_RE.test(id)) return resolveVirtualClientId(id, this.environment?.name);
4395
4510
  }
4396
4511
  },
4397
4512
  load: {
4398
4513
  filter: { id: LOAD_ID_FILTER },
4399
4514
  async handler(id) {
4400
- if (id === VIRTUAL_CLIENT_BROWSER_ID) return compileBrowserClient(authClientPath, fetchPath, fetchStreamPath);
4401
- if (id === VIRTUAL_CLIENT_WORKER_ID) {
4402
- if (options.target) return compileNodeClient(authClientPath);
4403
- return compileWorkerClient(authClientPath);
4515
+ const virtualClient = VIRTUAL_CLIENT_RE.exec(id);
4516
+ if (virtualClient?.[1] === "browser") return compileBrowserClient(getClientAuthPath(id), fetchPath, fetchStreamPath);
4517
+ if (virtualClient?.[1] === "worker") {
4518
+ if (options.target) return compileNodeClient(getClientAuthPath(id));
4519
+ return compileWorkerClient(getClientAuthPath(id));
4404
4520
  }
4405
4521
  if (id !== VIRTUAL_ROUTES_ID) return;
4406
4522
  if (!scan) await rescan();
@@ -4597,7 +4713,7 @@ function getOriginalFrameworkEntry(framework, root) {
4597
4713
  * dispatch file (and its transitive user-cron/queue imports + dev token)
4598
4714
  * would still ship in the production bundle.
4599
4715
  */
4600
- function generateClassATriggerWrapper(root, framework, original, isBuild) {
4716
+ function generateClassATriggerWrapper(root, framework, original, isBuild, assetsDir = "assets") {
4601
4717
  const outDir = join(root, ".void");
4602
4718
  mkdirSync(outDir, { recursive: true });
4603
4719
  const wrapperPath = join(outDir, `${framework}-trigger-wrapper.ts`);
@@ -4607,9 +4723,10 @@ import original from ${JSON.stringify(original)};
4607
4723
  export default {
4608
4724
  ...original,
4609
4725
  async fetch(request, env, ctx) {
4610
- return original.fetch(request, env, ctx);
4726
+ return serveWithAssets(request, env, await original.fetch(request, env, ctx));
4611
4727
  },
4612
4728
  };
4729
+ ${compileAssetFallbackHelper(assetsDir)}
4613
4730
  ` : `// @ts-nocheck — Auto-generated by Void in dev. Do NOT edit.
4614
4731
  import original from ${JSON.stringify(original)};
4615
4732
 
@@ -4794,9 +4911,9 @@ const STAGING_API_URL = "https://api.staging.void.cloud";
4794
4911
  */
4795
4912
  async function runAiSetupPrompt(root, token, staging, server) {
4796
4913
  const { select, text, isCancel, log } = await import("./dist-abzUneor.mjs").then((n) => n.p);
4797
- const { PlatformClient } = await import("./client-CCOKwNUz.mjs").then((n) => n.r);
4914
+ const { PlatformClient } = await import("./client-DIfOFf1W.mjs").then((n) => n.r);
4798
4915
  const { writeProjectConfig } = await import("./project-CH9pdo16.mjs").then((n) => n.n);
4799
- const { inferDefaultSlug } = await import("./resolve-project-CNpUbUHd.mjs").then((n) => n.i);
4916
+ const { inferDefaultSlug } = await import("./resolve-project-D4O1_fZz.mjs").then((n) => n.i);
4800
4917
  const client = new PlatformClient(token, staging ? STAGING_API_URL : DEFAULT_API_URL);
4801
4918
  let projects;
4802
4919
  try {
@@ -4822,8 +4939,8 @@ async function runAiSetupPrompt(root, token, staging, server) {
4822
4939
  let projectId;
4823
4940
  let slug;
4824
4941
  if (result === "__create__") {
4825
- const { validateProjectSlug } = await import("./project-slug-De4UjtD9.mjs").then((n) => n.t);
4826
- const { createProjectWithSlugRetry } = await import("./create-project-DmGoYMqF.mjs").then((n) => n.t);
4942
+ const { validateProjectSlug } = await import("./project-slug-rX3kTOfY.mjs").then((n) => n.t);
4943
+ const { createProjectWithSlugRetry } = await import("./create-project-DCUrFJxa.mjs").then((n) => n.t);
4827
4944
  let created;
4828
4945
  try {
4829
4946
  created = await createProjectWithSlugRetry(client, inferDefaultSlug(root), async (defaultSlug) => {
@@ -4885,6 +5002,7 @@ function voidPlugin(options) {
4885
5002
  const framework = detected?.class === "a" ? detected.name : void 0;
4886
5003
  const scanDirs = config.inference?.scanDirs ?? (detected ? FRAMEWORK_SCAN_DIRS : void 0);
4887
5004
  const inferenceOptions = config.inference?.bindings ? { bindings: config.inference.bindings } : void 0;
5005
+ const bindingNames = resolveBindingNames(config.inference?.bindings);
4888
5006
  const inferredBindings = inferProjectBindings(root, {
4889
5007
  ...inferenceOptions,
4890
5008
  paths
@@ -4950,7 +5068,6 @@ function voidPlugin(options) {
4950
5068
  reservedClasses: [...websocketRoutes.map((route) => route.className), sandboxConfig?.className]
4951
5069
  }) : readExistingLiveBindingConfig(root) : void 0;
4952
5070
  if (detected && (detected.class === "b" || detected.class === "c")) {
4953
- const bindingNames = resolveBindingNames(config.inference?.bindings);
4954
5071
  const frameworkPersistRoot = join(root, ".wrangler", "state");
4955
5072
  const syncFrameworkCompat = (compat) => {
4956
5073
  if (ensureWranglerCompatibilityDate(root, compat.compatibilityDate)) voidLog("Synced compatibility_date to wrangler config");
@@ -4999,11 +5116,13 @@ function voidPlugin(options) {
4999
5116
  }
5000
5117
  },
5001
5118
  clientStubsPlugin,
5119
+ bindingRuntimePlugin(bindingNames),
5002
5120
  envSchemaPlugin(root),
5003
5121
  envClientGuardPlugin(root),
5004
5122
  envClientFoldPlugin(),
5005
5123
  drizzlePlugin(root, false, dialect, {
5006
- forceVirtualDb: authEnabled,
5124
+ d1BindingName: bindingNames?.d1,
5125
+ forceVirtualDb: authEnabled || bindingNames?.d1 !== void 0,
5007
5126
  localD1PersistRoot: frameworkPersistRoot
5008
5127
  }),
5009
5128
  migrationPlugin(root, dialect, "local", frameworkPersistRoot, { enabled: false }),
@@ -5037,21 +5156,24 @@ function voidPlugin(options) {
5037
5156
  delete resolved.assets.not_found_handling;
5038
5157
  delete resolved.assets.run_worker_first;
5039
5158
  }
5159
+ const d1Name = bindingNames?.d1 ?? "DB";
5040
5160
  const d1 = [];
5041
- if ((bindings.needsD1 || authEnabled && dialect === "sqlite") && !hasBinding(resolved.d1_databases, "DB")) d1.push({
5042
- binding: "DB",
5161
+ if ((bindings.needsD1 || authEnabled && dialect === "sqlite") && !hasBinding(resolved.d1_databases, d1Name)) d1.push({
5162
+ binding: d1Name,
5043
5163
  database_name: "default",
5044
5164
  database_id: "local"
5045
5165
  });
5046
- if (d1.length > 0) result.d1_databases = [...resolved.d1_databases ?? [], ...d1];
5166
+ if (d1.length > 0) result.d1_databases = d1;
5167
+ const kvName = bindingNames?.kv ?? "KV";
5047
5168
  const kv = [];
5048
- if (bindings.needsKV && !hasBinding(resolved.kv_namespaces, "KV")) kv.push({
5049
- binding: "KV",
5169
+ if (bindings.needsKV && !hasBinding(resolved.kv_namespaces, kvName)) kv.push({
5170
+ binding: kvName,
5050
5171
  id: "local"
5051
5172
  });
5052
- if (kv.length > 0) result.kv_namespaces = [...resolved.kv_namespaces ?? [], ...kv];
5053
- if (bindings.needsR2 && !hasBinding(resolved.r2_buckets, "STORAGE")) result.r2_buckets = [...resolved.r2_buckets ?? [], {
5054
- binding: "STORAGE",
5173
+ if (kv.length > 0) result.kv_namespaces = kv;
5174
+ const r2Name = bindingNames?.r2 ?? "STORAGE";
5175
+ if (bindings.needsR2 && !hasBinding(resolved.r2_buckets, r2Name)) result.r2_buckets = [{
5176
+ binding: r2Name,
5055
5177
  bucket_name: "default"
5056
5178
  }];
5057
5179
  if (queues.length > 0) result.queues = {
@@ -5256,6 +5378,13 @@ function voidPlugin(options) {
5256
5378
  };
5257
5379
  if (framework) {
5258
5380
  workerConfig.main = getFrameworkEntry(framework, root, devTriggerToken);
5381
+ const frameworkBuildWrapperPlugin = {
5382
+ name: "void:framework-build-wrapper",
5383
+ configResolved(resolved) {
5384
+ if (resolved.command !== "build") return;
5385
+ generateClassATriggerWrapper(root, framework, getOriginalFrameworkEntry(framework, root), true, resolved.build.assetsDir);
5386
+ }
5387
+ };
5259
5388
  const existingFlags = workerConfig.compatibility_flags ?? [];
5260
5389
  if (!existingFlags.includes("nodejs_compat")) workerConfig.compatibility_flags = [...existingFlags, "nodejs_compat"];
5261
5390
  const viteEnvironment = framework === "vinext-app" ? {
@@ -5285,13 +5414,16 @@ function voidPlugin(options) {
5285
5414
  envClientGuardPlugin(root),
5286
5415
  envClientFoldPlugin(),
5287
5416
  clientStubsPlugin,
5417
+ bindingRuntimePlugin(bindingNames),
5288
5418
  drizzlePlugin(root, false, getDatabaseDialect(config), {
5289
- forceVirtualDb: authEnabled,
5419
+ d1BindingName: bindingNames?.d1,
5420
+ forceVirtualDb: authEnabled || bindingNames?.d1 !== void 0,
5290
5421
  localD1PersistRoot: options?.persistTo ?? outDir,
5291
5422
  redirectDbTypePaths
5292
5423
  }),
5293
5424
  migrationPlugin(root, getDatabaseDialect(config)),
5294
5425
  ...vinextCompat ? [vinextCompat] : [],
5426
+ frameworkBuildWrapperPlugin,
5295
5427
  frameworkTriggersPlugin(root, { devTriggerToken }),
5296
5428
  devTriggersHintPlugin(root, {
5297
5429
  framework: true,
@@ -5381,6 +5513,7 @@ function voidPlugin(options) {
5381
5513
  envClientGuardPlugin(root),
5382
5514
  envClientFoldPlugin(),
5383
5515
  clientStubsPlugin,
5516
+ bindingRuntimePlugin(bindingNames),
5384
5517
  ...bindings.needsSandbox ? [createSandboxSdkResolvePlugin()] : [],
5385
5518
  ...pagesDevCssAssetsPlugin(root, devTriggerToken),
5386
5519
  routingPlugin(root, {
@@ -5391,6 +5524,7 @@ function voidPlugin(options) {
5391
5524
  prerenderPaths: config.routing?.prerender,
5392
5525
  remoteMode,
5393
5526
  routing: config.routing,
5527
+ bindingNames,
5394
5528
  hasSandbox: bindings.needsSandbox,
5395
5529
  sandboxBindingName: sandboxConfig?.binding,
5396
5530
  sandboxClassName: sandboxConfig?.className,
@@ -5398,7 +5532,8 @@ function voidPlugin(options) {
5398
5532
  onDevAssetRoutingPolicyChange: updateDevAssetRoutingPolicy
5399
5533
  }),
5400
5534
  drizzlePlugin(root, true, dialect, {
5401
- forceVirtualDb: authEnabled,
5535
+ d1BindingName: bindingNames?.d1,
5536
+ forceVirtualDb: authEnabled || bindingNames?.d1 !== void 0,
5402
5537
  localD1PersistRoot: options?.persistTo ?? outDir
5403
5538
  }),
5404
5539
  migrationPlugin(root, dialect, "local", join(root, ".void"), {