@socketsecurity/lib 3.3.1 → 3.3.3
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 +13 -0
- package/dist/agent.d.ts +0 -4
- package/dist/agent.js +3 -7
- package/dist/constants/packages.d.ts +7 -0
- package/dist/constants/packages.js +7 -0
- package/dist/dlx-package.js +27 -0
- package/dist/env/ci.d.ts +1 -0
- package/dist/env/ci.js +1 -0
- package/dist/env/debug.d.ts +1 -0
- package/dist/env/debug.js +1 -0
- package/dist/env/github.d.ts +8 -0
- package/dist/env/github.js +8 -0
- package/dist/env/helpers.d.ts +3 -0
- package/dist/env/helpers.js +3 -0
- package/dist/env/home.d.ts +1 -0
- package/dist/env/home.js +1 -0
- package/dist/env/locale.d.ts +3 -0
- package/dist/env/locale.js +3 -0
- package/dist/env/node-auth-token.d.ts +1 -0
- package/dist/env/node-auth-token.js +1 -0
- package/dist/env/node-env.d.ts +1 -0
- package/dist/env/node-env.js +1 -0
- package/dist/env/npm.d.ts +5 -0
- package/dist/env/npm.js +5 -0
- package/dist/env/package-manager.d.ts +3 -0
- package/dist/env/package-manager.js +5 -2
- package/dist/env/path.d.ts +1 -0
- package/dist/env/path.js +1 -0
- package/dist/env/pre-commit.d.ts +1 -0
- package/dist/env/pre-commit.js +1 -0
- package/dist/env/shell.d.ts +1 -0
- package/dist/env/shell.js +1 -0
- package/dist/env/socket-cli-shadow.d.ts +5 -0
- package/dist/env/socket-cli-shadow.js +5 -0
- package/dist/env/socket-cli.d.ts +14 -0
- package/dist/env/socket-cli.js +14 -0
- package/dist/env/socket.d.ts +15 -0
- package/dist/env/socket.js +15 -0
- package/dist/env/temp-dir.d.ts +3 -0
- package/dist/env/temp-dir.js +3 -0
- package/dist/env/term.d.ts +1 -0
- package/dist/env/term.js +1 -0
- package/dist/env/test.d.ts +3 -0
- package/dist/env/test.js +4 -1
- package/dist/env/windows.d.ts +4 -0
- package/dist/env/windows.js +4 -0
- package/dist/env/xdg.d.ts +3 -0
- package/dist/env/xdg.js +3 -0
- package/dist/external/@npmcli/arborist.js +5 -0
- package/dist/external/@yarnpkg/extensions.js +2 -2
- package/dist/external/cacache.js +4 -13036
- package/dist/external/libnpmpack.js +4 -67685
- package/dist/external/make-fetch-happen.js +4 -22639
- package/dist/external/normalize-package-data.js +4 -4478
- package/dist/external/npm-core.js +6588 -0
- package/dist/external/npm-pack.js +87518 -0
- package/dist/external/npm-package-arg.js +4 -4515
- package/dist/external/pacote.js +4 -50314
- package/dist/external/semver.js +4 -1934
- package/dist/fs.d.ts +0 -6
- package/dist/fs.js +0 -6
- package/dist/logger.d.ts +4 -0
- package/dist/logger.js +4 -1
- package/package.json +76 -74
package/dist/fs.d.ts
CHANGED
|
@@ -616,7 +616,6 @@ export declare function invalidatePathCache(): void;
|
|
|
616
616
|
* await safeDelete('./flaky-dir', { maxRetries: 5, retryDelay: 500 })
|
|
617
617
|
* ```
|
|
618
618
|
*/
|
|
619
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
620
619
|
export declare function safeDelete(filepath: PathLike | PathLike[], options?: RemoveOptions | undefined): Promise<void>;
|
|
621
620
|
/**
|
|
622
621
|
* Safely delete a file or directory synchronously with built-in protections.
|
|
@@ -642,7 +641,6 @@ export declare function safeDelete(filepath: PathLike | PathLike[], options?: Re
|
|
|
642
641
|
* safeDeleteSync('./important', { force: true })
|
|
643
642
|
* ```
|
|
644
643
|
*/
|
|
645
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
646
644
|
export declare function safeDeleteSync(filepath: PathLike | PathLike[], options?: RemoveOptions | undefined): void;
|
|
647
645
|
/**
|
|
648
646
|
* Safely create a directory asynchronously, ignoring EEXIST errors.
|
|
@@ -674,7 +672,6 @@ export declare function safeDeleteSync(filepath: PathLike | PathLike[], options?
|
|
|
674
672
|
* await safeMkdir('./single-level', { recursive: false })
|
|
675
673
|
* ```
|
|
676
674
|
*/
|
|
677
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
678
675
|
export declare function safeMkdir(path: PathLike, options?: MakeDirectoryOptions | undefined): Promise<void>;
|
|
679
676
|
/**
|
|
680
677
|
* Safely create a directory synchronously, ignoring EEXIST errors.
|
|
@@ -705,7 +702,6 @@ export declare function safeMkdir(path: PathLike, options?: MakeDirectoryOptions
|
|
|
705
702
|
* safeMkdirSync('./single-level', { recursive: false })
|
|
706
703
|
* ```
|
|
707
704
|
*/
|
|
708
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
709
705
|
export declare function safeMkdirSync(path: PathLike, options?: MakeDirectoryOptions | undefined): void;
|
|
710
706
|
/**
|
|
711
707
|
* Safely read a file asynchronously, returning undefined on error.
|
|
@@ -844,7 +840,6 @@ export declare function uniqueSync(filepath: PathLike): string;
|
|
|
844
840
|
* await writeJson('./win.json', data, { EOL: '\r\n' })
|
|
845
841
|
* ```
|
|
846
842
|
*/
|
|
847
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
848
843
|
export declare function writeJson(filepath: PathLike, jsonContent: unknown, options?: WriteJsonOptions | string): Promise<void>;
|
|
849
844
|
/**
|
|
850
845
|
* Write JSON content to a file synchronously with formatting.
|
|
@@ -870,5 +865,4 @@ export declare function writeJson(filepath: PathLike, jsonContent: unknown, opti
|
|
|
870
865
|
* writeJsonSync('./compact.json', data, { spaces: 0 })
|
|
871
866
|
* ```
|
|
872
867
|
*/
|
|
873
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
874
868
|
export declare function writeJsonSync(filepath: PathLike, jsonContent: unknown, options?: WriteJsonOptions | string | undefined): void;
|
package/dist/fs.js
CHANGED
|
@@ -442,7 +442,6 @@ function invalidatePathCache() {
|
|
|
442
442
|
_cachedAllowedDirs = void 0;
|
|
443
443
|
}
|
|
444
444
|
(0, import_rewire.registerCacheInvalidation)(invalidatePathCache);
|
|
445
|
-
// @__NO_SIDE_EFFECTS__
|
|
446
445
|
async function safeDelete(filepath, options) {
|
|
447
446
|
const { deleteAsync } = require("./external/del");
|
|
448
447
|
const opts = { __proto__: null, ...options };
|
|
@@ -474,7 +473,6 @@ async function safeDelete(filepath, options) {
|
|
|
474
473
|
onlyFiles: false
|
|
475
474
|
});
|
|
476
475
|
}
|
|
477
|
-
// @__NO_SIDE_EFFECTS__
|
|
478
476
|
function safeDeleteSync(filepath, options) {
|
|
479
477
|
const { deleteSync } = require("./external/del");
|
|
480
478
|
const opts = { __proto__: null, ...options };
|
|
@@ -506,7 +504,6 @@ function safeDeleteSync(filepath, options) {
|
|
|
506
504
|
onlyFiles: false
|
|
507
505
|
});
|
|
508
506
|
}
|
|
509
|
-
// @__NO_SIDE_EFFECTS__
|
|
510
507
|
async function safeMkdir(path, options) {
|
|
511
508
|
const fs = /* @__PURE__ */ getFs();
|
|
512
509
|
const opts = { __proto__: null, recursive: true, ...options };
|
|
@@ -518,7 +515,6 @@ async function safeMkdir(path, options) {
|
|
|
518
515
|
}
|
|
519
516
|
}
|
|
520
517
|
}
|
|
521
|
-
// @__NO_SIDE_EFFECTS__
|
|
522
518
|
function safeMkdirSync(path, options) {
|
|
523
519
|
const fs = /* @__PURE__ */ getFs();
|
|
524
520
|
const opts = { __proto__: null, recursive: true, ...options };
|
|
@@ -598,7 +594,6 @@ function uniqueSync(filepath) {
|
|
|
598
594
|
} while (fs.existsSync(uniquePath));
|
|
599
595
|
return (0, import_path.normalizePath)(uniquePath);
|
|
600
596
|
}
|
|
601
|
-
// @__NO_SIDE_EFFECTS__
|
|
602
597
|
async function writeJson(filepath, jsonContent, options) {
|
|
603
598
|
const opts = typeof options === "string" ? { encoding: options } : options;
|
|
604
599
|
const { EOL, finalEOL, replacer, spaces, ...fsOptions } = {
|
|
@@ -619,7 +614,6 @@ async function writeJson(filepath, jsonContent, options) {
|
|
|
619
614
|
__proto__: null
|
|
620
615
|
});
|
|
621
616
|
}
|
|
622
|
-
// @__NO_SIDE_EFFECTS__
|
|
623
617
|
function writeJsonSync(filepath, jsonContent, options) {
|
|
624
618
|
const opts = typeof options === "string" ? { encoding: options } : options;
|
|
625
619
|
const { EOL, finalEOL, replacer, spaces, ...fsOptions } = {
|
package/dist/logger.d.ts
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* console.log(`${LOG_SYMBOLS.warn} Warning message`)
|
|
14
14
|
* console.log(`${LOG_SYMBOLS.info} Information message`)
|
|
15
15
|
* console.log(`${LOG_SYMBOLS.step} Processing step`)
|
|
16
|
+
* console.log(`${LOG_SYMBOLS.progress} Working on task`)
|
|
16
17
|
* console.log(`${LOG_SYMBOLS.reason} Working through logic`)
|
|
17
18
|
* ```
|
|
18
19
|
*/
|
|
@@ -21,6 +22,8 @@ type LogSymbols = {
|
|
|
21
22
|
fail: string;
|
|
22
23
|
/** Blue colored information symbol (ℹ or i in ASCII) */
|
|
23
24
|
info: string;
|
|
25
|
+
/** Cyan colored progress indicator symbol (∴ or :. in ASCII) */
|
|
26
|
+
progress: string;
|
|
24
27
|
/** Dimmed yellow reasoning/working symbol (∴ or :. in ASCII) */
|
|
25
28
|
reason: string;
|
|
26
29
|
/** Cyan colored step symbol (→ or > in ASCII) */
|
|
@@ -79,6 +82,7 @@ export type { LogSymbols, LoggerMethods, Task };
|
|
|
79
82
|
*
|
|
80
83
|
* console.log(`${LOG_SYMBOLS.fail} Build failed`) // Theme error color ✖
|
|
81
84
|
* console.log(`${LOG_SYMBOLS.info} Starting process`) // Theme info color ℹ
|
|
85
|
+
* console.log(`${LOG_SYMBOLS.progress} Working on task`) // Theme step color ∴
|
|
82
86
|
* console.log(`${LOG_SYMBOLS.reason} Analyzing dependencies`) // Dimmed yellow ∴
|
|
83
87
|
* console.log(`${LOG_SYMBOLS.step} Processing files`) // Theme step color →
|
|
84
88
|
* console.log(`${LOG_SYMBOLS.success} Build completed`) // Theme success color ✔
|
package/dist/logger.js
CHANGED
|
@@ -88,6 +88,7 @@ const LOG_SYMBOLS = /* @__PURE__ */ (() => {
|
|
|
88
88
|
const stepColor = theme.colors.step;
|
|
89
89
|
target.fail = /* @__PURE__ */ applyColor(supported ? "\u2716" : "\xD7", errorColor, colors);
|
|
90
90
|
target.info = /* @__PURE__ */ applyColor(supported ? "\u2139" : "i", infoColor, colors);
|
|
91
|
+
target.progress = /* @__PURE__ */ applyColor(supported ? "\u2234" : ":.", stepColor, colors);
|
|
91
92
|
target.reason = colors.dim(
|
|
92
93
|
/* @__PURE__ */ applyColor(supported ? "\u2234" : ":.", warningColor, colors)
|
|
93
94
|
);
|
|
@@ -327,6 +328,7 @@ class Logger {
|
|
|
327
328
|
__proto__: null,
|
|
328
329
|
fail: /* @__PURE__ */ applyColor(supported ? "\u2716" : "\xD7", theme.colors.error, colors),
|
|
329
330
|
info: /* @__PURE__ */ applyColor(supported ? "\u2139" : "i", theme.colors.info, colors),
|
|
331
|
+
progress: /* @__PURE__ */ applyColor(supported ? "\u2234" : ":.", theme.colors.step, colors),
|
|
330
332
|
reason: colors.dim(
|
|
331
333
|
/* @__PURE__ */ applyColor(supported ? "\u2234" : ":.", theme.colors.warning, colors)
|
|
332
334
|
),
|
|
@@ -1060,7 +1062,8 @@ class Logger {
|
|
|
1060
1062
|
const con = this.#getConsole();
|
|
1061
1063
|
const stream = this.#getTargetStream();
|
|
1062
1064
|
const streamObj = stream === "stderr" ? con._stderr : con._stdout;
|
|
1063
|
-
|
|
1065
|
+
const symbols = this.#getSymbols();
|
|
1066
|
+
streamObj.write(`${symbols.progress} ${text}`);
|
|
1064
1067
|
this[lastWasBlankSymbol](false);
|
|
1065
1068
|
return this;
|
|
1066
1069
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@socketsecurity/lib",
|
|
3
|
-
"version": "3.3.
|
|
4
|
-
"packageManager": "pnpm@10.
|
|
3
|
+
"version": "3.3.3",
|
|
4
|
+
"packageManager": "pnpm@10.22.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Core utilities and infrastructure for Socket.dev security tools",
|
|
7
7
|
"keywords": [
|
|
@@ -20,6 +20,76 @@
|
|
|
20
20
|
"email": "eng@socket.dev",
|
|
21
21
|
"url": "https://socket.dev"
|
|
22
22
|
},
|
|
23
|
+
"browser": {
|
|
24
|
+
"_http_agent": false,
|
|
25
|
+
"_http_client": false,
|
|
26
|
+
"_http_common": false,
|
|
27
|
+
"_http_incoming": false,
|
|
28
|
+
"_http_outgoing": false,
|
|
29
|
+
"_http_server": false,
|
|
30
|
+
"_stream_duplex": false,
|
|
31
|
+
"_stream_passthrough": false,
|
|
32
|
+
"_stream_readable": false,
|
|
33
|
+
"_stream_transform": false,
|
|
34
|
+
"_stream_wrap": false,
|
|
35
|
+
"_stream_writable": false,
|
|
36
|
+
"_tls_common": false,
|
|
37
|
+
"_tls_wrap": false,
|
|
38
|
+
"assert": false,
|
|
39
|
+
"assert/strict": false,
|
|
40
|
+
"async_hooks": false,
|
|
41
|
+
"buffer": false,
|
|
42
|
+
"child_process": false,
|
|
43
|
+
"cluster": false,
|
|
44
|
+
"console": false,
|
|
45
|
+
"constants": false,
|
|
46
|
+
"crypto": false,
|
|
47
|
+
"dgram": false,
|
|
48
|
+
"diagnostics_channel": false,
|
|
49
|
+
"dns": false,
|
|
50
|
+
"dns/promises": false,
|
|
51
|
+
"domain": false,
|
|
52
|
+
"events": false,
|
|
53
|
+
"fs": false,
|
|
54
|
+
"fs/promises": false,
|
|
55
|
+
"http": false,
|
|
56
|
+
"http2": false,
|
|
57
|
+
"https": false,
|
|
58
|
+
"inspector": false,
|
|
59
|
+
"inspector/promises": false,
|
|
60
|
+
"module": false,
|
|
61
|
+
"net": false,
|
|
62
|
+
"os": false,
|
|
63
|
+
"path": false,
|
|
64
|
+
"path/posix": false,
|
|
65
|
+
"path/win32": false,
|
|
66
|
+
"perf_hooks": false,
|
|
67
|
+
"process": false,
|
|
68
|
+
"punycode": false,
|
|
69
|
+
"querystring": false,
|
|
70
|
+
"readline": false,
|
|
71
|
+
"readline/promises": false,
|
|
72
|
+
"repl": false,
|
|
73
|
+
"stream": false,
|
|
74
|
+
"stream/consumers": false,
|
|
75
|
+
"stream/promises": false,
|
|
76
|
+
"stream/web": false,
|
|
77
|
+
"string_decoder": false,
|
|
78
|
+
"sys": false,
|
|
79
|
+
"timers": false,
|
|
80
|
+
"timers/promises": false,
|
|
81
|
+
"tls": false,
|
|
82
|
+
"trace_events": false,
|
|
83
|
+
"tty": false,
|
|
84
|
+
"url": false,
|
|
85
|
+
"util": false,
|
|
86
|
+
"util/types": false,
|
|
87
|
+
"v8": false,
|
|
88
|
+
"vm": false,
|
|
89
|
+
"wasi": false,
|
|
90
|
+
"worker_threads": false,
|
|
91
|
+
"zlib": false
|
|
92
|
+
},
|
|
23
93
|
"exports": {
|
|
24
94
|
"./abort": {
|
|
25
95
|
"types": "./dist/abort.d.ts",
|
|
@@ -580,7 +650,7 @@
|
|
|
580
650
|
],
|
|
581
651
|
"engines": {
|
|
582
652
|
"node": ">=22",
|
|
583
|
-
"pnpm": ">=10.
|
|
653
|
+
"pnpm": ">=10.22.0"
|
|
584
654
|
},
|
|
585
655
|
"sideEffects": false,
|
|
586
656
|
"scripts": {
|
|
@@ -610,16 +680,18 @@
|
|
|
610
680
|
"@inquirer/password": "4.0.18",
|
|
611
681
|
"@inquirer/search": "3.1.1",
|
|
612
682
|
"@inquirer/select": "4.3.2",
|
|
683
|
+
"@npmcli/arborist": "9.1.4",
|
|
613
684
|
"@npmcli/package-json": "7.0.0",
|
|
614
685
|
"@npmcli/promise-spawn": "8.0.3",
|
|
615
686
|
"@socketregistry/is-unicode-supported": "1.0.5",
|
|
616
687
|
"@socketregistry/packageurl-js": "1.3.5",
|
|
617
688
|
"@socketregistry/yocto-spinner": "1.0.25",
|
|
618
|
-
"@socketsecurity/lib-stable": "
|
|
689
|
+
"@socketsecurity/lib-stable": "npm:@socketsecurity/lib@3.3.2",
|
|
619
690
|
"@types/node": "24.9.2",
|
|
620
691
|
"@typescript/native-preview": "7.0.0-dev.20250920.1",
|
|
621
692
|
"@vitest/coverage-v8": "4.0.3",
|
|
622
693
|
"@vitest/ui": "4.0.3",
|
|
694
|
+
"@yarnpkg/core": "4.5.0",
|
|
623
695
|
"@yarnpkg/extensions": "2.0.6",
|
|
624
696
|
"cacache": "20.0.1",
|
|
625
697
|
"debug": "4.4.3",
|
|
@@ -670,75 +742,5 @@
|
|
|
670
742
|
"typescript": {
|
|
671
743
|
"optional": true
|
|
672
744
|
}
|
|
673
|
-
},
|
|
674
|
-
"browser": {
|
|
675
|
-
"_http_agent": false,
|
|
676
|
-
"_http_client": false,
|
|
677
|
-
"_http_common": false,
|
|
678
|
-
"_http_incoming": false,
|
|
679
|
-
"_http_outgoing": false,
|
|
680
|
-
"_http_server": false,
|
|
681
|
-
"_stream_duplex": false,
|
|
682
|
-
"_stream_passthrough": false,
|
|
683
|
-
"_stream_readable": false,
|
|
684
|
-
"_stream_transform": false,
|
|
685
|
-
"_stream_wrap": false,
|
|
686
|
-
"_stream_writable": false,
|
|
687
|
-
"_tls_common": false,
|
|
688
|
-
"_tls_wrap": false,
|
|
689
|
-
"assert": false,
|
|
690
|
-
"assert/strict": false,
|
|
691
|
-
"async_hooks": false,
|
|
692
|
-
"buffer": false,
|
|
693
|
-
"child_process": false,
|
|
694
|
-
"cluster": false,
|
|
695
|
-
"console": false,
|
|
696
|
-
"constants": false,
|
|
697
|
-
"crypto": false,
|
|
698
|
-
"dgram": false,
|
|
699
|
-
"diagnostics_channel": false,
|
|
700
|
-
"dns": false,
|
|
701
|
-
"dns/promises": false,
|
|
702
|
-
"domain": false,
|
|
703
|
-
"events": false,
|
|
704
|
-
"fs": false,
|
|
705
|
-
"fs/promises": false,
|
|
706
|
-
"http": false,
|
|
707
|
-
"http2": false,
|
|
708
|
-
"https": false,
|
|
709
|
-
"inspector": false,
|
|
710
|
-
"inspector/promises": false,
|
|
711
|
-
"module": false,
|
|
712
|
-
"net": false,
|
|
713
|
-
"os": false,
|
|
714
|
-
"path": false,
|
|
715
|
-
"path/posix": false,
|
|
716
|
-
"path/win32": false,
|
|
717
|
-
"perf_hooks": false,
|
|
718
|
-
"process": false,
|
|
719
|
-
"punycode": false,
|
|
720
|
-
"querystring": false,
|
|
721
|
-
"readline": false,
|
|
722
|
-
"readline/promises": false,
|
|
723
|
-
"repl": false,
|
|
724
|
-
"stream": false,
|
|
725
|
-
"stream/consumers": false,
|
|
726
|
-
"stream/promises": false,
|
|
727
|
-
"stream/web": false,
|
|
728
|
-
"string_decoder": false,
|
|
729
|
-
"sys": false,
|
|
730
|
-
"timers": false,
|
|
731
|
-
"timers/promises": false,
|
|
732
|
-
"tls": false,
|
|
733
|
-
"trace_events": false,
|
|
734
|
-
"tty": false,
|
|
735
|
-
"url": false,
|
|
736
|
-
"util": false,
|
|
737
|
-
"util/types": false,
|
|
738
|
-
"v8": false,
|
|
739
|
-
"vm": false,
|
|
740
|
-
"wasi": false,
|
|
741
|
-
"worker_threads": false,
|
|
742
|
-
"zlib": false
|
|
743
745
|
}
|
|
744
746
|
}
|