@socketsecurity/lib 5.26.0 → 5.27.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 (183) hide show
  1. package/CHANGELOG.md +371 -1185
  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} +26 -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 +71 -71
  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 +50 -68
  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/node/async-hooks.d.ts +6 -0
  84. package/dist/node/async-hooks.js +34 -0
  85. package/dist/node/child-process.d.ts +11 -0
  86. package/dist/node/child-process.js +34 -0
  87. package/dist/node/crypto.d.ts +6 -0
  88. package/dist/node/crypto.js +34 -0
  89. package/dist/node/events.d.ts +6 -0
  90. package/dist/node/events.js +34 -0
  91. package/dist/node/fs-promises.d.ts +6 -0
  92. package/dist/node/fs-promises.js +34 -0
  93. package/dist/node/fs.d.ts +14 -0
  94. package/dist/node/fs.js +34 -0
  95. package/dist/node/http.d.ts +6 -0
  96. package/dist/node/http.js +34 -0
  97. package/dist/node/https.d.ts +6 -0
  98. package/dist/node/https.js +34 -0
  99. package/dist/node/os.d.ts +6 -0
  100. package/dist/node/os.js +34 -0
  101. package/dist/node/path.d.ts +6 -0
  102. package/dist/node/path.js +34 -0
  103. package/dist/node/timers-promises.d.ts +6 -0
  104. package/dist/node/timers-promises.js +34 -0
  105. package/dist/node/url.d.ts +6 -0
  106. package/dist/node/url.js +34 -0
  107. package/dist/node/util.d.ts +6 -0
  108. package/dist/node/util.js +34 -0
  109. package/dist/objects.js +2 -2
  110. package/dist/packages/edit.js +8 -7
  111. package/dist/packages/exports.js +17 -16
  112. package/dist/packages/isolation.js +20 -13
  113. package/dist/packages/licenses.js +6 -3
  114. package/dist/packages/manifest.js +2 -1
  115. package/dist/packages/normalize.js +8 -4
  116. package/dist/packages/operations.js +5 -4
  117. package/dist/packages/provenance.js +7 -6
  118. package/dist/packages/specs.js +2 -1
  119. package/dist/packages/validation.js +2 -1
  120. package/dist/paths/normalize.js +32 -40
  121. package/dist/paths/packages.js +2 -1
  122. package/dist/paths/rewire.js +3 -2
  123. package/dist/performance.js +19 -18
  124. package/dist/primordials.d.ts +85 -2
  125. package/dist/primordials.js +311 -23
  126. package/dist/process-lock.js +14 -13
  127. package/dist/promise-queue.js +17 -9
  128. package/dist/promises.d.ts +29 -6
  129. package/dist/promises.js +19 -15
  130. package/dist/regexps.js +9 -8
  131. package/dist/releases/github-api.d.ts +56 -0
  132. package/dist/releases/github-api.js +275 -0
  133. package/dist/releases/github-archives.d.ts +60 -0
  134. package/dist/releases/github-archives.js +136 -0
  135. package/dist/releases/github-assets.d.ts +21 -0
  136. package/dist/releases/github-assets.js +52 -0
  137. package/dist/releases/github-auth.d.ts +16 -0
  138. package/dist/releases/github-auth.js +51 -0
  139. package/dist/releases/github-downloads.d.ts +42 -0
  140. package/dist/releases/github-downloads.js +155 -0
  141. package/dist/releases/github-types.d.ts +66 -0
  142. package/dist/{effects/types.js → releases/github-types.js} +2 -2
  143. package/dist/releases/socket-btm.d.ts +1 -1
  144. package/dist/releases/socket-btm.js +17 -17
  145. package/dist/schema/parse.js +2 -1
  146. package/dist/schema/validate.js +6 -5
  147. package/dist/sea/util.d.ts +43 -0
  148. package/dist/{sea.js → sea/util.js} +7 -7
  149. package/dist/shadow.js +2 -1
  150. package/dist/signal-exit.js +2 -2
  151. package/dist/smol/primordial.d.ts +80 -0
  152. package/dist/smol/primordial.js +46 -0
  153. package/dist/smol/util.d.ts +87 -0
  154. package/dist/smol/util.js +59 -0
  155. package/dist/smol/versions.d.ts +46 -0
  156. package/dist/smol/versions.js +46 -0
  157. package/dist/spawn.js +58 -63
  158. package/dist/spinner.d.ts +13 -6
  159. package/dist/spinner.js +75 -57
  160. package/dist/ssri.js +8 -7
  161. package/dist/stdio/footer.js +13 -12
  162. package/dist/stdio/header.js +5 -4
  163. package/dist/stdio/progress.js +13 -12
  164. package/dist/strings.js +19 -18
  165. package/dist/suppress-warnings.js +2 -2
  166. package/dist/tables.js +16 -13
  167. package/dist/temporary-executor.js +2 -1
  168. package/dist/themes/context.js +2 -1
  169. package/dist/themes/types.d.ts +1 -1
  170. package/dist/themes/utils.d.ts +8 -3
  171. package/dist/themes/utils.js +29 -5
  172. package/dist/url.js +4 -3
  173. package/dist/versions.js +27 -22
  174. package/package.json +120 -26
  175. package/dist/effects/text-shimmer.d.ts +0 -58
  176. package/dist/effects/text-shimmer.js +0 -192
  177. package/dist/effects/types.d.ts +0 -47
  178. package/dist/effects/ultra.d.ts +0 -22
  179. package/dist/releases/github.d.ts +0 -234
  180. package/dist/releases/github.js +0 -417
  181. package/dist/sea.d.ts +0 -30
  182. package/dist/themes/index.d.ts +0 -49
  183. package/dist/themes/index.js +0 -60
@@ -1,417 +0,0 @@
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_exports = {};
32
- __export(github_exports, {
33
- createAssetMatcher: () => createAssetMatcher,
34
- downloadAndExtractArchive: () => downloadAndExtractArchive,
35
- downloadAndExtractZip: () => downloadAndExtractZip,
36
- downloadGitHubRelease: () => downloadGitHubRelease,
37
- downloadReleaseAsset: () => downloadReleaseAsset,
38
- getAuthHeaders: () => getAuthHeaders,
39
- getLatestRelease: () => getLatestRelease,
40
- getReleaseAssetUrl: () => getReleaseAssetUrl
41
- });
42
- module.exports = __toCommonJS(github_exports);
43
- var import_node_process = __toESM(require("node:process"));
44
- var import_picomatch = __toESM(require("../external/picomatch"));
45
- var import_archives = require("../archives");
46
- var import_errors = require("../errors");
47
- var import_fs = require("../fs");
48
- var import_http_request = require("../http-request");
49
- var import_logger = require("../logger");
50
- var import_promises = require("../promises");
51
- var import_spawn = require("../spawn");
52
- const RETRY_CONFIG = Object.freeze({
53
- __proto__: null,
54
- // Exponential backoff: delay doubles with each retry (5s, 10s, 20s).
55
- backoffFactor: 2,
56
- // Initial delay before first retry.
57
- baseDelayMs: 5e3,
58
- // Maximum number of retry attempts (excluding initial request).
59
- retries: 2
60
- });
61
- const logger = (0, import_logger.getDefaultLogger)();
62
- let _fs;
63
- let _path;
64
- // @__NO_SIDE_EFFECTS__
65
- function getFs() {
66
- if (_fs === void 0) {
67
- _fs = require("node:fs");
68
- }
69
- return _fs;
70
- }
71
- // @__NO_SIDE_EFFECTS__
72
- function getPath() {
73
- if (_path === void 0) {
74
- _path = require("node:path");
75
- }
76
- return _path;
77
- }
78
- function createAssetMatcher(pattern) {
79
- if (typeof pattern === "string") {
80
- const isMatch = (0, import_picomatch.default)(pattern);
81
- return (input) => isMatch(input);
82
- }
83
- if (pattern instanceof RegExp) {
84
- return (input) => pattern.test(input);
85
- }
86
- const { prefix, suffix } = pattern;
87
- return (input) => input.startsWith(prefix) && input.endsWith(suffix);
88
- }
89
- async function downloadAndExtractArchive(tag, assetPattern, outputDir, repoConfig, options = {}) {
90
- const { cleanup = true, format, quiet = false, strip } = options;
91
- const path = /* @__PURE__ */ getPath();
92
- const fs = /* @__PURE__ */ getFs();
93
- await (0, import_fs.safeMkdir)(outputDir);
94
- let ext = ".archive";
95
- if (format) {
96
- ext = format === "tar.gz" ? ".tar.gz" : `.${format}`;
97
- } else if (typeof assetPattern === "string") {
98
- const detectedFormat = (0, import_archives.detectArchiveFormat)(assetPattern);
99
- if (detectedFormat) {
100
- ext = detectedFormat === "tar.gz" ? ".tar.gz" : `.${detectedFormat}`;
101
- }
102
- }
103
- const archivePath = path.join(outputDir, `__temp_download__${ext}`);
104
- if (!quiet) {
105
- logger.info(`Downloading archive from release ${tag}...`);
106
- }
107
- await downloadReleaseAsset(tag, assetPattern, archivePath, repoConfig, {
108
- quiet
109
- });
110
- if (!quiet) {
111
- logger.info(`Extracting archive to ${outputDir}...`);
112
- }
113
- try {
114
- await (0, import_archives.extractArchive)(archivePath, outputDir, { quiet, strip });
115
- if (!quiet) {
116
- logger.info(`Extracted archive contents to ${outputDir}`);
117
- }
118
- } catch (cause) {
119
- throw new Error(`Failed to extract archive: ${archivePath}`, { cause });
120
- } finally {
121
- if (cleanup) {
122
- try {
123
- await fs.promises.unlink(archivePath);
124
- if (!quiet) {
125
- logger.info("Cleaned up temporary archive file");
126
- }
127
- } catch (e) {
128
- if (!quiet) {
129
- logger.warn(`Failed to cleanup archive file: ${e}`);
130
- }
131
- }
132
- }
133
- }
134
- return outputDir;
135
- }
136
- async function downloadAndExtractZip(tag, assetPattern, outputDir, repoConfig, options = {}) {
137
- const { cleanup = true, quiet = false } = options;
138
- const path = /* @__PURE__ */ getPath();
139
- const fs = /* @__PURE__ */ getFs();
140
- await (0, import_fs.safeMkdir)(outputDir);
141
- const zipPath = path.join(outputDir, "__temp_download__.zip");
142
- if (!quiet) {
143
- logger.info(`Downloading zip asset from release ${tag}...`);
144
- }
145
- await downloadReleaseAsset(tag, assetPattern, zipPath, repoConfig, { quiet });
146
- if (!quiet) {
147
- logger.info(`Extracting zip to ${outputDir}...`);
148
- }
149
- try {
150
- await (0, import_archives.extractArchive)(zipPath, outputDir, { quiet });
151
- if (!quiet) {
152
- logger.info(`Extracted zip contents to ${outputDir}`);
153
- }
154
- } catch (cause) {
155
- throw new Error(`Failed to extract zip file: ${zipPath}`, { cause });
156
- } finally {
157
- if (cleanup) {
158
- try {
159
- await fs.promises.unlink(zipPath);
160
- if (!quiet) {
161
- logger.info("Cleaned up temporary zip file");
162
- }
163
- } catch (e) {
164
- if (!quiet) {
165
- logger.warn(`Failed to cleanup zip file: ${e}`);
166
- }
167
- }
168
- }
169
- }
170
- return outputDir;
171
- }
172
- async function downloadGitHubRelease(config) {
173
- const {
174
- assetName,
175
- binaryName,
176
- cwd = import_node_process.default.cwd(),
177
- downloadDir = "build/downloaded",
178
- owner,
179
- platformArch,
180
- quiet = false,
181
- removeMacOSQuarantine = true,
182
- repo,
183
- tag: explicitTag,
184
- toolName,
185
- toolPrefix
186
- } = config;
187
- let tag;
188
- if (explicitTag) {
189
- tag = explicitTag;
190
- } else if (toolPrefix) {
191
- const latestTag = await getLatestRelease(
192
- toolPrefix,
193
- { owner, repo },
194
- { quiet }
195
- );
196
- if (!latestTag) {
197
- throw new Error(`No ${toolPrefix} release found in ${owner}/${repo}`);
198
- }
199
- tag = latestTag;
200
- } else {
201
- throw new Error("Either toolPrefix or tag must be provided");
202
- }
203
- const path = /* @__PURE__ */ getPath();
204
- const resolvedDownloadDir = path.isAbsolute(downloadDir) ? downloadDir : path.join(cwd, downloadDir);
205
- const binaryDir = resolvedDownloadDir;
206
- const binaryPath = path.join(binaryDir, binaryName);
207
- const versionPath = path.join(binaryDir, ".version");
208
- const fs = /* @__PURE__ */ getFs();
209
- if (fs.existsSync(versionPath) && fs.existsSync(binaryPath)) {
210
- const cachedVersion = (await fs.promises.readFile(versionPath, "utf8")).trim();
211
- if (cachedVersion === tag && fs.existsSync(binaryPath)) {
212
- if (!quiet) {
213
- logger.info(`Using cached ${toolName} (${platformArch}): ${binaryPath}`);
214
- }
215
- return binaryPath;
216
- }
217
- }
218
- if (!quiet) {
219
- logger.info(`Downloading ${toolName} for ${platformArch}...`);
220
- }
221
- await downloadReleaseAsset(
222
- tag,
223
- assetName,
224
- binaryPath,
225
- { owner, repo },
226
- { quiet }
227
- );
228
- const isWindows = binaryName.endsWith(".exe");
229
- if (!isWindows) {
230
- fs.chmodSync(binaryPath, 493);
231
- if (removeMacOSQuarantine && import_node_process.default.platform === "darwin" && platformArch.startsWith("darwin")) {
232
- try {
233
- await (0, import_spawn.spawn)("xattr", ["-d", "com.apple.quarantine", binaryPath], {
234
- stdio: "ignore"
235
- });
236
- } catch {
237
- }
238
- }
239
- }
240
- await fs.promises.writeFile(versionPath, tag, "utf8");
241
- if (!quiet) {
242
- logger.info(`Downloaded ${toolName} to ${binaryPath}`);
243
- }
244
- return binaryPath;
245
- }
246
- async function downloadReleaseAsset(tag, assetPattern, outputPath, repoConfig, options = {}) {
247
- const { owner, repo } = repoConfig;
248
- const { quiet = false } = options;
249
- const downloadUrl = await getReleaseAssetUrl(
250
- tag,
251
- assetPattern,
252
- { owner, repo },
253
- { quiet }
254
- );
255
- if (!downloadUrl) {
256
- const patternDesc = typeof assetPattern === "string" ? assetPattern : "matching pattern";
257
- throw new Error(`Asset ${patternDesc} not found in release ${tag}`);
258
- }
259
- const path = /* @__PURE__ */ getPath();
260
- await (0, import_fs.safeMkdir)(path.dirname(outputPath));
261
- await (0, import_http_request.httpDownload)(downloadUrl, outputPath, {
262
- logger: quiet ? void 0 : logger,
263
- progressInterval: 10,
264
- retries: 2,
265
- retryDelay: 5e3
266
- });
267
- }
268
- function getAuthHeaders() {
269
- const token = import_node_process.default.env["GH_TOKEN"] || import_node_process.default.env["GITHUB_TOKEN"];
270
- const headers = {
271
- Accept: "application/vnd.github+json",
272
- "X-GitHub-Api-Version": "2022-11-28"
273
- };
274
- if (token) {
275
- headers["Authorization"] = `Bearer ${token}`;
276
- }
277
- return headers;
278
- }
279
- async function getLatestRelease(toolPrefix, repoConfig, options = {}) {
280
- const { assetPattern, quiet = false } = options;
281
- const { owner, repo } = repoConfig;
282
- const isMatch = assetPattern ? createAssetMatcher(assetPattern) : void 0;
283
- return await (0, import_promises.pRetry)(
284
- async () => {
285
- const response = await (0, import_http_request.httpRequest)(
286
- `https://api.github.com/repos/${owner}/${repo}/releases?per_page=100`,
287
- {
288
- headers: getAuthHeaders()
289
- }
290
- );
291
- if (!response.ok) {
292
- throw new Error(`Failed to fetch releases: ${response.status}`);
293
- }
294
- let releases;
295
- try {
296
- releases = JSON.parse(response.body.toString("utf8"));
297
- } catch (cause) {
298
- throw new Error(
299
- `Failed to parse GitHub releases response from https://api.github.com/repos/${owner}/${repo}/releases`,
300
- { cause }
301
- );
302
- }
303
- const matchingReleases = releases.filter((release) => {
304
- const { assets, tag_name: tag2 } = release;
305
- if (!tag2.startsWith(toolPrefix)) {
306
- return false;
307
- }
308
- if (!assets || assets.length === 0) {
309
- return false;
310
- }
311
- if (isMatch) {
312
- const hasMatchingAsset = assets.some(
313
- (a) => isMatch(a.name)
314
- );
315
- if (!hasMatchingAsset) {
316
- return false;
317
- }
318
- }
319
- return true;
320
- });
321
- if (matchingReleases.length === 0) {
322
- if (!quiet) {
323
- logger.info(`No ${toolPrefix} release found in latest 100 releases`);
324
- }
325
- return null;
326
- }
327
- matchingReleases.sort(
328
- (a, b) => new Date(b.published_at).getTime() - new Date(a.published_at).getTime()
329
- );
330
- const latestRelease = matchingReleases[0];
331
- const tag = latestRelease.tag_name;
332
- if (!quiet) {
333
- logger.info(`Found release: ${tag}`);
334
- }
335
- return tag;
336
- },
337
- {
338
- ...RETRY_CONFIG,
339
- onRetry: (attempt, error) => {
340
- if (!quiet) {
341
- logger.info(
342
- `Retry attempt ${attempt + 1}/${RETRY_CONFIG.retries + 1} for ${toolPrefix} release...`
343
- );
344
- logger.warn(
345
- `Attempt ${attempt + 1}/${RETRY_CONFIG.retries + 1} failed: ${(0, import_errors.errorMessage)(error)}`
346
- );
347
- }
348
- return void 0;
349
- }
350
- }
351
- ) ?? null;
352
- }
353
- async function getReleaseAssetUrl(tag, assetPattern, repoConfig, options = {}) {
354
- const { owner, repo } = repoConfig;
355
- const { quiet = false } = options;
356
- const isMatch = typeof assetPattern === "string" && !assetPattern.includes("*") && !assetPattern.includes("{") ? (input) => input === assetPattern : createAssetMatcher(assetPattern);
357
- return await (0, import_promises.pRetry)(
358
- async () => {
359
- const response = await (0, import_http_request.httpRequest)(
360
- `https://api.github.com/repos/${owner}/${repo}/releases/tags/${tag}`,
361
- {
362
- headers: getAuthHeaders()
363
- }
364
- );
365
- if (!response.ok) {
366
- throw new Error(`Failed to fetch release ${tag}: ${response.status}`);
367
- }
368
- let release;
369
- try {
370
- release = JSON.parse(response.body.toString("utf8"));
371
- } catch (cause) {
372
- throw new Error(
373
- `Failed to parse GitHub release response for tag ${tag}`,
374
- { cause }
375
- );
376
- }
377
- const assets = release.assets;
378
- if (!Array.isArray(assets)) {
379
- throw new Error(`Release ${tag} has no assets`);
380
- }
381
- const asset = assets.find((a) => isMatch(a.name));
382
- if (!asset) {
383
- const patternDesc = typeof assetPattern === "string" ? assetPattern : "matching pattern";
384
- throw new Error(`Asset ${patternDesc} not found in release ${tag}`);
385
- }
386
- if (!quiet) {
387
- logger.info(`Found asset: ${asset.name}`);
388
- }
389
- return asset.browser_download_url;
390
- },
391
- {
392
- ...RETRY_CONFIG,
393
- onRetry: (attempt, error) => {
394
- if (!quiet) {
395
- logger.info(
396
- `Retry attempt ${attempt + 1}/${RETRY_CONFIG.retries + 1} for asset URL...`
397
- );
398
- logger.warn(
399
- `Attempt ${attempt + 1}/${RETRY_CONFIG.retries + 1} failed: ${(0, import_errors.errorMessage)(error)}`
400
- );
401
- }
402
- return void 0;
403
- }
404
- }
405
- ) ?? null;
406
- }
407
- // Annotate the CommonJS export names for ESM import in node:
408
- 0 && (module.exports = {
409
- createAssetMatcher,
410
- downloadAndExtractArchive,
411
- downloadAndExtractZip,
412
- downloadGitHubRelease,
413
- downloadReleaseAsset,
414
- getAuthHeaders,
415
- getLatestRelease,
416
- getReleaseAssetUrl
417
- });
package/dist/sea.d.ts DELETED
@@ -1,30 +0,0 @@
1
- /**
2
- * @fileoverview SEA (Single Executable Application) detection utilities for Socket ecosystem.
3
- * Provides reliable detection of whether the current process is running
4
- * as a Node.js Single Executable Application.
5
- */
6
- /**
7
- * Get the current SEA binary path.
8
- * Only valid when running as a SEA binary.
9
- *
10
- * @example
11
- * ```typescript
12
- * const binPath = getSeaBinaryPath()
13
- * if (binPath) {
14
- * console.log(`Running as SEA binary: ${binPath}`)
15
- * }
16
- * ```
17
- */
18
- export declare function getSeaBinaryPath(): string | undefined;
19
- /**
20
- * Detect if the current process is running as a SEA binary.
21
- * Uses Node.js 24+ native API with caching for performance.
22
- *
23
- * @example
24
- * ```typescript
25
- * if (isSeaBinary()) {
26
- * console.log('Running as a Single Executable Application')
27
- * }
28
- * ```
29
- */
30
- export declare function isSeaBinary(): boolean;
@@ -1,49 +0,0 @@
1
- /**
2
- * @fileoverview Elegant theming system for Socket libraries.
3
- * Unified visual language across spinners, loggers, prompts, and links.
4
- *
5
- * @example
6
- * ```ts
7
- * import { setTheme, THEMES } from '@socketsecurity/lib/themes'
8
- *
9
- * // Set global theme
10
- * setTheme('terracotta')
11
- * ```
12
- *
13
- * @example
14
- * ```ts
15
- * import { withTheme } from '@socketsecurity/lib/themes'
16
- *
17
- * // Scoped theme context
18
- * await withTheme('ultra', async () => {
19
- * // All operations inherit Ultra theme
20
- * })
21
- * ```
22
- *
23
- * @example
24
- * ```ts
25
- * import { createTheme } from '@socketsecurity/lib/themes'
26
- *
27
- * // Custom theme creation
28
- * const myTheme = createTheme({
29
- * name: 'custom',
30
- * displayName: 'Custom Theme',
31
- * colors: {
32
- * primary: [255, 100, 200],
33
- * success: 'greenBright',
34
- * error: 'redBright',
35
- * warning: 'yellowBright',
36
- * info: 'blueBright',
37
- * step: 'cyanBright',
38
- * text: 'white',
39
- * textDim: 'gray',
40
- * link: 'cyanBright',
41
- * prompt: 'primary'
42
- * }
43
- * })
44
- * ```
45
- */
46
- export type { ColorReference, Theme, ThemeColors, ThemeEffects, ThemeMeta, } from './types';
47
- export { LUSH_THEME, SOCKET_THEME, SUNSET_THEME, TERRACOTTA_THEME, THEMES, ULTRA_THEME, type ThemeName, } from './themes';
48
- export { getTheme, onThemeChange, setTheme, withTheme, withThemeSync, type ThemeChangeListener, } from './context';
49
- export { createTheme, extendTheme, resolveColor, resolveShimmerColor, } from './utils';
@@ -1,60 +0,0 @@
1
- "use strict";
2
- /* Socket Lib - Built with esbuild */
3
- "use strict";
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
- var themes_exports = {};
22
- __export(themes_exports, {
23
- LUSH_THEME: () => import_themes.LUSH_THEME,
24
- SOCKET_THEME: () => import_themes.SOCKET_THEME,
25
- SUNSET_THEME: () => import_themes.SUNSET_THEME,
26
- TERRACOTTA_THEME: () => import_themes.TERRACOTTA_THEME,
27
- THEMES: () => import_themes.THEMES,
28
- ULTRA_THEME: () => import_themes.ULTRA_THEME,
29
- createTheme: () => import_utils.createTheme,
30
- extendTheme: () => import_utils.extendTheme,
31
- getTheme: () => import_context.getTheme,
32
- onThemeChange: () => import_context.onThemeChange,
33
- resolveColor: () => import_utils.resolveColor,
34
- resolveShimmerColor: () => import_utils.resolveShimmerColor,
35
- setTheme: () => import_context.setTheme,
36
- withTheme: () => import_context.withTheme,
37
- withThemeSync: () => import_context.withThemeSync
38
- });
39
- module.exports = __toCommonJS(themes_exports);
40
- var import_themes = require("./themes");
41
- var import_context = require("./context");
42
- var import_utils = require("./utils");
43
- // Annotate the CommonJS export names for ESM import in node:
44
- 0 && (module.exports = {
45
- LUSH_THEME,
46
- SOCKET_THEME,
47
- SUNSET_THEME,
48
- TERRACOTTA_THEME,
49
- THEMES,
50
- ULTRA_THEME,
51
- createTheme,
52
- extendTheme,
53
- getTheme,
54
- onThemeChange,
55
- resolveColor,
56
- resolveShimmerColor,
57
- setTheme,
58
- withTheme,
59
- withThemeSync
60
- });