@socketsecurity/lib 5.7.0 → 5.8.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 +48 -2
- package/README.md +190 -18
- package/dist/archives.d.ts +58 -0
- package/dist/archives.js +313 -0
- package/dist/arrays.js +2 -3
- package/dist/bin.js +100 -23
- package/dist/cache-with-ttl.js +21 -6
- package/dist/constants/agents.d.ts +0 -1
- package/dist/constants/agents.js +8 -8
- package/dist/constants/node.js +2 -1
- package/dist/cover/formatters.js +5 -3
- package/dist/dlx/detect.js +39 -13
- package/dist/dlx/package.js +10 -1
- package/dist/external/@npmcli/package-json.js +352 -824
- package/dist/external/adm-zip.js +2695 -0
- package/dist/external/debug.js +183 -7
- package/dist/external/external-pack.js +19 -1409
- package/dist/external/libnpmexec.js +2 -2
- package/dist/external/npm-pack.js +18777 -19997
- package/dist/external/pico-pack.js +29 -5
- package/dist/external/spdx-pack.js +41 -263
- package/dist/external/tar-fs.js +3053 -0
- package/dist/git.js +63 -23
- package/dist/github.js +7 -8
- package/dist/globs.js +20 -1
- package/dist/http-request.js +1 -1
- package/dist/memoization.js +22 -13
- package/dist/package-extensions.js +4 -2
- package/dist/packages/normalize.js +3 -0
- package/dist/process-lock.js +7 -5
- package/dist/releases/github.d.ts +40 -0
- package/dist/releases/github.js +122 -22
- package/dist/spawn.js +31 -6
- package/dist/spinner.js +1 -1
- package/dist/stdio/progress.js +2 -2
- package/package.json +38 -15
package/dist/spawn.js
CHANGED
|
@@ -53,9 +53,18 @@ function getPath() {
|
|
|
53
53
|
}
|
|
54
54
|
return _path;
|
|
55
55
|
}
|
|
56
|
+
let _fs;
|
|
57
|
+
// @__NO_SIDE_EFFECTS__
|
|
58
|
+
function getFs() {
|
|
59
|
+
if (_fs === void 0) {
|
|
60
|
+
_fs = require("fs");
|
|
61
|
+
}
|
|
62
|
+
return _fs;
|
|
63
|
+
}
|
|
56
64
|
const abortSignal = (0, import_process.getAbortSignal)();
|
|
57
65
|
const spinner = (0, import_spinner.getDefaultSpinner)();
|
|
58
66
|
const stackCache = /* @__PURE__ */ new WeakMap();
|
|
67
|
+
const spawnBinPathCache = /* @__PURE__ */ new Map();
|
|
59
68
|
const windowsScriptExtRegExp = /\.(?:cmd|bat|ps1)$/i;
|
|
60
69
|
let _child_process;
|
|
61
70
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -92,7 +101,7 @@ function enhanceSpawnError(error) {
|
|
|
92
101
|
}
|
|
93
102
|
const trimmedStderr = stderrText.trim();
|
|
94
103
|
if (trimmedStderr) {
|
|
95
|
-
const firstLine = trimmedStderr.split("\n")[0];
|
|
104
|
+
const firstLine = trimmedStderr.split("\n")[0] ?? "";
|
|
96
105
|
if (firstLine.length < 200) {
|
|
97
106
|
enhancedMessage += `
|
|
98
107
|
${firstLine}`;
|
|
@@ -178,14 +187,28 @@ function spawn(cmd, args, options, extra) {
|
|
|
178
187
|
const cwd = spawnOptions.cwd ? String(spawnOptions.cwd) : void 0;
|
|
179
188
|
let actualCmd = cmd;
|
|
180
189
|
if (!(0, import_normalize.isPath)(cmd)) {
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
190
|
+
const fs = /* @__PURE__ */ getFs();
|
|
191
|
+
const cached = spawnBinPathCache.get(cmd);
|
|
192
|
+
if (cached) {
|
|
193
|
+
if (fs.existsSync(cached)) {
|
|
194
|
+
actualCmd = cached;
|
|
195
|
+
} else {
|
|
196
|
+
spawnBinPathCache.delete(cmd);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (actualCmd === cmd) {
|
|
200
|
+
const resolved = (0, import_bin.whichSync)(cmd, { cwd, nothrow: true });
|
|
201
|
+
if (resolved && typeof resolved === "string") {
|
|
202
|
+
actualCmd = resolved;
|
|
203
|
+
spawnBinPathCache.set(cmd, resolved);
|
|
204
|
+
}
|
|
184
205
|
}
|
|
185
206
|
}
|
|
186
207
|
const WIN32 = process.platform === "win32";
|
|
187
208
|
if (WIN32 && shell && windowsScriptExtRegExp.test(actualCmd)) {
|
|
188
|
-
|
|
209
|
+
if (!(0, import_normalize.isPath)(actualCmd)) {
|
|
210
|
+
actualCmd = (/* @__PURE__ */ getPath()).basename(actualCmd, (/* @__PURE__ */ getPath()).extname(actualCmd));
|
|
211
|
+
}
|
|
189
212
|
}
|
|
190
213
|
const wasSpinning = !!spinnerInstance?.isSpinning;
|
|
191
214
|
const shouldStopSpinner = wasSpinning && !/* @__PURE__ */ isStdioType(stdio, "ignore") && !/* @__PURE__ */ isStdioType(stdio, "pipe");
|
|
@@ -269,7 +292,9 @@ function spawnSync(cmd, args, options) {
|
|
|
269
292
|
const shell = (0, import_objects.getOwn)(options, "shell");
|
|
270
293
|
const WIN32 = process.platform === "win32";
|
|
271
294
|
if (WIN32 && shell && windowsScriptExtRegExp.test(actualCmd)) {
|
|
272
|
-
|
|
295
|
+
if (!(0, import_normalize.isPath)(actualCmd)) {
|
|
296
|
+
actualCmd = (/* @__PURE__ */ getPath()).basename(actualCmd, (/* @__PURE__ */ getPath()).extname(actualCmd));
|
|
297
|
+
}
|
|
273
298
|
}
|
|
274
299
|
const { stripAnsi: shouldStripAnsi = true, ...rawSpawnOptions } = {
|
|
275
300
|
__proto__: null,
|
package/dist/spinner.js
CHANGED
|
@@ -66,7 +66,7 @@ function desc(value) {
|
|
|
66
66
|
}
|
|
67
67
|
function formatProgress(progress) {
|
|
68
68
|
const { current, total, unit } = progress;
|
|
69
|
-
const percentage = Math.round(current / total * 100);
|
|
69
|
+
const percentage = total === 0 ? 0 : Math.round(current / total * 100);
|
|
70
70
|
const bar = renderProgressBar(percentage);
|
|
71
71
|
const count = unit ? `${current}/${total} ${unit}` : `${current}/${total}`;
|
|
72
72
|
return `${bar} ${percentage}% (${count})`;
|
package/dist/stdio/progress.js
CHANGED
|
@@ -128,11 +128,11 @@ class ProgressBar {
|
|
|
128
128
|
*/
|
|
129
129
|
render(tokens) {
|
|
130
130
|
const colorFn = import_yoctocolors_cjs.default[this.options.color] || ((s) => s);
|
|
131
|
-
const percent = Math.floor(this.current / this.total * 100);
|
|
131
|
+
const percent = this.total === 0 ? 0 : Math.floor(this.current / this.total * 100);
|
|
132
132
|
const elapsed = Date.now() - this.startTime;
|
|
133
133
|
const eta = this.current === 0 ? 0 : elapsed / this.current * (this.total - this.current);
|
|
134
134
|
const availableWidth = this.options.width;
|
|
135
|
-
const filledWidth = Math.floor(this.current / this.total * availableWidth);
|
|
135
|
+
const filledWidth = this.total === 0 ? 0 : Math.floor(this.current / this.total * availableWidth);
|
|
136
136
|
const emptyWidth = availableWidth - filledWidth;
|
|
137
137
|
const filled = (0, import_strings.repeatString)(this.options.complete, filledWidth);
|
|
138
138
|
const empty = (0, import_strings.repeatString)(this.options.incomplete, emptyWidth);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@socketsecurity/lib",
|
|
3
|
-
"version": "5.
|
|
4
|
-
"packageManager": "pnpm@10.
|
|
3
|
+
"version": "5.8.1",
|
|
4
|
+
"packageManager": "pnpm@10.32.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Core utilities and infrastructure for Socket.dev security tools",
|
|
7
7
|
"keywords": [
|
|
@@ -103,6 +103,10 @@
|
|
|
103
103
|
"types": "./dist/ansi.d.ts",
|
|
104
104
|
"default": "./dist/ansi.js"
|
|
105
105
|
},
|
|
106
|
+
"./archives": {
|
|
107
|
+
"types": "./dist/archives.d.ts",
|
|
108
|
+
"default": "./dist/archives.js"
|
|
109
|
+
},
|
|
106
110
|
"./argv/flags": {
|
|
107
111
|
"types": "./dist/argv/flags.d.ts",
|
|
108
112
|
"default": "./dist/argv/flags.js"
|
|
@@ -679,7 +683,6 @@
|
|
|
679
683
|
"types": "./dist/zod.d.ts",
|
|
680
684
|
"default": "./dist/zod.js"
|
|
681
685
|
},
|
|
682
|
-
"./biome.json": "./biome.json",
|
|
683
686
|
"./data/extensions.json": "./data/extensions.json",
|
|
684
687
|
"./package.json": "./package.json",
|
|
685
688
|
"./tsconfig.dts.json": "./tsconfig.dts.json",
|
|
@@ -703,7 +706,11 @@
|
|
|
703
706
|
"cover": "node scripts/test/cover.mjs",
|
|
704
707
|
"dev": "node scripts/build/main.mjs --watch",
|
|
705
708
|
"fix": "node scripts/lint.mjs --fix",
|
|
709
|
+
"format": "oxfmt",
|
|
710
|
+
"format:check": "oxfmt --check",
|
|
706
711
|
"lint": "node scripts/lint.mjs",
|
|
712
|
+
"lint:oxlint": "oxlint .",
|
|
713
|
+
"lint:oxfmt": "oxfmt --check .",
|
|
707
714
|
"prepare": "husky",
|
|
708
715
|
"prepublishOnly": "pnpm run build",
|
|
709
716
|
"test": "node scripts/test/main.mjs",
|
|
@@ -714,10 +721,7 @@
|
|
|
714
721
|
"@babel/parser": "7.28.4",
|
|
715
722
|
"@babel/traverse": "7.28.4",
|
|
716
723
|
"@babel/types": "7.28.4",
|
|
717
|
-
"@biomejs/biome": "2.2.4",
|
|
718
724
|
"@dotenvx/dotenvx": "1.49.0",
|
|
719
|
-
"@eslint/compat": "1.4.0",
|
|
720
|
-
"@eslint/js": "9.38.0",
|
|
721
725
|
"@inquirer/checkbox": "4.3.1",
|
|
722
726
|
"@inquirer/confirm": "5.1.16",
|
|
723
727
|
"@inquirer/input": "4.2.2",
|
|
@@ -730,31 +734,27 @@
|
|
|
730
734
|
"@socketregistry/is-unicode-supported": "1.0.5",
|
|
731
735
|
"@socketregistry/packageurl-js": "1.3.5",
|
|
732
736
|
"@socketregistry/yocto-spinner": "1.0.25",
|
|
733
|
-
"@socketsecurity/lib-stable": "npm:@socketsecurity/lib@5.
|
|
737
|
+
"@socketsecurity/lib-stable": "npm:@socketsecurity/lib@5.8.0",
|
|
734
738
|
"@types/node": "24.9.2",
|
|
735
739
|
"@typescript/native-preview": "7.0.0-dev.20250920.1",
|
|
736
740
|
"@vitest/coverage-v8": "4.0.3",
|
|
737
741
|
"@vitest/ui": "4.0.3",
|
|
738
742
|
"@yarnpkg/core": "4.5.0",
|
|
739
743
|
"@yarnpkg/extensions": "2.0.6",
|
|
744
|
+
"adm-zip": "0.5.16",
|
|
740
745
|
"cacache": "20.0.1",
|
|
741
746
|
"debug": "4.4.3",
|
|
742
747
|
"del": "8.0.1",
|
|
743
748
|
"del-cli": "6.0.0",
|
|
744
749
|
"esbuild": "0.25.11",
|
|
745
|
-
"eslint": "9.35.0",
|
|
746
|
-
"eslint-import-resolver-typescript": "4.4.4",
|
|
747
|
-
"eslint-plugin-import-x": "4.16.1",
|
|
748
|
-
"eslint-plugin-n": "17.23.1",
|
|
749
750
|
"eslint-plugin-sort-destructure-keys": "2.0.0",
|
|
750
|
-
"eslint-plugin-unicorn": "61.0.2",
|
|
751
751
|
"fast-glob": "3.3.3",
|
|
752
752
|
"fast-sort": "3.4.1",
|
|
753
753
|
"get-east-asian-width": "1.3.0",
|
|
754
754
|
"globals": "16.4.0",
|
|
755
755
|
"has-flag": "5.0.1",
|
|
756
756
|
"husky": "9.1.7",
|
|
757
|
-
"libnpmexec": "
|
|
757
|
+
"libnpmexec": "10.2.3",
|
|
758
758
|
"libnpmpack": "9.0.9",
|
|
759
759
|
"lint-staged": "15.2.11",
|
|
760
760
|
"magic-string": "0.30.17",
|
|
@@ -762,6 +762,8 @@
|
|
|
762
762
|
"nock": "14.0.10",
|
|
763
763
|
"normalize-package-data": "8.0.0",
|
|
764
764
|
"npm-package-arg": "13.0.0",
|
|
765
|
+
"oxfmt": "^0.37.0",
|
|
766
|
+
"oxlint": "1.53.0",
|
|
765
767
|
"pacote": "21.0.1",
|
|
766
768
|
"picomatch": "2.3.1",
|
|
767
769
|
"pony-cause": "2.1.11",
|
|
@@ -771,11 +773,12 @@
|
|
|
771
773
|
"spdx-expression-parse": "4.0.0",
|
|
772
774
|
"streaming-iterables": "8.0.1",
|
|
773
775
|
"supports-color": "10.0.0",
|
|
776
|
+
"tar-fs": "3.1.2",
|
|
777
|
+
"tar-stream": "3.1.8",
|
|
774
778
|
"taze": "19.9.2",
|
|
775
779
|
"trash": "10.0.0",
|
|
776
780
|
"type-coverage": "2.29.7",
|
|
777
781
|
"typescript": "5.9.2",
|
|
778
|
-
"typescript-eslint": "8.44.1",
|
|
779
782
|
"validate-npm-package-name": "6.0.2",
|
|
780
783
|
"vite-tsconfig-paths": "5.1.4",
|
|
781
784
|
"vitest": "4.0.3",
|
|
@@ -794,23 +797,40 @@
|
|
|
794
797
|
},
|
|
795
798
|
"pnpm": {
|
|
796
799
|
"overrides": {
|
|
800
|
+
"@inquirer/ansi": "1.0.2",
|
|
801
|
+
"@inquirer/core": "10.3.1",
|
|
802
|
+
"@inquirer/figures": "1.0.15",
|
|
797
803
|
"@npmcli/arborist": "9.1.6",
|
|
804
|
+
"@npmcli/git": "6.0.3",
|
|
798
805
|
"@npmcli/run-script": "10.0.0",
|
|
799
806
|
"@sigstore/core": "3.1.0",
|
|
800
807
|
"@sigstore/sign": "4.1.0",
|
|
801
808
|
"ansi-regex": "6.2.2",
|
|
809
|
+
"chownr": "3.0.0",
|
|
802
810
|
"debug": "4.4.3",
|
|
803
811
|
"execa": "5.1.1",
|
|
804
812
|
"has-flag": "5.0.1",
|
|
813
|
+
"hosted-git-info": "8.1.0",
|
|
805
814
|
"isexe": "3.1.1",
|
|
806
815
|
"lru-cache": "11.2.2",
|
|
816
|
+
"minimatch": "9.0.5",
|
|
817
|
+
"minipass": "7.1.3",
|
|
818
|
+
"minipass-fetch": "4.0.1",
|
|
819
|
+
"minipass-sized": "1.0.3",
|
|
820
|
+
"minipass@7": "7.1.3",
|
|
821
|
+
"minizlib": "3.1.0",
|
|
822
|
+
"npm-package-arg": "12.0.2",
|
|
823
|
+
"npm-pick-manifest": "10.0.0",
|
|
807
824
|
"picomatch": "4.0.3",
|
|
808
825
|
"proc-log": "6.1.0",
|
|
809
826
|
"semver": "7.7.2",
|
|
810
827
|
"signal-exit": "4.1.0",
|
|
828
|
+
"spdx-expression-parse": "4.0.0",
|
|
829
|
+
"ssri": "12.0.0",
|
|
811
830
|
"string-width": "8.1.0",
|
|
812
831
|
"strip-ansi": "7.1.2",
|
|
813
832
|
"supports-color": "10.0.0",
|
|
833
|
+
"tar": "7.5.11",
|
|
814
834
|
"which": "5.0.0",
|
|
815
835
|
"wrap-ansi": "9.0.2",
|
|
816
836
|
"yoctocolors-cjs": "2.1.3"
|
|
@@ -819,7 +839,10 @@
|
|
|
819
839
|
"@npmcli/run-script@10.0.0": "patches/@npmcli__run-script@10.0.0.patch",
|
|
820
840
|
"@sigstore/sign@4.1.0": "patches/@sigstore__sign@4.1.0.patch",
|
|
821
841
|
"execa@5.1.1": "patches/execa@5.1.1.patch",
|
|
822
|
-
"
|
|
842
|
+
"minipass-flush@1.0.5": "patches/minipass-flush@1.0.5.patch",
|
|
843
|
+
"minipass-pipeline@1.2.4": "patches/minipass-pipeline@1.2.4.patch",
|
|
844
|
+
"node-gyp@11.5.0": "patches/node-gyp@11.5.0.patch",
|
|
845
|
+
"minipass-sized@1.0.3": "patches/minipass-sized@1.0.3.patch"
|
|
823
846
|
}
|
|
824
847
|
}
|
|
825
848
|
}
|