@vinext/cloudflare 1.0.0-beta.5 → 1.0.0-beta.7
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/README.md +40 -1
- package/dist/cache/cdn-adapter-config.d.ts +22 -0
- package/dist/cache/cdn-adapter-config.js +47 -0
- package/dist/cache/cdn-adapter.d.ts +34 -3
- package/dist/cache/cdn-adapter.js +34 -2
- package/dist/cache/cdn-adapter.runtime.d.ts +18 -1
- package/dist/cache/cdn-adapter.runtime.js +105 -15
- package/dist/cache/cdn-build-id.d.ts +5 -0
- package/dist/cache/cdn-build-id.js +5 -0
- package/dist/cache/kv-data-adapter.runtime.js +1 -1
- package/dist/cacheability-artifact.d.ts +10 -0
- package/dist/cacheability-artifact.js +165 -0
- package/dist/cacheability-manifest-limits.d.ts +5 -0
- package/dist/cacheability-manifest-limits.js +7 -0
- package/dist/cacheability-probe.d.ts +50 -0
- package/dist/cacheability-probe.js +496 -0
- package/dist/cdn-warm.d.ts +95 -2
- package/dist/cdn-warm.js +704 -80
- package/dist/cli.js +15 -1
- package/dist/deploy-config.d.ts +5 -1
- package/dist/deploy-config.js +15 -2
- package/dist/deploy-help.js +43 -6
- package/dist/deploy.d.ts +61 -6
- package/dist/deploy.js +631 -82
- package/dist/prerender-kv-populate.js +36 -4
- package/dist/tpr.js +2 -2
- package/dist/version-deploy.d.ts +12 -9
- package/dist/version-deploy.js +24 -10
- package/dist/version-headers.d.ts +2 -0
- package/dist/version-headers.js +2 -0
- package/dist/worker-deployment-url.d.ts +7 -1
- package/dist/worker-deployment-url.js +23 -1
- package/dist/wrangler-version-metadata.d.ts +8 -0
- package/dist/wrangler-version-metadata.js +9 -0
- package/package.json +4 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createKvKeySpace } from "./cache/kv-key.js";
|
|
2
|
-
import path from "node:path";
|
|
3
2
|
import fs from "node:fs";
|
|
4
|
-
import
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { getRenderedAppRoutes, getRenderedMetadataRoutes, readPrerenderManifest } from "vinext/internal/server/prerender-manifest";
|
|
5
5
|
import { appIsrCacheKey } from "vinext/internal/server/isr-cache";
|
|
6
|
-
import { buildAppPageCacheTags } from "vinext/internal/server/app-page-cache";
|
|
6
|
+
import { buildAppPageCacheTags, buildAppRouteCacheTags } from "vinext/internal/server/app-page-cache";
|
|
7
7
|
import { normalizePregeneratedPathname } from "vinext/internal/server/pregenerated-concrete-paths";
|
|
8
|
-
import { getOutputPath, getRscOutputPath } from "vinext/internal/utils/prerender-output-paths";
|
|
8
|
+
import { getAppRouteOutputPath, getOutputPath, getRscOutputPath } from "vinext/internal/utils/prerender-output-paths";
|
|
9
9
|
//#region src/prerender-kv-populate.ts
|
|
10
10
|
/**
|
|
11
11
|
* Deploy-time KV population for App Router prerendered artifacts.
|
|
@@ -111,6 +111,38 @@ function buildPrerenderKVPairs(serverDir, options) {
|
|
|
111
111
|
}
|
|
112
112
|
routeCount++;
|
|
113
113
|
}
|
|
114
|
+
for (const route of getRenderedMetadataRoutes(manifest.routes)) {
|
|
115
|
+
const pathname = route.path ?? route.route;
|
|
116
|
+
let artifactPath;
|
|
117
|
+
try {
|
|
118
|
+
artifactPath = resolveContainedFile(prerenderDir, getAppRouteOutputPath(pathname));
|
|
119
|
+
} catch (error) {
|
|
120
|
+
console.warn(`[vinext] Skipping metadata prerender KV seed for ${pathname}: ${formatUnknownError(error)}`);
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (!fs.existsSync(artifactPath)) continue;
|
|
124
|
+
const cachePathname = normalizePregeneratedPathname(pathname);
|
|
125
|
+
if (typeof route.revalidate === "number" && route.revalidate <= 0) continue;
|
|
126
|
+
const revalidateSeconds = typeof route.revalidate === "number" ? route.revalidate : void 0;
|
|
127
|
+
const expireSeconds = typeof route.expire === "number" ? route.expire : void 0;
|
|
128
|
+
const staleSeconds = typeof route.stale === "number" && route.stale >= 0 ? route.stale : void 0;
|
|
129
|
+
const expirationTtl = revalidateSeconds === void 0 ? void 0 : ttlSeconds;
|
|
130
|
+
const tags = buildAppRouteCacheTags(cachePathname, route.tags ?? [], route.routeSegments ?? []);
|
|
131
|
+
const metadata = buildMetadata(tags);
|
|
132
|
+
const routeKey = appIsrCacheKey(cachePathname, "route", manifest.buildId);
|
|
133
|
+
pairs.push({
|
|
134
|
+
key: keySpace.entryKey(routeKey),
|
|
135
|
+
value: buildCacheEntry({
|
|
136
|
+
kind: "APP_ROUTE",
|
|
137
|
+
body: fs.readFileSync(artifactPath).toString("base64"),
|
|
138
|
+
headers: route.headers ?? {},
|
|
139
|
+
status: route.responseStatus ?? 200
|
|
140
|
+
}, tags, now, revalidateSeconds, expireSeconds, staleSeconds),
|
|
141
|
+
...expirationTtl !== void 0 ? { expiration_ttl: expirationTtl } : {},
|
|
142
|
+
...metadata ? { metadata } : {}
|
|
143
|
+
});
|
|
144
|
+
routeCount++;
|
|
145
|
+
}
|
|
114
146
|
return {
|
|
115
147
|
routeCount,
|
|
116
148
|
pairs
|
package/dist/tpr.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createKvKeySpace } from "./cache/kv-key.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
|
-
import path from "node:path";
|
|
4
3
|
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { VINEXT_REVALIDATE_HEADER } from "vinext/internal/server/headers";
|
|
5
6
|
import { spawn } from "node:child_process";
|
|
6
7
|
import { pathToFileURL } from "node:url";
|
|
7
|
-
import { VINEXT_REVALIDATE_HEADER } from "vinext/internal/server/headers";
|
|
8
8
|
import { isrCacheKey } from "vinext/internal/server/isr-cache";
|
|
9
9
|
import { buildAppPageCacheTags } from "vinext/internal/server/app-page-cache";
|
|
10
10
|
//#region src/tpr.ts
|
package/dist/version-deploy.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { execFileSync } from "node:child_process";
|
|
|
5
5
|
type WranglerVersionUploadResult = {
|
|
6
6
|
versionId: string;
|
|
7
7
|
previewUrl: string | null;
|
|
8
|
+
workerName: string | null;
|
|
8
9
|
output: string;
|
|
9
10
|
};
|
|
10
11
|
type WranglerVersionDeployResult = {
|
|
@@ -16,6 +17,7 @@ type WranglerVersionTraffic = {
|
|
|
16
17
|
percentage: number;
|
|
17
18
|
};
|
|
18
19
|
type WranglerDeploymentStatus = {
|
|
20
|
+
deploymentId: string | null;
|
|
19
21
|
versions: WranglerVersionTraffic[];
|
|
20
22
|
output: string;
|
|
21
23
|
};
|
|
@@ -24,19 +26,20 @@ type WranglerVersionArgs = {
|
|
|
24
26
|
env: string | undefined;
|
|
25
27
|
};
|
|
26
28
|
declare function parseVersionId(output: string): string | null;
|
|
29
|
+
declare function parseUploadedWorkerName(output: string): string | null;
|
|
27
30
|
declare function parseWranglerVersionUploadOutput(output: string): WranglerVersionUploadResult;
|
|
28
|
-
declare function buildWranglerVersionUploadArgs(options: Pick<DeployOptions, "preview" | "env" | "name" | "config"> & {
|
|
31
|
+
declare function buildWranglerVersionUploadArgs(options: Pick<DeployOptions, "preview" | "env" | "name" | "config" | "verbose"> & {
|
|
29
32
|
previewAlias?: string;
|
|
30
33
|
}): WranglerVersionArgs;
|
|
31
|
-
declare function buildWranglerVersionDeployArgs(versionTraffic: readonly WranglerVersionTraffic[], options: Pick<DeployOptions, "preview" | "env" | "name" | "config">): WranglerVersionArgs;
|
|
32
|
-
declare function buildWranglerDeploymentsStatusArgs(options: Pick<DeployOptions, "preview" | "env" | "name" | "config">): WranglerVersionArgs;
|
|
33
|
-
declare function buildWranglerTriggersDeployArgs(options: Pick<DeployOptions, "preview" | "env" | "name" | "config">): WranglerVersionArgs;
|
|
34
|
+
declare function buildWranglerVersionDeployArgs(versionTraffic: readonly WranglerVersionTraffic[], options: Pick<DeployOptions, "preview" | "env" | "name" | "config" | "verbose">): WranglerVersionArgs;
|
|
35
|
+
declare function buildWranglerDeploymentsStatusArgs(options: Pick<DeployOptions, "preview" | "env" | "name" | "config" | "verbose">): WranglerVersionArgs;
|
|
36
|
+
declare function buildWranglerTriggersDeployArgs(options: Pick<DeployOptions, "preview" | "env" | "name" | "config" | "verbose">): WranglerVersionArgs;
|
|
34
37
|
declare function parseWranglerDeploymentStatusOutput(output: string): WranglerDeploymentStatus;
|
|
35
|
-
declare function runWranglerVersionUpload(root: string, options: Pick<DeployOptions, "preview" | "env" | "name" | "config"> & {
|
|
38
|
+
declare function runWranglerVersionUpload(root: string, options: Pick<DeployOptions, "preview" | "env" | "name" | "config" | "verbose"> & {
|
|
36
39
|
previewAlias?: string;
|
|
37
40
|
}, execute?: typeof execFileSync): WranglerVersionUploadResult;
|
|
38
|
-
declare function runWranglerVersionDeploy(root: string, versionTraffic: readonly WranglerVersionTraffic[], options: Pick<DeployOptions, "preview" | "env" | "name" | "config">, phase?: "stage" | "promote-warmed" | "promote-uploaded", execute?: typeof execFileSync): WranglerVersionDeployResult;
|
|
39
|
-
declare function runWranglerDeploymentStatus(root: string, options: Pick<DeployOptions, "preview" | "env" | "name" | "config">, execute?: typeof execFileSync): WranglerDeploymentStatus;
|
|
40
|
-
declare function runWranglerTriggersDeploy(root: string, options: Pick<DeployOptions, "preview" | "env" | "name" | "config">, execute?: typeof execFileSync): WranglerVersionDeployResult;
|
|
41
|
+
declare function runWranglerVersionDeploy(root: string, versionTraffic: readonly WranglerVersionTraffic[], options: Pick<DeployOptions, "preview" | "env" | "name" | "config" | "verbose">, phase?: "stage" | "promote-warmed" | "promote-uploaded", execute?: typeof execFileSync): WranglerVersionDeployResult;
|
|
42
|
+
declare function runWranglerDeploymentStatus(root: string, options: Pick<DeployOptions, "preview" | "env" | "name" | "config" | "verbose">, execute?: typeof execFileSync): WranglerDeploymentStatus;
|
|
43
|
+
declare function runWranglerTriggersDeploy(root: string, options: Pick<DeployOptions, "preview" | "env" | "name" | "config" | "verbose">, execute?: typeof execFileSync): WranglerVersionDeployResult;
|
|
41
44
|
//#endregion
|
|
42
|
-
export { WranglerDeploymentStatus, WranglerVersionDeployResult, WranglerVersionTraffic, WranglerVersionUploadResult, buildWranglerDeploymentsStatusArgs, buildWranglerTriggersDeployArgs, buildWranglerVersionDeployArgs, buildWranglerVersionUploadArgs, parseVersionId, parseWorkersDevUrl, parseWranglerDeploymentStatusOutput, parseWranglerVersionUploadOutput, runWranglerDeploymentStatus, runWranglerTriggersDeploy, runWranglerVersionDeploy, runWranglerVersionUpload };
|
|
45
|
+
export { WranglerDeploymentStatus, WranglerVersionDeployResult, WranglerVersionTraffic, WranglerVersionUploadResult, buildWranglerDeploymentsStatusArgs, buildWranglerTriggersDeployArgs, buildWranglerVersionDeployArgs, buildWranglerVersionUploadArgs, parseUploadedWorkerName, parseVersionId, parseWorkersDevUrl, parseWranglerDeploymentStatusOutput, parseWranglerVersionUploadOutput, runWranglerDeploymentStatus, runWranglerTriggersDeploy, runWranglerVersionDeploy, runWranglerVersionUpload };
|
package/dist/version-deploy.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { parseWorkersDevUrl } from "./workers-dev-url.js";
|
|
2
|
+
import { parseCdnWarmupDeploymentUrl } from "./worker-deployment-url.js";
|
|
2
3
|
import { buildNodeCliInvocation, resolveWranglerBin, validateWranglerEnvName } from "./deploy.js";
|
|
3
4
|
import { execFileSync } from "node:child_process";
|
|
4
5
|
//#region src/version-deploy.ts
|
|
@@ -56,16 +57,24 @@ function findPreviewUrlInUploadJson(parsed) {
|
|
|
56
57
|
]);
|
|
57
58
|
}
|
|
58
59
|
function parseVersionId(output) {
|
|
59
|
-
|
|
60
|
+
const versionIdPattern = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}";
|
|
61
|
+
const labeledVersionId = output.match(new RegExp(`Worker\\s+Version\\s+ID\\s*:\\s*(${versionIdPattern})\\b`, "i"))?.[1];
|
|
62
|
+
if (labeledVersionId) return labeledVersionId;
|
|
63
|
+
return output.match(new RegExp(`\\b${versionIdPattern}\\b`))?.[0] ?? null;
|
|
64
|
+
}
|
|
65
|
+
function parseUploadedWorkerName(output) {
|
|
66
|
+
return output.match(/^\s*Uploaded\s+(\S+)\s+\(\d+(?:\.\d+)?\s+sec\)\s*$/im)?.[1] ?? null;
|
|
60
67
|
}
|
|
61
68
|
function parseWranglerVersionUploadOutput(output) {
|
|
62
69
|
const parsed = parseJsonObject(output);
|
|
63
70
|
const versionId = findVersionIdInUploadJson(parsed) ?? parseVersionId(output);
|
|
64
71
|
const previewUrl = findPreviewUrlInUploadJson(parsed) ?? parseWorkersDevUrl(output);
|
|
72
|
+
const workerName = parseUploadedWorkerName(output);
|
|
65
73
|
if (!versionId) throw new Error("Could not detect Worker version ID from `wrangler versions upload` output.");
|
|
66
74
|
return {
|
|
67
75
|
versionId,
|
|
68
76
|
previewUrl,
|
|
77
|
+
workerName,
|
|
69
78
|
output
|
|
70
79
|
};
|
|
71
80
|
}
|
|
@@ -123,7 +132,7 @@ function buildWranglerTriggersDeployArgs(options) {
|
|
|
123
132
|
env
|
|
124
133
|
};
|
|
125
134
|
}
|
|
126
|
-
function runWranglerCommand(root, args, execute = execFileSync) {
|
|
135
|
+
function runWranglerCommand(root, args, execute = execFileSync, verbose = false) {
|
|
127
136
|
const invocation = buildNodeCliInvocation(resolveWranglerBin(root), args);
|
|
128
137
|
const execOpts = {
|
|
129
138
|
cwd: root,
|
|
@@ -132,7 +141,7 @@ function runWranglerCommand(root, args, execute = execFileSync) {
|
|
|
132
141
|
shell: false
|
|
133
142
|
};
|
|
134
143
|
const output = execute(invocation.file, invocation.args, execOpts);
|
|
135
|
-
if (output.trim()) for (const line of output.trim().split("\n")) console.log(` ${line}`);
|
|
144
|
+
if (verbose && output.trim()) for (const line of output.trim().split("\n")) console.log(` ${line}`);
|
|
136
145
|
return output;
|
|
137
146
|
}
|
|
138
147
|
function errorText(error) {
|
|
@@ -176,6 +185,11 @@ function parseWranglerDeploymentStatusOutput(output) {
|
|
|
176
185
|
const parsed = parseJsonObject(output);
|
|
177
186
|
if (!parsed) throw new Error("Could not parse `wrangler deployments status --json` output.");
|
|
178
187
|
return {
|
|
188
|
+
deploymentId: findStringInRecord(Array.isArray(parsed) ? parsed.at(-1) : parsed, [
|
|
189
|
+
"id",
|
|
190
|
+
"deployment_id",
|
|
191
|
+
"deploymentId"
|
|
192
|
+
]),
|
|
179
193
|
versions: parseDeploymentVersions(parsed),
|
|
180
194
|
output
|
|
181
195
|
};
|
|
@@ -185,7 +199,7 @@ function runWranglerVersionUpload(root, options, execute = execFileSync) {
|
|
|
185
199
|
if (env) console.log(`\n Uploading Worker version for env: ${env}...`);
|
|
186
200
|
else console.log("\n Uploading Worker version for production...");
|
|
187
201
|
try {
|
|
188
|
-
return parseWranglerVersionUploadOutput(runWranglerCommand(root, args, execute));
|
|
202
|
+
return parseWranglerVersionUploadOutput(runWranglerCommand(root, args, execute, options.verbose === true));
|
|
189
203
|
} catch (error) {
|
|
190
204
|
if (isMissingWorkerVersionUploadError(error)) throw withInitialDeployRequiredMessage();
|
|
191
205
|
throw error;
|
|
@@ -197,7 +211,7 @@ function runWranglerVersionDeploy(root, versionTraffic, options, phase = "promot
|
|
|
197
211
|
if (phase === "stage") console.log(`\n Staging uploaded Worker version at 0% for CDN warmup in ${target}...`);
|
|
198
212
|
else if (phase === "promote-warmed") console.log(`\n Promoting warmed Worker version to ${target}...`);
|
|
199
213
|
else console.log(`\n Promoting uploaded Worker version to ${target}...`);
|
|
200
|
-
const output = runWranglerCommand(root, args, execute);
|
|
214
|
+
const output = runWranglerCommand(root, args, execute, options.verbose === true);
|
|
201
215
|
return {
|
|
202
216
|
deployedUrl: parseWorkersDevUrl(output),
|
|
203
217
|
output
|
|
@@ -205,19 +219,19 @@ function runWranglerVersionDeploy(root, versionTraffic, options, phase = "promot
|
|
|
205
219
|
}
|
|
206
220
|
function runWranglerDeploymentStatus(root, options, execute = execFileSync) {
|
|
207
221
|
const { args, env } = buildWranglerDeploymentsStatusArgs(options);
|
|
208
|
-
if (env) console.log(`\n Reading current Worker deployment for env: ${env}...`);
|
|
222
|
+
if (options.verbose) if (env) console.log(`\n Reading current Worker deployment for env: ${env}...`);
|
|
209
223
|
else console.log("\n Reading current Worker deployment...");
|
|
210
|
-
return parseWranglerDeploymentStatusOutput(runWranglerCommand(root, args, execute));
|
|
224
|
+
return parseWranglerDeploymentStatusOutput(runWranglerCommand(root, args, execute, options.verbose === true));
|
|
211
225
|
}
|
|
212
226
|
function runWranglerTriggersDeploy(root, options, execute = execFileSync) {
|
|
213
227
|
const { args, env } = buildWranglerTriggersDeployArgs(options);
|
|
214
228
|
if (env) console.log(`\n Applying Worker triggers for env: ${env}...`);
|
|
215
229
|
else console.log("\n Applying Worker triggers...");
|
|
216
|
-
const output = runWranglerCommand(root, args, execute);
|
|
230
|
+
const output = runWranglerCommand(root, args, execute, options.verbose === true);
|
|
217
231
|
return {
|
|
218
|
-
deployedUrl:
|
|
232
|
+
deployedUrl: parseCdnWarmupDeploymentUrl(output),
|
|
219
233
|
output
|
|
220
234
|
};
|
|
221
235
|
}
|
|
222
236
|
//#endregion
|
|
223
|
-
export { buildWranglerDeploymentsStatusArgs, buildWranglerTriggersDeployArgs, buildWranglerVersionDeployArgs, buildWranglerVersionUploadArgs, parseVersionId, parseWorkersDevUrl, parseWranglerDeploymentStatusOutput, parseWranglerVersionUploadOutput, runWranglerDeploymentStatus, runWranglerTriggersDeploy, runWranglerVersionDeploy, runWranglerVersionUpload };
|
|
237
|
+
export { buildWranglerDeploymentsStatusArgs, buildWranglerTriggersDeployArgs, buildWranglerVersionDeployArgs, buildWranglerVersionUploadArgs, parseUploadedWorkerName, parseVersionId, parseWorkersDevUrl, parseWranglerDeploymentStatusOutput, parseWranglerVersionUploadOutput, runWranglerDeploymentStatus, runWranglerTriggersDeploy, runWranglerVersionDeploy, runWranglerVersionUpload };
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
//#region src/worker-deployment-url.d.ts
|
|
2
2
|
declare function parseWorkerDeploymentUrl(output: string): string | null;
|
|
3
|
+
/**
|
|
4
|
+
* Parse the concrete hostname that Wrangler reports after applying Worker
|
|
5
|
+
* triggers. Catch-all routes are valid warmup targets even though they are not
|
|
6
|
+
* canonical deployment URLs for general CLI reporting.
|
|
7
|
+
*/
|
|
8
|
+
declare function parseCdnWarmupDeploymentUrl(output: string): string | null;
|
|
3
9
|
//#endregion
|
|
4
|
-
export { parseWorkerDeploymentUrl };
|
|
10
|
+
export { parseCdnWarmupDeploymentUrl, parseWorkerDeploymentUrl };
|
|
@@ -3,6 +3,28 @@ import { parseWorkersDevUrl } from "./workers-dev-url.js";
|
|
|
3
3
|
function parseWorkerDeploymentUrl(output) {
|
|
4
4
|
return parseWorkersDevUrl(output) ?? parseCustomDomainUrl(output);
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Parse the concrete hostname that Wrangler reports after applying Worker
|
|
8
|
+
* triggers. Catch-all routes are valid warmup targets even though they are not
|
|
9
|
+
* canonical deployment URLs for general CLI reporting.
|
|
10
|
+
*/
|
|
11
|
+
function parseCdnWarmupDeploymentUrl(output) {
|
|
12
|
+
return parseCustomDomainUrl(output) ?? parseCatchAllWorkerRouteOrigin(output) ?? parseWorkersDevUrl(output);
|
|
13
|
+
}
|
|
14
|
+
function parseCatchAllWorkerRouteOrigin(output) {
|
|
15
|
+
for (const line of output.split(/\r?\n/)) {
|
|
16
|
+
const route = line.trim().split(/\s+/, 1)[0];
|
|
17
|
+
if (!route || !route.endsWith("/*")) continue;
|
|
18
|
+
try {
|
|
19
|
+
const url = new URL(route.includes("://") ? route : `https://${route}`);
|
|
20
|
+
if (url.protocol !== "https:" && url.protocol !== "http:" || url.hostname.includes("*") || url.username !== "" || url.password !== "" || url.port !== "" || url.pathname !== "/*" || url.search !== "" || url.hash !== "") continue;
|
|
21
|
+
return url.origin;
|
|
22
|
+
} catch {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
6
28
|
function parseCustomDomainUrl(output) {
|
|
7
29
|
for (const line of output.split(/\r?\n/)) {
|
|
8
30
|
const match = /^\s*(\S+)\s+\(custom domain(?: - zone (?:id|name): [^)]+)?\)(?: \[([^\]\r\n]+)\])?\s*$/.exec(line);
|
|
@@ -20,4 +42,4 @@ function parseCustomDomainUrl(output) {
|
|
|
20
42
|
return null;
|
|
21
43
|
}
|
|
22
44
|
//#endregion
|
|
23
|
-
export { parseWorkerDeploymentUrl };
|
|
45
|
+
export { parseCdnWarmupDeploymentUrl, parseWorkerDeploymentUrl };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/wrangler-version-metadata.d.ts
|
|
2
|
+
declare function assertCdnVersionMetadataConfig({ binding, configuredBinding, configPath }: {
|
|
3
|
+
binding: string;
|
|
4
|
+
configuredBinding: string | undefined;
|
|
5
|
+
configPath: string | undefined;
|
|
6
|
+
}): void;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { assertCdnVersionMetadataConfig };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/wrangler-version-metadata.ts
|
|
2
|
+
function assertCdnVersionMetadataConfig({ binding, configuredBinding, configPath }) {
|
|
3
|
+
if (configuredBinding === binding) return;
|
|
4
|
+
const location = configPath ? ` in ${configPath}` : "";
|
|
5
|
+
const found = configuredBinding ? ` declares ${JSON.stringify(configuredBinding)} instead` : " does not declare version_metadata";
|
|
6
|
+
throw new Error(`[vinext] Cloudflare CDN warmup requires version metadata binding ${JSON.stringify(binding)}, but the effective Wrangler config${location}${found}. Deploy the generated Wrangler config finalized by cdnAdapter(), or add the binding to this effective config and align cdnAdapter({ versionMetadataBinding }) when using a custom name.`);
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { assertCdnVersionMetadataConfig };
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vinext/cloudflare",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.7",
|
|
4
4
|
"description": "Cloudflare adapters for vinext (KV data cache and Images-backed image optimization).",
|
|
5
|
+
"homepage": "https://vinext.dev/",
|
|
5
6
|
"license": "MIT",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
@@ -54,10 +55,10 @@
|
|
|
54
55
|
"@types/node": "^25.9.2",
|
|
55
56
|
"vite": "npm:@voidzero-dev/vite-plus-core@0.2.6",
|
|
56
57
|
"vite-plus": "0.2.6",
|
|
57
|
-
"vinext": "1.0.0-beta.
|
|
58
|
+
"vinext": "1.0.0-beta.9"
|
|
58
59
|
},
|
|
59
60
|
"peerDependencies": {
|
|
60
|
-
"vinext": "^1.0.0-beta.
|
|
61
|
+
"vinext": "^1.0.0-beta.9"
|
|
61
62
|
},
|
|
62
63
|
"engines": {
|
|
63
64
|
"node": ">=22"
|