@vinext/cloudflare 1.0.0-beta.10 → 1.0.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/deploy.d.ts CHANGED
@@ -1,7 +1,7 @@
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";
4
+ import { WranglerDeploymentStatus, WranglerVersionTraffic, WranglerVersionUploadResult } from "./version-deploy.js";
5
5
  import { KVBulkPair } from "./prerender-kv-populate.js";
6
6
  import { spawn } from "node:child_process";
7
7
  import { VinextCacheConfig } from "vinext/internal/config/prerender";
@@ -74,6 +74,7 @@ export type DeployOptions = {
74
74
  /** TPR: analytics lookback window in hours (default: 24) */
75
75
  tprWindow?: number;
76
76
  };
77
+ export type DeploymentTool = "cf" | "wrangler";
77
78
  export declare function parseDeployArgs(args: string[]): {
78
79
  help: boolean;
79
80
  preview: boolean;
@@ -121,16 +122,24 @@ export declare function parseDeployArgs(args: string[]): {
121
122
  * Passing `undefined` is a no-op; the callback runs with `process.env` untouched.
122
123
  */
123
124
  export declare function withCloudflareEnv<T>(env: string | undefined, fn: () => Promise<T>): Promise<T>;
125
+ export declare function resolveViteBuildMode(deploymentTool: DeploymentTool, env: string | undefined): string;
124
126
  type WranglerDeployArgs = {
125
127
  args: string[];
126
128
  env: string | undefined;
127
129
  };
130
+ type CfDeployArgs = {
131
+ args: string[];
132
+ mode: string | undefined;
133
+ };
128
134
  type WranglerKVBulkPutArgs = {
129
135
  args: string[];
130
136
  env: string | undefined;
131
137
  };
132
138
  export declare function validateWranglerEnvName(env: string): string;
133
139
  export declare function buildWranglerDeployArgs(options: Pick<DeployOptions, "preview" | "env" | "name" | "config">): WranglerDeployArgs;
140
+ export declare function resolveDeploymentTool(root: string): DeploymentTool;
141
+ export declare function isCfCliInstalled(root: string, resolvePackageJson?: (root: string) => string | null): boolean;
142
+ export declare function buildCfDeployArgs(options: Pick<DeployOptions, "preview" | "env">): CfDeployArgs;
134
143
  export declare function buildWranglerKVBulkPutArgs(options: {
135
144
  binding: string;
136
145
  env?: string;
@@ -143,6 +152,7 @@ export declare function buildWranglerKVBulkPutArgs(options: {
143
152
  * shim and command shell that package managers create on Windows.
144
153
  */
145
154
  export declare function resolveWranglerBin(root: string, resolvePackageJson?: (root: string) => string | null): string;
155
+ export declare function resolveCfBin(root: string, resolvePackageJson?: (root: string) => string | null): string;
146
156
  export declare function buildNodeCliInvocation(scriptPath: string, args: string[], nodeExecutable?: string): {
147
157
  file: string;
148
158
  args: string[];
@@ -152,8 +162,9 @@ export declare function buildWranglerInvocation(root: string, options: Pick<Depl
152
162
  args: string[];
153
163
  env: string | undefined;
154
164
  };
155
- export declare function runWranglerKVBulkPut(root: string, options: {
165
+ export declare function runKVBulkPut(root: string, options: {
156
166
  binding: string;
167
+ deploymentTool: DeploymentTool;
157
168
  env?: string;
158
169
  pairs: KVBulkPair[];
159
170
  tempDir?: string;
@@ -161,12 +172,14 @@ export declare function runWranglerKVBulkPut(root: string, options: {
161
172
  export declare function runWranglerDeploy(root: string, options: Pick<DeployOptions, "preview" | "env" | "name" | "config" | "verbose"> & {
162
173
  promote?: boolean;
163
174
  }, execute?: typeof spawn): Promise<string>;
175
+ export declare function runCfDeploy(root: string, options: Pick<DeployOptions, "preview" | "env">, execute?: typeof spawn): Promise<string>;
164
176
  export declare function hasCdnWarmRequests(plan: Omit<CdnWarmRequestPlan, "pagesDataPaths"> & {
165
177
  pagesDataPaths?: readonly string[];
166
178
  }): boolean;
167
179
  export declare function selectTPRWarmPlan(plan: PrerenderWarmPlan, traffic: readonly TrafficEntry[], coverage: number, limit: number): PrerenderWarmPlan;
168
180
  export declare function projectRequiresRouteCacheabilityProbeManifest(project: Pick<ProjectInfo, "isAppRouter" | "isPagesRouter">, cacheConfig: VinextCacheConfig | null): boolean;
169
181
  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"> & {
182
+ deploymentTool?: DeploymentTool;
170
183
  /** Allow optional route selection to discover no warmable requests. */
171
184
  allowEmptyWarmPlan?: boolean;
172
185
  /** Probe a staged Worker and upload the resulting manifest as a second version. */
@@ -178,11 +191,15 @@ type CdnWarmDeployOptions = Pick<DeployOptions, "preview" | "env" | "name" | "co
178
191
  /** Narrow the final warm requests without changing discovery or probe metadata. */
179
192
  selectWarmPlan?: (plan: PrerenderWarmPlan) => PrerenderWarmPlan;
180
193
  };
194
+ type DeploymentControlPlaneOptions = Pick<DeployOptions, "preview" | "env" | "name" | "config" | "verbose"> & {
195
+ deploymentTool?: DeploymentTool;
196
+ };
181
197
  export declare function deployWithCdnWarmup(root: string, paths: readonly string[], options: CdnWarmDeployOptions): Promise<string>;
182
198
  export declare function resolveCdnWarmupTargetUrl(root: string, deployedUrl: string | null): string | null;
183
199
  export declare function resolveCdnWarmupTargetUrl(root: string, deployedUrl: string | null, options: Pick<DeployOptions, "preview" | "env" | "config" | "warmCdnTarget">): string | null;
184
200
  export declare function getZeroPercentStagingTraffic(deployment: WranglerDeploymentStatus | null, versionId: string): WranglerVersionTraffic[] | null;
185
201
  type ParsedWranglerConfig = NonNullable<ReturnType<typeof parseWranglerConfig>>;
202
+ export declare function resolveDeploymentControlPlaneOptions(options: DeploymentControlPlaneOptions, upload: Pick<WranglerVersionUploadResult, "workerName">): DeploymentControlPlaneOptions;
186
203
  export declare function resolveWorkerNameForVersionOverride(config: ParsedWranglerConfig | null, options: Pick<DeployOptions, "preview" | "env" | "name">): string | undefined;
187
204
  export declare function buildVersionOverrideHeaders(workerName: string | undefined, versionId: string): HeadersInit | undefined;
188
205
  export declare function deploy(options: DeployOptions): Promise<void>;