@socketsecurity/lib 5.5.3 → 5.7.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 +95 -1
- package/dist/cache-with-ttl.js +5 -1
- package/dist/dlx/binary.d.ts +47 -52
- package/dist/dlx/binary.js +129 -134
- package/dist/dlx/detect.d.ts +8 -8
- package/dist/dlx/detect.js +18 -18
- package/dist/dlx/manifest.d.ts +43 -36
- package/dist/dlx/manifest.js +114 -112
- package/dist/dlx/package.d.ts +55 -0
- package/dist/dlx/package.js +89 -79
- package/dist/env/ci.js +1 -2
- package/dist/env/rewire.d.ts +33 -22
- package/dist/env/rewire.js +20 -7
- package/dist/env/socket-cli.d.ts +24 -24
- package/dist/env/socket-cli.js +12 -12
- package/dist/env/temp-dir.d.ts +6 -6
- package/dist/env/temp-dir.js +4 -4
- package/dist/env/windows.d.ts +6 -6
- package/dist/env/windows.js +4 -4
- package/dist/external/libnpmexec.js +2 -2
- package/dist/github.js +10 -1
- package/dist/http-request.d.ts +79 -63
- package/dist/http-request.js +203 -159
- package/dist/packages/specs.js +1 -1
- package/dist/releases/github.d.ts +18 -7
- package/dist/releases/github.js +94 -92
- package/package.json +4 -4
package/dist/dlx/package.js
CHANGED
|
@@ -31,7 +31,12 @@ var package_exports = {};
|
|
|
31
31
|
__export(package_exports, {
|
|
32
32
|
dlxPackage: () => dlxPackage,
|
|
33
33
|
downloadPackage: () => downloadPackage,
|
|
34
|
-
|
|
34
|
+
ensurePackageInstalled: () => ensurePackageInstalled,
|
|
35
|
+
executePackage: () => executePackage,
|
|
36
|
+
findBinaryPath: () => findBinaryPath,
|
|
37
|
+
makePackageBinsExecutable: () => makePackageBinsExecutable,
|
|
38
|
+
parsePackageSpec: () => parsePackageSpec,
|
|
39
|
+
resolveBinaryPath: () => resolveBinaryPath
|
|
35
40
|
});
|
|
36
41
|
module.exports = __toCommonJS(package_exports);
|
|
37
42
|
var import_platform = require("../constants/platform");
|
|
@@ -61,24 +66,45 @@ function getPath() {
|
|
|
61
66
|
return _path;
|
|
62
67
|
}
|
|
63
68
|
const rangeOperatorsRegExp = /[~^><=xX* ]|\|\|/;
|
|
64
|
-
function
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
69
|
+
async function dlxPackage(args, options, spawnExtra) {
|
|
70
|
+
const downloadResult = await downloadPackage(options);
|
|
71
|
+
const spawnPromise = executePackage(
|
|
72
|
+
downloadResult.binaryPath,
|
|
73
|
+
args,
|
|
74
|
+
options?.spawnOptions,
|
|
75
|
+
spawnExtra
|
|
76
|
+
);
|
|
77
|
+
return {
|
|
78
|
+
...downloadResult,
|
|
79
|
+
spawnPromise
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
async function downloadPackage(options) {
|
|
83
|
+
const {
|
|
84
|
+
binaryName,
|
|
85
|
+
force: userForce,
|
|
86
|
+
package: packageSpec,
|
|
87
|
+
yes
|
|
88
|
+
} = {
|
|
89
|
+
__proto__: null,
|
|
90
|
+
...options
|
|
91
|
+
};
|
|
92
|
+
const { name: packageName, version: packageVersion } = parsePackageSpec(packageSpec);
|
|
93
|
+
const isVersionRange = packageVersion !== void 0 && rangeOperatorsRegExp.test(packageVersion);
|
|
94
|
+
const force = userForce !== void 0 ? userForce : yes === true ? true : isVersionRange;
|
|
95
|
+
const fullPackageSpec = packageVersion ? `${packageName}@${packageVersion}` : packageName;
|
|
96
|
+
const { installed, packageDir } = await ensurePackageInstalled(
|
|
97
|
+
packageName,
|
|
98
|
+
fullPackageSpec,
|
|
99
|
+
force
|
|
100
|
+
);
|
|
101
|
+
const binaryPath = findBinaryPath(packageDir, packageName, binaryName);
|
|
102
|
+
makePackageBinsExecutable(packageDir, packageName);
|
|
103
|
+
return {
|
|
104
|
+
binaryPath,
|
|
105
|
+
installed,
|
|
106
|
+
packageDir
|
|
107
|
+
};
|
|
82
108
|
}
|
|
83
109
|
async function ensurePackageInstalled(packageName, packageSpec, force) {
|
|
84
110
|
const fs = /* @__PURE__ */ getFs();
|
|
@@ -172,19 +198,13 @@ Check npm registry connectivity or package name.`,
|
|
|
172
198
|
}
|
|
173
199
|
);
|
|
174
200
|
}
|
|
175
|
-
function
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
const testPath = basePath + ext;
|
|
183
|
-
if (fs.existsSync(testPath)) {
|
|
184
|
-
return testPath;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
return basePath;
|
|
201
|
+
function executePackage(binaryPath, args, spawnOptions, spawnExtra) {
|
|
202
|
+
const needsShell = import_platform.WIN32 && /\.(?:bat|cmd|ps1)$/i.test(binaryPath);
|
|
203
|
+
const finalOptions = needsShell ? {
|
|
204
|
+
...spawnOptions,
|
|
205
|
+
shell: true
|
|
206
|
+
} : spawnOptions;
|
|
207
|
+
return (0, import_spawn.spawn)(binaryPath, args, finalOptions, spawnExtra);
|
|
188
208
|
}
|
|
189
209
|
function findBinaryPath(packageDir, packageName, binaryName) {
|
|
190
210
|
const path = /* @__PURE__ */ getPath();
|
|
@@ -240,19 +260,6 @@ function findBinaryPath(packageDir, packageName, binaryName) {
|
|
|
240
260
|
const rawPath = (0, import_normalize.normalizePath)(path.join(installedDir, binPath));
|
|
241
261
|
return resolveBinaryPath(rawPath);
|
|
242
262
|
}
|
|
243
|
-
async function dlxPackage(args, options, spawnExtra) {
|
|
244
|
-
const downloadResult = await downloadPackage(options);
|
|
245
|
-
const spawnPromise = executePackage(
|
|
246
|
-
downloadResult.binaryPath,
|
|
247
|
-
args,
|
|
248
|
-
options?.spawnOptions,
|
|
249
|
-
spawnExtra
|
|
250
|
-
);
|
|
251
|
-
return {
|
|
252
|
-
...downloadResult,
|
|
253
|
-
spawnPromise
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
263
|
function makePackageBinsExecutable(packageDir, packageName) {
|
|
257
264
|
if (import_platform.WIN32) {
|
|
258
265
|
return;
|
|
@@ -288,44 +295,47 @@ function makePackageBinsExecutable(packageDir, packageName) {
|
|
|
288
295
|
} catch {
|
|
289
296
|
}
|
|
290
297
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
);
|
|
310
|
-
const binaryPath = findBinaryPath(packageDir, packageName, binaryName);
|
|
311
|
-
makePackageBinsExecutable(packageDir, packageName);
|
|
312
|
-
return {
|
|
313
|
-
binaryPath,
|
|
314
|
-
installed,
|
|
315
|
-
packageDir
|
|
316
|
-
};
|
|
298
|
+
function parsePackageSpec(spec) {
|
|
299
|
+
try {
|
|
300
|
+
const parsed = (0, import_npm_package_arg.default)(spec);
|
|
301
|
+
const version = parsed.type === "tag" ? parsed.fetchSpec : parsed.type === "version" || parsed.type === "range" ? parsed.fetchSpec : void 0;
|
|
302
|
+
return {
|
|
303
|
+
name: parsed.name || spec,
|
|
304
|
+
version
|
|
305
|
+
};
|
|
306
|
+
} catch {
|
|
307
|
+
const atIndex = spec.lastIndexOf("@");
|
|
308
|
+
if (atIndex === -1 || atIndex === 0) {
|
|
309
|
+
return { name: spec, version: void 0 };
|
|
310
|
+
}
|
|
311
|
+
return {
|
|
312
|
+
name: spec.slice(0, atIndex),
|
|
313
|
+
version: spec.slice(atIndex + 1)
|
|
314
|
+
};
|
|
315
|
+
}
|
|
317
316
|
}
|
|
318
|
-
function
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
317
|
+
function resolveBinaryPath(basePath) {
|
|
318
|
+
if (!import_platform.WIN32) {
|
|
319
|
+
return basePath;
|
|
320
|
+
}
|
|
321
|
+
const fs = /* @__PURE__ */ getFs();
|
|
322
|
+
const extensions = [".cmd", ".bat", ".ps1", ".exe", ""];
|
|
323
|
+
for (const ext of extensions) {
|
|
324
|
+
const testPath = basePath + ext;
|
|
325
|
+
if (fs.existsSync(testPath)) {
|
|
326
|
+
return testPath;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return basePath;
|
|
325
330
|
}
|
|
326
331
|
// Annotate the CommonJS export names for ESM import in node:
|
|
327
332
|
0 && (module.exports = {
|
|
328
333
|
dlxPackage,
|
|
329
334
|
downloadPackage,
|
|
330
|
-
|
|
335
|
+
ensurePackageInstalled,
|
|
336
|
+
executePackage,
|
|
337
|
+
findBinaryPath,
|
|
338
|
+
makePackageBinsExecutable,
|
|
339
|
+
parsePackageSpec,
|
|
340
|
+
resolveBinaryPath
|
|
331
341
|
});
|
package/dist/env/ci.js
CHANGED
|
@@ -22,11 +22,10 @@ __export(ci_exports, {
|
|
|
22
22
|
getCI: () => getCI
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(ci_exports);
|
|
25
|
-
var import_helpers = require("./helpers");
|
|
26
25
|
var import_rewire = require("./rewire");
|
|
27
26
|
// @__NO_SIDE_EFFECTS__
|
|
28
27
|
function getCI() {
|
|
29
|
-
return (0,
|
|
28
|
+
return (0, import_rewire.isInEnv)("CI");
|
|
30
29
|
}
|
|
31
30
|
// Annotate the CommonJS export names for ESM import in node:
|
|
32
31
|
0 && (module.exports = {
|
package/dist/env/rewire.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clear a specific environment variable override.
|
|
3
|
+
*/
|
|
4
|
+
export declare function clearEnv(key: string): void;
|
|
1
5
|
/**
|
|
2
6
|
* Get an environment variable value, checking overrides first.
|
|
3
7
|
*
|
|
@@ -9,6 +13,35 @@
|
|
|
9
13
|
* @internal Used by env getters to support test rewiring
|
|
10
14
|
*/
|
|
11
15
|
export declare function getEnvValue(key: string): string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Check if an environment variable has been overridden.
|
|
18
|
+
*/
|
|
19
|
+
export declare function hasOverride(key: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Check if an environment variable exists (has a key), checking overrides first.
|
|
22
|
+
*
|
|
23
|
+
* Resolution order:
|
|
24
|
+
* 1. Isolated overrides (temporary - set via withEnv/withEnvSync)
|
|
25
|
+
* 2. Shared overrides (persistent - set via setEnv in beforeEach)
|
|
26
|
+
* 3. process.env (including vi.stubEnv modifications)
|
|
27
|
+
*
|
|
28
|
+
* @internal Used by env getters to check for key presence (not value truthiness)
|
|
29
|
+
*/
|
|
30
|
+
export declare function isInEnv(key: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Clear all environment variable overrides.
|
|
33
|
+
* Useful in afterEach hooks to ensure clean test state.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* import { resetEnv } from './rewire'
|
|
38
|
+
*
|
|
39
|
+
* afterEach(() => {
|
|
40
|
+
* resetEnv()
|
|
41
|
+
* })
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function resetEnv(): void;
|
|
12
45
|
/**
|
|
13
46
|
* Set an environment variable override for testing.
|
|
14
47
|
* This does not modify process.env, only affects env getters.
|
|
@@ -35,28 +68,6 @@ export declare function getEnvValue(key: string): string | undefined;
|
|
|
35
68
|
* ```
|
|
36
69
|
*/
|
|
37
70
|
export declare function setEnv(key: string, value: string | undefined): void;
|
|
38
|
-
/**
|
|
39
|
-
* Clear a specific environment variable override.
|
|
40
|
-
*/
|
|
41
|
-
export declare function clearEnv(key: string): void;
|
|
42
|
-
/**
|
|
43
|
-
* Clear all environment variable overrides.
|
|
44
|
-
* Useful in afterEach hooks to ensure clean test state.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```typescript
|
|
48
|
-
* import { resetEnv } from './rewire'
|
|
49
|
-
*
|
|
50
|
-
* afterEach(() => {
|
|
51
|
-
* resetEnv()
|
|
52
|
-
* })
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
export declare function resetEnv(): void;
|
|
56
|
-
/**
|
|
57
|
-
* Check if an environment variable has been overridden.
|
|
58
|
-
*/
|
|
59
|
-
export declare function hasOverride(key: string): boolean;
|
|
60
71
|
/**
|
|
61
72
|
* Run code with environment overrides in an isolated AsyncLocalStorage context.
|
|
62
73
|
* Creates true context isolation - overrides don't leak to concurrent code.
|
package/dist/env/rewire.js
CHANGED
|
@@ -22,12 +22,14 @@ __export(rewire_exports, {
|
|
|
22
22
|
clearEnv: () => clearEnv,
|
|
23
23
|
getEnvValue: () => getEnvValue,
|
|
24
24
|
hasOverride: () => hasOverride,
|
|
25
|
+
isInEnv: () => isInEnv,
|
|
25
26
|
resetEnv: () => resetEnv,
|
|
26
27
|
setEnv: () => setEnv,
|
|
27
28
|
withEnv: () => withEnv,
|
|
28
29
|
withEnvSync: () => withEnvSync
|
|
29
30
|
});
|
|
30
31
|
module.exports = __toCommonJS(rewire_exports);
|
|
32
|
+
var import_objects = require("../objects");
|
|
31
33
|
var import_helpers = require("./helpers");
|
|
32
34
|
let _async_hooks;
|
|
33
35
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -47,6 +49,9 @@ if (isVitestEnv && !globalThis[sharedOverridesSymbol]) {
|
|
|
47
49
|
globalThis[sharedOverridesSymbol] = /* @__PURE__ */ new Map();
|
|
48
50
|
}
|
|
49
51
|
const sharedOverrides = globalThis[sharedOverridesSymbol];
|
|
52
|
+
function clearEnv(key) {
|
|
53
|
+
sharedOverrides?.delete(key);
|
|
54
|
+
}
|
|
50
55
|
function getEnvValue(key) {
|
|
51
56
|
const isolatedOverrides = isolatedOverridesStorage.getStore();
|
|
52
57
|
if (isolatedOverrides?.has(key)) {
|
|
@@ -57,18 +62,25 @@ function getEnvValue(key) {
|
|
|
57
62
|
}
|
|
58
63
|
return process.env[key];
|
|
59
64
|
}
|
|
60
|
-
function
|
|
61
|
-
|
|
65
|
+
function hasOverride(key) {
|
|
66
|
+
const isolatedOverrides = isolatedOverridesStorage.getStore();
|
|
67
|
+
return !!(isolatedOverrides?.has(key) || sharedOverrides?.has(key));
|
|
62
68
|
}
|
|
63
|
-
function
|
|
64
|
-
|
|
69
|
+
function isInEnv(key) {
|
|
70
|
+
const isolatedOverrides = isolatedOverridesStorage.getStore();
|
|
71
|
+
if (isolatedOverrides?.has(key)) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
if (sharedOverrides?.has(key)) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
return (0, import_objects.hasOwn)(process.env, key);
|
|
65
78
|
}
|
|
66
79
|
function resetEnv() {
|
|
67
80
|
sharedOverrides?.clear();
|
|
68
81
|
}
|
|
69
|
-
function
|
|
70
|
-
|
|
71
|
-
return !!(isolatedOverrides?.has(key) || sharedOverrides?.has(key));
|
|
82
|
+
function setEnv(key, value) {
|
|
83
|
+
sharedOverrides?.set(key, value);
|
|
72
84
|
}
|
|
73
85
|
async function withEnv(overrides, fn) {
|
|
74
86
|
const map = new Map(Object.entries(overrides));
|
|
@@ -83,6 +95,7 @@ function withEnvSync(overrides, fn) {
|
|
|
83
95
|
clearEnv,
|
|
84
96
|
getEnvValue,
|
|
85
97
|
hasOverride,
|
|
98
|
+
isInEnv,
|
|
86
99
|
resetEnv,
|
|
87
100
|
setEnv,
|
|
88
101
|
withEnv,
|
package/dist/env/socket-cli.d.ts
CHANGED
|
@@ -38,6 +38,22 @@ export declare function getSocketCliApiTimeout(): number;
|
|
|
38
38
|
*/
|
|
39
39
|
/*@__NO_SIDE_EFFECTS__*/
|
|
40
40
|
export declare function getSocketCliApiToken(): string | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Bootstrap cache directory path.
|
|
43
|
+
* Set by bootstrap wrappers to pass dlx cache location to CLI.
|
|
44
|
+
*
|
|
45
|
+
* @returns Bootstrap cache directory or undefined
|
|
46
|
+
*/
|
|
47
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
48
|
+
export declare function getSocketCliBootstrapCacheDir(): string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Bootstrap package spec (e.g., @socketsecurity/cli@^2.0.11).
|
|
51
|
+
* Set by bootstrap wrappers (SEA/smol/npm) to pass package spec to CLI.
|
|
52
|
+
*
|
|
53
|
+
* @returns Bootstrap package spec or undefined
|
|
54
|
+
*/
|
|
55
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
56
|
+
export declare function getSocketCliBootstrapSpec(): string | undefined;
|
|
41
57
|
/**
|
|
42
58
|
* Socket CLI configuration file path (alternative name).
|
|
43
59
|
*
|
|
@@ -52,6 +68,14 @@ export declare function getSocketCliConfig(): string | undefined;
|
|
|
52
68
|
*/
|
|
53
69
|
/*@__NO_SIDE_EFFECTS__*/
|
|
54
70
|
export declare function getSocketCliFix(): string | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Socket CLI GitHub authentication token.
|
|
73
|
+
* Checks SOCKET_CLI_GITHUB_TOKEN, SOCKET_SECURITY_GITHUB_PAT, then falls back to GITHUB_TOKEN.
|
|
74
|
+
*
|
|
75
|
+
* @returns GitHub token or undefined
|
|
76
|
+
*/
|
|
77
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
78
|
+
export declare function getSocketCliGithubToken(): string | undefined;
|
|
55
79
|
/**
|
|
56
80
|
* Whether to skip Socket CLI API token requirement (alternative name).
|
|
57
81
|
*
|
|
@@ -81,27 +105,3 @@ export declare function getSocketCliOrgSlug(): string | undefined;
|
|
|
81
105
|
*/
|
|
82
106
|
/*@__NO_SIDE_EFFECTS__*/
|
|
83
107
|
export declare function getSocketCliViewAllRisks(): boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Socket CLI GitHub authentication token.
|
|
86
|
-
* Checks SOCKET_CLI_GITHUB_TOKEN, SOCKET_SECURITY_GITHUB_PAT, then falls back to GITHUB_TOKEN.
|
|
87
|
-
*
|
|
88
|
-
* @returns GitHub token or undefined
|
|
89
|
-
*/
|
|
90
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
91
|
-
export declare function getSocketCliGithubToken(): string | undefined;
|
|
92
|
-
/**
|
|
93
|
-
* Bootstrap package spec (e.g., @socketsecurity/cli@^2.0.11).
|
|
94
|
-
* Set by bootstrap wrappers (SEA/smol/npm) to pass package spec to CLI.
|
|
95
|
-
*
|
|
96
|
-
* @returns Bootstrap package spec or undefined
|
|
97
|
-
*/
|
|
98
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
99
|
-
export declare function getSocketCliBootstrapSpec(): string | undefined;
|
|
100
|
-
/**
|
|
101
|
-
* Bootstrap cache directory path.
|
|
102
|
-
* Set by bootstrap wrappers to pass dlx cache location to CLI.
|
|
103
|
-
*
|
|
104
|
-
* @returns Bootstrap cache directory or undefined
|
|
105
|
-
*/
|
|
106
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
107
|
-
export declare function getSocketCliBootstrapCacheDir(): string | undefined;
|
package/dist/env/socket-cli.js
CHANGED
|
@@ -58,6 +58,14 @@ function getSocketCliApiToken() {
|
|
|
58
58
|
return (0, import_rewire.getEnvValue)("SOCKET_CLI_API_TOKEN") || (0, import_rewire.getEnvValue)("SOCKET_CLI_API_KEY") || (0, import_rewire.getEnvValue)("SOCKET_SECURITY_API_TOKEN") || (0, import_rewire.getEnvValue)("SOCKET_SECURITY_API_KEY");
|
|
59
59
|
}
|
|
60
60
|
// @__NO_SIDE_EFFECTS__
|
|
61
|
+
function getSocketCliBootstrapCacheDir() {
|
|
62
|
+
return (0, import_rewire.getEnvValue)("SOCKET_CLI_BOOTSTRAP_CACHE_DIR");
|
|
63
|
+
}
|
|
64
|
+
// @__NO_SIDE_EFFECTS__
|
|
65
|
+
function getSocketCliBootstrapSpec() {
|
|
66
|
+
return (0, import_rewire.getEnvValue)("SOCKET_CLI_BOOTSTRAP_SPEC");
|
|
67
|
+
}
|
|
68
|
+
// @__NO_SIDE_EFFECTS__
|
|
61
69
|
function getSocketCliConfig() {
|
|
62
70
|
return (0, import_rewire.getEnvValue)("SOCKET_CLI_CONFIG");
|
|
63
71
|
}
|
|
@@ -66,6 +74,10 @@ function getSocketCliFix() {
|
|
|
66
74
|
return (0, import_rewire.getEnvValue)("SOCKET_CLI_FIX");
|
|
67
75
|
}
|
|
68
76
|
// @__NO_SIDE_EFFECTS__
|
|
77
|
+
function getSocketCliGithubToken() {
|
|
78
|
+
return (0, import_rewire.getEnvValue)("SOCKET_CLI_GITHUB_TOKEN") || (0, import_rewire.getEnvValue)("SOCKET_SECURITY_GITHUB_PAT") || (0, import_rewire.getEnvValue)("GITHUB_TOKEN");
|
|
79
|
+
}
|
|
80
|
+
// @__NO_SIDE_EFFECTS__
|
|
69
81
|
function getSocketCliNoApiToken() {
|
|
70
82
|
return (0, import_helpers.envAsBoolean)((0, import_rewire.getEnvValue)("SOCKET_CLI_NO_API_TOKEN"));
|
|
71
83
|
}
|
|
@@ -81,18 +93,6 @@ function getSocketCliOrgSlug() {
|
|
|
81
93
|
function getSocketCliViewAllRisks() {
|
|
82
94
|
return (0, import_helpers.envAsBoolean)((0, import_rewire.getEnvValue)("SOCKET_CLI_VIEW_ALL_RISKS"));
|
|
83
95
|
}
|
|
84
|
-
// @__NO_SIDE_EFFECTS__
|
|
85
|
-
function getSocketCliGithubToken() {
|
|
86
|
-
return (0, import_rewire.getEnvValue)("SOCKET_CLI_GITHUB_TOKEN") || (0, import_rewire.getEnvValue)("SOCKET_SECURITY_GITHUB_PAT") || (0, import_rewire.getEnvValue)("GITHUB_TOKEN");
|
|
87
|
-
}
|
|
88
|
-
// @__NO_SIDE_EFFECTS__
|
|
89
|
-
function getSocketCliBootstrapSpec() {
|
|
90
|
-
return (0, import_rewire.getEnvValue)("SOCKET_CLI_BOOTSTRAP_SPEC");
|
|
91
|
-
}
|
|
92
|
-
// @__NO_SIDE_EFFECTS__
|
|
93
|
-
function getSocketCliBootstrapCacheDir() {
|
|
94
|
-
return (0, import_rewire.getEnvValue)("SOCKET_CLI_BOOTSTRAP_CACHE_DIR");
|
|
95
|
-
}
|
|
96
96
|
// Annotate the CommonJS export names for ESM import in node:
|
|
97
97
|
0 && (module.exports = {
|
|
98
98
|
getSocketCliAcceptRisks,
|
package/dist/env/temp-dir.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TMPDIR environment variable.
|
|
3
|
-
* Unix/macOS temporary directory path.
|
|
4
|
-
*/
|
|
5
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
6
|
-
export declare function getTmpdir(): string | undefined;
|
|
7
1
|
/**
|
|
8
2
|
* TEMP environment variable.
|
|
9
3
|
* Windows temporary directory path.
|
|
@@ -16,3 +10,9 @@ export declare function getTemp(): string | undefined;
|
|
|
16
10
|
*/
|
|
17
11
|
/*@__NO_SIDE_EFFECTS__*/
|
|
18
12
|
export declare function getTmp(): string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* TMPDIR environment variable.
|
|
15
|
+
* Unix/macOS temporary directory path.
|
|
16
|
+
*/
|
|
17
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
18
|
+
export declare function getTmpdir(): string | undefined;
|
package/dist/env/temp-dir.js
CHANGED
|
@@ -26,10 +26,6 @@ __export(temp_dir_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(temp_dir_exports);
|
|
27
27
|
var import_rewire = require("./rewire");
|
|
28
28
|
// @__NO_SIDE_EFFECTS__
|
|
29
|
-
function getTmpdir() {
|
|
30
|
-
return (0, import_rewire.getEnvValue)("TMPDIR");
|
|
31
|
-
}
|
|
32
|
-
// @__NO_SIDE_EFFECTS__
|
|
33
29
|
function getTemp() {
|
|
34
30
|
return (0, import_rewire.getEnvValue)("TEMP");
|
|
35
31
|
}
|
|
@@ -37,6 +33,10 @@ function getTemp() {
|
|
|
37
33
|
function getTmp() {
|
|
38
34
|
return (0, import_rewire.getEnvValue)("TMP");
|
|
39
35
|
}
|
|
36
|
+
// @__NO_SIDE_EFFECTS__
|
|
37
|
+
function getTmpdir() {
|
|
38
|
+
return (0, import_rewire.getEnvValue)("TMPDIR");
|
|
39
|
+
}
|
|
40
40
|
// Annotate the CommonJS export names for ESM import in node:
|
|
41
41
|
0 && (module.exports = {
|
|
42
42
|
getTemp,
|
package/dist/env/windows.d.ts
CHANGED
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/*@__NO_SIDE_EFFECTS__*/
|
|
6
6
|
export declare function getAppdata(): string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* COMSPEC environment variable.
|
|
9
|
+
* Points to the Windows command processor (typically cmd.exe).
|
|
10
|
+
*/
|
|
11
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
12
|
+
export declare function getComspec(): string | undefined;
|
|
7
13
|
/**
|
|
8
14
|
* LOCALAPPDATA environment variable.
|
|
9
15
|
* Points to the Local Application Data directory on Windows.
|
|
@@ -16,9 +22,3 @@ export declare function getLocalappdata(): string | undefined;
|
|
|
16
22
|
*/
|
|
17
23
|
/*@__NO_SIDE_EFFECTS__*/
|
|
18
24
|
export declare function getUserprofile(): string | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* COMSPEC environment variable.
|
|
21
|
-
* Points to the Windows command processor (typically cmd.exe).
|
|
22
|
-
*/
|
|
23
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
24
|
-
export declare function getComspec(): string | undefined;
|
package/dist/env/windows.js
CHANGED
|
@@ -31,6 +31,10 @@ function getAppdata() {
|
|
|
31
31
|
return (0, import_rewire.getEnvValue)("APPDATA");
|
|
32
32
|
}
|
|
33
33
|
// @__NO_SIDE_EFFECTS__
|
|
34
|
+
function getComspec() {
|
|
35
|
+
return (0, import_rewire.getEnvValue)("COMSPEC");
|
|
36
|
+
}
|
|
37
|
+
// @__NO_SIDE_EFFECTS__
|
|
34
38
|
function getLocalappdata() {
|
|
35
39
|
return (0, import_rewire.getEnvValue)("LOCALAPPDATA");
|
|
36
40
|
}
|
|
@@ -38,10 +42,6 @@ function getLocalappdata() {
|
|
|
38
42
|
function getUserprofile() {
|
|
39
43
|
return (0, import_rewire.getEnvValue)("USERPROFILE");
|
|
40
44
|
}
|
|
41
|
-
// @__NO_SIDE_EFFECTS__
|
|
42
|
-
function getComspec() {
|
|
43
|
-
return (0, import_rewire.getEnvValue)("COMSPEC");
|
|
44
|
-
}
|
|
45
45
|
// Annotate the CommonJS export names for ESM import in node:
|
|
46
46
|
0 && (module.exports = {
|
|
47
47
|
getAppdata,
|
|
@@ -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/libnpmexec@10.
|
|
14
|
+
// node_modules/.pnpm/libnpmexec@10.2.0_supports-color@10.0.0/node_modules/libnpmexec/lib/get-bin-from-manifest.js
|
|
15
15
|
var require_get_bin_from_manifest = __commonJS({
|
|
16
|
-
"node_modules/.pnpm/libnpmexec@10.
|
|
16
|
+
"node_modules/.pnpm/libnpmexec@10.2.0_supports-color@10.0.0/node_modules/libnpmexec/lib/get-bin-from-manifest.js"(exports2, module2) {
|
|
17
17
|
var getBinFromManifest2 = /* @__PURE__ */ __name((mani) => {
|
|
18
18
|
const bin = mani.bin || {};
|
|
19
19
|
if (new Set(Object.values(bin)).size === 1) {
|
package/dist/github.js
CHANGED
|
@@ -83,7 +83,16 @@ async function fetchGitHub(url, options) {
|
|
|
83
83
|
`GitHub API error ${response.status}: ${response.statusText}`
|
|
84
84
|
);
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
try {
|
|
87
|
+
return JSON.parse(response.body.toString("utf8"));
|
|
88
|
+
} catch (error) {
|
|
89
|
+
throw new Error(
|
|
90
|
+
`Failed to parse GitHub API response: ${error instanceof Error ? error.message : String(error)}
|
|
91
|
+
URL: ${url}
|
|
92
|
+
Response may be malformed or incomplete.`,
|
|
93
|
+
{ cause: error }
|
|
94
|
+
);
|
|
95
|
+
}
|
|
87
96
|
}
|
|
88
97
|
async function resolveRefToSha(owner, repo, ref, options) {
|
|
89
98
|
const opts = {
|