@socketsecurity/lib 5.21.0 → 5.24.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 +32 -0
- package/README.md +24 -181
- package/dist/constants/socket.js +1 -1
- package/dist/dlx/manifest.js +8 -19
- package/dist/dlx/package.js +2 -1
- package/dist/env/socket-cli.d.ts +4 -3
- package/dist/env/socket-cli.js +1 -1
- package/dist/errors.d.ts +96 -2
- package/dist/errors.js +55 -0
- package/dist/external/@npmcli/package-json.js +3968 -9
- package/dist/external/npm-pack.js +6988 -4099
- package/dist/external/pony-cause.js +12 -11
- package/dist/github.js +3 -2
- package/dist/json/edit.js +3 -2
- package/dist/packages/isolation.js +4 -4
- package/dist/performance.js +3 -2
- package/dist/process-lock.js +3 -6
- package/dist/releases/github.js +3 -2
- package/dist/releases/socket-btm.d.ts +61 -5
- package/dist/releases/socket-btm.js +2 -2
- package/package.json +3 -7
- package/dist/env/socket-cli-shadow.d.ts +0 -77
- package/dist/env/socket-cli-shadow.js +0 -59
|
@@ -11,9 +11,9 @@ var __commonJS = (cb, mod) => function __require() {
|
|
|
11
11
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
// node_modules/.pnpm/pony-cause@2.1.
|
|
14
|
+
// node_modules/.pnpm/pony-cause@2.1.11_patch_hash=39b2eb2567818b7c60126d03e252dbbabd8738082fca850582300d45b0a8cfb8/node_modules/pony-cause/lib/error-with-cause.js
|
|
15
15
|
var require_error_with_cause = __commonJS({
|
|
16
|
-
"node_modules/.pnpm/pony-cause@2.1.
|
|
16
|
+
"node_modules/.pnpm/pony-cause@2.1.11_patch_hash=39b2eb2567818b7c60126d03e252dbbabd8738082fca850582300d45b0a8cfb8/node_modules/pony-cause/lib/error-with-cause.js"(exports2, module2) {
|
|
17
17
|
"use strict";
|
|
18
18
|
var ErrorWithCause = class _ErrorWithCause extends Error {
|
|
19
19
|
static {
|
|
@@ -41,13 +41,14 @@ var require_error_with_cause = __commonJS({
|
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
// node_modules/.pnpm/pony-cause@2.1.
|
|
44
|
+
// node_modules/.pnpm/pony-cause@2.1.11_patch_hash=39b2eb2567818b7c60126d03e252dbbabd8738082fca850582300d45b0a8cfb8/node_modules/pony-cause/lib/helpers.js
|
|
45
45
|
var require_helpers = __commonJS({
|
|
46
|
-
"node_modules/.pnpm/pony-cause@2.1.
|
|
46
|
+
"node_modules/.pnpm/pony-cause@2.1.11_patch_hash=39b2eb2567818b7c60126d03e252dbbabd8738082fca850582300d45b0a8cfb8/node_modules/pony-cause/lib/helpers.js"(exports2, module2) {
|
|
47
47
|
"use strict";
|
|
48
|
+
var isError = typeof Error.isError === "function" ? Error.isError : (v) => v !== null && typeof v === "object" && Object.prototype.toString.call(v) === "[object Error]";
|
|
48
49
|
var findCauseByReference = /* @__PURE__ */ __name((err, reference) => {
|
|
49
50
|
if (!err || !reference) return;
|
|
50
|
-
if (!(err
|
|
51
|
+
if (!isError(err)) return;
|
|
51
52
|
if (!(reference.prototype instanceof Error) && // @ts-ignore
|
|
52
53
|
reference !== Error) return;
|
|
53
54
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -66,13 +67,13 @@ var require_helpers = __commonJS({
|
|
|
66
67
|
}
|
|
67
68
|
if (typeof err.cause === "function") {
|
|
68
69
|
const causeResult = err.cause();
|
|
69
|
-
return causeResult
|
|
70
|
+
return isError(causeResult) ? causeResult : void 0;
|
|
70
71
|
} else {
|
|
71
|
-
return err.cause
|
|
72
|
+
return isError(err.cause) ? err.cause : void 0;
|
|
72
73
|
}
|
|
73
74
|
}, "getErrorCause");
|
|
74
75
|
var _stackWithCauses = /* @__PURE__ */ __name((err, seen) => {
|
|
75
|
-
if (!(err
|
|
76
|
+
if (!isError(err)) return "";
|
|
76
77
|
const stack = err.stack || "";
|
|
77
78
|
if (seen.has(err)) {
|
|
78
79
|
return stack + "\ncauses have become circular...";
|
|
@@ -87,7 +88,7 @@ var require_helpers = __commonJS({
|
|
|
87
88
|
}, "_stackWithCauses");
|
|
88
89
|
var stackWithCauses = /* @__PURE__ */ __name((err) => _stackWithCauses(err, /* @__PURE__ */ new Set()), "stackWithCauses");
|
|
89
90
|
var _messageWithCauses = /* @__PURE__ */ __name((err, seen, skip) => {
|
|
90
|
-
if (!(err
|
|
91
|
+
if (!isError(err)) return "";
|
|
91
92
|
const message = skip ? "" : err.message || "";
|
|
92
93
|
if (seen.has(err)) {
|
|
93
94
|
return message + ": ...";
|
|
@@ -116,9 +117,9 @@ var require_helpers = __commonJS({
|
|
|
116
117
|
}
|
|
117
118
|
});
|
|
118
119
|
|
|
119
|
-
// node_modules/.pnpm/pony-cause@2.1.
|
|
120
|
+
// node_modules/.pnpm/pony-cause@2.1.11_patch_hash=39b2eb2567818b7c60126d03e252dbbabd8738082fca850582300d45b0a8cfb8/node_modules/pony-cause/index.js
|
|
120
121
|
var require_pony_cause = __commonJS({
|
|
121
|
-
"node_modules/.pnpm/pony-cause@2.1.
|
|
122
|
+
"node_modules/.pnpm/pony-cause@2.1.11_patch_hash=39b2eb2567818b7c60126d03e252dbbabd8738082fca850582300d45b0a8cfb8/node_modules/pony-cause/index.js"(exports2, module2) {
|
|
122
123
|
"use strict";
|
|
123
124
|
var { ErrorWithCause } = require_error_with_cause();
|
|
124
125
|
var {
|
package/dist/github.js
CHANGED
|
@@ -45,6 +45,7 @@ var import_node_process = __toESM(require("node:process"));
|
|
|
45
45
|
var import_cache_with_ttl = require("./cache-with-ttl");
|
|
46
46
|
var import_github = require("./env/github");
|
|
47
47
|
var import_socket_cli = require("./env/socket-cli");
|
|
48
|
+
var import_errors = require("./errors");
|
|
48
49
|
var import_http_request = require("./http-request");
|
|
49
50
|
var import_spawn = require("./spawn");
|
|
50
51
|
const GITHUB_API_BASE_URL = "https://api.github.com";
|
|
@@ -80,7 +81,7 @@ async function fetchRefSha(owner, repo, ref, options) {
|
|
|
80
81
|
return commitData.sha;
|
|
81
82
|
} catch (e) {
|
|
82
83
|
throw new Error(
|
|
83
|
-
`failed to resolve ref "${ref}" for ${owner}/${repo}: ${
|
|
84
|
+
`failed to resolve ref "${ref}" for ${owner}/${repo}: ${(0, import_errors.errorMessage)(e)}`
|
|
84
85
|
);
|
|
85
86
|
}
|
|
86
87
|
}
|
|
@@ -165,7 +166,7 @@ async function fetchGitHub(url, options) {
|
|
|
165
166
|
return JSON.parse(response.body.toString("utf8"));
|
|
166
167
|
} catch (error) {
|
|
167
168
|
throw new Error(
|
|
168
|
-
`Failed to parse GitHub API response: ${
|
|
169
|
+
`Failed to parse GitHub API response: ${(0, import_errors.errorMessage)(error)}
|
|
169
170
|
URL: ${url}
|
|
170
171
|
Response may be malformed or incomplete.`,
|
|
171
172
|
{ cause: error }
|
package/dist/json/edit.js
CHANGED
|
@@ -35,6 +35,7 @@ __export(edit_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(edit_exports);
|
|
36
36
|
var import_node_process = __toESM(require("node:process"));
|
|
37
37
|
var import_promises = require("node:timers/promises");
|
|
38
|
+
var import_errors = require("../errors");
|
|
38
39
|
var import_format = require("./format");
|
|
39
40
|
const identSymbol = import_format.INDENT_SYMBOL;
|
|
40
41
|
const newlineSymbol = import_format.NEWLINE_SYMBOL;
|
|
@@ -59,7 +60,7 @@ async function readFile(filepath) {
|
|
|
59
60
|
return await fsPromises.readFile(filepath, "utf8");
|
|
60
61
|
} catch (err) {
|
|
61
62
|
const isLastAttempt = attempt === maxRetries;
|
|
62
|
-
const isEnoent =
|
|
63
|
+
const isEnoent = (0, import_errors.isErrnoException)(err) && err.code === "ENOENT";
|
|
63
64
|
if (!isEnoent || isLastAttempt) {
|
|
64
65
|
throw err;
|
|
65
66
|
}
|
|
@@ -92,7 +93,7 @@ async function retryWrite(filepath, content, retries = 3, baseDelay = 10) {
|
|
|
92
93
|
return;
|
|
93
94
|
} catch (err) {
|
|
94
95
|
const isLastAttempt = attempt === retries;
|
|
95
|
-
const isRetriableError =
|
|
96
|
+
const isRetriableError = (0, import_errors.isErrnoException)(err) && (err.code === "EPERM" || err.code === "EBUSY" || err.code === "ENOENT");
|
|
96
97
|
if (!isRetriableError || isLastAttempt) {
|
|
97
98
|
throw err;
|
|
98
99
|
}
|
|
@@ -35,6 +35,7 @@ __export(isolation_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(isolation_exports);
|
|
36
36
|
var import_npm_package_arg = __toESM(require("../external/npm-package-arg"));
|
|
37
37
|
var import_platform = require("../constants/platform");
|
|
38
|
+
var import_errors = require("../errors");
|
|
38
39
|
var import_normalize = require("../paths/normalize");
|
|
39
40
|
var import_socket = require("../paths/socket");
|
|
40
41
|
var import_spawn = require("../spawn");
|
|
@@ -69,10 +70,9 @@ async function mergePackageJson(pkgJsonPath, originalPkgJson) {
|
|
|
69
70
|
try {
|
|
70
71
|
pkgJson = JSON.parse(await fs.promises.readFile(pkgJsonPath, "utf8"));
|
|
71
72
|
} catch (error) {
|
|
72
|
-
throw new Error(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
);
|
|
73
|
+
throw new Error(`Failed to parse ${pkgJsonPath}: ${(0, import_errors.errorMessage)(error)}`, {
|
|
74
|
+
cause: error
|
|
75
|
+
});
|
|
76
76
|
}
|
|
77
77
|
const mergedPkgJson = originalPkgJson ? { ...originalPkgJson, ...pkgJson } : pkgJson;
|
|
78
78
|
return mergedPkgJson;
|
package/dist/performance.js
CHANGED
|
@@ -44,6 +44,7 @@ __export(performance_exports, {
|
|
|
44
44
|
module.exports = __toCommonJS(performance_exports);
|
|
45
45
|
var import_node_process = __toESM(require("node:process"));
|
|
46
46
|
var import_debug = require("./debug");
|
|
47
|
+
var import_errors = require("./errors");
|
|
47
48
|
const performanceMetrics = [];
|
|
48
49
|
function isPerfEnabled() {
|
|
49
50
|
return import_node_process.default.env["DEBUG"]?.includes("perf") || false;
|
|
@@ -128,7 +129,7 @@ async function measure(operation, fn, metadata) {
|
|
|
128
129
|
} catch (e) {
|
|
129
130
|
stop({
|
|
130
131
|
success: false,
|
|
131
|
-
error:
|
|
132
|
+
error: (0, import_errors.errorMessage)(e)
|
|
132
133
|
});
|
|
133
134
|
throw e;
|
|
134
135
|
}
|
|
@@ -143,7 +144,7 @@ function measureSync(operation, fn, metadata) {
|
|
|
143
144
|
} catch (e) {
|
|
144
145
|
stop({
|
|
145
146
|
success: false,
|
|
146
|
-
error:
|
|
147
|
+
error: (0, import_errors.errorMessage)(e)
|
|
147
148
|
});
|
|
148
149
|
throw e;
|
|
149
150
|
}
|
package/dist/process-lock.js
CHANGED
|
@@ -23,6 +23,7 @@ __export(process_lock_exports, {
|
|
|
23
23
|
processLock: () => processLock
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(process_lock_exports);
|
|
26
|
+
var import_errors = require("./errors");
|
|
26
27
|
var import_fs = require("./fs");
|
|
27
28
|
var import_logger = require("./logger");
|
|
28
29
|
var import_promises = require("./promises");
|
|
@@ -87,9 +88,7 @@ class ProcessLockManager {
|
|
|
87
88
|
fs.utimesSync(lockPath, now, now);
|
|
88
89
|
}
|
|
89
90
|
} catch (error) {
|
|
90
|
-
logger.warn(
|
|
91
|
-
`Failed to touch lock ${lockPath}: ${error instanceof Error ? error.message : String(error)}`
|
|
92
|
-
);
|
|
91
|
+
logger.warn(`Failed to touch lock ${lockPath}: ${(0, import_errors.errorMessage)(error)}`);
|
|
93
92
|
}
|
|
94
93
|
}
|
|
95
94
|
/**
|
|
@@ -277,9 +276,7 @@ To resolve:
|
|
|
277
276
|
}
|
|
278
277
|
this.activeLocks.delete(lockPath);
|
|
279
278
|
} catch (error) {
|
|
280
|
-
logger.warn(
|
|
281
|
-
`Failed to release lock ${lockPath}: ${error instanceof Error ? error.message : String(error)}`
|
|
282
|
-
);
|
|
279
|
+
logger.warn(`Failed to release lock ${lockPath}: ${(0, import_errors.errorMessage)(error)}`);
|
|
283
280
|
}
|
|
284
281
|
}
|
|
285
282
|
/**
|
package/dist/releases/github.js
CHANGED
|
@@ -43,6 +43,7 @@ module.exports = __toCommonJS(github_exports);
|
|
|
43
43
|
var import_node_process = __toESM(require("node:process"));
|
|
44
44
|
var import_picomatch = __toESM(require("../external/picomatch"));
|
|
45
45
|
var import_archives = require("../archives");
|
|
46
|
+
var import_errors = require("../errors");
|
|
46
47
|
var import_fs = require("../fs");
|
|
47
48
|
var import_http_request = require("../http-request");
|
|
48
49
|
var import_logger = require("../logger");
|
|
@@ -341,7 +342,7 @@ async function getLatestRelease(toolPrefix, repoConfig, options = {}) {
|
|
|
341
342
|
`Retry attempt ${attempt + 1}/${RETRY_CONFIG.retries + 1} for ${toolPrefix} release...`
|
|
342
343
|
);
|
|
343
344
|
logger.warn(
|
|
344
|
-
`Attempt ${attempt + 1}/${RETRY_CONFIG.retries + 1} failed: ${
|
|
345
|
+
`Attempt ${attempt + 1}/${RETRY_CONFIG.retries + 1} failed: ${(0, import_errors.errorMessage)(error)}`
|
|
345
346
|
);
|
|
346
347
|
}
|
|
347
348
|
return void 0;
|
|
@@ -395,7 +396,7 @@ async function getReleaseAssetUrl(tag, assetPattern, repoConfig, options = {}) {
|
|
|
395
396
|
`Retry attempt ${attempt + 1}/${RETRY_CONFIG.retries + 1} for asset URL...`
|
|
396
397
|
);
|
|
397
398
|
logger.warn(
|
|
398
|
-
`Attempt ${attempt + 1}/${RETRY_CONFIG.retries + 1} failed: ${
|
|
399
|
+
`Attempt ${attempt + 1}/${RETRY_CONFIG.retries + 1} failed: ${(0, import_errors.errorMessage)(error)}`
|
|
399
400
|
);
|
|
400
401
|
}
|
|
401
402
|
return void 0;
|
|
@@ -126,18 +126,74 @@ export declare function getBinaryAssetName(binaryBaseName: string, platform: Pla
|
|
|
126
126
|
*/
|
|
127
127
|
export declare function getBinaryName(binaryBaseName: string, platform: Platform): string;
|
|
128
128
|
/**
|
|
129
|
-
* Get platform-arch identifier for directory structure.
|
|
130
|
-
*
|
|
129
|
+
* Get platform-arch identifier for directory structure and asset names.
|
|
130
|
+
*
|
|
131
|
+
* # Format: `<os>-<arch>[-<libc>]`
|
|
132
|
+
*
|
|
133
|
+
* The OS segment is `process.platform` verbatim: `darwin` / `linux` /
|
|
134
|
+
* `win32`. The arch segment is `process.arch` verbatim: `x64` / `arm64`.
|
|
135
|
+
* The optional libc suffix is `-musl` (Linux only; the glibc default is
|
|
136
|
+
* unsuffixed to match Node.js's own linuxstatic convention).
|
|
137
|
+
*
|
|
138
|
+
* # Why these specific conventions
|
|
139
|
+
*
|
|
140
|
+
* ## Why `win32`, not `win`
|
|
141
|
+
*
|
|
142
|
+
* `win32` is what `process.platform` returns on every Windows host. Every
|
|
143
|
+
* npm package whose install-time platform filter uses the standard
|
|
144
|
+
* `os` / `cpu` / `libc` manifest fields must match `process.platform`
|
|
145
|
+
* strings exactly (npm compares them verbatim — there's no shorthand
|
|
146
|
+
* layer). Using `win` internally here would have forced a translation
|
|
147
|
+
* every time we constructed an install filter or a target triple, and
|
|
148
|
+
* reviewers would have to remember "we abbreviate on disk but not in
|
|
149
|
+
* package filters." Since the two now match, there's no translation
|
|
150
|
+
* step to get wrong.
|
|
151
|
+
*
|
|
152
|
+
* pnpm's pack-app (v11+) accepts `<os>-<arch>[-<libc>]` target strings
|
|
153
|
+
* and its shards are `@pnpm/exe.<os>-<arch>` (with `win32`, not `win` —
|
|
154
|
+
* see pnpm#11314). Our naming matches so asset names we emit can flow
|
|
155
|
+
* directly into pack-app's `--target` arg, `pnpm.app.targets` config,
|
|
156
|
+
* and sibling-package-name construction without a translation map.
|
|
157
|
+
*
|
|
158
|
+
* ## Why `-musl` is the suffix (and glibc is unsuffixed)
|
|
159
|
+
*
|
|
160
|
+
* Node.js's own linuxstatic tarballs historically used the unqualified
|
|
161
|
+
* `linux` for glibc and a separate download channel for musl. The pnpm
|
|
162
|
+
* ecosystem codified that as `linux-<arch>` (glibc, default) and
|
|
163
|
+
* `linux-<arch>-musl` (the libc outlier), matching the asymmetric
|
|
164
|
+
* reality of Linux distros — glibc is the majority case, musl is
|
|
165
|
+
* Alpine-and-similar. Adding `-glibc` for the default would be
|
|
166
|
+
* redundant noise in the name.
|
|
167
|
+
*
|
|
168
|
+
* ## Why libc is only appended for Linux
|
|
169
|
+
*
|
|
170
|
+
* macOS and Windows have exactly one system libc each (Apple libSystem,
|
|
171
|
+
* Microsoft UCRT). A hypothetical `darwin-arm64-libsystem` conveys no
|
|
172
|
+
* information. Node.js, npm, and pnpm all treat libc as a Linux-only
|
|
173
|
+
* axis; we follow the same convention so callers don't have to special-
|
|
174
|
+
* case `'darwin-arm64'.startsWith('darwin-arm64')` style matches.
|
|
175
|
+
*
|
|
176
|
+
* ## Why this function exists at all (vs. inlining)
|
|
177
|
+
*
|
|
178
|
+
* Two upstream APIs that socket-btm consumers end up calling — the
|
|
179
|
+
* npm manifest filter (`os`/`cpu`/`libc`) and pnpm's pack-app
|
|
180
|
+
* `--target` — both need the exact same triple format. Centralizing
|
|
181
|
+
* the construction here means a future schema change (e.g. Node
|
|
182
|
+
* introducing `riscv64`) gets one edit, and the error message for an
|
|
183
|
+
* unsupported platform is uniform across downloaders, pack-app
|
|
184
|
+
* invocations, and the `@socketbin/*` resolver logic.
|
|
131
185
|
*
|
|
132
186
|
* @param platform - Target platform
|
|
133
187
|
* @param arch - Target architecture
|
|
134
|
-
* @param libc - Linux libc variant (optional)
|
|
135
|
-
* @returns Platform-arch identifier (e.g., 'darwin-arm64', 'linux-x64-musl', '
|
|
188
|
+
* @param libc - Linux libc variant (optional; non-linux platforms ignore)
|
|
189
|
+
* @returns Platform-arch identifier (e.g., 'darwin-arm64', 'linux-x64-musl', 'win32-x64')
|
|
136
190
|
*
|
|
137
191
|
* @example
|
|
138
192
|
* ```typescript
|
|
139
193
|
* getPlatformArch('linux', 'x64', 'musl') // 'linux-x64-musl'
|
|
140
|
-
* getPlatformArch('darwin', 'arm64')
|
|
194
|
+
* getPlatformArch('darwin', 'arm64') // 'darwin-arm64'
|
|
195
|
+
* getPlatformArch('win32', 'x64') // 'win32-x64'
|
|
196
|
+
* getPlatformArch('darwin', 'x64', 'musl') // 'darwin-x64' — libc ignored
|
|
141
197
|
* ```
|
|
142
198
|
*/
|
|
143
199
|
export declare function getPlatformArch(platform: Platform, arch: Arch, libc?: Libc | undefined): string;
|
|
@@ -38,7 +38,7 @@ const PLATFORM_MAP = {
|
|
|
38
38
|
__proto__: null,
|
|
39
39
|
darwin: "darwin",
|
|
40
40
|
linux: "linux",
|
|
41
|
-
win32: "
|
|
41
|
+
win32: "win32"
|
|
42
42
|
};
|
|
43
43
|
const ARCH_MAP = {
|
|
44
44
|
__proto__: null,
|
|
@@ -185,7 +185,7 @@ function getBinaryAssetName(binaryBaseName, platform, arch, libc) {
|
|
|
185
185
|
return `${binaryBaseName}-linux-${mappedArch}${muslSuffix}${ext}`;
|
|
186
186
|
}
|
|
187
187
|
if (platform === "win32") {
|
|
188
|
-
return `${binaryBaseName}-
|
|
188
|
+
return `${binaryBaseName}-win32-${mappedArch}${ext}`;
|
|
189
189
|
}
|
|
190
190
|
throw new Error(`Unsupported platform: ${platform}`);
|
|
191
191
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@socketsecurity/lib",
|
|
3
|
-
"version": "5.
|
|
4
|
-
"packageManager": "pnpm@11.0.0-rc.
|
|
3
|
+
"version": "5.24.0",
|
|
4
|
+
"packageManager": "pnpm@11.0.0-rc.5",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Core utilities and infrastructure for Socket.dev security tools",
|
|
7
7
|
"keywords": [
|
|
@@ -351,10 +351,6 @@
|
|
|
351
351
|
"types": "./dist/env/socket-cli.d.ts",
|
|
352
352
|
"default": "./dist/env/socket-cli.js"
|
|
353
353
|
},
|
|
354
|
-
"./env/socket-cli-shadow": {
|
|
355
|
-
"types": "./dist/env/socket-cli-shadow.d.ts",
|
|
356
|
-
"default": "./dist/env/socket-cli-shadow.js"
|
|
357
|
-
},
|
|
358
354
|
"./env/temp-dir": {
|
|
359
355
|
"types": "./dist/env/temp-dir.d.ts",
|
|
360
356
|
"default": "./dist/env/temp-dir.js"
|
|
@@ -724,7 +720,7 @@
|
|
|
724
720
|
"@socketregistry/is-unicode-supported": "1.0.5",
|
|
725
721
|
"@socketregistry/packageurl-js": "1.4.2",
|
|
726
722
|
"@socketregistry/yocto-spinner": "1.0.25",
|
|
727
|
-
"@socketsecurity/lib-stable": "npm:@socketsecurity/lib@5.
|
|
723
|
+
"@socketsecurity/lib-stable": "npm:@socketsecurity/lib@5.23.0",
|
|
728
724
|
"@types/node": "24.9.2",
|
|
729
725
|
"@typescript/native-preview": "7.0.0-dev.20260415.1",
|
|
730
726
|
"@vitest/coverage-v8": "4.0.3",
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Socket CLI shadow mode environment variables.
|
|
3
|
-
* Provides typed getters for SOCKET_CLI_SHADOW_* environment variables.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Controls Socket CLI shadow mode risk acceptance.
|
|
7
|
-
*
|
|
8
|
-
* @returns Whether to accept all risks in shadow mode
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* import { getSocketCliShadowAcceptRisks } from '@socketsecurity/lib/env/socket-cli-shadow'
|
|
13
|
-
*
|
|
14
|
-
* if (getSocketCliShadowAcceptRisks()) {
|
|
15
|
-
* console.log('Shadow mode risks accepted')
|
|
16
|
-
* }
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export declare function getSocketCliShadowAcceptRisks(): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* API token for Socket CLI shadow mode.
|
|
22
|
-
*
|
|
23
|
-
* @returns Shadow mode API token or undefined
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```typescript
|
|
27
|
-
* import { getSocketCliShadowApiToken } from '@socketsecurity/lib/env/socket-cli-shadow'
|
|
28
|
-
*
|
|
29
|
-
* const token = getSocketCliShadowApiToken()
|
|
30
|
-
* // e.g. 'sk_shadow_abc123...' or undefined
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export declare function getSocketCliShadowApiToken(): string | undefined;
|
|
34
|
-
/**
|
|
35
|
-
* Binary path for Socket CLI shadow mode.
|
|
36
|
-
*
|
|
37
|
-
* @returns Shadow mode binary path or undefined
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```typescript
|
|
41
|
-
* import { getSocketCliShadowBin } from '@socketsecurity/lib/env/socket-cli-shadow'
|
|
42
|
-
*
|
|
43
|
-
* const bin = getSocketCliShadowBin()
|
|
44
|
-
* // e.g. '/usr/local/bin/socket-shadow' or undefined
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export declare function getSocketCliShadowBin(): string | undefined;
|
|
48
|
-
/**
|
|
49
|
-
* Controls Socket CLI shadow mode progress display.
|
|
50
|
-
*
|
|
51
|
-
* @returns Whether to show progress in shadow mode
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```typescript
|
|
55
|
-
* import { getSocketCliShadowProgress } from '@socketsecurity/lib/env/socket-cli-shadow'
|
|
56
|
-
*
|
|
57
|
-
* if (getSocketCliShadowProgress()) {
|
|
58
|
-
* console.log('Shadow mode progress enabled')
|
|
59
|
-
* }
|
|
60
|
-
* ```
|
|
61
|
-
*/
|
|
62
|
-
export declare function getSocketCliShadowProgress(): boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Controls Socket CLI shadow mode silent operation.
|
|
65
|
-
*
|
|
66
|
-
* @returns Whether shadow mode should operate silently
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```typescript
|
|
70
|
-
* import { getSocketCliShadowSilent } from '@socketsecurity/lib/env/socket-cli-shadow'
|
|
71
|
-
*
|
|
72
|
-
* if (getSocketCliShadowSilent()) {
|
|
73
|
-
* console.log('Shadow mode is silent')
|
|
74
|
-
* }
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
77
|
-
export declare function getSocketCliShadowSilent(): boolean;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* Socket Lib - Built with esbuild */
|
|
3
|
-
"use strict";
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
-
var socket_cli_shadow_exports = {};
|
|
22
|
-
__export(socket_cli_shadow_exports, {
|
|
23
|
-
getSocketCliShadowAcceptRisks: () => getSocketCliShadowAcceptRisks,
|
|
24
|
-
getSocketCliShadowApiToken: () => getSocketCliShadowApiToken,
|
|
25
|
-
getSocketCliShadowBin: () => getSocketCliShadowBin,
|
|
26
|
-
getSocketCliShadowProgress: () => getSocketCliShadowProgress,
|
|
27
|
-
getSocketCliShadowSilent: () => getSocketCliShadowSilent
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(socket_cli_shadow_exports);
|
|
30
|
-
var import_helpers = require("./helpers");
|
|
31
|
-
var import_rewire = require("./rewire");
|
|
32
|
-
// @__NO_SIDE_EFFECTS__
|
|
33
|
-
function getSocketCliShadowAcceptRisks() {
|
|
34
|
-
return (0, import_helpers.envAsBoolean)((0, import_rewire.getEnvValue)("SOCKET_CLI_SHADOW_ACCEPT_RISKS"));
|
|
35
|
-
}
|
|
36
|
-
// @__NO_SIDE_EFFECTS__
|
|
37
|
-
function getSocketCliShadowApiToken() {
|
|
38
|
-
return (0, import_rewire.getEnvValue)("SOCKET_CLI_SHADOW_API_TOKEN");
|
|
39
|
-
}
|
|
40
|
-
// @__NO_SIDE_EFFECTS__
|
|
41
|
-
function getSocketCliShadowBin() {
|
|
42
|
-
return (0, import_rewire.getEnvValue)("SOCKET_CLI_SHADOW_BIN");
|
|
43
|
-
}
|
|
44
|
-
// @__NO_SIDE_EFFECTS__
|
|
45
|
-
function getSocketCliShadowProgress() {
|
|
46
|
-
return (0, import_helpers.envAsBoolean)((0, import_rewire.getEnvValue)("SOCKET_CLI_SHADOW_PROGRESS"));
|
|
47
|
-
}
|
|
48
|
-
// @__NO_SIDE_EFFECTS__
|
|
49
|
-
function getSocketCliShadowSilent() {
|
|
50
|
-
return (0, import_helpers.envAsBoolean)((0, import_rewire.getEnvValue)("SOCKET_CLI_SHADOW_SILENT"));
|
|
51
|
-
}
|
|
52
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
-
0 && (module.exports = {
|
|
54
|
-
getSocketCliShadowAcceptRisks,
|
|
55
|
-
getSocketCliShadowApiToken,
|
|
56
|
-
getSocketCliShadowBin,
|
|
57
|
-
getSocketCliShadowProgress,
|
|
58
|
-
getSocketCliShadowSilent
|
|
59
|
-
});
|