wrangler 4.116.0 → 4.117.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "4.116.0",
3
+ "version": "4.117.0",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "assembly",
@@ -67,9 +67,9 @@
67
67
  "path-to-regexp": "6.3.0",
68
68
  "unenv": "2.0.0-rc.24",
69
69
  "workerd": "1.20260730.1",
70
+ "@cloudflare/kv-asset-handler": "0.5.0",
70
71
  "@cloudflare/unenv-preset": "2.16.1",
71
- "miniflare": "4.20260730.0",
72
- "@cloudflare/kv-asset-handler": "0.5.0"
72
+ "miniflare": "5.20260730.0-alpha"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@aws-sdk/client-s3": "^3.721.0",
@@ -156,21 +156,21 @@
156
156
  "yaml": "^2.8.1",
157
157
  "yargs": "^17.7.2",
158
158
  "zod": "4.4.3",
159
- "@cloudflare/autoconfig": "0.2.2",
159
+ "@cloudflare/autoconfig": "0.2.3",
160
160
  "@cloudflare/build-output-utils": "0.1.0",
161
- "@cloudflare/cli-shared-helpers": "0.1.18",
161
+ "@cloudflare/cli-shared-helpers": "0.1.19",
162
162
  "@cloudflare/codemod": "1.1.0",
163
163
  "@cloudflare/config": "0.4.0",
164
164
  "@cloudflare/containers-shared": "0.16.0",
165
+ "@cloudflare/deploy-helpers": "0.6.4",
165
166
  "@cloudflare/pages-functions": "0.1.0",
166
- "@cloudflare/deploy-helpers": "0.6.3",
167
- "@cloudflare/remote-bindings": "0.0.4",
168
- "@cloudflare/pages-shared": "^0.13.162",
169
- "@cloudflare/runtime-types": "0.0.7",
170
- "@cloudflare/workers-auth": "0.5.4",
167
+ "@cloudflare/pages-shared": "^0.13.163",
168
+ "@cloudflare/remote-bindings": "0.0.5",
169
+ "@cloudflare/runtime-types": "0.0.8",
170
+ "@cloudflare/workers-auth": "0.5.5",
171
171
  "@cloudflare/workers-shared": "0.19.9",
172
172
  "@cloudflare/workers-tsconfig": "0.0.0",
173
- "@cloudflare/workers-utils": "0.30.0",
173
+ "@cloudflare/workers-utils": "0.31.0",
174
174
  "@cloudflare/workflows-shared": "0.12.2"
175
175
  },
176
176
  "peerDependencies": {
@@ -2,7 +2,7 @@
2
2
  * Welcome to Cloudflare Workers! This is your first scheduled worker.
3
3
  *
4
4
  * - Run `wrangler dev` in your terminal to start a development server
5
- * - Run `curl "http://localhost:8787/cdn-cgi/handler/scheduled"` to trigger the scheduled event
5
+ * - Run `curl "http://localhost:8787/cdn-cgi/local/scheduled"` to trigger the scheduled event
6
6
  * - Go back to the console to see what your worker has logged
7
7
  * - Update the Cron trigger in wrangler.toml (see https://developers.cloudflare.com/workers/configuration/cron-triggers/)
8
8
  * - Run `wrangler publish --name my-worker` to publish your worker
@@ -2,7 +2,7 @@
2
2
  * Welcome to Cloudflare Workers! This is your first scheduled worker.
3
3
  *
4
4
  * - Run `wrangler dev` in your terminal to start a development server
5
- * - Run `curl "http://localhost:8787/cdn-cgi/handler/scheduled"` to trigger the scheduled event
5
+ * - Run `curl "http://localhost:8787/cdn-cgi/local/scheduled"` to trigger the scheduled event
6
6
  * - Go back to the console to see what your worker has logged
7
7
  * - Update the Cron trigger in wrangler.toml (see https://developers.cloudflare.com/workers/configuration/cron-triggers/)
8
8
  * - Run `wrangler deploy --name my-worker` to deploy your worker
@@ -132,6 +132,13 @@ export class ProxyWorker implements DurableObject {
132
132
  request.url
133
133
  );
134
134
 
135
+ // rewrite requests to old miniflare paths
136
+ // because wrangler cannot have a breaking change
137
+ userWorkerUrl.pathname = rewriteLegacyMiniflarePath(
138
+ userWorkerUrl.pathname
139
+ );
140
+ innerUrl.pathname = rewriteLegacyMiniflarePath(innerUrl.pathname);
141
+
135
142
  // Preserve client `Accept-Encoding`, rather than using Worker's default
136
143
  // of `Accept-Encoding: br, gzip`
137
144
  const encoding = request.cf?.clientAcceptEncoding;
@@ -238,6 +245,26 @@ export class ProxyWorker implements DurableObject {
238
245
  function isRequestFromProxyController(req: Request, env: Env): boolean {
239
246
  return req.headers.get("Authorization") === env.PROXY_CONTROLLER_AUTH_SECRET;
240
247
  }
248
+
249
+ // Miniflare v5 moved its internal endpoints under `/cdn-cgi/local/` (and
250
+ // `/__cf_local/` for endpoints that must remain reachable over tunnels). These
251
+ // map the pre-v5 paths onto their current equivalents.
252
+ const LEGACY_PATH_REWRITES: readonly [string, string][] = [
253
+ ["/cdn-cgi/handler", "/cdn-cgi/local"],
254
+ ["/cdn-cgi/mf/scheduled", "/cdn-cgi/local/scheduled"],
255
+ ["/cdn-cgi/mf/stream", "/__cf_local/stream"],
256
+ ["/cdn-cgi/mf/imagedelivery", "/__cf_local/imagedelivery"],
257
+ ["/cdn-cgi/explorer", "/cdn-cgi/local/explorer"],
258
+ ];
259
+
260
+ function rewriteLegacyMiniflarePath(pathname: string): string {
261
+ for (const [oldPrefix, newPrefix] of LEGACY_PATH_REWRITES) {
262
+ if (pathname === oldPrefix || pathname.startsWith(`${oldPrefix}/`)) {
263
+ return newPrefix + pathname.slice(oldPrefix.length);
264
+ }
265
+ }
266
+ return pathname;
267
+ }
241
268
  function isHtmlResponse(res: Response): boolean {
242
269
  return res.headers.get("content-type")?.startsWith("text/html") ?? false;
243
270
  }
@@ -122,6 +122,10 @@ var ProxyWorker = class {
122
122
  proxyData.userWorkerInnerUrlOverrides ?? {},
123
123
  request.url
124
124
  );
125
+ userWorkerUrl.pathname = rewriteLegacyMiniflarePath(
126
+ userWorkerUrl.pathname
127
+ );
128
+ innerUrl.pathname = rewriteLegacyMiniflarePath(innerUrl.pathname);
125
129
  const encoding = request.cf?.clientAcceptEncoding;
126
130
  if (encoding !== void 0) headers.set("Accept-Encoding", encoding);
127
131
  rewriteUrlRelatedHeaders(headers, outerUrl, innerUrl);
@@ -180,6 +184,21 @@ var ProxyWorker = class {
180
184
  function isRequestFromProxyController(req, env) {
181
185
  return req.headers.get("Authorization") === env.PROXY_CONTROLLER_AUTH_SECRET;
182
186
  }
187
+ var LEGACY_PATH_REWRITES = [
188
+ ["/cdn-cgi/handler", "/cdn-cgi/local"],
189
+ ["/cdn-cgi/mf/scheduled", "/cdn-cgi/local/scheduled"],
190
+ ["/cdn-cgi/mf/stream", "/__cf_local/stream"],
191
+ ["/cdn-cgi/mf/imagedelivery", "/__cf_local/imagedelivery"],
192
+ ["/cdn-cgi/explorer", "/cdn-cgi/local/explorer"]
193
+ ];
194
+ function rewriteLegacyMiniflarePath(pathname) {
195
+ for (const [oldPrefix, newPrefix] of LEGACY_PATH_REWRITES) {
196
+ if (pathname === oldPrefix || pathname.startsWith(`${oldPrefix}/`)) {
197
+ return newPrefix + pathname.slice(oldPrefix.length);
198
+ }
199
+ }
200
+ return pathname;
201
+ }
183
202
  function isHtmlResponse(res) {
184
203
  return res.headers.get("content-type")?.startsWith("text/html") ?? false;
185
204
  }
@@ -197,13 +197,13 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
197
197
  };
198
198
  };
199
199
  latest_stage: {
200
- status: "skipped" | "active" | "canceled" | "success" | "idle" | "failure";
200
+ status: "success" | "skipped" | "active" | "canceled" | "idle" | "failure";
201
201
  name: "queued" | "build" | "deploy" | "initialize" | "clone_repo";
202
202
  started_on: string | null;
203
203
  ended_on: string | null;
204
204
  };
205
205
  stages: {
206
- status: "skipped" | "active" | "canceled" | "success" | "idle" | "failure";
206
+ status: "success" | "skipped" | "active" | "canceled" | "idle" | "failure";
207
207
  name: "queued" | "build" | "deploy" | "initialize" | "clone_repo";
208
208
  started_on: string | null;
209
209
  ended_on: string | null;