@socketsecurity/lib 5.25.1 → 5.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +344 -1184
- package/README.md +1 -1
- package/dist/abort.js +7 -6
- package/dist/agent.js +16 -15
- package/dist/ansi.js +3 -2
- package/dist/archives.js +18 -17
- package/dist/argv/flags.js +29 -28
- package/dist/argv/parse.js +4 -3
- package/dist/arrays.js +3 -2
- package/dist/bin.js +12 -11
- package/dist/cacache.js +16 -11
- package/dist/cache-with-ttl.js +26 -21
- package/dist/colors.js +2 -1
- package/dist/constants/licenses.js +2 -1
- package/dist/constants/lifecycle-script-names.js +2 -1
- package/dist/constants/maintained-node-versions.js +2 -1
- package/dist/constants/node.js +4 -3
- package/dist/constants/package-default-socket-categories.js +2 -1
- package/dist/constants/packages.js +4 -3
- package/dist/constants/socket.js +1 -1
- package/dist/cover/code.js +9 -8
- package/dist/cover/formatters.js +12 -11
- package/dist/cover/type.js +5 -4
- package/dist/crypto.d.ts +36 -0
- package/dist/{effects/ultra.js → crypto.js} +33 -37
- package/dist/debug.js +12 -15
- package/dist/dlx/arborist.js +10 -9
- package/dist/dlx/binary.js +27 -24
- package/dist/dlx/cache.js +2 -10
- package/dist/dlx/detect.js +6 -5
- package/dist/dlx/integrity.js +13 -11
- package/dist/dlx/lockfile.js +7 -6
- package/dist/dlx/manifest.js +6 -5
- package/dist/dlx/package.js +17 -16
- package/dist/dlx/packages.js +6 -5
- package/dist/dlx/paths.d.ts +1 -1
- package/dist/dlx/paths.js +2 -1
- package/dist/effects/pulse-frames.js +4 -3
- package/dist/effects/shimmer-keyframes.d.ts +62 -0
- package/dist/effects/shimmer-keyframes.js +55 -0
- package/dist/effects/shimmer-terminal.d.ts +66 -0
- package/dist/effects/shimmer-terminal.js +57 -0
- package/dist/effects/shimmer.d.ts +293 -0
- package/dist/effects/shimmer.js +180 -0
- package/dist/env/rewire.js +4 -3
- package/dist/env.js +5 -4
- package/dist/errors.js +1 -1
- package/dist/external/@npmcli/package-json/lib/read-package.js +10 -10
- package/dist/external/@npmcli/package-json.js +372 -372
- package/dist/external/@npmcli/promise-spawn.js +24 -24
- package/dist/external/@socketregistry/packageurl-js.js +19 -18
- package/dist/external/@socketregistry/yocto-spinner.js +4 -3
- package/dist/external/@yarnpkg/extensions.js +2 -1
- package/dist/external/adm-zip.js +70 -70
- package/dist/external/debug.js +22 -22
- package/dist/external/external-pack.js +45 -45
- package/dist/external/fast-sort.js +5 -5
- package/dist/external/libnpmexec.js +4 -3
- package/dist/external/npm-pack.js +369 -369
- package/dist/external/p-map.js +9 -9
- package/dist/external/pico-pack.js +190 -190
- package/dist/external/pony-cause.js +2 -1
- package/dist/external/spdx-pack.js +11 -10
- package/dist/external/tar-fs.js +58 -58
- package/dist/external/which.js +13 -13
- package/dist/external/yargs-parser.js +71 -71
- package/dist/fs.js +19 -23
- package/dist/git.js +14 -13
- package/dist/github.d.ts +34 -0
- package/dist/github.js +248 -23
- package/dist/globs.d.ts +20 -0
- package/dist/globs.js +134 -25
- package/dist/http-request.d.ts +4 -3
- package/dist/http-request.js +39 -32
- package/dist/ipc-cli.js +2 -1
- package/dist/ipc.js +5 -4
- package/dist/json/edit.js +4 -3
- package/dist/json/format.js +3 -2
- package/dist/json/parse.js +7 -6
- package/dist/links.js +2 -1
- package/dist/logger.js +21 -14
- package/dist/memoization.js +16 -15
- package/dist/objects.js +2 -2
- package/dist/packages/edit.js +8 -7
- package/dist/packages/exports.js +17 -16
- package/dist/packages/isolation.js +20 -13
- package/dist/packages/licenses.js +6 -3
- package/dist/packages/manifest.js +2 -1
- package/dist/packages/normalize.js +8 -4
- package/dist/packages/operations.js +5 -4
- package/dist/packages/provenance.js +7 -6
- package/dist/packages/specs.js +2 -1
- package/dist/packages/validation.js +2 -1
- package/dist/paths/normalize.js +32 -40
- package/dist/paths/packages.js +2 -1
- package/dist/paths/rewire.js +3 -2
- package/dist/performance.js +19 -18
- package/dist/primordials.d.ts +9 -0
- package/dist/primordials.js +17 -0
- package/dist/process-lock.js +14 -13
- package/dist/promise-queue.js +17 -9
- package/dist/promises.d.ts +29 -6
- package/dist/promises.js +19 -15
- package/dist/regexps.js +9 -8
- package/dist/releases/github-api.d.ts +56 -0
- package/dist/releases/github-api.js +275 -0
- package/dist/releases/github-archives.d.ts +60 -0
- package/dist/releases/github-archives.js +136 -0
- package/dist/releases/github-assets.d.ts +21 -0
- package/dist/releases/github-assets.js +52 -0
- package/dist/releases/github-auth.d.ts +16 -0
- package/dist/releases/github-auth.js +51 -0
- package/dist/releases/github-downloads.d.ts +42 -0
- package/dist/releases/github-downloads.js +155 -0
- package/dist/releases/github-types.d.ts +66 -0
- package/dist/{effects/types.js → releases/github-types.js} +2 -2
- package/dist/releases/socket-btm.d.ts +1 -1
- package/dist/releases/socket-btm.js +17 -17
- package/dist/schema/parse.js +2 -1
- package/dist/schema/validate.js +6 -5
- package/dist/shadow.js +2 -1
- package/dist/signal-exit.js +2 -2
- package/dist/spawn.js +45 -35
- package/dist/spinner.d.ts +13 -6
- package/dist/spinner.js +75 -57
- package/dist/ssri.js +8 -7
- package/dist/stdio/footer.js +13 -12
- package/dist/stdio/header.js +5 -4
- package/dist/stdio/progress.js +13 -12
- package/dist/strings.js +19 -18
- package/dist/suppress-warnings.js +2 -2
- package/dist/tables.js +16 -13
- package/dist/temporary-executor.js +2 -1
- package/dist/themes/context.js +2 -1
- package/dist/themes/types.d.ts +1 -1
- package/dist/themes/utils.d.ts +8 -3
- package/dist/themes/utils.js +29 -5
- package/dist/url.js +4 -3
- package/package.json +44 -20
- package/dist/effects/text-shimmer.d.ts +0 -58
- package/dist/effects/text-shimmer.js +0 -192
- package/dist/effects/types.d.ts +0 -47
- package/dist/effects/ultra.d.ts +0 -22
- package/dist/releases/github.d.ts +0 -234
- package/dist/releases/github.js +0 -417
- package/dist/themes/index.d.ts +0 -49
- package/dist/themes/index.js +0 -60
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { ObjectDefineProperty: _p_ObjectDefineProperty, StringPrototypeStartsWith: _p_StringPrototypeStartsWith } = require('../primordials.js')
|
|
1
|
+
const { ArrayFrom: _p_ArrayFrom, ArrayIsArray: _p_ArrayIsArray, ArrayPrototypeFindLastIndex: _p_ArrayPrototypeFindLastIndex, ErrorCtor: _p_ErrorCtor, MathFloor: _p_MathFloor, MathMax: _p_MathMax, MathMin: _p_MathMin, MathRandom: _p_MathRandom, NumberIsNaN: _p_NumberIsNaN, NumberParseFloat: _p_NumberParseFloat, NumberParseInt: _p_NumberParseInt, ObjectAssign: _p_ObjectAssign, ObjectDefineProperty: _p_ObjectDefineProperty, ObjectEntries: _p_ObjectEntries, ObjectGetPrototypeOf: _p_ObjectGetPrototypeOf, ObjectIs: _p_ObjectIs, ObjectKeys: _p_ObjectKeys, PromiseCtor: _p_PromiseCtor, RegExpCtor: _p_RegExpCtor, SetCtor: _p_SetCtor, StringPrototypeCodePointAt: _p_StringPrototypeCodePointAt, StringPrototypeRepeat: _p_StringPrototypeRepeat, StringPrototypeReplaceAll: _p_StringPrototypeReplaceAll, StringPrototypeStartsWith: _p_StringPrototypeStartsWith } = require('../primordials.js')
|
|
2
2
|
"use strict";
|
|
3
3
|
/**
|
|
4
4
|
* Bundled from external-pack
|
|
@@ -44,7 +44,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
44
44
|
var require_signals = __commonJS({
|
|
45
45
|
"node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/cjs/signals.js"(exports2) {
|
|
46
46
|
"use strict";
|
|
47
|
-
|
|
47
|
+
_p_ObjectDefineProperty(exports2, "__esModule", { value: true });
|
|
48
48
|
exports2.signals = void 0;
|
|
49
49
|
exports2.signals = [];
|
|
50
50
|
exports2.signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
@@ -79,7 +79,7 @@ var require_cjs = __commonJS({
|
|
|
79
79
|
_p_ObjectDefineProperty(exports2, "__esModule", { value: true });
|
|
80
80
|
exports2.unload = exports2.load = exports2.onExit = exports2.signals = void 0;
|
|
81
81
|
var signals_js_1 = require_signals();
|
|
82
|
-
|
|
82
|
+
_p_ObjectDefineProperty(exports2, "signals", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
83
83
|
return signals_js_1.signals;
|
|
84
84
|
}, "get") });
|
|
85
85
|
var processOk2 = /* @__PURE__ */ __name((process7) => !!process7 && typeof process7 === "object" && typeof process7.removeListener === "function" && typeof process7.emit === "function" && typeof process7.reallyExit === "function" && typeof process7.listeners === "function" && typeof process7.kill === "function" && typeof process7.pid === "number" && typeof process7.on === "function", "processOk");
|
|
@@ -99,7 +99,7 @@ var require_cjs = __commonJS({
|
|
|
99
99
|
exit: []
|
|
100
100
|
};
|
|
101
101
|
count = 0;
|
|
102
|
-
id =
|
|
102
|
+
id = _p_MathRandom();
|
|
103
103
|
constructor() {
|
|
104
104
|
if (global2[kExitEmitter2]) {
|
|
105
105
|
return global2[kExitEmitter2];
|
|
@@ -257,7 +257,7 @@ var require_cjs = __commonJS({
|
|
|
257
257
|
signals_js_1.signals.forEach((sig) => {
|
|
258
258
|
const listener = this.#sigListeners[sig];
|
|
259
259
|
if (!listener) {
|
|
260
|
-
throw new
|
|
260
|
+
throw new _p_ErrorCtor("Listener not defined for signal: " + sig);
|
|
261
261
|
}
|
|
262
262
|
try {
|
|
263
263
|
this.#process.removeListener(sig, listener);
|
|
@@ -343,7 +343,7 @@ function envForceColor() {
|
|
|
343
343
|
if (env.FORCE_COLOR.length === 0) {
|
|
344
344
|
return 1;
|
|
345
345
|
}
|
|
346
|
-
const level =
|
|
346
|
+
const level = _p_MathMin(_p_NumberParseInt(env.FORCE_COLOR, 10), 3);
|
|
347
347
|
if (![0, 1, 2, 3].includes(level)) {
|
|
348
348
|
return;
|
|
349
349
|
}
|
|
@@ -419,7 +419,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
419
419
|
return 3;
|
|
420
420
|
}
|
|
421
421
|
if ("TERM_PROGRAM" in env) {
|
|
422
|
-
const version =
|
|
422
|
+
const version = _p_NumberParseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
423
423
|
switch (env.TERM_PROGRAM) {
|
|
424
424
|
case "iTerm.app": {
|
|
425
425
|
return version >= 3 ? 3 : 2;
|
|
@@ -788,7 +788,7 @@ var init_use_state = __esm({
|
|
|
788
788
|
function useEffect(cb, depArray) {
|
|
789
789
|
withPointer((pointer) => {
|
|
790
790
|
const oldDeps = pointer.get();
|
|
791
|
-
const hasChanged = !
|
|
791
|
+
const hasChanged = !_p_ArrayIsArray(oldDeps) || depArray.some((dep, i) => !_p_ObjectIs(dep, oldDeps[i]));
|
|
792
792
|
if (hasChanged) {
|
|
793
793
|
effectScheduler.queue(cb);
|
|
794
794
|
}
|
|
@@ -1097,7 +1097,7 @@ var init_dist = __esm({
|
|
|
1097
1097
|
shouldUseMain = isUnicodeSupported();
|
|
1098
1098
|
figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
1099
1099
|
dist_default = figures;
|
|
1100
|
-
replacements =
|
|
1100
|
+
replacements = _p_ObjectEntries(specialMainSymbols);
|
|
1101
1101
|
}
|
|
1102
1102
|
});
|
|
1103
1103
|
|
|
@@ -1134,15 +1134,15 @@ function isPlainObject(value) {
|
|
|
1134
1134
|
if (typeof value !== "object" || value === null)
|
|
1135
1135
|
return false;
|
|
1136
1136
|
let proto = value;
|
|
1137
|
-
while (
|
|
1138
|
-
proto =
|
|
1137
|
+
while (_p_ObjectGetPrototypeOf(proto) !== null) {
|
|
1138
|
+
proto = _p_ObjectGetPrototypeOf(proto);
|
|
1139
1139
|
}
|
|
1140
|
-
return
|
|
1140
|
+
return _p_ObjectGetPrototypeOf(value) === proto;
|
|
1141
1141
|
}
|
|
1142
1142
|
function deepMerge(...objects) {
|
|
1143
1143
|
const output = {};
|
|
1144
1144
|
for (const obj of objects) {
|
|
1145
|
-
for (const [key, value] of
|
|
1145
|
+
for (const [key, value] of _p_ObjectEntries(obj)) {
|
|
1146
1146
|
const prevValue = output[key];
|
|
1147
1147
|
output[key] = isPlainObject(prevValue) && isPlainObject(value) ? deepMerge(prevValue, value) : value;
|
|
1148
1148
|
}
|
|
@@ -1275,7 +1275,7 @@ var require_cli_width = __commonJS({
|
|
|
1275
1275
|
if (!options) {
|
|
1276
1276
|
return defaultOpts;
|
|
1277
1277
|
}
|
|
1278
|
-
|
|
1278
|
+
_p_ObjectKeys(defaultOpts).forEach(function(key) {
|
|
1279
1279
|
if (!options[key]) {
|
|
1280
1280
|
options[key] = defaultOpts[key];
|
|
1281
1281
|
}
|
|
@@ -1339,9 +1339,9 @@ var init_dist2 = __esm({
|
|
|
1339
1339
|
CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
1340
1340
|
CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
|
|
1341
1341
|
TAB_RE = /\t{1,1000}/y;
|
|
1342
|
-
EMOJI_RE = new
|
|
1342
|
+
EMOJI_RE = new _p_RegExpCtor("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
|
|
1343
1343
|
LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
1344
|
-
MODIFIER_RE = new
|
|
1344
|
+
MODIFIER_RE = new _p_RegExpCtor("\\p{M}+", "gu");
|
|
1345
1345
|
NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
|
|
1346
1346
|
getStringTruncatedWidth = /* @__PURE__ */ __name((input2, truncationOptions = {}, widthOptions = {}) => {
|
|
1347
1347
|
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
@@ -1368,7 +1368,7 @@ var init_dist2 = __esm({
|
|
|
1368
1368
|
let lengthExtra = 0;
|
|
1369
1369
|
let truncationEnabled = false;
|
|
1370
1370
|
let truncationIndex = length;
|
|
1371
|
-
let truncationLimit =
|
|
1371
|
+
let truncationLimit = _p_MathMax(0, LIMIT - ELLIPSIS_WIDTH);
|
|
1372
1372
|
let unmatchedStart = 0;
|
|
1373
1373
|
let unmatchedEnd = 0;
|
|
1374
1374
|
let width = 0;
|
|
@@ -1377,8 +1377,8 @@ var init_dist2 = __esm({
|
|
|
1377
1377
|
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
1378
1378
|
const unmatched = input2.slice(unmatchedStart, unmatchedEnd) || input2.slice(indexPrev, index);
|
|
1379
1379
|
lengthExtra = 0;
|
|
1380
|
-
for (const char of unmatched
|
|
1381
|
-
const codePoint = char
|
|
1380
|
+
for (const char of _p_StringPrototypeReplaceAll(unmatched, MODIFIER_RE, "")) {
|
|
1381
|
+
const codePoint = _p_StringPrototypeCodePointAt(char, 0) || 0;
|
|
1382
1382
|
if (isFullWidth(codePoint)) {
|
|
1383
1383
|
widthExtra = FULL_WIDTH_WIDTH;
|
|
1384
1384
|
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
@@ -1387,7 +1387,7 @@ var init_dist2 = __esm({
|
|
|
1387
1387
|
widthExtra = REGULAR_WIDTH;
|
|
1388
1388
|
}
|
|
1389
1389
|
if (width + widthExtra > truncationLimit) {
|
|
1390
|
-
truncationIndex =
|
|
1390
|
+
truncationIndex = _p_MathMin(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
1391
1391
|
}
|
|
1392
1392
|
if (width + widthExtra > LIMIT) {
|
|
1393
1393
|
truncationEnabled = true;
|
|
@@ -1408,7 +1408,7 @@ var init_dist2 = __esm({
|
|
|
1408
1408
|
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input2.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
1409
1409
|
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
1410
1410
|
if (width + widthExtra > truncationLimit) {
|
|
1411
|
-
truncationIndex =
|
|
1411
|
+
truncationIndex = _p_MathMin(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
1412
1412
|
}
|
|
1413
1413
|
if (width + widthExtra > LIMIT) {
|
|
1414
1414
|
truncationEnabled = true;
|
|
@@ -1467,7 +1467,7 @@ var init_main = __esm({
|
|
|
1467
1467
|
ANSI_OSC = "]";
|
|
1468
1468
|
ANSI_SGR_TERMINATOR = "m";
|
|
1469
1469
|
ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
1470
|
-
GROUP_REGEX = new
|
|
1470
|
+
GROUP_REGEX = new _p_RegExpCtor(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
1471
1471
|
getClosingCode = /* @__PURE__ */ __name((openingCode) => {
|
|
1472
1472
|
if (openingCode >= 30 && openingCode <= 37)
|
|
1473
1473
|
return 39;
|
|
@@ -1589,8 +1589,8 @@ var init_main = __esm({
|
|
|
1589
1589
|
const wordLength = dist_default3(word);
|
|
1590
1590
|
if (options.hard && wordLength > columns) {
|
|
1591
1591
|
const remainingColumns = columns - rowLength;
|
|
1592
|
-
const breaksStartingThisLine = 1 +
|
|
1593
|
-
const breaksStartingNextLine =
|
|
1592
|
+
const breaksStartingThisLine = 1 + _p_MathFloor((wordLength - remainingColumns - 1) / columns);
|
|
1593
|
+
const breaksStartingNextLine = _p_MathFloor((wordLength - 1) / columns);
|
|
1594
1594
|
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
1595
1595
|
rows.push("");
|
|
1596
1596
|
}
|
|
@@ -1636,7 +1636,7 @@ var init_main = __esm({
|
|
|
1636
1636
|
const groupsResult = GROUP_REGEX.exec(preString);
|
|
1637
1637
|
const groups = groupsResult?.groups;
|
|
1638
1638
|
if (groups?.code !== void 0) {
|
|
1639
|
-
const code =
|
|
1639
|
+
const code = _p_NumberParseFloat(groups.code);
|
|
1640
1640
|
escapeCode = code === END_CODE ? void 0 : code;
|
|
1641
1641
|
} else if (groups?.uri !== void 0) {
|
|
1642
1642
|
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
@@ -1691,7 +1691,7 @@ function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
|
|
1691
1691
|
lastActive: void 0
|
|
1692
1692
|
});
|
|
1693
1693
|
const { lastPointer, lastActive } = state.current;
|
|
1694
|
-
const middle =
|
|
1694
|
+
const middle = _p_MathFloor(pageSize / 2);
|
|
1695
1695
|
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
1696
1696
|
const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
|
|
1697
1697
|
let pointer = defaultPointerPosition;
|
|
@@ -1704,7 +1704,7 @@ function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
|
|
1704
1704
|
lastActive < active && // Check user didn't move up across page boundary.
|
|
1705
1705
|
active - lastActive < pageSize
|
|
1706
1706
|
) {
|
|
1707
|
-
pointer =
|
|
1707
|
+
pointer = _p_MathMin(
|
|
1708
1708
|
// Furthest allowed position for the pointer is the middle of the list
|
|
1709
1709
|
middle,
|
|
1710
1710
|
Math.abs(active - lastActive) === 1 ? Math.min(
|
|
@@ -1726,7 +1726,7 @@ function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
|
|
1726
1726
|
pageSize - spaceUnderActive
|
|
1727
1727
|
) : (
|
|
1728
1728
|
// Otherwise, progressively move the pointer to the middle of the list.
|
|
1729
|
-
|
|
1729
|
+
_p_MathMin(defaultPointerPosition, middle)
|
|
1730
1730
|
);
|
|
1731
1731
|
}
|
|
1732
1732
|
}
|
|
@@ -1747,9 +1747,9 @@ function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
|
|
1747
1747
|
const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });
|
|
1748
1748
|
const activeItem = renderItemAtIndex(active).slice(0, pageSize);
|
|
1749
1749
|
const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
|
|
1750
|
-
const pageBuffer =
|
|
1750
|
+
const pageBuffer = _p_ArrayFrom({ length: pageSize });
|
|
1751
1751
|
pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
|
|
1752
|
-
const itemVisited = /* @__PURE__ */ new
|
|
1752
|
+
const itemVisited = /* @__PURE__ */ new _p_SetCtor([active]);
|
|
1753
1753
|
let bufferPointer = activeItemPosition + activeItem.length;
|
|
1754
1754
|
let itemPointer = bound(active + 1);
|
|
1755
1755
|
while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
|
|
@@ -1764,7 +1764,7 @@ function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
|
|
1764
1764
|
itemPointer = bound(active - 1);
|
|
1765
1765
|
while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
|
|
1766
1766
|
const lines = renderItemAtIndex(itemPointer);
|
|
1767
|
-
const linesToAdd = lines.slice(
|
|
1767
|
+
const linesToAdd = lines.slice(_p_MathMax(0, lines.length - bufferPointer - 1));
|
|
1768
1768
|
pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
|
|
1769
1769
|
itemVisited.add(itemPointer);
|
|
1770
1770
|
bufferPointer -= linesToAdd.length;
|
|
@@ -1957,7 +1957,7 @@ var init_mjs = __esm({
|
|
|
1957
1957
|
exit: []
|
|
1958
1958
|
};
|
|
1959
1959
|
count = 0;
|
|
1960
|
-
id =
|
|
1960
|
+
id = _p_MathRandom();
|
|
1961
1961
|
constructor() {
|
|
1962
1962
|
if (global[kExitEmitter]) {
|
|
1963
1963
|
return global[kExitEmitter];
|
|
@@ -2115,7 +2115,7 @@ var init_mjs = __esm({
|
|
|
2115
2115
|
signals.forEach((sig) => {
|
|
2116
2116
|
const listener = this.#sigListeners[sig];
|
|
2117
2117
|
if (!listener) {
|
|
2118
|
-
throw new
|
|
2118
|
+
throw new _p_ErrorCtor("Listener not defined for signal: " + sig);
|
|
2119
2119
|
}
|
|
2120
2120
|
try {
|
|
2121
2121
|
this.#process.removeListener(sig, listener);
|
|
@@ -2197,7 +2197,7 @@ var init_dist4 = __esm({
|
|
|
2197
2197
|
cursorUp = /* @__PURE__ */ __name((rows = 1) => rows > 0 ? `${ESC2}${rows}A` : "", "cursorUp");
|
|
2198
2198
|
cursorDown = /* @__PURE__ */ __name((rows = 1) => rows > 0 ? `${ESC2}${rows}B` : "", "cursorDown");
|
|
2199
2199
|
cursorTo = /* @__PURE__ */ __name((x, y) => {
|
|
2200
|
-
if (typeof y === "number" && !
|
|
2200
|
+
if (typeof y === "number" && !_p_NumberIsNaN(y)) {
|
|
2201
2201
|
return `${ESC2}${y + 1};${x + 1}H`;
|
|
2202
2202
|
}
|
|
2203
2203
|
return `${ESC2}${x + 1}G`;
|
|
@@ -2250,7 +2250,7 @@ var init_screen_manager = __esm({
|
|
|
2250
2250
|
content += "\n";
|
|
2251
2251
|
}
|
|
2252
2252
|
let output = content + (bottomContent ? "\n" + bottomContent : "");
|
|
2253
|
-
const promptLineUpDiff =
|
|
2253
|
+
const promptLineUpDiff = _p_MathFloor(rawPromptLine.length / width) - this.cursorPos.rows;
|
|
2254
2254
|
const bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0);
|
|
2255
2255
|
if (bottomContentHeight > 0)
|
|
2256
2256
|
output += cursorUp(bottomContentHeight);
|
|
@@ -2291,7 +2291,7 @@ var init_promise_polyfill = __esm({
|
|
|
2291
2291
|
static withResolver() {
|
|
2292
2292
|
let resolve;
|
|
2293
2293
|
let reject;
|
|
2294
|
-
const promise = new
|
|
2294
|
+
const promise = new _p_PromiseCtor((res, rej) => {
|
|
2295
2295
|
resolve = res;
|
|
2296
2296
|
reject = rej;
|
|
2297
2297
|
});
|
|
@@ -2311,7 +2311,7 @@ function getCallSites() {
|
|
|
2311
2311
|
result = callSitesWithoutCurrent;
|
|
2312
2312
|
return callSitesWithoutCurrent;
|
|
2313
2313
|
};
|
|
2314
|
-
new
|
|
2314
|
+
new _p_ErrorCtor().stack;
|
|
2315
2315
|
} catch {
|
|
2316
2316
|
return result;
|
|
2317
2317
|
}
|
|
@@ -2322,7 +2322,7 @@ function createPrompt(view) {
|
|
|
2322
2322
|
const callSites = getCallSites();
|
|
2323
2323
|
const prompt = /* @__PURE__ */ __name((config, context = {}) => {
|
|
2324
2324
|
const { input: input2 = process.stdin, signal } = context;
|
|
2325
|
-
const cleanups = /* @__PURE__ */ new
|
|
2325
|
+
const cleanups = /* @__PURE__ */ new _p_SetCtor();
|
|
2326
2326
|
const output = new import_mute_stream.default();
|
|
2327
2327
|
output.pipe(context.output ?? process.stdout);
|
|
2328
2328
|
output.mute();
|
|
@@ -2338,7 +2338,7 @@ function createPrompt(view) {
|
|
|
2338
2338
|
const abort = /* @__PURE__ */ __name(() => reject(new AbortPromptError({ cause: signal.reason })), "abort");
|
|
2339
2339
|
if (signal.aborted) {
|
|
2340
2340
|
abort();
|
|
2341
|
-
return
|
|
2341
|
+
return _p_ObjectAssign(promise, { cancel });
|
|
2342
2342
|
}
|
|
2343
2343
|
signal.addEventListener("abort", abort);
|
|
2344
2344
|
cleanups.add(() => signal.removeEventListener("abort", abort));
|
|
@@ -2564,7 +2564,7 @@ var init_dist6 = __esm({
|
|
|
2564
2564
|
const [items, setItems] = useState(normalizeChoices(config.choices));
|
|
2565
2565
|
const bounds = useMemo(() => {
|
|
2566
2566
|
const first = items.findIndex(isNavigable);
|
|
2567
|
-
const last = items
|
|
2567
|
+
const last = _p_ArrayPrototypeFindLastIndex(items, isNavigable);
|
|
2568
2568
|
if (first === -1) {
|
|
2569
2569
|
throw new ValidationError("[checkbox prompt] No selectable choices. All choices are disabled.");
|
|
2570
2570
|
}
|
|
@@ -2884,7 +2884,7 @@ var init_dist9 = __esm({
|
|
|
2884
2884
|
let helpTip;
|
|
2885
2885
|
if (config.mask) {
|
|
2886
2886
|
const maskChar = typeof config.mask === "string" ? config.mask : "*";
|
|
2887
|
-
formattedValue = maskChar
|
|
2887
|
+
formattedValue = _p_StringPrototypeRepeat(maskChar, value.length);
|
|
2888
2888
|
} else if (status !== "done") {
|
|
2889
2889
|
helpTip = `${theme.style.help(theme.style.maskedText)}${cursorHide}`;
|
|
2890
2890
|
}
|
|
@@ -2964,7 +2964,7 @@ var init_dist10 = __esm({
|
|
|
2964
2964
|
const prefix = usePrefix({ status, theme });
|
|
2965
2965
|
const bounds = useMemo(() => {
|
|
2966
2966
|
const first = searchResults.findIndex(isSelectable2);
|
|
2967
|
-
const last = searchResults
|
|
2967
|
+
const last = _p_ArrayPrototypeFindLastIndex(searchResults, isSelectable2);
|
|
2968
2968
|
return { first, last };
|
|
2969
2969
|
}, [searchResults]);
|
|
2970
2970
|
const [active = bounds.first, setActive] = useState();
|
|
@@ -3157,7 +3157,7 @@ var init_dist11 = __esm({
|
|
|
3157
3157
|
const items = useMemo(() => normalizeChoices3(config.choices), [config.choices]);
|
|
3158
3158
|
const bounds = useMemo(() => {
|
|
3159
3159
|
const first = items.findIndex(isNavigable2);
|
|
3160
|
-
const last = items
|
|
3160
|
+
const last = _p_ArrayPrototypeFindLastIndex(items, isNavigable2);
|
|
3161
3161
|
if (first === -1) {
|
|
3162
3162
|
throw new ValidationError("[select prompt] No selectable choices. All choices are disabled.");
|
|
3163
3163
|
}
|
|
@@ -3171,7 +3171,7 @@ var init_dist11 = __esm({
|
|
|
3171
3171
|
const [active, setActive] = useState(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);
|
|
3172
3172
|
const selectedChoice = items[active];
|
|
3173
3173
|
if (selectedChoice == null || Separator.isSeparator(selectedChoice)) {
|
|
3174
|
-
throw new
|
|
3174
|
+
throw new _p_ErrorCtor("Active index does not point to a choice");
|
|
3175
3175
|
}
|
|
3176
3176
|
const [errorMsg, setError] = useState();
|
|
3177
3177
|
useKeypress((key, rl) => {
|
|
@@ -3196,7 +3196,7 @@ var init_dist11 = __esm({
|
|
|
3196
3196
|
} while (!isNavigable2(items[next]));
|
|
3197
3197
|
setActive(next);
|
|
3198
3198
|
}
|
|
3199
|
-
} else if (isNumberKey(key) && !
|
|
3199
|
+
} else if (isNumberKey(key) && !_p_NumberIsNaN(Number(rl.line))) {
|
|
3200
3200
|
const selectedIndex = Number(rl.line) - 1;
|
|
3201
3201
|
let selectableIndex = -1;
|
|
3202
3202
|
const position = items.findIndex((item2) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { ObjectDefineProperty: _p_ObjectDefineProperty } = require('../primordials.js')
|
|
1
|
+
const { ArrayIsArray: _p_ArrayIsArray, ObjectDefineProperty: _p_ObjectDefineProperty } = require('../primordials.js')
|
|
2
2
|
"use strict";
|
|
3
3
|
/**
|
|
4
4
|
* Bundled from fast-sort
|
|
@@ -73,7 +73,7 @@ var require_sort_cjs = __commonJS({
|
|
|
73
73
|
return comparer(sortBy(a), sortBy(b), order);
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
-
if (
|
|
76
|
+
if (_p_ArrayIsArray(sortBy)) {
|
|
77
77
|
var multiPropSorter_1 = multiPropertySorterProvider(comparer);
|
|
78
78
|
return function(a, b) {
|
|
79
79
|
return multiPropSorter_1(sortBy[0], sortBy, 1, order, comparer, a, b);
|
|
@@ -85,10 +85,10 @@ var require_sort_cjs = __commonJS({
|
|
|
85
85
|
__name(getSortStrategy, "getSortStrategy");
|
|
86
86
|
var sortArray = /* @__PURE__ */ __name(function(order, ctx, sortBy, comparer) {
|
|
87
87
|
var _a;
|
|
88
|
-
if (!
|
|
88
|
+
if (!_p_ArrayIsArray(ctx)) {
|
|
89
89
|
return ctx;
|
|
90
90
|
}
|
|
91
|
-
if (
|
|
91
|
+
if (_p_ArrayIsArray(sortBy) && sortBy.length < 2) {
|
|
92
92
|
_a = sortBy, sortBy = _a[0];
|
|
93
93
|
}
|
|
94
94
|
return ctx.sort(getSortStrategy(sortBy, comparer, order));
|
|
@@ -96,7 +96,7 @@ var require_sort_cjs = __commonJS({
|
|
|
96
96
|
function createNewSortInstance2(opts) {
|
|
97
97
|
var comparer = castComparer(opts.comparer);
|
|
98
98
|
return function(arrayToSort) {
|
|
99
|
-
var ctx =
|
|
99
|
+
var ctx = _p_ArrayIsArray(arrayToSort) && !opts.inPlaceSorting ? arrayToSort.slice() : arrayToSort;
|
|
100
100
|
return {
|
|
101
101
|
asc: /* @__PURE__ */ __name(function(sortBy) {
|
|
102
102
|
return sortArray(1, ctx, sortBy, comparer);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { ErrorCtor: _p_ErrorCtor, ObjectAssign: _p_ObjectAssign, ObjectKeys: _p_ObjectKeys, ObjectValues: _p_ObjectValues, SetCtor: _p_SetCtor } = require('../primordials.js')
|
|
1
2
|
"use strict";
|
|
2
3
|
/**
|
|
3
4
|
* Bundled from libnpmexec
|
|
@@ -16,14 +17,14 @@ var require_get_bin_from_manifest = __commonJS({
|
|
|
16
17
|
"node_modules/.pnpm/libnpmexec@10.2.3_supports-color@10.2.2/node_modules/libnpmexec/lib/get-bin-from-manifest.js"(exports2, module2) {
|
|
17
18
|
var getBinFromManifest2 = /* @__PURE__ */ __name((mani) => {
|
|
18
19
|
const bin = mani.bin || {};
|
|
19
|
-
if (new
|
|
20
|
-
return
|
|
20
|
+
if (new _p_SetCtor(_p_ObjectValues(bin)).size === 1) {
|
|
21
|
+
return _p_ObjectKeys(bin)[0];
|
|
21
22
|
}
|
|
22
23
|
const name = mani.name.replace(/^@[^/]+\//, "");
|
|
23
24
|
if (bin[name]) {
|
|
24
25
|
return name;
|
|
25
26
|
}
|
|
26
|
-
throw
|
|
27
|
+
throw _p_ObjectAssign(new _p_ErrorCtor("could not determine executable to run"), {
|
|
27
28
|
pkgid: mani._id
|
|
28
29
|
});
|
|
29
30
|
}, "getBinFromManifest");
|