@socketsecurity/lib 3.2.8 → 3.3.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/CHANGELOG.md +15 -0
- package/README.md +18 -240
- package/dist/agent.js +10 -10
- package/dist/bin.js +4 -4
- package/dist/colors.d.ts +37 -0
- package/dist/colors.js +58 -0
- package/dist/constants/node.js +1 -1
- package/dist/constants/packages.js +7 -7
- package/dist/constants/process.js +1 -1
- package/dist/debug.js +3 -3
- package/dist/dlx-binary.js +4 -4
- package/dist/effects/text-shimmer.js +1 -1
- package/dist/env/ci.js +2 -2
- package/dist/env/debug.js +1 -1
- package/dist/env/github.js +1 -1
- package/dist/env/home.js +1 -1
- package/dist/env/locale.js +1 -1
- package/dist/env/node-auth-token.js +1 -1
- package/dist/env/node-env.js +1 -1
- package/dist/env/npm.js +1 -1
- package/dist/env/package-manager.js +1 -1
- package/dist/env/path.js +1 -1
- package/dist/env/pre-commit.js +2 -2
- package/dist/env/rewire.d.ts +5 -5
- package/dist/env/rewire.js +22 -14
- package/dist/env/shell.js +1 -1
- package/dist/env/socket-cli-shadow.js +2 -2
- package/dist/env/socket-cli.js +2 -2
- package/dist/env/socket.js +2 -2
- package/dist/env/temp-dir.js +1 -1
- package/dist/env/term.js +1 -1
- package/dist/env/test.js +3 -3
- package/dist/env/windows.js +1 -1
- package/dist/env/xdg.js +1 -1
- package/dist/fs.js +4 -6
- package/dist/git.js +1 -1
- package/dist/github.js +2 -2
- package/dist/globs.js +3 -4
- package/dist/lifecycle-script-names.d.ts +9 -2
- package/dist/lifecycle-script-names.js +11 -4
- package/dist/logger.d.ts +106 -81
- package/dist/logger.js +234 -205
- package/dist/maintained-node-versions.d.ts +3 -2
- package/dist/maintained-node-versions.js +11 -4
- package/dist/objects.js +1 -1
- package/dist/package-default-node-range.d.ts +3 -2
- package/dist/package-default-node-range.js +12 -5
- package/dist/package-default-socket-categories.d.ts +7 -2
- package/dist/package-default-socket-categories.js +11 -4
- package/dist/package-extensions.d.ts +3 -2
- package/dist/package-extensions.js +11 -4
- package/dist/packages/exports.js +1 -1
- package/dist/packages/isolation.js +2 -2
- package/dist/packages/licenses.js +2 -2
- package/dist/packages/manifest.js +3 -3
- package/dist/packages/normalize.js +1 -1
- package/dist/packages/operations.js +5 -5
- package/dist/packages/provenance.js +1 -1
- package/dist/path.js +1 -1
- package/dist/paths.js +14 -14
- package/dist/promises.js +2 -2
- package/dist/spawn.js +1 -1
- package/dist/spinner.d.ts +29 -51
- package/dist/spinner.js +155 -149
- package/dist/stdio/prompts.js +1 -1
- package/dist/temporary-executor.js +1 -1
- package/dist/themes/types.d.ts +2 -1
- package/dist/themes/utils.d.ts +1 -1
- package/dist/utils/get-ipc.d.ts +0 -1
- package/dist/utils/get-ipc.js +4 -4
- package/dist/versions.d.ts +1 -1
- package/package.json +10 -9
|
@@ -22,7 +22,7 @@ __export(node_auth_token_exports, {
|
|
|
22
22
|
getNodeAuthToken: () => getNodeAuthToken
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(node_auth_token_exports);
|
|
25
|
-
var import_rewire = require("
|
|
25
|
+
var import_rewire = require("#env/rewire");
|
|
26
26
|
function getNodeAuthToken() {
|
|
27
27
|
return (0, import_rewire.getEnvValue)("NODE_AUTH_TOKEN");
|
|
28
28
|
}
|
package/dist/env/node-env.js
CHANGED
|
@@ -22,7 +22,7 @@ __export(node_env_exports, {
|
|
|
22
22
|
getNodeEnv: () => getNodeEnv
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(node_env_exports);
|
|
25
|
-
var import_rewire = require("
|
|
25
|
+
var import_rewire = require("#env/rewire");
|
|
26
26
|
function getNodeEnv() {
|
|
27
27
|
return (0, import_rewire.getEnvValue)("NODE_ENV");
|
|
28
28
|
}
|
package/dist/env/npm.js
CHANGED
|
@@ -26,7 +26,7 @@ __export(npm_exports, {
|
|
|
26
26
|
getNpmToken: () => getNpmToken
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(npm_exports);
|
|
29
|
-
var import_rewire = require("
|
|
29
|
+
var import_rewire = require("#env/rewire");
|
|
30
30
|
function getNpmConfigRegistry() {
|
|
31
31
|
return (0, import_rewire.getEnvValue)("npm_config_registry");
|
|
32
32
|
}
|
|
@@ -24,7 +24,7 @@ __export(package_manager_exports, {
|
|
|
24
24
|
getPackageManagerUserAgent: () => getPackageManagerUserAgent
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(package_manager_exports);
|
|
27
|
-
var import_rewire = require("
|
|
27
|
+
var import_rewire = require("#env/rewire");
|
|
28
28
|
function detectPackageManager() {
|
|
29
29
|
const userAgent = getPackageManagerUserAgent();
|
|
30
30
|
if (userAgent) {
|
package/dist/env/path.js
CHANGED
|
@@ -22,7 +22,7 @@ __export(path_exports, {
|
|
|
22
22
|
getPath: () => getPath
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(path_exports);
|
|
25
|
-
var import_rewire = require("
|
|
25
|
+
var import_rewire = require("#env/rewire");
|
|
26
26
|
function getPath() {
|
|
27
27
|
return (0, import_rewire.getEnvValue)("PATH");
|
|
28
28
|
}
|
package/dist/env/pre-commit.js
CHANGED
|
@@ -22,8 +22,8 @@ __export(pre_commit_exports, {
|
|
|
22
22
|
getPreCommit: () => getPreCommit
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(pre_commit_exports);
|
|
25
|
-
var import_helpers = require("
|
|
26
|
-
var import_rewire = require("
|
|
25
|
+
var import_helpers = require("#env/helpers");
|
|
26
|
+
var import_rewire = require("#env/rewire");
|
|
27
27
|
function getPreCommit() {
|
|
28
28
|
return (0, import_helpers.envAsBoolean)((0, import_rewire.getEnvValue)("PRE_COMMIT"));
|
|
29
29
|
}
|
package/dist/env/rewire.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Get an environment variable value, checking overrides first.
|
|
3
3
|
*
|
|
4
4
|
* Resolution order:
|
|
5
|
-
* 1.
|
|
6
|
-
* 2.
|
|
5
|
+
* 1. Isolated overrides (temporary - set via withEnv/withEnvSync)
|
|
6
|
+
* 2. Shared overrides (persistent - set via setEnv in beforeEach)
|
|
7
7
|
* 3. process.env (including vi.stubEnv modifications)
|
|
8
8
|
*
|
|
9
9
|
* @internal Used by env getters to support test rewiring
|
|
@@ -79,13 +79,13 @@ export declare function hasOverride(key: string): boolean;
|
|
|
79
79
|
* @example
|
|
80
80
|
* ```typescript
|
|
81
81
|
* // Nested overrides work correctly
|
|
82
|
-
* setEnv('CI', '1') //
|
|
82
|
+
* setEnv('CI', '1') // Shared override (persistent)
|
|
83
83
|
*
|
|
84
84
|
* await withEnv({ CI: '0' }, async () => {
|
|
85
|
-
* expect(getCI()).toBe(false) //
|
|
85
|
+
* expect(getCI()).toBe(false) // Isolated override takes precedence
|
|
86
86
|
* })
|
|
87
87
|
*
|
|
88
|
-
* expect(getCI()).toBe(true) // Back to
|
|
88
|
+
* expect(getCI()).toBe(true) // Back to shared override
|
|
89
89
|
* ```
|
|
90
90
|
*/
|
|
91
91
|
export declare function withEnv<T>(overrides: Record<string, string | undefined>, fn: () => T | Promise<T>): Promise<T>;
|
package/dist/env/rewire.js
CHANGED
|
@@ -29,38 +29,46 @@ __export(rewire_exports, {
|
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(rewire_exports);
|
|
31
31
|
var import_async_hooks = require("async_hooks");
|
|
32
|
-
|
|
33
|
-
const
|
|
32
|
+
var import_helpers = require("#env/helpers");
|
|
33
|
+
const isolatedOverridesStorage = new import_async_hooks.AsyncLocalStorage();
|
|
34
|
+
const sharedOverridesSymbol = Symbol.for(
|
|
35
|
+
"@socketsecurity/lib/env/rewire/test-overrides"
|
|
36
|
+
);
|
|
37
|
+
const isVitestEnv = (0, import_helpers.envAsBoolean)(process.env.VITEST);
|
|
38
|
+
if (isVitestEnv && !globalThis[sharedOverridesSymbol]) {
|
|
39
|
+
globalThis[sharedOverridesSymbol] = /* @__PURE__ */ new Map();
|
|
40
|
+
}
|
|
41
|
+
const sharedOverrides = globalThis[sharedOverridesSymbol];
|
|
34
42
|
function getEnvValue(key) {
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
37
|
-
return
|
|
43
|
+
const isolatedOverrides = isolatedOverridesStorage.getStore();
|
|
44
|
+
if (isolatedOverrides?.has(key)) {
|
|
45
|
+
return isolatedOverrides.get(key);
|
|
38
46
|
}
|
|
39
|
-
if (
|
|
40
|
-
return
|
|
47
|
+
if (sharedOverrides?.has(key)) {
|
|
48
|
+
return sharedOverrides.get(key);
|
|
41
49
|
}
|
|
42
50
|
return process.env[key];
|
|
43
51
|
}
|
|
44
52
|
function setEnv(key, value) {
|
|
45
|
-
|
|
53
|
+
sharedOverrides?.set(key, value);
|
|
46
54
|
}
|
|
47
55
|
function clearEnv(key) {
|
|
48
|
-
|
|
56
|
+
sharedOverrides?.delete(key);
|
|
49
57
|
}
|
|
50
58
|
function resetEnv() {
|
|
51
|
-
|
|
59
|
+
sharedOverrides?.clear();
|
|
52
60
|
}
|
|
53
61
|
function hasOverride(key) {
|
|
54
|
-
const
|
|
55
|
-
return
|
|
62
|
+
const isolatedOverrides = isolatedOverridesStorage.getStore();
|
|
63
|
+
return !!(isolatedOverrides?.has(key) || sharedOverrides?.has(key));
|
|
56
64
|
}
|
|
57
65
|
async function withEnv(overrides, fn) {
|
|
58
66
|
const map = new Map(Object.entries(overrides));
|
|
59
|
-
return await
|
|
67
|
+
return await isolatedOverridesStorage.run(map, fn);
|
|
60
68
|
}
|
|
61
69
|
function withEnvSync(overrides, fn) {
|
|
62
70
|
const map = new Map(Object.entries(overrides));
|
|
63
|
-
return
|
|
71
|
+
return isolatedOverridesStorage.run(map, fn);
|
|
64
72
|
}
|
|
65
73
|
// Annotate the CommonJS export names for ESM import in node:
|
|
66
74
|
0 && (module.exports = {
|
package/dist/env/shell.js
CHANGED
|
@@ -22,7 +22,7 @@ __export(shell_exports, {
|
|
|
22
22
|
getShell: () => getShell
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(shell_exports);
|
|
25
|
-
var import_rewire = require("
|
|
25
|
+
var import_rewire = require("#env/rewire");
|
|
26
26
|
function getShell() {
|
|
27
27
|
return (0, import_rewire.getEnvValue)("SHELL");
|
|
28
28
|
}
|
|
@@ -26,8 +26,8 @@ __export(socket_cli_shadow_exports, {
|
|
|
26
26
|
getSocketCliShadowSilent: () => getSocketCliShadowSilent
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(socket_cli_shadow_exports);
|
|
29
|
-
var import_helpers = require("
|
|
30
|
-
var import_rewire = require("
|
|
29
|
+
var import_helpers = require("#env/helpers");
|
|
30
|
+
var import_rewire = require("#env/rewire");
|
|
31
31
|
function getSocketCliShadowAcceptRisks() {
|
|
32
32
|
return (0, import_helpers.envAsBoolean)((0, import_rewire.getEnvValue)("SOCKET_CLI_SHADOW_ACCEPT_RISKS"));
|
|
33
33
|
}
|
package/dist/env/socket-cli.js
CHANGED
|
@@ -35,8 +35,8 @@ __export(socket_cli_exports, {
|
|
|
35
35
|
getSocketCliViewAllRisks: () => getSocketCliViewAllRisks
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(socket_cli_exports);
|
|
38
|
-
var import_helpers = require("
|
|
39
|
-
var import_rewire = require("
|
|
38
|
+
var import_helpers = require("#env/helpers");
|
|
39
|
+
var import_rewire = require("#env/rewire");
|
|
40
40
|
function getSocketCliAcceptRisks() {
|
|
41
41
|
return (0, import_helpers.envAsBoolean)((0, import_rewire.getEnvValue)("SOCKET_CLI_ACCEPT_RISKS"));
|
|
42
42
|
}
|
package/dist/env/socket.js
CHANGED
|
@@ -36,8 +36,8 @@ __export(socket_exports, {
|
|
|
36
36
|
getSocketViewAllRisks: () => getSocketViewAllRisks
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(socket_exports);
|
|
39
|
-
var import_helpers = require("
|
|
40
|
-
var import_rewire = require("
|
|
39
|
+
var import_helpers = require("#env/helpers");
|
|
40
|
+
var import_rewire = require("#env/rewire");
|
|
41
41
|
function getSocketAcceptRisks() {
|
|
42
42
|
return (0, import_helpers.envAsBoolean)((0, import_rewire.getEnvValue)("SOCKET_ACCEPT_RISKS"));
|
|
43
43
|
}
|
package/dist/env/temp-dir.js
CHANGED
|
@@ -24,7 +24,7 @@ __export(temp_dir_exports, {
|
|
|
24
24
|
getTmpdir: () => getTmpdir
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(temp_dir_exports);
|
|
27
|
-
var import_rewire = require("
|
|
27
|
+
var import_rewire = require("#env/rewire");
|
|
28
28
|
function getTmpdir() {
|
|
29
29
|
return (0, import_rewire.getEnvValue)("TMPDIR");
|
|
30
30
|
}
|
package/dist/env/term.js
CHANGED
|
@@ -22,7 +22,7 @@ __export(term_exports, {
|
|
|
22
22
|
getTerm: () => getTerm
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(term_exports);
|
|
25
|
-
var import_rewire = require("
|
|
25
|
+
var import_rewire = require("#env/rewire");
|
|
26
26
|
function getTerm() {
|
|
27
27
|
return (0, import_rewire.getEnvValue)("TERM");
|
|
28
28
|
}
|
package/dist/env/test.js
CHANGED
|
@@ -24,9 +24,9 @@ __export(test_exports, {
|
|
|
24
24
|
isTest: () => isTest
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(test_exports);
|
|
27
|
-
var import_helpers = require("
|
|
28
|
-
var import_node_env = require("
|
|
29
|
-
var import_rewire = require("
|
|
27
|
+
var import_helpers = require("#env/helpers");
|
|
28
|
+
var import_node_env = require("#env/node-env");
|
|
29
|
+
var import_rewire = require("#env/rewire");
|
|
30
30
|
function getJestWorkerId() {
|
|
31
31
|
return (0, import_helpers.envAsString)((0, import_rewire.getEnvValue)("JEST_WORKER_ID"));
|
|
32
32
|
}
|
package/dist/env/windows.js
CHANGED
|
@@ -25,7 +25,7 @@ __export(windows_exports, {
|
|
|
25
25
|
getUserprofile: () => getUserprofile
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(windows_exports);
|
|
28
|
-
var import_rewire = require("
|
|
28
|
+
var import_rewire = require("#env/rewire");
|
|
29
29
|
function getAppdata() {
|
|
30
30
|
return (0, import_rewire.getEnvValue)("APPDATA");
|
|
31
31
|
}
|
package/dist/env/xdg.js
CHANGED
|
@@ -24,7 +24,7 @@ __export(xdg_exports, {
|
|
|
24
24
|
getXdgDataHome: () => getXdgDataHome
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(xdg_exports);
|
|
27
|
-
var import_rewire = require("
|
|
27
|
+
var import_rewire = require("#env/rewire");
|
|
28
28
|
function getXdgCacheHome() {
|
|
29
29
|
return (0, import_rewire.getEnvValue)("XDG_CACHE_HOME");
|
|
30
30
|
}
|
package/dist/fs.js
CHANGED
|
@@ -48,7 +48,7 @@ __export(fs_exports, {
|
|
|
48
48
|
writeJsonSync: () => writeJsonSync
|
|
49
49
|
});
|
|
50
50
|
module.exports = __toCommonJS(fs_exports);
|
|
51
|
-
var import_process = require("
|
|
51
|
+
var import_process = require("#constants/process");
|
|
52
52
|
var import_arrays = require("./arrays");
|
|
53
53
|
var import_globs = require("./globs");
|
|
54
54
|
var import_json = require("./json");
|
|
@@ -429,7 +429,7 @@ function getAllowedDirectories() {
|
|
|
429
429
|
getOsTmpDir,
|
|
430
430
|
getSocketCacacheDir,
|
|
431
431
|
getSocketUserDir
|
|
432
|
-
} = require("
|
|
432
|
+
} = require("#lib/paths");
|
|
433
433
|
_cachedAllowedDirs = [
|
|
434
434
|
path.resolve(getOsTmpDir()),
|
|
435
435
|
path.resolve(getSocketCacacheDir()),
|
|
@@ -444,8 +444,7 @@ function invalidatePathCache() {
|
|
|
444
444
|
(0, import_rewire.registerCacheInvalidation)(invalidatePathCache);
|
|
445
445
|
// @__NO_SIDE_EFFECTS__
|
|
446
446
|
async function safeDelete(filepath, options) {
|
|
447
|
-
const
|
|
448
|
-
const { deleteAsync } = del;
|
|
447
|
+
const { deleteAsync } = require("./external/del");
|
|
449
448
|
const opts = { __proto__: null, ...options };
|
|
450
449
|
const patterns = (0, import_arrays.isArray)(filepath) ? filepath.map(import_path.pathLikeToString) : [(0, import_path.pathLikeToString)(filepath)];
|
|
451
450
|
let shouldForce = opts.force !== false;
|
|
@@ -477,8 +476,7 @@ async function safeDelete(filepath, options) {
|
|
|
477
476
|
}
|
|
478
477
|
// @__NO_SIDE_EFFECTS__
|
|
479
478
|
function safeDeleteSync(filepath, options) {
|
|
480
|
-
const
|
|
481
|
-
const { deleteSync } = del;
|
|
479
|
+
const { deleteSync } = require("./external/del");
|
|
482
480
|
const opts = { __proto__: null, ...options };
|
|
483
481
|
const patterns = (0, import_arrays.isArray)(filepath) ? filepath.map(import_path.pathLikeToString) : [(0, import_path.pathLikeToString)(filepath)];
|
|
484
482
|
let shouldForce = opts.force !== false;
|
package/dist/git.js
CHANGED
|
@@ -45,7 +45,7 @@ __export(git_exports, {
|
|
|
45
45
|
});
|
|
46
46
|
module.exports = __toCommonJS(git_exports);
|
|
47
47
|
var import_path = __toESM(require("path"));
|
|
48
|
-
var import_platform = require("
|
|
48
|
+
var import_platform = require("#constants/platform");
|
|
49
49
|
var import_debug = require("./debug");
|
|
50
50
|
var import_globs = require("./globs");
|
|
51
51
|
var import_path2 = require("./path");
|
package/dist/github.js
CHANGED
|
@@ -31,8 +31,8 @@ __export(github_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(github_exports);
|
|
33
33
|
var import_cache_with_ttl = require("./cache-with-ttl");
|
|
34
|
-
var import_github = require("
|
|
35
|
-
var import_socket_cli = require("
|
|
34
|
+
var import_github = require("#env/github");
|
|
35
|
+
var import_socket_cli = require("#env/socket-cli");
|
|
36
36
|
var import_http_request = require("./http-request");
|
|
37
37
|
var import_spawn = require("./spawn");
|
|
38
38
|
const GITHUB_API_BASE_URL = "https://api.github.com";
|
package/dist/globs.js
CHANGED
|
@@ -77,8 +77,7 @@ let _fastGlob;
|
|
|
77
77
|
// @__NO_SIDE_EFFECTS__
|
|
78
78
|
function getFastGlob() {
|
|
79
79
|
if (_fastGlob === void 0) {
|
|
80
|
-
|
|
81
|
-
_fastGlob = "default" in globExport ? globExport.default : globExport;
|
|
80
|
+
_fastGlob = require("./external/fast-glob");
|
|
82
81
|
}
|
|
83
82
|
return _fastGlob;
|
|
84
83
|
}
|
|
@@ -97,14 +96,14 @@ function globStreamLicenses(dirname, options) {
|
|
|
97
96
|
if (ignoreOriginals) {
|
|
98
97
|
const { LICENSE_ORIGINAL_GLOB_RECURSIVE } = (
|
|
99
98
|
/*@__INLINE__*/
|
|
100
|
-
require("
|
|
99
|
+
require("#constants/paths")
|
|
101
100
|
);
|
|
102
101
|
ignore.push(LICENSE_ORIGINAL_GLOB_RECURSIVE);
|
|
103
102
|
}
|
|
104
103
|
const fastGlob = /* @__PURE__ */ getFastGlob();
|
|
105
104
|
const paths = (
|
|
106
105
|
/*@__INLINE__*/
|
|
107
|
-
require("
|
|
106
|
+
require("#constants/paths")
|
|
108
107
|
);
|
|
109
108
|
return fastGlob.globStream(
|
|
110
109
|
[recursive ? paths.LICENSE_GLOB_RECURSIVE : paths.LICENSE_GLOB],
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview NPM lifecycle script names.
|
|
3
|
+
*
|
|
4
|
+
* Standard npm lifecycle hooks that can be defined in package.json scripts.
|
|
5
|
+
* https://docs.npmjs.com/cli/v10/using-npm/scripts#life-cycle-scripts
|
|
6
|
+
*/
|
|
7
|
+
declare const lifecycleScriptNames: Set<string>;
|
|
8
|
+
export default lifecycleScriptNames;
|
|
9
|
+
export { lifecycleScriptNames as 'module.exports' };
|
|
@@ -18,8 +18,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
20
|
var lifecycle_script_names_exports = {};
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
__export(lifecycle_script_names_exports, {
|
|
22
|
+
default: () => lifecycle_script_names_default,
|
|
23
|
+
"module.exports": () => lifecycleScriptNames
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(lifecycle_script_names_exports);
|
|
26
|
+
const lifecycleScriptNames = new Set(
|
|
23
27
|
[
|
|
24
28
|
"dependencies",
|
|
25
29
|
"prepublishOnly",
|
|
@@ -35,5 +39,8 @@ var lifecycle_script_names_default = new Set(
|
|
|
35
39
|
].map((n) => [`pre${n}`, n, `post${n}`])
|
|
36
40
|
].flat()
|
|
37
41
|
);
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
var lifecycle_script_names_default = lifecycleScriptNames;
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
"module.exports": null
|
|
46
|
+
});
|
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.reason} Working through logic`)
|
|
16
17
|
* ```
|
|
17
18
|
*/
|
|
18
19
|
type LogSymbols = {
|
|
@@ -20,6 +21,8 @@ type LogSymbols = {
|
|
|
20
21
|
fail: string;
|
|
21
22
|
/** Blue colored information symbol (ℹ or i in ASCII) */
|
|
22
23
|
info: string;
|
|
24
|
+
/** Dimmed yellow reasoning/working symbol (∴ or :. in ASCII) */
|
|
25
|
+
reason: string;
|
|
23
26
|
/** Cyan colored step symbol (→ or > in ASCII) */
|
|
24
27
|
step: string;
|
|
25
28
|
/** Green colored success symbol (✔ or √ in ASCII) */
|
|
@@ -62,9 +65,9 @@ export type { LogSymbols, LoggerMethods, Task };
|
|
|
62
65
|
/**
|
|
63
66
|
* Log symbols for terminal output with colored indicators.
|
|
64
67
|
*
|
|
65
|
-
* Provides colored Unicode symbols (
|
|
68
|
+
* Provides colored Unicode symbols (✖, ℹ, ∴, →, ✔, ⚠) with ASCII fallbacks (×, i, :., >, √, ‼)
|
|
66
69
|
* for terminals that don't support Unicode. Symbols are colored according to the active
|
|
67
|
-
* theme's color palette (
|
|
70
|
+
* theme's color palette (error, info, reason, step, success, warning).
|
|
68
71
|
*
|
|
69
72
|
* The symbols are lazily initialized on first access and automatically update when the
|
|
70
73
|
* fallback theme changes (via setTheme()). Note that LOG_SYMBOLS reflect the global
|
|
@@ -74,11 +77,12 @@ export type { LogSymbols, LoggerMethods, Task };
|
|
|
74
77
|
* ```typescript
|
|
75
78
|
* import { LOG_SYMBOLS } from '@socketsecurity/lib'
|
|
76
79
|
*
|
|
77
|
-
* console.log(`${LOG_SYMBOLS.success} Build completed`) // Theme success color ✔
|
|
78
80
|
* console.log(`${LOG_SYMBOLS.fail} Build failed`) // Theme error color ✖
|
|
79
|
-
* console.log(`${LOG_SYMBOLS.warn} Deprecated API used`) // Theme warning color ⚠
|
|
80
81
|
* console.log(`${LOG_SYMBOLS.info} Starting process`) // Theme info color ℹ
|
|
82
|
+
* console.log(`${LOG_SYMBOLS.reason} Analyzing dependencies`) // Dimmed yellow ∴
|
|
81
83
|
* console.log(`${LOG_SYMBOLS.step} Processing files`) // Theme step color →
|
|
84
|
+
* console.log(`${LOG_SYMBOLS.success} Build completed`) // Theme success color ✔
|
|
85
|
+
* console.log(`${LOG_SYMBOLS.warn} Deprecated API used`) // Theme warning color ⚠
|
|
82
86
|
* ```
|
|
83
87
|
*/
|
|
84
88
|
export declare const LOG_SYMBOLS: Record<string, string>;
|
|
@@ -288,6 +292,35 @@ export declare class Logger {
|
|
|
288
292
|
* ```
|
|
289
293
|
*/
|
|
290
294
|
assert(value: unknown, ...message: unknown[]): this;
|
|
295
|
+
/**
|
|
296
|
+
* Clears the current line in the terminal.
|
|
297
|
+
*
|
|
298
|
+
* Moves the cursor to the beginning of the line and clears all content.
|
|
299
|
+
* Works in both TTY and non-TTY environments. Useful for clearing
|
|
300
|
+
* progress indicators created with `progress()`.
|
|
301
|
+
*
|
|
302
|
+
* The stream to clear (stderr or stdout) depends on whether the logger
|
|
303
|
+
* is stream-bound.
|
|
304
|
+
*
|
|
305
|
+
* @returns The logger instance for chaining
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```typescript
|
|
309
|
+
* logger.progress('Loading...')
|
|
310
|
+
* // ... do work ...
|
|
311
|
+
* logger.clearLine()
|
|
312
|
+
* logger.success('Loaded')
|
|
313
|
+
*
|
|
314
|
+
* // Clear multiple progress updates
|
|
315
|
+
* for (const file of files) {
|
|
316
|
+
* logger.progress(`Processing ${file}`)
|
|
317
|
+
* processFile(file)
|
|
318
|
+
* logger.clearLine()
|
|
319
|
+
* }
|
|
320
|
+
* logger.success('All files processed')
|
|
321
|
+
* ```
|
|
322
|
+
*/
|
|
323
|
+
clearLine(): this;
|
|
291
324
|
/**
|
|
292
325
|
* Clears the visible terminal screen.
|
|
293
326
|
*
|
|
@@ -413,6 +446,28 @@ export declare class Logger {
|
|
|
413
446
|
* ```
|
|
414
447
|
*/
|
|
415
448
|
dirxml(...data: unknown[]): this;
|
|
449
|
+
/**
|
|
450
|
+
* Logs a completion message with a success symbol (alias for `success()`).
|
|
451
|
+
*
|
|
452
|
+
* Provides semantic clarity when marking something as "done". Does NOT
|
|
453
|
+
* automatically clear the current line - call `clearLine()` first if
|
|
454
|
+
* needed after using `progress()`.
|
|
455
|
+
*
|
|
456
|
+
* @param args - Message and additional arguments to log
|
|
457
|
+
* @returns The logger instance for chaining
|
|
458
|
+
*
|
|
459
|
+
* @example
|
|
460
|
+
* ```typescript
|
|
461
|
+
* logger.done('Task completed')
|
|
462
|
+
*
|
|
463
|
+
* // After progress indicator
|
|
464
|
+
* logger.progress('Processing...')
|
|
465
|
+
* // ... do work ...
|
|
466
|
+
* logger.clearLine()
|
|
467
|
+
* logger.done('Processing complete')
|
|
468
|
+
* ```
|
|
469
|
+
*/
|
|
470
|
+
done(...args: unknown[]): this;
|
|
416
471
|
/**
|
|
417
472
|
* Logs an error message to stderr.
|
|
418
473
|
*
|
|
@@ -614,6 +669,53 @@ export declare class Logger {
|
|
|
614
669
|
* ```
|
|
615
670
|
*/
|
|
616
671
|
logNewline(): this;
|
|
672
|
+
/**
|
|
673
|
+
* Shows a progress indicator that can be cleared with `clearLine()`.
|
|
674
|
+
*
|
|
675
|
+
* Displays a simple status message with a '∴' prefix. Does not include
|
|
676
|
+
* animation or spinner. Intended to be cleared once the operation completes.
|
|
677
|
+
* The output stream (stderr or stdout) depends on whether the logger is
|
|
678
|
+
* stream-bound.
|
|
679
|
+
*
|
|
680
|
+
* @param text - The progress message to display
|
|
681
|
+
* @returns The logger instance for chaining
|
|
682
|
+
*
|
|
683
|
+
* @example
|
|
684
|
+
* ```typescript
|
|
685
|
+
* logger.progress('Processing files...')
|
|
686
|
+
* // ... do work ...
|
|
687
|
+
* logger.clearLine()
|
|
688
|
+
* logger.success('Files processed')
|
|
689
|
+
*
|
|
690
|
+
* // Stream-specific progress
|
|
691
|
+
* logger.stdout.progress('Loading...')
|
|
692
|
+
* // ... do work ...
|
|
693
|
+
* logger.stdout.clearLine()
|
|
694
|
+
* logger.stdout.log('Done')
|
|
695
|
+
* ```
|
|
696
|
+
*/
|
|
697
|
+
progress(text: string): this;
|
|
698
|
+
/**
|
|
699
|
+
* Logs a reasoning/working message with a dimmed yellow therefore symbol.
|
|
700
|
+
*
|
|
701
|
+
* Automatically prefixes the message with `LOG_SYMBOLS.reason` (dimmed yellow ∴).
|
|
702
|
+
* Useful for showing intermediate reasoning, logic steps, or "working" output
|
|
703
|
+
* that leads to a conclusion. Always outputs to stderr. If the message starts
|
|
704
|
+
* with an existing symbol, it will be stripped and replaced.
|
|
705
|
+
*
|
|
706
|
+
* @param args - Message and additional arguments to log
|
|
707
|
+
* @returns The logger instance for chaining
|
|
708
|
+
*
|
|
709
|
+
* @example
|
|
710
|
+
* ```typescript
|
|
711
|
+
* logger.step('Analyzing package security')
|
|
712
|
+
* logger.reason('Found 3 direct dependencies')
|
|
713
|
+
* logger.reason('Checking 47 transitive dependencies')
|
|
714
|
+
* logger.reason('Risk score: 8.5/10')
|
|
715
|
+
* logger.fail('Package blocked due to high risk')
|
|
716
|
+
* ```
|
|
717
|
+
*/
|
|
718
|
+
reason(...args: unknown[]): this;
|
|
617
719
|
/**
|
|
618
720
|
* Resets all indentation to zero.
|
|
619
721
|
*
|
|
@@ -706,28 +808,6 @@ export declare class Logger {
|
|
|
706
808
|
* ```
|
|
707
809
|
*/
|
|
708
810
|
success(...args: unknown[]): this;
|
|
709
|
-
/**
|
|
710
|
-
* Logs a completion message with a success symbol (alias for `success()`).
|
|
711
|
-
*
|
|
712
|
-
* Provides semantic clarity when marking something as "done". Does NOT
|
|
713
|
-
* automatically clear the current line - call `clearLine()` first if
|
|
714
|
-
* needed after using `progress()`.
|
|
715
|
-
*
|
|
716
|
-
* @param args - Message and additional arguments to log
|
|
717
|
-
* @returns The logger instance for chaining
|
|
718
|
-
*
|
|
719
|
-
* @example
|
|
720
|
-
* ```typescript
|
|
721
|
-
* logger.done('Task completed')
|
|
722
|
-
*
|
|
723
|
-
* // After progress indicator
|
|
724
|
-
* logger.progress('Processing...')
|
|
725
|
-
* // ... do work ...
|
|
726
|
-
* logger.clearLine()
|
|
727
|
-
* logger.done('Processing complete')
|
|
728
|
-
* ```
|
|
729
|
-
*/
|
|
730
|
-
done(...args: unknown[]): this;
|
|
731
811
|
/**
|
|
732
812
|
* Displays data in a table format.
|
|
733
813
|
*
|
|
@@ -893,61 +973,6 @@ export declare class Logger {
|
|
|
893
973
|
* ```
|
|
894
974
|
*/
|
|
895
975
|
write(text: string): this;
|
|
896
|
-
/**
|
|
897
|
-
* Shows a progress indicator that can be cleared with `clearLine()`.
|
|
898
|
-
*
|
|
899
|
-
* Displays a simple status message with a '∴' prefix. Does not include
|
|
900
|
-
* animation or spinner. Intended to be cleared once the operation completes.
|
|
901
|
-
* The output stream (stderr or stdout) depends on whether the logger is
|
|
902
|
-
* stream-bound.
|
|
903
|
-
*
|
|
904
|
-
* @param text - The progress message to display
|
|
905
|
-
* @returns The logger instance for chaining
|
|
906
|
-
*
|
|
907
|
-
* @example
|
|
908
|
-
* ```typescript
|
|
909
|
-
* logger.progress('Processing files...')
|
|
910
|
-
* // ... do work ...
|
|
911
|
-
* logger.clearLine()
|
|
912
|
-
* logger.success('Files processed')
|
|
913
|
-
*
|
|
914
|
-
* // Stream-specific progress
|
|
915
|
-
* logger.stdout.progress('Loading...')
|
|
916
|
-
* // ... do work ...
|
|
917
|
-
* logger.stdout.clearLine()
|
|
918
|
-
* logger.stdout.log('Done')
|
|
919
|
-
* ```
|
|
920
|
-
*/
|
|
921
|
-
progress(text: string): this;
|
|
922
|
-
/**
|
|
923
|
-
* Clears the current line in the terminal.
|
|
924
|
-
*
|
|
925
|
-
* Moves the cursor to the beginning of the line and clears all content.
|
|
926
|
-
* Works in both TTY and non-TTY environments. Useful for clearing
|
|
927
|
-
* progress indicators created with `progress()`.
|
|
928
|
-
*
|
|
929
|
-
* The stream to clear (stderr or stdout) depends on whether the logger
|
|
930
|
-
* is stream-bound.
|
|
931
|
-
*
|
|
932
|
-
* @returns The logger instance for chaining
|
|
933
|
-
*
|
|
934
|
-
* @example
|
|
935
|
-
* ```typescript
|
|
936
|
-
* logger.progress('Loading...')
|
|
937
|
-
* // ... do work ...
|
|
938
|
-
* logger.clearLine()
|
|
939
|
-
* logger.success('Loaded')
|
|
940
|
-
*
|
|
941
|
-
* // Clear multiple progress updates
|
|
942
|
-
* for (const file of files) {
|
|
943
|
-
* logger.progress(`Processing ${file}`)
|
|
944
|
-
* processFile(file)
|
|
945
|
-
* logger.clearLine()
|
|
946
|
-
* }
|
|
947
|
-
* logger.success('All files processed')
|
|
948
|
-
* ```
|
|
949
|
-
*/
|
|
950
|
-
clearLine(): this;
|
|
951
976
|
}
|
|
952
977
|
/**
|
|
953
978
|
* Get the default logger instance.
|