wrangler 0.0.0-e57758f8 → 0.0.0-e5b8cb40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/wrangler.js +0 -28
- package/config-schema.json +142 -29
- package/package.json +22 -45
- package/templates/checked-fetch.js +1 -1
- package/templates/facade.d.ts +2 -2
- package/templates/middleware/loader-modules.ts +14 -13
- package/templates/pages-template-plugin.ts +2 -2
- package/templates/pages-template-worker.ts +1 -1
- package/templates/startDevWorker/InspectorProxyWorker.ts +4 -1
- package/templates/startDevWorker/ProxyWorker.ts +4 -1
- package/wrangler-dist/InspectorProxyWorker.js.map +1 -1
- package/wrangler-dist/ProxyWorker.js.map +1 -1
- package/wrangler-dist/cli.d.ts +551 -222
- package/wrangler-dist/cli.js +6516 -4358
- package/Cloudflare_CA.pem +0 -18
package/wrangler-dist/cli.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ import type { MessagePort as MessagePort_2 } from 'worker_threads';
|
|
|
14
14
|
import type { Metafile } from 'esbuild';
|
|
15
15
|
import { Miniflare } from 'miniflare';
|
|
16
16
|
import type { MiniflareOptions } from 'miniflare';
|
|
17
|
-
import type { ModuleRule
|
|
17
|
+
import type { ModuleRule } from 'miniflare';
|
|
18
18
|
import { Mutex } from 'miniflare';
|
|
19
19
|
import { Readable } from 'stream';
|
|
20
20
|
import { ReadableStream } from 'stream/web';
|
|
@@ -94,51 +94,68 @@ declare type BaseErrorEvent<Source = string, Data = undefined> = {
|
|
|
94
94
|
data: Data;
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
+
declare type BinaryFile = File_2<Uint8Array>;
|
|
98
|
+
|
|
97
99
|
declare type BinaryType = 'blob' | 'arraybuffer'
|
|
98
100
|
|
|
99
101
|
declare type Binding = {
|
|
100
|
-
type: "
|
|
101
|
-
|
|
102
|
+
type: "plain_text";
|
|
103
|
+
value: string;
|
|
102
104
|
} | {
|
|
103
|
-
type: "
|
|
104
|
-
|
|
105
|
+
type: "json";
|
|
106
|
+
value: Json;
|
|
107
|
+
} | ({
|
|
108
|
+
type: "kv_namespace";
|
|
109
|
+
} & BindingOmit<CfKvNamespace>) | ({
|
|
110
|
+
type: "send_email";
|
|
111
|
+
} & BindingOmit<CfSendEmailBindings>) | {
|
|
112
|
+
type: "wasm_module";
|
|
113
|
+
source: BinaryFile;
|
|
105
114
|
} | {
|
|
106
|
-
type: "
|
|
107
|
-
|
|
108
|
-
binding: string;
|
|
109
|
-
/** The name of this D1 database. */
|
|
110
|
-
database_name: string;
|
|
111
|
-
/** The UUID of this D1 database (not required). */
|
|
112
|
-
database_id: string;
|
|
113
|
-
/** The UUID of this D1 database for Wrangler Dev (if specified). */
|
|
114
|
-
preview_database_id?: string;
|
|
115
|
-
/** The name of the migrations table for this D1 database (defaults to 'd1_migrations'). */
|
|
116
|
-
migrations_table?: string;
|
|
117
|
-
/** The path to the directory of migrations for this D1 database (defaults to './migrations'). */
|
|
118
|
-
migrations_dir?: string;
|
|
119
|
-
/** Internal use only. */
|
|
120
|
-
database_internal_env?: string;
|
|
115
|
+
type: "text_blob";
|
|
116
|
+
source: File_2;
|
|
121
117
|
} | {
|
|
122
|
-
type: "
|
|
123
|
-
className: string;
|
|
124
|
-
service?: ServiceDesignator;
|
|
118
|
+
type: "browser";
|
|
125
119
|
} | {
|
|
126
|
-
type: "
|
|
127
|
-
service: ServiceDesignator | ServiceFetch;
|
|
120
|
+
type: "ai";
|
|
128
121
|
} | {
|
|
129
|
-
type: "
|
|
130
|
-
name: string;
|
|
122
|
+
type: "version_metadata";
|
|
131
123
|
} | {
|
|
124
|
+
type: "data_blob";
|
|
125
|
+
source: BinaryFile;
|
|
126
|
+
} | ({
|
|
127
|
+
type: "durable_object_namespace";
|
|
128
|
+
} & BindingOmit<CfDurableObject>) | ({
|
|
129
|
+
type: "queue";
|
|
130
|
+
} & BindingOmit<CfQueue>) | ({
|
|
131
|
+
type: "r2_bucket";
|
|
132
|
+
} & BindingOmit<CfR2Bucket>) | ({
|
|
133
|
+
type: "d1";
|
|
134
|
+
} & Omit<CfD1Database, "binding">) | ({
|
|
135
|
+
type: "vectorize";
|
|
136
|
+
} & Omit<CfVectorize, "binding">) | ({
|
|
132
137
|
type: "constellation";
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
} | {
|
|
138
|
-
type:
|
|
139
|
-
|
|
138
|
+
} & Omit<CfConstellation, "binding">) | ({
|
|
139
|
+
type: "hyperdrive";
|
|
140
|
+
} & Omit<CfHyperdrive, "binding">) | ({
|
|
141
|
+
type: "service";
|
|
142
|
+
} & Omit<CfService, "binding">) | {
|
|
143
|
+
type: "fetcher";
|
|
144
|
+
fetcher: ServiceFetch;
|
|
145
|
+
} | ({
|
|
146
|
+
type: "analytics_engine";
|
|
147
|
+
} & Omit<CfAnalyticsEngineDataset, "binding">) | ({
|
|
148
|
+
type: "dispatch_namespace";
|
|
149
|
+
} & Omit<CfDispatchNamespace, "binding">) | ({
|
|
150
|
+
type: "mtls_certificate";
|
|
151
|
+
} & Omit<CfMTlsCertificate, "binding">) | ({
|
|
152
|
+
type: "logfwdr";
|
|
153
|
+
} & Omit<CfLogfwdrBinding, "name">) | {
|
|
154
|
+
type: `unsafe_${string}`;
|
|
140
155
|
};
|
|
141
156
|
|
|
157
|
+
declare type BindingOmit<T> = Omit<T, "binding" | "name">;
|
|
158
|
+
|
|
142
159
|
/**
|
|
143
160
|
* Result of the `getBindingsProxy` utility
|
|
144
161
|
*/
|
|
@@ -264,23 +281,27 @@ declare namespace buildConnector {
|
|
|
264
281
|
}
|
|
265
282
|
}
|
|
266
283
|
|
|
284
|
+
declare type Bundle = EsbuildBundle;
|
|
285
|
+
|
|
267
286
|
declare type BundleCompleteEvent = {
|
|
268
287
|
type: "bundleComplete";
|
|
269
288
|
config: StartDevWorkerOptions;
|
|
270
|
-
bundle:
|
|
289
|
+
bundle: Bundle;
|
|
271
290
|
};
|
|
272
291
|
|
|
273
|
-
declare class BundlerController extends Controller {
|
|
274
|
-
|
|
292
|
+
declare class BundlerController extends Controller<BundlerControllerEventMap> {
|
|
293
|
+
#private;
|
|
294
|
+
onConfigUpdate(event: ConfigUpdateEvent): void;
|
|
275
295
|
teardown(): Promise<void>;
|
|
276
|
-
emitBundleStartEvent(
|
|
277
|
-
|
|
278
|
-
on(event: "bundleStart", listener: (_: BundleStartEvent) => void): this;
|
|
279
|
-
on(event: "bundleComplete", listener: (_: BundleCompleteEvent) => void): this;
|
|
280
|
-
on(event: "error", listener: (_: ErrorEvent) => void): this;
|
|
281
|
-
once: typeof BundlerController.on;
|
|
296
|
+
emitBundleStartEvent(config: StartDevWorkerOptions): void;
|
|
297
|
+
emitBundleCompleteEvent(config: StartDevWorkerOptions, bundle: EsbuildBundle): void;
|
|
282
298
|
}
|
|
283
299
|
|
|
300
|
+
declare type BundlerControllerEventMap = ControllerEventMap & {
|
|
301
|
+
bundleStart: [BundleStartEvent];
|
|
302
|
+
bundleComplete: [BundleCompleteEvent];
|
|
303
|
+
};
|
|
304
|
+
|
|
284
305
|
declare type BundleStartEvent = {
|
|
285
306
|
type: "bundleStart";
|
|
286
307
|
config: StartDevWorkerOptions;
|
|
@@ -378,6 +399,68 @@ declare interface CfAccount {
|
|
|
378
399
|
accountId: string;
|
|
379
400
|
}
|
|
380
401
|
|
|
402
|
+
/**
|
|
403
|
+
* A binding to the AI project
|
|
404
|
+
*/
|
|
405
|
+
declare interface CfAIBinding {
|
|
406
|
+
binding: string;
|
|
407
|
+
staging?: boolean;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
declare interface CfAnalyticsEngineDataset {
|
|
411
|
+
binding: string;
|
|
412
|
+
dataset?: string;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* A binding to a browser
|
|
417
|
+
*/
|
|
418
|
+
declare interface CfBrowserBinding {
|
|
419
|
+
binding: string;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
declare type CfCapnp = {
|
|
423
|
+
base_path?: never;
|
|
424
|
+
source_schemas?: never;
|
|
425
|
+
compiled_schema: string;
|
|
426
|
+
} | {
|
|
427
|
+
base_path: string;
|
|
428
|
+
source_schemas: string[];
|
|
429
|
+
compiled_schema?: never;
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
declare interface CfConstellation {
|
|
433
|
+
binding: string;
|
|
434
|
+
project_id: string;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
declare interface CfD1Database {
|
|
438
|
+
binding: string;
|
|
439
|
+
database_id: string;
|
|
440
|
+
database_name?: string;
|
|
441
|
+
preview_database_id?: string;
|
|
442
|
+
database_internal_env?: string;
|
|
443
|
+
migrations_table?: string;
|
|
444
|
+
migrations_dir?: string;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* A binding to a data blob (in service-worker format)
|
|
449
|
+
*/
|
|
450
|
+
declare interface CfDataBlobBindings {
|
|
451
|
+
[key: string]: string | Uint8Array;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
declare interface CfDispatchNamespace {
|
|
455
|
+
binding: string;
|
|
456
|
+
namespace: string;
|
|
457
|
+
outbound?: {
|
|
458
|
+
service: string;
|
|
459
|
+
environment?: string;
|
|
460
|
+
parameters?: string[];
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
|
|
381
464
|
/**
|
|
382
465
|
* A Durable Object.
|
|
383
466
|
*/
|
|
@@ -388,6 +471,42 @@ declare interface CfDurableObject {
|
|
|
388
471
|
environment?: string;
|
|
389
472
|
}
|
|
390
473
|
|
|
474
|
+
declare interface CfDurableObjectMigrations {
|
|
475
|
+
old_tag?: string;
|
|
476
|
+
new_tag: string;
|
|
477
|
+
steps: {
|
|
478
|
+
new_classes?: string[];
|
|
479
|
+
renamed_classes?: {
|
|
480
|
+
from: string;
|
|
481
|
+
to: string;
|
|
482
|
+
}[];
|
|
483
|
+
deleted_classes?: string[];
|
|
484
|
+
}[];
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
declare interface CfHyperdrive {
|
|
488
|
+
binding: string;
|
|
489
|
+
id: string;
|
|
490
|
+
localConnectionString?: string;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* A KV namespace.
|
|
495
|
+
*/
|
|
496
|
+
declare interface CfKvNamespace {
|
|
497
|
+
binding: string;
|
|
498
|
+
id: string;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
declare interface CfLogfwdr {
|
|
502
|
+
bindings: CfLogfwdrBinding[];
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
declare interface CfLogfwdrBinding {
|
|
506
|
+
name: string;
|
|
507
|
+
destination: string;
|
|
508
|
+
}
|
|
509
|
+
|
|
391
510
|
/**
|
|
392
511
|
* An imported module.
|
|
393
512
|
*/
|
|
@@ -419,6 +538,12 @@ declare interface CfModule {
|
|
|
419
538
|
* }
|
|
420
539
|
*/
|
|
421
540
|
content: string | Buffer;
|
|
541
|
+
/**
|
|
542
|
+
* An optional sourcemap for this module if it's of a ESM or CJS type, this will only be present
|
|
543
|
+
* if we're deploying with sourcemaps enabled. Since we copy extra modules that aren't bundled
|
|
544
|
+
* we need to also copy the relevant sourcemaps into the final out directory.
|
|
545
|
+
*/
|
|
546
|
+
sourceMap?: CfWorkerSourceMap;
|
|
422
547
|
/**
|
|
423
548
|
* The module type.
|
|
424
549
|
*
|
|
@@ -430,13 +555,193 @@ declare interface CfModule {
|
|
|
430
555
|
/**
|
|
431
556
|
* A module type.
|
|
432
557
|
*/
|
|
433
|
-
declare type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer" | "python" | "python-requirement";
|
|
558
|
+
declare type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer" | "python" | "python-requirement" | "nodejs-compat-module";
|
|
559
|
+
|
|
560
|
+
declare interface CfMTlsCertificate {
|
|
561
|
+
binding: string;
|
|
562
|
+
certificate_id: string;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
declare interface CfPlacement {
|
|
566
|
+
mode: "smart";
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
declare interface CfQueue {
|
|
570
|
+
binding: string;
|
|
571
|
+
queue_name: string;
|
|
572
|
+
delivery_delay?: number;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
declare interface CfR2Bucket {
|
|
576
|
+
binding: string;
|
|
577
|
+
bucket_name: string;
|
|
578
|
+
jurisdiction?: string;
|
|
579
|
+
}
|
|
434
580
|
|
|
435
581
|
/**
|
|
436
582
|
* The type of Worker
|
|
437
583
|
*/
|
|
438
584
|
declare type CfScriptFormat = "modules" | "service-worker";
|
|
439
585
|
|
|
586
|
+
/**
|
|
587
|
+
* A binding to send email.
|
|
588
|
+
*/
|
|
589
|
+
declare interface CfSendEmailBindings {
|
|
590
|
+
name: string;
|
|
591
|
+
destination_address?: string;
|
|
592
|
+
allowed_destination_addresses?: string[];
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
declare interface CfService {
|
|
596
|
+
binding: string;
|
|
597
|
+
service: string;
|
|
598
|
+
environment?: string;
|
|
599
|
+
entrypoint?: string;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
declare interface CfTailConsumer {
|
|
603
|
+
service: string;
|
|
604
|
+
environment?: string;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* A binding to a text blob (in service-worker format)
|
|
609
|
+
*/
|
|
610
|
+
declare interface CfTextBlobBindings {
|
|
611
|
+
[key: string]: string;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
declare interface CfUnsafe {
|
|
615
|
+
bindings: CfUnsafeBinding[] | undefined;
|
|
616
|
+
metadata: CfUnsafeMetadata | undefined;
|
|
617
|
+
capnp: CfCapnp | undefined;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
declare interface CfUnsafeBinding {
|
|
621
|
+
name: string;
|
|
622
|
+
type: string;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
declare type CfUnsafeMetadata = Record<string, unknown>;
|
|
626
|
+
|
|
627
|
+
declare interface CfUserLimits {
|
|
628
|
+
cpu_ms?: number;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* A map of variable names to values.
|
|
633
|
+
*/
|
|
634
|
+
declare interface CfVars {
|
|
635
|
+
[key: string]: string | Json;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
declare interface CfVectorize {
|
|
639
|
+
binding: string;
|
|
640
|
+
index_name: string;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* A binding to the Worker Version's metadata
|
|
645
|
+
*/
|
|
646
|
+
declare interface CfVersionMetadataBinding {
|
|
647
|
+
binding: string;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* A binding to a wasm module (in service-worker format)
|
|
652
|
+
*/
|
|
653
|
+
declare interface CfWasmModuleBindings {
|
|
654
|
+
[key: string]: string | Uint8Array;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Options for creating a `CfWorker`.
|
|
659
|
+
*/
|
|
660
|
+
declare interface CfWorkerInit {
|
|
661
|
+
/**
|
|
662
|
+
* The name of the worker.
|
|
663
|
+
*/
|
|
664
|
+
name: string | undefined;
|
|
665
|
+
/**
|
|
666
|
+
* The entrypoint module.
|
|
667
|
+
*/
|
|
668
|
+
main: CfModule;
|
|
669
|
+
/**
|
|
670
|
+
* The list of additional modules.
|
|
671
|
+
*/
|
|
672
|
+
modules: CfModule[] | undefined;
|
|
673
|
+
/**
|
|
674
|
+
* The list of source maps to include on upload.
|
|
675
|
+
*/
|
|
676
|
+
sourceMaps: CfWorkerSourceMap[] | undefined;
|
|
677
|
+
/**
|
|
678
|
+
* All the bindings
|
|
679
|
+
*/
|
|
680
|
+
bindings: {
|
|
681
|
+
vars: CfVars | undefined;
|
|
682
|
+
kv_namespaces: CfKvNamespace[] | undefined;
|
|
683
|
+
send_email: CfSendEmailBindings[] | undefined;
|
|
684
|
+
wasm_modules: CfWasmModuleBindings | undefined;
|
|
685
|
+
text_blobs: CfTextBlobBindings | undefined;
|
|
686
|
+
browser: CfBrowserBinding | undefined;
|
|
687
|
+
ai: CfAIBinding | undefined;
|
|
688
|
+
version_metadata: CfVersionMetadataBinding | undefined;
|
|
689
|
+
data_blobs: CfDataBlobBindings | undefined;
|
|
690
|
+
durable_objects: {
|
|
691
|
+
bindings: CfDurableObject[];
|
|
692
|
+
} | undefined;
|
|
693
|
+
queues: CfQueue[] | undefined;
|
|
694
|
+
r2_buckets: CfR2Bucket[] | undefined;
|
|
695
|
+
d1_databases: CfD1Database[] | undefined;
|
|
696
|
+
vectorize: CfVectorize[] | undefined;
|
|
697
|
+
constellation: CfConstellation[] | undefined;
|
|
698
|
+
hyperdrive: CfHyperdrive[] | undefined;
|
|
699
|
+
services: CfService[] | undefined;
|
|
700
|
+
analytics_engine_datasets: CfAnalyticsEngineDataset[] | undefined;
|
|
701
|
+
dispatch_namespaces: CfDispatchNamespace[] | undefined;
|
|
702
|
+
mtls_certificates: CfMTlsCertificate[] | undefined;
|
|
703
|
+
logfwdr: CfLogfwdr | undefined;
|
|
704
|
+
unsafe: CfUnsafe | undefined;
|
|
705
|
+
};
|
|
706
|
+
migrations: CfDurableObjectMigrations | undefined;
|
|
707
|
+
compatibility_date: string | undefined;
|
|
708
|
+
compatibility_flags: string[] | undefined;
|
|
709
|
+
usage_model: "bundled" | "unbound" | undefined;
|
|
710
|
+
keepVars: boolean | undefined;
|
|
711
|
+
keepSecrets: boolean | undefined;
|
|
712
|
+
logpush: boolean | undefined;
|
|
713
|
+
placement: CfPlacement | undefined;
|
|
714
|
+
tail_consumers: CfTailConsumer[] | undefined;
|
|
715
|
+
limits: CfUserLimits | undefined;
|
|
716
|
+
annotations?: Record<string, string | undefined>;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
declare interface CfWorkerSourceMap {
|
|
720
|
+
/**
|
|
721
|
+
* The name of the source map.
|
|
722
|
+
*
|
|
723
|
+
* @example
|
|
724
|
+
* 'out.js.map'
|
|
725
|
+
*/
|
|
726
|
+
name: string;
|
|
727
|
+
/**
|
|
728
|
+
* The content of the source map, which is a JSON object described by the v3
|
|
729
|
+
* spec.
|
|
730
|
+
*
|
|
731
|
+
* @example
|
|
732
|
+
* {
|
|
733
|
+
* "version" : 3,
|
|
734
|
+
* "file": "out.js",
|
|
735
|
+
* "sourceRoot": "",
|
|
736
|
+
* "sources": ["foo.js", "bar.js"],
|
|
737
|
+
* "sourcesContent": [null, null],
|
|
738
|
+
* "names": ["src", "maps", "are", "fun"],
|
|
739
|
+
* "mappings": "A,AAAB;;ABCDE;"
|
|
740
|
+
* }
|
|
741
|
+
*/
|
|
742
|
+
content: string | Buffer;
|
|
743
|
+
}
|
|
744
|
+
|
|
440
745
|
/**
|
|
441
746
|
* A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default.
|
|
442
747
|
*/
|
|
@@ -553,17 +858,41 @@ declare type CloudchamberConfig = {
|
|
|
553
858
|
memory?: string;
|
|
554
859
|
};
|
|
555
860
|
|
|
556
|
-
|
|
861
|
+
/**
|
|
862
|
+
* This is the static type definition for the configuration object.
|
|
863
|
+
*
|
|
864
|
+
* It reflects a normalized and validated version of the configuration that you can write in wrangler.toml,
|
|
865
|
+
* and optionally augment with arguments passed directly to wrangler.
|
|
866
|
+
*
|
|
867
|
+
* For more information about the configuration object, see the
|
|
868
|
+
* documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration
|
|
869
|
+
*
|
|
870
|
+
* Notes:
|
|
871
|
+
*
|
|
872
|
+
* - Fields that are only specified in `ConfigFields` and not `Environment` can only appear
|
|
873
|
+
* in the top level config and should not appear in any environments.
|
|
874
|
+
* - Fields that are specified in `PagesConfigFields` are only relevant for Pages projects
|
|
875
|
+
* - All top level fields in config and environments are optional in the wrangler.toml file.
|
|
876
|
+
*
|
|
877
|
+
* Legend for the annotations:
|
|
878
|
+
*
|
|
879
|
+
* - `@breaking`: the deprecation/optionality is a breaking change from Wrangler v1.
|
|
880
|
+
* - `@todo`: there's more work to be done (with details attached).
|
|
881
|
+
*/
|
|
882
|
+
declare type Config = ConfigFields<DevConfig> & PagesConfigFields & Environment;
|
|
883
|
+
|
|
884
|
+
declare class ConfigController extends Controller<ConfigControllerEventMap> {
|
|
557
885
|
config?: StartDevWorkerOptions;
|
|
558
886
|
setOptions(_: StartDevWorkerOptions): void;
|
|
559
887
|
updateOptions(_: Partial<StartDevWorkerOptions>): void;
|
|
560
888
|
teardown(): Promise<void>;
|
|
561
889
|
emitConfigUpdateEvent(data: ConfigUpdateEvent): void;
|
|
562
|
-
on(event: "configUpdate", listener: (_: ConfigUpdateEvent) => void): this;
|
|
563
|
-
on(event: "error", listener: (_: ErrorEvent) => void): this;
|
|
564
|
-
once: typeof ConfigController.on;
|
|
565
890
|
}
|
|
566
891
|
|
|
892
|
+
declare type ConfigControllerEventMap = ControllerEventMap & {
|
|
893
|
+
configUpdate: [ConfigUpdateEvent];
|
|
894
|
+
};
|
|
895
|
+
|
|
567
896
|
declare interface ConfigFields<Dev extends RawDevConfig> {
|
|
568
897
|
configPath: string | undefined;
|
|
569
898
|
/**
|
|
@@ -584,28 +913,6 @@ declare interface ConfigFields<Dev extends RawDevConfig> {
|
|
|
584
913
|
* Options to configure the development server that your worker will use.
|
|
585
914
|
*/
|
|
586
915
|
dev: Dev;
|
|
587
|
-
/**
|
|
588
|
-
* A list of migrations that should be uploaded with your Worker.
|
|
589
|
-
*
|
|
590
|
-
* These define changes in your Durable Object declarations.
|
|
591
|
-
*
|
|
592
|
-
* More details at https://developers.cloudflare.com/workers/learning/using-durable-objects#configuring-durable-object-classes-with-migrations
|
|
593
|
-
*
|
|
594
|
-
* @default []
|
|
595
|
-
*/
|
|
596
|
-
migrations: {
|
|
597
|
-
/** A unique identifier for this migration. */
|
|
598
|
-
tag: string;
|
|
599
|
-
/** The new Durable Objects being defined. */
|
|
600
|
-
new_classes?: string[];
|
|
601
|
-
/** The Durable Objects being renamed. */
|
|
602
|
-
renamed_classes?: {
|
|
603
|
-
from: string;
|
|
604
|
-
to: string;
|
|
605
|
-
}[];
|
|
606
|
-
/** The Durable Objects being removed. */
|
|
607
|
-
deleted_classes?: string[];
|
|
608
|
-
}[];
|
|
609
916
|
/**
|
|
610
917
|
* The definition of a Worker Site, a feature that lets you upload
|
|
611
918
|
* static assets with your Worker.
|
|
@@ -658,7 +965,7 @@ declare interface ConfigFields<Dev extends RawDevConfig> {
|
|
|
658
965
|
exclude: string[];
|
|
659
966
|
browser_TTL: number | undefined;
|
|
660
967
|
serve_single_page_app: boolean;
|
|
661
|
-
} | undefined;
|
|
968
|
+
} | string | undefined;
|
|
662
969
|
/**
|
|
663
970
|
* A list of wasm modules that your worker should be bound to. This is
|
|
664
971
|
* the "legacy" way of binding to a wasm module. ES module workers should
|
|
@@ -699,7 +1006,7 @@ declare interface ConfigFields<Dev extends RawDevConfig> {
|
|
|
699
1006
|
/**
|
|
700
1007
|
* The possible types for a `Rule`.
|
|
701
1008
|
*/
|
|
702
|
-
declare type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data" | "PythonModule" | "PythonRequirement";
|
|
1009
|
+
declare type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data" | "PythonModule" | "PythonRequirement" | "NodeJsCompatModule";
|
|
703
1010
|
|
|
704
1011
|
declare type ConfigUpdateEvent = {
|
|
705
1012
|
type: "configUpdate";
|
|
@@ -712,9 +1019,14 @@ url: string | URL_2 | UrlObject,
|
|
|
712
1019
|
options?: { dispatcher?: Dispatcher } & Omit<Dispatcher.ConnectOptions, 'origin' | 'path'>
|
|
713
1020
|
): Promise<Dispatcher.ConnectData>;
|
|
714
1021
|
|
|
715
|
-
declare abstract class Controller extends
|
|
1022
|
+
declare abstract class Controller<EventMap extends ControllerEventMap = ControllerEventMap> extends TypedEventEmitterImpl<EventMap> {
|
|
1023
|
+
emitErrorEvent(data: ErrorEvent): void;
|
|
716
1024
|
}
|
|
717
1025
|
|
|
1026
|
+
declare type ControllerEventMap = {
|
|
1027
|
+
error: [ErrorEvent];
|
|
1028
|
+
};
|
|
1029
|
+
|
|
718
1030
|
declare interface Cookie {
|
|
719
1031
|
name: string
|
|
720
1032
|
value: string
|
|
@@ -756,7 +1068,7 @@ attributes?: { name?: string, domain?: string }
|
|
|
756
1068
|
* NOTE: You will need the `CLOUDFLARE_API_KEY` environment
|
|
757
1069
|
* variable set
|
|
758
1070
|
*/
|
|
759
|
-
declare function deploy({ directory, accountId, projectName, branch, skipCaching, commitMessage, commitHash, commitDirty, functionsDirectory: customFunctionsDirectory, bundle, args, }: PagesDeployOptions): Promise<{
|
|
1071
|
+
declare function deploy({ directory, accountId, projectName, branch, skipCaching, commitMessage, commitHash, commitDirty, functionsDirectory: customFunctionsDirectory, bundle, sourceMaps, args, }: PagesDeployOptions): Promise<{
|
|
760
1072
|
url: string;
|
|
761
1073
|
id: string;
|
|
762
1074
|
environment: "production" | "preview";
|
|
@@ -819,30 +1131,6 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
|
|
|
819
1131
|
} | undefined;
|
|
820
1132
|
}>;
|
|
821
1133
|
|
|
822
|
-
declare interface DeprecatedConfigFields {
|
|
823
|
-
/**
|
|
824
|
-
* The project "type". A holdover from Wrangler v1.x.
|
|
825
|
-
* Valid values were "webpack", "javascript", and "rust".
|
|
826
|
-
*
|
|
827
|
-
* @deprecated DO NOT USE THIS. Most common features now work out of the box with wrangler, including modules, jsx, typescript, etc. If you need anything more, use a custom build.
|
|
828
|
-
* @breaking
|
|
829
|
-
*/
|
|
830
|
-
type?: "webpack" | "javascript" | "rust";
|
|
831
|
-
/**
|
|
832
|
-
* Path to the webpack config to use when building your worker.
|
|
833
|
-
* A holdover from Wrangler v1.x, used with `type: "webpack"`.
|
|
834
|
-
*
|
|
835
|
-
* @deprecated DO NOT USE THIS. Most common features now work out of the box with wrangler, including modules, jsx, typescript, etc. If you need anything more, use a custom build.
|
|
836
|
-
* @breaking
|
|
837
|
-
*/
|
|
838
|
-
webpack_config?: string;
|
|
839
|
-
/**
|
|
840
|
-
* Configuration only used by a standalone use of the miniflare binary.
|
|
841
|
-
* @deprecated
|
|
842
|
-
*/
|
|
843
|
-
miniflare?: unknown;
|
|
844
|
-
}
|
|
845
|
-
|
|
846
1134
|
/**
|
|
847
1135
|
* Deprecated upload configuration.
|
|
848
1136
|
*/
|
|
@@ -1280,39 +1568,6 @@ declare type Entry = {
|
|
|
1280
1568
|
declare interface Environment extends EnvironmentInheritable, EnvironmentNonInheritable {
|
|
1281
1569
|
}
|
|
1282
1570
|
|
|
1283
|
-
/**
|
|
1284
|
-
* The environment configuration properties that have been deprecated.
|
|
1285
|
-
*/
|
|
1286
|
-
declare interface EnvironmentDeprecated {
|
|
1287
|
-
/**
|
|
1288
|
-
* The zone ID of the zone you want to deploy to. You can find this
|
|
1289
|
-
* in your domain page on the dashboard.
|
|
1290
|
-
*
|
|
1291
|
-
* @deprecated This is unnecessary since we can deduce this from routes directly.
|
|
1292
|
-
*/
|
|
1293
|
-
zone_id?: string;
|
|
1294
|
-
/**
|
|
1295
|
-
* Legacy way of defining KVNamespaces that is no longer supported.
|
|
1296
|
-
*
|
|
1297
|
-
* @deprecated DO NOT USE. This was a legacy bug from Wrangler v1, that we do not want to support.
|
|
1298
|
-
*/
|
|
1299
|
-
"kv-namespaces"?: string;
|
|
1300
|
-
/**
|
|
1301
|
-
* A list of services that your Worker should be bound to.
|
|
1302
|
-
*
|
|
1303
|
-
* @default `[]`
|
|
1304
|
-
* @deprecated DO NOT USE. We'd added this to test the new service binding system, but the proper way to test experimental features is to use `unsafe.bindings` configuration.
|
|
1305
|
-
*/
|
|
1306
|
-
experimental_services?: {
|
|
1307
|
-
/** The binding name used to refer to the Service */
|
|
1308
|
-
name: string;
|
|
1309
|
-
/** The name of the Service being bound */
|
|
1310
|
-
service: string;
|
|
1311
|
-
/** The Service's environment */
|
|
1312
|
-
environment: string;
|
|
1313
|
-
}[];
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
1571
|
/**
|
|
1317
1572
|
* The `EnvironmentInheritable` interface declares all the configuration fields for an environment
|
|
1318
1573
|
* that can be inherited (and overridden) from the top-level environment.
|
|
@@ -1432,6 +1687,29 @@ declare interface EnvironmentInheritable {
|
|
|
1432
1687
|
* @inheritable
|
|
1433
1688
|
*/
|
|
1434
1689
|
jsx_fragment: string;
|
|
1690
|
+
/**
|
|
1691
|
+
* A list of migrations that should be uploaded with your Worker.
|
|
1692
|
+
*
|
|
1693
|
+
* These define changes in your Durable Object declarations.
|
|
1694
|
+
*
|
|
1695
|
+
* More details at https://developers.cloudflare.com/workers/learning/using-durable-objects#configuring-durable-object-classes-with-migrations
|
|
1696
|
+
*
|
|
1697
|
+
* @default []
|
|
1698
|
+
* @inheritable
|
|
1699
|
+
*/
|
|
1700
|
+
migrations: {
|
|
1701
|
+
/** A unique identifier for this migration. */
|
|
1702
|
+
tag: string;
|
|
1703
|
+
/** The new Durable Objects being defined. */
|
|
1704
|
+
new_classes?: string[];
|
|
1705
|
+
/** The Durable Objects being renamed. */
|
|
1706
|
+
renamed_classes?: {
|
|
1707
|
+
from: string;
|
|
1708
|
+
to: string;
|
|
1709
|
+
}[];
|
|
1710
|
+
/** The Durable Objects being removed. */
|
|
1711
|
+
deleted_classes?: string[];
|
|
1712
|
+
}[];
|
|
1435
1713
|
/**
|
|
1436
1714
|
* "Cron" definitions to trigger a Worker's "scheduled" function.
|
|
1437
1715
|
*
|
|
@@ -1564,24 +1842,6 @@ declare interface EnvironmentInheritable {
|
|
|
1564
1842
|
} | undefined;
|
|
1565
1843
|
}
|
|
1566
1844
|
|
|
1567
|
-
declare interface EnvironmentMap {
|
|
1568
|
-
/**
|
|
1569
|
-
* The `env` section defines overrides for the configuration for different environments.
|
|
1570
|
-
*
|
|
1571
|
-
* All environment fields can be specified at the top level of the config indicating the default environment settings.
|
|
1572
|
-
*
|
|
1573
|
-
* - Some fields are inherited and overridable in each environment.
|
|
1574
|
-
* - But some are not inherited and must be explicitly specified in every environment, if they are specified at the top level.
|
|
1575
|
-
*
|
|
1576
|
-
* For more information, see the documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration#environments
|
|
1577
|
-
*
|
|
1578
|
-
* @default {}
|
|
1579
|
-
*/
|
|
1580
|
-
env?: {
|
|
1581
|
-
[envName: string]: RawEnvironment;
|
|
1582
|
-
};
|
|
1583
|
-
}
|
|
1584
|
-
|
|
1585
1845
|
/**
|
|
1586
1846
|
* The `EnvironmentNonInheritable` interface declares all the configuration fields for an environment
|
|
1587
1847
|
* that cannot be inherited from the top-level environment, and must be defined specifically.
|
|
@@ -1956,7 +2216,10 @@ declare interface EnvironmentNonInheritable {
|
|
|
1956
2216
|
|
|
1957
2217
|
declare type ErrorEvent = BaseErrorEvent<"ConfigController" | "BundlerController" | "LocalRuntimeController" | "RemoteRuntimeController" | "ProxyWorker" | "InspectorProxyWorker"> | BaseErrorEvent<"ProxyController", {
|
|
1958
2218
|
config?: StartDevWorkerOptions;
|
|
1959
|
-
bundle?:
|
|
2219
|
+
bundle?: Bundle;
|
|
2220
|
+
}> | BaseErrorEvent<"BundlerController", {
|
|
2221
|
+
config?: StartDevWorkerOptions;
|
|
2222
|
+
filePath?: string;
|
|
1960
2223
|
}>;
|
|
1961
2224
|
|
|
1962
2225
|
declare namespace Errors {
|
|
@@ -2086,6 +2349,7 @@ declare namespace Errors {
|
|
|
2086
2349
|
declare type EsbuildBundle = {
|
|
2087
2350
|
id: number;
|
|
2088
2351
|
path: string;
|
|
2352
|
+
entrypointSource: string;
|
|
2089
2353
|
entry: Entry;
|
|
2090
2354
|
type: CfModuleType;
|
|
2091
2355
|
modules: CfModule[];
|
|
@@ -2420,7 +2684,7 @@ declare class Headers implements SpecIterable<[string, string]> {
|
|
|
2420
2684
|
|
|
2421
2685
|
declare type HeadersInit = string[][] | Record<string, string | ReadonlyArray<string>> | Headers
|
|
2422
2686
|
|
|
2423
|
-
declare type Hook<T
|
|
2687
|
+
declare type Hook<T extends string | number | object> = T | Promise<T> | (() => T | Promise<T>);
|
|
2424
2688
|
|
|
2425
2689
|
/**
|
|
2426
2690
|
* @property terminate Terminates HTTP server.
|
|
@@ -2462,6 +2726,21 @@ declare interface Interceptable extends Dispatcher {
|
|
|
2462
2726
|
intercept(options: MockInterceptor.Options): MockInterceptor;
|
|
2463
2727
|
}
|
|
2464
2728
|
|
|
2729
|
+
declare class Logger {
|
|
2730
|
+
constructor();
|
|
2731
|
+
loggerLevel: "error" | "none" | "warn" | "info" | "log" | "debug";
|
|
2732
|
+
columns: number;
|
|
2733
|
+
debug: (...args: unknown[]) => void;
|
|
2734
|
+
debugWithSanitization: (label: string, ...args: unknown[]) => void;
|
|
2735
|
+
info: (...args: unknown[]) => void;
|
|
2736
|
+
log: (...args: unknown[]) => void;
|
|
2737
|
+
warn: (...args: unknown[]) => void;
|
|
2738
|
+
error: (...args: unknown[]) => void;
|
|
2739
|
+
table<Keys extends string>(data: TableRow<Keys>[]): void;
|
|
2740
|
+
private doLog;
|
|
2741
|
+
private formatMessage;
|
|
2742
|
+
}
|
|
2743
|
+
|
|
2465
2744
|
declare type LogLevel = "debug" | "info" | "log" | "warn" | "error" | "none";
|
|
2466
2745
|
|
|
2467
2746
|
declare type MaybePromise<T> = T | Promise<T>;
|
|
@@ -2666,16 +2945,19 @@ declare class MockScope<TData extends object = object> {
|
|
|
2666
2945
|
times(repeatTimes: number): MockScope<TData>;
|
|
2667
2946
|
}
|
|
2668
2947
|
|
|
2669
|
-
declare interface ModuleRule {
|
|
2670
|
-
type: "ESModule" | "CommonJS" | "NodeJSCompat" | "CompiledWasm" | "Text" | "Data";
|
|
2671
|
-
include?: string[];
|
|
2672
|
-
fallthrough?: boolean;
|
|
2673
|
-
}
|
|
2674
|
-
|
|
2675
2948
|
declare interface MultiCacheQueryOptions extends CacheQueryOptions {
|
|
2676
2949
|
cacheName?: string
|
|
2677
2950
|
}
|
|
2678
2951
|
|
|
2952
|
+
/**
|
|
2953
|
+
* Wrangler can provide Node.js compatibility in a number of different modes:
|
|
2954
|
+
* - "legacy" - this mode adds compile-time polyfills that are not well maintained and cannot work with workerd runtime builtins.
|
|
2955
|
+
* - "v1" - this mode tells the workerd runtime to enable some Node.js builtin libraries (accessible only via `node:...` imports) but no globals.
|
|
2956
|
+
* - "v2" - this mode tells the workerd runtime to enable more Node.js builtin libraries (accessible both with and without the `node:` prefix)
|
|
2957
|
+
* and also some Node.js globals such as `Buffer`; it also turns on additional compile-time polyfills for those that are not provided by the runtime.
|
|
2958
|
+
*/
|
|
2959
|
+
declare type NodeJSCompatMode = "legacy" | "v1" | "v2" | null;
|
|
2960
|
+
|
|
2679
2961
|
declare interface PagesConfigFields {
|
|
2680
2962
|
/**
|
|
2681
2963
|
* The directory of static assets to serve.
|
|
@@ -2744,6 +3026,10 @@ declare interface PagesDeployOptions {
|
|
|
2744
3026
|
* Default: true
|
|
2745
3027
|
*/
|
|
2746
3028
|
bundle?: boolean;
|
|
3029
|
+
/**
|
|
3030
|
+
* Whether to upload any server-side sourcemaps with this deployment
|
|
3031
|
+
*/
|
|
3032
|
+
sourceMaps: boolean;
|
|
2747
3033
|
/**
|
|
2748
3034
|
* Command line args passed to the `pages deploy` cmd
|
|
2749
3035
|
*/
|
|
@@ -23123,7 +23409,7 @@ declare namespace ProxyAgent {
|
|
|
23123
23409
|
}
|
|
23124
23410
|
}
|
|
23125
23411
|
|
|
23126
|
-
declare class ProxyController extends
|
|
23412
|
+
declare class ProxyController extends Controller<ProxyControllerEventMap> {
|
|
23127
23413
|
ready: DeferredPromise<ReadyEvent>;
|
|
23128
23414
|
proxyWorker?: Miniflare;
|
|
23129
23415
|
proxyWorkerOptions?: MiniflareOptions;
|
|
@@ -23147,17 +23433,19 @@ declare class ProxyController extends EventEmitter_2 {
|
|
|
23147
23433
|
teardown(): Promise<void>;
|
|
23148
23434
|
emitReadyEvent(proxyWorker: Miniflare): void;
|
|
23149
23435
|
emitPreviewTokenExpiredEvent(proxyData: ProxyData): void;
|
|
23150
|
-
emitErrorEvent(
|
|
23151
|
-
|
|
23152
|
-
on(event: "previewTokenExpired", listener: (_: PreviewTokenExpiredEvent) => void): this;
|
|
23153
|
-
on(event: "error", listener: (_: ErrorEvent) => void): this;
|
|
23154
|
-
once: typeof ProxyController.on;
|
|
23436
|
+
emitErrorEvent(data: ErrorEvent): void;
|
|
23437
|
+
emitErrorEvent(reason: string, cause?: Error | SerializedError): void;
|
|
23155
23438
|
}
|
|
23156
23439
|
|
|
23440
|
+
declare type ProxyControllerEventMap = ControllerEventMap & {
|
|
23441
|
+
ready: [ReadyEvent];
|
|
23442
|
+
previewTokenExpired: [PreviewTokenExpiredEvent];
|
|
23443
|
+
};
|
|
23444
|
+
|
|
23157
23445
|
declare type ProxyData = {
|
|
23158
23446
|
userWorkerUrl: UrlOriginParts;
|
|
23159
23447
|
userWorkerInspectorUrl: UrlOriginAndPathnameParts;
|
|
23160
|
-
userWorkerInnerUrlOverrides
|
|
23448
|
+
userWorkerInnerUrlOverrides?: Partial<UrlOriginParts>;
|
|
23161
23449
|
headers: Record<string, string>;
|
|
23162
23450
|
liveReload?: boolean;
|
|
23163
23451
|
proxyLogsToController?: boolean;
|
|
@@ -23183,20 +23471,10 @@ declare type ProxyWorkerOutgoingRequestBody = {
|
|
|
23183
23471
|
args: Parameters<typeof console.debug>;
|
|
23184
23472
|
};
|
|
23185
23473
|
|
|
23186
|
-
declare type
|
|
23187
|
-
$schema?: string;
|
|
23188
|
-
};
|
|
23474
|
+
declare type QueueConsumer = NonNullable<Config["queues"]["consumers"]>[number];
|
|
23189
23475
|
|
|
23190
23476
|
declare type RawDevConfig = Partial<DevConfig>;
|
|
23191
23477
|
|
|
23192
|
-
/**
|
|
23193
|
-
* The raw environment configuration that we read from the config file.
|
|
23194
|
-
*
|
|
23195
|
-
* All the properties are optional, and will be replaced with defaults in the configuration that
|
|
23196
|
-
* is used in the rest of the codebase.
|
|
23197
|
-
*/
|
|
23198
|
-
declare type RawEnvironment = Partial<Environment> & EnvironmentDeprecated;
|
|
23199
|
-
|
|
23200
23478
|
declare type ReadyEvent = {
|
|
23201
23479
|
type: "ready";
|
|
23202
23480
|
proxyWorker: Miniflare;
|
|
@@ -23222,14 +23500,14 @@ declare type ReferrerPolicy =
|
|
|
23222
23500
|
declare type ReloadCompleteEvent = {
|
|
23223
23501
|
type: "reloadComplete";
|
|
23224
23502
|
config: StartDevWorkerOptions;
|
|
23225
|
-
bundle:
|
|
23503
|
+
bundle: Bundle;
|
|
23226
23504
|
proxyData: ProxyData;
|
|
23227
23505
|
};
|
|
23228
23506
|
|
|
23229
23507
|
declare type ReloadStartEvent = {
|
|
23230
23508
|
type: "reloadStart";
|
|
23231
23509
|
config: StartDevWorkerOptions;
|
|
23232
|
-
bundle:
|
|
23510
|
+
bundle: Bundle;
|
|
23233
23511
|
};
|
|
23234
23512
|
|
|
23235
23513
|
declare class Request implements BodyMixin {
|
|
@@ -23490,19 +23768,20 @@ declare type Rule = {
|
|
|
23490
23768
|
fallthrough?: boolean;
|
|
23491
23769
|
};
|
|
23492
23770
|
|
|
23493
|
-
declare abstract class RuntimeController extends Controller {
|
|
23771
|
+
declare abstract class RuntimeController extends Controller<RuntimeControllerEventMap> {
|
|
23494
23772
|
abstract onBundleStart(_: BundleStartEvent): void;
|
|
23495
23773
|
abstract onBundleComplete(_: BundleCompleteEvent): void;
|
|
23496
23774
|
abstract onPreviewTokenExpired(_: PreviewTokenExpiredEvent): void;
|
|
23497
23775
|
abstract teardown(): Promise<void>;
|
|
23498
23776
|
abstract emitReloadStartEvent(data: ReloadStartEvent): void;
|
|
23499
|
-
abstract
|
|
23500
|
-
on(event: "reloadStart", listener: (_: ReloadStartEvent) => void): this;
|
|
23501
|
-
on(event: "reloadComplete", listener: (_: ReloadCompleteEvent) => void): this;
|
|
23502
|
-
on(event: "error", listener: (_: ErrorEvent) => void): this;
|
|
23503
|
-
once: typeof RuntimeController.on;
|
|
23777
|
+
abstract emitReloadCompleteEvent(data: ReloadCompleteEvent): void;
|
|
23504
23778
|
}
|
|
23505
23779
|
|
|
23780
|
+
declare type RuntimeControllerEventMap = ControllerEventMap & {
|
|
23781
|
+
reloadStart: [ReloadStartEvent];
|
|
23782
|
+
reloadComplete: [ReloadCompleteEvent];
|
|
23783
|
+
};
|
|
23784
|
+
|
|
23506
23785
|
/**
|
|
23507
23786
|
* Convert a MIMEType object to a string.
|
|
23508
23787
|
* @see https://mimesniff.spec.whatwg.org/#serialize-a-mime-type
|
|
@@ -23516,12 +23795,7 @@ declare type SerializedError = {
|
|
|
23516
23795
|
cause?: unknown;
|
|
23517
23796
|
};
|
|
23518
23797
|
|
|
23519
|
-
declare
|
|
23520
|
-
name: string;
|
|
23521
|
-
env?: string;
|
|
23522
|
-
}
|
|
23523
|
-
|
|
23524
|
-
declare type ServiceFetch = (request: Request_2) => Promise<Response_2>;
|
|
23798
|
+
declare type ServiceFetch = (request: Request_2) => Promise<Response_2> | Response_2;
|
|
23525
23799
|
|
|
23526
23800
|
declare function setCookie (headers: Headers, cookie: Cookie): void
|
|
23527
23801
|
|
|
@@ -23532,7 +23806,7 @@ declare function setGlobalOrigin(origin: string | URL | undefined): void;
|
|
|
23532
23806
|
declare type SimpleRoute = string;
|
|
23533
23807
|
|
|
23534
23808
|
export declare type SourcelessWorkerOptions = Omit<WorkerOptions, "script" | "scriptPath" | "modules" | "modulesRoot"> & {
|
|
23535
|
-
modulesRules?:
|
|
23809
|
+
modulesRules?: ModuleRule[];
|
|
23536
23810
|
};
|
|
23537
23811
|
|
|
23538
23812
|
/**
|
|
@@ -23558,7 +23832,7 @@ declare interface SpecIterator<T, TReturn = any, TNext = undefined> {
|
|
|
23558
23832
|
|
|
23559
23833
|
declare interface StartDevWorkerOptions {
|
|
23560
23834
|
/** The name of the worker. */
|
|
23561
|
-
name
|
|
23835
|
+
name?: string;
|
|
23562
23836
|
/**
|
|
23563
23837
|
* The javascript or typescript entry-point of the worker.
|
|
23564
23838
|
* This is the `main` property of a wrangler.toml.
|
|
@@ -23566,9 +23840,7 @@ declare interface StartDevWorkerOptions {
|
|
|
23566
23840
|
*/
|
|
23567
23841
|
script: File_2<string>;
|
|
23568
23842
|
/** The configuration of the worker. */
|
|
23569
|
-
config?: File_2<
|
|
23570
|
-
env?: string;
|
|
23571
|
-
};
|
|
23843
|
+
config?: File_2<Config>;
|
|
23572
23844
|
/** The compatibility date for the workerd runtime. */
|
|
23573
23845
|
compatibilityDate?: string;
|
|
23574
23846
|
/** The compatibility flags for the workerd runtime. */
|
|
@@ -23583,25 +23855,49 @@ declare interface StartDevWorkerOptions {
|
|
|
23583
23855
|
include?: string[];
|
|
23584
23856
|
exclude?: string[];
|
|
23585
23857
|
};
|
|
23858
|
+
/** Service environments. Providing support for existing workers with this property. Don't use this for new workers. */
|
|
23859
|
+
env?: string;
|
|
23860
|
+
/** Wrangler environments, defaults to true. */
|
|
23861
|
+
legacyEnv?: boolean;
|
|
23862
|
+
/**
|
|
23863
|
+
* Whether Wrangler should send usage metrics to Cloudflare for this project.
|
|
23864
|
+
*
|
|
23865
|
+
* When defined this will override any user settings.
|
|
23866
|
+
* Otherwise, Wrangler will use the user's preference.
|
|
23867
|
+
*/
|
|
23868
|
+
sendMetrics?: boolean;
|
|
23869
|
+
usageModel?: "bundled" | "unbound";
|
|
23870
|
+
_bindings?: CfWorkerInit["bindings"];
|
|
23871
|
+
_entry?: Entry;
|
|
23872
|
+
_projectRoot?: string;
|
|
23873
|
+
_serveAssetsFromWorker?: boolean;
|
|
23874
|
+
_assets?: Config["assets"];
|
|
23875
|
+
_processEntrypoint?: boolean;
|
|
23876
|
+
_additionalModules?: CfModule[];
|
|
23586
23877
|
/** Options applying to the worker's build step. Applies to deploy and dev. */
|
|
23587
23878
|
build?: {
|
|
23588
23879
|
/** Whether the worker and its dependencies are bundled. Defaults to true. */
|
|
23589
23880
|
bundle?: boolean;
|
|
23881
|
+
findAdditionalModules?: boolean;
|
|
23590
23882
|
/** Specifies types of modules matched by globs. */
|
|
23591
|
-
moduleRules?:
|
|
23592
|
-
/** Replace global identifiers with constant expressions, e.g.
|
|
23593
|
-
define
|
|
23883
|
+
moduleRules?: Rule[];
|
|
23884
|
+
/** Replace global identifiers with constant expressions, e.g. { debug: 'true', version: '"1.0.0"' }. Only takes effect if bundle: true. */
|
|
23885
|
+
define?: Record<string, string>;
|
|
23594
23886
|
/** Whether the bundled worker is minified. Only takes effect if bundle: true. */
|
|
23595
|
-
minify
|
|
23887
|
+
minify?: boolean;
|
|
23596
23888
|
/** Options controlling a custom build step. */
|
|
23597
23889
|
custom: {
|
|
23598
23890
|
/** Custom shell command to run before bundling. Runs even if bundle. */
|
|
23599
|
-
command
|
|
23891
|
+
command?: string;
|
|
23600
23892
|
/** The cwd to run the command in. */
|
|
23601
23893
|
workingDirectory?: string;
|
|
23602
23894
|
/** Filepath(s) to watch for changes. Upon changes, the command will be rerun. */
|
|
23603
23895
|
watch?: string | string[];
|
|
23604
23896
|
};
|
|
23897
|
+
jsxFactory?: string;
|
|
23898
|
+
jsxFragment?: string;
|
|
23899
|
+
tsconfig?: string;
|
|
23900
|
+
nodejsCompatMode?: NodeJSCompatMode;
|
|
23605
23901
|
};
|
|
23606
23902
|
/** Options applying to the worker's development preview environment. */
|
|
23607
23903
|
dev?: {
|
|
@@ -23634,7 +23930,7 @@ declare interface StartDevWorkerOptions {
|
|
|
23634
23930
|
httpsCertPath?: string;
|
|
23635
23931
|
};
|
|
23636
23932
|
/** Controls what request.url looks like inside the worker. */
|
|
23637
|
-
|
|
23933
|
+
origin?: {
|
|
23638
23934
|
hostname?: string;
|
|
23639
23935
|
secure?: boolean;
|
|
23640
23936
|
};
|
|
@@ -23642,6 +23938,9 @@ declare interface StartDevWorkerOptions {
|
|
|
23642
23938
|
outboundService?: ServiceFetch;
|
|
23643
23939
|
/** An undici MockAgent to declaratively mock fetch calls to particular resources. */
|
|
23644
23940
|
mockFetch?: undici.MockAgent;
|
|
23941
|
+
/** Gets a fetcher to a specific worker, used for multi-worker development */
|
|
23942
|
+
getRegisteredWorker?(name: string): WorkerDefinition | undefined;
|
|
23943
|
+
testScheduled?: boolean;
|
|
23645
23944
|
};
|
|
23646
23945
|
}
|
|
23647
23946
|
|
|
@@ -23652,6 +23951,8 @@ options: { dispatcher?: Dispatcher } & Omit<Dispatcher.RequestOptions, 'origin'
|
|
|
23652
23951
|
factory: Dispatcher.StreamFactory
|
|
23653
23952
|
): Promise<Dispatcher.StreamData>;
|
|
23654
23953
|
|
|
23954
|
+
declare type TableRow<Keys extends string> = Record<Keys, string>;
|
|
23955
|
+
|
|
23655
23956
|
declare type TailConsumer = {
|
|
23656
23957
|
/** The name of the service tail events will be forwarded to. */
|
|
23657
23958
|
service: string;
|
|
@@ -23664,30 +23965,35 @@ declare type Trigger = {
|
|
|
23664
23965
|
} | {
|
|
23665
23966
|
type: "route";
|
|
23666
23967
|
pattern: string;
|
|
23667
|
-
|
|
23668
|
-
} | {
|
|
23968
|
+
} | ({
|
|
23669
23969
|
type: "route";
|
|
23670
|
-
|
|
23671
|
-
zoneId: string;
|
|
23672
|
-
customDomain?: true;
|
|
23673
|
-
zoneName?: never;
|
|
23674
|
-
} | {
|
|
23970
|
+
} & ZoneIdRoute) | ({
|
|
23675
23971
|
type: "route";
|
|
23676
|
-
|
|
23677
|
-
|
|
23678
|
-
|
|
23679
|
-
|
|
23680
|
-
|
|
23681
|
-
|
|
23682
|
-
schedule: string;
|
|
23683
|
-
} | {
|
|
23972
|
+
} & ZoneNameRoute) | ({
|
|
23973
|
+
type: "route";
|
|
23974
|
+
} & CustomDomainRoute) | {
|
|
23975
|
+
type: "cron";
|
|
23976
|
+
cron: string;
|
|
23977
|
+
} | ({
|
|
23684
23978
|
type: "queue-consumer";
|
|
23685
|
-
|
|
23686
|
-
|
|
23687
|
-
|
|
23688
|
-
|
|
23689
|
-
|
|
23690
|
-
|
|
23979
|
+
} & QueueConsumer);
|
|
23980
|
+
|
|
23981
|
+
declare interface TypedEventEmitter<EventMap extends Record<string | symbol, unknown[]>> extends EventEmitter_2 {
|
|
23982
|
+
addListener<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
|
|
23983
|
+
on<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
|
|
23984
|
+
once<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
|
|
23985
|
+
removeListener<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
|
|
23986
|
+
off<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
|
|
23987
|
+
removeAllListeners(event?: keyof EventMap): this;
|
|
23988
|
+
listeners<Name extends keyof EventMap>(eventName: Name): ((...args: EventMap[Name]) => void)[];
|
|
23989
|
+
rawListeners<Name extends keyof EventMap>(eventName: Name): ((...args: EventMap[Name]) => void)[];
|
|
23990
|
+
emit<Name extends keyof EventMap>(eventName: Name, ...args: EventMap[Name]): boolean;
|
|
23991
|
+
listenerCount<Name extends keyof EventMap>(eventName: Name, listener?: (...args: EventMap[Name]) => void): number;
|
|
23992
|
+
prependListener<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
|
|
23993
|
+
prependOnceListener<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
|
|
23994
|
+
}
|
|
23995
|
+
|
|
23996
|
+
declare const TypedEventEmitterImpl: new <EventMap extends Record<string | symbol, unknown[]>>() => TypedEventEmitter<EventMap>;
|
|
23691
23997
|
|
|
23692
23998
|
declare namespace Undici {
|
|
23693
23999
|
var Dispatcher: Dispatcher
|
|
@@ -23829,6 +24135,8 @@ export declare class unstable_DevEnv extends EventEmitter_2 {
|
|
|
23829
24135
|
emitErrorEvent(ev: ErrorEvent): void;
|
|
23830
24136
|
}
|
|
23831
24137
|
|
|
24138
|
+
export declare const unstable_generateASSETSBinding: (opts: UnstableASSETSBindingsOptions) => (request: Request_2) => Promise<Response_2>;
|
|
24139
|
+
|
|
23832
24140
|
export declare function unstable_getMiniflareWorkerOptions(configPath: string, environment?: string): {
|
|
23833
24141
|
workerOptions: SourcelessWorkerOptions;
|
|
23834
24142
|
define: Record<string, string>;
|
|
@@ -23849,6 +24157,12 @@ export declare function unstable_startWorkerRegistryServer(port: number): Promis
|
|
|
23849
24157
|
terminator: HttpTerminator;
|
|
23850
24158
|
}>;
|
|
23851
24159
|
|
|
24160
|
+
export declare interface UnstableASSETSBindingsOptions {
|
|
24161
|
+
log: Logger;
|
|
24162
|
+
proxyPort?: number;
|
|
24163
|
+
directory?: string;
|
|
24164
|
+
}
|
|
24165
|
+
|
|
23852
24166
|
export declare interface UnstableDevOptions {
|
|
23853
24167
|
config?: string;
|
|
23854
24168
|
env?: string;
|
|
@@ -23903,7 +24217,6 @@ export declare interface UnstableDevOptions {
|
|
|
23903
24217
|
inspect?: boolean;
|
|
23904
24218
|
local?: boolean;
|
|
23905
24219
|
accountId?: string;
|
|
23906
|
-
updateCheck?: boolean;
|
|
23907
24220
|
experimental?: {
|
|
23908
24221
|
processEntrypoint?: boolean;
|
|
23909
24222
|
additionalModules?: CfModule[];
|
|
@@ -23917,6 +24230,7 @@ export declare interface UnstableDevOptions {
|
|
|
23917
24230
|
testMode?: boolean;
|
|
23918
24231
|
testScheduled?: boolean;
|
|
23919
24232
|
watch?: boolean;
|
|
24233
|
+
devEnv?: boolean;
|
|
23920
24234
|
};
|
|
23921
24235
|
}
|
|
23922
24236
|
|
|
@@ -24011,6 +24325,21 @@ declare interface WebSocketInit {
|
|
|
24011
24325
|
headers?: HeadersInit
|
|
24012
24326
|
}
|
|
24013
24327
|
|
|
24328
|
+
declare type WorkerDefinition = {
|
|
24329
|
+
port: number | undefined;
|
|
24330
|
+
protocol: "http" | "https" | undefined;
|
|
24331
|
+
host: string | undefined;
|
|
24332
|
+
mode: "local" | "remote";
|
|
24333
|
+
headers?: Record<string, string>;
|
|
24334
|
+
entrypointAddresses?: WorkerEntrypointsDefinition;
|
|
24335
|
+
durableObjects: {
|
|
24336
|
+
name: string;
|
|
24337
|
+
className: string;
|
|
24338
|
+
}[];
|
|
24339
|
+
durableObjectsHost?: string;
|
|
24340
|
+
durableObjectsPort?: number;
|
|
24341
|
+
};
|
|
24342
|
+
|
|
24014
24343
|
declare type WorkerEntrypointsDefinition = Record<"default" | string, {
|
|
24015
24344
|
host: string;
|
|
24016
24345
|
port: number;
|