@cloudflare/workers-utils 0.23.0 → 0.23.2

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.
@@ -1,6 +1,8 @@
1
- import { T as TailConsumer, az as WorkerMetadata, R as RawConfig } from './config-BT23LDfr.mjs';
1
+ import { T as TailConsumer, aE as WorkerMetadata, R as RawConfig } from './config-8UymS5SL.mjs';
2
2
  import { AssetConfig } from '@cloudflare/workers-shared';
3
3
  import { Cloudflare } from 'cloudflare';
4
+ import 'node:url';
5
+ import 'undici';
4
6
 
5
7
  type RoutesRes = {
6
8
  id: string;
@@ -1,5 +1,345 @@
1
+ import { URLSearchParams } from 'node:url';
2
+ import { RequestInit, Response as Response$1, Headers, MockAgent } from 'undici';
1
3
  import { RouterConfig, AssetConfig } from '@cloudflare/workers-shared';
2
4
 
5
+ interface FetchError {
6
+ code: number;
7
+ documentation_url?: string;
8
+ message: string;
9
+ error_chain?: FetchError[];
10
+ }
11
+
12
+ /**
13
+ * `WRANGLER_C3_COMMAND` can override the command used by `wrangler init` when delegating to C3.
14
+ *
15
+ * By default this will use `create cloudflare`.
16
+ *
17
+ * To run against the beta release of C3 use:
18
+ *
19
+ * ```sh
20
+ * # Tell Wrangler to use the beta version of create-cloudflare
21
+ * WRANGLER_C3_COMMAND="create cloudflare@beta" npx wrangler init
22
+ * ```
23
+ *
24
+ * To test the integration between wrangler and C3 locally, use:
25
+ *
26
+ * ```sh
27
+ * # Ensure both Wrangler and C3 are built
28
+ * npm run build
29
+ * # Tell Wrangler to use the local version of create-cloudflare
30
+ * WRANGLER_C3_COMMAND="exec ./packages/create-cloudflare" npx wrangler init temp
31
+ * ```
32
+ *
33
+ * Note that you cannot use `WRANGLER_C3_COMMAND="create cloudflare@2"` if you are
34
+ * running Wrangler from inside the monorepo as the bin paths get messed up.
35
+ */
36
+ declare const getC3CommandFromEnv: () => string;
37
+ /**
38
+ * `WRANGLER_SEND_METRICS` can override whether we attempt to send metrics information to Sparrow.
39
+ */
40
+ declare const getWranglerSendMetricsFromEnv: () => boolean | undefined;
41
+ /**
42
+ * `WRANGLER_SEND_ERROR_REPORTS` controls whether we attempt to send error reports to Sentry.
43
+ *
44
+ * Defaults to `false` to avoid noisy false-positive reports. Users can opt in
45
+ * by setting `WRANGLER_SEND_ERROR_REPORTS=true`.
46
+ */
47
+ declare const getWranglerSendErrorReportsFromEnv: () => boolean;
48
+ /**
49
+ * Set `WRANGLER_API_ENVIRONMENT` environment variable to "staging" to tell Wrangler to hit the staging APIs rather than production.
50
+ */
51
+ declare const getCloudflareApiEnvironmentFromEnv: () => "production" | "staging";
52
+ /**
53
+ * The compliance region to use for the API requests.
54
+ */
55
+ type ComplianceConfig = Partial<Pick<Config, "compliance_region">>;
56
+ /** Used for commands that explicitly do not support compliance regions other than "public" */
57
+ declare const COMPLIANCE_REGION_CONFIG_PUBLIC: ComplianceConfig;
58
+ /**
59
+ * Used for commands where there is no configuration available and
60
+ * we rely upon the CLOUDFLARE_COMPLIANCE_REGION environment variable
61
+ * to determine the compliance region.
62
+ */
63
+ declare const COMPLIANCE_REGION_CONFIG_UNKNOWN: ComplianceConfig;
64
+ /**
65
+ * Set `CLOUDFLARE_COMPLIANCE_REGION` environment variable to "fedramp_high"
66
+ * or set the `compliance_region` property in the Wrangler configuration
67
+ * to tell Wrangler to run in FedRAMP High compliance region mode, rather than "public" mode.
68
+ */
69
+ declare const getCloudflareComplianceRegion: (complianceConfig: ComplianceConfig) => "public" | "fedramp_high";
70
+ /**
71
+ * `CLOUDFLARE_API_BASE_URL` specifies the URL to the Cloudflare API.
72
+ *
73
+ * If this environment variable is not set, it will default to a URL computed from the
74
+ * Cloudflare compliance region and the API environment.
75
+ */
76
+ declare const getCloudflareApiBaseUrl: (complianceConfig: ComplianceConfig) => string;
77
+ /**
78
+ * Compute the subdomain for the compliance region.
79
+ */
80
+ declare function getComplianceRegionSubdomain(complianceConfig: ComplianceConfig): string;
81
+ /**
82
+ * `WRANGLER_LOG_SANITIZE` specifies whether we sanitize debug logs.
83
+ *
84
+ * By default we do, since debug logs could be added to GitHub issues and shouldn't include sensitive information.
85
+ */
86
+ declare const getSanitizeLogs: () => boolean;
87
+ /**
88
+ * `WRANGLER_OUTPUT_FILE_DIRECTORY` specifies a directory where we should write a file containing output data in ND-JSON format.
89
+ *
90
+ * If this is set a random file will be created in this directory, and certain Wrangler commands will write entries to this file.
91
+ * This is overridden by the `WRANGLER_OUTPUT_FILE_PATH` environment variable.
92
+ */
93
+ declare const getOutputFileDirectoryFromEnv: () => string | undefined;
94
+ /**
95
+ * `WRANGLER_OUTPUT_FILE_PATH` specifies a path to a file where we should write output data in ND-JSON format.
96
+ *
97
+ * If this is set certain Wrangler commands will write entries to this file.
98
+ * This overrides the `WRANGLER_OUTPUT_FILE_DIRECTORY` environment variable.
99
+ */
100
+ declare const getOutputFilePathFromEnv: () => string | undefined;
101
+ /**
102
+ * `WRANGLER_CI_MATCH_TAG` specifies a Worker tag
103
+ *
104
+ * If this is set, Wrangler will ensure the Worker being targeted has this tag
105
+ */
106
+ declare const getCIMatchTag: () => string | undefined;
107
+ /**
108
+ * `WRANGLER_CI_OVERRIDE_NAME` specifies a Worker name
109
+ *
110
+ * If this is set, Wrangler will override the Worker name with this one
111
+ */
112
+ declare const getCIOverrideName: () => string | undefined;
113
+ /**
114
+ * `WRANGLER_CI_OVERRIDE_NETWORK_MODE_HOST` specifies whether --network=host should be set
115
+ *
116
+ * If this is set to true, Wrangler will use the --network=host flag when calling out to docker to build container images
117
+ */
118
+ declare const getCIOverrideNetworkModeHost: () => string | undefined;
119
+ /**
120
+ * `WRANGLER_CI_GENERATE_PREVIEW_ALIAS` specifies whether to generate a preview alias during version upload
121
+ *
122
+ * If this is set to true, Wrangler will attempt to autogenerate the preview alias by using the branch
123
+ * name. If the branch name is too long and an alias cannot be created, a warning will be printed to the console.
124
+ */
125
+ declare const getCIGeneratePreviewAlias: () => "true" | "false";
126
+ /**
127
+ * `WORKERS_CI_BRANCH` is the branch name exposed by Workers CI
128
+ *
129
+ */
130
+ declare const getWorkersCIBranchName: () => string | undefined;
131
+ /**
132
+ * `WRANGLER_BUILD_CONDITIONS` specifies the "build conditions" to use when importing packages at build time.
133
+ *
134
+ * See https://nodejs.org/api/packages.html#conditional-exports
135
+ * and https://esbuild.github.io/api/#how-conditions-work.
136
+ *
137
+ * If this is set, Wrangler will configure esbuild to use this list of conditions.
138
+ * The format is a string of comma separated conditions.
139
+ */
140
+ declare const getBuildConditionsFromEnv: () => string | undefined;
141
+ /**
142
+ * `WRANGLER_BUILD_PLATFORM` specifies the "build platform" to use when importing packages at build time.
143
+ *
144
+ * See https://esbuild.github.io/api/#platform
145
+ * and https://esbuild.github.io/api/#how-conditions-work.
146
+ *
147
+ * If this is set, Wrangler will configure esbuild to use this platform.
148
+ */
149
+ declare const getBuildPlatformFromEnv: () => string | undefined;
150
+ /**
151
+ * `WRANGLER_REGISTRY_PATH` specifies the file based dev registry folder
152
+ */
153
+ declare const getRegistryPath: () => string;
154
+ /**
155
+ * `WRANGLER_D1_EXTRA_LOCATION_CHOICES` is an internal variable to let D1 team target their testing environments.
156
+ *
157
+ * External accounts cannot access testing environments, so should not set this variable.
158
+ */
159
+ declare const getD1ExtraLocationChoices: () => string | undefined;
160
+ /**
161
+ * `WRANGLER_DOCKER_BIN` specifies the path to a docker binary.
162
+ *
163
+ * By default it's `docker`.
164
+ */
165
+ declare const getDockerPath: () => string;
166
+ declare const getSubdomainMixedStateCheckDisabled: () => boolean;
167
+ /**
168
+ /**
169
+ * `CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV` specifies whether to load vars for local dev from `.env` files.
170
+ */
171
+ declare const getCloudflareLoadDevVarsFromDotEnv: () => boolean;
172
+ /**
173
+ * `CLOUDFLARE_INCLUDE_PROCESS_ENV` specifies whether to include the `process.env` in vars loaded from `.env` for local development.
174
+ */
175
+ declare const getCloudflareIncludeProcessEnvFromEnv: () => boolean;
176
+ declare const getTraceHeader: () => string | undefined;
177
+ declare const getDisableConfigWatching: () => boolean;
178
+ /**
179
+ * Hide the Wrangler version banner and command status (deprecated/experimental) warnings
180
+ */
181
+ declare const getWranglerHideBanner: () => boolean;
182
+ /**
183
+ * `CLOUDFLARE_ENV` specifies the currently selected Wrangler/Cloudflare environment.
184
+ */
185
+ declare const getCloudflareEnv: () => string | undefined;
186
+ /**
187
+ * `OPEN_NEXT_DEPLOY` is an environment variables that indicates that the current process is being
188
+ * run by the open-next deploy command
189
+ */
190
+ declare const getOpenNextDeployFromEnv: () => string | undefined;
191
+ /**
192
+ * `X_LOCAL_EXPLORER` enables the local explorer UI at /cdn-cgi/explorer.
193
+ */
194
+ declare const getLocalExplorerEnabledFromEnv: () => boolean;
195
+ /**
196
+ * `X_BROWSER_HEADFUL` opens the browser in headful (visible) mode when using the
197
+ * Browser Run API in local development.
198
+ *
199
+ * Set to "true" to enable:
200
+ *
201
+ * ```sh
202
+ * X_BROWSER_HEADFUL=true vite dev
203
+ * ```
204
+ *
205
+ * Note: when using `@cloudflare/playwright`, two Chrome windows may appear — the initial blank
206
+ * page and the one created by `browser.newPage()`. This is expected due to how Playwright handles
207
+ * browser contexts via CDP.
208
+ */
209
+ declare const getBrowserRenderingHeadfulFromEnv: () => boolean;
210
+ /**
211
+ * `CLOUDFLARE_CF_FETCH_ENABLED` controls whether Miniflare fetches the `cf.json` file
212
+ * containing request.cf properties from workers.cloudflare.com.
213
+ *
214
+ * - If set to "false", disables fetching and uses fallback data (no files created)
215
+ * - If set to "true" or not set, uses the default behavior (fetches and caches cf.json)
216
+ *
217
+ * This is particularly useful for non-JavaScript projects that don't want
218
+ * a node_modules directory created automatically.
219
+ *
220
+ * Example:
221
+ * ```sh
222
+ * # Disable cf fetching entirely
223
+ * CLOUDFLARE_CF_FETCH_ENABLED=false npx wrangler dev
224
+ * ```
225
+ */
226
+ declare const getCfFetchEnabledFromEnv: () => boolean;
227
+ /**
228
+ * `CLOUDFLARE_CF_FETCH_PATH` specifies a custom path for caching the cf.json file.
229
+ *
230
+ * - If set, uses the specified path instead of the default node_modules/.mf/cf.json
231
+ * - If not set, uses the default location (node_modules/.mf/cf.json)
232
+ *
233
+ * Example:
234
+ * ```sh
235
+ * # Use a custom cache location
236
+ * CLOUDFLARE_CF_FETCH_PATH=/tmp/cf-cache.json npx wrangler dev
237
+ * ```
238
+ */
239
+ declare const getCfFetchPathFromEnv: () => string | undefined;
240
+ /**
241
+ * `WRANGLER_CACHE_DIR` specifies a custom directory for Wrangler's cache files.
242
+ * This overrides the default `node_modules/.cache/wrangler` location.
243
+ * Useful for Yarn PnP or projects without node_modules.
244
+ */
245
+ declare const getWranglerCacheDirFromEnv: () => string | undefined;
246
+ /**
247
+ * `CLOUDFLARED_PATH` specifies a custom path to a cloudflared binary.
248
+ *
249
+ * If set, Wrangler will use this cloudflared binary instead of downloading one.
250
+ * The path must point to an existing executable file.
251
+ */
252
+ declare const getCloudflaredPathFromEnv: () => string | undefined;
253
+
254
+ declare const LOGGER_LEVELS: {
255
+ readonly none: -1;
256
+ readonly error: 0;
257
+ readonly warn: 1;
258
+ readonly info: 2;
259
+ readonly log: 3;
260
+ readonly debug: 4;
261
+ };
262
+ type LoggerLevel = keyof typeof LOGGER_LEVELS;
263
+ type Logger = {
264
+ loggerLevel?: LoggerLevel;
265
+ debug: typeof console.debug;
266
+ debugWithSanitization?: (label: string, ...args: unknown[]) => void;
267
+ log: typeof console.log;
268
+ info: typeof console.info;
269
+ warn: typeof console.warn;
270
+ error: typeof console.error;
271
+ once?: {
272
+ info: typeof console.info;
273
+ log: typeof console.log;
274
+ warn: typeof console.warn;
275
+ error: typeof console.error;
276
+ };
277
+ };
278
+
279
+ type ApiCredentials = {
280
+ apiToken: string;
281
+ } | {
282
+ authKey: string;
283
+ authEmail: string;
284
+ };
285
+ interface FetchResult<ResponseType = unknown> {
286
+ success: boolean;
287
+ result: ResponseType;
288
+ errors: FetchError[];
289
+ messages?: (string | {
290
+ code?: number;
291
+ message: string;
292
+ })[];
293
+ result_info?: unknown;
294
+ }
295
+ type FetchResultFetcher = <ResponseType>(complianceConfig: ComplianceConfig, resource: string, init?: RequestInit, queryParams?: URLSearchParams, abortSignal?: AbortSignal) => Promise<ResponseType>;
296
+ type FetchListResultFetcher = <ResponseType>(complianceConfig: ComplianceConfig, resource: string, init?: RequestInit, queryParams?: URLSearchParams) => Promise<ResponseType[]>;
297
+ type FetchPagedListResultFetcher = <ResponseType>(complianceConfig: ComplianceConfig, resource: string, init?: RequestInit, queryParams?: URLSearchParams) => Promise<ResponseType[]>;
298
+ /**
299
+ *
300
+ * Note this requires its caller to handle credentials
301
+ * (need to call requireLoggedIn and requireApiToken)
302
+ */
303
+ declare function performApiFetchBase(complianceConfig: ComplianceConfig, resource: string, init: RequestInit | undefined, userAgent: string, logger: Logger, queryParams?: URLSearchParams, abortSignal?: AbortSignal, credentials?: ApiCredentials): Promise<Response$1>;
304
+ declare function fetchInternalBase<ResponseType>(complianceConfig: ComplianceConfig, resource: string, init: RequestInit | undefined, userAgent: string, logger: Logger, queryParams?: URLSearchParams, abortSignal?: AbortSignal, credentials?: ApiCredentials): Promise<{
305
+ response: ResponseType;
306
+ status: number;
307
+ }>;
308
+ declare function fetchResultBase<ResponseType>(complianceConfig: ComplianceConfig, resource: string, init: RequestInit | undefined, userAgent: string, logger: Logger, queryParams?: URLSearchParams, abortSignal?: AbortSignal, credentials?: ApiCredentials): Promise<ResponseType>;
309
+ declare function fetchListResultBase<ResponseType>(complianceConfig: ComplianceConfig, resource: string, init: RequestInit | undefined, userAgent: string, logger: Logger, queryParams?: URLSearchParams, credentials?: ApiCredentials): Promise<ResponseType[]>;
310
+ declare function truncate(text: string, maxLength: number): string;
311
+ declare function isWAFBlockResponse(headers: Headers): boolean;
312
+ declare function extractWAFBlockRayId(headers: Headers): string | undefined;
313
+ declare function extractAccountTag(resource: string): string | undefined;
314
+ interface PageResultInfo {
315
+ page: number;
316
+ per_page: number;
317
+ count: number;
318
+ total_count: number;
319
+ }
320
+ declare function hasMorePages(result_info: unknown): result_info is PageResultInfo;
321
+ declare function renderError(err: FetchError | {
322
+ code?: number;
323
+ message?: string;
324
+ documentation_url?: string;
325
+ }, level?: number): string;
326
+ declare function addAuthorizationHeader(headers: Headers, auth: ApiCredentials, overrideExisting?: boolean): void;
327
+ declare function throwFetchError(resource: string, response: FetchResult<unknown>, status: number): never;
328
+ /**
329
+ * Fetch a raw KV value from the Cloudflare API.
330
+ *
331
+ * This is special-cased because it's the only API endpoint that returns raw
332
+ * binary data instead of a JSON envelope.
333
+ *
334
+ * Note: callers must call encodeURIComponent on `key` before passing it.
335
+ */
336
+ declare function fetchKVGetValueBase(complianceConfig: ComplianceConfig, accountId: string, namespaceId: string, key: string, userAgent: string, logger: Logger, credentials: ApiCredentials): Promise<ArrayBuffer>;
337
+ type FetchKVGetValueFetcher = (complianceConfig: ComplianceConfig, accountId: string, namespaceId: string, key: string) => Promise<ArrayBuffer>;
338
+ declare function hasCursor(result_info: unknown): result_info is {
339
+ cursor: string;
340
+ };
341
+ declare function maybeAddTraceHeader(headers: Headers): void;
342
+
3
343
  /**
4
344
  * A symbol to inherit a binding from the deployed worker.
5
345
  */
@@ -262,6 +602,24 @@ interface CfHyperdrive {
262
602
  id: string;
263
603
  localConnectionString?: string;
264
604
  }
605
+ interface CfDevPluginCfg {
606
+ plugin: {
607
+ /**
608
+ * Package is the bare specifier of the package that exposes plugins to integrate into Miniflare via a named `plugins` export.
609
+ * @example "@cloudflare/my-external-miniflare-plugin"
610
+ */
611
+ package: string;
612
+ /**
613
+ * Plugin is the name of the plugin exposed by the package.
614
+ * @example "my-unsafe-plugin"
615
+ */
616
+ name: string;
617
+ };
618
+ /**
619
+ * dev-only options to pass to the plugin.
620
+ */
621
+ options?: Record<string, unknown>;
622
+ }
265
623
  interface CfService {
266
624
  binding: string;
267
625
  service: string;
@@ -270,6 +628,7 @@ interface CfService {
270
628
  props?: Record<string, unknown>;
271
629
  remote?: boolean;
272
630
  cross_account_grant?: string;
631
+ dev?: CfDevPluginCfg;
273
632
  }
274
633
  interface CfVpcService {
275
634
  binding: string;
@@ -320,24 +679,7 @@ interface CfPipeline {
320
679
  interface CfUnsafeBinding {
321
680
  name: string;
322
681
  type: string;
323
- dev?: {
324
- plugin: {
325
- /**
326
- * Package is the bare specifier of the package that exposes plugins to integrate into Miniflare via a named `plugins` export.
327
- * @example "@cloudflare/my-external-miniflare-plugin"
328
- */
329
- package: string;
330
- /**
331
- * Plugin is the name of the plugin exposed by the package.
332
- * @example "my-unsafe-plugin"
333
- */
334
- name: string;
335
- };
336
- /**
337
- * dev-only options to pass to the plugin.
338
- */
339
- options?: Record<string, unknown>;
340
- };
682
+ dev?: CfDevPluginCfg;
341
683
  }
342
684
  type CfUnsafeMetadata = Record<string, unknown>;
343
685
  type CfCapnp = {
@@ -683,6 +1025,16 @@ type AssetsOptions = {
683
1025
  _headers?: string;
684
1026
  run_worker_first?: boolean | string[];
685
1027
  };
1028
+ /**
1029
+ * The result of validating and resolving the assets directory, before the
1030
+ * full {@link AssetsOptions} are resolved. Produced by the validation half of
1031
+ * `getAssetsOptions` and consumed by `resolveAssetOptions`.
1032
+ */
1033
+ type ValidatedAssetsOptions = {
1034
+ directory: string;
1035
+ binding?: string;
1036
+ directoryExists: boolean;
1037
+ };
686
1038
  /**
687
1039
  * Information about the assets that should be uploaded
688
1040
  */
@@ -904,6 +1256,180 @@ type Binding = {
904
1256
  } | {
905
1257
  type: "inherit";
906
1258
  };
1259
+ interface CfAccount {
1260
+ /**
1261
+ * An API token.
1262
+ *
1263
+ * @link https://api.cloudflare.com/#user-api-tokens-properties
1264
+ */
1265
+ apiToken: ApiCredentials;
1266
+ /**
1267
+ * An account ID.
1268
+ */
1269
+ accountId: string;
1270
+ }
1271
+ type HookValues = string | number | boolean | object | undefined | null;
1272
+ type Hook<T extends HookValues, Args extends unknown[] = []> = T | ((...args: Args) => T);
1273
+ type AsyncHook<T extends HookValues, Args extends unknown[] = []> = Hook<T, Args> | Hook<Promise<T>, Args>;
1274
+ type LogLevel = "debug" | "info" | "log" | "warn" | "error" | "none";
1275
+ type NodeJSCompatMode = "als" | "v1" | "v2" | null;
1276
+ interface StartDevWorkerInput {
1277
+ /** The name of the worker. */
1278
+ name?: string;
1279
+ /**
1280
+ * The javascript or typescript entry-point of the worker.
1281
+ * This is the `main` property of a Wrangler configuration file.
1282
+ */
1283
+ entrypoint?: string;
1284
+ /** The configuration path of the worker, or a normalized configuration object. */
1285
+ config?: string | Config;
1286
+ /** The compatibility date for the workerd runtime. */
1287
+ compatibilityDate?: string;
1288
+ /** The compatibility flags for the workerd runtime. */
1289
+ compatibilityFlags?: string[];
1290
+ /** Specify the compliance region mode of the Worker. */
1291
+ complianceRegion?: Config["compliance_region"];
1292
+ /** Configuration for Python modules. */
1293
+ pythonModules?: {
1294
+ /** A list of glob patterns to exclude files from the python_modules directory when bundling. */
1295
+ exclude?: string[];
1296
+ };
1297
+ env?: string;
1298
+ /**
1299
+ * An array of paths to the .env files to load for this worker, relative to the project directory.
1300
+ *
1301
+ * If not specified, defaults to the standard `.env` files as given from Wrangler.
1302
+ * The project directory is where the Wrangler configuration file is located or the current working directory otherwise.
1303
+ */
1304
+ envFiles?: string[];
1305
+ /** The bindings available to the worker. The specified binding type will be exposed to the worker on the `env` object under the same key. */
1306
+ bindings?: Record<string, Binding>;
1307
+ /**
1308
+ * Default bindings that can be overridden by config bindings.
1309
+ * Useful for injecting environment-specific defaults like CF_PAGES variables.
1310
+ */
1311
+ defaultBindings?: Record<string, Extract<Binding, {
1312
+ type: "plain_text";
1313
+ }>>;
1314
+ migrations?: DurableObjectMigration[];
1315
+ containers?: ContainerApp[];
1316
+ /** The triggers which will cause the worker's exported default handlers to be called. */
1317
+ triggers?: Trigger[];
1318
+ tailConsumers?: CfTailConsumer[];
1319
+ streamingTailConsumers?: CfTailConsumer[];
1320
+ /**
1321
+ * Whether Wrangler should send usage metrics to Cloudflare for this project.
1322
+ *
1323
+ * When defined this will override any user settings.
1324
+ * Otherwise, Wrangler will use the user's preference.
1325
+ */
1326
+ sendMetrics?: boolean;
1327
+ /** Options applying to the worker's build step. Applies to deploy and dev. */
1328
+ build?: {
1329
+ /** Whether the worker and its dependencies are bundled. Defaults to true. */
1330
+ bundle?: boolean;
1331
+ additionalModules?: CfModule[];
1332
+ findAdditionalModules?: boolean;
1333
+ processEntrypoint?: boolean;
1334
+ /** Specifies types of modules matched by globs. */
1335
+ moduleRules?: Rule[];
1336
+ /** Replace global identifiers with constant expressions, e.g. { debug: 'true', version: '"1.0.0"' }. Only takes effect if bundle: true. */
1337
+ define?: Record<string, string>;
1338
+ /** Alias modules */
1339
+ alias?: Record<string, string>;
1340
+ /** Whether the bundled worker is minified. Only takes effect if bundle: true. */
1341
+ minify?: boolean;
1342
+ /** Whether to keep function names after JavaScript transpilations. */
1343
+ keepNames?: boolean;
1344
+ /** Options controlling a custom build step. */
1345
+ custom?: {
1346
+ /** Custom shell command to run before bundling. Runs even if bundle. */
1347
+ command?: string;
1348
+ /** The cwd to run the command in. */
1349
+ workingDirectory?: string;
1350
+ /** Filepath(s) to watch for changes. Upon changes, the command will be rerun. */
1351
+ watch?: string | string[];
1352
+ };
1353
+ jsxFactory?: string;
1354
+ jsxFragment?: string;
1355
+ tsconfig?: string;
1356
+ nodejsCompatMode?: Hook<NodeJSCompatMode, [Config]>;
1357
+ moduleRoot?: string;
1358
+ };
1359
+ /** Options applying to the worker's development preview environment. */
1360
+ dev?: {
1361
+ /** Options applying to the worker's inspector server. False disables the inspector server. */
1362
+ inspector?: {
1363
+ hostname?: string;
1364
+ port?: number;
1365
+ secure?: boolean;
1366
+ } | false;
1367
+ /** Whether the worker runs on the edge or locally. */
1368
+ remote?: boolean | "minimal";
1369
+ /** Cloudflare Account credentials. Can be provided upfront or as a function which will be called only when required. */
1370
+ auth?: AsyncHook<CfAccount, [Pick<Config, "account_id">]>;
1371
+ /** Whether local storage (KV, Durable Objects, R2, D1, etc) is persisted. You can also specify the directory to persist data to. Set to `false` to disable persistence. */
1372
+ persist?: string | false;
1373
+ /** Controls which logs are logged. */
1374
+ logLevel?: LogLevel;
1375
+ /** Whether the worker server restarts upon source/config file changes. */
1376
+ watch?: boolean;
1377
+ /** Whether a script tag is inserted on text/html responses which will reload the page upon file changes. Defaults to false. */
1378
+ liveReload?: boolean;
1379
+ /** The local address to reach your worker. Applies to remote: true (remote mode) and remote: false (local mode). */
1380
+ server?: {
1381
+ hostname?: string;
1382
+ port?: number;
1383
+ secure?: boolean;
1384
+ httpsKeyPath?: string;
1385
+ httpsCertPath?: string;
1386
+ };
1387
+ /** Controls what request.url looks like inside the worker. */
1388
+ origin?: {
1389
+ hostname?: string;
1390
+ secure?: boolean;
1391
+ };
1392
+ /** A hook for outbound fetch calls from within the worker. */
1393
+ outboundService?: ServiceFetch;
1394
+ /** An undici MockAgent to declaratively mock fetch calls to particular resources. */
1395
+ mockFetch?: MockAgent;
1396
+ testScheduled?: boolean;
1397
+ /** Treat this as the primary worker in a multiworker setup (i.e. the first Worker in Miniflare's options) */
1398
+ multiworkerPrimary?: boolean;
1399
+ /** Whether to infer the local request origin from configured routes. */
1400
+ inferOriginFromRoutes?: boolean;
1401
+ /** Whether local requests should be matched against configured routes. */
1402
+ routeRequestsByRoutes?: boolean;
1403
+ containerBuildId?: string;
1404
+ /** Whether to build and connect to containers during local dev. Requires Docker daemon to be running. Defaults to true. */
1405
+ enableContainers?: boolean;
1406
+ /** Path to the dev registry directory */
1407
+ registry?: string;
1408
+ /** Path to the docker executable. Defaults to 'docker' */
1409
+ dockerPath?: string;
1410
+ /** Options for the container engine */
1411
+ containerEngine?: ContainerEngine;
1412
+ /** Re-generate your worker types when your Wrangler configuration file changes */
1413
+ generateTypes?: boolean;
1414
+ /**
1415
+ * Experimental: Use `cloudflare.config.ts` + optional `wrangler.config.ts`
1416
+ * instead of `wrangler.json[c]` / `wrangler.toml`.
1417
+ */
1418
+ experimentalNewConfig?: boolean;
1419
+ /** Tunnel configuration for this dev session. */
1420
+ tunnel?: {
1421
+ enabled: boolean;
1422
+ name?: string;
1423
+ };
1424
+ };
1425
+ legacy?: {
1426
+ site?: Hook<Config["site"], [Config]>;
1427
+ useServiceEnvironments?: boolean;
1428
+ };
1429
+ unsafe?: Omit<CfUnsafe, "bindings">;
1430
+ assets?: string;
1431
+ experimental?: Record<string, never>;
1432
+ }
907
1433
  /**
908
1434
  * An entry point for the Worker.
909
1435
  *
@@ -2723,4 +3249,4 @@ interface EnvironmentMap {
2723
3249
  }
2724
3250
  declare const defaultWranglerConfig: Config;
2725
3251
 
2726
- export { type CfVectorize as $, type Assets as A, type Binding as B, type ComputedFields as C, type DurableObjectMigration as D, type Environment as E, type CfWasmModuleBindings as F, type CfTextBlobBindings as G, type CfBrowserBinding as H, type CfAIBinding as I, type CfImagesBinding as J, type CfMediaBinding as K, type CfStreamBinding as L, type CfVersionMetadataBinding as M, type CfDataBlobBindings as N, type Observability as O, type PreviewsConfig as P, type CfDurableObject as Q, type RawConfig as R, type StreamingTailConsumer as S, type TailConsumer as T, type UserLimits as U, type CfWorkflow as V, type WorkerMetadataBinding as W, type CfQueue as X, type CfR2Bucket as Y, type ZoneIdRoute as Z, type CfD1Database as _, type RedirectedRawConfig as a, type CfAISearchNamespace as a0, type CfAISearch as a1, type CfWebSearch as a2, type CfAgentMemory as a3, type CfSecretsStoreSecrets as a4, type CfArtifacts as a5, type CfHelloWorld as a6, type CfFlagship as a7, type CfWorkerLoader as a8, type CfRateLimit as a9, type ServiceMetadataRes as aA, type ServiceFetch as aB, type File as aC, type BinaryFile as aD, type Trigger as aE, type Entry as aF, INHERIT_SYMBOL as aG, SERVICE_TAG_PREFIX as aH, ENVIRONMENT_TAG_PREFIX as aI, PATH_TO_DEPLOY_CONFIG as aJ, JSON_CONFIG_FORMATS as aK, type CfHyperdrive as aa, type CfService as ab, type CfVpcService as ac, type CfVpcNetwork as ad, type CfAnalyticsEngineDataset as ae, type CfDispatchNamespace as af, type CfMTlsCertificate as ag, type CfLogfwdr as ah, type CfLogfwdrBinding as ai, type CfAssetsBinding as aj, type CfPipeline as ak, type CfUnsafeBinding as al, type CfCapnp as am, type CfUnsafe as an, type CfDurableObjectMigrations as ao, type CfPlacement as ap, type CfTailConsumer as aq, type CfUserLimits as ar, type CfWorkerInit as as, type CfWorkerContext as at, type CfWorkerSourceMap as au, type Json as av, type AssetConfigMetadata as aw, type AssetsOptions as ax, type LegacyAssetPaths as ay, type WorkerMetadata as az, type Config as b, type Route as c, type RawDevConfig as d, type ConfigFields as e, type RawEnvironment as f, defaultWranglerConfig as g, type ZoneNameRoute as h, type CustomDomainRoute as i, type CloudchamberConfig as j, type ContainerApp as k, type DurableObjectBindings as l, type WorkflowBinding as m, type EnvironmentNonInheritable as n, type Rule as o, type ConfigModuleRuleType as p, type DispatchNamespaceOutbound as q, type CacheOptions as r, type DockerConfiguration as s, type ContainerEngine as t, type CfScriptFormat as u, type CfModuleType as v, type CfModule as w, type CfVars as x, type CfKvNamespace as y, type CfSendEmailBindings as z };
3252
+ export { type CfQueue as $, type Assets as A, type Binding as B, type ComputedFields as C, type DurableObjectMigration as D, type Environment as E, type CfKvNamespace as F, type CfSendEmailBindings as G, type CfWasmModuleBindings as H, type CfTextBlobBindings as I, type CfBrowserBinding as J, type CfAIBinding as K, type Logger as L, type CfImagesBinding as M, type CfMediaBinding as N, type Observability as O, type PreviewsConfig as P, type CfStreamBinding as Q, type RawConfig as R, type StreamingTailConsumer as S, type TailConsumer as T, type UserLimits as U, type CfVersionMetadataBinding as V, type WorkerMetadataBinding as W, type CfDataBlobBindings as X, type CfDurableObject as Y, type ZoneIdRoute as Z, type CfWorkflow as _, type RedirectedRawConfig as a, type ComplianceConfig as a$, type CfR2Bucket as a0, type CfD1Database as a1, type CfVectorize as a2, type CfAISearchNamespace as a3, type CfAISearch as a4, type CfWebSearch as a5, type CfAgentMemory as a6, type CfSecretsStoreSecrets as a7, type CfArtifacts as a8, type CfHelloWorld as a9, type AssetConfigMetadata as aA, type AssetsOptions as aB, type ValidatedAssetsOptions as aC, type LegacyAssetPaths as aD, type WorkerMetadata as aE, type ServiceMetadataRes as aF, type ServiceFetch as aG, type File as aH, type BinaryFile as aI, type Trigger as aJ, type CfAccount as aK, type HookValues as aL, type Hook as aM, type AsyncHook as aN, type LogLevel as aO, type NodeJSCompatMode as aP, type StartDevWorkerInput as aQ, type Entry as aR, INHERIT_SYMBOL as aS, SERVICE_TAG_PREFIX as aT, ENVIRONMENT_TAG_PREFIX as aU, PATH_TO_DEPLOY_CONFIG as aV, JSON_CONFIG_FORMATS as aW, getC3CommandFromEnv as aX, getWranglerSendMetricsFromEnv as aY, getWranglerSendErrorReportsFromEnv as aZ, getCloudflareApiEnvironmentFromEnv as a_, type CfFlagship as aa, type CfWorkerLoader as ab, type CfRateLimit as ac, type CfHyperdrive as ad, type CfDevPluginCfg as ae, type CfService as af, type CfVpcService as ag, type CfVpcNetwork as ah, type CfAnalyticsEngineDataset as ai, type CfDispatchNamespace as aj, type CfMTlsCertificate as ak, type CfLogfwdr as al, type CfLogfwdrBinding as am, type CfAssetsBinding as an, type CfPipeline as ao, type CfUnsafeBinding as ap, type CfCapnp as aq, type CfUnsafe as ar, type CfDurableObjectMigrations as as, type CfPlacement as at, type CfTailConsumer as au, type CfUserLimits as av, type CfWorkerInit as aw, type CfWorkerContext as ax, type CfWorkerSourceMap as ay, type Json as az, type Config as b, COMPLIANCE_REGION_CONFIG_PUBLIC as b0, COMPLIANCE_REGION_CONFIG_UNKNOWN as b1, getCloudflareComplianceRegion as b2, getCloudflareApiBaseUrl as b3, getComplianceRegionSubdomain as b4, getSanitizeLogs as b5, getOutputFileDirectoryFromEnv as b6, getOutputFilePathFromEnv as b7, getCIMatchTag as b8, getCIOverrideName as b9, type FetchPagedListResultFetcher as bA, performApiFetchBase as bB, fetchInternalBase as bC, fetchResultBase as bD, fetchListResultBase as bE, truncate as bF, isWAFBlockResponse as bG, extractWAFBlockRayId as bH, extractAccountTag as bI, hasMorePages as bJ, renderError as bK, addAuthorizationHeader as bL, throwFetchError as bM, fetchKVGetValueBase as bN, type FetchKVGetValueFetcher as bO, hasCursor as bP, maybeAddTraceHeader as bQ, getCIOverrideNetworkModeHost as ba, getCIGeneratePreviewAlias as bb, getWorkersCIBranchName as bc, getBuildConditionsFromEnv as bd, getBuildPlatformFromEnv as be, getRegistryPath as bf, getD1ExtraLocationChoices as bg, getDockerPath as bh, getSubdomainMixedStateCheckDisabled as bi, getCloudflareLoadDevVarsFromDotEnv as bj, getCloudflareIncludeProcessEnvFromEnv as bk, getTraceHeader as bl, getDisableConfigWatching as bm, getWranglerHideBanner as bn, getCloudflareEnv as bo, getOpenNextDeployFromEnv as bp, getLocalExplorerEnabledFromEnv as bq, getBrowserRenderingHeadfulFromEnv as br, getCfFetchEnabledFromEnv as bs, getCfFetchPathFromEnv as bt, getWranglerCacheDirFromEnv as bu, getCloudflaredPathFromEnv as bv, type ApiCredentials as bw, type FetchResult as bx, type FetchResultFetcher as by, type FetchListResultFetcher as bz, type Route as c, type RawDevConfig as d, type ConfigFields as e, type RawEnvironment as f, defaultWranglerConfig as g, LOGGER_LEVELS as h, type LoggerLevel as i, type ZoneNameRoute as j, type CustomDomainRoute as k, type CloudchamberConfig as l, type ContainerApp as m, type DurableObjectBindings as n, type WorkflowBinding as o, type EnvironmentNonInheritable as p, type Rule as q, type ConfigModuleRuleType as r, type DispatchNamespaceOutbound as s, type CacheOptions as t, type DockerConfiguration as u, type ContainerEngine as v, type CfScriptFormat as w, type CfModuleType as x, type CfModule as y, type CfVars as z };