@slidev/cli 0.43.15 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{build-MH7MLIPF.mjs → build-LX2GXXQG.mjs} +3 -3
- package/dist/{chunk-4TC2LEB7.mjs → chunk-G3XS4CNO.mjs} +1122 -836
- package/dist/{chunk-JZDN7P5W.mjs → chunk-VHBBQ77F.mjs} +13 -12
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +11 -6
- package/dist/{export-LYIOCUF2.mjs → export-T7HYPK5J.mjs} +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/{unocss-BTVZWCXM.mjs → unocss-GHP27KVT.mjs} +1 -1
- package/dist/{windicss-MS4GFOSZ.mjs → windicss-SDUK26CZ.mjs} +1 -1
- package/package.json +25 -25
- package/template.md +1 -1
- /package/dist/{chunk-65ITIFTL.mjs → chunk-BXO7ZPPU.mjs} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ViteSlidevPlugin,
|
|
3
3
|
mergeViteConfigs
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VHBBQ77F.mjs";
|
|
5
5
|
import {
|
|
6
6
|
packageExists,
|
|
7
7
|
resolveImportPath
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
__commonJS,
|
|
11
11
|
__toESM
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-BXO7ZPPU.mjs";
|
|
13
13
|
|
|
14
14
|
// ../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/internal/constants.js
|
|
15
15
|
var require_constants = __commonJS({
|
|
@@ -142,14 +142,14 @@ var require_parse_options = __commonJS({
|
|
|
142
142
|
"use strict";
|
|
143
143
|
var looseOption = Object.freeze({ loose: true });
|
|
144
144
|
var emptyOpts = Object.freeze({});
|
|
145
|
-
var parseOptions = (
|
|
146
|
-
if (!
|
|
145
|
+
var parseOptions = (options2) => {
|
|
146
|
+
if (!options2) {
|
|
147
147
|
return emptyOpts;
|
|
148
148
|
}
|
|
149
|
-
if (typeof
|
|
149
|
+
if (typeof options2 !== "object") {
|
|
150
150
|
return looseOption;
|
|
151
151
|
}
|
|
152
|
-
return
|
|
152
|
+
return options2;
|
|
153
153
|
};
|
|
154
154
|
module.exports = parseOptions;
|
|
155
155
|
}
|
|
@@ -187,10 +187,10 @@ var require_semver = __commonJS({
|
|
|
187
187
|
var parseOptions = require_parse_options();
|
|
188
188
|
var { compareIdentifiers } = require_identifiers();
|
|
189
189
|
var SemVer = class _SemVer {
|
|
190
|
-
constructor(version3,
|
|
191
|
-
|
|
190
|
+
constructor(version3, options2) {
|
|
191
|
+
options2 = parseOptions(options2);
|
|
192
192
|
if (version3 instanceof _SemVer) {
|
|
193
|
-
if (version3.loose === !!
|
|
193
|
+
if (version3.loose === !!options2.loose && version3.includePrerelease === !!options2.includePrerelease) {
|
|
194
194
|
return version3;
|
|
195
195
|
} else {
|
|
196
196
|
version3 = version3.version;
|
|
@@ -203,11 +203,11 @@ var require_semver = __commonJS({
|
|
|
203
203
|
`version is longer than ${MAX_LENGTH} characters`
|
|
204
204
|
);
|
|
205
205
|
}
|
|
206
|
-
debug2("SemVer", version3,
|
|
207
|
-
this.options =
|
|
208
|
-
this.loose = !!
|
|
209
|
-
this.includePrerelease = !!
|
|
210
|
-
const m = version3.trim().match(
|
|
206
|
+
debug2("SemVer", version3, options2);
|
|
207
|
+
this.options = options2;
|
|
208
|
+
this.loose = !!options2.loose;
|
|
209
|
+
this.includePrerelease = !!options2.includePrerelease;
|
|
210
|
+
const m = version3.trim().match(options2.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
211
211
|
if (!m) {
|
|
212
212
|
throw new TypeError(`Invalid Version: ${version3}`);
|
|
213
213
|
}
|
|
@@ -425,12 +425,12 @@ var require_parse = __commonJS({
|
|
|
425
425
|
"../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/parse.js"(exports, module) {
|
|
426
426
|
"use strict";
|
|
427
427
|
var SemVer = require_semver();
|
|
428
|
-
var parse2 = (version3,
|
|
428
|
+
var parse2 = (version3, options2, throwErrors = false) => {
|
|
429
429
|
if (version3 instanceof SemVer) {
|
|
430
430
|
return version3;
|
|
431
431
|
}
|
|
432
432
|
try {
|
|
433
|
-
return new SemVer(version3,
|
|
433
|
+
return new SemVer(version3, options2);
|
|
434
434
|
} catch (er) {
|
|
435
435
|
if (!throwErrors) {
|
|
436
436
|
return null;
|
|
@@ -447,8 +447,8 @@ var require_valid = __commonJS({
|
|
|
447
447
|
"../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/valid.js"(exports, module) {
|
|
448
448
|
"use strict";
|
|
449
449
|
var parse2 = require_parse();
|
|
450
|
-
var valid = (version3,
|
|
451
|
-
const v = parse2(version3,
|
|
450
|
+
var valid = (version3, options2) => {
|
|
451
|
+
const v = parse2(version3, options2);
|
|
452
452
|
return v ? v.version : null;
|
|
453
453
|
};
|
|
454
454
|
module.exports = valid;
|
|
@@ -460,8 +460,8 @@ var require_clean = __commonJS({
|
|
|
460
460
|
"../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/clean.js"(exports, module) {
|
|
461
461
|
"use strict";
|
|
462
462
|
var parse2 = require_parse();
|
|
463
|
-
var clean = (version3,
|
|
464
|
-
const s = parse2(version3.trim().replace(/^[=v]+/, ""),
|
|
463
|
+
var clean = (version3, options2) => {
|
|
464
|
+
const s = parse2(version3.trim().replace(/^[=v]+/, ""), options2);
|
|
465
465
|
return s ? s.version : null;
|
|
466
466
|
};
|
|
467
467
|
module.exports = clean;
|
|
@@ -473,16 +473,16 @@ var require_inc = __commonJS({
|
|
|
473
473
|
"../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/inc.js"(exports, module) {
|
|
474
474
|
"use strict";
|
|
475
475
|
var SemVer = require_semver();
|
|
476
|
-
var inc = (version3, release,
|
|
477
|
-
if (typeof
|
|
476
|
+
var inc = (version3, release, options2, identifier, identifierBase) => {
|
|
477
|
+
if (typeof options2 === "string") {
|
|
478
478
|
identifierBase = identifier;
|
|
479
|
-
identifier =
|
|
480
|
-
|
|
479
|
+
identifier = options2;
|
|
480
|
+
options2 = void 0;
|
|
481
481
|
}
|
|
482
482
|
try {
|
|
483
483
|
return new SemVer(
|
|
484
484
|
version3 instanceof SemVer ? version3.version : version3,
|
|
485
|
-
|
|
485
|
+
options2
|
|
486
486
|
).inc(release, identifier, identifierBase).version;
|
|
487
487
|
} catch (er) {
|
|
488
488
|
return null;
|
|
@@ -572,8 +572,8 @@ var require_prerelease = __commonJS({
|
|
|
572
572
|
"../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/prerelease.js"(exports, module) {
|
|
573
573
|
"use strict";
|
|
574
574
|
var parse2 = require_parse();
|
|
575
|
-
var prerelease = (version3,
|
|
576
|
-
const parsed = parse2(version3,
|
|
575
|
+
var prerelease = (version3, options2) => {
|
|
576
|
+
const parsed = parse2(version3, options2);
|
|
577
577
|
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
578
578
|
};
|
|
579
579
|
module.exports = prerelease;
|
|
@@ -761,7 +761,7 @@ var require_coerce = __commonJS({
|
|
|
761
761
|
var SemVer = require_semver();
|
|
762
762
|
var parse2 = require_parse();
|
|
763
763
|
var { safeRe: re, t } = require_re();
|
|
764
|
-
var coerce = (version3,
|
|
764
|
+
var coerce = (version3, options2) => {
|
|
765
765
|
if (version3 instanceof SemVer) {
|
|
766
766
|
return version3;
|
|
767
767
|
}
|
|
@@ -771,9 +771,9 @@ var require_coerce = __commonJS({
|
|
|
771
771
|
if (typeof version3 !== "string") {
|
|
772
772
|
return null;
|
|
773
773
|
}
|
|
774
|
-
|
|
774
|
+
options2 = options2 || {};
|
|
775
775
|
let match = null;
|
|
776
|
-
if (!
|
|
776
|
+
if (!options2.rtl) {
|
|
777
777
|
match = version3.match(re[t.COERCE]);
|
|
778
778
|
} else {
|
|
779
779
|
let next;
|
|
@@ -788,7 +788,7 @@ var require_coerce = __commonJS({
|
|
|
788
788
|
if (match === null) {
|
|
789
789
|
return null;
|
|
790
790
|
}
|
|
791
|
-
return parse2(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`,
|
|
791
|
+
return parse2(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options2);
|
|
792
792
|
};
|
|
793
793
|
module.exports = coerce;
|
|
794
794
|
}
|
|
@@ -1194,23 +1194,23 @@ var require_lru_cache = __commonJS({
|
|
|
1194
1194
|
var UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet");
|
|
1195
1195
|
var naiveLength = () => 1;
|
|
1196
1196
|
var LRUCache = class {
|
|
1197
|
-
constructor(
|
|
1198
|
-
if (typeof
|
|
1199
|
-
|
|
1200
|
-
if (!
|
|
1201
|
-
|
|
1202
|
-
if (
|
|
1197
|
+
constructor(options2) {
|
|
1198
|
+
if (typeof options2 === "number")
|
|
1199
|
+
options2 = { max: options2 };
|
|
1200
|
+
if (!options2)
|
|
1201
|
+
options2 = {};
|
|
1202
|
+
if (options2.max && (typeof options2.max !== "number" || options2.max < 0))
|
|
1203
1203
|
throw new TypeError("max must be a non-negative number");
|
|
1204
|
-
const max = this[MAX] =
|
|
1205
|
-
const lc =
|
|
1204
|
+
const max = this[MAX] = options2.max || Infinity;
|
|
1205
|
+
const lc = options2.length || naiveLength;
|
|
1206
1206
|
this[LENGTH_CALCULATOR] = typeof lc !== "function" ? naiveLength : lc;
|
|
1207
|
-
this[ALLOW_STALE] =
|
|
1208
|
-
if (
|
|
1207
|
+
this[ALLOW_STALE] = options2.stale || false;
|
|
1208
|
+
if (options2.maxAge && typeof options2.maxAge !== "number")
|
|
1209
1209
|
throw new TypeError("maxAge must be a number");
|
|
1210
|
-
this[MAX_AGE] =
|
|
1211
|
-
this[DISPOSE] =
|
|
1212
|
-
this[NO_DISPOSE_ON_SET] =
|
|
1213
|
-
this[UPDATE_AGE_ON_GET] =
|
|
1210
|
+
this[MAX_AGE] = options2.maxAge || 0;
|
|
1211
|
+
this[DISPOSE] = options2.dispose;
|
|
1212
|
+
this[NO_DISPOSE_ON_SET] = options2.noDisposeOnSet || false;
|
|
1213
|
+
this[UPDATE_AGE_ON_GET] = options2.updateAgeOnGet || false;
|
|
1214
1214
|
this.reset();
|
|
1215
1215
|
}
|
|
1216
1216
|
// resize the cache when the max changes.
|
|
@@ -1452,13 +1452,13 @@ var require_range = __commonJS({
|
|
|
1452
1452
|
"../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/classes/range.js"(exports, module) {
|
|
1453
1453
|
"use strict";
|
|
1454
1454
|
var Range = class _Range {
|
|
1455
|
-
constructor(range,
|
|
1456
|
-
|
|
1455
|
+
constructor(range, options2) {
|
|
1456
|
+
options2 = parseOptions(options2);
|
|
1457
1457
|
if (range instanceof _Range) {
|
|
1458
|
-
if (range.loose === !!
|
|
1458
|
+
if (range.loose === !!options2.loose && range.includePrerelease === !!options2.includePrerelease) {
|
|
1459
1459
|
return range;
|
|
1460
1460
|
} else {
|
|
1461
|
-
return new _Range(range.raw,
|
|
1461
|
+
return new _Range(range.raw, options2);
|
|
1462
1462
|
}
|
|
1463
1463
|
}
|
|
1464
1464
|
if (range instanceof Comparator) {
|
|
@@ -1467,9 +1467,9 @@ var require_range = __commonJS({
|
|
|
1467
1467
|
this.format();
|
|
1468
1468
|
return this;
|
|
1469
1469
|
}
|
|
1470
|
-
this.options =
|
|
1471
|
-
this.loose = !!
|
|
1472
|
-
this.includePrerelease = !!
|
|
1470
|
+
this.options = options2;
|
|
1471
|
+
this.loose = !!options2.loose;
|
|
1472
|
+
this.includePrerelease = !!options2.includePrerelease;
|
|
1473
1473
|
this.raw = range.trim().split(/\s+/).join(" ");
|
|
1474
1474
|
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c2) => c2.length);
|
|
1475
1475
|
if (!this.set.length) {
|
|
@@ -1538,15 +1538,15 @@ var require_range = __commonJS({
|
|
|
1538
1538
|
cache.set(memoKey, result);
|
|
1539
1539
|
return result;
|
|
1540
1540
|
}
|
|
1541
|
-
intersects(range,
|
|
1541
|
+
intersects(range, options2) {
|
|
1542
1542
|
if (!(range instanceof _Range)) {
|
|
1543
1543
|
throw new TypeError("a Range is required");
|
|
1544
1544
|
}
|
|
1545
1545
|
return this.set.some((thisComparators) => {
|
|
1546
|
-
return isSatisfiable(thisComparators,
|
|
1547
|
-
return isSatisfiable(rangeComparators,
|
|
1546
|
+
return isSatisfiable(thisComparators, options2) && range.set.some((rangeComparators) => {
|
|
1547
|
+
return isSatisfiable(rangeComparators, options2) && thisComparators.every((thisComparator) => {
|
|
1548
1548
|
return rangeComparators.every((rangeComparator) => {
|
|
1549
|
-
return thisComparator.intersects(rangeComparator,
|
|
1549
|
+
return thisComparator.intersects(rangeComparator, options2);
|
|
1550
1550
|
});
|
|
1551
1551
|
});
|
|
1552
1552
|
});
|
|
@@ -1589,36 +1589,36 @@ var require_range = __commonJS({
|
|
|
1589
1589
|
var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
1590
1590
|
var isNullSet = (c2) => c2.value === "<0.0.0-0";
|
|
1591
1591
|
var isAny = (c2) => c2.value === "";
|
|
1592
|
-
var isSatisfiable = (comparators,
|
|
1592
|
+
var isSatisfiable = (comparators, options2) => {
|
|
1593
1593
|
let result = true;
|
|
1594
1594
|
const remainingComparators = comparators.slice();
|
|
1595
1595
|
let testComparator = remainingComparators.pop();
|
|
1596
1596
|
while (result && remainingComparators.length) {
|
|
1597
1597
|
result = remainingComparators.every((otherComparator) => {
|
|
1598
|
-
return testComparator.intersects(otherComparator,
|
|
1598
|
+
return testComparator.intersects(otherComparator, options2);
|
|
1599
1599
|
});
|
|
1600
1600
|
testComparator = remainingComparators.pop();
|
|
1601
1601
|
}
|
|
1602
1602
|
return result;
|
|
1603
1603
|
};
|
|
1604
|
-
var parseComparator = (comp,
|
|
1605
|
-
debug2("comp", comp,
|
|
1606
|
-
comp = replaceCarets(comp,
|
|
1604
|
+
var parseComparator = (comp, options2) => {
|
|
1605
|
+
debug2("comp", comp, options2);
|
|
1606
|
+
comp = replaceCarets(comp, options2);
|
|
1607
1607
|
debug2("caret", comp);
|
|
1608
|
-
comp = replaceTildes(comp,
|
|
1608
|
+
comp = replaceTildes(comp, options2);
|
|
1609
1609
|
debug2("tildes", comp);
|
|
1610
|
-
comp = replaceXRanges(comp,
|
|
1610
|
+
comp = replaceXRanges(comp, options2);
|
|
1611
1611
|
debug2("xrange", comp);
|
|
1612
|
-
comp = replaceStars(comp,
|
|
1612
|
+
comp = replaceStars(comp, options2);
|
|
1613
1613
|
debug2("stars", comp);
|
|
1614
1614
|
return comp;
|
|
1615
1615
|
};
|
|
1616
1616
|
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
1617
|
-
var replaceTildes = (comp,
|
|
1618
|
-
return comp.trim().split(/\s+/).map((c2) => replaceTilde(c2,
|
|
1617
|
+
var replaceTildes = (comp, options2) => {
|
|
1618
|
+
return comp.trim().split(/\s+/).map((c2) => replaceTilde(c2, options2)).join(" ");
|
|
1619
1619
|
};
|
|
1620
|
-
var replaceTilde = (comp,
|
|
1621
|
-
const r =
|
|
1620
|
+
var replaceTilde = (comp, options2) => {
|
|
1621
|
+
const r = options2.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
1622
1622
|
return comp.replace(r, (_, M, m, p, pr) => {
|
|
1623
1623
|
debug2("tilde", comp, _, M, m, p, pr);
|
|
1624
1624
|
let ret;
|
|
@@ -1638,13 +1638,13 @@ var require_range = __commonJS({
|
|
|
1638
1638
|
return ret;
|
|
1639
1639
|
});
|
|
1640
1640
|
};
|
|
1641
|
-
var replaceCarets = (comp,
|
|
1642
|
-
return comp.trim().split(/\s+/).map((c2) => replaceCaret(c2,
|
|
1641
|
+
var replaceCarets = (comp, options2) => {
|
|
1642
|
+
return comp.trim().split(/\s+/).map((c2) => replaceCaret(c2, options2)).join(" ");
|
|
1643
1643
|
};
|
|
1644
|
-
var replaceCaret = (comp,
|
|
1645
|
-
debug2("caret", comp,
|
|
1646
|
-
const r =
|
|
1647
|
-
const z =
|
|
1644
|
+
var replaceCaret = (comp, options2) => {
|
|
1645
|
+
debug2("caret", comp, options2);
|
|
1646
|
+
const r = options2.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
1647
|
+
const z = options2.includePrerelease ? "-0" : "";
|
|
1648
1648
|
return comp.replace(r, (_, M, m, p, pr) => {
|
|
1649
1649
|
debug2("caret", comp, _, M, m, p, pr);
|
|
1650
1650
|
let ret;
|
|
@@ -1685,13 +1685,13 @@ var require_range = __commonJS({
|
|
|
1685
1685
|
return ret;
|
|
1686
1686
|
});
|
|
1687
1687
|
};
|
|
1688
|
-
var replaceXRanges = (comp,
|
|
1689
|
-
debug2("replaceXRanges", comp,
|
|
1690
|
-
return comp.split(/\s+/).map((c2) => replaceXRange(c2,
|
|
1688
|
+
var replaceXRanges = (comp, options2) => {
|
|
1689
|
+
debug2("replaceXRanges", comp, options2);
|
|
1690
|
+
return comp.split(/\s+/).map((c2) => replaceXRange(c2, options2)).join(" ");
|
|
1691
1691
|
};
|
|
1692
|
-
var replaceXRange = (comp,
|
|
1692
|
+
var replaceXRange = (comp, options2) => {
|
|
1693
1693
|
comp = comp.trim();
|
|
1694
|
-
const r =
|
|
1694
|
+
const r = options2.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
1695
1695
|
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
1696
1696
|
debug2("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
1697
1697
|
const xM = isX(M);
|
|
@@ -1701,7 +1701,7 @@ var require_range = __commonJS({
|
|
|
1701
1701
|
if (gtlt === "=" && anyX) {
|
|
1702
1702
|
gtlt = "";
|
|
1703
1703
|
}
|
|
1704
|
-
pr =
|
|
1704
|
+
pr = options2.includePrerelease ? "-0" : "";
|
|
1705
1705
|
if (xM) {
|
|
1706
1706
|
if (gtlt === ">" || gtlt === "<") {
|
|
1707
1707
|
ret = "<0.0.0-0";
|
|
@@ -1744,13 +1744,13 @@ var require_range = __commonJS({
|
|
|
1744
1744
|
return ret;
|
|
1745
1745
|
});
|
|
1746
1746
|
};
|
|
1747
|
-
var replaceStars = (comp,
|
|
1748
|
-
debug2("replaceStars", comp,
|
|
1747
|
+
var replaceStars = (comp, options2) => {
|
|
1748
|
+
debug2("replaceStars", comp, options2);
|
|
1749
1749
|
return comp.trim().replace(re[t.STAR], "");
|
|
1750
1750
|
};
|
|
1751
|
-
var replaceGTE0 = (comp,
|
|
1752
|
-
debug2("replaceGTE0", comp,
|
|
1753
|
-
return comp.trim().replace(re[
|
|
1751
|
+
var replaceGTE0 = (comp, options2) => {
|
|
1752
|
+
debug2("replaceGTE0", comp, options2);
|
|
1753
|
+
return comp.trim().replace(re[options2.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
1754
1754
|
};
|
|
1755
1755
|
var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => {
|
|
1756
1756
|
if (isX(fM)) {
|
|
@@ -1779,13 +1779,13 @@ var require_range = __commonJS({
|
|
|
1779
1779
|
}
|
|
1780
1780
|
return `${from} ${to}`.trim();
|
|
1781
1781
|
};
|
|
1782
|
-
var testSet = (set, version3,
|
|
1782
|
+
var testSet = (set, version3, options2) => {
|
|
1783
1783
|
for (let i = 0; i < set.length; i++) {
|
|
1784
1784
|
if (!set[i].test(version3)) {
|
|
1785
1785
|
return false;
|
|
1786
1786
|
}
|
|
1787
1787
|
}
|
|
1788
|
-
if (version3.prerelease.length && !
|
|
1788
|
+
if (version3.prerelease.length && !options2.includePrerelease) {
|
|
1789
1789
|
for (let i = 0; i < set.length; i++) {
|
|
1790
1790
|
debug2(set[i].semver);
|
|
1791
1791
|
if (set[i].semver === Comparator.ANY) {
|
|
@@ -1814,19 +1814,19 @@ var require_comparator = __commonJS({
|
|
|
1814
1814
|
static get ANY() {
|
|
1815
1815
|
return ANY;
|
|
1816
1816
|
}
|
|
1817
|
-
constructor(comp,
|
|
1818
|
-
|
|
1817
|
+
constructor(comp, options2) {
|
|
1818
|
+
options2 = parseOptions(options2);
|
|
1819
1819
|
if (comp instanceof _Comparator) {
|
|
1820
|
-
if (comp.loose === !!
|
|
1820
|
+
if (comp.loose === !!options2.loose) {
|
|
1821
1821
|
return comp;
|
|
1822
1822
|
} else {
|
|
1823
1823
|
comp = comp.value;
|
|
1824
1824
|
}
|
|
1825
1825
|
}
|
|
1826
1826
|
comp = comp.trim().split(/\s+/).join(" ");
|
|
1827
|
-
debug2("comparator", comp,
|
|
1828
|
-
this.options =
|
|
1829
|
-
this.loose = !!
|
|
1827
|
+
debug2("comparator", comp, options2);
|
|
1828
|
+
this.options = options2;
|
|
1829
|
+
this.loose = !!options2.loose;
|
|
1830
1830
|
this.parse(comp);
|
|
1831
1831
|
if (this.semver === ANY) {
|
|
1832
1832
|
this.value = "";
|
|
@@ -1868,7 +1868,7 @@ var require_comparator = __commonJS({
|
|
|
1868
1868
|
}
|
|
1869
1869
|
return cmp(version3, this.operator, this.semver, this.options);
|
|
1870
1870
|
}
|
|
1871
|
-
intersects(comp,
|
|
1871
|
+
intersects(comp, options2) {
|
|
1872
1872
|
if (!(comp instanceof _Comparator)) {
|
|
1873
1873
|
throw new TypeError("a Comparator is required");
|
|
1874
1874
|
}
|
|
@@ -1876,18 +1876,18 @@ var require_comparator = __commonJS({
|
|
|
1876
1876
|
if (this.value === "") {
|
|
1877
1877
|
return true;
|
|
1878
1878
|
}
|
|
1879
|
-
return new Range(comp.value,
|
|
1879
|
+
return new Range(comp.value, options2).test(this.value);
|
|
1880
1880
|
} else if (comp.operator === "") {
|
|
1881
1881
|
if (comp.value === "") {
|
|
1882
1882
|
return true;
|
|
1883
1883
|
}
|
|
1884
|
-
return new Range(this.value,
|
|
1884
|
+
return new Range(this.value, options2).test(comp.semver);
|
|
1885
1885
|
}
|
|
1886
|
-
|
|
1887
|
-
if (
|
|
1886
|
+
options2 = parseOptions(options2);
|
|
1887
|
+
if (options2.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
|
|
1888
1888
|
return false;
|
|
1889
1889
|
}
|
|
1890
|
-
if (!
|
|
1890
|
+
if (!options2.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
|
|
1891
1891
|
return false;
|
|
1892
1892
|
}
|
|
1893
1893
|
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
|
|
@@ -1899,10 +1899,10 @@ var require_comparator = __commonJS({
|
|
|
1899
1899
|
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
|
|
1900
1900
|
return true;
|
|
1901
1901
|
}
|
|
1902
|
-
if (cmp(this.semver, "<", comp.semver,
|
|
1902
|
+
if (cmp(this.semver, "<", comp.semver, options2) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
|
|
1903
1903
|
return true;
|
|
1904
1904
|
}
|
|
1905
|
-
if (cmp(this.semver, ">", comp.semver,
|
|
1905
|
+
if (cmp(this.semver, ">", comp.semver, options2) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
|
|
1906
1906
|
return true;
|
|
1907
1907
|
}
|
|
1908
1908
|
return false;
|
|
@@ -1923,9 +1923,9 @@ var require_satisfies = __commonJS({
|
|
|
1923
1923
|
"../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/satisfies.js"(exports, module) {
|
|
1924
1924
|
"use strict";
|
|
1925
1925
|
var Range = require_range();
|
|
1926
|
-
var satisfies3 = (version3, range,
|
|
1926
|
+
var satisfies3 = (version3, range, options2) => {
|
|
1927
1927
|
try {
|
|
1928
|
-
range = new Range(range,
|
|
1928
|
+
range = new Range(range, options2);
|
|
1929
1929
|
} catch (er) {
|
|
1930
1930
|
return false;
|
|
1931
1931
|
}
|
|
@@ -1940,7 +1940,7 @@ var require_to_comparators = __commonJS({
|
|
|
1940
1940
|
"../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/ranges/to-comparators.js"(exports, module) {
|
|
1941
1941
|
"use strict";
|
|
1942
1942
|
var Range = require_range();
|
|
1943
|
-
var toComparators = (range,
|
|
1943
|
+
var toComparators = (range, options2) => new Range(range, options2).set.map((comp) => comp.map((c2) => c2.value).join(" ").trim().split(" "));
|
|
1944
1944
|
module.exports = toComparators;
|
|
1945
1945
|
}
|
|
1946
1946
|
});
|
|
@@ -1951,12 +1951,12 @@ var require_max_satisfying = __commonJS({
|
|
|
1951
1951
|
"use strict";
|
|
1952
1952
|
var SemVer = require_semver();
|
|
1953
1953
|
var Range = require_range();
|
|
1954
|
-
var maxSatisfying = (versions, range,
|
|
1954
|
+
var maxSatisfying = (versions, range, options2) => {
|
|
1955
1955
|
let max = null;
|
|
1956
1956
|
let maxSV = null;
|
|
1957
1957
|
let rangeObj = null;
|
|
1958
1958
|
try {
|
|
1959
|
-
rangeObj = new Range(range,
|
|
1959
|
+
rangeObj = new Range(range, options2);
|
|
1960
1960
|
} catch (er) {
|
|
1961
1961
|
return null;
|
|
1962
1962
|
}
|
|
@@ -1964,7 +1964,7 @@ var require_max_satisfying = __commonJS({
|
|
|
1964
1964
|
if (rangeObj.test(v)) {
|
|
1965
1965
|
if (!max || maxSV.compare(v) === -1) {
|
|
1966
1966
|
max = v;
|
|
1967
|
-
maxSV = new SemVer(max,
|
|
1967
|
+
maxSV = new SemVer(max, options2);
|
|
1968
1968
|
}
|
|
1969
1969
|
}
|
|
1970
1970
|
});
|
|
@@ -1980,12 +1980,12 @@ var require_min_satisfying = __commonJS({
|
|
|
1980
1980
|
"use strict";
|
|
1981
1981
|
var SemVer = require_semver();
|
|
1982
1982
|
var Range = require_range();
|
|
1983
|
-
var minSatisfying = (versions, range,
|
|
1983
|
+
var minSatisfying = (versions, range, options2) => {
|
|
1984
1984
|
let min = null;
|
|
1985
1985
|
let minSV = null;
|
|
1986
1986
|
let rangeObj = null;
|
|
1987
1987
|
try {
|
|
1988
|
-
rangeObj = new Range(range,
|
|
1988
|
+
rangeObj = new Range(range, options2);
|
|
1989
1989
|
} catch (er) {
|
|
1990
1990
|
return null;
|
|
1991
1991
|
}
|
|
@@ -1993,7 +1993,7 @@ var require_min_satisfying = __commonJS({
|
|
|
1993
1993
|
if (rangeObj.test(v)) {
|
|
1994
1994
|
if (!min || minSV.compare(v) === 1) {
|
|
1995
1995
|
min = v;
|
|
1996
|
-
minSV = new SemVer(min,
|
|
1996
|
+
minSV = new SemVer(min, options2);
|
|
1997
1997
|
}
|
|
1998
1998
|
}
|
|
1999
1999
|
});
|
|
@@ -2065,9 +2065,9 @@ var require_valid2 = __commonJS({
|
|
|
2065
2065
|
"../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/ranges/valid.js"(exports, module) {
|
|
2066
2066
|
"use strict";
|
|
2067
2067
|
var Range = require_range();
|
|
2068
|
-
var validRange = (range,
|
|
2068
|
+
var validRange = (range, options2) => {
|
|
2069
2069
|
try {
|
|
2070
|
-
return new Range(range,
|
|
2070
|
+
return new Range(range, options2).range || "*";
|
|
2071
2071
|
} catch (er) {
|
|
2072
2072
|
return null;
|
|
2073
2073
|
}
|
|
@@ -2089,9 +2089,9 @@ var require_outside = __commonJS({
|
|
|
2089
2089
|
var lt = require_lt();
|
|
2090
2090
|
var lte = require_lte();
|
|
2091
2091
|
var gte = require_gte();
|
|
2092
|
-
var outside = (version3, range, hilo,
|
|
2093
|
-
version3 = new SemVer(version3,
|
|
2094
|
-
range = new Range(range,
|
|
2092
|
+
var outside = (version3, range, hilo, options2) => {
|
|
2093
|
+
version3 = new SemVer(version3, options2);
|
|
2094
|
+
range = new Range(range, options2);
|
|
2095
2095
|
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
2096
2096
|
switch (hilo) {
|
|
2097
2097
|
case ">":
|
|
@@ -2111,7 +2111,7 @@ var require_outside = __commonJS({
|
|
|
2111
2111
|
default:
|
|
2112
2112
|
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
2113
2113
|
}
|
|
2114
|
-
if (satisfies3(version3, range,
|
|
2114
|
+
if (satisfies3(version3, range, options2)) {
|
|
2115
2115
|
return false;
|
|
2116
2116
|
}
|
|
2117
2117
|
for (let i = 0; i < range.set.length; ++i) {
|
|
@@ -2124,9 +2124,9 @@ var require_outside = __commonJS({
|
|
|
2124
2124
|
}
|
|
2125
2125
|
high = high || comparator;
|
|
2126
2126
|
low = low || comparator;
|
|
2127
|
-
if (gtfn(comparator.semver, high.semver,
|
|
2127
|
+
if (gtfn(comparator.semver, high.semver, options2)) {
|
|
2128
2128
|
high = comparator;
|
|
2129
|
-
} else if (ltfn(comparator.semver, low.semver,
|
|
2129
|
+
} else if (ltfn(comparator.semver, low.semver, options2)) {
|
|
2130
2130
|
low = comparator;
|
|
2131
2131
|
}
|
|
2132
2132
|
});
|
|
@@ -2150,7 +2150,7 @@ var require_gtr = __commonJS({
|
|
|
2150
2150
|
"../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/ranges/gtr.js"(exports, module) {
|
|
2151
2151
|
"use strict";
|
|
2152
2152
|
var outside = require_outside();
|
|
2153
|
-
var gtr = (version3, range,
|
|
2153
|
+
var gtr = (version3, range, options2) => outside(version3, range, ">", options2);
|
|
2154
2154
|
module.exports = gtr;
|
|
2155
2155
|
}
|
|
2156
2156
|
});
|
|
@@ -2160,7 +2160,7 @@ var require_ltr = __commonJS({
|
|
|
2160
2160
|
"../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/ranges/ltr.js"(exports, module) {
|
|
2161
2161
|
"use strict";
|
|
2162
2162
|
var outside = require_outside();
|
|
2163
|
-
var ltr = (version3, range,
|
|
2163
|
+
var ltr = (version3, range, options2) => outside(version3, range, "<", options2);
|
|
2164
2164
|
module.exports = ltr;
|
|
2165
2165
|
}
|
|
2166
2166
|
});
|
|
@@ -2170,10 +2170,10 @@ var require_intersects = __commonJS({
|
|
|
2170
2170
|
"../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/ranges/intersects.js"(exports, module) {
|
|
2171
2171
|
"use strict";
|
|
2172
2172
|
var Range = require_range();
|
|
2173
|
-
var intersects = (r1, r2,
|
|
2174
|
-
r1 = new Range(r1,
|
|
2175
|
-
r2 = new Range(r2,
|
|
2176
|
-
return r1.intersects(r2,
|
|
2173
|
+
var intersects = (r1, r2, options2) => {
|
|
2174
|
+
r1 = new Range(r1, options2);
|
|
2175
|
+
r2 = new Range(r2, options2);
|
|
2176
|
+
return r1.intersects(r2, options2);
|
|
2177
2177
|
};
|
|
2178
2178
|
module.exports = intersects;
|
|
2179
2179
|
}
|
|
@@ -2185,13 +2185,13 @@ var require_simplify = __commonJS({
|
|
|
2185
2185
|
"use strict";
|
|
2186
2186
|
var satisfies3 = require_satisfies();
|
|
2187
2187
|
var compare = require_compare();
|
|
2188
|
-
module.exports = (versions, range,
|
|
2188
|
+
module.exports = (versions, range, options2) => {
|
|
2189
2189
|
const set = [];
|
|
2190
2190
|
let first = null;
|
|
2191
2191
|
let prev = null;
|
|
2192
|
-
const v = versions.sort((a, b) => compare(a, b,
|
|
2192
|
+
const v = versions.sort((a, b) => compare(a, b, options2));
|
|
2193
2193
|
for (const version3 of v) {
|
|
2194
|
-
const included = satisfies3(version3, range,
|
|
2194
|
+
const included = satisfies3(version3, range, options2);
|
|
2195
2195
|
if (included) {
|
|
2196
2196
|
prev = version3;
|
|
2197
2197
|
if (!first) {
|
|
@@ -2238,17 +2238,17 @@ var require_subset = __commonJS({
|
|
|
2238
2238
|
var { ANY } = Comparator;
|
|
2239
2239
|
var satisfies3 = require_satisfies();
|
|
2240
2240
|
var compare = require_compare();
|
|
2241
|
-
var subset = (sub, dom,
|
|
2241
|
+
var subset = (sub, dom, options2 = {}) => {
|
|
2242
2242
|
if (sub === dom) {
|
|
2243
2243
|
return true;
|
|
2244
2244
|
}
|
|
2245
|
-
sub = new Range(sub,
|
|
2246
|
-
dom = new Range(dom,
|
|
2245
|
+
sub = new Range(sub, options2);
|
|
2246
|
+
dom = new Range(dom, options2);
|
|
2247
2247
|
let sawNonNull = false;
|
|
2248
2248
|
OUTER:
|
|
2249
2249
|
for (const simpleSub of sub.set) {
|
|
2250
2250
|
for (const simpleDom of dom.set) {
|
|
2251
|
-
const isSub = simpleSubset(simpleSub, simpleDom,
|
|
2251
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options2);
|
|
2252
2252
|
sawNonNull = sawNonNull || isSub !== null;
|
|
2253
2253
|
if (isSub) {
|
|
2254
2254
|
continue OUTER;
|
|
@@ -2262,21 +2262,21 @@ var require_subset = __commonJS({
|
|
|
2262
2262
|
};
|
|
2263
2263
|
var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
2264
2264
|
var minimumVersion = [new Comparator(">=0.0.0")];
|
|
2265
|
-
var simpleSubset = (sub, dom,
|
|
2265
|
+
var simpleSubset = (sub, dom, options2) => {
|
|
2266
2266
|
if (sub === dom) {
|
|
2267
2267
|
return true;
|
|
2268
2268
|
}
|
|
2269
2269
|
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
2270
2270
|
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
2271
2271
|
return true;
|
|
2272
|
-
} else if (
|
|
2272
|
+
} else if (options2.includePrerelease) {
|
|
2273
2273
|
sub = minimumVersionWithPreRelease;
|
|
2274
2274
|
} else {
|
|
2275
2275
|
sub = minimumVersion;
|
|
2276
2276
|
}
|
|
2277
2277
|
}
|
|
2278
2278
|
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
2279
|
-
if (
|
|
2279
|
+
if (options2.includePrerelease) {
|
|
2280
2280
|
return true;
|
|
2281
2281
|
} else {
|
|
2282
2282
|
dom = minimumVersion;
|
|
@@ -2286,9 +2286,9 @@ var require_subset = __commonJS({
|
|
|
2286
2286
|
let gt, lt;
|
|
2287
2287
|
for (const c2 of sub) {
|
|
2288
2288
|
if (c2.operator === ">" || c2.operator === ">=") {
|
|
2289
|
-
gt = higherGT(gt, c2,
|
|
2289
|
+
gt = higherGT(gt, c2, options2);
|
|
2290
2290
|
} else if (c2.operator === "<" || c2.operator === "<=") {
|
|
2291
|
-
lt = lowerLT(lt, c2,
|
|
2291
|
+
lt = lowerLT(lt, c2, options2);
|
|
2292
2292
|
} else {
|
|
2293
2293
|
eqSet.add(c2.semver);
|
|
2294
2294
|
}
|
|
@@ -2298,7 +2298,7 @@ var require_subset = __commonJS({
|
|
|
2298
2298
|
}
|
|
2299
2299
|
let gtltComp;
|
|
2300
2300
|
if (gt && lt) {
|
|
2301
|
-
gtltComp = compare(gt.semver, lt.semver,
|
|
2301
|
+
gtltComp = compare(gt.semver, lt.semver, options2);
|
|
2302
2302
|
if (gtltComp > 0) {
|
|
2303
2303
|
return null;
|
|
2304
2304
|
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
@@ -2306,14 +2306,14 @@ var require_subset = __commonJS({
|
|
|
2306
2306
|
}
|
|
2307
2307
|
}
|
|
2308
2308
|
for (const eq of eqSet) {
|
|
2309
|
-
if (gt && !satisfies3(eq, String(gt),
|
|
2309
|
+
if (gt && !satisfies3(eq, String(gt), options2)) {
|
|
2310
2310
|
return null;
|
|
2311
2311
|
}
|
|
2312
|
-
if (lt && !satisfies3(eq, String(lt),
|
|
2312
|
+
if (lt && !satisfies3(eq, String(lt), options2)) {
|
|
2313
2313
|
return null;
|
|
2314
2314
|
}
|
|
2315
2315
|
for (const c2 of dom) {
|
|
2316
|
-
if (!satisfies3(eq, String(c2),
|
|
2316
|
+
if (!satisfies3(eq, String(c2), options2)) {
|
|
2317
2317
|
return false;
|
|
2318
2318
|
}
|
|
2319
2319
|
}
|
|
@@ -2321,8 +2321,8 @@ var require_subset = __commonJS({
|
|
|
2321
2321
|
}
|
|
2322
2322
|
let higher, lower;
|
|
2323
2323
|
let hasDomLT, hasDomGT;
|
|
2324
|
-
let needDomLTPre = lt && !
|
|
2325
|
-
let needDomGTPre = gt && !
|
|
2324
|
+
let needDomLTPre = lt && !options2.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
2325
|
+
let needDomGTPre = gt && !options2.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
2326
2326
|
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
|
|
2327
2327
|
needDomLTPre = false;
|
|
2328
2328
|
}
|
|
@@ -2336,11 +2336,11 @@ var require_subset = __commonJS({
|
|
|
2336
2336
|
}
|
|
2337
2337
|
}
|
|
2338
2338
|
if (c2.operator === ">" || c2.operator === ">=") {
|
|
2339
|
-
higher = higherGT(gt, c2,
|
|
2339
|
+
higher = higherGT(gt, c2, options2);
|
|
2340
2340
|
if (higher === c2 && higher !== gt) {
|
|
2341
2341
|
return false;
|
|
2342
2342
|
}
|
|
2343
|
-
} else if (gt.operator === ">=" && !satisfies3(gt.semver, String(c2),
|
|
2343
|
+
} else if (gt.operator === ">=" && !satisfies3(gt.semver, String(c2), options2)) {
|
|
2344
2344
|
return false;
|
|
2345
2345
|
}
|
|
2346
2346
|
}
|
|
@@ -2351,11 +2351,11 @@ var require_subset = __commonJS({
|
|
|
2351
2351
|
}
|
|
2352
2352
|
}
|
|
2353
2353
|
if (c2.operator === "<" || c2.operator === "<=") {
|
|
2354
|
-
lower = lowerLT(lt, c2,
|
|
2354
|
+
lower = lowerLT(lt, c2, options2);
|
|
2355
2355
|
if (lower === c2 && lower !== lt) {
|
|
2356
2356
|
return false;
|
|
2357
2357
|
}
|
|
2358
|
-
} else if (lt.operator === "<=" && !satisfies3(lt.semver, String(c2),
|
|
2358
|
+
} else if (lt.operator === "<=" && !satisfies3(lt.semver, String(c2), options2)) {
|
|
2359
2359
|
return false;
|
|
2360
2360
|
}
|
|
2361
2361
|
}
|
|
@@ -2374,18 +2374,18 @@ var require_subset = __commonJS({
|
|
|
2374
2374
|
}
|
|
2375
2375
|
return true;
|
|
2376
2376
|
};
|
|
2377
|
-
var higherGT = (a, b,
|
|
2377
|
+
var higherGT = (a, b, options2) => {
|
|
2378
2378
|
if (!a) {
|
|
2379
2379
|
return b;
|
|
2380
2380
|
}
|
|
2381
|
-
const comp = compare(a.semver, b.semver,
|
|
2381
|
+
const comp = compare(a.semver, b.semver, options2);
|
|
2382
2382
|
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
2383
2383
|
};
|
|
2384
|
-
var lowerLT = (a, b,
|
|
2384
|
+
var lowerLT = (a, b, options2) => {
|
|
2385
2385
|
if (!a) {
|
|
2386
2386
|
return b;
|
|
2387
2387
|
}
|
|
2388
|
-
const comp = compare(a.semver, b.semver,
|
|
2388
|
+
const comp = compare(a.semver, b.semver, options2);
|
|
2389
2389
|
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
2390
2390
|
};
|
|
2391
2391
|
module.exports = subset;
|
|
@@ -2491,22 +2491,23 @@ var require_semver2 = __commonJS({
|
|
|
2491
2491
|
import { join } from "node:path";
|
|
2492
2492
|
import process2 from "node:process";
|
|
2493
2493
|
import { createServer as createViteServer, resolveConfig } from "vite";
|
|
2494
|
-
async function createServer(
|
|
2495
|
-
const rawConfig = await resolveConfig({}, "serve",
|
|
2494
|
+
async function createServer(options2, viteConfig = {}, serverOptions = {}) {
|
|
2495
|
+
const rawConfig = await resolveConfig({}, "serve", options2.entry);
|
|
2496
2496
|
const pluginOptions = rawConfig.slidev || {};
|
|
2497
2497
|
process2.env.EDITOR = process2.env.EDITOR || "code";
|
|
2498
2498
|
const server = await createViteServer(
|
|
2499
2499
|
await mergeViteConfigs(
|
|
2500
|
-
|
|
2500
|
+
options2,
|
|
2501
2501
|
viteConfig,
|
|
2502
2502
|
{
|
|
2503
|
+
root: options2.userRoot,
|
|
2503
2504
|
optimizeDeps: {
|
|
2504
2505
|
entries: [
|
|
2505
|
-
join(
|
|
2506
|
+
join(options2.clientRoot, "main.ts")
|
|
2506
2507
|
]
|
|
2507
2508
|
},
|
|
2508
2509
|
plugins: [
|
|
2509
|
-
await ViteSlidevPlugin(
|
|
2510
|
+
await ViteSlidevPlugin(options2, pluginOptions, serverOptions)
|
|
2510
2511
|
]
|
|
2511
2512
|
},
|
|
2512
2513
|
"serve"
|
|
@@ -2519,31 +2520,30 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
|
|
|
2519
2520
|
import * as parser from "@slidev/parser/fs";
|
|
2520
2521
|
|
|
2521
2522
|
// package.json
|
|
2522
|
-
var version = "0.
|
|
2523
|
+
var version = "0.45.0";
|
|
2523
2524
|
|
|
2524
2525
|
// node/themes.ts
|
|
2525
2526
|
import prompts2 from "prompts";
|
|
2526
2527
|
|
|
2527
|
-
// ../../node_modules/.pnpm/@antfu+ni@0.21.
|
|
2528
|
-
import fs$1, {
|
|
2528
|
+
// ../../node_modules/.pnpm/@antfu+ni@0.21.12/node_modules/@antfu/ni/dist/shared/ni.f699cf8a.mjs
|
|
2529
|
+
import fs$1, { createWriteStream, createReadStream, promises, existsSync } from "node:fs";
|
|
2529
2530
|
import path$3, { join as join$1, dirname, resolve } from "node:path";
|
|
2530
2531
|
import process$2 from "node:process";
|
|
2531
|
-
import url, { fileURLToPath } from "node:url";
|
|
2532
2532
|
import { Buffer as Buffer$1 } from "node:buffer";
|
|
2533
2533
|
import childProcess, { ChildProcess } from "node:child_process";
|
|
2534
2534
|
import require$$0$2 from "child_process";
|
|
2535
2535
|
import require$$0$1 from "path";
|
|
2536
2536
|
import require$$0 from "fs";
|
|
2537
|
+
import url, { fileURLToPath } from "node:url";
|
|
2537
2538
|
import os$1, { constants } from "node:os";
|
|
2538
|
-
import
|
|
2539
|
-
import require$$
|
|
2540
|
-
import require$$0$5 from "buffer";
|
|
2541
|
-
import require$$0$4 from "stream";
|
|
2542
|
-
import require$$2$1 from "util";
|
|
2539
|
+
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
2540
|
+
import require$$0$3 from "stream";
|
|
2543
2541
|
import { debuglog } from "node:util";
|
|
2544
|
-
import require$$0$
|
|
2542
|
+
import require$$0$4 from "os";
|
|
2545
2543
|
import require$$1 from "tty";
|
|
2546
|
-
import require$$0$
|
|
2544
|
+
import require$$0$5 from "readline";
|
|
2545
|
+
import require$$2 from "events";
|
|
2546
|
+
import require$$1$1 from "fs/promises";
|
|
2547
2547
|
function npmRun(agent) {
|
|
2548
2548
|
return (args) => {
|
|
2549
2549
|
if (args.length > 1)
|
|
@@ -2851,239 +2851,6 @@ var ini = {
|
|
|
2851
2851
|
unsafe
|
|
2852
2852
|
};
|
|
2853
2853
|
var ini$1 = /* @__PURE__ */ getDefaultExportFromCjs(ini);
|
|
2854
|
-
var Node = class {
|
|
2855
|
-
value;
|
|
2856
|
-
next;
|
|
2857
|
-
constructor(value) {
|
|
2858
|
-
this.value = value;
|
|
2859
|
-
}
|
|
2860
|
-
};
|
|
2861
|
-
var Queue = class {
|
|
2862
|
-
#head;
|
|
2863
|
-
#tail;
|
|
2864
|
-
#size;
|
|
2865
|
-
constructor() {
|
|
2866
|
-
this.clear();
|
|
2867
|
-
}
|
|
2868
|
-
enqueue(value) {
|
|
2869
|
-
const node = new Node(value);
|
|
2870
|
-
if (this.#head) {
|
|
2871
|
-
this.#tail.next = node;
|
|
2872
|
-
this.#tail = node;
|
|
2873
|
-
} else {
|
|
2874
|
-
this.#head = node;
|
|
2875
|
-
this.#tail = node;
|
|
2876
|
-
}
|
|
2877
|
-
this.#size++;
|
|
2878
|
-
}
|
|
2879
|
-
dequeue() {
|
|
2880
|
-
const current = this.#head;
|
|
2881
|
-
if (!current) {
|
|
2882
|
-
return;
|
|
2883
|
-
}
|
|
2884
|
-
this.#head = this.#head.next;
|
|
2885
|
-
this.#size--;
|
|
2886
|
-
return current.value;
|
|
2887
|
-
}
|
|
2888
|
-
clear() {
|
|
2889
|
-
this.#head = void 0;
|
|
2890
|
-
this.#tail = void 0;
|
|
2891
|
-
this.#size = 0;
|
|
2892
|
-
}
|
|
2893
|
-
get size() {
|
|
2894
|
-
return this.#size;
|
|
2895
|
-
}
|
|
2896
|
-
*[Symbol.iterator]() {
|
|
2897
|
-
let current = this.#head;
|
|
2898
|
-
while (current) {
|
|
2899
|
-
yield current.value;
|
|
2900
|
-
current = current.next;
|
|
2901
|
-
}
|
|
2902
|
-
}
|
|
2903
|
-
};
|
|
2904
|
-
function pLimit(concurrency) {
|
|
2905
|
-
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
2906
|
-
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
2907
|
-
}
|
|
2908
|
-
const queue = new Queue();
|
|
2909
|
-
let activeCount = 0;
|
|
2910
|
-
const next = () => {
|
|
2911
|
-
activeCount--;
|
|
2912
|
-
if (queue.size > 0) {
|
|
2913
|
-
queue.dequeue()();
|
|
2914
|
-
}
|
|
2915
|
-
};
|
|
2916
|
-
const run2 = async (fn, resolve3, args) => {
|
|
2917
|
-
activeCount++;
|
|
2918
|
-
const result = (async () => fn(...args))();
|
|
2919
|
-
resolve3(result);
|
|
2920
|
-
try {
|
|
2921
|
-
await result;
|
|
2922
|
-
} catch {
|
|
2923
|
-
}
|
|
2924
|
-
next();
|
|
2925
|
-
};
|
|
2926
|
-
const enqueue = (fn, resolve3, args) => {
|
|
2927
|
-
queue.enqueue(run2.bind(void 0, fn, resolve3, args));
|
|
2928
|
-
(async () => {
|
|
2929
|
-
await Promise.resolve();
|
|
2930
|
-
if (activeCount < concurrency && queue.size > 0) {
|
|
2931
|
-
queue.dequeue()();
|
|
2932
|
-
}
|
|
2933
|
-
})();
|
|
2934
|
-
};
|
|
2935
|
-
const generator = (fn, ...args) => new Promise((resolve3) => {
|
|
2936
|
-
enqueue(fn, resolve3, args);
|
|
2937
|
-
});
|
|
2938
|
-
Object.defineProperties(generator, {
|
|
2939
|
-
activeCount: {
|
|
2940
|
-
get: () => activeCount
|
|
2941
|
-
},
|
|
2942
|
-
pendingCount: {
|
|
2943
|
-
get: () => queue.size
|
|
2944
|
-
},
|
|
2945
|
-
clearQueue: {
|
|
2946
|
-
value: () => {
|
|
2947
|
-
queue.clear();
|
|
2948
|
-
}
|
|
2949
|
-
}
|
|
2950
|
-
});
|
|
2951
|
-
return generator;
|
|
2952
|
-
}
|
|
2953
|
-
var EndError = class extends Error {
|
|
2954
|
-
constructor(value) {
|
|
2955
|
-
super();
|
|
2956
|
-
this.value = value;
|
|
2957
|
-
}
|
|
2958
|
-
};
|
|
2959
|
-
var testElement = async (element, tester) => tester(await element);
|
|
2960
|
-
var finder = async (element) => {
|
|
2961
|
-
const values = await Promise.all(element);
|
|
2962
|
-
if (values[1] === true) {
|
|
2963
|
-
throw new EndError(values[0]);
|
|
2964
|
-
}
|
|
2965
|
-
return false;
|
|
2966
|
-
};
|
|
2967
|
-
async function pLocate(iterable, tester, {
|
|
2968
|
-
concurrency = Number.POSITIVE_INFINITY,
|
|
2969
|
-
preserveOrder = true
|
|
2970
|
-
} = {}) {
|
|
2971
|
-
const limit = pLimit(concurrency);
|
|
2972
|
-
const items = [...iterable].map((element) => [element, limit(testElement, element, tester)]);
|
|
2973
|
-
const checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);
|
|
2974
|
-
try {
|
|
2975
|
-
await Promise.all(items.map((element) => checkLimit(finder, element)));
|
|
2976
|
-
} catch (error) {
|
|
2977
|
-
if (error instanceof EndError) {
|
|
2978
|
-
return error.value;
|
|
2979
|
-
}
|
|
2980
|
-
throw error;
|
|
2981
|
-
}
|
|
2982
|
-
}
|
|
2983
|
-
var typeMappings = {
|
|
2984
|
-
directory: "isDirectory",
|
|
2985
|
-
file: "isFile"
|
|
2986
|
-
};
|
|
2987
|
-
function checkType(type) {
|
|
2988
|
-
if (type in typeMappings) {
|
|
2989
|
-
return;
|
|
2990
|
-
}
|
|
2991
|
-
throw new Error(`Invalid type specified: ${type}`);
|
|
2992
|
-
}
|
|
2993
|
-
var matchType = (type, stat) => type === void 0 || stat[typeMappings[type]]();
|
|
2994
|
-
var toPath$1 = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
2995
|
-
async function locatePath(paths, {
|
|
2996
|
-
cwd = process$2.cwd(),
|
|
2997
|
-
type = "file",
|
|
2998
|
-
allowSymlinks = true,
|
|
2999
|
-
concurrency,
|
|
3000
|
-
preserveOrder
|
|
3001
|
-
} = {}) {
|
|
3002
|
-
checkType(type);
|
|
3003
|
-
cwd = toPath$1(cwd);
|
|
3004
|
-
const statFunction = allowSymlinks ? promises.stat : promises.lstat;
|
|
3005
|
-
return pLocate(paths, async (path_) => {
|
|
3006
|
-
try {
|
|
3007
|
-
const stat = await statFunction(path$3.resolve(cwd, path_));
|
|
3008
|
-
return matchType(type, stat);
|
|
3009
|
-
} catch {
|
|
3010
|
-
return false;
|
|
3011
|
-
}
|
|
3012
|
-
}, { concurrency, preserveOrder });
|
|
3013
|
-
}
|
|
3014
|
-
var toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
3015
|
-
var findUpStop = Symbol("findUpStop");
|
|
3016
|
-
async function findUpMultiple(name, options = {}) {
|
|
3017
|
-
let directory = path$3.resolve(toPath(options.cwd) || "");
|
|
3018
|
-
const { root } = path$3.parse(directory);
|
|
3019
|
-
const stopAt = path$3.resolve(directory, options.stopAt || root);
|
|
3020
|
-
const limit = options.limit || Number.POSITIVE_INFINITY;
|
|
3021
|
-
const paths = [name].flat();
|
|
3022
|
-
const runMatcher = async (locateOptions) => {
|
|
3023
|
-
if (typeof name !== "function") {
|
|
3024
|
-
return locatePath(paths, locateOptions);
|
|
3025
|
-
}
|
|
3026
|
-
const foundPath = await name(locateOptions.cwd);
|
|
3027
|
-
if (typeof foundPath === "string") {
|
|
3028
|
-
return locatePath([foundPath], locateOptions);
|
|
3029
|
-
}
|
|
3030
|
-
return foundPath;
|
|
3031
|
-
};
|
|
3032
|
-
const matches = [];
|
|
3033
|
-
while (true) {
|
|
3034
|
-
const foundPath = await runMatcher({ ...options, cwd: directory });
|
|
3035
|
-
if (foundPath === findUpStop) {
|
|
3036
|
-
break;
|
|
3037
|
-
}
|
|
3038
|
-
if (foundPath) {
|
|
3039
|
-
matches.push(path$3.resolve(directory, foundPath));
|
|
3040
|
-
}
|
|
3041
|
-
if (directory === stopAt || matches.length >= limit) {
|
|
3042
|
-
break;
|
|
3043
|
-
}
|
|
3044
|
-
directory = path$3.dirname(directory);
|
|
3045
|
-
}
|
|
3046
|
-
return matches;
|
|
3047
|
-
}
|
|
3048
|
-
async function findUp(name, options = {}) {
|
|
3049
|
-
const matches = await findUpMultiple(name, { ...options, limit: 1 });
|
|
3050
|
-
return matches[0];
|
|
3051
|
-
}
|
|
3052
|
-
var customRcPath = process$2.env.NI_CONFIG_FILE;
|
|
3053
|
-
var home = process$2.platform === "win32" ? process$2.env.USERPROFILE : process$2.env.HOME;
|
|
3054
|
-
var defaultRcPath = path$3.join(home || "~/", ".nirc");
|
|
3055
|
-
var rcPath = customRcPath || defaultRcPath;
|
|
3056
|
-
var defaultConfig = {
|
|
3057
|
-
defaultAgent: "prompt",
|
|
3058
|
-
globalAgent: "npm"
|
|
3059
|
-
};
|
|
3060
|
-
var config;
|
|
3061
|
-
async function getConfig() {
|
|
3062
|
-
if (!config) {
|
|
3063
|
-
const result = await findUp("package.json") || "";
|
|
3064
|
-
let packageManager = "";
|
|
3065
|
-
if (result)
|
|
3066
|
-
packageManager = JSON.parse(fs$1.readFileSync(result, "utf8")).packageManager ?? "";
|
|
3067
|
-
const [, agent, version3] = packageManager.match(new RegExp(`^(${Object.values(LOCKS).join("|")})@(\\d).*?$`)) || [];
|
|
3068
|
-
if (agent)
|
|
3069
|
-
config = Object.assign({}, defaultConfig, { defaultAgent: agent === "yarn" && Number.parseInt(version3) > 1 ? "yarn@berry" : agent });
|
|
3070
|
-
else if (!fs$1.existsSync(rcPath))
|
|
3071
|
-
config = defaultConfig;
|
|
3072
|
-
else
|
|
3073
|
-
config = Object.assign({}, defaultConfig, ini$1.parse(fs$1.readFileSync(rcPath, "utf-8")));
|
|
3074
|
-
}
|
|
3075
|
-
return config;
|
|
3076
|
-
}
|
|
3077
|
-
async function getDefaultAgent(programmatic) {
|
|
3078
|
-
const { defaultAgent } = await getConfig();
|
|
3079
|
-
if (defaultAgent === "prompt" && (programmatic || process$2.env.CI))
|
|
3080
|
-
return "npm";
|
|
3081
|
-
return defaultAgent;
|
|
3082
|
-
}
|
|
3083
|
-
async function getGlobalAgent() {
|
|
3084
|
-
const { globalAgent } = await getConfig();
|
|
3085
|
-
return globalAgent;
|
|
3086
|
-
}
|
|
3087
2854
|
var crossSpawn$1 = { exports: {} };
|
|
3088
2855
|
var windows;
|
|
3089
2856
|
var hasRequiredWindows;
|
|
@@ -3094,8 +2861,8 @@ function requireWindows() {
|
|
|
3094
2861
|
windows = isexe2;
|
|
3095
2862
|
isexe2.sync = sync2;
|
|
3096
2863
|
var fs4 = require$$0;
|
|
3097
|
-
function
|
|
3098
|
-
var pathext =
|
|
2864
|
+
function checkPathExt2(path2, options2) {
|
|
2865
|
+
var pathext = options2.pathExt !== void 0 ? options2.pathExt : process.env.PATHEXT;
|
|
3099
2866
|
if (!pathext) {
|
|
3100
2867
|
return true;
|
|
3101
2868
|
}
|
|
@@ -3111,19 +2878,19 @@ function requireWindows() {
|
|
|
3111
2878
|
}
|
|
3112
2879
|
return false;
|
|
3113
2880
|
}
|
|
3114
|
-
function
|
|
2881
|
+
function checkStat2(stat, path2, options2) {
|
|
3115
2882
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
3116
2883
|
return false;
|
|
3117
2884
|
}
|
|
3118
|
-
return
|
|
2885
|
+
return checkPathExt2(path2, options2);
|
|
3119
2886
|
}
|
|
3120
|
-
function isexe2(path2,
|
|
2887
|
+
function isexe2(path2, options2, cb) {
|
|
3121
2888
|
fs4.stat(path2, function(er, stat) {
|
|
3122
|
-
cb(er, er ? false :
|
|
2889
|
+
cb(er, er ? false : checkStat2(stat, path2, options2));
|
|
3123
2890
|
});
|
|
3124
2891
|
}
|
|
3125
|
-
function sync2(path2,
|
|
3126
|
-
return
|
|
2892
|
+
function sync2(path2, options2) {
|
|
2893
|
+
return checkStat2(fs4.statSync(path2), path2, options2);
|
|
3127
2894
|
}
|
|
3128
2895
|
return windows;
|
|
3129
2896
|
}
|
|
@@ -3136,23 +2903,23 @@ function requireMode() {
|
|
|
3136
2903
|
mode = isexe2;
|
|
3137
2904
|
isexe2.sync = sync2;
|
|
3138
2905
|
var fs4 = require$$0;
|
|
3139
|
-
function isexe2(path2,
|
|
2906
|
+
function isexe2(path2, options2, cb) {
|
|
3140
2907
|
fs4.stat(path2, function(er, stat) {
|
|
3141
|
-
cb(er, er ? false :
|
|
2908
|
+
cb(er, er ? false : checkStat2(stat, options2));
|
|
3142
2909
|
});
|
|
3143
2910
|
}
|
|
3144
|
-
function sync2(path2,
|
|
3145
|
-
return
|
|
2911
|
+
function sync2(path2, options2) {
|
|
2912
|
+
return checkStat2(fs4.statSync(path2), options2);
|
|
3146
2913
|
}
|
|
3147
|
-
function
|
|
3148
|
-
return stat.isFile() &&
|
|
2914
|
+
function checkStat2(stat, options2) {
|
|
2915
|
+
return stat.isFile() && checkMode2(stat, options2);
|
|
3149
2916
|
}
|
|
3150
|
-
function
|
|
2917
|
+
function checkMode2(stat, options2) {
|
|
3151
2918
|
var mod = stat.mode;
|
|
3152
2919
|
var uid = stat.uid;
|
|
3153
2920
|
var gid = stat.gid;
|
|
3154
|
-
var myUid =
|
|
3155
|
-
var myGid =
|
|
2921
|
+
var myUid = options2.uid !== void 0 ? options2.uid : process.getuid && process.getuid();
|
|
2922
|
+
var myGid = options2.gid !== void 0 ? options2.gid : process.getgid && process.getgid();
|
|
3156
2923
|
var u = parseInt("100", 8);
|
|
3157
2924
|
var g = parseInt("010", 8);
|
|
3158
2925
|
var o = parseInt("001", 8);
|
|
@@ -3168,19 +2935,19 @@ if (process.platform === "win32" || commonjsGlobal.TESTING_WINDOWS) {
|
|
|
3168
2935
|
} else {
|
|
3169
2936
|
core = requireMode();
|
|
3170
2937
|
}
|
|
3171
|
-
var isexe_1 = isexe$
|
|
3172
|
-
isexe$
|
|
3173
|
-
function isexe$
|
|
3174
|
-
if (typeof
|
|
3175
|
-
cb =
|
|
3176
|
-
|
|
2938
|
+
var isexe_1 = isexe$4;
|
|
2939
|
+
isexe$4.sync = sync$2;
|
|
2940
|
+
function isexe$4(path2, options2, cb) {
|
|
2941
|
+
if (typeof options2 === "function") {
|
|
2942
|
+
cb = options2;
|
|
2943
|
+
options2 = {};
|
|
3177
2944
|
}
|
|
3178
2945
|
if (!cb) {
|
|
3179
2946
|
if (typeof Promise !== "function") {
|
|
3180
2947
|
throw new TypeError("callback not provided");
|
|
3181
2948
|
}
|
|
3182
2949
|
return new Promise(function(resolve3, reject) {
|
|
3183
|
-
isexe$
|
|
2950
|
+
isexe$4(path2, options2 || {}, function(er, is) {
|
|
3184
2951
|
if (er) {
|
|
3185
2952
|
reject(er);
|
|
3186
2953
|
} else {
|
|
@@ -3189,9 +2956,9 @@ function isexe$2(path2, options, cb) {
|
|
|
3189
2956
|
});
|
|
3190
2957
|
});
|
|
3191
2958
|
}
|
|
3192
|
-
core(path2,
|
|
2959
|
+
core(path2, options2 || {}, function(er, is) {
|
|
3193
2960
|
if (er) {
|
|
3194
|
-
if (er.code === "EACCES" ||
|
|
2961
|
+
if (er.code === "EACCES" || options2 && options2.ignoreErrors) {
|
|
3195
2962
|
er = null;
|
|
3196
2963
|
is = false;
|
|
3197
2964
|
}
|
|
@@ -3199,11 +2966,11 @@ function isexe$2(path2, options, cb) {
|
|
|
3199
2966
|
cb(er, is);
|
|
3200
2967
|
});
|
|
3201
2968
|
}
|
|
3202
|
-
function sync(path2,
|
|
2969
|
+
function sync$2(path2, options2) {
|
|
3203
2970
|
try {
|
|
3204
|
-
return core.sync(path2,
|
|
2971
|
+
return core.sync(path2, options2 || {});
|
|
3205
2972
|
} catch (er) {
|
|
3206
|
-
if (
|
|
2973
|
+
if (options2 && options2.ignoreErrors || er.code === "EACCES") {
|
|
3207
2974
|
return false;
|
|
3208
2975
|
} else {
|
|
3209
2976
|
throw er;
|
|
@@ -3213,7 +2980,7 @@ function sync(path2, options) {
|
|
|
3213
2980
|
var isWindows$1 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
3214
2981
|
var path$2 = require$$0$1;
|
|
3215
2982
|
var COLON = isWindows$1 ? ";" : ":";
|
|
3216
|
-
var isexe$
|
|
2983
|
+
var isexe$3 = isexe_1;
|
|
3217
2984
|
var getNotFoundError$1 = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
3218
2985
|
var getPathInfo$1 = (cmd, opt) => {
|
|
3219
2986
|
const colon = opt.colon || COLON;
|
|
@@ -3257,7 +3024,7 @@ var which$3 = (cmd, opt, cb) => {
|
|
|
3257
3024
|
if (ii === pathExt.length)
|
|
3258
3025
|
return resolve3(step(i + 1));
|
|
3259
3026
|
const ext = pathExt[ii];
|
|
3260
|
-
isexe$
|
|
3027
|
+
isexe$3(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
3261
3028
|
if (!er && is) {
|
|
3262
3029
|
if (opt.all)
|
|
3263
3030
|
found.push(p + ext);
|
|
@@ -3281,7 +3048,7 @@ var whichSync$1 = (cmd, opt) => {
|
|
|
3281
3048
|
for (let j = 0; j < pathExt.length; j++) {
|
|
3282
3049
|
const cur = p + pathExt[j];
|
|
3283
3050
|
try {
|
|
3284
|
-
const is = isexe$
|
|
3051
|
+
const is = isexe$3.sync(cur, { pathExt: pathExtExe });
|
|
3285
3052
|
if (is) {
|
|
3286
3053
|
if (opt.all)
|
|
3287
3054
|
found.push(cur);
|
|
@@ -3301,9 +3068,9 @@ var whichSync$1 = (cmd, opt) => {
|
|
|
3301
3068
|
var which_1 = which$3;
|
|
3302
3069
|
which$3.sync = whichSync$1;
|
|
3303
3070
|
var pathKey$2 = { exports: {} };
|
|
3304
|
-
var pathKey$1 = (
|
|
3305
|
-
const environment =
|
|
3306
|
-
const platform =
|
|
3071
|
+
var pathKey$1 = (options2 = {}) => {
|
|
3072
|
+
const environment = options2.env || process.env;
|
|
3073
|
+
const platform = options2.platform || process.platform;
|
|
3307
3074
|
if (platform !== "win32") {
|
|
3308
3075
|
return "PATH";
|
|
3309
3076
|
}
|
|
@@ -3399,7 +3166,7 @@ var path = require$$0$1;
|
|
|
3399
3166
|
var resolveCommand = resolveCommand_1;
|
|
3400
3167
|
var escape = _escape;
|
|
3401
3168
|
var readShebang = readShebang_1;
|
|
3402
|
-
var isWin$
|
|
3169
|
+
var isWin$1 = process.platform === "win32";
|
|
3403
3170
|
var isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
3404
3171
|
var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
3405
3172
|
function detectShebang(parsed) {
|
|
@@ -3413,7 +3180,7 @@ function detectShebang(parsed) {
|
|
|
3413
3180
|
return parsed.file;
|
|
3414
3181
|
}
|
|
3415
3182
|
function parseNonShell(parsed) {
|
|
3416
|
-
if (!isWin$
|
|
3183
|
+
if (!isWin$1) {
|
|
3417
3184
|
return parsed;
|
|
3418
3185
|
}
|
|
3419
3186
|
const commandFile = detectShebang(parsed);
|
|
@@ -3430,27 +3197,27 @@ function parseNonShell(parsed) {
|
|
|
3430
3197
|
}
|
|
3431
3198
|
return parsed;
|
|
3432
3199
|
}
|
|
3433
|
-
function parse$1(command, args,
|
|
3200
|
+
function parse$1(command, args, options2) {
|
|
3434
3201
|
if (args && !Array.isArray(args)) {
|
|
3435
|
-
|
|
3202
|
+
options2 = args;
|
|
3436
3203
|
args = null;
|
|
3437
3204
|
}
|
|
3438
3205
|
args = args ? args.slice(0) : [];
|
|
3439
|
-
|
|
3206
|
+
options2 = Object.assign({}, options2);
|
|
3440
3207
|
const parsed = {
|
|
3441
3208
|
command,
|
|
3442
3209
|
args,
|
|
3443
|
-
options,
|
|
3210
|
+
options: options2,
|
|
3444
3211
|
file: void 0,
|
|
3445
3212
|
original: {
|
|
3446
3213
|
command,
|
|
3447
3214
|
args
|
|
3448
3215
|
}
|
|
3449
3216
|
};
|
|
3450
|
-
return
|
|
3217
|
+
return options2.shell ? parsed : parseNonShell(parsed);
|
|
3451
3218
|
}
|
|
3452
3219
|
var parse_1 = parse$1;
|
|
3453
|
-
var isWin
|
|
3220
|
+
var isWin = process.platform === "win32";
|
|
3454
3221
|
function notFoundError(original, syscall) {
|
|
3455
3222
|
return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
|
|
3456
3223
|
code: "ENOENT",
|
|
@@ -3461,7 +3228,7 @@ function notFoundError(original, syscall) {
|
|
|
3461
3228
|
});
|
|
3462
3229
|
}
|
|
3463
3230
|
function hookChildProcess(cp2, parsed) {
|
|
3464
|
-
if (!isWin
|
|
3231
|
+
if (!isWin) {
|
|
3465
3232
|
return;
|
|
3466
3233
|
}
|
|
3467
3234
|
const originalEmit = cp2.emit;
|
|
@@ -3476,13 +3243,13 @@ function hookChildProcess(cp2, parsed) {
|
|
|
3476
3243
|
};
|
|
3477
3244
|
}
|
|
3478
3245
|
function verifyENOENT(status, parsed) {
|
|
3479
|
-
if (isWin
|
|
3246
|
+
if (isWin && status === 1 && !parsed.file) {
|
|
3480
3247
|
return notFoundError(parsed.original, "spawn");
|
|
3481
3248
|
}
|
|
3482
3249
|
return null;
|
|
3483
3250
|
}
|
|
3484
3251
|
function verifyENOENTSync(status, parsed) {
|
|
3485
|
-
if (isWin
|
|
3252
|
+
if (isWin && status === 1 && !parsed.file) {
|
|
3486
3253
|
return notFoundError(parsed.original, "spawnSync");
|
|
3487
3254
|
}
|
|
3488
3255
|
return null;
|
|
@@ -3496,14 +3263,14 @@ var enoent$1 = {
|
|
|
3496
3263
|
var cp = require$$0$2;
|
|
3497
3264
|
var parse = parse_1;
|
|
3498
3265
|
var enoent = enoent$1;
|
|
3499
|
-
function spawn(command, args,
|
|
3500
|
-
const parsed = parse(command, args,
|
|
3266
|
+
function spawn(command, args, options2) {
|
|
3267
|
+
const parsed = parse(command, args, options2);
|
|
3501
3268
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
3502
3269
|
enoent.hookChildProcess(spawned, parsed);
|
|
3503
3270
|
return spawned;
|
|
3504
3271
|
}
|
|
3505
|
-
function spawnSync(command, args,
|
|
3506
|
-
const parsed = parse(command, args,
|
|
3272
|
+
function spawnSync(command, args, options2) {
|
|
3273
|
+
const parsed = parse(command, args, options2);
|
|
3507
3274
|
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
3508
3275
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
3509
3276
|
return result;
|
|
@@ -3526,22 +3293,22 @@ function stripFinalNewline(input) {
|
|
|
3526
3293
|
}
|
|
3527
3294
|
return input;
|
|
3528
3295
|
}
|
|
3529
|
-
function pathKey(
|
|
3296
|
+
function pathKey(options2 = {}) {
|
|
3530
3297
|
const {
|
|
3531
3298
|
env: env2 = process.env,
|
|
3532
3299
|
platform = process.platform
|
|
3533
|
-
} =
|
|
3300
|
+
} = options2;
|
|
3534
3301
|
if (platform !== "win32") {
|
|
3535
3302
|
return "PATH";
|
|
3536
3303
|
}
|
|
3537
3304
|
return Object.keys(env2).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
3538
3305
|
}
|
|
3539
|
-
function npmRunPath(
|
|
3306
|
+
function npmRunPath(options2 = {}) {
|
|
3540
3307
|
const {
|
|
3541
3308
|
cwd = process$2.cwd(),
|
|
3542
3309
|
path: path_ = process$2.env[pathKey()],
|
|
3543
3310
|
execPath = process$2.execPath
|
|
3544
|
-
} =
|
|
3311
|
+
} = options2;
|
|
3545
3312
|
let previous;
|
|
3546
3313
|
const cwdString = cwd instanceof URL ? url.fileURLToPath(cwd) : cwd;
|
|
3547
3314
|
let cwdPath = path$3.resolve(cwdString);
|
|
@@ -3554,11 +3321,11 @@ function npmRunPath(options = {}) {
|
|
|
3554
3321
|
result.push(path$3.resolve(cwdString, execPath, ".."));
|
|
3555
3322
|
return [...result, path_].join(path$3.delimiter);
|
|
3556
3323
|
}
|
|
3557
|
-
function npmRunPathEnv({ env: env2 = process$2.env, ...
|
|
3324
|
+
function npmRunPathEnv({ env: env2 = process$2.env, ...options2 } = {}) {
|
|
3558
3325
|
env2 = { ...env2 };
|
|
3559
3326
|
const path2 = pathKey({ env: env2 });
|
|
3560
|
-
|
|
3561
|
-
env2[path2] = npmRunPath(
|
|
3327
|
+
options2.path = env2[path2];
|
|
3328
|
+
env2[path2] = npmRunPath(options2);
|
|
3562
3329
|
return env2;
|
|
3563
3330
|
}
|
|
3564
3331
|
var copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
|
@@ -3605,7 +3372,7 @@ function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
|
|
|
3605
3372
|
return to;
|
|
3606
3373
|
}
|
|
3607
3374
|
var calledFunctions = /* @__PURE__ */ new WeakMap();
|
|
3608
|
-
var onetime = (function_,
|
|
3375
|
+
var onetime = (function_, options2 = {}) => {
|
|
3609
3376
|
if (typeof function_ !== "function") {
|
|
3610
3377
|
throw new TypeError("Expected a function");
|
|
3611
3378
|
}
|
|
@@ -3617,7 +3384,7 @@ var onetime = (function_, options = {}) => {
|
|
|
3617
3384
|
if (callCount === 1) {
|
|
3618
3385
|
returnValue = function_.apply(this, arguments_);
|
|
3619
3386
|
function_ = null;
|
|
3620
|
-
} else if (
|
|
3387
|
+
} else if (options2.throw === true) {
|
|
3621
3388
|
throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
3622
3389
|
}
|
|
3623
3390
|
return returnValue;
|
|
@@ -3918,8 +3685,8 @@ var SIGNALS = [
|
|
|
3918
3685
|
];
|
|
3919
3686
|
var getSignals = () => {
|
|
3920
3687
|
const realtimeSignals = getRealtimeSignals();
|
|
3921
|
-
const
|
|
3922
|
-
return
|
|
3688
|
+
const signals2 = [...SIGNALS, ...realtimeSignals].map(normalizeSignal);
|
|
3689
|
+
return signals2;
|
|
3923
3690
|
};
|
|
3924
3691
|
var normalizeSignal = ({
|
|
3925
3692
|
name,
|
|
@@ -3937,8 +3704,8 @@ var normalizeSignal = ({
|
|
|
3937
3704
|
return { name, number: number2, description, supported, action: action2, forced, standard };
|
|
3938
3705
|
};
|
|
3939
3706
|
var getSignalsByName = () => {
|
|
3940
|
-
const
|
|
3941
|
-
return Object.fromEntries(
|
|
3707
|
+
const signals2 = getSignals();
|
|
3708
|
+
return Object.fromEntries(signals2.map(getSignalByName));
|
|
3942
3709
|
};
|
|
3943
3710
|
var getSignalByName = ({
|
|
3944
3711
|
name,
|
|
@@ -3951,13 +3718,16 @@ var getSignalByName = ({
|
|
|
3951
3718
|
}) => [name, { name, number: number2, description, supported, action: action2, forced, standard }];
|
|
3952
3719
|
var signalsByName = getSignalsByName();
|
|
3953
3720
|
var getSignalsByNumber = () => {
|
|
3954
|
-
const
|
|
3721
|
+
const signals2 = getSignals();
|
|
3955
3722
|
const length = SIGRTMAX + 1;
|
|
3956
|
-
const signalsA = Array.from(
|
|
3723
|
+
const signalsA = Array.from(
|
|
3724
|
+
{ length },
|
|
3725
|
+
(value, number2) => getSignalByNumber(number2, signals2)
|
|
3726
|
+
);
|
|
3957
3727
|
return Object.assign({}, ...signalsA);
|
|
3958
3728
|
};
|
|
3959
|
-
var getSignalByNumber = (number2,
|
|
3960
|
-
const signal = findSignalByNumber(number2,
|
|
3729
|
+
var getSignalByNumber = (number2, signals2) => {
|
|
3730
|
+
const signal = findSignalByNumber(number2, signals2);
|
|
3961
3731
|
if (signal === void 0) {
|
|
3962
3732
|
return {};
|
|
3963
3733
|
}
|
|
@@ -3974,12 +3744,12 @@ var getSignalByNumber = (number2, signals) => {
|
|
|
3974
3744
|
}
|
|
3975
3745
|
};
|
|
3976
3746
|
};
|
|
3977
|
-
var findSignalByNumber = (number2,
|
|
3978
|
-
const signal =
|
|
3747
|
+
var findSignalByNumber = (number2, signals2) => {
|
|
3748
|
+
const signal = signals2.find(({ name }) => constants.signals[name] === number2);
|
|
3979
3749
|
if (signal !== void 0) {
|
|
3980
3750
|
return signal;
|
|
3981
3751
|
}
|
|
3982
|
-
return
|
|
3752
|
+
return signals2.find((signalA) => signalA.number === number2);
|
|
3983
3753
|
};
|
|
3984
3754
|
getSignalsByNumber();
|
|
3985
3755
|
var getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
|
|
@@ -4012,7 +3782,7 @@ var makeError = ({
|
|
|
4012
3782
|
timedOut,
|
|
4013
3783
|
isCanceled,
|
|
4014
3784
|
killed,
|
|
4015
|
-
parsed: { options: { timeout } }
|
|
3785
|
+
parsed: { options: { timeout, cwd = process$2.cwd() } }
|
|
4016
3786
|
}) => {
|
|
4017
3787
|
exitCode = exitCode === null ? void 0 : exitCode;
|
|
4018
3788
|
signal = signal === null ? void 0 : signal;
|
|
@@ -4038,6 +3808,7 @@ ${error.message}` : execaMessage;
|
|
|
4038
3808
|
error.signalDescription = signalDescription;
|
|
4039
3809
|
error.stdout = stdout;
|
|
4040
3810
|
error.stderr = stderr;
|
|
3811
|
+
error.cwd = cwd;
|
|
4041
3812
|
if (all !== void 0) {
|
|
4042
3813
|
error.all = all;
|
|
4043
3814
|
}
|
|
@@ -4051,16 +3822,16 @@ ${error.message}` : execaMessage;
|
|
|
4051
3822
|
return error;
|
|
4052
3823
|
};
|
|
4053
3824
|
var aliases = ["stdin", "stdout", "stderr"];
|
|
4054
|
-
var hasAlias = (
|
|
4055
|
-
var normalizeStdio = (
|
|
4056
|
-
if (!
|
|
3825
|
+
var hasAlias = (options2) => aliases.some((alias) => options2[alias] !== void 0);
|
|
3826
|
+
var normalizeStdio = (options2) => {
|
|
3827
|
+
if (!options2) {
|
|
4057
3828
|
return;
|
|
4058
3829
|
}
|
|
4059
|
-
const { stdio } =
|
|
3830
|
+
const { stdio } = options2;
|
|
4060
3831
|
if (stdio === void 0) {
|
|
4061
|
-
return aliases.map((alias) =>
|
|
3832
|
+
return aliases.map((alias) => options2[alias]);
|
|
4062
3833
|
}
|
|
4063
|
-
if (hasAlias(
|
|
3834
|
+
if (hasAlias(options2)) {
|
|
4064
3835
|
throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias) => `\`${alias}\``).join(", ")}`);
|
|
4065
3836
|
}
|
|
4066
3837
|
if (typeof stdio === "string") {
|
|
@@ -4072,214 +3843,264 @@ var normalizeStdio = (options) => {
|
|
|
4072
3843
|
const length = Math.max(stdio.length, aliases.length);
|
|
4073
3844
|
return Array.from({ length }, (value, index) => stdio[index]);
|
|
4074
3845
|
};
|
|
4075
|
-
var
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
3846
|
+
var signals = [];
|
|
3847
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
3848
|
+
if (process.platform !== "win32") {
|
|
3849
|
+
signals.push(
|
|
3850
|
+
"SIGALRM",
|
|
3851
|
+
"SIGABRT",
|
|
3852
|
+
"SIGVTALRM",
|
|
3853
|
+
"SIGXCPU",
|
|
3854
|
+
"SIGXFSZ",
|
|
3855
|
+
"SIGUSR2",
|
|
3856
|
+
"SIGTRAP",
|
|
3857
|
+
"SIGSYS",
|
|
3858
|
+
"SIGQUIT",
|
|
3859
|
+
"SIGIOT"
|
|
3860
|
+
// should detect profiler and enable/disable accordingly.
|
|
3861
|
+
// see #21
|
|
3862
|
+
// 'SIGPROF'
|
|
3863
|
+
);
|
|
3864
|
+
}
|
|
3865
|
+
if (process.platform === "linux") {
|
|
3866
|
+
signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
3867
|
+
}
|
|
3868
|
+
var processOk = (process4) => !!process4 && typeof process4 === "object" && typeof process4.removeListener === "function" && typeof process4.emit === "function" && typeof process4.reallyExit === "function" && typeof process4.listeners === "function" && typeof process4.kill === "function" && typeof process4.pid === "number" && typeof process4.on === "function";
|
|
3869
|
+
var kExitEmitter = Symbol.for("signal-exit emitter");
|
|
3870
|
+
var global$1 = globalThis;
|
|
3871
|
+
var ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
3872
|
+
var Emitter = class {
|
|
3873
|
+
emitted = {
|
|
3874
|
+
afterExit: false,
|
|
3875
|
+
exit: false
|
|
3876
|
+
};
|
|
3877
|
+
listeners = {
|
|
3878
|
+
afterExit: [],
|
|
3879
|
+
exit: []
|
|
3880
|
+
};
|
|
3881
|
+
count = 0;
|
|
3882
|
+
id = Math.random();
|
|
3883
|
+
constructor() {
|
|
3884
|
+
if (global$1[kExitEmitter]) {
|
|
3885
|
+
return global$1[kExitEmitter];
|
|
3886
|
+
}
|
|
3887
|
+
ObjectDefineProperty(global$1, kExitEmitter, {
|
|
3888
|
+
value: this,
|
|
3889
|
+
writable: false,
|
|
3890
|
+
enumerable: false,
|
|
3891
|
+
configurable: false
|
|
3892
|
+
});
|
|
3893
|
+
}
|
|
3894
|
+
on(ev, fn) {
|
|
3895
|
+
this.listeners[ev].push(fn);
|
|
3896
|
+
}
|
|
3897
|
+
removeListener(ev, fn) {
|
|
3898
|
+
const list = this.listeners[ev];
|
|
3899
|
+
const i = list.indexOf(fn);
|
|
3900
|
+
if (i === -1) {
|
|
3901
|
+
return;
|
|
4104
3902
|
}
|
|
4105
|
-
if (
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
"SIGPWR",
|
|
4110
|
-
"SIGSTKFLT",
|
|
4111
|
-
"SIGUNUSED"
|
|
4112
|
-
);
|
|
3903
|
+
if (i === 0 && list.length === 1) {
|
|
3904
|
+
list.length = 0;
|
|
3905
|
+
} else {
|
|
3906
|
+
list.splice(i, 1);
|
|
4113
3907
|
}
|
|
4114
|
-
}
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
3908
|
+
}
|
|
3909
|
+
emit(ev, code, signal) {
|
|
3910
|
+
if (this.emitted[ev]) {
|
|
3911
|
+
return false;
|
|
3912
|
+
}
|
|
3913
|
+
this.emitted[ev] = true;
|
|
3914
|
+
let ret = false;
|
|
3915
|
+
for (const fn of this.listeners[ev]) {
|
|
3916
|
+
ret = fn(code, signal) === true || ret;
|
|
3917
|
+
}
|
|
3918
|
+
if (ev === "exit") {
|
|
3919
|
+
ret = this.emit("afterExit", code, signal) || ret;
|
|
3920
|
+
}
|
|
3921
|
+
return ret;
|
|
3922
|
+
}
|
|
4120
3923
|
};
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
3924
|
+
var SignalExitBase = class {
|
|
3925
|
+
};
|
|
3926
|
+
var signalExitWrap = (handler) => {
|
|
3927
|
+
return {
|
|
3928
|
+
onExit(cb, opts) {
|
|
3929
|
+
return handler.onExit(cb, opts);
|
|
3930
|
+
},
|
|
3931
|
+
load() {
|
|
3932
|
+
return handler.load();
|
|
3933
|
+
},
|
|
3934
|
+
unload() {
|
|
3935
|
+
return handler.unload();
|
|
3936
|
+
}
|
|
4125
3937
|
};
|
|
4126
|
-
}
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
if (typeof EE !== "function") {
|
|
4132
|
-
EE = EE.EventEmitter;
|
|
4133
|
-
}
|
|
4134
|
-
if (process$1.__signal_exit_emitter__) {
|
|
4135
|
-
emitter = process$1.__signal_exit_emitter__;
|
|
4136
|
-
} else {
|
|
4137
|
-
emitter = process$1.__signal_exit_emitter__ = new EE();
|
|
4138
|
-
emitter.count = 0;
|
|
4139
|
-
emitter.emitted = {};
|
|
3938
|
+
};
|
|
3939
|
+
var SignalExitFallback = class extends SignalExitBase {
|
|
3940
|
+
onExit() {
|
|
3941
|
+
return () => {
|
|
3942
|
+
};
|
|
4140
3943
|
}
|
|
4141
|
-
|
|
4142
|
-
emitter.setMaxListeners(Infinity);
|
|
4143
|
-
emitter.infinite = true;
|
|
3944
|
+
load() {
|
|
4144
3945
|
}
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
3946
|
+
unload() {
|
|
3947
|
+
}
|
|
3948
|
+
};
|
|
3949
|
+
var SignalExit = class extends SignalExitBase {
|
|
3950
|
+
// "SIGHUP" throws an `ENOSYS` error on Windows,
|
|
3951
|
+
// so use a supported signal instead
|
|
3952
|
+
/* c8 ignore start */
|
|
3953
|
+
#hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
3954
|
+
/* c8 ignore stop */
|
|
3955
|
+
#emitter = new Emitter();
|
|
3956
|
+
#process;
|
|
3957
|
+
#originalProcessEmit;
|
|
3958
|
+
#originalProcessReallyExit;
|
|
3959
|
+
#sigListeners = {};
|
|
3960
|
+
#loaded = false;
|
|
3961
|
+
constructor(process4) {
|
|
3962
|
+
super();
|
|
3963
|
+
this.#process = process4;
|
|
3964
|
+
this.#sigListeners = {};
|
|
3965
|
+
for (const sig of signals) {
|
|
3966
|
+
this.#sigListeners[sig] = () => {
|
|
3967
|
+
const listeners = this.#process.listeners(sig);
|
|
3968
|
+
let { count } = this.#emitter;
|
|
3969
|
+
const p = process4;
|
|
3970
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
3971
|
+
count += p.__signal_exit_emitter__.count;
|
|
3972
|
+
}
|
|
3973
|
+
if (listeners.length === count) {
|
|
3974
|
+
this.unload();
|
|
3975
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
3976
|
+
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
3977
|
+
if (!ret)
|
|
3978
|
+
process4.kill(process4.pid, s);
|
|
3979
|
+
}
|
|
4148
3980
|
};
|
|
4149
3981
|
}
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
3982
|
+
this.#originalProcessReallyExit = process4.reallyExit;
|
|
3983
|
+
this.#originalProcessEmit = process4.emit;
|
|
3984
|
+
}
|
|
3985
|
+
onExit(cb, opts) {
|
|
3986
|
+
if (!processOk(this.#process)) {
|
|
3987
|
+
return () => {
|
|
3988
|
+
};
|
|
4153
3989
|
}
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
ev = "afterexit";
|
|
3990
|
+
if (this.#loaded === false) {
|
|
3991
|
+
this.load();
|
|
4157
3992
|
}
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
3993
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
3994
|
+
this.#emitter.on(ev, cb);
|
|
3995
|
+
return () => {
|
|
3996
|
+
this.#emitter.removeListener(ev, cb);
|
|
3997
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
|
|
3998
|
+
this.unload();
|
|
4162
3999
|
}
|
|
4163
4000
|
};
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
unload = function unload2() {
|
|
4168
|
-
if (!loaded || !processOk(commonjsGlobal.process)) {
|
|
4001
|
+
}
|
|
4002
|
+
load() {
|
|
4003
|
+
if (this.#loaded) {
|
|
4169
4004
|
return;
|
|
4170
4005
|
}
|
|
4171
|
-
loaded =
|
|
4172
|
-
|
|
4006
|
+
this.#loaded = true;
|
|
4007
|
+
this.#emitter.count += 1;
|
|
4008
|
+
for (const sig of signals) {
|
|
4173
4009
|
try {
|
|
4174
|
-
|
|
4175
|
-
|
|
4010
|
+
const fn = this.#sigListeners[sig];
|
|
4011
|
+
if (fn)
|
|
4012
|
+
this.#process.on(sig, fn);
|
|
4013
|
+
} catch (_) {
|
|
4176
4014
|
}
|
|
4177
|
-
});
|
|
4178
|
-
process$1.emit = originalProcessEmit;
|
|
4179
|
-
process$1.reallyExit = originalProcessReallyExit;
|
|
4180
|
-
emitter.count -= 1;
|
|
4181
|
-
};
|
|
4182
|
-
signalExit.exports.unload = unload;
|
|
4183
|
-
emit = function emit2(event, code, signal) {
|
|
4184
|
-
if (emitter.emitted[event]) {
|
|
4185
|
-
return;
|
|
4186
4015
|
}
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
};
|
|
4190
|
-
sigListeners = {};
|
|
4191
|
-
signals.forEach(function(sig) {
|
|
4192
|
-
sigListeners[sig] = function listener() {
|
|
4193
|
-
if (!processOk(commonjsGlobal.process)) {
|
|
4194
|
-
return;
|
|
4195
|
-
}
|
|
4196
|
-
var listeners = process$1.listeners(sig);
|
|
4197
|
-
if (listeners.length === emitter.count) {
|
|
4198
|
-
unload();
|
|
4199
|
-
emit("exit", null, sig);
|
|
4200
|
-
emit("afterexit", null, sig);
|
|
4201
|
-
if (isWin && sig === "SIGHUP") {
|
|
4202
|
-
sig = "SIGINT";
|
|
4203
|
-
}
|
|
4204
|
-
process$1.kill(process$1.pid, sig);
|
|
4205
|
-
}
|
|
4016
|
+
this.#process.emit = (ev, ...a) => {
|
|
4017
|
+
return this.#processEmit(ev, ...a);
|
|
4206
4018
|
};
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
}
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
if (loaded || !processOk(commonjsGlobal.process)) {
|
|
4019
|
+
this.#process.reallyExit = (code) => {
|
|
4020
|
+
return this.#processReallyExit(code);
|
|
4021
|
+
};
|
|
4022
|
+
}
|
|
4023
|
+
unload() {
|
|
4024
|
+
if (!this.#loaded) {
|
|
4214
4025
|
return;
|
|
4215
4026
|
}
|
|
4216
|
-
loaded =
|
|
4217
|
-
|
|
4218
|
-
|
|
4027
|
+
this.#loaded = false;
|
|
4028
|
+
signals.forEach((sig) => {
|
|
4029
|
+
const listener = this.#sigListeners[sig];
|
|
4030
|
+
if (!listener) {
|
|
4031
|
+
throw new Error("Listener not defined for signal: " + sig);
|
|
4032
|
+
}
|
|
4219
4033
|
try {
|
|
4220
|
-
process
|
|
4221
|
-
|
|
4222
|
-
} catch (er) {
|
|
4223
|
-
return false;
|
|
4034
|
+
this.#process.removeListener(sig, listener);
|
|
4035
|
+
} catch (_) {
|
|
4224
4036
|
}
|
|
4225
4037
|
});
|
|
4226
|
-
process
|
|
4227
|
-
process
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
process
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
}
|
|
4247
|
-
var ret = originalProcessEmit.apply(this, arguments);
|
|
4248
|
-
emit("exit", process$1.exitCode, null);
|
|
4249
|
-
emit("afterexit", process$1.exitCode, null);
|
|
4038
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
4039
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
4040
|
+
this.#emitter.count -= 1;
|
|
4041
|
+
}
|
|
4042
|
+
#processReallyExit(code) {
|
|
4043
|
+
if (!processOk(this.#process)) {
|
|
4044
|
+
return 0;
|
|
4045
|
+
}
|
|
4046
|
+
this.#process.exitCode = code || 0;
|
|
4047
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
4048
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
4049
|
+
}
|
|
4050
|
+
#processEmit(ev, ...args) {
|
|
4051
|
+
const og = this.#originalProcessEmit;
|
|
4052
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
4053
|
+
if (typeof args[0] === "number") {
|
|
4054
|
+
this.#process.exitCode = args[0];
|
|
4055
|
+
}
|
|
4056
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
4057
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
4250
4058
|
return ret;
|
|
4251
4059
|
} else {
|
|
4252
|
-
return
|
|
4253
|
-
}
|
|
4254
|
-
}
|
|
4255
|
-
}
|
|
4256
|
-
var
|
|
4257
|
-
var
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4060
|
+
return og.call(this.#process, ev, ...args);
|
|
4061
|
+
}
|
|
4062
|
+
}
|
|
4063
|
+
};
|
|
4064
|
+
var process$1 = globalThis.process;
|
|
4065
|
+
var {
|
|
4066
|
+
/**
|
|
4067
|
+
* Called when the process is exiting, whether via signal, explicit
|
|
4068
|
+
* exit, or running out of stuff to do.
|
|
4069
|
+
*
|
|
4070
|
+
* If the global process object is not suitable for instrumentation,
|
|
4071
|
+
* then this will be a no-op.
|
|
4072
|
+
*
|
|
4073
|
+
* Returns a function that may be used to unload signal-exit.
|
|
4074
|
+
*/
|
|
4075
|
+
onExit,
|
|
4076
|
+
/**
|
|
4077
|
+
* Load the listeners. Likely you never need to call this, unless
|
|
4078
|
+
* doing a rather deep integration with signal-exit functionality.
|
|
4079
|
+
* Mostly exposed for the benefit of testing.
|
|
4080
|
+
*
|
|
4081
|
+
* @internal
|
|
4082
|
+
*/
|
|
4083
|
+
load,
|
|
4084
|
+
/**
|
|
4085
|
+
* Unload the listeners. Likely you never need to call this, unless
|
|
4086
|
+
* doing a rather deep integration with signal-exit functionality.
|
|
4087
|
+
* Mostly exposed for the benefit of testing.
|
|
4088
|
+
*
|
|
4089
|
+
* @internal
|
|
4090
|
+
*/
|
|
4091
|
+
unload
|
|
4092
|
+
} = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
|
|
4272
4093
|
var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
|
|
4273
|
-
var spawnedKill = (kill, signal = "SIGTERM",
|
|
4094
|
+
var spawnedKill = (kill, signal = "SIGTERM", options2 = {}) => {
|
|
4274
4095
|
const killResult = kill(signal);
|
|
4275
|
-
setKillTimeout(kill, signal,
|
|
4096
|
+
setKillTimeout(kill, signal, options2, killResult);
|
|
4276
4097
|
return killResult;
|
|
4277
4098
|
};
|
|
4278
|
-
var setKillTimeout = (kill, signal,
|
|
4279
|
-
if (!shouldForceKill(signal,
|
|
4099
|
+
var setKillTimeout = (kill, signal, options2, killResult) => {
|
|
4100
|
+
if (!shouldForceKill(signal, options2, killResult)) {
|
|
4280
4101
|
return;
|
|
4281
4102
|
}
|
|
4282
|
-
const timeout = getForceKillAfterTimeout(
|
|
4103
|
+
const timeout = getForceKillAfterTimeout(options2);
|
|
4283
4104
|
const t = setTimeout(() => {
|
|
4284
4105
|
kill("SIGKILL");
|
|
4285
4106
|
}, timeout);
|
|
@@ -4339,11 +4160,11 @@ var setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
|
|
|
4339
4160
|
removeExitHandler();
|
|
4340
4161
|
});
|
|
4341
4162
|
};
|
|
4342
|
-
function isStream(
|
|
4343
|
-
return
|
|
4163
|
+
function isStream(stream) {
|
|
4164
|
+
return stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
|
|
4344
4165
|
}
|
|
4345
|
-
function isWritableStream(
|
|
4346
|
-
return isStream(
|
|
4166
|
+
function isWritableStream(stream) {
|
|
4167
|
+
return isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
|
|
4347
4168
|
}
|
|
4348
4169
|
var isExecaChildProcess = (target) => target instanceof ChildProcess && typeof target.then === "function";
|
|
4349
4170
|
var pipeToTarget = (spawned, streamName, target) => {
|
|
@@ -4375,96 +4196,179 @@ var addPipeMethods = (spawned) => {
|
|
|
4375
4196
|
spawned.pipeAll = pipeToTarget.bind(void 0, spawned, "all");
|
|
4376
4197
|
}
|
|
4377
4198
|
};
|
|
4378
|
-
var
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
options = { ...options };
|
|
4382
|
-
const { array } = options;
|
|
4383
|
-
let { encoding } = options;
|
|
4384
|
-
const isBuffer = encoding === "buffer";
|
|
4385
|
-
let objectMode = false;
|
|
4386
|
-
if (array) {
|
|
4387
|
-
objectMode = !(encoding || isBuffer);
|
|
4388
|
-
} else {
|
|
4389
|
-
encoding = encoding || "utf8";
|
|
4199
|
+
var getStreamContents = async (stream, { init: init2, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = Number.POSITIVE_INFINITY } = {}) => {
|
|
4200
|
+
if (!isAsyncIterable(stream)) {
|
|
4201
|
+
throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");
|
|
4390
4202
|
}
|
|
4391
|
-
|
|
4392
|
-
|
|
4203
|
+
const state = init2();
|
|
4204
|
+
state.length = 0;
|
|
4205
|
+
try {
|
|
4206
|
+
for await (const chunk of stream) {
|
|
4207
|
+
const chunkType = getChunkType(chunk);
|
|
4208
|
+
const convertedChunk = convertChunk[chunkType](chunk, state);
|
|
4209
|
+
appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
|
|
4210
|
+
}
|
|
4211
|
+
appendFinalChunk({ state, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer });
|
|
4212
|
+
return finalize(state);
|
|
4213
|
+
} catch (error) {
|
|
4214
|
+
error.bufferedData = finalize(state);
|
|
4215
|
+
throw error;
|
|
4393
4216
|
}
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4217
|
+
};
|
|
4218
|
+
var appendFinalChunk = ({ state, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer }) => {
|
|
4219
|
+
const convertedChunk = getFinalChunk(state);
|
|
4220
|
+
if (convertedChunk !== void 0) {
|
|
4221
|
+
appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
|
|
4397
4222
|
}
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
var
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4223
|
+
};
|
|
4224
|
+
var appendChunk = ({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer }) => {
|
|
4225
|
+
const chunkSize = getSize(convertedChunk);
|
|
4226
|
+
const newLength = state.length + chunkSize;
|
|
4227
|
+
if (newLength <= maxBuffer) {
|
|
4228
|
+
addNewChunk(convertedChunk, state, addChunk, newLength);
|
|
4229
|
+
return;
|
|
4230
|
+
}
|
|
4231
|
+
const truncatedChunk = truncateChunk(convertedChunk, maxBuffer - state.length);
|
|
4232
|
+
if (truncatedChunk !== void 0) {
|
|
4233
|
+
addNewChunk(truncatedChunk, state, addChunk, maxBuffer);
|
|
4234
|
+
}
|
|
4235
|
+
throw new MaxBufferError();
|
|
4236
|
+
};
|
|
4237
|
+
var addNewChunk = (convertedChunk, state, addChunk, newLength) => {
|
|
4238
|
+
state.contents = addChunk(convertedChunk, state, newLength);
|
|
4239
|
+
state.length = newLength;
|
|
4240
|
+
};
|
|
4241
|
+
var isAsyncIterable = (stream) => typeof stream === "object" && stream !== null && typeof stream[Symbol.asyncIterator] === "function";
|
|
4242
|
+
var getChunkType = (chunk) => {
|
|
4243
|
+
const typeOfChunk = typeof chunk;
|
|
4244
|
+
if (typeOfChunk === "string") {
|
|
4245
|
+
return "string";
|
|
4246
|
+
}
|
|
4247
|
+
if (typeOfChunk !== "object" || chunk === null) {
|
|
4248
|
+
return "others";
|
|
4249
|
+
}
|
|
4250
|
+
if (globalThis.Buffer?.isBuffer(chunk)) {
|
|
4251
|
+
return "buffer";
|
|
4252
|
+
}
|
|
4253
|
+
const prototypeName = objectToString.call(chunk);
|
|
4254
|
+
if (prototypeName === "[object ArrayBuffer]") {
|
|
4255
|
+
return "arrayBuffer";
|
|
4256
|
+
}
|
|
4257
|
+
if (prototypeName === "[object DataView]") {
|
|
4258
|
+
return "dataView";
|
|
4259
|
+
}
|
|
4260
|
+
if (Number.isInteger(chunk.byteLength) && Number.isInteger(chunk.byteOffset) && objectToString.call(chunk.buffer) === "[object ArrayBuffer]") {
|
|
4261
|
+
return "typedArray";
|
|
4262
|
+
}
|
|
4263
|
+
return "others";
|
|
4264
|
+
};
|
|
4265
|
+
var { toString: objectToString } = Object.prototype;
|
|
4422
4266
|
var MaxBufferError = class extends Error {
|
|
4267
|
+
name = "MaxBufferError";
|
|
4423
4268
|
constructor() {
|
|
4424
4269
|
super("maxBuffer exceeded");
|
|
4425
|
-
this.name = "MaxBufferError";
|
|
4426
4270
|
}
|
|
4427
4271
|
};
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4272
|
+
var identity = (value) => value;
|
|
4273
|
+
var noop$1 = () => void 0;
|
|
4274
|
+
var getContentsProp = ({ contents }) => contents;
|
|
4275
|
+
var throwObjectStream = (chunk) => {
|
|
4276
|
+
throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
|
|
4277
|
+
};
|
|
4278
|
+
var getLengthProp = (convertedChunk) => convertedChunk.length;
|
|
4279
|
+
async function getStreamAsArrayBuffer(stream, options2) {
|
|
4280
|
+
return getStreamContents(stream, arrayBufferMethods, options2);
|
|
4281
|
+
}
|
|
4282
|
+
var initArrayBuffer = () => ({ contents: new ArrayBuffer(0) });
|
|
4283
|
+
var useTextEncoder = (chunk) => textEncoder.encode(chunk);
|
|
4284
|
+
var textEncoder = new TextEncoder();
|
|
4285
|
+
var useUint8Array = (chunk) => new Uint8Array(chunk);
|
|
4286
|
+
var useUint8ArrayWithOffset = (chunk) => new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
|
|
4287
|
+
var truncateArrayBufferChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
|
|
4288
|
+
var addArrayBufferChunk = (convertedChunk, { contents, length: previousLength }, length) => {
|
|
4289
|
+
const newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);
|
|
4290
|
+
new Uint8Array(newContents).set(convertedChunk, previousLength);
|
|
4291
|
+
return newContents;
|
|
4292
|
+
};
|
|
4293
|
+
var resizeArrayBufferSlow = (contents, length) => {
|
|
4294
|
+
if (length <= contents.byteLength) {
|
|
4295
|
+
return contents;
|
|
4296
|
+
}
|
|
4297
|
+
const arrayBuffer = new ArrayBuffer(getNewContentsLength(length));
|
|
4298
|
+
new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
|
|
4299
|
+
return arrayBuffer;
|
|
4300
|
+
};
|
|
4301
|
+
var resizeArrayBuffer = (contents, length) => {
|
|
4302
|
+
if (length <= contents.maxByteLength) {
|
|
4303
|
+
contents.resize(length);
|
|
4304
|
+
return contents;
|
|
4305
|
+
}
|
|
4306
|
+
const arrayBuffer = new ArrayBuffer(length, { maxByteLength: getNewContentsLength(length) });
|
|
4307
|
+
new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
|
|
4308
|
+
return arrayBuffer;
|
|
4309
|
+
};
|
|
4310
|
+
var getNewContentsLength = (length) => SCALE_FACTOR ** Math.ceil(Math.log(length) / Math.log(SCALE_FACTOR));
|
|
4311
|
+
var SCALE_FACTOR = 2;
|
|
4312
|
+
var finalizeArrayBuffer = ({ contents, length }) => hasArrayBufferResize() ? contents : contents.slice(0, length);
|
|
4313
|
+
var hasArrayBufferResize = () => "resize" in ArrayBuffer.prototype;
|
|
4314
|
+
var arrayBufferMethods = {
|
|
4315
|
+
init: initArrayBuffer,
|
|
4316
|
+
convertChunk: {
|
|
4317
|
+
string: useTextEncoder,
|
|
4318
|
+
buffer: useUint8Array,
|
|
4319
|
+
arrayBuffer: useUint8Array,
|
|
4320
|
+
dataView: useUint8ArrayWithOffset,
|
|
4321
|
+
typedArray: useUint8ArrayWithOffset,
|
|
4322
|
+
others: throwObjectStream
|
|
4323
|
+
},
|
|
4324
|
+
getSize: getLengthProp,
|
|
4325
|
+
truncateChunk: truncateArrayBufferChunk,
|
|
4326
|
+
addChunk: addArrayBufferChunk,
|
|
4327
|
+
getFinalChunk: noop$1,
|
|
4328
|
+
finalize: finalizeArrayBuffer
|
|
4329
|
+
};
|
|
4330
|
+
async function getStreamAsBuffer(stream, options2) {
|
|
4331
|
+
if (!("Buffer" in globalThis)) {
|
|
4332
|
+
throw new Error("getStreamAsBuffer() is only supported in Node.js");
|
|
4333
|
+
}
|
|
4334
|
+
try {
|
|
4335
|
+
return arrayBufferToNodeBuffer(await getStreamAsArrayBuffer(stream, options2));
|
|
4336
|
+
} catch (error) {
|
|
4337
|
+
if (error.bufferedData !== void 0) {
|
|
4338
|
+
error.bufferedData = arrayBufferToNodeBuffer(error.bufferedData);
|
|
4339
|
+
}
|
|
4340
|
+
throw error;
|
|
4431
4341
|
}
|
|
4432
|
-
options = {
|
|
4433
|
-
maxBuffer: Infinity,
|
|
4434
|
-
...options
|
|
4435
|
-
};
|
|
4436
|
-
const { maxBuffer } = options;
|
|
4437
|
-
const stream2 = bufferStream(options);
|
|
4438
|
-
await new Promise((resolve3, reject) => {
|
|
4439
|
-
const rejectPromise = (error) => {
|
|
4440
|
-
if (error && stream2.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
|
|
4441
|
-
error.bufferedData = stream2.getBufferedValue();
|
|
4442
|
-
}
|
|
4443
|
-
reject(error);
|
|
4444
|
-
};
|
|
4445
|
-
(async () => {
|
|
4446
|
-
try {
|
|
4447
|
-
await streamPipelinePromisified(inputStream, stream2);
|
|
4448
|
-
resolve3();
|
|
4449
|
-
} catch (error) {
|
|
4450
|
-
rejectPromise(error);
|
|
4451
|
-
}
|
|
4452
|
-
})();
|
|
4453
|
-
stream2.on("data", () => {
|
|
4454
|
-
if (stream2.getBufferedLength() > maxBuffer) {
|
|
4455
|
-
rejectPromise(new MaxBufferError());
|
|
4456
|
-
}
|
|
4457
|
-
});
|
|
4458
|
-
});
|
|
4459
|
-
return stream2.getBufferedValue();
|
|
4460
4342
|
}
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
var
|
|
4466
|
-
var
|
|
4467
|
-
var {
|
|
4343
|
+
var arrayBufferToNodeBuffer = (arrayBuffer) => globalThis.Buffer.from(arrayBuffer);
|
|
4344
|
+
async function getStreamAsString(stream, options2) {
|
|
4345
|
+
return getStreamContents(stream, stringMethods, options2);
|
|
4346
|
+
}
|
|
4347
|
+
var initString = () => ({ contents: "", textDecoder: new TextDecoder() });
|
|
4348
|
+
var useTextDecoder = (chunk, { textDecoder }) => textDecoder.decode(chunk, { stream: true });
|
|
4349
|
+
var addStringChunk = (convertedChunk, { contents }) => contents + convertedChunk;
|
|
4350
|
+
var truncateStringChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
|
|
4351
|
+
var getFinalStringChunk = ({ textDecoder }) => {
|
|
4352
|
+
const finalChunk = textDecoder.decode();
|
|
4353
|
+
return finalChunk === "" ? void 0 : finalChunk;
|
|
4354
|
+
};
|
|
4355
|
+
var stringMethods = {
|
|
4356
|
+
init: initString,
|
|
4357
|
+
convertChunk: {
|
|
4358
|
+
string: identity,
|
|
4359
|
+
buffer: useTextDecoder,
|
|
4360
|
+
arrayBuffer: useTextDecoder,
|
|
4361
|
+
dataView: useTextDecoder,
|
|
4362
|
+
typedArray: useTextDecoder,
|
|
4363
|
+
others: throwObjectStream
|
|
4364
|
+
},
|
|
4365
|
+
getSize: getLengthProp,
|
|
4366
|
+
truncateChunk: truncateStringChunk,
|
|
4367
|
+
addChunk: addStringChunk,
|
|
4368
|
+
getFinalChunk: getFinalStringChunk,
|
|
4369
|
+
finalize: getContentsProp
|
|
4370
|
+
};
|
|
4371
|
+
var { PassThrough } = require$$0$3;
|
|
4468
4372
|
var mergeStream = function() {
|
|
4469
4373
|
var sources = [];
|
|
4470
4374
|
var output = new PassThrough({ objectMode: true });
|
|
@@ -4510,8 +4414,8 @@ var getInput = ({ input, inputFile }) => {
|
|
|
4510
4414
|
validateInputOptions(input);
|
|
4511
4415
|
return createReadStream(inputFile);
|
|
4512
4416
|
};
|
|
4513
|
-
var handleInput = (spawned,
|
|
4514
|
-
const input = getInput(
|
|
4417
|
+
var handleInput = (spawned, options2) => {
|
|
4418
|
+
const input = getInput(options2);
|
|
4515
4419
|
if (input === void 0) {
|
|
4516
4420
|
return;
|
|
4517
4421
|
}
|
|
@@ -4534,25 +4438,33 @@ var makeAllStream = (spawned, { all }) => {
|
|
|
4534
4438
|
}
|
|
4535
4439
|
return mixed;
|
|
4536
4440
|
};
|
|
4537
|
-
var getBufferedData = async (
|
|
4538
|
-
if (!
|
|
4441
|
+
var getBufferedData = async (stream, streamPromise) => {
|
|
4442
|
+
if (!stream || streamPromise === void 0) {
|
|
4539
4443
|
return;
|
|
4540
4444
|
}
|
|
4541
|
-
|
|
4445
|
+
await setTimeout$1(0);
|
|
4446
|
+
stream.destroy();
|
|
4542
4447
|
try {
|
|
4543
4448
|
return await streamPromise;
|
|
4544
4449
|
} catch (error) {
|
|
4545
4450
|
return error.bufferedData;
|
|
4546
4451
|
}
|
|
4547
4452
|
};
|
|
4548
|
-
var getStreamPromise = (
|
|
4549
|
-
if (!
|
|
4453
|
+
var getStreamPromise = (stream, { encoding, buffer, maxBuffer }) => {
|
|
4454
|
+
if (!stream || !buffer) {
|
|
4550
4455
|
return;
|
|
4551
4456
|
}
|
|
4552
|
-
if (encoding) {
|
|
4553
|
-
return
|
|
4457
|
+
if (encoding === "utf8" || encoding === "utf-8") {
|
|
4458
|
+
return getStreamAsString(stream, { maxBuffer });
|
|
4459
|
+
}
|
|
4460
|
+
if (encoding === null || encoding === "buffer") {
|
|
4461
|
+
return getStreamAsBuffer(stream, { maxBuffer });
|
|
4554
4462
|
}
|
|
4555
|
-
return
|
|
4463
|
+
return applyEncoding(stream, maxBuffer, encoding);
|
|
4464
|
+
};
|
|
4465
|
+
var applyEncoding = async (stream, maxBuffer, encoding) => {
|
|
4466
|
+
const buffer = await getStreamAsBuffer(stream, { maxBuffer });
|
|
4467
|
+
return buffer.toString(encoding);
|
|
4556
4468
|
};
|
|
4557
4469
|
var getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
|
|
4558
4470
|
const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
|
|
@@ -4569,8 +4481,8 @@ var getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBu
|
|
|
4569
4481
|
]);
|
|
4570
4482
|
}
|
|
4571
4483
|
};
|
|
4572
|
-
var nativePromisePrototype = (
|
|
4573
|
-
})()
|
|
4484
|
+
var nativePromisePrototype = (async () => {
|
|
4485
|
+
})().constructor.prototype;
|
|
4574
4486
|
var descriptors = ["then", "catch", "finally"].map((property) => [
|
|
4575
4487
|
property,
|
|
4576
4488
|
Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
|
|
@@ -4601,12 +4513,11 @@ var normalizeArgs = (file, args = []) => {
|
|
|
4601
4513
|
return [file, ...args];
|
|
4602
4514
|
};
|
|
4603
4515
|
var NO_ESCAPE_REGEXP = /^[\w.-]+$/;
|
|
4604
|
-
var DOUBLE_QUOTES_REGEXP = /"/g;
|
|
4605
4516
|
var escapeArg = (arg) => {
|
|
4606
4517
|
if (typeof arg !== "string" || NO_ESCAPE_REGEXP.test(arg)) {
|
|
4607
4518
|
return arg;
|
|
4608
4519
|
}
|
|
4609
|
-
return `"${arg.
|
|
4520
|
+
return `"${arg.replaceAll('"', '\\"')}"`;
|
|
4610
4521
|
};
|
|
4611
4522
|
var joinCommand = (file, args) => normalizeArgs(file, args).join(" ");
|
|
4612
4523
|
var getEscapedCommand = (file, args) => normalizeArgs(file, args).map((arg) => escapeArg(arg)).join(" ");
|
|
@@ -4614,7 +4525,7 @@ var SPACES_REGEXP = / +/g;
|
|
|
4614
4525
|
var parseCommand = (command) => {
|
|
4615
4526
|
const tokens = [];
|
|
4616
4527
|
for (const token of command.trim().split(SPACES_REGEXP)) {
|
|
4617
|
-
const previousToken = tokens
|
|
4528
|
+
const previousToken = tokens.at(-1);
|
|
4618
4529
|
if (previousToken && previousToken.endsWith("\\")) {
|
|
4619
4530
|
tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`;
|
|
4620
4531
|
} else {
|
|
@@ -4644,18 +4555,18 @@ var getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) =>
|
|
|
4644
4555
|
}
|
|
4645
4556
|
return env2;
|
|
4646
4557
|
};
|
|
4647
|
-
var handleArguments = (file, args,
|
|
4648
|
-
const parsed = crossSpawn._parse(file, args,
|
|
4558
|
+
var handleArguments = (file, args, options2 = {}) => {
|
|
4559
|
+
const parsed = crossSpawn._parse(file, args, options2);
|
|
4649
4560
|
file = parsed.command;
|
|
4650
4561
|
args = parsed.args;
|
|
4651
|
-
|
|
4652
|
-
|
|
4562
|
+
options2 = parsed.options;
|
|
4563
|
+
options2 = {
|
|
4653
4564
|
maxBuffer: DEFAULT_MAX_BUFFER,
|
|
4654
4565
|
buffer: true,
|
|
4655
4566
|
stripFinalNewline: true,
|
|
4656
4567
|
extendEnv: true,
|
|
4657
4568
|
preferLocal: false,
|
|
4658
|
-
localDir:
|
|
4569
|
+
localDir: options2.cwd || process$2.cwd(),
|
|
4659
4570
|
execPath: process$2.execPath,
|
|
4660
4571
|
encoding: "utf8",
|
|
4661
4572
|
reject: true,
|
|
@@ -4663,26 +4574,26 @@ var handleArguments = (file, args, options = {}) => {
|
|
|
4663
4574
|
all: false,
|
|
4664
4575
|
windowsHide: true,
|
|
4665
4576
|
verbose: verboseDefault,
|
|
4666
|
-
...
|
|
4577
|
+
...options2
|
|
4667
4578
|
};
|
|
4668
|
-
|
|
4669
|
-
|
|
4579
|
+
options2.env = getEnv(options2);
|
|
4580
|
+
options2.stdio = normalizeStdio(options2);
|
|
4670
4581
|
if (process$2.platform === "win32" && path$3.basename(file, ".exe") === "cmd") {
|
|
4671
4582
|
args.unshift("/q");
|
|
4672
4583
|
}
|
|
4673
|
-
return { file, args, options, parsed };
|
|
4584
|
+
return { file, args, options: options2, parsed };
|
|
4674
4585
|
};
|
|
4675
|
-
var handleOutput = (
|
|
4586
|
+
var handleOutput = (options2, value, error) => {
|
|
4676
4587
|
if (typeof value !== "string" && !Buffer$1.isBuffer(value)) {
|
|
4677
4588
|
return error === void 0 ? void 0 : "";
|
|
4678
4589
|
}
|
|
4679
|
-
if (
|
|
4590
|
+
if (options2.stripFinalNewline) {
|
|
4680
4591
|
return stripFinalNewline(value);
|
|
4681
4592
|
}
|
|
4682
4593
|
return value;
|
|
4683
4594
|
};
|
|
4684
|
-
function execa(file, args,
|
|
4685
|
-
const parsed = handleArguments(file, args,
|
|
4595
|
+
function execa(file, args, options2) {
|
|
4596
|
+
const parsed = handleArguments(file, args, options2);
|
|
4686
4597
|
const command = joinCommand(file, args);
|
|
4687
4598
|
const escapedCommand = getEscapedCommand(file, args);
|
|
4688
4599
|
logCommand(escapedCommand, parsed.options);
|
|
@@ -4758,9 +4669,207 @@ function execa(file, args, options) {
|
|
|
4758
4669
|
mergePromise(spawned, handlePromiseOnce);
|
|
4759
4670
|
return spawned;
|
|
4760
4671
|
}
|
|
4761
|
-
function execaCommand(command,
|
|
4672
|
+
function execaCommand(command, options2) {
|
|
4762
4673
|
const [file, ...args] = parseCommand(command);
|
|
4763
|
-
return execa(file, args,
|
|
4674
|
+
return execa(file, args, options2);
|
|
4675
|
+
}
|
|
4676
|
+
var Node = class {
|
|
4677
|
+
value;
|
|
4678
|
+
next;
|
|
4679
|
+
constructor(value) {
|
|
4680
|
+
this.value = value;
|
|
4681
|
+
}
|
|
4682
|
+
};
|
|
4683
|
+
var Queue = class {
|
|
4684
|
+
#head;
|
|
4685
|
+
#tail;
|
|
4686
|
+
#size;
|
|
4687
|
+
constructor() {
|
|
4688
|
+
this.clear();
|
|
4689
|
+
}
|
|
4690
|
+
enqueue(value) {
|
|
4691
|
+
const node = new Node(value);
|
|
4692
|
+
if (this.#head) {
|
|
4693
|
+
this.#tail.next = node;
|
|
4694
|
+
this.#tail = node;
|
|
4695
|
+
} else {
|
|
4696
|
+
this.#head = node;
|
|
4697
|
+
this.#tail = node;
|
|
4698
|
+
}
|
|
4699
|
+
this.#size++;
|
|
4700
|
+
}
|
|
4701
|
+
dequeue() {
|
|
4702
|
+
const current = this.#head;
|
|
4703
|
+
if (!current) {
|
|
4704
|
+
return;
|
|
4705
|
+
}
|
|
4706
|
+
this.#head = this.#head.next;
|
|
4707
|
+
this.#size--;
|
|
4708
|
+
return current.value;
|
|
4709
|
+
}
|
|
4710
|
+
clear() {
|
|
4711
|
+
this.#head = void 0;
|
|
4712
|
+
this.#tail = void 0;
|
|
4713
|
+
this.#size = 0;
|
|
4714
|
+
}
|
|
4715
|
+
get size() {
|
|
4716
|
+
return this.#size;
|
|
4717
|
+
}
|
|
4718
|
+
*[Symbol.iterator]() {
|
|
4719
|
+
let current = this.#head;
|
|
4720
|
+
while (current) {
|
|
4721
|
+
yield current.value;
|
|
4722
|
+
current = current.next;
|
|
4723
|
+
}
|
|
4724
|
+
}
|
|
4725
|
+
};
|
|
4726
|
+
function pLimit(concurrency) {
|
|
4727
|
+
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
4728
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
4729
|
+
}
|
|
4730
|
+
const queue = new Queue();
|
|
4731
|
+
let activeCount = 0;
|
|
4732
|
+
const next = () => {
|
|
4733
|
+
activeCount--;
|
|
4734
|
+
if (queue.size > 0) {
|
|
4735
|
+
queue.dequeue()();
|
|
4736
|
+
}
|
|
4737
|
+
};
|
|
4738
|
+
const run2 = async (fn, resolve3, args) => {
|
|
4739
|
+
activeCount++;
|
|
4740
|
+
const result = (async () => fn(...args))();
|
|
4741
|
+
resolve3(result);
|
|
4742
|
+
try {
|
|
4743
|
+
await result;
|
|
4744
|
+
} catch {
|
|
4745
|
+
}
|
|
4746
|
+
next();
|
|
4747
|
+
};
|
|
4748
|
+
const enqueue = (fn, resolve3, args) => {
|
|
4749
|
+
queue.enqueue(run2.bind(void 0, fn, resolve3, args));
|
|
4750
|
+
(async () => {
|
|
4751
|
+
await Promise.resolve();
|
|
4752
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
4753
|
+
queue.dequeue()();
|
|
4754
|
+
}
|
|
4755
|
+
})();
|
|
4756
|
+
};
|
|
4757
|
+
const generator = (fn, ...args) => new Promise((resolve3) => {
|
|
4758
|
+
enqueue(fn, resolve3, args);
|
|
4759
|
+
});
|
|
4760
|
+
Object.defineProperties(generator, {
|
|
4761
|
+
activeCount: {
|
|
4762
|
+
get: () => activeCount
|
|
4763
|
+
},
|
|
4764
|
+
pendingCount: {
|
|
4765
|
+
get: () => queue.size
|
|
4766
|
+
},
|
|
4767
|
+
clearQueue: {
|
|
4768
|
+
value: () => {
|
|
4769
|
+
queue.clear();
|
|
4770
|
+
}
|
|
4771
|
+
}
|
|
4772
|
+
});
|
|
4773
|
+
return generator;
|
|
4774
|
+
}
|
|
4775
|
+
var EndError = class extends Error {
|
|
4776
|
+
constructor(value) {
|
|
4777
|
+
super();
|
|
4778
|
+
this.value = value;
|
|
4779
|
+
}
|
|
4780
|
+
};
|
|
4781
|
+
var testElement = async (element, tester) => tester(await element);
|
|
4782
|
+
var finder = async (element) => {
|
|
4783
|
+
const values = await Promise.all(element);
|
|
4784
|
+
if (values[1] === true) {
|
|
4785
|
+
throw new EndError(values[0]);
|
|
4786
|
+
}
|
|
4787
|
+
return false;
|
|
4788
|
+
};
|
|
4789
|
+
async function pLocate(iterable, tester, {
|
|
4790
|
+
concurrency = Number.POSITIVE_INFINITY,
|
|
4791
|
+
preserveOrder = true
|
|
4792
|
+
} = {}) {
|
|
4793
|
+
const limit = pLimit(concurrency);
|
|
4794
|
+
const items = [...iterable].map((element) => [element, limit(testElement, element, tester)]);
|
|
4795
|
+
const checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);
|
|
4796
|
+
try {
|
|
4797
|
+
await Promise.all(items.map((element) => checkLimit(finder, element)));
|
|
4798
|
+
} catch (error) {
|
|
4799
|
+
if (error instanceof EndError) {
|
|
4800
|
+
return error.value;
|
|
4801
|
+
}
|
|
4802
|
+
throw error;
|
|
4803
|
+
}
|
|
4804
|
+
}
|
|
4805
|
+
var typeMappings = {
|
|
4806
|
+
directory: "isDirectory",
|
|
4807
|
+
file: "isFile"
|
|
4808
|
+
};
|
|
4809
|
+
function checkType(type) {
|
|
4810
|
+
if (Object.hasOwnProperty.call(typeMappings, type)) {
|
|
4811
|
+
return;
|
|
4812
|
+
}
|
|
4813
|
+
throw new Error(`Invalid type specified: ${type}`);
|
|
4814
|
+
}
|
|
4815
|
+
var matchType = (type, stat) => stat[typeMappings[type]]();
|
|
4816
|
+
var toPath$1 = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
4817
|
+
async function locatePath(paths, {
|
|
4818
|
+
cwd = process$2.cwd(),
|
|
4819
|
+
type = "file",
|
|
4820
|
+
allowSymlinks = true,
|
|
4821
|
+
concurrency,
|
|
4822
|
+
preserveOrder
|
|
4823
|
+
} = {}) {
|
|
4824
|
+
checkType(type);
|
|
4825
|
+
cwd = toPath$1(cwd);
|
|
4826
|
+
const statFunction = allowSymlinks ? promises.stat : promises.lstat;
|
|
4827
|
+
return pLocate(paths, async (path_) => {
|
|
4828
|
+
try {
|
|
4829
|
+
const stat = await statFunction(path$3.resolve(cwd, path_));
|
|
4830
|
+
return matchType(type, stat);
|
|
4831
|
+
} catch {
|
|
4832
|
+
return false;
|
|
4833
|
+
}
|
|
4834
|
+
}, { concurrency, preserveOrder });
|
|
4835
|
+
}
|
|
4836
|
+
var toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
4837
|
+
var findUpStop = Symbol("findUpStop");
|
|
4838
|
+
async function findUpMultiple(name, options2 = {}) {
|
|
4839
|
+
let directory = path$3.resolve(toPath(options2.cwd) || "");
|
|
4840
|
+
const { root } = path$3.parse(directory);
|
|
4841
|
+
const stopAt = path$3.resolve(directory, options2.stopAt || root);
|
|
4842
|
+
const limit = options2.limit || Number.POSITIVE_INFINITY;
|
|
4843
|
+
const paths = [name].flat();
|
|
4844
|
+
const runMatcher = async (locateOptions) => {
|
|
4845
|
+
if (typeof name !== "function") {
|
|
4846
|
+
return locatePath(paths, locateOptions);
|
|
4847
|
+
}
|
|
4848
|
+
const foundPath = await name(locateOptions.cwd);
|
|
4849
|
+
if (typeof foundPath === "string") {
|
|
4850
|
+
return locatePath([foundPath], locateOptions);
|
|
4851
|
+
}
|
|
4852
|
+
return foundPath;
|
|
4853
|
+
};
|
|
4854
|
+
const matches = [];
|
|
4855
|
+
while (true) {
|
|
4856
|
+
const foundPath = await runMatcher({ ...options2, cwd: directory });
|
|
4857
|
+
if (foundPath === findUpStop) {
|
|
4858
|
+
break;
|
|
4859
|
+
}
|
|
4860
|
+
if (foundPath) {
|
|
4861
|
+
matches.push(path$3.resolve(directory, foundPath));
|
|
4862
|
+
}
|
|
4863
|
+
if (directory === stopAt || matches.length >= limit) {
|
|
4864
|
+
break;
|
|
4865
|
+
}
|
|
4866
|
+
directory = path$3.dirname(directory);
|
|
4867
|
+
}
|
|
4868
|
+
return matches;
|
|
4869
|
+
}
|
|
4870
|
+
async function findUp(name, options2 = {}) {
|
|
4871
|
+
const matches = await findUpMultiple(name, { ...options2, limit: 1 });
|
|
4872
|
+
return matches[0];
|
|
4764
4873
|
}
|
|
4765
4874
|
var ESC$1 = "\x1B[";
|
|
4766
4875
|
var OSC = "\x1B]";
|
|
@@ -4849,32 +4958,32 @@ ansiEscapes.link = (text2, url2) => {
|
|
|
4849
4958
|
BEL
|
|
4850
4959
|
].join("");
|
|
4851
4960
|
};
|
|
4852
|
-
ansiEscapes.image = (buffer,
|
|
4961
|
+
ansiEscapes.image = (buffer, options2 = {}) => {
|
|
4853
4962
|
let returnValue = `${OSC}1337;File=inline=1`;
|
|
4854
|
-
if (
|
|
4855
|
-
returnValue += `;width=${
|
|
4963
|
+
if (options2.width) {
|
|
4964
|
+
returnValue += `;width=${options2.width}`;
|
|
4856
4965
|
}
|
|
4857
|
-
if (
|
|
4858
|
-
returnValue += `;height=${
|
|
4966
|
+
if (options2.height) {
|
|
4967
|
+
returnValue += `;height=${options2.height}`;
|
|
4859
4968
|
}
|
|
4860
|
-
if (
|
|
4969
|
+
if (options2.preserveAspectRatio === false) {
|
|
4861
4970
|
returnValue += ";preserveAspectRatio=0";
|
|
4862
4971
|
}
|
|
4863
4972
|
return returnValue + ":" + buffer.toString("base64") + BEL;
|
|
4864
4973
|
};
|
|
4865
4974
|
ansiEscapes.iTerm = {
|
|
4866
4975
|
setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
|
|
4867
|
-
annotation: (message,
|
|
4976
|
+
annotation: (message, options2 = {}) => {
|
|
4868
4977
|
let returnValue = `${OSC}1337;`;
|
|
4869
|
-
const hasX = typeof
|
|
4870
|
-
const hasY = typeof
|
|
4871
|
-
if ((hasX || hasY) && !(hasX && hasY && typeof
|
|
4978
|
+
const hasX = typeof options2.x !== "undefined";
|
|
4979
|
+
const hasY = typeof options2.y !== "undefined";
|
|
4980
|
+
if ((hasX || hasY) && !(hasX && hasY && typeof options2.length !== "undefined")) {
|
|
4872
4981
|
throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");
|
|
4873
4982
|
}
|
|
4874
4983
|
message = message.replace(/\|/g, "");
|
|
4875
|
-
returnValue +=
|
|
4876
|
-
if (
|
|
4877
|
-
returnValue += (hasX ? [message,
|
|
4984
|
+
returnValue += options2.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
|
|
4985
|
+
if (options2.length > 0) {
|
|
4986
|
+
returnValue += (hasX ? [message, options2.length, options2.x, options2.y] : [options2.length, message]).join("|");
|
|
4878
4987
|
} else {
|
|
4879
4988
|
returnValue += message;
|
|
4880
4989
|
}
|
|
@@ -4887,7 +4996,7 @@ var hasFlag$2 = (flag, argv = process.argv) => {
|
|
|
4887
4996
|
const terminatorPosition = argv.indexOf("--");
|
|
4888
4997
|
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
4889
4998
|
};
|
|
4890
|
-
var os = require$$0$
|
|
4999
|
+
var os = require$$0$4;
|
|
4891
5000
|
var tty = require$$1;
|
|
4892
5001
|
var hasFlag$1 = hasFlag$2;
|
|
4893
5002
|
var { env } = process;
|
|
@@ -4973,8 +5082,8 @@ function supportsColor$1(haveStream, streamIsTTY) {
|
|
|
4973
5082
|
}
|
|
4974
5083
|
return min;
|
|
4975
5084
|
}
|
|
4976
|
-
function getSupportLevel(
|
|
4977
|
-
const level = supportsColor$1(
|
|
5085
|
+
function getSupportLevel(stream) {
|
|
5086
|
+
const level = supportsColor$1(stream, stream && stream.isTTY);
|
|
4978
5087
|
return translateLevel(level);
|
|
4979
5088
|
}
|
|
4980
5089
|
var supportsColor_1 = {
|
|
@@ -5000,7 +5109,7 @@ function parseVersion(versionString) {
|
|
|
5000
5109
|
patch: versions[2]
|
|
5001
5110
|
};
|
|
5002
5111
|
}
|
|
5003
|
-
function supportsHyperlink(
|
|
5112
|
+
function supportsHyperlink(stream) {
|
|
5004
5113
|
const { env: env2 } = process;
|
|
5005
5114
|
if ("FORCE_HYPERLINK" in env2) {
|
|
5006
5115
|
return !(env2.FORCE_HYPERLINK.length > 0 && parseInt(env2.FORCE_HYPERLINK, 10) === 0);
|
|
@@ -5011,10 +5120,10 @@ function supportsHyperlink(stream2) {
|
|
|
5011
5120
|
if (hasFlag("hyperlink=true") || hasFlag("hyperlink=always")) {
|
|
5012
5121
|
return true;
|
|
5013
5122
|
}
|
|
5014
|
-
if (!supportsColor.supportsColor(
|
|
5123
|
+
if (!supportsColor.supportsColor(stream)) {
|
|
5015
5124
|
return false;
|
|
5016
5125
|
}
|
|
5017
|
-
if (
|
|
5126
|
+
if (stream && !stream.isTTY) {
|
|
5018
5127
|
return false;
|
|
5019
5128
|
}
|
|
5020
5129
|
if (process.platform === "win32") {
|
|
@@ -5054,17 +5163,17 @@ var supportsHyperlinks = {
|
|
|
5054
5163
|
stderr: supportsHyperlink(process.stderr)
|
|
5055
5164
|
};
|
|
5056
5165
|
var supportsHyperlinks$1 = /* @__PURE__ */ getDefaultExportFromCjs(supportsHyperlinks);
|
|
5057
|
-
function terminalLink(text2, url2, { target = "stdout", ...
|
|
5166
|
+
function terminalLink(text2, url2, { target = "stdout", ...options2 } = {}) {
|
|
5058
5167
|
if (!supportsHyperlinks$1[target]) {
|
|
5059
|
-
if (
|
|
5168
|
+
if (options2.fallback === false) {
|
|
5060
5169
|
return text2;
|
|
5061
5170
|
}
|
|
5062
|
-
return typeof
|
|
5171
|
+
return typeof options2.fallback === "function" ? options2.fallback(text2, url2) : `${text2} (\u200B${url2}\u200B)`;
|
|
5063
5172
|
}
|
|
5064
5173
|
return ansiEscapes.link(text2, url2);
|
|
5065
5174
|
}
|
|
5066
5175
|
terminalLink.isSupported = supportsHyperlinks$1.stdout;
|
|
5067
|
-
terminalLink.stderr = (text2, url2,
|
|
5176
|
+
terminalLink.stderr = (text2, url2, options2 = {}) => terminalLink(text2, url2, { target: "stderr", ...options2 });
|
|
5068
5177
|
terminalLink.stderr.isSupported = supportsHyperlinks$1.stderr;
|
|
5069
5178
|
var prompts$3 = {};
|
|
5070
5179
|
var FORCE_COLOR$1;
|
|
@@ -5390,7 +5499,7 @@ var util = {
|
|
|
5390
5499
|
wrap: wrap$3,
|
|
5391
5500
|
entriesToDisplay: entriesToDisplay$3
|
|
5392
5501
|
};
|
|
5393
|
-
var readline = require$$0$
|
|
5502
|
+
var readline = require$$0$5;
|
|
5394
5503
|
var { action } = util;
|
|
5395
5504
|
var EventEmitter = require$$2;
|
|
5396
5505
|
var { beep, cursor: cursor$9 } = src;
|
|
@@ -6594,28 +6703,28 @@ Instructions:
|
|
|
6594
6703
|
return prefix + title + color$3.gray(desc || "");
|
|
6595
6704
|
}
|
|
6596
6705
|
// shared with autocompleteMultiselect
|
|
6597
|
-
paginateOptions(
|
|
6598
|
-
if (
|
|
6706
|
+
paginateOptions(options2) {
|
|
6707
|
+
if (options2.length === 0) {
|
|
6599
6708
|
return color$3.red("No matches for this query.");
|
|
6600
6709
|
}
|
|
6601
|
-
let { startIndex, endIndex } = entriesToDisplay$1(this.cursor,
|
|
6710
|
+
let { startIndex, endIndex } = entriesToDisplay$1(this.cursor, options2.length, this.optionsPerPage);
|
|
6602
6711
|
let prefix, styledOptions = [];
|
|
6603
6712
|
for (let i = startIndex; i < endIndex; i++) {
|
|
6604
6713
|
if (i === startIndex && startIndex > 0) {
|
|
6605
6714
|
prefix = figures$2.arrowUp;
|
|
6606
|
-
} else if (i === endIndex - 1 && endIndex <
|
|
6715
|
+
} else if (i === endIndex - 1 && endIndex < options2.length) {
|
|
6607
6716
|
prefix = figures$2.arrowDown;
|
|
6608
6717
|
} else {
|
|
6609
6718
|
prefix = " ";
|
|
6610
6719
|
}
|
|
6611
|
-
styledOptions.push(this.renderOption(this.cursor,
|
|
6720
|
+
styledOptions.push(this.renderOption(this.cursor, options2[i], i, prefix));
|
|
6612
6721
|
}
|
|
6613
6722
|
return "\n" + styledOptions.join("\n");
|
|
6614
6723
|
}
|
|
6615
6724
|
// shared with autocomleteMultiselect
|
|
6616
|
-
renderOptions(
|
|
6725
|
+
renderOptions(options2) {
|
|
6617
6726
|
if (!this.done) {
|
|
6618
|
-
return this.paginateOptions(
|
|
6727
|
+
return this.paginateOptions(options2);
|
|
6619
6728
|
}
|
|
6620
6729
|
return "";
|
|
6621
6730
|
}
|
|
@@ -7242,7 +7351,152 @@ function override(answers) {
|
|
|
7242
7351
|
var lib$1 = Object.assign(prompt, { prompt, prompts: prompts$2, inject, override });
|
|
7243
7352
|
var prompts = lib$1;
|
|
7244
7353
|
var prompts$1 = /* @__PURE__ */ getDefaultExportFromCjs(prompts);
|
|
7245
|
-
var
|
|
7354
|
+
var cjs = {};
|
|
7355
|
+
var posix$1 = {};
|
|
7356
|
+
Object.defineProperty(posix$1, "__esModule", { value: true });
|
|
7357
|
+
posix$1.sync = posix$1.isexe = void 0;
|
|
7358
|
+
var fs_1$1 = require$$0;
|
|
7359
|
+
var promises_1$1 = require$$1$1;
|
|
7360
|
+
var isexe$2 = async (path2, options2 = {}) => {
|
|
7361
|
+
const { ignoreErrors = false } = options2;
|
|
7362
|
+
try {
|
|
7363
|
+
return checkStat$1(await (0, promises_1$1.stat)(path2), options2);
|
|
7364
|
+
} catch (e) {
|
|
7365
|
+
const er = e;
|
|
7366
|
+
if (ignoreErrors || er.code === "EACCES")
|
|
7367
|
+
return false;
|
|
7368
|
+
throw er;
|
|
7369
|
+
}
|
|
7370
|
+
};
|
|
7371
|
+
posix$1.isexe = isexe$2;
|
|
7372
|
+
var sync$1 = (path2, options2 = {}) => {
|
|
7373
|
+
const { ignoreErrors = false } = options2;
|
|
7374
|
+
try {
|
|
7375
|
+
return checkStat$1((0, fs_1$1.statSync)(path2), options2);
|
|
7376
|
+
} catch (e) {
|
|
7377
|
+
const er = e;
|
|
7378
|
+
if (ignoreErrors || er.code === "EACCES")
|
|
7379
|
+
return false;
|
|
7380
|
+
throw er;
|
|
7381
|
+
}
|
|
7382
|
+
};
|
|
7383
|
+
posix$1.sync = sync$1;
|
|
7384
|
+
var checkStat$1 = (stat, options2) => stat.isFile() && checkMode(stat, options2);
|
|
7385
|
+
var checkMode = (stat, options2) => {
|
|
7386
|
+
const myUid = options2.uid ?? process.getuid?.();
|
|
7387
|
+
const myGroups = options2.groups ?? process.getgroups?.() ?? [];
|
|
7388
|
+
const myGid = options2.gid ?? process.getgid?.() ?? myGroups[0];
|
|
7389
|
+
if (myUid === void 0 || myGid === void 0) {
|
|
7390
|
+
throw new Error("cannot get uid or gid");
|
|
7391
|
+
}
|
|
7392
|
+
const groups = /* @__PURE__ */ new Set([myGid, ...myGroups]);
|
|
7393
|
+
const mod = stat.mode;
|
|
7394
|
+
const uid = stat.uid;
|
|
7395
|
+
const gid = stat.gid;
|
|
7396
|
+
const u = parseInt("100", 8);
|
|
7397
|
+
const g = parseInt("010", 8);
|
|
7398
|
+
const o = parseInt("001", 8);
|
|
7399
|
+
const ug = u | g;
|
|
7400
|
+
return !!(mod & o || mod & g && groups.has(gid) || mod & u && uid === myUid || mod & ug && myUid === 0);
|
|
7401
|
+
};
|
|
7402
|
+
var win32 = {};
|
|
7403
|
+
Object.defineProperty(win32, "__esModule", { value: true });
|
|
7404
|
+
win32.sync = win32.isexe = void 0;
|
|
7405
|
+
var fs_1 = require$$0;
|
|
7406
|
+
var promises_1 = require$$1$1;
|
|
7407
|
+
var isexe$1 = async (path2, options2 = {}) => {
|
|
7408
|
+
const { ignoreErrors = false } = options2;
|
|
7409
|
+
try {
|
|
7410
|
+
return checkStat(await (0, promises_1.stat)(path2), path2, options2);
|
|
7411
|
+
} catch (e) {
|
|
7412
|
+
const er = e;
|
|
7413
|
+
if (ignoreErrors || er.code === "EACCES")
|
|
7414
|
+
return false;
|
|
7415
|
+
throw er;
|
|
7416
|
+
}
|
|
7417
|
+
};
|
|
7418
|
+
win32.isexe = isexe$1;
|
|
7419
|
+
var sync = (path2, options2 = {}) => {
|
|
7420
|
+
const { ignoreErrors = false } = options2;
|
|
7421
|
+
try {
|
|
7422
|
+
return checkStat((0, fs_1.statSync)(path2), path2, options2);
|
|
7423
|
+
} catch (e) {
|
|
7424
|
+
const er = e;
|
|
7425
|
+
if (ignoreErrors || er.code === "EACCES")
|
|
7426
|
+
return false;
|
|
7427
|
+
throw er;
|
|
7428
|
+
}
|
|
7429
|
+
};
|
|
7430
|
+
win32.sync = sync;
|
|
7431
|
+
var checkPathExt = (path2, options2) => {
|
|
7432
|
+
const { pathExt = process.env.PATHEXT || "" } = options2;
|
|
7433
|
+
const peSplit = pathExt.split(";");
|
|
7434
|
+
if (peSplit.indexOf("") !== -1) {
|
|
7435
|
+
return true;
|
|
7436
|
+
}
|
|
7437
|
+
for (let i = 0; i < peSplit.length; i++) {
|
|
7438
|
+
const p = peSplit[i].toLowerCase();
|
|
7439
|
+
const ext = path2.substring(path2.length - p.length).toLowerCase();
|
|
7440
|
+
if (p && ext === p) {
|
|
7441
|
+
return true;
|
|
7442
|
+
}
|
|
7443
|
+
}
|
|
7444
|
+
return false;
|
|
7445
|
+
};
|
|
7446
|
+
var checkStat = (stat, path2, options2) => stat.isFile() && checkPathExt(path2, options2);
|
|
7447
|
+
var options = {};
|
|
7448
|
+
Object.defineProperty(options, "__esModule", { value: true });
|
|
7449
|
+
(function(exports) {
|
|
7450
|
+
var __createBinding = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
7451
|
+
if (k2 === void 0)
|
|
7452
|
+
k2 = k;
|
|
7453
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7454
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7455
|
+
desc = { enumerable: true, get: function() {
|
|
7456
|
+
return m[k];
|
|
7457
|
+
} };
|
|
7458
|
+
}
|
|
7459
|
+
Object.defineProperty(o, k2, desc);
|
|
7460
|
+
} : function(o, m, k, k2) {
|
|
7461
|
+
if (k2 === void 0)
|
|
7462
|
+
k2 = k;
|
|
7463
|
+
o[k2] = m[k];
|
|
7464
|
+
});
|
|
7465
|
+
var __setModuleDefault = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function(o, v) {
|
|
7466
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
7467
|
+
} : function(o, v) {
|
|
7468
|
+
o["default"] = v;
|
|
7469
|
+
});
|
|
7470
|
+
var __importStar = commonjsGlobal && commonjsGlobal.__importStar || function(mod) {
|
|
7471
|
+
if (mod && mod.__esModule)
|
|
7472
|
+
return mod;
|
|
7473
|
+
var result = {};
|
|
7474
|
+
if (mod != null) {
|
|
7475
|
+
for (var k in mod)
|
|
7476
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
7477
|
+
__createBinding(result, mod, k);
|
|
7478
|
+
}
|
|
7479
|
+
__setModuleDefault(result, mod);
|
|
7480
|
+
return result;
|
|
7481
|
+
};
|
|
7482
|
+
var __exportStar = commonjsGlobal && commonjsGlobal.__exportStar || function(m, exports2) {
|
|
7483
|
+
for (var p in m)
|
|
7484
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
|
7485
|
+
__createBinding(exports2, m, p);
|
|
7486
|
+
};
|
|
7487
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7488
|
+
exports.sync = exports.isexe = exports.posix = exports.win32 = void 0;
|
|
7489
|
+
const posix2 = __importStar(posix$1);
|
|
7490
|
+
exports.posix = posix2;
|
|
7491
|
+
const win32$1 = __importStar(win32);
|
|
7492
|
+
exports.win32 = win32$1;
|
|
7493
|
+
__exportStar(options, exports);
|
|
7494
|
+
const platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform;
|
|
7495
|
+
const impl = platform === "win32" ? win32$1 : posix2;
|
|
7496
|
+
exports.isexe = impl.isexe;
|
|
7497
|
+
exports.sync = impl.sync;
|
|
7498
|
+
})(cjs);
|
|
7499
|
+
var { isexe, sync: isexeSync } = cjs;
|
|
7246
7500
|
var { join: join2, delimiter, sep, posix } = require$$0$1;
|
|
7247
7501
|
var isWindows = process.platform === "win32";
|
|
7248
7502
|
var rSlash = new RegExp(`[${posix.sep}${sep === posix.sep ? "" : sep}]`.replace(/(\\)/g, "\\$1"));
|
|
@@ -7261,11 +7515,7 @@ var getPathInfo = (cmd, {
|
|
|
7261
7515
|
];
|
|
7262
7516
|
if (isWindows) {
|
|
7263
7517
|
const pathExtExe = optPathExt || [".EXE", ".CMD", ".BAT", ".COM"].join(optDelimiter);
|
|
7264
|
-
const pathExt = pathExtExe.split(optDelimiter).
|
|
7265
|
-
acc.push(item2);
|
|
7266
|
-
acc.push(item2.toLowerCase());
|
|
7267
|
-
return acc;
|
|
7268
|
-
}, []);
|
|
7518
|
+
const pathExt = pathExtExe.split(optDelimiter).flatMap((item2) => [item2, item2.toLowerCase()]);
|
|
7269
7519
|
if (cmd.includes(".") && pathExt[0] !== "") {
|
|
7270
7520
|
pathExt.unshift("");
|
|
7271
7521
|
}
|
|
@@ -7309,7 +7559,7 @@ var whichSync = (cmd, opt = {}) => {
|
|
|
7309
7559
|
const p = getPathPart(pathEnvPart, cmd);
|
|
7310
7560
|
for (const ext of pathExt) {
|
|
7311
7561
|
const withExt = p + ext;
|
|
7312
|
-
const is =
|
|
7562
|
+
const is = isexeSync(withExt, { pathExt: pathExtExe, ignoreErrors: true });
|
|
7313
7563
|
if (is) {
|
|
7314
7564
|
if (!opt.all) {
|
|
7315
7565
|
return withExt;
|
|
@@ -7360,16 +7610,18 @@ async function detect({ autoInstall, programmatic, cwd } = {}) {
|
|
|
7360
7610
|
try {
|
|
7361
7611
|
const pkg = JSON.parse(fs$1.readFileSync(packageJsonPath, "utf8"));
|
|
7362
7612
|
if (typeof pkg.packageManager === "string") {
|
|
7363
|
-
const [name, ver] = pkg.packageManager.split("@");
|
|
7613
|
+
const [name, ver] = pkg.packageManager.replace(/^\^/, "").split("@");
|
|
7364
7614
|
version3 = ver;
|
|
7365
|
-
if (name === "yarn" && Number.parseInt(ver) > 1)
|
|
7615
|
+
if (name === "yarn" && Number.parseInt(ver) > 1) {
|
|
7366
7616
|
agent = "yarn@berry";
|
|
7367
|
-
|
|
7617
|
+
version3 = "berry";
|
|
7618
|
+
} else if (name === "pnpm" && Number.parseInt(ver) < 7) {
|
|
7368
7619
|
agent = "pnpm@6";
|
|
7369
|
-
else if (name in AGENTS)
|
|
7620
|
+
} else if (name in AGENTS) {
|
|
7370
7621
|
agent = name;
|
|
7371
|
-
else if (!programmatic)
|
|
7622
|
+
} else if (!programmatic) {
|
|
7372
7623
|
console.warn("[ni] Unknown packageManager:", pkg.packageManager);
|
|
7624
|
+
}
|
|
7373
7625
|
}
|
|
7374
7626
|
} catch {
|
|
7375
7627
|
}
|
|
@@ -7391,10 +7643,42 @@ async function detect({ autoInstall, programmatic, cwd } = {}) {
|
|
|
7391
7643
|
if (!tryInstall)
|
|
7392
7644
|
process$2.exit(1);
|
|
7393
7645
|
}
|
|
7394
|
-
await execaCommand(`npm i -g ${agent}${version3 ? `@${version3}` : ""}`, { stdio: "inherit", cwd });
|
|
7646
|
+
await execaCommand(`npm i -g ${agent.split("@")[0]}${version3 ? `@${version3}` : ""}`, { stdio: "inherit", cwd });
|
|
7395
7647
|
}
|
|
7396
7648
|
return agent;
|
|
7397
7649
|
}
|
|
7650
|
+
var customRcPath = process$2.env.NI_CONFIG_FILE;
|
|
7651
|
+
var home = process$2.platform === "win32" ? process$2.env.USERPROFILE : process$2.env.HOME;
|
|
7652
|
+
var defaultRcPath = path$3.join(home || "~/", ".nirc");
|
|
7653
|
+
var rcPath = customRcPath || defaultRcPath;
|
|
7654
|
+
var defaultConfig = {
|
|
7655
|
+
defaultAgent: "prompt",
|
|
7656
|
+
globalAgent: "npm"
|
|
7657
|
+
};
|
|
7658
|
+
var config;
|
|
7659
|
+
async function getConfig() {
|
|
7660
|
+
if (!config) {
|
|
7661
|
+
config = Object.assign(
|
|
7662
|
+
{},
|
|
7663
|
+
defaultConfig,
|
|
7664
|
+
fs$1.existsSync(rcPath) ? ini$1.parse(fs$1.readFileSync(rcPath, "utf-8")) : null
|
|
7665
|
+
);
|
|
7666
|
+
const agent = await detect({ programmatic: true });
|
|
7667
|
+
if (agent)
|
|
7668
|
+
config.defaultAgent = agent;
|
|
7669
|
+
}
|
|
7670
|
+
return config;
|
|
7671
|
+
}
|
|
7672
|
+
async function getDefaultAgent(programmatic) {
|
|
7673
|
+
const { defaultAgent } = await getConfig();
|
|
7674
|
+
if (defaultAgent === "prompt" && (programmatic || process$2.env.CI))
|
|
7675
|
+
return "npm";
|
|
7676
|
+
return defaultAgent;
|
|
7677
|
+
}
|
|
7678
|
+
async function getGlobalAgent() {
|
|
7679
|
+
const { globalAgent } = await getConfig();
|
|
7680
|
+
return globalAgent;
|
|
7681
|
+
}
|
|
7398
7682
|
var UnsupportedCommand = class extends Error {
|
|
7399
7683
|
constructor({ agent, command }) {
|
|
7400
7684
|
super(`Command "${command}" is not support by agent "${agent}"`);
|
|
@@ -7523,13 +7807,13 @@ function init(open, close) {
|
|
|
7523
7807
|
return txt === void 0 ? chain([open], [blk]) : $.enabled ? run$1([blk], txt + "") : txt + "";
|
|
7524
7808
|
};
|
|
7525
7809
|
}
|
|
7526
|
-
var version2 = "0.21.
|
|
7810
|
+
var version2 = "0.21.12";
|
|
7527
7811
|
var DEBUG_SIGN = "?";
|
|
7528
|
-
async function getCliCommand(fn, args,
|
|
7812
|
+
async function getCliCommand(fn, args, options2 = {}, cwd = options2.cwd ?? process$2.cwd()) {
|
|
7529
7813
|
const isGlobal = args.includes("-g");
|
|
7530
7814
|
if (isGlobal)
|
|
7531
7815
|
return await fn(await getGlobalAgent(), args);
|
|
7532
|
-
let agent = await detect({ ...
|
|
7816
|
+
let agent = await detect({ ...options2, cwd }) || await getDefaultAgent(options2.programmatic);
|
|
7533
7817
|
if (agent === "prompt") {
|
|
7534
7818
|
agent = (await prompts$1({
|
|
7535
7819
|
name: "agent",
|
|
@@ -7541,25 +7825,26 @@ async function getCliCommand(fn, args, options = {}, cwd = options.cwd ?? proces
|
|
|
7541
7825
|
return;
|
|
7542
7826
|
}
|
|
7543
7827
|
return await fn(agent, args, {
|
|
7544
|
-
programmatic:
|
|
7828
|
+
programmatic: options2.programmatic,
|
|
7545
7829
|
hasLock: Boolean(agent),
|
|
7546
7830
|
cwd
|
|
7547
7831
|
});
|
|
7548
7832
|
}
|
|
7549
|
-
async function run(fn, args,
|
|
7833
|
+
async function run(fn, args, options2 = {}) {
|
|
7550
7834
|
const debug2 = args.includes(DEBUG_SIGN);
|
|
7551
7835
|
if (debug2)
|
|
7552
7836
|
remove(args, DEBUG_SIGN);
|
|
7553
|
-
let cwd =
|
|
7837
|
+
let cwd = options2.cwd ?? process$2.cwd();
|
|
7554
7838
|
if (args[0] === "-C") {
|
|
7555
7839
|
cwd = resolve(cwd, args[1]);
|
|
7556
7840
|
args.splice(0, 2);
|
|
7557
7841
|
}
|
|
7558
|
-
if (args.length === 1 && args[0]?.toLowerCase() === "-v") {
|
|
7559
|
-
const
|
|
7842
|
+
if (args.length === 1 && (args[0]?.toLowerCase() === "-v" || args[0] === "--version")) {
|
|
7843
|
+
const getCmd = (a) => agents.includes(a) ? getCommand(a, "agent", ["-v"]) : `${a} -v`;
|
|
7844
|
+
const getV = (a, o) => execaCommand(getCmd(a), o).then((e) => e.stdout).then((e) => e.startsWith("v") ? e : `v${e}`);
|
|
7560
7845
|
const globalAgentPromise = getGlobalAgent();
|
|
7561
7846
|
const globalAgentVersionPromise = globalAgentPromise.then(getV);
|
|
7562
|
-
const agentPromise = detect({ ...
|
|
7847
|
+
const agentPromise = detect({ ...options2, cwd }).then((a) => a || "");
|
|
7563
7848
|
const agentVersionPromise = agentPromise.then((a) => a && getV(a, { cwd }));
|
|
7564
7849
|
const nodeVersionPromise = getV("node", { cwd });
|
|
7565
7850
|
console.log(`@antfu/ni ${$.cyan(`v${version2}`)}`);
|
|
@@ -7581,17 +7866,18 @@ async function run(fn, args, options = {}) {
|
|
|
7581
7866
|
const dash = $.dim("-");
|
|
7582
7867
|
console.log($.green($.bold("@antfu/ni")) + $.dim(` use the right package manager v${version2}
|
|
7583
7868
|
`));
|
|
7584
|
-
console.log(`ni
|
|
7585
|
-
console.log(`nr
|
|
7586
|
-
console.log(`nlx
|
|
7587
|
-
console.log(`nu
|
|
7588
|
-
console.log(`nun
|
|
7589
|
-
console.log(`nci
|
|
7590
|
-
console.log(`na
|
|
7869
|
+
console.log(`ni ${dash} install`);
|
|
7870
|
+
console.log(`nr ${dash} run`);
|
|
7871
|
+
console.log(`nlx ${dash} execute`);
|
|
7872
|
+
console.log(`nu ${dash} upgrade`);
|
|
7873
|
+
console.log(`nun ${dash} uninstall`);
|
|
7874
|
+
console.log(`nci ${dash} clean install`);
|
|
7875
|
+
console.log(`na ${dash} agent alias`);
|
|
7876
|
+
console.log(`ni -v ${dash} show used agent`);
|
|
7591
7877
|
console.log($.yellow("\ncheck https://github.com/antfu/ni for more documentation."));
|
|
7592
7878
|
return;
|
|
7593
7879
|
}
|
|
7594
|
-
let command = await getCliCommand(fn, args,
|
|
7880
|
+
let command = await getCliCommand(fn, args, options2, cwd);
|
|
7595
7881
|
if (!command)
|
|
7596
7882
|
return;
|
|
7597
7883
|
const voltaPrefix = getVoltaPrefix();
|
|
@@ -7601,7 +7887,7 @@ async function run(fn, args, options = {}) {
|
|
|
7601
7887
|
console.log(command);
|
|
7602
7888
|
return;
|
|
7603
7889
|
}
|
|
7604
|
-
await execaCommand(command, { stdio: "inherit",
|
|
7890
|
+
await execaCommand(command, { stdio: "inherit", cwd });
|
|
7605
7891
|
}
|
|
7606
7892
|
|
|
7607
7893
|
// node/themes.ts
|
|
@@ -7689,19 +7975,19 @@ function getRoot(name, entry) {
|
|
|
7689
7975
|
return resolve2(dirname2(entry), name);
|
|
7690
7976
|
return dirname2(resolveImportPath(`${name}/package.json`, true));
|
|
7691
7977
|
}
|
|
7692
|
-
function getUserRoot(
|
|
7693
|
-
const { entry: rawEntry = "slides.md", userRoot = process3.cwd() } =
|
|
7978
|
+
function getUserRoot(options2) {
|
|
7979
|
+
const { entry: rawEntry = "slides.md", userRoot = process3.cwd() } = options2;
|
|
7694
7980
|
const fullEntry = resolve2(userRoot, rawEntry);
|
|
7695
7981
|
return { entry: fullEntry, userRoot: dirname2(fullEntry) };
|
|
7696
7982
|
}
|
|
7697
|
-
async function resolveOptions(
|
|
7698
|
-
const { remote, inspect } =
|
|
7983
|
+
async function resolveOptions(options2, mode2, promptForInstallation = true) {
|
|
7984
|
+
const { remote, inspect } = options2;
|
|
7699
7985
|
const {
|
|
7700
7986
|
entry,
|
|
7701
7987
|
userRoot
|
|
7702
|
-
} = getUserRoot(
|
|
7988
|
+
} = getUserRoot(options2);
|
|
7703
7989
|
const data = await parser.load(entry);
|
|
7704
|
-
const theme = resolveThemeName(
|
|
7990
|
+
const theme = resolveThemeName(options2.theme || data.config.theme);
|
|
7705
7991
|
if (promptForInstallation) {
|
|
7706
7992
|
if (await promptForThemeInstallation(theme) === false)
|
|
7707
7993
|
process3.exit(1);
|
|
@@ -7721,7 +8007,7 @@ async function resolveOptions(options, mode2, promptForInstallation = true) {
|
|
|
7721
8007
|
const themeMeta = await getThemeMeta(theme, join3(themeRoots[0], "package.json"));
|
|
7722
8008
|
data.themeMeta = themeMeta;
|
|
7723
8009
|
if (themeMeta)
|
|
7724
|
-
data.config = parser.resolveConfig(data.headmatter, themeMeta,
|
|
8010
|
+
data.config = parser.resolveConfig(data.headmatter, themeMeta, options2.entry);
|
|
7725
8011
|
}
|
|
7726
8012
|
debug({
|
|
7727
8013
|
config: data.config,
|