@cloudflare/workers-utils 0.21.1 → 0.22.1
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/browser.d.mts +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/{chunk-BLWXWFJK.mjs → chunk-UFU4JGIG.mjs} +21 -3
- package/dist/{config-BH_2HMEf.d.mts → config-CXobNAeT.d.mts} +123 -7
- package/dist/index.d.mts +151 -9
- package/dist/index.mjs +1852 -72
- package/dist/metafile-esm.json +1 -1
- package/dist/test-helpers/index.d.mts +1 -1
- package/package.json +9 -6
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
export { assertNever, constructWranglerConfig, getTodaysCompatDate, isCompatDate, mapWorkerMetadataBindings } from './chunk-
|
|
1
|
+
export { assertNever, constructWranglerConfig, getTodaysCompatDate, isCompatDate, mapWorkerMetadataBindings } from './chunk-UFU4JGIG.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, ParseError, parseJSON, APIError, 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
|
|
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
|
-
import { fetch } from 'undici';
|
|
13
|
+
import { fetch, Headers, FormData, Response } from 'undici';
|
|
14
|
+
import { URLSearchParams } from 'node:url';
|
|
15
|
+
import * as timersPromises from 'node:timers/promises';
|
|
14
16
|
|
|
15
17
|
// ../../node_modules/.pnpm/xdg-app-paths@8.3.0/node_modules/xdg-app-paths/dist/cjs/lib/XDGAppPaths.js
|
|
16
18
|
var require_XDGAppPaths = __commonJS({
|
|
@@ -34,7 +36,7 @@ var require_XDGAppPaths = __commonJS({
|
|
|
34
36
|
}
|
|
35
37
|
__name(typeOf, "typeOf");
|
|
36
38
|
function Adapt(adapter_) {
|
|
37
|
-
var meta = adapter_.meta,
|
|
39
|
+
var meta = adapter_.meta, path5 = adapter_.path, xdg = adapter_.xdg;
|
|
38
40
|
var XDGAppPaths_ = /* @__PURE__ */ function() {
|
|
39
41
|
function XDGAppPaths_2(options_) {
|
|
40
42
|
if (options_ === void 0) {
|
|
@@ -57,7 +59,7 @@ var require_XDGAppPaths = __commonJS({
|
|
|
57
59
|
meta.mainFilename()
|
|
58
60
|
];
|
|
59
61
|
var nameFallback = "$eval";
|
|
60
|
-
var name =
|
|
62
|
+
var name = path5.parse(((_c = namePriorityList.find(function(e2) {
|
|
61
63
|
return isString2(e2);
|
|
62
64
|
})) !== null && _c !== void 0 ? _c : nameFallback) + suffix).name;
|
|
63
65
|
XDGAppPaths.$name = /* @__PURE__ */ __name(function $name() {
|
|
@@ -78,28 +80,28 @@ var require_XDGAppPaths = __commonJS({
|
|
|
78
80
|
}
|
|
79
81
|
__name(finalPathSegment, "finalPathSegment");
|
|
80
82
|
XDGAppPaths.cache = /* @__PURE__ */ __name(function cache(dirOptions) {
|
|
81
|
-
return
|
|
83
|
+
return path5.join(xdg.cache(), finalPathSegment(dirOptions));
|
|
82
84
|
}, "cache");
|
|
83
85
|
XDGAppPaths.config = /* @__PURE__ */ __name(function config(dirOptions) {
|
|
84
|
-
return
|
|
86
|
+
return path5.join(xdg.config(), finalPathSegment(dirOptions));
|
|
85
87
|
}, "config");
|
|
86
88
|
XDGAppPaths.data = /* @__PURE__ */ __name(function data(dirOptions) {
|
|
87
|
-
return
|
|
89
|
+
return path5.join(xdg.data(), finalPathSegment(dirOptions));
|
|
88
90
|
}, "data");
|
|
89
91
|
XDGAppPaths.runtime = /* @__PURE__ */ __name(function runtime(dirOptions) {
|
|
90
|
-
return xdg.runtime() ?
|
|
92
|
+
return xdg.runtime() ? path5.join(xdg.runtime(), finalPathSegment(dirOptions)) : void 0;
|
|
91
93
|
}, "runtime");
|
|
92
94
|
XDGAppPaths.state = /* @__PURE__ */ __name(function state(dirOptions) {
|
|
93
|
-
return
|
|
95
|
+
return path5.join(xdg.state(), finalPathSegment(dirOptions));
|
|
94
96
|
}, "state");
|
|
95
97
|
XDGAppPaths.configDirs = /* @__PURE__ */ __name(function configDirs(dirOptions) {
|
|
96
98
|
return xdg.configDirs().map(function(s) {
|
|
97
|
-
return
|
|
99
|
+
return path5.join(s, finalPathSegment(dirOptions));
|
|
98
100
|
});
|
|
99
101
|
}, "configDirs");
|
|
100
102
|
XDGAppPaths.dataDirs = /* @__PURE__ */ __name(function dataDirs(dirOptions) {
|
|
101
103
|
return xdg.dataDirs().map(function(s) {
|
|
102
|
-
return
|
|
104
|
+
return path5.join(s, finalPathSegment(dirOptions));
|
|
103
105
|
});
|
|
104
106
|
}, "dataDirs");
|
|
105
107
|
return XDGAppPaths;
|
|
@@ -125,7 +127,7 @@ var require_XDG = __commonJS({
|
|
|
125
127
|
exports.__esModule = true;
|
|
126
128
|
exports.Adapt = void 0;
|
|
127
129
|
function Adapt(adapter_) {
|
|
128
|
-
var env = adapter_.env, osPaths = adapter_.osPaths,
|
|
130
|
+
var env = adapter_.env, osPaths = adapter_.osPaths, path5 = adapter_.path;
|
|
129
131
|
var isMacOS = /^darwin$/i.test(adapter_.process.platform);
|
|
130
132
|
var isWinOS = /^win/i.test(adapter_.process.platform);
|
|
131
133
|
function baseDir() {
|
|
@@ -133,7 +135,7 @@ var require_XDG = __commonJS({
|
|
|
133
135
|
}
|
|
134
136
|
__name(baseDir, "baseDir");
|
|
135
137
|
function valOrPath(val, pathSegments) {
|
|
136
|
-
return val ||
|
|
138
|
+
return val || path5.join.apply(path5, pathSegments);
|
|
137
139
|
}
|
|
138
140
|
__name(valOrPath, "valOrPath");
|
|
139
141
|
var linux = /* @__PURE__ */ __name(function() {
|
|
@@ -212,11 +214,11 @@ var require_XDG = __commonJS({
|
|
|
212
214
|
XDG.state = extension.state;
|
|
213
215
|
XDG.configDirs = /* @__PURE__ */ __name(function configDirs() {
|
|
214
216
|
var pathList = env.get("XDG_CONFIG_DIRS");
|
|
215
|
-
return __spreadArray([extension.config()], pathList ? pathList.split(
|
|
217
|
+
return __spreadArray([extension.config()], pathList ? pathList.split(path5.delimiter) : []);
|
|
216
218
|
}, "configDirs");
|
|
217
219
|
XDG.dataDirs = /* @__PURE__ */ __name(function dataDirs() {
|
|
218
220
|
var pathList = env.get("XDG_DATA_DIRS");
|
|
219
|
-
return __spreadArray([extension.data()], pathList ? pathList.split(
|
|
221
|
+
return __spreadArray([extension.data()], pathList ? pathList.split(path5.delimiter) : []);
|
|
220
222
|
}, "dataDirs");
|
|
221
223
|
return XDG;
|
|
222
224
|
}
|
|
@@ -245,7 +247,7 @@ var require_OSPaths = __commonJS({
|
|
|
245
247
|
}
|
|
246
248
|
__name(isEmpty, "isEmpty");
|
|
247
249
|
function Adapt(adapter_) {
|
|
248
|
-
var env = adapter_.env, os2 = adapter_.os,
|
|
250
|
+
var env = adapter_.env, os2 = adapter_.os, path5 = adapter_.path;
|
|
249
251
|
var isWinOS = /^win/i.test(adapter_.process.platform);
|
|
250
252
|
function normalizePath(path_) {
|
|
251
253
|
return path_ ? adapter_.path.normalize(adapter_.path.join(path_, ".")) : void 0;
|
|
@@ -260,7 +262,7 @@ var require_OSPaths = __commonJS({
|
|
|
260
262
|
typeof os2.homedir === "function" ? os2.homedir() : void 0,
|
|
261
263
|
env.get("USERPROFILE"),
|
|
262
264
|
env.get("HOME"),
|
|
263
|
-
env.get("HOMEDRIVE") || env.get("HOMEPATH") ?
|
|
265
|
+
env.get("HOMEDRIVE") || env.get("HOMEPATH") ? path5.join(env.get("HOMEDRIVE") || "", env.get("HOMEPATH") || "") : void 0
|
|
264
266
|
];
|
|
265
267
|
return normalizePath(priorityList.find(function(v) {
|
|
266
268
|
return !isEmpty(v);
|
|
@@ -271,7 +273,7 @@ var require_OSPaths = __commonJS({
|
|
|
271
273
|
__name(home, "home");
|
|
272
274
|
function temp() {
|
|
273
275
|
function joinPathToBase(base, segments) {
|
|
274
|
-
return base ?
|
|
276
|
+
return base ? path5.join.apply(path5, __spreadArray([base], segments)) : void 0;
|
|
275
277
|
}
|
|
276
278
|
__name(joinPathToBase, "joinPathToBase");
|
|
277
279
|
function posix() {
|
|
@@ -376,7 +378,7 @@ var require_node = __commonJS({
|
|
|
376
378
|
exports.__esModule = true;
|
|
377
379
|
exports.adapter = void 0;
|
|
378
380
|
var os2 = __importStar(__require("os"));
|
|
379
|
-
var
|
|
381
|
+
var path5 = __importStar(__require("path"));
|
|
380
382
|
exports.adapter = {
|
|
381
383
|
atImportPermissions: { env: true },
|
|
382
384
|
env: {
|
|
@@ -385,7 +387,7 @@ var require_node = __commonJS({
|
|
|
385
387
|
}, "get")
|
|
386
388
|
},
|
|
387
389
|
os: os2,
|
|
388
|
-
path:
|
|
390
|
+
path: path5,
|
|
389
391
|
process
|
|
390
392
|
};
|
|
391
393
|
}
|
|
@@ -431,7 +433,7 @@ var require_node2 = __commonJS({
|
|
|
431
433
|
};
|
|
432
434
|
exports.__esModule = true;
|
|
433
435
|
exports.adapter = void 0;
|
|
434
|
-
var
|
|
436
|
+
var path5 = __importStar(__require("path"));
|
|
435
437
|
var os_paths_1 = __importDefault(require_mod_cjs());
|
|
436
438
|
exports.adapter = {
|
|
437
439
|
atImportPermissions: { env: true },
|
|
@@ -441,7 +443,7 @@ var require_node2 = __commonJS({
|
|
|
441
443
|
}, "get")
|
|
442
444
|
},
|
|
443
445
|
osPaths: os_paths_1["default"],
|
|
444
|
-
path:
|
|
446
|
+
path: path5,
|
|
445
447
|
process
|
|
446
448
|
};
|
|
447
449
|
}
|
|
@@ -487,7 +489,7 @@ var require_node3 = __commonJS({
|
|
|
487
489
|
};
|
|
488
490
|
exports.__esModule = true;
|
|
489
491
|
exports.adapter = void 0;
|
|
490
|
-
var
|
|
492
|
+
var path5 = __importStar(__require("path"));
|
|
491
493
|
var xdg_portable_1 = __importDefault(require_mod_cjs2());
|
|
492
494
|
exports.adapter = {
|
|
493
495
|
atImportPermissions: { env: true, read: true },
|
|
@@ -502,7 +504,7 @@ var require_node3 = __commonJS({
|
|
|
502
504
|
return process.pkg ? process.execPath : void 0;
|
|
503
505
|
}, "pkgMainFilename")
|
|
504
506
|
},
|
|
505
|
-
path:
|
|
507
|
+
path: path5,
|
|
506
508
|
process,
|
|
507
509
|
xdg: xdg_portable_1["default"]
|
|
508
510
|
};
|
|
@@ -518,16 +520,212 @@ var require_mod_cjs3 = __commonJS({
|
|
|
518
520
|
}
|
|
519
521
|
});
|
|
520
522
|
|
|
523
|
+
// ../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js
|
|
524
|
+
var require_signals = __commonJS({
|
|
525
|
+
"../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js"(exports, module) {
|
|
526
|
+
module.exports = [
|
|
527
|
+
"SIGABRT",
|
|
528
|
+
"SIGALRM",
|
|
529
|
+
"SIGHUP",
|
|
530
|
+
"SIGINT",
|
|
531
|
+
"SIGTERM"
|
|
532
|
+
];
|
|
533
|
+
if (process.platform !== "win32") {
|
|
534
|
+
module.exports.push(
|
|
535
|
+
"SIGVTALRM",
|
|
536
|
+
"SIGXCPU",
|
|
537
|
+
"SIGXFSZ",
|
|
538
|
+
"SIGUSR2",
|
|
539
|
+
"SIGTRAP",
|
|
540
|
+
"SIGSYS",
|
|
541
|
+
"SIGQUIT",
|
|
542
|
+
"SIGIOT"
|
|
543
|
+
// should detect profiler and enable/disable accordingly.
|
|
544
|
+
// see #21
|
|
545
|
+
// 'SIGPROF'
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
if (process.platform === "linux") {
|
|
549
|
+
module.exports.push(
|
|
550
|
+
"SIGIO",
|
|
551
|
+
"SIGPOLL",
|
|
552
|
+
"SIGPWR",
|
|
553
|
+
"SIGSTKFLT",
|
|
554
|
+
"SIGUNUSED"
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
// ../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js
|
|
561
|
+
var require_signal_exit = __commonJS({
|
|
562
|
+
"../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js"(exports, module) {
|
|
563
|
+
var process2 = global.process;
|
|
564
|
+
var processOk = /* @__PURE__ */ __name(function(process3) {
|
|
565
|
+
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";
|
|
566
|
+
}, "processOk");
|
|
567
|
+
if (!processOk(process2)) {
|
|
568
|
+
module.exports = function() {
|
|
569
|
+
return function() {
|
|
570
|
+
};
|
|
571
|
+
};
|
|
572
|
+
} else {
|
|
573
|
+
assert3 = __require("assert");
|
|
574
|
+
signals = require_signals();
|
|
575
|
+
isWin = /^win/i.test(process2.platform);
|
|
576
|
+
EE = __require("events");
|
|
577
|
+
if (typeof EE !== "function") {
|
|
578
|
+
EE = EE.EventEmitter;
|
|
579
|
+
}
|
|
580
|
+
if (process2.__signal_exit_emitter__) {
|
|
581
|
+
emitter = process2.__signal_exit_emitter__;
|
|
582
|
+
} else {
|
|
583
|
+
emitter = process2.__signal_exit_emitter__ = new EE();
|
|
584
|
+
emitter.count = 0;
|
|
585
|
+
emitter.emitted = {};
|
|
586
|
+
}
|
|
587
|
+
if (!emitter.infinite) {
|
|
588
|
+
emitter.setMaxListeners(Infinity);
|
|
589
|
+
emitter.infinite = true;
|
|
590
|
+
}
|
|
591
|
+
module.exports = function(cb, opts) {
|
|
592
|
+
if (!processOk(global.process)) {
|
|
593
|
+
return function() {
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
assert3.equal(typeof cb, "function", "a callback must be provided for exit handler");
|
|
597
|
+
if (loaded === false) {
|
|
598
|
+
load();
|
|
599
|
+
}
|
|
600
|
+
var ev = "exit";
|
|
601
|
+
if (opts && opts.alwaysLast) {
|
|
602
|
+
ev = "afterexit";
|
|
603
|
+
}
|
|
604
|
+
var remove = /* @__PURE__ */ __name(function() {
|
|
605
|
+
emitter.removeListener(ev, cb);
|
|
606
|
+
if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
|
|
607
|
+
unload();
|
|
608
|
+
}
|
|
609
|
+
}, "remove");
|
|
610
|
+
emitter.on(ev, cb);
|
|
611
|
+
return remove;
|
|
612
|
+
};
|
|
613
|
+
unload = /* @__PURE__ */ __name(function unload2() {
|
|
614
|
+
if (!loaded || !processOk(global.process)) {
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
loaded = false;
|
|
618
|
+
signals.forEach(function(sig) {
|
|
619
|
+
try {
|
|
620
|
+
process2.removeListener(sig, sigListeners[sig]);
|
|
621
|
+
} catch (er) {
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
process2.emit = originalProcessEmit;
|
|
625
|
+
process2.reallyExit = originalProcessReallyExit;
|
|
626
|
+
emitter.count -= 1;
|
|
627
|
+
}, "unload");
|
|
628
|
+
module.exports.unload = unload;
|
|
629
|
+
emit = /* @__PURE__ */ __name(function emit2(event, code, signal) {
|
|
630
|
+
if (emitter.emitted[event]) {
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
emitter.emitted[event] = true;
|
|
634
|
+
emitter.emit(event, code, signal);
|
|
635
|
+
}, "emit");
|
|
636
|
+
sigListeners = {};
|
|
637
|
+
signals.forEach(function(sig) {
|
|
638
|
+
sigListeners[sig] = /* @__PURE__ */ __name(function listener() {
|
|
639
|
+
if (!processOk(global.process)) {
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
var listeners = process2.listeners(sig);
|
|
643
|
+
if (listeners.length === emitter.count) {
|
|
644
|
+
unload();
|
|
645
|
+
emit("exit", null, sig);
|
|
646
|
+
emit("afterexit", null, sig);
|
|
647
|
+
if (isWin && sig === "SIGHUP") {
|
|
648
|
+
sig = "SIGINT";
|
|
649
|
+
}
|
|
650
|
+
process2.kill(process2.pid, sig);
|
|
651
|
+
}
|
|
652
|
+
}, "listener");
|
|
653
|
+
});
|
|
654
|
+
module.exports.signals = function() {
|
|
655
|
+
return signals;
|
|
656
|
+
};
|
|
657
|
+
loaded = false;
|
|
658
|
+
load = /* @__PURE__ */ __name(function load2() {
|
|
659
|
+
if (loaded || !processOk(global.process)) {
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
loaded = true;
|
|
663
|
+
emitter.count += 1;
|
|
664
|
+
signals = signals.filter(function(sig) {
|
|
665
|
+
try {
|
|
666
|
+
process2.on(sig, sigListeners[sig]);
|
|
667
|
+
return true;
|
|
668
|
+
} catch (er) {
|
|
669
|
+
return false;
|
|
670
|
+
}
|
|
671
|
+
});
|
|
672
|
+
process2.emit = processEmit;
|
|
673
|
+
process2.reallyExit = processReallyExit;
|
|
674
|
+
}, "load");
|
|
675
|
+
module.exports.load = load;
|
|
676
|
+
originalProcessReallyExit = process2.reallyExit;
|
|
677
|
+
processReallyExit = /* @__PURE__ */ __name(function processReallyExit2(code) {
|
|
678
|
+
if (!processOk(global.process)) {
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
process2.exitCode = code || /* istanbul ignore next */
|
|
682
|
+
0;
|
|
683
|
+
emit("exit", process2.exitCode, null);
|
|
684
|
+
emit("afterexit", process2.exitCode, null);
|
|
685
|
+
originalProcessReallyExit.call(process2, process2.exitCode);
|
|
686
|
+
}, "processReallyExit");
|
|
687
|
+
originalProcessEmit = process2.emit;
|
|
688
|
+
processEmit = /* @__PURE__ */ __name(function processEmit2(ev, arg) {
|
|
689
|
+
if (ev === "exit" && processOk(global.process)) {
|
|
690
|
+
if (arg !== void 0) {
|
|
691
|
+
process2.exitCode = arg;
|
|
692
|
+
}
|
|
693
|
+
var ret = originalProcessEmit.apply(this, arguments);
|
|
694
|
+
emit("exit", process2.exitCode, null);
|
|
695
|
+
emit("afterexit", process2.exitCode, null);
|
|
696
|
+
return ret;
|
|
697
|
+
} else {
|
|
698
|
+
return originalProcessEmit.apply(this, arguments);
|
|
699
|
+
}
|
|
700
|
+
}, "processEmit");
|
|
701
|
+
}
|
|
702
|
+
var assert3;
|
|
703
|
+
var signals;
|
|
704
|
+
var isWin;
|
|
705
|
+
var EE;
|
|
706
|
+
var emitter;
|
|
707
|
+
var unload;
|
|
708
|
+
var emit;
|
|
709
|
+
var sigListeners;
|
|
710
|
+
var loaded;
|
|
711
|
+
var load;
|
|
712
|
+
var originalProcessReallyExit;
|
|
713
|
+
var processReallyExit;
|
|
714
|
+
var originalProcessEmit;
|
|
715
|
+
var processEmit;
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
|
|
521
719
|
// ../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js
|
|
522
720
|
var require_command_exists = __commonJS({
|
|
523
721
|
"../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js"(exports, module) {
|
|
524
722
|
var exec = __require("child_process").exec;
|
|
525
723
|
var execSync = __require("child_process").execSync;
|
|
526
|
-
var
|
|
527
|
-
var
|
|
528
|
-
var access =
|
|
529
|
-
var accessSync2 =
|
|
530
|
-
var constants2 =
|
|
724
|
+
var fs3 = __require("fs");
|
|
725
|
+
var path5 = __require("path");
|
|
726
|
+
var access = fs3.access;
|
|
727
|
+
var accessSync2 = fs3.accessSync;
|
|
728
|
+
var constants2 = fs3.constants || fs3;
|
|
531
729
|
var isUsingWindows = process.platform == "win32";
|
|
532
730
|
var fileNotExists = /* @__PURE__ */ __name(function(commandName, callback) {
|
|
533
731
|
access(
|
|
@@ -628,8 +826,8 @@ var require_command_exists = __commonJS({
|
|
|
628
826
|
cleanInput = /* @__PURE__ */ __name(function(s) {
|
|
629
827
|
var isPathName = /[\\]/.test(s);
|
|
630
828
|
if (isPathName) {
|
|
631
|
-
var dirname2 = '"' +
|
|
632
|
-
var basename = '"' +
|
|
829
|
+
var dirname2 = '"' + path5.dirname(s) + '"';
|
|
830
|
+
var basename = '"' + path5.basename(s) + '"';
|
|
633
831
|
return dirname2 + ":" + basename;
|
|
634
832
|
}
|
|
635
833
|
return '"' + s + '"';
|
|
@@ -672,6 +870,997 @@ var require_command_exists2 = __commonJS({
|
|
|
672
870
|
}
|
|
673
871
|
});
|
|
674
872
|
|
|
873
|
+
// ../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js
|
|
874
|
+
var require_ini = __commonJS({
|
|
875
|
+
"../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js"(exports) {
|
|
876
|
+
exports.parse = exports.decode = decode;
|
|
877
|
+
exports.stringify = exports.encode = encode;
|
|
878
|
+
exports.safe = safe;
|
|
879
|
+
exports.unsafe = unsafe;
|
|
880
|
+
var eol = typeof process !== "undefined" && process.platform === "win32" ? "\r\n" : "\n";
|
|
881
|
+
function encode(obj, opt) {
|
|
882
|
+
var children = [];
|
|
883
|
+
var out = "";
|
|
884
|
+
if (typeof opt === "string") {
|
|
885
|
+
opt = {
|
|
886
|
+
section: opt,
|
|
887
|
+
whitespace: false
|
|
888
|
+
};
|
|
889
|
+
} else {
|
|
890
|
+
opt = opt || {};
|
|
891
|
+
opt.whitespace = opt.whitespace === true;
|
|
892
|
+
}
|
|
893
|
+
var separator = opt.whitespace ? " = " : "=";
|
|
894
|
+
Object.keys(obj).forEach(function(k, _2, __) {
|
|
895
|
+
var val = obj[k];
|
|
896
|
+
if (val && Array.isArray(val)) {
|
|
897
|
+
val.forEach(function(item) {
|
|
898
|
+
out += safe(k + "[]") + separator + safe(item) + "\n";
|
|
899
|
+
});
|
|
900
|
+
} else if (val && typeof val === "object")
|
|
901
|
+
children.push(k);
|
|
902
|
+
else
|
|
903
|
+
out += safe(k) + separator + safe(val) + eol;
|
|
904
|
+
});
|
|
905
|
+
if (opt.section && out.length)
|
|
906
|
+
out = "[" + safe(opt.section) + "]" + eol + out;
|
|
907
|
+
children.forEach(function(k, _2, __) {
|
|
908
|
+
var nk = dotSplit(k).join("\\.");
|
|
909
|
+
var section = (opt.section ? opt.section + "." : "") + nk;
|
|
910
|
+
var child = encode(obj[k], {
|
|
911
|
+
section,
|
|
912
|
+
whitespace: opt.whitespace
|
|
913
|
+
});
|
|
914
|
+
if (out.length && child.length)
|
|
915
|
+
out += eol;
|
|
916
|
+
out += child;
|
|
917
|
+
});
|
|
918
|
+
return out;
|
|
919
|
+
}
|
|
920
|
+
__name(encode, "encode");
|
|
921
|
+
function dotSplit(str) {
|
|
922
|
+
return str.replace(/\1/g, "LITERAL\\1LITERAL").replace(/\\\./g, "").split(/\./).map(function(part) {
|
|
923
|
+
return part.replace(/\1/g, "\\.").replace(/\2LITERAL\\1LITERAL\2/g, "");
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
__name(dotSplit, "dotSplit");
|
|
927
|
+
function decode(str) {
|
|
928
|
+
var out = {};
|
|
929
|
+
var p = out;
|
|
930
|
+
var section = null;
|
|
931
|
+
var re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i;
|
|
932
|
+
var lines = str.split(/[\r\n]+/g);
|
|
933
|
+
lines.forEach(function(line, _2, __) {
|
|
934
|
+
if (!line || line.match(/^\s*[;#]/))
|
|
935
|
+
return;
|
|
936
|
+
var match = line.match(re);
|
|
937
|
+
if (!match)
|
|
938
|
+
return;
|
|
939
|
+
if (match[1] !== void 0) {
|
|
940
|
+
section = unsafe(match[1]);
|
|
941
|
+
if (section === "__proto__") {
|
|
942
|
+
p = {};
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
p = out[section] = out[section] || {};
|
|
946
|
+
return;
|
|
947
|
+
}
|
|
948
|
+
var key = unsafe(match[2]);
|
|
949
|
+
if (key === "__proto__")
|
|
950
|
+
return;
|
|
951
|
+
var value = match[3] ? unsafe(match[4]) : true;
|
|
952
|
+
switch (value) {
|
|
953
|
+
case "true":
|
|
954
|
+
case "false":
|
|
955
|
+
case "null":
|
|
956
|
+
value = JSON.parse(value);
|
|
957
|
+
}
|
|
958
|
+
if (key.length > 2 && key.slice(-2) === "[]") {
|
|
959
|
+
key = key.substring(0, key.length - 2);
|
|
960
|
+
if (key === "__proto__")
|
|
961
|
+
return;
|
|
962
|
+
if (!p[key])
|
|
963
|
+
p[key] = [];
|
|
964
|
+
else if (!Array.isArray(p[key]))
|
|
965
|
+
p[key] = [p[key]];
|
|
966
|
+
}
|
|
967
|
+
if (Array.isArray(p[key]))
|
|
968
|
+
p[key].push(value);
|
|
969
|
+
else
|
|
970
|
+
p[key] = value;
|
|
971
|
+
});
|
|
972
|
+
Object.keys(out).filter(function(k, _2, __) {
|
|
973
|
+
if (!out[k] || typeof out[k] !== "object" || Array.isArray(out[k]))
|
|
974
|
+
return false;
|
|
975
|
+
var parts = dotSplit(k);
|
|
976
|
+
var p2 = out;
|
|
977
|
+
var l = parts.pop();
|
|
978
|
+
var nl = l.replace(/\\\./g, ".");
|
|
979
|
+
parts.forEach(function(part, _3, __2) {
|
|
980
|
+
if (part === "__proto__")
|
|
981
|
+
return;
|
|
982
|
+
if (!p2[part] || typeof p2[part] !== "object")
|
|
983
|
+
p2[part] = {};
|
|
984
|
+
p2 = p2[part];
|
|
985
|
+
});
|
|
986
|
+
if (p2 === out && nl === l)
|
|
987
|
+
return false;
|
|
988
|
+
p2[nl] = out[k];
|
|
989
|
+
return true;
|
|
990
|
+
}).forEach(function(del, _2, __) {
|
|
991
|
+
delete out[del];
|
|
992
|
+
});
|
|
993
|
+
return out;
|
|
994
|
+
}
|
|
995
|
+
__name(decode, "decode");
|
|
996
|
+
function isQuoted(val) {
|
|
997
|
+
return val.charAt(0) === '"' && val.slice(-1) === '"' || val.charAt(0) === "'" && val.slice(-1) === "'";
|
|
998
|
+
}
|
|
999
|
+
__name(isQuoted, "isQuoted");
|
|
1000
|
+
function safe(val) {
|
|
1001
|
+
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, "\\#");
|
|
1002
|
+
}
|
|
1003
|
+
__name(safe, "safe");
|
|
1004
|
+
function unsafe(val, doUnesc) {
|
|
1005
|
+
val = (val || "").trim();
|
|
1006
|
+
if (isQuoted(val)) {
|
|
1007
|
+
if (val.charAt(0) === "'")
|
|
1008
|
+
val = val.substr(1, val.length - 2);
|
|
1009
|
+
try {
|
|
1010
|
+
val = JSON.parse(val);
|
|
1011
|
+
} catch (_2) {
|
|
1012
|
+
}
|
|
1013
|
+
} else {
|
|
1014
|
+
var esc = false;
|
|
1015
|
+
var unesc = "";
|
|
1016
|
+
for (var i = 0, l = val.length; i < l; i++) {
|
|
1017
|
+
var c = val.charAt(i);
|
|
1018
|
+
if (esc) {
|
|
1019
|
+
if ("\\;#".indexOf(c) !== -1)
|
|
1020
|
+
unesc += c;
|
|
1021
|
+
else
|
|
1022
|
+
unesc += "\\" + c;
|
|
1023
|
+
esc = false;
|
|
1024
|
+
} else if (";#".indexOf(c) !== -1)
|
|
1025
|
+
break;
|
|
1026
|
+
else if (c === "\\")
|
|
1027
|
+
esc = true;
|
|
1028
|
+
else
|
|
1029
|
+
unesc += c;
|
|
1030
|
+
}
|
|
1031
|
+
if (esc)
|
|
1032
|
+
unesc += "\\";
|
|
1033
|
+
return unesc.trim();
|
|
1034
|
+
}
|
|
1035
|
+
return val;
|
|
1036
|
+
}
|
|
1037
|
+
__name(unsafe, "unsafe");
|
|
1038
|
+
}
|
|
1039
|
+
});
|
|
1040
|
+
|
|
1041
|
+
// ../../node_modules/.pnpm/strip-json-comments@2.0.1/node_modules/strip-json-comments/index.js
|
|
1042
|
+
var require_strip_json_comments = __commonJS({
|
|
1043
|
+
"../../node_modules/.pnpm/strip-json-comments@2.0.1/node_modules/strip-json-comments/index.js"(exports, module) {
|
|
1044
|
+
var singleComment = 1;
|
|
1045
|
+
var multiComment = 2;
|
|
1046
|
+
function stripWithoutWhitespace() {
|
|
1047
|
+
return "";
|
|
1048
|
+
}
|
|
1049
|
+
__name(stripWithoutWhitespace, "stripWithoutWhitespace");
|
|
1050
|
+
function stripWithWhitespace(str, start, end) {
|
|
1051
|
+
return str.slice(start, end).replace(/\S/g, " ");
|
|
1052
|
+
}
|
|
1053
|
+
__name(stripWithWhitespace, "stripWithWhitespace");
|
|
1054
|
+
module.exports = function(str, opts) {
|
|
1055
|
+
opts = opts || {};
|
|
1056
|
+
var currentChar;
|
|
1057
|
+
var nextChar;
|
|
1058
|
+
var insideString = false;
|
|
1059
|
+
var insideComment = false;
|
|
1060
|
+
var offset = 0;
|
|
1061
|
+
var ret = "";
|
|
1062
|
+
var strip = opts.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace;
|
|
1063
|
+
for (var i = 0; i < str.length; i++) {
|
|
1064
|
+
currentChar = str[i];
|
|
1065
|
+
nextChar = str[i + 1];
|
|
1066
|
+
if (!insideComment && currentChar === '"') {
|
|
1067
|
+
var escaped = str[i - 1] === "\\" && str[i - 2] !== "\\";
|
|
1068
|
+
if (!escaped) {
|
|
1069
|
+
insideString = !insideString;
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
if (insideString) {
|
|
1073
|
+
continue;
|
|
1074
|
+
}
|
|
1075
|
+
if (!insideComment && currentChar + nextChar === "//") {
|
|
1076
|
+
ret += str.slice(offset, i);
|
|
1077
|
+
offset = i;
|
|
1078
|
+
insideComment = singleComment;
|
|
1079
|
+
i++;
|
|
1080
|
+
} else if (insideComment === singleComment && currentChar + nextChar === "\r\n") {
|
|
1081
|
+
i++;
|
|
1082
|
+
insideComment = false;
|
|
1083
|
+
ret += strip(str, offset, i);
|
|
1084
|
+
offset = i;
|
|
1085
|
+
continue;
|
|
1086
|
+
} else if (insideComment === singleComment && currentChar === "\n") {
|
|
1087
|
+
insideComment = false;
|
|
1088
|
+
ret += strip(str, offset, i);
|
|
1089
|
+
offset = i;
|
|
1090
|
+
} else if (!insideComment && currentChar + nextChar === "/*") {
|
|
1091
|
+
ret += str.slice(offset, i);
|
|
1092
|
+
offset = i;
|
|
1093
|
+
insideComment = multiComment;
|
|
1094
|
+
i++;
|
|
1095
|
+
continue;
|
|
1096
|
+
} else if (insideComment === multiComment && currentChar + nextChar === "*/") {
|
|
1097
|
+
i++;
|
|
1098
|
+
insideComment = false;
|
|
1099
|
+
ret += strip(str, offset, i + 1);
|
|
1100
|
+
offset = i + 1;
|
|
1101
|
+
continue;
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset));
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
});
|
|
1108
|
+
|
|
1109
|
+
// ../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js
|
|
1110
|
+
var require_utils = __commonJS({
|
|
1111
|
+
"../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports) {
|
|
1112
|
+
var fs3 = __require("fs");
|
|
1113
|
+
var ini = require_ini();
|
|
1114
|
+
var path5 = __require("path");
|
|
1115
|
+
var stripJsonComments = require_strip_json_comments();
|
|
1116
|
+
var parse = exports.parse = function(content) {
|
|
1117
|
+
if (/^\s*{/.test(content))
|
|
1118
|
+
return JSON.parse(stripJsonComments(content));
|
|
1119
|
+
return ini.parse(content);
|
|
1120
|
+
};
|
|
1121
|
+
var file = exports.file = function() {
|
|
1122
|
+
var args = [].slice.call(arguments).filter(function(arg) {
|
|
1123
|
+
return arg != null;
|
|
1124
|
+
});
|
|
1125
|
+
for (var i in args)
|
|
1126
|
+
if ("string" !== typeof args[i])
|
|
1127
|
+
return;
|
|
1128
|
+
var file2 = path5.join.apply(null, args);
|
|
1129
|
+
try {
|
|
1130
|
+
return fs3.readFileSync(file2, "utf-8");
|
|
1131
|
+
} catch (err) {
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
};
|
|
1135
|
+
exports.json = function() {
|
|
1136
|
+
var content = file.apply(null, arguments);
|
|
1137
|
+
return content ? parse(content) : null;
|
|
1138
|
+
};
|
|
1139
|
+
exports.env = function(prefix, env2) {
|
|
1140
|
+
env2 = env2 || process.env;
|
|
1141
|
+
var obj = {};
|
|
1142
|
+
var l = prefix.length;
|
|
1143
|
+
for (var k in env2) {
|
|
1144
|
+
if (k.toLowerCase().indexOf(prefix.toLowerCase()) === 0) {
|
|
1145
|
+
var keypath = k.substring(l).split("__");
|
|
1146
|
+
var _emptyStringIndex;
|
|
1147
|
+
while ((_emptyStringIndex = keypath.indexOf("")) > -1) {
|
|
1148
|
+
keypath.splice(_emptyStringIndex, 1);
|
|
1149
|
+
}
|
|
1150
|
+
var cursor = obj;
|
|
1151
|
+
keypath.forEach(/* @__PURE__ */ __name(function _buildSubObj(_subkey, i) {
|
|
1152
|
+
if (!_subkey || typeof cursor !== "object")
|
|
1153
|
+
return;
|
|
1154
|
+
if (i === keypath.length - 1)
|
|
1155
|
+
cursor[_subkey] = env2[k];
|
|
1156
|
+
if (cursor[_subkey] === void 0)
|
|
1157
|
+
cursor[_subkey] = {};
|
|
1158
|
+
cursor = cursor[_subkey];
|
|
1159
|
+
}, "_buildSubObj"));
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
return obj;
|
|
1163
|
+
};
|
|
1164
|
+
exports.find = function() {
|
|
1165
|
+
var rel = path5.join.apply(null, [].slice.call(arguments));
|
|
1166
|
+
function find2(start, rel2) {
|
|
1167
|
+
var file2 = path5.join(start, rel2);
|
|
1168
|
+
try {
|
|
1169
|
+
fs3.statSync(file2);
|
|
1170
|
+
return file2;
|
|
1171
|
+
} catch (err) {
|
|
1172
|
+
if (path5.dirname(start) !== start)
|
|
1173
|
+
return find2(path5.dirname(start), rel2);
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
__name(find2, "find");
|
|
1177
|
+
return find2(process.cwd(), rel);
|
|
1178
|
+
};
|
|
1179
|
+
}
|
|
1180
|
+
});
|
|
1181
|
+
|
|
1182
|
+
// ../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js
|
|
1183
|
+
var require_deep_extend = __commonJS({
|
|
1184
|
+
"../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js"(exports, module) {
|
|
1185
|
+
function isSpecificValue(val) {
|
|
1186
|
+
return val instanceof Buffer || val instanceof Date || val instanceof RegExp ? true : false;
|
|
1187
|
+
}
|
|
1188
|
+
__name(isSpecificValue, "isSpecificValue");
|
|
1189
|
+
function cloneSpecificValue(val) {
|
|
1190
|
+
if (val instanceof Buffer) {
|
|
1191
|
+
var x = Buffer.alloc ? Buffer.alloc(val.length) : new Buffer(val.length);
|
|
1192
|
+
val.copy(x);
|
|
1193
|
+
return x;
|
|
1194
|
+
} else if (val instanceof Date) {
|
|
1195
|
+
return new Date(val.getTime());
|
|
1196
|
+
} else if (val instanceof RegExp) {
|
|
1197
|
+
return new RegExp(val);
|
|
1198
|
+
} else {
|
|
1199
|
+
throw new Error("Unexpected situation");
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
__name(cloneSpecificValue, "cloneSpecificValue");
|
|
1203
|
+
function deepCloneArray(arr) {
|
|
1204
|
+
var clone = [];
|
|
1205
|
+
arr.forEach(function(item, index) {
|
|
1206
|
+
if (typeof item === "object" && item !== null) {
|
|
1207
|
+
if (Array.isArray(item)) {
|
|
1208
|
+
clone[index] = deepCloneArray(item);
|
|
1209
|
+
} else if (isSpecificValue(item)) {
|
|
1210
|
+
clone[index] = cloneSpecificValue(item);
|
|
1211
|
+
} else {
|
|
1212
|
+
clone[index] = deepExtend({}, item);
|
|
1213
|
+
}
|
|
1214
|
+
} else {
|
|
1215
|
+
clone[index] = item;
|
|
1216
|
+
}
|
|
1217
|
+
});
|
|
1218
|
+
return clone;
|
|
1219
|
+
}
|
|
1220
|
+
__name(deepCloneArray, "deepCloneArray");
|
|
1221
|
+
function safeGetProperty(object, property) {
|
|
1222
|
+
return property === "__proto__" ? void 0 : object[property];
|
|
1223
|
+
}
|
|
1224
|
+
__name(safeGetProperty, "safeGetProperty");
|
|
1225
|
+
var deepExtend = module.exports = function() {
|
|
1226
|
+
if (arguments.length < 1 || typeof arguments[0] !== "object") {
|
|
1227
|
+
return false;
|
|
1228
|
+
}
|
|
1229
|
+
if (arguments.length < 2) {
|
|
1230
|
+
return arguments[0];
|
|
1231
|
+
}
|
|
1232
|
+
var target = arguments[0];
|
|
1233
|
+
var args = Array.prototype.slice.call(arguments, 1);
|
|
1234
|
+
var val, src;
|
|
1235
|
+
args.forEach(function(obj) {
|
|
1236
|
+
if (typeof obj !== "object" || obj === null || Array.isArray(obj)) {
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
Object.keys(obj).forEach(function(key) {
|
|
1240
|
+
src = safeGetProperty(target, key);
|
|
1241
|
+
val = safeGetProperty(obj, key);
|
|
1242
|
+
if (val === target) {
|
|
1243
|
+
return;
|
|
1244
|
+
} else if (typeof val !== "object" || val === null) {
|
|
1245
|
+
target[key] = val;
|
|
1246
|
+
return;
|
|
1247
|
+
} else if (Array.isArray(val)) {
|
|
1248
|
+
target[key] = deepCloneArray(val);
|
|
1249
|
+
return;
|
|
1250
|
+
} else if (isSpecificValue(val)) {
|
|
1251
|
+
target[key] = cloneSpecificValue(val);
|
|
1252
|
+
return;
|
|
1253
|
+
} else if (typeof src !== "object" || src === null || Array.isArray(src)) {
|
|
1254
|
+
target[key] = deepExtend({}, val);
|
|
1255
|
+
return;
|
|
1256
|
+
} else {
|
|
1257
|
+
target[key] = deepExtend(src, val);
|
|
1258
|
+
return;
|
|
1259
|
+
}
|
|
1260
|
+
});
|
|
1261
|
+
});
|
|
1262
|
+
return target;
|
|
1263
|
+
};
|
|
1264
|
+
}
|
|
1265
|
+
});
|
|
1266
|
+
|
|
1267
|
+
// ../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js
|
|
1268
|
+
var require_minimist = __commonJS({
|
|
1269
|
+
"../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js"(exports, module) {
|
|
1270
|
+
module.exports = function(args, opts) {
|
|
1271
|
+
if (!opts) opts = {};
|
|
1272
|
+
var flags = { bools: {}, strings: {}, unknownFn: null };
|
|
1273
|
+
if (typeof opts["unknown"] === "function") {
|
|
1274
|
+
flags.unknownFn = opts["unknown"];
|
|
1275
|
+
}
|
|
1276
|
+
if (typeof opts["boolean"] === "boolean" && opts["boolean"]) {
|
|
1277
|
+
flags.allBools = true;
|
|
1278
|
+
} else {
|
|
1279
|
+
[].concat(opts["boolean"]).filter(Boolean).forEach(function(key2) {
|
|
1280
|
+
flags.bools[key2] = true;
|
|
1281
|
+
});
|
|
1282
|
+
}
|
|
1283
|
+
var aliases = {};
|
|
1284
|
+
Object.keys(opts.alias || {}).forEach(function(key2) {
|
|
1285
|
+
aliases[key2] = [].concat(opts.alias[key2]);
|
|
1286
|
+
aliases[key2].forEach(function(x) {
|
|
1287
|
+
aliases[x] = [key2].concat(aliases[key2].filter(function(y) {
|
|
1288
|
+
return x !== y;
|
|
1289
|
+
}));
|
|
1290
|
+
});
|
|
1291
|
+
});
|
|
1292
|
+
[].concat(opts.string).filter(Boolean).forEach(function(key2) {
|
|
1293
|
+
flags.strings[key2] = true;
|
|
1294
|
+
if (aliases[key2]) {
|
|
1295
|
+
flags.strings[aliases[key2]] = true;
|
|
1296
|
+
}
|
|
1297
|
+
});
|
|
1298
|
+
var defaults = opts["default"] || {};
|
|
1299
|
+
var argv = { _: [] };
|
|
1300
|
+
Object.keys(flags.bools).forEach(function(key2) {
|
|
1301
|
+
setArg(key2, defaults[key2] === void 0 ? false : defaults[key2]);
|
|
1302
|
+
});
|
|
1303
|
+
var notFlags = [];
|
|
1304
|
+
if (args.indexOf("--") !== -1) {
|
|
1305
|
+
notFlags = args.slice(args.indexOf("--") + 1);
|
|
1306
|
+
args = args.slice(0, args.indexOf("--"));
|
|
1307
|
+
}
|
|
1308
|
+
function argDefined(key2, arg2) {
|
|
1309
|
+
return flags.allBools && /^--[^=]+$/.test(arg2) || flags.strings[key2] || flags.bools[key2] || aliases[key2];
|
|
1310
|
+
}
|
|
1311
|
+
__name(argDefined, "argDefined");
|
|
1312
|
+
function setArg(key2, val, arg2) {
|
|
1313
|
+
if (arg2 && flags.unknownFn && !argDefined(key2, arg2)) {
|
|
1314
|
+
if (flags.unknownFn(arg2) === false) return;
|
|
1315
|
+
}
|
|
1316
|
+
var value2 = !flags.strings[key2] && isNumber(val) ? Number(val) : val;
|
|
1317
|
+
setKey(argv, key2.split("."), value2);
|
|
1318
|
+
(aliases[key2] || []).forEach(function(x) {
|
|
1319
|
+
setKey(argv, x.split("."), value2);
|
|
1320
|
+
});
|
|
1321
|
+
}
|
|
1322
|
+
__name(setArg, "setArg");
|
|
1323
|
+
function setKey(obj, keys, value2) {
|
|
1324
|
+
var o = obj;
|
|
1325
|
+
for (var i2 = 0; i2 < keys.length - 1; i2++) {
|
|
1326
|
+
var key2 = keys[i2];
|
|
1327
|
+
if (isConstructorOrProto(o, key2)) return;
|
|
1328
|
+
if (o[key2] === void 0) o[key2] = {};
|
|
1329
|
+
if (o[key2] === Object.prototype || o[key2] === Number.prototype || o[key2] === String.prototype) o[key2] = {};
|
|
1330
|
+
if (o[key2] === Array.prototype) o[key2] = [];
|
|
1331
|
+
o = o[key2];
|
|
1332
|
+
}
|
|
1333
|
+
var key2 = keys[keys.length - 1];
|
|
1334
|
+
if (isConstructorOrProto(o, key2)) return;
|
|
1335
|
+
if (o === Object.prototype || o === Number.prototype || o === String.prototype) o = {};
|
|
1336
|
+
if (o === Array.prototype) o = [];
|
|
1337
|
+
if (o[key2] === void 0 || flags.bools[key2] || typeof o[key2] === "boolean") {
|
|
1338
|
+
o[key2] = value2;
|
|
1339
|
+
} else if (Array.isArray(o[key2])) {
|
|
1340
|
+
o[key2].push(value2);
|
|
1341
|
+
} else {
|
|
1342
|
+
o[key2] = [o[key2], value2];
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
__name(setKey, "setKey");
|
|
1346
|
+
function aliasIsBoolean(key2) {
|
|
1347
|
+
return aliases[key2].some(function(x) {
|
|
1348
|
+
return flags.bools[x];
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
__name(aliasIsBoolean, "aliasIsBoolean");
|
|
1352
|
+
for (var i = 0; i < args.length; i++) {
|
|
1353
|
+
var arg = args[i];
|
|
1354
|
+
if (/^--.+=/.test(arg)) {
|
|
1355
|
+
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
|
|
1356
|
+
var key = m[1];
|
|
1357
|
+
var value = m[2];
|
|
1358
|
+
if (flags.bools[key]) {
|
|
1359
|
+
value = value !== "false";
|
|
1360
|
+
}
|
|
1361
|
+
setArg(key, value, arg);
|
|
1362
|
+
} else if (/^--no-.+/.test(arg)) {
|
|
1363
|
+
var key = arg.match(/^--no-(.+)/)[1];
|
|
1364
|
+
setArg(key, false, arg);
|
|
1365
|
+
} else if (/^--.+/.test(arg)) {
|
|
1366
|
+
var key = arg.match(/^--(.+)/)[1];
|
|
1367
|
+
var next = args[i + 1];
|
|
1368
|
+
if (next !== void 0 && !/^-/.test(next) && !flags.bools[key] && !flags.allBools && (aliases[key] ? !aliasIsBoolean(key) : true)) {
|
|
1369
|
+
setArg(key, next, arg);
|
|
1370
|
+
i++;
|
|
1371
|
+
} else if (/^(true|false)$/.test(next)) {
|
|
1372
|
+
setArg(key, next === "true", arg);
|
|
1373
|
+
i++;
|
|
1374
|
+
} else {
|
|
1375
|
+
setArg(key, flags.strings[key] ? "" : true, arg);
|
|
1376
|
+
}
|
|
1377
|
+
} else if (/^-[^-]+/.test(arg)) {
|
|
1378
|
+
var letters = arg.slice(1, -1).split("");
|
|
1379
|
+
var broken = false;
|
|
1380
|
+
for (var j = 0; j < letters.length; j++) {
|
|
1381
|
+
var next = arg.slice(j + 2);
|
|
1382
|
+
if (next === "-") {
|
|
1383
|
+
setArg(letters[j], next, arg);
|
|
1384
|
+
continue;
|
|
1385
|
+
}
|
|
1386
|
+
if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
|
|
1387
|
+
setArg(letters[j], next.split("=")[1], arg);
|
|
1388
|
+
broken = true;
|
|
1389
|
+
break;
|
|
1390
|
+
}
|
|
1391
|
+
if (/[A-Za-z]/.test(letters[j]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
|
|
1392
|
+
setArg(letters[j], next, arg);
|
|
1393
|
+
broken = true;
|
|
1394
|
+
break;
|
|
1395
|
+
}
|
|
1396
|
+
if (letters[j + 1] && letters[j + 1].match(/\W/)) {
|
|
1397
|
+
setArg(letters[j], arg.slice(j + 2), arg);
|
|
1398
|
+
broken = true;
|
|
1399
|
+
break;
|
|
1400
|
+
} else {
|
|
1401
|
+
setArg(letters[j], flags.strings[letters[j]] ? "" : true, arg);
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
var key = arg.slice(-1)[0];
|
|
1405
|
+
if (!broken && key !== "-") {
|
|
1406
|
+
if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) && !flags.bools[key] && (aliases[key] ? !aliasIsBoolean(key) : true)) {
|
|
1407
|
+
setArg(key, args[i + 1], arg);
|
|
1408
|
+
i++;
|
|
1409
|
+
} else if (args[i + 1] && /^(true|false)$/.test(args[i + 1])) {
|
|
1410
|
+
setArg(key, args[i + 1] === "true", arg);
|
|
1411
|
+
i++;
|
|
1412
|
+
} else {
|
|
1413
|
+
setArg(key, flags.strings[key] ? "" : true, arg);
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
} else {
|
|
1417
|
+
if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
|
|
1418
|
+
argv._.push(
|
|
1419
|
+
flags.strings["_"] || !isNumber(arg) ? arg : Number(arg)
|
|
1420
|
+
);
|
|
1421
|
+
}
|
|
1422
|
+
if (opts.stopEarly) {
|
|
1423
|
+
argv._.push.apply(argv._, args.slice(i + 1));
|
|
1424
|
+
break;
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
Object.keys(defaults).forEach(function(key2) {
|
|
1429
|
+
if (!hasKey(argv, key2.split("."))) {
|
|
1430
|
+
setKey(argv, key2.split("."), defaults[key2]);
|
|
1431
|
+
(aliases[key2] || []).forEach(function(x) {
|
|
1432
|
+
setKey(argv, x.split("."), defaults[key2]);
|
|
1433
|
+
});
|
|
1434
|
+
}
|
|
1435
|
+
});
|
|
1436
|
+
if (opts["--"]) {
|
|
1437
|
+
argv["--"] = new Array();
|
|
1438
|
+
notFlags.forEach(function(key2) {
|
|
1439
|
+
argv["--"].push(key2);
|
|
1440
|
+
});
|
|
1441
|
+
} else {
|
|
1442
|
+
notFlags.forEach(function(key2) {
|
|
1443
|
+
argv._.push(key2);
|
|
1444
|
+
});
|
|
1445
|
+
}
|
|
1446
|
+
return argv;
|
|
1447
|
+
};
|
|
1448
|
+
function hasKey(obj, keys) {
|
|
1449
|
+
var o = obj;
|
|
1450
|
+
keys.slice(0, -1).forEach(function(key2) {
|
|
1451
|
+
o = o[key2] || {};
|
|
1452
|
+
});
|
|
1453
|
+
var key = keys[keys.length - 1];
|
|
1454
|
+
return key in o;
|
|
1455
|
+
}
|
|
1456
|
+
__name(hasKey, "hasKey");
|
|
1457
|
+
function isNumber(x) {
|
|
1458
|
+
if (typeof x === "number") return true;
|
|
1459
|
+
if (/^0x[0-9a-f]+$/i.test(x)) return true;
|
|
1460
|
+
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
|
|
1461
|
+
}
|
|
1462
|
+
__name(isNumber, "isNumber");
|
|
1463
|
+
function isConstructorOrProto(obj, key) {
|
|
1464
|
+
return key === "constructor" && typeof obj[key] === "function" || key === "__proto__";
|
|
1465
|
+
}
|
|
1466
|
+
__name(isConstructorOrProto, "isConstructorOrProto");
|
|
1467
|
+
}
|
|
1468
|
+
});
|
|
1469
|
+
|
|
1470
|
+
// ../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js
|
|
1471
|
+
var require_rc = __commonJS({
|
|
1472
|
+
"../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js"(exports, module) {
|
|
1473
|
+
var cc = require_utils();
|
|
1474
|
+
var join2 = __require("path").join;
|
|
1475
|
+
var deepExtend = require_deep_extend();
|
|
1476
|
+
var etc = "/etc";
|
|
1477
|
+
var win = process.platform === "win32";
|
|
1478
|
+
var home = win ? process.env.USERPROFILE : process.env.HOME;
|
|
1479
|
+
module.exports = function(name, defaults, argv, parse) {
|
|
1480
|
+
if ("string" !== typeof name)
|
|
1481
|
+
throw new Error("rc(name): name *must* be string");
|
|
1482
|
+
if (!argv)
|
|
1483
|
+
argv = require_minimist()(process.argv.slice(2));
|
|
1484
|
+
defaults = ("string" === typeof defaults ? cc.json(defaults) : defaults) || {};
|
|
1485
|
+
parse = parse || cc.parse;
|
|
1486
|
+
var env = cc.env(name + "_");
|
|
1487
|
+
var configs = [defaults];
|
|
1488
|
+
var configFiles = [];
|
|
1489
|
+
function addConfigFile(file) {
|
|
1490
|
+
if (configFiles.indexOf(file) >= 0) return;
|
|
1491
|
+
var fileConfig = cc.file(file);
|
|
1492
|
+
if (fileConfig) {
|
|
1493
|
+
configs.push(parse(fileConfig));
|
|
1494
|
+
configFiles.push(file);
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
__name(addConfigFile, "addConfigFile");
|
|
1498
|
+
if (!win)
|
|
1499
|
+
[
|
|
1500
|
+
join2(etc, name, "config"),
|
|
1501
|
+
join2(etc, name + "rc")
|
|
1502
|
+
].forEach(addConfigFile);
|
|
1503
|
+
if (home)
|
|
1504
|
+
[
|
|
1505
|
+
join2(home, ".config", name, "config"),
|
|
1506
|
+
join2(home, ".config", name),
|
|
1507
|
+
join2(home, "." + name, "config"),
|
|
1508
|
+
join2(home, "." + name + "rc")
|
|
1509
|
+
].forEach(addConfigFile);
|
|
1510
|
+
addConfigFile(cc.find("." + name + "rc"));
|
|
1511
|
+
if (env.config) addConfigFile(env.config);
|
|
1512
|
+
if (argv.config) addConfigFile(argv.config);
|
|
1513
|
+
return deepExtend.apply(null, configs.concat([
|
|
1514
|
+
env,
|
|
1515
|
+
argv,
|
|
1516
|
+
configFiles.length ? { configs: configFiles, config: configFiles[configFiles.length - 1] } : void 0
|
|
1517
|
+
]));
|
|
1518
|
+
};
|
|
1519
|
+
}
|
|
1520
|
+
});
|
|
1521
|
+
|
|
1522
|
+
// ../../node_modules/.pnpm/registry-url@3.1.0/node_modules/registry-url/index.js
|
|
1523
|
+
var require_registry_url = __commonJS({
|
|
1524
|
+
"../../node_modules/.pnpm/registry-url@3.1.0/node_modules/registry-url/index.js"(exports, module) {
|
|
1525
|
+
module.exports = function(scope) {
|
|
1526
|
+
var rc = require_rc()("npm", { registry: "https://registry.npmjs.org/" });
|
|
1527
|
+
var url = rc[scope + ":registry"] || rc.registry;
|
|
1528
|
+
return url.slice(-1) === "/" ? url : url + "/";
|
|
1529
|
+
};
|
|
1530
|
+
}
|
|
1531
|
+
});
|
|
1532
|
+
|
|
1533
|
+
// ../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js
|
|
1534
|
+
var require_safe_buffer = __commonJS({
|
|
1535
|
+
"../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js"(exports, module) {
|
|
1536
|
+
var buffer = __require("buffer");
|
|
1537
|
+
var Buffer2 = buffer.Buffer;
|
|
1538
|
+
function copyProps(src, dst) {
|
|
1539
|
+
for (var key in src) {
|
|
1540
|
+
dst[key] = src[key];
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
__name(copyProps, "copyProps");
|
|
1544
|
+
if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
|
|
1545
|
+
module.exports = buffer;
|
|
1546
|
+
} else {
|
|
1547
|
+
copyProps(buffer, exports);
|
|
1548
|
+
exports.Buffer = SafeBuffer;
|
|
1549
|
+
}
|
|
1550
|
+
function SafeBuffer(arg, encodingOrOffset, length) {
|
|
1551
|
+
return Buffer2(arg, encodingOrOffset, length);
|
|
1552
|
+
}
|
|
1553
|
+
__name(SafeBuffer, "SafeBuffer");
|
|
1554
|
+
SafeBuffer.prototype = Object.create(Buffer2.prototype);
|
|
1555
|
+
copyProps(Buffer2, SafeBuffer);
|
|
1556
|
+
SafeBuffer.from = function(arg, encodingOrOffset, length) {
|
|
1557
|
+
if (typeof arg === "number") {
|
|
1558
|
+
throw new TypeError("Argument must not be a number");
|
|
1559
|
+
}
|
|
1560
|
+
return Buffer2(arg, encodingOrOffset, length);
|
|
1561
|
+
};
|
|
1562
|
+
SafeBuffer.alloc = function(size, fill, encoding) {
|
|
1563
|
+
if (typeof size !== "number") {
|
|
1564
|
+
throw new TypeError("Argument must be a number");
|
|
1565
|
+
}
|
|
1566
|
+
var buf = Buffer2(size);
|
|
1567
|
+
if (fill !== void 0) {
|
|
1568
|
+
if (typeof encoding === "string") {
|
|
1569
|
+
buf.fill(fill, encoding);
|
|
1570
|
+
} else {
|
|
1571
|
+
buf.fill(fill);
|
|
1572
|
+
}
|
|
1573
|
+
} else {
|
|
1574
|
+
buf.fill(0);
|
|
1575
|
+
}
|
|
1576
|
+
return buf;
|
|
1577
|
+
};
|
|
1578
|
+
SafeBuffer.allocUnsafe = function(size) {
|
|
1579
|
+
if (typeof size !== "number") {
|
|
1580
|
+
throw new TypeError("Argument must be a number");
|
|
1581
|
+
}
|
|
1582
|
+
return Buffer2(size);
|
|
1583
|
+
};
|
|
1584
|
+
SafeBuffer.allocUnsafeSlow = function(size) {
|
|
1585
|
+
if (typeof size !== "number") {
|
|
1586
|
+
throw new TypeError("Argument must be a number");
|
|
1587
|
+
}
|
|
1588
|
+
return buffer.SlowBuffer(size);
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1591
|
+
});
|
|
1592
|
+
|
|
1593
|
+
// ../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/base64.js
|
|
1594
|
+
var require_base64 = __commonJS({
|
|
1595
|
+
"../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/base64.js"(exports, module) {
|
|
1596
|
+
var safeBuffer = require_safe_buffer().Buffer;
|
|
1597
|
+
function decodeBase64(base64) {
|
|
1598
|
+
return safeBuffer.from(base64, "base64").toString("utf8");
|
|
1599
|
+
}
|
|
1600
|
+
__name(decodeBase64, "decodeBase64");
|
|
1601
|
+
function encodeBase64(string) {
|
|
1602
|
+
return safeBuffer.from(string, "utf8").toString("base64");
|
|
1603
|
+
}
|
|
1604
|
+
__name(encodeBase64, "encodeBase64");
|
|
1605
|
+
module.exports = {
|
|
1606
|
+
decodeBase64,
|
|
1607
|
+
encodeBase64
|
|
1608
|
+
};
|
|
1609
|
+
}
|
|
1610
|
+
});
|
|
1611
|
+
|
|
1612
|
+
// ../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/index.js
|
|
1613
|
+
var require_registry_auth_token = __commonJS({
|
|
1614
|
+
"../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/index.js"(exports, module) {
|
|
1615
|
+
var url = __require("url");
|
|
1616
|
+
var base64 = require_base64();
|
|
1617
|
+
var decodeBase64 = base64.decodeBase64;
|
|
1618
|
+
var encodeBase64 = base64.encodeBase64;
|
|
1619
|
+
var tokenKey = ":_authToken";
|
|
1620
|
+
var userKey = ":username";
|
|
1621
|
+
var passwordKey = ":_password";
|
|
1622
|
+
module.exports = function() {
|
|
1623
|
+
var checkUrl;
|
|
1624
|
+
var options;
|
|
1625
|
+
if (arguments.length >= 2) {
|
|
1626
|
+
checkUrl = arguments[0];
|
|
1627
|
+
options = arguments[1];
|
|
1628
|
+
} else if (typeof arguments[0] === "string") {
|
|
1629
|
+
checkUrl = arguments[0];
|
|
1630
|
+
} else {
|
|
1631
|
+
options = arguments[0];
|
|
1632
|
+
}
|
|
1633
|
+
options = options || {};
|
|
1634
|
+
options.npmrc = options.npmrc || require_rc()("npm", { registry: "https://registry.npmjs.org/" });
|
|
1635
|
+
checkUrl = checkUrl || options.npmrc.registry;
|
|
1636
|
+
return getRegistryAuthInfo(checkUrl, options) || getLegacyAuthInfo(options.npmrc);
|
|
1637
|
+
};
|
|
1638
|
+
function getRegistryAuthInfo(checkUrl, options) {
|
|
1639
|
+
var parsed = url.parse(checkUrl, false, true);
|
|
1640
|
+
var pathname;
|
|
1641
|
+
while (pathname !== "/" && parsed.pathname !== pathname) {
|
|
1642
|
+
pathname = parsed.pathname || "/";
|
|
1643
|
+
var regUrl = "//" + parsed.host + pathname.replace(/\/$/, "");
|
|
1644
|
+
var authInfo = getAuthInfoForUrl(regUrl, options.npmrc);
|
|
1645
|
+
if (authInfo) {
|
|
1646
|
+
return authInfo;
|
|
1647
|
+
}
|
|
1648
|
+
if (!options.recursive) {
|
|
1649
|
+
return /\/$/.test(checkUrl) ? void 0 : getRegistryAuthInfo(url.resolve(checkUrl, "."), options);
|
|
1650
|
+
}
|
|
1651
|
+
parsed.pathname = url.resolve(normalizePath(pathname), "..") || "/";
|
|
1652
|
+
}
|
|
1653
|
+
return void 0;
|
|
1654
|
+
}
|
|
1655
|
+
__name(getRegistryAuthInfo, "getRegistryAuthInfo");
|
|
1656
|
+
function getLegacyAuthInfo(npmrc) {
|
|
1657
|
+
if (npmrc._auth) {
|
|
1658
|
+
return { token: npmrc._auth, type: "Basic" };
|
|
1659
|
+
}
|
|
1660
|
+
return void 0;
|
|
1661
|
+
}
|
|
1662
|
+
__name(getLegacyAuthInfo, "getLegacyAuthInfo");
|
|
1663
|
+
function normalizePath(path5) {
|
|
1664
|
+
return path5[path5.length - 1] === "/" ? path5 : path5 + "/";
|
|
1665
|
+
}
|
|
1666
|
+
__name(normalizePath, "normalizePath");
|
|
1667
|
+
function getAuthInfoForUrl(regUrl, npmrc) {
|
|
1668
|
+
var bearerAuth = getBearerToken(npmrc[regUrl + tokenKey] || npmrc[regUrl + "/" + tokenKey]);
|
|
1669
|
+
if (bearerAuth) {
|
|
1670
|
+
return bearerAuth;
|
|
1671
|
+
}
|
|
1672
|
+
var username = npmrc[regUrl + userKey] || npmrc[regUrl + "/" + userKey];
|
|
1673
|
+
var password = npmrc[regUrl + passwordKey] || npmrc[regUrl + "/" + passwordKey];
|
|
1674
|
+
var basicAuth = getTokenForUsernameAndPassword(username, password);
|
|
1675
|
+
if (basicAuth) {
|
|
1676
|
+
return basicAuth;
|
|
1677
|
+
}
|
|
1678
|
+
return void 0;
|
|
1679
|
+
}
|
|
1680
|
+
__name(getAuthInfoForUrl, "getAuthInfoForUrl");
|
|
1681
|
+
function getBearerToken(tok) {
|
|
1682
|
+
if (!tok) {
|
|
1683
|
+
return void 0;
|
|
1684
|
+
}
|
|
1685
|
+
var token = tok.replace(/^\$\{?([^}]*)\}?$/, function(fullMatch, envVar) {
|
|
1686
|
+
return process.env[envVar];
|
|
1687
|
+
});
|
|
1688
|
+
return { token, type: "Bearer" };
|
|
1689
|
+
}
|
|
1690
|
+
__name(getBearerToken, "getBearerToken");
|
|
1691
|
+
function getTokenForUsernameAndPassword(username, password) {
|
|
1692
|
+
if (!username || !password) {
|
|
1693
|
+
return void 0;
|
|
1694
|
+
}
|
|
1695
|
+
var pass = decodeBase64(password.replace(/^\$\{?([^}]*)\}?$/, function(fullMatch, envVar) {
|
|
1696
|
+
return process.env[envVar];
|
|
1697
|
+
}));
|
|
1698
|
+
var token = encodeBase64(username + ":" + pass);
|
|
1699
|
+
return {
|
|
1700
|
+
token,
|
|
1701
|
+
type: "Basic",
|
|
1702
|
+
password: pass,
|
|
1703
|
+
username
|
|
1704
|
+
};
|
|
1705
|
+
}
|
|
1706
|
+
__name(getTokenForUsernameAndPassword, "getTokenForUsernameAndPassword");
|
|
1707
|
+
}
|
|
1708
|
+
});
|
|
1709
|
+
|
|
1710
|
+
// ../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js
|
|
1711
|
+
var require_update_check = __commonJS({
|
|
1712
|
+
"../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js"(exports, module) {
|
|
1713
|
+
var { URL: URL2 } = __require("url");
|
|
1714
|
+
var { join: join2 } = __require("path");
|
|
1715
|
+
var fs3 = __require("fs");
|
|
1716
|
+
var { promisify } = __require("util");
|
|
1717
|
+
var { tmpdir } = __require("os");
|
|
1718
|
+
var registryUrl = require_registry_url();
|
|
1719
|
+
var writeFile = promisify(fs3.writeFile);
|
|
1720
|
+
var mkdir = promisify(fs3.mkdir);
|
|
1721
|
+
var readFile = promisify(fs3.readFile);
|
|
1722
|
+
var compareVersions = /* @__PURE__ */ __name((a, b) => a.localeCompare(b, "en-US", { numeric: true }), "compareVersions");
|
|
1723
|
+
var encode = /* @__PURE__ */ __name((value) => encodeURIComponent(value).replace(/^%40/, "@"), "encode");
|
|
1724
|
+
var getFile = /* @__PURE__ */ __name(async (details, distTag) => {
|
|
1725
|
+
const rootDir = tmpdir();
|
|
1726
|
+
const subDir = join2(rootDir, "update-check");
|
|
1727
|
+
if (!fs3.existsSync(subDir)) {
|
|
1728
|
+
await mkdir(subDir);
|
|
1729
|
+
}
|
|
1730
|
+
let name = `${details.name}-${distTag}.json`;
|
|
1731
|
+
if (details.scope) {
|
|
1732
|
+
name = `${details.scope}-${name}`;
|
|
1733
|
+
}
|
|
1734
|
+
return join2(subDir, name);
|
|
1735
|
+
}, "getFile");
|
|
1736
|
+
var evaluateCache = /* @__PURE__ */ __name(async (file, time, interval) => {
|
|
1737
|
+
if (fs3.existsSync(file)) {
|
|
1738
|
+
const content = await readFile(file, "utf8");
|
|
1739
|
+
const { lastUpdate, latest } = JSON.parse(content);
|
|
1740
|
+
const nextCheck = lastUpdate + interval;
|
|
1741
|
+
if (nextCheck > time) {
|
|
1742
|
+
return {
|
|
1743
|
+
shouldCheck: false,
|
|
1744
|
+
latest
|
|
1745
|
+
};
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
return {
|
|
1749
|
+
shouldCheck: true,
|
|
1750
|
+
latest: null
|
|
1751
|
+
};
|
|
1752
|
+
}, "evaluateCache");
|
|
1753
|
+
var updateCache = /* @__PURE__ */ __name(async (file, latest, lastUpdate) => {
|
|
1754
|
+
const content = JSON.stringify({
|
|
1755
|
+
latest,
|
|
1756
|
+
lastUpdate
|
|
1757
|
+
});
|
|
1758
|
+
await writeFile(file, content, "utf8");
|
|
1759
|
+
}, "updateCache");
|
|
1760
|
+
var loadPackage = /* @__PURE__ */ __name((url, authInfo) => new Promise((resolve, reject) => {
|
|
1761
|
+
const options = {
|
|
1762
|
+
host: url.hostname,
|
|
1763
|
+
path: url.pathname,
|
|
1764
|
+
port: url.port,
|
|
1765
|
+
headers: {
|
|
1766
|
+
accept: "application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"
|
|
1767
|
+
},
|
|
1768
|
+
timeout: 2e3
|
|
1769
|
+
};
|
|
1770
|
+
if (authInfo) {
|
|
1771
|
+
options.headers.authorization = `${authInfo.type} ${authInfo.token}`;
|
|
1772
|
+
}
|
|
1773
|
+
const { get } = url.protocol === "https:" ? __require("https") : __require("http");
|
|
1774
|
+
get(options, (response) => {
|
|
1775
|
+
const { statusCode } = response;
|
|
1776
|
+
if (statusCode !== 200) {
|
|
1777
|
+
const error = new Error(`Request failed with code ${statusCode}`);
|
|
1778
|
+
error.code = statusCode;
|
|
1779
|
+
reject(error);
|
|
1780
|
+
response.resume();
|
|
1781
|
+
return;
|
|
1782
|
+
}
|
|
1783
|
+
let rawData = "";
|
|
1784
|
+
response.setEncoding("utf8");
|
|
1785
|
+
response.on("data", (chunk) => {
|
|
1786
|
+
rawData += chunk;
|
|
1787
|
+
});
|
|
1788
|
+
response.on("end", () => {
|
|
1789
|
+
try {
|
|
1790
|
+
const parsedData = JSON.parse(rawData);
|
|
1791
|
+
resolve(parsedData);
|
|
1792
|
+
} catch (e2) {
|
|
1793
|
+
reject(e2);
|
|
1794
|
+
}
|
|
1795
|
+
});
|
|
1796
|
+
}).on("error", reject).on("timeout", reject);
|
|
1797
|
+
}), "loadPackage");
|
|
1798
|
+
var getMostRecent = /* @__PURE__ */ __name(async ({ full, scope }, distTag) => {
|
|
1799
|
+
const regURL = registryUrl(scope);
|
|
1800
|
+
const url = new URL2(full, regURL);
|
|
1801
|
+
let spec = null;
|
|
1802
|
+
try {
|
|
1803
|
+
spec = await loadPackage(url);
|
|
1804
|
+
} catch (err) {
|
|
1805
|
+
if (err.code && String(err.code).startsWith(4)) {
|
|
1806
|
+
const registryAuthToken = require_registry_auth_token();
|
|
1807
|
+
const authInfo = registryAuthToken(regURL, { recursive: true });
|
|
1808
|
+
spec = await loadPackage(url, authInfo);
|
|
1809
|
+
} else {
|
|
1810
|
+
throw err;
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
const version = spec["dist-tags"][distTag];
|
|
1814
|
+
if (!version) {
|
|
1815
|
+
throw new Error(`Distribution tag ${distTag} is not available`);
|
|
1816
|
+
}
|
|
1817
|
+
return version;
|
|
1818
|
+
}, "getMostRecent");
|
|
1819
|
+
var defaultConfig = {
|
|
1820
|
+
interval: 36e5,
|
|
1821
|
+
distTag: "latest"
|
|
1822
|
+
};
|
|
1823
|
+
var getDetails = /* @__PURE__ */ __name((name) => {
|
|
1824
|
+
const spec = {
|
|
1825
|
+
full: encode(name)
|
|
1826
|
+
};
|
|
1827
|
+
if (name.includes("/")) {
|
|
1828
|
+
const parts = name.split("/");
|
|
1829
|
+
spec.scope = parts[0];
|
|
1830
|
+
spec.name = parts[1];
|
|
1831
|
+
} else {
|
|
1832
|
+
spec.scope = null;
|
|
1833
|
+
spec.name = name;
|
|
1834
|
+
}
|
|
1835
|
+
return spec;
|
|
1836
|
+
}, "getDetails");
|
|
1837
|
+
module.exports = async (pkg, config) => {
|
|
1838
|
+
if (typeof pkg !== "object") {
|
|
1839
|
+
throw new Error("The first parameter should be your package.json file content");
|
|
1840
|
+
}
|
|
1841
|
+
const details = getDetails(pkg.name);
|
|
1842
|
+
const time = Date.now();
|
|
1843
|
+
const { distTag, interval } = Object.assign({}, defaultConfig, config);
|
|
1844
|
+
const file = await getFile(details, distTag);
|
|
1845
|
+
let latest = null;
|
|
1846
|
+
let shouldCheck = true;
|
|
1847
|
+
({ shouldCheck, latest } = await evaluateCache(file, time, interval));
|
|
1848
|
+
if (shouldCheck) {
|
|
1849
|
+
latest = await getMostRecent(details, distTag);
|
|
1850
|
+
await updateCache(file, latest, time);
|
|
1851
|
+
}
|
|
1852
|
+
const comparision = compareVersions(pkg.version, latest);
|
|
1853
|
+
if (comparision === -1) {
|
|
1854
|
+
return {
|
|
1855
|
+
latest,
|
|
1856
|
+
fromCache: !shouldCheck
|
|
1857
|
+
};
|
|
1858
|
+
}
|
|
1859
|
+
return null;
|
|
1860
|
+
};
|
|
1861
|
+
}
|
|
1862
|
+
});
|
|
1863
|
+
|
|
675
1864
|
// src/config/config.ts
|
|
676
1865
|
var defaultWranglerConfig = {
|
|
677
1866
|
/* COMPUTED_FIELDS */
|
|
@@ -722,6 +1911,8 @@ var defaultWranglerConfig = {
|
|
|
722
1911
|
vectorize: [],
|
|
723
1912
|
ai_search_namespaces: [],
|
|
724
1913
|
ai_search: [],
|
|
1914
|
+
web_search: void 0,
|
|
1915
|
+
agent_memory: [],
|
|
725
1916
|
hyperdrive: [],
|
|
726
1917
|
workflows: [],
|
|
727
1918
|
secrets_store_secrets: [],
|
|
@@ -797,7 +1988,7 @@ var defaultWranglerConfig = {
|
|
|
797
1988
|
vpc_networks: []
|
|
798
1989
|
};
|
|
799
1990
|
var experimental_patchConfig = /* @__PURE__ */ __name((configPath, patch, isArrayInsertion = true) => {
|
|
800
|
-
let configString = readFileSync(configPath);
|
|
1991
|
+
let configString = readFileSync$1(configPath);
|
|
801
1992
|
if (configPath.endsWith("toml")) {
|
|
802
1993
|
if (configString.includes("#")) {
|
|
803
1994
|
throw new PatchConfigError(
|
|
@@ -1206,8 +2397,8 @@ function getErrorMap() {
|
|
|
1206
2397
|
}
|
|
1207
2398
|
__name(getErrorMap, "getErrorMap");
|
|
1208
2399
|
var makeIssue = /* @__PURE__ */ __name((params) => {
|
|
1209
|
-
const { data, path:
|
|
1210
|
-
const fullPath = [...
|
|
2400
|
+
const { data, path: path5, errorMaps, issueData } = params;
|
|
2401
|
+
const fullPath = [...path5, ...issueData.path || []];
|
|
1211
2402
|
const fullIssue = {
|
|
1212
2403
|
...issueData,
|
|
1213
2404
|
path: fullPath
|
|
@@ -1313,11 +2504,11 @@ var ParseInputLazyPath = class {
|
|
|
1313
2504
|
static {
|
|
1314
2505
|
__name(this, "ParseInputLazyPath");
|
|
1315
2506
|
}
|
|
1316
|
-
constructor(parent, value,
|
|
2507
|
+
constructor(parent, value, path5, key) {
|
|
1317
2508
|
this._cachedPath = [];
|
|
1318
2509
|
this.parent = parent;
|
|
1319
2510
|
this.data = value;
|
|
1320
|
-
this._path =
|
|
2511
|
+
this._path = path5;
|
|
1321
2512
|
this._key = key;
|
|
1322
2513
|
}
|
|
1323
2514
|
get path() {
|
|
@@ -4820,7 +6011,8 @@ var getWranglerSendMetricsFromEnv = getBooleanEnvironmentVariableFactory({
|
|
|
4820
6011
|
variableName: "WRANGLER_SEND_METRICS"
|
|
4821
6012
|
});
|
|
4822
6013
|
var getWranglerSendErrorReportsFromEnv = getBooleanEnvironmentVariableFactory({
|
|
4823
|
-
variableName: "WRANGLER_SEND_ERROR_REPORTS"
|
|
6014
|
+
variableName: "WRANGLER_SEND_ERROR_REPORTS",
|
|
6015
|
+
defaultValue: false
|
|
4824
6016
|
});
|
|
4825
6017
|
var getCloudflareApiEnvironmentFromEnv = getEnvironmentVariableFactory(
|
|
4826
6018
|
{
|
|
@@ -5120,9 +6312,9 @@ Please add "${field}" to "env.${envName}".`
|
|
|
5120
6312
|
return rawEnv[field] ?? defaultValue;
|
|
5121
6313
|
}
|
|
5122
6314
|
__name(notInheritable, "notInheritable");
|
|
5123
|
-
function unwindPropertyPath(root,
|
|
6315
|
+
function unwindPropertyPath(root, path5) {
|
|
5124
6316
|
let container = root;
|
|
5125
|
-
const parts =
|
|
6317
|
+
const parts = path5.split(".");
|
|
5126
6318
|
for (let i = 0; i < parts.length - 1; i++) {
|
|
5127
6319
|
if (!hasProperty(container, parts[i])) {
|
|
5128
6320
|
return;
|
|
@@ -5396,6 +6588,8 @@ var friendlyBindingNames = {
|
|
|
5396
6588
|
vectorize: "Vectorize Index",
|
|
5397
6589
|
ai_search_namespaces: "AI Search Namespace",
|
|
5398
6590
|
ai_search: "AI Search Instance",
|
|
6591
|
+
web_search: "Web Search",
|
|
6592
|
+
agent_memory: "Agent Memory",
|
|
5399
6593
|
hyperdrive: "Hyperdrive Config",
|
|
5400
6594
|
r2_buckets: "R2 Bucket",
|
|
5401
6595
|
logfwdr: "logfwdr",
|
|
@@ -5448,6 +6642,8 @@ var bindingTypeFriendlyNames = {
|
|
|
5448
6642
|
vectorize: "Vectorize Index",
|
|
5449
6643
|
ai_search_namespace: "AI Search Namespace",
|
|
5450
6644
|
ai_search: "AI Search Instance",
|
|
6645
|
+
web_search: "Web Search",
|
|
6646
|
+
agent_memory: "Agent Memory",
|
|
5451
6647
|
hyperdrive: "Hyperdrive Config",
|
|
5452
6648
|
service: "Worker",
|
|
5453
6649
|
fetcher: "Service Binding",
|
|
@@ -6642,6 +7838,26 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
|
6642
7838
|
validateBindingArray(envName, validateAISearchBinding),
|
|
6643
7839
|
[]
|
|
6644
7840
|
),
|
|
7841
|
+
web_search: notInheritable(
|
|
7842
|
+
diagnostics,
|
|
7843
|
+
topLevelEnv,
|
|
7844
|
+
rawConfig,
|
|
7845
|
+
rawEnv,
|
|
7846
|
+
envName,
|
|
7847
|
+
"web_search",
|
|
7848
|
+
validateNamedSimpleBinding(envName),
|
|
7849
|
+
void 0
|
|
7850
|
+
),
|
|
7851
|
+
agent_memory: notInheritable(
|
|
7852
|
+
diagnostics,
|
|
7853
|
+
topLevelEnv,
|
|
7854
|
+
rawConfig,
|
|
7855
|
+
rawEnv,
|
|
7856
|
+
envName,
|
|
7857
|
+
"agent_memory",
|
|
7858
|
+
validateBindingArray(envName, validateAgentMemoryBinding),
|
|
7859
|
+
[]
|
|
7860
|
+
),
|
|
6645
7861
|
hyperdrive: notInheritable(
|
|
6646
7862
|
diagnostics,
|
|
6647
7863
|
topLevelEnv,
|
|
@@ -7438,36 +8654,36 @@ var validateWorkflowBinding = /* @__PURE__ */ __name((diagnostics, field, value)
|
|
|
7438
8654
|
);
|
|
7439
8655
|
isValid2 = false;
|
|
7440
8656
|
}
|
|
7441
|
-
if (hasProperty(value, "
|
|
7442
|
-
if (typeof value.
|
|
7443
|
-
if (value.
|
|
8657
|
+
if (hasProperty(value, "schedules") && value.schedules !== void 0) {
|
|
8658
|
+
if (typeof value.schedules === "string") {
|
|
8659
|
+
if (value.schedules.length === 0) {
|
|
7444
8660
|
diagnostics.errors.push(
|
|
7445
|
-
`"${field}" bindings "
|
|
8661
|
+
`"${field}" bindings "schedules" field must not be an empty string.`
|
|
7446
8662
|
);
|
|
7447
8663
|
isValid2 = false;
|
|
7448
8664
|
}
|
|
7449
|
-
} else if (Array.isArray(value.
|
|
7450
|
-
if (value.
|
|
8665
|
+
} else if (Array.isArray(value.schedules)) {
|
|
8666
|
+
if (value.schedules.length === 0) {
|
|
7451
8667
|
diagnostics.errors.push(
|
|
7452
|
-
`"${field}" bindings "
|
|
8668
|
+
`"${field}" bindings "schedules" field must not be an empty array.`
|
|
7453
8669
|
);
|
|
7454
8670
|
isValid2 = false;
|
|
7455
|
-
} else if (!value.
|
|
8671
|
+
} else if (!value.schedules.every((s) => typeof s === "string")) {
|
|
7456
8672
|
diagnostics.errors.push(
|
|
7457
|
-
`"${field}" bindings should, optionally, have a string or array of strings "
|
|
8673
|
+
`"${field}" bindings should, optionally, have a string or array of strings "schedules" field but got ${JSON.stringify(
|
|
7458
8674
|
value
|
|
7459
8675
|
)}.`
|
|
7460
8676
|
);
|
|
7461
8677
|
isValid2 = false;
|
|
7462
|
-
} else if (value.
|
|
8678
|
+
} else if (value.schedules.some((s) => s === "")) {
|
|
7463
8679
|
diagnostics.errors.push(
|
|
7464
|
-
`"${field}" bindings "
|
|
8680
|
+
`"${field}" bindings "schedules" field must not contain empty strings.`
|
|
7465
8681
|
);
|
|
7466
8682
|
isValid2 = false;
|
|
7467
8683
|
}
|
|
7468
8684
|
} else {
|
|
7469
8685
|
diagnostics.errors.push(
|
|
7470
|
-
`"${field}" bindings should, optionally, have a string or array of strings "
|
|
8686
|
+
`"${field}" bindings should, optionally, have a string or array of strings "schedules" field but got ${JSON.stringify(
|
|
7471
8687
|
value
|
|
7472
8688
|
)}.`
|
|
7473
8689
|
);
|
|
@@ -7513,7 +8729,7 @@ var validateWorkflowBinding = /* @__PURE__ */ __name((diagnostics, field, value)
|
|
|
7513
8729
|
"script_name",
|
|
7514
8730
|
"remote",
|
|
7515
8731
|
"limits",
|
|
7516
|
-
"
|
|
8732
|
+
"schedules"
|
|
7517
8733
|
]);
|
|
7518
8734
|
return isValid2;
|
|
7519
8735
|
}, "validateWorkflowBinding");
|
|
@@ -7725,6 +8941,8 @@ var validateUnsafeBinding = /* @__PURE__ */ __name((diagnostics, field, value) =
|
|
|
7725
8941
|
"ai",
|
|
7726
8942
|
"ai_search_namespace",
|
|
7727
8943
|
"ai_search",
|
|
8944
|
+
"web_search",
|
|
8945
|
+
"agent_memory",
|
|
7728
8946
|
"kv_namespace",
|
|
7729
8947
|
"durable_object_namespace",
|
|
7730
8948
|
"d1_database",
|
|
@@ -8640,6 +9858,36 @@ var validateAISearchBinding = /* @__PURE__ */ __name((diagnostics, field, value)
|
|
|
8640
9858
|
]);
|
|
8641
9859
|
return isValid2;
|
|
8642
9860
|
}, "validateAISearchBinding");
|
|
9861
|
+
var validateAgentMemoryBinding = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
|
9862
|
+
if (typeof value !== "object" || value === null) {
|
|
9863
|
+
diagnostics.errors.push(
|
|
9864
|
+
`"agent_memory" bindings should be objects, but got ${JSON.stringify(value)}`
|
|
9865
|
+
);
|
|
9866
|
+
return false;
|
|
9867
|
+
}
|
|
9868
|
+
let isValid2 = true;
|
|
9869
|
+
if (!isRequiredProperty(value, "binding", "string")) {
|
|
9870
|
+
diagnostics.errors.push(
|
|
9871
|
+
`"${field}" bindings should have a string "binding" field but got ${JSON.stringify(value)}.`
|
|
9872
|
+
);
|
|
9873
|
+
isValid2 = false;
|
|
9874
|
+
}
|
|
9875
|
+
if (!isRequiredProperty(value, "namespace", "string")) {
|
|
9876
|
+
diagnostics.errors.push(
|
|
9877
|
+
`"${field}" bindings must have a "namespace" field but got ${JSON.stringify(value)}.`
|
|
9878
|
+
);
|
|
9879
|
+
isValid2 = false;
|
|
9880
|
+
}
|
|
9881
|
+
if (!isRemoteValid(value, field, diagnostics)) {
|
|
9882
|
+
isValid2 = false;
|
|
9883
|
+
}
|
|
9884
|
+
validateAdditionalProperties(diagnostics, field, Object.keys(value), [
|
|
9885
|
+
"binding",
|
|
9886
|
+
"namespace",
|
|
9887
|
+
"remote"
|
|
9888
|
+
]);
|
|
9889
|
+
return isValid2;
|
|
9890
|
+
}, "validateAgentMemoryBinding");
|
|
8643
9891
|
var validateHyperdriveBinding = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
|
8644
9892
|
if (typeof value !== "object" || value === null) {
|
|
8645
9893
|
diagnostics.errors.push(
|
|
@@ -9139,9 +10387,16 @@ var validatePipelineBinding = /* @__PURE__ */ __name((diagnostics, field, value)
|
|
|
9139
10387
|
);
|
|
9140
10388
|
isValid2 = false;
|
|
9141
10389
|
}
|
|
9142
|
-
|
|
10390
|
+
const hasStream = isOptionalProperty(value, "stream", "string");
|
|
10391
|
+
const hasPipeline = isOptionalProperty(value, "pipeline", "string");
|
|
10392
|
+
const v = value;
|
|
10393
|
+
if (hasStream && v.stream) ; else if (hasPipeline && v.pipeline) {
|
|
10394
|
+
diagnostics.warnings.push(
|
|
10395
|
+
`The "pipeline" field in "${field}" bindings is deprecated. Use "stream" instead.`
|
|
10396
|
+
);
|
|
10397
|
+
} else {
|
|
9143
10398
|
diagnostics.errors.push(
|
|
9144
|
-
`"${field}" bindings must have a string "
|
|
10399
|
+
`"${field}" bindings must have a string "stream" field but got ${JSON.stringify(
|
|
9145
10400
|
value
|
|
9146
10401
|
)}.`
|
|
9147
10402
|
);
|
|
@@ -9152,6 +10407,7 @@ var validatePipelineBinding = /* @__PURE__ */ __name((diagnostics, field, value)
|
|
|
9152
10407
|
}
|
|
9153
10408
|
validateAdditionalProperties(diagnostics, field, Object.keys(value), [
|
|
9154
10409
|
"binding",
|
|
10410
|
+
"stream",
|
|
9155
10411
|
"pipeline",
|
|
9156
10412
|
"remote"
|
|
9157
10413
|
]);
|
|
@@ -10012,7 +11268,7 @@ __name(isRemoteValid, "isRemoteValid");
|
|
|
10012
11268
|
function isDockerfile(imagePath, configPath) {
|
|
10013
11269
|
const baseDir = configPath ? path3.dirname(configPath) : process.cwd();
|
|
10014
11270
|
const maybeDockerfile = path3.resolve(baseDir, imagePath);
|
|
10015
|
-
if (
|
|
11271
|
+
if (fs2.existsSync(maybeDockerfile)) {
|
|
10016
11272
|
if (isDirectory(maybeDockerfile)) {
|
|
10017
11273
|
throw new UserError(
|
|
10018
11274
|
`${imagePath} is a directory, you should specify a path to the Dockerfile`,
|
|
@@ -10050,6 +11306,61 @@ function isDockerfile(imagePath, configPath) {
|
|
|
10050
11306
|
}
|
|
10051
11307
|
__name(isDockerfile, "isDockerfile");
|
|
10052
11308
|
|
|
11309
|
+
// src/config/binding-local-support.ts
|
|
11310
|
+
var BINDING_LOCAL_SUPPORT = {
|
|
11311
|
+
plain_text: "local-only",
|
|
11312
|
+
secret_text: "local-only",
|
|
11313
|
+
json: "local-only",
|
|
11314
|
+
wasm_module: "local-only",
|
|
11315
|
+
text_blob: "local-only",
|
|
11316
|
+
data_blob: "local-only",
|
|
11317
|
+
version_metadata: "local-only",
|
|
11318
|
+
inherit: "local-only",
|
|
11319
|
+
logfwdr: "local-only",
|
|
11320
|
+
assets: "local-only",
|
|
11321
|
+
unsafe_hello_world: "local-only",
|
|
11322
|
+
durable_object_namespace: "local-only",
|
|
11323
|
+
hyperdrive: "local-only",
|
|
11324
|
+
fetcher: "local-only",
|
|
11325
|
+
analytics_engine: "local-only",
|
|
11326
|
+
secrets_store_secret: "local-only",
|
|
11327
|
+
ratelimit: "local-only",
|
|
11328
|
+
worker_loader: "local-only",
|
|
11329
|
+
kv_namespace: "local-and-remote",
|
|
11330
|
+
r2_bucket: "local-and-remote",
|
|
11331
|
+
d1: "local-and-remote",
|
|
11332
|
+
workflow: "local-and-remote",
|
|
11333
|
+
browser: "local-and-remote",
|
|
11334
|
+
images: "local-and-remote",
|
|
11335
|
+
stream: "local-and-remote",
|
|
11336
|
+
send_email: "local-and-remote",
|
|
11337
|
+
pipeline: "local-and-remote",
|
|
11338
|
+
service: "local-and-remote",
|
|
11339
|
+
// TODO: Miniflare currently ignores `remote: true` on queues, tracked in #13727.
|
|
11340
|
+
queue: "local-and-remote",
|
|
11341
|
+
vectorize: "remote",
|
|
11342
|
+
mtls_certificate: "remote",
|
|
11343
|
+
dispatch_namespace: "remote",
|
|
11344
|
+
// Reach out to the @cloudflare/wrangler team before adding anything here
|
|
11345
|
+
ai: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
11346
|
+
ai_search: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
11347
|
+
ai_search_namespace: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
11348
|
+
media: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
11349
|
+
artifacts: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
11350
|
+
flagship: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
11351
|
+
vpc_service: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
11352
|
+
vpc_network: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
11353
|
+
web_search: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
11354
|
+
agent_memory: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator"
|
|
11355
|
+
};
|
|
11356
|
+
function getBindingLocalSupport(type) {
|
|
11357
|
+
if (type in BINDING_LOCAL_SUPPORT) {
|
|
11358
|
+
return BINDING_LOCAL_SUPPORT[type];
|
|
11359
|
+
}
|
|
11360
|
+
return "local-only";
|
|
11361
|
+
}
|
|
11362
|
+
__name(getBindingLocalSupport, "getBindingLocalSupport");
|
|
11363
|
+
|
|
10053
11364
|
// src/config/validation-pages.ts
|
|
10054
11365
|
var supportedPagesConfigFields = [
|
|
10055
11366
|
"pages_build_output_dir",
|
|
@@ -10181,6 +11492,66 @@ Pages requires Durable Object bindings to specify the name of the Worker where t
|
|
|
10181
11492
|
}
|
|
10182
11493
|
__name(validateDurableObjectBinding2, "validateDurableObjectBinding");
|
|
10183
11494
|
|
|
11495
|
+
// src/wrangler-tmp-dir.ts
|
|
11496
|
+
var import_signal_exit = __toESM(require_signal_exit());
|
|
11497
|
+
function getWranglerHiddenDirPath(projectRoot) {
|
|
11498
|
+
projectRoot ??= process.cwd();
|
|
11499
|
+
return path3.join(projectRoot, ".wrangler");
|
|
11500
|
+
}
|
|
11501
|
+
__name(getWranglerHiddenDirPath, "getWranglerHiddenDirPath");
|
|
11502
|
+
var STALE_WRANGLER_TMP_DIR_MS = 24 * 60 * 60 * 1e3;
|
|
11503
|
+
var sweptTmpRoots = /* @__PURE__ */ new Set();
|
|
11504
|
+
function sweepStaleWranglerTmpDirs(tmpRoot) {
|
|
11505
|
+
if (sweptTmpRoots.has(tmpRoot)) {
|
|
11506
|
+
return;
|
|
11507
|
+
}
|
|
11508
|
+
sweptTmpRoots.add(tmpRoot);
|
|
11509
|
+
let entries;
|
|
11510
|
+
try {
|
|
11511
|
+
entries = fs2.readdirSync(tmpRoot, { withFileTypes: true });
|
|
11512
|
+
} catch {
|
|
11513
|
+
return;
|
|
11514
|
+
}
|
|
11515
|
+
const cutoff = Date.now() - STALE_WRANGLER_TMP_DIR_MS;
|
|
11516
|
+
for (const entry of entries) {
|
|
11517
|
+
if (!entry.isDirectory()) {
|
|
11518
|
+
continue;
|
|
11519
|
+
}
|
|
11520
|
+
const entryPath = path3.join(tmpRoot, entry.name);
|
|
11521
|
+
try {
|
|
11522
|
+
if (fs2.statSync(entryPath).mtimeMs < cutoff) {
|
|
11523
|
+
removeDirSync(entryPath);
|
|
11524
|
+
}
|
|
11525
|
+
} catch {
|
|
11526
|
+
}
|
|
11527
|
+
}
|
|
11528
|
+
}
|
|
11529
|
+
__name(sweepStaleWranglerTmpDirs, "sweepStaleWranglerTmpDirs");
|
|
11530
|
+
function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
|
|
11531
|
+
const tmpRoot = path3.join(getWranglerHiddenDirPath(projectRoot), "tmp");
|
|
11532
|
+
fs2.mkdirSync(tmpRoot, { recursive: true });
|
|
11533
|
+
sweepStaleWranglerTmpDirs(tmpRoot);
|
|
11534
|
+
const tmpPrefix = path3.join(tmpRoot, `${prefix}-`);
|
|
11535
|
+
const tmpDir = fs2.realpathSync(fs2.mkdtempSync(tmpPrefix));
|
|
11536
|
+
const cleanupDir = /* @__PURE__ */ __name(() => {
|
|
11537
|
+
if (cleanup) {
|
|
11538
|
+
try {
|
|
11539
|
+
removeDirSync(tmpDir);
|
|
11540
|
+
} catch {
|
|
11541
|
+
}
|
|
11542
|
+
}
|
|
11543
|
+
}, "cleanupDir");
|
|
11544
|
+
const removeExitListener = (0, import_signal_exit.default)(cleanupDir);
|
|
11545
|
+
return {
|
|
11546
|
+
path: tmpDir,
|
|
11547
|
+
remove() {
|
|
11548
|
+
removeExitListener();
|
|
11549
|
+
cleanupDir();
|
|
11550
|
+
}
|
|
11551
|
+
};
|
|
11552
|
+
}
|
|
11553
|
+
__name(getWranglerTmpDir, "getWranglerTmpDir");
|
|
11554
|
+
|
|
10184
11555
|
// src/cloudflared.ts
|
|
10185
11556
|
var import_command_exists = __toESM(require_command_exists2());
|
|
10186
11557
|
var UPDATE_SERVICE_URL = "https://update.argotunnel.com";
|
|
@@ -10555,18 +11926,6 @@ __name(downloadCloudflared, "downloadCloudflared");
|
|
|
10555
11926
|
async function downloadAndExtractTarball(response, expectedChecksum, binPath, cacheDir) {
|
|
10556
11927
|
const tempTarPath = join(cacheDir, "cloudflared.tgz");
|
|
10557
11928
|
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
11929
|
writeFileSync(tempTarPath, buffer);
|
|
10571
11930
|
try {
|
|
10572
11931
|
execFileSync("tar", ["-xzf", tempTarPath, "-C", cacheDir], {
|
|
@@ -10576,6 +11935,21 @@ Actual: ${actualSha256}`,
|
|
|
10576
11935
|
if (extractedPath !== binPath && existsSync(extractedPath)) {
|
|
10577
11936
|
renameSync(extractedPath, binPath);
|
|
10578
11937
|
}
|
|
11938
|
+
if (expectedChecksum) {
|
|
11939
|
+
const extractedBinary = readFileSync(binPath);
|
|
11940
|
+
const actualSha256 = sha256Hex(extractedBinary);
|
|
11941
|
+
if (actualSha256 !== expectedChecksum) {
|
|
11942
|
+
throw new UserError(
|
|
11943
|
+
`[cloudflared] SHA256 mismatch for downloaded cloudflared binary.
|
|
11944
|
+
|
|
11945
|
+
Expected: ${expectedChecksum}
|
|
11946
|
+
Actual: ${actualSha256}`,
|
|
11947
|
+
{
|
|
11948
|
+
telemetryMessage: "tunnel cloudflared extracted binary checksum mismatch"
|
|
11949
|
+
}
|
|
11950
|
+
);
|
|
11951
|
+
}
|
|
11952
|
+
}
|
|
10579
11953
|
} finally {
|
|
10580
11954
|
try {
|
|
10581
11955
|
if (existsSync(tempTarPath)) {
|
|
@@ -10774,7 +12148,7 @@ function startTunnel(options) {
|
|
|
10774
12148
|
return;
|
|
10775
12149
|
}
|
|
10776
12150
|
logger?.log(
|
|
10777
|
-
`${publicURL ? `
|
|
12151
|
+
`${publicURL ? `Tunnel still open, expires in ${formatTunnelDuration(remainingMs)}: ${publicURL}` : `The tunnel is still open. It expires in ${formatTunnelDuration(remainingMs)}.`}${options.extendHint ? ` ${options.extendHint}` : ""}`
|
|
10778
12152
|
);
|
|
10779
12153
|
}, reminderIntervalMs);
|
|
10780
12154
|
reminderInterval.unref?.();
|
|
@@ -10925,7 +12299,7 @@ function createTunnelStartupError(message, stderrOutput, origin) {
|
|
|
10925
12299
|
cloudflared output:
|
|
10926
12300
|
${stderrOutput || "(no output)"}
|
|
10927
12301
|
|
|
10928
|
-
The local dev server started at ${origin.href}
|
|
12302
|
+
The local dev server started at ${origin.href}
|
|
10929
12303
|
` + (isQuickTunnelRateLimited ? "Cloudflare Quick Tunnel creation was rate limited. Try again in a few minutes, or use a named tunnel if you need more reliable access." : `Check the cloudflared output above for more details, and verify that ${origin.href} is reachable from this machine if this keeps happening.`);
|
|
10930
12304
|
if (isQuickTunnelRateLimited) {
|
|
10931
12305
|
return new UserError(errorMessage, { telemetryMessage: false });
|
|
@@ -10934,4 +12308,410 @@ The local dev server started at ${origin.href}.
|
|
|
10934
12308
|
}
|
|
10935
12309
|
__name(createTunnelStartupError, "createTunnelStartupError");
|
|
10936
12310
|
|
|
10937
|
-
|
|
12311
|
+
// src/cfetch/errors.ts
|
|
12312
|
+
function buildDetailedError(message, ...extra) {
|
|
12313
|
+
return new ParseError({
|
|
12314
|
+
text: message,
|
|
12315
|
+
notes: extra.map((text) => ({ text })),
|
|
12316
|
+
telemetryMessage: false
|
|
12317
|
+
});
|
|
12318
|
+
}
|
|
12319
|
+
__name(buildDetailedError, "buildDetailedError");
|
|
12320
|
+
function maybeThrowFriendlyError(error) {
|
|
12321
|
+
if (error.message === "workers.api.error.email_verification_required") {
|
|
12322
|
+
throw buildDetailedError(
|
|
12323
|
+
"Please verify your account's email address and try again.",
|
|
12324
|
+
"Check your email for a verification link, or login to https://dash.cloudflare.com and request a new one."
|
|
12325
|
+
);
|
|
12326
|
+
}
|
|
12327
|
+
}
|
|
12328
|
+
__name(maybeThrowFriendlyError, "maybeThrowFriendlyError");
|
|
12329
|
+
|
|
12330
|
+
// src/cfetch/index.ts
|
|
12331
|
+
function logHeaders(headers, logger) {
|
|
12332
|
+
const clone = cloneHeaders(headers);
|
|
12333
|
+
clone.delete("Authorization");
|
|
12334
|
+
logger.debugWithSanitization(
|
|
12335
|
+
"HEADERS:",
|
|
12336
|
+
JSON.stringify(Object.fromEntries(clone), null, 2)
|
|
12337
|
+
);
|
|
12338
|
+
}
|
|
12339
|
+
__name(logHeaders, "logHeaders");
|
|
12340
|
+
async function performApiFetchBase(complianceConfig, resource, init = {}, userAgent, logger, queryParams, abortSignal, credentials) {
|
|
12341
|
+
assert(credentials, "credentials are required for performApiFetch");
|
|
12342
|
+
const method = init.method ?? "GET";
|
|
12343
|
+
assert(
|
|
12344
|
+
resource.startsWith("/"),
|
|
12345
|
+
`CF API fetch - resource path must start with a "/" but got "${resource}"`
|
|
12346
|
+
);
|
|
12347
|
+
const headers = cloneHeaders(new Headers(init.headers));
|
|
12348
|
+
addAuthorizationHeader(headers, credentials);
|
|
12349
|
+
headers.set("User-Agent", userAgent);
|
|
12350
|
+
maybeAddTraceHeader(headers);
|
|
12351
|
+
const queryString = queryParams ? `?${queryParams.toString()}` : "";
|
|
12352
|
+
logger.debug(
|
|
12353
|
+
`-- START CF API REQUEST: ${method} ${getCloudflareApiBaseUrl(complianceConfig)}${resource}`
|
|
12354
|
+
);
|
|
12355
|
+
logger.debugWithSanitization("QUERY STRING:", queryString);
|
|
12356
|
+
logHeaders(headers, logger);
|
|
12357
|
+
logger.debugWithSanitization("INIT:", JSON.stringify({ ...init }, null, 2));
|
|
12358
|
+
if (init.body instanceof FormData) {
|
|
12359
|
+
logger.debugWithSanitization(
|
|
12360
|
+
"BODY:",
|
|
12361
|
+
await new Response(init.body).text(),
|
|
12362
|
+
null,
|
|
12363
|
+
2
|
|
12364
|
+
);
|
|
12365
|
+
}
|
|
12366
|
+
logger.debug("-- END CF API REQUEST");
|
|
12367
|
+
return await fetch(
|
|
12368
|
+
`${getCloudflareApiBaseUrl(complianceConfig)}${resource}${queryString}`,
|
|
12369
|
+
{
|
|
12370
|
+
method,
|
|
12371
|
+
...init,
|
|
12372
|
+
headers,
|
|
12373
|
+
signal: abortSignal
|
|
12374
|
+
}
|
|
12375
|
+
);
|
|
12376
|
+
}
|
|
12377
|
+
__name(performApiFetchBase, "performApiFetchBase");
|
|
12378
|
+
async function fetchInternalBase(complianceConfig, resource, init = {}, userAgent, logger, queryParams, abortSignal, credentials) {
|
|
12379
|
+
const method = init.method ?? "GET";
|
|
12380
|
+
const response = await performApiFetchBase(
|
|
12381
|
+
complianceConfig,
|
|
12382
|
+
resource,
|
|
12383
|
+
init,
|
|
12384
|
+
userAgent,
|
|
12385
|
+
logger,
|
|
12386
|
+
queryParams,
|
|
12387
|
+
abortSignal,
|
|
12388
|
+
credentials
|
|
12389
|
+
);
|
|
12390
|
+
const jsonText = await response.text();
|
|
12391
|
+
logger.debug(
|
|
12392
|
+
"-- START CF API RESPONSE:",
|
|
12393
|
+
response.statusText,
|
|
12394
|
+
response.status
|
|
12395
|
+
);
|
|
12396
|
+
logHeaders(response.headers, logger);
|
|
12397
|
+
logger.debugWithSanitization("RESPONSE:", jsonText);
|
|
12398
|
+
logger.debug("-- END CF API RESPONSE");
|
|
12399
|
+
if (!jsonText && (response.status === 204 || response.status === 205)) {
|
|
12400
|
+
return {
|
|
12401
|
+
response: {
|
|
12402
|
+
result: {},
|
|
12403
|
+
success: true,
|
|
12404
|
+
errors: [],
|
|
12405
|
+
messages: []
|
|
12406
|
+
},
|
|
12407
|
+
status: response.status
|
|
12408
|
+
};
|
|
12409
|
+
}
|
|
12410
|
+
if (isWAFBlockResponse(response.headers)) {
|
|
12411
|
+
throwWAFBlockError(
|
|
12412
|
+
response.headers,
|
|
12413
|
+
method,
|
|
12414
|
+
resource,
|
|
12415
|
+
response.status,
|
|
12416
|
+
response.statusText
|
|
12417
|
+
);
|
|
12418
|
+
}
|
|
12419
|
+
try {
|
|
12420
|
+
const json = parseJSON(jsonText);
|
|
12421
|
+
return { response: json, status: response.status };
|
|
12422
|
+
} catch {
|
|
12423
|
+
const rayId = extractWAFBlockRayId(response.headers);
|
|
12424
|
+
throw new APIError({
|
|
12425
|
+
text: "Received a malformed response from the API",
|
|
12426
|
+
notes: [
|
|
12427
|
+
{
|
|
12428
|
+
text: truncate(jsonText, 100)
|
|
12429
|
+
},
|
|
12430
|
+
{
|
|
12431
|
+
text: `${method} ${resource} -> ${response.status} ${response.statusText}`
|
|
12432
|
+
},
|
|
12433
|
+
...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : []
|
|
12434
|
+
],
|
|
12435
|
+
status: response.status,
|
|
12436
|
+
telemetryMessage: false
|
|
12437
|
+
});
|
|
12438
|
+
}
|
|
12439
|
+
}
|
|
12440
|
+
__name(fetchInternalBase, "fetchInternalBase");
|
|
12441
|
+
async function fetchResultBase(complianceConfig, resource, init = {}, userAgent, logger, queryParams, abortSignal, credentials) {
|
|
12442
|
+
const { response: json, status } = await fetchInternalBase(
|
|
12443
|
+
complianceConfig,
|
|
12444
|
+
resource,
|
|
12445
|
+
init,
|
|
12446
|
+
userAgent,
|
|
12447
|
+
logger,
|
|
12448
|
+
queryParams,
|
|
12449
|
+
abortSignal,
|
|
12450
|
+
credentials
|
|
12451
|
+
);
|
|
12452
|
+
if (json.success) {
|
|
12453
|
+
return json.result;
|
|
12454
|
+
} else {
|
|
12455
|
+
throwFetchError(resource, json, status);
|
|
12456
|
+
}
|
|
12457
|
+
}
|
|
12458
|
+
__name(fetchResultBase, "fetchResultBase");
|
|
12459
|
+
async function fetchListResultBase(complianceConfig, resource, init = {}, userAgent, logger, queryParams, credentials) {
|
|
12460
|
+
const results = [];
|
|
12461
|
+
let getMoreResults = true;
|
|
12462
|
+
let cursor;
|
|
12463
|
+
while (getMoreResults) {
|
|
12464
|
+
if (cursor) {
|
|
12465
|
+
queryParams = new URLSearchParams(queryParams);
|
|
12466
|
+
queryParams.set("cursor", cursor);
|
|
12467
|
+
}
|
|
12468
|
+
const { response: json, status } = await fetchInternalBase(
|
|
12469
|
+
complianceConfig,
|
|
12470
|
+
resource,
|
|
12471
|
+
init,
|
|
12472
|
+
userAgent,
|
|
12473
|
+
logger,
|
|
12474
|
+
queryParams,
|
|
12475
|
+
void 0,
|
|
12476
|
+
credentials
|
|
12477
|
+
);
|
|
12478
|
+
if (json.success) {
|
|
12479
|
+
results.push(...json.result);
|
|
12480
|
+
if (hasCursor(json.result_info)) {
|
|
12481
|
+
cursor = json.result_info?.cursor;
|
|
12482
|
+
} else {
|
|
12483
|
+
getMoreResults = false;
|
|
12484
|
+
}
|
|
12485
|
+
} else {
|
|
12486
|
+
throwFetchError(resource, json, status);
|
|
12487
|
+
}
|
|
12488
|
+
}
|
|
12489
|
+
return results;
|
|
12490
|
+
}
|
|
12491
|
+
__name(fetchListResultBase, "fetchListResultBase");
|
|
12492
|
+
function truncate(text, maxLength) {
|
|
12493
|
+
const { length } = text;
|
|
12494
|
+
if (length <= maxLength) {
|
|
12495
|
+
return text;
|
|
12496
|
+
}
|
|
12497
|
+
return `${text.substring(0, maxLength)}... (length = ${length})`;
|
|
12498
|
+
}
|
|
12499
|
+
__name(truncate, "truncate");
|
|
12500
|
+
function isWAFBlockResponse(headers) {
|
|
12501
|
+
return headers.get("cf-mitigated") === "challenge";
|
|
12502
|
+
}
|
|
12503
|
+
__name(isWAFBlockResponse, "isWAFBlockResponse");
|
|
12504
|
+
function extractWAFBlockRayId(headers) {
|
|
12505
|
+
return headers.get("cf-ray") ?? void 0;
|
|
12506
|
+
}
|
|
12507
|
+
__name(extractWAFBlockRayId, "extractWAFBlockRayId");
|
|
12508
|
+
function extractAccountTag(resource) {
|
|
12509
|
+
const re = new RegExp("/accounts/([a-zA-Z0-9]+)/?");
|
|
12510
|
+
const matches = re.exec(resource);
|
|
12511
|
+
return matches?.[1];
|
|
12512
|
+
}
|
|
12513
|
+
__name(extractAccountTag, "extractAccountTag");
|
|
12514
|
+
function hasMorePages(result_info) {
|
|
12515
|
+
const page = result_info?.page;
|
|
12516
|
+
const per_page = result_info?.per_page;
|
|
12517
|
+
const total = result_info?.total_count;
|
|
12518
|
+
return page !== void 0 && per_page !== void 0 && total !== void 0 && page * per_page < total;
|
|
12519
|
+
}
|
|
12520
|
+
__name(hasMorePages, "hasMorePages");
|
|
12521
|
+
function renderError(err, level = 0) {
|
|
12522
|
+
const indent = " ".repeat(level);
|
|
12523
|
+
const message = err.message ?? "";
|
|
12524
|
+
const chainedMessages = "error_chain" in err ? err.error_chain?.map(
|
|
12525
|
+
(chainedError) => `
|
|
12526
|
+
|
|
12527
|
+
${indent}- ${renderError(chainedError, level + 1)}`
|
|
12528
|
+
).join("\n") ?? "" : "";
|
|
12529
|
+
return (err.code ? `${message} [code: ${err.code}]` : message) + (err.documentation_url ? `
|
|
12530
|
+
${indent}To learn more about this error, visit: ${err.documentation_url}` : "") + chainedMessages;
|
|
12531
|
+
}
|
|
12532
|
+
__name(renderError, "renderError");
|
|
12533
|
+
function addAuthorizationHeader(headers, auth, overrideExisting = false) {
|
|
12534
|
+
if (!headers.has("Authorization") || overrideExisting) {
|
|
12535
|
+
if ("apiToken" in auth) {
|
|
12536
|
+
const authorizationHeader = `Bearer ${auth.apiToken}`;
|
|
12537
|
+
validateAuthorizationHeaderValue(authorizationHeader);
|
|
12538
|
+
headers.set("Authorization", authorizationHeader);
|
|
12539
|
+
} else {
|
|
12540
|
+
headers.set("X-Auth-Key", auth.authKey);
|
|
12541
|
+
headers.set("X-Auth-Email", auth.authEmail);
|
|
12542
|
+
}
|
|
12543
|
+
}
|
|
12544
|
+
}
|
|
12545
|
+
__name(addAuthorizationHeader, "addAuthorizationHeader");
|
|
12546
|
+
function validateAuthorizationHeaderValue(value) {
|
|
12547
|
+
for (const character of value) {
|
|
12548
|
+
const codePoint = character.codePointAt(0);
|
|
12549
|
+
if (codePoint === void 0 || codePoint > 255) {
|
|
12550
|
+
throw new UserError(
|
|
12551
|
+
`The configured Cloudflare API token contains a character that cannot be used in an HTTP Authorization header: ${formatAuthorizationHeaderCharacter(character, codePoint)}. Recreate or copy the token again, making sure it does not include characters such as ellipses.`,
|
|
12552
|
+
{
|
|
12553
|
+
telemetryMessage: "cfetch auth invalid authorization header"
|
|
12554
|
+
}
|
|
12555
|
+
);
|
|
12556
|
+
}
|
|
12557
|
+
}
|
|
12558
|
+
}
|
|
12559
|
+
__name(validateAuthorizationHeaderValue, "validateAuthorizationHeaderValue");
|
|
12560
|
+
function formatAuthorizationHeaderCharacter(character, codePoint) {
|
|
12561
|
+
if (codePoint === void 0) {
|
|
12562
|
+
return '"\\u{unknown}"';
|
|
12563
|
+
}
|
|
12564
|
+
const codePointLabel = `U+${codePoint.toString(16).toUpperCase().padStart(4, "0")}`;
|
|
12565
|
+
const characterLabel = isPrintableCharacter(character) ? `"${character}"` : `"${escapeCharacter(character)}"`;
|
|
12566
|
+
return `${characterLabel} (${codePointLabel})`;
|
|
12567
|
+
}
|
|
12568
|
+
__name(formatAuthorizationHeaderCharacter, "formatAuthorizationHeaderCharacter");
|
|
12569
|
+
function isPrintableCharacter(character) {
|
|
12570
|
+
return !/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(character);
|
|
12571
|
+
}
|
|
12572
|
+
__name(isPrintableCharacter, "isPrintableCharacter");
|
|
12573
|
+
function escapeCharacter(character) {
|
|
12574
|
+
return Array.from(character).map((c) => {
|
|
12575
|
+
const codePoint = c.codePointAt(0);
|
|
12576
|
+
if (codePoint === void 0) {
|
|
12577
|
+
return "";
|
|
12578
|
+
}
|
|
12579
|
+
return codePoint <= 65535 ? `\\u${codePoint.toString(16).toUpperCase().padStart(4, "0")}` : `\\u{${codePoint.toString(16).toUpperCase()}}`;
|
|
12580
|
+
}).join("");
|
|
12581
|
+
}
|
|
12582
|
+
__name(escapeCharacter, "escapeCharacter");
|
|
12583
|
+
function throwFetchError(resource, response, status) {
|
|
12584
|
+
const errors = response.errors ?? [];
|
|
12585
|
+
for (const error2 of errors) {
|
|
12586
|
+
maybeThrowFriendlyError(error2);
|
|
12587
|
+
}
|
|
12588
|
+
const notes = [
|
|
12589
|
+
...errors.map((err) => ({ text: renderError(err) })),
|
|
12590
|
+
...response.messages?.map((msg) => ({
|
|
12591
|
+
text: typeof msg === "string" ? msg : msg.message ?? String(msg)
|
|
12592
|
+
})) ?? []
|
|
12593
|
+
];
|
|
12594
|
+
if (notes.length === 0) {
|
|
12595
|
+
const raw = response;
|
|
12596
|
+
const fallbackMessage = typeof raw.error === "string" ? `${raw.error}${raw.code ? ` [code: ${raw.code}]` : ""}` : void 0;
|
|
12597
|
+
if (fallbackMessage) {
|
|
12598
|
+
notes.push({ text: fallbackMessage });
|
|
12599
|
+
}
|
|
12600
|
+
}
|
|
12601
|
+
const error = new APIError({
|
|
12602
|
+
text: `A request to the Cloudflare API (${resource}) failed.`,
|
|
12603
|
+
notes,
|
|
12604
|
+
status,
|
|
12605
|
+
telemetryMessage: false
|
|
12606
|
+
});
|
|
12607
|
+
const code = errors[0]?.code;
|
|
12608
|
+
if (code) {
|
|
12609
|
+
error.code = code;
|
|
12610
|
+
}
|
|
12611
|
+
error.accountTag = extractAccountTag(resource);
|
|
12612
|
+
throw error;
|
|
12613
|
+
}
|
|
12614
|
+
__name(throwFetchError, "throwFetchError");
|
|
12615
|
+
function throwWAFBlockError(headers, method, resource, status, statusText) {
|
|
12616
|
+
const rayId = extractWAFBlockRayId(headers);
|
|
12617
|
+
throw new APIError({
|
|
12618
|
+
text: "The Cloudflare API responded with a WAF block page instead of the expected JSON response",
|
|
12619
|
+
notes: [
|
|
12620
|
+
{
|
|
12621
|
+
text: "Cloudflare's firewall (WAF) blocked this API request. This is usually a false positive."
|
|
12622
|
+
},
|
|
12623
|
+
...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : [],
|
|
12624
|
+
{
|
|
12625
|
+
text: rayId ? "If the issue persists, please open a Cloudflare Support ticket and include the Ray ID above." : "If the issue persists, please open a Cloudflare Support ticket. You can find the Cloudflare Ray ID on the block page in your browser."
|
|
12626
|
+
},
|
|
12627
|
+
{
|
|
12628
|
+
text: `${method} ${resource} -> ${status} ${statusText}`
|
|
12629
|
+
}
|
|
12630
|
+
],
|
|
12631
|
+
status,
|
|
12632
|
+
telemetryMessage: false
|
|
12633
|
+
});
|
|
12634
|
+
}
|
|
12635
|
+
__name(throwWAFBlockError, "throwWAFBlockError");
|
|
12636
|
+
function hasCursor(result_info) {
|
|
12637
|
+
const cursor = result_info?.cursor;
|
|
12638
|
+
return cursor !== void 0 && cursor !== null && cursor !== "";
|
|
12639
|
+
}
|
|
12640
|
+
__name(hasCursor, "hasCursor");
|
|
12641
|
+
function maybeAddTraceHeader(headers) {
|
|
12642
|
+
const traceHeader = getTraceHeader();
|
|
12643
|
+
if (traceHeader) {
|
|
12644
|
+
headers.set("Cf-Trace-Id", traceHeader);
|
|
12645
|
+
}
|
|
12646
|
+
}
|
|
12647
|
+
__name(maybeAddTraceHeader, "maybeAddTraceHeader");
|
|
12648
|
+
function cloneHeaders(headers) {
|
|
12649
|
+
return new Headers(headers);
|
|
12650
|
+
}
|
|
12651
|
+
__name(cloneHeaders, "cloneHeaders");
|
|
12652
|
+
|
|
12653
|
+
// src/update-check.ts
|
|
12654
|
+
var import_update_check = __toESM(require_update_check());
|
|
12655
|
+
var UPDATE_CHECK_TIMEOUT_MS = 3e3;
|
|
12656
|
+
var TIMED_OUT = Symbol("timed_out");
|
|
12657
|
+
async function fetchLatestNpmVersion(name, version) {
|
|
12658
|
+
let result = null;
|
|
12659
|
+
try {
|
|
12660
|
+
result = await Promise.race([
|
|
12661
|
+
(0, import_update_check.default)(
|
|
12662
|
+
{ name, version },
|
|
12663
|
+
{
|
|
12664
|
+
distTag: version.startsWith("0.0.0") ? "beta" : "latest"
|
|
12665
|
+
}
|
|
12666
|
+
),
|
|
12667
|
+
timersPromises.setTimeout(UPDATE_CHECK_TIMEOUT_MS, TIMED_OUT, {
|
|
12668
|
+
ref: false
|
|
12669
|
+
})
|
|
12670
|
+
]);
|
|
12671
|
+
} catch {
|
|
12672
|
+
return { status: "failed" };
|
|
12673
|
+
}
|
|
12674
|
+
if (result === TIMED_OUT) {
|
|
12675
|
+
return { status: "failed" };
|
|
12676
|
+
}
|
|
12677
|
+
if (result === null) {
|
|
12678
|
+
return { status: "up-to-date" };
|
|
12679
|
+
}
|
|
12680
|
+
return { status: "update-available", latest: result.latest };
|
|
12681
|
+
}
|
|
12682
|
+
__name(fetchLatestNpmVersion, "fetchLatestNpmVersion");
|
|
12683
|
+
/*! Bundled license information:
|
|
12684
|
+
|
|
12685
|
+
deep-extend/lib/deep-extend.js:
|
|
12686
|
+
(*!
|
|
12687
|
+
* @description Recursive object extending
|
|
12688
|
+
* @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
|
|
12689
|
+
* @license MIT
|
|
12690
|
+
*
|
|
12691
|
+
* The MIT License (MIT)
|
|
12692
|
+
*
|
|
12693
|
+
* Copyright (c) 2013-2018 Viacheslav Lotsmanov
|
|
12694
|
+
*
|
|
12695
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
12696
|
+
* this software and associated documentation files (the "Software"), to deal in
|
|
12697
|
+
* the Software without restriction, including without limitation the rights to
|
|
12698
|
+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
12699
|
+
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
12700
|
+
* subject to the following conditions:
|
|
12701
|
+
*
|
|
12702
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
12703
|
+
* copies or substantial portions of the Software.
|
|
12704
|
+
*
|
|
12705
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
12706
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
12707
|
+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
12708
|
+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
12709
|
+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
12710
|
+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
12711
|
+
*)
|
|
12712
|
+
|
|
12713
|
+
safe-buffer/index.js:
|
|
12714
|
+
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
12715
|
+
*/
|
|
12716
|
+
|
|
12717
|
+
export { COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, Diagnostics, PatchConfigError, addAuthorizationHeader, bucketFormatMessage, defaultWranglerConfig, experimental_patchConfig, extractAccountTag, extractWAFBlockRayId, fetchInternalBase, fetchLatestNpmVersion, fetchListResultBase, fetchResultBase, 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, hasCursor, hasMorePages, hasProperty, isDockerfile, isOptionalProperty, isPagesConfig, isRequiredProperty, isValidR2BucketName, isWAFBlockResponse, maybeAddTraceHeader, normalizeAndValidateConfig, performApiFetchBase, renderError, spawnCloudflared, startTunnel, sweepStaleWranglerTmpDirs, throwFetchError, truncate, validatePagesConfig };
|