wrangler 3.1.1 → 3.2.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/README.md +5 -5
- package/package.json +3 -3
- package/templates/checked-fetch.js +9 -2
- package/templates/middleware/loader-modules.ts +9 -2
- package/wrangler-dist/cli.js +7267 -7125
package/README.md
CHANGED
|
@@ -41,15 +41,15 @@ $ npm install wrangler --save-dev
|
|
|
41
41
|
|
|
42
42
|
Wrangler is configured via a `wrangler.toml` file in the project root. When utilizing the `wrangler init` command, a `wrangler.toml` file will be created for you.
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
Example:
|
|
45
45
|
|
|
46
46
|
```toml
|
|
47
|
-
main = "./src/index.ts" # init w/ TypeScript
|
|
48
47
|
name = "my-worker"
|
|
49
|
-
|
|
48
|
+
main = "./src/index.ts" # init w/ TypeScript
|
|
49
|
+
compatibility_date = "YYYY-MM-DD"
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
For more detailed information about configuration, refer to the [documentation](https://developers.cloudflare.com/workers/wrangler/configuration/).
|
|
53
53
|
|
|
54
54
|
## Commands
|
|
55
55
|
|
|
@@ -65,7 +65,7 @@ Start a local development server, with live reloading and devtools.
|
|
|
65
65
|
|
|
66
66
|
Publish the given script to the worldwide Cloudflare network.
|
|
67
67
|
|
|
68
|
-
For more commands and options, refer to the [documentation](https://developers.cloudflare.com/workers/
|
|
68
|
+
For more commands and options, refer to the [documentation](https://developers.cloudflare.com/workers/wrangler/commands/).
|
|
69
69
|
|
|
70
70
|
## Pages
|
|
71
71
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wrangler",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Command-line interface for all things Cloudflare Workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wrangler",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"<rootDir>/src/__tests__/jest.setup.ts"
|
|
84
84
|
],
|
|
85
85
|
"testRegex": "src/__tests__/.*\\.(test|spec)\\.[jt]sx?$",
|
|
86
|
-
"testTimeout":
|
|
86
|
+
"testTimeout": 50000,
|
|
87
87
|
"transform": {
|
|
88
88
|
"^.+\\.c?(t|j)sx?$": [
|
|
89
89
|
"esbuild-jest",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"blake3-wasm": "^2.1.5",
|
|
104
104
|
"chokidar": "^3.5.3",
|
|
105
105
|
"esbuild": "0.16.3",
|
|
106
|
-
"miniflare": "
|
|
106
|
+
"miniflare": "3.20230710.0",
|
|
107
107
|
"nanoid": "^3.3.3",
|
|
108
108
|
"path-to-regexp": "^6.2.0",
|
|
109
109
|
"selfsigned": "^2.0.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const urls = new Set();
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
function checkURL(request, init) {
|
|
4
4
|
const url =
|
|
5
5
|
request instanceof URL
|
|
6
6
|
? request
|
|
@@ -19,5 +19,12 @@ export function checkedFetch(request, init) {
|
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
return globalThis.fetch(request, init);
|
|
23
22
|
}
|
|
23
|
+
|
|
24
|
+
globalThis.fetch = new Proxy(globalThis.fetch, {
|
|
25
|
+
apply(target, thisArg, argArray) {
|
|
26
|
+
const [request, init] = argArray;
|
|
27
|
+
checkURL(request, init);
|
|
28
|
+
return Reflect.apply(target, thisArg, argArray);
|
|
29
|
+
},
|
|
30
|
+
});
|
|
@@ -65,6 +65,8 @@ type MissingExportHandlers = Omit<
|
|
|
65
65
|
"tail" | "trace" | "scheduled" | "queue" | "test" | "fetch"
|
|
66
66
|
>;
|
|
67
67
|
|
|
68
|
+
let registeredMiddleware = false;
|
|
69
|
+
|
|
68
70
|
const facade: ExportedHandler<unknown> & MissingExportHandlers = {
|
|
69
71
|
...(worker.tail && {
|
|
70
72
|
tail: maskHandlerEnv(worker.tail),
|
|
@@ -86,8 +88,13 @@ const facade: ExportedHandler<unknown> & MissingExportHandlers = {
|
|
|
86
88
|
const env = getMaskedEnv(rawEnv);
|
|
87
89
|
// Get the chain of middleware from the worker object
|
|
88
90
|
if (worker.middleware && worker.middleware.length > 0) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
// Make sure we only register middleware once:
|
|
92
|
+
// https://github.com/cloudflare/workers-sdk/issues/2386#issuecomment-1614715911
|
|
93
|
+
if (!registeredMiddleware) {
|
|
94
|
+
registeredMiddleware = true;
|
|
95
|
+
for (const middleware of worker.middleware) {
|
|
96
|
+
__facade_register__(middleware);
|
|
97
|
+
}
|
|
91
98
|
}
|
|
92
99
|
|
|
93
100
|
const __facade_modules_dispatch__: Dispatcher = function (type, init) {
|