@cloudflare/workers-utils 0.42.0 → 0.44.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.
Files changed (32) hide show
  1. package/dist/browser.d.mts +2363 -3
  2. package/dist/browser.mjs +469 -2
  3. package/dist/{chunk-C6O4ION7.mjs → chunk-2Q77CKVU.mjs} +3 -1
  4. package/dist/{chunk-Z62CVNHJ.mjs → chunk-6G6FCMPX.mjs} +4 -1
  5. package/dist/{chunk-XNN5XXU4.mjs → chunk-AUSY7DKT.mjs} +13 -5
  6. package/dist/{chunk-IYSONYTF.mjs → chunk-FR75DWDU.mjs} +7 -5
  7. package/dist/{chunk-MCNIGVAF.mjs → chunk-M3RITKR3.mjs} +4 -1
  8. package/dist/{chunk-53IMCORZ.mjs → chunk-MIA26B4M.mjs} +3 -1
  9. package/dist/{chunk-34VZWBGB.mjs → chunk-MV2OJK3L.mjs} +4 -2
  10. package/dist/{chunk-WO2IAW6M.mjs → chunk-OWPFSLY6.mjs} +4 -1
  11. package/dist/{chunk-OWXQB7GP.mjs → chunk-PWC7WAOU.mjs} +4 -1
  12. package/dist/{chunk-3IYLA2JH.mjs → chunk-QSRIB43D.mjs} +5 -2
  13. package/dist/{chunk-Q72B4Q5Z.mjs → chunk-U6NEESU5.mjs} +6 -3
  14. package/dist/compatibility-date.mjs +5 -2
  15. package/dist/{compliance-DzwHmPKm.d.mts → compliance-CZ8Ownqu.d.mts} +534 -509
  16. package/dist/compliance.d.mts +1 -1
  17. package/dist/compliance.mjs +10 -7
  18. package/dist/docker-path.mjs +6 -3
  19. package/dist/errors.mjs +5 -2
  20. package/dist/fs-helpers.mjs +5 -2
  21. package/dist/global-wrangler-config-path.mjs +6 -3
  22. package/dist/index.d.mts +58 -6
  23. package/dist/index.mjs +584 -38
  24. package/dist/local-env.mjs +4 -1
  25. package/dist/metafile-esm.json +1 -1
  26. package/dist/{open-PBXRGS4R.mjs → open-PCXX3ZDZ.mjs} +3 -1
  27. package/dist/prometheus-metrics.mjs +5 -2
  28. package/dist/test-helpers/index.d.mts +1 -1
  29. package/dist/test-helpers/index.mjs +8 -5
  30. package/dist/zod-format.mjs +5 -2
  31. package/package.json +1 -1
  32. package/dist/chunk-DKSA7K25.mjs +0 -468
@@ -21,554 +21,288 @@ interface FetchError {
21
21
  } & Record<string, unknown>;
22
22
  }
23
23
 
24
+ declare const LOGGER_LEVELS: {
25
+ readonly none: -1;
26
+ readonly error: 0;
27
+ readonly warn: 1;
28
+ readonly info: 2;
29
+ readonly log: 3;
30
+ readonly debug: 4;
31
+ };
32
+ type LoggerLevel = keyof typeof LOGGER_LEVELS;
33
+ type Logger = {
34
+ loggerLevel?: LoggerLevel;
35
+ debug: typeof console.debug;
36
+ debugWithSanitization?: (label: string, ...args: unknown[]) => void;
37
+ log: typeof console.log;
38
+ info: typeof console.info;
39
+ warn: typeof console.warn;
40
+ error: typeof console.error;
41
+ once?: {
42
+ info: typeof console.info;
43
+ log: typeof console.log;
44
+ warn: typeof console.warn;
45
+ error: typeof console.error;
46
+ };
47
+ console?<M extends Exclude<keyof Console, "Console">>(method: M, ...args: Parameters<Console[M]>): void;
48
+ };
49
+
50
+ type ApiCredentials = {
51
+ apiToken: string;
52
+ } | {
53
+ authKey: string;
54
+ authEmail: string;
55
+ };
56
+ interface FetchResult<ResponseType = unknown> {
57
+ success: boolean;
58
+ result: ResponseType;
59
+ errors: FetchError[];
60
+ messages?: (string | {
61
+ code?: number;
62
+ message: string;
63
+ })[];
64
+ result_info?: unknown;
65
+ }
66
+ type FetchResultFetcher = <ResponseType>(complianceConfig: ComplianceConfig, resource: string, init?: RequestInit, queryParams?: URLSearchParams, abortSignal?: AbortSignal) => Promise<ResponseType>;
67
+ type FetchListResultFetcher = <ResponseType>(complianceConfig: ComplianceConfig, resource: string, init?: RequestInit, queryParams?: URLSearchParams) => Promise<ResponseType[]>;
68
+ type FetchPagedListResultFetcher = <ResponseType>(complianceConfig: ComplianceConfig, resource: string, init?: RequestInit, queryParams?: URLSearchParams) => Promise<ResponseType[]>;
24
69
  /**
25
- * `WRANGLER_C3_COMMAND` can override the command used by `wrangler init` when delegating to C3.
26
- *
27
- * By default this will use `create cloudflare`.
28
- *
29
- * To run against the beta release of C3 use:
30
- *
31
- * ```sh
32
- * # Tell Wrangler to use the beta version of create-cloudflare
33
- * WRANGLER_C3_COMMAND="create cloudflare@beta" npx wrangler init
34
- * ```
35
- *
36
- * To test the integration between wrangler and C3 locally, use:
37
- *
38
- * ```sh
39
- * # Ensure both Wrangler and C3 are built
40
- * npm run build
41
- * # Tell Wrangler to use the local version of create-cloudflare
42
- * WRANGLER_C3_COMMAND="exec ./packages/create-cloudflare" npx wrangler init temp
43
- * ```
44
70
  *
45
- * Note that you cannot use `WRANGLER_C3_COMMAND="create cloudflare@2"` if you are
46
- * running Wrangler from inside the monorepo as the bin paths get messed up.
47
- */
48
- declare const getC3CommandFromEnv: () => string;
49
- /** Whether `DO_NOT_TRACK` is set to a supported telemetry opt-out value. */
50
- declare function isDoNotTrackEnabled(): boolean;
51
- /**
52
- * `WRANGLER_SEND_METRICS` controls whether we attempt to send metrics information to Sparrow.
53
- * `DO_NOT_TRACK` takes precedence when it is set to an opt-out value.
71
+ * Note this requires its caller to handle credentials
72
+ * (need to call requireLoggedIn and requireApiToken)
54
73
  */
55
- declare function getWranglerSendMetricsFromEnv(): boolean | undefined;
74
+ declare function performApiFetchBase(complianceConfig: ComplianceConfig, resource: string, init: RequestInit | undefined, userAgent: string, logger: Logger, queryParams?: URLSearchParams, abortSignal?: AbortSignal, credentials?: ApiCredentials): Promise<Response$1>;
75
+ declare function fetchInternalBase<ResponseType>(complianceConfig: ComplianceConfig, resource: string, init: RequestInit | undefined, userAgent: string, logger: Logger, queryParams?: URLSearchParams, abortSignal?: AbortSignal, credentials?: ApiCredentials): Promise<{
76
+ response: ResponseType;
77
+ status: number;
78
+ retryAfterMs?: number;
79
+ }>;
80
+ declare function fetchResultBase<ResponseType>(complianceConfig: ComplianceConfig, resource: string, init: RequestInit | undefined, userAgent: string, logger: Logger, queryParams?: URLSearchParams, abortSignal?: AbortSignal, credentials?: ApiCredentials): Promise<ResponseType>;
81
+ declare function fetchListResultBase<ResponseType>(complianceConfig: ComplianceConfig, resource: string, init: RequestInit | undefined, userAgent: string, logger: Logger, queryParams?: URLSearchParams, credentials?: ApiCredentials): Promise<ResponseType[]>;
82
+ declare function truncate(text: string, maxLength: number): string;
83
+ declare function isWAFBlockResponse(headers: Headers): boolean;
56
84
  /**
57
- * `WRANGLER_NO_SKILLS_UPDATE_PROMPTS` suppresses the prompt that offers to
58
- * update Cloudflare agent skills when they are out of date.
85
+ * Parses a `Retry-After` header value (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After)
86
+ * into milliseconds to wait before retrying, or `undefined` if absent/unparsable.
59
87
  *
60
- * Set to `"true"` to never be prompted for skills updates.
88
+ * Per the HTTP spec, `Retry-After` may either be a number of delay-seconds,
89
+ * or an HTTP-date after which the request may be retried.
61
90
  */
62
- declare const getNoSkillsUpdatePromptsFromEnv: () => boolean | undefined;
91
+ declare function parseRetryAfterValue(retryAfter: string | null | undefined): number | undefined;
92
+ /** Same as {@link parseRetryAfterValue}, reading the value from a `Headers` object. */
93
+ declare function parseRetryAfterMs(headers: Headers): number | undefined;
94
+ declare function extractWAFBlockRayId(headers: Headers): string | undefined;
95
+ declare function extractAccountTag(resource: string): string | undefined;
96
+ interface PageResultInfo {
97
+ page: number;
98
+ per_page: number;
99
+ count: number;
100
+ total_count: number;
101
+ }
102
+ declare function hasMorePages(result_info: unknown): result_info is PageResultInfo;
103
+ declare function renderError(err: FetchError | {
104
+ code?: number;
105
+ message?: string;
106
+ documentation_url?: string;
107
+ }, level?: number): string;
108
+ declare function addAuthorizationHeader(headers: Headers, auth: ApiCredentials, overrideExisting?: boolean): void;
109
+ declare function throwFetchError(resource: string, response: FetchResult<unknown>, status: number, retryAfterMs?: number): never;
63
110
  /**
64
- * `WRANGLER_SEND_ERROR_REPORTS` controls whether we attempt to send error reports to Sentry.
111
+ * Fetch a raw KV value from the Cloudflare API.
65
112
  *
66
- * Defaults to `false` to avoid noisy false-positive reports. Users can opt in
67
- * by setting `WRANGLER_SEND_ERROR_REPORTS=true`.
113
+ * This is special-cased because it's the only API endpoint that returns raw
114
+ * binary data instead of a JSON envelope.
115
+ *
116
+ * Note: callers must call encodeURIComponent on `key` before passing it.
68
117
  */
69
- declare const getWranglerSendErrorReportsFromEnv: () => boolean;
118
+ declare function fetchKVGetValueBase(complianceConfig: ComplianceConfig, accountId: string, namespaceId: string, key: string, userAgent: string, logger: Logger, credentials: ApiCredentials): Promise<ArrayBuffer>;
119
+ type FetchKVGetValueFetcher = (complianceConfig: ComplianceConfig, accountId: string, namespaceId: string, key: string) => Promise<ArrayBuffer>;
120
+ declare function hasCursor(result_info: unknown): result_info is {
121
+ cursor: string;
122
+ };
123
+ declare function maybeAddTraceHeader(headers: Headers): void;
124
+
70
125
  /**
71
- * Set `WRANGLER_API_ENVIRONMENT` environment variable to "staging" to tell Wrangler to hit the staging APIs rather than production.
126
+ * A symbol to inherit a binding from the deployed worker.
72
127
  */
73
- declare const getCloudflareApiEnvironmentFromEnv: () => "production" | "staging";
128
+ declare const INHERIT_SYMBOL: unique symbol;
129
+ declare const SERVICE_TAG_PREFIX = "cf:service=";
130
+ declare const ENVIRONMENT_TAG_PREFIX = "cf:environment=";
131
+ declare const PATH_TO_DEPLOY_CONFIG = ".wrangler/deploy/config.json";
74
132
  /**
75
- * The compliance region to use for the API requests.
133
+ * Config formats that use JSON parsing
76
134
  */
77
- type ComplianceConfig = Partial<Pick<Config, "compliance_region">>;
78
- /** Used for commands that explicitly do not support compliance regions other than "public" */
79
- declare const COMPLIANCE_REGION_CONFIG_PUBLIC: ComplianceConfig;
135
+ declare const JSON_CONFIG_FORMATS: readonly string[];
136
+
80
137
  /**
81
- * Used for commands where there is no configuration available and
82
- * we rely upon the CLOUDFLARE_COMPLIANCE_REGION environment variable
83
- * to determine the compliance region.
138
+ * The type of Worker
84
139
  */
85
- declare const COMPLIANCE_REGION_CONFIG_UNKNOWN: ComplianceConfig;
140
+ type CfScriptFormat = "modules" | "service-worker";
86
141
  /**
87
- * Set `CLOUDFLARE_COMPLIANCE_REGION` environment variable to "fedramp_high"
88
- * or set the `compliance_region` property in the Wrangler configuration
89
- * to tell Wrangler to run in FedRAMP High compliance region mode, rather than "public" mode.
142
+ * A module type.
90
143
  */
91
- declare const getCloudflareComplianceRegion: (complianceConfig: ComplianceConfig) => "public" | "fedramp_high";
144
+ type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer" | "python" | "python-requirement";
92
145
  /**
93
- * `CLOUDFLARE_API_BASE_URL` specifies the URL to the Cloudflare API.
94
- *
95
- * If this environment variable is not set, it will default to a URL computed from the
96
- * Cloudflare compliance region and the API environment.
146
+ * An imported module.
97
147
  */
98
- declare const getCloudflareApiBaseUrl: (complianceConfig: ComplianceConfig) => string;
148
+ interface CfModule {
149
+ /**
150
+ * The module name.
151
+ *
152
+ * @example
153
+ * './src/index.js'
154
+ */
155
+ name: string;
156
+ /**
157
+ * The absolute path of the module on disk, or `undefined` if this is a
158
+ * virtual module. Used as the source URL for this module, so source maps are
159
+ * correctly resolved.
160
+ *
161
+ * @example
162
+ * '/path/to/src/index.js'
163
+ */
164
+ filePath: string | undefined;
165
+ /**
166
+ * The module content, usually JavaScript or WASM code.
167
+ *
168
+ * @example
169
+ * export default {
170
+ * async fetch(request) {
171
+ * return new Response('Ok')
172
+ * }
173
+ * }
174
+ */
175
+ content: string | Buffer<ArrayBuffer>;
176
+ /**
177
+ * An optional sourcemap for this module if it's of a ESM or CJS type, this will only be present
178
+ * if we're deploying with sourcemaps enabled. Since we copy extra modules that aren't bundled
179
+ * we need to also copy the relevant sourcemaps into the final out directory.
180
+ */
181
+ sourceMap?: CfWorkerSourceMap;
182
+ /**
183
+ * The module type.
184
+ *
185
+ * If absent, will default to the main module's type.
186
+ */
187
+ type?: CfModuleType;
188
+ }
99
189
  /**
100
- * Compute the subdomain for the compliance region.
190
+ * A map of variable names to values.
101
191
  */
102
- declare function getComplianceRegionSubdomain(complianceConfig: ComplianceConfig): string;
192
+ interface CfVars {
193
+ [key: string]: string | Json;
194
+ }
103
195
  /**
104
- * Returns the managed container registry for the configured API environment and compliance region.
105
- *
106
- * @param complianceConfig - Compliance configuration used to select the public or FedRAMP registry.
107
- * @returns The managed registry hostname, respecting `CLOUDFLARE_CONTAINER_REGISTRY` and `WRANGLER_API_ENVIRONMENT`.
196
+ * A KV namespace.
108
197
  */
109
- declare function getCloudflareContainerRegistry(complianceConfig?: ComplianceConfig): string;
198
+ interface CfKvNamespace {
199
+ binding: string;
200
+ id?: string | typeof INHERIT_SYMBOL;
201
+ remote?: boolean;
202
+ raw?: boolean;
203
+ }
110
204
  /**
111
- * `WRANGLER_LOG_SANITIZE` specifies whether we sanitize debug logs.
112
- *
113
- * By default we do, since debug logs could be added to GitHub issues and shouldn't include sensitive information.
205
+ * A binding to send email.
114
206
  */
115
- declare const getSanitizeLogs: () => boolean;
207
+ type CfSendEmailBindings = {
208
+ name: string;
209
+ remote?: boolean;
210
+ allowed_sender_addresses?: string[];
211
+ } & ({
212
+ destination_address: string;
213
+ allowed_destination_addresses?: never;
214
+ } | {
215
+ destination_address?: never;
216
+ allowed_destination_addresses: string[];
217
+ } | {
218
+ destination_address?: never;
219
+ allowed_destination_addresses?: never;
220
+ });
116
221
  /**
117
- * `WRANGLER_OUTPUT_FILE_DIRECTORY` specifies a directory where we should write a file containing output data in ND-JSON format.
118
- *
119
- * If this is set a random file will be created in this directory, and certain Wrangler commands will write entries to this file.
120
- * This is overridden by the `WRANGLER_OUTPUT_FILE_PATH` environment variable.
222
+ * A binding to a wasm module (in service-worker format)
121
223
  */
122
- declare const getOutputFileDirectoryFromEnv: () => string | undefined;
224
+ interface CfWasmModuleBindings {
225
+ [key: string]: string | Uint8Array<ArrayBuffer>;
226
+ }
123
227
  /**
124
- * `WRANGLER_OUTPUT_FILE_PATH` specifies a path to a file where we should write output data in ND-JSON format.
125
- *
126
- * If this is set certain Wrangler commands will write entries to this file.
127
- * This overrides the `WRANGLER_OUTPUT_FILE_DIRECTORY` environment variable.
228
+ * A binding to a text blob (in service-worker format)
128
229
  */
129
- declare const getOutputFilePathFromEnv: () => string | undefined;
230
+ interface CfTextBlobBindings {
231
+ [key: string]: string;
232
+ }
130
233
  /**
131
- * `WRANGLER_CI_MATCH_TAG` specifies a Worker tag
132
- *
133
- * If this is set, Wrangler will ensure the Worker being targeted has this tag
134
- */
135
- declare const getCIMatchTag: () => string | undefined;
136
- /**
137
- * `WRANGLER_CI_OVERRIDE_NAME` specifies a Worker name
138
- *
139
- * If this is set, Wrangler will override the Worker name with this one
140
- */
141
- declare const getCIOverrideName: () => string | undefined;
142
- /**
143
- * `WRANGLER_CI_OVERRIDE_NETWORK_MODE_HOST` specifies whether --network=host should be set
144
- *
145
- * If this is set to true, Wrangler will use the --network=host flag when calling out to docker to build container images
146
- */
147
- declare const getCIOverrideNetworkModeHost: () => string | undefined;
148
- /**
149
- * `WRANGLER_CI_GENERATE_PREVIEW_ALIAS` specifies whether to generate a preview alias during version upload
150
- *
151
- * If this is set to true, Wrangler will attempt to autogenerate the preview alias by using the branch
152
- * name. If the branch name is too long and an alias cannot be created, a warning will be printed to the console.
153
- */
154
- declare const getCIGeneratePreviewAlias: () => "true" | "false";
155
- /**
156
- * `WORKERS_CI_BRANCH` is the branch name exposed by Workers CI
157
- *
158
- */
159
- declare const getWorkersCIBranchName: () => string | undefined;
160
- /**
161
- * `WRANGLER_BUILD_CONDITIONS` specifies the "build conditions" to use when importing packages at build time.
162
- *
163
- * See https://nodejs.org/api/packages.html#conditional-exports
164
- * and https://esbuild.github.io/api/#how-conditions-work.
165
- *
166
- * If this is set, Wrangler will configure esbuild to use this list of conditions.
167
- * The format is a string of comma separated conditions.
168
- */
169
- declare const getBuildConditionsFromEnv: () => string | undefined;
170
- /**
171
- * `WRANGLER_BUILD_PLATFORM` specifies the "build platform" to use when importing packages at build time.
172
- *
173
- * See https://esbuild.github.io/api/#platform
174
- * and https://esbuild.github.io/api/#how-conditions-work.
175
- *
176
- * If this is set, Wrangler will configure esbuild to use this platform.
177
- */
178
- declare const getBuildPlatformFromEnv: () => string | undefined;
179
- /**
180
- * `WRANGLER_REGISTRY_PATH` specifies the file based dev registry folder
181
- */
182
- declare const getRegistryPath: () => string;
183
- /**
184
- * `WRANGLER_D1_EXTRA_LOCATION_CHOICES` is an internal variable to let D1 team target their testing environments.
185
- *
186
- * External accounts cannot access testing environments, so should not set this variable.
187
- */
188
- declare const getD1ExtraLocationChoices: () => string | undefined;
189
-
190
- declare const getSubdomainMixedStateCheckDisabled: () => boolean;
191
- /**
192
- /**
193
- * `CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV` specifies whether to load vars for local dev from `.env` files.
194
- */
195
- declare const getCloudflareLoadDevVarsFromDotEnv: () => boolean;
196
- /**
197
- * `CLOUDFLARE_INCLUDE_PROCESS_ENV` specifies whether to include the `process.env` in vars loaded from `.env` for local development.
198
- */
199
- declare const getCloudflareIncludeProcessEnvFromEnv: () => boolean;
200
- declare const getTraceHeader: () => string | undefined;
201
- declare const getDisableConfigWatching: () => boolean;
202
- /**
203
- * Hide the Wrangler version banner and command status (deprecated/experimental) warnings
204
- */
205
- declare const getWranglerHideBanner: () => boolean;
206
- /**
207
- * `CLOUDFLARE_ENV` specifies the currently selected Wrangler/Cloudflare environment.
208
- */
209
- declare const getCloudflareEnv: () => string | undefined;
210
- /**
211
- * `OPEN_NEXT_DEPLOY` is an environment variables that indicates that the current process is being
212
- * run by the open-next deploy command
234
+ * A binding to a browser
213
235
  */
214
- declare const getOpenNextDeployFromEnv: () => string | undefined;
236
+ interface CfBrowserBinding {
237
+ binding: string;
238
+ raw?: boolean;
239
+ remote?: boolean;
240
+ }
215
241
  /**
216
- * `X_LOCAL_EXPLORER` enables the local explorer UI at /cdn-cgi/local/explorer.
242
+ * A binding to the AI project
217
243
  */
218
- declare const getLocalExplorerEnabledFromEnv: () => boolean;
244
+ interface CfAIBinding {
245
+ binding: string;
246
+ staging?: boolean;
247
+ remote?: boolean;
248
+ raw?: boolean;
249
+ }
219
250
  /**
220
- * `X_LOCAL_OBSERVABILITY` turns on local-dev observability capture. Both
221
- * `wrangler dev` and the Vite plugin read it and pass it through as the one
222
- * `unsafeObservability` Miniflare option, which makes core attach the trace
223
- * collector to each user worker.
224
- *
225
- * Defaults to `true` so the Local Explorer's Observability tab captures traces
226
- * and logs out of the box. Set `X_LOCAL_OBSERVABILITY=false` to opt out — for
227
- * example if the extra per-worker services (collector + streaming tail) cause
228
- * trouble in a multi-process dev-registry setup.
251
+ * A binding to Cloudflare Images
229
252
  */
230
- declare const getLocalObservabilityEnabledFromEnv: () => boolean;
253
+ interface CfImagesBinding {
254
+ binding: string;
255
+ raw?: boolean;
256
+ remote?: boolean;
257
+ }
231
258
  /**
232
- * `X_BROWSER_HEADFUL` opens the browser in headful (visible) mode when using the
233
- * Browser Run API in local development.
234
- *
235
- * Set to "true" to enable:
236
- *
237
- * ```sh
238
- * X_BROWSER_HEADFUL=true vite dev
239
- * ```
240
- *
241
- * Note: when using `@cloudflare/playwright`, two Chrome windows may appear — the initial blank
242
- * page and the one created by `browser.newPage()`. This is expected due to how Playwright handles
243
- * browser contexts via CDP.
259
+ * A binding to Cloudflare Media Transformations
244
260
  */
245
- declare const getBrowserRenderingHeadfulFromEnv: () => boolean;
261
+ interface CfMediaBinding {
262
+ binding: string;
263
+ remote?: boolean;
264
+ }
246
265
  /**
247
- * `CLOUDFLARE_CF_FETCH_ENABLED` controls whether Miniflare fetches the `cf.json` file
248
- * containing request.cf properties from workers.cloudflare.com.
249
- *
250
- * - If set to "false", disables fetching and uses fallback data (no files created)
251
- * - If set to "true" or not set, uses the default behavior (fetches and caches cf.json)
252
- *
253
- * This is particularly useful for non-JavaScript projects that don't want
254
- * a node_modules directory created automatically.
255
- *
256
- * Example:
257
- * ```sh
258
- * # Disable cf fetching entirely
259
- * CLOUDFLARE_CF_FETCH_ENABLED=false npx wrangler dev
260
- * ```
266
+ * A binding to Cloudflare Stream
261
267
  */
262
- declare const getCfFetchEnabledFromEnv: () => boolean;
268
+ interface CfStreamBinding {
269
+ binding: string;
270
+ remote?: boolean;
271
+ }
263
272
  /**
264
- * `CLOUDFLARE_CF_FETCH_PATH` specifies a custom path for caching the cf.json file.
265
- *
266
- * - If set, uses the specified path instead of the default node_modules/.mf/cf.json
267
- * - If not set, uses the default location (node_modules/.mf/cf.json)
268
- *
269
- * Example:
270
- * ```sh
271
- * # Use a custom cache location
272
- * CLOUDFLARE_CF_FETCH_PATH=/tmp/cf-cache.json npx wrangler dev
273
- * ```
273
+ * A binding to the Worker Version's metadata
274
274
  */
275
- declare const getCfFetchPathFromEnv: () => string | undefined;
275
+ interface CfVersionMetadataBinding {
276
+ binding: string;
277
+ }
276
278
  /**
277
- * `WRANGLER_CACHE_DIR` specifies a custom directory for Wrangler's cache files.
278
- * This overrides the default `node_modules/.cache/wrangler` location.
279
- * Useful for Yarn PnP or projects without node_modules.
279
+ * A binding to a data blob (in service-worker format)
280
280
  */
281
- declare const getWranglerCacheDirFromEnv: () => string | undefined;
281
+ interface CfDataBlobBindings {
282
+ [key: string]: string | Uint8Array<ArrayBuffer>;
283
+ }
282
284
  /**
283
- * `CLOUDFLARED_PATH` specifies a custom path to a cloudflared binary.
284
- *
285
- * If set, Wrangler will use this cloudflared binary instead of downloading one.
286
- * The path must point to an existing executable file.
285
+ * A Durable Object.
287
286
  */
288
- declare const getCloudflaredPathFromEnv: () => string | undefined;
289
-
290
- declare const LOGGER_LEVELS: {
291
- readonly none: -1;
292
- readonly error: 0;
293
- readonly warn: 1;
294
- readonly info: 2;
295
- readonly log: 3;
296
- readonly debug: 4;
297
- };
298
- type LoggerLevel = keyof typeof LOGGER_LEVELS;
299
- type Logger = {
300
- loggerLevel?: LoggerLevel;
301
- debug: typeof console.debug;
302
- debugWithSanitization?: (label: string, ...args: unknown[]) => void;
303
- log: typeof console.log;
304
- info: typeof console.info;
305
- warn: typeof console.warn;
306
- error: typeof console.error;
307
- once?: {
308
- info: typeof console.info;
309
- log: typeof console.log;
310
- warn: typeof console.warn;
311
- error: typeof console.error;
287
+ interface CfDurableObject {
288
+ name: string;
289
+ class_name: string;
290
+ script_name?: string;
291
+ environment?: string;
292
+ }
293
+ interface CfWorkflow {
294
+ name: string;
295
+ class_name: string;
296
+ binding: string;
297
+ script_name?: string;
298
+ raw?: boolean;
299
+ limits?: {
300
+ steps?: number;
312
301
  };
313
- console?<M extends Exclude<keyof Console, "Console">>(method: M, ...args: Parameters<Console[M]>): void;
314
- };
315
-
316
- type ApiCredentials = {
317
- apiToken: string;
318
- } | {
319
- authKey: string;
320
- authEmail: string;
321
- };
322
- interface FetchResult<ResponseType = unknown> {
323
- success: boolean;
324
- result: ResponseType;
325
- errors: FetchError[];
326
- messages?: (string | {
327
- code?: number;
328
- message: string;
329
- })[];
330
- result_info?: unknown;
331
- }
332
- type FetchResultFetcher = <ResponseType>(complianceConfig: ComplianceConfig, resource: string, init?: RequestInit, queryParams?: URLSearchParams, abortSignal?: AbortSignal) => Promise<ResponseType>;
333
- type FetchListResultFetcher = <ResponseType>(complianceConfig: ComplianceConfig, resource: string, init?: RequestInit, queryParams?: URLSearchParams) => Promise<ResponseType[]>;
334
- type FetchPagedListResultFetcher = <ResponseType>(complianceConfig: ComplianceConfig, resource: string, init?: RequestInit, queryParams?: URLSearchParams) => Promise<ResponseType[]>;
335
- /**
336
- *
337
- * Note this requires its caller to handle credentials
338
- * (need to call requireLoggedIn and requireApiToken)
339
- */
340
- declare function performApiFetchBase(complianceConfig: ComplianceConfig, resource: string, init: RequestInit | undefined, userAgent: string, logger: Logger, queryParams?: URLSearchParams, abortSignal?: AbortSignal, credentials?: ApiCredentials): Promise<Response$1>;
341
- declare function fetchInternalBase<ResponseType>(complianceConfig: ComplianceConfig, resource: string, init: RequestInit | undefined, userAgent: string, logger: Logger, queryParams?: URLSearchParams, abortSignal?: AbortSignal, credentials?: ApiCredentials): Promise<{
342
- response: ResponseType;
343
- status: number;
344
- retryAfterMs?: number;
345
- }>;
346
- declare function fetchResultBase<ResponseType>(complianceConfig: ComplianceConfig, resource: string, init: RequestInit | undefined, userAgent: string, logger: Logger, queryParams?: URLSearchParams, abortSignal?: AbortSignal, credentials?: ApiCredentials): Promise<ResponseType>;
347
- declare function fetchListResultBase<ResponseType>(complianceConfig: ComplianceConfig, resource: string, init: RequestInit | undefined, userAgent: string, logger: Logger, queryParams?: URLSearchParams, credentials?: ApiCredentials): Promise<ResponseType[]>;
348
- declare function truncate(text: string, maxLength: number): string;
349
- declare function isWAFBlockResponse(headers: Headers): boolean;
350
- /**
351
- * Parses a `Retry-After` header value (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After)
352
- * into milliseconds to wait before retrying, or `undefined` if absent/unparsable.
353
- *
354
- * Per the HTTP spec, `Retry-After` may either be a number of delay-seconds,
355
- * or an HTTP-date after which the request may be retried.
356
- */
357
- declare function parseRetryAfterValue(retryAfter: string | null | undefined): number | undefined;
358
- /** Same as {@link parseRetryAfterValue}, reading the value from a `Headers` object. */
359
- declare function parseRetryAfterMs(headers: Headers): number | undefined;
360
- declare function extractWAFBlockRayId(headers: Headers): string | undefined;
361
- declare function extractAccountTag(resource: string): string | undefined;
362
- interface PageResultInfo {
363
- page: number;
364
- per_page: number;
365
- count: number;
366
- total_count: number;
367
- }
368
- declare function hasMorePages(result_info: unknown): result_info is PageResultInfo;
369
- declare function renderError(err: FetchError | {
370
- code?: number;
371
- message?: string;
372
- documentation_url?: string;
373
- }, level?: number): string;
374
- declare function addAuthorizationHeader(headers: Headers, auth: ApiCredentials, overrideExisting?: boolean): void;
375
- declare function throwFetchError(resource: string, response: FetchResult<unknown>, status: number, retryAfterMs?: number): never;
376
- /**
377
- * Fetch a raw KV value from the Cloudflare API.
378
- *
379
- * This is special-cased because it's the only API endpoint that returns raw
380
- * binary data instead of a JSON envelope.
381
- *
382
- * Note: callers must call encodeURIComponent on `key` before passing it.
383
- */
384
- declare function fetchKVGetValueBase(complianceConfig: ComplianceConfig, accountId: string, namespaceId: string, key: string, userAgent: string, logger: Logger, credentials: ApiCredentials): Promise<ArrayBuffer>;
385
- type FetchKVGetValueFetcher = (complianceConfig: ComplianceConfig, accountId: string, namespaceId: string, key: string) => Promise<ArrayBuffer>;
386
- declare function hasCursor(result_info: unknown): result_info is {
387
- cursor: string;
388
- };
389
- declare function maybeAddTraceHeader(headers: Headers): void;
390
-
391
- /**
392
- * A symbol to inherit a binding from the deployed worker.
393
- */
394
- declare const INHERIT_SYMBOL: unique symbol;
395
- declare const SERVICE_TAG_PREFIX = "cf:service=";
396
- declare const ENVIRONMENT_TAG_PREFIX = "cf:environment=";
397
- declare const PATH_TO_DEPLOY_CONFIG = ".wrangler/deploy/config.json";
398
- /**
399
- * Config formats that use JSON parsing
400
- */
401
- declare const JSON_CONFIG_FORMATS: readonly string[];
402
-
403
- /**
404
- * The type of Worker
405
- */
406
- type CfScriptFormat = "modules" | "service-worker";
407
- /**
408
- * A module type.
409
- */
410
- type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer" | "python" | "python-requirement";
411
- /**
412
- * An imported module.
413
- */
414
- interface CfModule {
415
- /**
416
- * The module name.
417
- *
418
- * @example
419
- * './src/index.js'
420
- */
421
- name: string;
422
- /**
423
- * The absolute path of the module on disk, or `undefined` if this is a
424
- * virtual module. Used as the source URL for this module, so source maps are
425
- * correctly resolved.
426
- *
427
- * @example
428
- * '/path/to/src/index.js'
429
- */
430
- filePath: string | undefined;
431
- /**
432
- * The module content, usually JavaScript or WASM code.
433
- *
434
- * @example
435
- * export default {
436
- * async fetch(request) {
437
- * return new Response('Ok')
438
- * }
439
- * }
440
- */
441
- content: string | Buffer<ArrayBuffer>;
442
- /**
443
- * An optional sourcemap for this module if it's of a ESM or CJS type, this will only be present
444
- * if we're deploying with sourcemaps enabled. Since we copy extra modules that aren't bundled
445
- * we need to also copy the relevant sourcemaps into the final out directory.
446
- */
447
- sourceMap?: CfWorkerSourceMap;
448
- /**
449
- * The module type.
450
- *
451
- * If absent, will default to the main module's type.
452
- */
453
- type?: CfModuleType;
454
- }
455
- /**
456
- * A map of variable names to values.
457
- */
458
- interface CfVars {
459
- [key: string]: string | Json;
460
- }
461
- /**
462
- * A KV namespace.
463
- */
464
- interface CfKvNamespace {
465
- binding: string;
466
- id?: string | typeof INHERIT_SYMBOL;
467
- remote?: boolean;
468
- raw?: boolean;
469
- }
470
- /**
471
- * A binding to send email.
472
- */
473
- type CfSendEmailBindings = {
474
- name: string;
475
- remote?: boolean;
476
- allowed_sender_addresses?: string[];
477
- } & ({
478
- destination_address: string;
479
- allowed_destination_addresses?: never;
480
- } | {
481
- destination_address?: never;
482
- allowed_destination_addresses: string[];
483
- } | {
484
- destination_address?: never;
485
- allowed_destination_addresses?: never;
486
- });
487
- /**
488
- * A binding to a wasm module (in service-worker format)
489
- */
490
- interface CfWasmModuleBindings {
491
- [key: string]: string | Uint8Array<ArrayBuffer>;
492
- }
493
- /**
494
- * A binding to a text blob (in service-worker format)
495
- */
496
- interface CfTextBlobBindings {
497
- [key: string]: string;
498
- }
499
- /**
500
- * A binding to a browser
501
- */
502
- interface CfBrowserBinding {
503
- binding: string;
504
- raw?: boolean;
505
- remote?: boolean;
506
- }
507
- /**
508
- * A binding to the AI project
509
- */
510
- interface CfAIBinding {
511
- binding: string;
512
- staging?: boolean;
513
- remote?: boolean;
514
- raw?: boolean;
515
- }
516
- /**
517
- * A binding to Cloudflare Images
518
- */
519
- interface CfImagesBinding {
520
- binding: string;
521
- raw?: boolean;
522
- remote?: boolean;
523
- }
524
- /**
525
- * A binding to Cloudflare Media Transformations
526
- */
527
- interface CfMediaBinding {
528
- binding: string;
529
- remote?: boolean;
530
- }
531
- /**
532
- * A binding to Cloudflare Stream
533
- */
534
- interface CfStreamBinding {
535
- binding: string;
536
- remote?: boolean;
537
- }
538
- /**
539
- * A binding to the Worker Version's metadata
540
- */
541
- interface CfVersionMetadataBinding {
542
- binding: string;
543
- }
544
- /**
545
- * A binding to a data blob (in service-worker format)
546
- */
547
- interface CfDataBlobBindings {
548
- [key: string]: string | Uint8Array<ArrayBuffer>;
549
- }
550
- /**
551
- * A Durable Object.
552
- */
553
- interface CfDurableObject {
554
- name: string;
555
- class_name: string;
556
- script_name?: string;
557
- environment?: string;
558
- }
559
- interface CfWorkflow {
560
- name: string;
561
- class_name: string;
562
- binding: string;
563
- script_name?: string;
564
- raw?: boolean;
565
- limits?: {
566
- steps?: number;
567
- };
568
- concurrency?: {
569
- limit?: number;
570
- };
571
- schedules?: string | string[];
302
+ concurrency?: {
303
+ limit?: number;
304
+ };
305
+ schedules?: string | string[];
572
306
  }
573
307
  interface CfQueue {
574
308
  binding: string;
@@ -826,6 +560,7 @@ interface CfWorkerInit {
826
560
  images?: Record<string, string>;
827
561
  }[] | undefined;
828
562
  migrations: CfDurableObjectMigrations | undefined;
563
+ code_update_strategy?: DurableObjectCodeUpdateStrategy;
829
564
  /**
830
565
  * Declarative exports configuration. Durable Object entries are sent instead
831
566
  * of `migrations`.
@@ -1149,6 +884,7 @@ type WorkerMetadataPut = {
1149
884
  compatibility_flags?: string[];
1150
885
  usage_model?: "bundled" | "unbound";
1151
886
  migrations?: CfDurableObjectMigrations;
887
+ code_update_strategy?: DurableObjectCodeUpdateStrategy;
1152
888
  exports?: CfExports;
1153
889
  capnp_schema?: string;
1154
890
  bindings: WorkerMetadataBinding[];
@@ -2448,6 +2184,26 @@ type DurableObjectBindings = {
2448
2184
  /** The service environment of the script_name to bind to */
2449
2185
  environment?: string;
2450
2186
  }[];
2187
+ type DurableObjectCodeUpdateStrategy = {
2188
+ /** How Durable Object code updates should be applied. */
2189
+ mode: "immediate" | "deferred";
2190
+ /**
2191
+ * Maximum time, in seconds, to wait for Durable Objects to hibernate.
2192
+ * Defaults to 300 (5 minutes) and cannot exceed 86400 (24 hours).
2193
+ * @minimum 0
2194
+ * @maximum 86400
2195
+ * @multipleOf 0.001
2196
+ * @default 300
2197
+ */
2198
+ max_delay?: number;
2199
+ };
2200
+ type DurableObjectsConfig = {
2201
+ bindings: DurableObjectBindings;
2202
+ code_update_strategy?: DurableObjectCodeUpdateStrategy;
2203
+ };
2204
+ type RawDurableObjectsConfig = Omit<DurableObjectsConfig, "bindings"> & {
2205
+ bindings?: DurableObjectBindings;
2206
+ };
2451
2207
  declare const ARTIFACTS_EVENT_TYPES: readonly ["cf.artifacts.repo.created", "cf.artifacts.repo.deleted", "cf.artifacts.repo.forked", "cf.artifacts.repo.imported", "cf.artifacts.repo.pushed", "cf.artifacts.repo.cloned", "cf.artifacts.repo.fetched", "cf.artifacts.repo.token.created", "cf.artifacts.repo.token.revoked"];
2452
2208
  type ArtifactsEventType = (typeof ARTIFACTS_EVENT_TYPES)[number];
2453
2209
  type ArtifactsEventTrigger = {
@@ -2561,7 +2317,7 @@ interface EnvironmentNonInheritable {
2561
2317
  required?: string[];
2562
2318
  };
2563
2319
  /**
2564
- * A list of durable objects that your Worker should be bound to.
2320
+ * Durable Object bindings and code update strategy for your Worker.
2565
2321
  *
2566
2322
  * For more information about Durable Objects, see the documentation at
2567
2323
  * https://developers.cloudflare.com/workers/learning/using-durable-objects
@@ -2574,9 +2330,7 @@ interface EnvironmentNonInheritable {
2574
2330
  * @default {bindings:[]}
2575
2331
  * @nonInheritable
2576
2332
  */
2577
- durable_objects: {
2578
- bindings: DurableObjectBindings;
2579
- };
2333
+ durable_objects: DurableObjectsConfig;
2580
2334
  /**
2581
2335
  * A list of workflows that your Worker should be bound to.
2582
2336
  *
@@ -3283,7 +3037,9 @@ interface EnvironmentNonInheritable {
3283
3037
  * All the properties are optional, and will be replaced with defaults in the configuration that
3284
3038
  * is used in the rest of the codebase.
3285
3039
  */
3286
- type RawEnvironment = Partial<Environment>;
3040
+ type RawEnvironment = Partial<Omit<Environment, "durable_objects">> & {
3041
+ durable_objects?: RawDurableObjectsConfig;
3042
+ };
3287
3043
  /**
3288
3044
  * A bundling resolver rule, defining the modules type for paths that match the specified globs.
3289
3045
  */
@@ -3426,7 +3182,10 @@ type ContainerEngine = {
3426
3182
  *
3427
3183
  * @inheritable
3428
3184
  */
3429
- interface PreviewsConfig extends Partial<EnvironmentNonInheritable>, Partial<Pick<EnvironmentInheritable, "logpush" | "observability" | "limits" | "placement" | "cache">> {
3185
+ interface PreviewsConfig extends Partial<Omit<EnvironmentNonInheritable, "durable_objects">>, Partial<Pick<EnvironmentInheritable, "logpush" | "observability" | "limits" | "placement" | "cache">> {
3186
+ durable_objects?: {
3187
+ bindings: DurableObjectBindings;
3188
+ };
3430
3189
  }
3431
3190
 
3432
3191
  /**
@@ -3708,4 +3467,270 @@ interface EnvironmentMap {
3708
3467
  }
3709
3468
  declare const defaultWranglerConfig: Config;
3710
3469
 
3711
- export { type CfMediaBinding as $, type ApiCredentials as A, type Binding as B, type ComputedFields as C, type DurableObjectExport as D, type Exports as E, type CfArtifacts as F, type CfAssetsBinding as G, type CfBrowserBinding as H, type CfCapnp as I, type CfD1Database as J, type CfDataBlobBindings as K, type Logger as L, type CfDevPluginCfg as M, type CfDispatchNamespace as N, type CfDurableObject as O, type CfDurableObjectMigrations as P, type CfExports as Q, type RawConfig as R, type CfFlagship as S, type CfHelloWorld as T, type CfHyperdrive as U, type CfImagesBinding as V, type WorkerEntrypointExport as W, type CfKvNamespace as X, type CfLogfwdr as Y, type CfLogfwdrBinding as Z, type CfMTlsCertificate as _, type RedirectedRawConfig as a, type Json as a$, type CfModule as a0, type CfModuleType as a1, type CfPipeline as a2, type CfPlacement as a3, type CfQueue as a4, type CfR2Bucket as a5, type CfRateLimit as a6, type CfScriptFormat as a7, type CfSecretsStoreSecrets as a8, type CfSendEmailBindings as a9, type DockerConfiguration as aA, type DurableObjectBindings as aB, type DurableObjectContainerImage as aC, type DurableObjectExportStorage as aD, type DurableObjectMigration as aE, ENVIRONMENT_TAG_PREFIX as aF, type Entry as aG, type Environment as aH, type EnvironmentNonInheritable as aI, type ExportsReconciliationEntryBase as aJ, type ExportsReconciliationErrorDetail as aK, type ExportsReconciliationInfo as aL, type ExportsReconciliationRename as aM, type ExportsReconciliationResult as aN, type ExportsReconciliationTransfer as aO, type ExportsReconciliationTransferPending as aP, type ExportsReconciliationWarning as aQ, type FetchKVGetValueFetcher as aR, type FetchListResultFetcher as aS, type FetchPagedListResultFetcher as aT, type FetchResult as aU, type FetchResultFetcher as aV, type File as aW, type Hook as aX, type HookValues as aY, INHERIT_SYMBOL as aZ, JSON_CONFIG_FORMATS as a_, type CfService as aa, type CfStreamBinding as ab, type CfTextBlobBindings as ac, type CfUnsafe as ad, type CfUnsafeBinding as ae, type CfUserLimits as af, type CfVars as ag, type CfVectorize as ah, type CfVersionMetadataBinding as ai, type CfVpcNetwork as aj, type CfVpcService as ak, type CfWasmModuleBindings as al, type CfWorkerContext as am, type CfWorkerInit as an, type CfWorkerLoader as ao, type CfWorkerSourceMap as ap, type CfWorkflow as aq, type CloudchamberConfig as ar, type ConfigFields as as, type ConfigModuleRuleType as at, type ConfiguredExport as au, type ConnectHandler as av, type ContainerEngine as aw, type ContainerObservability as ax, type CustomDomainRoute as ay, type DispatchNamespaceOutbound as az, type Config as b, getSanitizeLogs as b$, LOGGER_LEVELS as b0, type LegacyAssetPaths as b1, type LocalS3Credentials as b2, type LogLevel as b3, type LoggerLevel as b4, type NodeJSCompatMode as b5, type Observability as b6, PATH_TO_DEPLOY_CONFIG as b7, type PreviewsConfig as b8, type RawDevConfig as b9, getBuildConditionsFromEnv as bA, getBuildPlatformFromEnv as bB, getC3CommandFromEnv as bC, getCIGeneratePreviewAlias as bD, getCIMatchTag as bE, getCIOverrideName as bF, getCIOverrideNetworkModeHost as bG, getCfFetchEnabledFromEnv as bH, getCfFetchPathFromEnv as bI, getCloudflareApiBaseUrl as bJ, getCloudflareApiEnvironmentFromEnv as bK, getCloudflareComplianceRegion as bL, getCloudflareContainerRegistry as bM, getCloudflareEnv as bN, getCloudflareIncludeProcessEnvFromEnv as bO, getCloudflareLoadDevVarsFromDotEnv as bP, getCloudflaredPathFromEnv as bQ, getComplianceRegionSubdomain as bR, getD1ExtraLocationChoices as bS, getDisableConfigWatching as bT, getLocalExplorerEnabledFromEnv as bU, getLocalObservabilityEnabledFromEnv as bV, getNoSkillsUpdatePromptsFromEnv as bW, getOpenNextDeployFromEnv as bX, getOutputFileDirectoryFromEnv as bY, getOutputFilePathFromEnv as bZ, getRegistryPath as b_, type RawEnvironment as ba, type Rule as bb, SERVICE_TAG_PREFIX as bc, type ServiceFetch as bd, type ServiceMetadataRes as be, type StartDevWorkerInput as bf, type StreamingTailConsumer as bg, type TailConsumer as bh, type TcpConnectHandler as bi, type Trigger as bj, type UdpConnectHandler as bk, type UserLimits as bl, type ValidatedAssetsOptions as bm, type WorkerMetadata as bn, type WorkflowBinding as bo, type ZoneIdRoute as bp, type ZoneNameRoute as bq, addAuthorizationHeader as br, defaultWranglerConfig as bs, extractAccountTag as bt, extractWAFBlockRayId as bu, fetchInternalBase as bv, fetchKVGetValueBase as bw, fetchListResultBase as bx, fetchResultBase as by, getBrowserRenderingHeadfulFromEnv as bz, type WorkflowExport as c, getSubdomainMixedStateCheckDisabled as c0, getTraceHeader as c1, getWorkersCIBranchName as c2, getWranglerCacheDirFromEnv as c3, getWranglerHideBanner as c4, getWranglerSendErrorReportsFromEnv as c5, getWranglerSendMetricsFromEnv as c6, hasCursor as c7, hasMorePages as c8, isDoNotTrackEnabled as c9, isWAFBlockResponse as ca, maybeAddTraceHeader as cb, parseRetryAfterMs as cc, parseRetryAfterValue as cd, performApiFetchBase as ce, renderError as cf, throwFetchError as cg, truncate as ch, type ContainerApp as d, type WorkerMetadataBinding as e, type CfTailConsumer as f, type ComplianceConfig as g, type Route as h, ARTIFACTS_EVENT_TYPES as i, type Access as j, type ArtifactsEventTrigger as k, type ArtifactsEventType as l, type AssetConfigMetadata as m, type Assets as n, type AssetsOptions as o, type AsyncHook as p, type BinaryFile as q, COMPLIANCE_REGION_CONFIG_PUBLIC as r, COMPLIANCE_REGION_CONFIG_UNKNOWN as s, type CacheOptions as t, type CfAIBinding as u, type CfAISearch as v, type CfAISearchNamespace as w, type CfAccount as x, type CfAgentMemory as y, type CfAnalyticsEngineDataset as z };
3470
+ /**
3471
+ * `WRANGLER_C3_COMMAND` can override the command used by `wrangler init` when delegating to C3.
3472
+ *
3473
+ * By default this will use `create cloudflare`.
3474
+ *
3475
+ * To run against the beta release of C3 use:
3476
+ *
3477
+ * ```sh
3478
+ * # Tell Wrangler to use the beta version of create-cloudflare
3479
+ * WRANGLER_C3_COMMAND="create cloudflare@beta" npx wrangler init
3480
+ * ```
3481
+ *
3482
+ * To test the integration between wrangler and C3 locally, use:
3483
+ *
3484
+ * ```sh
3485
+ * # Ensure both Wrangler and C3 are built
3486
+ * npm run build
3487
+ * # Tell Wrangler to use the local version of create-cloudflare
3488
+ * WRANGLER_C3_COMMAND="exec ./packages/create-cloudflare" npx wrangler init temp
3489
+ * ```
3490
+ *
3491
+ * Note that you cannot use `WRANGLER_C3_COMMAND="create cloudflare@2"` if you are
3492
+ * running Wrangler from inside the monorepo as the bin paths get messed up.
3493
+ */
3494
+ declare const getC3CommandFromEnv: () => string;
3495
+ /** Whether `DO_NOT_TRACK` is set to a supported telemetry opt-out value. */
3496
+ declare function isDoNotTrackEnabled(): boolean;
3497
+ /**
3498
+ * `WRANGLER_SEND_METRICS` controls whether we attempt to send metrics information to Sparrow.
3499
+ * `DO_NOT_TRACK` takes precedence when it is set to an opt-out value.
3500
+ */
3501
+ declare function getWranglerSendMetricsFromEnv(): boolean | undefined;
3502
+ /**
3503
+ * `WRANGLER_NO_SKILLS_UPDATE_PROMPTS` suppresses the prompt that offers to
3504
+ * update Cloudflare agent skills when they are out of date.
3505
+ *
3506
+ * Set to `"true"` to never be prompted for skills updates.
3507
+ */
3508
+ declare const getNoSkillsUpdatePromptsFromEnv: () => boolean | undefined;
3509
+ /**
3510
+ * `WRANGLER_SEND_ERROR_REPORTS` controls whether we attempt to send error reports to Sentry.
3511
+ *
3512
+ * Defaults to `false` to avoid noisy false-positive reports. Users can opt in
3513
+ * by setting `WRANGLER_SEND_ERROR_REPORTS=true`.
3514
+ */
3515
+ declare const getWranglerSendErrorReportsFromEnv: () => boolean;
3516
+ /**
3517
+ * Set `WRANGLER_API_ENVIRONMENT` environment variable to "staging" to tell Wrangler to hit the staging APIs rather than production.
3518
+ */
3519
+ declare const getCloudflareApiEnvironmentFromEnv: () => "staging" | "production";
3520
+ /**
3521
+ * The compliance region to use for the API requests.
3522
+ */
3523
+ type ComplianceConfig = Partial<Pick<Config, "compliance_region">>;
3524
+ /** Used for commands that explicitly do not support compliance regions other than "public" */
3525
+ declare const COMPLIANCE_REGION_CONFIG_PUBLIC: ComplianceConfig;
3526
+ /**
3527
+ * Used for commands where there is no configuration available and
3528
+ * we rely upon the CLOUDFLARE_COMPLIANCE_REGION environment variable
3529
+ * to determine the compliance region.
3530
+ */
3531
+ declare const COMPLIANCE_REGION_CONFIG_UNKNOWN: ComplianceConfig;
3532
+ /**
3533
+ * Set `CLOUDFLARE_COMPLIANCE_REGION` environment variable to "fedramp_high"
3534
+ * or set the `compliance_region` property in the Wrangler configuration
3535
+ * to tell Wrangler to run in FedRAMP High compliance region mode, rather than "public" mode.
3536
+ */
3537
+ declare const getCloudflareComplianceRegion: (complianceConfig: ComplianceConfig) => "public" | "fedramp_high";
3538
+ /**
3539
+ * `CLOUDFLARE_API_BASE_URL` specifies the URL to the Cloudflare API.
3540
+ *
3541
+ * If this environment variable is not set, it will default to a URL computed from the
3542
+ * Cloudflare compliance region and the API environment.
3543
+ */
3544
+ declare const getCloudflareApiBaseUrl: (complianceConfig: ComplianceConfig) => string;
3545
+ /**
3546
+ * Compute the subdomain for the compliance region.
3547
+ */
3548
+ declare function getComplianceRegionSubdomain(complianceConfig: ComplianceConfig): string;
3549
+ /**
3550
+ * Returns the managed container registry for the configured API environment and compliance region.
3551
+ *
3552
+ * @param complianceConfig - Compliance configuration used to select the public or FedRAMP registry.
3553
+ * @returns The managed registry hostname, respecting `CLOUDFLARE_CONTAINER_REGISTRY` and `WRANGLER_API_ENVIRONMENT`.
3554
+ */
3555
+ declare function getCloudflareContainerRegistry(complianceConfig?: ComplianceConfig): string;
3556
+ /**
3557
+ * `WRANGLER_LOG_SANITIZE` specifies whether we sanitize debug logs.
3558
+ *
3559
+ * By default we do, since debug logs could be added to GitHub issues and shouldn't include sensitive information.
3560
+ */
3561
+ declare const getSanitizeLogs: () => boolean;
3562
+ /**
3563
+ * `WRANGLER_OUTPUT_FILE_DIRECTORY` specifies a directory where we should write a file containing output data in ND-JSON format.
3564
+ *
3565
+ * If this is set a random file will be created in this directory, and certain Wrangler commands will write entries to this file.
3566
+ * This is overridden by the `WRANGLER_OUTPUT_FILE_PATH` environment variable.
3567
+ */
3568
+ declare const getOutputFileDirectoryFromEnv: () => string | undefined;
3569
+ /**
3570
+ * `WRANGLER_OUTPUT_FILE_PATH` specifies a path to a file where we should write output data in ND-JSON format.
3571
+ *
3572
+ * If this is set certain Wrangler commands will write entries to this file.
3573
+ * This overrides the `WRANGLER_OUTPUT_FILE_DIRECTORY` environment variable.
3574
+ */
3575
+ declare const getOutputFilePathFromEnv: () => string | undefined;
3576
+ /**
3577
+ * `WRANGLER_CI_MATCH_TAG` specifies a Worker tag
3578
+ *
3579
+ * If this is set, Wrangler will ensure the Worker being targeted has this tag
3580
+ */
3581
+ declare const getCIMatchTag: () => string | undefined;
3582
+ /**
3583
+ * `WRANGLER_CI_OVERRIDE_NAME` specifies a Worker name
3584
+ *
3585
+ * If this is set, Wrangler will override the Worker name with this one
3586
+ */
3587
+ declare const getCIOverrideName: () => string | undefined;
3588
+ /**
3589
+ * `WRANGLER_CI_OVERRIDE_NETWORK_MODE_HOST` specifies whether --network=host should be set
3590
+ *
3591
+ * If this is set to true, Wrangler will use the --network=host flag when calling out to docker to build container images
3592
+ */
3593
+ declare const getCIOverrideNetworkModeHost: () => string | undefined;
3594
+ /**
3595
+ * `WRANGLER_CI_GENERATE_PREVIEW_ALIAS` specifies whether to generate a preview alias during version upload
3596
+ *
3597
+ * If this is set to true, Wrangler will attempt to autogenerate the preview alias by using the branch
3598
+ * name. If the branch name is too long and an alias cannot be created, a warning will be printed to the console.
3599
+ */
3600
+ declare const getCIGeneratePreviewAlias: () => "true" | "false";
3601
+ /**
3602
+ * `WORKERS_CI_BRANCH` is the branch name exposed by Workers CI
3603
+ *
3604
+ */
3605
+ declare const getWorkersCIBranchName: () => string | undefined;
3606
+ /**
3607
+ * `WRANGLER_BUILD_CONDITIONS` specifies the "build conditions" to use when importing packages at build time.
3608
+ *
3609
+ * See https://nodejs.org/api/packages.html#conditional-exports
3610
+ * and https://esbuild.github.io/api/#how-conditions-work.
3611
+ *
3612
+ * If this is set, Wrangler will configure esbuild to use this list of conditions.
3613
+ * The format is a string of comma separated conditions.
3614
+ */
3615
+ declare const getBuildConditionsFromEnv: () => string | undefined;
3616
+ /**
3617
+ * `WRANGLER_BUILD_PLATFORM` specifies the "build platform" to use when importing packages at build time.
3618
+ *
3619
+ * See https://esbuild.github.io/api/#platform
3620
+ * and https://esbuild.github.io/api/#how-conditions-work.
3621
+ *
3622
+ * If this is set, Wrangler will configure esbuild to use this platform.
3623
+ */
3624
+ declare const getBuildPlatformFromEnv: () => string | undefined;
3625
+ /**
3626
+ * `WRANGLER_REGISTRY_PATH` specifies the file based dev registry folder
3627
+ */
3628
+ declare const getRegistryPath: () => string;
3629
+ /**
3630
+ * `WRANGLER_D1_EXTRA_LOCATION_CHOICES` is an internal variable to let D1 team target their testing environments.
3631
+ *
3632
+ * External accounts cannot access testing environments, so should not set this variable.
3633
+ */
3634
+ declare const getD1ExtraLocationChoices: () => string | undefined;
3635
+
3636
+ declare const getSubdomainMixedStateCheckDisabled: () => boolean;
3637
+ /**
3638
+ /**
3639
+ * `CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV` specifies whether to load vars for local dev from `.env` files.
3640
+ */
3641
+ declare const getCloudflareLoadDevVarsFromDotEnv: () => boolean;
3642
+ /**
3643
+ * `CLOUDFLARE_INCLUDE_PROCESS_ENV` specifies whether to include the `process.env` in vars loaded from `.env` for local development.
3644
+ */
3645
+ declare const getCloudflareIncludeProcessEnvFromEnv: () => boolean;
3646
+ declare const getTraceHeader: () => string | undefined;
3647
+ declare const getDisableConfigWatching: () => boolean;
3648
+ /**
3649
+ * Hide the Wrangler version banner and command status (deprecated/experimental) warnings
3650
+ */
3651
+ declare const getWranglerHideBanner: () => boolean;
3652
+ /**
3653
+ * `CLOUDFLARE_ENV` specifies the currently selected Wrangler/Cloudflare environment.
3654
+ */
3655
+ declare const getCloudflareEnv: () => string | undefined;
3656
+ /**
3657
+ * `OPEN_NEXT_DEPLOY` is an environment variables that indicates that the current process is being
3658
+ * run by the open-next deploy command
3659
+ */
3660
+ declare const getOpenNextDeployFromEnv: () => string | undefined;
3661
+ /**
3662
+ * `X_LOCAL_EXPLORER` enables the local explorer UI at /cdn-cgi/local/explorer.
3663
+ */
3664
+ declare const getLocalExplorerEnabledFromEnv: () => boolean;
3665
+ /**
3666
+ * `X_LOCAL_OBSERVABILITY` turns on local-dev observability capture. Both
3667
+ * `wrangler dev` and the Vite plugin read it and pass it through as the one
3668
+ * `unsafeObservability` Miniflare option, which makes core attach the trace
3669
+ * collector to each user worker.
3670
+ *
3671
+ * Defaults to `true` so the Local Explorer's Observability tab captures traces
3672
+ * and logs out of the box. Set `X_LOCAL_OBSERVABILITY=false` to opt out — for
3673
+ * example if the extra per-worker services (collector + streaming tail) cause
3674
+ * trouble in a multi-process dev-registry setup.
3675
+ */
3676
+ declare const getLocalObservabilityEnabledFromEnv: () => boolean;
3677
+ /**
3678
+ * `X_BROWSER_HEADFUL` opens the browser in headful (visible) mode when using the
3679
+ * Browser Run API in local development.
3680
+ *
3681
+ * Set to "true" to enable:
3682
+ *
3683
+ * ```sh
3684
+ * X_BROWSER_HEADFUL=true vite dev
3685
+ * ```
3686
+ *
3687
+ * Note: when using `@cloudflare/playwright`, two Chrome windows may appear — the initial blank
3688
+ * page and the one created by `browser.newPage()`. This is expected due to how Playwright handles
3689
+ * browser contexts via CDP.
3690
+ */
3691
+ declare const getBrowserRenderingHeadfulFromEnv: () => boolean;
3692
+ /**
3693
+ * `CLOUDFLARE_CF_FETCH_ENABLED` controls whether Miniflare fetches the `cf.json` file
3694
+ * containing request.cf properties from workers.cloudflare.com.
3695
+ *
3696
+ * - If set to "false", disables fetching and uses fallback data (no files created)
3697
+ * - If set to "true" or not set, uses the default behavior (fetches and caches cf.json)
3698
+ *
3699
+ * This is particularly useful for non-JavaScript projects that don't want
3700
+ * a node_modules directory created automatically.
3701
+ *
3702
+ * Example:
3703
+ * ```sh
3704
+ * # Disable cf fetching entirely
3705
+ * CLOUDFLARE_CF_FETCH_ENABLED=false npx wrangler dev
3706
+ * ```
3707
+ */
3708
+ declare const getCfFetchEnabledFromEnv: () => boolean;
3709
+ /**
3710
+ * `CLOUDFLARE_CF_FETCH_PATH` specifies a custom path for caching the cf.json file.
3711
+ *
3712
+ * - If set, uses the specified path instead of the default node_modules/.mf/cf.json
3713
+ * - If not set, uses the default location (node_modules/.mf/cf.json)
3714
+ *
3715
+ * Example:
3716
+ * ```sh
3717
+ * # Use a custom cache location
3718
+ * CLOUDFLARE_CF_FETCH_PATH=/tmp/cf-cache.json npx wrangler dev
3719
+ * ```
3720
+ */
3721
+ declare const getCfFetchPathFromEnv: () => string | undefined;
3722
+ /**
3723
+ * `WRANGLER_CACHE_DIR` specifies a custom directory for Wrangler's cache files.
3724
+ * This overrides the default `node_modules/.cache/wrangler` location.
3725
+ * Useful for Yarn PnP or projects without node_modules.
3726
+ */
3727
+ declare const getWranglerCacheDirFromEnv: () => string | undefined;
3728
+ /**
3729
+ * `CLOUDFLARED_PATH` specifies a custom path to a cloudflared binary.
3730
+ *
3731
+ * If set, Wrangler will use this cloudflared binary instead of downloading one.
3732
+ * The path must point to an existing executable file.
3733
+ */
3734
+ declare const getCloudflaredPathFromEnv: () => string | undefined;
3735
+
3736
+ export { type CfLogfwdrBinding as $, type ApiCredentials as A, type Binding as B, type ComputedFields as C, type DurableObjectExport as D, type Exports as E, type CfAnalyticsEngineDataset as F, type CfArtifacts as G, type CfAssetsBinding as H, type CfBrowserBinding as I, type CfCapnp as J, type CfD1Database as K, type Logger as L, type CfDataBlobBindings as M, type CfDevPluginCfg as N, type CfDispatchNamespace as O, type CfDurableObject as P, type CfDurableObjectMigrations as Q, type RawConfig as R, type CfExports as S, type TailConsumer as T, type CfFlagship as U, type CfHelloWorld as V, type WorkerEntrypointExport as W, type CfHyperdrive as X, type CfImagesBinding as Y, type CfKvNamespace as Z, type CfLogfwdr as _, type RedirectedRawConfig as a, type Hook as a$, type CfMTlsCertificate as a0, type CfMediaBinding as a1, type CfModule as a2, type CfModuleType as a3, type CfPipeline as a4, type CfPlacement as a5, type CfQueue as a6, type CfR2Bucket as a7, type CfRateLimit as a8, type CfScriptFormat as a9, type CustomDomainRoute as aA, type DispatchNamespaceOutbound as aB, type DockerConfiguration as aC, type DurableObjectBindings as aD, type DurableObjectCodeUpdateStrategy as aE, type DurableObjectContainerImage as aF, type DurableObjectExportStorage as aG, type DurableObjectMigration as aH, type DurableObjectsConfig as aI, ENVIRONMENT_TAG_PREFIX as aJ, type Entry as aK, type Environment as aL, type EnvironmentNonInheritable as aM, type ExportsReconciliationEntryBase as aN, type ExportsReconciliationErrorDetail as aO, type ExportsReconciliationInfo as aP, type ExportsReconciliationRename as aQ, type ExportsReconciliationResult as aR, type ExportsReconciliationTransfer as aS, type ExportsReconciliationTransferPending as aT, type ExportsReconciliationWarning as aU, type FetchKVGetValueFetcher as aV, type FetchListResultFetcher as aW, type FetchPagedListResultFetcher as aX, type FetchResult as aY, type FetchResultFetcher as aZ, type File as a_, type CfSecretsStoreSecrets as aa, type CfSendEmailBindings as ab, type CfService as ac, type CfStreamBinding as ad, type CfTextBlobBindings as ae, type CfUnsafe as af, type CfUnsafeBinding as ag, type CfUserLimits as ah, type CfVars as ai, type CfVectorize as aj, type CfVersionMetadataBinding as ak, type CfVpcNetwork as al, type CfVpcService as am, type CfWasmModuleBindings as an, type CfWorkerContext as ao, type CfWorkerInit as ap, type CfWorkerLoader as aq, type CfWorkerSourceMap as ar, type CfWorkflow as as, type CloudchamberConfig as at, type ConfigFields as au, type ConfigModuleRuleType as av, type ConfiguredExport as aw, type ConnectHandler as ax, type ContainerEngine as ay, type ContainerObservability as az, type Config as b, getOutputFileDirectoryFromEnv as b$, type HookValues as b0, INHERIT_SYMBOL as b1, JSON_CONFIG_FORMATS as b2, type Json as b3, LOGGER_LEVELS as b4, type LegacyAssetPaths as b5, type LocalS3Credentials as b6, type LogLevel as b7, type LoggerLevel as b8, type NodeJSCompatMode as b9, fetchListResultBase as bA, fetchResultBase as bB, getBrowserRenderingHeadfulFromEnv as bC, getBuildConditionsFromEnv as bD, getBuildPlatformFromEnv as bE, getC3CommandFromEnv as bF, getCIGeneratePreviewAlias as bG, getCIMatchTag as bH, getCIOverrideName as bI, getCIOverrideNetworkModeHost as bJ, getCfFetchEnabledFromEnv as bK, getCfFetchPathFromEnv as bL, getCloudflareApiBaseUrl as bM, getCloudflareApiEnvironmentFromEnv as bN, getCloudflareComplianceRegion as bO, getCloudflareContainerRegistry as bP, getCloudflareEnv as bQ, getCloudflareIncludeProcessEnvFromEnv as bR, getCloudflareLoadDevVarsFromDotEnv as bS, getCloudflaredPathFromEnv as bT, getComplianceRegionSubdomain as bU, getD1ExtraLocationChoices as bV, getDisableConfigWatching as bW, getLocalExplorerEnabledFromEnv as bX, getLocalObservabilityEnabledFromEnv as bY, getNoSkillsUpdatePromptsFromEnv as bZ, getOpenNextDeployFromEnv as b_, type Observability as ba, PATH_TO_DEPLOY_CONFIG as bb, type PreviewsConfig as bc, type RawDevConfig as bd, type RawDurableObjectsConfig as be, type RawEnvironment as bf, type Rule as bg, SERVICE_TAG_PREFIX as bh, type ServiceFetch as bi, type ServiceMetadataRes as bj, type StartDevWorkerInput as bk, type StreamingTailConsumer as bl, type TcpConnectHandler as bm, type Trigger as bn, type UdpConnectHandler as bo, type UserLimits as bp, type ValidatedAssetsOptions as bq, type WorkflowBinding as br, type ZoneIdRoute as bs, type ZoneNameRoute as bt, addAuthorizationHeader as bu, defaultWranglerConfig as bv, extractAccountTag as bw, extractWAFBlockRayId as bx, fetchInternalBase as by, fetchKVGetValueBase as bz, type WorkflowExport as c, getOutputFilePathFromEnv as c0, getRegistryPath as c1, getSanitizeLogs as c2, getSubdomainMixedStateCheckDisabled as c3, getTraceHeader as c4, getWorkersCIBranchName as c5, getWranglerCacheDirFromEnv as c6, getWranglerHideBanner as c7, getWranglerSendErrorReportsFromEnv as c8, getWranglerSendMetricsFromEnv as c9, hasCursor as ca, hasMorePages as cb, isDoNotTrackEnabled as cc, isWAFBlockResponse as cd, maybeAddTraceHeader as ce, parseRetryAfterMs as cf, parseRetryAfterValue as cg, performApiFetchBase as ch, renderError as ci, throwFetchError as cj, truncate as ck, type ContainerApp as d, type WorkerMetadataBinding as e, type WorkerMetadata as f, type CfTailConsumer as g, type ComplianceConfig as h, type Route as i, ARTIFACTS_EVENT_TYPES as j, type Access as k, type ArtifactsEventTrigger as l, type ArtifactsEventType as m, type AssetConfigMetadata as n, type Assets as o, type AssetsOptions as p, type AsyncHook as q, type BinaryFile as r, COMPLIANCE_REGION_CONFIG_PUBLIC as s, COMPLIANCE_REGION_CONFIG_UNKNOWN as t, type CacheOptions as u, type CfAIBinding as v, type CfAISearch as w, type CfAISearchNamespace as x, type CfAccount as y, type CfAgentMemory as z };