wrangler 4.43.0 → 4.44.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/config-schema.json
CHANGED
|
@@ -720,6 +720,24 @@
|
|
|
720
720
|
"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
721
|
"default": {}
|
|
722
722
|
},
|
|
723
|
+
"media": {
|
|
724
|
+
"type": "object",
|
|
725
|
+
"properties": {
|
|
726
|
+
"binding": {
|
|
727
|
+
"type": "string"
|
|
728
|
+
},
|
|
729
|
+
"remote": {
|
|
730
|
+
"type": "boolean",
|
|
731
|
+
"description": "Whether the Media binding should be remote or not"
|
|
732
|
+
}
|
|
733
|
+
},
|
|
734
|
+
"required": [
|
|
735
|
+
"binding"
|
|
736
|
+
],
|
|
737
|
+
"additionalProperties": false,
|
|
738
|
+
"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.",
|
|
739
|
+
"default": {}
|
|
740
|
+
},
|
|
723
741
|
"version_metadata": {
|
|
724
742
|
"type": "object",
|
|
725
743
|
"properties": {
|
|
@@ -1869,6 +1887,24 @@
|
|
|
1869
1887
|
"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
1888
|
"default": {}
|
|
1871
1889
|
},
|
|
1890
|
+
"media": {
|
|
1891
|
+
"type": "object",
|
|
1892
|
+
"properties": {
|
|
1893
|
+
"binding": {
|
|
1894
|
+
"type": "string"
|
|
1895
|
+
},
|
|
1896
|
+
"remote": {
|
|
1897
|
+
"type": "boolean",
|
|
1898
|
+
"description": "Whether the Media binding should be remote or not"
|
|
1899
|
+
}
|
|
1900
|
+
},
|
|
1901
|
+
"required": [
|
|
1902
|
+
"binding"
|
|
1903
|
+
],
|
|
1904
|
+
"additionalProperties": false,
|
|
1905
|
+
"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.",
|
|
1906
|
+
"default": {}
|
|
1907
|
+
},
|
|
1872
1908
|
"version_metadata": {
|
|
1873
1909
|
"type": "object",
|
|
1874
1910
|
"properties": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wrangler",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.44.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.
|
|
57
|
+
"workerd": "1.20251011.0",
|
|
58
58
|
"@cloudflare/kv-asset-handler": "0.4.0",
|
|
59
|
-
"
|
|
60
|
-
"
|
|
59
|
+
"miniflare": "4.20251011.0",
|
|
60
|
+
"@cloudflare/unenv-preset": "2.7.8"
|
|
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.
|
|
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",
|
|
@@ -139,16 +141,16 @@
|
|
|
139
141
|
"xxhash-wasm": "^1.0.1",
|
|
140
142
|
"yaml": "^2.8.1",
|
|
141
143
|
"yargs": "^17.7.2",
|
|
144
|
+
"@cloudflare/containers-shared": "0.2.13",
|
|
142
145
|
"@cloudflare/cli": "1.1.3",
|
|
143
|
-
"@cloudflare/containers-shared": "0.2.12",
|
|
144
146
|
"@cloudflare/eslint-config-shared": "1.1.0",
|
|
145
|
-
"@cloudflare/pages-shared": "^0.13.
|
|
147
|
+
"@cloudflare/pages-shared": "^0.13.80",
|
|
146
148
|
"@cloudflare/workers-shared": "0.18.8",
|
|
147
149
|
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
148
150
|
"@cloudflare/workflows-shared": "0.3.7"
|
|
149
151
|
},
|
|
150
152
|
"peerDependencies": {
|
|
151
|
-
"@cloudflare/workers-types": "^4.
|
|
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, {
|
package/wrangler-dist/cli.d.ts
CHANGED
|
@@ -915,6 +915,20 @@ interface EnvironmentNonInheritable {
|
|
|
915
915
|
/** Whether the Images binding should be remote or not in local development */
|
|
916
916
|
remote?: boolean;
|
|
917
917
|
} | undefined;
|
|
918
|
+
/**
|
|
919
|
+
* Binding to Cloudflare Media Transformations
|
|
920
|
+
*
|
|
921
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
922
|
+
* and so must be specified in every named environment.
|
|
923
|
+
*
|
|
924
|
+
* @default {}
|
|
925
|
+
* @nonInheritable
|
|
926
|
+
*/
|
|
927
|
+
media: {
|
|
928
|
+
binding: string;
|
|
929
|
+
/** Whether the Media binding should be remote or not */
|
|
930
|
+
remote?: boolean;
|
|
931
|
+
} | undefined;
|
|
918
932
|
/**
|
|
919
933
|
* Binding to the Worker Version's metadata
|
|
920
934
|
*/
|
|
@@ -1321,6 +1335,13 @@ interface CfImagesBinding {
|
|
|
1321
1335
|
raw?: boolean;
|
|
1322
1336
|
remote?: boolean;
|
|
1323
1337
|
}
|
|
1338
|
+
/**
|
|
1339
|
+
* A binding to Cloudflare Media Transformations
|
|
1340
|
+
*/
|
|
1341
|
+
interface CfMediaBinding {
|
|
1342
|
+
binding: string;
|
|
1343
|
+
remote?: boolean;
|
|
1344
|
+
}
|
|
1324
1345
|
/**
|
|
1325
1346
|
* A Durable Object.
|
|
1326
1347
|
*/
|
|
@@ -2410,7 +2431,9 @@ type Binding = {
|
|
|
2410
2431
|
type: "worker_loader";
|
|
2411
2432
|
} & BindingOmit<CfWorkerLoader>) | ({
|
|
2412
2433
|
type: "vpc_service";
|
|
2413
|
-
} & BindingOmit<CfVpcService>) | {
|
|
2434
|
+
} & BindingOmit<CfVpcService>) | ({
|
|
2435
|
+
type: "media";
|
|
2436
|
+
} & BindingOmit<CfMediaBinding>) | {
|
|
2414
2437
|
type: `unsafe_${string}`;
|
|
2415
2438
|
} | {
|
|
2416
2439
|
type: "assets";
|