wrangler 4.65.0 → 4.67.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 +8 -8
- package/templates/remoteBindings/ProxyServerWorker.ts +30 -0
- package/templates/tsconfig.json +0 -1
- package/wrangler-dist/ProxyServerWorker.js +12 -0
- package/wrangler-dist/cli.d.ts +0 -1
- package/wrangler-dist/cli.js +1388 -586
- package/wrangler-dist/metafile-cjs.json +1 -1
- package/templates/init-tests/test-jest-new-worker.js +0 -23
- package/templates/init-tests/test-vitest-new-worker.js +0 -24
- package/templates/init-tests/test-vitest-new-worker.ts +0 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wrangler",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.67.0",
|
|
4
4
|
"description": "Command-line interface for all things Cloudflare Workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wrangler",
|
|
@@ -54,16 +54,16 @@
|
|
|
54
54
|
"esbuild": "0.27.3",
|
|
55
55
|
"path-to-regexp": "6.3.0",
|
|
56
56
|
"unenv": "2.0.0-rc.24",
|
|
57
|
-
"workerd": "1.
|
|
57
|
+
"workerd": "1.20260219.0",
|
|
58
58
|
"@cloudflare/kv-asset-handler": "0.4.2",
|
|
59
|
-
"@cloudflare/unenv-preset": "2.
|
|
60
|
-
"miniflare": "4.
|
|
59
|
+
"@cloudflare/unenv-preset": "2.14.0",
|
|
60
|
+
"miniflare": "4.20260219.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@aws-sdk/client-s3": "^3.721.0",
|
|
64
64
|
"@bomb.sh/tab": "^0.0.12",
|
|
65
65
|
"@cloudflare/types": "6.18.4",
|
|
66
|
-
"@cloudflare/workers-types": "^4.
|
|
66
|
+
"@cloudflare/workers-types": "^4.20260219.0",
|
|
67
67
|
"@cspotcode/source-map-support": "0.8.1",
|
|
68
68
|
"@netlify/build-info": "^10.2.0",
|
|
69
69
|
"@sentry/node": "^7.86.0",
|
|
@@ -150,14 +150,14 @@
|
|
|
150
150
|
"@cloudflare/cli": "1.2.1",
|
|
151
151
|
"@cloudflare/containers-shared": "0.9.0",
|
|
152
152
|
"@cloudflare/eslint-config-shared": "1.2.1",
|
|
153
|
-
"@cloudflare/pages-shared": "^0.13.107",
|
|
154
153
|
"@cloudflare/workers-shared": "0.19.0",
|
|
154
|
+
"@cloudflare/pages-shared": "^0.13.109",
|
|
155
155
|
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
156
|
-
"@cloudflare/workers-utils": "0.
|
|
156
|
+
"@cloudflare/workers-utils": "0.11.0",
|
|
157
157
|
"@cloudflare/workflows-shared": "0.4.0"
|
|
158
158
|
},
|
|
159
159
|
"peerDependencies": {
|
|
160
|
-
"@cloudflare/workers-types": "^4.
|
|
160
|
+
"@cloudflare/workers-types": "^4.20260219.0"
|
|
161
161
|
},
|
|
162
162
|
"peerDependenciesMeta": {
|
|
163
163
|
"@cloudflare/workers-types": {
|
|
@@ -3,6 +3,18 @@ import { EmailMessage } from "cloudflare:email";
|
|
|
3
3
|
|
|
4
4
|
interface Env extends Record<string, unknown> {}
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* List of RPC methods exposed by the raw AI binding that need proxying
|
|
8
|
+
* through a plain-object wrapper. The raw AI binding (deployed with raw:true)
|
|
9
|
+
* has a non-standard prototype that capnweb's typeForRpc() doesn't recognise,
|
|
10
|
+
* causing "RPC stub points at a non-serializable type". By wrapping only the
|
|
11
|
+
* allowed RPC methods in a plain object we give capnweb an Object.prototype
|
|
12
|
+
* target it can navigate.
|
|
13
|
+
*
|
|
14
|
+
* Add new AI RPC method names here as they are introduced.
|
|
15
|
+
*/
|
|
16
|
+
const AI_RPC_METHODS = ["aiSearch"] as const;
|
|
17
|
+
|
|
6
18
|
class BindingNotFoundError extends Error {
|
|
7
19
|
constructor(name?: string) {
|
|
8
20
|
super(`Binding ${name ? `"${name}"` : ""} not found`);
|
|
@@ -54,6 +66,11 @@ async function evaluateMediaBinding(
|
|
|
54
66
|
* can't emulate that over an async boundary, we mock it locally and _actually_
|
|
55
67
|
* perform the .get() remotely at the first appropriate async point. See
|
|
56
68
|
* packages/miniflare/src/workers/dispatch-namespace/dispatch-namespace.worker.ts
|
|
69
|
+
* - AI bindings (raw:true / minimal_mode) have a workerd-internal prototype
|
|
70
|
+
* that capnweb's typeForRpc() classifies as "unsupported", causing
|
|
71
|
+
* "RPC stub points at a non-serializable type". We wrap the binding in a
|
|
72
|
+
* plain object that delegates only the allowed RPC methods (AI_RPC_METHODS)
|
|
73
|
+
* so capnweb gets an Object.prototype target it can navigate.
|
|
57
74
|
*
|
|
58
75
|
* getExposedJSRPCBinding() and getExposedFetcher() perform the logic for figuring out
|
|
59
76
|
* which binding is being accessed, dependending on the request. Note: Both have logic
|
|
@@ -93,6 +110,19 @@ function getExposedJSRPCBinding(request: Request, env: Env) {
|
|
|
93
110
|
};
|
|
94
111
|
}
|
|
95
112
|
|
|
113
|
+
if (url.searchParams.get("MF-Binding-Type") === "ai") {
|
|
114
|
+
const wrapper: Record<string, (...args: unknown[]) => unknown> = {};
|
|
115
|
+
for (const method of AI_RPC_METHODS) {
|
|
116
|
+
if (typeof (targetBinding as any)[method] === "function") {
|
|
117
|
+
wrapper[method] = (...args: unknown[]) =>
|
|
118
|
+
(targetBinding as any)[method](...args);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (Object.keys(wrapper).length > 0) {
|
|
122
|
+
return wrapper;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
96
126
|
if (url.searchParams.has("MF-Dispatch-Namespace-Options")) {
|
|
97
127
|
const { name, args, options } = JSON.parse(
|
|
98
128
|
url.searchParams.get("MF-Dispatch-Namespace-Options")!
|
package/templates/tsconfig.json
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
"include": ["**/*.ts"],
|
|
7
7
|
"exclude": [
|
|
8
8
|
"__tests__",
|
|
9
|
-
"./init-tests/**",
|
|
10
9
|
// Note: `startDevWorker` and `middleware` should also be included but some work is needed
|
|
11
10
|
// for that first (see: https://github.com/cloudflare/workers-sdk/issues/8303)
|
|
12
11
|
"startDevWorker",
|
|
@@ -2407,6 +2407,7 @@ async function newWorkersRpcResponse(request, localMain) {
|
|
|
2407
2407
|
|
|
2408
2408
|
// templates/remoteBindings/ProxyServerWorker.ts
|
|
2409
2409
|
import { EmailMessage } from "cloudflare:email";
|
|
2410
|
+
var AI_RPC_METHODS = ["aiSearch"];
|
|
2410
2411
|
var BindingNotFoundError = class extends Error {
|
|
2411
2412
|
constructor(name) {
|
|
2412
2413
|
super(`Binding ${name ? `"${name}"` : ""} not found`);
|
|
@@ -2455,6 +2456,17 @@ function getExposedJSRPCBinding(request, env) {
|
|
|
2455
2456
|
}
|
|
2456
2457
|
};
|
|
2457
2458
|
}
|
|
2459
|
+
if (url.searchParams.get("MF-Binding-Type") === "ai") {
|
|
2460
|
+
const wrapper = {};
|
|
2461
|
+
for (const method of AI_RPC_METHODS) {
|
|
2462
|
+
if (typeof targetBinding[method] === "function") {
|
|
2463
|
+
wrapper[method] = (...args) => targetBinding[method](...args);
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
if (Object.keys(wrapper).length > 0) {
|
|
2467
|
+
return wrapper;
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2458
2470
|
if (url.searchParams.has("MF-Dispatch-Namespace-Options")) {
|
|
2459
2471
|
const { name, args, options } = JSON.parse(
|
|
2460
2472
|
url.searchParams.get("MF-Dispatch-Namespace-Options")
|