@vinext/cloudflare 1.0.0-beta.6 → 1.0.0-beta.8

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.
Files changed (58) hide show
  1. package/README.md +62 -12
  2. package/dist/cache/cdn-adapter-config.d.ts +30 -0
  3. package/dist/cache/cdn-adapter-config.js +87 -0
  4. package/dist/cache/cdn-adapter.d.ts +47 -15
  5. package/dist/cache/cdn-adapter.js +49 -13
  6. package/dist/cache/cdn-adapter.runtime.d.ts +26 -4
  7. package/dist/cache/cdn-adapter.runtime.js +131 -33
  8. package/dist/cache/cdn-adapter.worker.d.ts +30 -0
  9. package/dist/cache/cdn-adapter.worker.js +371 -0
  10. package/dist/cache/cdn-build-id.d.ts +6 -0
  11. package/dist/cache/cdn-build-id.js +9 -0
  12. package/dist/cache/kv-data-adapter.d.ts +21 -5
  13. package/dist/cache/kv-data-adapter.runtime.d.ts +38 -4
  14. package/dist/cache/kv-data-adapter.runtime.js +116 -42
  15. package/dist/cache/kv-key.d.ts +4 -5
  16. package/dist/cache/response-store-adapter.d.ts +37 -0
  17. package/dist/cache/response-store-adapter.js +39 -0
  18. package/dist/cache/response-store-adapter.self-contained.worker.d.ts +17 -0
  19. package/dist/cache/response-store-adapter.self-contained.worker.js +10 -0
  20. package/dist/cache/response-store-adapter.service-binding.worker.d.ts +15 -0
  21. package/dist/cache/response-store-adapter.service-binding.worker.js +9 -0
  22. package/dist/cache/response-store-adapter.worker.d.ts +14 -0
  23. package/dist/cache/response-store-adapter.worker.js +254 -0
  24. package/dist/cache/response-store-cdn.runtime.d.ts +5 -0
  25. package/dist/cache/response-store-cdn.runtime.js +41 -0
  26. package/dist/cache/response-store-data.runtime.d.ts +34 -0
  27. package/dist/cache/response-store-data.runtime.js +289 -0
  28. package/dist/cacheability-artifact.d.ts +9 -0
  29. package/dist/cacheability-artifact.js +191 -0
  30. package/dist/cacheability-manifest-limits.d.ts +4 -0
  31. package/dist/cacheability-manifest-limits.js +7 -0
  32. package/dist/cacheability-probe.d.ts +49 -0
  33. package/dist/cacheability-probe.js +660 -0
  34. package/dist/cdn-warm.d.ts +110 -11
  35. package/dist/cdn-warm.js +864 -82
  36. package/dist/cli.js +15 -1
  37. package/dist/deploy-config.d.ts +13 -10
  38. package/dist/deploy-config.js +21 -3
  39. package/dist/deploy-help.d.ts +3 -4
  40. package/dist/deploy-help.js +43 -6
  41. package/dist/deploy.d.ts +77 -23
  42. package/dist/deploy.js +666 -84
  43. package/dist/images/images-optimizer.d.ts +3 -4
  44. package/dist/prerender-kv-populate.d.ts +3 -4
  45. package/dist/prerender-kv-populate.js +4 -3
  46. package/dist/tpr.d.ts +9 -10
  47. package/dist/tpr.js +3 -3
  48. package/dist/utils/cache-control-metadata.d.ts +3 -4
  49. package/dist/version-deploy.d.ts +19 -16
  50. package/dist/version-deploy.js +29 -12
  51. package/dist/version-headers.d.ts +2 -0
  52. package/dist/version-headers.js +2 -0
  53. package/dist/worker-deployment-url.d.ts +8 -3
  54. package/dist/worker-deployment-url.js +23 -1
  55. package/dist/workers-dev-url.d.ts +2 -3
  56. package/dist/wrangler-version-metadata.d.ts +7 -0
  57. package/dist/wrangler-version-metadata.js +9 -0
  58. package/package.json +14 -7
@@ -1,6 +1,6 @@
1
1
  //#region src/images/images-optimizer.d.ts
2
2
  /** Options accepted by {@link imagesOptimizer}, forwarded to the runtime factory. */
3
- type ImagesOptimizerOptions = {
3
+ export type ImagesOptimizerOptions = {
4
4
  /** Cloudflare Images binding name on the Worker `env`. @default "IMAGES" */
5
5
  binding?: string;
6
6
  };
@@ -21,9 +21,8 @@ type ImagesOptimizerOptions = {
21
21
  * plugins: [vinext({ images: { optimizer: imagesOptimizer() } })],
22
22
  * });
23
23
  */
24
- declare function imagesOptimizer(options?: ImagesOptimizerOptions): {
24
+ export declare function imagesOptimizer(options?: ImagesOptimizerOptions): {
25
25
  adapter: string;
26
26
  options: ImagesOptimizerOptions | undefined;
27
27
  };
28
- //#endregion
29
- export { ImagesOptimizerOptions, imagesOptimizer };
28
+ //#endregion
@@ -7,13 +7,13 @@
7
7
  * KVCacheEntry shape written by KVCacheHandler.set(), and returns Wrangler KV
8
8
  * bulk import records for deploy-time upload.
9
9
  */
10
- type KVBulkPair = {
10
+ export type KVBulkPair = {
11
11
  key: string;
12
12
  value: string;
13
13
  expiration_ttl?: number;
14
14
  metadata?: Record<string, unknown>;
15
15
  };
16
- declare function buildPrerenderKVPairs(serverDir: string, options?: {
16
+ export declare function buildPrerenderKVPairs(serverDir: string, options?: {
17
17
  appPrefix?: string;
18
18
  now?: number;
19
19
  ttlSeconds?: number;
@@ -21,5 +21,4 @@ declare function buildPrerenderKVPairs(serverDir: string, options?: {
21
21
  routeCount: number;
22
22
  pairs: KVBulkPair[];
23
23
  };
24
- //#endregion
25
- export { KVBulkPair, buildPrerenderKVPairs };
24
+ //#endregion
@@ -1,6 +1,6 @@
1
1
  import { createKvKeySpace } from "./cache/kv-key.js";
2
- import path from "node:path";
3
2
  import fs from "node:fs";
3
+ import path from "node:path";
4
4
  import { getRenderedAppRoutes, getRenderedMetadataRoutes, readPrerenderManifest } from "vinext/internal/server/prerender-manifest";
5
5
  import { appIsrCacheKey } from "vinext/internal/server/isr-cache";
6
6
  import { buildAppPageCacheTags, buildAppRouteCacheTags } from "vinext/internal/server/app-page-cache";
@@ -16,7 +16,7 @@ import { getAppRouteOutputPath, getOutputPath, getRscOutputPath } from "vinext/i
16
16
  * bulk import records for deploy-time upload.
17
17
  */
18
18
  /** Default KV expiration TTL used by KVCacheHandler for revalidating entries. */
19
- const DEFAULT_KV_TTL_SECONDS = 720 * 3600;
19
+ const DEFAULT_KV_TTL_SECONDS = 2592e3;
20
20
  function resolveContainedFile(rootDir, relativePath) {
21
21
  const resolvedRoot = path.resolve(rootDir);
22
22
  const resolvedFile = path.resolve(resolvedRoot, relativePath);
@@ -48,7 +48,8 @@ function buildMetadata(tags) {
48
48
  return JSON.stringify(metadata).length <= 1024 ? metadata : void 0;
49
49
  }
50
50
  function buildPrerenderKVPairs(serverDir, options) {
51
- const manifest = readPrerenderManifest(path.join(serverDir, "vinext-prerender.json"));
51
+ const manifestPath = path.join(serverDir, "vinext-prerender.json");
52
+ const manifest = readPrerenderManifest(manifestPath);
52
53
  if (!manifest?.buildId || !Array.isArray(manifest.routes)) return {
53
54
  routeCount: 0,
54
55
  pairs: []
package/dist/tpr.d.ts CHANGED
@@ -20,7 +20,7 @@
20
20
  * gracefully skips when no custom domain, no API token, no traffic data,
21
21
  * or no KV namespace is configured.
22
22
  */
23
- type TPROptions = {
23
+ export type TPROptions = {
24
24
  /** Project root directory. */
25
25
  root: string;
26
26
  /** Wrangler config path, relative to root unless absolute. */
@@ -32,7 +32,7 @@ type TPROptions = {
32
32
  /** Analytics lookback window in hours. Default: 24. */
33
33
  window: number;
34
34
  };
35
- type TPRResult = {
35
+ export type TPRResult = {
36
36
  /** Total unique page paths found in analytics. */
37
37
  totalPaths: number;
38
38
  /** Number of pages successfully pre-rendered and uploaded. */
@@ -57,7 +57,7 @@ type WranglerConfig = {
57
57
  legacyEnv?: boolean;
58
58
  env?: Record<string, WranglerEnvironmentConfig>;
59
59
  };
60
- type WranglerEnvironmentConfig = {
60
+ export type WranglerEnvironmentConfig = {
61
61
  customDomain?: string;
62
62
  name?: string;
63
63
  };
@@ -65,7 +65,7 @@ type WranglerEnvironmentConfig = {
65
65
  * Parse wrangler config (JSONC or TOML) to extract the fields TPR needs:
66
66
  * account_id, VINEXT_KV_CACHE KV namespace ID, and custom domain.
67
67
  */
68
- declare function parseWranglerConfig(root: string, configPath?: string): WranglerConfig | null;
68
+ export declare function parseWranglerConfig(root: string, configPath?: string): WranglerConfig | null;
69
69
  /**
70
70
  * Generate zone lookup candidates from shortest (2-part) to longest.
71
71
  * Tries the most common case first (e.g., "example.com") and progressively
@@ -75,8 +75,8 @@ declare function parseWranglerConfig(root: string, configPath?: string): Wrangle
75
75
  * "shop.example.co.uk" → ["co.uk", "example.co.uk", "shop.example.co.uk"]
76
76
  * "example.com" → ["example.com"]
77
77
  */
78
- declare function domainCandidates(domain: string): string[];
79
- declare function resolveVinextProdServerPath(root: string): string;
78
+ export declare function domainCandidates(domain: string): string[];
79
+ export declare function resolveVinextProdServerPath(root: string): string;
80
80
  /**
81
81
  * Build KV bulk API pairs from pre-rendered entries.
82
82
  *
@@ -84,7 +84,7 @@ declare function resolveVinextProdServerPath(root: string): string;
84
84
  * createKvKeySpace().entryKey(isrCacheKey("app", pathname, buildId) + ":html")
85
85
  * → "cache:app:<buildId>:<pathname>:html"
86
86
  */
87
- declare function buildTprKVPairs(entries: Map<string, PrerenderResult>, buildId: string | undefined, defaultRevalidateSeconds: number): Array<{
87
+ export declare function buildTprKVPairs(entries: Map<string, PrerenderResult>, buildId: string | undefined, defaultRevalidateSeconds: number): Array<{
88
88
  key: string;
89
89
  value: string;
90
90
  expiration_ttl: number;
@@ -96,6 +96,5 @@ declare function buildTprKVPairs(entries: Map<string, PrerenderResult>, buildId:
96
96
  * `vinext-cloudflare deploy` pipeline. Gracefully skips (never errors) when
97
97
  * the prerequisites aren't met.
98
98
  */
99
- declare function runTPR(options: TPROptions): Promise<TPRResult>;
100
- //#endregion
101
- export { TPROptions, TPRResult, WranglerEnvironmentConfig, buildTprKVPairs, domainCandidates, parseWranglerConfig, resolveVinextProdServerPath, runTPR };
99
+ export declare function runTPR(options: TPROptions): Promise<TPRResult>;
100
+ //#endregion
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
@@ -573,7 +573,7 @@ async function waitForServer(port, timeoutMs) {
573
573
  /** KV bulk API accepts up to 10,000 pairs per request */
574
574
  const KV_BATCH_SIZE = 1e4;
575
575
  /** Maximum KV expiration TTL: 30 days */
576
- const MAX_KV_TTL_SECONDS = 720 * 3600;
576
+ const MAX_KV_TTL_SECONDS = 2592e3;
577
577
  /**
578
578
  * Build KV bulk API pairs from pre-rendered entries.
579
579
  *
@@ -5,7 +5,6 @@
5
5
  * so the Cloudflare adapters stay self-contained (these mirror the equivalent
6
6
  * helpers in the vinext core).
7
7
  */
8
- declare function isUnknownRecord(value: unknown): value is Record<string, unknown>;
9
- declare function readCacheControlNumberField(ctx: Record<string, unknown> | undefined, field: string): number | undefined;
10
- //#endregion
11
- export { isUnknownRecord, readCacheControlNumberField };
8
+ export declare function isUnknownRecord(value: unknown): value is Record<string, unknown>;
9
+ export declare function readCacheControlNumberField(ctx: Record<string, unknown> | undefined, field: string): number | undefined;
10
+ //#endregion
@@ -2,20 +2,22 @@ import { parseWorkersDevUrl } from "./workers-dev-url.js";
2
2
  import { DeployOptions } from "./deploy.js";
3
3
  import { execFileSync } from "node:child_process";
4
4
  //#region src/version-deploy.d.ts
5
- type WranglerVersionUploadResult = {
5
+ export type WranglerVersionUploadResult = {
6
6
  versionId: string;
7
7
  previewUrl: string | null;
8
+ workerName: string | null;
8
9
  output: string;
9
10
  };
10
- type WranglerVersionDeployResult = {
11
+ export type WranglerVersionDeployResult = {
11
12
  deployedUrl: string | null;
12
13
  output: string;
13
14
  };
14
- type WranglerVersionTraffic = {
15
+ export type WranglerVersionTraffic = {
15
16
  versionId: string;
16
17
  percentage: number;
17
18
  };
18
- type WranglerDeploymentStatus = {
19
+ export type WranglerDeploymentStatus = {
20
+ deploymentId: string | null;
19
21
  versions: WranglerVersionTraffic[];
20
22
  output: string;
21
23
  };
@@ -23,20 +25,21 @@ type WranglerVersionArgs = {
23
25
  args: string[];
24
26
  env: string | undefined;
25
27
  };
26
- declare function parseVersionId(output: string): string | null;
27
- declare function parseWranglerVersionUploadOutput(output: string): WranglerVersionUploadResult;
28
- declare function buildWranglerVersionUploadArgs(options: Pick<DeployOptions, "preview" | "env" | "name" | "config"> & {
28
+ export declare function parseVersionId(output: string): string | null;
29
+ export declare function parseUploadedWorkerName(output: string): string | null;
30
+ export declare function parseWranglerVersionUploadOutput(output: string): WranglerVersionUploadResult;
31
+ export 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 parseWranglerDeploymentStatusOutput(output: string): WranglerDeploymentStatus;
35
- declare function runWranglerVersionUpload(root: string, options: Pick<DeployOptions, "preview" | "env" | "name" | "config"> & {
34
+ export declare function buildWranglerVersionDeployArgs(versionTraffic: readonly WranglerVersionTraffic[], options: Pick<DeployOptions, "preview" | "env" | "name" | "config" | "verbose">): WranglerVersionArgs;
35
+ export declare function buildWranglerDeploymentsStatusArgs(options: Pick<DeployOptions, "preview" | "env" | "name" | "config" | "verbose">): WranglerVersionArgs;
36
+ export declare function buildWranglerTriggersDeployArgs(options: Pick<DeployOptions, "preview" | "env" | "name" | "config" | "verbose">): WranglerVersionArgs;
37
+ export declare function parseWranglerDeploymentStatusOutput(output: string): WranglerDeploymentStatus;
38
+ export 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
+ export 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
+ export declare function runWranglerDeploymentStatus(root: string, options: Pick<DeployOptions, "preview" | "env" | "name" | "config" | "verbose">, execute?: typeof execFileSync): WranglerDeploymentStatus;
43
+ export 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 { parseWorkersDevUrl };
@@ -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
- return output.match(/\b[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}\b/)?.[0] ?? null;
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,8 +132,9 @@ function buildWranglerTriggersDeployArgs(options) {
123
132
  env
124
133
  };
125
134
  }
126
- function runWranglerCommand(root, args, execute = execFileSync) {
127
- const invocation = buildNodeCliInvocation(resolveWranglerBin(root), args);
135
+ function runWranglerCommand(root, args, execute = execFileSync, verbose = false) {
136
+ const wranglerBin = resolveWranglerBin(root);
137
+ const invocation = buildNodeCliInvocation(wranglerBin, args);
128
138
  const execOpts = {
129
139
  cwd: root,
130
140
  stdio: "pipe",
@@ -132,7 +142,7 @@ function runWranglerCommand(root, args, execute = execFileSync) {
132
142
  shell: false
133
143
  };
134
144
  const output = execute(invocation.file, invocation.args, execOpts);
135
- if (output.trim()) for (const line of output.trim().split("\n")) console.log(` ${line}`);
145
+ if (verbose && output.trim()) for (const line of output.trim().split("\n")) console.log(` ${line}`);
136
146
  return output;
137
147
  }
138
148
  function errorText(error) {
@@ -176,6 +186,11 @@ function parseWranglerDeploymentStatusOutput(output) {
176
186
  const parsed = parseJsonObject(output);
177
187
  if (!parsed) throw new Error("Could not parse `wrangler deployments status --json` output.");
178
188
  return {
189
+ deploymentId: findStringInRecord(Array.isArray(parsed) ? parsed.at(-1) : parsed, [
190
+ "id",
191
+ "deployment_id",
192
+ "deploymentId"
193
+ ]),
179
194
  versions: parseDeploymentVersions(parsed),
180
195
  output
181
196
  };
@@ -185,7 +200,7 @@ function runWranglerVersionUpload(root, options, execute = execFileSync) {
185
200
  if (env) console.log(`\n Uploading Worker version for env: ${env}...`);
186
201
  else console.log("\n Uploading Worker version for production...");
187
202
  try {
188
- return parseWranglerVersionUploadOutput(runWranglerCommand(root, args, execute));
203
+ return parseWranglerVersionUploadOutput(runWranglerCommand(root, args, execute, options.verbose === true));
189
204
  } catch (error) {
190
205
  if (isMissingWorkerVersionUploadError(error)) throw withInitialDeployRequiredMessage();
191
206
  throw error;
@@ -197,7 +212,7 @@ function runWranglerVersionDeploy(root, versionTraffic, options, phase = "promot
197
212
  if (phase === "stage") console.log(`\n Staging uploaded Worker version at 0% for CDN warmup in ${target}...`);
198
213
  else if (phase === "promote-warmed") console.log(`\n Promoting warmed Worker version to ${target}...`);
199
214
  else console.log(`\n Promoting uploaded Worker version to ${target}...`);
200
- const output = runWranglerCommand(root, args, execute);
215
+ const output = runWranglerCommand(root, args, execute, options.verbose === true);
201
216
  return {
202
217
  deployedUrl: parseWorkersDevUrl(output),
203
218
  output
@@ -205,19 +220,21 @@ function runWranglerVersionDeploy(root, versionTraffic, options, phase = "promot
205
220
  }
206
221
  function runWranglerDeploymentStatus(root, options, execute = execFileSync) {
207
222
  const { args, env } = buildWranglerDeploymentsStatusArgs(options);
208
- if (env) console.log(`\n Reading current Worker deployment for env: ${env}...`);
209
- else console.log("\n Reading current Worker deployment...");
210
- return parseWranglerDeploymentStatusOutput(runWranglerCommand(root, args, execute));
223
+ if (options.verbose) {
224
+ if (env) console.log(`\n Reading current Worker deployment for env: ${env}...`);
225
+ else console.log("\n Reading current Worker deployment...");
226
+ }
227
+ return parseWranglerDeploymentStatusOutput(runWranglerCommand(root, args, execute, options.verbose === true));
211
228
  }
212
229
  function runWranglerTriggersDeploy(root, options, execute = execFileSync) {
213
230
  const { args, env } = buildWranglerTriggersDeployArgs(options);
214
231
  if (env) console.log(`\n Applying Worker triggers for env: ${env}...`);
215
232
  else console.log("\n Applying Worker triggers...");
216
- const output = runWranglerCommand(root, args, execute);
233
+ const output = runWranglerCommand(root, args, execute, options.verbose === true);
217
234
  return {
218
- deployedUrl: parseWorkersDevUrl(output),
235
+ deployedUrl: parseCdnWarmupDeploymentUrl(output),
219
236
  output
220
237
  };
221
238
  }
222
239
  //#endregion
223
- export { buildWranglerDeploymentsStatusArgs, buildWranglerTriggersDeployArgs, buildWranglerVersionDeployArgs, buildWranglerVersionUploadArgs, parseVersionId, parseWorkersDevUrl, parseWranglerDeploymentStatusOutput, parseWranglerVersionUploadOutput, runWranglerDeploymentStatus, runWranglerTriggersDeploy, runWranglerVersionDeploy, runWranglerVersionUpload };
240
+ export { buildWranglerDeploymentsStatusArgs, buildWranglerTriggersDeployArgs, buildWranglerVersionDeployArgs, buildWranglerVersionUploadArgs, parseUploadedWorkerName, parseVersionId, parseWorkersDevUrl, parseWranglerDeploymentStatusOutput, parseWranglerVersionUploadOutput, runWranglerDeploymentStatus, runWranglerTriggersDeploy, runWranglerVersionDeploy, runWranglerVersionUpload };
@@ -0,0 +1,2 @@
1
+ import { VINEXT_EXPECTED_WORKER_VERSION_HEADER } from "vinext/internal/server/headers";
2
+ export { VINEXT_EXPECTED_WORKER_VERSION_HEADER };
@@ -0,0 +1,2 @@
1
+ import { VINEXT_EXPECTED_WORKER_VERSION_HEADER } from "vinext/internal/server/headers";
2
+ export { VINEXT_EXPECTED_WORKER_VERSION_HEADER };
@@ -1,4 +1,9 @@
1
1
  //#region src/worker-deployment-url.d.ts
2
- declare function parseWorkerDeploymentUrl(output: string): string | null;
3
- //#endregion
4
- export { parseWorkerDeploymentUrl };
2
+ export 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
+ export declare function parseCdnWarmupDeploymentUrl(output: string): string | null;
9
+ //#endregion
@@ -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 };
@@ -1,4 +1,3 @@
1
1
  //#region src/workers-dev-url.d.ts
2
- declare function parseWorkersDevUrl(output: string): string | null;
3
- //#endregion
4
- export { parseWorkersDevUrl };
2
+ export declare function parseWorkersDevUrl(output: string): string | null;
3
+ //#endregion
@@ -0,0 +1,7 @@
1
+ //#region src/wrangler-version-metadata.d.ts
2
+ export declare function assertCdnVersionMetadataConfig({ binding, configuredBinding, configPath }: {
3
+ binding: string;
4
+ configuredBinding: string | undefined;
5
+ configPath: string | undefined;
6
+ }): void;
7
+ //#endregion
@@ -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.6",
4
- "description": "Cloudflare adapters for vinext (KV data cache and Images-backed image optimization).",
3
+ "version": "1.0.0-beta.8",
4
+ "description": "Cloudflare cache and image adapters for vinext.",
5
+ "homepage": "https://vinext.dev/",
5
6
  "license": "MIT",
6
7
  "repository": {
7
8
  "type": "git",
@@ -50,20 +51,26 @@
50
51
  "import": "./dist/images/*.js"
51
52
  }
52
53
  },
54
+ "dependencies": {
55
+ "@cloudflare/workers-response-store": "0.1.0-beta.0"
56
+ },
53
57
  "devDependencies": {
54
58
  "@types/node": "^25.9.2",
55
- "vite": "npm:@voidzero-dev/vite-plus-core@0.2.6",
56
- "vite-plus": "0.2.6",
57
- "vinext": "1.0.0-beta.6"
59
+ "miniflare": "5.20260730.0-alpha",
60
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.3.2",
61
+ "vite-plus": "0.3.2",
62
+ "vitest": "4.1.11",
63
+ "vinext": "1.0.0-beta.10"
58
64
  },
59
65
  "peerDependencies": {
60
- "vinext": "^1.0.0-beta.6"
66
+ "vinext": "^1.0.0-beta.10"
61
67
  },
62
68
  "engines": {
63
69
  "node": ">=22"
64
70
  },
65
71
  "scripts": {
66
72
  "build": "vp pack",
67
- "dev": "vp pack --watch"
73
+ "dev": "vp pack --watch",
74
+ "test": "vp run vinext#build && vp run @cloudflare/workers-response-store#build && vp run @vinext/cloudflare#build && VINEXT_RESPONSE_STORE_MODE=self-contained pnpm --filter response-store-demo run build && pnpm --filter response-store-demo run build && vitest run"
68
75
  }
69
76
  }