@socketsecurity/lib 5.2.1 → 5.4.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/bin.d.ts +0 -9
  3. package/dist/bin.js +70 -48
  4. package/dist/constants/agents.js +2 -2
  5. package/dist/constants/platform.d.ts +21 -0
  6. package/dist/constants/platform.js +30 -6
  7. package/dist/cover/code.js +13 -5
  8. package/dist/debug.js +1 -1
  9. package/dist/dlx/binary.d.ts +1 -1
  10. package/dist/dlx/binary.js +49 -39
  11. package/dist/dlx/cache.js +10 -2
  12. package/dist/dlx/dir.js +1 -1
  13. package/dist/dlx/manifest.d.ts +2 -1
  14. package/dist/dlx/manifest.js +45 -41
  15. package/dist/dlx/package.js +39 -19
  16. package/dist/dlx/packages.js +1 -1
  17. package/dist/dlx/paths.js +1 -1
  18. package/dist/env/rewire.js +10 -2
  19. package/dist/external/@inquirer/checkbox.js +4 -2528
  20. package/dist/external/@inquirer/confirm.js +4 -2371
  21. package/dist/external/@inquirer/input.js +4 -2395
  22. package/dist/external/@inquirer/password.js +4 -2503
  23. package/dist/external/@inquirer/search.js +4 -2500
  24. package/dist/external/@inquirer/select.js +4 -2617
  25. package/dist/external/del.js +4 -7139
  26. package/dist/external/fast-glob.js +4 -5776
  27. package/dist/external/inquirer-pack.js +4610 -0
  28. package/dist/external/npm-core.js +3 -1
  29. package/dist/external/pico-pack.js +7162 -0
  30. package/dist/external/picomatch.js +4 -1523
  31. package/dist/external/spdx-correct.js +4 -1384
  32. package/dist/external/spdx-expression-parse.js +4 -1047
  33. package/dist/external/spdx-pack.js +1640 -0
  34. package/dist/external/validate-npm-package-name.js +4 -104
  35. package/dist/fs.js +3 -3
  36. package/dist/git.js +41 -38
  37. package/dist/http-request.js +12 -4
  38. package/dist/ipc.js +53 -29
  39. package/dist/json/edit.js +1 -1
  40. package/dist/json/format.js +1 -1
  41. package/dist/logger.js +1 -1
  42. package/dist/packages/edit.js +3 -3
  43. package/dist/packages/isolation.js +45 -23
  44. package/dist/packages/licenses.js +10 -2
  45. package/dist/paths/normalize.js +3 -3
  46. package/dist/paths/packages.js +1 -1
  47. package/dist/paths/socket.d.ts +2 -2
  48. package/dist/paths/socket.js +27 -21
  49. package/dist/process-lock.js +23 -14
  50. package/dist/promises.js +1 -1
  51. package/dist/releases/github.d.ts +82 -137
  52. package/dist/releases/github.js +91 -48
  53. package/dist/releases/socket-btm.d.ts +78 -192
  54. package/dist/releases/socket-btm.js +112 -50
  55. package/dist/signal-exit.js +1 -1
  56. package/dist/spawn.js +11 -4
  57. package/dist/stdio/mask.d.ts +6 -21
  58. package/dist/stdio/mask.js +18 -14
  59. package/dist/themes/context.js +10 -2
  60. package/package.json +3 -2
@@ -1,221 +1,107 @@
1
1
  /**
2
- * Platform type for socket-btm binaries.
2
+ * @fileoverview Socket-btm release download utilities.
3
3
  */
4
- export type Platform = 'darwin' | 'linux' | 'win32';
4
+ import { type Arch, type Libc, type Platform } from '../constants/platform.js';
5
+ import { type AssetPattern } from './github.js';
6
+ export type { Arch, Libc, Platform };
5
7
  /**
6
- * Architecture type for socket-btm binaries.
7
- */
8
- export type Arch = 'arm64' | 'x64';
9
- /**
10
- * Linux libc variant.
11
- */
12
- export type Libc = 'musl' | 'glibc';
13
- /**
14
- * Configuration for downloading socket-btm binary releases.
8
+ * Configuration for downloading socket-btm generic assets.
15
9
  */
16
- export interface SocketBtmBinaryConfig {
17
- /**
18
- * Working directory (defaults to process.cwd()).
19
- */
10
+ export interface SocketBtmAssetConfig {
11
+ /** Asset name or pattern on GitHub. */
12
+ asset: string | AssetPattern;
13
+ /** @internal Discriminator fields */
14
+ bin?: never;
15
+ /** Working directory (defaults to process.cwd()). */
20
16
  cwd?: string;
21
- /**
22
- * Download destination directory.
23
- * Can be absolute or relative to cwd.
24
- * @default 'build/downloaded' (relative to cwd)
25
- *
26
- * Inspired by: gh release download --dir
27
- */
17
+ /** Download destination directory. @default 'build/downloaded' */
28
18
  downloadDir?: string;
29
- /**
30
- * Tool/package name for directory structure and release matching.
31
- * Similar to: brew install <formula>, cargo install <crate>
32
- *
33
- * Examples: 'node-smol', 'binject', 'binflate'
34
- *
35
- * Used for:
36
- * - Directory path: {downloadDir}/{tool}/{platformArch}/
37
- * - Finding release: Searches for tags starting with '{tool}-'
38
- */
39
- tool: string;
40
- /**
41
- * Binary/executable name (without extension).
42
- * Similar to: brew formula→binary mapping (postgresql→psql, imagemagick→magick)
43
- *
44
- * Examples: 'node', 'binject', 'psql', 'magick'
45
- *
46
- * Used to construct:
47
- * - Asset pattern: {bin}-{platform}-{arch}[-musl][.exe]
48
- * - Output filename: {bin} or {bin}.exe
49
- *
50
- * Presence of this field indicates binary download (vs asset download).
51
- *
52
- * @default tool (e.g., 'binject'→'binject', but 'node-smol'→'node-smol')
53
- */
54
- bin?: string;
55
- /**
56
- * Target platform (defaults to current platform).
57
- */
58
- targetPlatform?: Platform;
59
- /**
60
- * Target architecture (defaults to current arch).
61
- */
62
- targetArch?: Arch;
63
- /**
64
- * Linux libc variant (musl or glibc).
65
- * Defaults to musl for Linux for broader compatibility.
66
- * Ignored for non-Linux platforms.
67
- */
68
- libc?: Libc;
69
- /**
70
- * Specific release tag to download.
71
- * Inspired by: gh release download <tag>
72
- *
73
- * If not provided, downloads the latest release matching '{tool}-*' pattern.
74
- *
75
- * Examples: 'node-smol-20260105-c47753c', 'binject-20260106-1df5745'
76
- */
77
- tag?: string;
78
- /**
79
- * Suppress log messages.
80
- * @default false
81
- */
19
+ /** @internal Discriminator fields */
20
+ libc?: never;
21
+ /** Output filename. @default resolved asset name */
22
+ output?: string;
23
+ /** Suppress log messages. @default false */
82
24
  quiet?: boolean;
83
- /**
84
- * Remove macOS quarantine attribute after download.
85
- * Only applies when downloading on macOS for macOS binaries.
86
- * @default true
87
- */
25
+ /** Remove macOS quarantine attribute after download. @default false */
88
26
  removeMacOSQuarantine?: boolean;
89
- // Discriminator: presence of 'asset' means this is NOT a binary config
90
- asset?: never;
27
+ /** Specific release tag to download. */
28
+ tag?: string;
29
+ /** @internal Discriminator fields */
30
+ targetArch?: never;
31
+ /** @internal Discriminator fields */
32
+ targetPlatform?: never;
33
+ /** Tool/package name for directory structure and release matching. */
34
+ tool: string;
91
35
  }
92
36
  /**
93
- * Configuration for downloading socket-btm generic assets.
37
+ * Configuration for downloading socket-btm binary releases.
94
38
  */
95
- export interface SocketBtmAssetConfig {
96
- /**
97
- * Working directory (defaults to process.cwd()).
98
- */
39
+ export interface SocketBtmBinaryConfig {
40
+ /** @internal Discriminator field */
41
+ asset?: never;
42
+ /** Binary/executable name (without extension). @default tool */
43
+ bin?: string;
44
+ /** Working directory (defaults to process.cwd()). */
99
45
  cwd?: string;
100
- /**
101
- * Download destination directory.
102
- * Can be absolute or relative to cwd.
103
- * @default 'build/downloaded' (relative to cwd)
104
- *
105
- * Inspired by: gh release download --dir
106
- */
46
+ /** Download destination directory. @default 'build/downloaded' */
107
47
  downloadDir?: string;
108
- /**
109
- * Tool/package name for directory structure and release matching.
110
- *
111
- * Examples: 'yoga-layout', 'onnxruntime', 'models'
112
- *
113
- * Used for:
114
- * - Directory path: {downloadDir}/{tool}/assets/
115
- * - Finding release: Searches for tags starting with '{tool}-'
116
- */
117
- tool: string;
118
- /**
119
- * Asset name pattern on GitHub.
120
- * Inspired by: gh release download --pattern
121
- *
122
- * Examples: 'yoga-sync.mjs', 'ort-wasm-simd.wasm', '*.onnx'
123
- *
124
- * Presence of this field indicates asset download (vs binary download).
125
- */
126
- asset: string;
127
- /**
128
- * Output filename (e.g., 'yoga-sync.mjs').
129
- * Inspired by: gh release download --output
130
- *
131
- * @default asset (uses the asset name as-is)
132
- */
133
- output?: string;
134
- /**
135
- * Specific release tag to download.
136
- * Inspired by: gh release download <tag>
137
- *
138
- * If not provided, downloads the latest release matching '{tool}-*' pattern.
139
- *
140
- * Examples: 'yoga-layout-v20260106-a39285c', 'onnxruntime-v20260106-a39285c'
141
- */
142
- tag?: string;
143
- /**
144
- * Suppress log messages.
145
- * @default false
146
- */
48
+ /** Linux libc variant. Auto-detected if not specified. */
49
+ libc?: Libc;
50
+ /** Suppress log messages. @default false */
147
51
  quiet?: boolean;
148
- /**
149
- * Remove macOS quarantine attribute after download.
150
- * @default false (not needed for non-executable assets)
151
- */
52
+ /** Remove macOS quarantine attribute after download. @default true */
152
53
  removeMacOSQuarantine?: boolean;
153
- // Discriminators: mutually exclusive with binary-specific fields
154
- bin?: never;
155
- targetPlatform?: never;
156
- targetArch?: never;
157
- libc?: never;
54
+ /** Specific release tag to download. */
55
+ tag?: string;
56
+ /** Target architecture (defaults to current arch). */
57
+ targetArch?: Arch;
58
+ /** Target platform (defaults to current platform). */
59
+ targetPlatform?: Platform;
60
+ /** Tool/package name for directory structure and release matching. */
61
+ tool: string;
158
62
  }
159
63
  /**
160
64
  * Configuration for downloading socket-btm releases (binary or asset).
161
65
  */
162
66
  export type SocketBtmReleaseConfig = SocketBtmBinaryConfig | SocketBtmAssetConfig;
163
67
  /**
164
- * Download a release from socket-btm.
68
+ * Detect the libc variant (musl or glibc) on Linux systems.
69
+ * Returns undefined for non-Linux platforms.
165
70
  *
166
- * Generic function for downloading any socket-btm binary or asset.
167
- * Handles both platform-specific binaries and generic assets.
71
+ * @returns 'musl', 'glibc', or undefined (for non-Linux)
72
+ */
73
+ export declare function detectLibc(): Libc | undefined;
74
+ /**
75
+ * Download a release from socket-btm.
168
76
  *
169
77
  * @param config - Download configuration
170
78
  * @returns Path to the downloaded file
79
+ */
80
+ export declare function downloadSocketBtmRelease(config: SocketBtmReleaseConfig): Promise<string>;
81
+ /**
82
+ * Get asset name for a socket-btm binary.
171
83
  *
172
- * @example
173
- * ```ts
174
- * // Binary: node-smol (like: brew install nodejs → node)
175
- * const nodePath = await downloadSocketBtmRelease({
176
- * tool: 'node-smol',
177
- * bin: 'node'
178
- * })
179
- *
180
- * // Binary: binject (like: cargo install binject → binject)
181
- * const binjectPath = await downloadSocketBtmRelease({
182
- * tool: 'binject'
183
- * })
184
- *
185
- * // Binary: cross-platform
186
- * const binflatePath = await downloadSocketBtmRelease({
187
- * tool: 'binflate',
188
- * targetPlatform: 'linux',
189
- * targetArch: 'x64',
190
- * libc: 'musl'
191
- * })
192
- *
193
- * // Asset: WASM file
194
- * const yogaPath = await downloadSocketBtmRelease({
195
- * tool: 'yoga-layout',
196
- * asset: 'yoga-sync.mjs'
197
- * })
198
- *
199
- * // Asset: with custom output name
200
- * const ortPath = await downloadSocketBtmRelease({
201
- * tool: 'onnxruntime',
202
- * asset: 'ort-wasm-simd.wasm',
203
- * output: 'ort.wasm'
204
- * })
84
+ * @param binaryBaseName - Binary basename (e.g., 'binject', 'node')
85
+ * @param platform - Target platform
86
+ * @param arch - Target architecture
87
+ * @param libc - Linux libc variant (optional)
88
+ * @returns Asset name (e.g., 'binject-darwin-arm64', 'node-linux-x64-musl')
89
+ */
90
+ export declare function getBinaryAssetName(binaryBaseName: string, platform: Platform, arch: Arch, libc?: Libc | undefined): string;
91
+ /**
92
+ * Get binary filename for output.
205
93
  *
206
- * // Custom paths (like: gh release download --dir)
207
- * await downloadSocketBtmRelease({
208
- * tool: 'node-smol',
209
- * bin: 'node',
210
- * cwd: '/path/to/project',
211
- * downloadDir: 'build/cache'
212
- * })
94
+ * @param binaryBaseName - Binary basename (e.g., 'node', 'binject')
95
+ * @param platform - Target platform
96
+ * @returns Binary filename (e.g., 'node', 'node.exe')
97
+ */
98
+ export declare function getBinaryName(binaryBaseName: string, platform: Platform): string;
99
+ /**
100
+ * Get platform-arch identifier for directory structure.
213
101
  *
214
- * // Specific version (like: gh release download <tag>)
215
- * await downloadSocketBtmRelease({
216
- * tool: 'binject',
217
- * tag: 'binject-20260106-1df5745'
218
- * })
219
- * ```
102
+ * @param platform - Target platform
103
+ * @param arch - Target architecture
104
+ * @param libc - Linux libc variant (optional)
105
+ * @returns Platform-arch identifier (e.g., 'darwin-arm64', 'linux-x64-musl')
220
106
  */
221
- export declare function downloadSocketBtmRelease(config: SocketBtmReleaseConfig): Promise<string>;
107
+ export declare function getPlatformArch(platform: Platform, arch: Arch, libc?: Libc | undefined): string;
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
- var __create = Object.create;
4
3
  var __defProp = Object.defineProperty;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
7
  var __export = (target, all) => {
10
8
  for (var name in all)
@@ -18,54 +16,52 @@ var __copyProps = (to, from, except, desc) => {
18
16
  }
19
17
  return to;
20
18
  };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
20
  var socket_btm_exports = {};
31
21
  __export(socket_btm_exports, {
32
- downloadSocketBtmRelease: () => downloadSocketBtmRelease
22
+ detectLibc: () => detectLibc,
23
+ downloadSocketBtmRelease: () => downloadSocketBtmRelease,
24
+ getBinaryAssetName: () => getBinaryAssetName,
25
+ getBinaryName: () => getBinaryName,
26
+ getPlatformArch: () => getPlatformArch
33
27
  });
34
28
  module.exports = __toCommonJS(socket_btm_exports);
35
- var import_node_os = __toESM(require("node:os"));
29
+ var import_platform = require("../constants/platform.js");
36
30
  var import_github = require("./github.js");
37
31
  const ARCH_MAP = {
32
+ __proto__: null,
38
33
  arm64: "arm64",
39
34
  x64: "x64"
40
35
  };
41
- function getBinaryAssetName(binaryBaseName, platform, arch, libc) {
42
- const mappedArch = ARCH_MAP[arch];
43
- if (!mappedArch) {
44
- throw new Error(`Unsupported architecture: ${arch}`);
45
- }
46
- const muslSuffix = platform === "linux" && libc === "musl" ? "-musl" : "";
47
- const ext = platform === "win32" ? ".exe" : "";
48
- if (platform === "darwin") {
49
- return `${binaryBaseName}-darwin-${mappedArch}${ext}`;
50
- }
51
- if (platform === "linux") {
52
- return `${binaryBaseName}-linux-${mappedArch}${muslSuffix}${ext}`;
53
- }
54
- if (platform === "win32") {
55
- return `${binaryBaseName}-win-${mappedArch}${ext}`;
36
+ let _fs;
37
+ // @__NO_SIDE_EFFECTS__
38
+ function getFs() {
39
+ if (_fs === void 0) {
40
+ _fs = require("fs");
56
41
  }
57
- throw new Error(`Unsupported platform: ${platform}`);
42
+ return _fs;
58
43
  }
59
- function getPlatformArch(platform, arch, libc) {
60
- const mappedArch = ARCH_MAP[arch];
61
- if (!mappedArch) {
62
- throw new Error(`Unsupported architecture: ${arch}`);
44
+ function detectLibc() {
45
+ if ((0, import_platform.getPlatform)() !== "linux") {
46
+ return void 0;
47
+ }
48
+ try {
49
+ const fs = /* @__PURE__ */ getFs();
50
+ const muslPaths = [
51
+ "/lib/ld-musl-x86_64.so.1",
52
+ "/lib/ld-musl-aarch64.so.1",
53
+ "/usr/lib/ld-musl-x86_64.so.1",
54
+ "/usr/lib/ld-musl-aarch64.so.1"
55
+ ];
56
+ for (const path of muslPaths) {
57
+ if (fs.existsSync(path)) {
58
+ return "musl";
59
+ }
60
+ }
61
+ return "glibc";
62
+ } catch {
63
+ return "glibc";
63
64
  }
64
- const muslSuffix = platform === "linux" && libc === "musl" ? "-musl" : "";
65
- return `${platform}-${mappedArch}${muslSuffix}`;
66
- }
67
- function getBinaryName(binaryBaseName, platform) {
68
- return platform === "win32" ? `${binaryBaseName}.exe` : binaryBaseName;
69
65
  }
70
66
  async function downloadSocketBtmRelease(config) {
71
67
  const { cwd, downloadDir, quiet = false, tag, tool } = config;
@@ -77,7 +73,38 @@ async function downloadSocketBtmRelease(config) {
77
73
  output,
78
74
  removeMacOSQuarantine = false
79
75
  } = config;
80
- const outputName = output || asset;
76
+ let resolvedAsset;
77
+ let resolvedTag = tag;
78
+ const isExactMatch = typeof asset === "string" && !asset.includes("*");
79
+ if (isExactMatch) {
80
+ resolvedAsset = asset;
81
+ } else {
82
+ if (tag) {
83
+ throw new Error(
84
+ "Cannot use asset pattern with explicit tag. Either provide exact asset name or omit tag."
85
+ );
86
+ }
87
+ resolvedTag = await (0, import_github.getLatestRelease)(toolPrefix, import_github.SOCKET_BTM_REPO, {
88
+ assetPattern: asset,
89
+ quiet
90
+ });
91
+ if (!resolvedTag) {
92
+ throw new Error(`No ${tool} release with matching asset pattern found`);
93
+ }
94
+ const assetUrl = await (0, import_github.getReleaseAssetUrl)(
95
+ resolvedTag,
96
+ asset,
97
+ import_github.SOCKET_BTM_REPO,
98
+ {
99
+ quiet
100
+ }
101
+ );
102
+ if (!assetUrl) {
103
+ throw new Error(`No matching asset found in release ${resolvedTag}`);
104
+ }
105
+ resolvedAsset = assetUrl.split("/").pop() || asset.toString();
106
+ }
107
+ const outputName = output || resolvedAsset;
81
108
  const platformArch = "assets";
82
109
  downloadConfig = {
83
110
  owner: import_github.SOCKET_BTM_REPO.owner,
@@ -87,27 +114,29 @@ async function downloadSocketBtmRelease(config) {
87
114
  toolName: tool,
88
115
  platformArch,
89
116
  binaryName: outputName,
90
- assetName: asset,
117
+ assetName: resolvedAsset,
91
118
  toolPrefix,
92
- tag,
119
+ tag: resolvedTag,
93
120
  quiet,
94
121
  removeMacOSQuarantine
95
122
  };
96
123
  } else {
97
124
  const {
98
125
  bin,
99
- libc,
126
+ libc = detectLibc(),
100
127
  removeMacOSQuarantine = true,
101
- targetArch,
102
- targetPlatform
128
+ targetArch = (0, import_platform.getArch)(),
129
+ targetPlatform = (0, import_platform.getPlatform)()
103
130
  } = config;
104
131
  const baseName = bin || tool;
105
- const platform = targetPlatform || import_node_os.default.platform();
106
- const arch = targetArch || import_node_os.default.arch();
107
- const libcType = libc || (platform === "linux" ? "musl" : void 0);
108
- const assetName = getBinaryAssetName(baseName, platform, arch, libcType);
109
- const platformArch = getPlatformArch(platform, arch, libcType);
110
- const binaryName = getBinaryName(baseName, platform);
132
+ const assetName = getBinaryAssetName(
133
+ baseName,
134
+ targetPlatform,
135
+ targetArch,
136
+ libc
137
+ );
138
+ const platformArch = getPlatformArch(targetPlatform, targetArch, libc);
139
+ const binaryName = getBinaryName(baseName, targetPlatform);
111
140
  downloadConfig = {
112
141
  owner: import_github.SOCKET_BTM_REPO.owner,
113
142
  repo: import_github.SOCKET_BTM_REPO.repo,
@@ -125,7 +154,40 @@ async function downloadSocketBtmRelease(config) {
125
154
  }
126
155
  return await (0, import_github.downloadGitHubRelease)(downloadConfig);
127
156
  }
157
+ function getBinaryAssetName(binaryBaseName, platform, arch, libc) {
158
+ const mappedArch = ARCH_MAP[arch];
159
+ if (!mappedArch) {
160
+ throw new Error(`Unsupported architecture: ${arch}`);
161
+ }
162
+ const muslSuffix = platform === "linux" && libc === "musl" ? "-musl" : "";
163
+ const ext = platform === "win32" ? ".exe" : "";
164
+ if (platform === "darwin") {
165
+ return `${binaryBaseName}-darwin-${mappedArch}${ext}`;
166
+ }
167
+ if (platform === "linux") {
168
+ return `${binaryBaseName}-linux-${mappedArch}${muslSuffix}${ext}`;
169
+ }
170
+ if (platform === "win32") {
171
+ return `${binaryBaseName}-win-${mappedArch}${ext}`;
172
+ }
173
+ throw new Error(`Unsupported platform: ${platform}`);
174
+ }
175
+ function getBinaryName(binaryBaseName, platform) {
176
+ return platform === "win32" ? `${binaryBaseName}.exe` : binaryBaseName;
177
+ }
178
+ function getPlatformArch(platform, arch, libc) {
179
+ const mappedArch = ARCH_MAP[arch];
180
+ if (!mappedArch) {
181
+ throw new Error(`Unsupported architecture: ${arch}`);
182
+ }
183
+ const muslSuffix = platform === "linux" && libc === "musl" ? "-musl" : "";
184
+ return `${platform}-${mappedArch}${muslSuffix}`;
185
+ }
128
186
  // Annotate the CommonJS export names for ESM import in node:
129
187
  0 && (module.exports = {
130
- downloadSocketBtmRelease
188
+ detectLibc,
189
+ downloadSocketBtmRelease,
190
+ getBinaryAssetName,
191
+ getBinaryName,
192
+ getPlatformArch
131
193
  });
@@ -35,7 +35,7 @@ let _events;
35
35
  // @__NO_SIDE_EFFECTS__
36
36
  function getEvents() {
37
37
  if (_events === void 0) {
38
- _events = require("node:events");
38
+ _events = require("events");
39
39
  }
40
40
  return _events;
41
41
  }
package/dist/spawn.js CHANGED
@@ -37,13 +37,20 @@ __export(spawn_exports, {
37
37
  module.exports = __toCommonJS(spawn_exports);
38
38
  var import_process = require("./constants/process");
39
39
  var import_promise_spawn = __toESM(require("./external/@npmcli/promise-spawn"));
40
- var import_node_path = __toESM(require("node:path"));
41
40
  var import_arrays = require("./arrays");
42
41
  var import_bin = require("./bin");
43
42
  var import_normalize = require("./paths/normalize");
44
43
  var import_objects = require("./objects");
45
44
  var import_spinner = require("./spinner");
46
45
  var import_strings = require("./strings");
46
+ let _path;
47
+ // @__NO_SIDE_EFFECTS__
48
+ function getPath() {
49
+ if (_path === void 0) {
50
+ _path = require("path");
51
+ }
52
+ return _path;
53
+ }
47
54
  const abortSignal = (0, import_process.getAbortSignal)();
48
55
  const spinner = (0, import_spinner.getDefaultSpinner)();
49
56
  const windowsScriptExtRegExp = /\.(?:cmd|bat|ps1)$/i;
@@ -51,7 +58,7 @@ let _child_process;
51
58
  // @__NO_SIDE_EFFECTS__
52
59
  function getChildProcess() {
53
60
  if (_child_process === void 0) {
54
- _child_process = require("node:child_process");
61
+ _child_process = require("child_process");
55
62
  }
56
63
  return _child_process;
57
64
  }
@@ -102,7 +109,7 @@ function spawn(cmd, args, options, extra) {
102
109
  }
103
110
  const WIN32 = process.platform === "win32";
104
111
  if (WIN32 && shell && windowsScriptExtRegExp.test(actualCmd)) {
105
- actualCmd = import_node_path.default.basename(actualCmd, import_node_path.default.extname(actualCmd));
112
+ actualCmd = (/* @__PURE__ */ getPath()).basename(actualCmd, (/* @__PURE__ */ getPath()).extname(actualCmd));
106
113
  }
107
114
  const wasSpinning = !!spinnerInstance?.isSpinning;
108
115
  const shouldStopSpinner = wasSpinning && !/* @__PURE__ */ isStdioType(stdio, "ignore") && !/* @__PURE__ */ isStdioType(stdio, "pipe");
@@ -181,7 +188,7 @@ function spawnSync(cmd, args, options) {
181
188
  const shell = (0, import_objects.getOwn)(options, "shell");
182
189
  const WIN32 = process.platform === "win32";
183
190
  if (WIN32 && shell && windowsScriptExtRegExp.test(actualCmd)) {
184
- actualCmd = import_node_path.default.basename(actualCmd, import_node_path.default.extname(actualCmd));
191
+ actualCmd = (/* @__PURE__ */ getPath()).basename(actualCmd, (/* @__PURE__ */ getPath()).extname(actualCmd));
185
192
  }
186
193
  const { stripAnsi: shouldStripAnsi = true, ...rawSpawnOptions } = {
187
194
  __proto__: null,
@@ -1,24 +1,4 @@
1
- /**
2
- * @fileoverview Interactive output masking utilities for CLI tools.
3
- * Provides output control with keyboard toggling (ctrl+o).
4
- *
5
- * ANSI Escape Sequences Used:
6
- * - '\r': Carriage return - moves cursor to beginning of current line.
7
- * - '\x1b[K' or '\x1b[0K': CSI K (erase line) - clear from cursor to end of line.
8
- * - '\x1b[2K': CSI 2K - erase entire line.
9
- * - '\x1b[1A': CSI A - move cursor up 1 line.
10
- *
11
- * Terminal Control:
12
- * - Raw mode (setRawMode(true)): Captures keypresses immediately without buffering.
13
- * - TTY detection: Ensures terminal manipulation only occurs in interactive terminals.
14
- *
15
- * Key Features:
16
- * - Output buffering: Stores up to 1000 lines when masked to prevent memory issues.
17
- * - Graceful cleanup: Always restores terminal to normal mode on exit/error.
18
- * - Visual feedback: Uses spinner to indicate process is running when output is masked.
19
- */
20
1
  import type { ChildProcess, SpawnOptions } from 'child_process';
21
- import readline from 'readline';
22
2
  export interface OutputMaskOptions {
23
3
  /**
24
4
  * Current working directory for spawned process.
@@ -120,7 +100,11 @@ export declare function createOutputMask(options?: OutputMaskOptions): OutputMas
120
100
  * - ctrl+c: Cancel the running process.
121
101
  * The handler manipulates terminal state using ANSI escape sequences.
122
102
  */
123
- export declare function createKeyboardHandler(mask: OutputMask, child: ChildProcess, options?: OutputMaskOptions): (_str: string, key: readline.Key) => void;
103
+ type ReadlineKey = {
104
+ ctrl?: boolean;
105
+ name?: string;
106
+ };
107
+ export declare function createKeyboardHandler(mask: OutputMask, child: ChildProcess, options?: OutputMaskOptions): (_str: string, key: ReadlineKey) => void;
124
108
  /**
125
109
  * Attach output masking to a child process.
126
110
  * Returns a promise that resolves with the exit code.
@@ -138,3 +122,4 @@ export declare function attachOutputMask(child: ChildProcess, options?: OutputMa
138
122
  * stdin is inherited, stdout and stderr are piped for masking control.
139
123
  */
140
124
  export declare function runWithMask(command: string, args?: string[], options?: OutputMaskOptions & SpawnOptions): Promise<number>;
125
+ export {};