void 1.6.1 → 1.6.2
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/{account-cmd-DRhmCWcm.mjs → account-cmd-D903EEWQ.mjs} +2 -2
- package/dist/{application-analysis-HRFsZOv3.mjs → application-analysis-DlUG-XNT.mjs} +5 -17
- package/dist/{application-routing-P4TggvWp.mjs → application-routing-GCBSwXA9.mjs} +1 -1
- package/dist/{auth-link-CVXP1G6G.mjs → auth-link-g9J7MSmP.mjs} +2 -2
- package/dist/{auth-router-D1pGdbvB.mjs → auth-router-DMZbG9Qn.mjs} +2 -2
- package/dist/cli/cli.mjs +23 -23
- package/dist/cli/env-schema-probe.mjs +3 -3
- package/dist/{cloudflare-auth-CEu-1Ps_.mjs → cloudflare-auth-CuS42-9A.mjs} +1 -1
- package/dist/{cloudflare-cmd-fZ6AMSWk.mjs → cloudflare-cmd-DTF19-j-.mjs} +3 -3
- package/dist/{cloudflare-config-eQunqX6A.mjs → cloudflare-config-Ce8j5S7V.mjs} +2 -2
- package/dist/{cloudflare-connect-9OZe4XVQ.mjs → cloudflare-connect-BN4dHp8i.mjs} +2 -2
- package/dist/{cloudflare-operations-CrskD4_O.mjs → cloudflare-operations-DrZGzQap.mjs} +5 -5
- package/dist/{cloudflare-operations-oLvAd9Nd.mjs → cloudflare-operations-laxRA8HN.mjs} +1 -1
- package/dist/{cloudflare-process-DjJ638A-.mjs → cloudflare-process-D9aC-jXr.mjs} +2 -2
- package/dist/{config-BBlVXZCU.mjs → config-CNDjO-15.mjs} +3 -3
- package/dist/{config-BgysUhnm.mjs → config-DMR0i3Z2.mjs} +1 -1
- package/dist/{config-BITKQ3O6.mjs → config-hL-S-Y9D.mjs} +5 -5
- package/dist/{config-WlvEcL82.mjs → config-s6TkpSat.mjs} +2 -2
- package/dist/{connect-CKvmkl2R.mjs → connect-DHepM7Xs.mjs} +3 -3
- package/dist/{db-DjtGAcOz.mjs → db-CqfT6lhV.mjs} +18 -18
- package/dist/{db-types-C_8amnB0.mjs → db-types-DRmxBJ2K.mjs} +1 -1
- package/dist/deploy-DMhOyebt.mjs +2 -0
- package/dist/{deploy-D_gEojD2.mjs → deploy-La_Ly8g_.mjs} +38 -35
- package/dist/{deploy-managed-static-BHVbB_-A.mjs → deploy-managed-static-CESLfKHN.mjs} +13 -13
- package/dist/{deploy-transport-DEyOUfac.mjs → deploy-transport-DcI6LXhY.mjs} +2 -2
- package/dist/deploy.mjs +6 -6
- package/dist/discover-1DJD4YXD.mjs +1 -0
- package/dist/{discover-Dhkzxgdt.mjs → discover-CVFCWU7W.mjs} +1 -1
- package/dist/{dispatch-BNLB5_Gm.mjs → dispatch-DM4Xdd2l.mjs} +5 -5
- package/dist/{domain-BlH90Ods.mjs → domain-BD1KOQL3.mjs} +1 -1
- package/dist/{email-Bkq8ZL1p.mjs → email-XAspopcj.mjs} +6 -6
- package/dist/{email-cloudflare-MvJIxrwx.mjs → email-cloudflare-RxIQoPc9.mjs} +3 -3
- package/dist/{entry-CBZsCy3O.mjs → entry-DFBca6aS.mjs} +1 -1
- package/dist/{env-AvuCSeCH.mjs → env-DrYUh55t.mjs} +3 -3
- package/dist/{env-types-DqzVBKnS.mjs → env-types-Bd8DkQhl.mjs} +1 -1
- package/dist/{env-validation-C8Cmvas0.mjs → env-validation-Bosj7EVg.mjs} +1 -1
- package/dist/{env-validation-GV1oD4EV.mjs → env-validation-Del3C8AY.mjs} +2 -2
- package/dist/gen-BbT1Ku1P.mjs +1 -0
- package/dist/{gen-B9bCV5qu.mjs → gen-DSkScMIz.mjs} +4 -4
- package/dist/{handler-CKeTtYID.mjs → handler-DnI_au0K.mjs} +1 -1
- package/dist/{headers-CuTEdP9C.mjs → headers--cbz6iZ8.mjs} +1 -1
- package/dist/index.mjs +21 -21
- package/dist/{info-CJxua_db.mjs → info-BpxpsX0B.mjs} +4 -4
- package/dist/{init-B-4CluYx.mjs → init-DpVXO5S-.mjs} +12 -12
- package/dist/{list-BYSOo9fm.mjs → list-BFQ0gcML.mjs} +1 -1
- package/dist/{local-d1-BLgsNUj9.mjs → local-d1-CLVPP6v7.mjs} +1 -1
- package/dist/login-BX2gzHUt.mjs +1 -0
- package/dist/{login-CJopTWX4.mjs → login-RIw7ffPe.mjs} +1 -1
- package/dist/{logs-DE0weBsR.mjs → logs-B2OeLS4X.mjs} +1 -1
- package/dist/migrate-CUGMGaIM.mjs +1 -0
- package/dist/{migrate-ChHHZBTi.mjs → migrate-DiI50Chz.mjs} +4 -4
- package/dist/nitro.mjs +3 -3
- package/dist/{node-CZ6lGNLn.mjs → node-Bc-dBAGL.mjs} +2 -2
- package/dist/{operator-cmd-BUqsdk2K.mjs → operator-cmd-CEI5Aaza.mjs} +2 -2
- package/dist/operator-cmd-oTT2MA9G.mjs +1 -0
- package/dist/pages/client.d.mts +2 -0
- package/dist/pages/client.mjs +6 -3
- package/dist/pages/index.mjs +9 -5
- package/dist/pages/islands-plugin.mjs +1 -1
- package/dist/{platform-auth-config-K4m_LE8b.mjs → platform-auth-config-ZrYm8KVs.mjs} +3 -3
- package/dist/{platform-auth-protection-KF5Vo-1I.mjs → platform-auth-protection-t6mdY4nn.mjs} +2 -2
- package/dist/{platform-auth-recovery-BOdFrl7R.mjs → platform-auth-recovery-XeBmPTXx.mjs} +2 -2
- package/dist/{platform-cmd-DpCHawGF.mjs → platform-cmd-C7BevP9b.mjs} +1 -1
- package/dist/{platform-cmd-Ds3EAV5t.mjs → platform-cmd-EXehmSYA.mjs} +3 -3
- package/dist/{platform-domain-rWJshybd.mjs → platform-domain-DR263ObA.mjs} +2 -2
- package/dist/{platform-lifecycle-D9RdGub1.mjs → platform-lifecycle-BvU_TNji.mjs} +9 -9
- package/dist/{platform-lifecycle-BH34I0rh.mjs → platform-lifecycle-CN4aXldN.mjs} +1 -1
- package/dist/{platform-management-BRefdHGD.mjs → platform-management-_UE1_GM8.mjs} +1 -1
- package/dist/{platform-management-BfLW0Zlo.mjs → platform-management-yS2sve3V.mjs} +1 -1
- package/dist/{platform-recovery-DZuZGJtt.mjs → platform-recovery-CPVk9-Q4.mjs} +2 -2
- package/dist/{plugin-inference-CdLbxZL_.mjs → plugin-inference-bQ1Be840.mjs} +4 -7
- package/dist/{prepare-BuNbuFlA.mjs → prepare-BkRhDnxw.mjs} +1 -1
- package/dist/prepare-CZRVGNld.mjs +1 -0
- package/dist/{prepare-BerOZiD4.mjs → prepare-D8L9AQbw.mjs} +8 -8
- package/dist/{project-cmd-B_bUyZ3J.mjs → project-cmd-DH3CuFC6.mjs} +4 -4
- package/dist/{project-paths-CdGv9Tmi.mjs → project-paths-G0yut6Zz.mjs} +12 -8
- package/dist/{project-tsconfig-Cf2NFjlM.mjs → project-tsconfig-BMveFb4b.mjs} +1 -1
- package/dist/{provision-BbCzpbXs.mjs → provision-B0HqoRuI.mjs} +2 -2
- package/dist/{provision-DQF6Kw-6.mjs → provision-CYhZR_Mn.mjs} +1 -1
- package/dist/{rollback-BgL0wY1J.mjs → rollback-AVwiMAkk.mjs} +1 -1
- package/dist/{route-types-CZc1YXjF.mjs → route-types-e69EqY88.mjs} +1 -1
- package/dist/runtime/handler.mjs +1 -1
- package/dist/runtime/routing.mjs +2 -2
- package/dist/{scan-X2rDDRNa.mjs → scan-F0psanp7.mjs} +60 -14
- package/dist/{secret-CPq-B_vp.mjs → secret-szNdoeKa.mjs} +2 -2
- package/dist/{version-metadata-C8hLzQkv.mjs → version-metadata-BC3LK7Y-.mjs} +1 -1
- package/dist/wrangler-CQ5c-MtJ.mjs +1 -0
- package/dist/{wrangler-DESSbN8L.mjs → wrangler-Gn4EoY4-.mjs} +3 -3
- package/dist/{wrapper-C9SUxoj7.mjs → wrapper-B9W9RE8z.mjs} +3 -3
- package/docs/guide/edge/headers.md +3 -1
- package/docs/guide/edge/redirects.md +1 -0
- package/docs/guide/edge/static-assets.md +1 -1
- package/docs/guide/pages-routing/actions-and-forms.md +14 -0
- package/docs/guide/server-routing.md +14 -0
- package/docs/reference/api/pages.md +8 -0
- package/docs/reference/api/rewrites.md +3 -1
- package/package.json +7 -7
- package/dist/deploy-B029oHlE.mjs +0 -2
- package/dist/discover-D4mQthao.mjs +0 -1
- package/dist/gen-cCxrFp9L.mjs +0 -1
- package/dist/login-BpbYeu-n.mjs +0 -1
- package/dist/migrate-HdA6Kh2p.mjs +0 -1
- package/dist/operator-cmd-wBYyp8iQ.mjs +0 -1
- package/dist/prepare-Cz18kLkF.mjs +0 -1
- package/dist/wrangler-DUB3MGHV.mjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as join, l as toSlash, n as dirname, r as extname, t as basename } from "./dist-DMYe8CZJ.mjs";
|
|
2
|
-
import { n as readProjectPaths } from "./project-paths-
|
|
2
|
+
import { n as readProjectPaths } from "./project-paths-G0yut6Zz.mjs";
|
|
3
3
|
import { t as glob } from "./dist-BWNkVq50.mjs";
|
|
4
4
|
import { n as isIdentifier, o as moduleExportName, r as isLiteral } from "./ast-Cv0JwXqb.mjs";
|
|
5
5
|
import { a as staticLiteral, i as staticExportInitializers, t as bindingNames } from "./ast-bindings-BkivMJIo.mjs";
|
|
@@ -86,6 +86,51 @@ function parseWebSocketFilename(relativePath) {
|
|
|
86
86
|
function isRouteEnabledForEnvironment(route, environment) {
|
|
87
87
|
return environment === void 0 || route.env === null || route.env === environment;
|
|
88
88
|
}
|
|
89
|
+
// src/router/route-order.ts
|
|
90
|
+
/**
|
|
91
|
+
* Classify one segment of a route pattern. `*` and `:name{.+}` match the rest of the path,
|
|
92
|
+
* `:name` matches one segment, and anything else matches as written. Pages match with the
|
|
93
|
+
* same rules on the client (see `patternToRegex`), so ranking and matching agree.
|
|
94
|
+
*/
|
|
95
|
+
function routeSegmentKind(segment) {
|
|
96
|
+
if (segment === "*") return "rest";
|
|
97
|
+
if (segment.length < 2 || segment[0] !== ":") return "static";
|
|
98
|
+
const name = segment.endsWith("{.+}") ? segment.slice(1, -4) : "";
|
|
99
|
+
return name && !name.includes("{") && !name.includes("}") ? "rest" : "param";
|
|
100
|
+
}
|
|
101
|
+
const SEGMENT_RANK = {
|
|
102
|
+
static: 0,
|
|
103
|
+
param: 1,
|
|
104
|
+
rest: 2
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Order routes so that, of any two that match the same URL, the more specific one comes first.
|
|
108
|
+
* Hono and the Pages client matcher both use the first match.
|
|
109
|
+
*
|
|
110
|
+
* Catch-all routes come last and fully static routes first. Otherwise the first segment that
|
|
111
|
+
* differs decides: static before `:param` before catch-all. Parameter names never decide, so
|
|
112
|
+
* `/:lang/about` ranks ahead of `/:category/:item`. Two different static segments can't match
|
|
113
|
+
* the same URL, so their text only keeps the order stable.
|
|
114
|
+
*/
|
|
115
|
+
function compareRouteSpecificity(a, b) {
|
|
116
|
+
if (a.catchAll !== b.catchAll) return a.catchAll ? 1 : -1;
|
|
117
|
+
const aSegments = a.pattern.split("/");
|
|
118
|
+
const bSegments = b.pattern.split("/");
|
|
119
|
+
const aKinds = aSegments.map(routeSegmentKind);
|
|
120
|
+
const bKinds = bSegments.map(routeSegmentKind);
|
|
121
|
+
const aStatic = aKinds.every((kind) => kind === "static");
|
|
122
|
+
if (aStatic !== bKinds.every((kind) => kind === "static")) return aStatic ? -1 : 1;
|
|
123
|
+
const shared = Math.min(aSegments.length, bSegments.length);
|
|
124
|
+
for (let i = 0; i < shared; i++) {
|
|
125
|
+
const rank = SEGMENT_RANK[aKinds[i]] - SEGMENT_RANK[bKinds[i]];
|
|
126
|
+
if (rank !== 0) return rank;
|
|
127
|
+
if (aKinds[i] === "static" && aSegments[i] !== bSegments[i]) return compareText$1(aSegments[i], bSegments[i]);
|
|
128
|
+
}
|
|
129
|
+
return aSegments.length - bSegments.length || compareText$1(a.pattern, b.pattern);
|
|
130
|
+
}
|
|
131
|
+
function compareText$1(left, right) {
|
|
132
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
133
|
+
}
|
|
89
134
|
// src/shared/source-analysis-cache.ts
|
|
90
135
|
/**
|
|
91
136
|
* How long after a file changes its stat is trusted to identify its contents.
|
|
@@ -340,7 +385,12 @@ for (const [pattern, id, load, chain] of __voidDynamicRoutes) {
|
|
|
340
385
|
}`);
|
|
341
386
|
for (const layout of [...scan.layouts, ...scan.namedLayouts]) lines.push(`components[${JSON.stringify(layoutKey(toLayoutId(layout)))}] = ${load(layout.filePath)};`);
|
|
342
387
|
lines.push("const routeMeta = {");
|
|
343
|
-
for (const page of scan.pages)
|
|
388
|
+
for (const page of scan.pages) {
|
|
389
|
+
const flags = [];
|
|
390
|
+
if (page.island) flags.push("island: true");
|
|
391
|
+
if (page.prerender === false) flags.push("prerender: false");
|
|
392
|
+
if (flags.length > 0) lines.push(` ${JSON.stringify(page.componentId)}: { ${flags.join(", ")} },`);
|
|
393
|
+
}
|
|
344
394
|
lines.push("};");
|
|
345
395
|
lines.push(`function matchRoute(path) {
|
|
346
396
|
const id = __voidStaticRouteIds.get(path);
|
|
@@ -355,14 +405,15 @@ for (const [pattern, id, load, chain] of __voidDynamicRoutes) {
|
|
|
355
405
|
const REGEX_SYNTAX = ".*+?^${}()|[]\\";
|
|
356
406
|
/** The capture group for `*`, `:name{.+}` and `:name`; other segments match as written. */
|
|
357
407
|
function captureGroup(segment) {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
408
|
+
switch (routeSegmentKind(segment)) {
|
|
409
|
+
case "rest": return segment === "*" ? "(.*)" : "(.+)";
|
|
410
|
+
case "param": return "([^\\/]+)";
|
|
411
|
+
case "static": return;
|
|
412
|
+
}
|
|
362
413
|
}
|
|
363
414
|
/** Whether `patternToRegex` matches only the pattern's own text. */
|
|
364
415
|
function isStaticPattern(pattern) {
|
|
365
|
-
return pattern.split("/").every((segment) =>
|
|
416
|
+
return pattern.split("/").every((segment) => routeSegmentKind(segment) === "static");
|
|
366
417
|
}
|
|
367
418
|
/** The RegExp literal a page pattern matches with, the same on the client and the server. */
|
|
368
419
|
function patternToRegex(pattern) {
|
|
@@ -601,12 +652,7 @@ async function scanPages(root, options) {
|
|
|
601
652
|
...route.env ? { env: route.env } : {}
|
|
602
653
|
});
|
|
603
654
|
}
|
|
604
|
-
pages.sort(
|
|
605
|
-
if (a.catchAll !== b.catchAll) return a.catchAll ? 1 : -1;
|
|
606
|
-
const aDynamic = a.pattern.includes(":");
|
|
607
|
-
if (aDynamic !== b.pattern.includes(":")) return aDynamic ? 1 : -1;
|
|
608
|
-
return a.pattern.localeCompare(b.pattern);
|
|
609
|
-
});
|
|
655
|
+
pages.sort(compareRouteSpecificity);
|
|
610
656
|
if (options?.checkRoutes !== false) {
|
|
611
657
|
const environments = options?.environment ? [options.environment] : ["dev", "prod"];
|
|
612
658
|
for (const environment of environments) {
|
|
@@ -717,4 +763,4 @@ function extractFrontmatterLayout(source, matter) {
|
|
|
717
763
|
if (value === false || value === "false") return false;
|
|
718
764
|
return typeof value === "string" ? value : JSON.stringify(value);
|
|
719
765
|
}
|
|
720
|
-
export { resolveLayoutChain as a, editIslandSource as c, deriveFromSource as d, invalidateSourceAnalysis as f,
|
|
766
|
+
export { ROUTE_EXTENSIONS as _, resolveLayoutChain as a, editIslandSource as c, deriveFromSource as d, invalidateSourceAnalysis as f, parseWebSocketFilename as g, parseRouteFilename as h, resolveEffectiveLayoutChain as i, findIslandImports as l, isRouteEnabledForEnvironment as m, scanPages as n, resolveLayoutIds as o, compareRouteSpecificity as p, generateComponentManifest as r, resolveNamedLayout as s, pageFileEnvironment as t, findStaticCssImports as u };
|
|
@@ -4,7 +4,7 @@ import { A as confirm, H as outro, L as log, O as cancel, U as password, tt as i
|
|
|
4
4
|
import { r as PlatformClient } from "./client-CoxPEhJq.mjs";
|
|
5
5
|
import { m as printSuccess, o as formatCount, p as note } from "./output-BCdLioKP.mjs";
|
|
6
6
|
import { a as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-D0YNnJfm.mjs";
|
|
7
|
-
import { _ as validateSecretValues } from "./env-validation-
|
|
7
|
+
import { _ as validateSecretValues } from "./env-validation-Del3C8AY.mjs";
|
|
8
8
|
import { readFileSync } from "node:fs";
|
|
9
9
|
import { parseEnv } from "node:util";
|
|
10
10
|
// src/cli/secret.ts
|
|
@@ -97,7 +97,7 @@ async function resolveSecretBackend(root, args) {
|
|
|
97
97
|
}
|
|
98
98
|
async function resolveCloudflareSecretBackend(root, args) {
|
|
99
99
|
if (args.projectName) throw new Error("secret: --project selects a Void platform project and is not used for direct Cloudflare apps.");
|
|
100
|
-
const { deleteCloudflareSecret, listCloudflareSecrets, putCloudflareSecret, resolveCloudflareOperationContext, syncCloudflareSecrets } = await import("./cloudflare-operations-
|
|
100
|
+
const { deleteCloudflareSecret, listCloudflareSecrets, putCloudflareSecret, resolveCloudflareOperationContext, syncCloudflareSecrets } = await import("./cloudflare-operations-laxRA8HN.mjs");
|
|
101
101
|
const context = resolveCloudflareOperationContext(root);
|
|
102
102
|
return {
|
|
103
103
|
target: "Cloudflare Worker",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as join } from "./dist-DMYe8CZJ.mjs";
|
|
2
|
-
import { l as bindingNamesForField, p as findBindingNameOwner } from "./wrangler-
|
|
2
|
+
import { l as bindingNamesForField, p as findBindingNameOwner } from "./wrangler-Gn4EoY4-.mjs";
|
|
3
3
|
// src/shared/untrusted-env.ts
|
|
4
4
|
/** Authentication inputs that Wrangler may consume from the environment. */
|
|
5
5
|
const WRANGLER_AUTH_CREDENTIAL_ENV_VARS = [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { b as readRootWranglerConfig } from "./wrangler-Gn4EoY4-.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as join, c as resolve, n as dirname, o as normalize, t as basename } from "./dist-DMYe8CZJ.mjs";
|
|
2
|
-
import { o as TYPED_CONFIG_FILE, s as loadTypedVoidConfigFile } from "./project-paths-
|
|
3
|
-
import { h as validateConfig, p as readConfig } from "./config-
|
|
4
|
-
import { a as persistCloudflareConfig, i as materializeCloudflareConfig, r as ignoreMaterializedCloudflareConfig } from "./cloudflare-config-
|
|
2
|
+
import { o as TYPED_CONFIG_FILE, s as loadTypedVoidConfigFile } from "./project-paths-G0yut6Zz.mjs";
|
|
3
|
+
import { h as validateConfig, p as readConfig } from "./config-hL-S-Y9D.mjs";
|
|
4
|
+
import { a as persistCloudflareConfig, i as materializeCloudflareConfig, r as ignoreMaterializedCloudflareConfig } from "./cloudflare-config-Ce8j5S7V.mjs";
|
|
5
5
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { parseSync } from "vite";
|
|
7
7
|
import { appendSqliteClassMigration, isRecord } from "@void/deploy-core";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { a as join, l as toSlash, n as dirname, r as extname } from "./dist-DMYe8CZJ.mjs";
|
|
2
|
-
import { n as readProjectPaths } from "./project-paths-
|
|
3
|
-
import { l as getDatabaseDialect, p as readConfig } from "./config-
|
|
2
|
+
import { n as readProjectPaths } from "./project-paths-G0yut6Zz.mjs";
|
|
3
|
+
import { l as getDatabaseDialect, p as readConfig } from "./config-hL-S-Y9D.mjs";
|
|
4
4
|
import { n as isIdentifier, r as isLiteral } from "./ast-Cv0JwXqb.mjs";
|
|
5
5
|
import { t as MagicString } from "./dist-B6eN80gc.mjs";
|
|
6
|
-
import { c as voidDbBundlerPlugin, r as cloudflareQueueName, t as generateQueueResolverSource } from "./dispatch-
|
|
6
|
+
import { c as voidDbBundlerPlugin, r as cloudflareQueueName, t as generateQueueResolverSource } from "./dispatch-DM4Xdd2l.mjs";
|
|
7
7
|
import { t as WORKER_CONDITIONS } from "./worker-conditions-CBZ0RYsZ.mjs";
|
|
8
8
|
import { createRequire } from "node:module";
|
|
9
9
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
@@ -45,4 +45,6 @@ During local development, with `void deploy --platform cloudflare`, and on [othe
|
|
|
45
45
|
|
|
46
46
|
## Framework `_headers` files
|
|
47
47
|
|
|
48
|
-
Void reads `_headers` files produced by supported frameworks. Your `routing.headers` rules run afterward, so they can override framework defaults.
|
|
48
|
+
On a Void platform, Void reads `_headers` files produced by supported frameworks. Your `routing.headers` rules run afterward, so they can override framework defaults.
|
|
49
|
+
|
|
50
|
+
For native Cloudflare framework deployments, put a `_headers` file in your framework's public asset directory to configure static asset responses. Void includes the built file when it uploads a Worker version, including deployments that keep existing Worker secrets. These rules do not apply to responses generated by a Worker.
|
|
@@ -23,6 +23,7 @@ Define URL redirects in [`void.config.ts`](../../reference/config) using the `ro
|
|
|
23
23
|
- **Destinations** can be strings (default `302`) or objects with `to` and optional `status`. Supported statuses: `301`, `302`, `303`, `307`, `308`.
|
|
24
24
|
- `:splat` in the destination is replaced with the portion of the path matched by `*` in the source pattern.
|
|
25
25
|
- Destination query strings are merged into the `Location` header (the destination's parameters take precedence on per-key conflict). To drop the incoming query, write an explicit reset like `?`.
|
|
26
|
+
- `c.redirect()` in a handler, loader, or middleware sends that location unchanged and does not append the request query. A named action still drops its action key when the browser follows with GET, and keeps the page's other parameters. See [`c.redirect()`](../../reference/api/rewrites.md#c-rewrite-destination).
|
|
26
27
|
- When multiple rules match, the **first match wins**. Put specific patterns before catch-all patterns.
|
|
27
28
|
- Redirects are evaluated **before** the request reaches the worker, so they short-circuit static asset serving, ISR, and SSR.
|
|
28
29
|
|
|
@@ -33,7 +33,7 @@ Supported meta-frameworks use their own asset directories automatically.
|
|
|
33
33
|
|
|
34
34
|
### Native Cloudflare deployments
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
For apps that use Void routing, `void deploy --platform cloudflare` gives generated JavaScript bundles with content fingerprints immutable caching. Framework integrations use their asset configuration and `_headers` file. Files copied from `public/` and custom build outputs with stable filenames keep normal revalidation, even when they live in the assets directory. CSS and other assets keep Cloudflare's default or your configured `Cache-Control`.
|
|
37
37
|
|
|
38
38
|
Use [Custom Headers](./headers) to choose a cache policy for other files. Apply immutable caching only to URLs that change whenever their content changes.
|
|
39
39
|
|
|
@@ -300,6 +300,20 @@ Expected errors such as `400`, `404`, `409`, `422`, and `429` stay with the form
|
|
|
300
300
|
|
|
301
301
|
Authentication errors (`401`, `403`), server errors (`500`, `502`), and unexpected failures are thrown. Handle them with your framework's error boundary or error handling.
|
|
302
302
|
|
|
303
|
+
Use `isVoidActionError()` to tell a failed action apart from other errors. It's `true` for a `VoidActionError` at any status, and narrows the error so you can read `status` and `message`. `isCallSiteActionError()` is `true` only for the expected errors that `action()` returns.
|
|
304
|
+
|
|
305
|
+
```ts
|
|
306
|
+
import { isVoidActionError } from '@void/react'; // or "@void/vue", "@void/svelte", "@void/solid"
|
|
307
|
+
|
|
308
|
+
function describeError(error: unknown) {
|
|
309
|
+
if (isVoidActionError(error)) {
|
|
310
|
+
if (error.status === 401) return 'Please sign in again.';
|
|
311
|
+
if (error.status === 403) return error.message;
|
|
312
|
+
}
|
|
313
|
+
return 'Something went wrong.';
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
303
317
|
Actions can throw `ValidationError` for custom validation logic:
|
|
304
318
|
|
|
305
319
|
```ts
|
|
@@ -14,6 +14,20 @@ Create route handlers in `routes/` using `.ts`, `.tsx`, `.js`, `.jsx`, `.mts`, o
|
|
|
14
14
|
|
|
15
15
|
Dynamic segments use brackets: `[id]` becomes a route parameter and `[...slug]` becomes a catch-all. Prefix files or directories with `_` or `.` to exclude them from routing; `.well-known` remains available for standard discovery endpoints. Directories wrapped in parentheses like `(admin)` are route groups. They help organize files without changing the URL.
|
|
16
16
|
|
|
17
|
+
### Overlapping routes
|
|
18
|
+
|
|
19
|
+
When several routes match a URL, the most specific one handles it. Void compares routes segment by segment, from the left, and the first segment that differs decides: a static segment beats `[param]`, and `[param]` beats `[...slug]`. Catch-all routes rank after all other routes.
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
routes/
|
|
23
|
+
users/[id].ts → handles /users/about (users beats [lang])
|
|
24
|
+
[lang]/about.ts → handles /fr/about (about beats [slug])
|
|
25
|
+
[lang]/[slug].ts → handles /fr/contact
|
|
26
|
+
[...path].ts → handles URLs no other route matches
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Parameter names don't affect the order. Routes that differ only in their parameter names, such as `[id].ts` and `[slug].ts`, match the same URLs, so keep only one of them.
|
|
30
|
+
|
|
17
31
|
### Environment-only routes
|
|
18
32
|
|
|
19
33
|
Add a `.dev` or `.prod` suffix before the extension to include a route in only one environment:
|
|
@@ -91,6 +91,8 @@ Imported from `"@void/vue"`.
|
|
|
91
91
|
| `useForm(url, defaults, options?)` | Typed reactive form helper bound to a page action URL. Returns `{ data, post, put, patch, delete, pending, errors, error, hasChanges, wasSuccessful, recentlySuccessful, reset, setError, clearErrors, clearError }`. |
|
|
92
92
|
| `useIslandForm(defaults)` | Form helper for island components. Same form state as `useForm()`, plus `submit(url, method)`. `post(url)`, `put(url)`, `patch(url)`, and `delete(url)` take the action URL and submit with `fetch()`. |
|
|
93
93
|
| `action(url, options?)` | Awaitable one-shot page action helper. Uses `POST` by default and accepts `{ data, method, params, preserveScroll }`, where `method` can be `"PUT"`, `"PATCH"`, or `"DELETE"`. Returns an `ActionResult`. |
|
|
94
|
+
| `isVoidActionError(error)` | Returns `true` when `error` is a `VoidActionError` at any status, such as a thrown `401`, `403`, or `500`. Narrows `error` to `VoidActionError`. See [handling thrown errors](../../guide/pages-routing/actions-and-forms.md#validation-errors). |
|
|
95
|
+
| `isCallSiteActionError(error)` | Returns `true` only for the expected `VoidActionError` statuses that `action()` returns, such as `409` or `422`. |
|
|
94
96
|
| `useShared()` | Returns shared data. Middleware sets it with `c.set("shared", {...})`; a loader or action can update it. See [Shared data](../../guide/pages-routing/layouts.md#shared-data). |
|
|
95
97
|
|
|
96
98
|
Vue `Link` GET `data` is merged into the rendered `href` query string. Primitive values are serialized with `String(value)`, arrays become repeated keys, `null` and `undefined` are omitted, and nested objects throw. `prefetch` and `reloadDocument` are GET-only and throw for mutation links.
|
|
@@ -144,6 +146,8 @@ Imported from `"@void/react"`.
|
|
|
144
146
|
| `useForm(url, defaults, options?)` | Form helper hook. Returns `{ data, setData, post, put, patch, delete, pending, errors, error, hasChanges, wasSuccessful, recentlySuccessful, reset, setError, clearErrors, clearError }`. |
|
|
145
147
|
| `useIslandForm(defaults)` | Form helper hook for island components. Same form state as `useForm()`. `post(url)`, `put(url)`, `patch(url)`, and `delete(url)` take the action URL and submit with `fetch()`. |
|
|
146
148
|
| `action(url, options?)` | Awaitable one-shot page action helper. Uses `POST` by default and accepts `{ data, method, params, preserveScroll }`, where `method` can be `"PUT"`, `"PATCH"`, or `"DELETE"`. Returns an `ActionResult`. |
|
|
149
|
+
| `isVoidActionError(error)` | Returns `true` when `error` is a `VoidActionError` at any status, such as a thrown `401`, `403`, or `500`. Narrows `error` to `VoidActionError`. See [handling thrown errors](../../guide/pages-routing/actions-and-forms.md#validation-errors). |
|
|
150
|
+
| `isCallSiteActionError(error)` | Returns `true` only for the expected `VoidActionError` statuses that `action()` returns, such as `409` or `422`. |
|
|
147
151
|
| `useShared()` | Returns shared data. Middleware sets it with `c.set("shared", {...})`; a loader or action can update it. See [Shared data](../../guide/pages-routing/layouts.md#shared-data). |
|
|
148
152
|
| `Deferred<T>` | React-only prop type for `defer()` results. It is `Promise<T>` and is consumed with React `use()`. |
|
|
149
153
|
|
|
@@ -221,6 +225,8 @@ Imported from `"@void/svelte"`.
|
|
|
221
225
|
| `useForm(url, defaults, options?)` | Form helper using Svelte 5 runes. Returns `{ data, post, put, patch, delete, pending, errors, error, hasChanges, wasSuccessful, recentlySuccessful, reset, setError, clearErrors, clearError }`. |
|
|
222
226
|
| `useIslandForm(defaults)` | Form helper for island components. Same form state as `useForm()`, plus `submit(url, method)`. `post(url)`, `put(url)`, `patch(url)`, and `delete(url)` take the action URL and submit with `fetch()`. |
|
|
223
227
|
| `action(url, options?)` | Awaitable one-shot page action helper. Uses `POST` by default and accepts `{ data, method, params, preserveScroll }`, where `method` can be `"PUT"`, `"PATCH"`, or `"DELETE"`. Returns an `ActionResult`. |
|
|
228
|
+
| `isVoidActionError(error)` | Returns `true` when `error` is a `VoidActionError` at any status, such as a thrown `401`, `403`, or `500`. Narrows `error` to `VoidActionError`. See [handling thrown errors](../../guide/pages-routing/actions-and-forms.md#validation-errors). |
|
|
229
|
+
| `isCallSiteActionError(error)` | Returns `true` only for the expected `VoidActionError` statuses that `action()` returns, such as `409` or `422`. |
|
|
224
230
|
| `useShared()` | Returns shared data. Middleware sets it with `c.set("shared", {...})`; a loader or action can update it. See [Shared data](../../guide/pages-routing/layouts.md#shared-data). |
|
|
225
231
|
| `useRouter()` | Returns the Void Router with current route state (`url`, `path`, `query`, `params`) and navigation methods: `visit`, `refresh`, awaitable `prefetch`, `flush`, `flushAll`. |
|
|
226
232
|
| `useParams()` | Returns dynamic route params for the page currently being rendered. |
|
|
@@ -272,6 +278,8 @@ Imported from `"@void/solid"`.
|
|
|
272
278
|
| `useForm(url, defaults, options?)` | Form helper using Solid stores. Returns `{ data, setData, post, put, patch, delete, pending, errors, error, hasChanges, wasSuccessful, recentlySuccessful, reset, setError, clearErrors, clearError }`. |
|
|
273
279
|
| `useIslandForm(defaults)` | Form helper for island components. Same form state as `useForm()`. `post(url)`, `put(url)`, `patch(url)`, and `delete(url)` take the action URL and submit with `fetch()`. |
|
|
274
280
|
| `action(url, options?)` | Awaitable one-shot page action helper. Uses `POST` by default and accepts `{ data, method, params, preserveScroll }`, where `method` can be `"PUT"`, `"PATCH"`, or `"DELETE"`. Returns an `ActionResult`. |
|
|
281
|
+
| `isVoidActionError(error)` | Returns `true` when `error` is a `VoidActionError` at any status, such as a thrown `401`, `403`, or `500`. Narrows `error` to `VoidActionError`. See [handling thrown errors](../../guide/pages-routing/actions-and-forms.md#validation-errors). |
|
|
282
|
+
| `isCallSiteActionError(error)` | Returns `true` only for the expected `VoidActionError` statuses that `action()` returns, such as `409` or `422`. |
|
|
275
283
|
| `useShared()` | Returns shared data. Middleware sets it with `c.set("shared", {...})`; a loader or action can update it. See [Shared data](../../guide/pages-routing/layouts.md#shared-data). |
|
|
276
284
|
| `useRouter()` | Returns the Void Router with current route state (`url`, `path`, `query`, `params`) and navigation methods: `visit`, `refresh`, awaitable `prefetch`, `flush`, `flushAll`. |
|
|
277
285
|
| `useParams()` | Returns dynamic route params for the page currently being rendered. |
|
|
@@ -30,7 +30,9 @@ import { routeUrl } from 'void/routes';
|
|
|
30
30
|
return c.redirect(routeUrl('/users/:id', { params: { id: 42 } }));
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
`c.redirect()`
|
|
33
|
+
`c.redirect()` sends the location it is given. The request query is not added to an internal path, a protocol-relative URL, or an absolute URL, so `c.redirect('/notes')` from `/sign-in?redirectTo=/notes` goes to `/notes`. [`routing.redirects`](../../guide/edge/redirects.md) still merge the request query into the destination.
|
|
34
|
+
|
|
35
|
+
A [named action](../../guide/pages-routing/actions-and-forms.md#named-actions) is the exception. Redirecting it to a GET page drops the action key and keeps the page's other query parameters: `POST /users/42?delete&tab=profile` with `c.redirect('/users/42')` goes to `/users/42?tab=profile`. Redirects that preserve the request method keep the action key: `307` and `308`, or `301` and `302` after a `PUT`, `PATCH`, or `DELETE`.
|
|
34
36
|
|
|
35
37
|
```ts
|
|
36
38
|
import { defineHandler } from 'void';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "void",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.2",
|
|
4
4
|
"description": "Full-stack framework and deployment CLI for Cloudflare Workers, powered by Vite.",
|
|
5
5
|
"homepage": "https://void.cloud",
|
|
6
6
|
"bugs": {
|
|
@@ -352,11 +352,11 @@
|
|
|
352
352
|
"@cloudflare/workers-types": "^5.20261102.1",
|
|
353
353
|
"@cloudflare/workers-utils": "^0.50.2",
|
|
354
354
|
"@napi-rs/keyring": "^2.1.2",
|
|
355
|
-
"@void/deploy-cloudflare": "1.6.
|
|
356
|
-
"@void/deploy-core": "1.6.
|
|
357
|
-
"@void/edge": "1.6.
|
|
358
|
-
"@void/isr": "1.6.
|
|
359
|
-
"@void/platform": "1.6.
|
|
355
|
+
"@void/deploy-cloudflare": "1.6.2",
|
|
356
|
+
"@void/deploy-core": "1.6.2",
|
|
357
|
+
"@void/edge": "1.6.2",
|
|
358
|
+
"@void/isr": "1.6.2",
|
|
359
|
+
"@void/platform": "1.6.2",
|
|
360
360
|
"better-auth": "^1.7.14",
|
|
361
361
|
"better-sqlite3": "^13.0.3",
|
|
362
362
|
"blake3-jit": "^1.1.0",
|
|
@@ -407,7 +407,7 @@
|
|
|
407
407
|
"zod": "^4.6.7"
|
|
408
408
|
},
|
|
409
409
|
"peerDependencies": {
|
|
410
|
-
"@void/md": "1.6.
|
|
410
|
+
"@void/md": "1.6.2",
|
|
411
411
|
"arktype": ">=2.0.0",
|
|
412
412
|
"valibot": ">=1.0.0-beta.7",
|
|
413
413
|
"vite": "^8.0.0",
|
package/dist/deploy-B029oHlE.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { t as discoverSchema } from "./discover-Dhkzxgdt.mjs";
|
package/dist/gen-cCxrFp9L.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { r as runGenCommand } from "./gen-B9bCV5qu.mjs";
|
package/dist/login-BpbYeu-n.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { r as selectPlatformLoginMethod } from "./login-CJopTWX4.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { n as runMigrateCommand } from "./migrate-ChHHZBTi.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { a as runOperatorCommand } from "./operator-cmd-BUqsdk2K.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { t as prepareProject } from "./prepare-BerOZiD4.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { b as readRootWranglerConfig } from "./wrangler-DESSbN8L.mjs";
|