wrangler 0.0.0-cc9ced83 → 0.0.0-ccc19d57
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/middleware/loader-modules.ts +13 -3
- package/wrangler-dist/cli.js +8078 -7680
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-ccc19d57",
|
|
4
4
|
"description": "Command-line interface for all things Cloudflare Workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wrangler",
|
|
@@ -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.20230717.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.20230717.0",
|
|
118
118
|
"@iarna/toml": "^3.0.0",
|
|
119
119
|
"@microsoft/api-extractor": "^7.28.3",
|
|
120
120
|
"@types/better-sqlite3": "^7.6.0",
|
|
@@ -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) {
|