wrangler 0.0.0-fcaaa9fa → 0.0.0-fd39ae64

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 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
- example:
44
+ Example:
45
45
 
46
46
  ```toml
47
- main = "./src/index.ts" # init w/ TypeScript
48
47
  name = "my-worker"
49
- compatibility_date = "YYY-MM-DD"
48
+ main = "./src/index.ts" # init w/ TypeScript
49
+ compatibility_date = "YYYY-MM-DD"
50
50
  ```
51
51
 
52
- for more detailed information about configuration, see the [documentation](https://developers.cloudflare.com/workers/cli-wrangler/configuration)
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/cli-wrangler/commands).
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,197 +1,208 @@
1
1
  {
2
- "name": "wrangler",
3
- "version": "0.0.0-fcaaa9fa",
4
- "description": "Command-line interface for all things Cloudflare Workers",
5
- "keywords": [
6
- "wrangler",
7
- "cloudflare",
8
- "workers",
9
- "cloudflare workers",
10
- "edge",
11
- "compute",
12
- "serverless",
13
- "serverless application",
14
- "serverless module",
15
- "wasm",
16
- "web",
17
- "assembly",
18
- "webassembly",
19
- "rust",
20
- "emscripten",
21
- "typescript",
22
- "graphql",
23
- "router",
24
- "http",
25
- "cli"
26
- ],
27
- "homepage": "https://github.com/cloudflare/workers-sdk#readme",
28
- "bugs": {
29
- "url": "https://github.com/cloudflare/workers-sdk/issues"
30
- },
31
- "repository": {
32
- "type": "git",
33
- "url": "https://github.com/cloudflare/workers-sdk.git",
34
- "directory": "packages/wrangler"
35
- },
36
- "license": "MIT OR Apache-2.0",
37
- "author": "wrangler@cloudflare.com",
38
- "main": "wrangler-dist/cli.js",
39
- "types": "wrangler-dist/cli.d.ts",
40
- "bin": {
41
- "wrangler": "./bin/wrangler.js",
42
- "wrangler2": "./bin/wrangler.js"
43
- },
44
- "files": [
45
- "bin",
46
- "miniflare-dist",
47
- "wrangler-dist",
48
- "templates",
49
- "kv-asset-handler.js",
50
- "Cloudflare_CA.pem"
51
- ],
52
- "scripts": {
53
- "assert-git-version": "node -r esbuild-register scripts/assert-git-version.ts",
54
- "build": "npm run clean && npm run bundle && npm run emit-types",
55
- "bundle": "node -r esbuild-register scripts/bundle.ts",
56
- "check:lint": "eslint .",
57
- "check:type": "tsc",
58
- "clean": "rimraf wrangler-dist miniflare-dist emitted-types",
59
- "create-cloudflare": "create-cloudflare",
60
- "dev": "npm run clean && concurrently -c black,blue --kill-others-on-fail false 'npm run bundle -- --watch' 'npm run check:type -- --watch --preserveWatchOutput'",
61
- "emit-types": "tsc -p tsconfig.emit.json && node -r esbuild-register scripts/emit-types.ts",
62
- "prepublishOnly": "SOURCEMAPS=false npm run build",
63
- "start": "npm run bundle && cross-env NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js",
64
- "test": "npm run assert-git-version && jest",
65
- "test:ci": "npm run test -- --coverage",
66
- "test:debug": "npm run test -- --silent=false --verbose=true",
67
- "test:e2e": "vitest --test-timeout 120000 --single-thread --dir ./e2e run",
68
- "test:watch": "npm run test -- --runInBand --testTimeout=50000 --watch",
69
- "type:tests": "tsc -p ./src/__tests__/tsconfig.json && tsc -p ./e2e/tsconfig.json"
70
- },
71
- "jest": {
72
- "coverageReporters": [
73
- "json",
74
- "html",
75
- "text",
76
- "cobertura"
77
- ],
78
- "moduleNameMapper": {
79
- "clipboardy": "<rootDir>/src/__tests__/helpers/clipboardy-mock.js",
80
- "miniflare/cli": "<rootDir>/../../node_modules/miniflare/dist/src/cli.js"
81
- },
82
- "restoreMocks": true,
83
- "setupFilesAfterEnv": [
84
- "<rootDir>/src/__tests__/jest.setup.ts"
85
- ],
86
- "testRegex": "src/__tests__/.*\\.(test|spec)\\.[jt]sx?$",
87
- "testTimeout": 30000,
88
- "transform": {
89
- "^.+\\.c?(t|j)sx?$": [
90
- "esbuild-jest",
91
- {
92
- "sourcemap": true
93
- }
94
- ]
95
- },
96
- "transformIgnorePatterns": [
97
- "node_modules/(?!find-up|locate-path|p-locate|p-limit|p-timeout|p-queue|yocto-queue|path-exists|execa|strip-final-newline|npm-run-path|path-key|onetime|mimic-fn|human-signals|is-stream|get-port|supports-color|pretty-bytes|npx-import)"
98
- ]
99
- },
100
- "dependencies": {
101
- "@cloudflare/kv-asset-handler": "^0.2.0",
102
- "@esbuild-plugins/node-globals-polyfill": "^0.1.1",
103
- "@esbuild-plugins/node-modules-polyfill": "^0.1.4",
104
- "blake3-wasm": "^2.1.5",
105
- "chokidar": "^3.5.3",
106
- "esbuild": "0.16.3",
107
- "miniflare": "^3.0.1",
108
- "nanoid": "^3.3.3",
109
- "path-to-regexp": "^6.2.0",
110
- "selfsigned": "^2.0.1",
111
- "source-map": "^0.7.4",
112
- "xxhash-wasm": "^1.0.1"
113
- },
114
- "devDependencies": {
115
- "@cloudflare/eslint-config-worker": "*",
116
- "@cloudflare/types": "^6.18.4",
117
- "@cloudflare/workers-tsconfig": "*",
118
- "@cloudflare/workers-types": "^4.20230511.0",
119
- "@iarna/toml": "^3.0.0",
120
- "@microsoft/api-extractor": "^7.28.3",
121
- "@types/better-sqlite3": "^7.6.0",
122
- "@types/busboy": "^1.5.0",
123
- "@types/command-exists": "^1.2.0",
124
- "@types/express": "^4.17.13",
125
- "@types/glob-to-regexp": "0.4.1",
126
- "@types/javascript-time-ago": "^2.0.3",
127
- "@types/mime": "^2.0.3",
128
- "@types/prompts": "^2.0.14",
129
- "@types/react": "^17.0.37",
130
- "@types/serve-static": "^1.13.10",
131
- "@types/signal-exit": "^3.0.1",
132
- "@types/supports-color": "^8.1.1",
133
- "@types/ws": "^8.5.3",
134
- "@types/yargs": "^17.0.10",
135
- "@webcontainer/env": "^1.1.0",
136
- "body-parser": "^1.20.0",
137
- "chalk": "^2.4.2",
138
- "cli-table3": "^0.6.3",
139
- "clipboardy": "^3.0.0",
140
- "cmd-shim": "^4.1.0",
141
- "command-exists": "^1.2.9",
142
- "concurrently": "^7.2.2",
143
- "devtools-protocol": "^0.0.955664",
144
- "dotenv": "^16.0.0",
145
- "execa": "^6.1.0",
146
- "express": "^4.18.1",
147
- "finalhandler": "^1.2.0",
148
- "find-up": "^6.3.0",
149
- "get-port": "^6.1.2",
150
- "glob-to-regexp": "0.4.1",
151
- "http-terminator": "^3.2.0",
152
- "ignore": "^5.2.0",
153
- "ink": "^3.2.0",
154
- "ink-select-input": "^4.2.1",
155
- "ink-spinner": "^4.0.3",
156
- "ink-table": "^3.0.0",
157
- "ink-testing-library": "^2.1.0",
158
- "ink-text-input": "^4.0.3",
159
- "is-ci": "^3.0.1",
160
- "javascript-time-ago": "^2.5.4",
161
- "jest-fetch-mock": "^3.0.3",
162
- "jest-websocket-mock": "^2.3.0",
163
- "mime": "^3.0.0",
164
- "minimatch": "^5.1.0",
165
- "msw": "^0.49.1",
166
- "npx-import": "^1.1.3",
167
- "open": "^8.4.0",
168
- "p-queue": "^7.2.0",
169
- "pretty-bytes": "^6.0.0",
170
- "prompts": "^2.4.2",
171
- "react": "^17.0.2",
172
- "react-error-boundary": "^3.1.4",
173
- "remove-accents-esm": "^0.0.1",
174
- "semiver": "^1.1.0",
175
- "serve-static": "^1.15.0",
176
- "shellac": "^0.8.0",
177
- "signal-exit": "^3.0.7",
178
- "strip-ansi": "^7.0.1",
179
- "supports-color": "^9.2.2",
180
- "timeago.js": "^4.0.2",
181
- "tmp-promise": "^3.0.3",
182
- "ts-dedent": "^2.2.0",
183
- "undici": "5.20.0",
184
- "update-check": "^1.5.4",
185
- "vitest": "^0.31.0",
186
- "ws": "^8.5.0",
187
- "xdg-app-paths": "^7.3.0",
188
- "yargs": "^17.4.1",
189
- "yoga-layout": "file:../../vendor/yoga-layout-2.0.0-beta.1.tgz"
190
- },
191
- "optionalDependencies": {
192
- "fsevents": "~2.3.2"
193
- },
194
- "engines": {
195
- "node": ">=16.13.0"
196
- }
197
- }
2
+ "name": "wrangler",
3
+ "version": "0.0.0-fd39ae64",
4
+ "description": "Command-line interface for all things Cloudflare Workers",
5
+ "keywords": [
6
+ "wrangler",
7
+ "cloudflare",
8
+ "workers",
9
+ "cloudflare workers",
10
+ "edge",
11
+ "compute",
12
+ "serverless",
13
+ "serverless application",
14
+ "serverless module",
15
+ "wasm",
16
+ "web",
17
+ "assembly",
18
+ "webassembly",
19
+ "rust",
20
+ "emscripten",
21
+ "typescript",
22
+ "graphql",
23
+ "router",
24
+ "http",
25
+ "cli"
26
+ ],
27
+ "homepage": "https://github.com/cloudflare/workers-sdk#readme",
28
+ "bugs": {
29
+ "url": "https://github.com/cloudflare/workers-sdk/issues"
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/cloudflare/workers-sdk.git",
34
+ "directory": "packages/wrangler"
35
+ },
36
+ "license": "MIT OR Apache-2.0",
37
+ "author": "wrangler@cloudflare.com",
38
+ "main": "wrangler-dist/cli.js",
39
+ "types": "wrangler-dist/cli.d.ts",
40
+ "bin": {
41
+ "wrangler": "./bin/wrangler.js",
42
+ "wrangler2": "./bin/wrangler.js"
43
+ },
44
+ "files": [
45
+ "bin",
46
+ "miniflare-dist",
47
+ "wrangler-dist",
48
+ "templates",
49
+ "kv-asset-handler.js",
50
+ "Cloudflare_CA.pem"
51
+ ],
52
+ "jest": {
53
+ "coverageReporters": [
54
+ "json",
55
+ "html",
56
+ "text",
57
+ "cobertura"
58
+ ],
59
+ "moduleNameMapper": {
60
+ "clipboardy": "<rootDir>/src/__tests__/helpers/clipboardy-mock.js",
61
+ "miniflare/cli": "<rootDir>/../../node_modules/miniflare/dist/src/cli.js"
62
+ },
63
+ "restoreMocks": true,
64
+ "setupFilesAfterEnv": [
65
+ "<rootDir>/src/__tests__/jest.setup.ts"
66
+ ],
67
+ "testRegex": "src/__tests__/.*\\.(test|spec)\\.[jt]sx?$",
68
+ "testTimeout": 50000,
69
+ "transform": {
70
+ "^.+\\.c?(t|j)sx?$": [
71
+ "esbuild-jest",
72
+ {
73
+ "sourcemap": true
74
+ }
75
+ ]
76
+ },
77
+ "transformIgnorePatterns": [
78
+ "node_modules/.pnpm/(?!find-up|locate-path|p-locate|p-limit|p-timeout|p-queue|yocto-queue|path-exists|execa|strip-final-newline|npm-run-path|path-key|onetime|mimic-fn|human-signals|is-stream|get-port|supports-color|pretty-bytes|npx-import)"
79
+ ],
80
+ "snapshotFormat": {
81
+ "escapeString": true,
82
+ "printBasicPrototype": true
83
+ }
84
+ },
85
+ "dependencies": {
86
+ "@cloudflare/kv-asset-handler": "^0.2.0",
87
+ "@esbuild-plugins/node-globals-polyfill": "^0.2.3",
88
+ "@esbuild-plugins/node-modules-polyfill": "^0.2.2",
89
+ "blake3-wasm": "^2.1.5",
90
+ "chokidar": "^3.5.3",
91
+ "esbuild": "0.17.19",
92
+ "miniflare": "3.20230918.0",
93
+ "nanoid": "^3.3.3",
94
+ "path-to-regexp": "^6.2.0",
95
+ "selfsigned": "^2.0.1",
96
+ "source-map": "0.6.1",
97
+ "source-map-support": "0.5.21",
98
+ "xxhash-wasm": "^1.0.1"
99
+ },
100
+ "devDependencies": {
101
+ "@cloudflare/eslint-config-worker": "*",
102
+ "@cloudflare/types": "^6.18.4",
103
+ "@cloudflare/workers-types": "^4.20230724.0",
104
+ "@iarna/toml": "^3.0.0",
105
+ "@microsoft/api-extractor": "^7.28.3",
106
+ "@types/body-parser": "^1.19.2",
107
+ "@types/busboy": "^1.5.0",
108
+ "@types/command-exists": "^1.2.0",
109
+ "@types/express": "^4.17.13",
110
+ "@types/glob-to-regexp": "0.4.1",
111
+ "@types/is-ci": "^3.0.0",
112
+ "@types/javascript-time-ago": "^2.0.3",
113
+ "@types/mime": "^2.0.3",
114
+ "@types/minimatch": "^5.1.2",
115
+ "@types/prompts": "^2.0.14",
116
+ "@types/react": "^17.0.37",
117
+ "@types/serve-static": "^1.13.10",
118
+ "@types/signal-exit": "^3.0.1",
119
+ "@types/source-map-support": "^0.5.7",
120
+ "@types/supports-color": "^8.1.1",
121
+ "@types/ws": "^8.5.3",
122
+ "@types/yargs": "^17.0.10",
123
+ "@webcontainer/env": "^1.1.0",
124
+ "@types/jest": "^29.5.5",
125
+ "esbuild-jest": "0.5.0",
126
+ "jest": "^29.7.0",
127
+ "body-parser": "^1.20.0",
128
+ "chalk": "^2.4.2",
129
+ "cli-table3": "^0.6.3",
130
+ "clipboardy": "^3.0.0",
131
+ "cmd-shim": "^4.1.0",
132
+ "command-exists": "^1.2.9",
133
+ "concurrently": "^7.2.2",
134
+ "devtools-protocol": "^0.0.955664",
135
+ "dotenv": "^16.0.0",
136
+ "execa": "^6.1.0",
137
+ "express": "^4.18.1",
138
+ "finalhandler": "^1.2.0",
139
+ "find-up": "^6.3.0",
140
+ "get-port": "^6.1.2",
141
+ "glob-to-regexp": "0.4.1",
142
+ "http-terminator": "^3.2.0",
143
+ "ignore": "^5.2.0",
144
+ "ink": "^3.2.0",
145
+ "ink-select-input": "^4.2.1",
146
+ "ink-spinner": "^4.0.3",
147
+ "ink-table": "^3.0.0",
148
+ "ink-testing-library": "^2.1.0",
149
+ "ink-text-input": "^4.0.3",
150
+ "is-ci": "^3.0.1",
151
+ "javascript-time-ago": "^2.5.4",
152
+ "jest-fetch-mock": "^3.0.3",
153
+ "jest-websocket-mock": "^2.5.0",
154
+ "mime": "^3.0.0",
155
+ "minimatch": "^5.1.0",
156
+ "msw": "^0.49.1",
157
+ "npx-import": "^1.1.3",
158
+ "open": "^8.4.0",
159
+ "p-queue": "^7.2.0",
160
+ "patch-console": "^1.0.0",
161
+ "pretty-bytes": "^6.0.0",
162
+ "prompts": "^2.4.2",
163
+ "react": "^17.0.2",
164
+ "react-error-boundary": "^3.1.4",
165
+ "remove-accents-esm": "^0.0.1",
166
+ "semiver": "^1.1.0",
167
+ "serve-static": "^1.15.0",
168
+ "shellac": "^0.8.0",
169
+ "signal-exit": "^3.0.7",
170
+ "strip-ansi": "^7.0.1",
171
+ "supports-color": "^9.2.2",
172
+ "timeago.js": "^4.0.2",
173
+ "tmp-promise": "^3.0.3",
174
+ "ts-dedent": "^2.2.0",
175
+ "undici": "5.20.0",
176
+ "update-check": "^1.5.4",
177
+ "vitest": "^0.34.4",
178
+ "ws": "^8.5.0",
179
+ "xdg-app-paths": "^7.3.0",
180
+ "yargs": "^17.4.1",
181
+ "yoga-layout": "file:../../vendor/yoga-layout-2.0.0-beta.1.tgz",
182
+ "@cloudflare/pages-shared": "^0.9.0",
183
+ "@cloudflare/workers-tsconfig": "0.0.0"
184
+ },
185
+ "optionalDependencies": {
186
+ "fsevents": "~2.3.2"
187
+ },
188
+ "engines": {
189
+ "node": ">=16.13.0"
190
+ },
191
+ "scripts": {
192
+ "assert-git-version": "node -r esbuild-register scripts/assert-git-version.ts",
193
+ "build": "pnpm run clean && pnpm run bundle && pnpm run emit-types",
194
+ "bundle": "node -r esbuild-register scripts/bundle.ts",
195
+ "check:lint": "eslint .",
196
+ "check:type": "tsc",
197
+ "clean": "rimraf wrangler-dist miniflare-dist emitted-types",
198
+ "dev": "pnpm run clean && concurrently -c black,blue --kill-others-on-fail false 'pnpm run bundle --watch' 'pnpm run check:type --watch --preserveWatchOutput'",
199
+ "emit-types": "tsc -p tsconfig.emit.json && node -r esbuild-register scripts/emit-types.ts",
200
+ "start": "pnpm run bundle && cross-env NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js",
201
+ "test": "pnpm run assert-git-version && jest",
202
+ "test:ci": "pnpm run test --coverage",
203
+ "test:debug": "pnpm run test --silent=false --verbose=true",
204
+ "test:e2e": "vitest --test-timeout 240000 --single-thread --dir ./e2e run",
205
+ "test:watch": "pnpm run test --runInBand --testTimeout=50000 --watch",
206
+ "type:tests": "tsc -p ./src/__tests__/tsconfig.json && tsc -p ./e2e/tsconfig.json"
207
+ }
208
+ }
@@ -1,6 +1,6 @@
1
1
  const urls = new Set();
2
2
 
3
- export function checkedFetch(request, init) {
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
- for (const middleware of worker.middleware) {
90
- __facade_register__(middleware);
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) {
@@ -30,3 +30,4 @@ const jsonError: Middleware = async (request, env, _ctx, middlewareCtx) => {
30
30
  };
31
31
 
32
32
  export default jsonError;
33
+ export const wrap = undefined;