@socketsecurity/lib 5.4.0 → 5.5.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.
@@ -1,5 +1,5 @@
1
1
  'use strict'
2
2
 
3
- // Re-export from npm-core bundle for better deduplication
4
- const { npmPackageArg } = require('./npm-core')
3
+ // Re-export from npm-pack bundle for better deduplication.
4
+ const { npmPackageArg } = require('./npm-pack')
5
5
  module.exports = npmPackageArg
@@ -1,5 +1,5 @@
1
1
  'use strict'
2
2
 
3
- // Re-export from npm-core bundle for better deduplication
4
- const { semver } = require('./npm-core')
3
+ // Re-export from npm-pack bundle for better deduplication.
4
+ const { semver } = require('./npm-pack')
5
5
  module.exports = semver
@@ -0,0 +1,5 @@
1
+ 'use strict'
2
+
3
+ // Re-export from external-pack bundle for better deduplication.
4
+ const { signalExit } = require('./external-pack')
5
+ module.exports = signalExit
@@ -0,0 +1,8 @@
1
+ 'use strict'
2
+
3
+ // Re-export from external-pack bundle for better deduplication.
4
+ const { supportsColor } = require('./external-pack')
5
+ // supports-color is an ESM module, re-export all properties.
6
+ const exported = supportsColor.default || supportsColor
7
+ Object.assign(module.exports, exported)
8
+ module.exports.default = exported
@@ -1,5 +1,5 @@
1
1
  'use strict'
2
2
 
3
- // Re-export from npm-core bundle for better deduplication.
4
- const { validateNpmPackageName } = require('./npm-core')
3
+ // Re-export from npm-pack bundle for better deduplication.
4
+ const { validateNpmPackageName } = require('./npm-pack')
5
5
  module.exports = validateNpmPackageName
@@ -1,93 +1,6 @@
1
- "use strict";
2
- /**
3
- * Bundled from yoctocolors-cjs
4
- * This is a zero-dependency bundle created by esbuild.
5
- */
6
- "use strict";
7
- var __defProp = Object.defineProperty;
8
- var __getOwnPropNames = Object.getOwnPropertyNames;
9
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
- var __commonJS = (cb, mod) => function __require() {
11
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
- };
1
+ 'use strict'
13
2
 
14
- // node_modules/.pnpm/yoctocolors-cjs@2.1.3/node_modules/yoctocolors-cjs/index.js
15
- var require_yoctocolors_cjs = __commonJS({
16
- "node_modules/.pnpm/yoctocolors-cjs@2.1.3/node_modules/yoctocolors-cjs/index.js"(exports2, module2) {
17
- var tty = require("node:tty");
18
- var hasColors = tty?.WriteStream?.prototype?.hasColors?.() ?? false;
19
- var format = /* @__PURE__ */ __name((open, close) => {
20
- if (!hasColors) {
21
- return (input) => input;
22
- }
23
- const openCode = `\x1B[${open}m`;
24
- const closeCode = `\x1B[${close}m`;
25
- return (input) => {
26
- const string = input + "";
27
- let index = string.indexOf(closeCode);
28
- if (index === -1) {
29
- return openCode + string + closeCode;
30
- }
31
- let result = openCode;
32
- let lastIndex = 0;
33
- const reopenOnNestedClose = close === 22;
34
- const replaceCode = (reopenOnNestedClose ? closeCode : "") + openCode;
35
- while (index !== -1) {
36
- result += string.slice(lastIndex, index) + replaceCode;
37
- lastIndex = index + closeCode.length;
38
- index = string.indexOf(closeCode, lastIndex);
39
- }
40
- result += string.slice(lastIndex) + closeCode;
41
- return result;
42
- };
43
- }, "format");
44
- var colors2 = {};
45
- colors2.reset = format(0, 0);
46
- colors2.bold = format(1, 22);
47
- colors2.dim = format(2, 22);
48
- colors2.italic = format(3, 23);
49
- colors2.underline = format(4, 24);
50
- colors2.overline = format(53, 55);
51
- colors2.inverse = format(7, 27);
52
- colors2.hidden = format(8, 28);
53
- colors2.strikethrough = format(9, 29);
54
- colors2.black = format(30, 39);
55
- colors2.red = format(31, 39);
56
- colors2.green = format(32, 39);
57
- colors2.yellow = format(33, 39);
58
- colors2.blue = format(34, 39);
59
- colors2.magenta = format(35, 39);
60
- colors2.cyan = format(36, 39);
61
- colors2.white = format(37, 39);
62
- colors2.gray = format(90, 39);
63
- colors2.bgBlack = format(40, 49);
64
- colors2.bgRed = format(41, 49);
65
- colors2.bgGreen = format(42, 49);
66
- colors2.bgYellow = format(43, 49);
67
- colors2.bgBlue = format(44, 49);
68
- colors2.bgMagenta = format(45, 49);
69
- colors2.bgCyan = format(46, 49);
70
- colors2.bgWhite = format(47, 49);
71
- colors2.bgGray = format(100, 49);
72
- colors2.redBright = format(91, 39);
73
- colors2.greenBright = format(92, 39);
74
- colors2.yellowBright = format(93, 39);
75
- colors2.blueBright = format(94, 39);
76
- colors2.magentaBright = format(95, 39);
77
- colors2.cyanBright = format(96, 39);
78
- colors2.whiteBright = format(97, 39);
79
- colors2.bgRedBright = format(101, 49);
80
- colors2.bgGreenBright = format(102, 49);
81
- colors2.bgYellowBright = format(103, 49);
82
- colors2.bgBlueBright = format(104, 49);
83
- colors2.bgMagentaBright = format(105, 49);
84
- colors2.bgCyanBright = format(106, 49);
85
- colors2.bgWhiteBright = format(107, 49);
86
- module2.exports = colors2;
87
- }
88
- });
89
-
90
- // src/external/yoctocolors-cjs.js
91
- var colors = require_yoctocolors_cjs();
92
- module.exports = colors;
93
- module.exports.default = colors;
3
+ // Re-export from external-pack bundle for better deduplication.
4
+ const { yoctocolorsCjs } = require('./external-pack')
5
+ module.exports = yoctocolorsCjs
6
+ module.exports.default = yoctocolorsCjs
@@ -133,28 +133,38 @@ async function getLatestRelease(toolPrefix, repoConfig, options = {}) {
133
133
  throw new Error(`Failed to fetch releases: ${response.status}`);
134
134
  }
135
135
  const releases = JSON.parse(response.body.toString("utf8"));
136
- for (const release of releases) {
137
- const { assets, tag_name: tag } = release;
138
- if (!tag.startsWith(toolPrefix)) {
139
- continue;
140
- }
141
- if (isMatch) {
142
- const hasMatchingAsset = assets.some(
143
- (a) => isMatch(a.name)
144
- );
145
- if (!hasMatchingAsset) {
146
- continue;
136
+ const matchingReleases = releases.filter(
137
+ (release) => {
138
+ const { assets, tag_name: tag2 } = release;
139
+ if (!tag2.startsWith(toolPrefix)) {
140
+ return false;
141
+ }
142
+ if (isMatch) {
143
+ const hasMatchingAsset = assets.some(
144
+ (a) => isMatch(a.name)
145
+ );
146
+ if (!hasMatchingAsset) {
147
+ return false;
148
+ }
147
149
  }
150
+ return true;
148
151
  }
152
+ );
153
+ if (matchingReleases.length === 0) {
149
154
  if (!quiet) {
150
- logger.info(`Found release: ${tag}`);
155
+ logger.info(`No ${toolPrefix} release found in latest 100 releases`);
151
156
  }
152
- return tag;
157
+ return null;
153
158
  }
159
+ matchingReleases.sort(
160
+ (a, b) => new Date(b.published_at).getTime() - new Date(a.published_at).getTime()
161
+ );
162
+ const latestRelease = matchingReleases[0];
163
+ const tag = latestRelease.tag_name;
154
164
  if (!quiet) {
155
- logger.info(`No ${toolPrefix} release found in latest 100 releases`);
165
+ logger.info(`Found release: ${tag}`);
156
166
  }
157
- return null;
167
+ return tag;
158
168
  },
159
169
  {
160
170
  ...RETRY_CONFIG,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@socketsecurity/lib",
3
- "version": "5.4.0",
4
- "packageManager": "pnpm@10.27.0",
3
+ "version": "5.5.0",
4
+ "packageManager": "pnpm@10.28.0",
5
5
  "license": "MIT",
6
6
  "description": "Core utilities and infrastructure for Socket.dev security tools",
7
7
  "keywords": [
@@ -227,6 +227,10 @@
227
227
  "types": "./dist/dlx/cache.d.ts",
228
228
  "default": "./dist/dlx/cache.js"
229
229
  },
230
+ "./dlx/detect": {
231
+ "types": "./dist/dlx/detect.d.ts",
232
+ "default": "./dist/dlx/detect.js"
233
+ },
230
234
  "./dlx/dir": {
231
235
  "types": "./dist/dlx/dir.d.ts",
232
236
  "default": "./dist/dlx/dir.js"
@@ -722,7 +726,7 @@
722
726
  "@socketregistry/is-unicode-supported": "1.0.5",
723
727
  "@socketregistry/packageurl-js": "1.3.5",
724
728
  "@socketregistry/yocto-spinner": "1.0.25",
725
- "@socketsecurity/lib-stable": "npm:@socketsecurity/lib@5.2.1",
729
+ "@socketsecurity/lib-stable": "npm:@socketsecurity/lib@5.4.0",
726
730
  "@types/node": "24.9.2",
727
731
  "@typescript/native-preview": "7.0.0-dev.20250920.1",
728
732
  "@vitest/coverage-v8": "4.0.3",
@@ -744,6 +748,7 @@
744
748
  "fast-sort": "3.4.1",
745
749
  "get-east-asian-width": "1.3.0",
746
750
  "globals": "16.4.0",
751
+ "has-flag": "5.0.1",
747
752
  "husky": "9.1.7",
748
753
  "libnpmexec": "^10.1.11",
749
754
  "libnpmpack": "9.0.9",
@@ -756,9 +761,11 @@
756
761
  "pacote": "21.0.1",
757
762
  "picomatch": "2.3.1",
758
763
  "semver": "7.7.2",
764
+ "signal-exit": "4.1.0",
759
765
  "spdx-correct": "3.2.0",
760
766
  "spdx-expression-parse": "4.0.0",
761
767
  "streaming-iterables": "8.0.1",
768
+ "supports-color": "10.0.0",
762
769
  "taze": "19.9.2",
763
770
  "trash": "10.0.0",
764
771
  "type-coverage": "2.29.7",
@@ -784,14 +791,23 @@
784
791
  "overrides": {
785
792
  "@npmcli/arborist": "9.1.6",
786
793
  "@npmcli/run-script": "10.0.0",
794
+ "@sigstore/core": "3.1.0",
787
795
  "@sigstore/sign": "4.1.0",
788
796
  "ansi-regex": "6.2.2",
797
+ "debug": "4.4.3",
798
+ "has-flag": "5.0.1",
799
+ "isexe": "3.1.1",
789
800
  "lru-cache": "11.2.2",
790
801
  "picomatch": "4.0.3",
802
+ "proc-log": "6.1.0",
791
803
  "semver": "7.7.2",
804
+ "signal-exit": "4.1.0",
792
805
  "string-width": "8.1.0",
793
806
  "strip-ansi": "7.1.2",
794
- "wrap-ansi": "9.0.2"
807
+ "supports-color": "10.0.0",
808
+ "which": "5.0.0",
809
+ "wrap-ansi": "9.0.2",
810
+ "yoctocolors-cjs": "2.1.3"
795
811
  },
796
812
  "patchedDependencies": {
797
813
  "@npmcli/run-script@10.0.0": "patches/@npmcli__run-script@10.0.0.patch",