wrangler 0.0.0-be15640d → 0.0.0-be3a43ff
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 +6 -6
- package/templates/checked-fetch.js +9 -2
- package/templates/middleware/loader-modules.ts +13 -3
- package/wrangler-dist/cli.js +7529 -7344
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": "0.0.0-
|
|
3
|
+
"version": "0.0.0-be3a43ff",
|
|
4
4
|
"description": "Command-line interface for all things Cloudflare Workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wrangler",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"test": "npm run assert-git-version && jest",
|
|
64
64
|
"test:ci": "npm run test -- --coverage",
|
|
65
65
|
"test:debug": "npm run test -- --silent=false --verbose=true",
|
|
66
|
-
"test:e2e": "vitest --single-thread ./e2e",
|
|
66
|
+
"test:e2e": "vitest --test-timeout 240000 --single-thread --dir ./e2e run",
|
|
67
67
|
"test:watch": "npm run test -- --runInBand --testTimeout=50000 --watch",
|
|
68
68
|
"type:tests": "tsc -p ./src/__tests__/tsconfig.json && tsc -p ./e2e/tsconfig.json"
|
|
69
69
|
},
|
|
@@ -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",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"@cloudflare/eslint-config-worker": "*",
|
|
115
115
|
"@cloudflare/types": "^6.18.4",
|
|
116
116
|
"@cloudflare/workers-tsconfig": "*",
|
|
117
|
-
"@cloudflare/workers-types": "^4.
|
|
117
|
+
"@cloudflare/workers-types": "^4.20230710.0",
|
|
118
118
|
"@iarna/toml": "^3.0.0",
|
|
119
119
|
"@microsoft/api-extractor": "^7.28.3",
|
|
120
120
|
"@types/better-sqlite3": "^7.6.0",
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
"remove-accents-esm": "^0.0.1",
|
|
173
173
|
"semiver": "^1.1.0",
|
|
174
174
|
"serve-static": "^1.15.0",
|
|
175
|
-
"shellac": "^0.
|
|
175
|
+
"shellac": "^0.8.0",
|
|
176
176
|
"signal-exit": "^3.0.7",
|
|
177
177
|
"strip-ansi": "^7.0.1",
|
|
178
178
|
"supports-color": "^9.2.2",
|
|
@@ -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
|
+
});
|
|
@@ -62,9 +62,11 @@ function getMaskedEnv(rawEnv: unknown) {
|
|
|
62
62
|
*/
|
|
63
63
|
type MissingExportHandlers = Omit<
|
|
64
64
|
Required<ExportedHandler>,
|
|
65
|
-
"tail" | "trace" | "scheduled" | "queue" | "test" | "fetch"
|
|
65
|
+
"tail" | "trace" | "scheduled" | "queue" | "test" | "email" | "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),
|
|
@@ -81,13 +83,21 @@ const facade: ExportedHandler<unknown> & MissingExportHandlers = {
|
|
|
81
83
|
...(worker.test && {
|
|
82
84
|
test: maskHandlerEnv(worker.test),
|
|
83
85
|
}),
|
|
86
|
+
...(worker.email && {
|
|
87
|
+
email: maskHandlerEnv(worker.email),
|
|
88
|
+
}),
|
|
84
89
|
|
|
85
90
|
fetch(request, rawEnv, ctx) {
|
|
86
91
|
const env = getMaskedEnv(rawEnv);
|
|
87
92
|
// Get the chain of middleware from the worker object
|
|
88
93
|
if (worker.middleware && worker.middleware.length > 0) {
|
|
89
|
-
|
|
90
|
-
|
|
94
|
+
// Make sure we only register middleware once:
|
|
95
|
+
// https://github.com/cloudflare/workers-sdk/issues/2386#issuecomment-1614715911
|
|
96
|
+
if (!registeredMiddleware) {
|
|
97
|
+
registeredMiddleware = true;
|
|
98
|
+
for (const middleware of worker.middleware) {
|
|
99
|
+
__facade_register__(middleware);
|
|
100
|
+
}
|
|
91
101
|
}
|
|
92
102
|
|
|
93
103
|
const __facade_modules_dispatch__: Dispatcher = function (type, init) {
|