@socketsecurity/lib 5.25.1 → 5.26.1

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 (147) hide show
  1. package/CHANGELOG.md +344 -1184
  2. package/README.md +1 -1
  3. package/dist/abort.js +7 -6
  4. package/dist/agent.js +16 -15
  5. package/dist/ansi.js +3 -2
  6. package/dist/archives.js +18 -17
  7. package/dist/argv/flags.js +29 -28
  8. package/dist/argv/parse.js +4 -3
  9. package/dist/arrays.js +3 -2
  10. package/dist/bin.js +12 -11
  11. package/dist/cacache.js +16 -11
  12. package/dist/cache-with-ttl.js +26 -21
  13. package/dist/colors.js +2 -1
  14. package/dist/constants/licenses.js +2 -1
  15. package/dist/constants/lifecycle-script-names.js +2 -1
  16. package/dist/constants/maintained-node-versions.js +2 -1
  17. package/dist/constants/node.js +4 -3
  18. package/dist/constants/package-default-socket-categories.js +2 -1
  19. package/dist/constants/packages.js +4 -3
  20. package/dist/constants/socket.js +1 -1
  21. package/dist/cover/code.js +9 -8
  22. package/dist/cover/formatters.js +12 -11
  23. package/dist/cover/type.js +5 -4
  24. package/dist/crypto.d.ts +36 -0
  25. package/dist/{effects/ultra.js → crypto.js} +33 -37
  26. package/dist/debug.js +12 -15
  27. package/dist/dlx/arborist.js +10 -9
  28. package/dist/dlx/binary.js +27 -24
  29. package/dist/dlx/cache.js +2 -10
  30. package/dist/dlx/detect.js +6 -5
  31. package/dist/dlx/integrity.js +13 -11
  32. package/dist/dlx/lockfile.js +7 -6
  33. package/dist/dlx/manifest.js +6 -5
  34. package/dist/dlx/package.js +17 -16
  35. package/dist/dlx/packages.js +6 -5
  36. package/dist/dlx/paths.d.ts +1 -1
  37. package/dist/dlx/paths.js +2 -1
  38. package/dist/effects/pulse-frames.js +4 -3
  39. package/dist/effects/shimmer-keyframes.d.ts +62 -0
  40. package/dist/effects/shimmer-keyframes.js +55 -0
  41. package/dist/effects/shimmer-terminal.d.ts +66 -0
  42. package/dist/effects/shimmer-terminal.js +57 -0
  43. package/dist/effects/shimmer.d.ts +293 -0
  44. package/dist/effects/shimmer.js +180 -0
  45. package/dist/env/rewire.js +4 -3
  46. package/dist/env.js +5 -4
  47. package/dist/errors.js +1 -1
  48. package/dist/external/@npmcli/package-json/lib/read-package.js +10 -10
  49. package/dist/external/@npmcli/package-json.js +372 -372
  50. package/dist/external/@npmcli/promise-spawn.js +24 -24
  51. package/dist/external/@socketregistry/packageurl-js.js +19 -18
  52. package/dist/external/@socketregistry/yocto-spinner.js +4 -3
  53. package/dist/external/@yarnpkg/extensions.js +2 -1
  54. package/dist/external/adm-zip.js +70 -70
  55. package/dist/external/debug.js +22 -22
  56. package/dist/external/external-pack.js +45 -45
  57. package/dist/external/fast-sort.js +5 -5
  58. package/dist/external/libnpmexec.js +4 -3
  59. package/dist/external/npm-pack.js +369 -369
  60. package/dist/external/p-map.js +9 -9
  61. package/dist/external/pico-pack.js +190 -190
  62. package/dist/external/pony-cause.js +2 -1
  63. package/dist/external/spdx-pack.js +11 -10
  64. package/dist/external/tar-fs.js +58 -58
  65. package/dist/external/which.js +13 -13
  66. package/dist/external/yargs-parser.js +71 -71
  67. package/dist/fs.js +19 -23
  68. package/dist/git.js +14 -13
  69. package/dist/github.d.ts +34 -0
  70. package/dist/github.js +248 -23
  71. package/dist/globs.d.ts +20 -0
  72. package/dist/globs.js +134 -25
  73. package/dist/http-request.d.ts +4 -3
  74. package/dist/http-request.js +39 -32
  75. package/dist/ipc-cli.js +2 -1
  76. package/dist/ipc.js +5 -4
  77. package/dist/json/edit.js +4 -3
  78. package/dist/json/format.js +3 -2
  79. package/dist/json/parse.js +7 -6
  80. package/dist/links.js +2 -1
  81. package/dist/logger.js +21 -14
  82. package/dist/memoization.js +16 -15
  83. package/dist/objects.js +2 -2
  84. package/dist/packages/edit.js +8 -7
  85. package/dist/packages/exports.js +17 -16
  86. package/dist/packages/isolation.js +20 -13
  87. package/dist/packages/licenses.js +6 -3
  88. package/dist/packages/manifest.js +2 -1
  89. package/dist/packages/normalize.js +8 -4
  90. package/dist/packages/operations.js +5 -4
  91. package/dist/packages/provenance.js +7 -6
  92. package/dist/packages/specs.js +2 -1
  93. package/dist/packages/validation.js +2 -1
  94. package/dist/paths/normalize.js +32 -40
  95. package/dist/paths/packages.js +2 -1
  96. package/dist/paths/rewire.js +3 -2
  97. package/dist/performance.js +19 -18
  98. package/dist/primordials.d.ts +9 -0
  99. package/dist/primordials.js +17 -0
  100. package/dist/process-lock.js +14 -13
  101. package/dist/promise-queue.js +17 -9
  102. package/dist/promises.d.ts +29 -6
  103. package/dist/promises.js +19 -15
  104. package/dist/regexps.js +9 -8
  105. package/dist/releases/github-api.d.ts +56 -0
  106. package/dist/releases/github-api.js +275 -0
  107. package/dist/releases/github-archives.d.ts +60 -0
  108. package/dist/releases/github-archives.js +136 -0
  109. package/dist/releases/github-assets.d.ts +21 -0
  110. package/dist/releases/github-assets.js +52 -0
  111. package/dist/releases/github-auth.d.ts +16 -0
  112. package/dist/releases/github-auth.js +51 -0
  113. package/dist/releases/github-downloads.d.ts +42 -0
  114. package/dist/releases/github-downloads.js +155 -0
  115. package/dist/releases/github-types.d.ts +66 -0
  116. package/dist/{effects/types.js → releases/github-types.js} +2 -2
  117. package/dist/releases/socket-btm.d.ts +1 -1
  118. package/dist/releases/socket-btm.js +17 -17
  119. package/dist/schema/parse.js +2 -1
  120. package/dist/schema/validate.js +6 -5
  121. package/dist/shadow.js +2 -1
  122. package/dist/signal-exit.js +2 -2
  123. package/dist/spawn.js +45 -35
  124. package/dist/spinner.d.ts +13 -6
  125. package/dist/spinner.js +75 -57
  126. package/dist/ssri.js +8 -7
  127. package/dist/stdio/footer.js +13 -12
  128. package/dist/stdio/header.js +5 -4
  129. package/dist/stdio/progress.js +13 -12
  130. package/dist/strings.js +19 -18
  131. package/dist/suppress-warnings.js +2 -2
  132. package/dist/tables.js +16 -13
  133. package/dist/temporary-executor.js +2 -1
  134. package/dist/themes/context.js +2 -1
  135. package/dist/themes/types.d.ts +1 -1
  136. package/dist/themes/utils.d.ts +8 -3
  137. package/dist/themes/utils.js +29 -5
  138. package/dist/url.js +4 -3
  139. package/package.json +44 -20
  140. package/dist/effects/text-shimmer.d.ts +0 -58
  141. package/dist/effects/text-shimmer.js +0 -192
  142. package/dist/effects/types.d.ts +0 -47
  143. package/dist/effects/ultra.d.ts +0 -22
  144. package/dist/releases/github.d.ts +0 -234
  145. package/dist/releases/github.js +0 -417
  146. package/dist/themes/index.d.ts +0 -49
  147. package/dist/themes/index.js +0 -60
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ /* Socket Lib - Built with esbuild */
3
+ "use strict";
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+ var github_downloads_exports = {};
32
+ __export(github_downloads_exports, {
33
+ downloadGitHubRelease: () => downloadGitHubRelease,
34
+ downloadReleaseAsset: () => downloadReleaseAsset
35
+ });
36
+ module.exports = __toCommonJS(github_downloads_exports);
37
+ var import_node_process = __toESM(require("node:process"));
38
+ var import_fs = require("../fs");
39
+ var import_http_request = require("../http-request");
40
+ var import_logger = require("../logger");
41
+ var import_primordials = require("../primordials");
42
+ var import_spawn = require("../spawn");
43
+ var import_github_api = require("./github-api");
44
+ const logger = (0, import_logger.getDefaultLogger)();
45
+ let _fs;
46
+ let _path;
47
+ // @__NO_SIDE_EFFECTS__
48
+ function getFs() {
49
+ if (_fs === void 0) {
50
+ _fs = require("node:fs");
51
+ }
52
+ return _fs;
53
+ }
54
+ // @__NO_SIDE_EFFECTS__
55
+ function getPath() {
56
+ if (_path === void 0) {
57
+ _path = require("node:path");
58
+ }
59
+ return _path;
60
+ }
61
+ async function downloadGitHubRelease(config) {
62
+ const {
63
+ assetName,
64
+ binaryName,
65
+ cwd = import_node_process.default.cwd(),
66
+ downloadDir = "build/downloaded",
67
+ owner,
68
+ platformArch,
69
+ quiet = false,
70
+ removeMacOSQuarantine = true,
71
+ repo,
72
+ tag: explicitTag,
73
+ toolName,
74
+ toolPrefix
75
+ } = config;
76
+ let tag;
77
+ if (explicitTag) {
78
+ tag = explicitTag;
79
+ } else if (toolPrefix) {
80
+ const latestTag = await (0, import_github_api.getLatestRelease)(toolPrefix, { owner, repo });
81
+ if (!latestTag) {
82
+ throw new import_primordials.ErrorCtor(`No ${toolPrefix} release found in ${owner}/${repo}`);
83
+ }
84
+ tag = latestTag;
85
+ } else {
86
+ throw new import_primordials.ErrorCtor("Either toolPrefix or tag must be provided");
87
+ }
88
+ const path = /* @__PURE__ */ getPath();
89
+ const resolvedDownloadDir = path.isAbsolute(downloadDir) ? downloadDir : path.join(cwd, downloadDir);
90
+ const binaryDir = resolvedDownloadDir;
91
+ const binaryPath = path.join(binaryDir, binaryName);
92
+ const versionPath = path.join(binaryDir, ".version");
93
+ const fs = /* @__PURE__ */ getFs();
94
+ if (fs.existsSync(versionPath) && fs.existsSync(binaryPath)) {
95
+ const cachedVersion = (await fs.promises.readFile(versionPath, "utf8")).trim();
96
+ if (cachedVersion === tag && fs.existsSync(binaryPath)) {
97
+ if (!quiet) {
98
+ logger.info(`Using cached ${toolName} (${platformArch}): ${binaryPath}`);
99
+ }
100
+ return binaryPath;
101
+ }
102
+ }
103
+ if (!quiet) {
104
+ logger.info(`Downloading ${toolName} for ${platformArch}...`);
105
+ }
106
+ await downloadReleaseAsset(
107
+ tag,
108
+ assetName,
109
+ binaryPath,
110
+ { owner, repo },
111
+ { quiet }
112
+ );
113
+ const isWindows = (0, import_primordials.StringPrototypeEndsWith)(binaryName, ".exe");
114
+ if (!isWindows) {
115
+ fs.chmodSync(binaryPath, 493);
116
+ if (removeMacOSQuarantine && import_node_process.default.platform === "darwin" && (0, import_primordials.StringPrototypeStartsWith)(platformArch, "darwin")) {
117
+ try {
118
+ await (0, import_spawn.spawn)("xattr", ["-d", "com.apple.quarantine", binaryPath], {
119
+ stdio: "ignore"
120
+ });
121
+ } catch {
122
+ }
123
+ }
124
+ }
125
+ await fs.promises.writeFile(versionPath, tag, "utf8");
126
+ if (!quiet) {
127
+ logger.info(`Downloaded ${toolName} to ${binaryPath}`);
128
+ }
129
+ return binaryPath;
130
+ }
131
+ async function downloadReleaseAsset(tag, assetPattern, outputPath, repoConfig, options = {}) {
132
+ const { owner, repo } = repoConfig;
133
+ const { quiet = false } = options;
134
+ const downloadUrl = await (0, import_github_api.getReleaseAssetUrl)(tag, assetPattern, {
135
+ owner,
136
+ repo
137
+ });
138
+ if (!downloadUrl) {
139
+ const patternDesc = typeof assetPattern === "string" ? assetPattern : "matching pattern";
140
+ throw new import_primordials.ErrorCtor(`Asset ${patternDesc} not found in release ${tag}`);
141
+ }
142
+ const path = /* @__PURE__ */ getPath();
143
+ await (0, import_fs.safeMkdir)(path.dirname(outputPath));
144
+ await (0, import_http_request.httpDownload)(downloadUrl, outputPath, {
145
+ logger: quiet ? void 0 : logger,
146
+ progressInterval: 10,
147
+ retries: 2,
148
+ retryDelay: 5e3
149
+ });
150
+ }
151
+ // Annotate the CommonJS export names for ESM import in node:
152
+ 0 && (module.exports = {
153
+ downloadGitHubRelease,
154
+ downloadReleaseAsset
155
+ });
@@ -0,0 +1,66 @@
1
+ /**
2
+ * @fileoverview Public types for GitHub release download utilities.
3
+ */
4
+ /**
5
+ * Pattern for matching release assets.
6
+ * Can be either:
7
+ * - A string with glob pattern syntax
8
+ * - A prefix/suffix pair for explicit matching (backward compatible)
9
+ * - A RegExp for complex patterns
10
+ *
11
+ * String patterns support full glob syntax via picomatch.
12
+ * Examples:
13
+ * - Simple wildcard: yoga-sync-*.mjs matches yoga-sync-abc123.mjs
14
+ * - Complex: models-*.tar.gz matches models-2024-01-15.tar.gz
15
+ * - Prefix wildcard: *-models.tar.gz matches foo-models.tar.gz
16
+ * - Suffix wildcard: yoga-* matches yoga-layout
17
+ * - Brace expansion: {yoga,models}-*.{mjs,js} matches yoga-abc.mjs or models-xyz.js
18
+ *
19
+ * For backward compatibility, prefix/suffix objects are still supported but glob patterns are recommended.
20
+ */
21
+ export type AssetPattern = string | {
22
+ prefix: string;
23
+ suffix: string;
24
+ } | RegExp;
25
+ /**
26
+ * Configuration for downloading a GitHub release.
27
+ */
28
+ export interface DownloadGitHubReleaseConfig {
29
+ /** Asset name on GitHub. */
30
+ assetName: string;
31
+ /** Binary filename (e.g., 'node', 'binject'). */
32
+ binaryName: string;
33
+ /** Working directory (defaults to process.cwd()). */
34
+ cwd?: string;
35
+ /** Download destination directory. @default 'build/downloaded' */
36
+ downloadDir?: string;
37
+ /** GitHub repository owner/organization. */
38
+ owner: string;
39
+ /** Platform-arch identifier (e.g., 'linux-x64-musl'). */
40
+ platformArch: string;
41
+ /** Suppress log messages. @default false */
42
+ quiet?: boolean;
43
+ /** Remove macOS quarantine attribute after download. @default true */
44
+ removeMacOSQuarantine?: boolean;
45
+ /** GitHub repository name. */
46
+ repo: string;
47
+ /** Specific release tag to download. */
48
+ tag?: string;
49
+ /** Tool name for directory structure. */
50
+ toolName: string;
51
+ /** Tool prefix for finding latest release. */
52
+ toolPrefix?: string;
53
+ }
54
+ /**
55
+ * Configuration for repository access.
56
+ */
57
+ export interface RepoConfig {
58
+ /**
59
+ * GitHub repository owner/organization.
60
+ */
61
+ owner: string;
62
+ /**
63
+ * GitHub repository name.
64
+ */
65
+ repo: string;
66
+ }
@@ -14,5 +14,5 @@ var __copyProps = (to, from, except, desc) => {
14
14
  return to;
15
15
  };
16
16
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
17
- var types_exports = {};
18
- module.exports = __toCommonJS(types_exports);
17
+ var github_types_exports = {};
18
+ module.exports = __toCommonJS(github_types_exports);
@@ -2,7 +2,7 @@
2
2
  * @fileoverview Socket-btm release download utilities.
3
3
  */
4
4
  import { type Arch, type Libc, type Platform } from '../constants/platform';
5
- import { type AssetPattern } from './github';
5
+ import type { AssetPattern } from './github-types';
6
6
  export type { Arch, Libc, Platform };
7
7
  /**
8
8
  * Socket-btm GitHub repository configuration.
@@ -29,7 +29,9 @@ __export(socket_btm_exports, {
29
29
  });
30
30
  module.exports = __toCommonJS(socket_btm_exports);
31
31
  var import_platform = require("../constants/platform");
32
- var import_github = require("./github");
32
+ var import_github_api = require("./github-api");
33
+ var import_github_downloads = require("./github-downloads");
34
+ var import_primordials = require("../primordials");
33
35
  const SOCKET_BTM_REPO = {
34
36
  owner: "SocketDev",
35
37
  repo: "socket-btm"
@@ -93,27 +95,25 @@ async function downloadSocketBtmRelease(tool, options) {
93
95
  resolvedAsset = asset;
94
96
  } else {
95
97
  if (tag) {
96
- throw new Error(
98
+ throw new import_primordials.ErrorCtor(
97
99
  "Cannot use asset pattern with explicit tag. Either provide exact asset name or omit tag."
98
100
  );
99
101
  }
100
- resolvedTag = await (0, import_github.getLatestRelease)(toolPrefix, SOCKET_BTM_REPO, {
101
- assetPattern: asset,
102
- quiet
102
+ resolvedTag = await (0, import_github_api.getLatestRelease)(toolPrefix, SOCKET_BTM_REPO, {
103
+ assetPattern: asset
103
104
  }) ?? void 0;
104
105
  if (!resolvedTag) {
105
- throw new Error(`No ${tool} release with matching asset pattern found`);
106
+ throw new import_primordials.ErrorCtor(
107
+ `No ${tool} release with matching asset pattern found`
108
+ );
106
109
  }
107
- const assetUrl = await (0, import_github.getReleaseAssetUrl)(
110
+ const assetUrl = await (0, import_github_api.getReleaseAssetUrl)(
108
111
  resolvedTag,
109
112
  asset,
110
- SOCKET_BTM_REPO,
111
- {
112
- quiet
113
- }
113
+ SOCKET_BTM_REPO
114
114
  );
115
115
  if (!assetUrl) {
116
- throw new Error(`No matching asset found in release ${resolvedTag}`);
116
+ throw new import_primordials.ErrorCtor(`No matching asset found in release ${resolvedTag}`);
117
117
  }
118
118
  resolvedAsset = assetUrl.split("/").pop() || asset.toString();
119
119
  }
@@ -169,12 +169,12 @@ async function downloadSocketBtmRelease(tool, options) {
169
169
  removeMacOSQuarantine
170
170
  };
171
171
  }
172
- return await (0, import_github.downloadGitHubRelease)(downloadConfig);
172
+ return await (0, import_github_downloads.downloadGitHubRelease)(downloadConfig);
173
173
  }
174
174
  function getBinaryAssetName(binaryBaseName, platform, arch, libc) {
175
175
  const mappedArch = ARCH_MAP[arch];
176
176
  if (!mappedArch) {
177
- throw new Error(`Unsupported architecture: ${arch}`);
177
+ throw new import_primordials.ErrorCtor(`Unsupported architecture: ${arch}`);
178
178
  }
179
179
  const muslSuffix = platform === "linux" && libc === "musl" ? "-musl" : "";
180
180
  const ext = platform === "win32" ? ".exe" : "";
@@ -187,7 +187,7 @@ function getBinaryAssetName(binaryBaseName, platform, arch, libc) {
187
187
  if (platform === "win32") {
188
188
  return `${binaryBaseName}-win32-${mappedArch}${ext}`;
189
189
  }
190
- throw new Error(`Unsupported platform: ${platform}`);
190
+ throw new import_primordials.ErrorCtor(`Unsupported platform: ${platform}`);
191
191
  }
192
192
  function getBinaryName(binaryBaseName, platform) {
193
193
  return platform === "win32" ? `${binaryBaseName}.exe` : binaryBaseName;
@@ -195,11 +195,11 @@ function getBinaryName(binaryBaseName, platform) {
195
195
  function getPlatformArch(platform, arch, libc) {
196
196
  const mappedPlatform = PLATFORM_MAP[platform];
197
197
  if (!mappedPlatform) {
198
- throw new Error(`Unsupported platform: ${platform}`);
198
+ throw new import_primordials.ErrorCtor(`Unsupported platform: ${platform}`);
199
199
  }
200
200
  const mappedArch = ARCH_MAP[arch];
201
201
  if (!mappedArch) {
202
- throw new Error(`Unsupported architecture: ${arch}`);
202
+ throw new import_primordials.ErrorCtor(`Unsupported architecture: ${arch}`);
203
203
  }
204
204
  const muslSuffix = platform === "linux" && libc === "musl" ? "-musl" : "";
205
205
  return `${mappedPlatform}-${mappedArch}${muslSuffix}`;
@@ -24,13 +24,14 @@ __export(parse_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(parse_exports);
26
26
  var import_validate = require("./validate");
27
+ var import_primordials = require("../primordials");
27
28
  function parseSchema(schema, data) {
28
29
  const result = (0, import_validate.validateSchema)(schema, data);
29
30
  if (result.ok) {
30
31
  return result.value;
31
32
  }
32
33
  const summary = result.errors.map((e) => `${e.path.join(".") || "(root)"}: ${e.message}`).join(", ");
33
- throw new Error(`Validation failed: ${summary}`);
34
+ throw new import_primordials.ErrorCtor(`Validation failed: ${summary}`);
34
35
  }
35
36
  // Annotate the CommonJS export names for ESM import in node:
36
37
  0 && (module.exports = {
@@ -23,11 +23,12 @@ __export(validate_exports, {
23
23
  validateSchema: () => validateSchema
24
24
  });
25
25
  module.exports = __toCommonJS(validate_exports);
26
+ var import_primordials = require("../primordials");
26
27
  function isTypeBoxSchema(schema) {
27
28
  if (schema === null || typeof schema !== "object") {
28
29
  return false;
29
30
  }
30
- for (const sym of Object.getOwnPropertySymbols(schema)) {
31
+ for (const sym of (0, import_primordials.ObjectGetOwnPropertySymbols)(schema)) {
31
32
  if (sym.description === "TypeBox.Kind") {
32
33
  return typeof schema[sym] === "string";
33
34
  }
@@ -41,7 +42,7 @@ function normalizeTypeBoxErrors(errors) {
41
42
  out.push({
42
43
  path: segs.map((s) => {
43
44
  const n = Number(s);
44
- return Number.isInteger(n) && String(n) === s ? n : s;
45
+ return (0, import_primordials.NumberIsInteger)(n) && String(n) === s ? n : s;
45
46
  }),
46
47
  message: err.message
47
48
  });
@@ -53,13 +54,13 @@ function normalizeZodError(err) {
53
54
  return [{ path: [], message: String(err) }];
54
55
  }
55
56
  const issues = err.issues;
56
- if (!Array.isArray(issues)) {
57
+ if (!(0, import_primordials.ArrayIsArray)(issues)) {
57
58
  return [{ path: [], message: "Unknown validation error" }];
58
59
  }
59
60
  return issues.map((issue) => {
60
61
  const i = issue;
61
62
  return {
62
- path: Array.isArray(i.path) ? i.path : [],
63
+ path: (0, import_primordials.ArrayIsArray)(i.path) ? i.path : [],
63
64
  message: typeof i.message === "string" ? i.message : "Invalid value"
64
65
  };
65
66
  });
@@ -88,7 +89,7 @@ function validateSchema(schema, data) {
88
89
  errors: normalizeZodError(result.error)
89
90
  };
90
91
  }
91
- throw new TypeError(
92
+ throw new import_primordials.TypeErrorCtor(
92
93
  "validateSchema: unsupported schema kind. Expected a Zod schema or an object with a safeParse method."
93
94
  );
94
95
  }
package/dist/shadow.js CHANGED
@@ -44,7 +44,8 @@ function shouldSkipShadow(binPath, options) {
44
44
  return true;
45
45
  }
46
46
  const userAgent = import_node_process.default.env["npm_config_user_agent"];
47
- if (userAgent?.includes("exec") || userAgent?.includes("npx") || userAgent?.includes("dlx")) {
47
+ if (userAgent?.includes("exec") || userAgent?.includes("npx") || // # socket-hook: allow npx
48
+ userAgent?.includes("dlx")) {
48
49
  return true;
49
50
  }
50
51
  const normalizedCwd = (0, import_normalize.normalizePath)(cwd);
@@ -133,7 +133,7 @@ function processReallyExit(code) {
133
133
  globalProcess,
134
134
  [exitCode]
135
135
  );
136
- throw new Error("processReallyExit should never return");
136
+ throw new import_primordials.ErrorCtor("processReallyExit should never return");
137
137
  }
138
138
  // @__NO_SIDE_EFFECTS__
139
139
  function load() {
@@ -168,7 +168,7 @@ function onExit(cb, options) {
168
168
  };
169
169
  }
170
170
  if (typeof cb !== "function") {
171
- throw new TypeError("a callback must be provided for exit handler");
171
+ throw new import_primordials.TypeErrorCtor("a callback must be provided for exit handler");
172
172
  }
173
173
  if (loaded === false) {
174
174
  /* @__PURE__ */ load();
package/dist/spawn.js CHANGED
@@ -46,10 +46,11 @@ var import_objects = require("./objects");
46
46
  var import_normalize = require("./paths/normalize");
47
47
  var import_spinner = require("./spinner");
48
48
  var import_strings = require("./strings");
49
+ var import_primordials = require("./primordials");
49
50
  const abortSignal = (0, import_process.getAbortSignal)();
50
51
  const spinner = (0, import_spinner.getDefaultSpinner)();
51
- const stackCache = /* @__PURE__ */ new WeakMap();
52
- const spawnBinPathCache = /* @__PURE__ */ new Map();
52
+ const stackCache = new import_primordials.WeakMapCtor();
53
+ const spawnBinPathCache = new import_primordials.MapCtor();
53
54
  const windowsScriptExtRegExp = /\.(?:cmd|bat|ps1)$/i;
54
55
  let _npmCliPromiseSpawn;
55
56
  let _path;
@@ -133,7 +134,7 @@ ${firstLine.slice(0, 197)}...`;
133
134
  }
134
135
  const isSynthetic = err.message === "command failed";
135
136
  if (isSynthetic) {
136
- Object.defineProperty(err, "message", {
137
+ (0, import_primordials.ObjectDefineProperty)(err, "message", {
137
138
  __proto__: null,
138
139
  value: enhancedMessage,
139
140
  writable: true,
@@ -142,14 +143,14 @@ ${firstLine.slice(0, 197)}...`;
142
143
  });
143
144
  return err;
144
145
  }
145
- const enhancedError = new Error(enhancedMessage, {
146
+ const enhancedError = new import_primordials.ErrorCtor(enhancedMessage, {
146
147
  cause: err
147
148
  });
148
- const descriptors = Object.getOwnPropertyDescriptors(err);
149
- Reflect.deleteProperty(descriptors, "message");
150
- Reflect.deleteProperty(descriptors, "stack");
151
- Object.defineProperties(enhancedError, descriptors);
152
- Object.defineProperty(enhancedError, "stack", {
149
+ const descriptors = (0, import_primordials.ObjectGetOwnPropertyDescriptors)(err);
150
+ (0, import_primordials.ReflectDeleteProperty)(descriptors, "message");
151
+ (0, import_primordials.ReflectDeleteProperty)(descriptors, "stack");
152
+ (0, import_primordials.ObjectDefineProperties)(enhancedError, descriptors);
153
+ (0, import_primordials.ObjectDefineProperty)(enhancedError, "stack", {
153
154
  __proto__: null,
154
155
  configurable: true,
155
156
  enumerable: false,
@@ -214,7 +215,7 @@ function spawn(cmd, args, options, extra) {
214
215
  }
215
216
  }
216
217
  const WIN32 = import_node_process.default.platform === "win32";
217
- if (WIN32 && shell && windowsScriptExtRegExp.test(actualCmd)) {
218
+ if (WIN32 && shell && (0, import_primordials.RegExpPrototypeTest)(windowsScriptExtRegExp, actualCmd)) {
218
219
  if (!(0, import_normalize.isPath)(actualCmd)) {
219
220
  actualCmd = (/* @__PURE__ */ getPath()).basename(actualCmd, (/* @__PURE__ */ getPath()).extname(actualCmd));
220
221
  }
@@ -253,35 +254,44 @@ function spawn(cmd, args, options, extra) {
253
254
  const oldSpawnPromise = spawnPromise;
254
255
  let newSpawnPromise;
255
256
  if (shouldStripAnsi && stdioString) {
256
- newSpawnPromise = spawnPromise.then((result) => {
257
- const strippedResult = /* @__PURE__ */ stripAnsiFromSpawnResult(result);
258
- if ("code" in strippedResult) {
259
- ;
260
- strippedResult.exitCode = strippedResult.code;
257
+ newSpawnPromise = (async () => {
258
+ try {
259
+ const result = await spawnPromise;
260
+ const strippedResult = /* @__PURE__ */ stripAnsiFromSpawnResult(result);
261
+ if ("code" in strippedResult) {
262
+ ;
263
+ strippedResult.exitCode = strippedResult.code;
264
+ }
265
+ return strippedResult;
266
+ } catch (error) {
267
+ const strippedError = /* @__PURE__ */ stripAnsiFromSpawnResult(error);
268
+ throw /* @__PURE__ */ enhanceSpawnError(strippedError);
261
269
  }
262
- return strippedResult;
263
- }).catch((error) => {
264
- const strippedError = /* @__PURE__ */ stripAnsiFromSpawnResult(error);
265
- const enhancedError = /* @__PURE__ */ enhanceSpawnError(strippedError);
266
- throw enhancedError;
267
- });
270
+ })();
268
271
  } else {
269
- newSpawnPromise = spawnPromise.then((result) => {
270
- if (result !== null && typeof result === "object" && "code" in result) {
271
- const res = result;
272
- res.exitCode = res.code;
273
- return res;
272
+ newSpawnPromise = (async () => {
273
+ try {
274
+ const result = await spawnPromise;
275
+ if (result !== null && typeof result === "object" && "code" in result) {
276
+ const res = result;
277
+ res.exitCode = res.code;
278
+ return res;
279
+ }
280
+ return result;
281
+ } catch (error) {
282
+ throw /* @__PURE__ */ enhanceSpawnError(error);
274
283
  }
275
- return result;
276
- }).catch((error) => {
277
- const enhancedError = /* @__PURE__ */ enhanceSpawnError(error);
278
- throw enhancedError;
279
- });
284
+ })();
280
285
  }
281
286
  if (shouldRestartSpinner) {
282
- newSpawnPromise = newSpawnPromise.finally(() => {
283
- spinnerInstance.start();
284
- });
287
+ const prevPromise = newSpawnPromise;
288
+ newSpawnPromise = (async () => {
289
+ try {
290
+ return await prevPromise;
291
+ } finally {
292
+ spinnerInstance.start();
293
+ }
294
+ })();
285
295
  }
286
296
  ;
287
297
  newSpawnPromise.process = oldSpawnPromise.process;
@@ -301,7 +311,7 @@ function spawnSync(cmd, args, options) {
301
311
  }
302
312
  const shell = (0, import_objects.getOwn)(options, "shell");
303
313
  const WIN32 = import_node_process.default.platform === "win32";
304
- if (WIN32 && shell && windowsScriptExtRegExp.test(actualCmd)) {
314
+ if (WIN32 && shell && (0, import_primordials.RegExpPrototypeTest)(windowsScriptExtRegExp, actualCmd)) {
305
315
  if (!(0, import_normalize.isPath)(actualCmd)) {
306
316
  actualCmd = (/* @__PURE__ */ getPath()).basename(actualCmd, (/* @__PURE__ */ getPath()).extname(actualCmd));
307
317
  }
package/dist/spinner.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import type { Writable } from 'node:stream';
6
6
  import type { ColorInherit, ColorRgb, ColorValue } from './colors';
7
- import type { ShimmerColorGradient, ShimmerConfig, ShimmerDirection, ShimmerState } from './effects/text-shimmer';
7
+ import type { Palette, ShimmerConfig, ShimmerDirection } from './effects/shimmer';
8
8
  /**
9
9
  * Symbol types for status messages.
10
10
  * Maps to log symbols: fail (✗), info (ℹ), skip (↻), success (✓), warn (⚠).
@@ -23,12 +23,19 @@ export type ProgressInfo = {
23
23
  unit?: string | undefined;
24
24
  };
25
25
  /**
26
- * Internal shimmer state with color configuration.
27
- * Extends `ShimmerState` with additional color property that can be inherited from spinner.
26
+ * Internal shimmer runtime state. Holds the user-facing config plus a
27
+ * monotonic frame counter; the spinner advances `frame` on each animation
28
+ * tick and feeds the current frame to the shimmer engine.
28
29
  */
29
- export type ShimmerInfo = ShimmerState & {
30
- /** Color for shimmer effect - can inherit from spinner, use explicit color, or gradient */
31
- color: ColorInherit | ColorValue | ShimmerColorGradient;
30
+ export type ShimmerInfo = {
31
+ /** User-facing color reference (inherit, explicit value, or palette). */
32
+ color: ColorInherit | ColorValue | Palette;
33
+ /** Current direction (driven by config, snapshotted here for getters). */
34
+ direction: ShimmerDirection;
35
+ /** Steps per frame. */
36
+ speed: number;
37
+ /** Monotonic frame counter — advanced on each animation tick. */
38
+ frame: number;
32
39
  };
33
40
  /**
34
41
  * Spinner instance for displaying animated loading indicators.