@socketsecurity/lib 5.11.2 → 5.11.3

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/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [5.11.3](https://github.com/SocketDev/socket-lib/releases/tag/v5.11.3) - 2026-03-26
9
+
10
+ ### Fixed
11
+
12
+ - **build**: Deduplicate shared deps across external bundles (#110)
13
+ - **quality**: Comprehensive quality scan fixes across codebase (#111)
14
+ - **releases**: Add in-memory TTL cache for GitHub API responses
15
+ - **releases**: Guard against missing assets in GitHub release response (#112)
16
+ - **process-lock**: Fix Windows path separator handling for lock directory creation (#112)
17
+
8
18
  ## [5.11.2](https://github.com/SocketDev/socket-lib/releases/tag/v5.11.2) - 2026-03-24
9
19
 
10
20
  ### Added
package/dist/abort.js CHANGED
@@ -51,9 +51,7 @@ function createTimeoutSignal(ms) {
51
51
  if (ms <= 0) {
52
52
  throw new TypeError("timeout must be a positive number");
53
53
  }
54
- const controller = new AbortController();
55
- setTimeout(() => controller.abort(), ms);
56
- return controller.signal;
54
+ return AbortSignal.timeout(Math.ceil(ms));
57
55
  }
58
56
  // Annotate the CommonJS export names for ESM import in node:
59
57
  0 && (module.exports = {
package/dist/ansi.js CHANGED
@@ -39,7 +39,7 @@ const ANSI_REGEX = /\x1b\[[0-9;]*m/g;
39
39
  // @__NO_SIDE_EFFECTS__
40
40
  function ansiRegex(options) {
41
41
  const { onlyFirst } = options ?? {};
42
- const ST = "(?:\\u0007\\u001B\\u005C|\\u009C)";
42
+ const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
43
43
  const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
44
44
  const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
45
45
  const pattern = `${osc}|${csi}`;
@@ -157,12 +157,7 @@ function getPositionalArgs(startIndex = 2) {
157
157
  return positionals;
158
158
  }
159
159
  function hasFlag(flag, argv = import_node_process.default.argv) {
160
- const flagVariants = [
161
- `--${flag}`,
162
- // Short flag.
163
- `-${flag.charAt(0)}`
164
- ];
165
- return flagVariants.some((variant) => argv.includes(variant));
160
+ return argv.includes(`--${flag}`);
166
161
  }
167
162
  // Annotate the CommonJS export names for ESM import in node:
168
163
  0 && (module.exports = {
@@ -90,9 +90,16 @@ function createTtlCache(options) {
90
90
  }
91
91
  const cacheEntry = await cacache.safeGet(fullKey);
92
92
  if (cacheEntry) {
93
- const entry = JSON.parse(
94
- cacheEntry.data.toString("utf8")
95
- );
93
+ let entry;
94
+ try {
95
+ entry = JSON.parse(cacheEntry.data.toString("utf8"));
96
+ } catch {
97
+ try {
98
+ await cacache.remove(fullKey);
99
+ } catch {
100
+ }
101
+ return void 0;
102
+ }
96
103
  if (!isExpired(entry)) {
97
104
  if (opts.memoize) {
98
105
  memoCache.set(fullKey, entry);
@@ -45,6 +45,8 @@ function getPath() {
45
45
  }
46
46
  return _path;
47
47
  }
48
+ const fs = /* @__PURE__ */ getFs();
49
+ const path = /* @__PURE__ */ getPath();
48
50
  const logger = (0, import_logger.getDefaultLogger)();
49
51
  const MANIFEST_FILE_NAME = ".dlx-manifest.json";
50
52
  function isBinaryEntry(entry) {
@@ -57,7 +59,7 @@ class DlxManifest {
57
59
  manifestPath;
58
60
  lockPath;
59
61
  constructor(options = {}) {
60
- this.manifestPath = options.manifestPath ?? (/* @__PURE__ */ getPath()).join((0, import_socket.getSocketDlxDir)(), MANIFEST_FILE_NAME);
62
+ this.manifestPath = options.manifestPath ?? path.join((0, import_socket.getSocketDlxDir)(), MANIFEST_FILE_NAME);
61
63
  this.lockPath = `${this.manifestPath}.lock`;
62
64
  }
63
65
  /**
@@ -66,7 +68,7 @@ class DlxManifest {
66
68
  */
67
69
  readManifest() {
68
70
  try {
69
- if (!(/* @__PURE__ */ getFs()).existsSync(this.manifestPath)) {
71
+ if (!fs.existsSync(this.manifestPath)) {
70
72
  return /* @__PURE__ */ Object.create(null);
71
73
  }
72
74
  const rawContent = (0, import_fs.readFileUtf8Sync)(this.manifestPath);
@@ -87,7 +89,7 @@ class DlxManifest {
87
89
  * @private
88
90
  */
89
91
  async writeManifest(data) {
90
- const manifestDir = (/* @__PURE__ */ getPath()).dirname(this.manifestPath);
92
+ const manifestDir = path.dirname(this.manifestPath);
91
93
  try {
92
94
  (0, import_fs.safeMkdirSync)(manifestDir, { recursive: true });
93
95
  } catch (error) {
@@ -98,18 +100,12 @@ class DlxManifest {
98
100
  const content = JSON.stringify(data, null, 2);
99
101
  const tempPath = `${this.manifestPath}.tmp`;
100
102
  try {
101
- (/* @__PURE__ */ getFs()).writeFileSync(tempPath, content, "utf8");
102
- (/* @__PURE__ */ getFs()).writeFileSync(this.manifestPath, content, "utf8");
103
- try {
104
- if ((/* @__PURE__ */ getFs()).existsSync(tempPath)) {
105
- (/* @__PURE__ */ getFs()).unlinkSync(tempPath);
106
- }
107
- } catch {
108
- }
103
+ fs.writeFileSync(tempPath, content, "utf8");
104
+ fs.renameSync(tempPath, this.manifestPath);
109
105
  } catch (error) {
110
106
  try {
111
- if ((/* @__PURE__ */ getFs()).existsSync(tempPath)) {
112
- (/* @__PURE__ */ getFs()).unlinkSync(tempPath);
107
+ if (fs.existsSync(tempPath)) {
108
+ fs.unlinkSync(tempPath);
113
109
  }
114
110
  } catch {
115
111
  }
@@ -122,17 +118,16 @@ class DlxManifest {
122
118
  async clear(name) {
123
119
  await import_process_lock.processLock.withLock(this.lockPath, async () => {
124
120
  try {
125
- if (!(/* @__PURE__ */ getFs()).existsSync(this.manifestPath)) {
121
+ if (!fs.existsSync(this.manifestPath)) {
126
122
  return;
127
123
  }
128
- const content = (/* @__PURE__ */ getFs()).readFileSync(this.manifestPath, "utf8");
124
+ const content = fs.readFileSync(this.manifestPath, "utf8");
129
125
  if (!content.trim()) {
130
126
  return;
131
127
  }
132
128
  const data = JSON.parse(content);
133
129
  delete data[name];
134
- const updatedContent = JSON.stringify(data, null, 2);
135
- (/* @__PURE__ */ getFs()).writeFileSync(this.manifestPath, updatedContent, "utf8");
130
+ await this.writeManifest(data);
136
131
  } catch (error) {
137
132
  logger.warn(
138
133
  `Failed to clear cache for ${name}: ${error instanceof Error ? error.message : String(error)}`
@@ -146,8 +141,8 @@ class DlxManifest {
146
141
  async clearAll() {
147
142
  await import_process_lock.processLock.withLock(this.lockPath, async () => {
148
143
  try {
149
- if ((/* @__PURE__ */ getFs()).existsSync(this.manifestPath)) {
150
- (/* @__PURE__ */ getFs()).unlinkSync(this.manifestPath);
144
+ if (fs.existsSync(this.manifestPath)) {
145
+ fs.unlinkSync(this.manifestPath);
151
146
  }
152
147
  } catch (error) {
153
148
  logger.warn(
@@ -173,7 +168,7 @@ class DlxManifest {
173
168
  */
174
169
  getAllPackages() {
175
170
  try {
176
- if (!(/* @__PURE__ */ getFs()).existsSync(this.manifestPath)) {
171
+ if (!fs.existsSync(this.manifestPath)) {
177
172
  return [];
178
173
  }
179
174
  const rawContent = (0, import_fs.readFileUtf8Sync)(this.manifestPath);
@@ -219,8 +214,8 @@ class DlxManifest {
219
214
  await import_process_lock.processLock.withLock(this.lockPath, async () => {
220
215
  let data = /* @__PURE__ */ Object.create(null);
221
216
  try {
222
- if ((/* @__PURE__ */ getFs()).existsSync(this.manifestPath)) {
223
- const content2 = (/* @__PURE__ */ getFs()).readFileSync(this.manifestPath, "utf8");
217
+ if (fs.existsSync(this.manifestPath)) {
218
+ const content2 = fs.readFileSync(this.manifestPath, "utf8");
224
219
  if (content2.trim()) {
225
220
  data = JSON.parse(content2);
226
221
  }
@@ -231,7 +226,7 @@ class DlxManifest {
231
226
  );
232
227
  }
233
228
  data[name] = record;
234
- const manifestDir = (/* @__PURE__ */ getPath()).dirname(this.manifestPath);
229
+ const manifestDir = path.dirname(this.manifestPath);
235
230
  try {
236
231
  (0, import_fs.safeMkdirSync)(manifestDir, { recursive: true });
237
232
  } catch (error) {
@@ -242,18 +237,12 @@ class DlxManifest {
242
237
  const content = JSON.stringify(data, null, 2);
243
238
  const tempPath = `${this.manifestPath}.tmp`;
244
239
  try {
245
- (/* @__PURE__ */ getFs()).writeFileSync(tempPath, content, "utf8");
246
- (/* @__PURE__ */ getFs()).writeFileSync(this.manifestPath, content, "utf8");
247
- try {
248
- if ((/* @__PURE__ */ getFs()).existsSync(tempPath)) {
249
- (/* @__PURE__ */ getFs()).unlinkSync(tempPath);
250
- }
251
- } catch {
252
- }
240
+ fs.writeFileSync(tempPath, content, "utf8");
241
+ fs.renameSync(tempPath, this.manifestPath);
253
242
  } catch (error) {
254
243
  try {
255
- if ((/* @__PURE__ */ getFs()).existsSync(tempPath)) {
256
- (/* @__PURE__ */ getFs()).unlinkSync(tempPath);
244
+ if (fs.existsSync(tempPath)) {
245
+ fs.unlinkSync(tempPath);
257
246
  }
258
247
  } catch {
259
248
  }
@@ -235,7 +235,7 @@ var require_update_workspaces = __commonJS({
235
235
  var require_debug = __commonJS({
236
236
  "node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js"(exports2, module2) {
237
237
  "use strict";
238
- var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => void 0 : () => {
238
+ var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
239
239
  };
240
240
  module2.exports = debug;
241
241
  }
@@ -889,7 +889,7 @@ var require_commonjs = __commonJS({
889
889
  var warned = /* @__PURE__ */ new Set();
890
890
  var PROCESS = typeof process === "object" && !!process ? process : {};
891
891
  var emitWarning = /* @__PURE__ */ __name((msg, type, code, fn) => {
892
- typeof PROCESS.emitWarning === "function" ? PROCESS.emitWarning(msg, type, code, fn) : void 0;
892
+ typeof PROCESS.emitWarning === "function" ? PROCESS.emitWarning(msg, type, code, fn) : console.error(`[${code}] ${type}: ${msg}`);
893
893
  }, "emitWarning");
894
894
  var AC = globalThis.AbortController;
895
895
  var AS = globalThis.AbortSignal;
@@ -3903,7 +3903,7 @@ var require_commonjs2 = __commonJS({
3903
3903
  this.parseNegate();
3904
3904
  this.globSet = [...new Set(this.braceExpand())];
3905
3905
  if (options.debug) {
3906
- this.debug = (...args) => void 0;
3906
+ this.debug = (...args) => console.error(...args);
3907
3907
  }
3908
3908
  this.debug(this.pattern, this.globSet);
3909
3909
  const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
@@ -10656,9 +10656,11 @@ var require_retry_operation = __commonJS({
10656
10656
  this._fn(this._attempts);
10657
10657
  };
10658
10658
  RetryOperation.prototype.try = function(fn) {
10659
+ /* @__PURE__ */ console.log("Using RetryOperation.try() is deprecated");
10659
10660
  this.attempt(fn);
10660
10661
  };
10661
10662
  RetryOperation.prototype.start = function(fn) {
10663
+ /* @__PURE__ */ console.log("Using RetryOperation.start() is deprecated");
10662
10664
  this.attempt(fn);
10663
10665
  };
10664
10666
  RetryOperation.prototype.start = RetryOperation.prototype.try;
@@ -578,6 +578,7 @@ var require_fattr = __commonJS({
578
578
  _obj.readonly = (128 & _stat.mode) === 0;
579
579
  _obj.hidden = pth.basename(_path)[0] === ".";
580
580
  } else {
581
+ /* @__PURE__ */ console.warn("Invalid path: " + _path);
581
582
  }
582
583
  return {
583
584
  get directory() {
@@ -159,9 +159,9 @@ var require_ms = __commonJS({
159
159
  }
160
160
  });
161
161
 
162
- // node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/common.js
162
+ // node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/common.js
163
163
  var require_common = __commonJS({
164
- "node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/common.js"(exports2, module2) {
164
+ "node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/common.js"(exports2, module2) {
165
165
  function setup(env2) {
166
166
  createDebug.debug = createDebug;
167
167
  createDebug.default = createDebug;
@@ -336,6 +336,7 @@ var require_common = __commonJS({
336
336
  }
337
337
  __name(coerce, "coerce");
338
338
  function destroy() {
339
+ /* @__PURE__ */ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
339
340
  }
340
341
  __name(destroy, "destroy");
341
342
  createDebug.enable(createDebug.load());
@@ -346,9 +347,9 @@ var require_common = __commonJS({
346
347
  }
347
348
  });
348
349
 
349
- // node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/browser.js
350
+ // node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/browser.js
350
351
  var require_browser = __commonJS({
351
- "node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/browser.js"(exports2, module2) {
352
+ "node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/browser.js"(exports2, module2) {
352
353
  exports2.formatArgs = formatArgs;
353
354
  exports2.save = save;
354
355
  exports2.load = load;
@@ -359,6 +360,7 @@ var require_browser = __commonJS({
359
360
  return () => {
360
361
  if (!warned) {
361
362
  warned = true;
363
+ /* @__PURE__ */ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
362
364
  }
363
365
  };
364
366
  })();
@@ -519,7 +521,7 @@ var require_browser = __commonJS({
519
521
  }
520
522
  });
521
523
 
522
- // node_modules/.pnpm/supports-color@10.0.0/node_modules/supports-color/index.js
524
+ // node_modules/.pnpm/supports-color@10.2.2/node_modules/supports-color/index.js
523
525
  var supports_color_exports = {};
524
526
  __export(supports_color_exports, {
525
527
  createSupportsColor: () => createSupportsColor,
@@ -613,6 +615,12 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
613
615
  if (env.TERM === "xterm-kitty") {
614
616
  return 3;
615
617
  }
618
+ if (env.TERM === "xterm-ghostty") {
619
+ return 3;
620
+ }
621
+ if (env.TERM === "wezterm") {
622
+ return 3;
623
+ }
616
624
  if ("TERM_PROGRAM" in env) {
617
625
  const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
618
626
  switch (env.TERM_PROGRAM) {
@@ -644,7 +652,7 @@ function createSupportsColor(stream, options = {}) {
644
652
  }
645
653
  var import_node_process, import_node_os, import_node_tty, env, flagForceColor, supportsColor, supports_color_default;
646
654
  var init_supports_color = __esm({
647
- "node_modules/.pnpm/supports-color@10.0.0/node_modules/supports-color/index.js"() {
655
+ "node_modules/.pnpm/supports-color@10.2.2/node_modules/supports-color/index.js"() {
648
656
  import_node_process = __toESM(require("node:process"), 1);
649
657
  import_node_os = __toESM(require("node:os"), 1);
650
658
  import_node_tty = __toESM(require("node:tty"), 1);
@@ -667,9 +675,9 @@ var init_supports_color = __esm({
667
675
  }
668
676
  });
669
677
 
670
- // node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/node.js
678
+ // node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/node.js
671
679
  var require_node = __commonJS({
672
- "node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/node.js"(exports2, module2) {
680
+ "node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/node.js"(exports2, module2) {
673
681
  var tty2 = require("tty");
674
682
  var util = require("util");
675
683
  exports2.init = init;
@@ -848,9 +856,9 @@ var require_node = __commonJS({
848
856
  }
849
857
  });
850
858
 
851
- // node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/index.js
859
+ // node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/index.js
852
860
  var require_src = __commonJS({
853
- "node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/index.js"(exports2, module2) {
861
+ "node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/index.js"(exports2, module2) {
854
862
  if (typeof process === "undefined" || process.type === "renderer" || false || process.__nwjs) {
855
863
  module2.exports = require_browser();
856
864
  } else {
@@ -317,7 +317,7 @@ var require_cjs = __commonJS({
317
317
  }
318
318
  });
319
319
 
320
- // node_modules/.pnpm/supports-color@10.0.0/node_modules/supports-color/index.js
320
+ // node_modules/.pnpm/supports-color@10.2.2/node_modules/supports-color/index.js
321
321
  var supports_color_exports = {};
322
322
  __export(supports_color_exports, {
323
323
  createSupportsColor: () => createSupportsColor,
@@ -411,6 +411,12 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
411
411
  if (env.TERM === "xterm-kitty") {
412
412
  return 3;
413
413
  }
414
+ if (env.TERM === "xterm-ghostty") {
415
+ return 3;
416
+ }
417
+ if (env.TERM === "wezterm") {
418
+ return 3;
419
+ }
414
420
  if ("TERM_PROGRAM" in env) {
415
421
  const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
416
422
  switch (env.TERM_PROGRAM) {
@@ -442,7 +448,7 @@ function createSupportsColor(stream, options = {}) {
442
448
  }
443
449
  var import_node_process, import_node_os, import_node_tty, env, flagForceColor, supportsColor, supports_color_default;
444
450
  var init_supports_color = __esm({
445
- "node_modules/.pnpm/supports-color@10.0.0/node_modules/supports-color/index.js"() {
451
+ "node_modules/.pnpm/supports-color@10.2.2/node_modules/supports-color/index.js"() {
446
452
  import_node_process = __toESM(require("node:process"), 1);
447
453
  import_node_os = __toESM(require("node:os"), 1);
448
454
  import_node_tty = __toESM(require("node:tty"), 1);
@@ -11,9 +11,9 @@ var __commonJS = (cb, mod) => function __require() {
11
11
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
12
  };
13
13
 
14
- // node_modules/.pnpm/libnpmexec@10.2.3_supports-color@10.0.0/node_modules/libnpmexec/lib/get-bin-from-manifest.js
14
+ // node_modules/.pnpm/libnpmexec@10.2.3_supports-color@10.2.2/node_modules/libnpmexec/lib/get-bin-from-manifest.js
15
15
  var require_get_bin_from_manifest = __commonJS({
16
- "node_modules/.pnpm/libnpmexec@10.2.3_supports-color@10.0.0/node_modules/libnpmexec/lib/get-bin-from-manifest.js"(exports2, module2) {
16
+ "node_modules/.pnpm/libnpmexec@10.2.3_supports-color@10.2.2/node_modules/libnpmexec/lib/get-bin-from-manifest.js"(exports2, module2) {
17
17
  var getBinFromManifest2 = /* @__PURE__ */ __name((mani) => {
18
18
  const bin = mani.bin || {};
19
19
  if (new Set(Object.values(bin)).size === 1) {