@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.
@@ -31,7 +31,12 @@ var package_exports = {};
31
31
  __export(package_exports, {
32
32
  dlxPackage: () => dlxPackage,
33
33
  downloadPackage: () => downloadPackage,
34
- executePackage: () => executePackage
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 parsePackageSpec(spec) {
65
- try {
66
- const parsed = (0, import_npm_package_arg.default)(spec);
67
- const version = parsed.type === "tag" ? parsed.fetchSpec : parsed.type === "version" || parsed.type === "range" ? parsed.fetchSpec : void 0;
68
- return {
69
- name: parsed.name || spec,
70
- version
71
- };
72
- } catch {
73
- const atIndex = spec.lastIndexOf("@");
74
- if (atIndex === -1 || spec.startsWith("@")) {
75
- return { name: spec, version: void 0 };
76
- }
77
- return {
78
- name: spec.slice(0, atIndex),
79
- version: spec.slice(atIndex + 1)
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 resolveBinaryPath(basePath) {
176
- if (!import_platform.WIN32) {
177
- return basePath;
178
- }
179
- const fs = /* @__PURE__ */ getFs();
180
- const extensions = [".cmd", ".bat", ".ps1", ".exe", ""];
181
- for (const ext of extensions) {
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
- async function downloadPackage(options) {
292
- const {
293
- binaryName,
294
- force: userForce,
295
- package: packageSpec,
296
- yes
297
- } = {
298
- __proto__: null,
299
- ...options
300
- };
301
- const { name: packageName, version: packageVersion } = parsePackageSpec(packageSpec);
302
- const isVersionRange = packageVersion !== void 0 && rangeOperatorsRegExp.test(packageVersion);
303
- const force = userForce !== void 0 ? userForce : yes === true ? true : isVersionRange;
304
- const fullPackageSpec = packageVersion ? `${packageName}@${packageVersion}` : packageName;
305
- const { installed, packageDir } = await ensurePackageInstalled(
306
- packageName,
307
- fullPackageSpec,
308
- force
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 executePackage(binaryPath, args, spawnOptions, spawnExtra) {
319
- const needsShell = import_platform.WIN32 && /\.(?:bat|cmd|ps1)$/i.test(binaryPath);
320
- const finalOptions = needsShell ? {
321
- ...spawnOptions,
322
- shell: true
323
- } : spawnOptions;
324
- return (0, import_spawn.spawn)(binaryPath, args, finalOptions, spawnExtra);
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
- executePackage
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, import_helpers.envAsBoolean)((0, import_rewire.getEnvValue)("CI"));
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 = {
@@ -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.
@@ -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 setEnv(key, value) {
61
- sharedOverrides?.set(key, value);
65
+ function hasOverride(key) {
66
+ const isolatedOverrides = isolatedOverridesStorage.getStore();
67
+ return !!(isolatedOverrides?.has(key) || sharedOverrides?.has(key));
62
68
  }
63
- function clearEnv(key) {
64
- sharedOverrides?.delete(key);
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 hasOverride(key) {
70
- const isolatedOverrides = isolatedOverridesStorage.getStore();
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,
@@ -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;
@@ -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,
@@ -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;
@@ -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,
@@ -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;
@@ -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.1.11_supports-color@10.0.0/node_modules/libnpmexec/lib/get-bin-from-manifest.js
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.1.11_supports-color@10.0.0/node_modules/libnpmexec/lib/get-bin-from-manifest.js"(exports2, module2) {
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
- return JSON.parse(response.body.toString("utf8"));
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 = {