wrangler 4.100.0 → 4.102.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.
@@ -1,30 +1,44 @@
1
1
  #!/usr/bin/env node
2
- // `cf-wrangler` delegate binary. Runs wrangler's bundled dev server
3
- // in-process; the parent tool owns the Node runtime (version, flags).
2
+ // `cf-wrangler` delegate binary. Runs wrangler delegate verbs in-process;
3
+ // the parent tool owns the Node runtime (version, flags).
4
4
  //
5
- // Dispatches on the leading verb. Only `dev` exists today; an unknown
6
- // or missing verb exits 2, which the parent uses to feature-detect
7
- // support.
5
+ // Dispatches on the leading verb. An unknown or missing verb exits 2, which
6
+ // the parent uses to feature-detect support.
8
7
  const {
9
8
  ArgParseError,
9
+ parseCfWranglerBuildArgs,
10
10
  parseCfWranglerArgs,
11
+ runCfWranglerBuild,
11
12
  runCfWranglerDev,
12
13
  } = require("../wrangler-dist/cli.js");
13
14
 
14
15
  const argv = process.argv.slice(2);
15
16
  const verb = argv[0];
16
17
 
17
- if (verb !== "dev") {
18
+ const verbHandlers = {
19
+ dev: {
20
+ parse: parseCfWranglerArgs,
21
+ run: runCfWranglerDevFromArgs,
22
+ },
23
+ build: {
24
+ parse: parseCfWranglerBuildArgs,
25
+ run: runCfWranglerBuild,
26
+ },
27
+ };
28
+
29
+ const verbHandler = verbHandlers[verb];
30
+
31
+ if (!verbHandler) {
18
32
  process.stderr.write(
19
33
  `Error: unknown subcommand "${verb ?? ""}".\n` +
20
- `Usage: cf-wrangler dev [args]\n`
34
+ `Usage: cf-wrangler <${Object.keys(verbHandlers).join("|")}> [args]\n`
21
35
  );
22
36
  process.exit(2);
23
37
  }
24
38
 
25
39
  let parsed;
26
40
  try {
27
- parsed = parseCfWranglerArgs(argv.slice(1));
41
+ parsed = verbHandler.parse(argv.slice(1));
28
42
  } catch (err) {
29
43
  if (err instanceof ArgParseError) {
30
44
  process.stderr.write(`Error: ${err.message}\n`);
@@ -33,83 +47,86 @@ try {
33
47
  throw err;
34
48
  }
35
49
 
36
- // Build wrangler dev's full (yargs-derived) options object. Every field
37
- // must be present; we set the four accepted flags plus `wrangler dev`'s
38
- // defaults and leave everything else `undefined`, which makes wrangler's
39
- // ConfigController resolve those exactly as `wrangler dev` would (config
40
- // discovery, containers, inspector port, interactive hotkeys, ...).
41
- // `--local` forces local execution; left unset it preserves per-resource
42
- // `remote = true` bindings. There is no whole-worker remote dev (no
43
- // `--remote`).
44
- const options = {
45
- _: [],
46
- $0: "",
47
- env: parsed.mode,
48
- port: parsed.port,
49
- host: parsed.host,
50
- local: parsed.local,
51
- remote: false,
52
- latest: true,
53
- noBundle: false,
54
- testScheduled: false,
55
- processEntrypoint: false,
56
- experimentalAutoCreate: false,
57
- types: false,
58
- disableDevRegistry: false,
59
- config: undefined,
60
- script: undefined,
61
- name: undefined,
62
- accountId: undefined,
63
- forceLocal: undefined,
64
- compatibilityDate: undefined,
65
- compatibilityFlags: undefined,
66
- ip: undefined,
67
- inspectorPort: undefined,
68
- inspectorIp: undefined,
69
- v: undefined,
70
- cwd: undefined,
71
- localProtocol: undefined,
72
- httpsKeyPath: undefined,
73
- httpsCertPath: undefined,
74
- assets: undefined,
75
- site: undefined,
76
- siteInclude: undefined,
77
- siteExclude: undefined,
78
- persist: undefined,
79
- persistTo: undefined,
80
- routes: undefined,
81
- localUpstream: undefined,
82
- upstreamProtocol: undefined,
83
- var: undefined,
84
- define: undefined,
85
- alias: undefined,
86
- jsxFactory: undefined,
87
- jsxFragment: undefined,
88
- tsconfig: undefined,
89
- minify: undefined,
90
- legacyEnv: undefined,
91
- logLevel: undefined,
92
- showInteractiveDevSession: undefined,
93
- liveReload: undefined,
94
- bundle: undefined,
95
- additionalModules: undefined,
96
- enablePagesAssetsServiceBinding: undefined,
97
- d1Databases: undefined,
98
- experimentalProvision: undefined,
99
- enableIpc: undefined,
100
- nodeCompat: undefined,
101
- enableContainers: undefined,
102
- dockerPath: undefined,
103
- containerEngine: undefined,
104
- tunnel: undefined,
105
- tunnelName: undefined,
106
- envFile: undefined,
107
- onReady: undefined,
108
- };
109
-
110
- runCfWranglerDev(options)
50
+ verbHandler
51
+ .run(parsed)
111
52
  .then((code) => process.exit(code))
112
53
  .catch((err) => {
113
54
  process.stderr.write(`${(err && err.stack) || err}\n`);
114
55
  process.exit(1);
115
56
  });
57
+
58
+ function runCfWranglerDevFromArgs(parsedArgs) {
59
+ return runCfWranglerDev(createDevOptions(parsedArgs));
60
+ }
61
+
62
+ function createDevOptions(parsedArgs) {
63
+ // Build wrangler dev's full (yargs-derived) options object. Every field
64
+ // must be present; we set the four accepted flags plus `wrangler dev`'s
65
+ // defaults and leave everything else `undefined`, which makes wrangler's
66
+ // ConfigController resolve those exactly as `wrangler dev` would.
67
+ return {
68
+ _: [],
69
+ $0: "",
70
+ env: parsedArgs.mode,
71
+ port: parsedArgs.port,
72
+ host: parsedArgs.host,
73
+ local: parsedArgs.local,
74
+ remote: false,
75
+ latest: true,
76
+ noBundle: false,
77
+ testScheduled: false,
78
+ processEntrypoint: false,
79
+ experimentalAutoCreate: false,
80
+ types: false,
81
+ disableDevRegistry: false,
82
+ config: undefined,
83
+ script: undefined,
84
+ name: undefined,
85
+ accountId: undefined,
86
+ forceLocal: undefined,
87
+ compatibilityDate: undefined,
88
+ compatibilityFlags: undefined,
89
+ ip: undefined,
90
+ inspectorPort: undefined,
91
+ inspectorIp: undefined,
92
+ v: undefined,
93
+ cwd: undefined,
94
+ localProtocol: undefined,
95
+ httpsKeyPath: undefined,
96
+ httpsCertPath: undefined,
97
+ assets: undefined,
98
+ site: undefined,
99
+ siteInclude: undefined,
100
+ siteExclude: undefined,
101
+ persist: undefined,
102
+ persistTo: undefined,
103
+ routes: undefined,
104
+ localUpstream: undefined,
105
+ upstreamProtocol: undefined,
106
+ var: undefined,
107
+ define: undefined,
108
+ alias: undefined,
109
+ jsxFactory: undefined,
110
+ jsxFragment: undefined,
111
+ tsconfig: undefined,
112
+ minify: undefined,
113
+ legacyEnv: undefined,
114
+ logLevel: undefined,
115
+ showInteractiveDevSession: undefined,
116
+ liveReload: undefined,
117
+ bundle: undefined,
118
+ additionalModules: undefined,
119
+ enablePagesAssetsServiceBinding: undefined,
120
+ d1Databases: undefined,
121
+ experimentalProvision: undefined,
122
+ enableIpc: undefined,
123
+ nodeCompat: undefined,
124
+ enableContainers: undefined,
125
+ dockerPath: undefined,
126
+ containerEngine: undefined,
127
+ tunnel: undefined,
128
+ tunnelName: undefined,
129
+ envFile: undefined,
130
+ onReady: undefined,
131
+ };
132
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "4.100.0",
3
+ "version": "4.102.0",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "assembly",
@@ -63,19 +63,19 @@
63
63
  },
64
64
  "dependencies": {
65
65
  "blake3-wasm": "2.1.5",
66
- "esbuild": "0.27.3",
66
+ "esbuild": "0.28.1",
67
67
  "path-to-regexp": "6.3.0",
68
68
  "unenv": "2.0.0-rc.24",
69
- "workerd": "1.20260611.1",
69
+ "workerd": "1.20260617.1",
70
70
  "@cloudflare/kv-asset-handler": "0.5.0",
71
- "@cloudflare/unenv-preset": "2.16.1",
72
- "miniflare": "4.20260611.0"
71
+ "miniflare": "4.20260617.0",
72
+ "@cloudflare/unenv-preset": "2.16.1"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@aws-sdk/client-s3": "^3.721.0",
76
76
  "@bomb.sh/tab": "^0.0.12",
77
77
  "@cloudflare/types": "6.18.4",
78
- "@cloudflare/workers-types": "^4.20260611.1",
78
+ "@cloudflare/workers-types": "^4.20260617.1",
79
79
  "@cspotcode/source-map-support": "0.8.1",
80
80
  "@netlify/build-info": "^10.5.1",
81
81
  "@sentry/node": "^7.86.0",
@@ -148,28 +148,28 @@
148
148
  "tsdown": "0.16.3",
149
149
  "tsup": "8.3.0",
150
150
  "typescript": "5.8.3",
151
- "undici": "7.24.8",
151
+ "undici": "7.28.0",
152
152
  "vitest": "4.1.0",
153
153
  "vitest-websocket-mock": "^0.4.0",
154
- "ws": "8.20.1",
154
+ "ws": "8.21.0",
155
155
  "xxhash-wasm": "^1.0.1",
156
156
  "yaml": "^2.8.1",
157
157
  "yargs": "^17.7.2",
158
158
  "zod": "^4.4.3",
159
- "@cloudflare/cli-shared-helpers": "0.1.7",
159
+ "@cloudflare/cli-shared-helpers": "0.1.9",
160
160
  "@cloudflare/codemod": "1.1.0",
161
- "@cloudflare/config": "0.0.0",
162
161
  "@cloudflare/containers-shared": "0.15.1",
163
- "@cloudflare/deploy-helpers": "0.1.3",
164
- "@cloudflare/pages-shared": "^0.13.145",
165
- "@cloudflare/workers-shared": "0.19.6",
166
- "@cloudflare/workers-auth": "0.2.0",
162
+ "@cloudflare/config": "0.0.0",
163
+ "@cloudflare/deploy-helpers": "0.2.1",
164
+ "@cloudflare/pages-shared": "^0.13.147",
165
+ "@cloudflare/workers-auth": "0.3.1",
166
+ "@cloudflare/workers-shared": "0.19.7",
167
167
  "@cloudflare/workers-tsconfig": "0.0.0",
168
- "@cloudflare/workers-utils": "0.23.0",
169
- "@cloudflare/workflows-shared": "0.11.1"
168
+ "@cloudflare/workers-utils": "0.23.2",
169
+ "@cloudflare/workflows-shared": "0.11.2"
170
170
  },
171
171
  "peerDependencies": {
172
- "@cloudflare/workers-types": "^4.20260611.1"
172
+ "@cloudflare/workers-types": "^4.20260617.1"
173
173
  },
174
174
  "peerDependenciesMeta": {
175
175
  "@cloudflare/workers-types": {
@@ -71,6 +71,7 @@ var InspectorProxyWorker = class {
71
71
  constructor(_state, env) {
72
72
  this.env = env;
73
73
  }
74
+ env;
74
75
  websockets = {
75
76
  runtimeDeferred: createDeferred()
76
77
  };
@@ -37,6 +37,8 @@ var ProxyWorker = class {
37
37
  this.state = state;
38
38
  this.env = env;
39
39
  }
40
+ state;
41
+ env;
40
42
  proxyData;
41
43
  requestQueue = /* @__PURE__ */ new Map();
42
44
  requestRetryQueue = /* @__PURE__ */ new Map();
@@ -764,6 +764,47 @@ type WorkerHandle = {
764
764
  * ```
765
765
  */
766
766
  scheduled(options: FetcherScheduledOptions): Promise<FetcherScheduledResult>;
767
+ /**
768
+ * Returns a KV namespace binding configured on this Worker.
769
+ *
770
+ * @example
771
+ * ```ts
772
+ * const store = await worker.getKVNamespace("STORE");
773
+ * const value = await store.get("key");
774
+ * ```
775
+ */
776
+ getKVNamespace(bindingName: string): ReturnType<Miniflare["getKVNamespace"]>;
777
+ /**
778
+ * Returns an R2 bucket binding configured on this Worker.
779
+ *
780
+ * @example
781
+ * ```ts
782
+ * const bucket = await worker.getR2Bucket("BUCKET");
783
+ * const object = await bucket.get("key");
784
+ * ```
785
+ */
786
+ getR2Bucket(bindingName: string): ReturnType<Miniflare["getR2Bucket"]>;
787
+ /**
788
+ * Returns a D1 database binding configured on this Worker.
789
+ *
790
+ * @example
791
+ * ```ts
792
+ * const db = await worker.getD1Database("DB");
793
+ * const value = await db.prepare("SELECT value FROM entries").first("value");
794
+ * ```
795
+ */
796
+ getD1Database(bindingName: string): ReturnType<Miniflare["getD1Database"]>;
797
+ /**
798
+ * Returns a Durable Object namespace binding configured on this Worker.
799
+ *
800
+ * @example
801
+ * ```ts
802
+ * const namespace = await worker.getDurableObjectNamespace("OBJECT");
803
+ * const stub = namespace.getByName("counter");
804
+ * const response = await stub.fetch("http://example.com/");
805
+ * ```
806
+ */
807
+ getDurableObjectNamespace(bindingName: string): ReturnType<Miniflare["getDurableObjectNamespace"]>;
767
808
  };
768
809
  type TestHarness = {
769
810
  /**
@@ -3192,27 +3233,33 @@ declare function resolveNamedTunnel(name: string, origin: URL, options: {
3192
3233
  token: string;
3193
3234
  }>;
3194
3235
 
3195
- /**
3196
- * Run the dev server until it tears down (a hotkey quit in a TTY, or a
3197
- * signal from a non-interactive parent). Mirrors `wrangler dev`'s command
3198
- * handler and installs no signal handlers of its own, so signal handling
3199
- * and exit codes match `wrangler dev` exactly.
3200
- *
3201
- * @param options Fully-built `StartDevOptions` (built in `bin/cf-wrangler.js`).
3202
- * @returns `0` on a clean teardown.
3203
- */
3204
- declare function runCfWranglerDev(options: StartDevOptions): Promise<number>;
3205
-
3206
3236
  interface DevArgs {
3207
3237
  mode?: string;
3208
3238
  port?: number;
3209
3239
  host?: string;
3210
3240
  local?: boolean;
3211
3241
  }
3242
+ interface BuildArgs {
3243
+ mode?: string;
3244
+ }
3212
3245
  declare class ArgParseError extends Error {
3213
3246
  constructor(message: string);
3214
3247
  }
3215
3248
  declare function parseArgs(argv: string[]): DevArgs;
3249
+ declare function parseBuildArgs(argv: string[]): BuildArgs;
3250
+
3251
+ declare function runCfWranglerBuild(args: BuildArgs): Promise<number>;
3252
+
3253
+ /**
3254
+ * Run the dev server until it tears down (a hotkey quit in a TTY, or a
3255
+ * signal from a non-interactive parent). Mirrors `wrangler dev`'s command
3256
+ * handler and installs no signal handlers of its own, so signal handling
3257
+ * and exit codes match `wrangler dev` exactly.
3258
+ *
3259
+ * @param options Fully-built `StartDevOptions` (built in `bin/cf-wrangler.js`).
3260
+ * @returns `0` on a clean teardown.
3261
+ */
3262
+ declare function runCfWranglerDev(options: StartDevOptions): Promise<number>;
3216
3263
 
3217
3264
  /**
3218
3265
  * Split an SQLQuery into an array of statements
@@ -3462,12 +3509,25 @@ type CommandDefinition<NamedArgDefs extends NamedArgDefinitions = NamedArgDefini
3462
3509
  */
3463
3510
  sendMetrics?: boolean;
3464
3511
  /**
3465
- * Skip the AI coding agent skills installation prompt for this command.
3466
- * Set to `true` for commands whose stdout is captured by the shell (e.g. `complete`),
3467
- * where interactive prompts would corrupt the output.
3512
+ * After the command handler completes successfully, suggest installing
3513
+ * Cloudflare skills for detected AI coding agents that don't have them.
3514
+ *
3515
+ * When set to `true`, the suggestion always runs after the handler.
3516
+ * When set to a function, it receives the parsed args and should return
3517
+ * `true` to enable the suggestion — use this to skip the prompt in modes
3518
+ * where interactive output is inappropriate (e.g. `--json`).
3519
+ *
3520
+ * @default false
3521
+ */
3522
+ suggestSkillsAfterHandler?: boolean | ((args: HandlerArgs<NamedArgDefs>) => boolean);
3523
+ /**
3524
+ * Whether this command can authenticate with a temporary preview account
3525
+ * (via the hidden `--temporary` flag) when no real credentials are available.
3526
+ * Only enable this for commands whose API calls are covered by the temporary
3527
+ * preview-account deploy token (Workers, KV, D1, Hyperdrive, Queues, SSL/Certs).
3468
3528
  * @default false
3469
3529
  */
3470
- skipSkillsPrompt?: boolean;
3530
+ supportTemporary?: boolean;
3471
3531
  };
3472
3532
  /**
3473
3533
  * A plain key-value object describing the CLI args for this command.
@@ -3485,8 +3545,11 @@ type CommandDefinition<NamedArgDefs extends NamedArgDefinitions = NamedArgDefini
3485
3545
  * A hook to implement custom validation of the args before the handler is called.
3486
3546
  * Throw `CommandLineArgsError` with actionable error message if args are invalid.
3487
3547
  * The return value is ignored.
3548
+ *
3549
+ * @param args - The parsed CLI arguments
3550
+ * @param def - The command definition, useful for passing to helpers like `demandOneOfOption`
3488
3551
  */
3489
- validateArgs?: (args: HandlerArgs<NamedArgDefs>) => void | Promise<void>;
3552
+ validateArgs?: (args: HandlerArgs<NamedArgDefs>, def: CommandDefinition<NamedArgDefs>) => void | Promise<void>;
3490
3553
  /**
3491
3554
  * The implementation of the command which is given camelCase'd args
3492
3555
  * and a ctx object of convenience properties
@@ -3630,7 +3693,7 @@ declare function createCLIParser(argv: string[]): {
3630
3693
  readonly alias: "x-auto-create";
3631
3694
  };
3632
3695
  readonly "install-skills": {
3633
- readonly describe: "Install Cloudflare agents skills, if not already present, without asking the user for confirmation";
3696
+ readonly describe: "Install Cloudflare skills for detected AI coding agents before running the command";
3634
3697
  readonly type: "boolean";
3635
3698
  readonly default: false;
3636
3699
  };
@@ -3662,4 +3725,4 @@ interface Unstable_ASSETSBindingsOptions {
3662
3725
  }
3663
3726
  declare const unstable_generateASSETSBinding: (opts: Unstable_ASSETSBindingsOptions) => (request: Request) => Promise<Response$1>;
3664
3727
 
3665
- export { ArgParseError, type Experimental_GenerateTypesOptions, type Experimental_GenerateTypesResult, type GetPlatformProxyOptions, type PlatformProxy, type RemoteProxySession, type SourcelessWorkerOptions, type StartRemoteProxySessionOptions, type TestHarness, type TestHarnessOptions, 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, type WorkerHandle, createTestHarness, Framework as experimental_AutoConfigFramework, generateTypes as experimental_generateTypes, getDetailsForAutoConfig as experimental_getDetailsForAutoConfig, experimental_getWranglerCommands, runAutoConfig as experimental_runAutoConfig, getPlatformProxy, maybeStartOrUpdateRemoteProxySession, parseArgs as parseCfWranglerArgs, runCfWranglerDev, 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, readConfig as unstable_readConfig, resolveNamedTunnel as unstable_resolveNamedTunnel, splitSqlQuery as unstable_splitSqlQuery, startWorker as unstable_startWorker };
3728
+ export { ArgParseError, type Experimental_GenerateTypesOptions, type Experimental_GenerateTypesResult, type GetPlatformProxyOptions, type PlatformProxy, type RemoteProxySession, type SourcelessWorkerOptions, type StartRemoteProxySessionOptions, type TestHarness, type TestHarnessOptions, 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, type WorkerHandle, createTestHarness, Framework as experimental_AutoConfigFramework, generateTypes as experimental_generateTypes, getDetailsForAutoConfig as experimental_getDetailsForAutoConfig, experimental_getWranglerCommands, runAutoConfig as experimental_runAutoConfig, getPlatformProxy, maybeStartOrUpdateRemoteProxySession, parseArgs as parseCfWranglerArgs, parseBuildArgs as parseCfWranglerBuildArgs, runCfWranglerBuild, runCfWranglerDev, 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, readConfig as unstable_readConfig, resolveNamedTunnel as unstable_resolveNamedTunnel, splitSqlQuery as unstable_splitSqlQuery, startWorker as unstable_startWorker };