void 0.7.13 → 0.8.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/dist/{agents-DqkFfc2c.mjs → agents-Dkgafwfr.mjs} +1 -1
- package/dist/{auth-cmd-bS88H4Lb.mjs → auth-cmd-B1-7r6ng.mjs} +3 -3
- package/dist/{better-auth-shared-D2JaoCs4.mjs → better-auth-shared-CbAF6sOM.mjs} +1 -1
- package/dist/{better-auth-shared-HXlHRw02.d.mts → better-auth-shared-Fzyk5yS1.d.mts} +2 -7
- package/dist/{cache-DUDCNty6.mjs → cache-CGYC-2LW.mjs} +5 -5
- package/dist/{cancel-deploy-DOuSbPwX.mjs → cancel-deploy-B4j31z7d.mjs} +4 -4
- package/dist/canonical-json-CEyQaVDa.mjs +13 -0
- package/dist/cli/cli.mjs +44 -31
- package/dist/{client-C_DYiXeu.mjs → client-C-nH6yz3.mjs} +5 -5
- package/dist/{collect-HqAuilH6.mjs → collect-9rO3JFNM.mjs} +1 -1
- package/dist/{config-DyUSwbeX.mjs → config--wXmVOoe.mjs} +10 -8
- package/dist/{config-CeRQg3Lz.mjs → config-BVEC0lti.mjs} +11 -2
- package/dist/{config-CvHtTM0q.mjs → config-hhMYPVRT.mjs} +3 -12
- package/dist/{create-project-hvFe6rbI.mjs → create-project-BGnQMy5N.mjs} +44 -18
- package/dist/{db-YEYSTfGw.mjs → db-CT5Xg6ds.mjs} +42 -37
- package/dist/{delete-XyM_VD9o.mjs → delete-eMGTHHB9.mjs} +5 -5
- package/dist/{deploy-CPAEgVQm.mjs → deploy-DbmbcKID.mjs} +209 -127
- package/dist/{discover-CKGQpis8.mjs → discover-C8N1I4tK.mjs} +9 -6
- package/dist/{domain-Dvj7u8tr.mjs → domain-UfLrp2vc.mjs} +64 -22
- package/dist/{drizzle-Cx7cVwrE.mjs → drizzle-DmaANP4-.mjs} +1 -1
- package/dist/{env-Bjl0rzuf.mjs → env-Cvdbbm_N.mjs} +7 -7
- package/dist/{env-helpers-Dw95CU8e.d.mts → env-helpers-Bt9yYg5I.d.mts} +1 -1
- package/dist/{env-types-BSQghXbx.mjs → env-types-D6qI1ThV.mjs} +8 -19
- package/dist/{env-validation-Buy5pe3u.mjs → env-validation-DBJsxZLz.mjs} +4 -4
- package/dist/{gen-DU8NIdrH.mjs → gen-Cn2hZ8RR.mjs} +37 -31
- package/dist/{handler-DJTuxB10.d.mts → handler-BPhL8AmU.d.mts} +3 -3
- package/dist/{headers-CuVHn6Kl.mjs → headers-wAPJigtE.mjs} +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +273 -104
- package/dist/{init-Br5DTaG7.mjs → init-CbNCFFWx.mjs} +105 -35
- package/dist/{link-DdXqlUiJ.mjs → link-C5x1E-XZ.mjs} +5 -5
- package/dist/{list-9Bxa5Odn.mjs → list-ezL7hqDV.mjs} +5 -5
- package/dist/{login-C_MfDjhu.mjs → login-CkLr-AaI.mjs} +3 -3
- package/dist/{logs-DjqCpEER.mjs → logs-MnGILmLz.mjs} +4 -4
- package/dist/{mcp-vA0880_K.mjs → mcp-B84MmVAW.mjs} +3 -3
- package/dist/{node-gxRQXIRT.mjs → node-fpywdcbN.mjs} +6 -6
- package/dist/{output-D3g5otMC.mjs → output-DeiS4oEX.mjs} +1 -1
- 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 +28 -3
- package/dist/pages/index.mjs +6 -5
- package/dist/pages/islands-plugin.d.mts +1 -1
- package/dist/pages/islands-plugin.mjs +7 -5
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +1 -1
- package/dist/{pathe.M-eThtNZ-D-kmWkCS.mjs → pathe.M-eThtNZ-BrPhGF_K.mjs} +1 -1
- package/dist/plan-aD3wRDqF.mjs +271 -0
- package/dist/{plugin-inference-BexV6LL3.mjs → plugin-inference-Ba1uGdIy.mjs} +26 -20
- package/dist/{prepare-BEkH89oX.mjs → prepare-BrAISonG.mjs} +29 -19
- package/dist/{preset-CYQh93UF.mjs → preset-BRsCi8ZB.mjs} +10 -8
- package/dist/{project-DhB4A8_g.mjs → project-CH9pdo16.mjs} +1 -1
- package/dist/{project-cmd-CeXO06hG.mjs → project-cmd-JQUzv3qF.mjs} +10 -10
- package/dist/project-paths-CCMrHYQm.mjs +100 -0
- package/dist/{project-slug-KRvHQEQI.mjs → project-slug-De4UjtD9.mjs} +0 -1
- package/dist/{project-tsconfig-Bfy55qvs.mjs → project-tsconfig-HAGjfY6w.mjs} +10 -5
- package/dist/{protocol-D7r_deVZ.d.mts → protocol-mcSsdMij.d.mts} +3 -3
- package/dist/providers--_pvxpNN.d.mts +7 -0
- package/dist/{resolve-project-DdjLQ2tB.mjs → resolve-project-CNpUbUHd.mjs} +1 -1
- package/dist/{rollback-C8OSMxmq.mjs → rollback-CoAAvC18.mjs} +4 -4
- package/dist/{route-types-qVL-v-CB.mjs → route-types-jxRfWuCb.mjs} +1 -1
- package/dist/{runner-C0d3lJo1.mjs → runner-BkGBfr4e.mjs} +4 -2
- package/dist/{runner-pg-Bd_172vF.mjs → runner-pg-BXP0JpHW.mjs} +1 -1
- package/dist/runtime/ai.mjs +2 -2
- 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 +2 -2
- package/dist/runtime/better-auth.d.mts +1 -1
- package/dist/runtime/better-auth.mjs +2 -2
- 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.d.mts +33 -1
- package/dist/runtime/migration-handler.mjs +332 -24
- package/dist/runtime/remote/index.mjs +1 -1
- package/dist/runtime/sandbox.d.mts +73 -3
- package/dist/runtime/sandbox.mjs +239 -3
- 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-CKpylFj9.mjs → scan-2YmJkYAf.mjs} +4 -3
- package/dist/{scan-CkK1Hzpa.mjs → scan-DzzHqtiT.mjs} +82 -43
- package/dist/{secret-NDvlqAN2.mjs → secret-mz8t_CML.mjs} +5 -5
- package/dist/{skills-SAG0WyVn.mjs → skills-B_ynF4lA.mjs} +3 -3
- package/dist/{subcommand-prompt-q9T06dpg.mjs → subcommand-prompt-CPuV7tPW.mjs} +2 -2
- package/dist/sveltekit.mjs +1 -1
- package/dist/{validate-DW3ViKTA.mjs → validate-CNWm-PsL.mjs} +49 -9
- package/dist/{yarn-pnp-6LD6_3Ej.mjs → yarn-pnp-QgEYVC3V.mjs} +1 -1
- package/package.json +3 -2
- package/schema.json +5 -0
- package/skills/void/docs/guide/ai.md +1 -1
- package/skills/void/docs/guide/app-types.md +1 -1
- package/skills/void/docs/guide/database/postgresql.md +4 -3
- package/skills/void/docs/guide/edge/headers.md +1 -1
- package/skills/void/docs/guide/edge/static-assets.md +34 -0
- package/skills/void/docs/guide/sandboxes.md +3 -2
- package/skills/void/docs/guide/ssr.md +25 -2
- package/skills/void/docs/integrations/cloudflare.md +5 -3
- package/skills/void/docs/integrations/frameworks/overview.md +1 -1
- package/skills/void/docs/integrations/nodejs-bun-deno.md +10 -9
- package/skills/void/docs/reference/api.md +204 -13
- package/skills/void/docs/reference/cli.md +53 -7
- package/skills/void/docs/reference/config.md +27 -4
- package/skills/void/docs/reference/resource-inference.md +1 -1
- /package/dist/{auth-DmuALf16.d.mts → auth-SfRBhXan.d.mts} +0 -0
- /package/dist/{auth-migrations-BwLPwRgH.mjs → auth-migrations-BqJoGqGQ.mjs} +0 -0
- /package/dist/{cf-access-BW8K93Fm.mjs → cf-access-DKDsgwOU.mjs} +0 -0
- /package/dist/{defer-2ARBu8Et.mjs → defer-DkoEwda-.mjs} +0 -0
- /package/dist/{dist-q8b2Mjgb.mjs → dist-DR9sIMbM.mjs} +0 -0
- /package/dist/{dist-D2L3_KTK.mjs → dist-abzUneor.mjs} +0 -0
- /package/dist/{dotenv-HQNhRalS.mjs → dotenv-Bkoqyq9r.mjs} +0 -0
- /package/dist/{env-raw-DtfQ9E31.mjs → env-raw-zk5JQKZe.mjs} +0 -0
- /package/dist/{fetch-error-DZ868Xq4.d.mts → fetch-error-BbixZ9vW.d.mts} +0 -0
- /package/dist/{fetch-error-CEr0ACTl.mjs → fetch-error-rXermVU3.mjs} +0 -0
- /package/dist/{head-C7QW7UY1.d.mts → head-CZs8dMxG.d.mts} +0 -0
- /package/dist/{log-7ChR5Fbc.mjs → log-CWWZV4V1.mjs} +0 -0
- /package/dist/{magic-string.es-DS_lmuBe.mjs → magic-string.es-C1Fb0uxq.mjs} +0 -0
- /package/dist/{providers-BlFNPYen.mjs → providers-uC0PJg1c.mjs} +0 -0
- /package/dist/{standard-schema-D2qvCEYV.d.mts → standard-schema-WhHcCaqJ.d.mts} +0 -0
- /package/dist/{types-DG_Ynnyd.d.mts → types-C8wsi1hv.d.mts} +0 -0
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import { n as __exportAll } from "./chunk-DJd-R1mw.mjs";
|
|
2
|
-
import { a as join,
|
|
3
|
-
import { n as cliTitle, r as createSpinner, s as import_picocolors } from "./output-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { c as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { i as
|
|
12
|
-
import {
|
|
13
|
-
import { t as
|
|
14
|
-
import {
|
|
15
|
-
import { n as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { t as
|
|
23
|
-
import {
|
|
2
|
+
import { a as join, c as resolve, i as isAbsolute, n as dirname, r as extname, s as relative } from "./pathe.M-eThtNZ-BrPhGF_K.mjs";
|
|
3
|
+
import { n as cliTitle, r as createSpinner, s as import_picocolors } from "./output-DeiS4oEX.mjs";
|
|
4
|
+
import { i as resolveProjectPaths, n as readProjectPaths } from "./project-paths-CCMrHYQm.mjs";
|
|
5
|
+
import { t as findVoidAuthConfig } from "./config-hhMYPVRT.mjs";
|
|
6
|
+
import { a as isExpiredTokenError, c as getToken, i as isCliOutdatedError, l as getTokenSource, n as PlatformClient, o as parsePlatformErrorBody, t as PlatformApiError, u as isStagingMode } from "./client-C-nH6yz3.mjs";
|
|
7
|
+
import { c as R, g as ge, u as Se, v as ue, x as q, y as ye } from "./dist-abzUneor.mjs";
|
|
8
|
+
import { a as writeProjectConfig, r as readProjectConfig } from "./project-CH9pdo16.mjs";
|
|
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, o as scanJobsSync, r as scanRoutes } from "./scan-DzzHqtiT.mjs";
|
|
11
|
+
import { i as inferProjectBindings, l as validateSsrEntry, n as FRAMEWORK_SCAN_DIRS, r as detectFramework } from "./plugin-inference-Ba1uGdIy.mjs";
|
|
12
|
+
import { i as voidWarn, r as voidLog } from "./log-CWWZV4V1.mjs";
|
|
13
|
+
import { t as discoverSchema } from "./discover-C8N1I4tK.mjs";
|
|
14
|
+
import { t as findEnvFile } from "./env-types-D6qI1ThV.mjs";
|
|
15
|
+
import { i as validateProdEnv, n as formatEnvReport, r as getDeployEnvDefaults, t as fetchRemoteSecretNames } from "./env-validation-DBJsxZLz.mjs";
|
|
16
|
+
import { n as writeDrizzleConfig } from "./config--wXmVOoe.mjs";
|
|
17
|
+
import { t as collectMigrations } from "./collect-9rO3JFNM.mjs";
|
|
18
|
+
import { n as buildMigrationPlanBundle } from "./plan-aD3wRDqF.mjs";
|
|
19
|
+
import { r as validateMigrations, t as assertJournalCoherence } from "./validate-CNWm-PsL.mjs";
|
|
20
|
+
import { t as scanPages } from "./scan-2YmJkYAf.mjs";
|
|
21
|
+
import { i as promptProjectSetupAction, n as promptAndCreateProject, r as promptProjectSelection } from "./create-project-BGnQMy5N.mjs";
|
|
22
|
+
import { r as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-CNpUbUHd.mjs";
|
|
23
|
+
import { n as lintDuplicateSources, r as mergeRoutingRules, t as lintDestinationSplats } from "./headers-wAPJigtE.mjs";
|
|
24
|
+
import { t as promptForLoginToken } from "./login-CkLr-AaI.mjs";
|
|
25
|
+
import { i as resolveProjectCommand, n as detectPreset, r as formatProjectCommand, t as FRAMEWORK_PRESETS } from "./preset-BRsCi8ZB.mjs";
|
|
24
26
|
import { createRequire } from "node:module";
|
|
25
27
|
import { copyFileSync, cpSync, createWriteStream, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
|
26
28
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -31,6 +33,34 @@ import { execFile, execFileSync, execSync, spawnSync } from "node:child_process"
|
|
|
31
33
|
import { parse } from "jsonc-parser";
|
|
32
34
|
import { hash } from "blake3-jit";
|
|
33
35
|
import ignore from "ignore";
|
|
36
|
+
//#region src/asset-routing.ts
|
|
37
|
+
function isApiRoutePattern(pattern) {
|
|
38
|
+
return pattern === "/api" || pattern.startsWith("/api/");
|
|
39
|
+
}
|
|
40
|
+
function hasDocumentRoutes(routes) {
|
|
41
|
+
return routes.some((route) => !isApiRoutePattern(route.pattern));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Returns true when browser document navigations must reach the worker before
|
|
45
|
+
* a static asset fallback can serve HTML.
|
|
46
|
+
*/
|
|
47
|
+
function workerOwnsHtmlRouting(inputs) {
|
|
48
|
+
return inputs.isSsr || inputs.hasPages || inputs.hasDocumentRoutes || inputs.hasMiddleware || inputs.hasWebSockets === true || inputs.authEnabled === true || inputs.liveEnabled === true;
|
|
49
|
+
}
|
|
50
|
+
function resolveAssetConfig(inputs) {
|
|
51
|
+
return resolveAssetRoutingPolicy(inputs).assetConfig;
|
|
52
|
+
}
|
|
53
|
+
function resolveAssetRoutingPolicy(inputs) {
|
|
54
|
+
const workerFirst = workerOwnsHtmlRouting(inputs);
|
|
55
|
+
return {
|
|
56
|
+
assetConfig: workerFirst ? {
|
|
57
|
+
not_found_handling: "none",
|
|
58
|
+
run_worker_first: ["/**"]
|
|
59
|
+
} : { not_found_handling: "single-page-application" },
|
|
60
|
+
workerFirst,
|
|
61
|
+
workerSpaFallback: workerFirst && !inputs.isSsr && !inputs.hasPages
|
|
62
|
+
};
|
|
63
|
+
}
|
|
34
64
|
const SANDBOX_MIGRATION_TAG = "void-sandbox-v1";
|
|
35
65
|
const require = createRequire(import.meta.url);
|
|
36
66
|
function isSandboxEnabled(config) {
|
|
@@ -1706,10 +1736,19 @@ function buildVoidManifest(opts) {
|
|
|
1706
1736
|
});
|
|
1707
1737
|
}
|
|
1708
1738
|
if (bindings.needsLive) manifest.live = toLiveManifest(options?.live);
|
|
1709
|
-
if (migrations && migrations.length > 0)
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1739
|
+
if (migrations && migrations.length > 0) {
|
|
1740
|
+
const planBundle = dialect === "postgresql" ? void 0 : buildMigrationPlanBundle(migrations);
|
|
1741
|
+
manifest.migrations = {
|
|
1742
|
+
dialect: dialect ?? "sqlite",
|
|
1743
|
+
...planBundle ? {
|
|
1744
|
+
classifierVersion: planBundle.classifierVersion,
|
|
1745
|
+
migrationListHash: planBundle.migrationListHash,
|
|
1746
|
+
protocolVersion: planBundle.protocolVersion,
|
|
1747
|
+
stability: planBundle.plans.some((plan) => plan.stability === "legacy") ? "legacy" : "stable"
|
|
1748
|
+
} : {},
|
|
1749
|
+
pending: migrations.length
|
|
1750
|
+
};
|
|
1751
|
+
}
|
|
1713
1752
|
if (schedules && schedules.length > 0) manifest.schedules = schedules;
|
|
1714
1753
|
if (queues && queues.length > 0) manifest.queues = queues;
|
|
1715
1754
|
if (ssr) manifest.ssr = true;
|
|
@@ -1800,10 +1839,19 @@ function buildFrameworkManifest(opts) {
|
|
|
1800
1839
|
if (opts.bindings.needsR2) manifest.bindings.r2 = [po?.bindingNames?.r2 ?? "STORAGE"];
|
|
1801
1840
|
if (opts.bindings.needsAI) manifest.bindings.ai = true;
|
|
1802
1841
|
if (opts.bindings.needsLive) throw new Error(FRAMEWORK_LIVE_UNSUPPORTED_MESSAGE);
|
|
1803
|
-
if (opts.migrations && opts.migrations.length > 0)
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1842
|
+
if (opts.migrations && opts.migrations.length > 0) {
|
|
1843
|
+
const planBundle = opts.dialect === "postgresql" ? void 0 : buildMigrationPlanBundle(opts.migrations);
|
|
1844
|
+
manifest.migrations = {
|
|
1845
|
+
dialect: opts.dialect ?? "sqlite",
|
|
1846
|
+
...planBundle ? {
|
|
1847
|
+
classifierVersion: planBundle.classifierVersion,
|
|
1848
|
+
migrationListHash: planBundle.migrationListHash,
|
|
1849
|
+
protocolVersion: planBundle.protocolVersion,
|
|
1850
|
+
stability: planBundle.plans.some((plan) => plan.stability === "legacy") ? "legacy" : "stable"
|
|
1851
|
+
} : {},
|
|
1852
|
+
pending: opts.migrations.length
|
|
1853
|
+
};
|
|
1854
|
+
}
|
|
1807
1855
|
if (opts.schedules && opts.schedules.length > 0) manifest.schedules = opts.schedules;
|
|
1808
1856
|
if (opts.queues && opts.queues.length > 0) manifest.queues = opts.queues;
|
|
1809
1857
|
if (opts.revalidate != null && opts.revalidate !== 0) manifest.revalidate = opts.revalidate;
|
|
@@ -1920,9 +1968,13 @@ async function generateWrapper(workerDir, workerMain, root, features) {
|
|
|
1920
1968
|
copyFileSync(join(outDir, handlerFilename), join(workerDir, handlerFilename));
|
|
1921
1969
|
}
|
|
1922
1970
|
let migrations;
|
|
1971
|
+
let migrationPlanBundle;
|
|
1923
1972
|
if (features.hasMigrations) {
|
|
1924
|
-
const { collectMigrations } = await import("./collect-
|
|
1925
|
-
|
|
1973
|
+
const { collectMigrations } = await import("./collect-9rO3JFNM.mjs").then((n) => n.n);
|
|
1974
|
+
const { buildMigrationPlanBundle } = await import("./plan-aD3wRDqF.mjs").then((n) => n.i);
|
|
1975
|
+
const migrationsDir = readProjectPaths(root).migrationsDir;
|
|
1976
|
+
migrations = collectMigrations(migrationsDir);
|
|
1977
|
+
migrationPlanBundle = features.migrationDialect === "sqlite" ? buildMigrationPlanBundle(migrations) : void 0;
|
|
1926
1978
|
const handlerFilename_ = features.migrationDialect === "postgresql" ? "migration-handler-pg.mjs" : "migration-handler.mjs";
|
|
1927
1979
|
let handlerPath = join(import.meta.dirname, "runtime", handlerFilename_);
|
|
1928
1980
|
if (!existsSync(handlerPath)) handlerPath = join(import.meta.dirname, "..", "runtime", handlerFilename_);
|
|
@@ -1930,7 +1982,7 @@ async function generateWrapper(workerDir, workerMain, root, features) {
|
|
|
1930
1982
|
if (!existsSync(handlerPath)) throw new Error(`Migration handler not found: ${handlerFilename_}. Run "pnpm -C packages/void build" first.`);
|
|
1931
1983
|
copyFileSync(handlerPath, join(workerDir, "__void_migration_handler.mjs"));
|
|
1932
1984
|
}
|
|
1933
|
-
const wrapperSource = generateWrapperSource(renamedName, handlerFilename, features, migrations);
|
|
1985
|
+
const wrapperSource = generateWrapperSource(renamedName, handlerFilename, features, migrations, migrationPlanBundle);
|
|
1934
1986
|
writeFileSync(join(workerDir, workerMain), wrapperSource);
|
|
1935
1987
|
}
|
|
1936
1988
|
/**
|
|
@@ -1996,7 +2048,7 @@ function cleanupWrapper(root) {
|
|
|
1996
2048
|
writeFileSync(tokenPath, preservedToken);
|
|
1997
2049
|
}
|
|
1998
2050
|
}
|
|
1999
|
-
function generateWrapperSource(renamedEntry, handlersModule, features, migrations) {
|
|
2051
|
+
function generateWrapperSource(renamedEntry, handlersModule, features, migrations, migrationPlanBundle) {
|
|
2000
2052
|
const lines = [];
|
|
2001
2053
|
lines.push(`import original from "./${renamedEntry}";`);
|
|
2002
2054
|
if (features.crons.length > 0) lines.push(`import { handleScheduled } from "./${handlersModule}";`);
|
|
@@ -2004,6 +2056,7 @@ function generateWrapperSource(renamedEntry, handlersModule, features, migration
|
|
|
2004
2056
|
if (migrations && migrations.length > 0) {
|
|
2005
2057
|
lines.push(`import { createMigrationHandler } from "./__void_migration_handler.mjs";`);
|
|
2006
2058
|
lines.push(`const __migrations = ${JSON.stringify(migrations)};`);
|
|
2059
|
+
lines.push(`const __migrationPlanBundle = ${JSON.stringify(migrationPlanBundle)};`);
|
|
2007
2060
|
lines.push(`const __migrationDialect = ${JSON.stringify(features.migrationDialect ?? "sqlite")};`);
|
|
2008
2061
|
}
|
|
2009
2062
|
lines.push("");
|
|
@@ -2019,6 +2072,18 @@ function generateWrapperSource(renamedEntry, handlersModule, features, migration
|
|
|
2019
2072
|
lines.push(" const handler = createMigrationHandler(env, __migrations, __migrationDialect);");
|
|
2020
2073
|
lines.push(" return handler(request);");
|
|
2021
2074
|
lines.push(" }");
|
|
2075
|
+
lines.push(" if (request.method === \"GET\" && url.pathname === \"/__void/migrate/capabilities\") {");
|
|
2076
|
+
lines.push(" const handler = createMigrationHandler(env, __migrations, __migrationDialect, undefined, __migrationPlanBundle);");
|
|
2077
|
+
lines.push(" return handler(request);");
|
|
2078
|
+
lines.push(" }");
|
|
2079
|
+
lines.push(" if (request.method === \"POST\" && url.pathname === \"/__void/migrate/app\") {");
|
|
2080
|
+
lines.push(" const handler = createMigrationHandler(env, __migrations, __migrationDialect, undefined, __migrationPlanBundle);");
|
|
2081
|
+
lines.push(" return handler(request);");
|
|
2082
|
+
lines.push(" }");
|
|
2083
|
+
lines.push(" if (request.method === \"GET\" && url.pathname.startsWith(\"/__void/migrate/app/attempt/\")) {");
|
|
2084
|
+
lines.push(" const handler = createMigrationHandler(env, __migrations, __migrationDialect, undefined, __migrationPlanBundle);");
|
|
2085
|
+
lines.push(" return handler(request);");
|
|
2086
|
+
lines.push(" }");
|
|
2022
2087
|
}
|
|
2023
2088
|
if (features.crons.length > 0) {
|
|
2024
2089
|
lines.push(" if (request.method === \"POST\" && url.pathname === \"/__void/scheduled\") {");
|
|
@@ -2059,9 +2124,10 @@ function generateWrapperSource(renamedEntry, handlersModule, features, migration
|
|
|
2059
2124
|
}
|
|
2060
2125
|
function generateHandlersSource(root, features) {
|
|
2061
2126
|
const lines = [];
|
|
2127
|
+
const paths = readProjectPaths(root);
|
|
2062
2128
|
if (features.crons.length > 0) {
|
|
2063
2129
|
for (let i = 0; i < features.crons.length; i++) {
|
|
2064
|
-
const absPath = join(
|
|
2130
|
+
const absPath = join(paths.cronsDir, features.crons[i].filePath);
|
|
2065
2131
|
lines.push(`import cronHandler${i} from "${absPath}";`);
|
|
2066
2132
|
}
|
|
2067
2133
|
lines.push("");
|
|
@@ -2082,7 +2148,7 @@ function generateHandlersSource(root, features) {
|
|
|
2082
2148
|
if (features.queues.length > 0) {
|
|
2083
2149
|
lines.push("");
|
|
2084
2150
|
for (let i = 0; i < features.queues.length; i++) {
|
|
2085
|
-
const absPath = join(
|
|
2151
|
+
const absPath = join(paths.queuesDir, features.queues[i].filePath);
|
|
2086
2152
|
lines.push(`import queueHandler${i} from "${absPath}";`);
|
|
2087
2153
|
}
|
|
2088
2154
|
lines.push("");
|
|
@@ -2118,11 +2184,11 @@ var deploy_exports = /* @__PURE__ */ __exportAll({
|
|
|
2118
2184
|
ensurePreviouslyDeployedLiveBindingConfig: () => ensurePreviouslyDeployedLiveBindingConfig,
|
|
2119
2185
|
hasDeploySchemaDrift: () => hasDeploySchemaDrift,
|
|
2120
2186
|
promptDeployProjectConfig: () => promptDeployProjectConfig,
|
|
2121
|
-
resolveAssetConfig: () => resolveAssetConfig,
|
|
2122
2187
|
resolveDeployLiveBindingConfig: () => resolveDeployLiveBindingConfig,
|
|
2123
2188
|
resolveDeployWranglerCompat: () => resolveDeployWranglerCompat,
|
|
2124
2189
|
resolveDistDir: () => resolveDistDir,
|
|
2125
2190
|
resolveStaticBuildCommand: () => resolveStaticBuildCommand,
|
|
2191
|
+
resolveStaticDeployPreset: () => resolveStaticDeployPreset,
|
|
2126
2192
|
resolveWorkerDirName: () => resolveWorkerDirName,
|
|
2127
2193
|
runDeploy: () => runDeploy,
|
|
2128
2194
|
runStaticDeploy: () => runStaticDeploy,
|
|
@@ -2180,24 +2246,6 @@ async function resolveDeployLiveBindingConfig(root, client, projectId, opts) {
|
|
|
2180
2246
|
reservedClasses: [...opts.webSockets.map((route) => route.className), opts.sandboxClassName]
|
|
2181
2247
|
});
|
|
2182
2248
|
}
|
|
2183
|
-
/**
|
|
2184
|
-
* Resolve the Cloudflare Workers Static Assets `not_found_handling` config.
|
|
2185
|
-
*
|
|
2186
|
-
* Any worker capable of producing HTML (SSR, pages, file-based routes, or
|
|
2187
|
-
* middleware) must use `'none'` so the asset binding returns 404 for
|
|
2188
|
-
* unmatched paths and the worker — gated by `run_worker_first` — owns the
|
|
2189
|
-
* response. With `'single-page-application'`, CF short-circuits any
|
|
2190
|
-
* `Sec-Fetch-Mode: navigate` request straight to the SPA shell *before*
|
|
2191
|
-
* `run_worker_first` is consulted, silently bypassing auth middleware and
|
|
2192
|
-
* breaking OAuth callbacks (which arrive as navigations from the provider's
|
|
2193
|
-
* 302 redirect).
|
|
2194
|
-
*
|
|
2195
|
-
* Pure-frontend SPAs without any backend code keep the SPA-fallback config
|
|
2196
|
-
* because the worker has no responsibility for HTML routing.
|
|
2197
|
-
*/
|
|
2198
|
-
function resolveAssetConfig(opts) {
|
|
2199
|
-
return opts.isSsr || opts.hasPages || opts.hasRoutes || opts.hasMiddleware || opts.hasWebSockets === true || opts.authEnabled === true ? { not_found_handling: "none" } : { not_found_handling: "single-page-application" };
|
|
2200
|
-
}
|
|
2201
2249
|
function getExitCode(error) {
|
|
2202
2250
|
if (typeof error === "object" && error !== null && "status" in error && typeof error.status === "number") return error.status;
|
|
2203
2251
|
return 1;
|
|
@@ -2285,8 +2333,12 @@ async function runDeployInner(root, options, cliLog) {
|
|
|
2285
2333
|
appType: voidConfig.inference?.appType,
|
|
2286
2334
|
output: voidConfig.output
|
|
2287
2335
|
});
|
|
2336
|
+
let preset = resolveStaticDeployPreset(root, voidConfig, {
|
|
2337
|
+
dir: options?.dir,
|
|
2338
|
+
spa: options?.spa
|
|
2339
|
+
});
|
|
2288
2340
|
const detected = detectFramework(root);
|
|
2289
|
-
if (detected) {
|
|
2341
|
+
if (!preset && detected) {
|
|
2290
2342
|
cliLog.info("framework_detected", {
|
|
2291
2343
|
name: detected.name,
|
|
2292
2344
|
class: detected.class
|
|
@@ -2302,27 +2354,7 @@ async function runDeployInner(root, options, cliLog) {
|
|
|
2302
2354
|
} else await runFullDeploy(root, config, client, fwPreset, options?.skipBuild, gitMetadata, detected, cliLog);
|
|
2303
2355
|
return;
|
|
2304
2356
|
}
|
|
2305
|
-
|
|
2306
|
-
const appType = voidConfig.inference?.appType;
|
|
2307
|
-
if (appType && appType !== "void" && appType !== "framework") {
|
|
2308
|
-
const outputDir = voidConfig.inference?.outputDir;
|
|
2309
|
-
preset = {
|
|
2310
|
-
buildCommand: null,
|
|
2311
|
-
outputDir: outputDir ? resolve(root, outputDir) : join(root, "dist"),
|
|
2312
|
-
appType
|
|
2313
|
-
};
|
|
2314
|
-
const detectedPreset = detectPreset(root, {
|
|
2315
|
-
dir: options?.dir,
|
|
2316
|
-
spa: options?.spa
|
|
2317
|
-
});
|
|
2318
|
-
if (detectedPreset) {
|
|
2319
|
-
preset.buildCommand = detectedPreset.buildCommand;
|
|
2320
|
-
if (!outputDir) preset.outputDir = detectedPreset.outputDir;
|
|
2321
|
-
}
|
|
2322
|
-
} else if (!appType) preset = detectPreset(root, {
|
|
2323
|
-
dir: options?.dir,
|
|
2324
|
-
spa: options?.spa
|
|
2325
|
-
});
|
|
2357
|
+
if (!preset && !voidConfig.inference?.appType) preset = detectPreset(root, { spa: options?.spa });
|
|
2326
2358
|
const gitMetadata = collectGitDeployMetadata(root, options?.skipBuild ? null : getGitCommit(root));
|
|
2327
2359
|
if (preset) {
|
|
2328
2360
|
preset = {
|
|
@@ -2366,6 +2398,28 @@ function resolveStaticBuildCommand(preset, buildOverride, hasExplicitDir = false
|
|
|
2366
2398
|
if (hasExplicitDir) return null;
|
|
2367
2399
|
return buildOverride ?? preset.buildCommand;
|
|
2368
2400
|
}
|
|
2401
|
+
function resolveStaticDeployPreset(root, voidConfig, options) {
|
|
2402
|
+
if (options?.dir) return detectPreset(root, {
|
|
2403
|
+
dir: options.dir,
|
|
2404
|
+
spa: options.spa
|
|
2405
|
+
});
|
|
2406
|
+
const appType = voidConfig.inference?.appType;
|
|
2407
|
+
if (appType === "static" || appType === "spa") {
|
|
2408
|
+
const outputDir = voidConfig.inference?.outputDir;
|
|
2409
|
+
const preset = {
|
|
2410
|
+
buildCommand: null,
|
|
2411
|
+
outputDir: outputDir ? resolve(root, outputDir) : join(root, "dist"),
|
|
2412
|
+
appType
|
|
2413
|
+
};
|
|
2414
|
+
const detectedPreset = detectPreset(root, { spa: options?.spa });
|
|
2415
|
+
if (detectedPreset) {
|
|
2416
|
+
preset.buildCommand = detectedPreset.buildCommand;
|
|
2417
|
+
if (!outputDir) preset.outputDir = detectedPreset.outputDir;
|
|
2418
|
+
}
|
|
2419
|
+
return preset;
|
|
2420
|
+
}
|
|
2421
|
+
return null;
|
|
2422
|
+
}
|
|
2369
2423
|
/**
|
|
2370
2424
|
* Apply the visible side effects of a streamed deploy event (spinner
|
|
2371
2425
|
* message or log warning). Returns a discriminated result so the caller
|
|
@@ -2695,8 +2749,14 @@ async function runFrameworkDeploy(root, config, client, detected, fwPreset, void
|
|
|
2695
2749
|
R.error(`deploy: Worker output '${fwPreset.workerDir}' not found. Run '${buildCmd}' first.`);
|
|
2696
2750
|
process.exit(1);
|
|
2697
2751
|
}
|
|
2698
|
-
const
|
|
2699
|
-
|
|
2752
|
+
const inferenceOptions = voidConfig.inference?.bindings ? { bindings: voidConfig.inference.bindings } : void 0;
|
|
2753
|
+
const paths = resolveProjectPaths(root, voidConfig);
|
|
2754
|
+
const scanDirs = voidConfig.inference?.scanDirs ?? FRAMEWORK_SCAN_DIRS;
|
|
2755
|
+
const bindings = inferProjectBindings(root, {
|
|
2756
|
+
...inferenceOptions,
|
|
2757
|
+
paths
|
|
2758
|
+
}, scanDirs);
|
|
2759
|
+
if (bindings.needsAuth || findVoidAuthConfig(root, paths) !== null || voidConfig.auth !== void 0) {
|
|
2700
2760
|
R.error("deploy: Void-managed Better Auth is only supported in Void apps. Use Better Auth's official integration for this framework instead.");
|
|
2701
2761
|
process.exit(1);
|
|
2702
2762
|
}
|
|
@@ -2704,7 +2764,7 @@ async function runFrameworkDeploy(root, config, client, detected, fwPreset, void
|
|
|
2704
2764
|
R.error("deploy: void/live is currently supported in Void apps only.");
|
|
2705
2765
|
process.exit(1);
|
|
2706
2766
|
}
|
|
2707
|
-
const migrationsDir =
|
|
2767
|
+
const migrationsDir = paths.migrationsDir;
|
|
2708
2768
|
assertDeploySchemaDriftFree(root, dialect);
|
|
2709
2769
|
const rawMigrations = collectMigrations(migrationsDir);
|
|
2710
2770
|
let validatedMigrations;
|
|
@@ -2721,26 +2781,32 @@ async function runFrameworkDeploy(root, config, client, detected, fwPreset, void
|
|
|
2721
2781
|
R.error(getErrorMessage(err));
|
|
2722
2782
|
process.exit(1);
|
|
2723
2783
|
}
|
|
2724
|
-
if (dialect === "postgresql" && (bindings.needsD1 || rawMigrations.length > 0))
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2784
|
+
if (dialect === "postgresql" && (bindings.needsD1 || rawMigrations.length > 0)) {
|
|
2785
|
+
let resources = null;
|
|
2786
|
+
try {
|
|
2787
|
+
resources = await client.getResources(config.projectId);
|
|
2788
|
+
} catch {}
|
|
2789
|
+
if (resources) {
|
|
2790
|
+
if (!resources.some((resource) => resource.type === "hyperdrive")) {
|
|
2791
|
+
const { text: promptText, isCancel: isCancelPrompt } = await import("./dist-abzUneor.mjs").then((n) => n.p);
|
|
2792
|
+
const connectionString = await promptText({
|
|
2793
|
+
message: "Your project uses PostgreSQL. Enter your connection string:",
|
|
2794
|
+
placeholder: "postgresql://user:pass@host:5432/dbname",
|
|
2795
|
+
validate(value) {
|
|
2796
|
+
if (!value?.startsWith("postgres://") && !value?.startsWith("postgresql://")) return "Must start with \"postgres://\" or \"postgresql://\"";
|
|
2797
|
+
}
|
|
2798
|
+
});
|
|
2799
|
+
if (isCancelPrompt(connectionString)) {
|
|
2800
|
+
R.info("Deploy cancelled.");
|
|
2801
|
+
process.exit(0);
|
|
2732
2802
|
}
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
R.info("Deploy cancelled.");
|
|
2736
|
-
process.exit(0);
|
|
2803
|
+
await client.provisionDatabase(config.projectId, connectionString);
|
|
2804
|
+
R.success("Hyperdrive provisioned.");
|
|
2737
2805
|
}
|
|
2738
|
-
await client.provisionDatabase(config.projectId, connectionString);
|
|
2739
|
-
R.success("Hyperdrive provisioned.");
|
|
2740
2806
|
}
|
|
2741
|
-
}
|
|
2742
|
-
const rawJobs = scanJobsSync(root);
|
|
2743
|
-
const rawQueues = scanQueuesSync(root);
|
|
2807
|
+
}
|
|
2808
|
+
const rawJobs = scanJobsSync(root, paths.cronsDir);
|
|
2809
|
+
const rawQueues = scanQueuesSync(root, paths.queuesDir);
|
|
2744
2810
|
const originalEntry = join(workerDir, fwPreset.workerMain);
|
|
2745
2811
|
const wrapperFeatures = {
|
|
2746
2812
|
auth: null,
|
|
@@ -2881,10 +2947,12 @@ async function runFullDeploy(root, config, client, fwPreset, skipBuild, gitMetad
|
|
|
2881
2947
|
}
|
|
2882
2948
|
const isFrameworkMode = detected != null;
|
|
2883
2949
|
const deployConfig = readConfig(root);
|
|
2950
|
+
const paths = resolveProjectPaths(root, deployConfig);
|
|
2884
2951
|
const dialect = getDatabaseDialect(deployConfig);
|
|
2885
|
-
const
|
|
2952
|
+
const deployScanDirs = deployConfig.inference?.scanDirs ?? (isFrameworkMode ? FRAMEWORK_SCAN_DIRS : void 0);
|
|
2953
|
+
const bindings = inferProjectBindings(root, { paths }, deployScanDirs);
|
|
2886
2954
|
if (isSandboxEnabled(deployConfig)) bindings.needsSandbox = true;
|
|
2887
|
-
const authEnabled = bindings.needsAuth || findVoidAuthConfig(root) !== null || deployConfig.auth !== void 0;
|
|
2955
|
+
const authEnabled = bindings.needsAuth || findVoidAuthConfig(root, paths) !== null || deployConfig.auth !== void 0;
|
|
2888
2956
|
const effectiveBindings = authEnabled ? {
|
|
2889
2957
|
...bindings,
|
|
2890
2958
|
needsAuth: true,
|
|
@@ -2917,7 +2985,7 @@ async function runFullDeploy(root, config, client, fwPreset, skipBuild, gitMetad
|
|
|
2917
2985
|
lintDuplicateSources(fallbackRules, "fallbacks (post-asset)");
|
|
2918
2986
|
lintDestinationSplats(redirectRules, "redirects/rewrites (pre-asset)");
|
|
2919
2987
|
lintDestinationSplats(fallbackRules, "fallbacks (post-asset)");
|
|
2920
|
-
const migrationsDir =
|
|
2988
|
+
const migrationsDir = paths.migrationsDir;
|
|
2921
2989
|
assertDeploySchemaDriftFree(root, dialect);
|
|
2922
2990
|
const rawMigrations = collectMigrations(migrationsDir);
|
|
2923
2991
|
let validatedMigrations;
|
|
@@ -2934,31 +3002,40 @@ async function runFullDeploy(root, config, client, fwPreset, skipBuild, gitMetad
|
|
|
2934
3002
|
R.error(getErrorMessage(err));
|
|
2935
3003
|
process.exit(1);
|
|
2936
3004
|
}
|
|
2937
|
-
if (dialect === "postgresql" && (effectiveBindings.needsD1 || rawMigrations.length > 0))
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
3005
|
+
if (dialect === "postgresql" && (effectiveBindings.needsD1 || rawMigrations.length > 0)) {
|
|
3006
|
+
let resources = null;
|
|
3007
|
+
try {
|
|
3008
|
+
resources = await client.getResources(config.projectId);
|
|
3009
|
+
} catch {}
|
|
3010
|
+
if (resources) {
|
|
3011
|
+
if (!resources.some((resource) => resource.type === "hyperdrive")) {
|
|
3012
|
+
const { text: promptText, isCancel: isCancelPrompt } = await import("./dist-abzUneor.mjs").then((n) => n.p);
|
|
3013
|
+
const connectionString = await promptText({
|
|
3014
|
+
message: "Your project uses PostgreSQL. Enter your connection string:",
|
|
3015
|
+
placeholder: "postgresql://user:pass@host:5432/dbname",
|
|
3016
|
+
validate(value) {
|
|
3017
|
+
if (!value?.startsWith("postgres://") && !value?.startsWith("postgresql://")) return "Must start with \"postgres://\" or \"postgresql://\"";
|
|
3018
|
+
}
|
|
3019
|
+
});
|
|
3020
|
+
if (isCancelPrompt(connectionString)) {
|
|
3021
|
+
R.info("Deploy cancelled.");
|
|
3022
|
+
process.exit(0);
|
|
2945
3023
|
}
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
R.info("Deploy cancelled.");
|
|
2949
|
-
process.exit(0);
|
|
3024
|
+
await client.provisionDatabase(config.projectId, connectionString);
|
|
3025
|
+
R.success("Hyperdrive provisioned.");
|
|
2950
3026
|
}
|
|
2951
|
-
await client.provisionDatabase(config.projectId, connectionString);
|
|
2952
|
-
R.success("Hyperdrive provisioned.");
|
|
2953
3027
|
}
|
|
2954
|
-
}
|
|
3028
|
+
}
|
|
2955
3029
|
const workerDirName = resolveWorkerDirName(distDir, fwPreset, frameworkBuildCmd);
|
|
2956
|
-
const schedules = scanJobsSync(root).flatMap((job) => job.crons.map((cron) => ({
|
|
3030
|
+
const schedules = scanJobsSync(root, paths.cronsDir).flatMap((job) => job.crons.map((cron) => ({
|
|
2957
3031
|
name: job.name,
|
|
2958
3032
|
cron
|
|
2959
3033
|
})));
|
|
2960
|
-
const routeScan = await scanRoutes(root, {
|
|
2961
|
-
|
|
3034
|
+
const routeScan = await scanRoutes(root, {
|
|
3035
|
+
output: deployConfig.output,
|
|
3036
|
+
paths
|
|
3037
|
+
});
|
|
3038
|
+
const webSockets = routeScan.websockets ?? scanWebSocketRoutesSync(root, paths);
|
|
2962
3039
|
const liveConfig = await resolveDeployLiveBindingConfig(root, client, config.projectId, {
|
|
2963
3040
|
isFrameworkMode,
|
|
2964
3041
|
needsLive: effectiveBindings.needsLive,
|
|
@@ -2966,21 +3043,25 @@ async function runFullDeploy(root, config, client, fwPreset, skipBuild, gitMetad
|
|
|
2966
3043
|
sandboxClassName: sandboxConfig?.className,
|
|
2967
3044
|
cliLog
|
|
2968
3045
|
});
|
|
2969
|
-
const queues = scanQueuesSync(root).map((q) => ({
|
|
3046
|
+
const queues = scanQueuesSync(root, paths.queuesDir).map((q) => ({
|
|
2970
3047
|
name: q.name,
|
|
2971
3048
|
bindingName: q.bindingName,
|
|
2972
3049
|
...q.maxBatchSize != null && { maxBatchSize: q.maxBatchSize },
|
|
2973
3050
|
...q.maxBatchTimeout != null && { maxBatchTimeout: q.maxBatchTimeout }
|
|
2974
3051
|
}));
|
|
2975
|
-
const hasPages = existsSync(
|
|
3052
|
+
const hasPages = existsSync(paths.pagesDir);
|
|
2976
3053
|
const hasRoutes = routeScan.routes.length > 0;
|
|
3054
|
+
const hasDocumentRoutes$1 = hasDocumentRoutes(routeScan.routes);
|
|
2977
3055
|
const hasMiddleware = routeScan.middleware.length > 0;
|
|
2978
3056
|
const hasWebSockets = webSockets.length > 0;
|
|
2979
|
-
const isSsr = isFrameworkMode ? true : Boolean(validateSsrEntry(root)) || hasPages && deployConfig.output !== "static";
|
|
3057
|
+
const isSsr = isFrameworkMode ? true : Boolean(validateSsrEntry(root, paths)) || hasPages && deployConfig.output !== "static";
|
|
2980
3058
|
const vcRevalidate = readConfig(root).routing?.revalidate;
|
|
2981
3059
|
let revalidate;
|
|
2982
3060
|
if (vcRevalidate != null) revalidate = vcRevalidate;
|
|
2983
|
-
const pageScan = existsSync(
|
|
3061
|
+
const pageScan = existsSync(paths.pagesDir) ? routeScan.pages.pages.length > 0 ? routeScan.pages : await scanPages(root, {
|
|
3062
|
+
output: deployConfig.output,
|
|
3063
|
+
paths
|
|
3064
|
+
}) : null;
|
|
2984
3065
|
if (pageScan) {
|
|
2985
3066
|
const perPageRules = {};
|
|
2986
3067
|
for (const page of pageScan.pages) if (page.revalidate != null) perPageRules[page.pattern] = page.revalidate;
|
|
@@ -3024,10 +3105,11 @@ async function runFullDeploy(root, config, client, fwPreset, skipBuild, gitMetad
|
|
|
3024
3105
|
const assetConfig = resolveAssetConfig({
|
|
3025
3106
|
isSsr,
|
|
3026
3107
|
hasPages,
|
|
3027
|
-
|
|
3108
|
+
hasDocumentRoutes: hasDocumentRoutes$1,
|
|
3028
3109
|
hasMiddleware,
|
|
3029
3110
|
hasWebSockets,
|
|
3030
|
-
authEnabled
|
|
3111
|
+
authEnabled,
|
|
3112
|
+
liveEnabled: liveConfig !== void 0
|
|
3031
3113
|
});
|
|
3032
3114
|
s.start("Checking for changes...");
|
|
3033
3115
|
cliLog?.info("preflight_start", { dir: clientDir });
|
|
@@ -3151,12 +3233,12 @@ function assertDeploySchemaDriftFree(root, dialect) {
|
|
|
3151
3233
|
process.exit(1);
|
|
3152
3234
|
}
|
|
3153
3235
|
function hasDeploySchemaDrift(root, dialect) {
|
|
3154
|
-
if (!discoverSchema(root)) return false;
|
|
3236
|
+
if (!discoverSchema(root, readProjectPaths(root))) return false;
|
|
3155
3237
|
const driftRoot = mkDeployDriftCheckRoot(root);
|
|
3156
3238
|
const driftProjectRoot = join(driftRoot, "project");
|
|
3157
3239
|
createDeployDriftProject(root, driftProjectRoot);
|
|
3158
3240
|
try {
|
|
3159
|
-
const migrationsDir =
|
|
3241
|
+
const migrationsDir = readProjectPaths(driftProjectRoot).migrationsDir;
|
|
3160
3242
|
const before = snapshotDir(migrationsDir);
|
|
3161
3243
|
const output = runDrizzleKitGenerate(driftProjectRoot, writeDrizzleConfig(driftProjectRoot, dialect === "postgresql" ? "postgresql://dummy" : ":memory:", dialect));
|
|
3162
3244
|
const snapshotsEqual = migrationSnapshotsEqual(before, snapshotDir(migrationsDir));
|
|
@@ -3360,4 +3442,4 @@ function resolveWorkerDirName(distDir, fwPreset, buildCommand) {
|
|
|
3360
3442
|
throw new Error("deploy: Worker output not found. Expected dist/ssr/ or dist/rsc/.");
|
|
3361
3443
|
}
|
|
3362
3444
|
//#endregion
|
|
3363
|
-
export { isSandboxEnabled as C, SANDBOX_MIGRATION_TAG as S, normalizeWranglerCompatibilityFlags as _, prerenderPagesNode as a, resolveLiveBindingConfig as b, filterLoadedEnv as c, LIVE_MIGRATION_TAG as d, ensureWranglerCompat as f, nextDurableObjectMigrationTag as g, hasDurableObjectSqliteMigration as h, prerenderPages as i, resolveRemoteMode as l, ensureWranglerNodejsAlsFlag as m, resolveDistDir as n, DEFAULT_PROXY_URL as o, ensureWranglerCompatibilityDate as p, resolveWorkerDirName as r, STAGING_PROXY_URL as s, deploy_exports as t, stripInternalEnvKeys as u, readExistingLiveBindingConfig as v, resolveSandboxConfig as w, syncWranglerBindings as x, readWranglerCompat as y };
|
|
3445
|
+
export { isSandboxEnabled as C, resolveAssetRoutingPolicy as E, SANDBOX_MIGRATION_TAG as S, hasDocumentRoutes as T, normalizeWranglerCompatibilityFlags as _, prerenderPagesNode as a, resolveLiveBindingConfig as b, filterLoadedEnv as c, LIVE_MIGRATION_TAG as d, ensureWranglerCompat as f, nextDurableObjectMigrationTag as g, hasDurableObjectSqliteMigration as h, prerenderPages as i, resolveRemoteMode as l, ensureWranglerNodejsAlsFlag as m, resolveDistDir as n, DEFAULT_PROXY_URL as o, ensureWranglerCompatibilityDate as p, resolveWorkerDirName as r, STAGING_PROXY_URL as s, deploy_exports as t, stripInternalEnvKeys as u, readExistingLiveBindingConfig as v, resolveSandboxConfig as w, syncWranglerBindings as x, readWranglerCompat as y };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { n as __exportAll } from "./chunk-DJd-R1mw.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { s as relative } from "./pathe.M-eThtNZ-BrPhGF_K.mjs";
|
|
3
|
+
import { n as readProjectPaths } from "./project-paths-CCMrHYQm.mjs";
|
|
3
4
|
import { existsSync, statSync } from "node:fs";
|
|
4
5
|
//#region src/drizzle/discover.ts
|
|
5
6
|
var discover_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -15,13 +16,13 @@ var discover_exports = /* @__PURE__ */ __exportAll({
|
|
|
15
16
|
*
|
|
16
17
|
* Returns null if no schema is found.
|
|
17
18
|
*/
|
|
18
|
-
function discoverSchema(root) {
|
|
19
|
-
const filePath =
|
|
19
|
+
function discoverSchema(root, paths = readProjectPaths(root)) {
|
|
20
|
+
const filePath = paths.schemaFile;
|
|
20
21
|
if (existsSync(filePath) && statSync(filePath).isFile()) return {
|
|
21
22
|
type: "file",
|
|
22
23
|
path: filePath
|
|
23
24
|
};
|
|
24
|
-
const dirPath =
|
|
25
|
+
const dirPath = paths.schemaDir;
|
|
25
26
|
if (existsSync(dirPath) && statSync(dirPath).isDirectory()) return {
|
|
26
27
|
type: "directory",
|
|
27
28
|
path: dirPath
|
|
@@ -33,8 +34,10 @@ function discoverSchema(root) {
|
|
|
33
34
|
* - File: `"./db/schema.ts"`
|
|
34
35
|
* - Directory: `"./db/schema/*.ts"`
|
|
35
36
|
*/
|
|
36
|
-
function schemaSpecifier(location) {
|
|
37
|
-
return location.type === "file" ? "./db/schema.ts" : "./db/schema/*.ts";
|
|
37
|
+
function schemaSpecifier(location, root) {
|
|
38
|
+
if (!root) return location.type === "file" ? "./db/schema.ts" : "./db/schema/*.ts";
|
|
39
|
+
const rel = relative(root, location.path).replace(/\\/g, "/");
|
|
40
|
+
return location.type === "file" ? `./${rel}` : `./${rel}/*.ts`;
|
|
38
41
|
}
|
|
39
42
|
//#endregion
|
|
40
43
|
export { discover_exports as n, schemaSpecifier as r, discoverSchema as t };
|