void 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-cmd-ChVKPZ-w.mjs → account-cmd-DRhmCWcm.mjs} +3 -3
- package/dist/{application-analysis-2vGZrKzg.mjs → application-analysis-HRFsZOv3.mjs} +3 -3
- package/dist/{application-routing-DnUQoOJD.mjs → application-routing-P4TggvWp.mjs} +1 -1
- package/dist/{auth-link-D4uMdOsw.mjs → auth-link-CVXP1G6G.mjs} +3 -3
- package/dist/{auth-router-62dna450.mjs → auth-router-D1pGdbvB.mjs} +2 -2
- package/dist/{better-auth-shared-CiclgPde.mjs → better-auth-shared-C958aM7W.mjs} +28 -3
- package/dist/{build-cmd-D93K_4Sa.mjs → build-cmd-DmjbuT6d.mjs} +1 -1
- package/dist/{cache-CiIzEED4.mjs → cache-2khBO1MR.mjs} +1 -1
- package/dist/{cancel-deploy-BNoGfn2e.mjs → cancel-deploy-_itbbvY3.mjs} +1 -1
- package/dist/cli/cli.mjs +27 -27
- package/dist/client-CEtr5UOR.mjs +1 -0
- package/dist/{client-Qayy9xEh.mjs → client-CoxPEhJq.mjs} +6 -2
- package/dist/{cloudflare-cmd-DiFGaLow.mjs → cloudflare-cmd-fZ6AMSWk.mjs} +1 -1
- package/dist/{cloudflare-config-Chet188_.mjs → cloudflare-config-eQunqX6A.mjs} +1 -1
- package/dist/{cloudflare-connect-BdgAQBc7.mjs → cloudflare-connect-9OZe4XVQ.mjs} +1 -1
- package/dist/{cloudflare-operations-CWA24vCh.mjs → cloudflare-operations-CrskD4_O.mjs} +4 -4
- package/dist/{cloudflare-operations-D8MoezuN.mjs → cloudflare-operations-oLvAd9Nd.mjs} +1 -1
- package/dist/{config-Bt4rw93x.mjs → config-BBlVXZCU.mjs} +1 -1
- package/dist/{config-DkA9jYF2.mjs → config-BITKQ3O6.mjs} +2 -1
- package/dist/{config-BszFVhpk.mjs → config-BgysUhnm.mjs} +1 -1
- package/dist/{config-CzsNzGVH.d.mts → config-CPxJmt4M.d.mts} +2 -0
- package/dist/config-entry.d.mts +1 -1
- package/dist/{connect-b9mJbb6X.mjs → connect-CKvmkl2R.mjs} +4 -4
- package/dist/{create-project-rnjum4_V.mjs → create-project-BiMmR5wA.mjs} +1 -1
- package/dist/{create-project-eomwm0wa.mjs → create-project-Bq0M8MtO.mjs} +1 -1
- package/dist/{db-UPWmiSk1.mjs → db-cq5RW4Vy.mjs} +17 -17
- package/dist/{delete-BeeYi1WO.mjs → delete-CY4L8fi2.mjs} +1 -1
- package/dist/deploy-B029oHlE.mjs +2 -0
- package/dist/{deploy-CwmCcTlq.mjs → deploy-D_gEojD2.mjs} +79 -42
- package/dist/{deploy-managed-static-gPDxyp3v.mjs → deploy-managed-static-BHVbB_-A.mjs} +11 -11
- package/dist/{deploy-transport-L6zzPE9T.mjs → deploy-transport-DEyOUfac.mjs} +2 -2
- package/dist/deploy.mjs +5 -4
- package/dist/{dev-inbox-CwH5VuZj.mjs → dev-inbox-CUUS6iUg.mjs} +1 -1
- package/dist/{dispatch-CiJ1Xrba.mjs → dispatch-BNLB5_Gm.mjs} +1 -1
- package/dist/{domain-3xdH9p2L.mjs → domain-BlH90Ods.mjs} +2 -2
- package/dist/{email-Du3YRnM5.mjs → email-Bkq8ZL1p.mjs} +6 -6
- package/dist/{email-cloudflare-CtD8qE13.mjs → email-cloudflare-MvJIxrwx.mjs} +5 -107
- package/dist/{env-Cnvp0pGy.mjs → env-AvuCSeCH.mjs} +2 -2
- package/dist/{gen-BvVmpZ5f.mjs → gen-BD-dfjxY.mjs} +3 -3
- package/dist/gen-CIHXh9I8.mjs +1 -0
- package/dist/{github-cmd-X2GKiLi-.mjs → github-cmd-CA-lBdkn.mjs} +1 -1
- package/dist/{handler-Drm_lyrV.d.mts → handler-BR6Tvjkp.d.mts} +8 -3
- package/dist/{handler-xmzz0U38.mjs → handler-CKeTtYID.mjs} +2 -12
- package/dist/headers-CuTEdP9C.mjs +445 -0
- package/dist/{help-EWDNxST-.mjs → help-1OCFDsRr.mjs} +9 -1
- package/dist/help-Ba8Dq5-r.mjs +1 -0
- package/dist/{inbound-DSKSHDUj.d.mts → inbound-BHt4dIlL.d.mts} +16 -5
- package/dist/{inbound-DQfekMtz.mjs → inbound-CdO-qY0w.mjs} +2 -76
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +65 -37
- package/dist/{info-jW8_d3VI.mjs → info-CJxua_db.mjs} +4 -4
- package/dist/{init-jDQ5G9QC.mjs → init-B-4CluYx.mjs} +12 -11
- package/dist/{isr-config-DhBkzCdY.mjs → isr-config-Czzb4mIq.mjs} +1 -47
- package/dist/{link-DOyxX5Xs.mjs → link-DAXOT-G_.mjs} +2 -2
- package/dist/{list-C9pTYDtl.mjs → list-BYSOo9fm.mjs} +2 -2
- package/dist/{live-CDBHyYiR.d.mts → live-0xrcVpyq.d.mts} +1 -1
- package/dist/{local-d1-CKfek6Z4.mjs → local-d1-BLgsNUj9.mjs} +1 -1
- package/dist/login-BpbYeu-n.mjs +1 -0
- package/dist/{login-koQbjzPd.mjs → login-CJopTWX4.mjs} +2 -2
- package/dist/{logs-cTU5TsRW.mjs → logs-DE0weBsR.mjs} +13 -11
- package/dist/{migrate-C62pGTfr.mjs → migrate-ChHHZBTi.mjs} +3 -3
- package/dist/migrate-HdA6Kh2p.mjs +1 -0
- package/dist/{mime-DKkO7ZtA.mjs → mime-CtP6-qAF.mjs} +143 -15
- package/dist/nitro.mjs +3 -3
- package/dist/{node-BfAt2rz8.mjs → node-CZ6lGNLn.mjs} +1 -1
- package/dist/{operator-cmd-CnAvSqJ5.mjs → operator-cmd-BUqsdk2K.mjs} +28 -10
- package/dist/operator-cmd-wBYyp8iQ.mjs +1 -0
- package/dist/pages/client.d.mts +143 -11
- package/dist/pages/client.mjs +173 -12
- package/dist/pages/index.d.mts +22 -3
- package/dist/pages/index.mjs +18 -4
- package/dist/pages/islands-plugin.d.mts +46 -2
- package/dist/pages/islands-plugin.mjs +91 -5
- package/dist/pages/prefetch.d.mts +2 -2
- package/dist/pages/prefetch.mjs +1 -1
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +2 -2
- package/dist/platform-args-C7XUw9mw.mjs +1 -0
- package/dist/{platform-args-Bv9hoLEL.mjs → platform-args-Cx1M-7bq.mjs} +18 -4
- package/dist/{platform-auth-config-CLj0EvnB.mjs → platform-auth-config-K4m_LE8b.mjs} +4 -4
- package/dist/{platform-auth-protection-DQDSxVhr.mjs → platform-auth-protection-KF5Vo-1I.mjs} +2 -2
- package/dist/{platform-auth-recovery-DD3oLerq.mjs → platform-auth-recovery-BOdFrl7R.mjs} +2 -2
- package/dist/{platform-cmd-WnOmdLzR.mjs → platform-cmd-DpCHawGF.mjs} +1 -1
- package/dist/{platform-cmd-PLNLg-2N.mjs → platform-cmd-Ds3EAV5t.mjs} +5 -4
- package/dist/{platform-domain-Bnq0vg0q.mjs → platform-domain-rWJshybd.mjs} +2 -2
- package/dist/{platform-lifecycle-BQiN9HN5.mjs → platform-lifecycle-BH34I0rh.mjs} +1 -1
- package/dist/{platform-lifecycle-BCsFg1Tl.mjs → platform-lifecycle-D9RdGub1.mjs} +66 -31
- package/dist/{platform-management-nzCDwtiN.mjs → platform-management-BRefdHGD.mjs} +21 -3
- package/dist/{platform-management-CMJR8Zi-.mjs → platform-management-BfLW0Zlo.mjs} +1 -1
- package/dist/{platform-recovery-DBNoME3I.mjs → platform-recovery-DZuZGJtt.mjs} +2 -2
- package/dist/platform-runtime-logs-CdJGnk3f.mjs +68 -0
- package/dist/{platform-setup-VEcHu0Vq.mjs → platform-setup-Vw1AaUN8.mjs} +15 -2
- package/dist/{plugin-inference-DmwjC3y2.mjs → plugin-inference-CdLbxZL_.mjs} +1 -1
- package/dist/{prefetch-L93_1Jk7.mjs → prefetch-Dx2jIbtg.mjs} +19 -1
- package/dist/{prefetch-CG0K6JPd.d.mts → prefetch-NdNeubbH.d.mts} +7 -1
- package/dist/{prepare-pfl2LIMy.mjs → prepare-BJW-f1f1.mjs} +4 -4
- package/dist/{prepare-BPsfLWaW.mjs → prepare-BMGeKL16.mjs} +1 -1
- package/dist/prepare-BdxJJCMv.mjs +1 -0
- package/dist/{project-cmd-5Izu4Pg3.mjs → project-cmd-B_bUyZ3J.mjs} +15 -15
- package/dist/{project-team-DSUyjZFh.mjs → project-team-MjT5K4rQ.mjs} +1 -1
- package/dist/{project-token-wj09YQSB.mjs → project-token-BKHGwY3k.mjs} +1 -1
- package/dist/{project-zero-trust-BMHf2YF0.mjs → project-zero-trust-Bzdd05-h.mjs} +1 -1
- package/dist/{protocol-0-lp9ZYx.mjs → protocol-COyySMki.mjs} +130 -107
- package/dist/{protocol-xdrl-In0.d.mts → protocol-CkwjASep.d.mts} +2 -2
- package/dist/{provision-CRiNnlfE.mjs → provision-BbCzpbXs.mjs} +1 -1
- package/dist/{provision-CxHIGBIZ.mjs → provision-DQF6Kw-6.mjs} +1 -1
- package/dist/{requests-DicgB5jU.mjs → requests-daJmVpjk.mjs} +1 -1
- package/dist/{rollback-DrDZOKNE.mjs → rollback-BgL0wY1J.mjs} +2 -2
- package/dist/{route-types-irZc1txT.mjs → route-types-CZc1YXjF.mjs} +40 -4
- package/dist/route-url-C_YIH_zO.d.mts +37 -0
- package/dist/routes-stub.d.mts +6 -2
- package/dist/runtime/better-auth-mysql.mjs +1 -1
- package/dist/runtime/better-auth-pg.mjs +1 -1
- package/dist/runtime/better-auth.mjs +1 -1
- package/dist/runtime/email/testing.d.mts +1 -1
- package/dist/runtime/email/testing.mjs +3 -3
- package/dist/runtime/email.d.mts +1 -1
- package/dist/runtime/email.mjs +3 -3
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/handler.mjs +2 -2
- package/dist/runtime/live-client.d.mts +1 -1
- package/dist/runtime/live.d.mts +1 -1
- package/dist/runtime/route-url.d.mts +2 -2
- package/dist/runtime/routing.d.mts +3 -3
- package/dist/runtime/routing.mjs +37 -16
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws-server.d.mts +1 -1
- package/dist/runtime/ws.d.mts +1 -1
- package/dist/{scan-DSQtH3oS.mjs → scan-X2rDDRNa.mjs} +18 -10
- package/dist/{secret-C_QtTzJG.mjs → secret-CPq-B_vp.mjs} +2 -2
- package/dist/{static-asset-marker-NR1XS2z5.mjs → static-asset-marker-DsQKz6lt.mjs} +8 -1
- package/dist/validation-error-uAAjlsiW.mjs +82 -0
- package/dist/{version-metadata-Blf5H9BQ.mjs → version-metadata-C8hLzQkv.mjs} +1 -1
- package/dist/{wrangler-p-kLCJqF.mjs → wrangler-DESSbN8L.mjs} +2 -2
- package/dist/wrangler-DUB3MGHV.mjs +1 -0
- package/dist/{wrapper-iejSJDwL.mjs → wrapper-C9SUxoj7.mjs} +2 -2
- package/dist/{ws-DzBD-NUj.d.mts → ws-Dmjg5NH2.d.mts} +1 -1
- package/docs/guide/edge/headers.md +2 -0
- package/docs/guide/edge/rewrites.md +1 -1
- package/docs/guide/email/receiving.md +1 -1
- package/docs/guide/email/sending.md +42 -12
- package/docs/guide/pages-routing/actions-and-forms.md +21 -1
- package/docs/guide/pages-routing/islands.md +3 -3
- package/docs/guide/pages-routing/layouts.md +16 -2
- package/docs/guide/pages-routing/loaders.md +2 -2
- package/docs/guide/pages-routing/markdown.md +1 -1
- package/docs/guide/pages-routing/overview.md +103 -0
- package/docs/guide/platform/administration/connected-apps.md +4 -2
- package/docs/guide/platform/installation/credentials.md +6 -4
- package/docs/guide/platform/installation/maintenance.md +13 -0
- package/docs/guide/platform/installation/setup.md +22 -1
- package/docs/guide/ssg.md +3 -3
- package/docs/guide/type-safety.md +42 -1
- package/docs/integrations/frameworks/astro.md +17 -12
- package/docs/integrations/frameworks/overview.md +2 -2
- package/docs/reference/api/pages.md +101 -50
- package/docs/reference/api/rewrites.md +4 -1
- package/docs/reference/api/types.md +14 -10
- package/docs/reference/api.md +1 -1
- package/docs/reference/cli/platform-installation.md +4 -1
- package/docs/reference/cli/setup.md +1 -1
- package/docs/reference/config.md +10 -0
- package/package.json +8 -7
- package/schema.json +4 -0
- package/skills/void/SKILL.md +5 -0
- package/dist/client-DVtAKeUm.mjs +0 -1
- package/dist/deploy-CfU7CR-b.mjs +0 -2
- package/dist/gen-i61rdQgg.mjs +0 -1
- package/dist/headers-DEUBAM6W.mjs +0 -225
- package/dist/help-BcZDUcTw.mjs +0 -1
- package/dist/login-C0MiQrYs.mjs +0 -1
- package/dist/migrate-BG09-KOv.mjs +0 -1
- package/dist/operator-cmd-BhHXIL2G.mjs +0 -1
- package/dist/platform-args-C1kqYUen.mjs +0 -1
- package/dist/prepare-BJMmfq3W.mjs +0 -1
- package/dist/route-url-BGOiyKNz.d.mts +0 -24
- package/dist/validation-error-rDVbUJet.mjs +0 -47
- package/dist/wrangler-CPRX2d9A.mjs +0 -1
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import { a as join } from "./dist-DMYe8CZJ.mjs";
|
|
2
|
-
import { a as convertRewritesConfig, d as isProtocolRelative, f as parseHostPrefixedSource, i as convertRedirectsConfig, n as convertFallbacksConfig, o as countSplats, r as convertHeadersConfig, t as VALID_REDIRECT_STATUSES } from "./config-DkA9jYF2.mjs";
|
|
3
|
-
import { i as voidWarn } from "./log-D9hwSySP.mjs";
|
|
4
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
5
|
-
// src/cli/headers.ts
|
|
6
|
-
/**
|
|
7
|
-
* Parse a Cloudflare/Netlify `_headers` file into HeaderRule[].
|
|
8
|
-
*
|
|
9
|
-
* Format:
|
|
10
|
-
* - Non-indented lines = path pattern (starts a new block)
|
|
11
|
-
* - Indented lines = `Header-Name: value` (split on first `:`)
|
|
12
|
-
* - Lines starting with `#` are comments
|
|
13
|
-
* - `! Header-Name` unset directives are skipped (last-match-wins handles this)
|
|
14
|
-
*
|
|
15
|
-
* Output is sorted by pattern length ascending (shortest first) so that
|
|
16
|
-
* more-specific patterns come last — matching dispatch's last-match-wins semantics.
|
|
17
|
-
*
|
|
18
|
-
* Returns `undefined` if the file doesn't exist or yields no valid rules.
|
|
19
|
-
*/
|
|
20
|
-
function parseHeadersFile(dir) {
|
|
21
|
-
const filePath = join(dir, "_headers");
|
|
22
|
-
if (!existsSync(filePath)) return;
|
|
23
|
-
const content = readFileSync(filePath, "utf-8");
|
|
24
|
-
const rules = [];
|
|
25
|
-
let current = null;
|
|
26
|
-
for (const line of content.split("\n")) {
|
|
27
|
-
const trimmed = line.trimEnd();
|
|
28
|
-
if (trimmed === "" || trimmed.startsWith("#")) continue;
|
|
29
|
-
if (line[0] === " " || line[0] === " ") {
|
|
30
|
-
if (!current) continue;
|
|
31
|
-
const stripped = trimmed.trimStart();
|
|
32
|
-
if (stripped.startsWith("!")) continue;
|
|
33
|
-
const colonIdx = stripped.indexOf(":");
|
|
34
|
-
if (colonIdx === -1) continue;
|
|
35
|
-
const name = stripped.slice(0, colonIdx).trim();
|
|
36
|
-
const value = stripped.slice(colonIdx + 1).trim();
|
|
37
|
-
if (name) current.headers.push([name, value]);
|
|
38
|
-
} else {
|
|
39
|
-
if (current && current.headers.length > 0) rules.push(current);
|
|
40
|
-
current = {
|
|
41
|
-
pattern: trimmed,
|
|
42
|
-
headers: []
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (current && current.headers.length > 0) rules.push(current);
|
|
47
|
-
if (rules.length === 0) return;
|
|
48
|
-
rules.sort((a, b) => a.pattern.length - b.pattern.length);
|
|
49
|
-
return rules;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Parse a `_redirects` file: `source destination [status]` per line (status
|
|
53
|
-
* defaults to 302, `#` starts a comment). Keeps 3xx redirects and 200 rewrites.
|
|
54
|
-
*
|
|
55
|
-
* A `!` suffix on 200 sets `force`, so the rewrite applies even when a static
|
|
56
|
-
* asset matches. On a 3xx it is a no-op, stripped and counted in
|
|
57
|
-
* `redundantForceOn3xx`.
|
|
58
|
-
*
|
|
59
|
-
* Returns `undefined` when the file doesn't exist or yields no valid rules.
|
|
60
|
-
*/
|
|
61
|
-
function parseRedirectsFile(dir) {
|
|
62
|
-
const filePath = join(dir, "_redirects");
|
|
63
|
-
if (!existsSync(filePath)) return;
|
|
64
|
-
const content = readFileSync(filePath, "utf-8");
|
|
65
|
-
const rules = [];
|
|
66
|
-
let redundantForceOn3xx = 0;
|
|
67
|
-
const rawLines = content.split("\n");
|
|
68
|
-
for (let i = 0; i < rawLines.length; i++) {
|
|
69
|
-
const lineNumber = i + 1;
|
|
70
|
-
const trimmed = rawLines[i].trim();
|
|
71
|
-
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
72
|
-
const parts = trimmed.split(/\s+/);
|
|
73
|
-
if (parts.length < 2) continue;
|
|
74
|
-
const origin = `_redirects:${lineNumber}`;
|
|
75
|
-
const [rawSource, destination, statusStr] = parts;
|
|
76
|
-
const parsedSource = parseHostPrefixedSource(rawSource);
|
|
77
|
-
if ("error" in parsedSource) {
|
|
78
|
-
voidWarn(`Skipping _redirects entry "${rawSource} ${destination}${statusStr ? ` ${statusStr}` : ""}" (line ${lineNumber}): source ${parsedSource.error}.`);
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
const { host, path: source } = parsedSource;
|
|
82
|
-
if (countSplats(source) > 1) {
|
|
83
|
-
voidWarn(`Skipping _redirects entry "${rawSource} ${destination}${statusStr ? ` ${statusStr}` : ""}" (line ${lineNumber}): source must contain at most one "*" wildcard (captured as :splat).`);
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
let status;
|
|
87
|
-
let force = false;
|
|
88
|
-
if (statusStr) {
|
|
89
|
-
if (statusStr.endsWith("!")) {
|
|
90
|
-
const numericPart = statusStr.slice(0, -1);
|
|
91
|
-
status = parseInt(numericPart, 10);
|
|
92
|
-
if (status === 200) force = true;
|
|
93
|
-
else if (status >= 300 && status < 400) redundantForceOn3xx++;
|
|
94
|
-
} else status = parseInt(statusStr, 10);
|
|
95
|
-
} else status = 302;
|
|
96
|
-
if (status === 200) {
|
|
97
|
-
if (!destination.startsWith("/")) {
|
|
98
|
-
voidWarn(`Skipping _redirects rewrite "${rawSource} ${destination} ${force ? "200!" : "200"}": destination must start with "/" (only internal paths are supported).`);
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
if (isProtocolRelative(destination)) {
|
|
102
|
-
voidWarn(`Skipping _redirects rewrite "${rawSource} ${destination} ${force ? "200!" : "200"}": destination must not start with "//" (protocol-relative URLs parse as cross-origin; only internal paths are supported).`);
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
105
|
-
if (destination.includes("?")) {
|
|
106
|
-
voidWarn(`Skipping _redirects rewrite "${rawSource} ${destination} ${force ? "200!" : "200"}": destination must not contain "?" (query strings are not supported in rewrite destinations; the incoming request's query is preserved automatically).`);
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
rules.push({
|
|
110
|
-
source,
|
|
111
|
-
destination,
|
|
112
|
-
status,
|
|
113
|
-
force,
|
|
114
|
-
origin,
|
|
115
|
-
...host && { host }
|
|
116
|
-
});
|
|
117
|
-
} else if (status >= 300 && status < 400) {
|
|
118
|
-
if (!VALID_REDIRECT_STATUSES.has(status)) {
|
|
119
|
-
voidWarn(`Skipping _redirects entry "${rawSource} ${destination} ${statusStr}" (line ${lineNumber}): redirect status must be 301, 302, 303, 307, or 308.`);
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
rules.push({
|
|
123
|
-
source,
|
|
124
|
-
destination,
|
|
125
|
-
status,
|
|
126
|
-
origin,
|
|
127
|
-
...host && { host }
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
if (rules.length === 0 && redundantForceOn3xx === 0) return;
|
|
132
|
-
return {
|
|
133
|
-
rules,
|
|
134
|
-
redundantForceOn3xx
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Split `_redirects` rules into rules that always apply and fallbacks: unforced
|
|
139
|
-
* 200 rewrites, which apply only when no static asset matches.
|
|
140
|
-
*/
|
|
141
|
-
function splitRedirectRulesByForce(rules) {
|
|
142
|
-
const always = [];
|
|
143
|
-
const fallbacks = [];
|
|
144
|
-
if (!rules) return {
|
|
145
|
-
always,
|
|
146
|
-
fallbacks
|
|
147
|
-
};
|
|
148
|
-
for (const rule of rules) if (rule.status === 200 && rule.force !== true) fallbacks.push(rule);
|
|
149
|
-
else always.push(rule);
|
|
150
|
-
return {
|
|
151
|
-
always,
|
|
152
|
-
fallbacks
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Merge `_redirects` and `_headers` in `dir` with `routing` from void.config.ts.
|
|
157
|
-
* Deploy and dev share it so both build the same rule tables; callers lint them.
|
|
158
|
-
*/
|
|
159
|
-
function mergeRoutingRules(opts) {
|
|
160
|
-
const { dir, routing } = opts;
|
|
161
|
-
const fileDir = dir !== null && existsSync(dir) ? dir : null;
|
|
162
|
-
const fileHeaders = fileDir !== null ? parseHeadersFile(fileDir) : void 0;
|
|
163
|
-
const fileParsed = fileDir !== null ? parseRedirectsFile(fileDir) : void 0;
|
|
164
|
-
const { always: fileAlways, fallbacks: fileFallbacks } = splitRedirectRulesByForce(fileParsed?.rules);
|
|
165
|
-
const cfgHeaders = convertHeadersConfig(routing?.headers);
|
|
166
|
-
const cfgRedirects = convertRedirectsConfig(routing?.redirects);
|
|
167
|
-
const cfgRewrites = convertRewritesConfig(routing?.rewrites);
|
|
168
|
-
const cfgFallbacks = convertFallbacksConfig(routing?.fallbacks);
|
|
169
|
-
const headerRules = [...fileHeaders ?? [], ...cfgHeaders ?? []];
|
|
170
|
-
const redirectRules = [
|
|
171
|
-
...cfgRedirects ?? [],
|
|
172
|
-
...cfgRewrites ?? [],
|
|
173
|
-
...fileAlways
|
|
174
|
-
];
|
|
175
|
-
const mergedFallbacks = [...cfgFallbacks ?? [], ...fileFallbacks];
|
|
176
|
-
return {
|
|
177
|
-
headerRules,
|
|
178
|
-
redirectRules,
|
|
179
|
-
fallbackRules: mergedFallbacks.length > 0 ? mergedFallbacks : void 0,
|
|
180
|
-
redundantForceOn3xx: fileParsed?.redundantForceOn3xx ?? 0
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Lint each phase on its own: only duplicates within a phase shadow each other,
|
|
185
|
-
* so a redirect and a fallback with the same source are fine.
|
|
186
|
-
*/
|
|
187
|
-
function lintRoutingPhases(rules) {
|
|
188
|
-
lintDuplicateSources(rules.redirectRules, "redirects/rewrites (pre-asset)");
|
|
189
|
-
lintDuplicateSources(rules.fallbackRules, "fallbacks (post-asset)");
|
|
190
|
-
lintDestinationSplats(rules.redirectRules, "redirects/rewrites (pre-asset)");
|
|
191
|
-
lintDestinationSplats(rules.fallbackRules, "fallbacks (post-asset)");
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Warn about a literal `*` in a destination. Destinations substitute only
|
|
195
|
-
* `:name` params such as `:splat`, so a `*` passes through unchanged.
|
|
196
|
-
*/
|
|
197
|
-
function lintDestinationSplats(rules, phaseName) {
|
|
198
|
-
if (!rules || rules.length === 0) return;
|
|
199
|
-
const affected = rules.filter((r) => r.destination.includes("*"));
|
|
200
|
-
if (affected.length === 0) return;
|
|
201
|
-
const lines = affected.map((r) => ` ${r.source} → ${r.destination} (${r.origin ?? "<unknown>"})`);
|
|
202
|
-
voidWarn(`destinations in ${phaseName} contain a literal "*" — splat tokens are not substituted in destinations; use ":splat" (or other named params) or rewrite the destination:\n${lines.join("\n")}`);
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Warn when one phase repeats an exact `source`: first match wins, so the later
|
|
206
|
-
* rule never applies. Phases run separately, so callers lint each one.
|
|
207
|
-
*/
|
|
208
|
-
function lintDuplicateSources(rules, phaseName) {
|
|
209
|
-
if (!rules || rules.length < 2) return;
|
|
210
|
-
const bySource = /* @__PURE__ */ new Map();
|
|
211
|
-
for (const rule of rules) {
|
|
212
|
-
const existing = bySource.get(rule.source);
|
|
213
|
-
if (existing) existing.push(rule);
|
|
214
|
-
else bySource.set(rule.source, [rule]);
|
|
215
|
-
}
|
|
216
|
-
const lines = [];
|
|
217
|
-
for (const [source, occurrences] of bySource) {
|
|
218
|
-
if (occurrences.length < 2) continue;
|
|
219
|
-
const origins = occurrences.map((r) => r.origin ?? "<unknown>").join(", ");
|
|
220
|
-
lines.push(` ${source} — ${origins}`);
|
|
221
|
-
}
|
|
222
|
-
if (lines.length === 0) return;
|
|
223
|
-
voidWarn(`duplicate rule sources detected in ${phaseName} (first match wins — the earlier entry takes effect):\n${lines.join("\n")}`);
|
|
224
|
-
}
|
|
225
|
-
export { mergeRoutingRules as n, parseRedirectsFile as r, lintRoutingPhases as t };
|
package/dist/help-BcZDUcTw.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { r as printHelpPage } from "./help-EWDNxST-.mjs";
|
package/dist/login-C0MiQrYs.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { r as selectPlatformLoginMethod } from "./login-koQbjzPd.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { n as runMigrateCommand } from "./migrate-C62pGTfr.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { a as runOperatorCommand } from "./operator-cmd-CnAvSqJ5.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { t as parsePlatformArgs } from "./platform-args-Bv9hoLEL.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { t as prepareProject } from "./prepare-pfl2LIMy.mjs";
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { RoutePathMap } from "void/routes";
|
|
2
|
-
/** Expand complete route tokens without changing query strings or fragments. */
|
|
3
|
-
declare function interpolateRouteParams(path: string, params?: Record<string, string>, requireParams?: boolean): string;
|
|
4
|
-
/** Known page, HTTP and WebSocket route patterns. */
|
|
5
|
-
type RoutePath = keyof RoutePathMap & string;
|
|
6
|
-
type RouteQueryValue = string | number | boolean | null | undefined;
|
|
7
|
-
type RouteQuery = Record<string, RouteQueryValue | ReadonlyArray<RouteQueryValue>>;
|
|
8
|
-
type RouteOptions<P extends RoutePath> = {
|
|
9
|
-
query?: RouteQuery;
|
|
10
|
-
hash?: string;
|
|
11
|
-
} & ([RoutePathMap[P]] extends [never] ? {
|
|
12
|
-
params?: never;
|
|
13
|
-
} : {
|
|
14
|
-
params: { [K in RoutePathMap[P] & string]: string | number; };
|
|
15
|
-
});
|
|
16
|
-
type RouteDestination$1<P extends RoutePath = RoutePath> = P extends RoutePath ? {
|
|
17
|
-
pathname: P;
|
|
18
|
-
} & RouteOptions<P> : never;
|
|
19
|
-
type RouteUrlInput$1 = string | URL | RouteDestination$1;
|
|
20
|
-
/** Build a relative URL from a known route pattern. */
|
|
21
|
-
declare function routeUrl<P extends RoutePath>(path: P, ...args: [RoutePathMap[NoInfer<P>]] extends [never] ? [options?: RouteOptions<P>] : [options: RouteOptions<P>]): string;
|
|
22
|
-
/** @internal Convert navigation inputs to URL strings without requiring an origin. */
|
|
23
|
-
declare function toUrlString(value: RouteUrlInput$1): string;
|
|
24
|
-
export { RouteQueryValue as a, routeUrl as c, RouteQuery as i, toUrlString as l, RouteOptions as n, RouteUrlInput$1 as o, RoutePath as r, interpolateRouteParams as s, RouteDestination$1 as t };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// src/pages/defer.ts
|
|
2
|
-
const DEFERRED = Symbol("deferred");
|
|
3
|
-
function defer(groupOrResolver, maybeResolver) {
|
|
4
|
-
const [group, resolver] = typeof groupOrResolver === "string" ? [groupOrResolver, maybeResolver] : [null, groupOrResolver];
|
|
5
|
-
return {
|
|
6
|
-
[DEFERRED]: true,
|
|
7
|
-
group,
|
|
8
|
-
resolver
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Separate a loader's return value into immediate props and deferred sentinels.
|
|
13
|
-
* For single-prop deferred (group=null), the object key becomes the group name.
|
|
14
|
-
* For named groups, all keys sharing the same group name are collected.
|
|
15
|
-
*/
|
|
16
|
-
function separateDeferred(props) {
|
|
17
|
-
const immediateProps = {};
|
|
18
|
-
const deferredMap = {};
|
|
19
|
-
for (const [key, value] of Object.entries(props)) if (value && typeof value === "object" && DEFERRED in value) {
|
|
20
|
-
const sentinel = value;
|
|
21
|
-
const groupName = sentinel.group ?? key;
|
|
22
|
-
if (!deferredMap[groupName]) deferredMap[groupName] = {
|
|
23
|
-
resolver: sentinel.resolver,
|
|
24
|
-
keys: []
|
|
25
|
-
};
|
|
26
|
-
deferredMap[groupName].keys.push(key);
|
|
27
|
-
immediateProps[key] = {
|
|
28
|
-
value: null,
|
|
29
|
-
loading: true,
|
|
30
|
-
error: null
|
|
31
|
-
};
|
|
32
|
-
} else immediateProps[key] = value;
|
|
33
|
-
return {
|
|
34
|
-
immediateProps,
|
|
35
|
-
deferredMap
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
// src/pages/validation-error.ts
|
|
39
|
-
var ValidationError = class extends Error {
|
|
40
|
-
errors;
|
|
41
|
-
constructor(errors) {
|
|
42
|
-
super("Validation failed");
|
|
43
|
-
this.name = "ValidationError";
|
|
44
|
-
this.errors = errors;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
export { separateDeferred as i, DEFERRED as n, defer as r, ValidationError as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { b as readRootWranglerConfig } from "./wrangler-p-kLCJqF.mjs";
|