void 1.12.0 → 1.12.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-D_0qJ9fx.mjs → account-cmd-CdJQba_Q.mjs} +4 -4
- package/dist/{application-analysis-Cx2S63z5.mjs → application-analysis-DVeN8yoi.mjs} +1 -1
- package/dist/{application-routing-BAXpnawu.mjs → application-routing-KKw4Y84h.mjs} +1 -1
- package/dist/{auth-Boz0lrb3.mjs → auth-A7cZ8aXA.mjs} +1 -1
- package/dist/{auth-DlLDymuc.mjs → auth-CqwJwItO.mjs} +1 -1
- package/dist/{auth-link-C97r9p2N.mjs → auth-link-D9MWA_dj.mjs} +4 -4
- package/dist/{auth-router-BmzEgzYx.mjs → auth-router-FskgTU3B.mjs} +1 -1
- package/dist/{build-cmd-BaFsyZrz.mjs → build-cmd-B7OJ0U5R.mjs} +2 -2
- package/dist/build-id-4IV4hC1-.mjs +13 -0
- package/dist/{cache-xO711ATQ.mjs → cache-wSpi3aeM.mjs} +2 -2
- package/dist/{cancel-deploy-Di11ynsr.mjs → cancel-deploy-DMWzkAlb.mjs} +2 -2
- package/dist/{cf-access-FaIm95jA.mjs → cf-access-DHklo7Rg.mjs} +33 -19
- package/dist/{cf-build-output-Ca201_n1.mjs → cf-build-output-Cso7Vh-t.mjs} +4 -2
- package/dist/cf-build-output-Wpk_e5CI.mjs +1 -0
- package/dist/cli/cli.mjs +1 -1
- package/dist/cli/cloudflare-operation-process.mjs +1 -1
- package/dist/cli/db-execute-process.d.mts +2 -0
- package/dist/cli/db-execute-process.mjs +57 -0
- package/dist/{cli-main-DlW6lB8s.mjs → cli-main-DaLrQfPS.mjs} +37 -344
- package/dist/{client-ImIe7Mjq.mjs → client-DE2m2ldh.mjs} +4 -4
- package/dist/{client-DkYzDEC0.mjs → client-eLZwqkPH.mjs} +1 -1
- package/dist/{cloudflare-operations-BF0PSErW.mjs → cloudflare-operations-BIRQkYwL.mjs} +14 -8
- package/dist/cloudflare-operations-ByjFGats.mjs +1 -0
- package/dist/{connect-DDRQGfFE.mjs → connect-WG4TcR_d.mjs} +4 -4
- package/dist/{create-project-CY7sP8sI.mjs → create-project-8FdN6D2i.mjs} +2 -2
- package/dist/{create-project-Dro3K-az.mjs → create-project-CbuDH5Hv.mjs} +1 -1
- package/dist/{db-DmlaWVBu.mjs → db-BSuWV1PI.mjs} +1348 -69
- package/dist/db-args-BvMwAber.mjs +1 -0
- package/dist/db-args-CiQVg8SJ.mjs +321 -0
- package/dist/{delete-Uuq9ch6o.mjs → delete-WtLEfap2.mjs} +2 -2
- package/dist/{deploy-B9E7_rHC.mjs → deploy-DtJeunLF.mjs} +14 -14
- package/dist/{deploy-BB3rsZbP.mjs → deploy-GT4CW5fs.mjs} +1 -1
- package/dist/{deploy-managed-static-IKZyuc1W.mjs → deploy-managed-static-BWBsxOww.mjs} +5 -5
- package/dist/{deploy-security-notice-C3LalelR.mjs → deploy-security-notice-IRGy6Edf.mjs} +2 -2
- package/dist/deploy.mjs +4 -4
- package/dist/{domain-B_xY1yZ5.mjs → domain-mweyYXSw.mjs} +3 -3
- package/dist/{email-BIC15L7a.mjs → email-DoDqRH6i.mjs} +5 -5
- package/dist/{email-cloudflare-C447nOqq.mjs → email-cloudflare-DeYH3Ke7.mjs} +2 -2
- package/dist/{env-DJPZYHT5.mjs → env-DaAoYR2-.mjs} +3 -3
- package/dist/{gen-DiTZlDx8.mjs → gen-aOtHhZLD.mjs} +1 -1
- package/dist/gen-vhBDHs3q.mjs +1 -0
- package/dist/{github-cmd-DPmby8x-.mjs → github-cmd-BR19Ffdz.mjs} +2 -2
- package/dist/{help-9wfMyXHb.mjs → help-DvClCzqL.mjs} +9 -1
- package/dist/help-fKPzcTJv.mjs +1 -0
- package/dist/index.mjs +16 -206
- package/dist/{info-BWEWaOBo.mjs → info-P6MBiVJi.mjs} +2 -2
- package/dist/{init-BuTPVLPO.mjs → init-B2VZ2Hut.mjs} +63 -18
- package/dist/installed-packages-tfmYd-cC.mjs +198 -0
- package/dist/{link-BiesPyT4.mjs → link-Dyz9IGcM.mjs} +3 -3
- package/dist/{list-CkonftPQ.mjs → list-VGYBMjmx.mjs} +4 -4
- package/dist/login-BbSQTZ6d.mjs +1 -0
- package/dist/{login-BSOSah1j.mjs → login-jUBgfvzk.mjs} +3 -3
- package/dist/{logs-HOBUnroa.mjs → logs-kS1wuR4b.mjs} +3 -3
- package/dist/module-references-DWQmO6TW.mjs +27 -0
- package/dist/{mysql-sql-CB52k8tQ.mjs → mysql-lock-D8xtnI-D.mjs} +1 -118
- package/dist/mysql-sql-BIE7bc4Z.mjs +124 -0
- package/dist/{operator-ai-logging-ZDqqhnIq.mjs → operator-ai-logging-DD0n6zc2.mjs} +3 -3
- package/dist/{operator-args-DCkWbgT-.mjs → operator-args-nvetCWuz.mjs} +1 -1
- package/dist/{operator-auth-BjoPLgja.mjs → operator-auth-DMvn-y9X.mjs} +1 -1
- package/dist/{operator-client-DzebIntv.mjs → operator-client-dFNnXfyB.mjs} +4 -3
- package/dist/operator-cmd-jnjzuJKX.mjs +1 -0
- package/dist/{operator-cmd-AZoeI9Pl.mjs → operator-cmd-wML5HNfS.mjs} +13 -9
- package/dist/{operator-security-Bo26FP01.mjs → operator-security-D5MToU0p.mjs} +1 -1
- package/dist/pages/client.mjs +77 -9
- package/dist/pages/index.d.mts +6 -0
- package/dist/pages/index.mjs +276 -6
- package/dist/pages/protocol.mjs +1 -1
- package/dist/platform-args-CMwMoiLp.mjs +1 -0
- package/dist/{platform-args-lwCyQ6Xy.mjs → platform-args-CvZSuhYS.mjs} +1 -1
- package/dist/{platform-auth-config-DLRMPw1G.mjs → platform-auth-config-Bv3oQ2gE.mjs} +7 -7
- package/dist/{platform-auth-protection-HSmLmD3d.mjs → platform-auth-protection-OqzfhXwx.mjs} +5 -5
- package/dist/{platform-auth-recovery-BXPhTlKa.mjs → platform-auth-recovery-rmIYjXST.mjs} +4 -4
- package/dist/{platform-cmd-CqRjxFEU.mjs → platform-cmd-B3rO4RhU.mjs} +1 -1
- package/dist/{platform-cmd-DJ-fOYhL.mjs → platform-cmd-D_4z2Ijv.mjs} +6 -6
- package/dist/{platform-domain-CRsRJOws.mjs → platform-domain-CUq9odbd.mjs} +2 -2
- package/dist/{platform-lifecycle-bx_kpqo7.mjs → platform-lifecycle-DOSYo0UI.mjs} +1 -1
- package/dist/{platform-lifecycle-fau3VKv6.mjs → platform-lifecycle-DuoVruij.mjs} +138 -43
- package/dist/{platform-management-BRGhD-oF.mjs → platform-management-D_gt3qLb.mjs} +1 -1
- package/dist/{platform-management-CnKBdDx5.mjs → platform-management-MmO9IubR.mjs} +4 -4
- package/dist/{platform-plans-config-2C3_5EDs.mjs → platform-plans-config-DiydtNKY.mjs} +3 -3
- package/dist/{platform-recovery-poxgOOAY.mjs → platform-recovery-P_FVslfd.mjs} +2 -2
- package/dist/{platform-setup-DYylapHD.mjs → platform-setup-Lph9i-rh.mjs} +1 -1
- package/dist/{plugin-inference-7O11_E4H.mjs → plugin-inference-COlq96WJ.mjs} +2 -27
- package/dist/prepare-DcwigRUS.mjs +1 -0
- package/dist/{prepare-DWjn1Lzd.mjs → prepare-WvijE289.mjs} +1 -1
- package/dist/{prepare-BbvlKreR.mjs → prepare-co1o1FFd.mjs} +1 -1
- package/dist/{project-cmd-DyUEFi2b.mjs → project-cmd-BWJTplpc.mjs} +18 -18
- package/dist/{project-security-DZEQgnsS.mjs → project-security-BV1xfj1K.mjs} +1 -1
- package/dist/{project-security--tYGFPGo.mjs → project-security-CY_aahvW.mjs} +2 -2
- package/dist/{project-team-BszTHgzC.mjs → project-team-BlIFXlmT.mjs} +2 -2
- package/dist/{project-token-DBDy4NdV.mjs → project-token-CMsB7I1-.mjs} +2 -2
- package/dist/{project-zero-trust-D9sUouij.mjs → project-zero-trust-BI6pdpx4.mjs} +2 -2
- package/dist/{protocol-CE3wP-H1.mjs → protocol-4rEnumif.mjs} +10 -3
- package/dist/{redirect-DD825Stf.mjs → redirect-Dyvuil0Q.mjs} +5 -2
- package/dist/{requests-CBokjiOi.mjs → requests-CfmJxNYg.mjs} +2 -2
- package/dist/{rollback-CEeHNFUn.mjs → rollback-DL5HuAsM.mjs} +3 -3
- package/dist/{runner-mysql-3XDKrn-g.mjs → runner-mysql-D549vGGm.mjs} +2 -1
- package/dist/{runner-mysql-r688x6Y9.mjs → runner-mysql-DOjbj-N1.mjs} +1 -1
- package/dist/runtime/db/migrations/mysql-handler.mjs +2 -1
- package/dist/runtime/routing/index.mjs +2 -2
- package/dist/{secret-Deqo3n_N.mjs → secret-C-WBaUSS.mjs} +3 -3
- package/docs/guide/jobs.md +1 -1
- package/docs/guide/pages-routing/actions-and-forms.md +36 -15
- package/docs/guide/pages-routing/errors.md +3 -1
- package/docs/guide/pages-routing/overview.md +20 -0
- package/docs/guide/platform/administration/zero-trust.md +1 -1
- package/docs/guide/platform/installation/maintenance.md +5 -3
- package/docs/guide/queues.md +1 -1
- package/docs/integrations/frameworks/sveltekit.md +1 -1
- package/docs/reference/api/pages.md +4 -0
- package/docs/reference/cli/database.md +42 -6
- package/docs/reference/cli/platform-security.md +1 -1
- package/docs/reference/cli/platform-zero-trust.md +4 -3
- package/docs/reference/cli/setup.md +4 -0
- package/package.json +7 -7
- package/dist/cf-build-output-Dy7N0hQN.mjs +0 -1
- package/dist/cloudflare-operations-dpRD-2Px.mjs +0 -1
- package/dist/gen-CQDiPi8m.mjs +0 -1
- package/dist/help-Dy3w4rPq.mjs +0 -1
- package/dist/login-DWCZeCX9.mjs +0 -1
- package/dist/operator-cmd-DEnHFmJF.mjs +0 -1
- package/dist/platform-args-DNbNZ_RR.mjs +0 -1
- package/dist/prepare-BmG2E6TI.mjs +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as hasOwnKey } from "./has-own-key-D9QEnAkF.mjs";
|
|
2
|
-
import { i as assertAiLoggingPlatform, n as aiLoggingPreviewLines, r as aiLoggingStatusLine, t as aiLoggingChangeLines } from "./operator-ai-logging-
|
|
3
|
-
import { a as resolveOperatorOrigin, i as removeOperatorToken, n as readOperatorApiTokenStdin, o as saveOperatorToken, r as readOperatorToken, t as exchangeOperatorSession } from "./operator-auth-
|
|
4
|
-
import { n as OperatorClient, r as OperatorClientError } from "./operator-client-
|
|
2
|
+
import { i as assertAiLoggingPlatform, n as aiLoggingPreviewLines, r as aiLoggingStatusLine, t as aiLoggingChangeLines } from "./operator-ai-logging-DD0n6zc2.mjs";
|
|
3
|
+
import { a as resolveOperatorOrigin, i as removeOperatorToken, n as readOperatorApiTokenStdin, o as saveOperatorToken, r as readOperatorToken, t as exchangeOperatorSession } from "./operator-auth-DMvn-y9X.mjs";
|
|
4
|
+
import { n as OperatorClient, r as OperatorClientError } from "./operator-client-dFNnXfyB.mjs";
|
|
5
5
|
import { b as sanitizeTerminalText, o as dim, y as printSuccess } from "./output-BZLnu0z8.mjs";
|
|
6
6
|
import { t as MINIMAL_RUNTIME_LOGS_NOTE } from "./platform-runtime-logs-CdJGnk3f.mjs";
|
|
7
7
|
import { t as OPEN_PUBLIC_REQUEST_STATES } from "./security-api-types-CU7zQtr_.mjs";
|
|
@@ -83,9 +83,11 @@ function humanLines(value, indent = "") {
|
|
|
83
83
|
function output(value, json) {
|
|
84
84
|
console.log(json ? JSON.stringify(value) : humanLines(value).join("\n"));
|
|
85
85
|
}
|
|
86
|
+
const ZERO_TRUST_STATUS_COMMAND = "`void platform zero-trust status`";
|
|
86
87
|
function outputMutation(result, args) {
|
|
87
88
|
output(result, args.json);
|
|
88
89
|
const configuration = result.configuration;
|
|
90
|
+
if (!args.json && args.group === "zero-trust" && (configuration?.status === "configuring" || configuration?.status === "disabling")) console.log(`Zero Trust is still applying this change. Void continues it within a few minutes; follow it with ${ZERO_TRUST_STATUS_COMMAND}.`);
|
|
89
91
|
const project = result.project;
|
|
90
92
|
const publicRequest = result.publicRequest;
|
|
91
93
|
if (args.json || publicRequest?.state !== void 0 && OPEN_PUBLIC_REQUEST_STATES.has(publicRequest.state) || result.ok === false || result.partial === true || result.complete === false || result.error || result.operationStatus && result.operationStatus !== "completed" || configuration?.status && configuration.status !== "ready" && configuration.status !== "disabled" || project?.state === "reconciling" || project?.state === "error" || project?.last_error) return;
|
|
@@ -189,9 +191,9 @@ async function runAuth(origin, args) {
|
|
|
189
191
|
if (args.action === "login" || args.action === "token" && args.tokenStdin) {
|
|
190
192
|
if (!args.tokenStdin && !process.stdin.isTTY) throw new OperatorClientError("Browser login requires an interactive terminal. Use --token-stdin to exchange an API session.", "interactive_login_required");
|
|
191
193
|
const apiToken = args.tokenStdin ? await readOperatorApiTokenStdin() : await (async () => {
|
|
192
|
-
const { discoverPlatform } = await import("./platform-cmd-
|
|
193
|
-
const { selectPlatformLoginMethod } = await import("./login-
|
|
194
|
-
const { runPlatformLogin } = await import("./auth-
|
|
194
|
+
const { discoverPlatform } = await import("./platform-cmd-B3rO4RhU.mjs");
|
|
195
|
+
const { selectPlatformLoginMethod } = await import("./login-BbSQTZ6d.mjs");
|
|
196
|
+
const { runPlatformLogin } = await import("./auth-A7cZ8aXA.mjs");
|
|
195
197
|
return runPlatformLogin(origin, (await selectPlatformLoginMethod(await discoverPlatform(origin), args.provider)).id, (url) => process.stderr.write(`Sign in at ${url}\n`));
|
|
196
198
|
})();
|
|
197
199
|
const session = await exchangeOperatorSession(origin, apiToken);
|
|
@@ -375,7 +377,7 @@ function aiLoggingProjectId(args) {
|
|
|
375
377
|
}
|
|
376
378
|
async function runOperatorCommand(args) {
|
|
377
379
|
if (!args.action) {
|
|
378
|
-
const { printHelpPage } = await import("./help-
|
|
380
|
+
const { printHelpPage } = await import("./help-fKPzcTJv.mjs");
|
|
379
381
|
printHelpPage(["platform", args.group]);
|
|
380
382
|
return;
|
|
381
383
|
}
|
|
@@ -384,7 +386,7 @@ async function runOperatorCommand(args) {
|
|
|
384
386
|
const client = new OperatorClient(origin, readOperatorToken(origin));
|
|
385
387
|
if (args.method === "POST" && !(args.group === "security" && args.action === "probe") && !args.plan && !args.yes && (!process.stdin.isTTY || !process.stderr.isTTY)) throw new OperatorClientError("Mutations in non-interactive mode require --yes or --plan.", "confirmation_required");
|
|
386
388
|
if (args.group === "security") {
|
|
387
|
-
const { runSecurityOperatorCommand } = await import("./operator-security-
|
|
389
|
+
const { runSecurityOperatorCommand } = await import("./operator-security-D5MToU0p.mjs");
|
|
388
390
|
return runSecurityOperatorCommand(client, origin, args, {
|
|
389
391
|
output,
|
|
390
392
|
outputMutation,
|
|
@@ -429,10 +431,12 @@ async function runOperatorCommand(args) {
|
|
|
429
431
|
...args.group === "project" && args.action === "normalize" ? { expected: preview.changes } : {},
|
|
430
432
|
...recoveryFence
|
|
431
433
|
};
|
|
434
|
+
const zeroTrustOperation = args.group === "zero-trust" && (args.action === "configure" || args.action === "reconcile" || args.action === "disable");
|
|
432
435
|
const result = await client.request(args.path, {
|
|
433
436
|
method: "POST",
|
|
434
437
|
body,
|
|
435
|
-
timeoutMs: args.timeoutMs
|
|
438
|
+
timeoutMs: args.timeoutMs,
|
|
439
|
+
...zeroTrustOperation ? { unknownOutcome: `Void continues a started Zero Trust change within a few minutes; follow it with ${ZERO_TRUST_STATUS_COMMAND} before retrying.` } : {}
|
|
436
440
|
});
|
|
437
441
|
if (aiLogging && !args.json) {
|
|
438
442
|
console.log(aiLoggingChangeLines(aiLoggingProjectId(args), result).join("\n"));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as OperatorClientError } from "./operator-client-
|
|
1
|
+
import { r as OperatorClientError } from "./operator-client-dFNnXfyB.mjs";
|
|
2
2
|
import { o as dim, y as printSuccess } from "./output-BZLnu0z8.mjs";
|
|
3
3
|
import { n as securityFindingsSarif, t as sarifToolVersion } from "./security-sarif-ClyYwtAW.mjs";
|
|
4
4
|
// src/cli/operator-security.ts
|
package/dist/pages/client.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { r as toUrlString, t as interpolateRouteParams } from "../route-url-B41eQ8QI.mjs";
|
|
2
2
|
import { c as searchWithoutActionKey, n as isSameOrigin, r as PRESERVED_QUERY_HEADER, t as decodePagePath, u as withPageQuery } from "../url-DBQluotE.mjs";
|
|
3
|
+
import { n as pagesBuildId } from "../build-id-4IV4hC1-.mjs";
|
|
3
4
|
import { r as parseCacheFor, t as PrefetchCache } from "../prefetch-C_OUvg5g.mjs";
|
|
4
|
-
import { t as fetchPages } from "../redirect-
|
|
5
|
+
import { t as fetchPages } from "../redirect-Dyvuil0Q.mjs";
|
|
5
6
|
import { a as serializePageData, n as decodePageData, r as deserializePageData, t as ISLAND_FRONTMATTER_ID } from "../serialize-BmB4BfKu.mjs";
|
|
6
|
-
import { PAGES_PROTOCOL_VERSION, readUsageLimit } from "@void/edge";
|
|
7
|
+
import { PAGES_BUILD_HEADER, PAGES_PROTOCOL_VERSION, buildHeaders, isStaleBuild, readUsageLimit } from "@void/edge";
|
|
7
8
|
// src/pages/action-result.ts
|
|
8
9
|
var VoidActionError = class extends Error {
|
|
9
10
|
body;
|
|
@@ -99,7 +100,7 @@ function clientPageError(error, dev = false) {
|
|
|
99
100
|
/** Terminal recovery cannot depend on the failed adapter, imports, or component tree. */
|
|
100
101
|
function showTerminalPageError(url = window.location.href) {
|
|
101
102
|
const target = new URL(url, window.location.href);
|
|
102
|
-
if (target
|
|
103
|
+
if (!isSameOrigin(target, window.location.origin)) throw new Error("Invalid error page destination");
|
|
103
104
|
try {
|
|
104
105
|
history.replaceState(history.state, "", target.href);
|
|
105
106
|
} catch {}
|
|
@@ -367,6 +368,42 @@ async function skipCommit() {
|
|
|
367
368
|
function abortError() {
|
|
368
369
|
return new DOMException("Navigation aborted", "AbortError");
|
|
369
370
|
}
|
|
371
|
+
const DEPLOY_RELOAD_KEY = "__void_pages_deploy_reload";
|
|
372
|
+
/** A reload that lands on the same stale build must not reload again. */
|
|
373
|
+
const DEPLOY_RELOAD_WINDOW_MS = 1e4;
|
|
374
|
+
/**
|
|
375
|
+
* Claims the one reload this tab may spend to recover `url` from `build`. Returns
|
|
376
|
+
* false when that reload already happened: a cache can keep serving the document
|
|
377
|
+
* from the old build, and reloading it again would loop.
|
|
378
|
+
*/
|
|
379
|
+
function claimDeployReload(build, url) {
|
|
380
|
+
try {
|
|
381
|
+
const now = Date.now();
|
|
382
|
+
const previous = JSON.parse(sessionStorage.getItem(DEPLOY_RELOAD_KEY) ?? "null");
|
|
383
|
+
if (previous?.build === build && previous.url === url && typeof previous.at === "number" && now - previous.at < DEPLOY_RELOAD_WINDOW_MS) return false;
|
|
384
|
+
sessionStorage.setItem(DEPLOY_RELOAD_KEY, JSON.stringify({
|
|
385
|
+
build,
|
|
386
|
+
url,
|
|
387
|
+
at: now
|
|
388
|
+
}));
|
|
389
|
+
} catch {}
|
|
390
|
+
return true;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Loads `url` as a new document. Setting `location.href` to the current URL with
|
|
394
|
+
* a fragment only scrolls, and that is the URL a refresh or a back/forward visit
|
|
395
|
+
* asks for, so that case reloads the page instead.
|
|
396
|
+
*/
|
|
397
|
+
function loadDocument(url) {
|
|
398
|
+
const { origin, pathname, search, hash } = window.location;
|
|
399
|
+
const target = new URL(url, `${origin}${pathname}${search}`);
|
|
400
|
+
if (!(isSameOrigin(target, origin) && target.pathname === pathname && target.search === search) || target.hash === "") {
|
|
401
|
+
window.location.href = url;
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
if (target.hash !== hash) history.replaceState(history.state, "", url);
|
|
405
|
+
window.location.reload();
|
|
406
|
+
}
|
|
370
407
|
function abortSignalPromise(signal) {
|
|
371
408
|
if (signal.aborted) return Promise.reject(abortError());
|
|
372
409
|
return new Promise((_resolve, reject) => {
|
|
@@ -406,6 +443,7 @@ async function createPageNavigationEngine(config) {
|
|
|
406
443
|
const hasBoundaries = Object.keys(config.boundaryManifest?.plans ?? {}).length > 0;
|
|
407
444
|
const _prefetchCache = new PrefetchCache();
|
|
408
445
|
const uncachedPayloads = /* @__PURE__ */ new WeakSet();
|
|
446
|
+
const stalePrefetches = /* @__PURE__ */ new Map();
|
|
409
447
|
let _nextNavigationId = 0;
|
|
410
448
|
let _urlNavigationId = 0;
|
|
411
449
|
let _pendingResource = null;
|
|
@@ -611,6 +649,7 @@ async function createPageNavigationEngine(config) {
|
|
|
611
649
|
const headers = {
|
|
612
650
|
"X-VoidPages": "true",
|
|
613
651
|
"X-VoidPages-Version": PAGES_PROTOCOL_VERSION,
|
|
652
|
+
...buildHeaders(pagesBuildId()),
|
|
614
653
|
Accept: "application/json",
|
|
615
654
|
Purpose: "prefetch"
|
|
616
655
|
};
|
|
@@ -622,6 +661,11 @@ async function createPageNavigationEngine(config) {
|
|
|
622
661
|
}).then(async (result) => {
|
|
623
662
|
const r = result?.response;
|
|
624
663
|
if (!r || result?.redirectedTo) return null;
|
|
664
|
+
const servedBy = r.headers.get(PAGES_BUILD_HEADER);
|
|
665
|
+
if (servedBy !== null && isStaleBuild(pagesBuildId(), servedBy)) {
|
|
666
|
+
stalePrefetches.set(url, servedBy);
|
|
667
|
+
return null;
|
|
668
|
+
}
|
|
625
669
|
if (!r.headers.get("X-VoidPages")) return (await loadStaticPageData(url, r, void 0, !STATIC_PAGE_DATA_FAST_PATH))?.pageData ?? null;
|
|
626
670
|
const data = decodePageData(await r.json());
|
|
627
671
|
if (!r.ok || /no-store/i.test(r.headers.get("Cache-Control") ?? "")) uncachedPayloads.add(data);
|
|
@@ -653,6 +697,7 @@ async function createPageNavigationEngine(config) {
|
|
|
653
697
|
const headers = {
|
|
654
698
|
"X-VoidPages": "true",
|
|
655
699
|
"X-VoidPages-Version": PAGES_PROTOCOL_VERSION,
|
|
700
|
+
...buildHeaders(pagesBuildId()),
|
|
656
701
|
Accept: "application/json"
|
|
657
702
|
};
|
|
658
703
|
if (options._preservedQuery && method !== "GET") headers[PRESERVED_QUERY_HEADER] = options._preservedQuery;
|
|
@@ -675,7 +720,14 @@ async function createPageNavigationEngine(config) {
|
|
|
675
720
|
const cachedPageData = await cacheEntry.response;
|
|
676
721
|
_prefetchCache.consume(fetchUrl, method);
|
|
677
722
|
if (cachedPageData === null) {
|
|
678
|
-
|
|
723
|
+
if (signal.aborted) throw abortError();
|
|
724
|
+
const staleBuild = stalePrefetches.get(fetchUrl);
|
|
725
|
+
stalePrefetches.delete(fetchUrl);
|
|
726
|
+
if (staleBuild !== void 0 && !claimDeployReload(staleBuild, url)) {
|
|
727
|
+
showTerminalPageError(url);
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
loadDocument(url);
|
|
679
731
|
return;
|
|
680
732
|
}
|
|
681
733
|
pageData = clonePageData(cachedPageData);
|
|
@@ -696,9 +748,10 @@ async function createPageNavigationEngine(config) {
|
|
|
696
748
|
}
|
|
697
749
|
}
|
|
698
750
|
const fetched = pageData === void 0 ? method === "GET" ? await fetchPageResponse(url, fetchOptions) : await fetchPages(url, fetchOptions) : null;
|
|
699
|
-
|
|
751
|
+
let response = fetched?.response ?? null;
|
|
752
|
+
const answeredMethod = fetched?.method ?? method;
|
|
700
753
|
if (pageData === void 0 && !response) {
|
|
701
|
-
|
|
754
|
+
loadDocument(url);
|
|
702
755
|
return;
|
|
703
756
|
}
|
|
704
757
|
if (fetched?.redirectedTo) {
|
|
@@ -714,6 +767,21 @@ async function createPageNavigationEngine(config) {
|
|
|
714
767
|
commitTarget.hash = redirectUrl.hash;
|
|
715
768
|
commitTarget.method = method;
|
|
716
769
|
}
|
|
770
|
+
const servedBy = response?.headers.get(PAGES_BUILD_HEADER) ?? null;
|
|
771
|
+
if (answeredMethod === "GET" && servedBy !== null && isStaleBuild(pagesBuildId(), servedBy)) {
|
|
772
|
+
if (signal.aborted) throw abortError();
|
|
773
|
+
if (claimDeployReload(servedBy, url)) {
|
|
774
|
+
response = null;
|
|
775
|
+
pageData = void 0;
|
|
776
|
+
} else {
|
|
777
|
+
showTerminalPageError(url);
|
|
778
|
+
return;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
if (pageData === void 0 && !response) {
|
|
782
|
+
loadDocument(url);
|
|
783
|
+
return;
|
|
784
|
+
}
|
|
717
785
|
if (response && method !== "GET" && !response.ok) throw await createActionErrorFromResponse(response, fetchUrl);
|
|
718
786
|
if (response && !response.headers.get("X-VoidPages")) {
|
|
719
787
|
if (method === "GET") {
|
|
@@ -722,7 +790,7 @@ async function createPageNavigationEngine(config) {
|
|
|
722
790
|
pageData = staticPageData.pageData;
|
|
723
791
|
deferredRegistry.setup(pageData, staticPageData.resolvedDeferred);
|
|
724
792
|
} else {
|
|
725
|
-
|
|
793
|
+
loadDocument(url);
|
|
726
794
|
return;
|
|
727
795
|
}
|
|
728
796
|
} else {
|
|
@@ -732,7 +800,7 @@ async function createPageNavigationEngine(config) {
|
|
|
732
800
|
}
|
|
733
801
|
const contentType = response?.headers.get("content-type") || "";
|
|
734
802
|
if (pageData !== void 0) {} else if (!response) {
|
|
735
|
-
|
|
803
|
+
loadDocument(url);
|
|
736
804
|
return;
|
|
737
805
|
} else if (contentType.includes("application/x-ndjson")) {
|
|
738
806
|
if (!response.body) throw new Error("pages: Missing response body for streamed page data.");
|
|
@@ -786,7 +854,7 @@ async function createPageNavigationEngine(config) {
|
|
|
786
854
|
commitTarget.fetchUrl = withoutActionKey(fetchUrl, pageData.url);
|
|
787
855
|
}
|
|
788
856
|
if (!components[pageData.component]) {
|
|
789
|
-
|
|
857
|
+
loadDocument(url);
|
|
790
858
|
return;
|
|
791
859
|
}
|
|
792
860
|
let component;
|
package/dist/pages/index.d.mts
CHANGED
|
@@ -87,6 +87,11 @@ type PagesPluginOptions = {
|
|
|
87
87
|
root?: string;
|
|
88
88
|
viewTransitions?: boolean;
|
|
89
89
|
prefetch?: PrefetchConfig;
|
|
90
|
+
/**
|
|
91
|
+
* Reload the destination when a tab navigates against a newer deployment.
|
|
92
|
+
* Defaults to `true`. Turn it off to keep error boundaries in charge.
|
|
93
|
+
*/
|
|
94
|
+
deployRecovery?: boolean;
|
|
90
95
|
};
|
|
91
96
|
/**
|
|
92
97
|
* `prefetch` with its defaults: Links prefetch only when they ask to, with a 75 ms
|
|
@@ -96,6 +101,7 @@ export declare function resolvePrefetchConfig(prefetch: PrefetchConfig | undefin
|
|
|
96
101
|
type CreatePagesPluginOptions = {
|
|
97
102
|
name: string;
|
|
98
103
|
root?: string;
|
|
104
|
+
deployRecovery?: boolean;
|
|
99
105
|
generateRenderer: (scan: PageScanResult, isDev: boolean) => string;
|
|
100
106
|
generateClient: (scan: PageScanResult, staticPageData: StaticPageDataBuildOptions) => string;
|
|
101
107
|
config: (context: PagesPluginContext) => UserConfig | void | Promise<UserConfig | void>;
|
package/dist/pages/index.mjs
CHANGED
|
@@ -1,13 +1,227 @@
|
|
|
1
1
|
import { l as resolveNamedLayout, n as scanPages, o as resolveEffectiveLayoutChain, r as generateComponentManifest, s as resolveLayoutChain, t as pageFileEnvironment } from "../scan-Ct_SEzH4.mjs";
|
|
2
2
|
import { a as resolveHead, i as renderHtmlAttrs, n as renderBodyAttrs, r as renderHeadToString } from "../head-BwQ5kgqt.mjs";
|
|
3
|
-
import { a as join, n as dirname } from "../dist-DMYe8CZJ.mjs";
|
|
3
|
+
import { a as join, i as isAbsolute, n as dirname, o as normalize, s as relative } from "../dist-DMYe8CZJ.mjs";
|
|
4
|
+
import { n as findInstalledPackage } from "../installed-packages-tfmYd-cC.mjs";
|
|
5
|
+
import { t as PAGES_BUILD_ID_DEFINE } from "../build-id-4IV4hC1-.mjs";
|
|
4
6
|
import { n as assertLinkPrefetchValue } from "../prefetch-C_OUvg5g.mjs";
|
|
5
7
|
import { r as parseRedirectsFile } from "../headers-DqBsjDxg.mjs";
|
|
6
8
|
import { p as readConfig } from "../config-Dv5jri1-.mjs";
|
|
7
9
|
import { a as serializePageData } from "../serialize-BmB4BfKu.mjs";
|
|
8
10
|
import { r as resolvePagesDir } from "../project-paths-2ENfCCih.mjs";
|
|
9
|
-
import { existsSync } from "node:fs";
|
|
10
|
-
import { normalizePath } from "vite";
|
|
11
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, statSync, writeFileSync } from "node:fs";
|
|
12
|
+
import { loadEnv, normalizePath, searchForWorkspaceRoot } from "vite";
|
|
13
|
+
import { createHash } from "node:crypto";
|
|
14
|
+
// src/pages/build-id-source.ts
|
|
15
|
+
/** Directories never part of the app source, whatever their position. */
|
|
16
|
+
const alwaysSkipped = /* @__PURE__ */ new Set(["node_modules"]);
|
|
17
|
+
/** Beside the generated types, which the scaffold already ignores. */
|
|
18
|
+
const CACHE_FILE = ".void/pages-build-id.json";
|
|
19
|
+
/** Workspace files that pin what the installed packages contain. */
|
|
20
|
+
const WORKSPACE_FILES = [
|
|
21
|
+
"package.json",
|
|
22
|
+
"pnpm-workspace.yaml",
|
|
23
|
+
"pnpm-lock.yaml",
|
|
24
|
+
"package-lock.json",
|
|
25
|
+
"npm-shrinkwrap.json",
|
|
26
|
+
"yarn.lock",
|
|
27
|
+
"bun.lock",
|
|
28
|
+
"bun.lockb"
|
|
29
|
+
];
|
|
30
|
+
const DEPENDENCY_FIELDS = [
|
|
31
|
+
"dependencies",
|
|
32
|
+
"devDependencies",
|
|
33
|
+
"optionalDependencies",
|
|
34
|
+
"peerDependencies"
|
|
35
|
+
];
|
|
36
|
+
const HEX_DIGITS = "0123456789abcdef";
|
|
37
|
+
/** Twelve lowercase hex digits, the shape `contentIdOf` makes. */
|
|
38
|
+
function isBuildId(value) {
|
|
39
|
+
if (typeof value !== "string" || value.length !== 12) return false;
|
|
40
|
+
for (let index = 0; index < value.length; index++) if (!HEX_DIGITS.includes(value.charAt(index))) return false;
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The id each app root got in the current build. Vite resolves the config again
|
|
45
|
+
* for every environment, with new plugin instances, and the values it sees can
|
|
46
|
+
* differ between those passes: a define such as `Date.now()`, or a file another
|
|
47
|
+
* task writes meanwhile. The first pass decides, so both bundles get one id.
|
|
48
|
+
*/
|
|
49
|
+
const currentBuildIds = /* @__PURE__ */ new Map();
|
|
50
|
+
/**
|
|
51
|
+
* A stable id for one build of an app: a hash of what its bundles are made of.
|
|
52
|
+
* Every environment of a Vite build derives the same id from the same tree,
|
|
53
|
+
* which a per-process random value cannot guarantee.
|
|
54
|
+
*
|
|
55
|
+
* The hash covers the app folder, the workspace packages it depends on (found
|
|
56
|
+
* through its installed links, transitively), and the workspace manifest and
|
|
57
|
+
* lockfile, since a dependency upgrade renames chunks without touching the app.
|
|
58
|
+
* Modules imported by a relative path from outside all of these are not seen.
|
|
59
|
+
*
|
|
60
|
+
* The id changes with any change there, including server-only ones, which
|
|
61
|
+
* reloads a stale tab that did not need it. That is the safe direction: missing
|
|
62
|
+
* a change means importing chunks that no longer exist.
|
|
63
|
+
*
|
|
64
|
+
* Hashing contents is cached across processes, keyed by file size and
|
|
65
|
+
* modification time. A write always moves the modification time, so a
|
|
66
|
+
* fingerprint that still matches describes the same content.
|
|
67
|
+
*/
|
|
68
|
+
function computePagesBuildId(root, excludeDirs, inputs = {}) {
|
|
69
|
+
root = normalize(root);
|
|
70
|
+
const current = currentBuildIds.get(root);
|
|
71
|
+
if (current !== void 0) return current;
|
|
72
|
+
const workspace = searchForWorkspaceRoot(root);
|
|
73
|
+
const excluded = new Set(excludeDirs.map((dir) => isAbsolute(dir) ? normalize(dir) : join(root, dir)));
|
|
74
|
+
const files = buildSourceFiles(root, workspace, excluded);
|
|
75
|
+
const buildInputs = `${inputs.env ?? ""}\0${inputs.define ?? ""}`;
|
|
76
|
+
const fingerprint = fingerprintOf(workspace, files, buildInputs);
|
|
77
|
+
let id = readCachedId(root, fingerprint);
|
|
78
|
+
if (id === null) {
|
|
79
|
+
id = contentIdOf(workspace, files, buildInputs);
|
|
80
|
+
writeCachedId(root, fingerprint, id);
|
|
81
|
+
}
|
|
82
|
+
currentBuildIds.set(root, id);
|
|
83
|
+
return id;
|
|
84
|
+
}
|
|
85
|
+
/** Ends the current build of `root`, or of every app, so the next build hashes again. */
|
|
86
|
+
function endPagesBuild(root) {
|
|
87
|
+
if (root === void 0) currentBuildIds.clear();
|
|
88
|
+
else currentBuildIds.delete(normalize(root));
|
|
89
|
+
}
|
|
90
|
+
/** Paths, relative to the workspace, of every file the id covers, sorted. */
|
|
91
|
+
function buildSourceFiles(root, workspace, excluded) {
|
|
92
|
+
const files = /* @__PURE__ */ new Set();
|
|
93
|
+
const add = (directory) => {
|
|
94
|
+
for (const file of sourceFiles(directory, excluded)) files.add(relative(workspace, file));
|
|
95
|
+
};
|
|
96
|
+
add(root);
|
|
97
|
+
for (const directory of workspaceDependencies(root, workspace)) add(directory);
|
|
98
|
+
if (workspace !== root) {
|
|
99
|
+
for (const name of WORKSPACE_FILES) if (existsSync(join(workspace, name))) files.add(name);
|
|
100
|
+
}
|
|
101
|
+
return [...files].sort();
|
|
102
|
+
}
|
|
103
|
+
/** Real path, or null when it cannot be resolved. */
|
|
104
|
+
function realPath(path) {
|
|
105
|
+
try {
|
|
106
|
+
return realpathSync(path);
|
|
107
|
+
} catch {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function dependencyNames(directory) {
|
|
112
|
+
try {
|
|
113
|
+
const manifest = JSON.parse(readFileSync(join(directory, "package.json"), "utf8"));
|
|
114
|
+
const names = [];
|
|
115
|
+
for (const field of DEPENDENCY_FIELDS) {
|
|
116
|
+
const deps = manifest[field];
|
|
117
|
+
if (deps !== null && typeof deps === "object") names.push(...Object.keys(deps));
|
|
118
|
+
}
|
|
119
|
+
return names;
|
|
120
|
+
} catch {
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Folders of the workspace packages `root` depends on, directly or through other
|
|
126
|
+
* workspace packages. Package managers link them into node_modules, or Yarn
|
|
127
|
+
* Plug'n'Play maps them, and they lie in the workspace outside any node_modules.
|
|
128
|
+
*/
|
|
129
|
+
function workspaceDependencies(root, workspace) {
|
|
130
|
+
const realWorkspace = realPath(workspace);
|
|
131
|
+
const realRoot = realPath(root);
|
|
132
|
+
if (realWorkspace === null || realRoot === null) return [];
|
|
133
|
+
const seen = /* @__PURE__ */ new Set([realRoot]);
|
|
134
|
+
const found = [];
|
|
135
|
+
const queue = [realRoot];
|
|
136
|
+
for (let directory = queue.shift(); directory !== void 0; directory = queue.shift()) for (const name of dependencyNames(directory)) {
|
|
137
|
+
const installed = findInstalledPackage(name, directory);
|
|
138
|
+
const target = installed === void 0 ? null : realPath(installed) ?? installed;
|
|
139
|
+
if (target === null || seen.has(target)) continue;
|
|
140
|
+
const inWorkspace = relative(realWorkspace, target);
|
|
141
|
+
if (inWorkspace.startsWith("..") || isAbsolute(inWorkspace) || inWorkspace.split("/").includes("node_modules")) continue;
|
|
142
|
+
seen.add(target);
|
|
143
|
+
found.push(join(workspace, inWorkspace));
|
|
144
|
+
queue.push(target);
|
|
145
|
+
}
|
|
146
|
+
return found;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Dot directories hold tool state (.git, .void, .wrangler), and .env files hold
|
|
150
|
+
* local settings, whose client values reach the id through `inputs.env`. Other
|
|
151
|
+
* dot files can configure the build (.postcssrc, .browserslistrc), so they count.
|
|
152
|
+
*/
|
|
153
|
+
function isSkipped(name, isDirectory) {
|
|
154
|
+
if (alwaysSkipped.has(name)) return true;
|
|
155
|
+
if (!name.startsWith(".")) return false;
|
|
156
|
+
return isDirectory || name.startsWith(".env") || name === ".DS_Store";
|
|
157
|
+
}
|
|
158
|
+
/** Absolute paths of the files under `directory` that describe it. */
|
|
159
|
+
function sourceFiles(directory, excluded) {
|
|
160
|
+
const files = [];
|
|
161
|
+
const walk = (current) => {
|
|
162
|
+
let entries;
|
|
163
|
+
try {
|
|
164
|
+
entries = readdirSync(current, { withFileTypes: true });
|
|
165
|
+
} catch {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
for (const entry of entries) {
|
|
169
|
+
if (isSkipped(entry.name, entry.isDirectory())) continue;
|
|
170
|
+
const path = join(current, entry.name);
|
|
171
|
+
if (excluded.has(path)) continue;
|
|
172
|
+
if (entry.isDirectory()) walk(path);
|
|
173
|
+
else if (entry.isFile()) files.push(path);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
walk(directory);
|
|
177
|
+
return files;
|
|
178
|
+
}
|
|
179
|
+
function fingerprintOf(workspace, files, inputs) {
|
|
180
|
+
const hash = createHash("sha256");
|
|
181
|
+
hash.update(inputs);
|
|
182
|
+
hash.update("\0");
|
|
183
|
+
for (const file of files) try {
|
|
184
|
+
const stats = statSync(join(workspace, file));
|
|
185
|
+
hash.update(`${file}\0${stats.size}\0${stats.mtimeMs}\0`);
|
|
186
|
+
} catch {
|
|
187
|
+
hash.update(`${file}\0-\0`);
|
|
188
|
+
}
|
|
189
|
+
return hash.digest("hex");
|
|
190
|
+
}
|
|
191
|
+
function contentIdOf(workspace, files, inputs) {
|
|
192
|
+
const hash = createHash("sha256");
|
|
193
|
+
hash.update(inputs);
|
|
194
|
+
hash.update("\0");
|
|
195
|
+
for (const file of files) {
|
|
196
|
+
hash.update(file);
|
|
197
|
+
hash.update("\0");
|
|
198
|
+
try {
|
|
199
|
+
hash.update(readFileSync(join(workspace, file)));
|
|
200
|
+
} catch {
|
|
201
|
+
hash.update("-");
|
|
202
|
+
}
|
|
203
|
+
hash.update("\0");
|
|
204
|
+
}
|
|
205
|
+
return hash.digest("hex").slice(0, 12);
|
|
206
|
+
}
|
|
207
|
+
/** The last id, when the tree still looks the way it did when the id was made. */
|
|
208
|
+
function readCachedId(root, fingerprint) {
|
|
209
|
+
try {
|
|
210
|
+
const entry = JSON.parse(readFileSync(join(root, CACHE_FILE), "utf8"));
|
|
211
|
+
if (entry.fingerprint === fingerprint && isBuildId(entry.id)) return entry.id;
|
|
212
|
+
} catch {}
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
function writeCachedId(root, fingerprint, id) {
|
|
216
|
+
try {
|
|
217
|
+
const path = join(root, CACHE_FILE);
|
|
218
|
+
mkdirSync(join(root, ".void"), { recursive: true });
|
|
219
|
+
writeFileSync(path, JSON.stringify({
|
|
220
|
+
fingerprint,
|
|
221
|
+
id
|
|
222
|
+
}));
|
|
223
|
+
} catch {}
|
|
224
|
+
}
|
|
11
225
|
// src/pages/static-data.ts
|
|
12
226
|
function resolveStaticPageDataBuildOptions(root, options = {}) {
|
|
13
227
|
const config = readConfig(root);
|
|
@@ -41,6 +255,42 @@ function resolvePrefetchConfig(prefetch) {
|
|
|
41
255
|
cacheFor: prefetch?.cacheFor ?? "30s"
|
|
42
256
|
};
|
|
43
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
* The files that are not app source: the build output of every environment, and
|
|
260
|
+
* assets that never take part in a chunk hash.
|
|
261
|
+
*/
|
|
262
|
+
function buildIdExcludes(root, userConfig) {
|
|
263
|
+
const dirs = /* @__PURE__ */ new Set(["dist"]);
|
|
264
|
+
const add = (dir) => {
|
|
265
|
+
if (typeof dir === "string") dirs.add(dir);
|
|
266
|
+
};
|
|
267
|
+
add(userConfig.build?.outDir);
|
|
268
|
+
for (const environment of Object.values(userConfig.environments ?? {})) add(environment?.build?.outDir);
|
|
269
|
+
add(userConfig.publicDir === void 0 ? "public" : userConfig.publicDir);
|
|
270
|
+
return [...dirs].map((dir) => isAbsolute(dir) ? dir : join(root, dir));
|
|
271
|
+
}
|
|
272
|
+
/** Entries sorted by key, so the order they were written in does not change the id. */
|
|
273
|
+
function sortedEntries(record) {
|
|
274
|
+
return Object.entries(record).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Values the client bundle inlines without appearing in a source file: the
|
|
278
|
+
* env vars Vite exposes, and the app's `define` entries. Two builds that differ
|
|
279
|
+
* only here still emit different chunks, so the id has to cover them.
|
|
280
|
+
*/
|
|
281
|
+
function clientBuildInputs(root, userConfig, mode) {
|
|
282
|
+
const { envDir } = userConfig;
|
|
283
|
+
const env = loadEnv(mode, typeof envDir === "string" ? isAbsolute(envDir) ? envDir : join(root, envDir) : envDir ?? root, [.../* @__PURE__ */ new Set(["VITE_", ...[userConfig.envPrefix ?? []].flat()])]);
|
|
284
|
+
return {
|
|
285
|
+
env: JSON.stringify([
|
|
286
|
+
sortedEntries(env),
|
|
287
|
+
mode,
|
|
288
|
+
userConfig.base ?? null,
|
|
289
|
+
process.env.NODE_ENV ?? null
|
|
290
|
+
]),
|
|
291
|
+
define: JSON.stringify([sortedEntries(userConfig.define ?? {}), sortedEntries(userConfig.environments?.client?.define ?? {})])
|
|
292
|
+
};
|
|
293
|
+
}
|
|
44
294
|
/** Shared Vite lifecycle; adapters own their generated code and environment configuration. */
|
|
45
295
|
function createPagesPlugin(pagesDir, options) {
|
|
46
296
|
let pageScan = null;
|
|
@@ -117,16 +367,36 @@ function createPagesPlugin(pagesDir, options) {
|
|
|
117
367
|
configResolved(config) {
|
|
118
368
|
viteConfig = config;
|
|
119
369
|
},
|
|
120
|
-
|
|
121
|
-
|
|
370
|
+
buildApp: {
|
|
371
|
+
order: "post",
|
|
372
|
+
async handler() {
|
|
373
|
+
endPagesBuild(root);
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
config(userConfig, env) {
|
|
377
|
+
const dev = env.command === "serve";
|
|
378
|
+
isDev = dev;
|
|
122
379
|
if (!existsSync(pagesDir)) return;
|
|
123
|
-
|
|
380
|
+
const pagesConfig = options.config({
|
|
124
381
|
isDev,
|
|
125
382
|
async scan() {
|
|
126
383
|
await runRescan();
|
|
127
384
|
return pageScan;
|
|
128
385
|
}
|
|
129
386
|
});
|
|
387
|
+
const withBuildId = (resolved) => {
|
|
388
|
+
if (dev || resolved === null || resolved === void 0 || options.deployRecovery === false) return resolved;
|
|
389
|
+
if (userConfig.define?.["import.meta.env.__VOID_PAGES_BUILD_ID"] !== void 0) return resolved;
|
|
390
|
+
const buildId = computePagesBuildId(root, buildIdExcludes(root, userConfig), clientBuildInputs(root, userConfig, env.mode));
|
|
391
|
+
return {
|
|
392
|
+
...resolved,
|
|
393
|
+
define: {
|
|
394
|
+
...resolved.define,
|
|
395
|
+
[PAGES_BUILD_ID_DEFINE]: JSON.stringify(buildId)
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
return pagesConfig instanceof Promise ? pagesConfig.then(withBuildId) : withBuildId(pagesConfig);
|
|
130
400
|
}
|
|
131
401
|
};
|
|
132
402
|
}
|
package/dist/pages/protocol.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { t as ValidationError } from "../validation-error-CtcAvyI7.mjs";
|
|
2
|
-
import { a as safeJsonStringify, i as recoverPageHttpException, n as handlePageGet, r as handlePageMutation, t as flattenValidationErrors } from "../protocol-
|
|
2
|
+
import { a as safeJsonStringify, i as recoverPageHttpException, n as handlePageGet, r as handlePageMutation, t as flattenValidationErrors } from "../protocol-4rEnumif.mjs";
|
|
3
3
|
export { ValidationError, flattenValidationErrors, handlePageGet, handlePageMutation, recoverPageHttpException, safeJsonStringify };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as parsePlatformArgs } from "./platform-args-CvZSuhYS.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as operatorGroups, r as parseOperatorArgs } from "./operator-args-
|
|
1
|
+
import { n as operatorGroups, r as parseOperatorArgs } from "./operator-args-nvetCWuz.mjs";
|
|
2
2
|
import { R2_LOCATION_HINTS, isR2LocationHint } from "@void/deploy-core";
|
|
3
3
|
import { PLATFORM_LOGIN_KINDS, normalizePlatformDashboardUrl, parsePlatformLoginId } from "@void/platform";
|
|
4
4
|
import { parsePlanSecurityCapInput } from "@void/platform/security-policy";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { A as confirm, K as select, U as password, X as text, z as multiselect } from "./dist-Cr_xGE_K.mjs";
|
|
2
|
-
import { u as openBrowser } from "./auth-
|
|
3
|
-
import { a as resolveOperatorOrigin, r as readOperatorToken } from "./operator-auth-
|
|
4
|
-
import { n as OperatorClient } from "./operator-client-
|
|
5
|
-
import { i as humanLines } from "./operator-cmd-
|
|
2
|
+
import { u as openBrowser } from "./auth-CqwJwItO.mjs";
|
|
3
|
+
import { a as resolveOperatorOrigin, r as readOperatorToken } from "./operator-auth-DMvn-y9X.mjs";
|
|
4
|
+
import { n as OperatorClient } from "./operator-client-dFNnXfyB.mjs";
|
|
5
|
+
import { i as humanLines } from "./operator-cmd-wML5HNfS.mjs";
|
|
6
6
|
import { f as formatUrl, y as printSuccess } from "./output-BZLnu0z8.mjs";
|
|
7
|
-
import { o as platformPromptAnswer } from "./platform-setup-
|
|
7
|
+
import { o as platformPromptAnswer } from "./platform-setup-Lph9i-rh.mjs";
|
|
8
8
|
import { parsePlatformAdmissionPolicy, parsePlatformLoginConfiguration } from "@void/platform";
|
|
9
9
|
import { stripVTControlCharacters } from "node:util";
|
|
10
10
|
import { readFile } from "node:fs/promises";
|
|
@@ -142,11 +142,11 @@ async function configurationInput(args, existing) {
|
|
|
142
142
|
}
|
|
143
143
|
async function runPlatformAuthConfig(args) {
|
|
144
144
|
if (args.action === "recover") {
|
|
145
|
-
const { runPlatformAuthRecovery } = await import("./platform-auth-recovery-
|
|
145
|
+
const { runPlatformAuthRecovery } = await import("./platform-auth-recovery-rmIYjXST.mjs");
|
|
146
146
|
return runPlatformAuthRecovery(args);
|
|
147
147
|
}
|
|
148
148
|
if (args.action === "protection") {
|
|
149
|
-
const { runPlatformProtectionConfig } = await import("./platform-auth-protection-
|
|
149
|
+
const { runPlatformProtectionConfig } = await import("./platform-auth-protection-OqzfhXwx.mjs");
|
|
150
150
|
return runPlatformProtectionConfig(args);
|
|
151
151
|
}
|
|
152
152
|
const origin = resolveOperatorOrigin(args.connection);
|
package/dist/{platform-auth-protection-HSmLmD3d.mjs → platform-auth-protection-OqzfhXwx.mjs}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { A as confirm, tt as isCancel } from "./dist-Cr_xGE_K.mjs";
|
|
2
2
|
import { t as cfAccessHeaders } from "./cf-access-DmkKPcAI.mjs";
|
|
3
|
-
import { t as ensurePlatformAccessToken } from "./cf-access-
|
|
4
|
-
import { a as resolveOperatorOrigin, r as readOperatorToken } from "./operator-auth-
|
|
5
|
-
import { n as OperatorClient } from "./operator-client-
|
|
3
|
+
import { t as ensurePlatformAccessToken } from "./cf-access-DHklo7Rg.mjs";
|
|
4
|
+
import { a as resolveOperatorOrigin, r as readOperatorToken } from "./operator-auth-DMvn-y9X.mjs";
|
|
5
|
+
import { n as OperatorClient } from "./operator-client-dFNnXfyB.mjs";
|
|
6
6
|
import { y as printSuccess } from "./output-BZLnu0z8.mjs";
|
|
7
|
-
import { K as platformOperatorCredentialLabel, Q as preparePlatformAccessSetup, X as checkpointPlatformAccessResources, Z as parsePlatformAccessSetupSpec, et as PlatformCloudflareClient, n as resolvePlatformInstallDatabaseUrl, q as resolvePlatformCloudflareCredential, v as acquirePlatformDatabaseLifecycleLock } from "./platform-lifecycle-
|
|
8
|
-
import { f as verifyPlatformInstallationOwnership, u as selectAuthoritativePlatformManifest } from "./platform-management-
|
|
7
|
+
import { K as platformOperatorCredentialLabel, Q as preparePlatformAccessSetup, X as checkpointPlatformAccessResources, Z as parsePlatformAccessSetupSpec, et as PlatformCloudflareClient, n as resolvePlatformInstallDatabaseUrl, q as resolvePlatformCloudflareCredential, v as acquirePlatformDatabaseLifecycleLock } from "./platform-lifecycle-DuoVruij.mjs";
|
|
8
|
+
import { f as verifyPlatformInstallationOwnership, u as selectAuthoritativePlatformManifest } from "./platform-management-MmO9IubR.mjs";
|
|
9
9
|
import { S as writePendingInstallationSecrets, c as normalizePlatformApiUrl, m as readInstallationRecoverySecrets, p as promoteInstallationSecrets, t as acquirePlatformLifecycleLock, v as resolveInstallationManifest, x as writeInstallationManifest } from "./platform-registry-DHH6fivm.mjs";
|
|
10
10
|
import { parsePlatformAccessProtection, platformProtectionProofMessage } from "@void/platform";
|
|
11
11
|
import { createHmac } from "node:crypto";
|