wrangler 3.57.0 → 3.57.2
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/bin/wrangler.js +0 -28
- package/package.json +12 -44
- package/templates/facade.d.ts +2 -2
- package/templates/middleware/loader-modules.ts +14 -13
- package/wrangler-dist/cli.d.ts +25 -0
- package/wrangler-dist/cli.js +266 -242
- package/Cloudflare_CA.pem +0 -18
- package/wrangler-dist/cli.js.map +0 -7
package/bin/wrangler.js
CHANGED
@@ -28,30 +28,6 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://gi
|
|
28
28
|
return;
|
29
29
|
}
|
30
30
|
|
31
|
-
let pathToCACerts = process.env.NODE_EXTRA_CA_CERTS;
|
32
|
-
if (pathToCACerts) {
|
33
|
-
// TODO:
|
34
|
-
// - should we log a warning here?
|
35
|
-
// - maybe we can generate a certificate that concatenates with ours?
|
36
|
-
//
|
37
|
-
// I do think it'll be rare that someone wants to add a cert AND
|
38
|
-
// use Cloudflare WARP, but let's wait till the situation actually
|
39
|
-
// arises before we do anything about it
|
40
|
-
} else {
|
41
|
-
const osTempDir = os.tmpdir();
|
42
|
-
const certDir = path.join(osTempDir, "wrangler-cert");
|
43
|
-
const certPath = path.join(certDir, "Cloudflare_CA.pem");
|
44
|
-
// copy cert to the system temp dir if needed
|
45
|
-
if (!fs.existsSync(certPath)) {
|
46
|
-
fs.mkdirSync(certDir, { recursive: true });
|
47
|
-
fs.writeFileSync(
|
48
|
-
certPath,
|
49
|
-
fs.readFileSync(path.join(__dirname, "../Cloudflare_CA.pem"), "utf-8")
|
50
|
-
);
|
51
|
-
}
|
52
|
-
pathToCACerts = certPath;
|
53
|
-
}
|
54
|
-
|
55
31
|
return spawn(
|
56
32
|
process.execPath,
|
57
33
|
[
|
@@ -63,10 +39,6 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://gi
|
|
63
39
|
],
|
64
40
|
{
|
65
41
|
stdio: ["inherit", "inherit", "inherit", "ipc"],
|
66
|
-
env: {
|
67
|
-
...process.env,
|
68
|
-
NODE_EXTRA_CA_CERTS: pathToCACerts,
|
69
|
-
},
|
70
42
|
}
|
71
43
|
)
|
72
44
|
.on("exit", (code) =>
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "wrangler",
|
3
|
-
"version": "3.57.
|
3
|
+
"version": "3.57.2",
|
4
4
|
"description": "Command-line interface for all things Cloudflare Workers",
|
5
5
|
"keywords": [
|
6
6
|
"wrangler",
|
@@ -47,37 +47,8 @@
|
|
47
47
|
"wrangler-dist",
|
48
48
|
"templates",
|
49
49
|
"kv-asset-handler.js",
|
50
|
-
"Cloudflare_CA.pem",
|
51
50
|
"config-schema.json"
|
52
51
|
],
|
53
|
-
"jest": {
|
54
|
-
"moduleNameMapper": {
|
55
|
-
"clipboardy": "<rootDir>/src/__tests__/helpers/clipboardy-mock.js",
|
56
|
-
"miniflare/cli": "<rootDir>/../../node_modules/miniflare/dist/src/cli.js"
|
57
|
-
},
|
58
|
-
"restoreMocks": true,
|
59
|
-
"setupFilesAfterEnv": [
|
60
|
-
"<rootDir>/src/__tests__/jest.setup.ts"
|
61
|
-
],
|
62
|
-
"testRegex": "src/__tests__/.*\\.(test|spec)\\.[jt]sx?$",
|
63
|
-
"testTimeout": 50000,
|
64
|
-
"transform": {
|
65
|
-
"^.+\\.c?(t|j)sx?$": [
|
66
|
-
"esbuild-jest",
|
67
|
-
{
|
68
|
-
"sourcemap": true
|
69
|
-
}
|
70
|
-
]
|
71
|
-
},
|
72
|
-
"transformIgnorePatterns": [
|
73
|
-
"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|strip-ansi|ansi-regex)"
|
74
|
-
],
|
75
|
-
"snapshotFormat": {
|
76
|
-
"escapeString": true,
|
77
|
-
"printBasicPrototype": true
|
78
|
-
},
|
79
|
-
"prettierPath": null
|
80
|
-
},
|
81
52
|
"dependencies": {
|
82
53
|
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
83
54
|
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
|
@@ -92,11 +63,11 @@
|
|
92
63
|
"source-map": "0.6.1",
|
93
64
|
"xxhash-wasm": "^1.0.1",
|
94
65
|
"@cloudflare/kv-asset-handler": "0.3.2",
|
95
|
-
"miniflare": "3.
|
66
|
+
"miniflare": "3.20240524.0"
|
96
67
|
},
|
97
68
|
"devDependencies": {
|
98
69
|
"@cloudflare/types": "^6.18.4",
|
99
|
-
"@cloudflare/workers-types": "^4.
|
70
|
+
"@cloudflare/workers-types": "^4.20240524.0",
|
100
71
|
"@cspotcode/source-map-support": "0.8.1",
|
101
72
|
"@iarna/toml": "^3.0.0",
|
102
73
|
"@microsoft/api-extractor": "^7.28.3",
|
@@ -109,7 +80,6 @@
|
|
109
80
|
"@types/glob-to-regexp": "0.4.1",
|
110
81
|
"@types/is-ci": "^3.0.0",
|
111
82
|
"@types/javascript-time-ago": "^2.0.3",
|
112
|
-
"@types/jest": "^29.5.5",
|
113
83
|
"@types/mime": "^2.0.3",
|
114
84
|
"@types/minimatch": "^5.1.2",
|
115
85
|
"@types/prompts": "^2.0.14",
|
@@ -133,7 +103,6 @@
|
|
133
103
|
"devtools-protocol": "^0.0.955664",
|
134
104
|
"dotenv": "^16.0.0",
|
135
105
|
"es-module-lexer": "^1.3.0",
|
136
|
-
"esbuild-jest": "0.5.0",
|
137
106
|
"execa": "^6.1.0",
|
138
107
|
"express": "^4.18.1",
|
139
108
|
"find-up": "^6.3.0",
|
@@ -148,13 +117,11 @@
|
|
148
117
|
"ink-table": "^3.0.0",
|
149
118
|
"is-ci": "^3.0.1",
|
150
119
|
"javascript-time-ago": "^2.5.4",
|
151
|
-
"jest": "^29.7.0",
|
152
|
-
"jest-fetch-mock": "^3.0.3",
|
153
|
-
"jest-websocket-mock": "^2.5.0",
|
154
120
|
"md5-file": "5.0.0",
|
155
121
|
"mime": "^3.0.0",
|
156
122
|
"minimatch": "^5.1.0",
|
157
|
-
"
|
123
|
+
"mock-socket": "^9.3.1",
|
124
|
+
"msw": "^2.3.0",
|
158
125
|
"open": "^8.4.0",
|
159
126
|
"p-queue": "^7.2.0",
|
160
127
|
"patch-console": "^1.0.0",
|
@@ -176,20 +143,21 @@
|
|
176
143
|
"undici": "5.28.4",
|
177
144
|
"update-check": "^1.5.4",
|
178
145
|
"vitest": "^1.6.0",
|
146
|
+
"vitest-websocket-mock": "^0.3.0",
|
179
147
|
"ws": "^8.5.0",
|
180
148
|
"xdg-app-paths": "^8.3.0",
|
181
149
|
"yargs": "^17.7.2",
|
182
150
|
"yoga-layout": "file:../../vendor/yoga-layout-2.0.0-beta.1.tgz",
|
183
|
-
"@cloudflare/cli": "1.1.1",
|
184
151
|
"@cloudflare/eslint-config-worker": "1.1.0",
|
185
|
-
"@cloudflare/
|
186
|
-
"@cloudflare/workers-tsconfig": "0.0.0"
|
152
|
+
"@cloudflare/cli": "1.1.1",
|
153
|
+
"@cloudflare/workers-tsconfig": "0.0.0",
|
154
|
+
"@cloudflare/pages-shared": "^0.11.39"
|
187
155
|
},
|
188
156
|
"optionalDependencies": {
|
189
157
|
"fsevents": "~2.3.2"
|
190
158
|
},
|
191
159
|
"peerDependencies": {
|
192
|
-
"@cloudflare/workers-types": "^4.
|
160
|
+
"@cloudflare/workers-types": "^4.20240524.0"
|
193
161
|
},
|
194
162
|
"peerDependenciesMeta": {
|
195
163
|
"@cloudflare/workers-types": {
|
@@ -213,8 +181,8 @@
|
|
213
181
|
"emit-types": "tsc -p tsconfig.emit.json && node -r esbuild-register scripts/emit-types.ts",
|
214
182
|
"generate-json-schema": "pnpm exec ts-json-schema-generator --no-type-check --path src/config/config.ts --type RawConfig --out config-schema.json",
|
215
183
|
"start": "pnpm run bundle && cross-env NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js",
|
216
|
-
"test": "pnpm run assert-git-version &&
|
217
|
-
"test:ci": "pnpm run test",
|
184
|
+
"test": "pnpm run assert-git-version && vitest",
|
185
|
+
"test:ci": "pnpm run test run",
|
218
186
|
"test:debug": "pnpm run test --silent=false --verbose=true",
|
219
187
|
"test:e2e": "vitest -c ./e2e/vitest.config.ts",
|
220
188
|
"test:watch": "pnpm run test --testTimeout=50000 --watch",
|
package/templates/facade.d.ts
CHANGED
@@ -3,10 +3,10 @@ declare module "__ENTRY_POINT__" {
|
|
3
3
|
import { WorkerEntrypoint } from "cloudflare:workers";
|
4
4
|
|
5
5
|
export type WorkerEntrypointConstructor = typeof WorkerEntrypoint;
|
6
|
-
export type WithMiddleware<T> = T & { middleware?: Middleware[] };
|
7
6
|
|
8
|
-
const worker:
|
7
|
+
const worker: ExportedHandler | WorkerEntrypointConstructor;
|
9
8
|
export default worker;
|
9
|
+
export const __INTERNAL_WRANGLER_MIDDLEWARE__: Middleware[];
|
10
10
|
}
|
11
11
|
|
12
12
|
declare module "__KV_ASSET_HANDLER__" {
|
@@ -3,12 +3,9 @@
|
|
3
3
|
// export dynamically through wrangler, or we can potentially let users directly
|
4
4
|
// add them as a sort of "plugin" system.
|
5
5
|
|
6
|
-
import ENTRY from "__ENTRY_POINT__";
|
6
|
+
import ENTRY, { __INTERNAL_WRANGLER_MIDDLEWARE__ } from "__ENTRY_POINT__";
|
7
7
|
import { __facade_invoke__, __facade_register__, Dispatcher } from "./common";
|
8
|
-
import type {
|
9
|
-
WithMiddleware,
|
10
|
-
WorkerEntrypointConstructor,
|
11
|
-
} from "__ENTRY_POINT__";
|
8
|
+
import type { WorkerEntrypointConstructor } from "__ENTRY_POINT__";
|
12
9
|
|
13
10
|
// Preserve all the exports from the worker
|
14
11
|
export * from "__ENTRY_POINT__";
|
@@ -33,15 +30,16 @@ class __Facade_ScheduledController__ implements ScheduledController {
|
|
33
30
|
}
|
34
31
|
}
|
35
32
|
|
36
|
-
function wrapExportedHandler(
|
37
|
-
worker: WithMiddleware<ExportedHandler>
|
38
|
-
): ExportedHandler {
|
33
|
+
function wrapExportedHandler(worker: ExportedHandler): ExportedHandler {
|
39
34
|
// If we don't have any middleware defined, just return the handler as is
|
40
|
-
if (
|
35
|
+
if (
|
36
|
+
__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined ||
|
37
|
+
__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0
|
38
|
+
) {
|
41
39
|
return worker;
|
42
40
|
}
|
43
41
|
// Otherwise, register all middleware once
|
44
|
-
for (const middleware of
|
42
|
+
for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) {
|
45
43
|
__facade_register__(middleware);
|
46
44
|
}
|
47
45
|
|
@@ -75,14 +73,17 @@ function wrapExportedHandler(
|
|
75
73
|
}
|
76
74
|
|
77
75
|
function wrapWorkerEntrypoint(
|
78
|
-
klass:
|
76
|
+
klass: WorkerEntrypointConstructor
|
79
77
|
): WorkerEntrypointConstructor {
|
80
78
|
// If we don't have any middleware defined, just return the handler as is
|
81
|
-
if (
|
79
|
+
if (
|
80
|
+
__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined ||
|
81
|
+
__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0
|
82
|
+
) {
|
82
83
|
return klass;
|
83
84
|
}
|
84
85
|
// Otherwise, register all middleware once
|
85
|
-
for (const middleware of
|
86
|
+
for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) {
|
86
87
|
__facade_register__(middleware);
|
87
88
|
}
|
88
89
|
|
package/wrangler-dist/cli.d.ts
CHANGED
@@ -2462,6 +2462,21 @@ declare interface Interceptable extends Dispatcher {
|
|
2462
2462
|
intercept(options: MockInterceptor.Options): MockInterceptor;
|
2463
2463
|
}
|
2464
2464
|
|
2465
|
+
declare class Logger {
|
2466
|
+
constructor();
|
2467
|
+
loggerLevel: "none" | "error" | "warn" | "info" | "log" | "debug";
|
2468
|
+
columns: number;
|
2469
|
+
debug: (...args: unknown[]) => void;
|
2470
|
+
debugWithSanitization: (label: string, ...args: unknown[]) => void;
|
2471
|
+
info: (...args: unknown[]) => void;
|
2472
|
+
log: (...args: unknown[]) => void;
|
2473
|
+
warn: (...args: unknown[]) => void;
|
2474
|
+
error: (...args: unknown[]) => void;
|
2475
|
+
table<Keys extends string>(data: TableRow<Keys>[]): void;
|
2476
|
+
private doLog;
|
2477
|
+
private formatMessage;
|
2478
|
+
}
|
2479
|
+
|
2465
2480
|
declare type LogLevel = "debug" | "info" | "log" | "warn" | "error" | "none";
|
2466
2481
|
|
2467
2482
|
declare type MaybePromise<T> = T | Promise<T>;
|
@@ -23652,6 +23667,8 @@ options: { dispatcher?: Dispatcher } & Omit<Dispatcher.RequestOptions, 'origin'
|
|
23652
23667
|
factory: Dispatcher.StreamFactory
|
23653
23668
|
): Promise<Dispatcher.StreamData>;
|
23654
23669
|
|
23670
|
+
declare type TableRow<Keys extends string> = Record<Keys, string>;
|
23671
|
+
|
23655
23672
|
declare type TailConsumer = {
|
23656
23673
|
/** The name of the service tail events will be forwarded to. */
|
23657
23674
|
service: string;
|
@@ -23829,6 +23846,8 @@ export declare class unstable_DevEnv extends EventEmitter_2 {
|
|
23829
23846
|
emitErrorEvent(ev: ErrorEvent): void;
|
23830
23847
|
}
|
23831
23848
|
|
23849
|
+
export declare const unstable_generateASSETSBinding: (opts: UnstableASSETSBindingsOptions) => (request: Request_2) => Promise<Response_2>;
|
23850
|
+
|
23832
23851
|
export declare function unstable_getMiniflareWorkerOptions(configPath: string, environment?: string): {
|
23833
23852
|
workerOptions: SourcelessWorkerOptions;
|
23834
23853
|
define: Record<string, string>;
|
@@ -23849,6 +23868,12 @@ export declare function unstable_startWorkerRegistryServer(port: number): Promis
|
|
23849
23868
|
terminator: HttpTerminator;
|
23850
23869
|
}>;
|
23851
23870
|
|
23871
|
+
export declare interface UnstableASSETSBindingsOptions {
|
23872
|
+
log: Logger;
|
23873
|
+
proxyPort?: number;
|
23874
|
+
directory?: string;
|
23875
|
+
}
|
23876
|
+
|
23852
23877
|
export declare interface UnstableDevOptions {
|
23853
23878
|
config?: string;
|
23854
23879
|
env?: string;
|