@socketsecurity/lib 5.11.1 → 5.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/github.js CHANGED
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
20
  };
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
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
  var github_exports = {};
21
31
  __export(github_exports, {
@@ -30,6 +40,7 @@ __export(github_exports, {
30
40
  resolveRefToSha: () => resolveRefToSha
31
41
  });
32
42
  module.exports = __toCommonJS(github_exports);
43
+ var import_node_process = __toESM(require("node:process"));
33
44
  var import_cache_with_ttl = require("./cache-with-ttl");
34
45
  var import_github = require("./env/github");
35
46
  var import_socket_cli = require("./env/socket-cli");
@@ -100,7 +111,7 @@ async function resolveRefToSha(owner, repo, ref, options) {
100
111
  ...options
101
112
  };
102
113
  const cacheKey = `${owner}/${repo}@${ref}`;
103
- if (process.env["DISABLE_GITHUB_CACHE"]) {
114
+ if (import_node_process.default.env["DISABLE_GITHUB_CACHE"]) {
104
115
  return await fetchRefSha(owner, repo, ref, opts);
105
116
  }
106
117
  const cache = getGithubCache();
@@ -189,7 +200,7 @@ async function fetchGhsaDetails(ghsaId, options) {
189
200
  async function cacheFetchGhsa(ghsaId, options) {
190
201
  const cache = getGithubCache();
191
202
  const key = `ghsa:${ghsaId}`;
192
- if (process.env["DISABLE_GITHUB_CACHE"]) {
203
+ if (import_node_process.default.env["DISABLE_GITHUB_CACHE"]) {
193
204
  return await fetchGhsaDetails(ghsaId, options);
194
205
  }
195
206
  const cached = await cache.getOrFetch(key, async () => {
@@ -25,6 +25,24 @@ export interface HttpRequestOptions {
25
25
  * ```
26
26
  */
27
27
  body?: Buffer | string | undefined;
28
+ /**
29
+ * Custom CA certificates for TLS connections.
30
+ * When provided, these certificates are combined with the default trust
31
+ * store via an HTTPS agent. Useful when SSL_CERT_FILE is set but
32
+ * NODE_EXTRA_CA_CERTS was not available at process startup.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * import { rootCertificates } from 'node:tls'
37
+ * import { readFileSync } from 'node:fs'
38
+ *
39
+ * const extraCerts = readFileSync('/path/to/cert.pem', 'utf-8')
40
+ * await httpRequest('https://api.example.com', {
41
+ * ca: [...rootCertificates, extraCerts]
42
+ * })
43
+ * ```
44
+ */
45
+ ca?: string[] | undefined;
28
46
  /**
29
47
  * Whether to automatically follow HTTP redirects (3xx status codes).
30
48
  *
@@ -257,6 +275,12 @@ export interface HttpResponse {
257
275
  * Configuration options for file downloads.
258
276
  */
259
277
  export interface HttpDownloadOptions {
278
+ /**
279
+ * Custom CA certificates for TLS connections.
280
+ * When provided, these certificates are used for the download request.
281
+ * See `HttpRequestOptions.ca` for details.
282
+ */
283
+ ca?: string[] | undefined;
260
284
  /**
261
285
  * Whether to automatically follow HTTP redirects (3xx status codes).
262
286
  * This is essential for downloading from services that use CDN redirects,
@@ -501,6 +525,11 @@ export declare function parseChecksums(text: string): Checksums;
501
525
  * Options for fetching checksums from a URL.
502
526
  */
503
527
  export interface FetchChecksumsOptions {
528
+ /**
529
+ * Custom CA certificates for TLS connections.
530
+ * See `HttpRequestOptions.ca` for details.
531
+ */
532
+ ca?: string[] | undefined;
504
533
  /**
505
534
  * HTTP headers to send with the request.
506
535
  */
@@ -82,11 +82,15 @@ function parseChecksums(text) {
82
82
  return checksums;
83
83
  }
84
84
  async function fetchChecksums(url, options) {
85
- const { headers = {}, timeout = 3e4 } = {
85
+ const {
86
+ ca,
87
+ headers = {},
88
+ timeout = 3e4
89
+ } = {
86
90
  __proto__: null,
87
91
  ...options
88
92
  };
89
- const response = await httpRequest(url, { headers, timeout });
93
+ const response = await httpRequest(url, { ca, headers, timeout });
90
94
  if (!response.ok) {
91
95
  throw new Error(
92
96
  `Failed to fetch checksums from ${url}: ${response.status} ${response.statusText}`
@@ -96,6 +100,7 @@ async function fetchChecksums(url, options) {
96
100
  }
97
101
  async function httpDownloadAttempt(url, destPath, options) {
98
102
  const {
103
+ ca,
99
104
  followRedirects = true,
100
105
  headers = {},
101
106
  maxRedirects = 5,
@@ -117,6 +122,9 @@ async function httpDownloadAttempt(url, destPath, options) {
117
122
  port: parsedUrl.port,
118
123
  timeout
119
124
  };
125
+ if (ca && isHttps) {
126
+ requestOptions["ca"] = ca;
127
+ }
120
128
  const { createWriteStream } = /* @__PURE__ */ getFs();
121
129
  let fileStream;
122
130
  let streamClosed = false;
@@ -141,6 +149,7 @@ async function httpDownloadAttempt(url, destPath, options) {
141
149
  const redirectUrl = res.headers.location.startsWith("http") ? res.headers.location : new URL(res.headers.location, url).toString();
142
150
  resolve(
143
151
  httpDownloadAttempt(redirectUrl, destPath, {
152
+ ca,
144
153
  followRedirects,
145
154
  headers,
146
155
  maxRedirects: maxRedirects - 1,
@@ -223,6 +232,7 @@ async function httpDownloadAttempt(url, destPath, options) {
223
232
  async function httpRequestAttempt(url, options) {
224
233
  const {
225
234
  body,
235
+ ca,
226
236
  followRedirects = true,
227
237
  headers = {},
228
238
  maxRedirects = 5,
@@ -244,6 +254,9 @@ async function httpRequestAttempt(url, options) {
244
254
  port: parsedUrl.port,
245
255
  timeout
246
256
  };
257
+ if (ca && isHttps) {
258
+ requestOptions["ca"] = ca;
259
+ }
247
260
  const request = httpModule.request(
248
261
  requestOptions,
249
262
  (res) => {
@@ -260,6 +273,7 @@ async function httpRequestAttempt(url, options) {
260
273
  resolve(
261
274
  httpRequestAttempt(redirectUrl, {
262
275
  body,
276
+ ca,
263
277
  followRedirects,
264
278
  headers,
265
279
  maxRedirects: maxRedirects - 1,
@@ -328,6 +342,7 @@ async function httpRequestAttempt(url, options) {
328
342
  }
329
343
  async function httpDownload(url, destPath, options) {
330
344
  const {
345
+ ca,
331
346
  followRedirects = true,
332
347
  headers = {},
333
348
  logger,
@@ -363,6 +378,7 @@ async function httpDownload(url, destPath, options) {
363
378
  for (let attempt = 0; attempt <= retries; attempt++) {
364
379
  try {
365
380
  const result = await httpDownloadAttempt(url, tempPath, {
381
+ ca,
366
382
  followRedirects,
367
383
  headers,
368
384
  maxRedirects,
@@ -437,6 +453,7 @@ async function httpJson(url, options) {
437
453
  async function httpRequest(url, options) {
438
454
  const {
439
455
  body,
456
+ ca,
440
457
  followRedirects = true,
441
458
  headers = {},
442
459
  maxRedirects = 5,
@@ -450,6 +467,7 @@ async function httpRequest(url, options) {
450
467
  try {
451
468
  return await httpRequestAttempt(url, {
452
469
  body,
470
+ ca,
453
471
  followRedirects,
454
472
  headers,
455
473
  maxRedirects,
package/dist/ipc.js CHANGED
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
20
  };
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
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
  var ipc_exports = {};
21
31
  __export(ipc_exports, {
@@ -33,6 +43,7 @@ __export(ipc_exports, {
33
43
  writeIpcStub: () => writeIpcStub
34
44
  });
35
45
  module.exports = __toCommonJS(ipc_exports);
46
+ var import_node_process = __toESM(require("node:process"));
36
47
  var import_fs = require("./fs");
37
48
  var import_socket = require("./paths/socket");
38
49
  var import_zod = require("./zod");
@@ -93,13 +104,13 @@ const IpcStubSchema = import_zod.z.object({
93
104
  });
94
105
  function createIpcChannelId(prefix = "socket") {
95
106
  const crypto = /* @__PURE__ */ getCrypto();
96
- return `${prefix}-${process.pid}-${crypto.randomBytes(8).toString("hex")}`;
107
+ return `${prefix}-${import_node_process.default.pid}-${crypto.randomBytes(8).toString("hex")}`;
97
108
  }
98
109
  function getIpcStubPath(appName) {
99
110
  const tempDir = (0, import_socket.getOsTmpDir)();
100
111
  const path = /* @__PURE__ */ getPath();
101
112
  const stubDir = path.join(tempDir, ".socket-ipc", appName);
102
- return path.join(stubDir, `stub-${process.pid}.json`);
113
+ return path.join(stubDir, `stub-${import_node_process.default.pid}.json`);
103
114
  }
104
115
  async function ensureIpcDirectory(filePath) {
105
116
  const fs = /* @__PURE__ */ getFs();
@@ -112,7 +123,7 @@ async function writeIpcStub(appName, data) {
112
123
  await ensureIpcDirectory(stubPath);
113
124
  const ipcData = {
114
125
  data,
115
- pid: process.pid,
126
+ pid: import_node_process.default.pid,
116
127
  timestamp: Date.now()
117
128
  };
118
129
  const validated = IpcStubSchema.parse(ipcData);
@@ -198,9 +209,9 @@ function onIpc(handler) {
198
209
  handler(parsed);
199
210
  }
200
211
  };
201
- process.on("message", listener);
212
+ import_node_process.default.on("message", listener);
202
213
  return () => {
203
- process.off("message", listener);
214
+ import_node_process.default.off("message", listener);
204
215
  };
205
216
  }
206
217
  function waitForIpc(messageType, options = {}) {
package/dist/json/edit.js CHANGED
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
20
  };
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
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
  var edit_exports = {};
21
31
  __export(edit_exports, {
@@ -23,6 +33,7 @@ __export(edit_exports, {
23
33
  });
24
34
  module.exports = __toCommonJS(edit_exports);
25
35
  var import_promises = require("node:timers/promises");
36
+ var import_node_process = __toESM(require("node:process"));
26
37
  var import_format = require("./format");
27
38
  const identSymbol = import_format.INDENT_SYMBOL;
28
39
  const newlineSymbol = import_format.NEWLINE_SYMBOL;
@@ -41,7 +52,7 @@ async function retryWrite(filepath, content, retries = 3, baseDelay = 10) {
41
52
  for (let attempt = 0; attempt <= retries; attempt++) {
42
53
  try {
43
54
  await fsPromises.writeFile(filepath, content);
44
- if (process.platform === "win32") {
55
+ if (import_node_process.default.platform === "win32") {
45
56
  await (0, import_promises.setTimeout)(50);
46
57
  let accessRetries = 0;
47
58
  const maxAccessRetries = 5;
@@ -74,7 +85,7 @@ function parseJson(content) {
74
85
  }
75
86
  async function readFile(filepath) {
76
87
  const { promises: fsPromises } = /* @__PURE__ */ getFs();
77
- const maxRetries = process.platform === "win32" ? 5 : 1;
88
+ const maxRetries = import_node_process.default.platform === "win32" ? 5 : 1;
78
89
  for (let attempt = 0; attempt <= maxRetries; attempt++) {
79
90
  try {
80
91
  return await fsPromises.readFile(filepath, "utf8");
@@ -84,7 +95,7 @@ async function readFile(filepath) {
84
95
  if (!isEnoent || isLastAttempt) {
85
96
  throw err;
86
97
  }
87
- const delay = process.platform === "win32" ? 50 * (attempt + 1) : 20;
98
+ const delay = import_node_process.default.platform === "win32" ? 50 * (attempt + 1) : 20;
88
99
  await (0, import_promises.setTimeout)(delay);
89
100
  }
90
101
  }
package/dist/logger.js CHANGED
@@ -36,6 +36,7 @@ __export(logger_exports, {
36
36
  lastWasBlankSymbol: () => lastWasBlankSymbol
37
37
  });
38
38
  module.exports = __toCommonJS(logger_exports);
39
+ var import_node_process = __toESM(require("node:process"));
39
40
  var import_is_unicode_supported = __toESM(require("./external/@socketregistry/is-unicode-supported"));
40
41
  var import_yoctocolors_cjs = __toESM(require("./external/yoctocolors-cjs"));
41
42
  var import_strings = require("./strings");
@@ -282,8 +283,8 @@ class Logger {
282
283
  con = /* @__PURE__ */ constructConsole(...ctorArgs);
283
284
  } else {
284
285
  con = /* @__PURE__ */ constructConsole({
285
- stdout: process.stdout,
286
- stderr: process.stderr
286
+ stdout: import_node_process.default.stdout,
287
+ stderr: import_node_process.default.stderr
287
288
  });
288
289
  for (const { 0: key, 1: method } of boundConsoleEntries) {
289
290
  con[key] = method;
@@ -1442,8 +1443,8 @@ function ensurePrototypeInitialized() {
1442
1443
  con = /* @__PURE__ */ constructConsole(...ctorArgs);
1443
1444
  } else {
1444
1445
  con = /* @__PURE__ */ constructConsole({
1445
- stdout: process.stdout,
1446
- stderr: process.stderr
1446
+ stdout: import_node_process.default.stdout,
1447
+ stderr: import_node_process.default.stderr
1447
1448
  });
1448
1449
  for (const { 0: k, 1: method } of boundConsoleEntries) {
1449
1450
  con[k] = method;
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
20
  };
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
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
  var performance_exports = {};
21
31
  __export(performance_exports, {
@@ -31,10 +41,11 @@ __export(performance_exports, {
31
41
  trackMemory: () => trackMemory
32
42
  });
33
43
  module.exports = __toCommonJS(performance_exports);
44
+ var import_node_process = __toESM(require("node:process"));
34
45
  var import_debug = require("./debug");
35
46
  const performanceMetrics = [];
36
47
  function isPerfEnabled() {
37
- return process.env["DEBUG"]?.includes("perf") || false;
48
+ return import_node_process.default.env["DEBUG"]?.includes("perf") || false;
38
49
  }
39
50
  function perfTimer(operation, metadata) {
40
51
  if (!isPerfEnabled()) {
@@ -155,7 +166,7 @@ function trackMemory(label) {
155
166
  if (!isPerfEnabled()) {
156
167
  return 0;
157
168
  }
158
- const usage = process.memoryUsage();
169
+ const usage = import_node_process.default.memoryUsage();
159
170
  const heapUsedMB = Math.round(usage.heapUsed / 1024 / 1024 * 100) / 100;
160
171
  (0, import_debug.debugLog)(`[perf] [MEMORY] ${label}: ${heapUsedMB}MB heap used`);
161
172
  const metric = {
@@ -40,6 +40,7 @@ __export(github_exports, {
40
40
  getReleaseAssetUrl: () => getReleaseAssetUrl
41
41
  });
42
42
  module.exports = __toCommonJS(github_exports);
43
+ var import_node_process = __toESM(require("node:process"));
43
44
  var import_picomatch = __toESM(require("../external/picomatch.js"));
44
45
  var import_archives = require("../archives.js");
45
46
  var import_fs = require("../fs.js");
@@ -92,7 +93,7 @@ async function downloadGitHubRelease(config) {
92
93
  const {
93
94
  assetName,
94
95
  binaryName,
95
- cwd = process.cwd(),
96
+ cwd = import_node_process.default.cwd(),
96
97
  downloadDir = "build/downloaded",
97
98
  owner,
98
99
  platformArch,
@@ -147,7 +148,7 @@ async function downloadGitHubRelease(config) {
147
148
  const isWindows = binaryName.endsWith(".exe");
148
149
  if (!isWindows) {
149
150
  fs.chmodSync(binaryPath, 493);
150
- if (removeMacOSQuarantine && process.platform === "darwin" && platformArch.startsWith("darwin")) {
151
+ if (removeMacOSQuarantine && import_node_process.default.platform === "darwin" && platformArch.startsWith("darwin")) {
151
152
  try {
152
153
  await (0, import_spawn.spawn)("xattr", ["-d", "com.apple.quarantine", binaryPath], {
153
154
  stdio: "ignore"
@@ -185,7 +186,7 @@ async function downloadReleaseAsset(tag, assetPattern, outputPath, repoConfig, o
185
186
  });
186
187
  }
187
188
  function getAuthHeaders() {
188
- const token = process.env["GH_TOKEN"] || process.env["GITHUB_TOKEN"];
189
+ const token = import_node_process.default.env["GH_TOKEN"] || import_node_process.default.env["GITHUB_TOKEN"];
189
190
  const headers = {
190
191
  Accept: "application/vnd.github+json",
191
192
  "X-GitHub-Api-Version": "2022-11-28"
package/dist/sea.js CHANGED
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
20
  };
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
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
  var sea_exports = {};
21
31
  __export(sea_exports, {
@@ -23,10 +33,11 @@ __export(sea_exports, {
23
33
  isSeaBinary: () => isSeaBinary
24
34
  });
25
35
  module.exports = __toCommonJS(sea_exports);
36
+ var import_node_process = __toESM(require("node:process"));
26
37
  var import_normalize = require("./paths/normalize");
27
38
  let _isSea;
28
39
  function getSeaBinaryPath() {
29
- return isSeaBinary() && process.argv[0] ? (0, import_normalize.normalizePath)(process.argv[0]) : void 0;
40
+ return isSeaBinary() && import_node_process.default.argv[0] ? (0, import_normalize.normalizePath)(import_node_process.default.argv[0]) : void 0;
30
41
  }
31
42
  function isSeaBinary() {
32
43
  if (_isSea === void 0) {
package/dist/shadow.js CHANGED
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,27 +18,36 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
20
  };
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
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
  var shadow_exports = {};
21
31
  __export(shadow_exports, {
22
32
  shouldSkipShadow: () => shouldSkipShadow
23
33
  });
24
34
  module.exports = __toCommonJS(shadow_exports);
35
+ var import_node_process = __toESM(require("node:process"));
25
36
  var import_normalize = require("./paths/normalize");
26
37
  function shouldSkipShadow(binPath, options) {
27
- const { cwd = process.cwd(), win32 = false } = {
38
+ const { cwd = import_node_process.default.cwd(), win32 = false } = {
28
39
  __proto__: null,
29
40
  ...options
30
41
  };
31
42
  if (win32 && binPath) {
32
43
  return true;
33
44
  }
34
- const userAgent = process.env["npm_config_user_agent"];
45
+ const userAgent = import_node_process.default.env["npm_config_user_agent"];
35
46
  if (userAgent?.includes("exec") || userAgent?.includes("npx") || userAgent?.includes("dlx")) {
36
47
  return true;
37
48
  }
38
49
  const normalizedCwd = (0, import_normalize.normalizePath)(cwd);
39
- const npmCache = process.env["npm_config_cache"];
50
+ const npmCache = import_node_process.default.env["npm_config_cache"];
40
51
  if (npmCache && normalizedCwd.includes((0, import_normalize.normalizePath)(npmCache))) {
41
52
  return true;
42
53
  }
package/dist/spawn.js CHANGED
@@ -36,6 +36,7 @@ __export(spawn_exports, {
36
36
  spawnSync: () => spawnSync
37
37
  });
38
38
  module.exports = __toCommonJS(spawn_exports);
39
+ var import_node_process = __toESM(require("node:process"));
39
40
  var import_process = require("./constants/process");
40
41
  var import_errors = require("./errors");
41
42
  var import_promise_spawn = __toESM(require("./external/@npmcli/promise-spawn"));
@@ -204,7 +205,7 @@ function spawn(cmd, args, options, extra) {
204
205
  }
205
206
  }
206
207
  }
207
- const WIN32 = process.platform === "win32";
208
+ const WIN32 = import_node_process.default.platform === "win32";
208
209
  if (WIN32 && shell && windowsScriptExtRegExp.test(actualCmd)) {
209
210
  if (!(0, import_normalize.isPath)(actualCmd)) {
210
211
  actualCmd = (/* @__PURE__ */ getPath()).basename(actualCmd, (/* @__PURE__ */ getPath()).extname(actualCmd));
@@ -218,9 +219,9 @@ function spawn(cmd, args, options, extra) {
218
219
  }
219
220
  const envToUse = env ? {
220
221
  __proto__: null,
221
- ...process.env,
222
+ ...import_node_process.default.env,
222
223
  ...env
223
- } : process.env;
224
+ } : import_node_process.default.env;
224
225
  const promiseSpawnOpts = {
225
226
  __proto__: null,
226
227
  cwd: typeof spawnOptions.cwd === "string" ? spawnOptions.cwd : void 0,
@@ -290,7 +291,7 @@ function spawnSync(cmd, args, options) {
290
291
  }
291
292
  }
292
293
  const shell = (0, import_objects.getOwn)(options, "shell");
293
- const WIN32 = process.platform === "win32";
294
+ const WIN32 = import_node_process.default.platform === "win32";
294
295
  if (WIN32 && shell && windowsScriptExtRegExp.test(actualCmd)) {
295
296
  if (!(0, import_normalize.isPath)(actualCmd)) {
296
297
  actualCmd = (/* @__PURE__ */ getPath()).basename(actualCmd, (/* @__PURE__ */ getPath()).extname(actualCmd));
package/dist/spinner.d.ts CHANGED
@@ -1,7 +1,3 @@
1
- /**
2
- * @fileoverview CLI spinner utilities for long-running operations.
3
- * Provides animated progress indicators with CI environment detection.
4
- */
5
1
  import type { Writable } from 'stream';
6
2
  import type { ColorInherit, ColorRgb, ColorValue } from './colors';
7
3
  import type { ShimmerColorGradient, ShimmerConfig, ShimmerDirection, ShimmerState } from './effects/text-shimmer';
package/dist/spinner.js CHANGED
@@ -38,6 +38,7 @@ __export(spinner_exports, {
38
38
  withSpinnerSync: () => withSpinnerSync
39
39
  });
40
40
  module.exports = __toCommonJS(spinner_exports);
41
+ var import_node_process = __toESM(require("node:process"));
41
42
  var import_yoctocolors_cjs = __toESM(require("./external/yoctocolors-cjs"));
42
43
  var import_colors = require("./colors");
43
44
  var import_process = require("./constants/process");
@@ -881,7 +882,7 @@ async function withSpinner(options) {
881
882
  const wasSpinning = spinner.isSpinning;
882
883
  spinner.stop();
883
884
  if (wasSpinning) {
884
- process.stderr.write("\r\x1B[2K");
885
+ import_node_process.default.stderr.write("\r\x1B[2K");
885
886
  }
886
887
  if (savedColor !== void 0) {
887
888
  spinner.color = savedColor;
@@ -1,24 +1,3 @@
1
- /**
2
- * @fileoverview Terminal clearing and cursor utilities.
3
- * Provides functions for clearing lines, screens, and managing cursor position.
4
- */
5
- /**
6
- * Clear the current line in the terminal.
7
- * Uses native TTY methods when available, falls back to ANSI escape codes.
8
- *
9
- * ANSI Sequences:
10
- * - `\r`: Carriage return (move to line start)
11
- * - `\x1b[K`: Clear from cursor to end of line
12
- *
13
- * @param stream - Output stream to clear
14
- * @default stream process.stdout
15
- *
16
- * @example
17
- * ```ts
18
- * clearLine() // Clear current line on stdout
19
- * clearLine(process.stderr) // Clear on stderr
20
- * ```
21
- */
22
1
  export declare function clearLine(stream?: NodeJS.WriteStream): void;
23
2
  /**
24
3
  * Clear multiple lines above the current cursor position.