@cloudflare/workers-utils 0.21.1 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,16 +1,17 @@
1
- export { assertNever, constructWranglerConfig, getTodaysCompatDate, isCompatDate, mapWorkerMetadataBindings } from './chunk-BLWXWFJK.mjs';
1
+ export { assertNever, constructWranglerConfig, getTodaysCompatDate, isCompatDate, mapWorkerMetadataBindings } from './chunk-AKFE3ND4.mjs';
2
2
  export { MetricsRegistry } from './chunk-O4YGOZSW.mjs';
3
- import { isDirectory, UserError, isRedirectedRawConfig, dedent, configFileName, formatConfigSnippet, FatalError, removeDirSync, readFileSync, parseTOML, modify, applyEdits, format, dist_default, parseJSONC } from './chunk-GMTGAG26.mjs';
3
+ import { isDirectory, UserError, isRedirectedRawConfig, dedent, configFileName, formatConfigSnippet, FatalError, removeDirSync, readFileSync as readFileSync$1, parseTOML, modify, applyEdits, format, dist_default, parseJSONC } from './chunk-GMTGAG26.mjs';
4
4
  export { APIError, CommandLineArgsError, DeprecationError, FatalError, JsonFriendlyFatalError, MissingConfigError, ParseError, UserError, configFileName, configFormat, createFatalError, experimental_readRawConfig, findWranglerConfig, formatConfigSnippet, indexLocation, isDirectory, isRedirectedConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, readFileSync, readFileSyncToBuffer, removeDir, removeDirSync, resolveWranglerConfigPath, searchLocation } from './chunk-GMTGAG26.mjs';
5
5
  export { ENVIRONMENT_TAG_PREFIX, INHERIT_SYMBOL, JSON_CONFIG_FORMATS, PATH_TO_DEPLOY_CONFIG, SERVICE_TAG_PREFIX } from './chunk-OZQVB3L3.mjs';
6
6
  import { __commonJS, __name, __require, __export, __toESM, __reExport } from './chunk-DCOBXSFB.mjs';
7
- import fs, { accessSync, constants, writeFileSync, renameSync, existsSync, unlinkSync, mkdirSync, chmodSync } from 'node:fs';
7
+ import fs2, { accessSync, constants, writeFileSync, renameSync, existsSync, unlinkSync, mkdirSync, chmodSync, readFileSync } from 'node:fs';
8
8
  import assert from 'node:assert';
9
9
  import path3, { join, dirname } from 'node:path';
10
10
  import os, { arch } from 'node:os';
11
11
  import { execFileSync, spawn } from 'node:child_process';
12
12
  import { createHash } from 'node:crypto';
13
13
  import { fetch } from 'undici';
14
+ import * as timersPromises from 'node:timers/promises';
14
15
 
15
16
  // ../../node_modules/.pnpm/xdg-app-paths@8.3.0/node_modules/xdg-app-paths/dist/cjs/lib/XDGAppPaths.js
16
17
  var require_XDGAppPaths = __commonJS({
@@ -34,7 +35,7 @@ var require_XDGAppPaths = __commonJS({
34
35
  }
35
36
  __name(typeOf, "typeOf");
36
37
  function Adapt(adapter_) {
37
- var meta = adapter_.meta, path4 = adapter_.path, xdg = adapter_.xdg;
38
+ var meta = adapter_.meta, path5 = adapter_.path, xdg = adapter_.xdg;
38
39
  var XDGAppPaths_ = /* @__PURE__ */ function() {
39
40
  function XDGAppPaths_2(options_) {
40
41
  if (options_ === void 0) {
@@ -57,7 +58,7 @@ var require_XDGAppPaths = __commonJS({
57
58
  meta.mainFilename()
58
59
  ];
59
60
  var nameFallback = "$eval";
60
- var name = path4.parse(((_c = namePriorityList.find(function(e2) {
61
+ var name = path5.parse(((_c = namePriorityList.find(function(e2) {
61
62
  return isString2(e2);
62
63
  })) !== null && _c !== void 0 ? _c : nameFallback) + suffix).name;
63
64
  XDGAppPaths.$name = /* @__PURE__ */ __name(function $name() {
@@ -78,28 +79,28 @@ var require_XDGAppPaths = __commonJS({
78
79
  }
79
80
  __name(finalPathSegment, "finalPathSegment");
80
81
  XDGAppPaths.cache = /* @__PURE__ */ __name(function cache(dirOptions) {
81
- return path4.join(xdg.cache(), finalPathSegment(dirOptions));
82
+ return path5.join(xdg.cache(), finalPathSegment(dirOptions));
82
83
  }, "cache");
83
84
  XDGAppPaths.config = /* @__PURE__ */ __name(function config(dirOptions) {
84
- return path4.join(xdg.config(), finalPathSegment(dirOptions));
85
+ return path5.join(xdg.config(), finalPathSegment(dirOptions));
85
86
  }, "config");
86
87
  XDGAppPaths.data = /* @__PURE__ */ __name(function data(dirOptions) {
87
- return path4.join(xdg.data(), finalPathSegment(dirOptions));
88
+ return path5.join(xdg.data(), finalPathSegment(dirOptions));
88
89
  }, "data");
89
90
  XDGAppPaths.runtime = /* @__PURE__ */ __name(function runtime(dirOptions) {
90
- return xdg.runtime() ? path4.join(xdg.runtime(), finalPathSegment(dirOptions)) : void 0;
91
+ return xdg.runtime() ? path5.join(xdg.runtime(), finalPathSegment(dirOptions)) : void 0;
91
92
  }, "runtime");
92
93
  XDGAppPaths.state = /* @__PURE__ */ __name(function state(dirOptions) {
93
- return path4.join(xdg.state(), finalPathSegment(dirOptions));
94
+ return path5.join(xdg.state(), finalPathSegment(dirOptions));
94
95
  }, "state");
95
96
  XDGAppPaths.configDirs = /* @__PURE__ */ __name(function configDirs(dirOptions) {
96
97
  return xdg.configDirs().map(function(s) {
97
- return path4.join(s, finalPathSegment(dirOptions));
98
+ return path5.join(s, finalPathSegment(dirOptions));
98
99
  });
99
100
  }, "configDirs");
100
101
  XDGAppPaths.dataDirs = /* @__PURE__ */ __name(function dataDirs(dirOptions) {
101
102
  return xdg.dataDirs().map(function(s) {
102
- return path4.join(s, finalPathSegment(dirOptions));
103
+ return path5.join(s, finalPathSegment(dirOptions));
103
104
  });
104
105
  }, "dataDirs");
105
106
  return XDGAppPaths;
@@ -125,7 +126,7 @@ var require_XDG = __commonJS({
125
126
  exports.__esModule = true;
126
127
  exports.Adapt = void 0;
127
128
  function Adapt(adapter_) {
128
- var env = adapter_.env, osPaths = adapter_.osPaths, path4 = adapter_.path;
129
+ var env = adapter_.env, osPaths = adapter_.osPaths, path5 = adapter_.path;
129
130
  var isMacOS = /^darwin$/i.test(adapter_.process.platform);
130
131
  var isWinOS = /^win/i.test(adapter_.process.platform);
131
132
  function baseDir() {
@@ -133,7 +134,7 @@ var require_XDG = __commonJS({
133
134
  }
134
135
  __name(baseDir, "baseDir");
135
136
  function valOrPath(val, pathSegments) {
136
- return val || path4.join.apply(path4, pathSegments);
137
+ return val || path5.join.apply(path5, pathSegments);
137
138
  }
138
139
  __name(valOrPath, "valOrPath");
139
140
  var linux = /* @__PURE__ */ __name(function() {
@@ -212,11 +213,11 @@ var require_XDG = __commonJS({
212
213
  XDG.state = extension.state;
213
214
  XDG.configDirs = /* @__PURE__ */ __name(function configDirs() {
214
215
  var pathList = env.get("XDG_CONFIG_DIRS");
215
- return __spreadArray([extension.config()], pathList ? pathList.split(path4.delimiter) : []);
216
+ return __spreadArray([extension.config()], pathList ? pathList.split(path5.delimiter) : []);
216
217
  }, "configDirs");
217
218
  XDG.dataDirs = /* @__PURE__ */ __name(function dataDirs() {
218
219
  var pathList = env.get("XDG_DATA_DIRS");
219
- return __spreadArray([extension.data()], pathList ? pathList.split(path4.delimiter) : []);
220
+ return __spreadArray([extension.data()], pathList ? pathList.split(path5.delimiter) : []);
220
221
  }, "dataDirs");
221
222
  return XDG;
222
223
  }
@@ -245,7 +246,7 @@ var require_OSPaths = __commonJS({
245
246
  }
246
247
  __name(isEmpty, "isEmpty");
247
248
  function Adapt(adapter_) {
248
- var env = adapter_.env, os2 = adapter_.os, path4 = adapter_.path;
249
+ var env = adapter_.env, os2 = adapter_.os, path5 = adapter_.path;
249
250
  var isWinOS = /^win/i.test(adapter_.process.platform);
250
251
  function normalizePath(path_) {
251
252
  return path_ ? adapter_.path.normalize(adapter_.path.join(path_, ".")) : void 0;
@@ -260,7 +261,7 @@ var require_OSPaths = __commonJS({
260
261
  typeof os2.homedir === "function" ? os2.homedir() : void 0,
261
262
  env.get("USERPROFILE"),
262
263
  env.get("HOME"),
263
- env.get("HOMEDRIVE") || env.get("HOMEPATH") ? path4.join(env.get("HOMEDRIVE") || "", env.get("HOMEPATH") || "") : void 0
264
+ env.get("HOMEDRIVE") || env.get("HOMEPATH") ? path5.join(env.get("HOMEDRIVE") || "", env.get("HOMEPATH") || "") : void 0
264
265
  ];
265
266
  return normalizePath(priorityList.find(function(v) {
266
267
  return !isEmpty(v);
@@ -271,7 +272,7 @@ var require_OSPaths = __commonJS({
271
272
  __name(home, "home");
272
273
  function temp() {
273
274
  function joinPathToBase(base, segments) {
274
- return base ? path4.join.apply(path4, __spreadArray([base], segments)) : void 0;
275
+ return base ? path5.join.apply(path5, __spreadArray([base], segments)) : void 0;
275
276
  }
276
277
  __name(joinPathToBase, "joinPathToBase");
277
278
  function posix() {
@@ -376,7 +377,7 @@ var require_node = __commonJS({
376
377
  exports.__esModule = true;
377
378
  exports.adapter = void 0;
378
379
  var os2 = __importStar(__require("os"));
379
- var path4 = __importStar(__require("path"));
380
+ var path5 = __importStar(__require("path"));
380
381
  exports.adapter = {
381
382
  atImportPermissions: { env: true },
382
383
  env: {
@@ -385,7 +386,7 @@ var require_node = __commonJS({
385
386
  }, "get")
386
387
  },
387
388
  os: os2,
388
- path: path4,
389
+ path: path5,
389
390
  process
390
391
  };
391
392
  }
@@ -431,7 +432,7 @@ var require_node2 = __commonJS({
431
432
  };
432
433
  exports.__esModule = true;
433
434
  exports.adapter = void 0;
434
- var path4 = __importStar(__require("path"));
435
+ var path5 = __importStar(__require("path"));
435
436
  var os_paths_1 = __importDefault(require_mod_cjs());
436
437
  exports.adapter = {
437
438
  atImportPermissions: { env: true },
@@ -441,7 +442,7 @@ var require_node2 = __commonJS({
441
442
  }, "get")
442
443
  },
443
444
  osPaths: os_paths_1["default"],
444
- path: path4,
445
+ path: path5,
445
446
  process
446
447
  };
447
448
  }
@@ -487,7 +488,7 @@ var require_node3 = __commonJS({
487
488
  };
488
489
  exports.__esModule = true;
489
490
  exports.adapter = void 0;
490
- var path4 = __importStar(__require("path"));
491
+ var path5 = __importStar(__require("path"));
491
492
  var xdg_portable_1 = __importDefault(require_mod_cjs2());
492
493
  exports.adapter = {
493
494
  atImportPermissions: { env: true, read: true },
@@ -502,7 +503,7 @@ var require_node3 = __commonJS({
502
503
  return process.pkg ? process.execPath : void 0;
503
504
  }, "pkgMainFilename")
504
505
  },
505
- path: path4,
506
+ path: path5,
506
507
  process,
507
508
  xdg: xdg_portable_1["default"]
508
509
  };
@@ -518,16 +519,212 @@ var require_mod_cjs3 = __commonJS({
518
519
  }
519
520
  });
520
521
 
522
+ // ../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js
523
+ var require_signals = __commonJS({
524
+ "../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js"(exports, module) {
525
+ module.exports = [
526
+ "SIGABRT",
527
+ "SIGALRM",
528
+ "SIGHUP",
529
+ "SIGINT",
530
+ "SIGTERM"
531
+ ];
532
+ if (process.platform !== "win32") {
533
+ module.exports.push(
534
+ "SIGVTALRM",
535
+ "SIGXCPU",
536
+ "SIGXFSZ",
537
+ "SIGUSR2",
538
+ "SIGTRAP",
539
+ "SIGSYS",
540
+ "SIGQUIT",
541
+ "SIGIOT"
542
+ // should detect profiler and enable/disable accordingly.
543
+ // see #21
544
+ // 'SIGPROF'
545
+ );
546
+ }
547
+ if (process.platform === "linux") {
548
+ module.exports.push(
549
+ "SIGIO",
550
+ "SIGPOLL",
551
+ "SIGPWR",
552
+ "SIGSTKFLT",
553
+ "SIGUNUSED"
554
+ );
555
+ }
556
+ }
557
+ });
558
+
559
+ // ../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js
560
+ var require_signal_exit = __commonJS({
561
+ "../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js"(exports, module) {
562
+ var process2 = global.process;
563
+ var processOk = /* @__PURE__ */ __name(function(process3) {
564
+ return process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function";
565
+ }, "processOk");
566
+ if (!processOk(process2)) {
567
+ module.exports = function() {
568
+ return function() {
569
+ };
570
+ };
571
+ } else {
572
+ assert2 = __require("assert");
573
+ signals = require_signals();
574
+ isWin = /^win/i.test(process2.platform);
575
+ EE = __require("events");
576
+ if (typeof EE !== "function") {
577
+ EE = EE.EventEmitter;
578
+ }
579
+ if (process2.__signal_exit_emitter__) {
580
+ emitter = process2.__signal_exit_emitter__;
581
+ } else {
582
+ emitter = process2.__signal_exit_emitter__ = new EE();
583
+ emitter.count = 0;
584
+ emitter.emitted = {};
585
+ }
586
+ if (!emitter.infinite) {
587
+ emitter.setMaxListeners(Infinity);
588
+ emitter.infinite = true;
589
+ }
590
+ module.exports = function(cb, opts) {
591
+ if (!processOk(global.process)) {
592
+ return function() {
593
+ };
594
+ }
595
+ assert2.equal(typeof cb, "function", "a callback must be provided for exit handler");
596
+ if (loaded === false) {
597
+ load();
598
+ }
599
+ var ev = "exit";
600
+ if (opts && opts.alwaysLast) {
601
+ ev = "afterexit";
602
+ }
603
+ var remove = /* @__PURE__ */ __name(function() {
604
+ emitter.removeListener(ev, cb);
605
+ if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
606
+ unload();
607
+ }
608
+ }, "remove");
609
+ emitter.on(ev, cb);
610
+ return remove;
611
+ };
612
+ unload = /* @__PURE__ */ __name(function unload2() {
613
+ if (!loaded || !processOk(global.process)) {
614
+ return;
615
+ }
616
+ loaded = false;
617
+ signals.forEach(function(sig) {
618
+ try {
619
+ process2.removeListener(sig, sigListeners[sig]);
620
+ } catch (er) {
621
+ }
622
+ });
623
+ process2.emit = originalProcessEmit;
624
+ process2.reallyExit = originalProcessReallyExit;
625
+ emitter.count -= 1;
626
+ }, "unload");
627
+ module.exports.unload = unload;
628
+ emit = /* @__PURE__ */ __name(function emit2(event, code, signal) {
629
+ if (emitter.emitted[event]) {
630
+ return;
631
+ }
632
+ emitter.emitted[event] = true;
633
+ emitter.emit(event, code, signal);
634
+ }, "emit");
635
+ sigListeners = {};
636
+ signals.forEach(function(sig) {
637
+ sigListeners[sig] = /* @__PURE__ */ __name(function listener() {
638
+ if (!processOk(global.process)) {
639
+ return;
640
+ }
641
+ var listeners = process2.listeners(sig);
642
+ if (listeners.length === emitter.count) {
643
+ unload();
644
+ emit("exit", null, sig);
645
+ emit("afterexit", null, sig);
646
+ if (isWin && sig === "SIGHUP") {
647
+ sig = "SIGINT";
648
+ }
649
+ process2.kill(process2.pid, sig);
650
+ }
651
+ }, "listener");
652
+ });
653
+ module.exports.signals = function() {
654
+ return signals;
655
+ };
656
+ loaded = false;
657
+ load = /* @__PURE__ */ __name(function load2() {
658
+ if (loaded || !processOk(global.process)) {
659
+ return;
660
+ }
661
+ loaded = true;
662
+ emitter.count += 1;
663
+ signals = signals.filter(function(sig) {
664
+ try {
665
+ process2.on(sig, sigListeners[sig]);
666
+ return true;
667
+ } catch (er) {
668
+ return false;
669
+ }
670
+ });
671
+ process2.emit = processEmit;
672
+ process2.reallyExit = processReallyExit;
673
+ }, "load");
674
+ module.exports.load = load;
675
+ originalProcessReallyExit = process2.reallyExit;
676
+ processReallyExit = /* @__PURE__ */ __name(function processReallyExit2(code) {
677
+ if (!processOk(global.process)) {
678
+ return;
679
+ }
680
+ process2.exitCode = code || /* istanbul ignore next */
681
+ 0;
682
+ emit("exit", process2.exitCode, null);
683
+ emit("afterexit", process2.exitCode, null);
684
+ originalProcessReallyExit.call(process2, process2.exitCode);
685
+ }, "processReallyExit");
686
+ originalProcessEmit = process2.emit;
687
+ processEmit = /* @__PURE__ */ __name(function processEmit2(ev, arg) {
688
+ if (ev === "exit" && processOk(global.process)) {
689
+ if (arg !== void 0) {
690
+ process2.exitCode = arg;
691
+ }
692
+ var ret = originalProcessEmit.apply(this, arguments);
693
+ emit("exit", process2.exitCode, null);
694
+ emit("afterexit", process2.exitCode, null);
695
+ return ret;
696
+ } else {
697
+ return originalProcessEmit.apply(this, arguments);
698
+ }
699
+ }, "processEmit");
700
+ }
701
+ var assert2;
702
+ var signals;
703
+ var isWin;
704
+ var EE;
705
+ var emitter;
706
+ var unload;
707
+ var emit;
708
+ var sigListeners;
709
+ var loaded;
710
+ var load;
711
+ var originalProcessReallyExit;
712
+ var processReallyExit;
713
+ var originalProcessEmit;
714
+ var processEmit;
715
+ }
716
+ });
717
+
521
718
  // ../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js
522
719
  var require_command_exists = __commonJS({
523
720
  "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js"(exports, module) {
524
721
  var exec = __require("child_process").exec;
525
722
  var execSync = __require("child_process").execSync;
526
- var fs2 = __require("fs");
527
- var path4 = __require("path");
528
- var access = fs2.access;
529
- var accessSync2 = fs2.accessSync;
530
- var constants2 = fs2.constants || fs2;
723
+ var fs3 = __require("fs");
724
+ var path5 = __require("path");
725
+ var access = fs3.access;
726
+ var accessSync2 = fs3.accessSync;
727
+ var constants2 = fs3.constants || fs3;
531
728
  var isUsingWindows = process.platform == "win32";
532
729
  var fileNotExists = /* @__PURE__ */ __name(function(commandName, callback) {
533
730
  access(
@@ -628,8 +825,8 @@ var require_command_exists = __commonJS({
628
825
  cleanInput = /* @__PURE__ */ __name(function(s) {
629
826
  var isPathName = /[\\]/.test(s);
630
827
  if (isPathName) {
631
- var dirname2 = '"' + path4.dirname(s) + '"';
632
- var basename = '"' + path4.basename(s) + '"';
828
+ var dirname2 = '"' + path5.dirname(s) + '"';
829
+ var basename = '"' + path5.basename(s) + '"';
633
830
  return dirname2 + ":" + basename;
634
831
  }
635
832
  return '"' + s + '"';
@@ -672,6 +869,997 @@ var require_command_exists2 = __commonJS({
672
869
  }
673
870
  });
674
871
 
872
+ // ../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js
873
+ var require_ini = __commonJS({
874
+ "../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js"(exports) {
875
+ exports.parse = exports.decode = decode;
876
+ exports.stringify = exports.encode = encode;
877
+ exports.safe = safe;
878
+ exports.unsafe = unsafe;
879
+ var eol = typeof process !== "undefined" && process.platform === "win32" ? "\r\n" : "\n";
880
+ function encode(obj, opt) {
881
+ var children = [];
882
+ var out = "";
883
+ if (typeof opt === "string") {
884
+ opt = {
885
+ section: opt,
886
+ whitespace: false
887
+ };
888
+ } else {
889
+ opt = opt || {};
890
+ opt.whitespace = opt.whitespace === true;
891
+ }
892
+ var separator = opt.whitespace ? " = " : "=";
893
+ Object.keys(obj).forEach(function(k, _2, __) {
894
+ var val = obj[k];
895
+ if (val && Array.isArray(val)) {
896
+ val.forEach(function(item) {
897
+ out += safe(k + "[]") + separator + safe(item) + "\n";
898
+ });
899
+ } else if (val && typeof val === "object")
900
+ children.push(k);
901
+ else
902
+ out += safe(k) + separator + safe(val) + eol;
903
+ });
904
+ if (opt.section && out.length)
905
+ out = "[" + safe(opt.section) + "]" + eol + out;
906
+ children.forEach(function(k, _2, __) {
907
+ var nk = dotSplit(k).join("\\.");
908
+ var section = (opt.section ? opt.section + "." : "") + nk;
909
+ var child = encode(obj[k], {
910
+ section,
911
+ whitespace: opt.whitespace
912
+ });
913
+ if (out.length && child.length)
914
+ out += eol;
915
+ out += child;
916
+ });
917
+ return out;
918
+ }
919
+ __name(encode, "encode");
920
+ function dotSplit(str) {
921
+ return str.replace(/\1/g, "LITERAL\\1LITERAL").replace(/\\\./g, "").split(/\./).map(function(part) {
922
+ return part.replace(/\1/g, "\\.").replace(/\2LITERAL\\1LITERAL\2/g, "");
923
+ });
924
+ }
925
+ __name(dotSplit, "dotSplit");
926
+ function decode(str) {
927
+ var out = {};
928
+ var p = out;
929
+ var section = null;
930
+ var re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i;
931
+ var lines = str.split(/[\r\n]+/g);
932
+ lines.forEach(function(line, _2, __) {
933
+ if (!line || line.match(/^\s*[;#]/))
934
+ return;
935
+ var match = line.match(re);
936
+ if (!match)
937
+ return;
938
+ if (match[1] !== void 0) {
939
+ section = unsafe(match[1]);
940
+ if (section === "__proto__") {
941
+ p = {};
942
+ return;
943
+ }
944
+ p = out[section] = out[section] || {};
945
+ return;
946
+ }
947
+ var key = unsafe(match[2]);
948
+ if (key === "__proto__")
949
+ return;
950
+ var value = match[3] ? unsafe(match[4]) : true;
951
+ switch (value) {
952
+ case "true":
953
+ case "false":
954
+ case "null":
955
+ value = JSON.parse(value);
956
+ }
957
+ if (key.length > 2 && key.slice(-2) === "[]") {
958
+ key = key.substring(0, key.length - 2);
959
+ if (key === "__proto__")
960
+ return;
961
+ if (!p[key])
962
+ p[key] = [];
963
+ else if (!Array.isArray(p[key]))
964
+ p[key] = [p[key]];
965
+ }
966
+ if (Array.isArray(p[key]))
967
+ p[key].push(value);
968
+ else
969
+ p[key] = value;
970
+ });
971
+ Object.keys(out).filter(function(k, _2, __) {
972
+ if (!out[k] || typeof out[k] !== "object" || Array.isArray(out[k]))
973
+ return false;
974
+ var parts = dotSplit(k);
975
+ var p2 = out;
976
+ var l = parts.pop();
977
+ var nl = l.replace(/\\\./g, ".");
978
+ parts.forEach(function(part, _3, __2) {
979
+ if (part === "__proto__")
980
+ return;
981
+ if (!p2[part] || typeof p2[part] !== "object")
982
+ p2[part] = {};
983
+ p2 = p2[part];
984
+ });
985
+ if (p2 === out && nl === l)
986
+ return false;
987
+ p2[nl] = out[k];
988
+ return true;
989
+ }).forEach(function(del, _2, __) {
990
+ delete out[del];
991
+ });
992
+ return out;
993
+ }
994
+ __name(decode, "decode");
995
+ function isQuoted(val) {
996
+ return val.charAt(0) === '"' && val.slice(-1) === '"' || val.charAt(0) === "'" && val.slice(-1) === "'";
997
+ }
998
+ __name(isQuoted, "isQuoted");
999
+ function safe(val) {
1000
+ return typeof val !== "string" || val.match(/[=\r\n]/) || val.match(/^\[/) || val.length > 1 && isQuoted(val) || val !== val.trim() ? JSON.stringify(val) : val.replace(/;/g, "\\;").replace(/#/g, "\\#");
1001
+ }
1002
+ __name(safe, "safe");
1003
+ function unsafe(val, doUnesc) {
1004
+ val = (val || "").trim();
1005
+ if (isQuoted(val)) {
1006
+ if (val.charAt(0) === "'")
1007
+ val = val.substr(1, val.length - 2);
1008
+ try {
1009
+ val = JSON.parse(val);
1010
+ } catch (_2) {
1011
+ }
1012
+ } else {
1013
+ var esc = false;
1014
+ var unesc = "";
1015
+ for (var i = 0, l = val.length; i < l; i++) {
1016
+ var c = val.charAt(i);
1017
+ if (esc) {
1018
+ if ("\\;#".indexOf(c) !== -1)
1019
+ unesc += c;
1020
+ else
1021
+ unesc += "\\" + c;
1022
+ esc = false;
1023
+ } else if (";#".indexOf(c) !== -1)
1024
+ break;
1025
+ else if (c === "\\")
1026
+ esc = true;
1027
+ else
1028
+ unesc += c;
1029
+ }
1030
+ if (esc)
1031
+ unesc += "\\";
1032
+ return unesc.trim();
1033
+ }
1034
+ return val;
1035
+ }
1036
+ __name(unsafe, "unsafe");
1037
+ }
1038
+ });
1039
+
1040
+ // ../../node_modules/.pnpm/strip-json-comments@2.0.1/node_modules/strip-json-comments/index.js
1041
+ var require_strip_json_comments = __commonJS({
1042
+ "../../node_modules/.pnpm/strip-json-comments@2.0.1/node_modules/strip-json-comments/index.js"(exports, module) {
1043
+ var singleComment = 1;
1044
+ var multiComment = 2;
1045
+ function stripWithoutWhitespace() {
1046
+ return "";
1047
+ }
1048
+ __name(stripWithoutWhitespace, "stripWithoutWhitespace");
1049
+ function stripWithWhitespace(str, start, end) {
1050
+ return str.slice(start, end).replace(/\S/g, " ");
1051
+ }
1052
+ __name(stripWithWhitespace, "stripWithWhitespace");
1053
+ module.exports = function(str, opts) {
1054
+ opts = opts || {};
1055
+ var currentChar;
1056
+ var nextChar;
1057
+ var insideString = false;
1058
+ var insideComment = false;
1059
+ var offset = 0;
1060
+ var ret = "";
1061
+ var strip = opts.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace;
1062
+ for (var i = 0; i < str.length; i++) {
1063
+ currentChar = str[i];
1064
+ nextChar = str[i + 1];
1065
+ if (!insideComment && currentChar === '"') {
1066
+ var escaped = str[i - 1] === "\\" && str[i - 2] !== "\\";
1067
+ if (!escaped) {
1068
+ insideString = !insideString;
1069
+ }
1070
+ }
1071
+ if (insideString) {
1072
+ continue;
1073
+ }
1074
+ if (!insideComment && currentChar + nextChar === "//") {
1075
+ ret += str.slice(offset, i);
1076
+ offset = i;
1077
+ insideComment = singleComment;
1078
+ i++;
1079
+ } else if (insideComment === singleComment && currentChar + nextChar === "\r\n") {
1080
+ i++;
1081
+ insideComment = false;
1082
+ ret += strip(str, offset, i);
1083
+ offset = i;
1084
+ continue;
1085
+ } else if (insideComment === singleComment && currentChar === "\n") {
1086
+ insideComment = false;
1087
+ ret += strip(str, offset, i);
1088
+ offset = i;
1089
+ } else if (!insideComment && currentChar + nextChar === "/*") {
1090
+ ret += str.slice(offset, i);
1091
+ offset = i;
1092
+ insideComment = multiComment;
1093
+ i++;
1094
+ continue;
1095
+ } else if (insideComment === multiComment && currentChar + nextChar === "*/") {
1096
+ i++;
1097
+ insideComment = false;
1098
+ ret += strip(str, offset, i + 1);
1099
+ offset = i + 1;
1100
+ continue;
1101
+ }
1102
+ }
1103
+ return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset));
1104
+ };
1105
+ }
1106
+ });
1107
+
1108
+ // ../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js
1109
+ var require_utils = __commonJS({
1110
+ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports) {
1111
+ var fs3 = __require("fs");
1112
+ var ini = require_ini();
1113
+ var path5 = __require("path");
1114
+ var stripJsonComments = require_strip_json_comments();
1115
+ var parse = exports.parse = function(content) {
1116
+ if (/^\s*{/.test(content))
1117
+ return JSON.parse(stripJsonComments(content));
1118
+ return ini.parse(content);
1119
+ };
1120
+ var file = exports.file = function() {
1121
+ var args = [].slice.call(arguments).filter(function(arg) {
1122
+ return arg != null;
1123
+ });
1124
+ for (var i in args)
1125
+ if ("string" !== typeof args[i])
1126
+ return;
1127
+ var file2 = path5.join.apply(null, args);
1128
+ try {
1129
+ return fs3.readFileSync(file2, "utf-8");
1130
+ } catch (err) {
1131
+ return;
1132
+ }
1133
+ };
1134
+ exports.json = function() {
1135
+ var content = file.apply(null, arguments);
1136
+ return content ? parse(content) : null;
1137
+ };
1138
+ exports.env = function(prefix, env2) {
1139
+ env2 = env2 || process.env;
1140
+ var obj = {};
1141
+ var l = prefix.length;
1142
+ for (var k in env2) {
1143
+ if (k.toLowerCase().indexOf(prefix.toLowerCase()) === 0) {
1144
+ var keypath = k.substring(l).split("__");
1145
+ var _emptyStringIndex;
1146
+ while ((_emptyStringIndex = keypath.indexOf("")) > -1) {
1147
+ keypath.splice(_emptyStringIndex, 1);
1148
+ }
1149
+ var cursor = obj;
1150
+ keypath.forEach(/* @__PURE__ */ __name(function _buildSubObj(_subkey, i) {
1151
+ if (!_subkey || typeof cursor !== "object")
1152
+ return;
1153
+ if (i === keypath.length - 1)
1154
+ cursor[_subkey] = env2[k];
1155
+ if (cursor[_subkey] === void 0)
1156
+ cursor[_subkey] = {};
1157
+ cursor = cursor[_subkey];
1158
+ }, "_buildSubObj"));
1159
+ }
1160
+ }
1161
+ return obj;
1162
+ };
1163
+ exports.find = function() {
1164
+ var rel = path5.join.apply(null, [].slice.call(arguments));
1165
+ function find2(start, rel2) {
1166
+ var file2 = path5.join(start, rel2);
1167
+ try {
1168
+ fs3.statSync(file2);
1169
+ return file2;
1170
+ } catch (err) {
1171
+ if (path5.dirname(start) !== start)
1172
+ return find2(path5.dirname(start), rel2);
1173
+ }
1174
+ }
1175
+ __name(find2, "find");
1176
+ return find2(process.cwd(), rel);
1177
+ };
1178
+ }
1179
+ });
1180
+
1181
+ // ../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js
1182
+ var require_deep_extend = __commonJS({
1183
+ "../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js"(exports, module) {
1184
+ function isSpecificValue(val) {
1185
+ return val instanceof Buffer || val instanceof Date || val instanceof RegExp ? true : false;
1186
+ }
1187
+ __name(isSpecificValue, "isSpecificValue");
1188
+ function cloneSpecificValue(val) {
1189
+ if (val instanceof Buffer) {
1190
+ var x = Buffer.alloc ? Buffer.alloc(val.length) : new Buffer(val.length);
1191
+ val.copy(x);
1192
+ return x;
1193
+ } else if (val instanceof Date) {
1194
+ return new Date(val.getTime());
1195
+ } else if (val instanceof RegExp) {
1196
+ return new RegExp(val);
1197
+ } else {
1198
+ throw new Error("Unexpected situation");
1199
+ }
1200
+ }
1201
+ __name(cloneSpecificValue, "cloneSpecificValue");
1202
+ function deepCloneArray(arr) {
1203
+ var clone = [];
1204
+ arr.forEach(function(item, index) {
1205
+ if (typeof item === "object" && item !== null) {
1206
+ if (Array.isArray(item)) {
1207
+ clone[index] = deepCloneArray(item);
1208
+ } else if (isSpecificValue(item)) {
1209
+ clone[index] = cloneSpecificValue(item);
1210
+ } else {
1211
+ clone[index] = deepExtend({}, item);
1212
+ }
1213
+ } else {
1214
+ clone[index] = item;
1215
+ }
1216
+ });
1217
+ return clone;
1218
+ }
1219
+ __name(deepCloneArray, "deepCloneArray");
1220
+ function safeGetProperty(object, property) {
1221
+ return property === "__proto__" ? void 0 : object[property];
1222
+ }
1223
+ __name(safeGetProperty, "safeGetProperty");
1224
+ var deepExtend = module.exports = function() {
1225
+ if (arguments.length < 1 || typeof arguments[0] !== "object") {
1226
+ return false;
1227
+ }
1228
+ if (arguments.length < 2) {
1229
+ return arguments[0];
1230
+ }
1231
+ var target = arguments[0];
1232
+ var args = Array.prototype.slice.call(arguments, 1);
1233
+ var val, src;
1234
+ args.forEach(function(obj) {
1235
+ if (typeof obj !== "object" || obj === null || Array.isArray(obj)) {
1236
+ return;
1237
+ }
1238
+ Object.keys(obj).forEach(function(key) {
1239
+ src = safeGetProperty(target, key);
1240
+ val = safeGetProperty(obj, key);
1241
+ if (val === target) {
1242
+ return;
1243
+ } else if (typeof val !== "object" || val === null) {
1244
+ target[key] = val;
1245
+ return;
1246
+ } else if (Array.isArray(val)) {
1247
+ target[key] = deepCloneArray(val);
1248
+ return;
1249
+ } else if (isSpecificValue(val)) {
1250
+ target[key] = cloneSpecificValue(val);
1251
+ return;
1252
+ } else if (typeof src !== "object" || src === null || Array.isArray(src)) {
1253
+ target[key] = deepExtend({}, val);
1254
+ return;
1255
+ } else {
1256
+ target[key] = deepExtend(src, val);
1257
+ return;
1258
+ }
1259
+ });
1260
+ });
1261
+ return target;
1262
+ };
1263
+ }
1264
+ });
1265
+
1266
+ // ../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js
1267
+ var require_minimist = __commonJS({
1268
+ "../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js"(exports, module) {
1269
+ module.exports = function(args, opts) {
1270
+ if (!opts) opts = {};
1271
+ var flags = { bools: {}, strings: {}, unknownFn: null };
1272
+ if (typeof opts["unknown"] === "function") {
1273
+ flags.unknownFn = opts["unknown"];
1274
+ }
1275
+ if (typeof opts["boolean"] === "boolean" && opts["boolean"]) {
1276
+ flags.allBools = true;
1277
+ } else {
1278
+ [].concat(opts["boolean"]).filter(Boolean).forEach(function(key2) {
1279
+ flags.bools[key2] = true;
1280
+ });
1281
+ }
1282
+ var aliases = {};
1283
+ Object.keys(opts.alias || {}).forEach(function(key2) {
1284
+ aliases[key2] = [].concat(opts.alias[key2]);
1285
+ aliases[key2].forEach(function(x) {
1286
+ aliases[x] = [key2].concat(aliases[key2].filter(function(y) {
1287
+ return x !== y;
1288
+ }));
1289
+ });
1290
+ });
1291
+ [].concat(opts.string).filter(Boolean).forEach(function(key2) {
1292
+ flags.strings[key2] = true;
1293
+ if (aliases[key2]) {
1294
+ flags.strings[aliases[key2]] = true;
1295
+ }
1296
+ });
1297
+ var defaults = opts["default"] || {};
1298
+ var argv = { _: [] };
1299
+ Object.keys(flags.bools).forEach(function(key2) {
1300
+ setArg(key2, defaults[key2] === void 0 ? false : defaults[key2]);
1301
+ });
1302
+ var notFlags = [];
1303
+ if (args.indexOf("--") !== -1) {
1304
+ notFlags = args.slice(args.indexOf("--") + 1);
1305
+ args = args.slice(0, args.indexOf("--"));
1306
+ }
1307
+ function argDefined(key2, arg2) {
1308
+ return flags.allBools && /^--[^=]+$/.test(arg2) || flags.strings[key2] || flags.bools[key2] || aliases[key2];
1309
+ }
1310
+ __name(argDefined, "argDefined");
1311
+ function setArg(key2, val, arg2) {
1312
+ if (arg2 && flags.unknownFn && !argDefined(key2, arg2)) {
1313
+ if (flags.unknownFn(arg2) === false) return;
1314
+ }
1315
+ var value2 = !flags.strings[key2] && isNumber(val) ? Number(val) : val;
1316
+ setKey(argv, key2.split("."), value2);
1317
+ (aliases[key2] || []).forEach(function(x) {
1318
+ setKey(argv, x.split("."), value2);
1319
+ });
1320
+ }
1321
+ __name(setArg, "setArg");
1322
+ function setKey(obj, keys, value2) {
1323
+ var o = obj;
1324
+ for (var i2 = 0; i2 < keys.length - 1; i2++) {
1325
+ var key2 = keys[i2];
1326
+ if (isConstructorOrProto(o, key2)) return;
1327
+ if (o[key2] === void 0) o[key2] = {};
1328
+ if (o[key2] === Object.prototype || o[key2] === Number.prototype || o[key2] === String.prototype) o[key2] = {};
1329
+ if (o[key2] === Array.prototype) o[key2] = [];
1330
+ o = o[key2];
1331
+ }
1332
+ var key2 = keys[keys.length - 1];
1333
+ if (isConstructorOrProto(o, key2)) return;
1334
+ if (o === Object.prototype || o === Number.prototype || o === String.prototype) o = {};
1335
+ if (o === Array.prototype) o = [];
1336
+ if (o[key2] === void 0 || flags.bools[key2] || typeof o[key2] === "boolean") {
1337
+ o[key2] = value2;
1338
+ } else if (Array.isArray(o[key2])) {
1339
+ o[key2].push(value2);
1340
+ } else {
1341
+ o[key2] = [o[key2], value2];
1342
+ }
1343
+ }
1344
+ __name(setKey, "setKey");
1345
+ function aliasIsBoolean(key2) {
1346
+ return aliases[key2].some(function(x) {
1347
+ return flags.bools[x];
1348
+ });
1349
+ }
1350
+ __name(aliasIsBoolean, "aliasIsBoolean");
1351
+ for (var i = 0; i < args.length; i++) {
1352
+ var arg = args[i];
1353
+ if (/^--.+=/.test(arg)) {
1354
+ var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
1355
+ var key = m[1];
1356
+ var value = m[2];
1357
+ if (flags.bools[key]) {
1358
+ value = value !== "false";
1359
+ }
1360
+ setArg(key, value, arg);
1361
+ } else if (/^--no-.+/.test(arg)) {
1362
+ var key = arg.match(/^--no-(.+)/)[1];
1363
+ setArg(key, false, arg);
1364
+ } else if (/^--.+/.test(arg)) {
1365
+ var key = arg.match(/^--(.+)/)[1];
1366
+ var next = args[i + 1];
1367
+ if (next !== void 0 && !/^-/.test(next) && !flags.bools[key] && !flags.allBools && (aliases[key] ? !aliasIsBoolean(key) : true)) {
1368
+ setArg(key, next, arg);
1369
+ i++;
1370
+ } else if (/^(true|false)$/.test(next)) {
1371
+ setArg(key, next === "true", arg);
1372
+ i++;
1373
+ } else {
1374
+ setArg(key, flags.strings[key] ? "" : true, arg);
1375
+ }
1376
+ } else if (/^-[^-]+/.test(arg)) {
1377
+ var letters = arg.slice(1, -1).split("");
1378
+ var broken = false;
1379
+ for (var j = 0; j < letters.length; j++) {
1380
+ var next = arg.slice(j + 2);
1381
+ if (next === "-") {
1382
+ setArg(letters[j], next, arg);
1383
+ continue;
1384
+ }
1385
+ if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
1386
+ setArg(letters[j], next.split("=")[1], arg);
1387
+ broken = true;
1388
+ break;
1389
+ }
1390
+ if (/[A-Za-z]/.test(letters[j]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
1391
+ setArg(letters[j], next, arg);
1392
+ broken = true;
1393
+ break;
1394
+ }
1395
+ if (letters[j + 1] && letters[j + 1].match(/\W/)) {
1396
+ setArg(letters[j], arg.slice(j + 2), arg);
1397
+ broken = true;
1398
+ break;
1399
+ } else {
1400
+ setArg(letters[j], flags.strings[letters[j]] ? "" : true, arg);
1401
+ }
1402
+ }
1403
+ var key = arg.slice(-1)[0];
1404
+ if (!broken && key !== "-") {
1405
+ if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) && !flags.bools[key] && (aliases[key] ? !aliasIsBoolean(key) : true)) {
1406
+ setArg(key, args[i + 1], arg);
1407
+ i++;
1408
+ } else if (args[i + 1] && /^(true|false)$/.test(args[i + 1])) {
1409
+ setArg(key, args[i + 1] === "true", arg);
1410
+ i++;
1411
+ } else {
1412
+ setArg(key, flags.strings[key] ? "" : true, arg);
1413
+ }
1414
+ }
1415
+ } else {
1416
+ if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
1417
+ argv._.push(
1418
+ flags.strings["_"] || !isNumber(arg) ? arg : Number(arg)
1419
+ );
1420
+ }
1421
+ if (opts.stopEarly) {
1422
+ argv._.push.apply(argv._, args.slice(i + 1));
1423
+ break;
1424
+ }
1425
+ }
1426
+ }
1427
+ Object.keys(defaults).forEach(function(key2) {
1428
+ if (!hasKey(argv, key2.split("."))) {
1429
+ setKey(argv, key2.split("."), defaults[key2]);
1430
+ (aliases[key2] || []).forEach(function(x) {
1431
+ setKey(argv, x.split("."), defaults[key2]);
1432
+ });
1433
+ }
1434
+ });
1435
+ if (opts["--"]) {
1436
+ argv["--"] = new Array();
1437
+ notFlags.forEach(function(key2) {
1438
+ argv["--"].push(key2);
1439
+ });
1440
+ } else {
1441
+ notFlags.forEach(function(key2) {
1442
+ argv._.push(key2);
1443
+ });
1444
+ }
1445
+ return argv;
1446
+ };
1447
+ function hasKey(obj, keys) {
1448
+ var o = obj;
1449
+ keys.slice(0, -1).forEach(function(key2) {
1450
+ o = o[key2] || {};
1451
+ });
1452
+ var key = keys[keys.length - 1];
1453
+ return key in o;
1454
+ }
1455
+ __name(hasKey, "hasKey");
1456
+ function isNumber(x) {
1457
+ if (typeof x === "number") return true;
1458
+ if (/^0x[0-9a-f]+$/i.test(x)) return true;
1459
+ return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
1460
+ }
1461
+ __name(isNumber, "isNumber");
1462
+ function isConstructorOrProto(obj, key) {
1463
+ return key === "constructor" && typeof obj[key] === "function" || key === "__proto__";
1464
+ }
1465
+ __name(isConstructorOrProto, "isConstructorOrProto");
1466
+ }
1467
+ });
1468
+
1469
+ // ../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js
1470
+ var require_rc = __commonJS({
1471
+ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js"(exports, module) {
1472
+ var cc = require_utils();
1473
+ var join2 = __require("path").join;
1474
+ var deepExtend = require_deep_extend();
1475
+ var etc = "/etc";
1476
+ var win = process.platform === "win32";
1477
+ var home = win ? process.env.USERPROFILE : process.env.HOME;
1478
+ module.exports = function(name, defaults, argv, parse) {
1479
+ if ("string" !== typeof name)
1480
+ throw new Error("rc(name): name *must* be string");
1481
+ if (!argv)
1482
+ argv = require_minimist()(process.argv.slice(2));
1483
+ defaults = ("string" === typeof defaults ? cc.json(defaults) : defaults) || {};
1484
+ parse = parse || cc.parse;
1485
+ var env = cc.env(name + "_");
1486
+ var configs = [defaults];
1487
+ var configFiles = [];
1488
+ function addConfigFile(file) {
1489
+ if (configFiles.indexOf(file) >= 0) return;
1490
+ var fileConfig = cc.file(file);
1491
+ if (fileConfig) {
1492
+ configs.push(parse(fileConfig));
1493
+ configFiles.push(file);
1494
+ }
1495
+ }
1496
+ __name(addConfigFile, "addConfigFile");
1497
+ if (!win)
1498
+ [
1499
+ join2(etc, name, "config"),
1500
+ join2(etc, name + "rc")
1501
+ ].forEach(addConfigFile);
1502
+ if (home)
1503
+ [
1504
+ join2(home, ".config", name, "config"),
1505
+ join2(home, ".config", name),
1506
+ join2(home, "." + name, "config"),
1507
+ join2(home, "." + name + "rc")
1508
+ ].forEach(addConfigFile);
1509
+ addConfigFile(cc.find("." + name + "rc"));
1510
+ if (env.config) addConfigFile(env.config);
1511
+ if (argv.config) addConfigFile(argv.config);
1512
+ return deepExtend.apply(null, configs.concat([
1513
+ env,
1514
+ argv,
1515
+ configFiles.length ? { configs: configFiles, config: configFiles[configFiles.length - 1] } : void 0
1516
+ ]));
1517
+ };
1518
+ }
1519
+ });
1520
+
1521
+ // ../../node_modules/.pnpm/registry-url@3.1.0/node_modules/registry-url/index.js
1522
+ var require_registry_url = __commonJS({
1523
+ "../../node_modules/.pnpm/registry-url@3.1.0/node_modules/registry-url/index.js"(exports, module) {
1524
+ module.exports = function(scope) {
1525
+ var rc = require_rc()("npm", { registry: "https://registry.npmjs.org/" });
1526
+ var url = rc[scope + ":registry"] || rc.registry;
1527
+ return url.slice(-1) === "/" ? url : url + "/";
1528
+ };
1529
+ }
1530
+ });
1531
+
1532
+ // ../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js
1533
+ var require_safe_buffer = __commonJS({
1534
+ "../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js"(exports, module) {
1535
+ var buffer = __require("buffer");
1536
+ var Buffer2 = buffer.Buffer;
1537
+ function copyProps(src, dst) {
1538
+ for (var key in src) {
1539
+ dst[key] = src[key];
1540
+ }
1541
+ }
1542
+ __name(copyProps, "copyProps");
1543
+ if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
1544
+ module.exports = buffer;
1545
+ } else {
1546
+ copyProps(buffer, exports);
1547
+ exports.Buffer = SafeBuffer;
1548
+ }
1549
+ function SafeBuffer(arg, encodingOrOffset, length) {
1550
+ return Buffer2(arg, encodingOrOffset, length);
1551
+ }
1552
+ __name(SafeBuffer, "SafeBuffer");
1553
+ SafeBuffer.prototype = Object.create(Buffer2.prototype);
1554
+ copyProps(Buffer2, SafeBuffer);
1555
+ SafeBuffer.from = function(arg, encodingOrOffset, length) {
1556
+ if (typeof arg === "number") {
1557
+ throw new TypeError("Argument must not be a number");
1558
+ }
1559
+ return Buffer2(arg, encodingOrOffset, length);
1560
+ };
1561
+ SafeBuffer.alloc = function(size, fill, encoding) {
1562
+ if (typeof size !== "number") {
1563
+ throw new TypeError("Argument must be a number");
1564
+ }
1565
+ var buf = Buffer2(size);
1566
+ if (fill !== void 0) {
1567
+ if (typeof encoding === "string") {
1568
+ buf.fill(fill, encoding);
1569
+ } else {
1570
+ buf.fill(fill);
1571
+ }
1572
+ } else {
1573
+ buf.fill(0);
1574
+ }
1575
+ return buf;
1576
+ };
1577
+ SafeBuffer.allocUnsafe = function(size) {
1578
+ if (typeof size !== "number") {
1579
+ throw new TypeError("Argument must be a number");
1580
+ }
1581
+ return Buffer2(size);
1582
+ };
1583
+ SafeBuffer.allocUnsafeSlow = function(size) {
1584
+ if (typeof size !== "number") {
1585
+ throw new TypeError("Argument must be a number");
1586
+ }
1587
+ return buffer.SlowBuffer(size);
1588
+ };
1589
+ }
1590
+ });
1591
+
1592
+ // ../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/base64.js
1593
+ var require_base64 = __commonJS({
1594
+ "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/base64.js"(exports, module) {
1595
+ var safeBuffer = require_safe_buffer().Buffer;
1596
+ function decodeBase64(base64) {
1597
+ return safeBuffer.from(base64, "base64").toString("utf8");
1598
+ }
1599
+ __name(decodeBase64, "decodeBase64");
1600
+ function encodeBase64(string) {
1601
+ return safeBuffer.from(string, "utf8").toString("base64");
1602
+ }
1603
+ __name(encodeBase64, "encodeBase64");
1604
+ module.exports = {
1605
+ decodeBase64,
1606
+ encodeBase64
1607
+ };
1608
+ }
1609
+ });
1610
+
1611
+ // ../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/index.js
1612
+ var require_registry_auth_token = __commonJS({
1613
+ "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/index.js"(exports, module) {
1614
+ var url = __require("url");
1615
+ var base64 = require_base64();
1616
+ var decodeBase64 = base64.decodeBase64;
1617
+ var encodeBase64 = base64.encodeBase64;
1618
+ var tokenKey = ":_authToken";
1619
+ var userKey = ":username";
1620
+ var passwordKey = ":_password";
1621
+ module.exports = function() {
1622
+ var checkUrl;
1623
+ var options;
1624
+ if (arguments.length >= 2) {
1625
+ checkUrl = arguments[0];
1626
+ options = arguments[1];
1627
+ } else if (typeof arguments[0] === "string") {
1628
+ checkUrl = arguments[0];
1629
+ } else {
1630
+ options = arguments[0];
1631
+ }
1632
+ options = options || {};
1633
+ options.npmrc = options.npmrc || require_rc()("npm", { registry: "https://registry.npmjs.org/" });
1634
+ checkUrl = checkUrl || options.npmrc.registry;
1635
+ return getRegistryAuthInfo(checkUrl, options) || getLegacyAuthInfo(options.npmrc);
1636
+ };
1637
+ function getRegistryAuthInfo(checkUrl, options) {
1638
+ var parsed = url.parse(checkUrl, false, true);
1639
+ var pathname;
1640
+ while (pathname !== "/" && parsed.pathname !== pathname) {
1641
+ pathname = parsed.pathname || "/";
1642
+ var regUrl = "//" + parsed.host + pathname.replace(/\/$/, "");
1643
+ var authInfo = getAuthInfoForUrl(regUrl, options.npmrc);
1644
+ if (authInfo) {
1645
+ return authInfo;
1646
+ }
1647
+ if (!options.recursive) {
1648
+ return /\/$/.test(checkUrl) ? void 0 : getRegistryAuthInfo(url.resolve(checkUrl, "."), options);
1649
+ }
1650
+ parsed.pathname = url.resolve(normalizePath(pathname), "..") || "/";
1651
+ }
1652
+ return void 0;
1653
+ }
1654
+ __name(getRegistryAuthInfo, "getRegistryAuthInfo");
1655
+ function getLegacyAuthInfo(npmrc) {
1656
+ if (npmrc._auth) {
1657
+ return { token: npmrc._auth, type: "Basic" };
1658
+ }
1659
+ return void 0;
1660
+ }
1661
+ __name(getLegacyAuthInfo, "getLegacyAuthInfo");
1662
+ function normalizePath(path5) {
1663
+ return path5[path5.length - 1] === "/" ? path5 : path5 + "/";
1664
+ }
1665
+ __name(normalizePath, "normalizePath");
1666
+ function getAuthInfoForUrl(regUrl, npmrc) {
1667
+ var bearerAuth = getBearerToken(npmrc[regUrl + tokenKey] || npmrc[regUrl + "/" + tokenKey]);
1668
+ if (bearerAuth) {
1669
+ return bearerAuth;
1670
+ }
1671
+ var username = npmrc[regUrl + userKey] || npmrc[regUrl + "/" + userKey];
1672
+ var password = npmrc[regUrl + passwordKey] || npmrc[regUrl + "/" + passwordKey];
1673
+ var basicAuth = getTokenForUsernameAndPassword(username, password);
1674
+ if (basicAuth) {
1675
+ return basicAuth;
1676
+ }
1677
+ return void 0;
1678
+ }
1679
+ __name(getAuthInfoForUrl, "getAuthInfoForUrl");
1680
+ function getBearerToken(tok) {
1681
+ if (!tok) {
1682
+ return void 0;
1683
+ }
1684
+ var token = tok.replace(/^\$\{?([^}]*)\}?$/, function(fullMatch, envVar) {
1685
+ return process.env[envVar];
1686
+ });
1687
+ return { token, type: "Bearer" };
1688
+ }
1689
+ __name(getBearerToken, "getBearerToken");
1690
+ function getTokenForUsernameAndPassword(username, password) {
1691
+ if (!username || !password) {
1692
+ return void 0;
1693
+ }
1694
+ var pass = decodeBase64(password.replace(/^\$\{?([^}]*)\}?$/, function(fullMatch, envVar) {
1695
+ return process.env[envVar];
1696
+ }));
1697
+ var token = encodeBase64(username + ":" + pass);
1698
+ return {
1699
+ token,
1700
+ type: "Basic",
1701
+ password: pass,
1702
+ username
1703
+ };
1704
+ }
1705
+ __name(getTokenForUsernameAndPassword, "getTokenForUsernameAndPassword");
1706
+ }
1707
+ });
1708
+
1709
+ // ../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js
1710
+ var require_update_check = __commonJS({
1711
+ "../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js"(exports, module) {
1712
+ var { URL: URL2 } = __require("url");
1713
+ var { join: join2 } = __require("path");
1714
+ var fs3 = __require("fs");
1715
+ var { promisify } = __require("util");
1716
+ var { tmpdir } = __require("os");
1717
+ var registryUrl = require_registry_url();
1718
+ var writeFile = promisify(fs3.writeFile);
1719
+ var mkdir = promisify(fs3.mkdir);
1720
+ var readFile = promisify(fs3.readFile);
1721
+ var compareVersions = /* @__PURE__ */ __name((a, b) => a.localeCompare(b, "en-US", { numeric: true }), "compareVersions");
1722
+ var encode = /* @__PURE__ */ __name((value) => encodeURIComponent(value).replace(/^%40/, "@"), "encode");
1723
+ var getFile = /* @__PURE__ */ __name(async (details, distTag) => {
1724
+ const rootDir = tmpdir();
1725
+ const subDir = join2(rootDir, "update-check");
1726
+ if (!fs3.existsSync(subDir)) {
1727
+ await mkdir(subDir);
1728
+ }
1729
+ let name = `${details.name}-${distTag}.json`;
1730
+ if (details.scope) {
1731
+ name = `${details.scope}-${name}`;
1732
+ }
1733
+ return join2(subDir, name);
1734
+ }, "getFile");
1735
+ var evaluateCache = /* @__PURE__ */ __name(async (file, time, interval) => {
1736
+ if (fs3.existsSync(file)) {
1737
+ const content = await readFile(file, "utf8");
1738
+ const { lastUpdate, latest } = JSON.parse(content);
1739
+ const nextCheck = lastUpdate + interval;
1740
+ if (nextCheck > time) {
1741
+ return {
1742
+ shouldCheck: false,
1743
+ latest
1744
+ };
1745
+ }
1746
+ }
1747
+ return {
1748
+ shouldCheck: true,
1749
+ latest: null
1750
+ };
1751
+ }, "evaluateCache");
1752
+ var updateCache = /* @__PURE__ */ __name(async (file, latest, lastUpdate) => {
1753
+ const content = JSON.stringify({
1754
+ latest,
1755
+ lastUpdate
1756
+ });
1757
+ await writeFile(file, content, "utf8");
1758
+ }, "updateCache");
1759
+ var loadPackage = /* @__PURE__ */ __name((url, authInfo) => new Promise((resolve, reject) => {
1760
+ const options = {
1761
+ host: url.hostname,
1762
+ path: url.pathname,
1763
+ port: url.port,
1764
+ headers: {
1765
+ accept: "application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"
1766
+ },
1767
+ timeout: 2e3
1768
+ };
1769
+ if (authInfo) {
1770
+ options.headers.authorization = `${authInfo.type} ${authInfo.token}`;
1771
+ }
1772
+ const { get } = url.protocol === "https:" ? __require("https") : __require("http");
1773
+ get(options, (response) => {
1774
+ const { statusCode } = response;
1775
+ if (statusCode !== 200) {
1776
+ const error = new Error(`Request failed with code ${statusCode}`);
1777
+ error.code = statusCode;
1778
+ reject(error);
1779
+ response.resume();
1780
+ return;
1781
+ }
1782
+ let rawData = "";
1783
+ response.setEncoding("utf8");
1784
+ response.on("data", (chunk) => {
1785
+ rawData += chunk;
1786
+ });
1787
+ response.on("end", () => {
1788
+ try {
1789
+ const parsedData = JSON.parse(rawData);
1790
+ resolve(parsedData);
1791
+ } catch (e2) {
1792
+ reject(e2);
1793
+ }
1794
+ });
1795
+ }).on("error", reject).on("timeout", reject);
1796
+ }), "loadPackage");
1797
+ var getMostRecent = /* @__PURE__ */ __name(async ({ full, scope }, distTag) => {
1798
+ const regURL = registryUrl(scope);
1799
+ const url = new URL2(full, regURL);
1800
+ let spec = null;
1801
+ try {
1802
+ spec = await loadPackage(url);
1803
+ } catch (err) {
1804
+ if (err.code && String(err.code).startsWith(4)) {
1805
+ const registryAuthToken = require_registry_auth_token();
1806
+ const authInfo = registryAuthToken(regURL, { recursive: true });
1807
+ spec = await loadPackage(url, authInfo);
1808
+ } else {
1809
+ throw err;
1810
+ }
1811
+ }
1812
+ const version = spec["dist-tags"][distTag];
1813
+ if (!version) {
1814
+ throw new Error(`Distribution tag ${distTag} is not available`);
1815
+ }
1816
+ return version;
1817
+ }, "getMostRecent");
1818
+ var defaultConfig = {
1819
+ interval: 36e5,
1820
+ distTag: "latest"
1821
+ };
1822
+ var getDetails = /* @__PURE__ */ __name((name) => {
1823
+ const spec = {
1824
+ full: encode(name)
1825
+ };
1826
+ if (name.includes("/")) {
1827
+ const parts = name.split("/");
1828
+ spec.scope = parts[0];
1829
+ spec.name = parts[1];
1830
+ } else {
1831
+ spec.scope = null;
1832
+ spec.name = name;
1833
+ }
1834
+ return spec;
1835
+ }, "getDetails");
1836
+ module.exports = async (pkg, config) => {
1837
+ if (typeof pkg !== "object") {
1838
+ throw new Error("The first parameter should be your package.json file content");
1839
+ }
1840
+ const details = getDetails(pkg.name);
1841
+ const time = Date.now();
1842
+ const { distTag, interval } = Object.assign({}, defaultConfig, config);
1843
+ const file = await getFile(details, distTag);
1844
+ let latest = null;
1845
+ let shouldCheck = true;
1846
+ ({ shouldCheck, latest } = await evaluateCache(file, time, interval));
1847
+ if (shouldCheck) {
1848
+ latest = await getMostRecent(details, distTag);
1849
+ await updateCache(file, latest, time);
1850
+ }
1851
+ const comparision = compareVersions(pkg.version, latest);
1852
+ if (comparision === -1) {
1853
+ return {
1854
+ latest,
1855
+ fromCache: !shouldCheck
1856
+ };
1857
+ }
1858
+ return null;
1859
+ };
1860
+ }
1861
+ });
1862
+
675
1863
  // src/config/config.ts
676
1864
  var defaultWranglerConfig = {
677
1865
  /* COMPUTED_FIELDS */
@@ -722,6 +1910,8 @@ var defaultWranglerConfig = {
722
1910
  vectorize: [],
723
1911
  ai_search_namespaces: [],
724
1912
  ai_search: [],
1913
+ web_search: void 0,
1914
+ agent_memory: [],
725
1915
  hyperdrive: [],
726
1916
  workflows: [],
727
1917
  secrets_store_secrets: [],
@@ -797,7 +1987,7 @@ var defaultWranglerConfig = {
797
1987
  vpc_networks: []
798
1988
  };
799
1989
  var experimental_patchConfig = /* @__PURE__ */ __name((configPath, patch, isArrayInsertion = true) => {
800
- let configString = readFileSync(configPath);
1990
+ let configString = readFileSync$1(configPath);
801
1991
  if (configPath.endsWith("toml")) {
802
1992
  if (configString.includes("#")) {
803
1993
  throw new PatchConfigError(
@@ -1206,8 +2396,8 @@ function getErrorMap() {
1206
2396
  }
1207
2397
  __name(getErrorMap, "getErrorMap");
1208
2398
  var makeIssue = /* @__PURE__ */ __name((params) => {
1209
- const { data, path: path4, errorMaps, issueData } = params;
1210
- const fullPath = [...path4, ...issueData.path || []];
2399
+ const { data, path: path5, errorMaps, issueData } = params;
2400
+ const fullPath = [...path5, ...issueData.path || []];
1211
2401
  const fullIssue = {
1212
2402
  ...issueData,
1213
2403
  path: fullPath
@@ -1313,11 +2503,11 @@ var ParseInputLazyPath = class {
1313
2503
  static {
1314
2504
  __name(this, "ParseInputLazyPath");
1315
2505
  }
1316
- constructor(parent, value, path4, key) {
2506
+ constructor(parent, value, path5, key) {
1317
2507
  this._cachedPath = [];
1318
2508
  this.parent = parent;
1319
2509
  this.data = value;
1320
- this._path = path4;
2510
+ this._path = path5;
1321
2511
  this._key = key;
1322
2512
  }
1323
2513
  get path() {
@@ -4820,7 +6010,8 @@ var getWranglerSendMetricsFromEnv = getBooleanEnvironmentVariableFactory({
4820
6010
  variableName: "WRANGLER_SEND_METRICS"
4821
6011
  });
4822
6012
  var getWranglerSendErrorReportsFromEnv = getBooleanEnvironmentVariableFactory({
4823
- variableName: "WRANGLER_SEND_ERROR_REPORTS"
6013
+ variableName: "WRANGLER_SEND_ERROR_REPORTS",
6014
+ defaultValue: false
4824
6015
  });
4825
6016
  var getCloudflareApiEnvironmentFromEnv = getEnvironmentVariableFactory(
4826
6017
  {
@@ -5120,9 +6311,9 @@ Please add "${field}" to "env.${envName}".`
5120
6311
  return rawEnv[field] ?? defaultValue;
5121
6312
  }
5122
6313
  __name(notInheritable, "notInheritable");
5123
- function unwindPropertyPath(root, path4) {
6314
+ function unwindPropertyPath(root, path5) {
5124
6315
  let container = root;
5125
- const parts = path4.split(".");
6316
+ const parts = path5.split(".");
5126
6317
  for (let i = 0; i < parts.length - 1; i++) {
5127
6318
  if (!hasProperty(container, parts[i])) {
5128
6319
  return;
@@ -5396,6 +6587,8 @@ var friendlyBindingNames = {
5396
6587
  vectorize: "Vectorize Index",
5397
6588
  ai_search_namespaces: "AI Search Namespace",
5398
6589
  ai_search: "AI Search Instance",
6590
+ web_search: "Web Search",
6591
+ agent_memory: "Agent Memory",
5399
6592
  hyperdrive: "Hyperdrive Config",
5400
6593
  r2_buckets: "R2 Bucket",
5401
6594
  logfwdr: "logfwdr",
@@ -5448,6 +6641,8 @@ var bindingTypeFriendlyNames = {
5448
6641
  vectorize: "Vectorize Index",
5449
6642
  ai_search_namespace: "AI Search Namespace",
5450
6643
  ai_search: "AI Search Instance",
6644
+ web_search: "Web Search",
6645
+ agent_memory: "Agent Memory",
5451
6646
  hyperdrive: "Hyperdrive Config",
5452
6647
  service: "Worker",
5453
6648
  fetcher: "Service Binding",
@@ -6642,6 +7837,26 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
6642
7837
  validateBindingArray(envName, validateAISearchBinding),
6643
7838
  []
6644
7839
  ),
7840
+ web_search: notInheritable(
7841
+ diagnostics,
7842
+ topLevelEnv,
7843
+ rawConfig,
7844
+ rawEnv,
7845
+ envName,
7846
+ "web_search",
7847
+ validateNamedSimpleBinding(envName),
7848
+ void 0
7849
+ ),
7850
+ agent_memory: notInheritable(
7851
+ diagnostics,
7852
+ topLevelEnv,
7853
+ rawConfig,
7854
+ rawEnv,
7855
+ envName,
7856
+ "agent_memory",
7857
+ validateBindingArray(envName, validateAgentMemoryBinding),
7858
+ []
7859
+ ),
6645
7860
  hyperdrive: notInheritable(
6646
7861
  diagnostics,
6647
7862
  topLevelEnv,
@@ -7438,36 +8653,36 @@ var validateWorkflowBinding = /* @__PURE__ */ __name((diagnostics, field, value)
7438
8653
  );
7439
8654
  isValid2 = false;
7440
8655
  }
7441
- if (hasProperty(value, "schedule") && value.schedule !== void 0) {
7442
- if (typeof value.schedule === "string") {
7443
- if (value.schedule.length === 0) {
8656
+ if (hasProperty(value, "schedules") && value.schedules !== void 0) {
8657
+ if (typeof value.schedules === "string") {
8658
+ if (value.schedules.length === 0) {
7444
8659
  diagnostics.errors.push(
7445
- `"${field}" bindings "schedule" field must not be an empty string.`
8660
+ `"${field}" bindings "schedules" field must not be an empty string.`
7446
8661
  );
7447
8662
  isValid2 = false;
7448
8663
  }
7449
- } else if (Array.isArray(value.schedule)) {
7450
- if (value.schedule.length === 0) {
8664
+ } else if (Array.isArray(value.schedules)) {
8665
+ if (value.schedules.length === 0) {
7451
8666
  diagnostics.errors.push(
7452
- `"${field}" bindings "schedule" field must not be an empty array.`
8667
+ `"${field}" bindings "schedules" field must not be an empty array.`
7453
8668
  );
7454
8669
  isValid2 = false;
7455
- } else if (!value.schedule.every((s) => typeof s === "string")) {
8670
+ } else if (!value.schedules.every((s) => typeof s === "string")) {
7456
8671
  diagnostics.errors.push(
7457
- `"${field}" bindings should, optionally, have a string or array of strings "schedule" field but got ${JSON.stringify(
8672
+ `"${field}" bindings should, optionally, have a string or array of strings "schedules" field but got ${JSON.stringify(
7458
8673
  value
7459
8674
  )}.`
7460
8675
  );
7461
8676
  isValid2 = false;
7462
- } else if (value.schedule.some((s) => s === "")) {
8677
+ } else if (value.schedules.some((s) => s === "")) {
7463
8678
  diagnostics.errors.push(
7464
- `"${field}" bindings "schedule" field must not contain empty strings.`
8679
+ `"${field}" bindings "schedules" field must not contain empty strings.`
7465
8680
  );
7466
8681
  isValid2 = false;
7467
8682
  }
7468
8683
  } else {
7469
8684
  diagnostics.errors.push(
7470
- `"${field}" bindings should, optionally, have a string or array of strings "schedule" field but got ${JSON.stringify(
8685
+ `"${field}" bindings should, optionally, have a string or array of strings "schedules" field but got ${JSON.stringify(
7471
8686
  value
7472
8687
  )}.`
7473
8688
  );
@@ -7513,7 +8728,7 @@ var validateWorkflowBinding = /* @__PURE__ */ __name((diagnostics, field, value)
7513
8728
  "script_name",
7514
8729
  "remote",
7515
8730
  "limits",
7516
- "schedule"
8731
+ "schedules"
7517
8732
  ]);
7518
8733
  return isValid2;
7519
8734
  }, "validateWorkflowBinding");
@@ -7725,6 +8940,8 @@ var validateUnsafeBinding = /* @__PURE__ */ __name((diagnostics, field, value) =
7725
8940
  "ai",
7726
8941
  "ai_search_namespace",
7727
8942
  "ai_search",
8943
+ "web_search",
8944
+ "agent_memory",
7728
8945
  "kv_namespace",
7729
8946
  "durable_object_namespace",
7730
8947
  "d1_database",
@@ -8640,6 +9857,36 @@ var validateAISearchBinding = /* @__PURE__ */ __name((diagnostics, field, value)
8640
9857
  ]);
8641
9858
  return isValid2;
8642
9859
  }, "validateAISearchBinding");
9860
+ var validateAgentMemoryBinding = /* @__PURE__ */ __name((diagnostics, field, value) => {
9861
+ if (typeof value !== "object" || value === null) {
9862
+ diagnostics.errors.push(
9863
+ `"agent_memory" bindings should be objects, but got ${JSON.stringify(value)}`
9864
+ );
9865
+ return false;
9866
+ }
9867
+ let isValid2 = true;
9868
+ if (!isRequiredProperty(value, "binding", "string")) {
9869
+ diagnostics.errors.push(
9870
+ `"${field}" bindings should have a string "binding" field but got ${JSON.stringify(value)}.`
9871
+ );
9872
+ isValid2 = false;
9873
+ }
9874
+ if (!isRequiredProperty(value, "namespace", "string")) {
9875
+ diagnostics.errors.push(
9876
+ `"${field}" bindings must have a "namespace" field but got ${JSON.stringify(value)}.`
9877
+ );
9878
+ isValid2 = false;
9879
+ }
9880
+ if (!isRemoteValid(value, field, diagnostics)) {
9881
+ isValid2 = false;
9882
+ }
9883
+ validateAdditionalProperties(diagnostics, field, Object.keys(value), [
9884
+ "binding",
9885
+ "namespace",
9886
+ "remote"
9887
+ ]);
9888
+ return isValid2;
9889
+ }, "validateAgentMemoryBinding");
8643
9890
  var validateHyperdriveBinding = /* @__PURE__ */ __name((diagnostics, field, value) => {
8644
9891
  if (typeof value !== "object" || value === null) {
8645
9892
  diagnostics.errors.push(
@@ -9139,9 +10386,16 @@ var validatePipelineBinding = /* @__PURE__ */ __name((diagnostics, field, value)
9139
10386
  );
9140
10387
  isValid2 = false;
9141
10388
  }
9142
- if (!isRequiredProperty(value, "pipeline", "string")) {
10389
+ const hasStream = isOptionalProperty(value, "stream", "string");
10390
+ const hasPipeline = isOptionalProperty(value, "pipeline", "string");
10391
+ const v = value;
10392
+ if (hasStream && v.stream) ; else if (hasPipeline && v.pipeline) {
10393
+ diagnostics.warnings.push(
10394
+ `The "pipeline" field in "${field}" bindings is deprecated. Use "stream" instead.`
10395
+ );
10396
+ } else {
9143
10397
  diagnostics.errors.push(
9144
- `"${field}" bindings must have a string "pipeline" field but got ${JSON.stringify(
10398
+ `"${field}" bindings must have a string "stream" field but got ${JSON.stringify(
9145
10399
  value
9146
10400
  )}.`
9147
10401
  );
@@ -9152,6 +10406,7 @@ var validatePipelineBinding = /* @__PURE__ */ __name((diagnostics, field, value)
9152
10406
  }
9153
10407
  validateAdditionalProperties(diagnostics, field, Object.keys(value), [
9154
10408
  "binding",
10409
+ "stream",
9155
10410
  "pipeline",
9156
10411
  "remote"
9157
10412
  ]);
@@ -10012,7 +11267,7 @@ __name(isRemoteValid, "isRemoteValid");
10012
11267
  function isDockerfile(imagePath, configPath) {
10013
11268
  const baseDir = configPath ? path3.dirname(configPath) : process.cwd();
10014
11269
  const maybeDockerfile = path3.resolve(baseDir, imagePath);
10015
- if (fs.existsSync(maybeDockerfile)) {
11270
+ if (fs2.existsSync(maybeDockerfile)) {
10016
11271
  if (isDirectory(maybeDockerfile)) {
10017
11272
  throw new UserError(
10018
11273
  `${imagePath} is a directory, you should specify a path to the Dockerfile`,
@@ -10050,6 +11305,61 @@ function isDockerfile(imagePath, configPath) {
10050
11305
  }
10051
11306
  __name(isDockerfile, "isDockerfile");
10052
11307
 
11308
+ // src/config/binding-local-support.ts
11309
+ var BINDING_LOCAL_SUPPORT = {
11310
+ plain_text: "local-only",
11311
+ secret_text: "local-only",
11312
+ json: "local-only",
11313
+ wasm_module: "local-only",
11314
+ text_blob: "local-only",
11315
+ data_blob: "local-only",
11316
+ version_metadata: "local-only",
11317
+ inherit: "local-only",
11318
+ logfwdr: "local-only",
11319
+ assets: "local-only",
11320
+ unsafe_hello_world: "local-only",
11321
+ durable_object_namespace: "local-only",
11322
+ hyperdrive: "local-only",
11323
+ fetcher: "local-only",
11324
+ analytics_engine: "local-only",
11325
+ secrets_store_secret: "local-only",
11326
+ ratelimit: "local-only",
11327
+ worker_loader: "local-only",
11328
+ kv_namespace: "local-and-remote",
11329
+ r2_bucket: "local-and-remote",
11330
+ d1: "local-and-remote",
11331
+ workflow: "local-and-remote",
11332
+ browser: "local-and-remote",
11333
+ images: "local-and-remote",
11334
+ stream: "local-and-remote",
11335
+ send_email: "local-and-remote",
11336
+ pipeline: "local-and-remote",
11337
+ service: "local-and-remote",
11338
+ // TODO: Miniflare currently ignores `remote: true` on queues, tracked in #13727.
11339
+ queue: "local-and-remote",
11340
+ vectorize: "remote",
11341
+ mtls_certificate: "remote",
11342
+ dispatch_namespace: "remote",
11343
+ // Reach out to the @cloudflare/wrangler team before adding anything here
11344
+ ai: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
11345
+ ai_search: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
11346
+ ai_search_namespace: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
11347
+ media: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
11348
+ artifacts: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
11349
+ flagship: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
11350
+ vpc_service: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
11351
+ vpc_network: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
11352
+ web_search: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
11353
+ agent_memory: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator"
11354
+ };
11355
+ function getBindingLocalSupport(type) {
11356
+ if (type in BINDING_LOCAL_SUPPORT) {
11357
+ return BINDING_LOCAL_SUPPORT[type];
11358
+ }
11359
+ return "local-only";
11360
+ }
11361
+ __name(getBindingLocalSupport, "getBindingLocalSupport");
11362
+
10053
11363
  // src/config/validation-pages.ts
10054
11364
  var supportedPagesConfigFields = [
10055
11365
  "pages_build_output_dir",
@@ -10181,6 +11491,66 @@ Pages requires Durable Object bindings to specify the name of the Worker where t
10181
11491
  }
10182
11492
  __name(validateDurableObjectBinding2, "validateDurableObjectBinding");
10183
11493
 
11494
+ // src/wrangler-tmp-dir.ts
11495
+ var import_signal_exit = __toESM(require_signal_exit());
11496
+ function getWranglerHiddenDirPath(projectRoot) {
11497
+ projectRoot ??= process.cwd();
11498
+ return path3.join(projectRoot, ".wrangler");
11499
+ }
11500
+ __name(getWranglerHiddenDirPath, "getWranglerHiddenDirPath");
11501
+ var STALE_WRANGLER_TMP_DIR_MS = 24 * 60 * 60 * 1e3;
11502
+ var sweptTmpRoots = /* @__PURE__ */ new Set();
11503
+ function sweepStaleWranglerTmpDirs(tmpRoot) {
11504
+ if (sweptTmpRoots.has(tmpRoot)) {
11505
+ return;
11506
+ }
11507
+ sweptTmpRoots.add(tmpRoot);
11508
+ let entries;
11509
+ try {
11510
+ entries = fs2.readdirSync(tmpRoot, { withFileTypes: true });
11511
+ } catch {
11512
+ return;
11513
+ }
11514
+ const cutoff = Date.now() - STALE_WRANGLER_TMP_DIR_MS;
11515
+ for (const entry of entries) {
11516
+ if (!entry.isDirectory()) {
11517
+ continue;
11518
+ }
11519
+ const entryPath = path3.join(tmpRoot, entry.name);
11520
+ try {
11521
+ if (fs2.statSync(entryPath).mtimeMs < cutoff) {
11522
+ removeDirSync(entryPath);
11523
+ }
11524
+ } catch {
11525
+ }
11526
+ }
11527
+ }
11528
+ __name(sweepStaleWranglerTmpDirs, "sweepStaleWranglerTmpDirs");
11529
+ function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
11530
+ const tmpRoot = path3.join(getWranglerHiddenDirPath(projectRoot), "tmp");
11531
+ fs2.mkdirSync(tmpRoot, { recursive: true });
11532
+ sweepStaleWranglerTmpDirs(tmpRoot);
11533
+ const tmpPrefix = path3.join(tmpRoot, `${prefix}-`);
11534
+ const tmpDir = fs2.realpathSync(fs2.mkdtempSync(tmpPrefix));
11535
+ const cleanupDir = /* @__PURE__ */ __name(() => {
11536
+ if (cleanup) {
11537
+ try {
11538
+ removeDirSync(tmpDir);
11539
+ } catch {
11540
+ }
11541
+ }
11542
+ }, "cleanupDir");
11543
+ const removeExitListener = (0, import_signal_exit.default)(cleanupDir);
11544
+ return {
11545
+ path: tmpDir,
11546
+ remove() {
11547
+ removeExitListener();
11548
+ cleanupDir();
11549
+ }
11550
+ };
11551
+ }
11552
+ __name(getWranglerTmpDir, "getWranglerTmpDir");
11553
+
10184
11554
  // src/cloudflared.ts
10185
11555
  var import_command_exists = __toESM(require_command_exists2());
10186
11556
  var UPDATE_SERVICE_URL = "https://update.argotunnel.com";
@@ -10555,18 +11925,6 @@ __name(downloadCloudflared, "downloadCloudflared");
10555
11925
  async function downloadAndExtractTarball(response, expectedChecksum, binPath, cacheDir) {
10556
11926
  const tempTarPath = join(cacheDir, "cloudflared.tgz");
10557
11927
  const buffer = Buffer.from(await response.arrayBuffer());
10558
- if (expectedChecksum) {
10559
- const actualSha256 = sha256Hex(buffer);
10560
- if (actualSha256 !== expectedChecksum) {
10561
- throw new UserError(
10562
- `[cloudflared] SHA256 mismatch for downloaded cloudflared tarball.
10563
-
10564
- Expected: ${expectedChecksum}
10565
- Actual: ${actualSha256}`,
10566
- { telemetryMessage: "tunnel cloudflared tarball checksum mismatch" }
10567
- );
10568
- }
10569
- }
10570
11928
  writeFileSync(tempTarPath, buffer);
10571
11929
  try {
10572
11930
  execFileSync("tar", ["-xzf", tempTarPath, "-C", cacheDir], {
@@ -10576,6 +11934,21 @@ Actual: ${actualSha256}`,
10576
11934
  if (extractedPath !== binPath && existsSync(extractedPath)) {
10577
11935
  renameSync(extractedPath, binPath);
10578
11936
  }
11937
+ if (expectedChecksum) {
11938
+ const extractedBinary = readFileSync(binPath);
11939
+ const actualSha256 = sha256Hex(extractedBinary);
11940
+ if (actualSha256 !== expectedChecksum) {
11941
+ throw new UserError(
11942
+ `[cloudflared] SHA256 mismatch for downloaded cloudflared binary.
11943
+
11944
+ Expected: ${expectedChecksum}
11945
+ Actual: ${actualSha256}`,
11946
+ {
11947
+ telemetryMessage: "tunnel cloudflared extracted binary checksum mismatch"
11948
+ }
11949
+ );
11950
+ }
11951
+ }
10579
11952
  } finally {
10580
11953
  try {
10581
11954
  if (existsSync(tempTarPath)) {
@@ -10934,4 +12307,68 @@ The local dev server started at ${origin.href}.
10934
12307
  }
10935
12308
  __name(createTunnelStartupError, "createTunnelStartupError");
10936
12309
 
10937
- export { COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, Diagnostics, PatchConfigError, bucketFormatMessage, defaultWranglerConfig, experimental_patchConfig, friendlyBindingNames, getBindingTypeFriendlyName, getBooleanEnvironmentVariableFactory, getBrowserRenderingHeadfulFromEnv, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getC3CommandFromEnv, getCIGeneratePreviewAlias, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCfFetchEnabledFromEnv, getCfFetchPathFromEnv, getCloudflareApiBaseUrl, getCloudflareApiEnvironmentFromEnv, getCloudflareComplianceRegion, getCloudflareEnv, getCloudflareIncludeProcessEnvFromEnv, getCloudflareLoadDevVarsFromDotEnv, getCloudflaredPathFromEnv, getComplianceRegionSubdomain, getD1ExtraLocationChoices, getDisableConfigWatching, getDockerPath, getEnvironmentVariableFactory, getGlobalWranglerConfigPath, getLocalExplorerEnabledFromEnv, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTraceHeader, getWorkersCIBranchName, getWranglerCacheDirFromEnv, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, hasProperty, isDockerfile, isOptionalProperty, isPagesConfig, isRequiredProperty, isValidR2BucketName, normalizeAndValidateConfig, spawnCloudflared, startTunnel, validatePagesConfig };
12310
+ // src/update-check.ts
12311
+ var import_update_check = __toESM(require_update_check());
12312
+ var UPDATE_CHECK_TIMEOUT_MS = 3e3;
12313
+ var TIMED_OUT = Symbol("timed_out");
12314
+ async function fetchLatestNpmVersion(name, version) {
12315
+ let result = null;
12316
+ try {
12317
+ result = await Promise.race([
12318
+ (0, import_update_check.default)(
12319
+ { name, version },
12320
+ {
12321
+ distTag: version.startsWith("0.0.0") ? "beta" : "latest"
12322
+ }
12323
+ ),
12324
+ timersPromises.setTimeout(UPDATE_CHECK_TIMEOUT_MS, TIMED_OUT, {
12325
+ ref: false
12326
+ })
12327
+ ]);
12328
+ } catch {
12329
+ return { status: "failed" };
12330
+ }
12331
+ if (result === TIMED_OUT) {
12332
+ return { status: "failed" };
12333
+ }
12334
+ if (result === null) {
12335
+ return { status: "up-to-date" };
12336
+ }
12337
+ return { status: "update-available", latest: result.latest };
12338
+ }
12339
+ __name(fetchLatestNpmVersion, "fetchLatestNpmVersion");
12340
+ /*! Bundled license information:
12341
+
12342
+ deep-extend/lib/deep-extend.js:
12343
+ (*!
12344
+ * @description Recursive object extending
12345
+ * @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
12346
+ * @license MIT
12347
+ *
12348
+ * The MIT License (MIT)
12349
+ *
12350
+ * Copyright (c) 2013-2018 Viacheslav Lotsmanov
12351
+ *
12352
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
12353
+ * this software and associated documentation files (the "Software"), to deal in
12354
+ * the Software without restriction, including without limitation the rights to
12355
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
12356
+ * the Software, and to permit persons to whom the Software is furnished to do so,
12357
+ * subject to the following conditions:
12358
+ *
12359
+ * The above copyright notice and this permission notice shall be included in all
12360
+ * copies or substantial portions of the Software.
12361
+ *
12362
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12363
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
12364
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
12365
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
12366
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
12367
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12368
+ *)
12369
+
12370
+ safe-buffer/index.js:
12371
+ (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
12372
+ */
12373
+
12374
+ export { COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, Diagnostics, PatchConfigError, bucketFormatMessage, defaultWranglerConfig, experimental_patchConfig, fetchLatestNpmVersion, friendlyBindingNames, getBindingLocalSupport, getBindingTypeFriendlyName, getBooleanEnvironmentVariableFactory, getBrowserRenderingHeadfulFromEnv, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getC3CommandFromEnv, getCIGeneratePreviewAlias, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCfFetchEnabledFromEnv, getCfFetchPathFromEnv, getCloudflareApiBaseUrl, getCloudflareApiEnvironmentFromEnv, getCloudflareComplianceRegion, getCloudflareEnv, getCloudflareIncludeProcessEnvFromEnv, getCloudflareLoadDevVarsFromDotEnv, getCloudflaredPathFromEnv, getComplianceRegionSubdomain, getD1ExtraLocationChoices, getDisableConfigWatching, getDockerPath, getEnvironmentVariableFactory, getGlobalWranglerConfigPath, getLocalExplorerEnabledFromEnv, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTraceHeader, getWorkersCIBranchName, getWranglerCacheDirFromEnv, getWranglerHiddenDirPath, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, getWranglerTmpDir, hasProperty, isDockerfile, isOptionalProperty, isPagesConfig, isRequiredProperty, isValidR2BucketName, normalizeAndValidateConfig, spawnCloudflared, startTunnel, sweepStaleWranglerTmpDirs, validatePagesConfig };