void 0.8.2 → 0.8.4
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/cli/cli.mjs
CHANGED
|
@@ -1516,7 +1516,7 @@ else if (command === "deploy") {
|
|
|
1516
1516
|
R.error(err instanceof Error ? err.message : String(err));
|
|
1517
1517
|
process.exit(1);
|
|
1518
1518
|
}
|
|
1519
|
-
import("../deploy-
|
|
1519
|
+
import("../deploy-Ceecksgw.mjs").then((n) => n.t).then(({ runDeploy }) => {
|
|
1520
1520
|
runDeploy(root, {
|
|
1521
1521
|
projectSlug: deployArgs.projectSlug,
|
|
1522
1522
|
dir: deployArgs.dir,
|
|
@@ -1532,7 +1532,7 @@ else if (command === "deploy") {
|
|
|
1532
1532
|
else if (command === "project") runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (root, parsed) => import("../project-cmd-JQUzv3qF.mjs").then(({ runProjectCommand }) => runProjectCommand(root, parsed)));
|
|
1533
1533
|
else if (command === "secret") runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (root, parsed) => import("../secret-mz8t_CML.mjs").then(({ runSecretCommand }) => runSecretCommand(root, parsed)));
|
|
1534
1534
|
else if (command === "domain") runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (root, parsed) => import("../domain-UfLrp2vc.mjs").then(({ runDomainCommand }) => runDomainCommand(root, parsed)));
|
|
1535
|
-
else if (command === "db") runSubcommandGroup("db", dbSubcommands, parseDbArgs, (root, parsed) => import("../db-
|
|
1535
|
+
else if (command === "db") runSubcommandGroup("db", dbSubcommands, parseDbArgs, (root, parsed) => import("../db-BvKxda3n.mjs").then(({ runDbCommand }) => runDbCommand(root, parsed)));
|
|
1536
1536
|
else if (command === "env") runSubcommandGroup("env", envSubcommands, parseEnvArgs, (root, parsed) => import("../env-Cvdbbm_N.mjs").then(({ runEnvCommand }) => runEnvCommand(root, parsed)));
|
|
1537
1537
|
else if (command === "gen") runSubcommandGroup("gen", genSubcommands, parseGenArgs, (root, parsed) => import("../gen-Cn2hZ8RR.mjs").then(({ runGenCommand }) => runGenCommand(root, parsed)));
|
|
1538
1538
|
else if (command === "prepare") {
|
|
@@ -1646,7 +1646,7 @@ else if (command === "-v" || command === "--version") {
|
|
|
1646
1646
|
return;
|
|
1647
1647
|
}
|
|
1648
1648
|
case "deploy": {
|
|
1649
|
-
const { runDeploy } = await import("../deploy-
|
|
1649
|
+
const { runDeploy } = await import("../deploy-Ceecksgw.mjs").then((n) => n.t);
|
|
1650
1650
|
await runDeploy(root);
|
|
1651
1651
|
return;
|
|
1652
1652
|
}
|
|
@@ -1659,7 +1659,7 @@ else if (command === "-v" || command === "--version") {
|
|
|
1659
1659
|
case "project": return runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (r, p) => import("../project-cmd-JQUzv3qF.mjs").then(({ runProjectCommand }) => runProjectCommand(r, p)));
|
|
1660
1660
|
case "secret": return runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (r, p) => import("../secret-mz8t_CML.mjs").then(({ runSecretCommand }) => runSecretCommand(r, p)));
|
|
1661
1661
|
case "domain": return runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (r, p) => import("../domain-UfLrp2vc.mjs").then(({ runDomainCommand }) => runDomainCommand(r, p)));
|
|
1662
|
-
case "db": return runSubcommandGroup("db", dbSubcommands, parseDbArgs, (r, p) => import("../db-
|
|
1662
|
+
case "db": return runSubcommandGroup("db", dbSubcommands, parseDbArgs, (r, p) => import("../db-BvKxda3n.mjs").then(({ runDbCommand }) => runDbCommand(r, p)));
|
|
1663
1663
|
case "env": return runSubcommandGroup("env", envSubcommands, parseEnvArgs, (r, p) => import("../env-Cvdbbm_N.mjs").then(({ runEnvCommand }) => runEnvCommand(r, p)));
|
|
1664
1664
|
case "gen": return runSubcommandGroup("gen", genSubcommands, parseGenArgs, (r, p) => import("../gen-Cn2hZ8RR.mjs").then(({ runGenCommand }) => runGenCommand(r, p)));
|
|
1665
1665
|
case "prepare": {
|
|
@@ -315,6 +315,10 @@ async function runMigrate(root, dialect, remote) {
|
|
|
315
315
|
process.exit(1);
|
|
316
316
|
}
|
|
317
317
|
if (remote) {
|
|
318
|
+
if (dialect === "postgresql") {
|
|
319
|
+
R.error("db: `void db migrate --remote` is only supported for D1 projects. PostgreSQL remote migrations run during `void deploy` through the project Hyperdrive binding.");
|
|
320
|
+
process.exit(1);
|
|
321
|
+
}
|
|
318
322
|
const token = getToken(root);
|
|
319
323
|
if (!token) {
|
|
320
324
|
R.error("Not logged in. Run `void auth login` first.");
|
|
@@ -40,23 +40,31 @@ function isApiRoutePattern(pattern) {
|
|
|
40
40
|
function hasDocumentRoutes(routes) {
|
|
41
41
|
return routes.some((route) => !isApiRoutePattern(route.pattern));
|
|
42
42
|
}
|
|
43
|
+
function hasApiRoutes(routes) {
|
|
44
|
+
return routes.some((route) => isApiRoutePattern(route.pattern));
|
|
45
|
+
}
|
|
43
46
|
/**
|
|
44
47
|
* Returns true when browser document navigations must reach the worker before
|
|
45
48
|
* a static asset fallback can serve HTML.
|
|
46
49
|
*/
|
|
47
50
|
function workerOwnsHtmlRouting(inputs) {
|
|
48
|
-
return inputs.isSsr || inputs.hasPages || inputs.hasDocumentRoutes || inputs.hasMiddleware || inputs.hasWebSockets === true || inputs.
|
|
51
|
+
return inputs.isSsr || inputs.hasPages || inputs.hasDocumentRoutes || inputs.hasMiddleware || inputs.hasWebSockets === true || inputs.liveEnabled === true;
|
|
49
52
|
}
|
|
50
53
|
function resolveAssetConfig(inputs) {
|
|
51
54
|
return resolveAssetRoutingPolicy(inputs).assetConfig;
|
|
52
55
|
}
|
|
53
56
|
function resolveAssetRoutingPolicy(inputs) {
|
|
54
57
|
const workerFirst = workerOwnsHtmlRouting(inputs);
|
|
58
|
+
const apiWorkerFirst = !workerFirst && (inputs.hasApiRoutes === true || inputs.authEnabled === true);
|
|
55
59
|
return {
|
|
56
60
|
assetConfig: workerFirst ? {
|
|
57
61
|
not_found_handling: "none",
|
|
58
62
|
run_worker_first: ["/**"]
|
|
63
|
+
} : apiWorkerFirst ? {
|
|
64
|
+
not_found_handling: "single-page-application",
|
|
65
|
+
run_worker_first: ["/api", "/api/*"]
|
|
59
66
|
} : { not_found_handling: "single-page-application" },
|
|
67
|
+
apiWorkerFirst,
|
|
60
68
|
workerFirst,
|
|
61
69
|
workerSpaFallback: workerFirst && !inputs.isSsr && !inputs.hasPages
|
|
62
70
|
};
|
|
@@ -2442,6 +2450,9 @@ function applyDeployEvent(event, s) {
|
|
|
2442
2450
|
case "provisioning":
|
|
2443
2451
|
s.message(`Provisioning ${event.bindings.join(", ")}`);
|
|
2444
2452
|
return { kind: "continue" };
|
|
2453
|
+
case "worker_readiness":
|
|
2454
|
+
s.message("Waiting for worker to become reachable...");
|
|
2455
|
+
return { kind: "continue" };
|
|
2445
2456
|
case "migration_start":
|
|
2446
2457
|
s.message(`Running ${event.pending} migration${event.pending > 1 ? "s" : ""}...`);
|
|
2447
2458
|
return { kind: "continue" };
|
|
@@ -3051,6 +3062,7 @@ async function runFullDeploy(root, config, client, fwPreset, skipBuild, gitMetad
|
|
|
3051
3062
|
}));
|
|
3052
3063
|
const hasPages = existsSync(paths.pagesDir);
|
|
3053
3064
|
const hasRoutes = routeScan.routes.length > 0;
|
|
3065
|
+
const hasApiRoutes$1 = hasApiRoutes(routeScan.routes) || hasApiRoutes(webSockets) || authEnabled;
|
|
3054
3066
|
const hasDocumentRoutes$1 = hasDocumentRoutes(routeScan.routes);
|
|
3055
3067
|
const hasMiddleware = routeScan.middleware.length > 0;
|
|
3056
3068
|
const hasWebSockets = webSockets.length > 0;
|
|
@@ -3105,6 +3117,7 @@ async function runFullDeploy(root, config, client, fwPreset, skipBuild, gitMetad
|
|
|
3105
3117
|
const assetConfig = resolveAssetConfig({
|
|
3106
3118
|
isSsr,
|
|
3107
3119
|
hasPages,
|
|
3120
|
+
hasApiRoutes: hasApiRoutes$1,
|
|
3108
3121
|
hasDocumentRoutes: hasDocumentRoutes$1,
|
|
3109
3122
|
hasMiddleware,
|
|
3110
3123
|
hasWebSockets: hasDocumentRoutes(webSockets),
|
|
@@ -3442,4 +3455,4 @@ function resolveWorkerDirName(distDir, fwPreset, buildCommand) {
|
|
|
3442
3455
|
throw new Error("deploy: Worker output not found. Expected dist/ssr/ or dist/rsc/.");
|
|
3443
3456
|
}
|
|
3444
3457
|
//#endregion
|
|
3445
|
-
export { isSandboxEnabled as C, resolveAssetRoutingPolicy as E, SANDBOX_MIGRATION_TAG as S,
|
|
3458
|
+
export { isSandboxEnabled as C, resolveAssetRoutingPolicy as D, hasDocumentRoutes as E, SANDBOX_MIGRATION_TAG as S, hasApiRoutes 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 };
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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,
|
|
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-Ceecksgw.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-C-nH6yz3.mjs";
|
|
@@ -4252,6 +4252,7 @@ function routingPlugin(root, options) {
|
|
|
4252
4252
|
if (!scan) return resolveAssetRoutingPolicy({
|
|
4253
4253
|
isSsr: Boolean(ssr),
|
|
4254
4254
|
hasPages: false,
|
|
4255
|
+
hasApiRoutes: compileOptions.auth !== null,
|
|
4255
4256
|
hasDocumentRoutes: false,
|
|
4256
4257
|
hasMiddleware: false,
|
|
4257
4258
|
hasWebSockets: false,
|
|
@@ -4261,6 +4262,7 @@ function routingPlugin(root, options) {
|
|
|
4261
4262
|
return resolveAssetRoutingPolicy({
|
|
4262
4263
|
isSsr: Boolean(ssr),
|
|
4263
4264
|
hasPages: scan.pages.pages.length > 0,
|
|
4265
|
+
hasApiRoutes: hasApiRoutes(scan.routes) || hasApiRoutes(scan.websockets ?? []) || compileOptions.auth !== null,
|
|
4264
4266
|
hasDocumentRoutes: hasDocumentRoutes(scan.routes),
|
|
4265
4267
|
hasMiddleware: scan.middleware.length > 0,
|
|
4266
4268
|
hasWebSockets: hasDocumentRoutes(scan.websockets ?? []),
|
|
@@ -5116,7 +5118,7 @@ function voidPlugin(options) {
|
|
|
5116
5118
|
...env
|
|
5117
5119
|
};
|
|
5118
5120
|
const assets = workerConfig.assets;
|
|
5119
|
-
if (command === "serve" && assets?.run_worker_first) assets.run_worker_first = [...DEV_ASSET_ROUTING_EXCLUSIONS, "/**"];
|
|
5121
|
+
if (command === "serve" && assets?.run_worker_first?.includes("/**")) assets.run_worker_first = [...DEV_ASSET_ROUTING_EXCLUSIONS, "/**"];
|
|
5120
5122
|
const watchConfig = { server: { watch: { ignored } } };
|
|
5121
5123
|
if (!isNodeTarget(config.target) && config.output !== "static") {
|
|
5122
5124
|
const envNames = framework === "vinext-app" ? ["rsc", "ssr"] : ["ssr"];
|
|
@@ -5302,10 +5304,13 @@ function voidPlugin(options) {
|
|
|
5302
5304
|
const ssrEntry = validateSsrEntry(root, paths);
|
|
5303
5305
|
const hasPages = existsSync(paths.pagesDir);
|
|
5304
5306
|
const hasMiddleware = scanMiddlewareSync(root, paths).length > 0;
|
|
5305
|
-
const
|
|
5307
|
+
const routePatterns = scanRoutePatternsSync(root, paths);
|
|
5308
|
+
const hasDocumentRoutes$1 = hasDocumentRoutes(routePatterns);
|
|
5309
|
+
const hasApiRoutes$1 = hasApiRoutes(routePatterns) || hasApiRoutes(websocketRoutes) || authEnabled;
|
|
5306
5310
|
let assetRouting = resolveAssetRoutingPolicy({
|
|
5307
5311
|
isSsr: Boolean(ssrEntry),
|
|
5308
5312
|
hasPages,
|
|
5313
|
+
hasApiRoutes: hasApiRoutes$1,
|
|
5309
5314
|
hasDocumentRoutes: hasDocumentRoutes$1,
|
|
5310
5315
|
hasMiddleware,
|
|
5311
5316
|
hasWebSockets: hasDocumentRoutes(websocketRoutes),
|
|
@@ -5322,7 +5327,7 @@ function voidPlugin(options) {
|
|
|
5322
5327
|
}
|
|
5323
5328
|
function updateDevAssetRoutingPolicy(next) {
|
|
5324
5329
|
const previous = assetRouting;
|
|
5325
|
-
const requiresRestart = previous.workerFirst !== next.workerFirst || previous.assetConfig.not_found_handling !== next.assetConfig.not_found_handling;
|
|
5330
|
+
const requiresRestart = previous.workerFirst !== next.workerFirst || previous.apiWorkerFirst !== next.apiWorkerFirst || previous.assetConfig.not_found_handling !== next.assetConfig.not_found_handling || JSON.stringify(previous.assetConfig.run_worker_first) !== JSON.stringify(next.assetConfig.run_worker_first);
|
|
5326
5331
|
assetRouting = next;
|
|
5327
5332
|
if (requiresRestart) applyAssetRoutingPolicy(next);
|
|
5328
5333
|
return requiresRestart;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "void",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/voidzero-dev/void.git",
|
|
@@ -333,7 +333,7 @@
|
|
|
333
333
|
"valibot": ">=1.0.0-beta.7",
|
|
334
334
|
"vite": "^8.0.0",
|
|
335
335
|
"zod": "^3.25.0 || ^4.0.0",
|
|
336
|
-
"@void/md": "0.8.
|
|
336
|
+
"@void/md": "0.8.4"
|
|
337
337
|
},
|
|
338
338
|
"peerDependenciesMeta": {
|
|
339
339
|
"@void/md": {
|
|
@@ -73,13 +73,13 @@ Static assets can run in front of the worker, behind the worker, or without any
|
|
|
73
73
|
|
|
74
74
|
### Deploy shapes
|
|
75
75
|
|
|
76
|
-
| Shape
|
|
77
|
-
|
|
|
78
|
-
| `inference.appType: "static"`
|
|
79
|
-
| Static SPA deploy
|
|
80
|
-
| Void app with only `/api` routes
|
|
81
|
-
| Void app with `middleware/`,
|
|
82
|
-
| Pages, SSR, and framework apps
|
|
76
|
+
| Shape | Worker deployed | First handler for assets | First handler for document navigations | Miss behavior |
|
|
77
|
+
| ---------------------------------------------------------------------------------- | --------------- | ------------------------ | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
78
|
+
| `inference.appType: "static"` | No | Asset platform | Asset platform | Platform 404 page. |
|
|
79
|
+
| Static SPA deploy | No | Asset platform | Asset platform | Platform serves `/index.html` for unmatched navigations. If user `routing.fallbacks` exist, Void ships fallback rules. |
|
|
80
|
+
| Void app with only `/api` routes or managed auth | Yes | Worker first for `/api` | Asset platform | Static navigations keep the platform SPA fallback; API requests, including document navigations, reach the worker. |
|
|
81
|
+
| Void app with `middleware/`, non-`/api` routes, document WebSockets, live bindings | Yes | Worker first | Worker first | Asset misses stay 404, then the worker serves `/index.html` for HTML requests after routes and middleware run. |
|
|
82
|
+
| Pages, SSR, and framework apps | Yes | Worker first | Worker first | Asset misses stay 404. Pages, SSR, or framework rendering owns HTML responses, including intentional HTML 404s. |
|
|
83
83
|
|
|
84
84
|
### Worker-first Void apps
|
|
85
85
|
|
|
@@ -95,7 +95,7 @@ This is the path needed for preview auth and other middleware. Cloudflare's plat
|
|
|
95
95
|
|
|
96
96
|
### Asset-first Void apps
|
|
97
97
|
|
|
98
|
-
For Void apps with only `/api` routes, Void
|
|
98
|
+
For Void apps with only `/api` routes, Void keeps the platform SPA fallback and scopes `run_worker_first` to `/api` and `/api/*`. Static assets and non-API SPA navigations stay on the asset platform. API requests, including browser document navigations such as OAuth callbacks, reach the worker instead of being rewritten to `index.html`.
|
|
99
99
|
|
|
100
100
|
### Generated config
|
|
101
101
|
|