wrangler 3.22.4 → 3.22.5

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.
Files changed (2) hide show
  1. package/package.json +7 -5
  2. package/wrangler-dist/cli.js +1605 -332
@@ -66087,6 +66087,1229 @@ var require_glob_to_regexp = __commonJS({
66087
66087
  }
66088
66088
  });
66089
66089
 
66090
+ // ../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/homedir.js
66091
+ var require_homedir = __commonJS({
66092
+ "../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/homedir.js"(exports2, module3) {
66093
+ "use strict";
66094
+ init_import_meta_url();
66095
+ var os10 = require("os");
66096
+ module3.exports = os10.homedir || /* @__PURE__ */ __name(function homedir2() {
66097
+ var home = process.env.HOME;
66098
+ var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
66099
+ if (process.platform === "win32") {
66100
+ return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || home || null;
66101
+ }
66102
+ if (process.platform === "darwin") {
66103
+ return home || (user ? "/Users/" + user : null);
66104
+ }
66105
+ if (process.platform === "linux") {
66106
+ return home || (process.getuid() === 0 ? "/root" : user ? "/home/" + user : null);
66107
+ }
66108
+ return home || null;
66109
+ }, "homedir");
66110
+ }
66111
+ });
66112
+
66113
+ // ../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/caller.js
66114
+ var require_caller = __commonJS({
66115
+ "../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/caller.js"(exports2, module3) {
66116
+ init_import_meta_url();
66117
+ module3.exports = function() {
66118
+ var origPrepareStackTrace = Error.prepareStackTrace;
66119
+ Error.prepareStackTrace = function(_2, stack2) {
66120
+ return stack2;
66121
+ };
66122
+ var stack = new Error().stack;
66123
+ Error.prepareStackTrace = origPrepareStackTrace;
66124
+ return stack[2].getFileName();
66125
+ };
66126
+ }
66127
+ });
66128
+
66129
+ // ../../node_modules/.pnpm/path-parse@1.0.7/node_modules/path-parse/index.js
66130
+ var require_path_parse = __commonJS({
66131
+ "../../node_modules/.pnpm/path-parse@1.0.7/node_modules/path-parse/index.js"(exports2, module3) {
66132
+ "use strict";
66133
+ init_import_meta_url();
66134
+ var isWindows2 = process.platform === "win32";
66135
+ var splitWindowsRe = /^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/;
66136
+ var win32 = {};
66137
+ function win32SplitPath(filename) {
66138
+ return splitWindowsRe.exec(filename).slice(1);
66139
+ }
66140
+ __name(win32SplitPath, "win32SplitPath");
66141
+ win32.parse = function(pathString) {
66142
+ if (typeof pathString !== "string") {
66143
+ throw new TypeError(
66144
+ "Parameter 'pathString' must be a string, not " + typeof pathString
66145
+ );
66146
+ }
66147
+ var allParts = win32SplitPath(pathString);
66148
+ if (!allParts || allParts.length !== 5) {
66149
+ throw new TypeError("Invalid path '" + pathString + "'");
66150
+ }
66151
+ return {
66152
+ root: allParts[1],
66153
+ dir: allParts[0] === allParts[1] ? allParts[0] : allParts[0].slice(0, -1),
66154
+ base: allParts[2],
66155
+ ext: allParts[4],
66156
+ name: allParts[3]
66157
+ };
66158
+ };
66159
+ var splitPathRe = /^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/;
66160
+ var posix2 = {};
66161
+ function posixSplitPath(filename) {
66162
+ return splitPathRe.exec(filename).slice(1);
66163
+ }
66164
+ __name(posixSplitPath, "posixSplitPath");
66165
+ posix2.parse = function(pathString) {
66166
+ if (typeof pathString !== "string") {
66167
+ throw new TypeError(
66168
+ "Parameter 'pathString' must be a string, not " + typeof pathString
66169
+ );
66170
+ }
66171
+ var allParts = posixSplitPath(pathString);
66172
+ if (!allParts || allParts.length !== 5) {
66173
+ throw new TypeError("Invalid path '" + pathString + "'");
66174
+ }
66175
+ return {
66176
+ root: allParts[1],
66177
+ dir: allParts[0].slice(0, -1),
66178
+ base: allParts[2],
66179
+ ext: allParts[4],
66180
+ name: allParts[3]
66181
+ };
66182
+ };
66183
+ if (isWindows2)
66184
+ module3.exports = win32.parse;
66185
+ else
66186
+ module3.exports = posix2.parse;
66187
+ module3.exports.posix = posix2.parse;
66188
+ module3.exports.win32 = win32.parse;
66189
+ }
66190
+ });
66191
+
66192
+ // ../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/node-modules-paths.js
66193
+ var require_node_modules_paths = __commonJS({
66194
+ "../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/node-modules-paths.js"(exports2, module3) {
66195
+ init_import_meta_url();
66196
+ var path56 = require("path");
66197
+ var parse5 = path56.parse || require_path_parse();
66198
+ var getNodeModulesDirs = /* @__PURE__ */ __name(function getNodeModulesDirs2(absoluteStart, modules) {
66199
+ var prefix = "/";
66200
+ if (/^([A-Za-z]:)/.test(absoluteStart)) {
66201
+ prefix = "";
66202
+ } else if (/^\\\\/.test(absoluteStart)) {
66203
+ prefix = "\\\\";
66204
+ }
66205
+ var paths = [absoluteStart];
66206
+ var parsed = parse5(absoluteStart);
66207
+ while (parsed.dir !== paths[paths.length - 1]) {
66208
+ paths.push(parsed.dir);
66209
+ parsed = parse5(parsed.dir);
66210
+ }
66211
+ return paths.reduce(function(dirs, aPath) {
66212
+ return dirs.concat(modules.map(function(moduleDir) {
66213
+ return path56.resolve(prefix, aPath, moduleDir);
66214
+ }));
66215
+ }, []);
66216
+ }, "getNodeModulesDirs");
66217
+ module3.exports = /* @__PURE__ */ __name(function nodeModulesPaths(start, opts, request2) {
66218
+ var modules = opts && opts.moduleDirectory ? [].concat(opts.moduleDirectory) : ["node_modules"];
66219
+ if (opts && typeof opts.paths === "function") {
66220
+ return opts.paths(
66221
+ request2,
66222
+ start,
66223
+ function() {
66224
+ return getNodeModulesDirs(start, modules);
66225
+ },
66226
+ opts
66227
+ );
66228
+ }
66229
+ var dirs = getNodeModulesDirs(start, modules);
66230
+ return opts && opts.paths ? dirs.concat(opts.paths) : dirs;
66231
+ }, "nodeModulesPaths");
66232
+ }
66233
+ });
66234
+
66235
+ // ../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/normalize-options.js
66236
+ var require_normalize_options = __commonJS({
66237
+ "../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/normalize-options.js"(exports2, module3) {
66238
+ init_import_meta_url();
66239
+ module3.exports = function(x, opts) {
66240
+ return opts || {};
66241
+ };
66242
+ }
66243
+ });
66244
+
66245
+ // ../../node_modules/.pnpm/function-bind@1.1.1/node_modules/function-bind/implementation.js
66246
+ var require_implementation = __commonJS({
66247
+ "../../node_modules/.pnpm/function-bind@1.1.1/node_modules/function-bind/implementation.js"(exports2, module3) {
66248
+ "use strict";
66249
+ init_import_meta_url();
66250
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
66251
+ var slice = Array.prototype.slice;
66252
+ var toStr = Object.prototype.toString;
66253
+ var funcType = "[object Function]";
66254
+ module3.exports = /* @__PURE__ */ __name(function bind(that) {
66255
+ var target = this;
66256
+ if (typeof target !== "function" || toStr.call(target) !== funcType) {
66257
+ throw new TypeError(ERROR_MESSAGE + target);
66258
+ }
66259
+ var args = slice.call(arguments, 1);
66260
+ var bound;
66261
+ var binder = /* @__PURE__ */ __name(function() {
66262
+ if (this instanceof bound) {
66263
+ var result = target.apply(
66264
+ this,
66265
+ args.concat(slice.call(arguments))
66266
+ );
66267
+ if (Object(result) === result) {
66268
+ return result;
66269
+ }
66270
+ return this;
66271
+ } else {
66272
+ return target.apply(
66273
+ that,
66274
+ args.concat(slice.call(arguments))
66275
+ );
66276
+ }
66277
+ }, "binder");
66278
+ var boundLength = Math.max(0, target.length - args.length);
66279
+ var boundArgs = [];
66280
+ for (var i = 0; i < boundLength; i++) {
66281
+ boundArgs.push("$" + i);
66282
+ }
66283
+ bound = Function("binder", "return function (" + boundArgs.join(",") + "){ return binder.apply(this,arguments); }")(binder);
66284
+ if (target.prototype) {
66285
+ var Empty = /* @__PURE__ */ __name(function Empty2() {
66286
+ }, "Empty");
66287
+ Empty.prototype = target.prototype;
66288
+ bound.prototype = new Empty();
66289
+ Empty.prototype = null;
66290
+ }
66291
+ return bound;
66292
+ }, "bind");
66293
+ }
66294
+ });
66295
+
66296
+ // ../../node_modules/.pnpm/function-bind@1.1.1/node_modules/function-bind/index.js
66297
+ var require_function_bind = __commonJS({
66298
+ "../../node_modules/.pnpm/function-bind@1.1.1/node_modules/function-bind/index.js"(exports2, module3) {
66299
+ "use strict";
66300
+ init_import_meta_url();
66301
+ var implementation = require_implementation();
66302
+ module3.exports = Function.prototype.bind || implementation;
66303
+ }
66304
+ });
66305
+
66306
+ // ../../node_modules/.pnpm/has@1.0.3/node_modules/has/src/index.js
66307
+ var require_src2 = __commonJS({
66308
+ "../../node_modules/.pnpm/has@1.0.3/node_modules/has/src/index.js"(exports2, module3) {
66309
+ "use strict";
66310
+ init_import_meta_url();
66311
+ var bind = require_function_bind();
66312
+ module3.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
66313
+ }
66314
+ });
66315
+
66316
+ // ../../node_modules/.pnpm/is-core-module@2.13.0/node_modules/is-core-module/core.json
66317
+ var require_core = __commonJS({
66318
+ "../../node_modules/.pnpm/is-core-module@2.13.0/node_modules/is-core-module/core.json"(exports2, module3) {
66319
+ module3.exports = {
66320
+ assert: true,
66321
+ "node:assert": [">= 14.18 && < 15", ">= 16"],
66322
+ "assert/strict": ">= 15",
66323
+ "node:assert/strict": ">= 16",
66324
+ async_hooks: ">= 8",
66325
+ "node:async_hooks": [">= 14.18 && < 15", ">= 16"],
66326
+ buffer_ieee754: ">= 0.5 && < 0.9.7",
66327
+ buffer: true,
66328
+ "node:buffer": [">= 14.18 && < 15", ">= 16"],
66329
+ child_process: true,
66330
+ "node:child_process": [">= 14.18 && < 15", ">= 16"],
66331
+ cluster: ">= 0.5",
66332
+ "node:cluster": [">= 14.18 && < 15", ">= 16"],
66333
+ console: true,
66334
+ "node:console": [">= 14.18 && < 15", ">= 16"],
66335
+ constants: true,
66336
+ "node:constants": [">= 14.18 && < 15", ">= 16"],
66337
+ crypto: true,
66338
+ "node:crypto": [">= 14.18 && < 15", ">= 16"],
66339
+ _debug_agent: ">= 1 && < 8",
66340
+ _debugger: "< 8",
66341
+ dgram: true,
66342
+ "node:dgram": [">= 14.18 && < 15", ">= 16"],
66343
+ diagnostics_channel: [">= 14.17 && < 15", ">= 15.1"],
66344
+ "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"],
66345
+ dns: true,
66346
+ "node:dns": [">= 14.18 && < 15", ">= 16"],
66347
+ "dns/promises": ">= 15",
66348
+ "node:dns/promises": ">= 16",
66349
+ domain: ">= 0.7.12",
66350
+ "node:domain": [">= 14.18 && < 15", ">= 16"],
66351
+ events: true,
66352
+ "node:events": [">= 14.18 && < 15", ">= 16"],
66353
+ freelist: "< 6",
66354
+ fs: true,
66355
+ "node:fs": [">= 14.18 && < 15", ">= 16"],
66356
+ "fs/promises": [">= 10 && < 10.1", ">= 14"],
66357
+ "node:fs/promises": [">= 14.18 && < 15", ">= 16"],
66358
+ _http_agent: ">= 0.11.1",
66359
+ "node:_http_agent": [">= 14.18 && < 15", ">= 16"],
66360
+ _http_client: ">= 0.11.1",
66361
+ "node:_http_client": [">= 14.18 && < 15", ">= 16"],
66362
+ _http_common: ">= 0.11.1",
66363
+ "node:_http_common": [">= 14.18 && < 15", ">= 16"],
66364
+ _http_incoming: ">= 0.11.1",
66365
+ "node:_http_incoming": [">= 14.18 && < 15", ">= 16"],
66366
+ _http_outgoing: ">= 0.11.1",
66367
+ "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"],
66368
+ _http_server: ">= 0.11.1",
66369
+ "node:_http_server": [">= 14.18 && < 15", ">= 16"],
66370
+ http: true,
66371
+ "node:http": [">= 14.18 && < 15", ">= 16"],
66372
+ http2: ">= 8.8",
66373
+ "node:http2": [">= 14.18 && < 15", ">= 16"],
66374
+ https: true,
66375
+ "node:https": [">= 14.18 && < 15", ">= 16"],
66376
+ inspector: ">= 8",
66377
+ "node:inspector": [">= 14.18 && < 15", ">= 16"],
66378
+ "inspector/promises": [">= 19"],
66379
+ "node:inspector/promises": [">= 19"],
66380
+ _linklist: "< 8",
66381
+ module: true,
66382
+ "node:module": [">= 14.18 && < 15", ">= 16"],
66383
+ net: true,
66384
+ "node:net": [">= 14.18 && < 15", ">= 16"],
66385
+ "node-inspect/lib/_inspect": ">= 7.6 && < 12",
66386
+ "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12",
66387
+ "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12",
66388
+ os: true,
66389
+ "node:os": [">= 14.18 && < 15", ">= 16"],
66390
+ path: true,
66391
+ "node:path": [">= 14.18 && < 15", ">= 16"],
66392
+ "path/posix": ">= 15.3",
66393
+ "node:path/posix": ">= 16",
66394
+ "path/win32": ">= 15.3",
66395
+ "node:path/win32": ">= 16",
66396
+ perf_hooks: ">= 8.5",
66397
+ "node:perf_hooks": [">= 14.18 && < 15", ">= 16"],
66398
+ process: ">= 1",
66399
+ "node:process": [">= 14.18 && < 15", ">= 16"],
66400
+ punycode: ">= 0.5",
66401
+ "node:punycode": [">= 14.18 && < 15", ">= 16"],
66402
+ querystring: true,
66403
+ "node:querystring": [">= 14.18 && < 15", ">= 16"],
66404
+ readline: true,
66405
+ "node:readline": [">= 14.18 && < 15", ">= 16"],
66406
+ "readline/promises": ">= 17",
66407
+ "node:readline/promises": ">= 17",
66408
+ repl: true,
66409
+ "node:repl": [">= 14.18 && < 15", ">= 16"],
66410
+ smalloc: ">= 0.11.5 && < 3",
66411
+ _stream_duplex: ">= 0.9.4",
66412
+ "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"],
66413
+ _stream_transform: ">= 0.9.4",
66414
+ "node:_stream_transform": [">= 14.18 && < 15", ">= 16"],
66415
+ _stream_wrap: ">= 1.4.1",
66416
+ "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"],
66417
+ _stream_passthrough: ">= 0.9.4",
66418
+ "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"],
66419
+ _stream_readable: ">= 0.9.4",
66420
+ "node:_stream_readable": [">= 14.18 && < 15", ">= 16"],
66421
+ _stream_writable: ">= 0.9.4",
66422
+ "node:_stream_writable": [">= 14.18 && < 15", ">= 16"],
66423
+ stream: true,
66424
+ "node:stream": [">= 14.18 && < 15", ">= 16"],
66425
+ "stream/consumers": ">= 16.7",
66426
+ "node:stream/consumers": ">= 16.7",
66427
+ "stream/promises": ">= 15",
66428
+ "node:stream/promises": ">= 16",
66429
+ "stream/web": ">= 16.5",
66430
+ "node:stream/web": ">= 16.5",
66431
+ string_decoder: true,
66432
+ "node:string_decoder": [">= 14.18 && < 15", ">= 16"],
66433
+ sys: [">= 0.4 && < 0.7", ">= 0.8"],
66434
+ "node:sys": [">= 14.18 && < 15", ">= 16"],
66435
+ "test/reporters": ">= 19.9 && < 20.2",
66436
+ "node:test/reporters": [">= 18.17 && < 19", ">= 19.9", ">= 20"],
66437
+ "node:test": [">= 16.17 && < 17", ">= 18"],
66438
+ timers: true,
66439
+ "node:timers": [">= 14.18 && < 15", ">= 16"],
66440
+ "timers/promises": ">= 15",
66441
+ "node:timers/promises": ">= 16",
66442
+ _tls_common: ">= 0.11.13",
66443
+ "node:_tls_common": [">= 14.18 && < 15", ">= 16"],
66444
+ _tls_legacy: ">= 0.11.3 && < 10",
66445
+ _tls_wrap: ">= 0.11.3",
66446
+ "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"],
66447
+ tls: true,
66448
+ "node:tls": [">= 14.18 && < 15", ">= 16"],
66449
+ trace_events: ">= 10",
66450
+ "node:trace_events": [">= 14.18 && < 15", ">= 16"],
66451
+ tty: true,
66452
+ "node:tty": [">= 14.18 && < 15", ">= 16"],
66453
+ url: true,
66454
+ "node:url": [">= 14.18 && < 15", ">= 16"],
66455
+ util: true,
66456
+ "node:util": [">= 14.18 && < 15", ">= 16"],
66457
+ "util/types": ">= 15.3",
66458
+ "node:util/types": ">= 16",
66459
+ "v8/tools/arguments": ">= 10 && < 12",
66460
+ "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"],
66461
+ "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"],
66462
+ "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"],
66463
+ "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"],
66464
+ "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"],
66465
+ "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"],
66466
+ v8: ">= 1",
66467
+ "node:v8": [">= 14.18 && < 15", ">= 16"],
66468
+ vm: true,
66469
+ "node:vm": [">= 14.18 && < 15", ">= 16"],
66470
+ wasi: [">= 13.4 && < 13.5", ">= 18.17 && < 19", ">= 20"],
66471
+ "node:wasi": [">= 18.17 && < 19", ">= 20"],
66472
+ worker_threads: ">= 11.7",
66473
+ "node:worker_threads": [">= 14.18 && < 15", ">= 16"],
66474
+ zlib: ">= 0.5",
66475
+ "node:zlib": [">= 14.18 && < 15", ">= 16"]
66476
+ };
66477
+ }
66478
+ });
66479
+
66480
+ // ../../node_modules/.pnpm/is-core-module@2.13.0/node_modules/is-core-module/index.js
66481
+ var require_is_core_module = __commonJS({
66482
+ "../../node_modules/.pnpm/is-core-module@2.13.0/node_modules/is-core-module/index.js"(exports2, module3) {
66483
+ "use strict";
66484
+ init_import_meta_url();
66485
+ var has = require_src2();
66486
+ function specifierIncluded(current, specifier) {
66487
+ var nodeParts = current.split(".");
66488
+ var parts = specifier.split(" ");
66489
+ var op = parts.length > 1 ? parts[0] : "=";
66490
+ var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split(".");
66491
+ for (var i = 0; i < 3; ++i) {
66492
+ var cur = parseInt(nodeParts[i] || 0, 10);
66493
+ var ver = parseInt(versionParts[i] || 0, 10);
66494
+ if (cur === ver) {
66495
+ continue;
66496
+ }
66497
+ if (op === "<") {
66498
+ return cur < ver;
66499
+ }
66500
+ if (op === ">=") {
66501
+ return cur >= ver;
66502
+ }
66503
+ return false;
66504
+ }
66505
+ return op === ">=";
66506
+ }
66507
+ __name(specifierIncluded, "specifierIncluded");
66508
+ function matchesRange(current, range) {
66509
+ var specifiers = range.split(/ ?&& ?/);
66510
+ if (specifiers.length === 0) {
66511
+ return false;
66512
+ }
66513
+ for (var i = 0; i < specifiers.length; ++i) {
66514
+ if (!specifierIncluded(current, specifiers[i])) {
66515
+ return false;
66516
+ }
66517
+ }
66518
+ return true;
66519
+ }
66520
+ __name(matchesRange, "matchesRange");
66521
+ function versionIncluded(nodeVersion2, specifierValue) {
66522
+ if (typeof specifierValue === "boolean") {
66523
+ return specifierValue;
66524
+ }
66525
+ var current = typeof nodeVersion2 === "undefined" ? process.versions && process.versions.node : nodeVersion2;
66526
+ if (typeof current !== "string") {
66527
+ throw new TypeError(typeof nodeVersion2 === "undefined" ? "Unable to determine current node version" : "If provided, a valid node version is required");
66528
+ }
66529
+ if (specifierValue && typeof specifierValue === "object") {
66530
+ for (var i = 0; i < specifierValue.length; ++i) {
66531
+ if (matchesRange(current, specifierValue[i])) {
66532
+ return true;
66533
+ }
66534
+ }
66535
+ return false;
66536
+ }
66537
+ return matchesRange(current, specifierValue);
66538
+ }
66539
+ __name(versionIncluded, "versionIncluded");
66540
+ var data = require_core();
66541
+ module3.exports = /* @__PURE__ */ __name(function isCore(x, nodeVersion2) {
66542
+ return has(data, x) && versionIncluded(nodeVersion2, data[x]);
66543
+ }, "isCore");
66544
+ }
66545
+ });
66546
+
66547
+ // ../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/async.js
66548
+ var require_async = __commonJS({
66549
+ "../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/async.js"(exports2, module3) {
66550
+ init_import_meta_url();
66551
+ var fs23 = require("fs");
66552
+ var getHomedir = require_homedir();
66553
+ var path56 = require("path");
66554
+ var caller = require_caller();
66555
+ var nodeModulesPaths = require_node_modules_paths();
66556
+ var normalizeOptions = require_normalize_options();
66557
+ var isCore = require_is_core_module();
66558
+ var realpathFS = process.platform !== "win32" && fs23.realpath && typeof fs23.realpath.native === "function" ? fs23.realpath.native : fs23.realpath;
66559
+ var homedir2 = getHomedir();
66560
+ var defaultPaths = /* @__PURE__ */ __name(function() {
66561
+ return [
66562
+ path56.join(homedir2, ".node_modules"),
66563
+ path56.join(homedir2, ".node_libraries")
66564
+ ];
66565
+ }, "defaultPaths");
66566
+ var defaultIsFile = /* @__PURE__ */ __name(function isFile(file, cb) {
66567
+ fs23.stat(file, function(err, stat3) {
66568
+ if (!err) {
66569
+ return cb(null, stat3.isFile() || stat3.isFIFO());
66570
+ }
66571
+ if (err.code === "ENOENT" || err.code === "ENOTDIR")
66572
+ return cb(null, false);
66573
+ return cb(err);
66574
+ });
66575
+ }, "isFile");
66576
+ var defaultIsDir = /* @__PURE__ */ __name(function isDirectory2(dir, cb) {
66577
+ fs23.stat(dir, function(err, stat3) {
66578
+ if (!err) {
66579
+ return cb(null, stat3.isDirectory());
66580
+ }
66581
+ if (err.code === "ENOENT" || err.code === "ENOTDIR")
66582
+ return cb(null, false);
66583
+ return cb(err);
66584
+ });
66585
+ }, "isDirectory");
66586
+ var defaultRealpath = /* @__PURE__ */ __name(function realpath(x, cb) {
66587
+ realpathFS(x, function(realpathErr, realPath) {
66588
+ if (realpathErr && realpathErr.code !== "ENOENT")
66589
+ cb(realpathErr);
66590
+ else
66591
+ cb(null, realpathErr ? x : realPath);
66592
+ });
66593
+ }, "realpath");
66594
+ var maybeRealpath = /* @__PURE__ */ __name(function maybeRealpath2(realpath, x, opts, cb) {
66595
+ if (opts && opts.preserveSymlinks === false) {
66596
+ realpath(x, cb);
66597
+ } else {
66598
+ cb(null, x);
66599
+ }
66600
+ }, "maybeRealpath");
66601
+ var defaultReadPackage = /* @__PURE__ */ __name(function defaultReadPackage2(readFile8, pkgfile, cb) {
66602
+ readFile8(pkgfile, function(readFileErr, body) {
66603
+ if (readFileErr)
66604
+ cb(readFileErr);
66605
+ else {
66606
+ try {
66607
+ var pkg = JSON.parse(body);
66608
+ cb(null, pkg);
66609
+ } catch (jsonErr) {
66610
+ cb(null);
66611
+ }
66612
+ }
66613
+ });
66614
+ }, "defaultReadPackage");
66615
+ var getPackageCandidates = /* @__PURE__ */ __name(function getPackageCandidates2(x, start, opts) {
66616
+ var dirs = nodeModulesPaths(start, opts, x);
66617
+ for (var i = 0; i < dirs.length; i++) {
66618
+ dirs[i] = path56.join(dirs[i], x);
66619
+ }
66620
+ return dirs;
66621
+ }, "getPackageCandidates");
66622
+ module3.exports = /* @__PURE__ */ __name(function resolve18(x, options25, callback) {
66623
+ var cb = callback;
66624
+ var opts = options25;
66625
+ if (typeof options25 === "function") {
66626
+ cb = opts;
66627
+ opts = {};
66628
+ }
66629
+ if (typeof x !== "string") {
66630
+ var err = new TypeError("Path must be a string.");
66631
+ return process.nextTick(function() {
66632
+ cb(err);
66633
+ });
66634
+ }
66635
+ opts = normalizeOptions(x, opts);
66636
+ var isFile = opts.isFile || defaultIsFile;
66637
+ var isDirectory2 = opts.isDirectory || defaultIsDir;
66638
+ var readFile8 = opts.readFile || fs23.readFile;
66639
+ var realpath = opts.realpath || defaultRealpath;
66640
+ var readPackage = opts.readPackage || defaultReadPackage;
66641
+ if (opts.readFile && opts.readPackage) {
66642
+ var conflictErr = new TypeError("`readFile` and `readPackage` are mutually exclusive.");
66643
+ return process.nextTick(function() {
66644
+ cb(conflictErr);
66645
+ });
66646
+ }
66647
+ var packageIterator = opts.packageIterator;
66648
+ var extensions = opts.extensions || [".js"];
66649
+ var includeCoreModules = opts.includeCoreModules !== false;
66650
+ var basedir = opts.basedir || path56.dirname(caller());
66651
+ var parent = opts.filename || basedir;
66652
+ opts.paths = opts.paths || defaultPaths();
66653
+ var absoluteStart = path56.resolve(basedir);
66654
+ maybeRealpath(
66655
+ realpath,
66656
+ absoluteStart,
66657
+ opts,
66658
+ function(err2, realStart) {
66659
+ if (err2)
66660
+ cb(err2);
66661
+ else
66662
+ init2(realStart);
66663
+ }
66664
+ );
66665
+ var res;
66666
+ function init2(basedir2) {
66667
+ if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
66668
+ res = path56.resolve(basedir2, x);
66669
+ if (x === "." || x === ".." || x.slice(-1) === "/")
66670
+ res += "/";
66671
+ if (/\/$/.test(x) && res === basedir2) {
66672
+ loadAsDirectory(res, opts.package, onfile);
66673
+ } else
66674
+ loadAsFile(res, opts.package, onfile);
66675
+ } else if (includeCoreModules && isCore(x)) {
66676
+ return cb(null, x);
66677
+ } else
66678
+ loadNodeModules(x, basedir2, function(err2, n2, pkg) {
66679
+ if (err2)
66680
+ cb(err2);
66681
+ else if (n2) {
66682
+ return maybeRealpath(realpath, n2, opts, function(err3, realN) {
66683
+ if (err3) {
66684
+ cb(err3);
66685
+ } else {
66686
+ cb(null, realN, pkg);
66687
+ }
66688
+ });
66689
+ } else {
66690
+ var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
66691
+ moduleError.code = "MODULE_NOT_FOUND";
66692
+ cb(moduleError);
66693
+ }
66694
+ });
66695
+ }
66696
+ __name(init2, "init");
66697
+ function onfile(err2, m, pkg) {
66698
+ if (err2)
66699
+ cb(err2);
66700
+ else if (m)
66701
+ cb(null, m, pkg);
66702
+ else
66703
+ loadAsDirectory(res, function(err3, d, pkg2) {
66704
+ if (err3)
66705
+ cb(err3);
66706
+ else if (d) {
66707
+ maybeRealpath(realpath, d, opts, function(err4, realD) {
66708
+ if (err4) {
66709
+ cb(err4);
66710
+ } else {
66711
+ cb(null, realD, pkg2);
66712
+ }
66713
+ });
66714
+ } else {
66715
+ var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
66716
+ moduleError.code = "MODULE_NOT_FOUND";
66717
+ cb(moduleError);
66718
+ }
66719
+ });
66720
+ }
66721
+ __name(onfile, "onfile");
66722
+ function loadAsFile(x2, thePackage, callback2) {
66723
+ var loadAsFilePackage = thePackage;
66724
+ var cb2 = callback2;
66725
+ if (typeof loadAsFilePackage === "function") {
66726
+ cb2 = loadAsFilePackage;
66727
+ loadAsFilePackage = void 0;
66728
+ }
66729
+ var exts = [""].concat(extensions);
66730
+ load(exts, x2, loadAsFilePackage);
66731
+ function load(exts2, x3, loadPackage) {
66732
+ if (exts2.length === 0)
66733
+ return cb2(null, void 0, loadPackage);
66734
+ var file = x3 + exts2[0];
66735
+ var pkg = loadPackage;
66736
+ if (pkg)
66737
+ onpkg(null, pkg);
66738
+ else
66739
+ loadpkg(path56.dirname(file), onpkg);
66740
+ function onpkg(err2, pkg_, dir) {
66741
+ pkg = pkg_;
66742
+ if (err2)
66743
+ return cb2(err2);
66744
+ if (dir && pkg && opts.pathFilter) {
66745
+ var rfile = path56.relative(dir, file);
66746
+ var rel = rfile.slice(0, rfile.length - exts2[0].length);
66747
+ var r3 = opts.pathFilter(pkg, x3, rel);
66748
+ if (r3)
66749
+ return load(
66750
+ [""].concat(extensions.slice()),
66751
+ path56.resolve(dir, r3),
66752
+ pkg
66753
+ );
66754
+ }
66755
+ isFile(file, onex);
66756
+ }
66757
+ __name(onpkg, "onpkg");
66758
+ function onex(err2, ex) {
66759
+ if (err2)
66760
+ return cb2(err2);
66761
+ if (ex)
66762
+ return cb2(null, file, pkg);
66763
+ load(exts2.slice(1), x3, pkg);
66764
+ }
66765
+ __name(onex, "onex");
66766
+ }
66767
+ __name(load, "load");
66768
+ }
66769
+ __name(loadAsFile, "loadAsFile");
66770
+ function loadpkg(dir, cb2) {
66771
+ if (dir === "" || dir === "/")
66772
+ return cb2(null);
66773
+ if (process.platform === "win32" && /^\w:[/\\]*$/.test(dir)) {
66774
+ return cb2(null);
66775
+ }
66776
+ if (/[/\\]node_modules[/\\]*$/.test(dir))
66777
+ return cb2(null);
66778
+ maybeRealpath(realpath, dir, opts, function(unwrapErr, pkgdir) {
66779
+ if (unwrapErr)
66780
+ return loadpkg(path56.dirname(dir), cb2);
66781
+ var pkgfile = path56.join(pkgdir, "package.json");
66782
+ isFile(pkgfile, function(err2, ex) {
66783
+ if (!ex)
66784
+ return loadpkg(path56.dirname(dir), cb2);
66785
+ readPackage(readFile8, pkgfile, function(err3, pkgParam) {
66786
+ if (err3)
66787
+ cb2(err3);
66788
+ var pkg = pkgParam;
66789
+ if (pkg && opts.packageFilter) {
66790
+ pkg = opts.packageFilter(pkg, pkgfile);
66791
+ }
66792
+ cb2(null, pkg, dir);
66793
+ });
66794
+ });
66795
+ });
66796
+ }
66797
+ __name(loadpkg, "loadpkg");
66798
+ function loadAsDirectory(x2, loadAsDirectoryPackage, callback2) {
66799
+ var cb2 = callback2;
66800
+ var fpkg = loadAsDirectoryPackage;
66801
+ if (typeof fpkg === "function") {
66802
+ cb2 = fpkg;
66803
+ fpkg = opts.package;
66804
+ }
66805
+ maybeRealpath(realpath, x2, opts, function(unwrapErr, pkgdir) {
66806
+ if (unwrapErr)
66807
+ return cb2(unwrapErr);
66808
+ var pkgfile = path56.join(pkgdir, "package.json");
66809
+ isFile(pkgfile, function(err2, ex) {
66810
+ if (err2)
66811
+ return cb2(err2);
66812
+ if (!ex)
66813
+ return loadAsFile(path56.join(x2, "index"), fpkg, cb2);
66814
+ readPackage(readFile8, pkgfile, function(err3, pkgParam) {
66815
+ if (err3)
66816
+ return cb2(err3);
66817
+ var pkg = pkgParam;
66818
+ if (pkg && opts.packageFilter) {
66819
+ pkg = opts.packageFilter(pkg, pkgfile);
66820
+ }
66821
+ if (pkg && pkg.main) {
66822
+ if (typeof pkg.main !== "string") {
66823
+ var mainError = new TypeError("package \u201C" + pkg.name + "\u201D `main` must be a string");
66824
+ mainError.code = "INVALID_PACKAGE_MAIN";
66825
+ return cb2(mainError);
66826
+ }
66827
+ if (pkg.main === "." || pkg.main === "./") {
66828
+ pkg.main = "index";
66829
+ }
66830
+ loadAsFile(path56.resolve(x2, pkg.main), pkg, function(err4, m, pkg2) {
66831
+ if (err4)
66832
+ return cb2(err4);
66833
+ if (m)
66834
+ return cb2(null, m, pkg2);
66835
+ if (!pkg2)
66836
+ return loadAsFile(path56.join(x2, "index"), pkg2, cb2);
66837
+ var dir = path56.resolve(x2, pkg2.main);
66838
+ loadAsDirectory(dir, pkg2, function(err5, n2, pkg3) {
66839
+ if (err5)
66840
+ return cb2(err5);
66841
+ if (n2)
66842
+ return cb2(null, n2, pkg3);
66843
+ loadAsFile(path56.join(x2, "index"), pkg3, cb2);
66844
+ });
66845
+ });
66846
+ return;
66847
+ }
66848
+ loadAsFile(path56.join(x2, "/index"), pkg, cb2);
66849
+ });
66850
+ });
66851
+ });
66852
+ }
66853
+ __name(loadAsDirectory, "loadAsDirectory");
66854
+ function processDirs(cb2, dirs) {
66855
+ if (dirs.length === 0)
66856
+ return cb2(null, void 0);
66857
+ var dir = dirs[0];
66858
+ isDirectory2(path56.dirname(dir), isdir);
66859
+ function isdir(err2, isdir2) {
66860
+ if (err2)
66861
+ return cb2(err2);
66862
+ if (!isdir2)
66863
+ return processDirs(cb2, dirs.slice(1));
66864
+ loadAsFile(dir, opts.package, onfile2);
66865
+ }
66866
+ __name(isdir, "isdir");
66867
+ function onfile2(err2, m, pkg) {
66868
+ if (err2)
66869
+ return cb2(err2);
66870
+ if (m)
66871
+ return cb2(null, m, pkg);
66872
+ loadAsDirectory(dir, opts.package, ondir);
66873
+ }
66874
+ __name(onfile2, "onfile");
66875
+ function ondir(err2, n2, pkg) {
66876
+ if (err2)
66877
+ return cb2(err2);
66878
+ if (n2)
66879
+ return cb2(null, n2, pkg);
66880
+ processDirs(cb2, dirs.slice(1));
66881
+ }
66882
+ __name(ondir, "ondir");
66883
+ }
66884
+ __name(processDirs, "processDirs");
66885
+ function loadNodeModules(x2, start, cb2) {
66886
+ var thunk = /* @__PURE__ */ __name(function() {
66887
+ return getPackageCandidates(x2, start, opts);
66888
+ }, "thunk");
66889
+ processDirs(
66890
+ cb2,
66891
+ packageIterator ? packageIterator(x2, start, thunk, opts) : thunk()
66892
+ );
66893
+ }
66894
+ __name(loadNodeModules, "loadNodeModules");
66895
+ }, "resolve");
66896
+ }
66897
+ });
66898
+
66899
+ // ../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/core.json
66900
+ var require_core2 = __commonJS({
66901
+ "../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/core.json"(exports2, module3) {
66902
+ module3.exports = {
66903
+ assert: true,
66904
+ "node:assert": [">= 14.18 && < 15", ">= 16"],
66905
+ "assert/strict": ">= 15",
66906
+ "node:assert/strict": ">= 16",
66907
+ async_hooks: ">= 8",
66908
+ "node:async_hooks": [">= 14.18 && < 15", ">= 16"],
66909
+ buffer_ieee754: ">= 0.5 && < 0.9.7",
66910
+ buffer: true,
66911
+ "node:buffer": [">= 14.18 && < 15", ">= 16"],
66912
+ child_process: true,
66913
+ "node:child_process": [">= 14.18 && < 15", ">= 16"],
66914
+ cluster: ">= 0.5",
66915
+ "node:cluster": [">= 14.18 && < 15", ">= 16"],
66916
+ console: true,
66917
+ "node:console": [">= 14.18 && < 15", ">= 16"],
66918
+ constants: true,
66919
+ "node:constants": [">= 14.18 && < 15", ">= 16"],
66920
+ crypto: true,
66921
+ "node:crypto": [">= 14.18 && < 15", ">= 16"],
66922
+ _debug_agent: ">= 1 && < 8",
66923
+ _debugger: "< 8",
66924
+ dgram: true,
66925
+ "node:dgram": [">= 14.18 && < 15", ">= 16"],
66926
+ diagnostics_channel: [">= 14.17 && < 15", ">= 15.1"],
66927
+ "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"],
66928
+ dns: true,
66929
+ "node:dns": [">= 14.18 && < 15", ">= 16"],
66930
+ "dns/promises": ">= 15",
66931
+ "node:dns/promises": ">= 16",
66932
+ domain: ">= 0.7.12",
66933
+ "node:domain": [">= 14.18 && < 15", ">= 16"],
66934
+ events: true,
66935
+ "node:events": [">= 14.18 && < 15", ">= 16"],
66936
+ freelist: "< 6",
66937
+ fs: true,
66938
+ "node:fs": [">= 14.18 && < 15", ">= 16"],
66939
+ "fs/promises": [">= 10 && < 10.1", ">= 14"],
66940
+ "node:fs/promises": [">= 14.18 && < 15", ">= 16"],
66941
+ _http_agent: ">= 0.11.1",
66942
+ "node:_http_agent": [">= 14.18 && < 15", ">= 16"],
66943
+ _http_client: ">= 0.11.1",
66944
+ "node:_http_client": [">= 14.18 && < 15", ">= 16"],
66945
+ _http_common: ">= 0.11.1",
66946
+ "node:_http_common": [">= 14.18 && < 15", ">= 16"],
66947
+ _http_incoming: ">= 0.11.1",
66948
+ "node:_http_incoming": [">= 14.18 && < 15", ">= 16"],
66949
+ _http_outgoing: ">= 0.11.1",
66950
+ "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"],
66951
+ _http_server: ">= 0.11.1",
66952
+ "node:_http_server": [">= 14.18 && < 15", ">= 16"],
66953
+ http: true,
66954
+ "node:http": [">= 14.18 && < 15", ">= 16"],
66955
+ http2: ">= 8.8",
66956
+ "node:http2": [">= 14.18 && < 15", ">= 16"],
66957
+ https: true,
66958
+ "node:https": [">= 14.18 && < 15", ">= 16"],
66959
+ inspector: ">= 8",
66960
+ "node:inspector": [">= 14.18 && < 15", ">= 16"],
66961
+ "inspector/promises": [">= 19"],
66962
+ "node:inspector/promises": [">= 19"],
66963
+ _linklist: "< 8",
66964
+ module: true,
66965
+ "node:module": [">= 14.18 && < 15", ">= 16"],
66966
+ net: true,
66967
+ "node:net": [">= 14.18 && < 15", ">= 16"],
66968
+ "node-inspect/lib/_inspect": ">= 7.6 && < 12",
66969
+ "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12",
66970
+ "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12",
66971
+ os: true,
66972
+ "node:os": [">= 14.18 && < 15", ">= 16"],
66973
+ path: true,
66974
+ "node:path": [">= 14.18 && < 15", ">= 16"],
66975
+ "path/posix": ">= 15.3",
66976
+ "node:path/posix": ">= 16",
66977
+ "path/win32": ">= 15.3",
66978
+ "node:path/win32": ">= 16",
66979
+ perf_hooks: ">= 8.5",
66980
+ "node:perf_hooks": [">= 14.18 && < 15", ">= 16"],
66981
+ process: ">= 1",
66982
+ "node:process": [">= 14.18 && < 15", ">= 16"],
66983
+ punycode: ">= 0.5",
66984
+ "node:punycode": [">= 14.18 && < 15", ">= 16"],
66985
+ querystring: true,
66986
+ "node:querystring": [">= 14.18 && < 15", ">= 16"],
66987
+ readline: true,
66988
+ "node:readline": [">= 14.18 && < 15", ">= 16"],
66989
+ "readline/promises": ">= 17",
66990
+ "node:readline/promises": ">= 17",
66991
+ repl: true,
66992
+ "node:repl": [">= 14.18 && < 15", ">= 16"],
66993
+ smalloc: ">= 0.11.5 && < 3",
66994
+ _stream_duplex: ">= 0.9.4",
66995
+ "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"],
66996
+ _stream_transform: ">= 0.9.4",
66997
+ "node:_stream_transform": [">= 14.18 && < 15", ">= 16"],
66998
+ _stream_wrap: ">= 1.4.1",
66999
+ "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"],
67000
+ _stream_passthrough: ">= 0.9.4",
67001
+ "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"],
67002
+ _stream_readable: ">= 0.9.4",
67003
+ "node:_stream_readable": [">= 14.18 && < 15", ">= 16"],
67004
+ _stream_writable: ">= 0.9.4",
67005
+ "node:_stream_writable": [">= 14.18 && < 15", ">= 16"],
67006
+ stream: true,
67007
+ "node:stream": [">= 14.18 && < 15", ">= 16"],
67008
+ "stream/consumers": ">= 16.7",
67009
+ "node:stream/consumers": ">= 16.7",
67010
+ "stream/promises": ">= 15",
67011
+ "node:stream/promises": ">= 16",
67012
+ "stream/web": ">= 16.5",
67013
+ "node:stream/web": ">= 16.5",
67014
+ string_decoder: true,
67015
+ "node:string_decoder": [">= 14.18 && < 15", ">= 16"],
67016
+ sys: [">= 0.4 && < 0.7", ">= 0.8"],
67017
+ "node:sys": [">= 14.18 && < 15", ">= 16"],
67018
+ "test/reporters": ">= 19.9 && < 20.2",
67019
+ "node:test/reporters": [">= 18.17 && < 19", ">= 19.9", ">= 20"],
67020
+ "node:test": [">= 16.17 && < 17", ">= 18"],
67021
+ timers: true,
67022
+ "node:timers": [">= 14.18 && < 15", ">= 16"],
67023
+ "timers/promises": ">= 15",
67024
+ "node:timers/promises": ">= 16",
67025
+ _tls_common: ">= 0.11.13",
67026
+ "node:_tls_common": [">= 14.18 && < 15", ">= 16"],
67027
+ _tls_legacy: ">= 0.11.3 && < 10",
67028
+ _tls_wrap: ">= 0.11.3",
67029
+ "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"],
67030
+ tls: true,
67031
+ "node:tls": [">= 14.18 && < 15", ">= 16"],
67032
+ trace_events: ">= 10",
67033
+ "node:trace_events": [">= 14.18 && < 15", ">= 16"],
67034
+ tty: true,
67035
+ "node:tty": [">= 14.18 && < 15", ">= 16"],
67036
+ url: true,
67037
+ "node:url": [">= 14.18 && < 15", ">= 16"],
67038
+ util: true,
67039
+ "node:util": [">= 14.18 && < 15", ">= 16"],
67040
+ "util/types": ">= 15.3",
67041
+ "node:util/types": ">= 16",
67042
+ "v8/tools/arguments": ">= 10 && < 12",
67043
+ "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"],
67044
+ "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"],
67045
+ "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"],
67046
+ "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"],
67047
+ "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"],
67048
+ "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"],
67049
+ v8: ">= 1",
67050
+ "node:v8": [">= 14.18 && < 15", ">= 16"],
67051
+ vm: true,
67052
+ "node:vm": [">= 14.18 && < 15", ">= 16"],
67053
+ wasi: [">= 13.4 && < 13.5", ">= 18.17 && < 19", ">= 20"],
67054
+ "node:wasi": [">= 18.17 && < 19", ">= 20"],
67055
+ worker_threads: ">= 11.7",
67056
+ "node:worker_threads": [">= 14.18 && < 15", ">= 16"],
67057
+ zlib: ">= 0.5",
67058
+ "node:zlib": [">= 14.18 && < 15", ">= 16"]
67059
+ };
67060
+ }
67061
+ });
67062
+
67063
+ // ../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/core.js
67064
+ var require_core3 = __commonJS({
67065
+ "../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/core.js"(exports2, module3) {
67066
+ "use strict";
67067
+ init_import_meta_url();
67068
+ var isCoreModule = require_is_core_module();
67069
+ var data = require_core2();
67070
+ var core = {};
67071
+ for (mod in data) {
67072
+ if (Object.prototype.hasOwnProperty.call(data, mod)) {
67073
+ core[mod] = isCoreModule(mod);
67074
+ }
67075
+ }
67076
+ var mod;
67077
+ module3.exports = core;
67078
+ }
67079
+ });
67080
+
67081
+ // ../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/is-core.js
67082
+ var require_is_core = __commonJS({
67083
+ "../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/is-core.js"(exports2, module3) {
67084
+ init_import_meta_url();
67085
+ var isCoreModule = require_is_core_module();
67086
+ module3.exports = /* @__PURE__ */ __name(function isCore(x) {
67087
+ return isCoreModule(x);
67088
+ }, "isCore");
67089
+ }
67090
+ });
67091
+
67092
+ // ../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/sync.js
67093
+ var require_sync = __commonJS({
67094
+ "../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/sync.js"(exports2, module3) {
67095
+ init_import_meta_url();
67096
+ var isCore = require_is_core_module();
67097
+ var fs23 = require("fs");
67098
+ var path56 = require("path");
67099
+ var getHomedir = require_homedir();
67100
+ var caller = require_caller();
67101
+ var nodeModulesPaths = require_node_modules_paths();
67102
+ var normalizeOptions = require_normalize_options();
67103
+ var realpathFS = process.platform !== "win32" && fs23.realpathSync && typeof fs23.realpathSync.native === "function" ? fs23.realpathSync.native : fs23.realpathSync;
67104
+ var homedir2 = getHomedir();
67105
+ var defaultPaths = /* @__PURE__ */ __name(function() {
67106
+ return [
67107
+ path56.join(homedir2, ".node_modules"),
67108
+ path56.join(homedir2, ".node_libraries")
67109
+ ];
67110
+ }, "defaultPaths");
67111
+ var defaultIsFile = /* @__PURE__ */ __name(function isFile(file) {
67112
+ try {
67113
+ var stat3 = fs23.statSync(file, { throwIfNoEntry: false });
67114
+ } catch (e3) {
67115
+ if (e3 && (e3.code === "ENOENT" || e3.code === "ENOTDIR"))
67116
+ return false;
67117
+ throw e3;
67118
+ }
67119
+ return !!stat3 && (stat3.isFile() || stat3.isFIFO());
67120
+ }, "isFile");
67121
+ var defaultIsDir = /* @__PURE__ */ __name(function isDirectory2(dir) {
67122
+ try {
67123
+ var stat3 = fs23.statSync(dir, { throwIfNoEntry: false });
67124
+ } catch (e3) {
67125
+ if (e3 && (e3.code === "ENOENT" || e3.code === "ENOTDIR"))
67126
+ return false;
67127
+ throw e3;
67128
+ }
67129
+ return !!stat3 && stat3.isDirectory();
67130
+ }, "isDirectory");
67131
+ var defaultRealpathSync = /* @__PURE__ */ __name(function realpathSync3(x) {
67132
+ try {
67133
+ return realpathFS(x);
67134
+ } catch (realpathErr) {
67135
+ if (realpathErr.code !== "ENOENT") {
67136
+ throw realpathErr;
67137
+ }
67138
+ }
67139
+ return x;
67140
+ }, "realpathSync");
67141
+ var maybeRealpathSync = /* @__PURE__ */ __name(function maybeRealpathSync2(realpathSync3, x, opts) {
67142
+ if (opts && opts.preserveSymlinks === false) {
67143
+ return realpathSync3(x);
67144
+ }
67145
+ return x;
67146
+ }, "maybeRealpathSync");
67147
+ var defaultReadPackageSync = /* @__PURE__ */ __name(function defaultReadPackageSync2(readFileSync23, pkgfile) {
67148
+ var body = readFileSync23(pkgfile);
67149
+ try {
67150
+ var pkg = JSON.parse(body);
67151
+ return pkg;
67152
+ } catch (jsonErr) {
67153
+ }
67154
+ }, "defaultReadPackageSync");
67155
+ var getPackageCandidates = /* @__PURE__ */ __name(function getPackageCandidates2(x, start, opts) {
67156
+ var dirs = nodeModulesPaths(start, opts, x);
67157
+ for (var i = 0; i < dirs.length; i++) {
67158
+ dirs[i] = path56.join(dirs[i], x);
67159
+ }
67160
+ return dirs;
67161
+ }, "getPackageCandidates");
67162
+ module3.exports = /* @__PURE__ */ __name(function resolveSync2(x, options25) {
67163
+ if (typeof x !== "string") {
67164
+ throw new TypeError("Path must be a string.");
67165
+ }
67166
+ var opts = normalizeOptions(x, options25);
67167
+ var isFile = opts.isFile || defaultIsFile;
67168
+ var readFileSync23 = opts.readFileSync || fs23.readFileSync;
67169
+ var isDirectory2 = opts.isDirectory || defaultIsDir;
67170
+ var realpathSync3 = opts.realpathSync || defaultRealpathSync;
67171
+ var readPackageSync = opts.readPackageSync || defaultReadPackageSync;
67172
+ if (opts.readFileSync && opts.readPackageSync) {
67173
+ throw new TypeError("`readFileSync` and `readPackageSync` are mutually exclusive.");
67174
+ }
67175
+ var packageIterator = opts.packageIterator;
67176
+ var extensions = opts.extensions || [".js"];
67177
+ var includeCoreModules = opts.includeCoreModules !== false;
67178
+ var basedir = opts.basedir || path56.dirname(caller());
67179
+ var parent = opts.filename || basedir;
67180
+ opts.paths = opts.paths || defaultPaths();
67181
+ var absoluteStart = maybeRealpathSync(realpathSync3, path56.resolve(basedir), opts);
67182
+ if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
67183
+ var res = path56.resolve(absoluteStart, x);
67184
+ if (x === "." || x === ".." || x.slice(-1) === "/")
67185
+ res += "/";
67186
+ var m = loadAsFileSync(res) || loadAsDirectorySync(res);
67187
+ if (m)
67188
+ return maybeRealpathSync(realpathSync3, m, opts);
67189
+ } else if (includeCoreModules && isCore(x)) {
67190
+ return x;
67191
+ } else {
67192
+ var n2 = loadNodeModulesSync(x, absoluteStart);
67193
+ if (n2)
67194
+ return maybeRealpathSync(realpathSync3, n2, opts);
67195
+ }
67196
+ var err = new Error("Cannot find module '" + x + "' from '" + parent + "'");
67197
+ err.code = "MODULE_NOT_FOUND";
67198
+ throw err;
67199
+ function loadAsFileSync(x2) {
67200
+ var pkg = loadpkg(path56.dirname(x2));
67201
+ if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) {
67202
+ var rfile = path56.relative(pkg.dir, x2);
67203
+ var r3 = opts.pathFilter(pkg.pkg, x2, rfile);
67204
+ if (r3) {
67205
+ x2 = path56.resolve(pkg.dir, r3);
67206
+ }
67207
+ }
67208
+ if (isFile(x2)) {
67209
+ return x2;
67210
+ }
67211
+ for (var i = 0; i < extensions.length; i++) {
67212
+ var file = x2 + extensions[i];
67213
+ if (isFile(file)) {
67214
+ return file;
67215
+ }
67216
+ }
67217
+ }
67218
+ __name(loadAsFileSync, "loadAsFileSync");
67219
+ function loadpkg(dir) {
67220
+ if (dir === "" || dir === "/")
67221
+ return;
67222
+ if (process.platform === "win32" && /^\w:[/\\]*$/.test(dir)) {
67223
+ return;
67224
+ }
67225
+ if (/[/\\]node_modules[/\\]*$/.test(dir))
67226
+ return;
67227
+ var pkgfile = path56.join(maybeRealpathSync(realpathSync3, dir, opts), "package.json");
67228
+ if (!isFile(pkgfile)) {
67229
+ return loadpkg(path56.dirname(dir));
67230
+ }
67231
+ var pkg = readPackageSync(readFileSync23, pkgfile);
67232
+ if (pkg && opts.packageFilter) {
67233
+ pkg = opts.packageFilter(
67234
+ pkg,
67235
+ /*pkgfile,*/
67236
+ dir
67237
+ );
67238
+ }
67239
+ return { pkg, dir };
67240
+ }
67241
+ __name(loadpkg, "loadpkg");
67242
+ function loadAsDirectorySync(x2) {
67243
+ var pkgfile = path56.join(maybeRealpathSync(realpathSync3, x2, opts), "/package.json");
67244
+ if (isFile(pkgfile)) {
67245
+ try {
67246
+ var pkg = readPackageSync(readFileSync23, pkgfile);
67247
+ } catch (e3) {
67248
+ }
67249
+ if (pkg && opts.packageFilter) {
67250
+ pkg = opts.packageFilter(
67251
+ pkg,
67252
+ /*pkgfile,*/
67253
+ x2
67254
+ );
67255
+ }
67256
+ if (pkg && pkg.main) {
67257
+ if (typeof pkg.main !== "string") {
67258
+ var mainError = new TypeError("package \u201C" + pkg.name + "\u201D `main` must be a string");
67259
+ mainError.code = "INVALID_PACKAGE_MAIN";
67260
+ throw mainError;
67261
+ }
67262
+ if (pkg.main === "." || pkg.main === "./") {
67263
+ pkg.main = "index";
67264
+ }
67265
+ try {
67266
+ var m2 = loadAsFileSync(path56.resolve(x2, pkg.main));
67267
+ if (m2)
67268
+ return m2;
67269
+ var n3 = loadAsDirectorySync(path56.resolve(x2, pkg.main));
67270
+ if (n3)
67271
+ return n3;
67272
+ } catch (e3) {
67273
+ }
67274
+ }
67275
+ }
67276
+ return loadAsFileSync(path56.join(x2, "/index"));
67277
+ }
67278
+ __name(loadAsDirectorySync, "loadAsDirectorySync");
67279
+ function loadNodeModulesSync(x2, start) {
67280
+ var thunk = /* @__PURE__ */ __name(function() {
67281
+ return getPackageCandidates(x2, start, opts);
67282
+ }, "thunk");
67283
+ var dirs = packageIterator ? packageIterator(x2, start, thunk, opts) : thunk();
67284
+ for (var i = 0; i < dirs.length; i++) {
67285
+ var dir = dirs[i];
67286
+ if (isDirectory2(path56.dirname(dir))) {
67287
+ var m2 = loadAsFileSync(dir);
67288
+ if (m2)
67289
+ return m2;
67290
+ var n3 = loadAsDirectorySync(dir);
67291
+ if (n3)
67292
+ return n3;
67293
+ }
67294
+ }
67295
+ }
67296
+ __name(loadNodeModulesSync, "loadNodeModulesSync");
67297
+ }, "resolveSync");
67298
+ }
67299
+ });
67300
+
67301
+ // ../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/index.js
67302
+ var require_resolve = __commonJS({
67303
+ "../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/index.js"(exports2, module3) {
67304
+ init_import_meta_url();
67305
+ var async = require_async();
67306
+ async.core = require_core3();
67307
+ async.isCore = require_is_core();
67308
+ async.sync = require_sync();
67309
+ module3.exports = async;
67310
+ }
67311
+ });
67312
+
66090
67313
  // ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
66091
67314
  var require_windows = __commonJS({
66092
67315
  "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports2, module3) {
@@ -66831,7 +68054,7 @@ var require_npm_run_path = __commonJS({
66831
68054
  });
66832
68055
 
66833
68056
  // ../../node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/core.js
66834
- var require_core = __commonJS({
68057
+ var require_core4 = __commonJS({
66835
68058
  "../../node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/core.js"(exports2) {
66836
68059
  "use strict";
66837
68060
  init_import_meta_url();
@@ -67147,7 +68370,7 @@ var require_signals2 = __commonJS({
67147
68370
  Object.defineProperty(exports2, "__esModule", { value: true });
67148
68371
  exports2.getSignals = void 0;
67149
68372
  var _os = require("os");
67150
- var _core = require_core();
68373
+ var _core = require_core4();
67151
68374
  var _realtime = require_realtime();
67152
68375
  var getSignals2 = /* @__PURE__ */ __name(function() {
67153
68376
  const realtimeSignals = (0, _realtime.getRealtimeSignals)();
@@ -69438,7 +70661,7 @@ var require_node4 = __commonJS({
69438
70661
  });
69439
70662
 
69440
70663
  // ../../node_modules/.pnpm/debug@2.6.9_supports-color@9.2.2/node_modules/debug/src/index.js
69441
- var require_src2 = __commonJS({
70664
+ var require_src3 = __commonJS({
69442
70665
  "../../node_modules/.pnpm/debug@2.6.9_supports-color@9.2.2/node_modules/debug/src/index.js"(exports2, module3) {
69443
70666
  init_import_meta_url();
69444
70667
  if (typeof process !== "undefined" && process.type === "renderer") {
@@ -82481,7 +83704,7 @@ var require_json = __commonJS({
82481
83704
  var bytes = require_bytes();
82482
83705
  var contentType = require_content_type();
82483
83706
  var createError = require_http_errors();
82484
- var debug = require_src2()("body-parser:json");
83707
+ var debug = require_src3()("body-parser:json");
82485
83708
  var read = require_read();
82486
83709
  var typeis = require_type_is();
82487
83710
  module3.exports = json;
@@ -82611,7 +83834,7 @@ var require_raw = __commonJS({
82611
83834
  "use strict";
82612
83835
  init_import_meta_url();
82613
83836
  var bytes = require_bytes();
82614
- var debug = require_src2()("body-parser:raw");
83837
+ var debug = require_src3()("body-parser:raw");
82615
83838
  var read = require_read();
82616
83839
  var typeis = require_type_is();
82617
83840
  module3.exports = raw;
@@ -82672,7 +83895,7 @@ var require_text3 = __commonJS({
82672
83895
  init_import_meta_url();
82673
83896
  var bytes = require_bytes();
82674
83897
  var contentType = require_content_type();
82675
- var debug = require_src2()("body-parser:text");
83898
+ var debug = require_src3()("body-parser:text");
82676
83899
  var read = require_read();
82677
83900
  var typeis = require_type_is();
82678
83901
  module3.exports = text;
@@ -82829,77 +84052,6 @@ var require_has_proto = __commonJS({
82829
84052
  }
82830
84053
  });
82831
84054
 
82832
- // ../../node_modules/.pnpm/function-bind@1.1.1/node_modules/function-bind/implementation.js
82833
- var require_implementation = __commonJS({
82834
- "../../node_modules/.pnpm/function-bind@1.1.1/node_modules/function-bind/implementation.js"(exports2, module3) {
82835
- "use strict";
82836
- init_import_meta_url();
82837
- var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
82838
- var slice = Array.prototype.slice;
82839
- var toStr = Object.prototype.toString;
82840
- var funcType = "[object Function]";
82841
- module3.exports = /* @__PURE__ */ __name(function bind(that) {
82842
- var target = this;
82843
- if (typeof target !== "function" || toStr.call(target) !== funcType) {
82844
- throw new TypeError(ERROR_MESSAGE + target);
82845
- }
82846
- var args = slice.call(arguments, 1);
82847
- var bound;
82848
- var binder = /* @__PURE__ */ __name(function() {
82849
- if (this instanceof bound) {
82850
- var result = target.apply(
82851
- this,
82852
- args.concat(slice.call(arguments))
82853
- );
82854
- if (Object(result) === result) {
82855
- return result;
82856
- }
82857
- return this;
82858
- } else {
82859
- return target.apply(
82860
- that,
82861
- args.concat(slice.call(arguments))
82862
- );
82863
- }
82864
- }, "binder");
82865
- var boundLength = Math.max(0, target.length - args.length);
82866
- var boundArgs = [];
82867
- for (var i = 0; i < boundLength; i++) {
82868
- boundArgs.push("$" + i);
82869
- }
82870
- bound = Function("binder", "return function (" + boundArgs.join(",") + "){ return binder.apply(this,arguments); }")(binder);
82871
- if (target.prototype) {
82872
- var Empty = /* @__PURE__ */ __name(function Empty2() {
82873
- }, "Empty");
82874
- Empty.prototype = target.prototype;
82875
- bound.prototype = new Empty();
82876
- Empty.prototype = null;
82877
- }
82878
- return bound;
82879
- }, "bind");
82880
- }
82881
- });
82882
-
82883
- // ../../node_modules/.pnpm/function-bind@1.1.1/node_modules/function-bind/index.js
82884
- var require_function_bind = __commonJS({
82885
- "../../node_modules/.pnpm/function-bind@1.1.1/node_modules/function-bind/index.js"(exports2, module3) {
82886
- "use strict";
82887
- init_import_meta_url();
82888
- var implementation = require_implementation();
82889
- module3.exports = Function.prototype.bind || implementation;
82890
- }
82891
- });
82892
-
82893
- // ../../node_modules/.pnpm/has@1.0.3/node_modules/has/src/index.js
82894
- var require_src3 = __commonJS({
82895
- "../../node_modules/.pnpm/has@1.0.3/node_modules/has/src/index.js"(exports2, module3) {
82896
- "use strict";
82897
- init_import_meta_url();
82898
- var bind = require_function_bind();
82899
- module3.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
82900
- }
82901
- });
82902
-
82903
84055
  // ../../node_modules/.pnpm/get-intrinsic@1.2.1/node_modules/get-intrinsic/index.js
82904
84056
  var require_get_intrinsic = __commonJS({
82905
84057
  "../../node_modules/.pnpm/get-intrinsic@1.2.1/node_modules/get-intrinsic/index.js"(exports2, module3) {
@@ -83099,7 +84251,7 @@ var require_get_intrinsic = __commonJS({
83099
84251
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
83100
84252
  };
83101
84253
  var bind = require_function_bind();
83102
- var hasOwn = require_src3();
84254
+ var hasOwn = require_src2();
83103
84255
  var $concat = bind.call(Function.call, Array.prototype.concat);
83104
84256
  var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
83105
84257
  var $replace = bind.call(Function.call, String.prototype.replace);
@@ -84644,7 +85796,7 @@ var require_urlencoded2 = __commonJS({
84644
85796
  var bytes = require_bytes();
84645
85797
  var contentType = require_content_type();
84646
85798
  var createError = require_http_errors();
84647
- var debug = require_src2()("body-parser:urlencoded");
85799
+ var debug = require_src3()("body-parser:urlencoded");
84648
85800
  var deprecate = require_depd()("body-parser");
84649
85801
  var read = require_read();
84650
85802
  var typeis = require_type_is();
@@ -85068,7 +86220,7 @@ var require_finalhandler = __commonJS({
85068
86220
  "../../node_modules/.pnpm/finalhandler@1.2.0_supports-color@9.2.2/node_modules/finalhandler/index.js"(exports2, module3) {
85069
86221
  "use strict";
85070
86222
  init_import_meta_url();
85071
- var debug = require_src2()("finalhandler");
86223
+ var debug = require_src3()("finalhandler");
85072
86224
  var encodeUrl = require_encodeurl();
85073
86225
  var escapeHtml = require_escape_html();
85074
86226
  var onFinished = require_on_finished();
@@ -85346,7 +86498,7 @@ var require_layer = __commonJS({
85346
86498
  "use strict";
85347
86499
  init_import_meta_url();
85348
86500
  var pathRegexp = require_path_to_regexp();
85349
- var debug = require_src2()("express:router:layer");
86501
+ var debug = require_src3()("express:router:layer");
85350
86502
  var hasOwnProperty2 = Object.prototype.hasOwnProperty;
85351
86503
  module3.exports = Layer;
85352
86504
  function Layer(path56, options25, fn2) {
@@ -85490,7 +86642,7 @@ var require_route3 = __commonJS({
85490
86642
  "../../node_modules/.pnpm/express@4.18.1_supports-color@9.2.2/node_modules/express/lib/router/route.js"(exports2, module3) {
85491
86643
  "use strict";
85492
86644
  init_import_meta_url();
85493
- var debug = require_src2()("express:router:route");
86645
+ var debug = require_src3()("express:router:route");
85494
86646
  var flatten = require_array_flatten();
85495
86647
  var Layer = require_layer();
85496
86648
  var methods = require_methods();
@@ -85625,7 +86777,7 @@ var require_router = __commonJS({
85625
86777
  var Layer = require_layer();
85626
86778
  var methods = require_methods();
85627
86779
  var mixin3 = require_utils_merge();
85628
- var debug = require_src2()("express:router");
86780
+ var debug = require_src3()("express:router");
85629
86781
  var deprecate = require_depd()("express");
85630
86782
  var flatten = require_array_flatten();
85631
86783
  var parseUrl2 = require_parseurl();
@@ -86073,7 +87225,7 @@ var require_view = __commonJS({
86073
87225
  "../../node_modules/.pnpm/express@4.18.1_supports-color@9.2.2/node_modules/express/lib/view.js"(exports2, module3) {
86074
87226
  "use strict";
86075
87227
  init_import_meta_url();
86076
- var debug = require_src2()("express:view");
87228
+ var debug = require_src3()("express:view");
86077
87229
  var path56 = require("path");
86078
87230
  var fs23 = require("fs");
86079
87231
  var dirname13 = path56.dirname;
@@ -86789,7 +87941,7 @@ var require_send = __commonJS({
86789
87941
  "use strict";
86790
87942
  init_import_meta_url();
86791
87943
  var createError = require_http_errors();
86792
- var debug = require_src2()("send");
87944
+ var debug = require_src3()("send");
86793
87945
  var deprecate = require_depd()("send");
86794
87946
  var destroy = require_destroy();
86795
87947
  var encodeUrl = require_encodeurl();
@@ -88362,7 +89514,7 @@ var require_application = __commonJS({
88362
89514
  var methods = require_methods();
88363
89515
  var middleware = require_init();
88364
89516
  var query = require_query();
88365
- var debug = require_src2()("express:application");
89517
+ var debug = require_src3()("express:application");
88366
89518
  var View = require_view();
88367
89519
  var http4 = require("http");
88368
89520
  var compileETag = require_utils5().compileETag;
@@ -92103,7 +93255,7 @@ var require_json_schema_traverse = __commonJS({
92103
93255
  });
92104
93256
 
92105
93257
  // ../../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/resolve.js
92106
- var require_resolve = __commonJS({
93258
+ var require_resolve2 = __commonJS({
92107
93259
  "../../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/resolve.js"(exports2, module3) {
92108
93260
  "use strict";
92109
93261
  init_import_meta_url();
@@ -92364,7 +93516,7 @@ var require_error_classes = __commonJS({
92364
93516
  "../../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/error_classes.js"(exports2, module3) {
92365
93517
  "use strict";
92366
93518
  init_import_meta_url();
92367
- var resolve18 = require_resolve();
93519
+ var resolve18 = require_resolve2();
92368
93520
  module3.exports = {
92369
93521
  Validation: errorSubclass(ValidationError),
92370
93522
  MissingRef: errorSubclass(MissingRefError)
@@ -92940,7 +94092,7 @@ var require_compile = __commonJS({
92940
94092
  "../../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/index.js"(exports2, module3) {
92941
94093
  "use strict";
92942
94094
  init_import_meta_url();
92943
- var resolve18 = require_resolve();
94095
+ var resolve18 = require_resolve2();
92944
94096
  var util4 = require_util9();
92945
94097
  var errorClasses = require_error_classes();
92946
94098
  var stableStringify = require_fast_json_stable_stringify();
@@ -96134,7 +97286,7 @@ var require_data = __commonJS({
96134
97286
  });
96135
97287
 
96136
97288
  // ../../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/async.js
96137
- var require_async = __commonJS({
97289
+ var require_async2 = __commonJS({
96138
97290
  "../../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/async.js"(exports2, module3) {
96139
97291
  "use strict";
96140
97292
  init_import_meta_url();
@@ -96789,7 +97941,7 @@ var require_ajv = __commonJS({
96789
97941
  "use strict";
96790
97942
  init_import_meta_url();
96791
97943
  var compileSchema = require_compile();
96792
- var resolve18 = require_resolve();
97944
+ var resolve18 = require_resolve2();
96793
97945
  var Cache2 = require_cache();
96794
97946
  var SchemaObject = require_schema_obj();
96795
97947
  var stableStringify = require_fast_json_stable_stringify();
@@ -96809,7 +97961,7 @@ var require_ajv = __commonJS({
96809
97961
  Ajv.prototype.errorsText = errorsText;
96810
97962
  Ajv.prototype._addSchema = _addSchema;
96811
97963
  Ajv.prototype._compile = _compile;
96812
- Ajv.prototype.compileAsync = require_async();
97964
+ Ajv.prototype.compileAsync = require_async2();
96813
97965
  var customKeyword = require_keyword();
96814
97966
  Ajv.prototype.addKeyword = customKeyword.add;
96815
97967
  Ajv.prototype.getKeyword = customKeyword.get;
@@ -104491,15 +105643,15 @@ async function generateASSETSBinding(options25) {
104491
105643
  try {
104492
105644
  const url4 = new URL(miniflareRequest.url);
104493
105645
  url4.host = `localhost:${options25.proxyPort}`;
104494
- const proxyRequest = new import_miniflare5.Request(url4, miniflareRequest);
105646
+ const proxyRequest = new import_miniflare6.Request(url4, miniflareRequest);
104495
105647
  if (proxyRequest.headers.get("Upgrade") === "websocket") {
104496
105648
  proxyRequest.headers.delete("Sec-WebSocket-Accept");
104497
105649
  proxyRequest.headers.delete("Sec-WebSocket-Key");
104498
105650
  }
104499
- return await (0, import_miniflare5.fetch)(proxyRequest);
105651
+ return await (0, import_miniflare6.fetch)(proxyRequest);
104500
105652
  } catch (thrown) {
104501
105653
  options25.log.error(new Error(`Could not proxy request: ${thrown}`));
104502
- return new import_miniflare5.Response(`[wrangler] Could not proxy request: ${thrown}`, {
105654
+ return new import_miniflare6.Response(`[wrangler] Could not proxy request: ${thrown}`, {
104503
105655
  status: 502
104504
105656
  });
104505
105657
  }
@@ -104508,7 +105660,7 @@ async function generateASSETSBinding(options25) {
104508
105660
  return await assetsFetch(miniflareRequest);
104509
105661
  } catch (thrown) {
104510
105662
  options25.log.error(new Error(`Could not serve static asset: ${thrown}`));
104511
- return new import_miniflare5.Response(
105663
+ return new import_miniflare6.Response(
104512
105664
  `[wrangler] Could not serve static asset: ${thrown}`,
104513
105665
  { status: 502 }
104514
105666
  );
@@ -104616,11 +105768,11 @@ async function generateAssetsFetch(directory, log) {
104616
105768
  });
104617
105769
  }, "generateResponse");
104618
105770
  return async (input, init2) => {
104619
- const request2 = new import_miniflare5.Request(input, init2);
105771
+ const request2 = new import_miniflare6.Request(input, init2);
104620
105772
  return await generateResponse(request2);
104621
105773
  };
104622
105774
  }
104623
- var import_node_fs13, import_node_path21, import_chokidar, import_mime, import_miniflare5, invalidAssetsFetch;
105775
+ var import_node_fs13, import_node_path21, import_chokidar, import_mime, import_miniflare6, invalidAssetsFetch;
104624
105776
  var init_assets = __esm({
104625
105777
  "src/miniflare-cli/assets.ts"() {
104626
105778
  init_import_meta_url();
@@ -104631,7 +105783,7 @@ var init_assets = __esm({
104631
105783
  init_parseRedirects();
104632
105784
  import_chokidar = require("chokidar");
104633
105785
  import_mime = __toESM(require_mime2());
104634
- import_miniflare5 = require("miniflare");
105786
+ import_miniflare6 = require("miniflare");
104635
105787
  init_hash();
104636
105788
  __name(generateASSETSBinding, "generateASSETSBinding");
104637
105789
  __name(generateAssetsFetch, "generateAssetsFetch");
@@ -116639,6 +117791,30 @@ function findUpSync(name, options25 = {}) {
116639
117791
  }
116640
117792
  __name(findUpSync, "findUpSync");
116641
117793
 
117794
+ // src/errors.ts
117795
+ init_import_meta_url();
117796
+ var UserError = class extends Error {
117797
+ constructor(...args) {
117798
+ super(...args);
117799
+ Object.setPrototypeOf(this, new.target.prototype);
117800
+ }
117801
+ };
117802
+ __name(UserError, "UserError");
117803
+ var DeprecationError = class extends UserError {
117804
+ constructor(message) {
117805
+ super(`Deprecation:
117806
+ ${message}`);
117807
+ }
117808
+ };
117809
+ __name(DeprecationError, "DeprecationError");
117810
+ var FatalError = class extends UserError {
117811
+ constructor(message, code) {
117812
+ super(message);
117813
+ this.code = code;
117814
+ }
117815
+ };
117816
+ __name(FatalError, "FatalError");
117817
+
116642
117818
  // src/logger.ts
116643
117819
  init_import_meta_url();
116644
117820
  var import_node_util = require("node:util");
@@ -117805,7 +118981,7 @@ function formatMessage({ text, notes, location, kind = "error" }, color = true)
117805
118981
  return lines.join("\n");
117806
118982
  }
117807
118983
  __name(formatMessage, "formatMessage");
117808
- var ParseError = class extends Error {
118984
+ var ParseError = class extends UserError {
117809
118985
  text;
117810
118986
  notes;
117811
118987
  location;
@@ -117820,6 +118996,17 @@ var ParseError = class extends Error {
117820
118996
  }
117821
118997
  };
117822
118998
  __name(ParseError, "ParseError");
118999
+ var APIError = class extends ParseError {
119000
+ // Allow `APIError`s to be marked as handled.
119001
+ #reportable = true;
119002
+ get reportable() {
119003
+ return this.#reportable;
119004
+ }
119005
+ preventReport() {
119006
+ this.#reportable = false;
119007
+ }
119008
+ };
119009
+ __name(APIError, "APIError");
117823
119010
  var TOML_ERROR_NAME = "TomlError";
117824
119011
  var TOML_ERROR_SUFFIX = " at row ";
117825
119012
  function parseTOML(input, file) {
@@ -118023,7 +119210,7 @@ var import_undici3 = __toESM(require_undici());
118023
119210
  var import_undici4 = __toESM(require_undici());
118024
119211
 
118025
119212
  // package.json
118026
- var version = "3.22.4";
119213
+ var version = "3.22.5";
118027
119214
  var package_default = {
118028
119215
  name: "wrangler",
118029
119216
  version,
@@ -118128,7 +119315,6 @@ var package_default = {
118128
119315
  },
118129
119316
  dependencies: {
118130
119317
  "@cloudflare/kv-asset-handler": "^0.2.0",
118131
- "@cspotcode/source-map-support": "0.8.1",
118132
119318
  "@esbuild-plugins/node-globals-polyfill": "^0.2.3",
118133
119319
  "@esbuild-plugins/node-modules-polyfill": "^0.2.2",
118134
119320
  "blake3-wasm": "^2.1.5",
@@ -118137,6 +119323,7 @@ var package_default = {
118137
119323
  miniflare: "workspace:*",
118138
119324
  nanoid: "^3.3.3",
118139
119325
  "path-to-regexp": "^6.2.0",
119326
+ resolve: "^1.22.8",
118140
119327
  "resolve.exports": "^2.0.2",
118141
119328
  selfsigned: "^2.0.1",
118142
119329
  "source-map": "0.6.1",
@@ -118150,6 +119337,7 @@ var package_default = {
118150
119337
  "@cloudflare/types": "^6.18.4",
118151
119338
  "@cloudflare/workers-tsconfig": "workspace:*",
118152
119339
  "@cloudflare/workers-types": "^4.20230914.0",
119340
+ "@cspotcode/source-map-support": "0.8.1",
118153
119341
  "@iarna/toml": "^3.0.0",
118154
119342
  "@microsoft/api-extractor": "^7.28.3",
118155
119343
  "@sentry/node": "^7.86.0",
@@ -118167,6 +119355,7 @@ var package_default = {
118167
119355
  "@types/minimatch": "^5.1.2",
118168
119356
  "@types/prompts": "^2.0.14",
118169
119357
  "@types/react": "^17.0.37",
119358
+ "@types/resolve": "^1.20.6",
118170
119359
  "@types/serve-static": "^1.13.10",
118171
119360
  "@types/shell-quote": "^1.7.2",
118172
119361
  "@types/signal-exit": "^3.0.1",
@@ -118365,7 +119554,7 @@ function isNonInteractiveOrCI() {
118365
119554
  return !isInteractive() || CI.isCI();
118366
119555
  }
118367
119556
  __name(isNonInteractiveOrCI, "isNonInteractiveOrCI");
118368
- var NoDefaultValueProvided = class extends Error {
119557
+ var NoDefaultValueProvided = class extends UserError {
118369
119558
  constructor() {
118370
119559
  super("This command cannot be run in a non-interactive context");
118371
119560
  Object.setPrototypeOf(this, new.target.prototype);
@@ -118516,7 +119705,7 @@ async function getAccessToken(domain2) {
118516
119705
  }
118517
119706
  const output = (0, import_child_process.spawnSync)("cloudflared", ["access", "login", domain2]);
118518
119707
  if (output.error) {
118519
- throw new Error(
119708
+ throw new UserError(
118520
119709
  "To use Wrangler with Cloudflare Access, please install `cloudflared` from https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation"
118521
119710
  );
118522
119711
  }
@@ -118589,7 +119778,7 @@ async function getAccountChoices() {
118589
119778
  const response = await fetchPagedListResult(`/memberships`);
118590
119779
  const accounts = response.map((r3) => r3.account);
118591
119780
  if (accounts.length === 0) {
118592
- throw new Error(
119781
+ throw new UserError(
118593
119782
  "Failed to automatically retrieve account IDs for the logged in user.\nIn a non-interactive environment, it is mandatory to specify an account ID, either by assigning its value to CLOUDFLARE_ACCOUNT_ID, or as `account_id` in your `wrangler.toml` file."
118594
119783
  );
118595
119784
  } else {
@@ -118597,7 +119786,7 @@ async function getAccountChoices() {
118597
119786
  }
118598
119787
  } catch (err) {
118599
119788
  if (err.code === 9109) {
118600
- throw new Error(
119789
+ throw new UserError(
118601
119790
  `Failed to automatically retrieve account IDs for the logged in user.
118602
119791
  You may have incorrect permissions on your API token. You can skip this account check by adding an \`account_id\` in your \`wrangler.toml\`, or by setting the value of CLOUDFLARE_ACCOUNT_ID"`
118603
119792
  );
@@ -118713,13 +119902,13 @@ function getAPIToken() {
118713
119902
  return void 0;
118714
119903
  }
118715
119904
  __name(getAPIToken, "getAPIToken");
118716
- var ErrorOAuth2 = class extends Error {
119905
+ var ErrorOAuth2 = class extends UserError {
118717
119906
  toString() {
118718
119907
  return "ErrorOAuth2";
118719
119908
  }
118720
119909
  };
118721
119910
  __name(ErrorOAuth2, "ErrorOAuth2");
118722
- var ErrorUnknown = class extends ErrorOAuth2 {
119911
+ var ErrorUnknown = class extends Error {
118723
119912
  toString() {
118724
119913
  return "ErrorUnknown";
118725
119914
  }
@@ -119249,7 +120438,7 @@ async function getAccountId() {
119249
120438
  return accountID;
119250
120439
  } catch (e3) {
119251
120440
  if (e3 instanceof NoDefaultValueProvided) {
119252
- throw new Error(
120441
+ throw new UserError(
119253
120442
  `More than one account available but unable to select one in non-interactive mode.
119254
120443
  Please set the appropriate \`account_id\` in your \`wrangler.toml\` file.
119255
120444
  Available accounts are (\`<name>\`: \`<account_id>\`):
@@ -119264,16 +120453,16 @@ async function requireAuth(config) {
119264
120453
  const loggedIn = await loginOrRefreshIfRequired();
119265
120454
  if (!loggedIn) {
119266
120455
  if (!isInteractive() || CI.isCI()) {
119267
- throw new Error(
120456
+ throw new UserError(
119268
120457
  "In a non-interactive environment, it's necessary to set a CLOUDFLARE_API_TOKEN environment variable for wrangler to work. Please go to https://developers.cloudflare.com/fundamentals/api/get-started/create-token/ for instructions on how to create an api token, and assign its value to CLOUDFLARE_API_TOKEN."
119269
120458
  );
119270
120459
  } else {
119271
- throw new Error("Did not login, quitting...");
120460
+ throw new UserError("Did not login, quitting...");
119272
120461
  }
119273
120462
  }
119274
120463
  const accountId = config.account_id || await getAccountId();
119275
120464
  if (!accountId) {
119276
- throw new Error("No account id found, quitting...");
120465
+ throw new UserError("No account id found, quitting...");
119277
120466
  }
119278
120467
  return accountId;
119279
120468
  }
@@ -119281,7 +120470,7 @@ __name(requireAuth, "requireAuth");
119281
120470
  function requireApiToken() {
119282
120471
  const credentials = getAPIToken();
119283
120472
  if (!credentials) {
119284
- throw new Error("No API token found.");
120473
+ throw new UserError("No API token found.");
119285
120474
  }
119286
120475
  return credentials;
119287
120476
  }
@@ -119373,7 +120562,7 @@ async function fetchInternal(resource, init2 = {}, queryParams, abortSignal) {
119373
120562
  try {
119374
120563
  return parseJSON(jsonText);
119375
120564
  } catch (err) {
119376
- throw new ParseError({
120565
+ throw new APIError({
119377
120566
  text: "Received a malformed response from the API",
119378
120567
  notes: [
119379
120568
  {
@@ -119402,7 +120591,7 @@ __name(cloneHeaders, "cloneHeaders");
119402
120591
  async function requireLoggedIn() {
119403
120592
  const loggedIn = await loginOrRefreshIfRequired();
119404
120593
  if (!loggedIn) {
119405
- throw new Error("Not logged in.");
120594
+ throw new UserError("Not logged in.");
119406
120595
  }
119407
120596
  }
119408
120597
  __name(requireLoggedIn, "requireLoggedIn");
@@ -119593,7 +120782,7 @@ __name(hasMorePages, "hasMorePages");
119593
120782
  function throwFetchError(resource, response) {
119594
120783
  for (const error2 of response.errors)
119595
120784
  maybeThrowFriendlyError(error2);
119596
- const error = new ParseError({
120785
+ const error = new APIError({
119597
120786
  text: `A request to the Cloudflare API (${resource}) failed.`,
119598
120787
  notes: [
119599
120788
  ...response.errors.map((err) => ({ text: renderError(err) })),
@@ -119655,7 +120844,7 @@ var getProjectByName = /* @__PURE__ */ __name(async (config, accountId, name) =>
119655
120844
  const allProjects = await listProjects(accountId);
119656
120845
  const matchingProj = allProjects.find((proj) => proj.name === name);
119657
120846
  if (!matchingProj) {
119658
- throw new Error(`Couldn't find Project with name '${name}'`);
120847
+ throw new UserError(`Couldn't find Project with name '${name}'`);
119659
120848
  }
119660
120849
  return matchingProj;
119661
120850
  }, "getProjectByName");
@@ -119663,7 +120852,7 @@ var getProjectModelByName = /* @__PURE__ */ __name(async (config, accountId, pro
119663
120852
  const allModels = await listModels(accountId, proj);
119664
120853
  const matchingModel = allModels.find((model) => model.name === modelName);
119665
120854
  if (!matchingModel) {
119666
- throw new Error(`Couldn't find Model with name '${modelName}'`);
120855
+ throw new UserError(`Couldn't find Model with name '${modelName}'`);
119667
120856
  }
119668
120857
  return matchingModel;
119669
120858
  }, "getProjectModelByName");
@@ -122317,7 +123506,7 @@ function readConfig(configPath, args) {
122317
123506
  logger.warn(diagnostics.renderWarnings());
122318
123507
  }
122319
123508
  if (diagnostics.hasErrors()) {
122320
- throw new Error(diagnostics.renderErrors());
123509
+ throw new UserError(diagnostics.renderErrors());
122321
123510
  }
122322
123511
  return config;
122323
123512
  }
@@ -122996,6 +124185,7 @@ var import_node_fs6 = require("node:fs");
122996
124185
  var import_promises2 = require("node:fs/promises");
122997
124186
  var import_node_path9 = __toESM(require("node:path"));
122998
124187
  var import_glob_to_regexp = __toESM(require_glob_to_regexp());
124188
+ var import_resolve = __toESM(require_resolve());
122999
124189
 
123000
124190
  // ../../node_modules/.pnpm/resolve.exports@2.0.2/node_modules/resolve.exports/dist/index.mjs
123001
124191
  init_import_meta_url();
@@ -123074,27 +124264,21 @@ var DEFAULT_MODULE_RULES = [
123074
124264
  function parseRules(userRules = []) {
123075
124265
  const rules = [...userRules, ...DEFAULT_MODULE_RULES];
123076
124266
  const completedRuleLocations = {};
124267
+ const redundantRules = {};
123077
124268
  let index = 0;
123078
124269
  const rulesToRemove = [];
123079
124270
  for (const rule of rules) {
123080
124271
  if (rule.type in completedRuleLocations) {
123081
124272
  if (rules[completedRuleLocations[rule.type]].fallthrough !== false) {
123082
- if (index < userRules.length) {
123083
- logger.warn(
123084
- `The module rule at position ${index} (${JSON.stringify(
123085
- rule
123086
- )}) has the same type as a previous rule (at position ${completedRuleLocations[rule.type]}, ${JSON.stringify(
123087
- rules[completedRuleLocations[rule.type]]
123088
- )}). This rule will be ignored. To use the previous rule, add \`fallthrough = true\` to allow this one to also be used, or \`fallthrough = false\` to silence this warning.`
123089
- );
124273
+ if (rule.type in redundantRules) {
124274
+ redundantRules[rule.type].push({
124275
+ index,
124276
+ default: index >= userRules.length
124277
+ });
123090
124278
  } else {
123091
- logger.warn(
123092
- `The default module rule ${JSON.stringify(
123093
- rule
123094
- )} has the same type as a previous rule (at position ${completedRuleLocations[rule.type]}, ${JSON.stringify(
123095
- rules[completedRuleLocations[rule.type]]
123096
- )}). This rule will be ignored. To use the previous rule, add \`fallthrough = true\` to allow the default one to also be used, or \`fallthrough = false\` to silence this warning.`
123097
- );
124279
+ redundantRules[rule.type] = [
124280
+ { index, default: index >= userRules.length }
124281
+ ];
123098
124282
  }
123099
124283
  }
123100
124284
  rulesToRemove.push(rule);
@@ -123104,6 +124288,23 @@ function parseRules(userRules = []) {
123104
124288
  }
123105
124289
  index++;
123106
124290
  }
124291
+ for (const completedRuleType in completedRuleLocations) {
124292
+ const r3 = redundantRules[completedRuleType];
124293
+ if (r3) {
124294
+ const completedRuleIndex = completedRuleLocations[completedRuleType];
124295
+ let warning = `The ${completedRuleIndex >= userRules.length ? "default " : ""}module rule ${JSON.stringify(
124296
+ rules[completedRuleIndex]
124297
+ )} does not have a fallback, the following rules will be ignored:`;
124298
+ for (const rule of r3) {
124299
+ warning += `
124300
+ ${JSON.stringify(rules[rule.index])}${rule.default ? " (DEFAULT)" : ""}`;
124301
+ }
124302
+ warning += `
124303
+
124304
+ Add \`fallthrough = true\` to rule to allow next rule to be used or \`fallthrough = false\` to silence this warning`;
124305
+ logger.warn(warning);
124306
+ }
124307
+ }
123107
124308
  rulesToRemove.forEach((rule) => rules.splice(rules.indexOf(rule), 1));
123108
124309
  return { rules, removedRules: rulesToRemove };
123109
124310
  }
@@ -123297,6 +124498,13 @@ function createModuleCollector(props) {
123297
124498
  } catch (e3) {
123298
124499
  }
123299
124500
  }
124501
+ try {
124502
+ const resolved = (0, import_resolve.sync)(args.path, {
124503
+ basedir: args.resolveDir
124504
+ });
124505
+ filePath = resolved;
124506
+ } catch (e3) {
124507
+ }
123300
124508
  const fileContent = await (0, import_promises2.readFile)(filePath);
123301
124509
  const fileHash = import_node_crypto3.default.createHash("sha1").update(fileContent).digest("hex");
123302
124510
  const fileName = props.preserveFileNames ? filePath : `./${fileHash}-${import_node_path9.default.basename(args.path)}`;
@@ -123343,7 +124551,7 @@ function createModuleCollector(props) {
123343
124551
  build5.onResolve(
123344
124552
  { filter: (0, import_glob_to_regexp.default)(glob) },
123345
124553
  async (args) => {
123346
- throw new Error(
124554
+ throw new UserError(
123347
124555
  `The file ${args.path} matched a module rule in your configuration (${JSON.stringify(
123348
124556
  rule
123349
124557
  )}), but was ignored because a previous rule with the same type was not marked as \`fallthrough = true\`.`
@@ -123440,7 +124648,7 @@ async function matchFiles(files, relativeTo, { rules, removedRules }) {
123440
124648
  for (const glob of rule.globs) {
123441
124649
  const regexp = (0, import_glob_to_regexp2.default)(glob);
123442
124650
  if (regexp.test(filePath)) {
123443
- throw new Error(
124651
+ throw new UserError(
123444
124652
  `The file ${filePath} matched a module rule in your configuration (${JSON.stringify(
123445
124653
  rule
123446
124654
  )}), but was ignored because a previous rule with the same type was not marked as \`fallthrough = true\`.`
@@ -123582,7 +124790,7 @@ async function bundleWorker(entry, destination, {
123582
124790
  }
123583
124791
  for (const middleware of middlewareToLoad) {
123584
124792
  if (!middleware.supports.includes(entry.format)) {
123585
- throw new Error(
124793
+ throw new UserError(
123586
124794
  `Your Worker is written using the "${entry.format}" format, which isn't supported by the "${middleware.name}" middleware. To use "${middleware.name}" middleware, convert your Worker to the "${middleware.supports[0]}" format`
123587
124795
  );
123588
124796
  }
@@ -123663,7 +124871,7 @@ async function bundleWorker(entry, destination, {
123663
124871
  await ctx.watch();
123664
124872
  result = await initialBuildResultPromise;
123665
124873
  if (result.errors.length > 0) {
123666
- throw new Error("Failed to build");
124874
+ throw new UserError("Failed to build");
123667
124875
  }
123668
124876
  stop = /* @__PURE__ */ __name(async function() {
123669
124877
  tmpDir.remove();
@@ -123684,7 +124892,7 @@ async function bundleWorker(entry, destination, {
123684
124892
  const notExportedDOs = doBindings.filter((x) => !x.script_name && !entryPoint.exports.includes(x.class_name)).map((x) => x.class_name);
123685
124893
  if (notExportedDOs.length) {
123686
124894
  const relativePath = path12.relative(process.cwd(), entryFile);
123687
- throw new Error(
124895
+ throw new UserError(
123688
124896
  `Your Worker depends on the following Durable Objects, which are not exported in your entrypoint file: ${notExportedDOs.join(
123689
124897
  ", "
123690
124898
  )}.
@@ -123751,11 +124959,11 @@ async function guessWorkerFormat(entryFile, entryWorkingDirectory, hint, tsconfi
123751
124959
  if (hint) {
123752
124960
  if (hint !== guessedWorkerFormat) {
123753
124961
  if (hint === "service-worker") {
123754
- throw new Error(
124962
+ throw new UserError(
123755
124963
  "You configured this worker to be a 'service-worker', but the file you are trying to build appears to have a `default` export like a module worker. Please pass `--format modules`, or simply remove the configuration."
123756
124964
  );
123757
124965
  } else {
123758
- throw new Error(
124966
+ throw new UserError(
123759
124967
  "You configured this worker to be 'modules', but the file you are trying to build doesn't export a handler. Please pass `--format service-worker`, or simply remove the configuration."
123760
124968
  );
123761
124969
  }
@@ -124816,7 +126024,7 @@ The \`main\` property in wrangler.toml should point to the file generated by the
124816
126024
  __name(runCustomBuild, "runCustomBuild");
124817
126025
  function assertEntryPointExists(expectedEntryAbsolute, expectedEntryRelative, errorMessage) {
124818
126026
  if (!fileExists(expectedEntryAbsolute)) {
124819
- throw new Error(
126027
+ throw new UserError(
124820
126028
  getMissingEntryPointMessage(
124821
126029
  errorMessage,
124822
126030
  expectedEntryAbsolute,
@@ -124887,7 +126095,7 @@ async function getEntry(args, config, command2) {
124887
126095
  } else if (args.assets || config.assets) {
124888
126096
  file = import_node_path15.default.resolve(getBasePath(), "templates/no-op-worker.js");
124889
126097
  } else {
124890
- throw new Error(
126098
+ throw new UserError(
124891
126099
  `Missing entry-point: The entry-point should be specified via the command line (e.g. \`wrangler ${command2} path/to/script\`) or the \`main\` config field.`
124892
126100
  );
124893
126101
  }
@@ -124915,7 +126123,7 @@ async function getEntry(args, config, command2) {
124915
126123
  const addScriptNameExamples = generateAddScriptNameExamples(localBindings);
124916
126124
  const migrateText = "Alternatively, migrate your worker to ES Module syntax to implement a Durable Object in this Worker:";
124917
126125
  const migrateUrl = "https://developers.cloudflare.com/workers/learning/migrating-to-module-workers/";
124918
- throw new Error(
126126
+ throw new UserError(
124919
126127
  `${errorMessage}
124920
126128
  ${addScriptName}
124921
126129
  ${addScriptNameExamples}
@@ -125493,6 +126701,7 @@ init_import_meta_url();
125493
126701
  var import_node_assert6 = __toESM(require("node:assert"));
125494
126702
  var import_node_fs9 = __toESM(require("node:fs"));
125495
126703
  var import_node_url9 = __toESM(require("node:url"));
126704
+ var import_miniflare2 = require("miniflare");
125496
126705
  function maybeGetFile(filePath) {
125497
126706
  try {
125498
126707
  return import_node_fs9.default.readFileSync(filePath, "utf8");
@@ -125535,10 +126744,7 @@ function getSourceMappingPrepareStackTrace(retrieveSourceMap) {
125535
126744
  if (sourceMappingPrepareStackTrace !== void 0) {
125536
126745
  return sourceMappingPrepareStackTrace;
125537
126746
  }
125538
- const originalSupport = require.cache["@cspotcode/source-map-support"];
125539
- delete require.cache["@cspotcode/source-map-support"];
125540
- const support = require("@cspotcode/source-map-support");
125541
- require.cache["@cspotcode/source-map-support"] = originalSupport;
126747
+ const support = (0, import_miniflare2.getFreshSourceMapSupport)();
125542
126748
  const originalPrepareStackTrace = Error.prepareStackTrace;
125543
126749
  support.install({
125544
126750
  environment: "node",
@@ -125596,16 +126802,26 @@ function getSourceMappedString(value, retrieveSourceMap) {
125596
126802
  );
125597
126803
  const sourceMappedCallSiteLines = sourceMappedStackTrace.split("\n").slice(1);
125598
126804
  for (let i = 0; i < callSiteLines.length; i++) {
126805
+ if (callSites[i].getFileName() === void 0)
126806
+ continue;
126807
+ const callSiteLine = callSiteLines[i][0];
126808
+ const callSiteAtIndex = callSiteLine.indexOf("at");
126809
+ (0, import_node_assert6.default)(callSiteAtIndex !== -1);
126810
+ const callSiteLineLeftPad = callSiteLine.substring(0, callSiteAtIndex);
125599
126811
  value = value.replace(
125600
- callSiteLines[i][0],
125601
- sourceMappedCallSiteLines[i].substring(4)
125602
- // Trim indent from stack
126812
+ callSiteLine,
126813
+ callSiteLineLeftPad + sourceMappedCallSiteLines[i].trimStart()
125603
126814
  );
125604
126815
  }
125605
126816
  return value;
125606
126817
  }
125607
126818
  __name(getSourceMappedString, "getSourceMappedString");
125608
- var CALL_SITE_REGEXP = /at (?:(.+?)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/g;
126819
+ var CALL_SITE_REGEXP = (
126820
+ // Validation errors from `wrangler deploy` have a 2 space indent, whereas
126821
+ // regular stack traces have a 4 space indent.
126822
+ // eslint-disable-next-line no-control-regex
126823
+ /^(?:\s+(?:\x1B\[\d+m)?'?)? {2,4}at (?:(.+?)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/gm
126824
+ );
125609
126825
  function lineMatchToCallSite(lineMatch) {
125610
126826
  let object = null;
125611
126827
  let method = null;
@@ -125911,11 +127127,11 @@ var import_node_assert7 = __toESM(require("node:assert"));
125911
127127
  var import_node_crypto4 = require("node:crypto");
125912
127128
  var import_node_fs11 = require("node:fs");
125913
127129
  var import_node_path19 = __toESM(require("node:path"));
125914
- var import_miniflare4 = require("miniflare");
127130
+ var import_miniflare5 = require("miniflare");
125915
127131
 
125916
127132
  // src/ai/fetcher.ts
125917
127133
  init_import_meta_url();
125918
- var import_miniflare2 = require("miniflare");
127134
+ var import_miniflare3 = require("miniflare");
125919
127135
  async function AIFetcher(request2) {
125920
127136
  const accountId = await getAccountId();
125921
127137
  request2.headers.delete("Host");
@@ -125926,7 +127142,7 @@ async function AIFetcher(request2) {
125926
127142
  body: request2.body,
125927
127143
  duplex: "half"
125928
127144
  });
125929
- return new import_miniflare2.Response(res.body, { status: res.status });
127145
+ return new import_miniflare3.Response(res.body, { status: res.status });
125930
127146
  }
125931
127147
  __name(AIFetcher, "AIFetcher");
125932
127148
 
@@ -125959,7 +127175,7 @@ __name(withSourceURLs, "withSourceURLs");
125959
127175
  init_import_meta_url();
125960
127176
  var fs11 = __toESM(require("node:fs"));
125961
127177
  var path22 = __toESM(require("node:path"));
125962
- var import_miniflare3 = require("miniflare");
127178
+ var import_miniflare4 = require("miniflare");
125963
127179
  var CERT_EXPIRY_DAYS = 30;
125964
127180
  var ONE_DAY_IN_MS = 864e5;
125965
127181
  function getHttpsOptions() {
@@ -126031,7 +127247,7 @@ function generateCertificate() {
126031
127247
  name: "subjectAltName",
126032
127248
  altNames: [
126033
127249
  { type: 2, value: "localhost" },
126034
- ...(0, import_miniflare3.getAccessibleHosts)(false).map((ip2) => ({ type: 7, ip: ip2 }))
127250
+ ...(0, import_miniflare4.getAccessibleHosts)(false).map((ip2) => ({ type: 7, ip: ip2 }))
126035
127251
  ]
126036
127252
  }
126037
127253
  ]
@@ -126133,7 +127349,7 @@ export default {
126133
127349
  }
126134
127350
  }
126135
127351
  `;
126136
- var WranglerLog = class extends import_miniflare4.Log {
127352
+ var WranglerLog = class extends import_miniflare5.Log {
126137
127353
  #warnedCompatibilityDateFallback = false;
126138
127354
  log(message) {
126139
127355
  if (message.includes(EXTERNAL_DURABLE_OBJECTS_WORKER_NAME))
@@ -126174,13 +127390,13 @@ function castLogLevel(level) {
126174
127390
  let key = level.toUpperCase();
126175
127391
  if (key === "LOG")
126176
127392
  key = "INFO";
126177
- return import_miniflare4.LogLevel[key];
127393
+ return import_miniflare5.LogLevel[key];
126178
127394
  }
126179
127395
  __name(castLogLevel, "castLogLevel");
126180
127396
  function buildLog() {
126181
127397
  let level = castLogLevel(logger.loggerLevel);
126182
- if (level <= import_miniflare4.LogLevel.DEBUG) {
126183
- level = Math.min(level, import_miniflare4.LogLevel.WARN);
127398
+ if (level <= import_miniflare5.LogLevel.DEBUG) {
127399
+ level = Math.min(level, import_miniflare5.LogLevel.WARN);
126184
127400
  }
126185
127401
  return new WranglerLog(level, { prefix: "wrangler-UserWorker" });
126186
127402
  }
@@ -126509,7 +127725,7 @@ var ErrorEvent = class extends Event {
126509
127725
  }
126510
127726
  };
126511
127727
  __name(ErrorEvent, "ErrorEvent");
126512
- var MiniflareServer = class extends import_miniflare4.TypedEventTarget {
127728
+ var MiniflareServer = class extends import_miniflare5.TypedEventTarget {
126513
127729
  #log = buildLog();
126514
127730
  #mf;
126515
127731
  // This is given as a shared secret to the Proxy and User workers
@@ -126519,7 +127735,7 @@ var MiniflareServer = class extends import_miniflare4.TypedEventTarget {
126519
127735
  // `buildMiniflareOptions()` is asynchronous, meaning if multiple bundle
126520
127736
  // updates were submitted, the second may apply before the first. Therefore,
126521
127737
  // wrap updates in a mutex, so they're always applied in invocation order.
126522
- #mutex = new import_miniflare4.Mutex();
127738
+ #mutex = new import_miniflare5.Mutex();
126523
127739
  async #onBundleUpdate(config, opts) {
126524
127740
  if (opts?.signal?.aborted)
126525
127741
  return;
@@ -126532,7 +127748,7 @@ var MiniflareServer = class extends import_miniflare4.TypedEventTarget {
126532
127748
  if (opts?.signal?.aborted)
126533
127749
  return;
126534
127750
  if (this.#mf === void 0) {
126535
- this.#mf = new import_miniflare4.Miniflare(options25);
127751
+ this.#mf = new import_miniflare5.Miniflare(options25);
126536
127752
  } else {
126537
127753
  await this.#mf.setOptions(options25);
126538
127754
  }
@@ -126818,7 +128034,7 @@ function handleUnsafeCapnp(capnp) {
126818
128034
  (x) => (0, import_node_path22.resolve)(base_path, x)
126819
128035
  );
126820
128036
  if (!(0, import_command_exists.sync)("capnp")) {
126821
- throw new Error(
128037
+ throw new UserError(
126822
128038
  "The capnp compiler is required to upload capnp schemas, but is not present."
126823
128039
  );
126824
128040
  }
@@ -127223,7 +128439,7 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
127223
128439
  const args = ["clone", "--depth", "1"];
127224
128440
  const gitVersion = await getGitVersioon();
127225
128441
  if (!gitVersion) {
127226
- throw new Error("Failed to find git installation");
128442
+ throw new UserError("Failed to find git installation");
127227
128443
  }
127228
128444
  const useSparseCheckout = subdirectory && semiver_default(gitVersion, "2.26.0") > -1;
127229
128445
  if (useSparseCheckout) {
@@ -127252,7 +128468,7 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
127252
128468
  } catch (err) {
127253
128469
  if (err.code !== "EXDEV") {
127254
128470
  logger.debug(err);
127255
- throw new Error(`Failed to find "${subdirectory}" in ${remote}`);
128471
+ throw new UserError(`Failed to find "${subdirectory}" in ${remote}`);
127256
128472
  }
127257
128473
  try {
127258
128474
  import_node_fs16.default.cpSync(templatePath, targetDirectory, { recursive: true });
@@ -127262,7 +128478,7 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
127262
128478
  });
127263
128479
  } catch (moveErr) {
127264
128480
  logger.debug(moveErr);
127265
- throw new Error(`Failed to find "${subdirectory}" in ${remote}`);
128481
+ throw new UserError(`Failed to find "${subdirectory}" in ${remote}`);
127266
128482
  }
127267
128483
  }
127268
128484
  import_node_fs16.default.rmSync(import_node_path24.default.join(targetDirectory, ".git"), {
@@ -127345,7 +128561,7 @@ async function getPackageManager(cwd2) {
127345
128561
  logger.log("Using pnpm as package manager.");
127346
128562
  return { ...PnpmPackageManager, cwd: cwd2 };
127347
128563
  } else {
127348
- throw new Error(
128564
+ throw new UserError(
127349
128565
  "Unable to find a package manager. Supported managers are: npm, yarn, and pnpm."
127350
128566
  );
127351
128567
  }
@@ -130936,7 +132152,7 @@ var handler3 = withConfig(
130936
132152
  });
130937
132153
  } catch (e3) {
130938
132154
  if (e3.code === 7409) {
130939
- throw new Error("A project with that name already exists");
132155
+ throw new UserError("A project with that name already exists");
130940
132156
  }
130941
132157
  throw e3;
130942
132158
  }
@@ -131186,7 +132402,7 @@ var handler10 = withConfig(
131186
132402
  );
131187
132403
  } catch (e3) {
131188
132404
  if (e3.code === 7408) {
131189
- throw new Error("A model with that name already exists");
132405
+ throw new UserError("A model with that name already exists");
131190
132406
  }
131191
132407
  throw e3;
131192
132408
  }
@@ -134285,7 +135501,7 @@ var getDatabaseByNameOrBinding = /* @__PURE__ */ __name(async (config, accountId
134285
135501
  const allDBs = await listDatabases(accountId);
134286
135502
  const matchingDB = allDBs.find((db) => db.name === name);
134287
135503
  if (!matchingDB) {
134288
- throw new Error(`Couldn't find DB with name '${name}'`);
135504
+ throw new UserError(`Couldn't find DB with name '${name}'`);
134289
135505
  }
134290
135506
  return matchingDB;
134291
135507
  }, "getDatabaseByNameOrBinding");
@@ -134496,7 +135712,7 @@ var Handler2 = withConfig(
134496
135712
  const accountId = await requireAuth(config);
134497
135713
  if (location) {
134498
135714
  if (LOCATION_CHOICES.indexOf(location.toLowerCase()) === -1) {
134499
- throw new Error(
135715
+ throw new UserError(
134500
135716
  `Location '${location}' invalid. Valid values are ${LOCATION_CHOICES.join(
134501
135717
  ","
134502
135718
  )}`
@@ -134518,7 +135734,7 @@ var Handler2 = withConfig(
134518
135734
  });
134519
135735
  } catch (e3) {
134520
135736
  if (e3.code === 7502) {
134521
- throw new Error("A database with that name already exists");
135737
+ throw new UserError("A database with that name already exists");
134522
135738
  }
134523
135739
  throw e3;
134524
135740
  }
@@ -134572,7 +135788,7 @@ var import_node_path27 = __toESM(require("node:path"));
134572
135788
  var import_chalk7 = __toESM(require_chalk());
134573
135789
  var import_ink3 = __toESM(require_build2());
134574
135790
  var import_ink_table3 = __toESM(require_dist3());
134575
- var import_miniflare8 = require("miniflare");
135791
+ var import_miniflare9 = require("miniflare");
134576
135792
  var import_react5 = __toESM(require_react());
134577
135793
 
134578
135794
  // src/dev/get-local-persistence-path.ts
@@ -134603,7 +135819,7 @@ function trimSqlQuery(sql) {
134603
135819
  return sql;
134604
135820
  const trimmedSql = sql.replace("BEGIN TRANSACTION;", "").replace("COMMIT;", "");
134605
135821
  if (mayContainTransaction(trimmedSql)) {
134606
- throw new Error(
135822
+ throw new UserError(
134607
135823
  "Wrangler could not process the provided SQL file, as it contains several transactions.\nD1 runs your SQL in a transaction for you.\nPlease export an SQL file from your SQLite database and try again."
134608
135824
  );
134609
135825
  }
@@ -134838,16 +136054,16 @@ async function executeSql({
134838
136054
  }
134839
136055
  const sql = file ? readFileSync5(file) : command2;
134840
136056
  if (!sql)
134841
- throw new Error(`Error: must provide --command or --file.`);
136057
+ throw new UserError(`Error: must provide --command or --file.`);
134842
136058
  if (preview && local)
134843
- throw new Error(`Error: can't use --preview with --local`);
136059
+ throw new UserError(`Error: can't use --preview with --local`);
134844
136060
  if (persistTo && !local)
134845
- throw new Error(`Error: can't use --persist-to without --local`);
136061
+ throw new UserError(`Error: can't use --persist-to without --local`);
134846
136062
  logger.log(`\u{1F300} Mapping SQL input into an array of statements`);
134847
136063
  const queries = splitSqlQuery(sql);
134848
136064
  if (file && sql) {
134849
136065
  if (queries[0].startsWith("SQLite format 3")) {
134850
- throw new Error(
136066
+ throw new UserError(
134851
136067
  "Provided file is a binary SQLite database file instead of an SQL text file.\nThe execute command can only process SQL text files.\nPlease export an SQL file from your SQLite database and try again."
134852
136068
  );
134853
136069
  }
@@ -134878,7 +136094,7 @@ async function executeLocally({
134878
136094
  }) {
134879
136095
  const localDB = getDatabaseInfoFromConfig(config, name);
134880
136096
  if (!localDB) {
134881
- throw new Error(
136097
+ throw new UserError(
134882
136098
  `Can't find a DB with name/binding '${name}' in local config. Check info in wrangler.toml...`
134883
136099
  );
134884
136100
  }
@@ -134890,7 +136106,7 @@ async function executeLocally({
134890
136106
  d1Persist
134891
136107
  )}:`
134892
136108
  );
134893
- const mf = new import_miniflare8.Miniflare({
136109
+ const mf = new import_miniflare9.Miniflare({
134894
136110
  modules: true,
134895
136111
  script: "",
134896
136112
  d1Persist,
@@ -134954,9 +136170,11 @@ async function executeRemotely({
134954
136170
  name
134955
136171
  );
134956
136172
  if (preview && !db.previewDatabaseUuid) {
134957
- throw logger.error(
136173
+ const error = new UserError(
134958
136174
  "Please define a `preview_database_id` in your wrangler.toml to execute your queries against a preview database"
134959
136175
  );
136176
+ logger.error(error.message);
136177
+ throw error;
134960
136178
  }
134961
136179
  const dbUuid = preview ? db.previewDatabaseUuid : db.uuid;
134962
136180
  logger.log(`\u{1F300} Executing on remote database ${name} (${dbUuid}):`);
@@ -135159,7 +136377,7 @@ Ok to create ${dir}?`)) {
135159
136377
  } else {
135160
136378
  logger.warn(warning);
135161
136379
  }
135162
- throw new Error(`No migrations present at ${dir}.`);
136380
+ throw new UserError(`No migrations present at ${dir}.`);
135163
136381
  }
135164
136382
  __name(getMigrationsPath, "getMigrationsPath");
135165
136383
  async function getUnappliedMigrations({
@@ -135297,7 +136515,7 @@ var ApplyHandler = withConfig(
135297
136515
  }) => {
135298
136516
  const databaseInfo = getDatabaseInfoFromConfig(config, database);
135299
136517
  if (!databaseInfo && !local) {
135300
- throw new Error(
136518
+ throw new UserError(
135301
136519
  `Can't find a DB with name/binding '${database}' in local config. Check info in wrangler.toml...`
135302
136520
  );
135303
136521
  }
@@ -135424,7 +136642,7 @@ Your database may not be available to serve requests during the migration, conti
135424
136642
  )
135425
136643
  );
135426
136644
  if (errorNotes.length > 0) {
135427
- throw new Error(
136645
+ throw new UserError(
135428
136646
  errorNotes.map((err) => {
135429
136647
  return err;
135430
136648
  }).join("\n")
@@ -135452,7 +136670,7 @@ var CreateHandler2 = withConfig(
135452
136670
  async ({ config, database, message }) => {
135453
136671
  const databaseInfo = getDatabaseInfoFromConfig(config, database);
135454
136672
  if (!databaseInfo) {
135455
- throw new Error(
136673
+ throw new UserError(
135456
136674
  `Can't find a DB with name/binding '${database}' in local config. Check info in wrangler.toml...`
135457
136675
  );
135458
136676
  }
@@ -135504,7 +136722,7 @@ var ListHandler2 = withConfig(
135504
136722
  }
135505
136723
  const databaseInfo = getDatabaseInfoFromConfig(config, database);
135506
136724
  if (!databaseInfo && !local) {
135507
- throw new Error(
136725
+ throw new UserError(
135508
136726
  `Can't find a DB with name/binding '${database}' in local config. Check info in wrangler.toml...`
135509
136727
  );
135510
136728
  }
@@ -135576,7 +136794,7 @@ var getBookmarkIdFromTimestamp = /* @__PURE__ */ __name(async (accountId, databa
135576
136794
  var checkIfDatabaseIsExperimental = /* @__PURE__ */ __name(async (accountId, databaseId) => {
135577
136795
  const dbInfo = await getDatabaseInfoFromId(accountId, databaseId);
135578
136796
  if (dbInfo.version !== "beta") {
135579
- throw new Error(
136797
+ throw new UserError(
135580
136798
  "Time travel is only available for D1 databases created with the --experimental-backend flag"
135581
136799
  );
135582
136800
  }
@@ -135600,7 +136818,7 @@ __name(getLocalISOString, "getLocalISOString");
135600
136818
  var convertTimestampToISO = /* @__PURE__ */ __name((timestamp) => {
135601
136819
  const parsedTimestamp = isISODate(timestamp) ? new Date(timestamp) : new Date(Number(timestamp.length === 10 ? timestamp + "000" : timestamp));
135602
136820
  if (parsedTimestamp.toString() === "Invalid Date") {
135603
- throw new Error(
136821
+ throw new UserError(
135604
136822
  `Invalid timestamp '${timestamp}'. Please provide a valid Unix timestamp or ISO string, for example: ${getLocalISOString(
135605
136823
  /* @__PURE__ */ new Date()
135606
136824
  )}
@@ -135611,12 +136829,12 @@ For accepted format, see: https://developer.mozilla.org/en-US/docs/Web/JavaScrip
135611
136829
  const thirtyDaysAgo = /* @__PURE__ */ new Date();
135612
136830
  thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30);
135613
136831
  if (parsedTimestamp > now) {
135614
- throw new Error(
136832
+ throw new UserError(
135615
136833
  `Invalid timestamp '${timestamp}'. Please provide a timestamp in the past`
135616
136834
  );
135617
136835
  }
135618
136836
  if (parsedTimestamp < thirtyDaysAgo) {
135619
- throw new Error(
136837
+ throw new UserError(
135620
136838
  `Invalid timestamp '${timestamp}'. Please provide a timestamp within the last 30 days`
135621
136839
  );
135622
136840
  }
@@ -135677,11 +136895,11 @@ function RestoreOptions2(yargs) {
135677
136895
  if (argv.timestamp && !argv.bookmark || !argv.timestamp && argv.bookmark) {
135678
136896
  return true;
135679
136897
  } else if (argv.timestamp && argv.bookmark) {
135680
- throw new Error(
136898
+ throw new UserError(
135681
136899
  "Provide either a timestamp, or a bookmark - not both."
135682
136900
  );
135683
136901
  } else {
135684
- throw new Error("Provide either a timestamp or a bookmark");
136902
+ throw new UserError("Provide either a timestamp or a bookmark");
135685
136903
  }
135686
136904
  });
135687
136905
  }
@@ -135829,7 +137047,7 @@ var import_path10 = __toESM(require("path"));
135829
137047
  // src/kv/helpers.ts
135830
137048
  init_import_meta_url();
135831
137049
  var import_node_url11 = require("node:url");
135832
- var import_miniflare9 = require("miniflare");
137050
+ var import_miniflare10 = require("miniflare");
135833
137051
  var import_undici8 = __toESM(require_undici());
135834
137052
  var API_MAX = 1e4;
135835
137053
  var BATCH_KEY_MAX = API_MAX / 2;
@@ -136023,21 +137241,21 @@ function getKVNamespaceId({ preview, binding, "namespace-id": namespaceId }, con
136023
137241
  return namespaceId;
136024
137242
  }
136025
137243
  if (binding && !config) {
136026
- throw new Error("--binding specified, but no config file was found.");
137244
+ throw new UserError("--binding specified, but no config file was found.");
136027
137245
  }
136028
137246
  if (!config) {
136029
- throw new Error(
137247
+ throw new UserError(
136030
137248
  "Failed to find a config file.\nEither use --namespace-id to upload directly or create a configuration file with a binding."
136031
137249
  );
136032
137250
  }
136033
137251
  if (!config.kv_namespaces || config.kv_namespaces.length === 0) {
136034
- throw new Error(
137252
+ throw new UserError(
136035
137253
  "No KV Namespaces configured! Either use --namespace-id to upload directly or add a KV namespace to your wrangler config file."
136036
137254
  );
136037
137255
  }
136038
137256
  const namespace = config.kv_namespaces.find((ns) => ns.binding === binding);
136039
137257
  if (!namespace) {
136040
- throw new Error(
137258
+ throw new UserError(
136041
137259
  `A namespace with binding name "${binding}" was not found in the configured "kv_namespaces".`
136042
137260
  );
136043
137261
  }
@@ -136045,7 +137263,7 @@ function getKVNamespaceId({ preview, binding, "namespace-id": namespaceId }, con
136045
137263
  namespaceId = namespace.preview_id;
136046
137264
  return namespaceId;
136047
137265
  } else if (preview) {
136048
- throw new Error(
137266
+ throw new UserError(
136049
137267
  `No preview ID found for ${binding}. Add one to your wrangler config file to use a separate namespace for previewing your worker.`
136050
137268
  );
136051
137269
  }
@@ -136054,7 +137272,7 @@ function getKVNamespaceId({ preview, binding, "namespace-id": namespaceId }, con
136054
137272
  namespaceId = namespace.id;
136055
137273
  return namespaceId;
136056
137274
  } else if (previewIsDefined) {
136057
- throw new Error(
137275
+ throw new UserError(
136058
137276
  `No namespace ID found for ${binding}. Add one to your wrangler config file to use a separate namespace for previewing your worker.`
136059
137277
  );
136060
137278
  }
@@ -136062,12 +137280,12 @@ function getKVNamespaceId({ preview, binding, "namespace-id": namespaceId }, con
136062
137280
  if (bindingHasOnlyOneId) {
136063
137281
  namespaceId = namespace.id || namespace.preview_id;
136064
137282
  } else {
136065
- throw new Error(
137283
+ throw new UserError(
136066
137284
  `${binding} has both a namespace ID and a preview ID. Specify "--preview" or "--preview false" to avoid writing data to the wrong namespace.`
136067
137285
  );
136068
137286
  }
136069
137287
  if (!namespaceId) {
136070
- throw Error(
137288
+ throw new Error(
136071
137289
  "Something went wrong trying to determine which namespace to upload to.\nPlease create a github issue with the command you just ran along with your wrangler configuration."
136072
137290
  );
136073
137291
  }
@@ -136081,7 +137299,7 @@ __name(isValidKVNamespaceBinding, "isValidKVNamespaceBinding");
136081
137299
  async function usingLocalNamespace(persistTo, configPath, namespaceId, closure) {
136082
137300
  const persist = getLocalPersistencePath(persistTo, configPath);
136083
137301
  const persistOptions = buildPersistOptions(persist);
136084
- const mf = new import_miniflare9.Miniflare({
137302
+ const mf = new import_miniflare10.Miniflare({
136085
137303
  script: 'addEventListener("fetch", (e) => e.respondWith(new Response(null, { status: 404 })))',
136086
137304
  ...persistOptions,
136087
137305
  kvNamespaces: { NAMESPACE: namespaceId }
@@ -136361,10 +137579,11 @@ async function deleteHandler(args) {
136361
137579
  );
136362
137580
  const accountId = args.dryRun ? void 0 : await requireAuth(config);
136363
137581
  const scriptName = getScriptName(args, config);
136364
- (0, import_assert2.default)(
136365
- scriptName,
136366
- "A worker name must be defined, either via --name, or in wrangler.toml"
136367
- );
137582
+ if (!scriptName) {
137583
+ throw new UserError(
137584
+ "A worker name must be defined, either via --name, or in wrangler.toml"
137585
+ );
137586
+ }
136368
137587
  if (args.dryRun) {
136369
137588
  logger.log(`--dry-run: exiting now.`);
136370
137589
  return;
@@ -136802,7 +138021,7 @@ __name(createPatternMatcher, "createPatternMatcher");
136802
138021
  async function validateAssetSize(absFilePath, relativeFilePath) {
136803
138022
  const { size } = await (0, import_promises5.stat)(absFilePath);
136804
138023
  if (size > 25 * 1024 * 1024) {
136805
- throw new Error(
138024
+ throw new UserError(
136806
138025
  `File ${relativeFilePath} is too big, it should be under 25 MiB. See https://developers.cloudflare.com/workers/platform/limits#kv-limits`
136807
138026
  );
136808
138027
  }
@@ -136810,7 +138029,7 @@ async function validateAssetSize(absFilePath, relativeFilePath) {
136810
138029
  __name(validateAssetSize, "validateAssetSize");
136811
138030
  function validateAssetKey(assetKey) {
136812
138031
  if (assetKey.length > 512) {
136813
- throw new Error(
138032
+ throw new UserError(
136814
138033
  `The asset path key "${assetKey}" exceeds the maximum key size limit of 512. See https://developers.cloudflare.com/workers/platform/limits#kv-limits",`
136815
138034
  );
136816
138035
  }
@@ -137038,15 +138257,17 @@ async function deployHandler(args) {
137038
138257
  }
137039
138258
  );
137040
138259
  if (args.public) {
137041
- throw new Error("The --public field has been renamed to --assets");
138260
+ throw new UserError("The --public field has been renamed to --assets");
137042
138261
  }
137043
138262
  if (args.experimentalPublic) {
137044
- throw new Error(
138263
+ throw new UserError(
137045
138264
  "The --experimental-public field has been renamed to --assets"
137046
138265
  );
137047
138266
  }
137048
138267
  if ((args.assets || config.assets) && (args.site || config.site)) {
137049
- throw new Error("Cannot use Assets and Workers Sites in the same Worker.");
138268
+ throw new UserError(
138269
+ "Cannot use Assets and Workers Sites in the same Worker."
138270
+ );
137050
138271
  }
137051
138272
  if (args.assets) {
137052
138273
  logger.warn(
@@ -137102,25 +138323,6 @@ __name(deployHandler, "deployHandler");
137102
138323
 
137103
138324
  // src/deprecated/index.ts
137104
138325
  init_import_meta_url();
137105
-
137106
- // src/errors.ts
137107
- init_import_meta_url();
137108
- var DeprecationError = class extends Error {
137109
- constructor(message) {
137110
- super(`Deprecation:
137111
- ${message}`);
137112
- }
137113
- };
137114
- __name(DeprecationError, "DeprecationError");
137115
- var FatalError = class extends Error {
137116
- constructor(message, code) {
137117
- super(message);
137118
- this.code = code;
137119
- }
137120
- };
137121
- __name(FatalError, "FatalError");
137122
-
137123
- // src/deprecated/index.ts
137124
138326
  function buildOptions(yargs) {
137125
138327
  return yargs;
137126
138328
  }
@@ -137595,7 +138797,7 @@ function toUrlBase({ httpsUrl, gitUrl, shorthandUrl }) {
137595
138797
  case "bb":
137596
138798
  return "https://bitbucket.org";
137597
138799
  default:
137598
- throw new Error(
138800
+ throw new UserError(
137599
138801
  `Unable to parse shorthand ${shorthandUrl}. Supported options are "bitbucket" ("bb"), "github" ("gh"), and "gitlab" ("gl")`
137600
138802
  );
137601
138803
  }
@@ -137612,7 +138814,7 @@ function parseTemplatePath(templatePath) {
137612
138814
  }
137613
138815
  const groups = TEMPLATE_REGEX.exec(templatePath)?.groups;
137614
138816
  if (!groups) {
137615
- throw new Error(`Unable to parse ${templatePath} as a template`);
138817
+ throw new UserError(`Unable to parse ${templatePath} as a template`);
137616
138818
  }
137617
138819
  const { user, repository, subdirectoryPath, tag, ...urlGroups } = groups;
137618
138820
  const urlBase = toUrlBase(urlGroups);
@@ -138316,7 +139518,7 @@ var kvBulk = /* @__PURE__ */ __name((kvYargs) => {
138316
139518
  const namespaceId = getKVNamespaceId(args, config);
138317
139519
  const content = parseJSON(readFileSync5(filename), filename);
138318
139520
  if (!Array.isArray(content)) {
138319
- throw new Error(
139521
+ throw new UserError(
138320
139522
  `Unexpected JSON input from "${filename}".
138321
139523
  Expected an array of key-value objects but got type "${typeof content}".`
138322
139524
  );
@@ -138347,7 +139549,7 @@ Expected an array of key-value objects but got type "${typeof content}".`
138347
139549
  );
138348
139550
  }
138349
139551
  if (errors.length > 0) {
138350
- throw new Error(
139552
+ throw new UserError(
138351
139553
  `Unexpected JSON input from "${filename}".
138352
139554
  Each item in the array should be an object that matches:
138353
139555
 
@@ -138436,7 +139638,7 @@ interface KeyValue {
138436
139638
  }
138437
139639
  const content = parseJSON(readFileSync5(filename), filename);
138438
139640
  if (!Array.isArray(content)) {
138439
- throw new Error(
139641
+ throw new UserError(
138440
139642
  `Unexpected JSON input from "${filename}".
138441
139643
  Expected an array of strings but got:
138442
139644
  ${content}`
@@ -138454,7 +139656,7 @@ ${content}`
138454
139656
  }
138455
139657
  }
138456
139658
  if (errors.length > 0) {
138457
- throw new Error(
139659
+ throw new UserError(
138458
139660
  `Unexpected JSON input from "${filename}".
138459
139661
  Expected an array of strings.
138460
139662
  ` + errors.join("\n")
@@ -138490,10 +139692,10 @@ init_import_meta_url();
138490
139692
 
138491
139693
  // src/api/mtls-certificate.ts
138492
139694
  init_import_meta_url();
138493
- var ErrorMTlsCertificateNameNotFound = class extends Error {
139695
+ var ErrorMTlsCertificateNameNotFound = class extends UserError {
138494
139696
  };
138495
139697
  __name(ErrorMTlsCertificateNameNotFound, "ErrorMTlsCertificateNameNotFound");
138496
- var ErrorMTlsCertificateManyNamesMatch = class extends Error {
139698
+ var ErrorMTlsCertificateManyNamesMatch = class extends UserError {
138497
139699
  };
138498
139700
  __name(ErrorMTlsCertificateManyNamesMatch, "ErrorMTlsCertificateManyNamesMatch");
138499
139701
  async function uploadMTlsCertificateFromFs(accountId, details) {
@@ -138892,7 +140094,7 @@ __name(hasOverlappingRules, "hasOverlappingRules");
138892
140094
  // src/pages/errors.ts
138893
140095
  var EXIT_CODE_FUNCTIONS_NO_ROUTES_ERROR = 156;
138894
140096
  var EXIT_CODE_FUNCTIONS_NOTHING_TO_BUILD_ERROR = 157;
138895
- var FunctionsBuildError = class extends Error {
140097
+ var FunctionsBuildError = class extends UserError {
138896
140098
  constructor(message) {
138897
140099
  super(message);
138898
140100
  }
@@ -138902,7 +140104,7 @@ function getFunctionsBuildWarning(functionsDirectory, suffix) {
138902
140104
  return `Unexpected error building Functions directory: ${functionsDirectory}${suffix ? " - " + suffix : ""}`;
138903
140105
  }
138904
140106
  __name(getFunctionsBuildWarning, "getFunctionsBuildWarning");
138905
- var FunctionsNoRoutesError = class extends Error {
140107
+ var FunctionsNoRoutesError = class extends UserError {
138906
140108
  constructor(message) {
138907
140109
  super(message);
138908
140110
  }
@@ -139656,10 +140858,10 @@ function parseConfig(config, baseDir) {
139656
140858
  let { identifier } = importMap.get(modulePath) ?? {};
139657
140859
  const resolvedPath = import_node_path36.default.resolve(baseDir, filepath);
139658
140860
  if (import_node_path36.default.relative(baseDir, resolvedPath).startsWith("..")) {
139659
- throw new Error(`Invalid module path "${filepath}"`);
140861
+ throw new UserError(`Invalid module path "${filepath}"`);
139660
140862
  }
139661
140863
  if (name !== "default" && !isValidIdentifier(name)) {
139662
- throw new Error(`Invalid module identifier "${name}"`);
140864
+ throw new UserError(`Invalid module identifier "${name}"`);
139663
140865
  }
139664
140866
  if (!identifier) {
139665
140867
  identifier = normalizeIdentifier(`__${filepath}_${name}`);
@@ -140172,7 +141374,7 @@ var validateArgs = /* @__PURE__ */ __name((args) => {
140172
141374
  }
140173
141375
  const nodejsCompat = !!args.compatibilityFlags?.includes("nodejs_compat");
140174
141376
  if (legacyNodeCompat && nodejsCompat) {
140175
- throw new Error(
141377
+ throw new UserError(
140176
141378
  "The `nodejs_compat` compatibility flag cannot be used in conjunction with the legacy `--node-compat` flag. If you want to use the Workers runtime Node.js compatibility features, please remove the `--node-compat` argument from your CLI command."
140177
141379
  );
140178
141380
  }
@@ -141890,7 +143092,7 @@ function translateCLICommandToFilterMessage(cliFilters) {
141890
143092
  __name(translateCLICommandToFilterMessage, "translateCLICommandToFilterMessage");
141891
143093
  function parseSamplingRate(sampling_rate) {
141892
143094
  if (sampling_rate <= 0 || sampling_rate >= 1) {
141893
- throw new Error(
143095
+ throw new UserError(
141894
143096
  "A sampling rate must be between 0 and 1 in order to have any effect.\nFor example, a sampling rate of 0.25 means 25% of events will be logged."
141895
143097
  );
141896
143098
  }
@@ -142300,7 +143502,7 @@ async function Handler10({
142300
143502
  deploymentId = latestDeployment.id;
142301
143503
  }
142302
143504
  if (!deploymentId || !projectName) {
142303
- throw new FatalError("An unknown error occurred.", 1);
143505
+ throw new Error("An unknown error occurred.");
142304
143506
  }
142305
143507
  const filters = translateCLICommandToFilterMessage({
142306
143508
  header,
@@ -142669,7 +143871,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates/ for
142669
143871
  const scriptReadyPromise = new Promise(
142670
143872
  (promiseResolve) => scriptReadyResolve = promiseResolve
142671
143873
  );
142672
- const workerScriptPath = directory !== void 0 ? (0, import_node_path43.join)(directory, singleWorkerScriptPath) : singleWorkerScriptPath;
143874
+ const workerScriptPath = directory !== void 0 ? (0, import_node_path43.join)(directory, singleWorkerScriptPath) : (0, import_node_path43.resolve)(singleWorkerScriptPath);
142673
143875
  const usingWorkerDirectory = (0, import_node_fs28.existsSync)(workerScriptPath) && (0, import_node_fs28.lstatSync)(workerScriptPath).isDirectory();
142674
143876
  const usingWorkerScript = (0, import_node_fs28.existsSync)(workerScriptPath);
142675
143877
  const enableBundling = bundle ?? !noBundle;
@@ -142815,9 +144017,8 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates/ for
142815
144017
  }
142816
144018
  await scriptReadyPromise;
142817
144019
  if (scriptPath3 === "") {
142818
- throw new FatalError(
142819
- "Failed to start wrangler pages dev due to an unknown error",
142820
- 1
144020
+ throw new Error(
144021
+ "Failed to start wrangler pages dev due to an unknown error"
142821
144022
  );
142822
144023
  }
142823
144024
  let entrypoint = scriptPath3;
@@ -144176,7 +145377,7 @@ var MAX_UPLOAD_SIZE = 300 * 1024 * 1024;
144176
145377
 
144177
145378
  // src/r2/helpers.ts
144178
145379
  init_import_meta_url();
144179
- var import_miniflare11 = require("miniflare");
145380
+ var import_miniflare12 = require("miniflare");
144180
145381
  async function listR2Buckets(accountId, jurisdiction) {
144181
145382
  const headers = {};
144182
145383
  if (jurisdiction !== void 0) {
@@ -144212,7 +145413,7 @@ __name(deleteR2Bucket, "deleteR2Bucket");
144212
145413
  function bucketAndKeyFromObjectPath(objectPath = "") {
144213
145414
  const match = /^([^/]+)\/(.*)/.exec(objectPath);
144214
145415
  if (match === null) {
144215
- throw new Error(
145416
+ throw new UserError(
144216
145417
  `The object path must be in the form of {bucket}/{key} you provided ${objectPath}`
144217
145418
  );
144218
145419
  }
@@ -144278,7 +145479,7 @@ __name(deleteR2Object, "deleteR2Object");
144278
145479
  async function usingLocalBucket(persistTo, configPath, bucketName, closure) {
144279
145480
  const persist = getLocalPersistencePath(persistTo, configPath);
144280
145481
  const persistOptions = buildPersistOptions(persist);
144281
- const mf = new import_miniflare11.Miniflare({
145482
+ const mf = new import_miniflare12.Miniflare({
144282
145483
  modules: true,
144283
145484
  // TODO(soon): import `reduceError()` from `miniflare:shared`
144284
145485
  script: `
@@ -144412,7 +145613,6 @@ function r2(r2Yargs) {
144412
145613
  },
144413
145614
  async (objectGetYargs) => {
144414
145615
  const config = readConfig(objectGetYargs.config, objectGetYargs);
144415
- const accountId = await requireAuth(config);
144416
145616
  const { objectPath, pipe, jurisdiction } = objectGetYargs;
144417
145617
  const { bucket, key } = bucketAndKeyFromObjectPath(objectPath);
144418
145618
  let fullBucketName = bucket;
@@ -144442,12 +145642,13 @@ function r2(r2Yargs) {
144442
145642
  async (r2Bucket) => {
144443
145643
  const object = await r2Bucket.get(key);
144444
145644
  if (object === null) {
144445
- throw new Error("The specified key does not exist.");
145645
+ throw new UserError("The specified key does not exist.");
144446
145646
  }
144447
145647
  await stream.promises.pipeline(object.body, output);
144448
145648
  }
144449
145649
  );
144450
145650
  } else {
145651
+ const accountId = await requireAuth(config);
144451
145652
  const input = await getR2Object(
144452
145653
  accountId,
144453
145654
  bucket,
@@ -144523,7 +145724,6 @@ function r2(r2Yargs) {
144523
145724
  async (objectPutYargs) => {
144524
145725
  await printWranglerBanner();
144525
145726
  const config = readConfig(objectPutYargs.config, objectPutYargs);
144526
- const accountId = await requireAuth(config);
144527
145727
  const {
144528
145728
  objectPath,
144529
145729
  file,
@@ -144621,6 +145821,7 @@ ${key} is ${prettyBytes(objectSize, {
144621
145821
  }
144622
145822
  );
144623
145823
  } else {
145824
+ const accountId = await requireAuth(config);
144624
145825
  await putR2Object(
144625
145826
  accountId,
144626
145827
  bucket,
@@ -144659,7 +145860,6 @@ ${key} is ${prettyBytes(objectSize, {
144659
145860
  const { objectPath, jurisdiction } = args;
144660
145861
  await printWranglerBanner();
144661
145862
  const config = readConfig(args.config, args);
144662
- const accountId = await requireAuth(config);
144663
145863
  const { bucket, key } = bucketAndKeyFromObjectPath(objectPath);
144664
145864
  let fullBucketName = bucket;
144665
145865
  if (jurisdiction !== void 0) {
@@ -144676,6 +145876,7 @@ ${key} is ${prettyBytes(objectSize, {
144676
145876
  (r2Bucket) => r2Bucket.delete(key)
144677
145877
  );
144678
145878
  } else {
145879
+ const accountId = await requireAuth(config);
144679
145880
  await deleteR2Object(accountId, bucket, key, jurisdiction);
144680
145881
  }
144681
145882
  logger.log("Delete complete.");
@@ -144976,7 +146177,7 @@ var secret = /* @__PURE__ */ __name((secretYargs) => {
144976
146177
  const config = readConfig(args.config, args);
144977
146178
  const scriptName = getLegacyScriptName(args, config);
144978
146179
  if (!scriptName) {
144979
- throw new Error(
146180
+ throw new UserError(
144980
146181
  "Required Worker name missing. Please specify the Worker name in wrangler.toml, or pass it as an argument with `--name <worker-name>`"
144981
146182
  );
144982
146183
  }
@@ -145039,7 +146240,7 @@ var secret = /* @__PURE__ */ __name((secretYargs) => {
145039
146240
  const config = readConfig(args.config, args);
145040
146241
  const scriptName = getLegacyScriptName(args, config);
145041
146242
  if (!scriptName) {
145042
- throw new Error(
146243
+ throw new UserError(
145043
146244
  "Required Worker name missing. Please specify the Worker name in wrangler.toml, or pass it as an argument with `--name <worker-name>`"
145044
146245
  );
145045
146246
  }
@@ -145072,7 +146273,7 @@ var secret = /* @__PURE__ */ __name((secretYargs) => {
145072
146273
  const config = readConfig(args.config, args);
145073
146274
  const scriptName = getLegacyScriptName(args, config);
145074
146275
  if (!scriptName) {
145075
- throw new Error(
146276
+ throw new UserError(
145076
146277
  "Required Worker name missing. Please specify the Worker name in wrangler.toml, or pass it as an argument with `--name <worker-name>`"
145077
146278
  );
145078
146279
  }
@@ -145123,9 +146324,11 @@ var secretBulkHandler = /* @__PURE__ */ __name(async (secretBulkArgs) => {
145123
146324
  const config = readConfig(secretBulkArgs.config, secretBulkArgs);
145124
146325
  const scriptName = getLegacyScriptName(secretBulkArgs, config);
145125
146326
  if (!scriptName) {
145126
- throw logger.error(
146327
+ const error = new UserError(
145127
146328
  "Required Worker name missing. Please specify the Worker name in wrangler.toml, or pass it as an argument with `--name <worker-name>`"
145128
146329
  );
146330
+ logger.error(error.message);
146331
+ throw error;
145129
146332
  }
145130
146333
  const accountId = await requireAuth(config);
145131
146334
  logger.log(
@@ -154266,18 +155469,52 @@ var makeSentry10Transport = /* @__PURE__ */ __name((options25) => {
154266
155469
  }, "transportSentry10");
154267
155470
  return createTransport(options25, transportSentry10);
154268
155471
  }, "makeSentry10Transport");
155472
+ var disabledDefaultIntegrations = [
155473
+ "Console",
155474
+ // Console logs may contain PII
155475
+ "LocalVariables",
155476
+ // Local variables may contain tokens and PII
155477
+ "Http",
155478
+ // Only captures method/URL/response status, but URL may contain PII
155479
+ "Undici",
155480
+ // Same as "Http"
155481
+ "RequestData"
155482
+ // Request data to Wrangler's HTTP servers may contain PII
155483
+ ];
154269
155484
  function setupSentry() {
154270
- if (typeof SENTRY_DSN !== "undefined") {
155485
+ if (true) {
154271
155486
  init({
154272
155487
  release: `wrangler@${version}`,
154273
- dsn: SENTRY_DSN,
154274
- transport: makeSentry10Transport
155488
+ dsn: "https://9edbb8417b284aa2bbead9b4c318918b@sentry10.cfdata.org/583",
155489
+ transport: makeSentry10Transport,
155490
+ integrations(defaultIntegrations2) {
155491
+ return defaultIntegrations2.filter(
155492
+ ({ name }) => !disabledDefaultIntegrations.includes(name)
155493
+ );
155494
+ },
155495
+ beforeSend(event) {
155496
+ delete event.server_name;
155497
+ if (event.contexts !== void 0)
155498
+ delete event.contexts.culture;
155499
+ const fakeInstallPath = process.platform === "win32" ? "C:\\Project\\" : "/project/";
155500
+ for (const exception of event.exception?.values ?? []) {
155501
+ for (const frame of exception.stacktrace?.frames ?? []) {
155502
+ if (frame.filename === void 0)
155503
+ continue;
155504
+ const nodeModulesIndex = frame.filename.indexOf("node_modules");
155505
+ if (nodeModulesIndex === -1)
155506
+ continue;
155507
+ frame.filename = fakeInstallPath + frame.filename.substring(nodeModulesIndex);
155508
+ }
155509
+ }
155510
+ return event;
155511
+ }
154275
155512
  });
154276
155513
  }
154277
155514
  }
154278
155515
  __name(setupSentry, "setupSentry");
154279
155516
  function addBreadcrumb2(message, level = "log") {
154280
- if (typeof SENTRY_DSN !== "undefined") {
155517
+ if (true) {
154281
155518
  addBreadcrumb({
154282
155519
  message,
154283
155520
  level
@@ -154286,7 +155523,7 @@ function addBreadcrumb2(message, level = "log") {
154286
155523
  }
154287
155524
  __name(addBreadcrumb2, "addBreadcrumb");
154288
155525
  async function captureGlobalException(e3) {
154289
- if (typeof SENTRY_DSN !== "undefined") {
155526
+ if (true) {
154290
155527
  sentryReportingAllowed = await confirm(
154291
155528
  "Would you like to report this error to Cloudflare?",
154292
155529
  { fallbackValue: false }
@@ -154301,7 +155538,7 @@ async function captureGlobalException(e3) {
154301
155538
  }
154302
155539
  __name(captureGlobalException, "captureGlobalException");
154303
155540
  async function closeSentry() {
154304
- if (typeof SENTRY_DSN !== "undefined") {
155541
+ if (true) {
154305
155542
  await close();
154306
155543
  }
154307
155544
  }
@@ -154368,7 +155605,7 @@ async function getZoneIdFromHost(host) {
154368
155605
  }
154369
155606
  hostPieces.shift();
154370
155607
  }
154371
- throw new Error(`Could not find zone for ${host}`);
155608
+ throw new UserError(`Could not find zone for ${host}`);
154372
155609
  }
154373
155610
  __name(getZoneIdFromHost, "getZoneIdFromHost");
154374
155611
  async function getRoutesForZone(zone) {
@@ -154411,7 +155648,7 @@ __name(findClosestRoute, "findClosestRoute");
154411
155648
  async function getWorkerForZone(worker) {
154412
155649
  const zone = await getZoneForRoute(worker);
154413
155650
  if (!zone) {
154414
- throw new Error(
155651
+ throw new UserError(
154415
155652
  `The route '${worker}' is not part of one of your zones. Either add this zone from the Cloudflare dashboard, or try using a route within one of your existing zones.`
154416
155653
  );
154417
155654
  }
@@ -154420,11 +155657,11 @@ async function getWorkerForZone(worker) {
154420
155657
  if (!scriptName) {
154421
155658
  const closestRoute = findClosestRoute(worker, routes)?.[0];
154422
155659
  if (!closestRoute) {
154423
- throw new Error(
155660
+ throw new UserError(
154424
155661
  `The route '${worker}' has no workers assigned. You can assign a worker to it from wrangler.toml or the Cloudflare dashboard`
154425
155662
  );
154426
155663
  } else {
154427
- throw new Error(
155664
+ throw new UserError(
154428
155665
  `The route '${worker}' has no workers assigned. Did you mean to tail the route '${closestRoute.pattern}'?`
154429
155666
  );
154430
155667
  }
@@ -154497,7 +155734,7 @@ async function tailHandler(args) {
154497
155734
  scriptName = getLegacyScriptName({ name: args.worker, ...args }, config);
154498
155735
  }
154499
155736
  if (!scriptName) {
154500
- throw new Error(
155737
+ throw new UserError(
154501
155738
  "Required Worker name missing. Please specify the Worker name in wrangler.toml, or pass it as an argument with `wrangler tail <worker-name>`"
154502
155739
  );
154503
155740
  }
@@ -154695,7 +155932,7 @@ function writeDTSFile({
154695
155932
  const wranglerOverrideDTSPath = findUpSync("worker-configuration.d.ts");
154696
155933
  try {
154697
155934
  if (wranglerOverrideDTSPath !== void 0 && !fs21.readFileSync(wranglerOverrideDTSPath, "utf8").includes("Generated by Wrangler")) {
154698
- throw new Error(
155935
+ throw new UserError(
154699
155936
  "A non-wrangler worker-configuration.d.ts already exists, please rename and try again."
154700
155937
  );
154701
155938
  }
@@ -155193,7 +156430,7 @@ if (proxy) {
155193
156430
  function getRules(config) {
155194
156431
  const rules = config.rules ?? config.build?.upload?.rules ?? [];
155195
156432
  if (config.rules && config.build?.upload?.rules) {
155196
- throw new Error(
156433
+ throw new UserError(
155197
156434
  `You cannot configure both [rules] and [build.upload.rules] in your wrangler.toml. Delete the \`build.upload\` section.`
155198
156435
  );
155199
156436
  }
@@ -155248,7 +156485,7 @@ function demandOneOfOption(...options25) {
155248
156485
  };
155249
156486
  }
155250
156487
  __name(demandOneOfOption, "demandOneOfOption");
155251
- var CommandLineArgsError = class extends Error {
156488
+ var CommandLineArgsError = class extends UserError {
155252
156489
  };
155253
156490
  __name(CommandLineArgsError, "CommandLineArgsError");
155254
156491
  function createCLIParser(argv) {
@@ -155660,18 +156897,30 @@ function createCLIParser(argv) {
155660
156897
  __name(createCLIParser, "createCLIParser");
155661
156898
  async function main(argv) {
155662
156899
  setupSentry();
155663
- addBreadcrumb2(`wrangler ${argv.join(" ")}`);
155664
156900
  const wrangler = createCLIParser(argv);
156901
+ let recordedCommand = false;
156902
+ const wranglerWithMiddleware = wrangler.middleware(
156903
+ (args) => {
156904
+ if (recordedCommand)
156905
+ return;
156906
+ recordedCommand = true;
156907
+ addBreadcrumb2(`wrangler ${args._.join(" ")}`);
156908
+ },
156909
+ /* applyBeforeValidation */
156910
+ true
156911
+ );
155665
156912
  let cliHandlerThrew = false;
155666
156913
  try {
155667
- await wrangler.parse();
156914
+ await wranglerWithMiddleware.parse();
155668
156915
  } catch (e3) {
155669
156916
  cliHandlerThrew = true;
156917
+ let mayReport = true;
155670
156918
  logger.log("");
155671
156919
  if (e3 instanceof CommandLineArgsError) {
155672
156920
  logger.error(e3.message);
155673
156921
  await createCLIParser([...argv, "--help"]).parse();
155674
156922
  } else if (isAuthenticationError(e3)) {
156923
+ mayReport = false;
155675
156924
  logger.log(formatMessage(e3));
155676
156925
  const envAuth = getAuthFromEnv();
155677
156926
  if (envAuth !== void 0 && "apiToken" in envAuth) {
@@ -155685,6 +156934,7 @@ async function main(argv) {
155685
156934
  });
155686
156935
  logger.log(formatMessage(e3));
155687
156936
  } else if (e3 instanceof Error && e3.message.includes("Raw mode is not supported on")) {
156937
+ mayReport = false;
155688
156938
  const currentPlatform = import_node_os8.default.platform();
155689
156939
  const thisTerminalIsUnsupported = "This terminal doesn't support raw mode.";
155690
156940
  const soWranglerWontWork = "Wrangler uses raw mode to read user input and write output to the terminal, and won't function correctly without it.";
@@ -155696,6 +156946,7 @@ ${soWranglerWontWork}
155696
156946
  ${tryRunningItIn}${oneOfThese}`
155697
156947
  );
155698
156948
  } else if (isBuildFailure(e3)) {
156949
+ mayReport = false;
155699
156950
  logBuildFailure(e3.errors, e3.warnings);
155700
156951
  logger.error(e3.message);
155701
156952
  } else {
@@ -155704,6 +156955,13 @@ ${tryRunningItIn}${oneOfThese}`
155704
156955
  `${fgGreenColor}%s${resetColor}`,
155705
156956
  "If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
155706
156957
  );
156958
+ }
156959
+ if (
156960
+ // Only report the error if we didn't just handle it
156961
+ mayReport && // ...and it's not a user error
156962
+ !(e3 instanceof UserError) && // ...and it's not an un-reportable API error
156963
+ !(e3 instanceof APIError && !e3.reportable)
156964
+ ) {
155707
156965
  await captureGlobalException(e3);
155708
156966
  }
155709
156967
  throw e3;
@@ -155834,7 +157092,7 @@ The \`init\` command will be removed in a future version.`
155834
157092
  );
155835
157093
  } catch (err) {
155836
157094
  if (err.code === 10090) {
155837
- throw new Error(
157095
+ throw new UserError(
155838
157096
  "wrangler couldn't find a Worker script with that name in your account.\nRun `wrangler whoami` to confirm you're logged into the correct account."
155839
157097
  );
155840
157098
  }
@@ -156711,13 +157969,13 @@ async function rollbackDeployment(accountId, scriptName, { send_metrics: sendMet
156711
157969
  params
156712
157970
  );
156713
157971
  if (deploys.length < 2) {
156714
- throw new Error(
157972
+ throw new UserError(
156715
157973
  "Cannot rollback to previous deployment since there are less than 2 deployments"
156716
157974
  );
156717
157975
  }
156718
157976
  deploymentId = deploys.at(-2)?.id;
156719
157977
  if (deploymentId === void 0) {
156720
- throw new Error("Cannot find previous deployment");
157978
+ throw new UserError("Cannot find previous deployment");
156721
157979
  }
156722
157980
  }
156723
157981
  const firstHash = deploymentId.substring(0, deploymentId.indexOf("-"));
@@ -156792,7 +158050,7 @@ async function viewDeployment(accountId, scriptName, { send_metrics: sendMetrics
156792
158050
  );
156793
158051
  deploymentId = latest.id;
156794
158052
  if (deploymentId === void 0) {
156795
- throw new Error("Cannot find previous deployment");
158053
+ throw new UserError("Cannot find previous deployment");
156796
158054
  }
156797
158055
  }
156798
158056
  const deploymentDetails = await fetchResult(
@@ -156837,7 +158095,7 @@ async function commonDeploymentCMDSetup(yargs, deploymentsWarning) {
156837
158095
  logger.log(`${deploymentsWarning}
156838
158096
  `);
156839
158097
  if (!scriptName) {
156840
- throw new Error(
158098
+ throw new UserError(
156841
158099
  "Required Worker name missing. Please specify the Worker name in wrangler.toml, or pass it as an argument with `--name`"
156842
158100
  );
156843
158101
  }
@@ -156954,7 +158212,7 @@ async function getWorkersDevSubdomain(accountId) {
156954
158212
  if (!wantsToRegister) {
156955
158213
  const solutionMessage = "You can either deploy your worker to one or more routes by specifying them in wrangler.toml, or register a workers.dev subdomain here:";
156956
158214
  const onboardingLink = `https://dash.cloudflare.com/${accountId}/workers/onboarding`;
156957
- throw new Error(`${solutionMessage}
158215
+ throw new UserError(`${solutionMessage}
156958
158216
  ${onboardingLink}`);
156959
158217
  }
156960
158218
  return await registerSubdomain(accountId);
@@ -157003,7 +158261,7 @@ async function registerSubdomain(accountId) {
157003
158261
  if (!ok) {
157004
158262
  const solutionMessage = "You can either deploy your worker to one or more routes by specifying them in wrangler.toml, or register a workers.dev subdomain here:";
157005
158263
  const onboardingLink = `https://dash.cloudflare.com/${accountId}/workers/onboarding`;
157006
- throw new Error(`${solutionMessage}
158264
+ throw new UserError(`${solutionMessage}
157007
158265
  ${onboardingLink}`);
157008
158266
  }
157009
158267
  try {
@@ -157197,7 +158455,7 @@ Edits that have been made via the script API will be overridden by your local co
157197
158455
  }
157198
158456
  if (!(props.compatibilityDate || config.compatibility_date)) {
157199
158457
  const compatibilityDateStr = `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1 + "").padStart(2, "0")}-${((/* @__PURE__ */ new Date()).getDate() + "").padStart(2, "0")}`;
157200
- throw new Error(`A compatibility_date is required when publishing. Add the following to your wrangler.toml file:.
158458
+ throw new UserError(`A compatibility_date is required when publishing. Add the following to your wrangler.toml file:.
157201
158459
  \`\`\`
157202
158460
  compatibility_date = "${compatibilityDateStr}"
157203
158461
  \`\`\`
@@ -157211,12 +158469,12 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
157211
158469
  for (const route2 of routes) {
157212
158470
  if (typeof route2 !== "string" && route2.custom_domain) {
157213
158471
  if (route2.pattern.includes("*")) {
157214
- throw new Error(
158472
+ throw new UserError(
157215
158473
  `Cannot use "${route2.pattern}" as a Custom Domain; wildcard operators (*) are not allowed`
157216
158474
  );
157217
158475
  }
157218
158476
  if (route2.pattern.includes("/")) {
157219
- throw new Error(
158477
+ throw new UserError(
157220
158478
  `Cannot use "${route2.pattern}" as a Custom Domain; paths are not allowed`
157221
158479
  );
157222
158480
  }
@@ -157279,22 +158537,22 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
157279
158537
  let deploymentId = null;
157280
158538
  const { format: format9 } = props.entry;
157281
158539
  if (!props.isWorkersSite && Boolean(props.assetPaths) && format9 === "service-worker") {
157282
- throw new Error(
158540
+ throw new UserError(
157283
158541
  "You cannot use the service-worker format with an `assets` directory yet. For information on how to migrate to the module-worker format, see: https://developers.cloudflare.com/workers/learning/migrating-to-module-workers/"
157284
158542
  );
157285
158543
  }
157286
158544
  if (config.wasm_modules && format9 === "modules") {
157287
- throw new Error(
158545
+ throw new UserError(
157288
158546
  "You cannot configure [wasm_modules] with an ES module worker. Instead, import the .wasm module directly in your code"
157289
158547
  );
157290
158548
  }
157291
158549
  if (config.text_blobs && format9 === "modules") {
157292
- throw new Error(
158550
+ throw new UserError(
157293
158551
  "You cannot configure [text_blobs] with an ES module worker. Instead, import the file directly in your code, and optionally configure `[rules]` in your wrangler.toml"
157294
158552
  );
157295
158553
  }
157296
158554
  if (config.data_blobs && format9 === "modules") {
157297
- throw new Error(
158555
+ throw new UserError(
157298
158556
  "You cannot configure [data_blobs] with an ES module worker. Instead, import the file directly in your code, and optionally configure `[rules]` in your wrangler.toml"
157299
158557
  );
157300
158558
  }
@@ -157497,7 +158755,8 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
157497
158755
  }
157498
158756
  } catch (err) {
157499
158757
  helpIfErrorIsSizeOrScriptStartup(err, dependencies);
157500
- if (err instanceof ParseError && "code" in err && err.code === 10021 && err.notes.length > 0) {
158758
+ if (err instanceof APIError && "code" in err && err.code === 10021 && err.notes.length > 0) {
158759
+ err.preventReport();
157501
158760
  const maybeNameToFilePath = /* @__PURE__ */ __name((moduleName) => {
157502
158761
  if (bundleType === "commonjs")
157503
158762
  return resolvedEntryPointPath;
@@ -157591,7 +158850,7 @@ ${assignedRoutes.map(
157591
158850
  `https://dash.cloudflare.com/${accountId}/workers/overview`
157592
158851
  )
157593
158852
  )} to unassign a worker from a route.`;
157594
- throw new Error(`${errorMessage}
158853
+ throw new UserError(`${errorMessage}
157595
158854
  ${resolution}
157596
158855
  ${dashLink}`);
157597
158856
  }
@@ -157691,7 +158950,7 @@ async function publishRoutes(routes, {
157691
158950
  __name(publishRoutes, "publishRoutes");
157692
158951
  async function publishRoutesFallback(routes, { scriptName, notProd }) {
157693
158952
  if (notProd) {
157694
- throw new Error(
158953
+ throw new UserError(
157695
158954
  "Service environments combined with an API token that doesn't have 'All Zones' permissions is not supported.\nEither turn off service environments by setting `legacy_env = true`, creating an API token with 'All Zones' permissions, or logging in via OAuth"
157696
158955
  );
157697
158956
  }
@@ -157737,7 +158996,7 @@ async function publishRoutesFallback(routes, { scriptName, notProd }) {
157737
158996
  alreadyDeployedRoutes.delete(routePattern);
157738
158997
  continue;
157739
158998
  } else {
157740
- throw new Error(
158999
+ throw new UserError(
157741
159000
  `The route with pattern "${routePattern}" is already associated with another worker called "${knownScript}".`
157742
159001
  );
157743
159002
  }
@@ -157784,7 +159043,7 @@ async function ensureQueuesExist(config) {
157784
159043
  } catch (err) {
157785
159044
  const queueErr = err;
157786
159045
  if (queueErr.code === 11e3) {
157787
- throw new Error(
159046
+ throw new UserError(
157788
159047
  `Queue "${queue}" does not exist. To create it, run: wrangler queues create ${queue}`
157789
159048
  );
157790
159049
  }
@@ -157806,7 +159065,7 @@ function updateQueueConsumers(config) {
157806
159065
  }
157807
159066
  };
157808
159067
  if (config.name === void 0) {
157809
- throw new Error("Script name is required to update queue consumers");
159068
+ throw new UserError("Script name is required to update queue consumers");
157810
159069
  }
157811
159070
  const scriptName = config.name;
157812
159071
  const envName = void 0;
@@ -157970,7 +159229,7 @@ var import_node_http22 = require("node:http2");
157970
159229
  var import_node_https = require("node:https");
157971
159230
  var import_node_https2 = __toESM(require("node:https"));
157972
159231
  var import_http_terminator2 = __toESM(require_src5());
157973
- var import_miniflare13 = require("miniflare");
159232
+ var import_miniflare14 = require("miniflare");
157974
159233
  var import_react16 = __toESM(require_react());
157975
159234
  var import_serve_static = __toESM(require_serve_static());
157976
159235
  function addCfPreviewTokenHeader(headers, previewTokenValue) {
@@ -158065,7 +159324,7 @@ async function startPreviewServer({
158065
159324
  logger.log(`\u2B23 Listening at ${localProtocol}://${ip2}:${usedPort}`);
158066
159325
  const accessibleHosts = [];
158067
159326
  if (ip2 === "::" || ip2 === "*" || ip2 === "0.0.0.0") {
158068
- accessibleHosts.push(...(0, import_miniflare13.getAccessibleHosts)(true));
159327
+ accessibleHosts.push(...(0, import_miniflare14.getAccessibleHosts)(true));
158069
159328
  if (ip2 !== "0.0.0.0") {
158070
159329
  accessibleHosts.push("localhost");
158071
159330
  accessibleHosts.push("[::1]");
@@ -158592,9 +159851,11 @@ async function startRemoteServer(props) {
158592
159851
  });
158593
159852
  accountId = accountChoices[0].id;
158594
159853
  } else {
158595
- throw logger.error(
159854
+ const error = new UserError(
158596
159855
  "In a non-interactive environment, it is mandatory to specify an account ID, either by assigning its value to CLOUDFLARE_ACCOUNT_ID, or as `account_id` in your `wrangler.toml` file."
158597
159856
  );
159857
+ logger.error(error.message);
159858
+ throw error;
158598
159859
  }
158599
159860
  }
158600
159861
  const previewToken = await getRemotePreviewToken({
@@ -158602,7 +159863,9 @@ async function startRemoteServer(props) {
158602
159863
  accountId
158603
159864
  });
158604
159865
  if (previewToken === void 0) {
158605
- throw logger.error("Failed to get a previewToken");
159866
+ const error = new Error("Failed to get a previewToken");
159867
+ logger.error(error.message);
159868
+ throw error;
158606
159869
  }
158607
159870
  const previewServer = await startPreviewServer({
158608
159871
  previewToken,
@@ -158638,7 +159901,9 @@ async function startRemoteServer(props) {
158638
159901
  }
158639
159902
  });
158640
159903
  if (!previewServer) {
158641
- throw logger.error("Failed to start remote server");
159904
+ const error = new Error("Failed to start remote server");
159905
+ logger.error(error);
159906
+ throw error;
158642
159907
  }
158643
159908
  return { stop: previewServer.stop };
158644
159909
  }
@@ -158646,7 +159911,9 @@ __name(startRemoteServer, "startRemoteServer");
158646
159911
  async function getRemotePreviewToken(props) {
158647
159912
  async function start() {
158648
159913
  if (props.accountId === void 0) {
158649
- throw logger.error("no accountId provided");
159914
+ const error = new Error("no accountId provided");
159915
+ logger.error(error.message);
159916
+ throw error;
158650
159917
  }
158651
159918
  const abortController = new AbortController();
158652
159919
  const { workerAccount, workerContext } = getWorkerAccountAndContext({
@@ -158664,7 +159931,9 @@ async function getRemotePreviewToken(props) {
158664
159931
  abortController.signal
158665
159932
  );
158666
159933
  if (session === void 0) {
158667
- throw logger.error("Failed to start a session");
159934
+ const error = new Error("Failed to start a session");
159935
+ logger.error(error.message);
159936
+ throw error;
158668
159937
  }
158669
159938
  if (!props.bundle || !props.format)
158670
159939
  return;
@@ -159005,27 +160274,27 @@ __name(useEsbuild, "useEsbuild");
159005
160274
  init_import_meta_url();
159006
160275
  function validateDevProps(props) {
159007
160276
  if (!props.isWorkersSite && props.assetPaths && props.entry.format === "service-worker") {
159008
- throw new Error(
160277
+ throw new UserError(
159009
160278
  "You cannot use the service-worker format with an `assets` directory yet. For information on how to migrate to the module-worker format, see: https://developers.cloudflare.com/workers/learning/migrating-to-module-workers/"
159010
160279
  );
159011
160280
  }
159012
160281
  if (props.bindings.wasm_modules && props.entry.format === "modules") {
159013
- throw new Error(
160282
+ throw new UserError(
159014
160283
  "You cannot configure [wasm_modules] with an ES module worker. Instead, import the .wasm module directly in your code"
159015
160284
  );
159016
160285
  }
159017
160286
  if (props.bindings.text_blobs && props.entry.format === "modules") {
159018
- throw new Error(
160287
+ throw new UserError(
159019
160288
  "You cannot configure [text_blobs] with an ES module worker. Instead, import the file directly in your code, and optionally configure `[rules]` in your wrangler.toml"
159020
160289
  );
159021
160290
  }
159022
160291
  if (props.bindings.data_blobs && props.entry.format === "modules") {
159023
- throw new Error(
160292
+ throw new UserError(
159024
160293
  "You cannot configure [data_blobs] with an ES module worker. Instead, import the file directly in your code, and optionally configure `[rules]` in your wrangler.toml"
159025
160294
  );
159026
160295
  }
159027
160296
  if (props.compatibilityFlags?.includes("nodejs_compat") && props.legacyNodeCompat) {
159028
- throw new Error(
160297
+ throw new UserError(
159029
160298
  "You cannot use the `nodejs_compat` compatibility flag in conjunction with the legacy `--node-compat` flag. If you want to use the new runtime Node.js compatibility features, please remove the `--node-compat` argument from your CLI command or your config file."
159030
160299
  );
159031
160300
  }
@@ -160025,7 +161294,7 @@ function devOptions(yargs) {
160025
161294
  type: "boolean"
160026
161295
  }).check((argv) => {
160027
161296
  if (argv["live-reload"] && argv.remote) {
160028
- throw new Error(
161297
+ throw new UserError(
160029
161298
  "--live-reload is only supported in local mode. Please just use one of either --remote or --live-reload."
160030
161299
  );
160031
161300
  }
@@ -160063,7 +161332,7 @@ This is currently not supported \u{1F62D}, but we think that we'll get it to wor
160063
161332
  if (args.remote) {
160064
161333
  const isLoggedIn = await loginOrRefreshIfRequired();
160065
161334
  if (!isLoggedIn) {
160066
- throw new Error(
161335
+ throw new UserError(
160067
161336
  "You must be logged in to use wrangler dev in remote mode. Try logging in, or run wrangler dev --local."
160068
161337
  );
160069
161338
  }
@@ -160312,7 +161581,9 @@ async function startApiDev(args) {
160312
161581
  __name(getDevServer, "getDevServer");
160313
161582
  const devServer = await getDevServer(config);
160314
161583
  if (!devServer) {
160315
- throw logger.error("Failed to start dev server.");
161584
+ const error = new Error("Failed to start dev server.");
161585
+ logger.error(error.message);
161586
+ throw error;
160316
161587
  }
160317
161588
  return {
160318
161589
  stop: async () => {
@@ -160359,7 +161630,7 @@ async function getZoneIdHostAndRoutes(args, config) {
160359
161630
  const firstRoute = routes[0];
160360
161631
  host = getHostFromRoute(firstRoute);
160361
161632
  if (host === void 0) {
160362
- throw new Error(
161633
+ throw new UserError(
160363
161634
  `Cannot infer host from first route: ${JSON.stringify(
160364
161635
  firstRoute
160365
161636
  )}.
@@ -160400,15 +161671,17 @@ async function validateDevServerSettings(args, config) {
160400
161671
  );
160401
161672
  }
160402
161673
  if (args.experimentalPublic) {
160403
- throw new Error(
161674
+ throw new UserError(
160404
161675
  "The --experimental-public field has been renamed to --assets"
160405
161676
  );
160406
161677
  }
160407
161678
  if (args.public) {
160408
- throw new Error("The --public field has been renamed to --assets");
161679
+ throw new UserError("The --public field has been renamed to --assets");
160409
161680
  }
160410
161681
  if ((args.assets ?? config.assets) && (args.site ?? config.site)) {
160411
- throw new Error("Cannot use Assets and Workers Sites in the same Worker.");
161682
+ throw new UserError(
161683
+ "Cannot use Assets and Workers Sites in the same Worker."
161684
+ );
160412
161685
  }
160413
161686
  if (args.assets) {
160414
161687
  logger.warn(
@@ -160430,7 +161703,7 @@ async function validateDevServerSettings(args, config) {
160430
161703
  const compatibilityFlags = args.compatibilityFlags ?? config.compatibility_flags;
160431
161704
  const nodejsCompat = compatibilityFlags?.includes("nodejs_compat");
160432
161705
  if (legacyNodeCompat && nodejsCompat) {
160433
- throw new Error(
161706
+ throw new UserError(
160434
161707
  "The `nodejs_compat` compatibility flag cannot be used in conjunction with the legacy `--node-compat` flag. If you want to use the Workers runtime Node.js compatibility features, please remove the `--node-compat` argument from your CLI command or `node_compat = true` from your config file."
160435
161708
  );
160436
161709
  }
@@ -160495,7 +161768,7 @@ function getBindings(configParam, env5, local, args) {
160495
161768
  ...(configParam.kv_namespaces || []).map(
160496
161769
  ({ binding, preview_id, id }) => {
160497
161770
  if (!preview_id && !local) {
160498
- throw new Error(
161771
+ throw new UserError(
160499
161772
  `In development, you should use a separate kv namespace than the one you'd use in production. Please create a new kv namespace with "wrangler kv:namespace create <name> --preview" and add its id as preview_id to the kv_namespace "${binding}" in your wrangler.toml`
160500
161773
  );
160501
161774
  }
@@ -160533,7 +161806,7 @@ function getBindings(configParam, env5, local, args) {
160533
161806
  ...configParam.r2_buckets?.map(
160534
161807
  ({ binding, preview_bucket_name, bucket_name, jurisdiction }) => {
160535
161808
  if (!preview_bucket_name && !local) {
160536
- throw new Error(
161809
+ throw new UserError(
160537
161810
  `In development, you should use a separate r2 bucket than the one you'd use in production. Please create a new r2 bucket with "wrangler r2 bucket create <name>" and add its name as preview_bucket_name to the r2_buckets "${binding}" in your wrangler.toml`
160538
161811
  );
160539
161812
  }
@@ -160579,7 +161852,7 @@ function getBindings(configParam, env5, local, args) {
160579
161852
  constellation: configParam.constellation,
160580
161853
  hyperdrive: configParam.hyperdrive.map((hyperdrive2) => {
160581
161854
  if (!hyperdrive2.localConnectionString) {
160582
- throw new Error(
161855
+ throw new UserError(
160583
161856
  `In development, you should use a local postgres connection string to emulate hyperdrive functionality. Please setup postgres locally and set the value of "${hyperdrive2.binding}"'s "localConnectionString" to the postgres connection string in your wrangler.toml`
160584
161857
  );
160585
161858
  }
@@ -160645,7 +161918,7 @@ unstable_dev()'s behaviour will likely change in future releases`
160645
161918
  _: [],
160646
161919
  $0: "",
160647
161920
  remote: !local,
160648
- local,
161921
+ local: void 0,
160649
161922
  experimentalLocal: void 0,
160650
161923
  d1Databases,
160651
161924
  disableDevRegistry,
@@ -160905,7 +162178,7 @@ var import_node_assert18 = __toESM(require("node:assert"));
160905
162178
  var import_node_crypto6 = require("node:crypto");
160906
162179
  var import_node_events3 = require("node:events");
160907
162180
  var import_node_path53 = __toESM(require("node:path"));
160908
- var import_miniflare15 = require("miniflare");
162181
+ var import_miniflare16 = require("miniflare");
160909
162182
 
160910
162183
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/wrangler/templates/startDevWorker/InspectorProxyWorker.ts
160911
162184
  init_import_meta_url();
@@ -160995,7 +162268,7 @@ var ProxyController = class extends import_node_events3.EventEmitter {
160995
162268
  PROXY_CONTROLLER: async (req) => {
160996
162269
  const message = await req.json();
160997
162270
  this.onProxyWorkerMessage(message);
160998
- return new import_miniflare15.Response(null, { status: 204 });
162271
+ return new import_miniflare16.Response(null, { status: 204 });
160999
162272
  }
161000
162273
  },
161001
162274
  bindings: {
@@ -161048,7 +162321,7 @@ var ProxyController = class extends import_node_events3.EventEmitter {
161048
162321
  proxyWorkerOptions
161049
162322
  );
161050
162323
  const willInstantiateMiniflareInstance = !this.proxyWorker || proxyWorkerOptionsChanged;
161051
- this.proxyWorker ??= new import_miniflare15.Miniflare(proxyWorkerOptions);
162324
+ this.proxyWorker ??= new import_miniflare16.Miniflare(proxyWorkerOptions);
161052
162325
  this.proxyWorkerOptions = proxyWorkerOptions;
161053
162326
  if (proxyWorkerOptionsChanged) {
161054
162327
  logger.debug("ProxyWorker miniflare options changed, reinstantiating...");
@@ -161074,7 +162347,7 @@ var ProxyController = class extends import_node_events3.EventEmitter {
161074
162347
  if (this._torndown)
161075
162348
  return;
161076
162349
  const existingWebSocket = await this.inspectorProxyWorkerWebSocket?.promise;
161077
- if (existingWebSocket?.readyState === import_miniflare15.WebSocket.READY_STATE_OPEN) {
162350
+ if (existingWebSocket?.readyState === import_miniflare16.WebSocket.READY_STATE_OPEN) {
161078
162351
  return existingWebSocket;
161079
162352
  }
161080
162353
  this.inspectorProxyWorkerWebSocket = createDeferred();
@@ -161117,7 +162390,7 @@ var ProxyController = class extends import_node_events3.EventEmitter {
161117
162390
  this.inspectorProxyWorkerWebSocket?.resolve(webSocket);
161118
162391
  return webSocket;
161119
162392
  }
161120
- runtimeMessageMutex = new import_miniflare15.Mutex();
162393
+ runtimeMessageMutex = new import_miniflare16.Mutex();
161121
162394
  async sendMessageToProxyWorker(message, retries = 3) {
161122
162395
  if (this._torndown)
161123
162396
  return;
@@ -161264,15 +162537,15 @@ var ProxyController = class extends import_node_events3.EventEmitter {
161264
162537
  );
161265
162538
  }
161266
162539
  if (maybeContents === void 0) {
161267
- return new import_miniflare15.Response(null, { status: 404 });
162540
+ return new import_miniflare16.Response(null, { status: 404 });
161268
162541
  }
161269
- return new import_miniflare15.Response(maybeContents);
162542
+ return new import_miniflare16.Response(maybeContents);
161270
162543
  }
161271
162544
  default:
161272
162545
  assertNever(message);
161273
- return new import_miniflare15.Response(null, { status: 404 });
162546
+ return new import_miniflare16.Response(null, { status: 404 });
161274
162547
  }
161275
- return new import_miniflare15.Response(null, { status: 204 });
162548
+ return new import_miniflare16.Response(null, { status: 204 });
161276
162549
  }
161277
162550
  _torndown = false;
161278
162551
  async teardown() {
@@ -161322,7 +162595,7 @@ var ProxyController = class extends import_node_events3.EventEmitter {
161322
162595
  __name(ProxyController, "ProxyController");
161323
162596
  var ProxyControllerLogger = class extends WranglerLog {
161324
162597
  log(message) {
161325
- if (message.includes("/cdn-cgi/") && this.level < import_miniflare15.LogLevel.DEBUG)
162598
+ if (message.includes("/cdn-cgi/") && this.level < import_miniflare16.LogLevel.DEBUG)
161326
162599
  return;
161327
162600
  super.log(message);
161328
162601
  }