wrangler 4.43.0 → 4.45.0

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.
@@ -248,6 +248,26 @@
248
248
  ],
249
249
  "description": "Specify the compliance region mode of the Worker.\n\nAlthough if the user does not specify a compliance region, the default is `public`, it can be set to `undefined` in configuration to delegate to the CLOUDFLARE_COMPLIANCE_REGION environment variable."
250
250
  },
251
+ "python_modules": {
252
+ "type": "object",
253
+ "properties": {
254
+ "exclude": {
255
+ "type": "array",
256
+ "items": {
257
+ "type": "string"
258
+ },
259
+ "description": "A list of glob patterns to exclude files from the python_modules directory when bundling.\n\nPatterns are relative to the python_modules directory and use glob syntax.",
260
+ "default": [
261
+ "***.pyc"
262
+ ]
263
+ }
264
+ },
265
+ "required": [
266
+ "exclude"
267
+ ],
268
+ "additionalProperties": false,
269
+ "description": "Configuration for Python modules."
270
+ },
251
271
  "define": {
252
272
  "type": "object",
253
273
  "additionalProperties": {
@@ -720,6 +740,24 @@
720
740
  "description": "Binding to Cloudflare Images\n\nNOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.\n\nFor reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#images",
721
741
  "default": {}
722
742
  },
743
+ "media": {
744
+ "type": "object",
745
+ "properties": {
746
+ "binding": {
747
+ "type": "string"
748
+ },
749
+ "remote": {
750
+ "type": "boolean",
751
+ "description": "Whether the Media binding should be remote or not"
752
+ }
753
+ },
754
+ "required": [
755
+ "binding"
756
+ ],
757
+ "additionalProperties": false,
758
+ "description": "Binding to Cloudflare Media Transformations\n\nNOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.",
759
+ "default": {}
760
+ },
723
761
  "version_metadata": {
724
762
  "type": "object",
725
763
  "properties": {
@@ -1397,6 +1435,26 @@
1397
1435
  ],
1398
1436
  "description": "Specify the compliance region mode of the Worker.\n\nAlthough if the user does not specify a compliance region, the default is `public`, it can be set to `undefined` in configuration to delegate to the CLOUDFLARE_COMPLIANCE_REGION environment variable."
1399
1437
  },
1438
+ "python_modules": {
1439
+ "type": "object",
1440
+ "properties": {
1441
+ "exclude": {
1442
+ "type": "array",
1443
+ "items": {
1444
+ "type": "string"
1445
+ },
1446
+ "description": "A list of glob patterns to exclude files from the python_modules directory when bundling.\n\nPatterns are relative to the python_modules directory and use glob syntax.",
1447
+ "default": [
1448
+ "***.pyc"
1449
+ ]
1450
+ }
1451
+ },
1452
+ "required": [
1453
+ "exclude"
1454
+ ],
1455
+ "additionalProperties": false,
1456
+ "description": "Configuration for Python modules."
1457
+ },
1400
1458
  "define": {
1401
1459
  "type": "object",
1402
1460
  "additionalProperties": {
@@ -1869,6 +1927,24 @@
1869
1927
  "description": "Binding to Cloudflare Images\n\nNOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.\n\nFor reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#images",
1870
1928
  "default": {}
1871
1929
  },
1930
+ "media": {
1931
+ "type": "object",
1932
+ "properties": {
1933
+ "binding": {
1934
+ "type": "string"
1935
+ },
1936
+ "remote": {
1937
+ "type": "boolean",
1938
+ "description": "Whether the Media binding should be remote or not"
1939
+ }
1940
+ },
1941
+ "required": [
1942
+ "binding"
1943
+ ],
1944
+ "additionalProperties": false,
1945
+ "description": "Binding to Cloudflare Media Transformations\n\nNOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.",
1946
+ "default": {}
1947
+ },
1872
1948
  "version_metadata": {
1873
1949
  "type": "object",
1874
1950
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "4.43.0",
3
+ "version": "4.45.0",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -54,15 +54,15 @@
54
54
  "esbuild": "0.25.4",
55
55
  "path-to-regexp": "6.3.0",
56
56
  "unenv": "2.0.0-rc.21",
57
- "workerd": "1.20251008.0",
57
+ "workerd": "1.20251011.0",
58
58
  "@cloudflare/kv-asset-handler": "0.4.0",
59
- "@cloudflare/unenv-preset": "2.7.7",
60
- "miniflare": "4.20251008.0"
59
+ "@cloudflare/unenv-preset": "2.7.8",
60
+ "miniflare": "4.20251011.1"
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.20251008.0",
65
+ "@cloudflare/workers-types": "^4.20251011.0",
66
66
  "@cspotcode/source-map-support": "0.8.1",
67
67
  "@iarna/toml": "^3.0.0",
68
68
  "@sentry/node": "^7.86.0",
@@ -72,6 +72,7 @@
72
72
  "@types/glob-to-regexp": "^0.4.1",
73
73
  "@types/is-ci": "^3.0.0",
74
74
  "@types/javascript-time-ago": "^2.0.3",
75
+ "@types/json-diff": "^1.0.3",
75
76
  "@types/mime": "^3.0.4",
76
77
  "@types/minimatch": "^5.1.2",
77
78
  "@types/node": "^20.19.9",
@@ -105,6 +106,7 @@
105
106
  "is-ci": "^3.0.1",
106
107
  "itty-time": "^1.0.6",
107
108
  "javascript-time-ago": "^2.5.4",
109
+ "json-diff": "^1.0.6",
108
110
  "md5-file": "5.0.0",
109
111
  "mime": "^3.0.0",
110
112
  "minimatch": "^5.1.0",
@@ -140,15 +142,15 @@
140
142
  "yaml": "^2.8.1",
141
143
  "yargs": "^17.7.2",
142
144
  "@cloudflare/cli": "1.1.3",
143
- "@cloudflare/containers-shared": "0.2.12",
145
+ "@cloudflare/containers-shared": "0.2.13",
144
146
  "@cloudflare/eslint-config-shared": "1.1.0",
145
- "@cloudflare/pages-shared": "^0.13.79",
146
- "@cloudflare/workers-shared": "0.18.8",
147
+ "@cloudflare/pages-shared": "^0.13.81",
147
148
  "@cloudflare/workers-tsconfig": "0.0.0",
148
- "@cloudflare/workflows-shared": "0.3.7"
149
+ "@cloudflare/workers-shared": "0.18.8",
150
+ "@cloudflare/workflows-shared": "0.3.8"
149
151
  },
150
152
  "peerDependencies": {
151
- "@cloudflare/workers-types": "^4.20251008.0"
153
+ "@cloudflare/workers-types": "^4.20251011.0"
152
154
  },
153
155
  "peerDependenciesMeta": {
154
156
  "@cloudflare/workers-types": {
@@ -9,6 +9,39 @@ class BindingNotFoundError extends Error {
9
9
  }
10
10
  }
11
11
 
12
+ /**
13
+ * Here be dragons! capnweb does not currently support ReadableStreams, which Media
14
+ * bindings use for input. As such, Media Bindings cannot be directly used via capnweb,
15
+ * and need to be special cased.
16
+ */
17
+
18
+ function isSpecialCaseMediaBindingRequest(headers: Headers): boolean {
19
+ return headers.has("x-cf-media-input-options");
20
+ }
21
+ async function evaluateMediaBinding(
22
+ headers: Headers,
23
+ stream: ReadableStream,
24
+ binding: MediaBinding
25
+ ): Promise<Response> {
26
+ const inputOptions = JSON.parse(
27
+ headers.get("x-cf-media-input-options") as string
28
+ );
29
+ const outputOptions = JSON.parse(
30
+ headers.get("x-cf-media-output-options") as string
31
+ );
32
+
33
+ const result = await binding
34
+ .input(stream)
35
+ .transform(inputOptions)
36
+ .output(outputOptions);
37
+
38
+ return new Response(await result.media(), {
39
+ headers: {
40
+ "x-cf-media-content-type": await result.contentType(),
41
+ },
42
+ });
43
+ }
44
+
12
45
  /**
13
46
  * For most bindings, we expose them as
14
47
  * - RPC stubs directly to capnweb, or
@@ -114,6 +147,13 @@ export default {
114
147
  originalHeaders.set(name, value);
115
148
  }
116
149
  }
150
+ if (isSpecialCaseMediaBindingRequest(originalHeaders)) {
151
+ return evaluateMediaBinding(
152
+ originalHeaders,
153
+ request.body as ReadableStream,
154
+ fetcher as unknown as MediaBinding
155
+ );
156
+ }
117
157
 
118
158
  return fetcher.fetch(
119
159
  request.headers.get("MF-URL") ?? "http://example.com",
@@ -2412,6 +2412,23 @@ var BindingNotFoundError = class extends Error {
2412
2412
  super(`Binding ${name ? `"${name}"` : ""} not found`);
2413
2413
  }
2414
2414
  };
2415
+ function isSpecialCaseMediaBindingRequest(headers) {
2416
+ return headers.has("x-cf-media-input-options");
2417
+ }
2418
+ async function evaluateMediaBinding(headers, stream, binding) {
2419
+ const inputOptions = JSON.parse(
2420
+ headers.get("x-cf-media-input-options")
2421
+ );
2422
+ const outputOptions = JSON.parse(
2423
+ headers.get("x-cf-media-output-options")
2424
+ );
2425
+ const result = await binding.input(stream).transform(inputOptions).output(outputOptions);
2426
+ return new Response(await result.media(), {
2427
+ headers: {
2428
+ "x-cf-media-content-type": await result.contentType()
2429
+ }
2430
+ });
2431
+ }
2415
2432
  function getExposedJSRPCBinding(request, env) {
2416
2433
  const url = new URL(request.url);
2417
2434
  const bindingName = url.searchParams.get("MF-Binding");
@@ -2478,6 +2495,13 @@ var ProxyServerWorker_default = {
2478
2495
  originalHeaders.set(name, value);
2479
2496
  }
2480
2497
  }
2498
+ if (isSpecialCaseMediaBindingRequest(originalHeaders)) {
2499
+ return evaluateMediaBinding(
2500
+ originalHeaders,
2501
+ request.body,
2502
+ fetcher
2503
+ );
2504
+ }
2481
2505
  return fetcher.fetch(
2482
2506
  request.headers.get("MF-URL") ?? "http://example.com",
2483
2507
  new Request(request, {
@@ -532,6 +532,21 @@ interface EnvironmentInheritable {
532
532
  * it can be set to `undefined` in configuration to delegate to the CLOUDFLARE_COMPLIANCE_REGION environment variable.
533
533
  */
534
534
  compliance_region: "public" | "fedramp_high" | undefined;
535
+ /**
536
+ * Configuration for Python modules.
537
+ *
538
+ * @inheritable
539
+ */
540
+ python_modules: {
541
+ /**
542
+ * A list of glob patterns to exclude files from the python_modules directory when bundling.
543
+ *
544
+ * Patterns are relative to the python_modules directory and use glob syntax.
545
+ *
546
+ * @default ["**\*.pyc"]
547
+ */
548
+ exclude: string[];
549
+ };
535
550
  }
536
551
  type DurableObjectBindings = {
537
552
  /** The name of the binding used to refer to the Durable Object */
@@ -915,6 +930,20 @@ interface EnvironmentNonInheritable {
915
930
  /** Whether the Images binding should be remote or not in local development */
916
931
  remote?: boolean;
917
932
  } | undefined;
933
+ /**
934
+ * Binding to Cloudflare Media Transformations
935
+ *
936
+ * NOTE: This field is not automatically inherited from the top level environment,
937
+ * and so must be specified in every named environment.
938
+ *
939
+ * @default {}
940
+ * @nonInheritable
941
+ */
942
+ media: {
943
+ binding: string;
944
+ /** Whether the Media binding should be remote or not */
945
+ remote?: boolean;
946
+ } | undefined;
918
947
  /**
919
948
  * Binding to the Worker Version's metadata
920
949
  */
@@ -1321,6 +1350,13 @@ interface CfImagesBinding {
1321
1350
  raw?: boolean;
1322
1351
  remote?: boolean;
1323
1352
  }
1353
+ /**
1354
+ * A binding to Cloudflare Media Transformations
1355
+ */
1356
+ interface CfMediaBinding {
1357
+ binding: string;
1358
+ remote?: boolean;
1359
+ }
1324
1360
  /**
1325
1361
  * A Durable Object.
1326
1362
  */
@@ -1747,7 +1783,6 @@ interface CommonYargsOptions {
1747
1783
  env: string | undefined;
1748
1784
  "env-file": string[] | undefined;
1749
1785
  "experimental-provision": boolean | undefined;
1750
- "experimental-remote-bindings": boolean | undefined;
1751
1786
  "experimental-auto-create": boolean;
1752
1787
  }
1753
1788
  type CommonYargsArgv = Argv<CommonYargsOptions>;
@@ -1867,8 +1902,6 @@ interface Unstable_DevOptions {
1867
1902
  watch?: boolean;
1868
1903
  devEnv?: boolean;
1869
1904
  fileBasedRegistry?: boolean;
1870
- vectorizeBindToProd?: boolean;
1871
- imagesLocalMode?: boolean;
1872
1905
  enableIpc?: boolean;
1873
1906
  enableContainers?: boolean;
1874
1907
  dockerPath?: string;
@@ -2169,6 +2202,11 @@ interface StartDevWorkerInput {
2169
2202
  compatibilityFlags?: string[];
2170
2203
  /** Specify the compliance region mode of the Worker. */
2171
2204
  complianceRegion?: Config["compliance_region"];
2205
+ /** Configuration for Python modules. */
2206
+ pythonModules?: {
2207
+ /** A list of glob patterns to exclude files from the python_modules directory when bundling. */
2208
+ exclude?: string[];
2209
+ };
2172
2210
  env?: string;
2173
2211
  /**
2174
2212
  * An array of paths to the .env files to load for this worker, relative to the project directory.
@@ -2231,7 +2269,11 @@ interface StartDevWorkerInput {
2231
2269
  port?: number;
2232
2270
  secure?: boolean;
2233
2271
  } | false;
2234
- /** Whether the worker runs on the edge or locally. Can also be set to "minimal" for minimal mode. */
2272
+ /** Whether the worker runs on the edge or locally. This has several options:
2273
+ * - true | "minimal": Run your Worker's code & bindings in a remote preview session, optionally using minimal mode as an internal detail
2274
+ * - false: Run your Worker's code & bindings in a local simulator
2275
+ * - undefined (default): Run your Worker's code locally, and any configured remote bindings remotely
2276
+ */
2235
2277
  remote?: boolean | "minimal";
2236
2278
  /** Cloudflare Account credentials. Can be provided upfront or as a function which will be called only when required. */
2237
2279
  auth?: AsyncHook<CfAccount, [Pick<Config, "account_id">]>;
@@ -2261,14 +2303,8 @@ interface StartDevWorkerInput {
2261
2303
  /** An undici MockAgent to declaratively mock fetch calls to particular resources. */
2262
2304
  mockFetch?: undici.MockAgent;
2263
2305
  testScheduled?: boolean;
2264
- /** Whether to use Vectorize as a remote binding -- the worker is run locally but accesses to Vectorize are made remotely */
2265
- bindVectorizeToProd?: boolean;
2266
- /** Whether to use Images local mode -- this is lower fidelity, but doesn't require network access */
2267
- imagesLocalMode?: boolean;
2268
2306
  /** Treat this as the primary worker in a multiworker setup (i.e. the first Worker in Miniflare's options) */
2269
2307
  multiworkerPrimary?: boolean;
2270
- /** Whether the experimental remote bindings feature should be enabled */
2271
- experimentalRemoteBindings?: boolean;
2272
2308
  containerBuildId?: string;
2273
2309
  /** Whether to build and connect to containers during local dev. Requires Docker daemon to be running. Defaults to true. */
2274
2310
  enableContainers?: boolean;
@@ -2281,7 +2317,7 @@ interface StartDevWorkerInput {
2281
2317
  };
2282
2318
  legacy?: {
2283
2319
  site?: Hook<Config["site"], [Config]>;
2284
- enableServiceEnvironments?: boolean;
2320
+ useServiceEnvironments?: boolean;
2285
2321
  };
2286
2322
  unsafe?: Omit<CfUnsafe, "bindings">;
2287
2323
  assets?: string;
@@ -2410,7 +2446,9 @@ type Binding = {
2410
2446
  type: "worker_loader";
2411
2447
  } & BindingOmit<CfWorkerLoader>) | ({
2412
2448
  type: "vpc_service";
2413
- } & BindingOmit<CfVpcService>) | {
2449
+ } & BindingOmit<CfVpcService>) | ({
2450
+ type: "media";
2451
+ } & BindingOmit<CfMediaBinding>) | {
2414
2452
  type: `unsafe_${string}`;
2415
2453
  } | {
2416
2454
  type: "assets";
@@ -2751,13 +2789,6 @@ type GetPlatformProxyOptions = {
2751
2789
  persist?: boolean | {
2752
2790
  path: string;
2753
2791
  };
2754
- /**
2755
- * Experimental flags (note: these can change at any time and are not version-controlled use at your own risk)
2756
- */
2757
- experimental?: {
2758
- /** whether access to remove bindings should be enabled */
2759
- remoteBindings?: boolean;
2760
- };
2761
2792
  };
2762
2793
  /**
2763
2794
  * Result of the `getPlatformProxy` utility
@@ -2803,9 +2834,7 @@ interface Unstable_MiniflareWorkerOptions {
2803
2834
  externalWorkers: WorkerOptions[];
2804
2835
  }
2805
2836
  declare function unstable_getMiniflareWorkerOptions(configPath: string, env?: string, options?: {
2806
- imagesLocalMode?: boolean;
2807
2837
  remoteProxyConnectionString?: RemoteProxyConnectionString;
2808
- remoteBindingsEnabled?: boolean;
2809
2838
  overrides?: {
2810
2839
  assets?: Partial<AssetsOptions>;
2811
2840
  enableContainers?: boolean;
@@ -2813,9 +2842,7 @@ declare function unstable_getMiniflareWorkerOptions(configPath: string, env?: st
2813
2842
  containerBuildId?: string;
2814
2843
  }): Unstable_MiniflareWorkerOptions;
2815
2844
  declare function unstable_getMiniflareWorkerOptions(config: Config, env?: string, options?: {
2816
- imagesLocalMode?: boolean;
2817
2845
  remoteProxyConnectionString?: RemoteProxyConnectionString;
2818
- remoteBindingsEnabled?: boolean;
2819
2846
  overrides?: {
2820
2847
  assets?: Partial<AssetsOptions>;
2821
2848
  enableContainers?: boolean;
@@ -2967,7 +2994,6 @@ declare function fetchResult<ResponseType>(complianceConfig: ComplianceConfig, r
2967
2994
  type ExperimentalFlags = {
2968
2995
  MULTIWORKER: boolean;
2969
2996
  RESOURCES_PROVISION: boolean;
2970
- REMOTE_BINDINGS: boolean;
2971
2997
  DEPLOY_REMOTE_DIFF_CHECK: boolean;
2972
2998
  AUTOCREATE_RESOURCES: boolean;
2973
2999
  };
@@ -3213,16 +3239,10 @@ declare function createCLIParser(argv: string[]): {
3213
3239
  readonly array: true;
3214
3240
  readonly requiresArg: true;
3215
3241
  };
3216
- readonly "experimental-remote-bindings": {
3217
- readonly describe: "Experimental: Enable Remote Bindings";
3218
- readonly type: "boolean";
3219
- readonly hidden: true;
3220
- readonly default: true;
3221
- readonly alias: readonly ["x-remote-bindings"];
3222
- };
3223
3242
  readonly "experimental-provision": {
3224
3243
  readonly describe: "Experimental: Enable automatic resource provisioning";
3225
3244
  readonly type: "boolean";
3245
+ readonly default: true;
3226
3246
  readonly hidden: true;
3227
3247
  readonly alias: readonly ["x-provision"];
3228
3248
  };