@vinext/cloudflare 1.0.0-beta.1 → 1.0.0-beta.10
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 +94 -1
- package/dist/cache/cdn-adapter-config.d.ts +30 -0
- package/dist/cache/cdn-adapter-config.js +87 -0
- package/dist/cache/cdn-adapter.d.ts +47 -15
- package/dist/cache/cdn-adapter.js +49 -13
- package/dist/cache/cdn-adapter.runtime.d.ts +26 -4
- package/dist/cache/cdn-adapter.runtime.js +150 -37
- package/dist/cache/cdn-adapter.worker.d.ts +31 -0
- package/dist/cache/cdn-adapter.worker.js +373 -0
- package/dist/cache/cdn-build-id.d.ts +6 -0
- package/dist/cache/cdn-build-id.js +9 -0
- package/dist/cache/kv-data-adapter.d.ts +32 -8
- package/dist/cache/kv-data-adapter.js +5 -1
- package/dist/cache/kv-data-adapter.runtime.d.ts +45 -13
- package/dist/cache/kv-data-adapter.runtime.js +132 -52
- package/dist/cache/kv-key.d.ts +15 -0
- package/dist/cache/kv-key.js +43 -0
- package/dist/cache/response-store-adapter.d.ts +73 -0
- package/dist/cache/response-store-adapter.js +64 -0
- package/dist/cache/response-store-adapter.self-contained.worker.d.ts +18 -0
- package/dist/cache/response-store-adapter.self-contained.worker.js +12 -0
- package/dist/cache/response-store-adapter.service-binding.worker.d.ts +16 -0
- package/dist/cache/response-store-adapter.service-binding.worker.js +11 -0
- package/dist/cache/response-store-adapter.worker.d.ts +14 -0
- package/dist/cache/response-store-adapter.worker.js +278 -0
- package/dist/cache/response-store-cdn.runtime.d.ts +5 -0
- package/dist/cache/response-store-cdn.runtime.js +41 -0
- package/dist/cache/response-store-data.runtime.d.ts +34 -0
- package/dist/cache/response-store-data.runtime.js +300 -0
- package/dist/cacheability-artifact.d.ts +9 -0
- package/dist/cacheability-artifact.js +191 -0
- package/dist/cacheability-manifest-limits.d.ts +4 -0
- package/dist/cacheability-manifest-limits.js +7 -0
- package/dist/cacheability-probe.d.ts +49 -0
- package/dist/cacheability-probe.js +660 -0
- package/dist/cdn-warm.d.ts +110 -12
- package/dist/cdn-warm.js +880 -82
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +15 -1
- package/dist/deploy-config.d.ts +13 -11
- package/dist/deploy-config.js +21 -3
- package/dist/deploy-help.d.ts +3 -4
- package/dist/deploy-help.js +61 -18
- package/dist/deploy.d.ts +121 -41
- package/dist/deploy.js +762 -104
- package/dist/images/images-optimizer.d.ts +5 -5
- package/dist/images/images-optimizer.runtime.d.ts +1 -5
- package/dist/prerender-kv-populate.d.ts +3 -4
- package/dist/prerender-kv-populate.js +51 -18
- package/dist/tpr.d.ts +32 -70
- package/dist/tpr.js +45 -602
- package/dist/utils/cache-control-metadata.d.ts +3 -4
- package/dist/version-deploy.d.ts +19 -17
- package/dist/version-deploy.js +32 -13
- package/dist/version-headers.d.ts +2 -0
- package/dist/version-headers.js +2 -0
- package/dist/worker-deployment-url.d.ts +9 -0
- package/dist/worker-deployment-url.js +45 -0
- package/dist/workers-dev-url.d.ts +2 -3
- package/dist/wrangler-config.d.ts +19 -0
- package/dist/wrangler-config.js +294 -0
- package/dist/wrangler-version-metadata.d.ts +7 -0
- package/dist/wrangler-version-metadata.js +9 -0
- package/package.json +14 -11
package/dist/cli.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
package/dist/cli.js
CHANGED
|
@@ -38,16 +38,30 @@ async function deployCommand() {
|
|
|
38
38
|
root: process.cwd(),
|
|
39
39
|
preview: parsed.preview,
|
|
40
40
|
env: parsed.env,
|
|
41
|
+
config: parsed.config,
|
|
41
42
|
skipBuild: parsed.skipBuild,
|
|
42
43
|
dryRun: parsed.dryRun,
|
|
44
|
+
verbose: parsed.verbose,
|
|
43
45
|
name: parsed.name,
|
|
44
46
|
prerenderAll: parsed.prerenderAll,
|
|
45
47
|
prerenderConcurrency: parsed.prerenderConcurrency,
|
|
46
48
|
warmCdnCache: parsed.warmCdnCache,
|
|
49
|
+
warmCdnTarget: parsed.warmCdnTarget,
|
|
47
50
|
warmCdnConcurrency: parsed.warmCdnConcurrency,
|
|
48
51
|
warmCdnTimeout: parsed.warmCdnTimeout,
|
|
49
52
|
warmCdnRetries: parsed.warmCdnRetries,
|
|
50
|
-
|
|
53
|
+
warmCdnDiscoveryTimeout: parsed.warmCdnDiscoveryTimeout,
|
|
54
|
+
warmCdnDiscoveryRetries: parsed.warmCdnDiscoveryRetries,
|
|
55
|
+
warmCdnProbeTimeout: parsed.warmCdnProbeTimeout,
|
|
56
|
+
warmCdnProbeRetries: parsed.warmCdnProbeRetries,
|
|
57
|
+
warmCdnCertify: parsed.warmCdnCertify,
|
|
58
|
+
warmCdnReadinessTimeout: parsed.warmCdnReadinessTimeout,
|
|
59
|
+
warmCdnReadinessRetries: parsed.warmCdnReadinessRetries,
|
|
60
|
+
warmCdnReadinessProbes: parsed.warmCdnReadinessProbes,
|
|
61
|
+
warmCdnReadinessProbeDelay: parsed.warmCdnReadinessProbeDelay,
|
|
62
|
+
dangerouslyPromoteOnCdnWarmError: parsed.dangerouslyPromoteOnCdnWarmError,
|
|
63
|
+
warmCdnPromote: parsed.warmCdnPromote,
|
|
64
|
+
warmCdnPromotionDelay: parsed.warmCdnPromotionDelay,
|
|
51
65
|
warmCdnIncludeFallbacks: parsed.warmCdnIncludeFallbacks,
|
|
52
66
|
experimentalTPR: parsed.experimentalTPR,
|
|
53
67
|
tprCoverage: parsed.tprCoverage,
|
package/dist/deploy-config.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { VinextCacheConfig } from "vinext/internal/cache-adapters";
|
|
2
|
-
|
|
3
2
|
//#region src/deploy-config.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Check whether an existing vite.config file already imports and uses the
|
|
@@ -9,7 +8,7 @@ import { VinextCacheConfig } from "vinext/internal/cache-adapters";
|
|
|
9
8
|
* Returns true when the config both imports the package and invokes
|
|
10
9
|
* `cloudflare(...)` in the plugin list.
|
|
11
10
|
*/
|
|
12
|
-
declare function viteConfigHasCloudflarePlugin(root: string): boolean;
|
|
11
|
+
export declare function viteConfigHasCloudflarePlugin(root: string): boolean;
|
|
13
12
|
/**
|
|
14
13
|
* Detect whether the Vite config assigns a CDN or data cache adapter — i.e. the
|
|
15
14
|
* `cdn` or `data` field of the `vinext({ cache })` option is given a value.
|
|
@@ -18,14 +17,18 @@ declare function viteConfigHasCloudflarePlugin(root: string): boolean;
|
|
|
18
17
|
* an unreadable or absent config is treated as configured so a deploy is never
|
|
19
18
|
* blocked on a false negative.
|
|
20
19
|
*/
|
|
21
|
-
declare function viteConfigHasCacheAdapter(root: string): boolean;
|
|
22
|
-
type ResolvedKvDataAdapterConfig = {
|
|
20
|
+
export declare function viteConfigHasCacheAdapter(root: string): boolean;
|
|
21
|
+
export type ResolvedKvDataAdapterConfig = {
|
|
23
22
|
binding: string;
|
|
24
23
|
appPrefix?: string;
|
|
25
24
|
ttlSeconds?: number;
|
|
26
25
|
};
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
export type ResolvedCdnAdapterConfig = {
|
|
27
|
+
versionMetadataBinding: string;
|
|
28
|
+
};
|
|
29
|
+
export declare function resolveCdnAdapterConfig(cache: VinextCacheConfig | null | undefined): ResolvedCdnAdapterConfig | null;
|
|
30
|
+
export declare function resolveKvDataAdapterConfig(cache: VinextCacheConfig | null | undefined): ResolvedKvDataAdapterConfig | null;
|
|
31
|
+
export declare function viteConfigHasImageAdapter(root: string): boolean;
|
|
29
32
|
/**
|
|
30
33
|
* Detect whether an existing user-authored Worker entry wires up a cache
|
|
31
34
|
* backend imperatively via one of the `setCacheHandler` / `setDataCacheHandler`
|
|
@@ -40,16 +43,15 @@ declare function viteConfigHasImageAdapter(root: string): boolean;
|
|
|
40
43
|
* missing Worker entry returns false (nothing to inspect — defer to other
|
|
41
44
|
* checks).
|
|
42
45
|
*/
|
|
43
|
-
declare function workerEntryHasCacheHandler(root: string): boolean;
|
|
46
|
+
export declare function workerEntryHasCacheHandler(root: string): boolean;
|
|
44
47
|
/**
|
|
45
48
|
* Build the error thrown when an ISR/cached app is deployed without a cache
|
|
46
49
|
* adapter configured in the Vite config. Production deployments need a
|
|
47
50
|
* persistent cache backend; vinext no longer scaffolds one into the Worker
|
|
48
51
|
* entry, so it must be declared via `vinext({ cache })`.
|
|
49
52
|
*/
|
|
50
|
-
declare function formatMissingCacheAdapterError(options: {
|
|
53
|
+
export declare function formatMissingCacheAdapterError(options: {
|
|
51
54
|
configFile?: string;
|
|
52
55
|
}): string;
|
|
53
|
-
declare function formatImageOptimizationHint(): string;
|
|
54
|
-
//#endregion
|
|
55
|
-
export { ResolvedKvDataAdapterConfig, formatImageOptimizationHint, formatMissingCacheAdapterError, resolveKvDataAdapterConfig, viteConfigHasCacheAdapter, viteConfigHasCloudflarePlugin, viteConfigHasImageAdapter, workerEntryHasCacheHandler };
|
|
56
|
+
export declare function formatImageOptimizationHint(): string;
|
|
57
|
+
//#endregion
|
package/dist/deploy-config.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { DEFAULT_KV_DATA_CACHE_BINDING } from "./cache/kv-data-adapter.js";
|
|
2
|
-
import
|
|
2
|
+
import { DEFAULT_CDN_VERSION_METADATA_BINDING } from "./cache/cdn-adapter.js";
|
|
3
3
|
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
4
6
|
import { findViteConfigPath } from "vinext/internal/utils/project";
|
|
5
7
|
//#region src/deploy-config.ts
|
|
6
8
|
function escapeRegExp(value) {
|
|
@@ -84,9 +86,25 @@ function viteConfigHasCacheAdapter(root) {
|
|
|
84
86
|
return true;
|
|
85
87
|
}
|
|
86
88
|
const block = extractCacheBlock(content);
|
|
87
|
-
if (!block)
|
|
89
|
+
if (!block) {
|
|
90
|
+
const assigned = /\bcache\s*:\s*([^,}\n]+)/.exec(content)?.[1].trim();
|
|
91
|
+
return Boolean(assigned && assigned !== "undefined" && assigned !== "null");
|
|
92
|
+
}
|
|
88
93
|
return cacheFieldAssigned(block, "cdn") || cacheFieldAssigned(block, "data");
|
|
89
94
|
}
|
|
95
|
+
function isCloudflareCdnAdapterPath(adapter) {
|
|
96
|
+
const normalized = adapter.replace(/\\/g, "/");
|
|
97
|
+
return ["cdn-adapter.runtime", "response-store-cdn.runtime"].some((runtime) => {
|
|
98
|
+
const bundledRuntime = fileURLToPath(new URL(`./cache/${runtime}.js`, import.meta.url)).replace(/\\/g, "/");
|
|
99
|
+
return normalized === `@vinext/cloudflare/cache/${runtime}` || normalized === `@vinext/cloudflare/cache/${runtime}.js` || normalized === bundledRuntime;
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function resolveCdnAdapterConfig(cache) {
|
|
103
|
+
const cdn = cache?.cdn;
|
|
104
|
+
if (!cdn?.adapter || !isCloudflareCdnAdapterPath(cdn.adapter)) return null;
|
|
105
|
+
const options = cdn.options;
|
|
106
|
+
return { versionMetadataBinding: typeof options?.versionMetadataBinding === "string" && options.versionMetadataBinding.length > 0 ? options.versionMetadataBinding : DEFAULT_CDN_VERSION_METADATA_BINDING };
|
|
107
|
+
}
|
|
90
108
|
function isCloudflareKvDataAdapterPath(adapter) {
|
|
91
109
|
const normalized = adapter.replace(/\\/g, "/");
|
|
92
110
|
return normalized === "@vinext/cloudflare/cache/kv-data-adapter.runtime" || normalized === "@vinext/cloudflare/cache/kv-data-adapter.runtime.js" || normalized.endsWith("/cache/kv-data-adapter.runtime.js");
|
|
@@ -166,4 +184,4 @@ function formatImageOptimizationHint() {
|
|
|
166
184
|
return " [vinext] next/image is served unoptimized. To enable edge image\n optimization via Cloudflare Images, run:\n\n vinext init --platform=cloudflare --image-optimization=cloudflare-images\n\n This adds the imagesOptimizer() option to your Vite config and the matching\n IMAGES binding to your Wrangler config without replacing existing settings.";
|
|
167
185
|
}
|
|
168
186
|
//#endregion
|
|
169
|
-
export { formatImageOptimizationHint, formatMissingCacheAdapterError, resolveKvDataAdapterConfig, viteConfigHasCacheAdapter, viteConfigHasCloudflarePlugin, viteConfigHasImageAdapter, workerEntryHasCacheHandler };
|
|
187
|
+
export { formatImageOptimizationHint, formatMissingCacheAdapterError, resolveCdnAdapterConfig, resolveKvDataAdapterConfig, viteConfigHasCacheAdapter, viteConfigHasCloudflarePlugin, viteConfigHasImageAdapter, workerEntryHasCacheHandler };
|
package/dist/deploy-help.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
//#region src/deploy-help.d.ts
|
|
2
|
-
declare function formatDeployHelp(): string;
|
|
3
|
-
declare function printDeployHelp(): void;
|
|
4
|
-
//#endregion
|
|
5
|
-
export { formatDeployHelp, printDeployHelp };
|
|
2
|
+
export declare function formatDeployHelp(): string;
|
|
3
|
+
export declare function printDeployHelp(): void;
|
|
4
|
+
//#endregion
|
package/dist/deploy-help.js
CHANGED
|
@@ -18,6 +18,9 @@ function formatDeployHelp() {
|
|
|
18
18
|
--config <path> Wrangler config path (default: wrangler.jsonc/json/toml)
|
|
19
19
|
--skip-build Skip the build step (use existing dist/)
|
|
20
20
|
--dry-run Validate setup without building or deploying
|
|
21
|
+
--verbose Print raw output from internal Wrangler commands
|
|
22
|
+
--no-promote Do not promote the uploaded Worker version to 100%
|
|
23
|
+
traffic
|
|
21
24
|
--prerender-all Pre-render discovered routes after building (future
|
|
22
25
|
releases will auto-populate the remote cache)
|
|
23
26
|
--prerender-concurrency <count>
|
|
@@ -25,29 +28,63 @@ function formatDeployHelp() {
|
|
|
25
28
|
--experimental-warm-cdn-cache
|
|
26
29
|
Upload a Worker version, warm build-discovered paths
|
|
27
30
|
through the production URL, then promote it (experimental)
|
|
31
|
+
--warm-cdn-target <origin>
|
|
32
|
+
HTTPS origin to use for discovery, probing, and warming
|
|
33
|
+
(overrides URLs inferred from Wrangler output)
|
|
28
34
|
--warm-cdn-concurrency <count>
|
|
29
|
-
Maximum number of CDN warmup requests in parallel
|
|
30
|
-
--warm-cdn-timeout <ms> Per-request CDN warmup timeout (default:
|
|
31
|
-
--warm-cdn-retries <n> Retries
|
|
32
|
-
|
|
35
|
+
Maximum number of CDN warmup requests in parallel (default: 25)
|
|
36
|
+
--warm-cdn-timeout <ms> Per-request CDN warmup timeout (default: 10000)
|
|
37
|
+
--warm-cdn-retries <n> Retries per failed CDN warmup request (default: 1;
|
|
38
|
+
staged-version propagation default: 60)
|
|
39
|
+
--warm-cdn-discovery-timeout <ms>
|
|
40
|
+
Total staged path-discovery deadline (default: 120000)
|
|
41
|
+
--warm-cdn-discovery-retries <n>
|
|
42
|
+
Optional staged path-discovery retry limit
|
|
43
|
+
(default: derived from the discovery deadline)
|
|
44
|
+
--warm-cdn-probe-timeout <ms>
|
|
45
|
+
Abort when cacheability probing makes no progress for
|
|
46
|
+
this duration (default: 120000)
|
|
47
|
+
--warm-cdn-probe-retries <n>
|
|
48
|
+
Cacheability-probe retries (default: 2)
|
|
49
|
+
--warm-cdn-certify With --experimental-warm-cdn-cache, re-request warmed
|
|
50
|
+
entries using headers only and require every planned
|
|
51
|
+
entry to be reusable before promotion
|
|
52
|
+
--warm-cdn-readiness-timeout <ms>
|
|
53
|
+
Explicit total staged-readiness deadline (default:
|
|
54
|
+
120000)
|
|
55
|
+
--warm-cdn-readiness-retries <n>
|
|
56
|
+
Staged-readiness retries (default: 60)
|
|
57
|
+
--warm-cdn-readiness-probes <count>
|
|
58
|
+
Consecutive successful staged-readiness probes
|
|
59
|
+
required before warming (default: 6)
|
|
60
|
+
--warm-cdn-readiness-probe-delay <ms>
|
|
61
|
+
Delay between staged-readiness probes (default: 1000)
|
|
62
|
+
--dangerously-promote-on-cdn-warm-error
|
|
63
|
+
Promote even when ordinary staged warmup cannot be
|
|
64
|
+
verified (never bypasses --warm-cdn-certify)
|
|
65
|
+
--warm-cdn-promotion-delay <ms>
|
|
66
|
+
Delay before promotion after warmup (default: 15000)
|
|
33
67
|
--warm-cdn-include-fallbacks
|
|
34
68
|
Also warm PPR fallback-shell placeholder paths
|
|
35
69
|
-h, --help Show this help
|
|
36
70
|
|
|
37
71
|
Experimental:
|
|
38
|
-
--experimental-
|
|
39
|
-
|
|
40
|
-
--
|
|
41
|
-
--
|
|
72
|
+
--experimental-traffic-aware-warm-cache
|
|
73
|
+
Select CDN pre-warm routes from traffic
|
|
74
|
+
--traffic-aware-coverage <pct> Traffic coverage target, 0-100 (default: 90)
|
|
75
|
+
--traffic-aware-limit <count> Hard cap on selected routes (default: 1000)
|
|
76
|
+
--traffic-aware-window <hours> Analytics lookback window in hours (default: 24)
|
|
42
77
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
CLOUDFLARE_API_TOKEN environment variable with Zone.Analytics read permission.
|
|
78
|
+
Traffic-aware warming uses Cloudflare zone analytics to select the
|
|
79
|
+
highest-traffic routes, then feeds those routes into the same staged CDN
|
|
80
|
+
pre-warming flow used by --experimental-warm-cdn-cache. It requires a custom
|
|
81
|
+
domain and a CLOUDFLARE_API_TOKEN with Zone Analytics read permission.
|
|
48
82
|
|
|
49
|
-
|
|
50
|
-
|
|
83
|
+
Legacy --experimental-tpr and --tpr-* aliases remain supported.
|
|
84
|
+
|
|
85
|
+
Workers Cache automatically uses tiered caching. Warmed entries can therefore
|
|
86
|
+
be reused outside the data center reached by the warmup request after cache
|
|
87
|
+
propagation, but the deploy does not wait for every edge location to fill.
|
|
51
88
|
|
|
52
89
|
Examples:
|
|
53
90
|
npx @vinext/cloudflare deploy Build and deploy to production
|
|
@@ -58,10 +95,16 @@ function formatDeployHelp() {
|
|
|
58
95
|
vinext-cloudflare deploy --config dist/server/wrangler.json Deploy using a generated Wrangler config
|
|
59
96
|
vinext-cloudflare deploy --dry-run Validate setup without building or deploying
|
|
60
97
|
vinext-cloudflare deploy --name my-app Deploy with a custom Worker name
|
|
98
|
+
vinext-cloudflare deploy --no-promote Upload a version without changing deployment traffic
|
|
61
99
|
vinext-cloudflare deploy --experimental-warm-cdn-cache Warm build-discovered paths during version deploy (experimental)
|
|
62
|
-
vinext-cloudflare deploy --experimental-
|
|
63
|
-
|
|
64
|
-
vinext-cloudflare deploy --experimental-
|
|
100
|
+
vinext-cloudflare deploy --experimental-warm-cdn-cache --warm-cdn-target https://example.com
|
|
101
|
+
Warm an explicit production origin
|
|
102
|
+
vinext-cloudflare deploy --experimental-traffic-aware-warm-cache
|
|
103
|
+
Enable traffic-aware warming
|
|
104
|
+
vinext-cloudflare deploy --experimental-traffic-aware-warm-cache --traffic-aware-coverage 95
|
|
105
|
+
Cover 95% of traffic
|
|
106
|
+
vinext-cloudflare deploy --experimental-traffic-aware-warm-cache --traffic-aware-limit 500
|
|
107
|
+
Cap at 500 routes
|
|
65
108
|
`;
|
|
66
109
|
}
|
|
67
110
|
function printDeployHelp() {
|
package/dist/deploy.d.ts
CHANGED
|
@@ -1,31 +1,80 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CdnWarmOptions, CdnWarmRequestPlan, PrerenderWarmPlan } from "./cdn-warm.js";
|
|
2
|
+
import { parseWranglerConfig } from "./wrangler-config.js";
|
|
3
|
+
import { TrafficEntry } from "./tpr.js";
|
|
2
4
|
import { WranglerDeploymentStatus, WranglerVersionTraffic } from "./version-deploy.js";
|
|
3
5
|
import { KVBulkPair } from "./prerender-kv-populate.js";
|
|
4
6
|
import { spawn } from "node:child_process";
|
|
5
|
-
|
|
7
|
+
import { VinextCacheConfig } from "vinext/internal/config/prerender";
|
|
8
|
+
import { ProjectInfo } from "vinext/internal/utils/project";
|
|
6
9
|
//#region src/deploy.d.ts
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
export declare const DEFAULT_CDN_WARM_PROMOTION_DELAY_MS = 15000;
|
|
11
|
+
export type DeployOptions = {
|
|
12
|
+
/** Project root directory */
|
|
13
|
+
root: string;
|
|
14
|
+
/** Deploy to preview environment (default: production) */
|
|
15
|
+
preview?: boolean;
|
|
16
|
+
/** Wrangler environment name from wrangler.jsonc env.<name> */
|
|
17
|
+
env?: string;
|
|
18
|
+
/** Custom project name for the Worker */
|
|
19
|
+
name?: string;
|
|
20
|
+
/** Wrangler config path, relative to root unless absolute */
|
|
21
|
+
config?: string;
|
|
22
|
+
/** Skip the build step (assume already built) */
|
|
23
|
+
skipBuild?: boolean;
|
|
24
|
+
/** Dry run — validate setup but don't build or deploy */
|
|
25
|
+
dryRun?: boolean;
|
|
26
|
+
/** Print raw output from internal Wrangler commands. */
|
|
27
|
+
verbose?: boolean;
|
|
28
|
+
/** Pre-render all discovered routes into the dist output after building */
|
|
29
|
+
prerenderAll?: boolean;
|
|
30
|
+
/** Maximum number of routes to prerender in parallel */
|
|
31
|
+
prerenderConcurrency?: number;
|
|
32
|
+
/** Warm Cloudflare's CDN cache by requesting build-discovered paths for the uploaded version */
|
|
33
|
+
warmCdnCache?: boolean;
|
|
34
|
+
/** Explicit production origin to use for CDN discovery, probing, and warming */
|
|
35
|
+
warmCdnTarget?: string;
|
|
36
|
+
/** Maximum number of CDN warmup requests to issue in parallel */
|
|
37
|
+
warmCdnConcurrency?: number;
|
|
38
|
+
/** Per-request CDN warmup timeout in milliseconds */
|
|
39
|
+
warmCdnTimeout?: number;
|
|
40
|
+
/** Number of CDN warmup retries for transient failures */
|
|
41
|
+
warmCdnRetries?: number;
|
|
42
|
+
/** Maximum duration of staged Worker path discovery */
|
|
43
|
+
warmCdnDiscoveryTimeout?: number;
|
|
44
|
+
/** Number of transient staged Worker path discovery retries */
|
|
45
|
+
warmCdnDiscoveryRetries?: number;
|
|
46
|
+
/** Abort after this duration without a completed cacheability probe */
|
|
47
|
+
warmCdnProbeTimeout?: number;
|
|
48
|
+
/** Number of transient staged Worker cacheability probe retries */
|
|
49
|
+
warmCdnProbeRetries?: number;
|
|
50
|
+
/** Re-request warmed identities and require reusable CDN hits before promotion */
|
|
51
|
+
warmCdnCertify?: boolean;
|
|
52
|
+
/** Maximum duration of staged Worker readiness verification */
|
|
53
|
+
warmCdnReadinessTimeout?: number;
|
|
54
|
+
/** Number of staged Worker readiness retries */
|
|
55
|
+
warmCdnReadinessRetries?: number;
|
|
56
|
+
/** Consecutive successful probes required before warming the staged Worker */
|
|
57
|
+
warmCdnReadinessProbes?: number;
|
|
58
|
+
/** Delay between staged Worker readiness probes in milliseconds */
|
|
59
|
+
warmCdnReadinessProbeDelay?: number;
|
|
60
|
+
/** Promote even when staged CDN warmup cannot be completed */
|
|
61
|
+
dangerouslyPromoteOnCdnWarmError?: boolean;
|
|
62
|
+
/** Promote the uploaded Worker version to 100% traffic (default: true) */
|
|
63
|
+
warmCdnPromote?: boolean;
|
|
64
|
+
/** Delay between successful warmup and promotion in milliseconds */
|
|
65
|
+
warmCdnPromotionDelay?: number;
|
|
66
|
+
/** Include PPR fallback-shell placeholder paths during CDN warmup */
|
|
67
|
+
warmCdnIncludeFallbacks?: boolean;
|
|
68
|
+
/** Select CDN pre-warm routes using traffic analytics */
|
|
69
|
+
experimentalTPR?: boolean;
|
|
70
|
+
/** TPR: traffic coverage percentage target (0–100, default: 90) */
|
|
71
|
+
tprCoverage?: number;
|
|
72
|
+
/** TPR: hard cap on selected routes (default: 1000) */
|
|
73
|
+
tprLimit?: number;
|
|
74
|
+
/** TPR: analytics lookback window in hours (default: 24) */
|
|
26
75
|
tprWindow?: number;
|
|
27
76
|
};
|
|
28
|
-
declare function parseDeployArgs(args: string[]): {
|
|
77
|
+
export declare function parseDeployArgs(args: string[]): {
|
|
29
78
|
help: boolean;
|
|
30
79
|
preview: boolean;
|
|
31
80
|
env: string | undefined;
|
|
@@ -33,13 +82,26 @@ declare function parseDeployArgs(args: string[]): {
|
|
|
33
82
|
config: string | undefined;
|
|
34
83
|
skipBuild: boolean;
|
|
35
84
|
dryRun: boolean;
|
|
85
|
+
verbose: boolean;
|
|
36
86
|
prerenderAll: boolean;
|
|
37
87
|
prerenderConcurrency: number | undefined;
|
|
38
88
|
warmCdnCache: boolean;
|
|
89
|
+
warmCdnTarget: string | undefined;
|
|
39
90
|
warmCdnConcurrency: number | undefined;
|
|
40
91
|
warmCdnTimeout: number | undefined;
|
|
41
92
|
warmCdnRetries: number | undefined;
|
|
42
|
-
|
|
93
|
+
warmCdnDiscoveryTimeout: number | undefined;
|
|
94
|
+
warmCdnDiscoveryRetries: number | undefined;
|
|
95
|
+
warmCdnProbeTimeout: number | undefined;
|
|
96
|
+
warmCdnProbeRetries: number | undefined;
|
|
97
|
+
warmCdnCertify: boolean;
|
|
98
|
+
warmCdnReadinessTimeout: number | undefined;
|
|
99
|
+
warmCdnReadinessRetries: number | undefined;
|
|
100
|
+
warmCdnReadinessProbes: number | undefined;
|
|
101
|
+
warmCdnReadinessProbeDelay: number | undefined;
|
|
102
|
+
dangerouslyPromoteOnCdnWarmError: boolean;
|
|
103
|
+
warmCdnPromote: boolean;
|
|
104
|
+
warmCdnPromotionDelay: number | undefined;
|
|
43
105
|
warmCdnIncludeFallbacks: boolean;
|
|
44
106
|
experimentalTPR: boolean;
|
|
45
107
|
tprCoverage: number | undefined;
|
|
@@ -58,7 +120,7 @@ declare function parseDeployArgs(args: string[]): {
|
|
|
58
120
|
*
|
|
59
121
|
* Passing `undefined` is a no-op; the callback runs with `process.env` untouched.
|
|
60
122
|
*/
|
|
61
|
-
declare function withCloudflareEnv<T>(env: string | undefined, fn: () => Promise<T>): Promise<T>;
|
|
123
|
+
export declare function withCloudflareEnv<T>(env: string | undefined, fn: () => Promise<T>): Promise<T>;
|
|
62
124
|
type WranglerDeployArgs = {
|
|
63
125
|
args: string[];
|
|
64
126
|
env: string | undefined;
|
|
@@ -67,9 +129,9 @@ type WranglerKVBulkPutArgs = {
|
|
|
67
129
|
args: string[];
|
|
68
130
|
env: string | undefined;
|
|
69
131
|
};
|
|
70
|
-
declare function validateWranglerEnvName(env: string): string;
|
|
71
|
-
declare function buildWranglerDeployArgs(options: Pick<DeployOptions, "preview" | "env" | "name" | "config">): WranglerDeployArgs;
|
|
72
|
-
declare function buildWranglerKVBulkPutArgs(options: {
|
|
132
|
+
export declare function validateWranglerEnvName(env: string): string;
|
|
133
|
+
export declare function buildWranglerDeployArgs(options: Pick<DeployOptions, "preview" | "env" | "name" | "config">): WranglerDeployArgs;
|
|
134
|
+
export declare function buildWranglerKVBulkPutArgs(options: {
|
|
73
135
|
binding: string;
|
|
74
136
|
env?: string;
|
|
75
137
|
filePath: string;
|
|
@@ -80,30 +142,48 @@ declare function buildWranglerKVBulkPutArgs(options: {
|
|
|
80
142
|
* Invoking the JavaScript file through `process.execPath` avoids the `.cmd`
|
|
81
143
|
* shim and command shell that package managers create on Windows.
|
|
82
144
|
*/
|
|
83
|
-
declare function resolveWranglerBin(root: string, resolvePackageJson?: (root: string) => string | null): string;
|
|
84
|
-
declare function buildNodeCliInvocation(scriptPath: string, args: string[], nodeExecutable?: string): {
|
|
145
|
+
export declare function resolveWranglerBin(root: string, resolvePackageJson?: (root: string) => string | null): string;
|
|
146
|
+
export declare function buildNodeCliInvocation(scriptPath: string, args: string[], nodeExecutable?: string): {
|
|
85
147
|
file: string;
|
|
86
148
|
args: string[];
|
|
87
149
|
};
|
|
88
|
-
declare function buildWranglerInvocation(root: string, options: Pick<DeployOptions, "preview" | "env" | "name" | "config">, nodeExecutable?: string): {
|
|
150
|
+
export declare function buildWranglerInvocation(root: string, options: Pick<DeployOptions, "preview" | "env" | "name" | "config">, nodeExecutable?: string): {
|
|
89
151
|
file: string;
|
|
90
152
|
args: string[];
|
|
91
153
|
env: string | undefined;
|
|
92
154
|
};
|
|
93
|
-
declare function runWranglerKVBulkPut(root: string, options: {
|
|
155
|
+
export declare function runWranglerKVBulkPut(root: string, options: {
|
|
94
156
|
binding: string;
|
|
95
157
|
env?: string;
|
|
96
158
|
pairs: KVBulkPair[];
|
|
97
159
|
tempDir?: string;
|
|
98
160
|
}, execute?: typeof spawn, nodeExecutable?: string): Promise<void>;
|
|
99
|
-
declare function runWranglerDeploy(root: string, options: Pick<DeployOptions, "preview" | "env" | "name" | "config"
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
declare function
|
|
103
|
-
|
|
161
|
+
export declare function runWranglerDeploy(root: string, options: Pick<DeployOptions, "preview" | "env" | "name" | "config" | "verbose"> & {
|
|
162
|
+
promote?: boolean;
|
|
163
|
+
}, execute?: typeof spawn): Promise<string>;
|
|
164
|
+
export declare function hasCdnWarmRequests(plan: Omit<CdnWarmRequestPlan, "pagesDataPaths"> & {
|
|
165
|
+
pagesDataPaths?: readonly string[];
|
|
166
|
+
}): boolean;
|
|
167
|
+
export declare function selectTPRWarmPlan(plan: PrerenderWarmPlan, traffic: readonly TrafficEntry[], coverage: number, limit: number): PrerenderWarmPlan;
|
|
168
|
+
export declare function projectRequiresRouteCacheabilityProbeManifest(project: Pick<ProjectInfo, "isAppRouter" | "isPagesRouter">, cacheConfig: VinextCacheConfig | null): boolean;
|
|
169
|
+
type CdnWarmDeployOptions = Pick<DeployOptions, "preview" | "env" | "name" | "config" | "verbose" | "warmCdnTarget" | "warmCdnConcurrency" | "warmCdnTimeout" | "warmCdnRetries" | "warmCdnDiscoveryTimeout" | "warmCdnDiscoveryRetries" | "warmCdnProbeTimeout" | "warmCdnProbeRetries" | "warmCdnCertify" | "warmCdnReadinessTimeout" | "warmCdnReadinessRetries" | "warmCdnReadinessProbes" | "warmCdnReadinessProbeDelay" | "dangerouslyPromoteOnCdnWarmError" | "warmCdnPromote" | "warmCdnPromotionDelay"> & Pick<CdnWarmOptions, "deploymentId" | "expectedBuildId" | "expectedRscBuildId" | "loadingShellPaths" | "pagesDataPaths" | "routeHandlerPaths" | "routePatterns" | "rscPaths" | "statusSource"> & {
|
|
170
|
+
/** Allow optional route selection to discover no warmable requests. */
|
|
171
|
+
allowEmptyWarmPlan?: boolean;
|
|
172
|
+
/** Probe a staged Worker and upload the resulting manifest as a second version. */
|
|
173
|
+
cacheabilityProbe?: boolean;
|
|
174
|
+
discoverWarmPlan?: (target: {
|
|
175
|
+
headers?: HeadersInit;
|
|
176
|
+
targetUrl: string;
|
|
177
|
+
}) => Promise<PrerenderWarmPlan>;
|
|
178
|
+
/** Narrow the final warm requests without changing discovery or probe metadata. */
|
|
179
|
+
selectWarmPlan?: (plan: PrerenderWarmPlan) => PrerenderWarmPlan;
|
|
180
|
+
};
|
|
181
|
+
export declare function deployWithCdnWarmup(root: string, paths: readonly string[], options: CdnWarmDeployOptions): Promise<string>;
|
|
182
|
+
export declare function resolveCdnWarmupTargetUrl(root: string, deployedUrl: string | null): string | null;
|
|
183
|
+
export declare function resolveCdnWarmupTargetUrl(root: string, deployedUrl: string | null, options: Pick<DeployOptions, "preview" | "env" | "config" | "warmCdnTarget">): string | null;
|
|
184
|
+
export declare function getZeroPercentStagingTraffic(deployment: WranglerDeploymentStatus | null, versionId: string): WranglerVersionTraffic[] | null;
|
|
104
185
|
type ParsedWranglerConfig = NonNullable<ReturnType<typeof parseWranglerConfig>>;
|
|
105
|
-
declare function resolveWorkerNameForVersionOverride(config: ParsedWranglerConfig | null, options: Pick<DeployOptions, "preview" | "env" | "name">): string | undefined;
|
|
106
|
-
declare function buildVersionOverrideHeaders(workerName: string | undefined, versionId: string): HeadersInit | undefined;
|
|
107
|
-
declare function deploy(options: DeployOptions): Promise<void>;
|
|
108
|
-
//#endregion
|
|
109
|
-
export { DeployOptions, buildNodeCliInvocation, buildVersionOverrideHeaders, buildWranglerDeployArgs, buildWranglerInvocation, buildWranglerKVBulkPutArgs, deploy, deployWithCdnWarmup, getZeroPercentStagingTraffic, parseDeployArgs, resolveCdnWarmupTargetUrl, resolveWorkerNameForVersionOverride, resolveWranglerBin, runWranglerDeploy, runWranglerKVBulkPut, validateWranglerEnvName, withCloudflareEnv };
|
|
186
|
+
export declare function resolveWorkerNameForVersionOverride(config: ParsedWranglerConfig | null, options: Pick<DeployOptions, "preview" | "env" | "name">): string | undefined;
|
|
187
|
+
export declare function buildVersionOverrideHeaders(workerName: string | undefined, versionId: string): HeadersInit | undefined;
|
|
188
|
+
export declare function deploy(options: DeployOptions): Promise<void>;
|
|
189
|
+
//#endregion
|