nitro 3.0.260429-beta → 3.0.260522-beta

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 (75) hide show
  1. package/dist/THIRD-PARTY-LICENSES.md.gz +0 -0
  2. package/dist/_build/common.mjs +119 -21
  3. package/dist/_build/rolldown.mjs +6 -6
  4. package/dist/_build/rollup.mjs +11 -11
  5. package/dist/_build/vite.build.mjs +3 -3
  6. package/dist/_build/vite.dev.mjs +149 -0
  7. package/dist/_build/vite.env.mjs +177 -0
  8. package/dist/_chunks/nitro.mjs +239 -12
  9. package/dist/_chunks/nitro2.mjs +117 -90
  10. package/dist/_chunks/utils.mjs +4 -4
  11. package/dist/_common.mjs +1 -1
  12. package/dist/_dev.d.mts +1 -1
  13. package/dist/_dev.mjs +5 -5
  14. package/dist/_libs/c12+rc9.mjs +11 -10
  15. package/dist/_libs/c12+readdirp+chokidar.d.mts +7 -8
  16. package/dist/_libs/citty.mjs +1 -1
  17. package/dist/_libs/common.d.mts +37 -0
  18. package/dist/_libs/commondir+is-reference.mjs +3 -3
  19. package/dist/_libs/compatx.d.mts +1 -1
  20. package/dist/_libs/compatx.mjs +1 -1
  21. package/dist/_libs/estree+pluginutils.d.mts +1 -1
  22. package/dist/_libs/estree-walker.mjs +1 -1
  23. package/dist/_libs/hasown+resolve+deepmerge.mjs +15 -15
  24. package/dist/_libs/httpxy.d.mts +1 -1
  25. package/dist/_libs/httpxy.mjs +8 -4
  26. package/dist/_libs/jsonc-parser+workers-utils.d.mts +1579 -0
  27. package/dist/_libs/klona.mjs +1 -1
  28. package/dist/_libs/magic-string.d.mts +1 -1
  29. package/dist/_libs/mlly.d.mts +1 -1
  30. package/dist/_libs/nypm+tinyexec.mjs +92 -99
  31. package/dist/_libs/openapi-types.d.mts +730 -0
  32. package/dist/_libs/perfect-debounce.mjs +1 -1
  33. package/dist/_libs/pkg-types.d.mts +1 -1
  34. package/dist/_libs/plugin-alias.mjs +2 -2
  35. package/dist/_libs/plugin-inject.mjs +3 -3
  36. package/dist/_libs/plugin-json.mjs +2 -2
  37. package/dist/_libs/pluginutils.mjs +16 -5
  38. package/dist/_libs/readdirp+chokidar.mjs +2 -2
  39. package/dist/_libs/remapping.mjs +2 -2
  40. package/dist/_libs/resolve-uri+gen-mapping.mjs +2 -5
  41. package/dist/_libs/rou3.d.mts +1 -1
  42. package/dist/_libs/rou3.mjs +1 -1
  43. package/dist/_libs/std-env.d.mts +1 -1
  44. package/dist/_libs/tsconfck.mjs +1 -1
  45. package/dist/_libs/ultrahtml.mjs +1 -1
  46. package/dist/_libs/{unimport+unplugin+oxc-parser.mjs → unimport+unplugin.mjs} +18 -8
  47. package/dist/_libs/unplugin+unimport.d.mts +3 -3
  48. package/dist/_libs/unwasm.d.mts +1 -1
  49. package/dist/_presets.mjs +117 -91
  50. package/dist/builder.d.mts +1 -1
  51. package/dist/builder.mjs +3 -3
  52. package/dist/cli/_chunks/build.mjs +3 -3
  53. package/dist/cli/_chunks/common.mjs +1 -1
  54. package/dist/cli/_chunks/deploy.mjs +2 -2
  55. package/dist/cli/_chunks/dev.mjs +4 -4
  56. package/dist/cli/_chunks/docs.mjs +1 -1
  57. package/dist/cli/_chunks/list.mjs +2 -2
  58. package/dist/cli/_chunks/prepare.mjs +3 -3
  59. package/dist/cli/_chunks/preview.mjs +4 -4
  60. package/dist/cli/_chunks/run.mjs +2 -2
  61. package/dist/cli/_chunks/task.mjs +1 -1
  62. package/dist/cli/index.mjs +1 -1
  63. package/dist/docs/1.deploy/2.providers/2.aws-amplify.md +3 -3
  64. package/dist/docs/1.deploy/2.providers/21.vercel.md +6 -0
  65. package/dist/docs/3.examples/27.vite-ssr-tsr-react.md +1 -1
  66. package/dist/presets/vercel/runtime/queue.dev.mjs +41 -0
  67. package/dist/runtime/internal/app.mjs +4 -111
  68. package/dist/runtime/virtual/app.d.mts +4 -0
  69. package/dist/runtime/virtual/app.mjs +32 -0
  70. package/dist/types/index.d.mts +21 -1756
  71. package/dist/vite.mjs +23 -337
  72. package/package.json +37 -39
  73. package/dist/THIRD-PARTY-LICENSES.md +0 -1676
  74. package/dist/_chunks/nitro3.mjs +0 -136
  75. package/dist/_chunks/nitro4.mjs +0 -127
@@ -0,0 +1,1579 @@
1
+ type Json = string | number | boolean | null | Json[] | {
2
+ [id: string]: Json;
3
+ };
4
+ /**
5
+ * The `Environment` interface declares all the configuration fields that
6
+ * can be specified for an environment.
7
+ *
8
+ * This could be the top-level default environment, or a specific named environment.
9
+ */
10
+ interface Environment extends EnvironmentInheritable, EnvironmentNonInheritable {}
11
+ type SimpleRoute = string;
12
+ type ZoneIdRoute = {
13
+ pattern: string;
14
+ zone_id: string;
15
+ custom_domain?: boolean;
16
+ };
17
+ type ZoneNameRoute = {
18
+ pattern: string;
19
+ zone_name: string;
20
+ custom_domain?: boolean;
21
+ };
22
+ type CustomDomainRoute = {
23
+ pattern: string;
24
+ custom_domain: boolean;
25
+ enabled?: boolean;
26
+ previews_enabled?: boolean;
27
+ };
28
+ type Route = SimpleRoute | ZoneIdRoute | ZoneNameRoute | CustomDomainRoute;
29
+ /**
30
+ * Configuration in wrangler for Cloudchamber
31
+ */
32
+ type CloudchamberConfig = {
33
+ image?: string;
34
+ location?: string;
35
+ instance_type?: "dev" | "basic" | "standard" | "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4";
36
+ vcpu?: number;
37
+ memory?: string;
38
+ ipv4?: boolean;
39
+ };
40
+ type UnsafeBinding = {
41
+ /**
42
+ * The name of the binding provided to the Worker
43
+ */
44
+ name: string;
45
+ /**
46
+ * The 'type' of the unsafe binding.
47
+ */
48
+ type: string;
49
+ dev?: {
50
+ plugin: {
51
+ /**
52
+ * Package is the bare specifier of the package that exposes plugins to integrate into Miniflare via a named `plugins` export.
53
+ * @example "@cloudflare/my-external-miniflare-plugin"
54
+ */
55
+ package: string;
56
+ /**
57
+ * Plugin is the name of the plugin exposed by the package.
58
+ * @example "MY_UNSAFE_PLUGIN"
59
+ */
60
+ name: string;
61
+ };
62
+ /**
63
+ * Optional mapping of unsafe bindings names to options provided for the plugin.
64
+ */
65
+ options?: Record<string, unknown>;
66
+ };
67
+ [key: string]: unknown;
68
+ };
69
+ /**
70
+ * Configuration for a container application
71
+ */
72
+ type ContainerApp = {
73
+ /**
74
+ * Name of the application
75
+ * @optional Defaults to `worker_name-class_name` if not specified.
76
+ */
77
+ name?: string;
78
+ /**
79
+ * Number of application instances
80
+ * @deprecated
81
+ * @hidden
82
+ */
83
+ instances?: number;
84
+ /**
85
+ * Number of maximum application instances.
86
+ * @optional
87
+ */
88
+ max_instances?: number;
89
+ /**
90
+ * The path to a Dockerfile, or an image URI for the Cloudflare registry.
91
+ */
92
+ image: string;
93
+ /**
94
+ * Build context of the application.
95
+ * @optional - defaults to the directory of `image`.
96
+ */
97
+ image_build_context?: string;
98
+ /**
99
+ * Image variables available to the image at build-time only.
100
+ * For runtime env vars, refer to https://developers.cloudflare.com/containers/examples/env-vars-and-secrets/
101
+ * @optional
102
+ */
103
+ image_vars?: Record<string, string>;
104
+ /**
105
+ * The class name of the Durable Object the container is connected to.
106
+ */
107
+ class_name: string;
108
+ /**
109
+ * The scheduling policy of the application
110
+ * @optional
111
+ * @default "default"
112
+ */
113
+ scheduling_policy?: "default" | "moon" | "regional";
114
+ /**
115
+ * The instance type to be used for the container.
116
+ * Select from one of the following named instance types:
117
+ * - lite: 1/16 vCPU, 256 MiB memory, and 2 GB disk
118
+ * - basic: 1/4 vCPU, 1 GiB memory, and 4 GB disk
119
+ * - standard-1: 1/2 vCPU, 4 GiB memory, and 8 GB disk
120
+ * - standard-2: 1 vCPU, 6 GiB memory, and 12 GB disk
121
+ * - standard-3: 2 vCPU, 8 GiB memory, and 16 GB disk
122
+ * - standard-4: 4 vCPU, 12 GiB memory, and 20 GB disk
123
+ * - dev: 1/16 vCPU, 256 MiB memory, and 2 GB disk (deprecated, use "lite" instead)
124
+ * - standard: 1 vCPU, 4 GiB memory, and 4 GB disk (deprecated, use "standard-1" instead)
125
+ *
126
+ * Customers on an enterprise plan have the additional option to set custom limits.
127
+ *
128
+ * @optional
129
+ * @default "dev"
130
+ */
131
+ instance_type?: "dev" | "basic" | "standard" | "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4" | {
132
+ /** @defaults to 0.0625 (1/16 vCPU) */vcpu?: number; /** @defaults to 256 MiB */
133
+ memory_mib?: number; /** @defaults to 2 GB */
134
+ disk_mb?: number;
135
+ };
136
+ ssh?: {
137
+ /**
138
+ * If enabled, those with write access to a container will be able to SSH into it through Wrangler.
139
+ * @default false
140
+ */
141
+ enabled: boolean;
142
+ /**
143
+ * Port that the SSH service is running on
144
+ * @defaults to 22
145
+ */
146
+ port?: number;
147
+ };
148
+ /**
149
+ * @deprecated Use `ssh` instead.
150
+ * @hidden
151
+ */
152
+ wrangler_ssh?: {
153
+ enabled: boolean;
154
+ port?: number;
155
+ };
156
+ /**
157
+ * SSH public keys to put in the container's authorized_keys file.
158
+ */
159
+ authorized_keys?: {
160
+ name: string;
161
+ public_key: string;
162
+ }[];
163
+ /**
164
+ * Trusted user CA keys to put in the container's trusted_user_ca_keys file.
165
+ */
166
+ trusted_user_ca_keys?: {
167
+ name?: string;
168
+ public_key: string;
169
+ }[];
170
+ /**
171
+ * @deprecated Use top level `containers` fields instead.
172
+ * `configuration.image` should be `image`
173
+ * limits should be set via `instance_type`
174
+ * @hidden
175
+ */
176
+ configuration?: {
177
+ image?: string;
178
+ labels?: {
179
+ name: string;
180
+ value: string;
181
+ }[];
182
+ secrets?: {
183
+ name: string;
184
+ type: "env";
185
+ secret: string;
186
+ }[];
187
+ disk?: {
188
+ size_mb: number;
189
+ };
190
+ vcpu?: number;
191
+ memory_mib?: number;
192
+ };
193
+ /**
194
+ * Scheduling constraints for container placement.
195
+ */
196
+ constraints?: {
197
+ /**
198
+ * Limit container placement to specific geographic regions.
199
+ */
200
+ regions?: ("ENAM" | "WNAM" | "EEUR" | "WEUR" | "APAC" | "SAM" | "ME" | "OC" | "AFR")[];
201
+ /**
202
+ * Restrict containers to compliance boundaries.
203
+ */
204
+ jurisdiction?: "eu" | "fedramp";
205
+ /**
206
+ * @hidden
207
+ */
208
+ cities?: string[];
209
+ /**
210
+ * @deprecated Use `tiers` instead
211
+ * @hidden
212
+ */
213
+ tier?: number;
214
+ /**
215
+ * @hidden
216
+ */
217
+ tiers?: number[];
218
+ };
219
+ /**
220
+ * Scheduling affinities
221
+ * @hidden
222
+ */
223
+ affinities?: {
224
+ colocation?: "datacenter";
225
+ hardware_generation?: "highest-overall-performance";
226
+ };
227
+ /**
228
+ * @deprecated use the `class_name` field instead.
229
+ * @hidden
230
+ */
231
+ durable_objects?: {
232
+ namespace_id: string;
233
+ };
234
+ /**
235
+ * Configures what percentage of instances should be updated at each step of a rollout.
236
+ * You can specify this as a single number, or an array of numbers.
237
+ *
238
+ * If this is a single number, each step will progress by that percentage.
239
+ * The options are 5, 10, 20, 25, 50 or 100.
240
+ *
241
+ * If this is an array, each step specifies the cumulative rollout progress.
242
+ * The final step must be 100.
243
+ *
244
+ * This can be overridden adhoc by deploying with the `--containers-rollout=immediate` flag,
245
+ * which will roll out to 100% of instances in one step.
246
+ *
247
+ * @optional
248
+ * @default [10,100]
249
+ * */
250
+ rollout_step_percentage?: number | number[];
251
+ /**
252
+ * How a rollout should be created. It supports the following modes:
253
+ * - full_auto: The container application will be rolled out fully automatically.
254
+ * - none: The container application won't have a roll out or update.
255
+ * - manual: The container application will be rollout fully by manually actioning progress steps.
256
+ * @optional
257
+ * @default "full_auto"
258
+ * @hidden
259
+ */
260
+ rollout_kind?: "full_auto" | "none" | "full_manual";
261
+ /**
262
+ * Configures the grace period (in seconds) for active instances before being shutdown during a rollout.
263
+ * @optional
264
+ * @default 0
265
+ */
266
+ rollout_active_grace_period?: number;
267
+ /**
268
+ * Directly passed to the API without wrangler-side validation or transformation.
269
+ * @hidden
270
+ */
271
+ unsafe?: Record<string, unknown>;
272
+ };
273
+ /**
274
+ * Configuration in wrangler for Durable Object Migrations
275
+ */
276
+ type DurableObjectMigration = {
277
+ /** A unique identifier for this migration. */tag: string; /** The new Durable Objects being defined. */
278
+ new_classes?: string[]; /** The new SQLite Durable Objects being defined. */
279
+ new_sqlite_classes?: string[]; /** The Durable Objects being renamed. */
280
+ renamed_classes?: {
281
+ from: string;
282
+ to: string;
283
+ }[]; /** The Durable Objects being removed. */
284
+ deleted_classes?: string[];
285
+ };
286
+ /**
287
+ * The `EnvironmentInheritable` interface declares all the configuration fields for an environment
288
+ * that can be inherited (and overridden) from the top-level environment.
289
+ */
290
+ interface EnvironmentInheritable {
291
+ /**
292
+ * The name of your Worker. Alphanumeric + dashes only.
293
+ *
294
+ * @inheritable
295
+ */
296
+ name: string | undefined;
297
+ /**
298
+ * This is the ID of the account associated with your zone.
299
+ * You might have more than one account, so make sure to use
300
+ * the ID of the account associated with the zone/route you
301
+ * provide, if you provide one. It can also be specified through
302
+ * the CLOUDFLARE_ACCOUNT_ID environment variable.
303
+ *
304
+ * @inheritable
305
+ */
306
+ account_id: string | undefined;
307
+ /**
308
+ * A date in the form yyyy-mm-dd, which will be used to determine
309
+ * which version of the Workers runtime is used.
310
+ *
311
+ * More details at https://developers.cloudflare.com/workers/configuration/compatibility-dates
312
+ *
313
+ * @inheritable
314
+ */
315
+ compatibility_date: string | undefined;
316
+ /**
317
+ * A list of flags that enable features from upcoming features of
318
+ * the Workers runtime, usually used together with compatibility_date.
319
+ *
320
+ * More details at https://developers.cloudflare.com/workers/configuration/compatibility-flags/
321
+ *
322
+ * @default []
323
+ * @inheritable
324
+ */
325
+ compatibility_flags: string[];
326
+ /**
327
+ * The entrypoint/path to the JavaScript file that will be executed.
328
+ *
329
+ * @inheritable
330
+ */
331
+ main: string | undefined;
332
+ /**
333
+ * If true then Wrangler will traverse the file tree below `base_dir`;
334
+ * Any files that match `rules` will be included in the deployed Worker.
335
+ * Defaults to true if `no_bundle` is true, otherwise false.
336
+ *
337
+ * @inheritable
338
+ */
339
+ find_additional_modules: boolean | undefined;
340
+ /**
341
+ * Determines whether Wrangler will preserve bundled file names.
342
+ * Defaults to false.
343
+ * If left unset, files will be named using the pattern ${fileHash}-${basename},
344
+ * for example, `34de60b44167af5c5a709e62a4e20c4f18c9e3b6-favicon.ico`.
345
+ *
346
+ * @inheritable
347
+ */
348
+ preserve_file_names: boolean | undefined;
349
+ /**
350
+ * The directory in which module rules should be evaluated when including additional files into a Worker deployment.
351
+ * This defaults to the directory containing the `main` entry point of the Worker if not specified.
352
+ *
353
+ * @inheritable
354
+ */
355
+ base_dir: string | undefined;
356
+ /**
357
+ * Whether we use <name>.<subdomain>.workers.dev to
358
+ * test and deploy your Worker.
359
+ *
360
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#workersdev
361
+ *
362
+ * @default true
363
+ * @breaking
364
+ * @inheritable
365
+ */
366
+ workers_dev: boolean | undefined;
367
+ /**
368
+ * Whether we use <version>-<name>.<subdomain>.workers.dev to
369
+ * serve Preview URLs for your Worker.
370
+ *
371
+ * @default false
372
+ * @inheritable
373
+ */
374
+ preview_urls: boolean | undefined;
375
+ /**
376
+ * A list of routes that your Worker should be published to.
377
+ * Only one of `routes` or `route` is required.
378
+ *
379
+ * Only required when workers_dev is false, and there's no scheduled Worker (see `triggers`)
380
+ *
381
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#types-of-routes
382
+ *
383
+ * @inheritable
384
+ */
385
+ routes: Route[] | undefined;
386
+ /**
387
+ * A route that your Worker should be published to. Literally
388
+ * the same as routes, but only one.
389
+ * Only one of `routes` or `route` is required.
390
+ *
391
+ * Only required when workers_dev is false, and there's no scheduled Worker
392
+ *
393
+ * @inheritable
394
+ */
395
+ route: Route | undefined;
396
+ /**
397
+ * Path to a custom tsconfig
398
+ *
399
+ * @inheritable
400
+ */
401
+ tsconfig: string | undefined;
402
+ /**
403
+ * The function to use to replace jsx syntax.
404
+ *
405
+ * @default "React.createElement"
406
+ * @inheritable
407
+ */
408
+ jsx_factory: string;
409
+ /**
410
+ * The function to use to replace jsx fragment syntax.
411
+ *
412
+ * @default "React.Fragment"
413
+ * @inheritable
414
+ */
415
+ jsx_fragment: string;
416
+ /**
417
+ * A list of migrations that should be uploaded with your Worker.
418
+ *
419
+ * These define changes in your Durable Object declarations.
420
+ *
421
+ * More details at https://developers.cloudflare.com/workers/learning/using-durable-objects#configuring-durable-object-classes-with-migrations
422
+ *
423
+ * @default []
424
+ * @inheritable
425
+ */
426
+ migrations: DurableObjectMigration[];
427
+ /**
428
+ * "Cron" definitions to trigger a Worker's "scheduled" function.
429
+ *
430
+ * Lets you call Workers periodically, much like a cron job.
431
+ *
432
+ * More details here https://developers.cloudflare.com/workers/platform/cron-triggers
433
+ *
434
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers
435
+ *
436
+ * @default {crons:[]}
437
+ * @inheritable
438
+ */
439
+ triggers: {
440
+ crons: string[] | undefined;
441
+ };
442
+ /**
443
+ * Specify limits for runtime behavior.
444
+ * Only supported for the "standard" Usage Model
445
+ *
446
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#limits
447
+ *
448
+ * @inheritable
449
+ */
450
+ limits: UserLimits | undefined;
451
+ /**
452
+ * An ordered list of rules that define which modules to import,
453
+ * and what type to import them as. You will need to specify rules
454
+ * to use Text, Data, and CompiledWasm modules, or when you wish to
455
+ * have a .js file be treated as an ESModule instead of CommonJS.
456
+ *
457
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#bundling
458
+ *
459
+ * @inheritable
460
+ */
461
+ rules: Rule[];
462
+ /**
463
+ * Configures a custom build step to be run by Wrangler when building your Worker.
464
+ *
465
+ * Refer to the [custom builds documentation](https://developers.cloudflare.com/workers/cli-wrangler/configuration#build)
466
+ * for more details.
467
+ *
468
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#custom-builds
469
+ *
470
+ * @default {watch_dir:"./src"}
471
+ */
472
+ build: {
473
+ /** The command used to build your Worker. On Linux and macOS, the command is executed in the `sh` shell and the `cmd` shell for Windows. The `&&` and `||` shell operators may be used. */command?: string; /** The directory in which the command is executed. */
474
+ cwd?: string; /** The directory to watch for changes while using wrangler dev, defaults to the current working directory */
475
+ watch_dir?: string | string[];
476
+ };
477
+ /**
478
+ * Skip internal build steps and directly deploy script
479
+ * @inheritable
480
+ */
481
+ no_bundle: boolean | undefined;
482
+ /**
483
+ * Minify the script before uploading.
484
+ * @inheritable
485
+ */
486
+ minify: boolean | undefined;
487
+ /**
488
+ * Set the `name` property to the original name for functions and classes renamed during minification.
489
+ *
490
+ * See https://esbuild.github.io/api/#keep-names
491
+ *
492
+ * @default true
493
+ * @inheritable
494
+ */
495
+ keep_names: boolean | undefined;
496
+ /**
497
+ * Designates this Worker as an internal-only "first-party" Worker.
498
+ *
499
+ * @inheritable
500
+ */
501
+ first_party_worker: boolean | undefined;
502
+ /**
503
+ * List of bindings that you will send to logfwdr
504
+ *
505
+ * @default {bindings:[]}
506
+ * @inheritable
507
+ */
508
+ logfwdr: {
509
+ bindings: {
510
+ /** The binding name used to refer to logfwdr */name: string; /** The destination for this logged message */
511
+ destination: string;
512
+ }[];
513
+ };
514
+ /**
515
+ * Send Trace Events from this Worker to Workers Logpush.
516
+ *
517
+ * This will not configure a corresponding Logpush job automatically.
518
+ *
519
+ * For more information about Workers Logpush, see:
520
+ * https://blog.cloudflare.com/logpush-for-workers/
521
+ *
522
+ * @inheritable
523
+ */
524
+ logpush: boolean | undefined;
525
+ /**
526
+ * Include source maps when uploading this worker.
527
+ *
528
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#source-maps
529
+ *
530
+ * @inheritable
531
+ */
532
+ upload_source_maps: boolean | undefined;
533
+ /**
534
+ * Specify how the Worker should be located to minimize round-trip time.
535
+ *
536
+ * More details: https://developers.cloudflare.com/workers/platform/smart-placement/
537
+ *
538
+ * @inheritable
539
+ */
540
+ placement: {
541
+ mode: "off" | "smart";
542
+ hint?: string;
543
+ } | {
544
+ mode?: "targeted";
545
+ region: string;
546
+ } | {
547
+ mode?: "targeted";
548
+ host: string;
549
+ } | {
550
+ mode?: "targeted";
551
+ hostname: string;
552
+ } | undefined;
553
+ /**
554
+ * Specify the directory of static assets to deploy/serve
555
+ *
556
+ * More details at https://developers.cloudflare.com/workers/frameworks/
557
+ *
558
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#assets
559
+ *
560
+ * @inheritable
561
+ */
562
+ assets: Assets | undefined;
563
+ /**
564
+ * Specify the observability behavior of the Worker.
565
+ *
566
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#observability
567
+ *
568
+ * @inheritable
569
+ */
570
+ observability: Observability | undefined;
571
+ /**
572
+ * Specify the cache behavior of the Worker.
573
+ *
574
+ * @inheritable
575
+ */
576
+ cache: CacheOptions | undefined;
577
+ /**
578
+ * Specify the compliance region mode of the Worker.
579
+ *
580
+ * Although if the user does not specify a compliance region, the default is `public`,
581
+ * it can be set to `undefined` in configuration to delegate to the CLOUDFLARE_COMPLIANCE_REGION environment variable.
582
+ */
583
+ compliance_region: "public" | "fedramp_high" | undefined;
584
+ /**
585
+ * Configuration for Python modules.
586
+ *
587
+ * @inheritable
588
+ */
589
+ python_modules: {
590
+ /**
591
+ * A list of glob patterns to exclude files from the python_modules directory when bundling.
592
+ *
593
+ * Patterns are relative to the python_modules directory and use glob syntax.
594
+ *
595
+ * @default ["**\*.pyc"]
596
+ */
597
+ exclude: string[];
598
+ };
599
+ /**
600
+ * Configuration for Worker Previews.
601
+ *
602
+ * Previews are branches of your Worker's main instance used to test features
603
+ * in development outside of production. This block defines the settings
604
+ * used when creating Preview deployments via `wrangler preview`.
605
+ *
606
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#previews
607
+ *
608
+ * @inheritable
609
+ */
610
+ previews: PreviewsConfig | undefined;
611
+ }
612
+ type DurableObjectBindings = {
613
+ /** The name of the binding used to refer to the Durable Object */name: string; /** The exported class name of the Durable Object */
614
+ class_name: string; /** The script where the Durable Object is defined (if it's external to this Worker) */
615
+ script_name?: string; /** The service environment of the script_name to bind to */
616
+ environment?: string;
617
+ }[];
618
+ type WorkflowBinding = {
619
+ /** The name of the binding used to refer to the Workflow */binding: string; /** The name of the Workflow */
620
+ name: string; /** The exported class name of the Workflow */
621
+ class_name: string; /** The script where the Workflow is defined (if it's external to this Worker) */
622
+ script_name?: string; /** Whether the Workflow should be remote or not in local development */
623
+ remote?: boolean; /** Optional limits for the Workflow */
624
+ limits?: {
625
+ /** Maximum number of steps a Workflow instance can execute */steps?: number;
626
+ };
627
+ };
628
+ /**
629
+ * The `EnvironmentNonInheritable` interface declares all the configuration fields for an environment
630
+ * that cannot be inherited from the top-level environment, and must be defined specifically.
631
+ *
632
+ * If any of these fields are defined at the top-level then they should also be specifically defined
633
+ * for each named environment.
634
+ */
635
+ interface EnvironmentNonInheritable {
636
+ /**
637
+ * A map of values to substitute when deploying your Worker.
638
+ *
639
+ * NOTE: This field is not automatically inherited from the top level environment,
640
+ * and so must be specified in every named environment.
641
+ *
642
+ * @default {}
643
+ * @nonInheritable
644
+ */
645
+ define: Record<string, string>;
646
+ /**
647
+ * A map of environment variables to set when deploying your Worker.
648
+ *
649
+ * NOTE: This field is not automatically inherited from the top level environment,
650
+ * and so must be specified in every named environment.
651
+ *
652
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
653
+ *
654
+ * @default {}
655
+ * @nonInheritable
656
+ */
657
+ vars: Record<string, string | Json>;
658
+ /**
659
+ * Secrets configuration.
660
+ *
661
+ * NOTE: This field is not automatically inherited from the top level environment,
662
+ * and so must be specified in every named environment.
663
+ *
664
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#secrets-configuration-property
665
+ *
666
+ * @nonInheritable
667
+ */
668
+ secrets?: {
669
+ /**
670
+ * List of secret names that are required by your Worker.
671
+ * When defined, this property:
672
+ * - Replaces .dev.vars/.env/process.env inference for type generation
673
+ * - Enables local dev validation with warnings for missing secrets
674
+ */
675
+ required?: string[];
676
+ };
677
+ /**
678
+ * A list of durable objects that your Worker should be bound to.
679
+ *
680
+ * For more information about Durable Objects, see the documentation at
681
+ * https://developers.cloudflare.com/workers/learning/using-durable-objects
682
+ *
683
+ * NOTE: This field is not automatically inherited from the top level environment,
684
+ * and so must be specified in every named environment.
685
+ *
686
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
687
+ *
688
+ * @default {bindings:[]}
689
+ * @nonInheritable
690
+ */
691
+ durable_objects: {
692
+ bindings: DurableObjectBindings;
693
+ };
694
+ /**
695
+ * A list of workflows that your Worker should be bound to.
696
+ *
697
+ * NOTE: This field is not automatically inherited from the top level environment,
698
+ * and so must be specified in every named environment.
699
+ *
700
+ * @default []
701
+ * @nonInheritable
702
+ */
703
+ workflows: WorkflowBinding[];
704
+ /**
705
+ * Cloudchamber configuration
706
+ *
707
+ * NOTE: This field is not automatically inherited from the top level environment,
708
+ * and so must be specified in every named environment.
709
+ *
710
+ * @default {}
711
+ * @nonInheritable
712
+ */
713
+ cloudchamber: CloudchamberConfig;
714
+ /**
715
+ * Container related configuration
716
+ *
717
+ * NOTE: This field is not automatically inherited from the top level environment,
718
+ * and so must be specified in every named environment.
719
+ *
720
+ * @default []
721
+ * @nonInheritable
722
+ */
723
+ containers?: ContainerApp[];
724
+ /**
725
+ * These specify any Workers KV Namespaces you want to
726
+ * access from inside your Worker.
727
+ *
728
+ * To learn more about KV Namespaces,
729
+ * see the documentation at https://developers.cloudflare.com/workers/learning/how-kv-works
730
+ *
731
+ * NOTE: This field is not automatically inherited from the top level environment,
732
+ * and so must be specified in every named environment.
733
+ *
734
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#kv-namespaces
735
+ *
736
+ * @default []
737
+ * @nonInheritable
738
+ */
739
+ kv_namespaces: {
740
+ /** The binding name used to refer to the KV Namespace */binding: string; /** The ID of the KV namespace */
741
+ id?: string; /** The ID of the KV namespace used during `wrangler dev` */
742
+ preview_id?: string; /** Whether the KV namespace should be remote or not in local development */
743
+ remote?: boolean;
744
+ }[];
745
+ /**
746
+ * These specify bindings to send email from inside your Worker.
747
+ *
748
+ * NOTE: This field is not automatically inherited from the top level environment,
749
+ * and so must be specified in every named environment.
750
+ *
751
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#email-bindings
752
+ *
753
+ * @default []
754
+ * @nonInheritable
755
+ */
756
+ send_email: {
757
+ /** The binding name used to refer to the this binding */name: string; /** If this binding should be restricted to a specific verified address */
758
+ destination_address?: string; /** If this binding should be restricted to a set of verified addresses */
759
+ allowed_destination_addresses?: string[]; /** If this binding should be restricted to a set of sender addresses */
760
+ allowed_sender_addresses?: string[]; /** Whether the binding should be remote or not in local development */
761
+ remote?: boolean;
762
+ }[];
763
+ /**
764
+ * Specifies Queues that are bound to this Worker environment.
765
+ *
766
+ * NOTE: This field is not automatically inherited from the top level environment,
767
+ * and so must be specified in every named environment.
768
+ *
769
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#queues
770
+ *
771
+ * @default {consumers:[],producers:[]}
772
+ * @nonInheritable
773
+ */
774
+ queues: {
775
+ /** Producer bindings */producers?: {
776
+ /** The binding name used to refer to the Queue in the Worker. */binding: string; /** The name of this Queue. */
777
+ queue: string; /** The number of seconds to wait before delivering a message */
778
+ delivery_delay?: number; /** Whether the Queue producer should be remote or not in local development */
779
+ remote?: boolean;
780
+ }[]; /** Consumer configuration */
781
+ consumers?: {
782
+ /** The name of the queue from which this consumer should consume. */queue: string; /** The consumer type. Only "worker" is supported in wrangler config. Default is "worker". */
783
+ type?: "worker"; /** The maximum number of messages per batch */
784
+ max_batch_size?: number; /** The maximum number of seconds to wait to fill a batch with messages. */
785
+ max_batch_timeout?: number; /** The maximum number of retries for each message. */
786
+ max_retries?: number; /** The queue to send messages that failed to be consumed. */
787
+ dead_letter_queue?: string; /** The maximum number of concurrent consumer Worker invocations. Leaving this unset will allow your consumer to scale to the maximum concurrency needed to keep up with the message backlog. */
788
+ max_concurrency?: number | null; /** The number of milliseconds to wait for pulled messages to become visible again */
789
+ visibility_timeout_ms?: number; /** The number of seconds to wait before retrying a message */
790
+ retry_delay?: number;
791
+ }[];
792
+ };
793
+ /**
794
+ * Specifies R2 buckets that are bound to this Worker environment.
795
+ *
796
+ * NOTE: This field is not automatically inherited from the top level environment,
797
+ * and so must be specified in every named environment.
798
+ *
799
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#r2-buckets
800
+ *
801
+ * @default []
802
+ * @nonInheritable
803
+ */
804
+ r2_buckets: {
805
+ /** The binding name used to refer to the R2 bucket in the Worker. */binding: string; /** The name of this R2 bucket at the edge. */
806
+ bucket_name?: string; /** The preview name of this R2 bucket at the edge. */
807
+ preview_bucket_name?: string; /** The jurisdiction that the bucket exists in. Default if not present. */
808
+ jurisdiction?: string; /** Whether the R2 bucket should be remote or not in local development */
809
+ remote?: boolean;
810
+ }[];
811
+ /**
812
+ * Specifies D1 databases that are bound to this Worker environment.
813
+ *
814
+ * NOTE: This field is not automatically inherited from the top level environment,
815
+ * and so must be specified in every named environment.
816
+ *
817
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#d1-databases
818
+ *
819
+ * @default []
820
+ * @nonInheritable
821
+ */
822
+ d1_databases: {
823
+ /** The binding name used to refer to the D1 database in the Worker. */binding: string; /** The name of this D1 database. */
824
+ database_name?: string; /** The UUID of this D1 database (not required). */
825
+ database_id?: string; /** The UUID of this D1 database for Wrangler Dev (if specified). */
826
+ preview_database_id?: string; /** The name of the migrations table for this D1 database (defaults to 'd1_migrations'). */
827
+ migrations_table?: string; /** The path to the directory of migrations for this D1 database (defaults to './migrations'). */
828
+ migrations_dir?: string; /** Internal use only. */
829
+ database_internal_env?: string; /** Whether the D1 database should be remote or not in local development */
830
+ remote?: boolean;
831
+ }[];
832
+ /**
833
+ * Specifies Vectorize indexes that are bound to this Worker environment.
834
+ *
835
+ * NOTE: This field is not automatically inherited from the top level environment,
836
+ * and so must be specified in every named environment.
837
+ *
838
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#vectorize-indexes
839
+ *
840
+ * @default []
841
+ * @nonInheritable
842
+ */
843
+ vectorize: {
844
+ /** The binding name used to refer to the Vectorize index in the Worker. */binding: string; /** The name of the index. */
845
+ index_name: string; /** Whether the Vectorize index should be remote or not in local development */
846
+ remote?: boolean;
847
+ }[];
848
+ /**
849
+ * Specifies AI Search namespace bindings that are bound to this Worker environment.
850
+ * Each binding is scoped to a namespace and allows dynamic instance CRUD within it.
851
+ *
852
+ * NOTE: This field is not automatically inherited from the top level environment,
853
+ * and so must be specified in every named environment.
854
+ *
855
+ * @default []
856
+ * @nonInheritable
857
+ */
858
+ ai_search_namespaces: {
859
+ /** The binding name used to refer to the AI Search namespace in the Worker. */binding: string; /** The user-chosen namespace name. Must exist in Cloudflare at deploy time. */
860
+ namespace: string; /** Whether the AI Search namespace binding should be remote in local development */
861
+ remote?: boolean;
862
+ }[];
863
+ /**
864
+ * Specifies AI Search instance bindings that are bound to this Worker environment.
865
+ * Each binding is bound directly to a single pre-existing instance within the "default" namespace.
866
+ *
867
+ * NOTE: This field is not automatically inherited from the top level environment,
868
+ * and so must be specified in every named environment.
869
+ *
870
+ * @default []
871
+ * @nonInheritable
872
+ */
873
+ ai_search: {
874
+ /** The binding name used to refer to the AI Search instance in the Worker. */binding: string; /** The user-chosen instance name. Must exist in Cloudflare at deploy time. */
875
+ instance_name: string; /** Whether the AI Search instance binding should be remote in local development */
876
+ remote?: boolean;
877
+ }[];
878
+ /**
879
+ * Specifies Hyperdrive configs that are bound to this Worker environment.
880
+ *
881
+ * NOTE: This field is not automatically inherited from the top level environment,
882
+ * and so must be specified in every named environment.
883
+ *
884
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#hyperdrive
885
+ *
886
+ * @default []
887
+ * @nonInheritable
888
+ */
889
+ hyperdrive: {
890
+ /** The binding name used to refer to the project in the Worker. */binding: string; /** The id of the database. */
891
+ id: string; /** The local database connection string for `wrangler dev` */
892
+ localConnectionString?: string;
893
+ }[];
894
+ /**
895
+ * Specifies service bindings (Worker-to-Worker) that are bound to this Worker environment.
896
+ *
897
+ * NOTE: This field is not automatically inherited from the top level environment,
898
+ * and so must be specified in every named environment.
899
+ *
900
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings
901
+ *
902
+ * @default []
903
+ * @nonInheritable
904
+ */
905
+ services: {
906
+ /** The binding name used to refer to the bound service. */binding: string;
907
+ /**
908
+ * The name of the service.
909
+ * To bind to a worker in a specific environment,
910
+ * you should use the format `<worker_name>-<environment_name>`.
911
+ */
912
+ service: string;
913
+ /**
914
+ * @hidden
915
+ * @deprecated you should use `service: <worker_name>-<environment_name>` instead.
916
+ * This refers to the deprecated concept of 'service environments'.
917
+ * The environment of the service (e.g. production, staging, etc).
918
+ */
919
+ environment?: string; /** Optionally, the entrypoint (named export) of the service to bind to. */
920
+ entrypoint?: string; /** Optional properties that will be made available to the service via ctx.props. */
921
+ props?: Record<string, unknown>; /** Whether the service binding should be remote or not in local development */
922
+ remote?: boolean;
923
+ }[] | undefined;
924
+ /**
925
+ * Specifies analytics engine datasets that are bound to this Worker environment.
926
+ *
927
+ * NOTE: This field is not automatically inherited from the top level environment,
928
+ * and so must be specified in every named environment.
929
+ *
930
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#analytics-engine-datasets
931
+ *
932
+ * @default []
933
+ * @nonInheritable
934
+ */
935
+ analytics_engine_datasets: {
936
+ /** The binding name used to refer to the dataset in the Worker. */binding: string; /** The name of this dataset to write to. */
937
+ dataset?: string;
938
+ }[];
939
+ /**
940
+ * A browser that will be usable from the Worker.
941
+ *
942
+ * NOTE: This field is not automatically inherited from the top level environment,
943
+ * and so must be specified in every named environment.
944
+ *
945
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#browser-rendering
946
+ *
947
+ * @default {}
948
+ * @nonInheritable
949
+ */
950
+ browser: {
951
+ binding: string; /** Whether the Browser binding should be remote or not in local development */
952
+ remote?: boolean;
953
+ } | undefined;
954
+ /**
955
+ * Binding to the AI project.
956
+ *
957
+ * NOTE: This field is not automatically inherited from the top level environment,
958
+ * and so must be specified in every named environment.
959
+ *
960
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#workers-ai
961
+ *
962
+ * @default {}
963
+ * @nonInheritable
964
+ */
965
+ ai: {
966
+ binding: string;
967
+ staging?: boolean; /** Whether the AI binding should be remote or not in local development */
968
+ remote?: boolean;
969
+ } | undefined;
970
+ /**
971
+ * Binding to Cloudflare Images
972
+ *
973
+ * NOTE: This field is not automatically inherited from the top level environment,
974
+ * and so must be specified in every named environment.
975
+ *
976
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#images
977
+ *
978
+ * @default {}
979
+ * @nonInheritable
980
+ */
981
+ images: {
982
+ binding: string; /** Whether the Images binding should be remote or not in local development */
983
+ remote?: boolean;
984
+ } | undefined;
985
+ /**
986
+ * Binding to Cloudflare Media Transformations
987
+ *
988
+ * NOTE: This field is not automatically inherited from the top level environment,
989
+ * and so must be specified in every named environment.
990
+ *
991
+ * @default {}
992
+ * @nonInheritable
993
+ */
994
+ media: {
995
+ binding: string; /** Whether the Media binding should be remote or not */
996
+ remote?: boolean;
997
+ } | undefined;
998
+ /**
999
+ * Binding to Cloudflare Stream
1000
+ *
1001
+ * NOTE: This field is not automatically inherited from the top level environment,
1002
+ * and so must be specified in every named environment.
1003
+ *
1004
+ * @default {}
1005
+ * @nonInheritable
1006
+ */
1007
+ stream: {
1008
+ binding: string; /** Whether the Stream binding should be remote or not in local development */
1009
+ remote?: boolean;
1010
+ } | undefined;
1011
+ /**
1012
+ * Binding to the Worker Version's metadata
1013
+ */
1014
+ version_metadata: {
1015
+ binding: string;
1016
+ } | undefined;
1017
+ /**
1018
+ * "Unsafe" tables for features that aren't directly supported by wrangler.
1019
+ *
1020
+ * NOTE: This field is not automatically inherited from the top level environment,
1021
+ * and so must be specified in every named environment.
1022
+ *
1023
+ * @default {}
1024
+ * @nonInheritable
1025
+ */
1026
+ unsafe: {
1027
+ /**
1028
+ * A set of bindings that should be put into a Worker's upload metadata without changes. These
1029
+ * can be used to implement bindings for features that haven't released and aren't supported
1030
+ * directly by wrangler or miniflare.
1031
+ */
1032
+ bindings?: UnsafeBinding[];
1033
+ /**
1034
+ * Arbitrary key/value pairs that will be included in the uploaded metadata. Values specified
1035
+ * here will always be applied to metadata last, so can add new or override existing fields.
1036
+ */
1037
+ metadata?: {
1038
+ [key: string]: unknown;
1039
+ };
1040
+ /**
1041
+ * Used for internal capnp uploads for the Workers runtime
1042
+ */
1043
+ capnp?: {
1044
+ base_path: string;
1045
+ source_schemas: string[];
1046
+ compiled_schema?: never;
1047
+ } | {
1048
+ base_path?: never;
1049
+ source_schemas?: never;
1050
+ compiled_schema: string;
1051
+ };
1052
+ };
1053
+ /**
1054
+ * Specifies a list of mTLS certificates that are bound to this Worker environment.
1055
+ *
1056
+ * NOTE: This field is not automatically inherited from the top level environment,
1057
+ * and so must be specified in every named environment.
1058
+ *
1059
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#mtls-certificates
1060
+ *
1061
+ * @default []
1062
+ * @nonInheritable
1063
+ */
1064
+ mtls_certificates: {
1065
+ /** The binding name used to refer to the certificate in the Worker */binding: string; /** The uuid of the uploaded mTLS certificate */
1066
+ certificate_id: string; /** Whether the mtls fetcher should be remote or not in local development */
1067
+ remote?: boolean;
1068
+ }[];
1069
+ /**
1070
+ * Specifies a list of Tail Workers that are bound to this Worker environment
1071
+ *
1072
+ * NOTE: This field is not automatically inherited from the top level environment,
1073
+ * and so must be specified in every named environment.
1074
+ *
1075
+ * @default []
1076
+ * @nonInheritable
1077
+ */
1078
+ tail_consumers?: TailConsumer[];
1079
+ /**
1080
+ * Specifies a list of Streaming Tail Workers that are bound to this Worker environment
1081
+ *
1082
+ * NOTE: This field is not automatically inherited from the top level environment,
1083
+ * and so must be specified in every named environment.
1084
+ *
1085
+ * @default []
1086
+ * @nonInheritable
1087
+ */
1088
+ streaming_tail_consumers?: StreamingTailConsumer[];
1089
+ /**
1090
+ * Specifies namespace bindings that are bound to this Worker environment.
1091
+ *
1092
+ * NOTE: This field is not automatically inherited from the top level environment,
1093
+ * and so must be specified in every named environment.
1094
+ *
1095
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#dispatch-namespace-bindings-workers-for-platforms
1096
+ *
1097
+ * @default []
1098
+ * @nonInheritable
1099
+ */
1100
+ dispatch_namespaces: {
1101
+ /** The binding name used to refer to the bound service. */binding: string; /** The namespace to bind to. */
1102
+ namespace: string; /** Details about the outbound Worker which will handle outbound requests from your namespace */
1103
+ outbound?: DispatchNamespaceOutbound; /** Whether the Dispatch Namespace should be remote or not in local development */
1104
+ remote?: boolean;
1105
+ }[];
1106
+ /**
1107
+ * Specifies list of Pipelines bound to this Worker environment
1108
+ *
1109
+ * NOTE: This field is not automatically inherited from the top level environment,
1110
+ * and so must be specified in every named environment.
1111
+ *
1112
+ * @default []
1113
+ * @nonInheritable
1114
+ */
1115
+ pipelines: {
1116
+ /** The binding name used to refer to the bound service. */binding: string; /** Name of the Pipeline to bind */
1117
+ pipeline: string; /** Whether the pipeline should be remote or not in local development */
1118
+ remote?: boolean;
1119
+ }[];
1120
+ /**
1121
+ * Specifies Secret Store bindings that are bound to this Worker environment.
1122
+ *
1123
+ * NOTE: This field is not automatically inherited from the top level environment,
1124
+ * and so must be specified in every named environment.
1125
+ *
1126
+ * @default []
1127
+ * @nonInheritable
1128
+ */
1129
+ secrets_store_secrets: {
1130
+ /** The binding name used to refer to the bound service. */binding: string; /** Id of the secret store */
1131
+ store_id: string; /** Name of the secret */
1132
+ secret_name: string;
1133
+ }[];
1134
+ /**
1135
+ * Specifies Artifacts bindings that are bound to this Worker environment.
1136
+ * Artifacts provides git-compatible file storage on Cloudflare Workers.
1137
+ *
1138
+ * NOTE: This field is not automatically inherited from the top level environment,
1139
+ * and so must be specified in every named environment.
1140
+ *
1141
+ * @default []
1142
+ * @nonInheritable
1143
+ */
1144
+ artifacts: {
1145
+ /** The binding name used to refer to the Artifacts instance. */binding: string; /** The namespace to use. */
1146
+ namespace: string; /** Whether to use the remote Artifacts service in local dev. */
1147
+ remote?: boolean;
1148
+ }[];
1149
+ /**
1150
+ * **DO NOT USE**. Hello World Binding Config to serve as an explanatory example.
1151
+ *
1152
+ * NOTE: This field is not automatically inherited from the top level environment,
1153
+ * and so must be specified in every named environment.
1154
+ *
1155
+ * @default []
1156
+ * @nonInheritable
1157
+ */
1158
+ unsafe_hello_world: {
1159
+ /** The binding name used to refer to the bound service. */binding: string; /** Whether the timer is enabled */
1160
+ enable_timer?: boolean;
1161
+ }[];
1162
+ /**
1163
+ * Specifies Flagship feature flag bindings that are bound to this Worker environment.
1164
+ *
1165
+ * NOTE: This field is not automatically inherited from the top level environment,
1166
+ * and so must be specified in every named environment.
1167
+ *
1168
+ * @default []
1169
+ * @nonInheritable
1170
+ */
1171
+ flagship: {
1172
+ /** The binding name used to refer to the bound Flagship service. */binding: string; /** The Flagship app ID to bind to. */
1173
+ app_id: string; /** Set to `true` to suppress the remote binding warning in local dev. Flagship bindings are always remote. */
1174
+ remote?: boolean;
1175
+ }[];
1176
+ /**
1177
+ * Specifies rate limit bindings that are bound to this Worker environment.
1178
+ *
1179
+ * NOTE: This field is not automatically inherited from the top level environment,
1180
+ * and so must be specified in every named environment.
1181
+ *
1182
+ * @default []
1183
+ * @nonInheritable
1184
+ */
1185
+ ratelimits: {
1186
+ /** The binding name used to refer to the rate limiter in the Worker. */name: string; /** The namespace ID for this rate limiter. */
1187
+ namespace_id: string; /** Simple rate limiting configuration. */
1188
+ simple: {
1189
+ /** The maximum number of requests allowed in the time period. */limit: number; /** The time period in seconds (10 for ten seconds, 60 for one minute). */
1190
+ period: 10 | 60;
1191
+ };
1192
+ }[];
1193
+ /**
1194
+ * Specifies Worker Loader bindings that are bound to this Worker environment.
1195
+ *
1196
+ * NOTE: This field is not automatically inherited from the top level environment,
1197
+ * and so must be specified in every named environment.
1198
+ *
1199
+ * @default []
1200
+ * @nonInheritable
1201
+ */
1202
+ worker_loaders: {
1203
+ /** The binding name used to refer to the Worker Loader in the Worker. */binding: string;
1204
+ }[];
1205
+ /**
1206
+ * Specifies VPC services that are bound to this Worker environment.
1207
+ *
1208
+ * NOTE: This field is not automatically inherited from the top level environment,
1209
+ * and so must be specified in every named environment.
1210
+ *
1211
+ * @default []
1212
+ * @nonInheritable
1213
+ */
1214
+ vpc_services: {
1215
+ /** The binding name used to refer to the VPC service in the Worker. */binding: string; /** The service ID of the VPC connectivity service. */
1216
+ service_id: string; /** Whether the VPC service is remote or not */
1217
+ remote?: boolean;
1218
+ }[];
1219
+ /**
1220
+ * Specifies VPC networks that are bound to this Worker environment.
1221
+ *
1222
+ * NOTE: This field is not automatically inherited from the top level environment,
1223
+ * and so must be specified in every named environment.
1224
+ *
1225
+ * @default []
1226
+ * @nonInheritable
1227
+ */
1228
+ vpc_networks: ({
1229
+ /** The binding name used to refer to the VPC network in the Worker. */binding: string; /** The tunnel ID of the Cloudflare Tunnel to route traffic through. Mutually exclusive with network_id. */
1230
+ tunnel_id: string; /** Whether the VPC network is remote or not */
1231
+ remote?: boolean;
1232
+ } | {
1233
+ /** The binding name used to refer to the VPC network in the Worker. */binding: string; /** The network ID to route traffic through. Mutually exclusive with tunnel_id. */
1234
+ network_id: string; /** Whether the VPC network is remote or not */
1235
+ remote?: boolean;
1236
+ })[];
1237
+ }
1238
+ /**
1239
+ * The raw environment configuration that we read from the config file.
1240
+ *
1241
+ * All the properties are optional, and will be replaced with defaults in the configuration that
1242
+ * is used in the rest of the codebase.
1243
+ */
1244
+ type RawEnvironment = Partial<Environment>;
1245
+ /**
1246
+ * A bundling resolver rule, defining the modules type for paths that match the specified globs.
1247
+ */
1248
+ type Rule = {
1249
+ type: ConfigModuleRuleType;
1250
+ globs: string[];
1251
+ fallthrough?: boolean;
1252
+ };
1253
+ /**
1254
+ * The possible types for a `Rule`.
1255
+ */
1256
+ type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data" | "PythonModule" | "PythonRequirement";
1257
+ type TailConsumer = {
1258
+ /** The name of the service tail events will be forwarded to. */service: string; /** (Optional) The environment of the service. */
1259
+ environment?: string;
1260
+ };
1261
+ type StreamingTailConsumer = {
1262
+ /** The name of the service streaming tail events will be forwarded to. */service: string;
1263
+ };
1264
+ interface DispatchNamespaceOutbound {
1265
+ /** Name of the service handling the outbound requests */
1266
+ service: string;
1267
+ /** (Optional) Name of the environment handling the outbound requests. */
1268
+ environment?: string;
1269
+ /** (Optional) List of parameter names, for sending context from your dispatch Worker to the outbound handler */
1270
+ parameters?: string[];
1271
+ }
1272
+ interface UserLimits {
1273
+ /** Maximum allowed CPU time for a Worker's invocation in milliseconds */
1274
+ cpu_ms?: number;
1275
+ /** Maximum allowed number of fetch requests that a Worker's invocation can execute */
1276
+ subrequests?: number;
1277
+ }
1278
+ type Assets = {
1279
+ /** Absolute path to assets directory */directory?: string; /** Name of `env` binding property in the User Worker. */
1280
+ binding?: string; /** How to handle HTML requests. */
1281
+ html_handling?: "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash" | "none"; /** How to handle requests that do not match an asset. */
1282
+ not_found_handling?: "single-page-application" | "404-page" | "none";
1283
+ /**
1284
+ * Matches will be routed to the User Worker, and matches to negative rules will go to the Asset Worker.
1285
+ *
1286
+ * Can also be `true`, indicating that every request should be routed to the User Worker.
1287
+ */
1288
+ run_worker_first?: string[] | boolean;
1289
+ };
1290
+ interface Observability {
1291
+ /** If observability is enabled for this Worker */
1292
+ enabled?: boolean;
1293
+ /** The sampling rate */
1294
+ head_sampling_rate?: number;
1295
+ logs?: {
1296
+ enabled?: boolean; /** The sampling rate */
1297
+ head_sampling_rate?: number; /** Set to false to disable invocation logs */
1298
+ invocation_logs?: boolean;
1299
+ /**
1300
+ * If logs should be persisted to the Cloudflare observability platform where they can be queried in the dashboard.
1301
+ *
1302
+ * @default true
1303
+ */
1304
+ persist?: boolean;
1305
+ /**
1306
+ * What destinations logs emitted from the Worker should be sent to.
1307
+ *
1308
+ * @default []
1309
+ */
1310
+ destinations?: string[];
1311
+ };
1312
+ traces?: {
1313
+ enabled?: boolean; /** The sampling rate */
1314
+ head_sampling_rate?: number;
1315
+ /**
1316
+ * If traces should be persisted to the Cloudflare observability platform where they can be queried in the dashboard.
1317
+ *
1318
+ * @default true
1319
+ */
1320
+ persist?: boolean;
1321
+ /**
1322
+ * What destinations traces emitted from the Worker should be sent to.
1323
+ *
1324
+ * @default []
1325
+ */
1326
+ destinations?: string[];
1327
+ };
1328
+ }
1329
+ interface CacheOptions {
1330
+ /** If cache is enabled for this Worker */
1331
+ enabled: boolean;
1332
+ }
1333
+ type DockerConfiguration = {
1334
+ /** Socket used by miniflare to communicate with Docker */socketPath: string; /** Docker image name for the container egress interceptor sidecar */
1335
+ containerEgressInterceptorImage?: string;
1336
+ };
1337
+ type ContainerEngine = {
1338
+ localDocker: DockerConfiguration;
1339
+ } | string;
1340
+ /**
1341
+ * Configuration for Worker Previews.
1342
+ *
1343
+ * This defines the settings used when creating Preview deployments.
1344
+ * Previews are branches of your Worker's main instance used to test features
1345
+ * during feature development outside of production.
1346
+ *
1347
+ * The `previews` block contains any intentionally divergent configuration intended solely for Previews, including:
1348
+ * - All non-inheritable properties (environment variables and bindings like KV, D1, R2, etc.)
1349
+ * - Select inheritable properties: `logpush`, `observability`, `limits`, `cache`
1350
+ *
1351
+ * @inheritable
1352
+ */
1353
+ interface PreviewsConfig extends Partial<EnvironmentNonInheritable>, Partial<Pick<EnvironmentInheritable, "logpush" | "observability" | "limits" | "cache">> {}
1354
+ /**
1355
+ * This is the static type definition for the configuration object.
1356
+ *
1357
+ * It reflects a normalized and validated version of the configuration that you can write in a Wrangler configuration file,
1358
+ * and optionally augment with arguments passed directly to wrangler.
1359
+ *
1360
+ * For more information about the configuration object, see the
1361
+ * documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration
1362
+ *
1363
+ * Notes:
1364
+ *
1365
+ * - Fields that are only specified in `ConfigFields` and not `Environment` can only appear
1366
+ * in the top level config and should not appear in any environments.
1367
+ * - Fields that are specified in `PagesConfigFields` are only relevant for Pages projects
1368
+ * - All top level fields in config and environments are optional in the Wrangler configuration file.
1369
+ *
1370
+ * Legend for the annotations:
1371
+ *
1372
+ * - `@breaking`: the deprecation/optionality is a breaking change from Wrangler v1.
1373
+ * - `@todo`: there's more work to be done (with details attached).
1374
+ */
1375
+ type RawConfig = Partial<ConfigFields<RawDevConfig>> & PagesConfigFields & RawEnvironment & EnvironmentMap & {
1376
+ $schema?: string;
1377
+ };
1378
+ interface ConfigFields<Dev extends RawDevConfig> {
1379
+ /**
1380
+ * A boolean to enable "legacy" style wrangler environments (from Wrangler v1).
1381
+ * These have been superseded by Services, but there may be projects that won't
1382
+ * (or can't) use them. If you're using a legacy environment, you can set this
1383
+ * to `true` to enable it.
1384
+ */
1385
+ legacy_env: boolean;
1386
+ /**
1387
+ * Whether Wrangler should send usage metrics to Cloudflare for this project.
1388
+ *
1389
+ * When defined this will override any user settings.
1390
+ * Otherwise, Wrangler will use the user's preference.
1391
+ */
1392
+ send_metrics: boolean | undefined;
1393
+ /**
1394
+ * Options to configure the development server that your worker will use.
1395
+ *
1396
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#local-development-settings
1397
+ */
1398
+ dev: Dev;
1399
+ /**
1400
+ * The definition of a Worker Site, a feature that lets you upload
1401
+ * static assets with your Worker.
1402
+ *
1403
+ * More details at https://developers.cloudflare.com/workers/platform/sites
1404
+ *
1405
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#workers-sites
1406
+ */
1407
+ site: {
1408
+ /**
1409
+ * The directory containing your static assets.
1410
+ *
1411
+ * It must be a path relative to your Wrangler configuration file.
1412
+ * Example: bucket = "./public"
1413
+ *
1414
+ * If there is a `site` field then it must contain this `bucket` field.
1415
+ */
1416
+ bucket: string;
1417
+ /**
1418
+ * The location of your Worker script.
1419
+ *
1420
+ * @deprecated DO NOT use this (it's a holdover from Wrangler v1.x). Either use the top level `main` field, or pass the path to your entry file as a command line argument.
1421
+ * @breaking
1422
+ */
1423
+ "entry-point"?: string;
1424
+ /**
1425
+ * An exclusive list of .gitignore-style patterns that match file
1426
+ * or directory names from your bucket location. Only matched
1427
+ * items will be uploaded. Example: include = ["upload_dir"]
1428
+ *
1429
+ * @optional
1430
+ * @default []
1431
+ */
1432
+ include?: string[];
1433
+ /**
1434
+ * A list of .gitignore-style patterns that match files or
1435
+ * directories in your bucket that should be excluded from
1436
+ * uploads. Example: exclude = ["ignore_dir"]
1437
+ *
1438
+ * @optional
1439
+ * @default []
1440
+ */
1441
+ exclude?: string[];
1442
+ } | undefined;
1443
+ /**
1444
+ * A list of wasm modules that your worker should be bound to. This is
1445
+ * the "legacy" way of binding to a wasm module. ES module workers should
1446
+ * do proper module imports.
1447
+ */
1448
+ wasm_modules: {
1449
+ [key: string]: string;
1450
+ } | undefined;
1451
+ /**
1452
+ * A list of text files that your worker should be bound to. This is
1453
+ * the "legacy" way of binding to a text file. ES module workers should
1454
+ * do proper module imports.
1455
+ */
1456
+ text_blobs: {
1457
+ [key: string]: string;
1458
+ } | undefined;
1459
+ /**
1460
+ * A list of data files that your worker should be bound to. This is
1461
+ * the "legacy" way of binding to a data file. ES module workers should
1462
+ * do proper module imports.
1463
+ */
1464
+ data_blobs: {
1465
+ [key: string]: string;
1466
+ } | undefined;
1467
+ /**
1468
+ * A map of module aliases. Lets you swap out a module for any others.
1469
+ * Corresponds with esbuild's `alias` config
1470
+ *
1471
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#module-aliasing
1472
+ */
1473
+ alias: {
1474
+ [key: string]: string;
1475
+ } | undefined;
1476
+ /**
1477
+ * By default, the Wrangler configuration file is the source of truth for your environment configuration, like a terraform file.
1478
+ *
1479
+ * If you change your vars in the dashboard, wrangler *will* override/delete them on its next deploy.
1480
+ *
1481
+ * If you want to keep your dashboard vars when wrangler deploys, set this field to true.
1482
+ *
1483
+ * @default false
1484
+ * @nonInheritable
1485
+ */
1486
+ keep_vars?: boolean;
1487
+ }
1488
+ interface PagesConfigFields {
1489
+ /**
1490
+ * The directory of static assets to serve.
1491
+ *
1492
+ * The presence of this field in a Wrangler configuration file indicates a Pages project,
1493
+ * and will prompt the handling of the configuration file according to the
1494
+ * Pages-specific validation rules.
1495
+ */
1496
+ pages_build_output_dir?: string;
1497
+ }
1498
+ interface DevConfig {
1499
+ /**
1500
+ * IP address for the local dev server to listen on,
1501
+ *
1502
+ * @default localhost
1503
+ */
1504
+ ip: string;
1505
+ /**
1506
+ * Port for the local dev server to listen on
1507
+ *
1508
+ * @default 8787
1509
+ */
1510
+ port: number | undefined;
1511
+ /**
1512
+ * Port for the local dev server's inspector to listen on
1513
+ *
1514
+ * @default 9229
1515
+ */
1516
+ inspector_port: number | undefined;
1517
+ /**
1518
+ * IP address for the local dev server's inspector to listen on
1519
+ *
1520
+ * @default 127.0.0.1
1521
+ */
1522
+ inspector_ip: string | undefined;
1523
+ /**
1524
+ * Protocol that local wrangler dev server listens to requests on.
1525
+ *
1526
+ * @default http
1527
+ */
1528
+ local_protocol: "http" | "https";
1529
+ /**
1530
+ * Protocol that wrangler dev forwards requests on
1531
+ *
1532
+ * Setting this to `http` is not currently implemented for remote mode.
1533
+ * See https://github.com/cloudflare/workers-sdk/issues/583
1534
+ *
1535
+ * @default https
1536
+ */
1537
+ upstream_protocol: "https" | "http";
1538
+ /**
1539
+ * Host to forward requests to, defaults to the host of the first route of project
1540
+ */
1541
+ host: string | undefined;
1542
+ /**
1543
+ * When developing, whether to build and connect to containers. This requires a Docker daemon to be running.
1544
+ * Defaults to `true`.
1545
+ *
1546
+ * @default true
1547
+ */
1548
+ enable_containers: boolean;
1549
+ /**
1550
+ * Either the Docker unix socket i.e. `unix:///var/run/docker.sock` or a full configuration.
1551
+ * Note that windows is only supported via WSL at the moment
1552
+ */
1553
+ container_engine: ContainerEngine | undefined;
1554
+ /**
1555
+ * Re-generate your worker types when your Wrangler configuration file changes.
1556
+ *
1557
+ * @default false
1558
+ */
1559
+ generate_types: boolean;
1560
+ }
1561
+ type RawDevConfig = Partial<DevConfig>;
1562
+ interface EnvironmentMap {
1563
+ /**
1564
+ * The `env` section defines overrides for the configuration for different environments.
1565
+ *
1566
+ * All environment fields can be specified at the top level of the config indicating the default environment settings.
1567
+ *
1568
+ * - Some fields are inherited and overridable in each environment.
1569
+ * - But some are not inherited and must be explicitly specified in every environment, if they are specified at the top level.
1570
+ *
1571
+ * For more information, see the documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration#environments
1572
+ *
1573
+ * @default {}
1574
+ */
1575
+ env?: {
1576
+ [envName: string]: RawEnvironment;
1577
+ };
1578
+ }
1579
+ export { RawConfig };