wrangler 4.109.0 → 4.111.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.
@@ -110,7 +110,6 @@ function createDevOptions(parsedArgs) {
110
110
  jsxFragment: undefined,
111
111
  tsconfig: undefined,
112
112
  minify: undefined,
113
- legacyEnv: undefined,
114
113
  logLevel: undefined,
115
114
  showInteractiveDevSession: undefined,
116
115
  liveReload: undefined,
@@ -1638,16 +1638,27 @@
1638
1638
  "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.",
1639
1639
  "markdownDescription": "The directory of static assets to serve.\n\nThe presence of this field in a Wrangler configuration file indicates a Pages project,\nand will prompt the handling of the configuration file according to the\nPages-specific validation rules."
1640
1640
  },
1641
- "legacy_env": {
1642
- "type": "boolean",
1643
- "description": "A boolean to enable \"legacy\" style wrangler environments (from Wrangler v1). These have been superseded by Services, but there may be projects that won't (or can't) use them. If you're using a legacy environment, you can set this to `true` to enable it.",
1644
- "markdownDescription": "A boolean to enable \"legacy\" style wrangler environments (from Wrangler v1).\nThese have been superseded by Services, but there may be projects that won't\n(or can't) use them. If you're using a legacy environment, you can set this\nto `true` to enable it."
1645
- },
1646
1641
  "send_metrics": {
1647
1642
  "type": "boolean",
1648
1643
  "description": "Whether Wrangler should send usage metrics to Cloudflare for this project.\n\nWhen defined this will override any user settings. Otherwise, Wrangler will use the user's preference.",
1649
1644
  "markdownDescription": "Whether Wrangler should send usage metrics to Cloudflare for this project.\n\nWhen defined this will override any user settings.\nOtherwise, Wrangler will use the user's preference."
1650
1645
  },
1646
+ "dependencies_instrumentation": {
1647
+ "type": "object",
1648
+ "properties": {
1649
+ "enabled": {
1650
+ "type": "boolean",
1651
+ "description": "Whether dependency instrumentation is enabled. Defaults to `true`.",
1652
+ "markdownDescription": "Whether dependency instrumentation is enabled. Defaults to `true`."
1653
+ }
1654
+ },
1655
+ "required": [
1656
+ "enabled"
1657
+ ],
1658
+ "additionalProperties": false,
1659
+ "description": "Configuration for npm package dependency instrumentation.\n\nControls whether Wrangler should collect and send npm package dependency metadata when deploying or uploading a Worker version.\n\nWhen `enabled` is set to `false`, Wrangler will not include `package_dependencies` in the upload payload. Defaults to enabled when not specified.\n\nNote: This is considered build metadata, so managed separately from the telemetry one and not disabled when `send_metrics`/`WRANGLER_SEND_METRICS` is set to `false`",
1660
+ "markdownDescription": "Configuration for npm package dependency instrumentation.\n\nControls whether Wrangler should collect and send npm package dependency\nmetadata when deploying or uploading a Worker version.\n\nWhen `enabled` is set to `false`, Wrangler will not include\n`package_dependencies` in the upload payload. Defaults to enabled when\nnot specified.\n\nNote: This is considered build metadata, so managed separately from the\n telemetry one and not disabled when\n `send_metrics`/`WRANGLER_SEND_METRICS` is set to `false`"
1661
+ },
1651
1662
  "dev": {
1652
1663
  "$ref": "#/definitions/RawDevConfig",
1653
1664
  "description": "Options to configure the development server that your worker will use.\n\nFor reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#local-development-settings",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "4.109.0",
3
+ "version": "4.111.0",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "assembly",
@@ -66,16 +66,16 @@
66
66
  "esbuild": "0.28.1",
67
67
  "path-to-regexp": "6.3.0",
68
68
  "unenv": "2.0.0-rc.24",
69
- "workerd": "1.20260708.1",
69
+ "workerd": "1.20260710.1",
70
70
  "@cloudflare/kv-asset-handler": "0.5.0",
71
71
  "@cloudflare/unenv-preset": "2.16.1",
72
- "miniflare": "4.20260708.0"
72
+ "miniflare": "4.20260710.0"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@aws-sdk/client-s3": "^3.721.0",
76
76
  "@bomb.sh/tab": "^0.0.12",
77
77
  "@cloudflare/types": "6.18.4",
78
- "@cloudflare/workers-types": "^5.20260708.1",
78
+ "@cloudflare/workers-types": "^5.20260710.1",
79
79
  "@cspotcode/source-map-support": "0.8.1",
80
80
  "@netlify/build-info": "^10.5.1",
81
81
  "@sentry/node": "^7.86.0",
@@ -155,21 +155,22 @@
155
155
  "yaml": "^2.8.1",
156
156
  "yargs": "^17.7.2",
157
157
  "zod": "^4.4.3",
158
- "@cloudflare/autoconfig": "0.1.3",
159
- "@cloudflare/cli-shared-helpers": "0.1.12",
158
+ "@cloudflare/autoconfig": "0.1.5",
160
159
  "@cloudflare/codemod": "1.1.0",
161
- "@cloudflare/config": "0.0.0",
160
+ "@cloudflare/cli-shared-helpers": "0.1.14",
161
+ "@cloudflare/config": "0.2.0",
162
+ "@cloudflare/deploy-helpers": "0.5.0",
163
+ "@cloudflare/pages-shared": "^0.13.157",
162
164
  "@cloudflare/containers-shared": "0.16.0",
163
- "@cloudflare/deploy-helpers": "0.3.3",
164
- "@cloudflare/pages-shared": "^0.13.155",
165
- "@cloudflare/workers-shared": "0.19.7",
165
+ "@cloudflare/runtime-types": "0.0.2",
166
+ "@cloudflare/workers-auth": "0.5.0",
167
+ "@cloudflare/workers-shared": "0.19.8",
166
168
  "@cloudflare/workers-tsconfig": "0.0.0",
167
- "@cloudflare/workers-auth": "0.4.1",
168
- "@cloudflare/workers-utils": "0.25.1",
169
+ "@cloudflare/workers-utils": "0.27.0",
169
170
  "@cloudflare/workflows-shared": "0.12.0"
170
171
  },
171
172
  "peerDependencies": {
172
- "@cloudflare/workers-types": "^5.20260708.1"
173
+ "@cloudflare/workers-types": "^5.20260710.1"
173
174
  },
174
175
  "peerDependenciesMeta": {
175
176
  "@cloudflare/workers-types": {
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  createDeferred,
3
3
  DeferredPromise,
4
+ rewriteUrlInHeaderValue,
4
5
  urlFromParts,
5
6
  } from "../../src/api/startDevWorker/utils";
6
7
  import type {
@@ -350,10 +351,7 @@ function rewriteUrlRelatedHeaders(headers: Headers, from: URL, to: URL) {
350
351
  headers.delete("Set-Cookie");
351
352
  headers.forEach((value, key) => {
352
353
  if (typeof value === "string" && value.includes(from.host)) {
353
- headers.set(
354
- key,
355
- value.replaceAll(from.origin, to.origin).replaceAll(from.host, to.host)
356
- );
354
+ headers.set(key, rewriteUrlInHeaderValue(value, from, to));
357
355
  }
358
356
  });
359
357
  for (const cookie of setCookie) {
@@ -21,6 +21,23 @@ function urlFromParts(parts, base = "http://localhost") {
21
21
  Object.assign(url, parts);
22
22
  return url;
23
23
  }
24
+ function rewriteUrlInHeaderValue(value, from, to) {
25
+ return value.replace(
26
+ /(https?:\/\/[^/?#\s,;"']+)([^\s,;"']*)/gi,
27
+ (match, origin, rest) => {
28
+ let url;
29
+ try {
30
+ url = new URL(origin);
31
+ } catch {
32
+ return match;
33
+ }
34
+ if (url.host !== from.host) {
35
+ return match;
36
+ }
37
+ return to.origin + rest;
38
+ }
39
+ );
40
+ }
24
41
 
25
42
  // templates/startDevWorker/ProxyWorker.ts
26
43
  var LIVE_RELOAD_PROTOCOL = "WRANGLER_PROXYWORKER_LIVE_RELOAD_PROTOCOL";
@@ -231,10 +248,7 @@ function rewriteUrlRelatedHeaders(headers, from, to) {
231
248
  headers.delete("Set-Cookie");
232
249
  headers.forEach((value, key) => {
233
250
  if (typeof value === "string" && value.includes(from.host)) {
234
- headers.set(
235
- key,
236
- value.replaceAll(from.origin, to.origin).replaceAll(from.host, to.host)
237
- );
251
+ headers.set(key, rewriteUrlInHeaderValue(value, from, to));
238
252
  }
239
253
  });
240
254
  for (const cookie of setCookie) {
@@ -651,7 +651,6 @@ declare const dev: {
651
651
  nodeCompat: boolean | undefined;
652
652
  persistTo: string | undefined;
653
653
  liveReload: boolean | undefined;
654
- legacyEnv: boolean | undefined;
655
654
  testScheduled: boolean;
656
655
  logLevel: "debug" | "none" | "error" | "log" | "info" | "warn" | undefined;
657
656
  showInteractiveDevSession: boolean | undefined;
@@ -777,16 +776,25 @@ type TestHarnessOptions = {
777
776
  */
778
777
  workers: WorkerInput[];
779
778
  };
779
+ type ExportName<Module, Type> = string extends keyof Module ? string : Extract<{
780
+ [K in keyof Module]-?: NonNullable<Module[K]> extends Type | (abstract new (...args: any[]) => Type) ? K : never;
781
+ }[keyof Module], string>;
780
782
  type BindingName<Env, Type> = string extends keyof Env ? string : Extract<{
781
783
  [K in keyof Env]-?: NonNullable<Env[K]> extends Type ? K : never;
782
784
  }[keyof Env], string>;
785
+ type DurableObjectIdentifier = {
786
+ name: string;
787
+ id?: never;
788
+ } | {
789
+ id: string;
790
+ name?: never;
791
+ };
792
+ type WorkerDefaultExport = (new (...args: any[]) => Rpc.WorkerEntrypointBranded) | Rpc.WorkerEntrypointBranded | AnyExportedHandler;
783
793
  type WorkerModule = {
784
- default: WorkerExport;
785
- [key: string]: WorkerExport | undefined;
794
+ default: WorkerDefaultExport;
786
795
  };
787
796
  type AnyExportedHandler = ExportedHandler<any, any, any, any>;
788
797
  type AnyEnv = Record<string, any>;
789
- type WorkerExport = (new (...args: any[]) => Rpc.WorkerEntrypointBranded) | Rpc.WorkerEntrypointBranded | AnyExportedHandler;
790
798
  type WorkerHandle<Env = AnyEnv, Module extends WorkerModule = {
791
799
  default: AnyExportedHandler;
792
800
  }> = {
@@ -829,9 +837,27 @@ type WorkerHandle<Env = AnyEnv, Module extends WorkerModule = {
829
837
  */
830
838
  getEnv(): Promise<Env>;
831
839
  /**
832
- * Lists the string IDs of Durable Object instances with persisted storage for a binding.
840
+ * Lists the string IDs of Durable Object instances with persisted storage.
841
+ * Pass an exported Durable Object class name, or a Durable Object binding name.
833
842
  */
834
- listDurableObjectIds(bindingName: BindingName<Env, DurableObjectNamespace>): Promise<string[]>;
843
+ listDurableObjectIds(classNameOrBindingName: ExportName<Module, Rpc.DurableObjectBranded> | BindingName<Env, DurableObjectNamespace>): Promise<string[]>;
844
+ /**
845
+ * Evicts a currently running Durable Object instance while preserving its durable storage.
846
+ * In-memory state is reset the next time the object starts.
847
+ * Pass an exported Durable Object class name, or a Durable Object binding name.
848
+ * Class names are resolved before binding names.
849
+ *
850
+ * @example
851
+ * ```ts
852
+ * await worker.evictDurableObject("Counter", {
853
+ * name: "user-123",
854
+ * webSockets: "hibernate",
855
+ * });
856
+ * ```
857
+ */
858
+ evictDurableObject(classNameOrBindingName: ExportName<Module, Rpc.DurableObjectBranded> | BindingName<Env, DurableObjectNamespace>, options: DurableObjectIdentifier & {
859
+ webSockets?: "close" | "hibernate";
860
+ }): Promise<void>;
835
861
  /**
836
862
  * Applies D1 migration files that have not already run to a D1 binding on this Worker.
837
863
  *
@@ -2742,13 +2768,6 @@ interface ComputedFields {
2742
2768
  targetEnvironment: string | undefined;
2743
2769
  }
2744
2770
  interface ConfigFields<Dev extends RawDevConfig> {
2745
- /**
2746
- * A boolean to enable "legacy" style wrangler environments (from Wrangler v1).
2747
- * These have been superseded by Services, but there may be projects that won't
2748
- * (or can't) use them. If you're using a legacy environment, you can set this
2749
- * to `true` to enable it.
2750
- */
2751
- legacy_env: boolean;
2752
2771
  /**
2753
2772
  * Whether Wrangler should send usage metrics to Cloudflare for this project.
2754
2773
  *
@@ -2756,6 +2775,24 @@ interface ConfigFields<Dev extends RawDevConfig> {
2756
2775
  * Otherwise, Wrangler will use the user's preference.
2757
2776
  */
2758
2777
  send_metrics: boolean | undefined;
2778
+ /**
2779
+ * Configuration for npm package dependency instrumentation.
2780
+ *
2781
+ * Controls whether Wrangler should collect and send npm package dependency
2782
+ * metadata when deploying or uploading a Worker version.
2783
+ *
2784
+ * When `enabled` is set to `false`, Wrangler will not include
2785
+ * `package_dependencies` in the upload payload. Defaults to enabled when
2786
+ * not specified.
2787
+ *
2788
+ * Note: This is considered build metadata, so managed separately from the
2789
+ * telemetry one and not disabled when
2790
+ * `send_metrics`/`WRANGLER_SEND_METRICS` is set to `false`
2791
+ */
2792
+ dependencies_instrumentation: {
2793
+ /** Whether dependency instrumentation is enabled. Defaults to `true`. */
2794
+ enabled: boolean;
2795
+ } | undefined;
2759
2796
  /**
2760
2797
  * Options to configure the development server that your worker will use.
2761
2798
  *
@@ -3143,6 +3180,11 @@ type WorkerConfigObject = {
3143
3180
  complianceRegion?: Config$1["compliance_region"];
3144
3181
  /** Id of the account owning the worker */
3145
3182
  account_id?: Config$1["account_id"];
3183
+ /**
3184
+ * directory used to resolve the auth profile from directory bindings.
3185
+ * Falls back to `process.cwd()` when not provided.
3186
+ */
3187
+ profileDir?: string;
3146
3188
  };
3147
3189
  /**
3148
3190
  * Utility for potentially starting or updating a remote proxy session.
@@ -3615,6 +3657,20 @@ declare class CommandRegistry {
3615
3657
  * Includes both registry-defined commands & legacy commands.
3616
3658
  */
3617
3659
  get topLevelCommands(): Set<string>;
3660
+ /**
3661
+ * Get the set of valid subcommand names at a given command path.
3662
+ *
3663
+ * Walks the definition tree along the given path segments, then returns
3664
+ * the keys of the subtree at that node. Returns `undefined` if the path
3665
+ * does not exist in the tree or has no subcommands.
3666
+ *
3667
+ * @param pathSegments - The command path segments to walk (e.g., `["kv"]`
3668
+ * returns `namespace`, `key`, `bulk`; `["kv", "namespace"]` returns
3669
+ * `create`, `list`, `delete`, etc.)
3670
+ * @returns A set of valid subcommand names, or `undefined` if the path is
3671
+ * invalid or has no subcommands
3672
+ */
3673
+ getSubcommands(pathSegments: string[]): Set<string> | undefined;
3618
3674
  /**
3619
3675
  * Returns the map of categories to command segments, ordered according to
3620
3676
  * the category order. Commands within each category are sorted alphabetically.