@socketsecurity/lib 5.11.3 → 5.11.4
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 +14 -0
- package/dist/archives.d.ts +2 -0
- package/dist/archives.js +84 -5
- package/dist/dlx/binary.js +10 -4
- package/dist/external/@npmcli/package-json.js +152 -130
- package/dist/external/npm-pack.js +196 -174
- package/dist/fs.js +12 -3
- package/dist/globs.js +21 -13
- package/dist/http-request.js +27 -4
- package/dist/ipc.js +6 -6
- package/dist/sorts.js +16 -12
- package/dist/spawn.js +10 -2
- package/dist/strings.js +11 -3
- package/dist/versions.js +27 -11
- package/package.json +4 -3
package/dist/fs.js
CHANGED
|
@@ -63,7 +63,6 @@ module.exports = __toCommonJS(fs_exports);
|
|
|
63
63
|
var import_node_process = __toESM(require("node:process"));
|
|
64
64
|
var import_process = require("./constants/process");
|
|
65
65
|
var import_arrays = require("./arrays");
|
|
66
|
-
var import_del = require("./external/del");
|
|
67
66
|
var import_promises = require("./promises");
|
|
68
67
|
var import_globs = require("./globs");
|
|
69
68
|
var import_parse = require("./json/parse");
|
|
@@ -72,6 +71,14 @@ var import_normalize = require("./paths/normalize");
|
|
|
72
71
|
var import_rewire = require("./paths/rewire");
|
|
73
72
|
var import_socket = require("./paths/socket");
|
|
74
73
|
var import_sorts = require("./sorts");
|
|
74
|
+
let _del;
|
|
75
|
+
// @__NO_SIDE_EFFECTS__
|
|
76
|
+
function getDel() {
|
|
77
|
+
if (_del === void 0) {
|
|
78
|
+
_del = require("./external/del");
|
|
79
|
+
}
|
|
80
|
+
return _del;
|
|
81
|
+
}
|
|
75
82
|
const abortSignal = (0, import_process.getAbortSignal)();
|
|
76
83
|
const defaultRemoveOptions = (0, import_objects.objectFreeze)({
|
|
77
84
|
__proto__: null,
|
|
@@ -541,9 +548,10 @@ async function safeDelete(filepath, options) {
|
|
|
541
548
|
}
|
|
542
549
|
const maxRetries = opts.maxRetries ?? defaultRemoveOptions.maxRetries;
|
|
543
550
|
const retryDelay = opts.retryDelay ?? defaultRemoveOptions.retryDelay;
|
|
551
|
+
const del = /* @__PURE__ */ getDel();
|
|
544
552
|
await (0, import_promises.pRetry)(
|
|
545
553
|
async () => {
|
|
546
|
-
await
|
|
554
|
+
await del.deleteAsync(patterns, {
|
|
547
555
|
dryRun: false,
|
|
548
556
|
force: shouldForce,
|
|
549
557
|
onlyFiles: false
|
|
@@ -582,11 +590,12 @@ function safeDeleteSync(filepath, options) {
|
|
|
582
590
|
}
|
|
583
591
|
const maxRetries = opts.maxRetries ?? defaultRemoveOptions.maxRetries;
|
|
584
592
|
const retryDelay = opts.retryDelay ?? defaultRemoveOptions.retryDelay;
|
|
593
|
+
const del = /* @__PURE__ */ getDel();
|
|
585
594
|
let lastError;
|
|
586
595
|
let delay = retryDelay;
|
|
587
596
|
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
588
597
|
try {
|
|
589
|
-
|
|
598
|
+
del.deleteSync(patterns, {
|
|
590
599
|
dryRun: false,
|
|
591
600
|
force: shouldForce,
|
|
592
601
|
onlyFiles: false
|
package/dist/globs.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with esbuild */
|
|
3
|
-
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
7
|
var __export = (target, all) => {
|
|
10
8
|
for (var name in all)
|
|
@@ -18,14 +16,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
16
|
}
|
|
19
17
|
return to;
|
|
20
18
|
};
|
|
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
|
-
));
|
|
29
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
20
|
var globs_exports = {};
|
|
31
21
|
__export(globs_exports, {
|
|
@@ -36,10 +26,24 @@ __export(globs_exports, {
|
|
|
36
26
|
globSync: () => globSync
|
|
37
27
|
});
|
|
38
28
|
module.exports = __toCommonJS(globs_exports);
|
|
39
|
-
var fastGlob = __toESM(require("./external/fast-glob.js"));
|
|
40
|
-
var import_picomatch = __toESM(require("./external/picomatch.js"));
|
|
41
29
|
var import_objects = require("./objects");
|
|
42
30
|
var import_globs = require("./paths/globs");
|
|
31
|
+
let _fastGlob;
|
|
32
|
+
// @__NO_SIDE_EFFECTS__
|
|
33
|
+
function getFastGlob() {
|
|
34
|
+
if (_fastGlob === void 0) {
|
|
35
|
+
_fastGlob = require("./external/fast-glob.js");
|
|
36
|
+
}
|
|
37
|
+
return _fastGlob;
|
|
38
|
+
}
|
|
39
|
+
let _picomatch;
|
|
40
|
+
// @__NO_SIDE_EFFECTS__
|
|
41
|
+
function getPicomatch() {
|
|
42
|
+
if (_picomatch === void 0) {
|
|
43
|
+
_picomatch = require("./external/picomatch.js");
|
|
44
|
+
}
|
|
45
|
+
return _picomatch;
|
|
46
|
+
}
|
|
43
47
|
const defaultIgnore = (0, import_objects.objectFreeze)([
|
|
44
48
|
// Most of these ignored files can be included specifically if included in the
|
|
45
49
|
// files globs. Exceptions to this are:
|
|
@@ -95,6 +99,7 @@ function globStreamLicenses(dirname, options) {
|
|
|
95
99
|
if (ignoreOriginals) {
|
|
96
100
|
ignore.push(import_globs.LICENSE_ORIGINAL_GLOB_RECURSIVE);
|
|
97
101
|
}
|
|
102
|
+
const fastGlob = /* @__PURE__ */ getFastGlob();
|
|
98
103
|
return fastGlob.globStream(
|
|
99
104
|
[recursive ? import_globs.LICENSE_GLOB_RECURSIVE : import_globs.LICENSE_GLOB],
|
|
100
105
|
{
|
|
@@ -142,7 +147,8 @@ function getGlobMatcher(glob2, options) {
|
|
|
142
147
|
...options,
|
|
143
148
|
...negativePatterns.length > 0 ? { ignore: negativePatterns } : {}
|
|
144
149
|
};
|
|
145
|
-
|
|
150
|
+
const picomatch = /* @__PURE__ */ getPicomatch();
|
|
151
|
+
matcher = picomatch(
|
|
146
152
|
positivePatterns.length > 0 ? positivePatterns : patterns,
|
|
147
153
|
matchOptions
|
|
148
154
|
);
|
|
@@ -152,10 +158,12 @@ function getGlobMatcher(glob2, options) {
|
|
|
152
158
|
}
|
|
153
159
|
// @__NO_SIDE_EFFECTS__
|
|
154
160
|
function glob(patterns, options) {
|
|
161
|
+
const fastGlob = /* @__PURE__ */ getFastGlob();
|
|
155
162
|
return fastGlob.glob(patterns, options);
|
|
156
163
|
}
|
|
157
164
|
// @__NO_SIDE_EFFECTS__
|
|
158
165
|
function globSync(patterns, options) {
|
|
166
|
+
const fastGlob = /* @__PURE__ */ getFastGlob();
|
|
159
167
|
return fastGlob.globSync(patterns, options);
|
|
160
168
|
}
|
|
161
169
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/http-request.js
CHANGED
|
@@ -147,6 +147,15 @@ async function httpDownloadAttempt(url, destPath, options) {
|
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
149
|
const redirectUrl = res.headers.location.startsWith("http") ? res.headers.location : new URL(res.headers.location, url).toString();
|
|
150
|
+
const redirectParsed = new URL(redirectUrl);
|
|
151
|
+
if (isHttps && redirectParsed.protocol !== "https:") {
|
|
152
|
+
reject(
|
|
153
|
+
new Error(
|
|
154
|
+
`Redirect from HTTPS to HTTP is not allowed: ${redirectUrl}`
|
|
155
|
+
)
|
|
156
|
+
);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
150
159
|
resolve(
|
|
151
160
|
httpDownloadAttempt(redirectUrl, destPath, {
|
|
152
161
|
ca,
|
|
@@ -270,6 +279,15 @@ async function httpRequestAttempt(url, options) {
|
|
|
270
279
|
return;
|
|
271
280
|
}
|
|
272
281
|
const redirectUrl = res.headers.location.startsWith("http") ? res.headers.location : new URL(res.headers.location, url).toString();
|
|
282
|
+
const redirectParsed = new URL(redirectUrl);
|
|
283
|
+
if (isHttps && redirectParsed.protocol !== "https:") {
|
|
284
|
+
reject(
|
|
285
|
+
new Error(
|
|
286
|
+
`Redirect from HTTPS to HTTP is not allowed: ${redirectUrl}`
|
|
287
|
+
)
|
|
288
|
+
);
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
273
291
|
resolve(
|
|
274
292
|
httpRequestAttempt(redirectUrl, {
|
|
275
293
|
body,
|
|
@@ -372,8 +390,10 @@ async function httpDownload(url, destPath, options) {
|
|
|
372
390
|
}
|
|
373
391
|
};
|
|
374
392
|
}
|
|
393
|
+
const crypto = /* @__PURE__ */ getCrypto();
|
|
375
394
|
const fs = /* @__PURE__ */ getFs();
|
|
376
|
-
const
|
|
395
|
+
const tempSuffix = crypto.randomBytes(6).toString("hex");
|
|
396
|
+
const tempPath = `${destPath}.${tempSuffix}.download`;
|
|
377
397
|
if (fs.existsSync(tempPath)) {
|
|
378
398
|
await (0, import_fs.safeDelete)(tempPath);
|
|
379
399
|
}
|
|
@@ -389,14 +409,17 @@ async function httpDownload(url, destPath, options) {
|
|
|
389
409
|
timeout
|
|
390
410
|
});
|
|
391
411
|
if (sha256) {
|
|
392
|
-
const crypto = /* @__PURE__ */ getCrypto();
|
|
393
412
|
const fileContent = await fs.promises.readFile(tempPath);
|
|
394
413
|
const computedHash = crypto.createHash("sha256").update(fileContent).digest("hex");
|
|
395
|
-
|
|
414
|
+
const expectedHash = sha256.toLowerCase();
|
|
415
|
+
if (computedHash.length !== expectedHash.length || !crypto.timingSafeEqual(
|
|
416
|
+
Buffer.from(computedHash),
|
|
417
|
+
Buffer.from(expectedHash)
|
|
418
|
+
)) {
|
|
396
419
|
await (0, import_fs.safeDelete)(tempPath);
|
|
397
420
|
throw new Error(
|
|
398
421
|
`Checksum verification failed for ${url}
|
|
399
|
-
Expected: ${
|
|
422
|
+
Expected: ${expectedHash}
|
|
400
423
|
Computed: ${computedHash}`
|
|
401
424
|
);
|
|
402
425
|
}
|
package/dist/ipc.js
CHANGED
|
@@ -116,7 +116,7 @@ async function ensureIpcDirectory(filePath) {
|
|
|
116
116
|
const fs = /* @__PURE__ */ getFs();
|
|
117
117
|
const path = /* @__PURE__ */ getPath();
|
|
118
118
|
const dir = path.dirname(filePath);
|
|
119
|
-
await fs.promises.mkdir(dir, { recursive: true });
|
|
119
|
+
await fs.promises.mkdir(dir, { recursive: true, mode: 448 });
|
|
120
120
|
}
|
|
121
121
|
async function writeIpcStub(appName, data) {
|
|
122
122
|
const stubPath = getIpcStubPath(appName);
|
|
@@ -128,11 +128,10 @@ async function writeIpcStub(appName, data) {
|
|
|
128
128
|
};
|
|
129
129
|
const validated = IpcStubSchema.parse(ipcData);
|
|
130
130
|
const fs = /* @__PURE__ */ getFs();
|
|
131
|
-
await fs.promises.writeFile(
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
);
|
|
131
|
+
await fs.promises.writeFile(stubPath, JSON.stringify(validated, null, 2), {
|
|
132
|
+
encoding: "utf8",
|
|
133
|
+
mode: 384
|
|
134
|
+
});
|
|
136
135
|
return stubPath;
|
|
137
136
|
}
|
|
138
137
|
async function readIpcStub(stubPath) {
|
|
@@ -179,6 +178,7 @@ async function cleanupIpcStubs(appName) {
|
|
|
179
178
|
const contentAge = now - validated.timestamp;
|
|
180
179
|
isStale = isStale || contentAge > maxAgeMs;
|
|
181
180
|
} catch {
|
|
181
|
+
isStale = true;
|
|
182
182
|
}
|
|
183
183
|
if (isStale) {
|
|
184
184
|
(0, import_fs.safeDeleteSync)(filePath, { force: true });
|
package/dist/sorts.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with esbuild */
|
|
3
|
-
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
7
|
var __export = (target, all) => {
|
|
10
8
|
for (var name in all)
|
|
@@ -18,14 +16,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
16
|
}
|
|
19
17
|
return to;
|
|
20
18
|
};
|
|
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
|
-
));
|
|
29
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
20
|
var sorts_exports = {};
|
|
31
21
|
__export(sorts_exports, {
|
|
@@ -36,10 +26,23 @@ __export(sorts_exports, {
|
|
|
36
26
|
naturalSorter: () => naturalSorter
|
|
37
27
|
});
|
|
38
28
|
module.exports = __toCommonJS(sorts_exports);
|
|
39
|
-
|
|
40
|
-
|
|
29
|
+
let _semver;
|
|
30
|
+
function getSemver() {
|
|
31
|
+
if (_semver === void 0) {
|
|
32
|
+
_semver = require("./external/semver.js");
|
|
33
|
+
}
|
|
34
|
+
return _semver;
|
|
35
|
+
}
|
|
36
|
+
let _fastSort;
|
|
37
|
+
function getFastSort() {
|
|
38
|
+
if (_fastSort === void 0) {
|
|
39
|
+
_fastSort = require("./external/fast-sort.js");
|
|
40
|
+
}
|
|
41
|
+
return _fastSort;
|
|
42
|
+
}
|
|
41
43
|
// @__NO_SIDE_EFFECTS__
|
|
42
44
|
function compareSemver(a, b) {
|
|
45
|
+
const semver = getSemver();
|
|
43
46
|
const validA = semver.valid(a);
|
|
44
47
|
const validB = semver.valid(b);
|
|
45
48
|
if (!validA && !validB) {
|
|
@@ -90,6 +93,7 @@ let _naturalSorter;
|
|
|
90
93
|
// @__NO_SIDE_EFFECTS__
|
|
91
94
|
function naturalSorter(arrayToSort) {
|
|
92
95
|
if (_naturalSorter === void 0) {
|
|
96
|
+
const fastSort = getFastSort();
|
|
93
97
|
_naturalSorter = fastSort.createNewSortInstance({
|
|
94
98
|
comparer: naturalCompare
|
|
95
99
|
});
|
package/dist/spawn.js
CHANGED
|
@@ -39,13 +39,20 @@ module.exports = __toCommonJS(spawn_exports);
|
|
|
39
39
|
var import_node_process = __toESM(require("node:process"));
|
|
40
40
|
var import_process = require("./constants/process");
|
|
41
41
|
var import_errors = require("./errors");
|
|
42
|
-
var import_promise_spawn = __toESM(require("./external/@npmcli/promise-spawn"));
|
|
43
42
|
var import_arrays = require("./arrays");
|
|
44
43
|
var import_bin = require("./bin");
|
|
45
44
|
var import_normalize = require("./paths/normalize");
|
|
46
45
|
var import_objects = require("./objects");
|
|
47
46
|
var import_spinner = require("./spinner");
|
|
48
47
|
var import_strings = require("./strings");
|
|
48
|
+
let _npmCliPromiseSpawn;
|
|
49
|
+
// @__NO_SIDE_EFFECTS__
|
|
50
|
+
function getNpmCliPromiseSpawn() {
|
|
51
|
+
if (_npmCliPromiseSpawn === void 0) {
|
|
52
|
+
_npmCliPromiseSpawn = require("./external/@npmcli/promise-spawn");
|
|
53
|
+
}
|
|
54
|
+
return _npmCliPromiseSpawn;
|
|
55
|
+
}
|
|
49
56
|
let _path;
|
|
50
57
|
// @__NO_SIDE_EFFECTS__
|
|
51
58
|
function getPath() {
|
|
@@ -235,7 +242,8 @@ function spawn(cmd, args, options, extra) {
|
|
|
235
242
|
uid: spawnOptions.uid,
|
|
236
243
|
gid: spawnOptions.gid
|
|
237
244
|
};
|
|
238
|
-
const
|
|
245
|
+
const npmCliPromiseSpawn = /* @__PURE__ */ getNpmCliPromiseSpawn();
|
|
246
|
+
const spawnPromise = npmCliPromiseSpawn(
|
|
239
247
|
actualCmd,
|
|
240
248
|
args ? [...args] : [],
|
|
241
249
|
promiseSpawnOpts,
|
package/dist/strings.js
CHANGED
|
@@ -37,7 +37,14 @@ __export(strings_exports, {
|
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(strings_exports);
|
|
39
39
|
var import_ansi = require("./ansi");
|
|
40
|
-
|
|
40
|
+
let _eastAsianWidth;
|
|
41
|
+
// @__NO_SIDE_EFFECTS__
|
|
42
|
+
function getEastAsianWidth() {
|
|
43
|
+
if (_eastAsianWidth === void 0) {
|
|
44
|
+
_eastAsianWidth = require("./external/get-east-asian-width").eastAsianWidth;
|
|
45
|
+
}
|
|
46
|
+
return _eastAsianWidth;
|
|
47
|
+
}
|
|
41
48
|
const fromCharCode = String.fromCharCode;
|
|
42
49
|
// @__NO_SIDE_EFFECTS__
|
|
43
50
|
function applyLinePrefix(str, options) {
|
|
@@ -164,6 +171,7 @@ function stringWidth(text) {
|
|
|
164
171
|
}
|
|
165
172
|
let width = 0;
|
|
166
173
|
const eastAsianWidthOptions = { ambiguousAsWide: false };
|
|
174
|
+
const eastAsianWidth = /* @__PURE__ */ getEastAsianWidth();
|
|
167
175
|
for (const { segment } of segmenter.segment(plainText)) {
|
|
168
176
|
if (zeroWidthClusterRegex.test(segment)) {
|
|
169
177
|
continue;
|
|
@@ -177,14 +185,14 @@ function stringWidth(text) {
|
|
|
177
185
|
if (codePoint === void 0) {
|
|
178
186
|
continue;
|
|
179
187
|
}
|
|
180
|
-
width +=
|
|
188
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
181
189
|
if (segment.length > 1) {
|
|
182
190
|
for (const char of segment.slice(1)) {
|
|
183
191
|
const charCode = char.charCodeAt(0);
|
|
184
192
|
if (charCode >= 65280 && charCode <= 65519) {
|
|
185
193
|
const trailingCodePoint = char.codePointAt(0);
|
|
186
194
|
if (trailingCodePoint !== void 0) {
|
|
187
|
-
width +=
|
|
195
|
+
width += eastAsianWidth(trailingCodePoint, eastAsianWidthOptions);
|
|
188
196
|
}
|
|
189
197
|
}
|
|
190
198
|
}
|
package/dist/versions.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with esbuild */
|
|
3
|
-
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
7
|
var __export = (target, all) => {
|
|
10
8
|
for (var name in all)
|
|
@@ -18,14 +16,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
16
|
}
|
|
19
17
|
return to;
|
|
20
18
|
};
|
|
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
|
-
));
|
|
29
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
20
|
var versions_exports = {};
|
|
31
21
|
__export(versions_exports, {
|
|
@@ -51,61 +41,83 @@ __export(versions_exports, {
|
|
|
51
41
|
versionDiff: () => versionDiff
|
|
52
42
|
});
|
|
53
43
|
module.exports = __toCommonJS(versions_exports);
|
|
54
|
-
|
|
44
|
+
let _semver;
|
|
45
|
+
function getSemver() {
|
|
46
|
+
if (_semver === void 0) {
|
|
47
|
+
_semver = require("./external/semver.js");
|
|
48
|
+
}
|
|
49
|
+
return _semver;
|
|
50
|
+
}
|
|
55
51
|
function coerceVersion(version) {
|
|
52
|
+
const semver = getSemver();
|
|
56
53
|
const coerced = semver.coerce(version);
|
|
57
54
|
return coerced?.version;
|
|
58
55
|
}
|
|
59
56
|
function compareVersions(v1, v2) {
|
|
60
57
|
try {
|
|
58
|
+
const semver = getSemver();
|
|
61
59
|
return semver.compare(v1, v2);
|
|
62
60
|
} catch {
|
|
63
61
|
return void 0;
|
|
64
62
|
}
|
|
65
63
|
}
|
|
66
64
|
function filterVersions(versions, range) {
|
|
65
|
+
const semver = getSemver();
|
|
67
66
|
return versions.filter((v) => semver.satisfies(v, range));
|
|
68
67
|
}
|
|
69
68
|
function getMajorVersion(version) {
|
|
69
|
+
const semver = getSemver();
|
|
70
70
|
const parsed = semver.parse(version);
|
|
71
71
|
return parsed?.major;
|
|
72
72
|
}
|
|
73
73
|
function getMinorVersion(version) {
|
|
74
|
+
const semver = getSemver();
|
|
74
75
|
const parsed = semver.parse(version);
|
|
75
76
|
return parsed?.minor;
|
|
76
77
|
}
|
|
77
78
|
function getPatchVersion(version) {
|
|
79
|
+
const semver = getSemver();
|
|
78
80
|
const parsed = semver.parse(version);
|
|
79
81
|
return parsed?.patch;
|
|
80
82
|
}
|
|
81
83
|
function incrementVersion(version, release, identifier) {
|
|
84
|
+
const semver = getSemver();
|
|
82
85
|
return semver.inc(version, release, identifier) || void 0;
|
|
83
86
|
}
|
|
84
87
|
function isEqual(version1, version2) {
|
|
88
|
+
const semver = getSemver();
|
|
85
89
|
return semver.eq(version1, version2);
|
|
86
90
|
}
|
|
87
91
|
function isGreaterThan(version1, version2) {
|
|
92
|
+
const semver = getSemver();
|
|
88
93
|
return semver.gt(version1, version2);
|
|
89
94
|
}
|
|
90
95
|
function isGreaterThanOrEqual(version1, version2) {
|
|
96
|
+
const semver = getSemver();
|
|
91
97
|
return semver.gte(version1, version2);
|
|
92
98
|
}
|
|
93
99
|
function isLessThan(version1, version2) {
|
|
100
|
+
const semver = getSemver();
|
|
94
101
|
return semver.lt(version1, version2);
|
|
95
102
|
}
|
|
96
103
|
function isLessThanOrEqual(version1, version2) {
|
|
104
|
+
const semver = getSemver();
|
|
97
105
|
return semver.lte(version1, version2);
|
|
98
106
|
}
|
|
99
107
|
function isValidVersion(version) {
|
|
108
|
+
const semver = getSemver();
|
|
100
109
|
return semver.valid(version) !== null;
|
|
101
110
|
}
|
|
102
111
|
function maxVersion(versions) {
|
|
112
|
+
const semver = getSemver();
|
|
103
113
|
return semver.maxSatisfying(versions, "*") || void 0;
|
|
104
114
|
}
|
|
105
115
|
function minVersion(versions) {
|
|
116
|
+
const semver = getSemver();
|
|
106
117
|
return semver.minSatisfying(versions, "*") || void 0;
|
|
107
118
|
}
|
|
108
119
|
function parseVersion(version) {
|
|
120
|
+
const semver = getSemver();
|
|
109
121
|
const parsed = semver.parse(version);
|
|
110
122
|
if (!parsed) {
|
|
111
123
|
return void 0;
|
|
@@ -119,16 +131,20 @@ function parseVersion(version) {
|
|
|
119
131
|
};
|
|
120
132
|
}
|
|
121
133
|
function satisfiesVersion(version, range) {
|
|
134
|
+
const semver = getSemver();
|
|
122
135
|
return semver.satisfies(version, range);
|
|
123
136
|
}
|
|
124
137
|
function sortVersions(versions) {
|
|
138
|
+
const semver = getSemver();
|
|
125
139
|
return semver.sort([...versions]);
|
|
126
140
|
}
|
|
127
141
|
function sortVersionsDesc(versions) {
|
|
142
|
+
const semver = getSemver();
|
|
128
143
|
return semver.rsort([...versions]);
|
|
129
144
|
}
|
|
130
145
|
function versionDiff(version1, version2) {
|
|
131
146
|
try {
|
|
147
|
+
const semver = getSemver();
|
|
132
148
|
return semver.diff(version1, version2) || void 0;
|
|
133
149
|
} catch {
|
|
134
150
|
return void 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@socketsecurity/lib",
|
|
3
|
-
"version": "5.11.
|
|
3
|
+
"version": "5.11.4",
|
|
4
4
|
"packageManager": "pnpm@10.33.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Core utilities and infrastructure for Socket.dev security tools",
|
|
@@ -734,7 +734,7 @@
|
|
|
734
734
|
"@socketregistry/is-unicode-supported": "1.0.5",
|
|
735
735
|
"@socketregistry/packageurl-js": "1.3.5",
|
|
736
736
|
"@socketregistry/yocto-spinner": "1.0.25",
|
|
737
|
-
"@socketsecurity/lib-stable": "npm:@socketsecurity/lib@5.11.
|
|
737
|
+
"@socketsecurity/lib-stable": "npm:@socketsecurity/lib@5.11.3",
|
|
738
738
|
"@types/node": "24.9.2",
|
|
739
739
|
"@typescript/native-preview": "7.0.0-dev.20250920.1",
|
|
740
740
|
"@vitest/coverage-v8": "4.0.3",
|
|
@@ -807,6 +807,7 @@
|
|
|
807
807
|
"@sigstore/core": "3.1.0",
|
|
808
808
|
"@sigstore/sign": "4.1.0",
|
|
809
809
|
"ansi-regex": "6.2.2",
|
|
810
|
+
"brace-expansion": "5.0.5",
|
|
810
811
|
"chownr": "3.0.0",
|
|
811
812
|
"debug": "4.4.3",
|
|
812
813
|
"execa": "5.1.1",
|
|
@@ -814,7 +815,7 @@
|
|
|
814
815
|
"hosted-git-info": "8.1.0",
|
|
815
816
|
"isexe": "3.1.1",
|
|
816
817
|
"lru-cache": "11.2.2",
|
|
817
|
-
"minimatch": "9.0.
|
|
818
|
+
"minimatch": "9.0.6",
|
|
818
819
|
"minipass": "7.1.3",
|
|
819
820
|
"minipass-fetch": "4.0.1",
|
|
820
821
|
"minipass-sized": "1.0.3",
|