wrangler 4.115.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 +16 -14
- package/templates/new-worker-scheduled.js +1 -1
- package/templates/new-worker-scheduled.ts +1 -1
- package/templates/pages-template-worker.ts +2 -0
- package/templates/startDevWorker/ProxyWorker.ts +27 -0
- package/wrangler-dist/ProxyWorker.js +19 -0
- package/wrangler-dist/cli.d.ts +42 -2
- package/wrangler-dist/cli.js +118715 -57488
- package/wrangler-dist/metafile-cjs.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wrangler",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.117.0",
|
|
4
4
|
"description": "Command-line interface for all things Cloudflare Workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"assembly",
|
|
@@ -66,17 +66,17 @@
|
|
|
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.
|
|
69
|
+
"workerd": "1.20260730.1",
|
|
70
70
|
"@cloudflare/kv-asset-handler": "0.5.0",
|
|
71
71
|
"@cloudflare/unenv-preset": "2.16.1",
|
|
72
|
-
"miniflare": "
|
|
72
|
+
"miniflare": "5.20260730.0-alpha"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@aws-sdk/client-s3": "^3.721.0",
|
|
76
76
|
"@aws-sdk/s3-request-presigner": "^3.721.0",
|
|
77
77
|
"@bomb.sh/tab": "^0.0.12",
|
|
78
78
|
"@cloudflare/types": "6.18.4",
|
|
79
|
-
"@cloudflare/workers-types": "^5.
|
|
79
|
+
"@cloudflare/workers-types": "^5.20260730.1",
|
|
80
80
|
"@cspotcode/source-map-support": "0.8.1",
|
|
81
81
|
"@netlify/build-info": "^10.5.1",
|
|
82
82
|
"@sentry/node": "^7.86.0",
|
|
@@ -156,23 +156,25 @@
|
|
|
156
156
|
"yaml": "^2.8.1",
|
|
157
157
|
"yargs": "^17.7.2",
|
|
158
158
|
"zod": "4.4.3",
|
|
159
|
-
"@cloudflare/autoconfig": "0.2.
|
|
160
|
-
"@cloudflare/
|
|
159
|
+
"@cloudflare/autoconfig": "0.2.3",
|
|
160
|
+
"@cloudflare/build-output-utils": "0.1.0",
|
|
161
|
+
"@cloudflare/cli-shared-helpers": "0.1.19",
|
|
161
162
|
"@cloudflare/codemod": "1.1.0",
|
|
162
|
-
"@cloudflare/config": "0.
|
|
163
|
+
"@cloudflare/config": "0.4.0",
|
|
163
164
|
"@cloudflare/containers-shared": "0.16.0",
|
|
164
|
-
"@cloudflare/deploy-helpers": "0.6.
|
|
165
|
-
"@cloudflare/pages-
|
|
166
|
-
"@cloudflare/
|
|
167
|
-
"@cloudflare/
|
|
168
|
-
"@cloudflare/
|
|
165
|
+
"@cloudflare/deploy-helpers": "0.6.4",
|
|
166
|
+
"@cloudflare/pages-functions": "0.1.0",
|
|
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",
|
|
169
171
|
"@cloudflare/workers-shared": "0.19.9",
|
|
170
172
|
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
171
|
-
"@cloudflare/workers-utils": "0.
|
|
173
|
+
"@cloudflare/workers-utils": "0.31.0",
|
|
172
174
|
"@cloudflare/workflows-shared": "0.12.2"
|
|
173
175
|
},
|
|
174
176
|
"peerDependencies": {
|
|
175
|
-
"@cloudflare/workers-types": "^5.
|
|
177
|
+
"@cloudflare/workers-types": "^5.20260730.1"
|
|
176
178
|
},
|
|
177
179
|
"peerDependenciesMeta": {
|
|
178
180
|
"@cloudflare/workers-types": {
|
|
@@ -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/
|
|
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/
|
|
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
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// This file is a copy of packages/pages-functions/src/templates/pages-template-worker.ts.
|
|
2
|
+
// Changes here should be reflected there and vice-versa.
|
|
1
3
|
import { match } from "path-to-regexp";
|
|
2
4
|
|
|
3
5
|
//note: this explicitly does not include the * character, as pages requires this
|
|
@@ -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
|
}
|
package/wrangler-dist/cli.d.ts
CHANGED
|
@@ -197,13 +197,13 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
|
|
|
197
197
|
};
|
|
198
198
|
};
|
|
199
199
|
latest_stage: {
|
|
200
|
-
status: "
|
|
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: "
|
|
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;
|
|
@@ -816,6 +816,33 @@ type DurableObjectIdentifier = {
|
|
|
816
816
|
id: string;
|
|
817
817
|
name?: never;
|
|
818
818
|
};
|
|
819
|
+
type FetcherEmailOptions = {
|
|
820
|
+
from: string;
|
|
821
|
+
to: string;
|
|
822
|
+
raw: string | ReadableStream<Uint8Array>;
|
|
823
|
+
};
|
|
824
|
+
type FetcherEmailResult = {
|
|
825
|
+
outcome: "ok" | "exception";
|
|
826
|
+
rejectReason?: string;
|
|
827
|
+
forwards: Array<{
|
|
828
|
+
messageId: string;
|
|
829
|
+
recipient: string;
|
|
830
|
+
headers: [string, string][];
|
|
831
|
+
}>;
|
|
832
|
+
replies: Array<{
|
|
833
|
+
messageId: string;
|
|
834
|
+
sender: string;
|
|
835
|
+
raw: string;
|
|
836
|
+
}>;
|
|
837
|
+
events: Array<{
|
|
838
|
+
type: "forward" | "reply";
|
|
839
|
+
timestamp: string;
|
|
840
|
+
messageId: string;
|
|
841
|
+
} | {
|
|
842
|
+
type: "reject";
|
|
843
|
+
timestamp: string;
|
|
844
|
+
}>;
|
|
845
|
+
};
|
|
819
846
|
type WorkerDefaultExport = (new (...args: any[]) => Rpc.WorkerEntrypointBranded) | Rpc.WorkerEntrypointBranded | AnyExportedHandler;
|
|
820
847
|
type WorkerModule = {
|
|
821
848
|
default: WorkerDefaultExport;
|
|
@@ -838,6 +865,19 @@ type WorkerHandle<Env = AnyEnv, Module extends WorkerModule = {
|
|
|
838
865
|
* ```
|
|
839
866
|
*/
|
|
840
867
|
fetch: DispatchFetch;
|
|
868
|
+
/**
|
|
869
|
+
* Dispatches an email event directly to this Worker.
|
|
870
|
+
*
|
|
871
|
+
* @example
|
|
872
|
+
* ```ts
|
|
873
|
+
* const result = await worker.email({
|
|
874
|
+
* from: "sender@example.com",
|
|
875
|
+
* to: "recipient@example.com",
|
|
876
|
+
* raw: "From: sender@example.com\\r\\n...",
|
|
877
|
+
* });
|
|
878
|
+
* ```
|
|
879
|
+
*/
|
|
880
|
+
email(options: FetcherEmailOptions): Promise<FetcherEmailResult>;
|
|
841
881
|
/**
|
|
842
882
|
* Dispatches a scheduled event directly to this Worker.
|
|
843
883
|
*
|