wrangler 4.85.0 → 4.87.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/bin/wrangler.js +2 -3
- package/config-schema.json +1113 -474
- package/package.json +13 -13
- package/templates/startDevWorker/ProxyWorker.ts +17 -1
- package/wrangler-dist/ProxyWorker.js +13 -1
- package/wrangler-dist/cli.d.ts +96 -24
- package/wrangler-dist/cli.js +40244 -36997
- package/wrangler-dist/metafile-cjs.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wrangler",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.87.0",
|
|
4
4
|
"description": "Command-line interface for all things Cloudflare Workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"assembly",
|
|
@@ -54,18 +54,18 @@
|
|
|
54
54
|
"esbuild": "0.27.3",
|
|
55
55
|
"path-to-regexp": "6.3.0",
|
|
56
56
|
"unenv": "2.0.0-rc.24",
|
|
57
|
-
"workerd": "1.
|
|
58
|
-
"@cloudflare/kv-asset-handler": "0.
|
|
57
|
+
"workerd": "1.20260430.1",
|
|
58
|
+
"@cloudflare/kv-asset-handler": "0.5.0",
|
|
59
59
|
"@cloudflare/unenv-preset": "2.16.1",
|
|
60
|
-
"miniflare": "4.
|
|
60
|
+
"miniflare": "4.20260430.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@aws-sdk/client-s3": "^3.721.0",
|
|
64
64
|
"@bomb.sh/tab": "^0.0.12",
|
|
65
65
|
"@cloudflare/types": "6.18.4",
|
|
66
|
-
"@cloudflare/workers-types": "^4.
|
|
66
|
+
"@cloudflare/workers-types": "^4.20260430.1",
|
|
67
67
|
"@cspotcode/source-map-support": "0.8.1",
|
|
68
|
-
"@netlify/build-info": "^10.
|
|
68
|
+
"@netlify/build-info": "^10.5.1",
|
|
69
69
|
"@sentry/node": "^7.86.0",
|
|
70
70
|
"@sentry/types": "^7.86.0",
|
|
71
71
|
"@sentry/utils": "^7.86.0",
|
|
@@ -144,17 +144,17 @@
|
|
|
144
144
|
"xxhash-wasm": "^1.0.1",
|
|
145
145
|
"yaml": "^2.8.1",
|
|
146
146
|
"yargs": "^17.7.2",
|
|
147
|
+
"@cloudflare/cli-shared-helpers": "0.1.0",
|
|
147
148
|
"@cloudflare/codemod": "1.1.0",
|
|
148
149
|
"@cloudflare/containers-shared": "0.14.1",
|
|
149
|
-
"@cloudflare/pages-shared": "^0.13.
|
|
150
|
-
"@cloudflare/workers-shared": "0.19.
|
|
151
|
-
"@cloudflare/cli-shared-helpers": "0.1.0",
|
|
150
|
+
"@cloudflare/pages-shared": "^0.13.130",
|
|
151
|
+
"@cloudflare/workers-shared": "0.19.4",
|
|
152
152
|
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
153
|
-
"@cloudflare/
|
|
154
|
-
"@cloudflare/
|
|
153
|
+
"@cloudflare/workers-utils": "0.18.0",
|
|
154
|
+
"@cloudflare/workflows-shared": "0.10.0"
|
|
155
155
|
},
|
|
156
156
|
"peerDependencies": {
|
|
157
|
-
"@cloudflare/workers-types": "^4.
|
|
157
|
+
"@cloudflare/workers-types": "^4.20260430.1"
|
|
158
158
|
},
|
|
159
159
|
"peerDependenciesMeta": {
|
|
160
160
|
"@cloudflare/workers-types": {
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
"fsevents": "~2.3.2"
|
|
166
166
|
},
|
|
167
167
|
"engines": {
|
|
168
|
-
"node": ">=
|
|
168
|
+
"node": ">=22.0.0"
|
|
169
169
|
},
|
|
170
170
|
"volta": {
|
|
171
171
|
"extends": "../../package.json"
|
|
@@ -23,6 +23,7 @@ type Request = Parameters<
|
|
|
23
23
|
>[0];
|
|
24
24
|
|
|
25
25
|
const LIVE_RELOAD_PROTOCOL = "WRANGLER_PROXYWORKER_LIVE_RELOAD_PROTOCOL";
|
|
26
|
+
const LIVE_RELOAD_PATHNAME = "/cdn-cgi/live-reload";
|
|
26
27
|
export default {
|
|
27
28
|
fetch(req, env) {
|
|
28
29
|
const singleton = env.DURABLE_OBJECT.idFromName("");
|
|
@@ -161,6 +162,12 @@ export class ProxyWorker implements DurableObject {
|
|
|
161
162
|
res = insertLiveReloadScript(request, res, this.env, proxyData);
|
|
162
163
|
}
|
|
163
164
|
|
|
165
|
+
if (isSseResponse(res)) {
|
|
166
|
+
void sendMessageToProxyController(this.env, {
|
|
167
|
+
type: "sseResponseDetected",
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
164
171
|
deferredResponse.resolve(res);
|
|
165
172
|
})
|
|
166
173
|
.catch((error: Error) => {
|
|
@@ -227,7 +234,16 @@ function isRequestFromProxyController(req: Request, env: Env): boolean {
|
|
|
227
234
|
function isHtmlResponse(res: Response): boolean {
|
|
228
235
|
return res.headers.get("content-type")?.startsWith("text/html") ?? false;
|
|
229
236
|
}
|
|
237
|
+
function isSseResponse(res: Response): boolean {
|
|
238
|
+
return (
|
|
239
|
+
res.headers.get("content-type")?.startsWith("text/event-stream") ?? false
|
|
240
|
+
);
|
|
241
|
+
}
|
|
230
242
|
function isRequestForLiveReloadWebsocket(req: Request): boolean {
|
|
243
|
+
if (new URL(req.url).pathname !== LIVE_RELOAD_PATHNAME) {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
|
|
231
247
|
const websocketProtocol = req.headers.get("Sec-WebSocket-Protocol");
|
|
232
248
|
const isWebSocketUpgrade = req.headers.get("Upgrade") === "websocket";
|
|
233
249
|
|
|
@@ -309,7 +325,7 @@ const liveReloadScript = `
|
|
|
309
325
|
function initLiveReload() {
|
|
310
326
|
if (ws) return;
|
|
311
327
|
var origin = (location.protocol === "http:" ? "ws://" : "wss://") + location.host;
|
|
312
|
-
ws = new WebSocket(origin + "
|
|
328
|
+
ws = new WebSocket(origin + "${LIVE_RELOAD_PATHNAME}", "${LIVE_RELOAD_PROTOCOL}");
|
|
313
329
|
ws.onclose = recover;
|
|
314
330
|
ws.onerror = recover;
|
|
315
331
|
ws.onmessage = location.reload.bind(location);
|
|
@@ -24,6 +24,7 @@ function urlFromParts(parts, base = "http://localhost") {
|
|
|
24
24
|
|
|
25
25
|
// templates/startDevWorker/ProxyWorker.ts
|
|
26
26
|
var LIVE_RELOAD_PROTOCOL = "WRANGLER_PROXYWORKER_LIVE_RELOAD_PROTOCOL";
|
|
27
|
+
var LIVE_RELOAD_PATHNAME = "/cdn-cgi/live-reload";
|
|
27
28
|
var ProxyWorker_default = {
|
|
28
29
|
fetch(req, env) {
|
|
29
30
|
const singleton = env.DURABLE_OBJECT.idFromName("");
|
|
@@ -118,6 +119,11 @@ var ProxyWorker = class {
|
|
|
118
119
|
if (isHtmlResponse(res)) {
|
|
119
120
|
res = insertLiveReloadScript(request, res, this.env, proxyData);
|
|
120
121
|
}
|
|
122
|
+
if (isSseResponse(res)) {
|
|
123
|
+
void sendMessageToProxyController(this.env, {
|
|
124
|
+
type: "sseResponseDetected"
|
|
125
|
+
});
|
|
126
|
+
}
|
|
121
127
|
deferredResponse.resolve(res);
|
|
122
128
|
}).catch((error) => {
|
|
123
129
|
const newUserWorkerUrl = this.proxyData && urlFromParts(this.proxyData.userWorkerUrl);
|
|
@@ -155,7 +161,13 @@ function isRequestFromProxyController(req, env) {
|
|
|
155
161
|
function isHtmlResponse(res) {
|
|
156
162
|
return res.headers.get("content-type")?.startsWith("text/html") ?? false;
|
|
157
163
|
}
|
|
164
|
+
function isSseResponse(res) {
|
|
165
|
+
return res.headers.get("content-type")?.startsWith("text/event-stream") ?? false;
|
|
166
|
+
}
|
|
158
167
|
function isRequestForLiveReloadWebsocket(req) {
|
|
168
|
+
if (new URL(req.url).pathname !== LIVE_RELOAD_PATHNAME) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
159
171
|
const websocketProtocol = req.headers.get("Sec-WebSocket-Protocol");
|
|
160
172
|
const isWebSocketUpgrade = req.headers.get("Upgrade") === "websocket";
|
|
161
173
|
return isWebSocketUpgrade && websocketProtocol === LIVE_RELOAD_PROTOCOL;
|
|
@@ -203,7 +215,7 @@ var liveReloadScript = `
|
|
|
203
215
|
function initLiveReload() {
|
|
204
216
|
if (ws) return;
|
|
205
217
|
var origin = (location.protocol === "http:" ? "ws://" : "wss://") + location.host;
|
|
206
|
-
ws = new WebSocket(origin + "
|
|
218
|
+
ws = new WebSocket(origin + "${LIVE_RELOAD_PATHNAME}", "${LIVE_RELOAD_PROTOCOL}");
|
|
207
219
|
ws.onclose = recover;
|
|
208
220
|
ws.onerror = recover;
|
|
209
221
|
ws.onmessage = location.reload.bind(location);
|
package/wrangler-dist/cli.d.ts
CHANGED
|
@@ -237,23 +237,6 @@ declare const unstable_pages: {
|
|
|
237
237
|
deploy: typeof deploy;
|
|
238
238
|
};
|
|
239
239
|
|
|
240
|
-
type AssetsOptions = {
|
|
241
|
-
directory: string;
|
|
242
|
-
binding?: string;
|
|
243
|
-
routerConfig: RouterConfig;
|
|
244
|
-
assetConfig: AssetConfig;
|
|
245
|
-
_redirects?: string;
|
|
246
|
-
_headers?: string;
|
|
247
|
-
run_worker_first?: boolean | string[];
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
type ApiCredentials = {
|
|
251
|
-
apiToken: string;
|
|
252
|
-
} | {
|
|
253
|
-
authKey: string;
|
|
254
|
-
authEmail: string;
|
|
255
|
-
};
|
|
256
|
-
|
|
257
240
|
/**
|
|
258
241
|
* An entry point for the Worker.
|
|
259
242
|
*
|
|
@@ -278,6 +261,90 @@ type Entry = {
|
|
|
278
261
|
exports: string[];
|
|
279
262
|
};
|
|
280
263
|
|
|
264
|
+
interface GenerateTypesOptions {
|
|
265
|
+
/**
|
|
266
|
+
* Path to the Wrangler config file to use. Can be an array for multi-config type resolution.
|
|
267
|
+
*/
|
|
268
|
+
config?: string | string[];
|
|
269
|
+
/**
|
|
270
|
+
* Name of the Wrangler environment to generate types for.
|
|
271
|
+
*/
|
|
272
|
+
env?: string;
|
|
273
|
+
/**
|
|
274
|
+
* Paths to `.env` files to load when inferring local variables and secrets.
|
|
275
|
+
*/
|
|
276
|
+
envFile?: string[];
|
|
277
|
+
/**
|
|
278
|
+
* Name of the generated environment interface.
|
|
279
|
+
*/
|
|
280
|
+
envInterface?: string;
|
|
281
|
+
/**
|
|
282
|
+
* Whether to include environment/bindings types in the output.
|
|
283
|
+
*/
|
|
284
|
+
includeEnv?: boolean;
|
|
285
|
+
/**
|
|
286
|
+
* Whether to include runtime types in the output.
|
|
287
|
+
*/
|
|
288
|
+
includeRuntime?: boolean;
|
|
289
|
+
/**
|
|
290
|
+
* Path to the declaration file for generated types.
|
|
291
|
+
*/
|
|
292
|
+
path?: string;
|
|
293
|
+
/**
|
|
294
|
+
* Whether to generate strict literal/union variable types.
|
|
295
|
+
*/
|
|
296
|
+
strictVars?: boolean;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
type Experimental_GenerateTypesOptions = GenerateTypesOptions;
|
|
300
|
+
interface GenerateTypesResult {
|
|
301
|
+
/**
|
|
302
|
+
* Combined formatted output containing all generated sections.
|
|
303
|
+
*/
|
|
304
|
+
content: string;
|
|
305
|
+
/**
|
|
306
|
+
* Generated environment/bindings types, or `null` when env types are excluded.
|
|
307
|
+
*/
|
|
308
|
+
env: string | null;
|
|
309
|
+
/**
|
|
310
|
+
* Target declaration file path associated with this generation run.
|
|
311
|
+
*/
|
|
312
|
+
path: string;
|
|
313
|
+
/**
|
|
314
|
+
* Generated runtime types, or `null` when runtime types are excluded.
|
|
315
|
+
*/
|
|
316
|
+
runtime: string | null;
|
|
317
|
+
}
|
|
318
|
+
type Experimental_GenerateTypesResult = GenerateTypesResult;
|
|
319
|
+
/**
|
|
320
|
+
* Generate types from your Worker configuration
|
|
321
|
+
*
|
|
322
|
+
* @description Programmatically generate TypeScript type definitions for your
|
|
323
|
+
* Worker, using the same logic that powers the `wrangler types` CLI command.
|
|
324
|
+
*
|
|
325
|
+
* @param options - Type generation configuration options that mirror the `wrangler types` CLI flags
|
|
326
|
+
*
|
|
327
|
+
* @returns Structured output containing combined content & split env/runtime sections.
|
|
328
|
+
*/
|
|
329
|
+
declare function generateTypes(options: Experimental_GenerateTypesOptions): Promise<Experimental_GenerateTypesResult>;
|
|
330
|
+
|
|
331
|
+
type AssetsOptions = {
|
|
332
|
+
directory: string;
|
|
333
|
+
binding?: string;
|
|
334
|
+
routerConfig: RouterConfig;
|
|
335
|
+
assetConfig: AssetConfig;
|
|
336
|
+
_redirects?: string;
|
|
337
|
+
_headers?: string;
|
|
338
|
+
run_worker_first?: boolean | string[];
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
type ApiCredentials = {
|
|
342
|
+
apiToken: string;
|
|
343
|
+
} | {
|
|
344
|
+
authKey: string;
|
|
345
|
+
authEmail: string;
|
|
346
|
+
};
|
|
347
|
+
|
|
281
348
|
/**
|
|
282
349
|
* Information about Wrangler's bundling process that needs passed through
|
|
283
350
|
* for DevTools sourcemap transformation
|
|
@@ -383,6 +450,8 @@ type ProxyWorkerIncomingRequestBody = {
|
|
|
383
450
|
type ProxyWorkerOutgoingRequestBody = {
|
|
384
451
|
type: "error";
|
|
385
452
|
error: SerializedError;
|
|
453
|
+
} | {
|
|
454
|
+
type: "sseResponseDetected";
|
|
386
455
|
} | {
|
|
387
456
|
type: "previewTokenExpired";
|
|
388
457
|
proxyData: ProxyData;
|
|
@@ -681,6 +750,8 @@ interface StartDevWorkerInput {
|
|
|
681
750
|
containerEngine?: ContainerEngine$1;
|
|
682
751
|
/** Re-generate your worker types when your Wrangler configuration file changes */
|
|
683
752
|
generateTypes?: boolean;
|
|
753
|
+
/** Whether a Cloudflare Quick Tunnel is active for this dev session */
|
|
754
|
+
tunnel?: boolean;
|
|
684
755
|
};
|
|
685
756
|
legacy?: {
|
|
686
757
|
site?: Hook<Config$1["site"], [Config$1]>;
|
|
@@ -778,7 +849,7 @@ declare function getDurableObjectClassNameToUseSQLiteMap(migrations: Config$1["m
|
|
|
778
849
|
*/
|
|
779
850
|
declare class CacheStorage {
|
|
780
851
|
constructor();
|
|
781
|
-
open(
|
|
852
|
+
open(_cacheName: string): Promise<Cache>;
|
|
782
853
|
get default(): Cache;
|
|
783
854
|
}
|
|
784
855
|
type CacheRequest = any;
|
|
@@ -787,9 +858,9 @@ type CacheResponse = any;
|
|
|
787
858
|
* No-op implementation of Cache
|
|
788
859
|
*/
|
|
789
860
|
declare class Cache {
|
|
790
|
-
delete(
|
|
791
|
-
match(
|
|
792
|
-
put(
|
|
861
|
+
delete(_request: CacheRequest, _options?: CacheQueryOptions): Promise<boolean>;
|
|
862
|
+
match(_request: CacheRequest, _options?: CacheQueryOptions): Promise<CacheResponse | undefined>;
|
|
863
|
+
put(_request: CacheRequest, _response: CacheResponse): Promise<void>;
|
|
793
864
|
}
|
|
794
865
|
type CacheQueryOptions = {
|
|
795
866
|
ignoreMethod?: boolean;
|
|
@@ -2079,7 +2150,7 @@ interface EnvironmentNonInheritable {
|
|
|
2079
2150
|
binding: string;
|
|
2080
2151
|
/** The Flagship app ID to bind to. */
|
|
2081
2152
|
app_id: string;
|
|
2082
|
-
/**
|
|
2153
|
+
/** Set to `true` to suppress the remote binding warning in local dev. Flagship bindings are always remote. */
|
|
2083
2154
|
remote?: boolean;
|
|
2084
2155
|
}[];
|
|
2085
2156
|
/**
|
|
@@ -2593,11 +2664,11 @@ type Optional<T, K extends keyof T> = Omit<T, K> & Pick<Partial<T>, K>;
|
|
|
2593
2664
|
type FrameworkInfo = {
|
|
2594
2665
|
id: string;
|
|
2595
2666
|
name: string;
|
|
2596
|
-
class: typeof Framework;
|
|
2597
2667
|
} & ({
|
|
2598
2668
|
supported: false;
|
|
2599
2669
|
} | {
|
|
2600
2670
|
supported: true;
|
|
2671
|
+
class: typeof Framework;
|
|
2601
2672
|
frameworkPackageInfo: AutoConfigFrameworkPackageInfo;
|
|
2602
2673
|
});
|
|
2603
2674
|
/**
|
|
@@ -2891,6 +2962,7 @@ declare function maybeStartOrUpdateRemoteProxySession(wranglerOrWorkerConfigObje
|
|
|
2891
2962
|
} | null, auth?: AsyncHook<CfAccount> | undefined): Promise<{
|
|
2892
2963
|
session: RemoteProxySession;
|
|
2893
2964
|
remoteBindings: Record<string, Binding>;
|
|
2965
|
+
auth?: AsyncHook<CfAccount> | undefined;
|
|
2894
2966
|
} | null>;
|
|
2895
2967
|
|
|
2896
2968
|
declare const LOGGER_LEVELS: {
|
|
@@ -3338,4 +3410,4 @@ interface Unstable_ASSETSBindingsOptions {
|
|
|
3338
3410
|
}
|
|
3339
3411
|
declare const unstable_generateASSETSBinding: (opts: Unstable_ASSETSBindingsOptions) => (request: Request) => Promise<Response$1>;
|
|
3340
3412
|
|
|
3341
|
-
export { type GetPlatformProxyOptions, type PlatformProxy, type RemoteProxySession, type SourcelessWorkerOptions, type StartRemoteProxySessionOptions, type Unstable_ASSETSBindingsOptions, type Config as Unstable_Config, type Unstable_DevOptions, type Unstable_DevWorker, type Unstable_MiniflareWorkerOptions, type RawConfig as Unstable_RawConfig, type RawEnvironment as Unstable_RawEnvironment, Framework as experimental_AutoConfigFramework, getDetailsForAutoConfig as experimental_getDetailsForAutoConfig, experimental_getWranglerCommands, runAutoConfig as experimental_runAutoConfig, getPlatformProxy, maybeStartOrUpdateRemoteProxySession, startRemoteProxySession, DevEnv as unstable_DevEnv, convertConfigBindingsToStartWorkerBindings as unstable_convertConfigBindingsToStartWorkerBindings, unstable_dev, unstable_generateASSETSBinding, unstable_getDevCompatibilityDate, getDurableObjectClassNameToUseSQLiteMap as unstable_getDurableObjectClassNameToUseSQLiteMap, unstable_getMiniflareWorkerOptions, getVarsForDev as unstable_getVarsForDev, getWorkerNameFromProject as unstable_getWorkerNameFromProject, unstable_pages, printBindings as unstable_printBindings, readConfig as unstable_readConfig, splitSqlQuery as unstable_splitSqlQuery, startWorker as unstable_startWorker };
|
|
3413
|
+
export { type Experimental_GenerateTypesOptions, type Experimental_GenerateTypesResult, type GetPlatformProxyOptions, type PlatformProxy, type RemoteProxySession, type SourcelessWorkerOptions, type StartRemoteProxySessionOptions, type Unstable_ASSETSBindingsOptions, type Config as Unstable_Config, type Unstable_DevOptions, type Unstable_DevWorker, type Unstable_MiniflareWorkerOptions, type RawConfig as Unstable_RawConfig, type RawEnvironment as Unstable_RawEnvironment, Framework as experimental_AutoConfigFramework, generateTypes as experimental_generateTypes, getDetailsForAutoConfig as experimental_getDetailsForAutoConfig, experimental_getWranglerCommands, runAutoConfig as experimental_runAutoConfig, getPlatformProxy, maybeStartOrUpdateRemoteProxySession, startRemoteProxySession, DevEnv as unstable_DevEnv, convertConfigBindingsToStartWorkerBindings as unstable_convertConfigBindingsToStartWorkerBindings, unstable_dev, unstable_generateASSETSBinding, unstable_getDevCompatibilityDate, getDurableObjectClassNameToUseSQLiteMap as unstable_getDurableObjectClassNameToUseSQLiteMap, unstable_getMiniflareWorkerOptions, getVarsForDev as unstable_getVarsForDev, getWorkerNameFromProject as unstable_getWorkerNameFromProject, unstable_pages, printBindings as unstable_printBindings, readConfig as unstable_readConfig, splitSqlQuery as unstable_splitSqlQuery, startWorker as unstable_startWorker };
|