@vinext/cloudflare 1.0.0-beta.9 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +165 -37
- package/dist/cache/cdn-adapter-config.d.ts +2 -1
- package/dist/cache/cdn-adapter-config.js +13 -5
- package/dist/cache/cdn-adapter.d.ts +5 -56
- package/dist/cache/cdn-adapter.js +3 -61
- package/dist/cache/cdn-adapter.runtime.d.ts +1 -0
- package/dist/cache/cdn-adapter.runtime.js +17 -3
- package/dist/cache/cdn-build-id.d.ts +1 -1
- package/dist/cache/cdn-build-id.js +1 -1
- package/dist/cache/config.d.ts +137 -0
- package/dist/cache/config.js +87 -0
- package/dist/cache/kv-data-adapter.d.ts +1 -1
- package/dist/cache/kv-data-adapter.js +1 -1
- package/dist/cache/kv-data-adapter.runtime.js +13 -9
- package/dist/cache/kv-key.d.ts +7 -4
- package/dist/cache/kv-key.js +16 -5
- package/dist/cache/response-store-adapter.d.ts +9 -6
- package/dist/cache/response-store-adapter.js +20 -1
- package/dist/cache/response-store-adapter.worker.js +100 -43
- package/dist/cache/response-store-cdn.runtime.js +1 -0
- package/dist/cache/response-store-data.runtime.js +53 -31
- package/dist/cache/static-assets-adapter.build.d.ts +6 -0
- package/dist/cache/static-assets-adapter.build.js +65 -0
- package/dist/cache/static-assets-adapter.d.ts +27 -0
- package/dist/cache/static-assets-adapter.js +26 -0
- package/dist/cache/static-assets-adapter.runtime.d.ts +26 -0
- package/dist/cache/static-assets-adapter.runtime.js +77 -0
- package/dist/cache/static-assets-adapter.shared.d.ts +12 -0
- package/dist/cache/static-assets-adapter.shared.js +4 -0
- package/dist/cache/workers-cache-cdn-adapter.d.ts +58 -0
- package/dist/cache/workers-cache-cdn-adapter.js +65 -0
- package/dist/cacheability-artifact.d.ts +7 -1
- package/dist/cacheability-artifact.js +60 -21
- package/dist/cacheability-probe.d.ts +2 -0
- package/dist/cacheability-probe.js +107 -13
- package/dist/cdn-warm.d.ts +1 -0
- package/dist/cdn-warm.js +2 -1
- package/dist/deploy-config.d.ts +3 -8
- package/dist/deploy-config.js +5 -23
- package/dist/deploy-help.js +47 -42
- package/dist/deploy.d.ts +18 -16
- package/dist/deploy.js +355 -216
- package/dist/tpr.d.ts +4 -0
- package/dist/tpr.js +16 -7
- package/dist/version-deploy.d.ts +27 -0
- package/dist/version-deploy.js +121 -3
- package/dist/wrangler-version-metadata.js +1 -1
- package/package.json +16 -5
- package/dist/prerender-kv-populate.d.ts +0 -24
- package/dist/prerender-kv-populate.js +0 -153
package/dist/deploy-help.js
CHANGED
|
@@ -9,78 +9,81 @@ function formatDeployHelp() {
|
|
|
9
9
|
- Detects App Router or Pages Router
|
|
10
10
|
- Validates setup from vinext init --platform=cloudflare
|
|
11
11
|
- Builds the project with Vite
|
|
12
|
-
- Deploys
|
|
12
|
+
- Deploys with cf for typed Cloudflare config projects, or Wrangler otherwise
|
|
13
13
|
|
|
14
14
|
Options:
|
|
15
15
|
--preview Deploy to preview environment (same as --env preview)
|
|
16
|
-
--env <name>
|
|
17
|
-
--name <name> Custom Worker name
|
|
16
|
+
--env <name> Cloudflare mode for typed config; Wrangler environment otherwise
|
|
17
|
+
--name <name> Custom Worker name for Wrangler config projects
|
|
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
|
|
21
|
+
--verbose Print raw output from internal Cloudflare CLI commands
|
|
22
22
|
--no-promote Do not promote the uploaded Worker version to 100%
|
|
23
23
|
traffic
|
|
24
|
-
--prerender-all
|
|
25
|
-
|
|
24
|
+
--prerender-all Deprecated for Worker deployments; use
|
|
25
|
+
--warm-cache instead (still honored for static
|
|
26
|
+
export and cache adapters that package local
|
|
27
|
+
prerender output)
|
|
26
28
|
--prerender-concurrency <count>
|
|
27
|
-
Maximum
|
|
28
|
-
--
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
--warm-cdn-target <origin>
|
|
29
|
+
Maximum parallel routes for local prerendering
|
|
30
|
+
--warm-cache Upload a Worker version, warm build-discovered paths
|
|
31
|
+
through the production URL, then promote it
|
|
32
|
+
--warm-cache-target <origin>
|
|
32
33
|
HTTPS origin to use for discovery, probing, and warming
|
|
33
34
|
(overrides URLs inferred from Wrangler output)
|
|
34
|
-
|
|
35
|
+
Also supported with traffic-aware warming
|
|
36
|
+
--warm-cache-concurrency <count>
|
|
35
37
|
Maximum number of CDN warmup requests in parallel (default: 25)
|
|
36
|
-
--warm-
|
|
37
|
-
--warm-
|
|
38
|
+
--warm-cache-timeout <ms> Per-request CDN warmup timeout (default: 10000)
|
|
39
|
+
--warm-cache-retries <n> Retries per failed CDN warmup request (default: 1;
|
|
38
40
|
staged-version propagation default: 60)
|
|
39
|
-
--warm-
|
|
41
|
+
--warm-cache-discovery-timeout <ms>
|
|
40
42
|
Total staged path-discovery deadline (default: 120000)
|
|
41
|
-
--warm-
|
|
43
|
+
--warm-cache-discovery-retries <n>
|
|
42
44
|
Optional staged path-discovery retry limit
|
|
43
45
|
(default: derived from the discovery deadline)
|
|
44
|
-
--warm-
|
|
46
|
+
--warm-cache-probe-timeout <ms>
|
|
45
47
|
Abort when cacheability probing makes no progress for
|
|
46
48
|
this duration (default: 120000)
|
|
47
|
-
--warm-
|
|
49
|
+
--warm-cache-probe-retries <n>
|
|
48
50
|
Cacheability-probe retries (default: 2)
|
|
49
|
-
--warm-
|
|
50
|
-
entries using headers only and require
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
--warm-cache-certify With either warming mode, re-request warmed
|
|
52
|
+
entries using headers only and require reusable hits.
|
|
53
|
+
Traffic-aware warming requires every selected entry
|
|
54
|
+
to be reusable before promotion
|
|
55
|
+
--warm-cache-readiness-timeout <ms>
|
|
53
56
|
Explicit total staged-readiness deadline (default:
|
|
54
57
|
120000)
|
|
55
|
-
--warm-
|
|
58
|
+
--warm-cache-readiness-retries <n>
|
|
56
59
|
Staged-readiness retries (default: 60)
|
|
57
|
-
--warm-
|
|
60
|
+
--warm-cache-readiness-probes <count>
|
|
58
61
|
Consecutive successful staged-readiness probes
|
|
59
62
|
required before warming (default: 6)
|
|
60
|
-
--warm-
|
|
63
|
+
--warm-cache-readiness-probe-delay <ms>
|
|
61
64
|
Delay between staged-readiness probes (default: 1000)
|
|
62
|
-
--dangerously-promote-on-
|
|
65
|
+
--dangerously-promote-on-warm-cache-error
|
|
63
66
|
Promote even when ordinary staged warmup cannot be
|
|
64
|
-
verified (never bypasses --warm-
|
|
65
|
-
--warm-
|
|
67
|
+
verified (never bypasses --warm-cache-certify)
|
|
68
|
+
--warm-cache-promotion-delay <ms>
|
|
66
69
|
Delay before promotion after warmup (default: 15000)
|
|
67
|
-
--warm-
|
|
70
|
+
--warm-cache-include-fallbacks
|
|
68
71
|
Also warm PPR fallback-shell placeholder paths
|
|
69
72
|
-h, --help Show this help
|
|
70
73
|
|
|
71
|
-
|
|
72
|
-
--
|
|
73
|
-
Select CDN pre-warm routes from traffic
|
|
74
|
+
Traffic-aware warming:
|
|
75
|
+
--traffic-aware-warm-cache Select cache warming routes from traffic
|
|
74
76
|
--traffic-aware-coverage <pct> Traffic coverage target, 0-100 (default: 90)
|
|
75
77
|
--traffic-aware-limit <count> Hard cap on selected routes (default: 1000)
|
|
76
78
|
--traffic-aware-window <hours> Analytics lookback window in hours (default: 24)
|
|
77
79
|
|
|
78
80
|
Traffic-aware warming uses Cloudflare zone analytics to select the
|
|
79
81
|
highest-traffic routes, then feeds those routes into the same staged CDN
|
|
80
|
-
pre-warming flow used by --
|
|
81
|
-
domain and a CLOUDFLARE_API_TOKEN with Zone Analytics
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
pre-warming flow used by --warm-cache. It requires a custom
|
|
83
|
+
domain and a CLOUDFLARE_API_TOKEN with Zone > Analytics > Read and
|
|
84
|
+
Zone > Zone > Read permissions for that zone.
|
|
85
|
+
Use --warm-cache-target <origin> to provide the production HTTPS origin
|
|
86
|
+
manually for traffic-aware analytics selection, discovery, probing, and warming.
|
|
84
87
|
|
|
85
88
|
Workers Cache automatically uses tiered caching. Warmed entries can therefore
|
|
86
89
|
be reused outside the data center reached by the warmup request after cache
|
|
@@ -91,20 +94,22 @@ function formatDeployHelp() {
|
|
|
91
94
|
vpx @vinext/cloudflare deploy Build and deploy with Vite+
|
|
92
95
|
vp exec vinext-cloudflare deploy Run the locally installed Vite+ bin
|
|
93
96
|
vinext-cloudflare deploy --preview Deploy to a preview URL
|
|
94
|
-
vinext-cloudflare deploy --env staging Deploy using
|
|
97
|
+
vinext-cloudflare deploy --env staging Deploy using Cloudflare mode/environment staging
|
|
95
98
|
vinext-cloudflare deploy --config dist/server/wrangler.json Deploy using a generated Wrangler config
|
|
96
99
|
vinext-cloudflare deploy --dry-run Validate setup without building or deploying
|
|
97
100
|
vinext-cloudflare deploy --name my-app Deploy with a custom Worker name
|
|
98
101
|
vinext-cloudflare deploy --no-promote Upload a version without changing deployment traffic
|
|
99
|
-
vinext-cloudflare deploy --
|
|
100
|
-
vinext-cloudflare deploy --
|
|
102
|
+
vinext-cloudflare deploy --warm-cache Warm build-discovered paths during version deploy
|
|
103
|
+
vinext-cloudflare deploy --warm-cache --warm-cache-target https://example.com
|
|
101
104
|
Warm an explicit production origin
|
|
102
|
-
vinext-cloudflare deploy --
|
|
105
|
+
vinext-cloudflare deploy --traffic-aware-warm-cache
|
|
103
106
|
Enable traffic-aware warming
|
|
104
|
-
vinext-cloudflare deploy --
|
|
107
|
+
vinext-cloudflare deploy --traffic-aware-warm-cache --traffic-aware-coverage 95
|
|
105
108
|
Cover 95% of traffic
|
|
106
|
-
vinext-cloudflare deploy --
|
|
109
|
+
vinext-cloudflare deploy --traffic-aware-warm-cache --traffic-aware-limit 500
|
|
107
110
|
Cap at 500 routes
|
|
111
|
+
vinext-cloudflare deploy --traffic-aware-warm-cache --warm-cache-target https://example.com
|
|
112
|
+
Select and warm traffic routes for an explicit origin
|
|
108
113
|
`;
|
|
109
114
|
}
|
|
110
115
|
function printDeployHelp() {
|
package/dist/deploy.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { CdnWarmOptions, CdnWarmRequestPlan, PrerenderWarmPlan } from "./cdn-warm.js";
|
|
2
2
|
import { parseWranglerConfig } from "./wrangler-config.js";
|
|
3
3
|
import { TrafficEntry } from "./tpr.js";
|
|
4
|
-
import { WranglerDeploymentStatus, WranglerVersionTraffic } from "./version-deploy.js";
|
|
5
|
-
import { KVBulkPair } from "./prerender-kv-populate.js";
|
|
4
|
+
import { WranglerDeploymentStatus, WranglerVersionTraffic, WranglerVersionUploadResult } from "./version-deploy.js";
|
|
6
5
|
import { spawn } from "node:child_process";
|
|
7
|
-
import { VinextCacheConfig } from "vinext/internal/config/prerender";
|
|
6
|
+
import { VinextCacheConfig, VinextRouteRootConfig } from "vinext/internal/config/prerender";
|
|
8
7
|
import { ProjectInfo } from "vinext/internal/utils/project";
|
|
9
8
|
//#region src/deploy.d.ts
|
|
10
9
|
export declare const DEFAULT_CDN_WARM_PROMOTION_DELAY_MS = 15000;
|
|
@@ -74,6 +73,9 @@ export type DeployOptions = {
|
|
|
74
73
|
/** TPR: analytics lookback window in hours (default: 24) */
|
|
75
74
|
tprWindow?: number;
|
|
76
75
|
};
|
|
76
|
+
export type DeploymentTool = "cf" | "wrangler";
|
|
77
|
+
/** The typed cf Vite plugin emits Worker and asset bundles into Build Output. */
|
|
78
|
+
export declare function resolvePrerenderOutputDirs(root: string, deploymentTool: DeploymentTool, configured: VinextRouteRootConfig | null): VinextRouteRootConfig | null;
|
|
77
79
|
export declare function parseDeployArgs(args: string[]): {
|
|
78
80
|
help: boolean;
|
|
79
81
|
preview: boolean;
|
|
@@ -121,21 +123,20 @@ export declare function parseDeployArgs(args: string[]): {
|
|
|
121
123
|
* Passing `undefined` is a no-op; the callback runs with `process.env` untouched.
|
|
122
124
|
*/
|
|
123
125
|
export declare function withCloudflareEnv<T>(env: string | undefined, fn: () => Promise<T>): Promise<T>;
|
|
126
|
+
export declare function resolveViteBuildMode(deploymentTool: DeploymentTool, env: string | undefined): string;
|
|
124
127
|
type WranglerDeployArgs = {
|
|
125
128
|
args: string[];
|
|
126
129
|
env: string | undefined;
|
|
127
130
|
};
|
|
128
|
-
type
|
|
131
|
+
type CfDeployArgs = {
|
|
129
132
|
args: string[];
|
|
130
|
-
|
|
133
|
+
mode: string | undefined;
|
|
131
134
|
};
|
|
132
135
|
export declare function validateWranglerEnvName(env: string): string;
|
|
133
136
|
export declare function buildWranglerDeployArgs(options: Pick<DeployOptions, "preview" | "env" | "name" | "config">): WranglerDeployArgs;
|
|
134
|
-
export declare function
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
filePath: string;
|
|
138
|
-
}): WranglerKVBulkPutArgs;
|
|
137
|
+
export declare function resolveDeploymentTool(root: string): DeploymentTool;
|
|
138
|
+
export declare function isCfCliInstalled(root: string, resolvePackageJson?: (root: string) => string | null): boolean;
|
|
139
|
+
export declare function buildCfDeployArgs(options: Pick<DeployOptions, "preview" | "env">): CfDeployArgs;
|
|
139
140
|
/**
|
|
140
141
|
* Resolve Wrangler's JavaScript CLI entrypoint in node_modules.
|
|
141
142
|
*
|
|
@@ -143,6 +144,7 @@ export declare function buildWranglerKVBulkPutArgs(options: {
|
|
|
143
144
|
* shim and command shell that package managers create on Windows.
|
|
144
145
|
*/
|
|
145
146
|
export declare function resolveWranglerBin(root: string, resolvePackageJson?: (root: string) => string | null): string;
|
|
147
|
+
export declare function resolveCfBin(root: string, resolvePackageJson?: (root: string) => string | null): string;
|
|
146
148
|
export declare function buildNodeCliInvocation(scriptPath: string, args: string[], nodeExecutable?: string): {
|
|
147
149
|
file: string;
|
|
148
150
|
args: string[];
|
|
@@ -152,21 +154,17 @@ export declare function buildWranglerInvocation(root: string, options: Pick<Depl
|
|
|
152
154
|
args: string[];
|
|
153
155
|
env: string | undefined;
|
|
154
156
|
};
|
|
155
|
-
export declare function runWranglerKVBulkPut(root: string, options: {
|
|
156
|
-
binding: string;
|
|
157
|
-
env?: string;
|
|
158
|
-
pairs: KVBulkPair[];
|
|
159
|
-
tempDir?: string;
|
|
160
|
-
}, execute?: typeof spawn, nodeExecutable?: string): Promise<void>;
|
|
161
157
|
export declare function runWranglerDeploy(root: string, options: Pick<DeployOptions, "preview" | "env" | "name" | "config" | "verbose"> & {
|
|
162
158
|
promote?: boolean;
|
|
163
159
|
}, execute?: typeof spawn): Promise<string>;
|
|
160
|
+
export declare function runCfDeploy(root: string, options: Pick<DeployOptions, "preview" | "env">, execute?: typeof spawn): Promise<string>;
|
|
164
161
|
export declare function hasCdnWarmRequests(plan: Omit<CdnWarmRequestPlan, "pagesDataPaths"> & {
|
|
165
162
|
pagesDataPaths?: readonly string[];
|
|
166
163
|
}): boolean;
|
|
167
164
|
export declare function selectTPRWarmPlan(plan: PrerenderWarmPlan, traffic: readonly TrafficEntry[], coverage: number, limit: number): PrerenderWarmPlan;
|
|
168
165
|
export declare function projectRequiresRouteCacheabilityProbeManifest(project: Pick<ProjectInfo, "isAppRouter" | "isPagesRouter">, cacheConfig: VinextCacheConfig | null): boolean;
|
|
169
166
|
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"> & {
|
|
167
|
+
deploymentTool?: DeploymentTool;
|
|
170
168
|
/** Allow optional route selection to discover no warmable requests. */
|
|
171
169
|
allowEmptyWarmPlan?: boolean;
|
|
172
170
|
/** Probe a staged Worker and upload the resulting manifest as a second version. */
|
|
@@ -178,11 +176,15 @@ type CdnWarmDeployOptions = Pick<DeployOptions, "preview" | "env" | "name" | "co
|
|
|
178
176
|
/** Narrow the final warm requests without changing discovery or probe metadata. */
|
|
179
177
|
selectWarmPlan?: (plan: PrerenderWarmPlan) => PrerenderWarmPlan;
|
|
180
178
|
};
|
|
179
|
+
type DeploymentControlPlaneOptions = Pick<DeployOptions, "preview" | "env" | "name" | "config" | "verbose"> & {
|
|
180
|
+
deploymentTool?: DeploymentTool;
|
|
181
|
+
};
|
|
181
182
|
export declare function deployWithCdnWarmup(root: string, paths: readonly string[], options: CdnWarmDeployOptions): Promise<string>;
|
|
182
183
|
export declare function resolveCdnWarmupTargetUrl(root: string, deployedUrl: string | null): string | null;
|
|
183
184
|
export declare function resolveCdnWarmupTargetUrl(root: string, deployedUrl: string | null, options: Pick<DeployOptions, "preview" | "env" | "config" | "warmCdnTarget">): string | null;
|
|
184
185
|
export declare function getZeroPercentStagingTraffic(deployment: WranglerDeploymentStatus | null, versionId: string): WranglerVersionTraffic[] | null;
|
|
185
186
|
type ParsedWranglerConfig = NonNullable<ReturnType<typeof parseWranglerConfig>>;
|
|
187
|
+
export declare function resolveDeploymentControlPlaneOptions(options: DeploymentControlPlaneOptions, upload: Pick<WranglerVersionUploadResult, "workerName">): DeploymentControlPlaneOptions;
|
|
186
188
|
export declare function resolveWorkerNameForVersionOverride(config: ParsedWranglerConfig | null, options: Pick<DeployOptions, "preview" | "env" | "name">): string | undefined;
|
|
187
189
|
export declare function buildVersionOverrideHeaders(workerName: string | undefined, versionId: string): HeadersInit | undefined;
|
|
188
190
|
export declare function deploy(options: DeployOptions): Promise<void>;
|