void 0.9.2 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{auth-cmd-CPkWrQR9.mjs → auth-cmd-DBnbrX9Y.mjs} +2 -2
- package/dist/{better-auth-shared-ChVbrq52.mjs → better-auth-shared-D0Mbmx5V.mjs} +1 -1
- package/dist/{better-auth-shared-CmEQZs1T.d.mts → better-auth-shared-a7H3wk9J.d.mts} +2 -2
- package/dist/{cache-1SVxZ7BK.mjs → cache-DNX0hLsO.mjs} +1 -1
- package/dist/{cancel-deploy-JaFClLr7.mjs → cancel-deploy-CDzkVaYZ.mjs} +1 -1
- package/dist/cli/cli.mjs +205 -36
- package/dist/{client-DIfOFf1W.mjs → client-D4awzTnj.mjs} +149 -45
- package/dist/{config-BVEC0lti.mjs → config-8dLIngKW.mjs} +1 -1
- package/dist/{create-project-DCUrFJxa.mjs → create-project-CGodxfzH.mjs} +1 -1
- package/dist/{db-DiddQC2v.mjs → db-ERzz4oly.mjs} +16 -16
- package/dist/{delete-CYknzwXU.mjs → delete-CJZGDLBR.mjs} +1 -1
- package/dist/{deploy-CRU9fGjE.mjs → deploy-Cwa5sooV.mjs} +97 -108
- package/dist/{domain-B7RntQ1r.mjs → domain-WvoAHE6w.mjs} +1 -1
- package/dist/{drizzle-2fs1qTgy.mjs → drizzle-DqstQTGq.mjs} +1 -1
- package/dist/{env-Bvw0wMTI.mjs → env-Cx4czPsR.mjs} +3 -3
- package/dist/{env-helpers-Bd2wVdxz.d.mts → env-helpers-ZatKyjen.d.mts} +1 -1
- package/dist/{env-types-D6qI1ThV.mjs → env-types-CaJaIRXU.mjs} +1 -1
- package/dist/{env-validation-DBJsxZLz.mjs → env-validation-LH6eoyW-.mjs} +3 -3
- package/dist/{gen-CZdNWIaA.mjs → gen-Dgi4D7GC.mjs} +3 -3
- package/dist/git-metadata-Ce0AtSZL.mjs +82 -0
- package/dist/github-cmd-CUB041gj.mjs +308 -0
- package/dist/{handler-xflsMwWM.d.mts → handler-DczZlaXR.d.mts} +24 -4
- package/dist/{headers-Y0jshugF.mjs → headers-BNWymgnH.mjs} +2 -2
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +60 -55
- package/dist/{init-BHupO7Fm.mjs → init-DvaRDMIc.mjs} +125 -80
- package/dist/{link-7MoXUMaI.mjs → link-CpbWJY3P.mjs} +2 -2
- package/dist/{list-N2mCHv8q.mjs → list-BkwE5vH4.mjs} +1 -1
- package/dist/{login-tt1OmNVg.mjs → login-Ca6mhQVI.mjs} +1 -1
- package/dist/{logs-Cl7q2CjZ.mjs → logs-ArQzZquo.mjs} +1 -1
- package/dist/{mcp-BXD35N2J.mjs → mcp-Cc2MMXdQ.mjs} +1 -1
- package/dist/{node-CHWVVjO6.mjs → node-B07cZs0d.mjs} +4 -4
- package/dist/pages/client.d.mts +1 -1
- package/dist/pages/client.mjs +1 -0
- package/dist/pages/head-client.d.mts +1 -1
- package/dist/pages/head.d.mts +1 -1
- package/dist/pages/index.d.mts +8 -6
- package/dist/pages/index.mjs +3 -3
- package/dist/pages/islands-plugin.d.mts +1 -1
- package/dist/pages/islands-plugin.mjs +1 -1
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +30 -12
- package/dist/{plugin-inference-BUBhHt_1.mjs → plugin-inference-C3fLzFvP.mjs} +3 -1
- package/dist/{prepare-CrlAVbWS.mjs → prepare-DH2WnEpD.mjs} +14 -19
- package/dist/{preset-CIJG2O7a.mjs → preset-B7ZQZn0u.mjs} +2 -2
- package/dist/{project-cmd-CLrqSbqj.mjs → project-cmd-CWZeawuN.mjs} +8 -8
- package/dist/{project-tsconfig-HAGjfY6w.mjs → project-tsconfig-BTNuNoJ0.mjs} +18 -4
- package/dist/{protocol-DYca39yJ.d.mts → protocol-63PHtCHS.d.mts} +8 -5
- package/dist/{rollback-CEbAwbHK.mjs → rollback-BJ60ktsW.mjs} +1 -1
- package/dist/{route-types-jxRfWuCb.mjs → route-types-D03ryMXz.mjs} +3 -2
- package/dist/{runner-DLZ9E_cX.mjs → runner-BQyKUqAL.mjs} +1 -1
- 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 +2 -2
- package/dist/runtime/client-react.mjs +1 -1
- package/dist/runtime/client-solid.d.mts +2 -2
- package/dist/runtime/client-solid.mjs +1 -1
- package/dist/runtime/client-svelte.d.mts +2 -2
- package/dist/runtime/client-svelte.mjs +1 -1
- package/dist/runtime/client-vue.d.mts +2 -2
- package/dist/runtime/client-vue.mjs +1 -1
- 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 +2 -2
- package/dist/runtime/handler.mjs +68 -2
- 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/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-BNC_1OsY.mjs → scan-DGEp1-1Q.mjs} +19 -11
- package/dist/{scan-2YmJkYAf.mjs → scan-VCAM1oh3.mjs} +55 -29
- package/dist/{secret-C_uTY7xx.mjs → secret-BRbXyu7E.mjs} +1 -1
- package/dist/{types-Dm9kep2X.d.mts → types-BnHMXezo.d.mts} +12 -3
- package/package.json +2 -2
- package/schema.json +3 -3
- package/skills/void/docs/guide/deployment.md +37 -11
- package/skills/void/docs/guide/edge/headers.md +10 -3
- package/skills/void/docs/guide/edge/rewrites.md +5 -5
- package/skills/void/docs/guide/pages-routing/layouts.md +8 -7
- package/skills/void/docs/guide/pages-routing/loaders.md +1 -1
- package/skills/void/docs/guide/pages-routing/overview.md +32 -5
- package/skills/void/docs/guide/server-routing.md +28 -0
- package/skills/void/docs/node_modules/void/AGENTS.md +15 -14
- package/skills/void/docs/node_modules/void/README.md +1 -0
- package/skills/void/docs/reference/api.md +44 -1
- package/skills/void/docs/reference/cli.md +65 -2
- package/skills/void/docs/reference/config.md +1 -1
- /package/dist/{auth-migrations-CuQkjjWE.mjs → auth-migrations-BP-hMzYl.mjs} +0 -0
- /package/dist/{auth-CDeb2XAl.d.mts → auth-nEUVHuFI.d.mts} +0 -0
- /package/dist/{defer-CouVukrf.mjs → defer-C-bdSM_b.mjs} +0 -0
- /package/dist/{dist-DR9sIMbM.mjs → dist-5cGIJHQQ.mjs} +0 -0
- /package/dist/{dotenv-Bkoqyq9r.mjs → dotenv-lS94ymhM.mjs} +0 -0
- /package/dist/{env-raw-RDkMnSTC.mjs → env-raw-Dtj1UAoK.mjs} +0 -0
- /package/dist/{fetch-error-CimrygMq.d.mts → fetch-error-BQMdPvge.d.mts} +0 -0
- /package/dist/{fetch-error-BFIoojjf.mjs → fetch-error-C6qffTl2.mjs} +0 -0
- /package/dist/{head-BsSTGnIe.d.mts → head-JAH2l3fg.d.mts} +0 -0
- /package/dist/{log-CWWZV4V1.mjs → log-BdD_Fpms.mjs} +0 -0
- /package/dist/{package-json-B2TD0JLu.mjs → package-json-Bg_GJdJB.mjs} +0 -0
- /package/dist/{pg-CMZ_5wsC.mjs → pg-CempqvEJ.mjs} +0 -0
- /package/dist/{providers-3Kkv63Ha.d.mts → providers-BkiAlEad.d.mts} +0 -0
- /package/dist/{providers-uC0PJg1c.mjs → providers-BwPbdHdi.mjs} +0 -0
- /package/dist/{runner-pg-Cv9V7ydr.mjs → runner-pg-BAheiT6v.mjs} +0 -0
- /package/dist/{skills-BRKc--As.mjs → skills--OMgLmXW.mjs} +0 -0
- /package/dist/{standard-schema-Dnsh2vnl.d.mts → standard-schema-BCBv-QaP.d.mts} +0 -0
- /package/dist/{subcommand-prompt-OD-x_Tsm.mjs → subcommand-prompt-ClwpLlKD.mjs} +0 -0
- /package/dist/{yarn-pnp-0SwYgQxx.mjs → yarn-pnp-DhCHHLAz.mjs} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
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 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-
|
|
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-Cwa5sooV.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 {
|
|
7
|
+
import { d as getToken, p as isStagingMode } from "./client-D4awzTnj.mjs";
|
|
8
8
|
import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { a as
|
|
12
|
-
import { i as
|
|
13
|
-
import { r as
|
|
14
|
-
import {
|
|
15
|
-
import { n as
|
|
9
|
+
import { n as ensureProjectTsconfig, r as writeFileIfChanged } from "./project-tsconfig-BTNuNoJ0.mjs";
|
|
10
|
+
import { c as getDatabaseDialect, f as readConfig, l as isNodeTarget, p as resolveBindingNames } from "./config-8dLIngKW.mjs";
|
|
11
|
+
import { a as scanQueuesSync, i as scanWebSocketRoutesSync, n as scanRoutePatternsSync, o as scanJobsSync, r as scanRoutes, t as scanMiddlewareSync } from "./scan-DGEp1-1Q.mjs";
|
|
12
|
+
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-C3fLzFvP.mjs";
|
|
13
|
+
import { i as voidWarn, n as voidError, r as voidLog, t as setShowTimestamp } from "./log-BdD_Fpms.mjs";
|
|
14
|
+
import { r as parseDotenvFile } from "./dotenv-lS94ymhM.mjs";
|
|
15
|
+
import { i as generateDbDts, n as generateQueueTypes, r as DRIZZLE_OPERATORS, t as generateRouteTypes } from "./route-types-D03ryMXz.mjs";
|
|
16
16
|
import { t as discoverSchema } from "./discover-C8N1I4tK.mjs";
|
|
17
17
|
import { t as MagicString } from "./magic-string.es-C1Fb0uxq.mjs";
|
|
18
|
-
import { n as findEnvFileForPaths, r as generateEnvTypes, t as findEnvFile } from "./env-types-
|
|
19
|
-
import { a as loadUserEnvFile } from "./env-validation-
|
|
20
|
-
import { i as resolveLayoutIds } from "./scan-
|
|
18
|
+
import { n as findEnvFileForPaths, r as generateEnvTypes, t as findEnvFile } from "./env-types-CaJaIRXU.mjs";
|
|
19
|
+
import { a as loadUserEnvFile } from "./env-validation-LH6eoyW-.mjs";
|
|
20
|
+
import { i as resolveLayoutIds } from "./scan-VCAM1oh3.mjs";
|
|
21
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-
|
|
23
|
-
import { n as generateVoidAuthDrizzleSchema, t as generateVoidAuthDatabaseModule } from "./drizzle-
|
|
24
|
-
import { t as INTERNAL_BINDING_PREFIXES } from "./env-raw-
|
|
25
|
-
import { n as defer } from "./defer-
|
|
26
|
-
import { VoidAssetRewriteError, defineHandler, defineHead, defineMiddleware, defineQueue, defineRender, defineScheduled } from "./runtime/handler.mjs";
|
|
22
|
+
import { n as lintDuplicateSources, r as mergeRoutingRules, t as lintDestinationSplats } from "./headers-BNWymgnH.mjs";
|
|
23
|
+
import { n as generateVoidAuthDrizzleSchema, t as generateVoidAuthDatabaseModule } from "./drizzle-DqstQTGq.mjs";
|
|
24
|
+
import { t as INTERNAL_BINDING_PREFIXES } from "./env-raw-Dtj1UAoK.mjs";
|
|
25
|
+
import { n as defer } from "./defer-C-bdSM_b.mjs";
|
|
26
|
+
import { VoidAssetRewriteError, basicAuth, defineHandler, defineHead, defineMiddleware, defineQueue, defineRender, defineScheduled } from "./runtime/handler.mjs";
|
|
27
27
|
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, readdirSync, rmSync, writeFileSync, writeSync } from "node:fs";
|
|
28
28
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
29
29
|
import { cloudflare } from "@cloudflare/vite-plugin";
|
|
@@ -654,7 +654,7 @@ export function createDb(d1) {
|
|
|
654
654
|
const migrationsDir = paths.migrationsDir;
|
|
655
655
|
if (!(existsSync(migrationsDir) && readdirSync(migrationsDir).some((f) => f.endsWith(".sql")))) {
|
|
656
656
|
if (dialect === "sqlite") {
|
|
657
|
-
const { getApplicationTables, getMiniflareDatabasePath } = await import("./runner-
|
|
657
|
+
const { getApplicationTables, getMiniflareDatabasePath } = await import("./runner-BQyKUqAL.mjs");
|
|
658
658
|
if ((await getApplicationTables(getMiniflareDatabasePath(options.localD1PersistRoot ?? join(root, ".void"), options.localD1DatabaseId ?? "local")).catch(() => [])).length > 0) return;
|
|
659
659
|
}
|
|
660
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.
|
|
@@ -1058,7 +1058,7 @@ function envSchemaPlugin(root, options = {}) {
|
|
|
1058
1058
|
if (!envFile) return;
|
|
1059
1059
|
mkdirSync(outDir, { recursive: true });
|
|
1060
1060
|
const { dts } = generateEnvTypes(envFile, outDir);
|
|
1061
|
-
|
|
1061
|
+
writeFileIfChanged(join(outDir, "env.d.ts"), dts);
|
|
1062
1062
|
}
|
|
1063
1063
|
async function importUserEnv() {
|
|
1064
1064
|
if (!envFile) return;
|
|
@@ -1654,7 +1654,7 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
|
|
|
1654
1654
|
else warn();
|
|
1655
1655
|
return;
|
|
1656
1656
|
}
|
|
1657
|
-
const { runPgMigrations, getPgAppliedMigrations } = await import("./runner-pg-
|
|
1657
|
+
const { runPgMigrations, getPgAppliedMigrations } = await import("./runner-pg-BAheiT6v.mjs");
|
|
1658
1658
|
const { collectMigrations } = await import("./collect-9rO3JFNM.mjs").then((n) => n.n);
|
|
1659
1659
|
const { validateMigrations } = await import("./validate-CNWm-PsL.mjs").then((n) => n.i);
|
|
1660
1660
|
const allMigrations = collectMigrations(migrationsDir);
|
|
@@ -1669,7 +1669,7 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
|
|
|
1669
1669
|
const applied = await runPgMigrations(migrationsDir, url);
|
|
1670
1670
|
if (applied.length > 0) voidLog(`Applied ${applied.length} migration(s): ${applied.join(", ")}`);
|
|
1671
1671
|
} else if (hasSqlMigrations) {
|
|
1672
|
-
const { runMigrations, getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-
|
|
1672
|
+
const { runMigrations, getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-BQyKUqAL.mjs");
|
|
1673
1673
|
const { collectMigrations } = await import("./collect-9rO3JFNM.mjs").then((n) => n.n);
|
|
1674
1674
|
const { validateMigrations } = await import("./validate-CNWm-PsL.mjs").then((n) => n.i);
|
|
1675
1675
|
const dbPath = getMiniflareDatabasePath(persistRoot, databaseId);
|
|
@@ -1686,7 +1686,7 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
|
|
|
1686
1686
|
if (applied.length > 0) voidLog(`Applied ${applied.length} migration(s): ${applied.join(", ")}`);
|
|
1687
1687
|
}
|
|
1688
1688
|
if (auth?.enabled) {
|
|
1689
|
-
const { runLocalVoidAuthMigrations } = await import("./node-
|
|
1689
|
+
const { runLocalVoidAuthMigrations } = await import("./node-B07cZs0d.mjs");
|
|
1690
1690
|
await runLocalVoidAuthMigrations(root, dialect, persistRoot, databaseId, auth.configPath);
|
|
1691
1691
|
voidLog("Applied Better Auth migrations");
|
|
1692
1692
|
}
|
|
@@ -2621,7 +2621,7 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
|
|
|
2621
2621
|
lines.push("function __voidAnnotateRouting(response, trace) {");
|
|
2622
2622
|
lines.push(" if (!__VOID_DEV_ROUTING || !response) return response;");
|
|
2623
2623
|
lines.push(" const headers = new Headers(response.headers);");
|
|
2624
|
-
lines.push(" headers.set(\"X-Void-Routing\", trace);");
|
|
2624
|
+
lines.push(" try { headers.set(\"X-Void-Routing\", trace); } catch { return response; }");
|
|
2625
2625
|
lines.push(" return new Response(response.body, { status: response.status, statusText: response.statusText, headers });");
|
|
2626
2626
|
lines.push("}");
|
|
2627
2627
|
lines.push("");
|
|
@@ -2671,7 +2671,7 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
|
|
|
2671
2671
|
if (options.nodeTarget) lines.push(" const __rewritePromise = app.fetch(rewriteReq, c.env);");
|
|
2672
2672
|
else lines.push(" const __rewritePromise = app.fetch(rewriteReq, c.env, c.executionCtx);");
|
|
2673
2673
|
lines.push(" if (!__VOID_DEV_ROUTING) return __rewritePromise;");
|
|
2674
|
-
lines.push(" return __rewritePromise.then((res) => __voidAnnotateRouting(res, \"c.rewrite
|
|
2674
|
+
lines.push(" return __rewritePromise.then((res) => __voidAnnotateRouting(res, \"c.rewrite -> \" + path + \" (middleware)\"));");
|
|
2675
2675
|
lines.push(" };");
|
|
2676
2676
|
lines.push(" const __origRedirect = c.redirect.bind(c);");
|
|
2677
2677
|
lines.push(" c.redirect = (location, status) => {");
|
|
@@ -3139,8 +3139,8 @@ window.__vite_plugin_react_preamble_installed__ = true;
|
|
|
3139
3139
|
return lines.join("\n");
|
|
3140
3140
|
}
|
|
3141
3141
|
function compilePrerenderCollector(lines, scan, ssr, options) {
|
|
3142
|
-
const staticPaths = scan.pages.pages.filter((page) => page.
|
|
3143
|
-
const dynamicPages = scan.pages.pages.filter((page) => page.
|
|
3142
|
+
const staticPaths = scan.pages.pages.filter((page) => page.shouldPrerender && page.params.length === 0 && !page.catchAll).map((page) => page.pattern);
|
|
3143
|
+
const dynamicPages = scan.pages.pages.filter((page) => page.shouldPrerender && page.hasGetPrerenderPaths && (page.params.length > 0 || page.catchAll));
|
|
3144
3144
|
const explicitPaths = options.explicitPrerenderPaths ?? [];
|
|
3145
3145
|
lines.push(`function __voidBuildPrerenderPath(pattern, params) {`);
|
|
3146
3146
|
lines.push(` let path = pattern;`);
|
|
@@ -3194,11 +3194,16 @@ function compilePrerenderCollector(lines, scan, ssr, options) {
|
|
|
3194
3194
|
function compilePageRoutes(lines, scan, pages, options) {
|
|
3195
3195
|
lines.push(`import { handlePageGet, handlePageMutation } from ${JSON.stringify(pages.protocolPath)};`);
|
|
3196
3196
|
lines.push(`import { renderHeadToString, renderHtmlAttrs, renderBodyAttrs } from ${JSON.stringify(pages.headPath)};`);
|
|
3197
|
-
lines.push(`import
|
|
3197
|
+
lines.push(`import * as __voidPagesRenderer from "virtual:void-pages-renderer";`);
|
|
3198
3198
|
if (options.dev) lines.push(`import { getVoidPagesDevCss } from "virtual:void-pages-dev-assets";`);
|
|
3199
|
-
const hasIslandPages = scan.pages.pages.some((p) => p.island);
|
|
3199
|
+
const hasIslandPages = scan.pages.pages.some((p) => p.renderMode === "island");
|
|
3200
3200
|
if (hasIslandPages) lines.push(`import { renderIslandPage } from "virtual:void-islands-renderer";`);
|
|
3201
3201
|
lines.push("");
|
|
3202
|
+
lines.push(`const renderPage = __voidPagesRenderer.renderPage;`);
|
|
3203
|
+
lines.push(`if (typeof __voidPagesRenderer.renderPreambleScript === "string") {`);
|
|
3204
|
+
lines.push(` renderPage.preambleScript = __voidPagesRenderer.renderPreambleScript;`);
|
|
3205
|
+
lines.push(`}`);
|
|
3206
|
+
lines.push("");
|
|
3202
3207
|
lines.push(`const __voidHeadConfig = ${JSON.stringify(pages.headConfig ?? null)};`);
|
|
3203
3208
|
lines.push("");
|
|
3204
3209
|
pushDefaultErrorPageHelpers(lines, options);
|
|
@@ -3447,17 +3452,17 @@ function compilePageRoutes(lines, scan, pages, options) {
|
|
|
3447
3452
|
lines.push(`const ${headVarName} = () => (${JSON.stringify(headObj)});`);
|
|
3448
3453
|
mdHeadRef = headVarName;
|
|
3449
3454
|
}
|
|
3450
|
-
const renderer = page.island ? "renderIslandPage" : "renderPage";
|
|
3451
|
-
const assetTags = page.island && pages.islandClientEntryId ? "getIslandsAssetTags" : "getPagesAssetTags";
|
|
3452
|
-
const
|
|
3455
|
+
const renderer = page.renderMode === "island" ? "renderIslandPage" : "renderPage";
|
|
3456
|
+
const assetTags = page.renderMode === "island" && pages.islandClientEntryId ? "getIslandsAssetTags" : "getPagesAssetTags";
|
|
3457
|
+
const renderOptions = `, ${JSON.stringify({ renderMode: page.renderMode })}`;
|
|
3453
3458
|
lines.push(`app.get(${JSON.stringify(page.pattern)}, async (c) => {`);
|
|
3454
3459
|
if (serverImportPath) {
|
|
3455
3460
|
const loaderName = `_pload_${safeId}`;
|
|
3456
3461
|
lines.push(` const mod = await ${loaderName}();`);
|
|
3457
|
-
lines.push(` return handlePageGet(mod.loader, mod.head, c, ${JSON.stringify(page.componentId)}, ${renderer}, ${assetTags}, __voidHeadConfig${
|
|
3462
|
+
lines.push(` return handlePageGet(mod.loader, mod.head, c, ${JSON.stringify(page.componentId)}, ${renderer}, ${assetTags}, __voidHeadConfig${renderOptions});`);
|
|
3458
3463
|
} else {
|
|
3459
3464
|
const headArg = mdHeadRef ?? "undefined";
|
|
3460
|
-
lines.push(` return handlePageGet(undefined, ${headArg}, c, ${JSON.stringify(page.componentId)}, ${renderer}, ${assetTags}, __voidHeadConfig${
|
|
3465
|
+
lines.push(` return handlePageGet(undefined, ${headArg}, c, ${JSON.stringify(page.componentId)}, ${renderer}, ${assetTags}, __voidHeadConfig${renderOptions});`);
|
|
3461
3466
|
}
|
|
3462
3467
|
lines.push(`});`);
|
|
3463
3468
|
if (page.methods.includes("action") || page.methods.includes("actions")) {
|
|
@@ -3469,7 +3474,7 @@ function compilePageRoutes(lines, scan, pages, options) {
|
|
|
3469
3474
|
lines.push(` const handler = actionName ? mod.actions?.[actionName] : mod.actions?.default;`);
|
|
3470
3475
|
lines.push(` if (!handler) return new Response("Unknown action" + (actionName ? ": " + actionName : ""), { status: 404 });`);
|
|
3471
3476
|
} else lines.push(` const handler = mod.action;`);
|
|
3472
|
-
lines.push(` return handlePageMutation(handler, mod.loader, mod.head, c, ${JSON.stringify(page.componentId)}, ${renderer}, ${assetTags}, __voidHeadConfig${
|
|
3477
|
+
lines.push(` return handlePageMutation(handler, mod.loader, mod.head, c, ${JSON.stringify(page.componentId)}, ${renderer}, ${assetTags}, __voidHeadConfig${renderOptions});`);
|
|
3473
3478
|
lines.push(`});`);
|
|
3474
3479
|
}
|
|
3475
3480
|
}
|
|
@@ -4018,13 +4023,13 @@ function emitApplyRoutingRules(lines, rulesVar, indent, nodeTarget, markFallback
|
|
|
4018
4023
|
else lines.push(`${indent} const __r = await app.fetch(rewriteReq, c.env, c.executionCtx);`);
|
|
4019
4024
|
lines.push(`${indent} if (!__VOID_DEV_ROUTING) return __r;`);
|
|
4020
4025
|
lines.push(`${indent} const __kind = matched.rule.force === true ? "rewrite" : "fallback";`);
|
|
4021
|
-
lines.push(`${indent} const __trace = __kind + "[" + matched.rule.source + "]
|
|
4026
|
+
lines.push(`${indent} const __trace = __kind + "[" + matched.rule.source + "] -> " + dest + " (" + (matched.rule.origin || "unknown") + ")";`);
|
|
4022
4027
|
lines.push(`${indent} return __voidAnnotateRouting(__r, __trace);`);
|
|
4023
4028
|
lines.push(`${indent} }`);
|
|
4024
4029
|
lines.push(`${indent} const location = __mergeQueryIntoLocation(dest, new URL(c.req.url).search);`);
|
|
4025
4030
|
lines.push(`${indent} const __redir = c.redirect(location, matched.rule.status);`);
|
|
4026
4031
|
lines.push(`${indent} if (!__VOID_DEV_ROUTING) return __redir;`);
|
|
4027
|
-
lines.push(`${indent} const __rtrace = "redirect[" + matched.rule.source + "]
|
|
4032
|
+
lines.push(`${indent} const __rtrace = "redirect[" + matched.rule.source + "] -> " + dest + " " + matched.rule.status + " (" + (matched.rule.origin || "unknown") + ")";`);
|
|
4028
4033
|
lines.push(`${indent} return __voidAnnotateRouting(__redir, __rtrace);`);
|
|
4029
4034
|
lines.push(`${indent}}`);
|
|
4030
4035
|
}
|
|
@@ -4241,12 +4246,12 @@ function routingPlugin(root, options) {
|
|
|
4241
4246
|
function writeRouteTypes() {
|
|
4242
4247
|
if (!scan) return;
|
|
4243
4248
|
const { dts } = generateRouteTypes(scan, routesDir, outDir, pagesDir);
|
|
4244
|
-
|
|
4249
|
+
writeFileIfChanged(join(outDir, "routes.d.ts"), dts);
|
|
4245
4250
|
}
|
|
4246
4251
|
function writeQueueTypes() {
|
|
4247
4252
|
if (!scan) return;
|
|
4248
4253
|
const dts = generateQueueTypes(scan.queues, queuesDir, outDir);
|
|
4249
|
-
|
|
4254
|
+
writeFileIfChanged(join(outDir, "queues.d.ts"), dts);
|
|
4250
4255
|
}
|
|
4251
4256
|
async function rescan() {
|
|
4252
4257
|
scan = await scanRoutes(root, {
|
|
@@ -4347,8 +4352,8 @@ function routingPlugin(root, options) {
|
|
|
4347
4352
|
const env = loadEnv(resolvedConfig?.mode ?? "development", root, "");
|
|
4348
4353
|
const schemaPath = join(outDir, "better-auth-schema.ts");
|
|
4349
4354
|
const databasePath = join(outDir, "better-auth-db.ts");
|
|
4350
|
-
|
|
4351
|
-
|
|
4355
|
+
writeFileIfChanged(schemaPath, generateVoidAuthDrizzleSchema(authRuntime, env));
|
|
4356
|
+
writeFileIfChanged(databasePath, generateVoidAuthDatabaseModule({
|
|
4352
4357
|
dialect: compileOptions.auth.dialect,
|
|
4353
4358
|
schemaImportPath: schemaPath,
|
|
4354
4359
|
drizzleAdapterPath
|
|
@@ -4424,9 +4429,9 @@ function routingPlugin(root, options) {
|
|
|
4424
4429
|
const outDir = join(root, ".void");
|
|
4425
4430
|
mkdirSync(outDir, { recursive: true });
|
|
4426
4431
|
if (options.target) {
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
} else
|
|
4432
|
+
writeFileIfChanged(join(outDir, "app.ts"), compileNodeApp(options.target, compileOptions.honoPath, getEnvSchemaModule()));
|
|
4433
|
+
writeFileIfChanged(join(outDir, "index.ts"), compileNodeServer(options.target));
|
|
4434
|
+
} else writeFileIfChanged(join(outDir, "entry.ts"), compileWorkerEntry(false, remote, void 0, void 0, compileOptions.runtimeEnvPath, getEnvSchemaModule(), options.hasSandbox ? {
|
|
4430
4435
|
bindingName: options.sandboxBindingName,
|
|
4431
4436
|
className: options.sandboxClassName,
|
|
4432
4437
|
runtimePath: sandboxRuntimePath
|
|
@@ -4490,9 +4495,9 @@ function routingPlugin(root, options) {
|
|
|
4490
4495
|
}
|
|
4491
4496
|
}
|
|
4492
4497
|
if (options.target) {
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
} else
|
|
4498
|
+
writeFileIfChanged(join(outDir, "app.ts"), compileNodeApp(options.target, compileOptions.honoPath, getEnvSchemaModule()));
|
|
4499
|
+
writeFileIfChanged(join(outDir, "index.ts"), compileNodeServer(options.target));
|
|
4500
|
+
} else writeFileIfChanged(join(outDir, "entry.ts"), compileWorkerEntry(scan.queues.length > 0, remote, resolvedConfig?.build.assetsDir, (scan.websockets ?? []).map((route) => route.className), compileOptions.runtimeEnvPath, getEnvSchemaModule(), options.hasSandbox ? {
|
|
4496
4501
|
bindingName: options.sandboxBindingName,
|
|
4497
4502
|
className: options.sandboxClassName,
|
|
4498
4503
|
runtimePath: sandboxRuntimePath
|
|
@@ -4540,9 +4545,9 @@ function routingPlugin(root, options) {
|
|
|
4540
4545
|
writeRouteTypes();
|
|
4541
4546
|
writeQueueTypes();
|
|
4542
4547
|
if (options.target) {
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
} else
|
|
4548
|
+
writeFileIfChanged(join(outDir, "app.ts"), compileNodeApp(options.target, compileOptions.honoPath, getEnvSchemaModule()));
|
|
4549
|
+
writeFileIfChanged(join(outDir, "index.ts"), compileNodeServer(options.target));
|
|
4550
|
+
} else writeFileIfChanged(join(outDir, "entry.ts"), compileWorkerEntry(scan.queues.length > 0, remote, resolvedConfig?.build.assetsDir, (scan.websockets ?? []).map((route) => route.className), compileOptions.runtimeEnvPath, getEnvSchemaModule(), options.hasSandbox ? {
|
|
4546
4551
|
bindingName: options.sandboxBindingName,
|
|
4547
4552
|
className: options.sandboxClassName,
|
|
4548
4553
|
runtimePath: sandboxRuntimePath
|
|
@@ -4717,7 +4722,7 @@ function generateClassATriggerWrapper(root, framework, original, isBuild, assets
|
|
|
4717
4722
|
const outDir = join(root, ".void");
|
|
4718
4723
|
mkdirSync(outDir, { recursive: true });
|
|
4719
4724
|
const wrapperPath = join(outDir, `${framework}-trigger-wrapper.ts`);
|
|
4720
|
-
|
|
4725
|
+
writeFileIfChanged(wrapperPath, isBuild ? `// @ts-nocheck — Auto-generated by Void for vite build. Do NOT edit.
|
|
4721
4726
|
import original from ${JSON.stringify(original)};
|
|
4722
4727
|
|
|
4723
4728
|
export default {
|
|
@@ -4747,7 +4752,7 @@ function generateVinextPagesEntry(root) {
|
|
|
4747
4752
|
const outDir = join(root, ".void");
|
|
4748
4753
|
mkdirSync(outDir, { recursive: true });
|
|
4749
4754
|
const entryPath = join(outDir, "vinext-pages-entry.ts");
|
|
4750
|
-
|
|
4755
|
+
writeFileIfChanged(entryPath, `// Auto-generated by Void — vinext Pages Router worker entry
|
|
4751
4756
|
// @ts-expect-error virtual module resolved by vinext at build time
|
|
4752
4757
|
import { renderPage, handleApiRoute } from "virtual:vinext-server-entry";
|
|
4753
4758
|
|
|
@@ -4773,7 +4778,7 @@ function generateReactRouterEntry(root) {
|
|
|
4773
4778
|
const outDir = join(root, ".void");
|
|
4774
4779
|
mkdirSync(outDir, { recursive: true });
|
|
4775
4780
|
const entryPath = join(outDir, "react-router-entry.ts");
|
|
4776
|
-
|
|
4781
|
+
writeFileIfChanged(entryPath, `// Auto-generated by Void — React Router v7 worker entry
|
|
4777
4782
|
import { createRequestHandler } from "react-router";
|
|
4778
4783
|
|
|
4779
4784
|
const requestHandler = createRequestHandler(
|
|
@@ -4911,7 +4916,7 @@ const STAGING_API_URL = "https://api.staging.void.cloud";
|
|
|
4911
4916
|
*/
|
|
4912
4917
|
async function runAiSetupPrompt(root, token, staging, server) {
|
|
4913
4918
|
const { select, text, isCancel, log } = await import("./dist-abzUneor.mjs").then((n) => n.p);
|
|
4914
|
-
const { PlatformClient } = await import("./client-
|
|
4919
|
+
const { PlatformClient } = await import("./client-D4awzTnj.mjs").then((n) => n.r);
|
|
4915
4920
|
const { writeProjectConfig } = await import("./project-CH9pdo16.mjs").then((n) => n.n);
|
|
4916
4921
|
const { inferDefaultSlug } = await import("./resolve-project-D4O1_fZz.mjs").then((n) => n.i);
|
|
4917
4922
|
const client = new PlatformClient(token, staging ? STAGING_API_URL : DEFAULT_API_URL);
|
|
@@ -4940,7 +4945,7 @@ async function runAiSetupPrompt(root, token, staging, server) {
|
|
|
4940
4945
|
let slug;
|
|
4941
4946
|
if (result === "__create__") {
|
|
4942
4947
|
const { validateProjectSlug } = await import("./project-slug-rX3kTOfY.mjs").then((n) => n.t);
|
|
4943
|
-
const { createProjectWithSlugRetry } = await import("./create-project-
|
|
4948
|
+
const { createProjectWithSlugRetry } = await import("./create-project-CGodxfzH.mjs").then((n) => n.t);
|
|
4944
4949
|
let created;
|
|
4945
4950
|
try {
|
|
4946
4951
|
created = await createProjectWithSlugRetry(client, inferDefaultSlug(root), async (defaultSlug) => {
|
|
@@ -5555,4 +5560,4 @@ function voidPlugin(options) {
|
|
|
5555
5560
|
];
|
|
5556
5561
|
}
|
|
5557
5562
|
//#endregion
|
|
5558
|
-
export { VoidAssetRewriteError, defer, defineHandler, defineHead, defineMiddleware, defineQueue, defineRender, defineScheduled, voidPlugin };
|
|
5563
|
+
export { VoidAssetRewriteError, basicAuth, defer, defineHandler, defineHead, defineMiddleware, defineQueue, defineRender, defineScheduled, voidPlugin };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { a as join, c as resolve, i as isAbsolute, n as dirname, s as relative, t as basename } from "./pathe.M-eThtNZ-BrPhGF_K.mjs";
|
|
2
2
|
import { n as cliTitle } from "./output-DeiS4oEX.mjs";
|
|
3
3
|
import { n as readProjectPaths } from "./project-paths-CCMrHYQm.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { d as getToken, n as PlatformClient, p as isStagingMode } from "./client-D4awzTnj.mjs";
|
|
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
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { r as
|
|
10
|
-
import {
|
|
7
|
+
import { n as ensureProjectTsconfig, t as createProjectTsconfig } from "./project-tsconfig-BTNuNoJ0.mjs";
|
|
8
|
+
import { c as getDatabaseDialect, f as readConfig } from "./config-8dLIngKW.mjs";
|
|
9
|
+
import { r as detectFramework } from "./plugin-inference-C3fLzFvP.mjs";
|
|
10
|
+
import { r as parseDotenvFile, t as expandDotenv } from "./dotenv-lS94ymhM.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-MhSzNMiC.mjs";
|
|
14
|
-
import { n as promptAndCreateProject, r as promptProjectSelection } from "./create-project-
|
|
15
|
-
import { t as promptForLoginToken } from "./login-
|
|
16
|
-
import { r as formatProjectCommand } from "./preset-
|
|
17
|
-
import { n as findInstalledYarnPnpRuntime, r as hasLocalLockfile, t as buildDrizzleKitSpawnEnv } from "./yarn-pnp-
|
|
14
|
+
import { n as promptAndCreateProject, r as promptProjectSelection } from "./create-project-CGodxfzH.mjs";
|
|
15
|
+
import { t as promptForLoginToken } from "./login-Ca6mhQVI.mjs";
|
|
16
|
+
import { r as formatProjectCommand } from "./preset-B7ZQZn0u.mjs";
|
|
17
|
+
import { n as findInstalledYarnPnpRuntime, r as hasLocalLockfile, t as buildDrizzleKitSpawnEnv } from "./yarn-pnp-DhCHHLAz.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";
|
|
@@ -1767,95 +1767,138 @@ function getNodeVersionLine(root) {
|
|
|
1767
1767
|
if (existsSync(join(root, ".node-version"))) return "node-version-file: .node-version";
|
|
1768
1768
|
return "node-version: lts/*";
|
|
1769
1769
|
}
|
|
1770
|
-
|
|
1770
|
+
const WORKFLOW_DEFAULT_API_URL = "https://api.void.cloud";
|
|
1771
|
+
function getWorkflowSetupSteps(root, pm) {
|
|
1771
1772
|
const nodeVersion = getNodeVersionLine(root);
|
|
1772
1773
|
switch (pm) {
|
|
1773
|
-
case "pnpm": return
|
|
1774
|
-
|
|
1775
|
-
push:
|
|
1776
|
-
branches: [main]
|
|
1777
|
-
|
|
1778
|
-
jobs:
|
|
1779
|
-
deploy:
|
|
1780
|
-
runs-on: ubuntu-latest
|
|
1781
|
-
steps:
|
|
1782
|
-
- uses: actions/checkout@v6
|
|
1783
|
-
- uses: pnpm/action-setup@v5
|
|
1774
|
+
case "pnpm": return {
|
|
1775
|
+
setup: ` - uses: pnpm/action-setup@v5
|
|
1784
1776
|
- uses: actions/setup-node@v6
|
|
1785
1777
|
with:
|
|
1786
1778
|
${nodeVersion}
|
|
1787
|
-
cache: pnpm
|
|
1788
|
-
- run: pnpm install
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
case "yarn": return `name: Deploy
|
|
1794
|
-
on:
|
|
1795
|
-
push:
|
|
1796
|
-
branches: [main]
|
|
1797
|
-
|
|
1798
|
-
jobs:
|
|
1799
|
-
deploy:
|
|
1800
|
-
runs-on: ubuntu-latest
|
|
1801
|
-
steps:
|
|
1802
|
-
- uses: actions/checkout@v6
|
|
1803
|
-
- uses: actions/setup-node@v6
|
|
1779
|
+
cache: pnpm`,
|
|
1780
|
+
install: " - run: pnpm install --frozen-lockfile",
|
|
1781
|
+
runner: "pnpm exec void"
|
|
1782
|
+
};
|
|
1783
|
+
case "yarn": return {
|
|
1784
|
+
setup: ` - uses: actions/setup-node@v6
|
|
1804
1785
|
with:
|
|
1805
1786
|
${nodeVersion}
|
|
1806
|
-
cache: yarn
|
|
1807
|
-
- run: yarn install --immutable
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1787
|
+
cache: yarn`,
|
|
1788
|
+
install: " - run: yarn install --immutable",
|
|
1789
|
+
runner: "yarn void"
|
|
1790
|
+
};
|
|
1791
|
+
case "bun": return {
|
|
1792
|
+
setup: " - uses: oven-sh/setup-bun@v2",
|
|
1793
|
+
install: " - run: bun install --frozen-lockfile",
|
|
1794
|
+
runner: "bunx void"
|
|
1795
|
+
};
|
|
1796
|
+
default: return {
|
|
1797
|
+
setup: ` - uses: actions/setup-node@v6
|
|
1798
|
+
with:
|
|
1799
|
+
${nodeVersion}
|
|
1800
|
+
cache: npm`,
|
|
1801
|
+
install: " - run: npm ci",
|
|
1802
|
+
runner: "npx void"
|
|
1803
|
+
};
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
/**
|
|
1807
|
+
* Scaffold the GitHub Actions workflow that deploys via GitHub OIDC — no
|
|
1808
|
+
* long-lived secret stored in the repo. The job requests an OIDC token from
|
|
1809
|
+
* GitHub (audience `void`), exchanges it at `POST $VOID_API_URL/auth/github-oidc`
|
|
1810
|
+
* for a short-lived (15-min) project-scoped deploy token, then runs
|
|
1811
|
+
* `void deploy --project <slug>` with that token exported as `VOID_TOKEN`.
|
|
1812
|
+
*
|
|
1813
|
+
* `slug` is the linked project slug when known (from `.void/project.json`);
|
|
1814
|
+
* otherwise a `${{ vars.VOID_PROJECT }}` placeholder is emitted with a comment
|
|
1815
|
+
* telling the user to set the repository variable.
|
|
1816
|
+
*/
|
|
1817
|
+
function getWorkflowYaml(root, pm, slug) {
|
|
1818
|
+
const { setup, install, runner } = getWorkflowSetupSteps(root, pm);
|
|
1819
|
+
return `name: Deploy to Void
|
|
1813
1820
|
on:
|
|
1814
1821
|
push:
|
|
1815
1822
|
branches: [main]
|
|
1816
1823
|
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1824
|
+
# Latest push wins: cancel an in-flight deploy for the same repo+branch so a
|
|
1825
|
+
# newer commit is never overtaken by an older one. Keyed by repo + ref only —
|
|
1826
|
+
# workflow-level concurrency cannot read the \`env\` context, so VOID_PROJECT is
|
|
1827
|
+
# not used here (one repo+branch deploys to one project in this scaffold).
|
|
1828
|
+
concurrency:
|
|
1829
|
+
group: void-deploy-\${{ github.repository }}-\${{ github.ref }}
|
|
1830
|
+
cancel-in-progress: true
|
|
1831
|
+
|
|
1832
|
+
# id-token: write lets the job mint a GitHub OIDC token. No long-lived
|
|
1833
|
+
# VOID_TOKEN secret is stored — the token below is exchanged for a
|
|
1834
|
+
# short-lived, project-scoped deploy token at deploy time.
|
|
1835
|
+
permissions:
|
|
1836
|
+
id-token: write
|
|
1837
|
+
contents: read
|
|
1838
|
+
|
|
1839
|
+
env:
|
|
1840
|
+
# Override with a VOID_API_URL repository variable to target staging.
|
|
1841
|
+
VOID_API_URL: \${{ vars.VOID_API_URL || '${WORKFLOW_DEFAULT_API_URL}' }}
|
|
1842
|
+
${slug ? `VOID_PROJECT: ${slug}` : `# Set a VOID_PROJECT repository variable to your project slug
|
|
1843
|
+
# (Settings → Secrets and variables → Actions → Variables).
|
|
1844
|
+
VOID_PROJECT: \${{ vars.VOID_PROJECT }}`}
|
|
1832
1845
|
|
|
1833
1846
|
jobs:
|
|
1834
1847
|
deploy:
|
|
1835
1848
|
runs-on: ubuntu-latest
|
|
1836
1849
|
steps:
|
|
1837
1850
|
- uses: actions/checkout@v6
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
VOID_TOKEN
|
|
1851
|
+
${setup}
|
|
1852
|
+
${install}
|
|
1853
|
+
- name: Exchange GitHub OIDC token for a Void deploy token
|
|
1854
|
+
run: |
|
|
1855
|
+
OIDC_TOKEN="$(curl -sf \\
|
|
1856
|
+
-H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \\
|
|
1857
|
+
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=void" | jq -r '.value')"
|
|
1858
|
+
VOID_TOKEN="$(curl -sf \\
|
|
1859
|
+
-H 'Content-Type: application/json' \\
|
|
1860
|
+
-d "$(jq -n --arg t "$OIDC_TOKEN" --arg p "$VOID_PROJECT" '{oidcToken: $t, project: $p}')" \\
|
|
1861
|
+
"$VOID_API_URL/auth/github-oidc" | jq -r '.token')"
|
|
1862
|
+
echo "::add-mask::$VOID_TOKEN"
|
|
1863
|
+
echo "VOID_TOKEN=$VOID_TOKEN" >> "$GITHUB_ENV"
|
|
1864
|
+
- name: Deploy
|
|
1865
|
+
run: ${runner} deploy --project "$VOID_PROJECT"
|
|
1846
1866
|
`;
|
|
1847
|
-
}
|
|
1848
1867
|
}
|
|
1849
1868
|
function setupGithubActions(root, state) {
|
|
1850
|
-
const
|
|
1869
|
+
const workflowDir = join(root, ".github", "workflows");
|
|
1870
|
+
const workflowPath = join(workflowDir, "void-deploy.yml");
|
|
1851
1871
|
if (existsSync(workflowPath)) {
|
|
1852
|
-
R.warn("deploy.yml already exists, skipping");
|
|
1872
|
+
R.warn("void-deploy.yml already exists, skipping");
|
|
1853
1873
|
return;
|
|
1854
1874
|
}
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1875
|
+
const slug = readProjectConfig(root)?.slug ?? null;
|
|
1876
|
+
mkdirSync(workflowDir, { recursive: true });
|
|
1877
|
+
writeFileSync(workflowPath, getWorkflowYaml(root, state.packageManager, slug));
|
|
1878
|
+
R.success("Created .github/workflows/void-deploy.yml");
|
|
1879
|
+
if (slug) Se(`Pushes to main will build and deploy "${slug}" via GitHub OIDC — no token to store.\nConnect the repo to your project in the Void dashboard to authorize it.`, "GitHub Actions OIDC deploy");
|
|
1880
|
+
else Se("Pushes to main will build and deploy via GitHub OIDC — no token to store.\nSet a VOID_PROJECT repository variable (Settings → Secrets and variables → Actions → Variables)\nto your project slug, and connect the repo to your project in the Void dashboard.", "GitHub Actions OIDC deploy");
|
|
1881
|
+
}
|
|
1882
|
+
/**
|
|
1883
|
+
* Bake a resolved project slug into an already-written `void-deploy.yml`.
|
|
1884
|
+
*
|
|
1885
|
+
* Step 8 (GitHub Actions) runs BEFORE Step 9 (project link), so when a user
|
|
1886
|
+
* links a project during the same interactive init the workflow was written
|
|
1887
|
+
* with the `${{ vars.VOID_PROJECT }}` placeholder. Once the link resolves a
|
|
1888
|
+
* slug, rewrite the placeholder `env.VOID_PROJECT` block in place so the user
|
|
1889
|
+
* does not also have to set a repository variable. No-op (returns `false`)
|
|
1890
|
+
* when the workflow is missing or the placeholder is not present (e.g. the
|
|
1891
|
+
* slug was already known at scaffold time, or the user declined linking).
|
|
1892
|
+
*/
|
|
1893
|
+
function patchWorkflowProjectSlug(root, slug) {
|
|
1894
|
+
const workflowPath = join(root, ".github", "workflows", "void-deploy.yml");
|
|
1895
|
+
if (!existsSync(workflowPath)) return false;
|
|
1896
|
+
const yaml = readFileSync(workflowPath, "utf-8");
|
|
1897
|
+
const placeholderBlock = " # Set a VOID_PROJECT repository variable to your project slug\n # (Settings → Secrets and variables → Actions → Variables).\n VOID_PROJECT: ${{ vars.VOID_PROJECT }}";
|
|
1898
|
+
if (!yaml.includes(placeholderBlock)) return false;
|
|
1899
|
+
writeFileSync(workflowPath, yaml.replace(placeholderBlock, ` VOID_PROJECT: ${slug}`));
|
|
1900
|
+
R.success(`Set VOID_PROJECT: ${slug} in .github/workflows/void-deploy.yml`);
|
|
1901
|
+
return true;
|
|
1859
1902
|
}
|
|
1860
1903
|
function writeFileIfMissing(root, filePath, content) {
|
|
1861
1904
|
const fullPath = join(root, filePath);
|
|
@@ -2764,7 +2807,7 @@ async function runInitCommand(root, initArgs) {
|
|
|
2764
2807
|
const agentSetup = await resolveAgentSetup(root);
|
|
2765
2808
|
injectAgentBlock(root, agentSetup.instructionFilePath);
|
|
2766
2809
|
if (agentSetup.agents.length > 0) {
|
|
2767
|
-
const { linkSkillsForSpecificAgents } = await import("./skills
|
|
2810
|
+
const { linkSkillsForSpecificAgents } = await import("./skills--OMgLmXW.mjs");
|
|
2768
2811
|
linkSkillsForSpecificAgents(root, agentSetup.agents);
|
|
2769
2812
|
} else R.info("Skills linking skipped for generic agent setup");
|
|
2770
2813
|
setupMcpConfig(root, agentSetup.agents);
|
|
@@ -2789,10 +2832,9 @@ async function runInitCommand(root, initArgs) {
|
|
|
2789
2832
|
}
|
|
2790
2833
|
}
|
|
2791
2834
|
const githubStepSkipForSubpackage = isInsideWorkspaceSubpackage(root);
|
|
2792
|
-
if ((!targeted || initArgs?.github) && !githubStepSkipForSubpackage) if (
|
|
2793
|
-
else if (targeted) setupGithubActions(root, state);
|
|
2835
|
+
if ((!targeted || initArgs?.github) && !githubStepSkipForSubpackage) if (targeted) setupGithubActions(root, state);
|
|
2794
2836
|
else {
|
|
2795
|
-
const setupGha = await ue({ message: "Create .github/workflows/deploy.yml to deploy on pushes to main?" });
|
|
2837
|
+
const setupGha = await ue({ message: "Create .github/workflows/void-deploy.yml to deploy on pushes to main?" });
|
|
2796
2838
|
if (q(setupGha)) {
|
|
2797
2839
|
me("Setup cancelled.");
|
|
2798
2840
|
process.exit(0);
|
|
@@ -2810,7 +2852,10 @@ async function runInitCommand(root, initArgs) {
|
|
|
2810
2852
|
}
|
|
2811
2853
|
if (scaffoldAddedDependencies) installProjectDependencies(root, state.packageManager);
|
|
2812
2854
|
if (scaffoldedStarterMode && !workspaceSubpackageSkip) generateStarterMigration(root, scaffoldedStarterMode);
|
|
2813
|
-
if (!targeted)
|
|
2855
|
+
if (!targeted) {
|
|
2856
|
+
const linked = await maybeSetupDeployProject(root);
|
|
2857
|
+
if (linked?.slug) patchWorkflowProjectSlug(root, linked.slug);
|
|
2858
|
+
}
|
|
2814
2859
|
if (workspaceSubpackageSkip) if (scaffoldedStarterMode) ye("Run your workspace install, then `void db generate` to finish setup.");
|
|
2815
2860
|
else ye("Run your workspace install to finish setup.");
|
|
2816
2861
|
else ye(`Run \`${getDevCommand(root, framework)}\` to start developing`);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as cliTitle, s as import_picocolors } from "./output-DeiS4oEX.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { d as getToken, n as PlatformClient, u as getSiteDomain } from "./client-D4awzTnj.mjs";
|
|
3
3
|
import { _ as me, c as R, g as ge, y as ye } from "./dist-abzUneor.mjs";
|
|
4
4
|
import { a as writeProjectConfig, r as readProjectConfig } from "./project-CH9pdo16.mjs";
|
|
5
|
-
import { n as promptAndCreateProject, r as promptProjectSelection } from "./create-project-
|
|
5
|
+
import { n as promptAndCreateProject, r as promptProjectSelection } from "./create-project-CGodxfzH.mjs";
|
|
6
6
|
import { r as resolveProjectBySlug } from "./resolve-project-D4O1_fZz.mjs";
|
|
7
7
|
//#region src/cli/link.ts
|
|
8
8
|
async function runLink(root, slug) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as ensureUtc, i as dim, l as tablePrefix, n as cliTitle, s as import_picocolors } from "./output-DeiS4oEX.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { d as getToken, n as PlatformClient } from "./client-D4awzTnj.mjs";
|
|
3
3
|
import { c as R, g as ge, y as ye } from "./dist-abzUneor.mjs";
|
|
4
4
|
import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
|
|
5
5
|
import { r as resolveProjectBySlug } from "./resolve-project-D4O1_fZz.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as cliTitle, r as createSpinner, s as import_picocolors } from "./output-DeiS4oEX.mjs";
|
|
2
|
-
import { a as isExpiredTokenError,
|
|
2
|
+
import { _ as saveToken, a as isExpiredTokenError, d as getToken, f as getTokenSource, g as runLogin, h as removeToken, n as PlatformClient, p as isStagingMode } from "./client-D4awzTnj.mjs";
|
|
3
3
|
import { _ as me, c as R, g as ge, i as Ee, x as q, y as ye } from "./dist-abzUneor.mjs";
|
|
4
4
|
//#region src/cli/login.ts
|
|
5
5
|
async function promptForLoginToken(root = process.cwd()) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as dim, n as cliTitle, s as import_picocolors } from "./output-DeiS4oEX.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { d as getToken, n as PlatformClient } from "./client-D4awzTnj.mjs";
|
|
3
3
|
import { c as R, g as ge, y as ye } from "./dist-abzUneor.mjs";
|
|
4
4
|
import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
|
|
5
5
|
//#region src/cli/logs.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as join, n as dirname } from "./pathe.M-eThtNZ-BrPhGF_K.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { d as getToken, n as PlatformClient } from "./client-D4awzTnj.mjs";
|
|
3
3
|
import { a as writeProjectConfig } from "./project-CH9pdo16.mjs";
|
|
4
4
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|