void 0.8.11 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{better-auth-shared-BXdg2Sur.d.mts → better-auth-shared-BxcgLiHN.d.mts} +2 -2
- package/dist/cli/cli.mjs +24 -24
- package/dist/{create-project-DmGoYMqF.mjs → create-project-Dg5hiuDE.mjs} +10 -2
- package/dist/{db-CSn2p-PN.mjs → db-D7l4OGV1.mjs} +13 -13
- package/dist/{deploy-OPo_tSWl.mjs → deploy-iR7ug73w.mjs} +16 -13
- package/dist/{env-helpers-GICENGaN.d.mts → env-helpers-bupZjGHq.d.mts} +1 -1
- package/dist/{gen-DVPMPTL1.mjs → gen-CsawhQZz.mjs} +1 -1
- package/dist/{handler-2mA_-sst.d.mts → handler-DMSGX5S6.d.mts} +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +180 -64
- package/dist/{init-BaXYK2PD.mjs → init-CD9yg4Xt.mjs} +6 -6
- package/dist/{link-PClO4q2M.mjs → link-27a64clx.mjs} +7 -9
- package/dist/{node-x1AzR6Yf.mjs → node-C2HhnBO_.mjs} +3 -3
- package/dist/package-json-BMdypFnO.mjs +44 -0
- package/dist/pages/client.d.mts +1 -1
- package/dist/pages/head-client.d.mts +1 -1
- package/dist/pages/head.d.mts +1 -1
- package/dist/pages/index.d.mts +2 -2
- package/dist/pages/islands-plugin.d.mts +1 -1
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +1 -1
- package/dist/{plugin-inference-Ba1uGdIy.mjs → plugin-inference-BUBhHt_1.mjs} +6 -2
- package/dist/{prepare-D8znEv3-.mjs → prepare-BNuC8Ds9.mjs} +3 -3
- package/dist/{preset-BRsCi8ZB.mjs → preset-Lvi0ORmO.mjs} +6 -21
- package/dist/{project-cmd-CErG1vM7.mjs → project-cmd-DUkWHooP.mjs} +7 -7
- package/dist/{protocol-DXs_1QcC.d.mts → protocol-hjl3Nx5x.d.mts} +3 -3
- package/dist/{runner-DCYwTlee.mjs → runner-Cioqe5b2.mjs} +11 -3
- package/dist/runtime/ai.mjs +1 -1
- package/dist/runtime/auth.d.mts +1 -1
- package/dist/runtime/better-auth-pg.d.mts +1 -1
- package/dist/runtime/better-auth-pg.mjs +3 -3
- package/dist/runtime/better-auth.d.mts +1 -1
- package/dist/runtime/better-auth.mjs +2 -2
- package/dist/runtime/client-react.d.mts +6 -0
- package/dist/runtime/client-react.mjs +5 -0
- package/dist/runtime/client-solid.d.mts +6 -0
- package/dist/runtime/client-solid.mjs +5 -0
- package/dist/runtime/client-svelte.d.mts +6 -0
- package/dist/runtime/client-svelte.mjs +5 -0
- package/dist/runtime/client-vue.d.mts +6 -0
- package/dist/runtime/client-vue.mjs +5 -0
- package/dist/runtime/client.d.mts +2 -2
- package/dist/runtime/client.mjs +1 -1
- package/dist/runtime/env-helpers.d.mts +1 -1
- package/dist/runtime/env-public-client.d.mts +1 -1
- package/dist/runtime/env-public.d.mts +2 -2
- package/dist/runtime/env-public.mjs +1 -1
- package/dist/runtime/env.mjs +1 -1
- package/dist/runtime/fetch-stream.d.mts +1 -1
- package/dist/runtime/fetch-stream.mjs +1 -1
- package/dist/runtime/fetch.d.mts +1 -1
- package/dist/runtime/fetch.mjs +1 -1
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/handler.mjs +1 -1
- package/dist/runtime/isr.mjs +1 -1
- package/dist/runtime/live.d.mts +2 -2
- package/dist/runtime/live.mjs +1 -1
- package/dist/runtime/migration-handler-pg.mjs +1 -1
- package/dist/runtime/remote/index.d.mts +5 -1
- package/dist/runtime/remote/index.mjs +7 -4
- package/dist/runtime/sandbox.mjs +1 -1
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws-server.d.mts +2 -2
- package/dist/runtime/ws.d.mts +3 -3
- package/dist/{scan-DzzHqtiT.mjs → scan-BNC_1OsY.mjs} +1 -1
- package/package.json +22 -2
- package/skills/void/docs/guide/env-vars.md +4 -1
- package/skills/void/docs/integrations/cloudflare.md +3 -2
- package/skills/void/docs/reference/api.md +42 -30
- package/skills/void/docs/reference/config.md +1 -1
- package/skills/void/docs/reference/resource-inference.md +11 -11
- /package/dist/{auth-CHfPhSta.d.mts → auth-BL0cU_Sy.d.mts} +0 -0
- /package/dist/{auth-cmd-DE2YDAk0.mjs → auth-cmd-BSdoU6dB.mjs} +0 -0
- /package/dist/{auth-migrations-BqJoGqGQ.mjs → auth-migrations-DBoTUBvq.mjs} +0 -0
- /package/dist/{better-auth-shared-CbAF6sOM.mjs → better-auth-shared-pR54mTD2.mjs} +0 -0
- /package/dist/{cache-ChOUXuMY.mjs → cache-Cb4Vs95q.mjs} +0 -0
- /package/dist/{cancel-deploy-g6bC-mpl.mjs → cancel-deploy-CLVkqGJB.mjs} +0 -0
- /package/dist/{defer-DkoEwda-.mjs → defer-BosTTQTi.mjs} +0 -0
- /package/dist/{delete-D446r1rC.mjs → delete-Bi-gbEHT.mjs} +0 -0
- /package/dist/{domain-Digh83lu.mjs → domain-C_atK_X9.mjs} +0 -0
- /package/dist/{drizzle-DmaANP4-.mjs → drizzle-Bvhm-Uug.mjs} +0 -0
- /package/dist/{env-CJMOHUbW.mjs → env-Dc073Aip.mjs} +0 -0
- /package/dist/{env-raw-zk5JQKZe.mjs → env-raw-DhK_myJu.mjs} +0 -0
- /package/dist/{fetch-error-rXermVU3.mjs → fetch-error-B8GTcrQw.mjs} +0 -0
- /package/dist/{fetch-error-7aWl0RiD.d.mts → fetch-error-Dn-En6Wg.d.mts} +0 -0
- /package/dist/{head-DnTAP4p-.d.mts → head-BW_f2L_4.d.mts} +0 -0
- /package/dist/{list-G03-pEN-.mjs → list-C3Xt_i8a.mjs} +0 -0
- /package/dist/{logs-D0a_HhLn.mjs → logs-CktUaLEr.mjs} +0 -0
- /package/dist/{mcp-BLsmImuJ.mjs → mcp-BU7CP6gX.mjs} +0 -0
- /package/dist/{pg-BDQxUp3Q.mjs → pg-C-ybKyFU.mjs} +0 -0
- /package/dist/{providers--6L9uf7j.d.mts → providers-BVUcW4Jo.d.mts} +0 -0
- /package/dist/{rollback-BtiabraI.mjs → rollback-CEjAG9uQ.mjs} +0 -0
- /package/dist/{runner-pg-CJ04wNk5.mjs → runner-pg-D8ciL41o.mjs} +0 -0
- /package/dist/{secret-CNnequJa.mjs → secret-Dab6XQdb.mjs} +0 -0
- /package/dist/{skills-C38GxuGT.mjs → skills-GPm5Kjev.mjs} +0 -0
- /package/dist/{standard-schema-BDiIJgp5.d.mts → standard-schema-DCIm8cwQ.d.mts} +0 -0
- /package/dist/{subcommand-prompt-BLewBtNI.mjs → subcommand-prompt-DUaWltdH.mjs} +0 -0
- /package/dist/{types-C0AOcrPN.d.mts → types-s2mK7ar_.d.mts} +0 -0
- /package/dist/{yarn-pnp-CLFC1T3p.mjs → yarn-pnp-BdM0hoCa.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-
|
|
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-iR7ug73w.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
7
|
import { c as getToken, u as isStagingMode } from "./client-CCOKwNUz.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-
|
|
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-
|
|
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";
|
|
@@ -19,9 +19,9 @@ import { n as findEnvFileForPaths, r as generateEnvTypes, t as findEnvFile } fro
|
|
|
19
19
|
import { a as loadUserEnvFile } from "./env-validation-DBJsxZLz.mjs";
|
|
20
20
|
import { i as resolveLayoutIds } from "./scan-2YmJkYAf.mjs";
|
|
21
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-
|
|
23
|
-
import { t as INTERNAL_BINDING_PREFIXES } from "./env-raw-
|
|
24
|
-
import { n as defer } from "./defer-
|
|
22
|
+
import { n as generateVoidAuthDrizzleSchema, t as generateVoidAuthDatabaseModule } from "./drizzle-Bvhm-Uug.mjs";
|
|
23
|
+
import { t as INTERNAL_BINDING_PREFIXES } from "./env-raw-DhK_myJu.mjs";
|
|
24
|
+
import { n as defer } from "./defer-BosTTQTi.mjs";
|
|
25
25
|
import { VoidAssetRewriteError, defineHandler, defineHead, defineMiddleware, defineQueue, defineRender, defineScheduled } from "./runtime/handler.mjs";
|
|
26
26
|
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, readdirSync, rmSync, writeFileSync, writeSync } from "node:fs";
|
|
27
27
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -305,26 +305,25 @@ async function readDevCssResponse(response) {
|
|
|
305
305
|
}
|
|
306
306
|
|
|
307
307
|
export async function getVoidPagesDevCss(request, env, payload) {
|
|
308
|
-
const controller = new AbortController();
|
|
309
|
-
const timeout = setTimeout(() => controller.abort(), 1500);
|
|
310
308
|
const attempts = [];
|
|
309
|
+
attempts.push({
|
|
310
|
+
fetcher: "global",
|
|
311
|
+
label: INTERNAL_ORIGIN,
|
|
312
|
+
url: new URL(ENDPOINT, INTERNAL_ORIGIN).toString(),
|
|
313
|
+
});
|
|
311
314
|
if (env?.ASSETS && typeof env.ASSETS.fetch === "function") {
|
|
312
315
|
attempts.push({
|
|
313
316
|
fetcher: env.ASSETS,
|
|
314
317
|
label: "ASSETS",
|
|
315
318
|
url: new URL(ENDPOINT, request.url).toString(),
|
|
316
319
|
});
|
|
317
|
-
} else {
|
|
318
|
-
attempts.push({
|
|
319
|
-
fetcher: "global",
|
|
320
|
-
label: INTERNAL_ORIGIN,
|
|
321
|
-
url: new URL(ENDPOINT, INTERNAL_ORIGIN).toString(),
|
|
322
|
-
});
|
|
323
320
|
}
|
|
324
321
|
try {
|
|
325
322
|
let lastError;
|
|
326
323
|
let lastLabel = "unknown";
|
|
327
324
|
for (const attempt of attempts) {
|
|
325
|
+
const controller = new AbortController();
|
|
326
|
+
const timeout = setTimeout(() => controller.abort(), 1500);
|
|
328
327
|
try {
|
|
329
328
|
const request = createDevCssRequest(attempt.url, payload, controller.signal);
|
|
330
329
|
const response =
|
|
@@ -335,6 +334,8 @@ export async function getVoidPagesDevCss(request, env, payload) {
|
|
|
335
334
|
} catch (error) {
|
|
336
335
|
lastError = error;
|
|
337
336
|
lastLabel = attempt.label;
|
|
337
|
+
} finally {
|
|
338
|
+
clearTimeout(timeout);
|
|
338
339
|
}
|
|
339
340
|
}
|
|
340
341
|
throw new Error(
|
|
@@ -343,8 +344,6 @@ export async function getVoidPagesDevCss(request, env, payload) {
|
|
|
343
344
|
} catch (error) {
|
|
344
345
|
console.warn("[void] dev CSS collection failed:", error instanceof Error ? error.message : String(error));
|
|
345
346
|
return [];
|
|
346
|
-
} finally {
|
|
347
|
-
clearTimeout(timeout);
|
|
348
347
|
}
|
|
349
348
|
}
|
|
350
349
|
`;
|
|
@@ -420,6 +419,59 @@ export async function getVoidPagesDevCss(request, env, payload) {
|
|
|
420
419
|
}];
|
|
421
420
|
}
|
|
422
421
|
//#endregion
|
|
422
|
+
//#region src/plugin-binding-runtime.ts
|
|
423
|
+
const envModuleResolved$1 = fileURLToPath(import.meta.resolve("#self/_env"));
|
|
424
|
+
const kvModuleResolved = fileURLToPath(import.meta.resolve("void/kv"));
|
|
425
|
+
const storageModuleResolved = fileURLToPath(import.meta.resolve("void/storage"));
|
|
426
|
+
const VIRTUAL_KV_ID = "\0virtual:void-kv";
|
|
427
|
+
const VIRTUAL_STORAGE_ID = "\0virtual:void-storage";
|
|
428
|
+
function bindingRuntimePlugin(bindingNames) {
|
|
429
|
+
return {
|
|
430
|
+
name: "void:binding-runtime",
|
|
431
|
+
enforce: "pre",
|
|
432
|
+
resolveId: {
|
|
433
|
+
filter: { id: /^(void\/kv|void\/storage)$/ },
|
|
434
|
+
handler(id) {
|
|
435
|
+
if (this.environment?.name === "client") return;
|
|
436
|
+
if (id === "void/kv" && bindingNames?.kv) return VIRTUAL_KV_ID;
|
|
437
|
+
if (id === "void/storage" && bindingNames?.r2) return VIRTUAL_STORAGE_ID;
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
load: {
|
|
441
|
+
filter: { id: /^\0virtual:void-(?:kv|storage)$/ },
|
|
442
|
+
handler(id) {
|
|
443
|
+
if (id === VIRTUAL_KV_ID) return `
|
|
444
|
+
import { requireRuntimeBinding } from ${JSON.stringify(envModuleResolved$1)};
|
|
445
|
+
import { createKV } from ${JSON.stringify(kvModuleResolved)};
|
|
446
|
+
|
|
447
|
+
const namespace = new Proxy({}, {
|
|
448
|
+
get(_, prop) {
|
|
449
|
+
const ns = requireRuntimeBinding(${JSON.stringify(bindingNames?.kv)});
|
|
450
|
+
const value = Reflect.get(ns, prop, ns);
|
|
451
|
+
return typeof value === 'function' ? value.bind(ns) : value;
|
|
452
|
+
},
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
export { createKV };
|
|
456
|
+
export const kv = createKV(namespace);
|
|
457
|
+
`;
|
|
458
|
+
if (id === VIRTUAL_STORAGE_ID) return `
|
|
459
|
+
import { requireRuntimeBinding } from ${JSON.stringify(envModuleResolved$1)};
|
|
460
|
+
export { createStorage } from ${JSON.stringify(storageModuleResolved)};
|
|
461
|
+
|
|
462
|
+
export const storage = new Proxy({}, {
|
|
463
|
+
get(_, prop) {
|
|
464
|
+
const bucket = requireRuntimeBinding(${JSON.stringify(bindingNames?.r2)});
|
|
465
|
+
const value = Reflect.get(bucket, prop, bucket);
|
|
466
|
+
return typeof value === 'function' ? value.bind(bucket) : value;
|
|
467
|
+
},
|
|
468
|
+
});
|
|
469
|
+
`;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
//#endregion
|
|
423
475
|
//#region src/plugin-dev-triggers-hint.ts
|
|
424
476
|
/**
|
|
425
477
|
* Prints a one-shot hint on dev server start when the project has crons
|
|
@@ -489,6 +541,7 @@ function drizzlePlugin(root, hasRouteTypes, dialect = "sqlite", options = {}) {
|
|
|
489
541
|
const paths = readProjectPaths(root);
|
|
490
542
|
const schema = discoverSchema(root, paths);
|
|
491
543
|
const hasDbRuntime = schema != null || options.forceVirtualDb === true;
|
|
544
|
+
const d1BindingName = options.d1BindingName ?? "DB";
|
|
492
545
|
ensureProjectTsconfig(root, hasRouteTypes, hasDbRuntime, schema != null, {
|
|
493
546
|
redirectDbModule: options.redirectDbTypePaths,
|
|
494
547
|
paths
|
|
@@ -584,7 +637,7 @@ let _instance;
|
|
|
584
637
|
|
|
585
638
|
export const db = new Proxy({}, {
|
|
586
639
|
get(_, prop) {
|
|
587
|
-
_instance ??= drizzle(requireRuntimeBinding(
|
|
640
|
+
_instance ??= drizzle(requireRuntimeBinding(${JSON.stringify(d1BindingName)})${drizzleConfig});
|
|
588
641
|
return Reflect.get(_instance, prop);
|
|
589
642
|
},
|
|
590
643
|
});
|
|
@@ -600,7 +653,7 @@ export function createDb(d1) {
|
|
|
600
653
|
const migrationsDir = paths.migrationsDir;
|
|
601
654
|
if (!(existsSync(migrationsDir) && readdirSync(migrationsDir).some((f) => f.endsWith(".sql")))) {
|
|
602
655
|
if (dialect === "sqlite") {
|
|
603
|
-
const { getApplicationTables, getMiniflareDatabasePath } = await import("./runner-
|
|
656
|
+
const { getApplicationTables, getMiniflareDatabasePath } = await import("./runner-Cioqe5b2.mjs");
|
|
604
657
|
if ((await getApplicationTables(getMiniflareDatabasePath(options.localD1PersistRoot ?? join(root, ".void"), options.localD1DatabaseId ?? "local")).catch(() => [])).length > 0) return;
|
|
605
658
|
}
|
|
606
659
|
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 +742,7 @@ function pushHit(node, hits) {
|
|
|
689
742
|
}
|
|
690
743
|
}
|
|
691
744
|
/** Default Vite `envPrefix`. */
|
|
692
|
-
const DEFAULT_ENV_PREFIXES$
|
|
745
|
+
const DEFAULT_ENV_PREFIXES$2 = ["VITE_"];
|
|
693
746
|
/**
|
|
694
747
|
* Build-time constant folding for client-only `env.FOO` reads.
|
|
695
748
|
*
|
|
@@ -718,7 +771,7 @@ const DEFAULT_ENV_PREFIXES$1 = ["VITE_"];
|
|
|
718
771
|
* and editing `.env.local` take effect without a full rebuild.
|
|
719
772
|
*/
|
|
720
773
|
function envClientFoldPlugin() {
|
|
721
|
-
let envPrefixes = DEFAULT_ENV_PREFIXES$
|
|
774
|
+
let envPrefixes = DEFAULT_ENV_PREFIXES$2;
|
|
722
775
|
let loadedEnv = {};
|
|
723
776
|
const schemaDefaults = {};
|
|
724
777
|
/** The merged view the transform consults for each key. */
|
|
@@ -737,7 +790,7 @@ function envClientFoldPlugin() {
|
|
|
737
790
|
const prefix = config.envPrefix;
|
|
738
791
|
if (typeof prefix === "string") envPrefixes = [prefix];
|
|
739
792
|
else if (Array.isArray(prefix) && prefix.length > 0) envPrefixes = prefix;
|
|
740
|
-
else envPrefixes = DEFAULT_ENV_PREFIXES$
|
|
793
|
+
else envPrefixes = DEFAULT_ENV_PREFIXES$2;
|
|
741
794
|
loadedEnv = { ...config.env ?? {} };
|
|
742
795
|
try {
|
|
743
796
|
const mod = await loadEnvPublic$1();
|
|
@@ -893,9 +946,9 @@ function recordHit(node, hits) {
|
|
|
893
946
|
* are skipped — only the `client` environment is checked.
|
|
894
947
|
*/
|
|
895
948
|
/** Default value matches Vite's default `envPrefix`. */
|
|
896
|
-
const DEFAULT_ENV_PREFIXES = ["VITE_"];
|
|
949
|
+
const DEFAULT_ENV_PREFIXES$1 = ["VITE_"];
|
|
897
950
|
function envClientGuardPlugin(root) {
|
|
898
|
-
let envPrefixes = DEFAULT_ENV_PREFIXES;
|
|
951
|
+
let envPrefixes = DEFAULT_ENV_PREFIXES$1;
|
|
899
952
|
return {
|
|
900
953
|
name: "void:env-client-guard",
|
|
901
954
|
enforce: "post",
|
|
@@ -982,11 +1035,18 @@ async function loadSchemaModule() {
|
|
|
982
1035
|
*/
|
|
983
1036
|
/** Patterns Vite's `define` typically uses for env-shaped constants. */
|
|
984
1037
|
const DEFINE_ENV_PATTERN = /^(?:globalThis\.)?(?:process\.env|import\.meta\.env)\.([A-Z_][A-Z0-9_]*)$/;
|
|
1038
|
+
const DEFAULT_ENV_PREFIXES = ["VITE_"];
|
|
1039
|
+
function resolveEnvPrefixes(prefix) {
|
|
1040
|
+
if (typeof prefix === "string") return [prefix];
|
|
1041
|
+
if (Array.isArray(prefix) && prefix.length > 0) return prefix;
|
|
1042
|
+
return DEFAULT_ENV_PREFIXES;
|
|
1043
|
+
}
|
|
985
1044
|
function envSchemaPlugin(root, options = {}) {
|
|
986
1045
|
const outDir = join(root, ".void");
|
|
987
1046
|
let envFile = null;
|
|
988
1047
|
let viteMode = "development";
|
|
989
1048
|
let envDir = root;
|
|
1049
|
+
const appliedClientDefaults = /* @__PURE__ */ new Map();
|
|
990
1050
|
async function emitDefaults() {
|
|
991
1051
|
if (!envFile || !options.onDefaults) return;
|
|
992
1052
|
const { _hasRegisteredSchema, _getSchemaDefaults } = await loadSchemaModule();
|
|
@@ -1039,6 +1099,20 @@ function envSchemaPlugin(root, options = {}) {
|
|
|
1039
1099
|
for (const { key, messages } of report.invalid) lines.push(` • ${key}: ${messages.join("; ")}`);
|
|
1040
1100
|
voidWarn(lines.join("\n"));
|
|
1041
1101
|
}
|
|
1102
|
+
async function applyClientDefaultsToViteEnv(config) {
|
|
1103
|
+
if (!envFile) return;
|
|
1104
|
+
for (const [key, value] of appliedClientDefaults) if (config.env[key] === value) delete config.env[key];
|
|
1105
|
+
appliedClientDefaults.clear();
|
|
1106
|
+
const { _hasRegisteredSchema, _getSchemaDefaults } = await loadSchemaModule();
|
|
1107
|
+
if (!_hasRegisteredSchema()) return;
|
|
1108
|
+
const prefixes = resolveEnvPrefixes(config.envPrefix);
|
|
1109
|
+
for (const [key, value] of Object.entries(_getSchemaDefaults())) {
|
|
1110
|
+
if (!prefixes.some((prefix) => key.startsWith(prefix))) continue;
|
|
1111
|
+
if (config.env[key] !== void 0) continue;
|
|
1112
|
+
config.env[key] = value;
|
|
1113
|
+
appliedClientDefaults.set(key, value);
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1042
1116
|
return {
|
|
1043
1117
|
name: "void:env-schema",
|
|
1044
1118
|
async config() {
|
|
@@ -1051,6 +1125,7 @@ function envSchemaPlugin(root, options = {}) {
|
|
|
1051
1125
|
async configResolved(config) {
|
|
1052
1126
|
viteMode = config.mode;
|
|
1053
1127
|
envDir = typeof config.envDir === "string" ? config.envDir : root;
|
|
1128
|
+
await applyClientDefaultsToViteEnv(config);
|
|
1054
1129
|
if (envFile && config.define) await warnOnDefineOverlap(config.define);
|
|
1055
1130
|
},
|
|
1056
1131
|
async configureServer(server) {
|
|
@@ -1068,7 +1143,9 @@ function envSchemaPlugin(root, options = {}) {
|
|
|
1068
1143
|
regenerateTypes();
|
|
1069
1144
|
await importUserEnv();
|
|
1070
1145
|
await emitDefaults();
|
|
1146
|
+
await applyClientDefaultsToViteEnv(server.config);
|
|
1071
1147
|
await validateAndWarn();
|
|
1148
|
+
server.ws.send({ type: "full-reload" });
|
|
1072
1149
|
}
|
|
1073
1150
|
});
|
|
1074
1151
|
},
|
|
@@ -1576,7 +1653,7 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
|
|
|
1576
1653
|
else warn();
|
|
1577
1654
|
return;
|
|
1578
1655
|
}
|
|
1579
|
-
const { runPgMigrations, getPgAppliedMigrations } = await import("./runner-pg-
|
|
1656
|
+
const { runPgMigrations, getPgAppliedMigrations } = await import("./runner-pg-D8ciL41o.mjs");
|
|
1580
1657
|
const { collectMigrations } = await import("./collect-9rO3JFNM.mjs").then((n) => n.n);
|
|
1581
1658
|
const { validateMigrations } = await import("./validate-CNWm-PsL.mjs").then((n) => n.i);
|
|
1582
1659
|
const allMigrations = collectMigrations(migrationsDir);
|
|
@@ -1591,7 +1668,7 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
|
|
|
1591
1668
|
const applied = await runPgMigrations(migrationsDir, url);
|
|
1592
1669
|
if (applied.length > 0) voidLog(`Applied ${applied.length} migration(s): ${applied.join(", ")}`);
|
|
1593
1670
|
} else if (hasSqlMigrations) {
|
|
1594
|
-
const { runMigrations, getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-
|
|
1671
|
+
const { runMigrations, getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-Cioqe5b2.mjs");
|
|
1595
1672
|
const { collectMigrations } = await import("./collect-9rO3JFNM.mjs").then((n) => n.n);
|
|
1596
1673
|
const { validateMigrations } = await import("./validate-CNWm-PsL.mjs").then((n) => n.i);
|
|
1597
1674
|
const dbPath = getMiniflareDatabasePath(persistRoot, databaseId);
|
|
@@ -1608,7 +1685,7 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
|
|
|
1608
1685
|
if (applied.length > 0) voidLog(`Applied ${applied.length} migration(s): ${applied.join(", ")}`);
|
|
1609
1686
|
}
|
|
1610
1687
|
if (auth?.enabled) {
|
|
1611
|
-
const { runLocalVoidAuthMigrations } = await import("./node-
|
|
1688
|
+
const { runLocalVoidAuthMigrations } = await import("./node-C2HhnBO_.mjs");
|
|
1612
1689
|
await runLocalVoidAuthMigrations(root, dialect, persistRoot, databaseId, auth.configPath);
|
|
1613
1690
|
voidLog("Applied Better Auth migrations");
|
|
1614
1691
|
}
|
|
@@ -2940,16 +3017,23 @@ window.__vite_plugin_react_preamble_installed__ = true;
|
|
|
2940
3017
|
lines.push("");
|
|
2941
3018
|
}
|
|
2942
3019
|
if (options.migrationHandlerPath && (options.migrations?.length || auth)) {
|
|
3020
|
+
const d1BindingName = options.bindingNames?.d1;
|
|
2943
3021
|
lines.push(`import { createMigrationHandler as __createMigrationHandler } from ${JSON.stringify(options.migrationHandlerPath)};`);
|
|
2944
3022
|
lines.push(`const __migrations = ${JSON.stringify(options.migrations)};`);
|
|
2945
3023
|
lines.push(`const __migrationPlanBundle = ${JSON.stringify(options.migrationPlanBundle)};`);
|
|
2946
3024
|
lines.push(`const __migrationDialect = ${JSON.stringify(options.migrationDialect ?? "sqlite")};`);
|
|
3025
|
+
if (d1BindingName) lines.push(`function __voidGetMigrationEnv() {
|
|
3026
|
+
const env = __getRawEnv();
|
|
3027
|
+
if (!env || env[${JSON.stringify(d1BindingName)}] == null) return env;
|
|
3028
|
+
return { ...env, DB: env[${JSON.stringify(d1BindingName)}] };
|
|
3029
|
+
}`);
|
|
3030
|
+
else lines.push("function __voidGetMigrationEnv() { return __getRawEnv(); }");
|
|
2947
3031
|
lines.push("function __voidCreateMigrationRequestHandler(request, includeAuthMigrations, includePlanBundle) {");
|
|
2948
3032
|
lines.push(" return __createMigrationHandler(");
|
|
2949
|
-
lines.push("
|
|
3033
|
+
lines.push(" __voidGetMigrationEnv(),");
|
|
2950
3034
|
lines.push(" __migrations,");
|
|
2951
3035
|
lines.push(" __migrationDialect,");
|
|
2952
|
-
if (auth) lines.push(` includeAuthMigrations ? () => runVoidAuthMigrations(new Request(request.url),
|
|
3036
|
+
if (auth) lines.push(` includeAuthMigrations ? () => runVoidAuthMigrations(new Request(request.url), __voidGetMigrationEnv(), __voidAuthOptions${auth.authSchemaPath ? ", __voidAuthMigrationSchema" : ""}) : undefined,`);
|
|
2953
3037
|
else lines.push(" undefined,");
|
|
2954
3038
|
lines.push(" includePlanBundle ? __migrationPlanBundle : undefined,");
|
|
2955
3039
|
lines.push(" );");
|
|
@@ -2977,20 +3061,20 @@ window.__vite_plugin_react_preamble_installed__ = true;
|
|
|
2977
3061
|
lines.push("}");
|
|
2978
3062
|
lines.push("app.post(\"/__void/migrate\", async (c) => {");
|
|
2979
3063
|
lines.push(" const __voidMigrationHandler = __createMigrationHandler(");
|
|
2980
|
-
lines.push("
|
|
3064
|
+
lines.push(" __voidGetMigrationEnv(),");
|
|
2981
3065
|
lines.push(" __migrations,");
|
|
2982
3066
|
lines.push(" __migrationDialect,");
|
|
2983
|
-
if (auth) lines.push(` () => runVoidAuthMigrations(new Request(c.req.url),
|
|
3067
|
+
if (auth) lines.push(` () => runVoidAuthMigrations(new Request(c.req.url), __voidGetMigrationEnv(), __voidAuthOptions${auth.authSchemaPath ? ", __voidAuthMigrationSchema" : ""}),`);
|
|
2984
3068
|
else lines.push(" undefined,");
|
|
2985
3069
|
lines.push(" );");
|
|
2986
3070
|
lines.push(" return __voidMigrationHandler(c.req.raw);");
|
|
2987
3071
|
lines.push("});");
|
|
2988
3072
|
lines.push("app.get(\"/__void/migrate/capabilities\", async (c) => {");
|
|
2989
3073
|
lines.push(" const __voidMigrationHandler = __createMigrationHandler(");
|
|
2990
|
-
lines.push("
|
|
3074
|
+
lines.push(" __voidGetMigrationEnv(),");
|
|
2991
3075
|
lines.push(" __migrations,");
|
|
2992
3076
|
lines.push(" __migrationDialect,");
|
|
2993
|
-
if (auth) lines.push(` () => runVoidAuthMigrations(new Request(c.req.url),
|
|
3077
|
+
if (auth) lines.push(` () => runVoidAuthMigrations(new Request(c.req.url), __voidGetMigrationEnv(), __voidAuthOptions${auth.authSchemaPath ? ", __voidAuthMigrationSchema" : ""}),`);
|
|
2994
3078
|
else lines.push(" undefined,");
|
|
2995
3079
|
lines.push(" __migrationPlanBundle,");
|
|
2996
3080
|
lines.push(" );");
|
|
@@ -2998,7 +3082,7 @@ window.__vite_plugin_react_preamble_installed__ = true;
|
|
|
2998
3082
|
lines.push("});");
|
|
2999
3083
|
lines.push("app.post(\"/__void/migrate/app\", async (c) => {");
|
|
3000
3084
|
lines.push(" const __voidMigrationHandler = __createMigrationHandler(");
|
|
3001
|
-
lines.push("
|
|
3085
|
+
lines.push(" __voidGetMigrationEnv(),");
|
|
3002
3086
|
lines.push(" __migrations,");
|
|
3003
3087
|
lines.push(" __migrationDialect,");
|
|
3004
3088
|
lines.push(" undefined,");
|
|
@@ -3008,7 +3092,7 @@ window.__vite_plugin_react_preamble_installed__ = true;
|
|
|
3008
3092
|
lines.push("});");
|
|
3009
3093
|
lines.push("app.get(\"/__void/migrate/app/attempt/:attemptId\", async (c) => {");
|
|
3010
3094
|
lines.push(" const __voidMigrationHandler = __createMigrationHandler(");
|
|
3011
|
-
lines.push("
|
|
3095
|
+
lines.push(" __voidGetMigrationEnv(),");
|
|
3012
3096
|
lines.push(" __migrations,");
|
|
3013
3097
|
lines.push(" __migrationDialect,");
|
|
3014
3098
|
lines.push(" undefined,");
|
|
@@ -3019,10 +3103,10 @@ window.__vite_plugin_react_preamble_installed__ = true;
|
|
|
3019
3103
|
if (auth) {
|
|
3020
3104
|
lines.push("app.post(\"/__void/migrate/auth\", async (c) => {");
|
|
3021
3105
|
lines.push(" const __voidMigrationHandler = __createMigrationHandler(");
|
|
3022
|
-
lines.push("
|
|
3106
|
+
lines.push(" __voidGetMigrationEnv(),");
|
|
3023
3107
|
lines.push(" __migrations,");
|
|
3024
3108
|
lines.push(" __migrationDialect,");
|
|
3025
|
-
lines.push(` () => runVoidAuthMigrations(new Request(c.req.url),
|
|
3109
|
+
lines.push(` () => runVoidAuthMigrations(new Request(c.req.url), __voidGetMigrationEnv(), __voidAuthOptions${auth.authSchemaPath ? ", __voidAuthMigrationSchema" : ""}),`);
|
|
3026
3110
|
lines.push(" __migrationPlanBundle,");
|
|
3027
3111
|
lines.push(" );");
|
|
3028
3112
|
lines.push(" return __voidMigrationHandler(c.req.raw);");
|
|
@@ -3481,6 +3565,8 @@ function compilePageRoutes(lines, scan, pages, options) {
|
|
|
3481
3565
|
*/
|
|
3482
3566
|
function compileWorkerEntry(hasQueues = false, remote, assetsDir = "assets", webSocketClasses = [], runtimeEnvPath = "void/_env", envSchemaModule, sandbox, serveSpaFallback = false, live) {
|
|
3483
3567
|
const remotePath = remote?.remotePath;
|
|
3568
|
+
const remoteBindingNames = JSON.stringify(remote?.bindingNames);
|
|
3569
|
+
const createRemoteEnvCall = `createRemoteEnv(env${remote?.bindingNames ? `, ${remoteBindingNames}` : ""})`;
|
|
3484
3570
|
const hasSandbox = sandbox === true || typeof sandbox === "object";
|
|
3485
3571
|
const sandboxClassName = typeof sandbox === "object" ? sandbox.className ?? "Sandbox" : "Sandbox";
|
|
3486
3572
|
const sandboxBindingName = typeof sandbox === "object" ? sandbox.bindingName ?? "SANDBOX" : "SANDBOX";
|
|
@@ -3560,7 +3646,7 @@ ${spaFallbackCode}
|
|
|
3560
3646
|
const fetchHandler = remotePath ? `async (request, env, ctx) => {
|
|
3561
3647
|
${envValidateCall} const ws = await __voidHandleWebSocket(request, env);
|
|
3562
3648
|
if (ws) return ws;
|
|
3563
|
-
if (env.__VOID_REMOTE === "1") env =
|
|
3649
|
+
if (env.__VOID_REMOTE === "1") env = ${createRemoteEnvCall};
|
|
3564
3650
|
return __withRawEnv(env, () => {
|
|
3565
3651
|
const userEnv = __filterInternalBindings(env);
|
|
3566
3652
|
return withRuntimeEnv(env, async () => {
|
|
@@ -3602,7 +3688,7 @@ ${envValidateCall} const ws = await __voidHandleWebSocket(request, env);
|
|
|
3602
3688
|
return Response.json({ paths });
|
|
3603
3689
|
}`;
|
|
3604
3690
|
const scheduledHandler = remotePath ? `async function handleScheduled(controller, env, ctx) {
|
|
3605
|
-
${envValidateCall} if (env.__VOID_REMOTE === "1") env =
|
|
3691
|
+
${envValidateCall} if (env.__VOID_REMOTE === "1") env = ${createRemoteEnvCall};
|
|
3606
3692
|
const userEnv = __filterInternalBindings(env);
|
|
3607
3693
|
return withRuntimeEnv(env, () => scheduled(controller, userEnv, ctx));
|
|
3608
3694
|
}` : `async function handleScheduled(controller, env, ctx) {
|
|
@@ -3614,7 +3700,7 @@ ${runtimeEnvImport}${envSchemaImport}${remoteImport}${filterBindingsHelper}${ass
|
|
|
3614
3700
|
${internalRouteHelper}
|
|
3615
3701
|
${scheduledHandler}
|
|
3616
3702
|
async function queue(batch, env, ctx) {
|
|
3617
|
-
${envValidateCall}${remotePath ? ` if (env.__VOID_REMOTE === "1") env =
|
|
3703
|
+
${envValidateCall}${remotePath ? ` if (env.__VOID_REMOTE === "1") env = ${createRemoteEnvCall};\n` : ""} const userEnv = __filterInternalBindings(env);
|
|
3618
3704
|
const messages = [...batch.messages].map(m => ({
|
|
3619
3705
|
id: m.id, timestamp: m.timestamp.toISOString(),
|
|
3620
3706
|
body: m.body, attempts: m.attempts,
|
|
@@ -4109,14 +4195,16 @@ export async function fetch(path, options) {
|
|
|
4109
4195
|
const VIRTUAL_ROUTES_ID = "virtual:void-routes";
|
|
4110
4196
|
const VIRTUAL_CLIENT_WORKER_ID = "virtual:void-client-worker";
|
|
4111
4197
|
const VIRTUAL_CLIENT_BROWSER_ID = "virtual:void-client-browser";
|
|
4198
|
+
const CLIENT_IMPORT_RE = /^void\/client(?:\/(react|vue|svelte|solid))?$/;
|
|
4199
|
+
const VIRTUAL_CLIENT_RE = /^virtual:void-client-(browser|worker)(?::(react|vue|svelte|solid))?$/;
|
|
4112
4200
|
const PAGE_VIRTUAL_MODULE_IDS = [
|
|
4113
4201
|
"\0virtual:void-pages-renderer",
|
|
4114
4202
|
"\0virtual:void-pages-client",
|
|
4115
4203
|
"\0virtual:void-islands-renderer",
|
|
4116
4204
|
"\0virtual:void-islands-client"
|
|
4117
4205
|
];
|
|
4118
|
-
const RESOLVE_ID_FILTER = /^(virtual:void-(routes|client-worker|client-browser)|void(\/client
|
|
4119
|
-
const LOAD_ID_FILTER = /^virtual:void-(routes|client-worker|client-browser)$/;
|
|
4206
|
+
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)?)$/;
|
|
4207
|
+
const LOAD_ID_FILTER = /^virtual:void-(routes|client-worker(?::(react|vue|svelte|solid))?|client-browser(?::(react|vue|svelte|solid))?)$/;
|
|
4120
4208
|
function routingPlugin(root, options) {
|
|
4121
4209
|
let scan = null;
|
|
4122
4210
|
let ssr = null;
|
|
@@ -4170,7 +4258,14 @@ function routingPlugin(root, options) {
|
|
|
4170
4258
|
const sandboxRuntimePath = resolveFile("#self/sandbox");
|
|
4171
4259
|
const drizzleAdapterPath = resolveFile("better-auth/adapters/drizzle");
|
|
4172
4260
|
let authClientPath = join(runtimeDir, "auth-client.mjs");
|
|
4261
|
+
const explicitAuthClientPaths = {
|
|
4262
|
+
react: join(runtimeDir, "auth-client-react.mjs"),
|
|
4263
|
+
vue: join(runtimeDir, "auth-client-vue.mjs"),
|
|
4264
|
+
svelte: join(runtimeDir, "auth-client-svelte.mjs"),
|
|
4265
|
+
solid: join(runtimeDir, "auth-client-solid.mjs")
|
|
4266
|
+
};
|
|
4173
4267
|
const remote = options.remoteMode ? {
|
|
4268
|
+
bindingNames: options.bindingNames,
|
|
4174
4269
|
remotePath: resolveFile("#self/remote"),
|
|
4175
4270
|
envPath: resolveFile("#self/_env")
|
|
4176
4271
|
} : void 0;
|
|
@@ -4198,7 +4293,8 @@ function routingPlugin(root, options) {
|
|
|
4198
4293
|
auth: null,
|
|
4199
4294
|
nodeTarget: !!options.target,
|
|
4200
4295
|
explicitPrerenderPaths: options.prerenderPaths,
|
|
4201
|
-
bindingHandlerPath: options.target ? void 0 : resolveFile("#self/remote/binding-handler")
|
|
4296
|
+
bindingHandlerPath: options.target ? void 0 : resolveFile("#self/remote/binding-handler"),
|
|
4297
|
+
bindingNames: options.bindingNames
|
|
4202
4298
|
};
|
|
4203
4299
|
let publicDir = join(root, "public");
|
|
4204
4300
|
function reloadFileRules() {
|
|
@@ -4252,12 +4348,21 @@ function routingPlugin(root, options) {
|
|
|
4252
4348
|
}
|
|
4253
4349
|
let resolvedConfig = null;
|
|
4254
4350
|
function resolveAuthClientPath(config) {
|
|
4255
|
-
if (config.plugins.some((plugin) => plugin.name === "void-react:pages")) return
|
|
4256
|
-
if (config.plugins.some((plugin) => plugin.name === "void-vue:pages")) return
|
|
4257
|
-
if (config.plugins.some((plugin) => plugin.name === "void-svelte:pages")) return
|
|
4258
|
-
if (config.plugins.some((plugin) => plugin.name === "void-solid:pages")) return
|
|
4351
|
+
if (config.plugins.some((plugin) => plugin.name === "void-react:pages")) return explicitAuthClientPaths.react;
|
|
4352
|
+
if (config.plugins.some((plugin) => plugin.name === "void-vue:pages")) return explicitAuthClientPaths.vue;
|
|
4353
|
+
if (config.plugins.some((plugin) => plugin.name === "void-svelte:pages")) return explicitAuthClientPaths.svelte;
|
|
4354
|
+
if (config.plugins.some((plugin) => plugin.name === "void-solid:pages")) return explicitAuthClientPaths.solid;
|
|
4259
4355
|
return join(runtimeDir, "auth-client.mjs");
|
|
4260
4356
|
}
|
|
4357
|
+
function getClientAuthPath(id) {
|
|
4358
|
+
const framework = VIRTUAL_CLIENT_RE.exec(id)?.[2];
|
|
4359
|
+
return framework ? explicitAuthClientPaths[framework] : authClientPath;
|
|
4360
|
+
}
|
|
4361
|
+
function resolveVirtualClientId(id, environmentName) {
|
|
4362
|
+
const framework = CLIENT_IMPORT_RE.exec(id)?.[1];
|
|
4363
|
+
const base = environmentName === "client" ? VIRTUAL_CLIENT_BROWSER_ID : VIRTUAL_CLIENT_WORKER_ID;
|
|
4364
|
+
return framework ? `${base}:${framework}` : base;
|
|
4365
|
+
}
|
|
4261
4366
|
function isPotentialAuthConfigPath(path) {
|
|
4262
4367
|
return authConfigPaths.has(normalizePath(path));
|
|
4263
4368
|
}
|
|
@@ -4391,16 +4496,17 @@ function routingPlugin(root, options) {
|
|
|
4391
4496
|
if (id === VIRTUAL_CLIENT_BROWSER_ID) return VIRTUAL_CLIENT_BROWSER_ID;
|
|
4392
4497
|
if (id === "void") return handlerFile;
|
|
4393
4498
|
if (id === "void/queues") return resolveFile("#self/queues");
|
|
4394
|
-
if (id
|
|
4499
|
+
if (CLIENT_IMPORT_RE.test(id)) return resolveVirtualClientId(id, this.environment?.name);
|
|
4395
4500
|
}
|
|
4396
4501
|
},
|
|
4397
4502
|
load: {
|
|
4398
4503
|
filter: { id: LOAD_ID_FILTER },
|
|
4399
4504
|
async handler(id) {
|
|
4400
|
-
|
|
4401
|
-
if (
|
|
4402
|
-
|
|
4403
|
-
return
|
|
4505
|
+
const virtualClient = VIRTUAL_CLIENT_RE.exec(id);
|
|
4506
|
+
if (virtualClient?.[1] === "browser") return compileBrowserClient(getClientAuthPath(id), fetchPath, fetchStreamPath);
|
|
4507
|
+
if (virtualClient?.[1] === "worker") {
|
|
4508
|
+
if (options.target) return compileNodeClient(getClientAuthPath(id));
|
|
4509
|
+
return compileWorkerClient(getClientAuthPath(id));
|
|
4404
4510
|
}
|
|
4405
4511
|
if (id !== VIRTUAL_ROUTES_ID) return;
|
|
4406
4512
|
if (!scan) await rescan();
|
|
@@ -4823,7 +4929,7 @@ async function runAiSetupPrompt(root, token, staging, server) {
|
|
|
4823
4929
|
let slug;
|
|
4824
4930
|
if (result === "__create__") {
|
|
4825
4931
|
const { validateProjectSlug } = await import("./project-slug-De4UjtD9.mjs").then((n) => n.t);
|
|
4826
|
-
const { createProjectWithSlugRetry } = await import("./create-project-
|
|
4932
|
+
const { createProjectWithSlugRetry } = await import("./create-project-Dg5hiuDE.mjs").then((n) => n.t);
|
|
4827
4933
|
let created;
|
|
4828
4934
|
try {
|
|
4829
4935
|
created = await createProjectWithSlugRetry(client, inferDefaultSlug(root), async (defaultSlug) => {
|
|
@@ -4885,6 +4991,7 @@ function voidPlugin(options) {
|
|
|
4885
4991
|
const framework = detected?.class === "a" ? detected.name : void 0;
|
|
4886
4992
|
const scanDirs = config.inference?.scanDirs ?? (detected ? FRAMEWORK_SCAN_DIRS : void 0);
|
|
4887
4993
|
const inferenceOptions = config.inference?.bindings ? { bindings: config.inference.bindings } : void 0;
|
|
4994
|
+
const bindingNames = resolveBindingNames(config.inference?.bindings);
|
|
4888
4995
|
const inferredBindings = inferProjectBindings(root, {
|
|
4889
4996
|
...inferenceOptions,
|
|
4890
4997
|
paths
|
|
@@ -4950,7 +5057,6 @@ function voidPlugin(options) {
|
|
|
4950
5057
|
reservedClasses: [...websocketRoutes.map((route) => route.className), sandboxConfig?.className]
|
|
4951
5058
|
}) : readExistingLiveBindingConfig(root) : void 0;
|
|
4952
5059
|
if (detected && (detected.class === "b" || detected.class === "c")) {
|
|
4953
|
-
const bindingNames = resolveBindingNames(config.inference?.bindings);
|
|
4954
5060
|
const frameworkPersistRoot = join(root, ".wrangler", "state");
|
|
4955
5061
|
const syncFrameworkCompat = (compat) => {
|
|
4956
5062
|
if (ensureWranglerCompatibilityDate(root, compat.compatibilityDate)) voidLog("Synced compatibility_date to wrangler config");
|
|
@@ -4999,11 +5105,13 @@ function voidPlugin(options) {
|
|
|
4999
5105
|
}
|
|
5000
5106
|
},
|
|
5001
5107
|
clientStubsPlugin,
|
|
5108
|
+
bindingRuntimePlugin(bindingNames),
|
|
5002
5109
|
envSchemaPlugin(root),
|
|
5003
5110
|
envClientGuardPlugin(root),
|
|
5004
5111
|
envClientFoldPlugin(),
|
|
5005
5112
|
drizzlePlugin(root, false, dialect, {
|
|
5006
|
-
|
|
5113
|
+
d1BindingName: bindingNames?.d1,
|
|
5114
|
+
forceVirtualDb: authEnabled || bindingNames?.d1 !== void 0,
|
|
5007
5115
|
localD1PersistRoot: frameworkPersistRoot
|
|
5008
5116
|
}),
|
|
5009
5117
|
migrationPlugin(root, dialect, "local", frameworkPersistRoot, { enabled: false }),
|
|
@@ -5037,21 +5145,24 @@ function voidPlugin(options) {
|
|
|
5037
5145
|
delete resolved.assets.not_found_handling;
|
|
5038
5146
|
delete resolved.assets.run_worker_first;
|
|
5039
5147
|
}
|
|
5148
|
+
const d1Name = bindingNames?.d1 ?? "DB";
|
|
5040
5149
|
const d1 = [];
|
|
5041
|
-
if ((bindings.needsD1 || authEnabled && dialect === "sqlite") && !hasBinding(resolved.d1_databases,
|
|
5042
|
-
binding:
|
|
5150
|
+
if ((bindings.needsD1 || authEnabled && dialect === "sqlite") && !hasBinding(resolved.d1_databases, d1Name)) d1.push({
|
|
5151
|
+
binding: d1Name,
|
|
5043
5152
|
database_name: "default",
|
|
5044
5153
|
database_id: "local"
|
|
5045
5154
|
});
|
|
5046
|
-
if (d1.length > 0) result.d1_databases =
|
|
5155
|
+
if (d1.length > 0) result.d1_databases = d1;
|
|
5156
|
+
const kvName = bindingNames?.kv ?? "KV";
|
|
5047
5157
|
const kv = [];
|
|
5048
|
-
if (bindings.needsKV && !hasBinding(resolved.kv_namespaces,
|
|
5049
|
-
binding:
|
|
5158
|
+
if (bindings.needsKV && !hasBinding(resolved.kv_namespaces, kvName)) kv.push({
|
|
5159
|
+
binding: kvName,
|
|
5050
5160
|
id: "local"
|
|
5051
5161
|
});
|
|
5052
|
-
if (kv.length > 0) result.kv_namespaces =
|
|
5053
|
-
|
|
5054
|
-
|
|
5162
|
+
if (kv.length > 0) result.kv_namespaces = kv;
|
|
5163
|
+
const r2Name = bindingNames?.r2 ?? "STORAGE";
|
|
5164
|
+
if (bindings.needsR2 && !hasBinding(resolved.r2_buckets, r2Name)) result.r2_buckets = [{
|
|
5165
|
+
binding: r2Name,
|
|
5055
5166
|
bucket_name: "default"
|
|
5056
5167
|
}];
|
|
5057
5168
|
if (queues.length > 0) result.queues = {
|
|
@@ -5285,8 +5396,10 @@ function voidPlugin(options) {
|
|
|
5285
5396
|
envClientGuardPlugin(root),
|
|
5286
5397
|
envClientFoldPlugin(),
|
|
5287
5398
|
clientStubsPlugin,
|
|
5399
|
+
bindingRuntimePlugin(bindingNames),
|
|
5288
5400
|
drizzlePlugin(root, false, getDatabaseDialect(config), {
|
|
5289
|
-
|
|
5401
|
+
d1BindingName: bindingNames?.d1,
|
|
5402
|
+
forceVirtualDb: authEnabled || bindingNames?.d1 !== void 0,
|
|
5290
5403
|
localD1PersistRoot: options?.persistTo ?? outDir,
|
|
5291
5404
|
redirectDbTypePaths
|
|
5292
5405
|
}),
|
|
@@ -5381,6 +5494,7 @@ function voidPlugin(options) {
|
|
|
5381
5494
|
envClientGuardPlugin(root),
|
|
5382
5495
|
envClientFoldPlugin(),
|
|
5383
5496
|
clientStubsPlugin,
|
|
5497
|
+
bindingRuntimePlugin(bindingNames),
|
|
5384
5498
|
...bindings.needsSandbox ? [createSandboxSdkResolvePlugin()] : [],
|
|
5385
5499
|
...pagesDevCssAssetsPlugin(root, devTriggerToken),
|
|
5386
5500
|
routingPlugin(root, {
|
|
@@ -5391,6 +5505,7 @@ function voidPlugin(options) {
|
|
|
5391
5505
|
prerenderPaths: config.routing?.prerender,
|
|
5392
5506
|
remoteMode,
|
|
5393
5507
|
routing: config.routing,
|
|
5508
|
+
bindingNames,
|
|
5394
5509
|
hasSandbox: bindings.needsSandbox,
|
|
5395
5510
|
sandboxBindingName: sandboxConfig?.binding,
|
|
5396
5511
|
sandboxClassName: sandboxConfig?.className,
|
|
@@ -5398,7 +5513,8 @@ function voidPlugin(options) {
|
|
|
5398
5513
|
onDevAssetRoutingPolicyChange: updateDevAssetRoutingPolicy
|
|
5399
5514
|
}),
|
|
5400
5515
|
drizzlePlugin(root, true, dialect, {
|
|
5401
|
-
|
|
5516
|
+
d1BindingName: bindingNames?.d1,
|
|
5517
|
+
forceVirtualDb: authEnabled || bindingNames?.d1 !== void 0,
|
|
5402
5518
|
localD1PersistRoot: options?.persistTo ?? outDir
|
|
5403
5519
|
}),
|
|
5404
5520
|
migrationPlugin(root, dialect, "local", join(root, ".void"), {
|
|
@@ -5,16 +5,16 @@ import { c as getToken, n as PlatformClient, u as isStagingMode } from "./client
|
|
|
5
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
6
|
import { a as writeProjectConfig, r as readProjectConfig } from "./project-CH9pdo16.mjs";
|
|
7
7
|
import { c as getDatabaseDialect, f as readConfig } from "./config-BVEC0lti.mjs";
|
|
8
|
-
import { r as detectFramework } from "./plugin-inference-
|
|
8
|
+
import { r as detectFramework } from "./plugin-inference-BUBhHt_1.mjs";
|
|
9
9
|
import { r as parseDotenvFile, t as expandDotenv } from "./dotenv-Bkoqyq9r.mjs";
|
|
10
10
|
import { n as ensureProjectTsconfig, t as createProjectTsconfig } from "./project-tsconfig-HAGjfY6w.mjs";
|
|
11
11
|
import { t as MagicString } from "./magic-string.es-C1Fb0uxq.mjs";
|
|
12
12
|
import { n as writeDrizzleConfig } from "./config--wXmVOoe.mjs";
|
|
13
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-
|
|
14
|
+
import { n as promptAndCreateProject, r as promptProjectSelection } from "./create-project-Dg5hiuDE.mjs";
|
|
15
15
|
import { t as promptForLoginToken } from "./login-BZ1Yk9Xw.mjs";
|
|
16
|
-
import { r as formatProjectCommand } from "./preset-
|
|
17
|
-
import { n as findInstalledYarnPnpRuntime, r as hasLocalLockfile, t as buildDrizzleKitSpawnEnv } from "./yarn-pnp-
|
|
16
|
+
import { r as formatProjectCommand } from "./preset-Lvi0ORmO.mjs";
|
|
17
|
+
import { n as findInstalledYarnPnpRuntime, r as hasLocalLockfile, t as buildDrizzleKitSpawnEnv } from "./yarn-pnp-BdM0hoCa.mjs";
|
|
18
18
|
import { createRequire } from "node:module";
|
|
19
19
|
import { existsSync, mkdirSync, readFileSync, readdirSync, rmdirSync, unlinkSync, writeFileSync } from "node:fs";
|
|
20
20
|
import { fileURLToPath } from "node:url";
|
|
@@ -45,7 +45,7 @@ async function maybeSetupDeployProject(root) {
|
|
|
45
45
|
const client = new PlatformClient(existingToken ?? await ensureToken(root), { root });
|
|
46
46
|
const projects = await client.listProjects();
|
|
47
47
|
if (projects.length === 0) return promptAndCreateProject(root, client);
|
|
48
|
-
const result = await promptProjectSelection(projects, "Select a project to link:", root);
|
|
48
|
+
const result = await promptProjectSelection(projects, "Select a project to link:", root, { confirmExisting: true });
|
|
49
49
|
if (result.action === "select") {
|
|
50
50
|
const config = {
|
|
51
51
|
projectId: result.project.id,
|
|
@@ -2764,7 +2764,7 @@ async function runInitCommand(root, initArgs) {
|
|
|
2764
2764
|
const agentSetup = await resolveAgentSetup(root);
|
|
2765
2765
|
injectAgentBlock(root, agentSetup.instructionFilePath);
|
|
2766
2766
|
if (agentSetup.agents.length > 0) {
|
|
2767
|
-
const { linkSkillsForSpecificAgents } = await import("./skills-
|
|
2767
|
+
const { linkSkillsForSpecificAgents } = await import("./skills-GPm5Kjev.mjs");
|
|
2768
2768
|
linkSkillsForSpecificAgents(root, agentSetup.agents);
|
|
2769
2769
|
} else R.info("Skills linking skipped for generic agent setup");
|
|
2770
2770
|
setupMcpConfig(root, agentSetup.agents);
|