wrangler 4.19.2 → 4.20.1

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.
@@ -163,8 +163,8 @@
163
163
  },
164
164
  "keep_names": {
165
165
  "type": "boolean",
166
- "description": "Keep function names after javascript transpilations.",
167
- "default": "{true}"
166
+ "description": "Set the `name` property to the original name for functions and classes renamed during minification.\n\nSee https://esbuild.github.io/api/#keep-names",
167
+ "default": true
168
168
  },
169
169
  "first_party_worker": {
170
170
  "type": "boolean",
@@ -807,6 +807,10 @@
807
807
  "certificate_id": {
808
808
  "type": "string",
809
809
  "description": "The uuid of the uploaded mTLS certificate"
810
+ },
811
+ "remote": {
812
+ "type": "boolean",
813
+ "description": "Whether the mtls fetcher should be remote or not (only available under `--x-mixed-mode`)"
810
814
  }
811
815
  },
812
816
  "required": [
@@ -908,6 +912,28 @@
908
912
  "description": "Specifies Secret Store bindings that are bound to this Worker environment.\n\nNOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.",
909
913
  "default": []
910
914
  },
915
+ "unsafe_hello_world": {
916
+ "type": "array",
917
+ "items": {
918
+ "type": "object",
919
+ "properties": {
920
+ "binding": {
921
+ "type": "string",
922
+ "description": "The binding name used to refer to the bound service."
923
+ },
924
+ "enable_timer": {
925
+ "type": "boolean",
926
+ "description": "Whether the timer is enabled"
927
+ }
928
+ },
929
+ "required": [
930
+ "binding"
931
+ ],
932
+ "additionalProperties": false
933
+ },
934
+ "description": "**DO NOT USE**. Hello World Binding Config to serve as an explanatory example.\n\nNOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.",
935
+ "default": []
936
+ },
911
937
  "pages_build_output_dir": {
912
938
  "type": "string",
913
939
  "description": "The directory of static assets to serve.\n\nThe presence of this field in a Wrangler configuration file indicates a Pages project, and will prompt the handling of the configuration file according to the Pages-specific validation rules."
@@ -1143,8 +1169,8 @@
1143
1169
  },
1144
1170
  "keep_names": {
1145
1171
  "type": "boolean",
1146
- "description": "Keep function names after javascript transpilations.",
1147
- "default": "{true}"
1172
+ "description": "Set the `name` property to the original name for functions and classes renamed during minification.\n\nSee https://esbuild.github.io/api/#keep-names",
1173
+ "default": true
1148
1174
  },
1149
1175
  "first_party_worker": {
1150
1176
  "type": "boolean",
@@ -1787,6 +1813,10 @@
1787
1813
  "certificate_id": {
1788
1814
  "type": "string",
1789
1815
  "description": "The uuid of the uploaded mTLS certificate"
1816
+ },
1817
+ "remote": {
1818
+ "type": "boolean",
1819
+ "description": "Whether the mtls fetcher should be remote or not (only available under `--x-mixed-mode`)"
1790
1820
  }
1791
1821
  },
1792
1822
  "required": [
@@ -1887,6 +1917,28 @@
1887
1917
  },
1888
1918
  "description": "Specifies Secret Store bindings that are bound to this Worker environment.\n\nNOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.",
1889
1919
  "default": []
1920
+ },
1921
+ "unsafe_hello_world": {
1922
+ "type": "array",
1923
+ "items": {
1924
+ "type": "object",
1925
+ "properties": {
1926
+ "binding": {
1927
+ "type": "string",
1928
+ "description": "The binding name used to refer to the bound service."
1929
+ },
1930
+ "enable_timer": {
1931
+ "type": "boolean",
1932
+ "description": "Whether the timer is enabled"
1933
+ }
1934
+ },
1935
+ "required": [
1936
+ "binding"
1937
+ ],
1938
+ "additionalProperties": false
1939
+ },
1940
+ "description": "**DO NOT USE**. Hello World Binding Config to serve as an explanatory example.\n\nNOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.",
1941
+ "default": []
1890
1942
  }
1891
1943
  },
1892
1944
  "additionalProperties": false,
@@ -2097,8 +2149,18 @@
2097
2149
  "description": "How to handle requests that do not match an asset."
2098
2150
  },
2099
2151
  "run_worker_first": {
2100
- "type": "boolean",
2101
- "description": "If true, route every request to the User Worker, whether or not it matches an asset. If false, then respond to requests that match an asset with that asset directly."
2152
+ "anyOf": [
2153
+ {
2154
+ "type": "array",
2155
+ "items": {
2156
+ "type": "string"
2157
+ }
2158
+ },
2159
+ {
2160
+ "type": "boolean"
2161
+ }
2162
+ ],
2163
+ "description": "Matches will be routed to the User Worker, and matches to negative rules will go to the Asset Worker.\n\nCan also be `true`, indicating that every request should be routed to the User Worker."
2102
2164
  }
2103
2165
  },
2104
2166
  "additionalProperties": false
@@ -2400,13 +2462,6 @@
2400
2462
  "full_manual"
2401
2463
  ],
2402
2464
  "description": "How a rollout should be created. It supports the following modes: - full_auto: The container application will be rolled out fully automatically. - none: The container application won't have a roll out or update. - manual: The container application will be rollout fully by manually actioning progress steps."
2403
- },
2404
- "dev_exposed_ports": {
2405
- "type": "array",
2406
- "items": {
2407
- "type": "number"
2408
- },
2409
- "description": "Ports to be exposed by the container application. Only applies to dev, on non-linux machines, and if the Dockerfile doesn't already declare exposed ports."
2410
2465
  }
2411
2466
  },
2412
2467
  "required": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "4.19.2",
3
+ "version": "4.20.1",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -50,19 +50,19 @@
50
50
  "config-schema.json"
51
51
  ],
52
52
  "dependencies": {
53
- "@cloudflare/unenv-preset": "2.3.2",
53
+ "@cloudflare/unenv-preset": "2.3.3",
54
54
  "blake3-wasm": "2.1.5",
55
55
  "esbuild": "0.25.4",
56
56
  "path-to-regexp": "6.3.0",
57
57
  "unenv": "2.0.0-rc.17",
58
- "workerd": "1.20250604.0",
58
+ "workerd": "1.20250612.0",
59
59
  "@cloudflare/kv-asset-handler": "0.4.0",
60
- "miniflare": "4.20250604.0"
60
+ "miniflare": "4.20250612.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@aws-sdk/client-s3": "^3.721.0",
64
64
  "@cloudflare/types": "6.18.4",
65
- "@cloudflare/workers-types": "^4.20250604.0",
65
+ "@cloudflare/workers-types": "^4.20250612.0",
66
66
  "@cspotcode/source-map-support": "0.8.1",
67
67
  "@iarna/toml": "^3.0.0",
68
68
  "@sentry/node": "^7.86.0",
@@ -83,7 +83,7 @@
83
83
  "@types/supports-color": "^8.1.1",
84
84
  "@types/ws": "^8.5.7",
85
85
  "@types/yargs": "^17.0.22",
86
- "@vitest/ui": "~3.1.1",
86
+ "@vitest/ui": "~3.2.0",
87
87
  "@webcontainer/env": "^1.1.0",
88
88
  "chalk": "^5.2.0",
89
89
  "chokidar": "^4.0.1",
@@ -129,20 +129,21 @@
129
129
  "typescript": "^5.7.2",
130
130
  "undici": "^5.28.5",
131
131
  "update-check": "^1.5.4",
132
- "vitest": "~3.1.1",
132
+ "vitest": "~3.2.0",
133
133
  "vitest-websocket-mock": "^0.4.0",
134
134
  "ws": "8.18.0",
135
135
  "xdg-app-paths": "^8.3.0",
136
136
  "xxhash-wasm": "^1.0.1",
137
137
  "yargs": "^17.7.2",
138
138
  "@cloudflare/cli": "1.1.1",
139
+ "@cloudflare/containers-shared": "0.1.0",
139
140
  "@cloudflare/eslint-config-worker": "1.1.0",
140
- "@cloudflare/pages-shared": "^0.13.44",
141
+ "@cloudflare/pages-shared": "^0.13.46",
141
142
  "@cloudflare/workers-shared": "0.17.6",
142
143
  "@cloudflare/workers-tsconfig": "0.0.0"
143
144
  },
144
145
  "peerDependencies": {
145
- "@cloudflare/workers-types": "^4.20250604.0"
146
+ "@cloudflare/workers-types": "^4.20250612.0"
146
147
  },
147
148
  "peerDependenciesMeta": {
148
149
  "@cloudflare/workers-types": {
@@ -1,4 +1,4 @@
1
- import { Json, DispatchFetch, WorkerOptions, NodeJSCompatMode, Request, Response as Response$1, Miniflare, MiniflareOptions, Mutex, ModuleRule, MixedModeConnectionString } from 'miniflare';
1
+ import { Json, Request, Response as Response$1, DispatchFetch, WorkerOptions, NodeJSCompatMode, Miniflare, MiniflareOptions, Mutex, ModuleRule, MixedModeConnectionString } from 'miniflare';
2
2
  import * as undici from 'undici';
3
3
  import { RequestInfo, RequestInit, Response, FormData } from 'undici';
4
4
  import { RouterConfig, AssetConfig } from '@cloudflare/workers-shared';
@@ -100,10 +100,6 @@ type ContainerApp = {
100
100
  * - manual: The container application will be rollout fully by manually actioning progress steps.
101
101
  */
102
102
  rollout_kind?: "full_auto" | "none" | "full_manual";
103
- /**
104
- * Ports to be exposed by the container application. Only applies to dev, on non-linux machines, and if the Dockerfile doesn't already declare exposed ports.
105
- */
106
- dev_exposed_ports?: number[];
107
103
  };
108
104
  /**
109
105
  * Configuration in wrangler for Durable Object Migrations
@@ -328,9 +324,11 @@ interface EnvironmentInheritable {
328
324
  */
329
325
  minify: boolean | undefined;
330
326
  /**
331
- * Keep function names after javascript transpilations.
327
+ * Set the `name` property to the original name for functions and classes renamed during minification.
332
328
  *
333
- * @default {true}
329
+ * See https://esbuild.github.io/api/#keep-names
330
+ *
331
+ * @default true
334
332
  * @inheritable
335
333
  */
336
334
  keep_names: boolean | undefined;
@@ -838,6 +836,8 @@ interface EnvironmentNonInheritable {
838
836
  binding: string;
839
837
  /** The uuid of the uploaded mTLS certificate */
840
838
  certificate_id: string;
839
+ /** Whether the mtls fetcher should be remote or not (only available under `--x-mixed-mode`) */
840
+ remote?: boolean;
841
841
  }[];
842
842
  /**
843
843
  * Specifies a list of Tail Workers that are bound to this Worker environment
@@ -902,6 +902,21 @@ interface EnvironmentNonInheritable {
902
902
  /** Name of the secret */
903
903
  secret_name: string;
904
904
  }[];
905
+ /**
906
+ * **DO NOT USE**. Hello World Binding Config to serve as an explanatory example.
907
+ *
908
+ * NOTE: This field is not automatically inherited from the top level environment,
909
+ * and so must be specified in every named environment.
910
+ *
911
+ * @default []
912
+ * @nonInheritable
913
+ */
914
+ unsafe_hello_world: {
915
+ /** The binding name used to refer to the bound service. */
916
+ binding: string;
917
+ /** Whether the timer is enabled */
918
+ enable_timer?: boolean;
919
+ }[];
905
920
  }
906
921
  /**
907
922
  * The raw environment configuration that we read from the config file.
@@ -950,10 +965,11 @@ type Assets = {
950
965
  /** How to handle requests that do not match an asset. */
951
966
  not_found_handling?: "single-page-application" | "404-page" | "none";
952
967
  /**
953
- * If true, route every request to the User Worker, whether or not it matches an asset.
954
- * If false, then respond to requests that match an asset with that asset directly.
955
- * */
956
- run_worker_first?: boolean;
968
+ * Matches will be routed to the User Worker, and matches to negative rules will go to the Asset Worker.
969
+ *
970
+ * Can also be `true`, indicating that every request should be routed to the User Worker.
971
+ */
972
+ run_worker_first?: string[] | boolean;
957
973
  };
958
974
  interface Observability {
959
975
  /** If observability is enabled for this Worker */
@@ -1359,6 +1375,10 @@ interface CfSecretsStoreSecrets {
1359
1375
  store_id: string;
1360
1376
  secret_name: string;
1361
1377
  }
1378
+ interface CfHelloWorld {
1379
+ binding: string;
1380
+ enable_timer?: boolean;
1381
+ }
1362
1382
  interface CfHyperdrive {
1363
1383
  binding: string;
1364
1384
  id: string;
@@ -1389,6 +1409,7 @@ interface CfDispatchNamespace {
1389
1409
  interface CfMTlsCertificate {
1390
1410
  binding: string;
1391
1411
  certificate_id: string;
1412
+ remote?: boolean;
1392
1413
  }
1393
1414
  interface CfLogfwdrBinding {
1394
1415
  name: string;
@@ -1706,6 +1727,7 @@ type AssetsOptions = {
1706
1727
  assetConfig: AssetConfig;
1707
1728
  _redirects?: string;
1708
1729
  _headers?: string;
1730
+ run_worker_first?: boolean | string[];
1709
1731
  };
1710
1732
 
1711
1733
  type ApiCredentials = {
@@ -1793,7 +1815,7 @@ type MiniflareWorker = Awaited<ReturnType<Miniflare["getWorker"]>>;
1793
1815
  interface Worker {
1794
1816
  ready: Promise<void>;
1795
1817
  url: Promise<URL>;
1796
- inspectorUrl: Promise<URL>;
1818
+ inspectorUrl: Promise<URL | undefined>;
1797
1819
  config: StartDevWorkerOptions;
1798
1820
  setConfig: ConfigController["set"];
1799
1821
  patchConfig: ConfigController["patch"];
@@ -1868,12 +1890,12 @@ interface StartDevWorkerInput {
1868
1890
  };
1869
1891
  /** Options applying to the worker's development preview environment. */
1870
1892
  dev?: {
1871
- /** Options applying to the worker's inspector server. */
1893
+ /** Options applying to the worker's inspector server. False disables the inspector server. */
1872
1894
  inspector?: {
1873
1895
  hostname?: string;
1874
1896
  port?: number;
1875
1897
  secure?: boolean;
1876
- };
1898
+ } | false;
1877
1899
  /** Whether the worker runs on the edge or locally. Can also be set to "minimal" for minimal mode. */
1878
1900
  remote?: boolean | "minimal";
1879
1901
  /** Cloudflare Account credentials. Can be provided upfront or as a function which will be called only when required. */
@@ -2041,7 +2063,9 @@ type Binding = {
2041
2063
  type: "secrets_store_secret";
2042
2064
  } & BindingOmit<CfSecretsStoreSecrets>) | ({
2043
2065
  type: "logfwdr";
2044
- } & NameOmit<CfLogfwdrBinding>) | {
2066
+ } & NameOmit<CfLogfwdrBinding>) | ({
2067
+ type: "unsafe_hello_world";
2068
+ } & BindingOmit<CfHelloWorld>) | {
2045
2069
  type: `unsafe_${string}`;
2046
2070
  } | {
2047
2071
  type: "assets";
@@ -2094,7 +2118,7 @@ type ReadyEvent = {
2094
2118
  type: "ready";
2095
2119
  proxyWorker: Miniflare;
2096
2120
  url: URL;
2097
- inspectorUrl: URL;
2121
+ inspectorUrl: URL | undefined;
2098
2122
  };
2099
2123
  type ProxyWorkerIncomingRequestBody = {
2100
2124
  type: "play";
@@ -2143,7 +2167,7 @@ type UrlOriginParts = Pick<URL, "protocol" | "hostname" | "port">;
2143
2167
  type UrlOriginAndPathnameParts = Pick<URL, "protocol" | "hostname" | "port" | "pathname">;
2144
2168
  type ProxyData = {
2145
2169
  userWorkerUrl: UrlOriginParts;
2146
- userWorkerInspectorUrl: UrlOriginAndPathnameParts;
2170
+ userWorkerInspectorUrl?: UrlOriginAndPathnameParts;
2147
2171
  userWorkerInnerUrlOverrides?: Partial<UrlOriginParts>;
2148
2172
  headers: Record<string, string>;
2149
2173
  liveReload?: boolean;
@@ -2234,7 +2258,7 @@ declare class ProxyController extends Controller<ProxyControllerEventMap> {
2234
2258
  onInspectorProxyWorkerRequest(message: InspectorProxyWorkerOutgoingRequestBody): Promise<Response$1>;
2235
2259
  _torndown: boolean;
2236
2260
  teardown(): Promise<void>;
2237
- emitReadyEvent(proxyWorker: Miniflare, url: URL, inspectorUrl: URL): void;
2261
+ emitReadyEvent(proxyWorker: Miniflare, url: URL, inspectorUrl: URL | undefined): void;
2238
2262
  emitPreviewTokenExpiredEvent(proxyData: ProxyData): void;
2239
2263
  emitErrorEvent(data: ErrorEvent): void;
2240
2264
  emitErrorEvent(reason: string, cause?: Error | SerializedError): void;
@@ -2395,12 +2419,36 @@ type MixedModeSession = Pick<Worker, "ready" | "dispose"> & {
2395
2419
  updateBindings: (bindings: StartDevWorkerInput["bindings"]) => Promise<void>;
2396
2420
  mixedModeConnectionString: MixedModeConnectionString;
2397
2421
  };
2398
- declare function startMixedModeSession(bindings: StartDevWorkerInput["bindings"], options?: {
2422
+ type StartMixedModeSessionOptions = {
2423
+ workerName?: string;
2399
2424
  auth?: NonNullable<StartDevWorkerInput["dev"]>["auth"];
2400
2425
  /** If running in a non-public compliance region, set this here. */
2401
2426
  complianceRegion?: Config["compliance_region"];
2402
- }): Promise<MixedModeSession>;
2427
+ };
2428
+ declare function startMixedModeSession(bindings: StartDevWorkerInput["bindings"], options?: StartMixedModeSessionOptions): Promise<MixedModeSession>;
2403
2429
  declare function pickRemoteBindings(bindings: Record<string, Binding>): Record<string, Binding>;
2430
+ /**
2431
+ * Utility for potentially starting or updating a mixed mode session.
2432
+ *
2433
+ * It uses an internal map for storing existing mixed mode session indexed by worker names. If no worker name is provided
2434
+ * the mixed mode session won't be retrieved nor saved to/from the internal map.
2435
+ *
2436
+ * @param configPathOrWorkerConfig either a file path to a wrangler configuration file or an object containing the name of
2437
+ * the target worker alongside its bindings.
2438
+ * @param preExistingMixedModeSessionData the data of a pre-existing mixed mode session if there was one null otherwise
2439
+ * @returns null if no existing mixed mode session was provided and one should not be created (because the worker is not
2440
+ * defining any remote bindings), the data associated to the created/updated mixed mode session otherwise.
2441
+ */
2442
+ declare function maybeStartOrUpdateMixedModeSession(configPathOrWorkerConfig: string | {
2443
+ name?: string;
2444
+ bindings: NonNullable<StartDevWorkerInput["bindings"]>;
2445
+ }, preExistingMixedModeSessionData: {
2446
+ session: MixedModeSession;
2447
+ remoteBindings: Record<string, Binding>;
2448
+ } | null): Promise<{
2449
+ session: MixedModeSession;
2450
+ remoteBindings: Record<string, Binding>;
2451
+ } | null>;
2404
2452
 
2405
2453
  declare const LOGGER_LEVELS: {
2406
2454
  readonly none: -1;
@@ -2457,4 +2505,4 @@ interface Unstable_ASSETSBindingsOptions {
2457
2505
  }
2458
2506
  declare const generateASSETSBinding: (opts: Unstable_ASSETSBindingsOptions) => (request: Request) => Promise<Response$1>;
2459
2507
 
2460
- export { type ConfigBindingOptions as Experimental_ConfigBindingOptions, type MixedModeSession as Experimental_MixedModeSession, type GetPlatformProxyOptions, type PlatformProxy, type SourcelessWorkerOptions, type Unstable_ASSETSBindingsOptions, type Config as Unstable_Config, type Unstable_DevOptions, type Unstable_DevWorker, type Unstable_MiniflareWorkerOptions, type RawConfig as Unstable_RawConfig, type RawEnvironment as Unstable_RawEnvironment, experimental_patchConfig, pickRemoteBindings as experimental_pickRemoteBindings, experimental_readRawConfig, startMixedModeSession as experimental_startMixedModeSession, getPlatformProxy, DevEnv as unstable_DevEnv, convertConfigBindingsToStartWorkerBindings as unstable_convertConfigBindingsToStartWorkerBindings, unstable_dev, generateASSETSBinding as unstable_generateASSETSBinding, unstable_getMiniflareWorkerOptions, unstable_pages, readConfig as unstable_readConfig, splitSqlQuery as unstable_splitSqlQuery, startWorker as unstable_startWorker };
2508
+ export { type ConfigBindingOptions as Experimental_ConfigBindingOptions, type MixedModeSession as Experimental_MixedModeSession, type GetPlatformProxyOptions, type PlatformProxy, type SourcelessWorkerOptions, type Unstable_ASSETSBindingsOptions, type Binding as Unstable_Binding, type Config as Unstable_Config, type Unstable_DevOptions, type Unstable_DevWorker, type Unstable_MiniflareWorkerOptions, type RawConfig as Unstable_RawConfig, type RawEnvironment as Unstable_RawEnvironment, type StartMixedModeSessionOptions as experimental_StartMixedModeSessionOptions, maybeStartOrUpdateMixedModeSession as experimental_maybeStartOrUpdateMixedModeSession, experimental_patchConfig, pickRemoteBindings as experimental_pickRemoteBindings, experimental_readRawConfig, startMixedModeSession as experimental_startMixedModeSession, getPlatformProxy, DevEnv as unstable_DevEnv, convertConfigBindingsToStartWorkerBindings as unstable_convertConfigBindingsToStartWorkerBindings, unstable_dev, generateASSETSBinding as unstable_generateASSETSBinding, unstable_getMiniflareWorkerOptions, unstable_pages, readConfig as unstable_readConfig, splitSqlQuery as unstable_splitSqlQuery, startWorker as unstable_startWorker };