wrangler 0.0.0-ecdfabed0 → 0.0.0-ecef68635

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.
@@ -14,7 +14,7 @@ import type * as kvAssetHandler from "@cloudflare/kv-asset-handler";
14
14
 
15
15
  const ASSET_MANIFEST = JSON.parse(manifest);
16
16
 
17
- const staticAssets: Middleware = async (request, env, _ctx, middlewareCtx) => {
17
+ const staticAssets: Middleware = async (request, env, ctx, middlewareCtx) => {
18
18
  let options: Partial<Options> = {
19
19
  ASSET_MANIFEST,
20
20
  ASSET_NAMESPACE: env.__STATIC_CONTENT,
@@ -27,7 +27,7 @@ const staticAssets: Middleware = async (request, env, _ctx, middlewareCtx) => {
27
27
  {
28
28
  request,
29
29
  waitUntil(promise) {
30
- return _ctx.waitUntil(promise);
30
+ return ctx.waitUntil(promise);
31
31
  },
32
32
  },
33
33
  options
@@ -16,6 +16,7 @@ import { Miniflare } from 'miniflare';
16
16
  import type { MiniflareOptions } from 'miniflare';
17
17
  import type { ModuleRule } from 'miniflare';
18
18
  import { Mutex } from 'miniflare';
19
+ import type { NodeJSCompatMode } from 'miniflare';
19
20
  import { Readable } from 'stream';
20
21
  import { ReadableStream } from 'stream/web';
21
22
  import type { Request as Request_2 } from 'miniflare';
@@ -30,6 +31,7 @@ import { UrlObject } from 'url';
30
31
  import { URLSearchParams as URLSearchParams_2 } from 'url';
31
32
  import type { WorkerOptions } from 'miniflare';
32
33
  import { Writable } from 'stream';
34
+ import { z } from 'zod';
33
35
 
34
36
  declare type AbortSignal_2 = unknown;
35
37
 
@@ -72,6 +74,32 @@ declare type ApiCredentials = {
72
74
  authEmail: string;
73
75
  };
74
76
 
77
+ declare type AssetConfig = z.infer<typeof AssetConfigSchema>;
78
+
79
+ declare const AssetConfigSchema: z.ZodObject<{
80
+ html_handling: z.ZodOptional<z.ZodEnum<["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]>>;
81
+ not_found_handling: z.ZodOptional<z.ZodEnum<["single-page-application", "404-page", "none"]>>;
82
+ }, "strip", z.ZodTypeAny, {
83
+ html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
84
+ not_found_handling?: "none" | "single-page-application" | "404-page";
85
+ }, {
86
+ html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
87
+ not_found_handling?: "none" | "single-page-application" | "404-page";
88
+ }>;
89
+
90
+ declare type Assets = {
91
+ /** Absolute path to assets directory */
92
+ directory: string;
93
+ binding?: string;
94
+ html_handling?: "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash" | "none";
95
+ not_found_handling?: "single-page-application" | "404-page" | "none";
96
+ };
97
+
98
+ declare type AssetsOptions = Pick<Assets, "directory" | "binding"> & {
99
+ routingConfig: RoutingConfig;
100
+ assetConfig: AssetConfig;
101
+ };
102
+
75
103
  declare type AsyncHook<T extends HookValues, Args extends unknown[] = []> = Hook<T, Args> | Hook<Promise<T>, Args>;
76
104
 
77
105
  declare class BalancedPool extends Dispatcher {
@@ -148,6 +176,8 @@ declare type Binding = {
148
176
  } & Omit<CfDispatchNamespace, "binding">) | ({
149
177
  type: "mtls_certificate";
150
178
  } & Omit<CfMTlsCertificate, "binding">) | ({
179
+ type: "pipeline";
180
+ } & Omit<CfPipeline, "binding">) | ({
151
181
  type: "logfwdr";
152
182
  } & Omit<CfLogfwdrBinding, "name">) | {
153
183
  type: `unsafe_${string}`;
@@ -176,7 +206,7 @@ declare type BodyInit =
176
206
  | ArrayBuffer
177
207
  | AsyncIterable<Uint8Array>
178
208
  | Blob_2
179
- | FormData
209
+ | FormData_2
180
210
  | Iterable<Uint8Array>
181
211
  | NodeJS.ArrayBufferView
182
212
  | URLSearchParams_2
@@ -189,7 +219,7 @@ declare interface BodyMixin {
189
219
 
190
220
  readonly arrayBuffer: () => Promise<ArrayBuffer>
191
221
  readonly blob: () => Promise<Blob_2>
192
- readonly formData: () => Promise<FormData>
222
+ readonly formData: () => Promise<FormData_2>
193
223
  readonly json: () => Promise<unknown>
194
224
  readonly text: () => Promise<string>
195
225
  }
@@ -519,6 +549,11 @@ declare interface CfMTlsCertificate {
519
549
  certificate_id: string;
520
550
  }
521
551
 
552
+ declare interface CfPipeline {
553
+ binding: string;
554
+ pipeline: string;
555
+ }
556
+
522
557
  declare interface CfQueue {
523
558
  binding: string;
524
559
  queue_name: string;
@@ -742,7 +777,7 @@ declare class ConfigController extends Controller<ConfigControllerEventMap> {
742
777
  #private;
743
778
  latestInput?: StartDevWorkerInput;
744
779
  latestConfig?: StartDevWorkerOptions;
745
- set(input: StartDevWorkerInput): Promise<StartDevWorkerOptions | undefined>;
780
+ set(input: StartDevWorkerInput, throwErrors?: boolean): Promise<StartDevWorkerOptions | undefined>;
746
781
  patch(input: Partial<StartDevWorkerInput>): Promise<StartDevWorkerOptions | undefined>;
747
782
  teardown(): Promise<void>;
748
783
  emitConfigUpdateEvent(config: StartDevWorkerOptions): void;
@@ -815,9 +850,11 @@ declare interface ConfigFields<Dev extends RawDevConfig> {
815
850
  exclude?: string[];
816
851
  } | undefined;
817
852
  /**
818
- * Serve a folder of static assets with your Worker, without any additional code.
819
- * This can either be a string, or an object with additional config fields.
820
- * Only one of assets and legacy_assets can be used.
853
+ * Old behaviour of serving a folder of static assets with your Worker,
854
+ * without any additional code.
855
+ * This can either be a string, or an object with additional config
856
+ * fields.
857
+ * Will be deprecated in the near future in favor of `assets`.
821
858
  */
822
859
  legacy_assets: {
823
860
  bucket: string;
@@ -960,13 +997,13 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
960
997
  type: string;
961
998
  };
962
999
  latest_stage: {
963
- name: "build" | "deploy" | "queued" | "initialize" | "clone_repo";
1000
+ name: "queued" | "build" | "deploy" | "initialize" | "clone_repo";
964
1001
  status: "active" | "idle" | "canceled" | "success" | "failure" | "skipped";
965
1002
  started_on: string | null;
966
1003
  ended_on: string | null;
967
1004
  };
968
1005
  stages: {
969
- name: "build" | "deploy" | "queued" | "initialize" | "clone_repo";
1006
+ name: "queued" | "build" | "deploy" | "initialize" | "clone_repo";
970
1007
  status: "active" | "idle" | "canceled" | "success" | "failure" | "skipped";
971
1008
  started_on: string | null;
972
1009
  ended_on: string | null;
@@ -975,7 +1012,6 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
975
1012
  modified_on: string;
976
1013
  short_id: string;
977
1014
  build_image_major_version: number;
978
- kv_namespaces?: any;
979
1015
  source?: {
980
1016
  type: "github" | "gitlab";
981
1017
  config: {
@@ -990,6 +1026,7 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
990
1026
  preview_branch_excludes?: string[] | undefined;
991
1027
  };
992
1028
  } | undefined;
1029
+ kv_namespaces?: any;
993
1030
  env_vars?: any;
994
1031
  durable_object_namespaces?: any;
995
1032
  is_skipped?: boolean | undefined;
@@ -1224,7 +1261,7 @@ declare namespace Dispatcher {
1224
1261
  path: string;
1225
1262
  method: HttpMethod;
1226
1263
  /** Default: `null` */
1227
- body?: string | Buffer | Uint8Array | Readable | null | FormData;
1264
+ body?: string | Buffer | Uint8Array | Readable | null | FormData_2;
1228
1265
  /** Default: `null` */
1229
1266
  headers?: IncomingHttpHeaders | string[] | null;
1230
1267
  /** Query string params to be embedded in the request URL. Default: `null` */
@@ -1390,6 +1427,25 @@ declare type DurableObjectBindings = {
1390
1427
  environment?: string;
1391
1428
  }[];
1392
1429
 
1430
+ /**
1431
+ * Configuration in wrangler for Durable Object Migrations
1432
+ */
1433
+ declare type DurableObjectMigration = {
1434
+ /** A unique identifier for this migration. */
1435
+ tag: string;
1436
+ /** The new Durable Objects being defined. */
1437
+ new_classes?: string[];
1438
+ /** The new SQLite Durable Objects being defined. */
1439
+ new_sqlite_classes?: string[];
1440
+ /** The Durable Objects being renamed. */
1441
+ renamed_classes?: {
1442
+ from: string;
1443
+ to: string;
1444
+ }[];
1445
+ /** The Durable Objects being removed. */
1446
+ deleted_classes?: string[];
1447
+ };
1448
+
1393
1449
  declare interface EnablePagesAssetsServiceBindingOptions {
1394
1450
  proxyPort?: number;
1395
1451
  directory?: string;
@@ -1554,21 +1610,7 @@ declare interface EnvironmentInheritable {
1554
1610
  * @default []
1555
1611
  * @inheritable
1556
1612
  */
1557
- migrations: {
1558
- /** A unique identifier for this migration. */
1559
- tag: string;
1560
- /** The new Durable Objects being defined. */
1561
- new_classes?: string[];
1562
- /** The new SQLite Durable Objects being defined. */
1563
- new_sqlite_classes?: string[];
1564
- /** The Durable Objects being renamed. */
1565
- renamed_classes?: {
1566
- from: string;
1567
- to: string;
1568
- }[];
1569
- /** The Durable Objects being removed. */
1570
- deleted_classes?: string[];
1571
- }[];
1613
+ migrations: DurableObjectMigration[];
1572
1614
  /**
1573
1615
  * "Cron" definitions to trigger a Worker's "scheduled" function.
1574
1616
  *
@@ -1698,13 +1740,22 @@ declare interface EnvironmentInheritable {
1698
1740
  */
1699
1741
  placement: {
1700
1742
  mode: "off" | "smart";
1743
+ hint?: string;
1701
1744
  } | undefined;
1702
1745
  /**
1703
1746
  * Specify the directory of static assets to deploy/serve
1704
1747
  *
1748
+ * More details at https://developers.cloudflare.com/workers/frameworks/
1749
+ *
1750
+ * @inheritable
1751
+ */
1752
+ assets: Assets | undefined;
1753
+ /**
1754
+ * Specify the observability behavior of the Worker.
1755
+ *
1705
1756
  * @inheritable
1706
1757
  */
1707
- experimental_assets: ExperimentalAssets | undefined;
1758
+ observability: Observability | undefined;
1708
1759
  }
1709
1760
 
1710
1761
  /**
@@ -2062,6 +2113,21 @@ declare interface EnvironmentNonInheritable {
2062
2113
  /** Details about the outbound Worker which will handle outbound requests from your namespace */
2063
2114
  outbound?: DispatchNamespaceOutbound;
2064
2115
  }[];
2116
+ /**
2117
+ * Specifies list of Pipelines bound to this Worker environment
2118
+ *
2119
+ * NOTE: This field is not automatically inherited from the top level environment,
2120
+ * and so must be specified in every named environment.
2121
+ *
2122
+ * @default `[]`
2123
+ * @nonInheritable
2124
+ */
2125
+ pipelines: {
2126
+ /** The binding name used to refer to the bound service. */
2127
+ binding: string;
2128
+ /** Name of the Pipeline to bind */
2129
+ pipeline: string;
2130
+ }[];
2065
2131
  }
2066
2132
 
2067
2133
  declare type ErrorEvent = BaseErrorEvent<"ConfigController" | "BundlerController" | "LocalRuntimeController" | "RemoteRuntimeController" | "ProxyWorker" | "InspectorProxyWorker"> | BaseErrorEvent<"ProxyController", {
@@ -2273,16 +2339,6 @@ declare class ExecutionContext {
2273
2339
  passThroughOnException(): void;
2274
2340
  }
2275
2341
 
2276
- declare type ExperimentalAssets = {
2277
- /** Absolute path to assets directory */
2278
- directory: string;
2279
- binding?: string;
2280
- };
2281
-
2282
- declare interface ExperimentalAssetsOptions extends ExperimentalAssets {
2283
- routingConfig: RoutingConfig;
2284
- }
2285
-
2286
2342
  declare function fetch (
2287
2343
  input: RequestInfo,
2288
2344
  init?: RequestInit
@@ -2362,7 +2418,7 @@ declare class FileReader {
2362
2418
  /**
2363
2419
  * Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using fetch().
2364
2420
  */
2365
- declare class FormData {
2421
+ declare class FormData_2 {
2366
2422
  /**
2367
2423
  * Appends a new value onto an existing key inside a FormData object,
2368
2424
  * or adds the key if it does not already exist.
@@ -2427,7 +2483,7 @@ declare class FormData {
2427
2483
  * Executes given callback function for each field of the FormData instance
2428
2484
  */
2429
2485
  forEach: (
2430
- callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData) => void,
2486
+ callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData_2) => void,
2431
2487
  thisArg?: unknown
2432
2488
  ) => void
2433
2489
 
@@ -2602,7 +2658,9 @@ declare interface Interceptable extends Dispatcher {
2602
2658
  declare class Logger {
2603
2659
  #private;
2604
2660
  constructor();
2605
- loggerLevel: "error" | "none" | "warn" | "info" | "log" | "debug";
2661
+ private overrideLoggerLevel?;
2662
+ get loggerLevel(): "error" | "none" | "warn" | "info" | "log" | "debug";
2663
+ set loggerLevel(val: "error" | "none" | "warn" | "info" | "log" | "debug");
2606
2664
  columns: number;
2607
2665
  debug: (...args: unknown[]) => void;
2608
2666
  debugWithSanitization: (label: string, ...args: unknown[]) => void;
@@ -2828,15 +2886,12 @@ declare interface MultiCacheQueryOptions extends CacheQueryOptions {
2828
2886
  cacheName?: string
2829
2887
  }
2830
2888
 
2831
- /**
2832
- * Wrangler can provide Node.js compatibility in a number of different modes:
2833
- * - "legacy" - this mode adds compile-time polyfills that are not well maintained and cannot work with workerd runtime builtins.
2834
- * - "als": this mode tells the workerd runtime to enable only the Async Local Storage builtin library (accessible via `node:async_hooks`).
2835
- * - "v1" - this mode tells the workerd runtime to enable some Node.js builtin libraries (accessible only via `node:...` imports) but no globals.
2836
- * - "v2" - this mode tells the workerd runtime to enable more Node.js builtin libraries (accessible both with and without the `node:` prefix)
2837
- * 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.
2838
- */
2839
- declare type NodeJSCompatMode = "legacy" | "als" | "v1" | "v2" | null;
2889
+ declare interface Observability {
2890
+ /** If observability is enabled for this Worker */
2891
+ enabled: boolean;
2892
+ /** The sampling rate */
2893
+ head_sampling_rate?: number;
2894
+ }
2840
2895
 
2841
2896
  declare interface PagesConfigFields {
2842
2897
  /**
@@ -25536,7 +25591,7 @@ declare class Request implements BodyMixin {
25536
25591
 
25537
25592
  readonly arrayBuffer: () => Promise<ArrayBuffer>
25538
25593
  readonly blob: () => Promise<Blob_2>
25539
- readonly formData: () => Promise<FormData>
25594
+ readonly formData: () => Promise<FormData_2>
25540
25595
  readonly json: () => Promise<unknown>
25541
25596
  readonly text: () => Promise<string>
25542
25597
 
@@ -25620,7 +25675,7 @@ declare class Response implements BodyMixin {
25620
25675
 
25621
25676
  readonly arrayBuffer: () => Promise<ArrayBuffer>
25622
25677
  readonly blob: () => Promise<Blob_2>
25623
- readonly formData: () => Promise<FormData>
25678
+ readonly formData: () => Promise<FormData_2>
25624
25679
  readonly json: () => Promise<unknown>
25625
25680
  readonly text: () => Promise<string>
25626
25681
 
@@ -25762,9 +25817,15 @@ declare namespace RetryHandler {
25762
25817
 
25763
25818
  declare type Route = SimpleRoute | ZoneIdRoute | ZoneNameRoute | CustomDomainRoute;
25764
25819
 
25765
- declare type RoutingConfig = {
25766
- hasUserWorker: boolean;
25767
- };
25820
+ declare type RoutingConfig = z.infer<typeof RoutingConfigSchema>;
25821
+
25822
+ declare const RoutingConfigSchema: z.ZodObject<{
25823
+ has_user_worker: z.ZodOptional<z.ZodBoolean>;
25824
+ }, "strip", z.ZodTypeAny, {
25825
+ has_user_worker?: boolean;
25826
+ }, {
25827
+ has_user_worker?: boolean;
25828
+ }>;
25768
25829
 
25769
25830
  /**
25770
25831
  * A bundling resolver rule, defining the modules type for paths that match the specified globs.
@@ -25855,6 +25916,7 @@ declare interface StartDevWorkerInput {
25855
25916
  env?: string;
25856
25917
  /** The bindings available to the worker. The specified bindind type will be exposed to the worker on the `env` object under the same key. */
25857
25918
  bindings?: Record<string, Binding>;
25919
+ migrations?: DurableObjectMigration[];
25858
25920
  /** The triggers which will cause the worker's exported default handlers to be called. */
25859
25921
  triggers?: Trigger[];
25860
25922
  /**
@@ -25941,12 +26003,10 @@ declare interface StartDevWorkerInput {
25941
26003
  enableServiceEnvironments?: boolean;
25942
26004
  };
25943
26005
  unsafe?: Omit<CfUnsafe, "bindings">;
25944
- experimental?: {
25945
- assets?: Omit<ExperimentalAssetsOptions, "bindings">;
25946
- };
26006
+ assets?: string;
25947
26007
  }
25948
26008
 
25949
- declare type StartDevWorkerOptions = StartDevWorkerInput & {
26009
+ declare type StartDevWorkerOptions = Omit<StartDevWorkerInput, "assets"> & {
25950
26010
  /** A worker's directory. Usually where the wrangler.toml file is located */
25951
26011
  directory: string;
25952
26012
  build: StartDevWorkerInput["build"] & {
@@ -25966,6 +26026,7 @@ declare type StartDevWorkerOptions = StartDevWorkerInput & {
25966
26026
  persist: string;
25967
26027
  };
25968
26028
  entrypoint: string;
26029
+ assets?: AssetsOptions;
25969
26030
  };
25970
26031
 
25971
26032
  /** A faster version of `request`. */
@@ -26048,7 +26109,7 @@ declare namespace Undici {
26048
26109
  var Headers: Headers;
26049
26110
  var Response: Response;
26050
26111
  var Request: Request;
26051
- var FormData: FormData;
26112
+ var FormData: FormData_2;
26052
26113
  var File: File;
26053
26114
  var FileReader: FileReader;
26054
26115
  var caches: caches;
@@ -26116,7 +26177,7 @@ declare namespace undici {
26116
26177
  ProgressEventInit,
26117
26178
  ProgressEvent,
26118
26179
  FormDataEntryValue,
26119
- FormData,
26180
+ FormData_2 as FormData,
26120
26181
  DiagnosticsChannel,
26121
26182
  BinaryType,
26122
26183
  WebSocketEventMap,
@@ -26198,7 +26259,7 @@ export declare interface UnstableDevOptions {
26198
26259
  localProtocol?: "http" | "https";
26199
26260
  httpsKeyPath?: string;
26200
26261
  httpsCertPath?: string;
26201
- experimentalAssets?: string;
26262
+ assets?: string;
26202
26263
  legacyAssets?: string;
26203
26264
  site?: string;
26204
26265
  siteInclude?: string[];