@socketsecurity/lib 5.3.0 → 5.4.1
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 +22 -0
- package/dist/cover/code.js +12 -4
- package/dist/dlx/cache.js +10 -2
- package/dist/dlx/manifest.js +45 -41
- package/dist/env/rewire.js +10 -2
- package/dist/external/@inquirer/checkbox.js +4 -2528
- package/dist/external/@inquirer/confirm.js +4 -2371
- package/dist/external/@inquirer/input.js +4 -2395
- package/dist/external/@inquirer/password.js +4 -2503
- package/dist/external/@inquirer/search.js +4 -2500
- package/dist/external/@inquirer/select.js +4 -2617
- package/dist/external/@npmcli/package-json.js +11 -7
- package/dist/external/debug.js +670 -15
- package/dist/external/del.js +4 -7139
- package/dist/external/external-pack.js +4795 -0
- package/dist/external/fast-glob.js +4 -5776
- package/dist/external/has-flag.js +6 -0
- package/dist/external/libnpmexec.js +2 -2
- package/dist/external/normalize-package-data.js +2 -2
- package/dist/external/npm-pack.js +1698 -3337
- package/dist/external/npm-package-arg.js +2 -2
- package/dist/external/pico-pack.js +7162 -0
- package/dist/external/picomatch.js +4 -1523
- package/dist/external/semver.js +2 -2
- package/dist/external/signal-exit.js +5 -0
- package/dist/external/spdx-correct.js +4 -1384
- package/dist/external/spdx-expression-parse.js +4 -1047
- package/dist/external/spdx-pack.js +1640 -0
- package/dist/external/supports-color.js +8 -0
- package/dist/external/validate-npm-package-name.js +4 -104
- package/dist/external/yoctocolors-cjs.js +5 -92
- package/dist/http-request.js +10 -2
- package/dist/ipc.js +53 -29
- package/dist/packages/isolation.js +45 -23
- package/dist/packages/licenses.js +10 -2
- package/dist/paths/socket.d.ts +2 -2
- package/dist/paths/socket.js +27 -21
- package/dist/process-lock.js +23 -14
- package/dist/releases/github.d.ts +67 -41
- package/dist/releases/github.js +142 -100
- package/dist/releases/socket-btm.d.ts +40 -33
- package/dist/releases/socket-btm.js +45 -5
- package/dist/spawn.js +10 -3
- package/dist/stdio/mask.d.ts +6 -21
- package/dist/stdio/mask.js +18 -14
- package/dist/themes/context.js +10 -2
- package/package.json +16 -3
- package/dist/external/npm-core.js +0 -6588
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,28 @@ 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.4.1](https://github.com/SocketDev/socket-lib/releases/tag/v5.4.1) - 2026-01-10
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **build**: Removed debug module stub to bundle real debug package. The stub was missing `enable()` and `disable()` methods, causing errors when downstream projects re-bundled the lib.
|
|
13
|
+
|
|
14
|
+
## [5.4.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.4.0) - 2026-01-07
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- **releases/github**: Extended release functions to accept glob patterns for asset discovery
|
|
19
|
+
- `getReleaseAssetUrl()` now accepts glob patterns: `'yoga-sync-*.mjs'`, `'models-*.tar.gz'`
|
|
20
|
+
- `downloadReleaseAsset()` now accepts glob patterns for automatic asset discovery
|
|
21
|
+
- `getLatestRelease()` now accepts asset patterns to find releases with matching assets
|
|
22
|
+
- Supports wildcards, brace expansion, RegExp patterns, and prefix/suffix objects
|
|
23
|
+
- Uses picomatch for robust glob pattern matching
|
|
24
|
+
|
|
25
|
+
- **releases/socket-btm**: Extended `downloadSocketBtmRelease()` to accept glob patterns
|
|
26
|
+
- `asset` parameter now accepts wildcards: `'yoga-sync-*.mjs'`, `'models-*.tar.gz'`
|
|
27
|
+
- Automatically discovers and downloads latest matching asset
|
|
28
|
+
- Eliminates need for hardcoded asset names in build scripts
|
|
29
|
+
|
|
8
30
|
## [5.3.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.3.0) - 2026-01-07
|
|
9
31
|
|
|
10
32
|
### Added
|
package/dist/cover/code.js
CHANGED
|
@@ -22,12 +22,19 @@ __export(code_exports, {
|
|
|
22
22
|
getCodeCoverage: () => getCodeCoverage
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(code_exports);
|
|
25
|
-
var import_fs = require("fs");
|
|
26
|
-
var import_fs2 = require("../fs");
|
|
25
|
+
var import_fs = require("../fs");
|
|
27
26
|
var import_objects = require("../objects");
|
|
28
27
|
var import_spawn = require("../spawn");
|
|
28
|
+
let _fs;
|
|
29
29
|
let _path;
|
|
30
30
|
// @__NO_SIDE_EFFECTS__
|
|
31
|
+
function getFs() {
|
|
32
|
+
if (_fs === void 0) {
|
|
33
|
+
_fs = require("fs");
|
|
34
|
+
}
|
|
35
|
+
return _fs;
|
|
36
|
+
}
|
|
37
|
+
// @__NO_SIDE_EFFECTS__
|
|
31
38
|
function getPath() {
|
|
32
39
|
if (_path === void 0) {
|
|
33
40
|
_path = require("path");
|
|
@@ -46,7 +53,8 @@ async function getCodeCoverage(options) {
|
|
|
46
53
|
if (!coveragePath) {
|
|
47
54
|
throw new Error("Coverage path is required");
|
|
48
55
|
}
|
|
49
|
-
const
|
|
56
|
+
const fs = /* @__PURE__ */ getFs();
|
|
57
|
+
const coverageExists = await fs.promises.access(coveragePath).then(() => true).catch(() => false);
|
|
50
58
|
if (!coverageExists) {
|
|
51
59
|
if (generateIfMissing) {
|
|
52
60
|
await (0, import_spawn.spawn)("vitest", ["run", "--coverage"], {
|
|
@@ -59,7 +67,7 @@ async function getCodeCoverage(options) {
|
|
|
59
67
|
);
|
|
60
68
|
}
|
|
61
69
|
}
|
|
62
|
-
const coverageData = await (0,
|
|
70
|
+
const coverageData = await (0, import_fs.readJson)(coveragePath);
|
|
63
71
|
if (!(0, import_objects.isObjectObject)(coverageData)) {
|
|
64
72
|
throw new Error(`Invalid coverage data format in "${coveragePath}"`);
|
|
65
73
|
}
|
package/dist/dlx/cache.js
CHANGED
|
@@ -22,9 +22,17 @@ __export(cache_exports, {
|
|
|
22
22
|
generateCacheKey: () => generateCacheKey
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(cache_exports);
|
|
25
|
-
|
|
25
|
+
let _crypto;
|
|
26
|
+
// @__NO_SIDE_EFFECTS__
|
|
27
|
+
function getCrypto() {
|
|
28
|
+
if (_crypto === void 0) {
|
|
29
|
+
_crypto = require("crypto");
|
|
30
|
+
}
|
|
31
|
+
return _crypto;
|
|
32
|
+
}
|
|
26
33
|
function generateCacheKey(spec) {
|
|
27
|
-
|
|
34
|
+
const crypto = /* @__PURE__ */ getCrypto();
|
|
35
|
+
return crypto.createHash("sha512").update(spec).digest("hex").substring(0, 16);
|
|
28
36
|
}
|
|
29
37
|
// Annotate the CommonJS export names for ESM import in node:
|
|
30
38
|
0 && (module.exports = {
|
package/dist/dlx/manifest.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 manifest_exports = {};
|
|
31
21
|
__export(manifest_exports, {
|
|
@@ -35,12 +25,26 @@ __export(manifest_exports, {
|
|
|
35
25
|
isPackageEntry: () => isPackageEntry
|
|
36
26
|
});
|
|
37
27
|
module.exports = __toCommonJS(manifest_exports);
|
|
38
|
-
var import_fs = require("fs");
|
|
39
|
-
var import_path = __toESM(require("path"));
|
|
40
|
-
var import_fs2 = require("../fs");
|
|
28
|
+
var import_fs = require("../fs");
|
|
41
29
|
var import_logger = require("../logger");
|
|
42
30
|
var import_socket = require("../paths/socket");
|
|
43
31
|
var import_process_lock = require("../process-lock");
|
|
32
|
+
let _fs;
|
|
33
|
+
let _path;
|
|
34
|
+
// @__NO_SIDE_EFFECTS__
|
|
35
|
+
function getFs() {
|
|
36
|
+
if (_fs === void 0) {
|
|
37
|
+
_fs = require("fs");
|
|
38
|
+
}
|
|
39
|
+
return _fs;
|
|
40
|
+
}
|
|
41
|
+
// @__NO_SIDE_EFFECTS__
|
|
42
|
+
function getPath() {
|
|
43
|
+
if (_path === void 0) {
|
|
44
|
+
_path = require("path");
|
|
45
|
+
}
|
|
46
|
+
return _path;
|
|
47
|
+
}
|
|
44
48
|
const logger = (0, import_logger.getDefaultLogger)();
|
|
45
49
|
const MANIFEST_FILE_NAME = ".dlx-manifest.json";
|
|
46
50
|
function isPackageEntry(entry) {
|
|
@@ -53,7 +57,7 @@ class DlxManifest {
|
|
|
53
57
|
manifestPath;
|
|
54
58
|
lockPath;
|
|
55
59
|
constructor(options = {}) {
|
|
56
|
-
this.manifestPath = options.manifestPath ??
|
|
60
|
+
this.manifestPath = options.manifestPath ?? (/* @__PURE__ */ getPath()).join((0, import_socket.getSocketDlxDir)(), MANIFEST_FILE_NAME);
|
|
57
61
|
this.lockPath = `${this.manifestPath}.lock`;
|
|
58
62
|
}
|
|
59
63
|
/**
|
|
@@ -61,10 +65,10 @@ class DlxManifest {
|
|
|
61
65
|
*/
|
|
62
66
|
readManifest() {
|
|
63
67
|
try {
|
|
64
|
-
if (!(
|
|
68
|
+
if (!(/* @__PURE__ */ getFs()).existsSync(this.manifestPath)) {
|
|
65
69
|
return /* @__PURE__ */ Object.create(null);
|
|
66
70
|
}
|
|
67
|
-
const rawContent = (0,
|
|
71
|
+
const rawContent = (0, import_fs.readFileUtf8Sync)(this.manifestPath);
|
|
68
72
|
const content = (typeof rawContent === "string" ? rawContent : rawContent.toString("utf8")).trim();
|
|
69
73
|
if (!content) {
|
|
70
74
|
return /* @__PURE__ */ Object.create(null);
|
|
@@ -134,9 +138,9 @@ class DlxManifest {
|
|
|
134
138
|
* Write the manifest file atomically.
|
|
135
139
|
*/
|
|
136
140
|
async writeManifest(data) {
|
|
137
|
-
const manifestDir =
|
|
141
|
+
const manifestDir = (/* @__PURE__ */ getPath()).dirname(this.manifestPath);
|
|
138
142
|
try {
|
|
139
|
-
(0,
|
|
143
|
+
(0, import_fs.safeMkdirSync)(manifestDir, { recursive: true });
|
|
140
144
|
} catch (error) {
|
|
141
145
|
logger.warn(
|
|
142
146
|
`Failed to create manifest directory: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -145,18 +149,18 @@ class DlxManifest {
|
|
|
145
149
|
const content = JSON.stringify(data, null, 2);
|
|
146
150
|
const tempPath = `${this.manifestPath}.tmp`;
|
|
147
151
|
try {
|
|
148
|
-
(
|
|
149
|
-
(
|
|
152
|
+
(/* @__PURE__ */ getFs()).writeFileSync(tempPath, content, "utf8");
|
|
153
|
+
(/* @__PURE__ */ getFs()).writeFileSync(this.manifestPath, content, "utf8");
|
|
150
154
|
try {
|
|
151
|
-
if ((
|
|
152
|
-
(
|
|
155
|
+
if ((/* @__PURE__ */ getFs()).existsSync(tempPath)) {
|
|
156
|
+
(/* @__PURE__ */ getFs()).unlinkSync(tempPath);
|
|
153
157
|
}
|
|
154
158
|
} catch {
|
|
155
159
|
}
|
|
156
160
|
} catch (error) {
|
|
157
161
|
try {
|
|
158
|
-
if ((
|
|
159
|
-
(
|
|
162
|
+
if ((/* @__PURE__ */ getFs()).existsSync(tempPath)) {
|
|
163
|
+
(/* @__PURE__ */ getFs()).unlinkSync(tempPath);
|
|
160
164
|
}
|
|
161
165
|
} catch {
|
|
162
166
|
}
|
|
@@ -171,8 +175,8 @@ class DlxManifest {
|
|
|
171
175
|
await import_process_lock.processLock.withLock(this.lockPath, async () => {
|
|
172
176
|
let data = /* @__PURE__ */ Object.create(null);
|
|
173
177
|
try {
|
|
174
|
-
if ((
|
|
175
|
-
const content2 = (
|
|
178
|
+
if ((/* @__PURE__ */ getFs()).existsSync(this.manifestPath)) {
|
|
179
|
+
const content2 = (/* @__PURE__ */ getFs()).readFileSync(this.manifestPath, "utf8");
|
|
176
180
|
if (content2.trim()) {
|
|
177
181
|
data = JSON.parse(content2);
|
|
178
182
|
}
|
|
@@ -183,9 +187,9 @@ class DlxManifest {
|
|
|
183
187
|
);
|
|
184
188
|
}
|
|
185
189
|
data[name] = record;
|
|
186
|
-
const manifestDir =
|
|
190
|
+
const manifestDir = (/* @__PURE__ */ getPath()).dirname(this.manifestPath);
|
|
187
191
|
try {
|
|
188
|
-
(0,
|
|
192
|
+
(0, import_fs.safeMkdirSync)(manifestDir, { recursive: true });
|
|
189
193
|
} catch (error) {
|
|
190
194
|
logger.warn(
|
|
191
195
|
`Failed to create manifest directory: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -194,18 +198,18 @@ class DlxManifest {
|
|
|
194
198
|
const content = JSON.stringify(data, null, 2);
|
|
195
199
|
const tempPath = `${this.manifestPath}.tmp`;
|
|
196
200
|
try {
|
|
197
|
-
(
|
|
198
|
-
(
|
|
201
|
+
(/* @__PURE__ */ getFs()).writeFileSync(tempPath, content, "utf8");
|
|
202
|
+
(/* @__PURE__ */ getFs()).writeFileSync(this.manifestPath, content, "utf8");
|
|
199
203
|
try {
|
|
200
|
-
if ((
|
|
201
|
-
(
|
|
204
|
+
if ((/* @__PURE__ */ getFs()).existsSync(tempPath)) {
|
|
205
|
+
(/* @__PURE__ */ getFs()).unlinkSync(tempPath);
|
|
202
206
|
}
|
|
203
207
|
} catch {
|
|
204
208
|
}
|
|
205
209
|
} catch (error) {
|
|
206
210
|
try {
|
|
207
|
-
if ((
|
|
208
|
-
(
|
|
211
|
+
if ((/* @__PURE__ */ getFs()).existsSync(tempPath)) {
|
|
212
|
+
(/* @__PURE__ */ getFs()).unlinkSync(tempPath);
|
|
209
213
|
}
|
|
210
214
|
} catch {
|
|
211
215
|
}
|
|
@@ -219,17 +223,17 @@ class DlxManifest {
|
|
|
219
223
|
async clear(name) {
|
|
220
224
|
await import_process_lock.processLock.withLock(this.lockPath, async () => {
|
|
221
225
|
try {
|
|
222
|
-
if (!(
|
|
226
|
+
if (!(/* @__PURE__ */ getFs()).existsSync(this.manifestPath)) {
|
|
223
227
|
return;
|
|
224
228
|
}
|
|
225
|
-
const content = (
|
|
229
|
+
const content = (/* @__PURE__ */ getFs()).readFileSync(this.manifestPath, "utf8");
|
|
226
230
|
if (!content.trim()) {
|
|
227
231
|
return;
|
|
228
232
|
}
|
|
229
233
|
const data = JSON.parse(content);
|
|
230
234
|
delete data[name];
|
|
231
235
|
const updatedContent = JSON.stringify(data, null, 2);
|
|
232
|
-
(
|
|
236
|
+
(/* @__PURE__ */ getFs()).writeFileSync(this.manifestPath, updatedContent, "utf8");
|
|
233
237
|
} catch (error) {
|
|
234
238
|
logger.warn(
|
|
235
239
|
`Failed to clear cache for ${name}: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -243,8 +247,8 @@ class DlxManifest {
|
|
|
243
247
|
async clearAll() {
|
|
244
248
|
await import_process_lock.processLock.withLock(this.lockPath, async () => {
|
|
245
249
|
try {
|
|
246
|
-
if ((
|
|
247
|
-
(
|
|
250
|
+
if ((/* @__PURE__ */ getFs()).existsSync(this.manifestPath)) {
|
|
251
|
+
(/* @__PURE__ */ getFs()).unlinkSync(this.manifestPath);
|
|
248
252
|
}
|
|
249
253
|
} catch (error) {
|
|
250
254
|
logger.warn(
|
|
@@ -268,10 +272,10 @@ class DlxManifest {
|
|
|
268
272
|
*/
|
|
269
273
|
getAllPackages() {
|
|
270
274
|
try {
|
|
271
|
-
if (!(
|
|
275
|
+
if (!(/* @__PURE__ */ getFs()).existsSync(this.manifestPath)) {
|
|
272
276
|
return [];
|
|
273
277
|
}
|
|
274
|
-
const rawContent = (0,
|
|
278
|
+
const rawContent = (0, import_fs.readFileUtf8Sync)(this.manifestPath);
|
|
275
279
|
const content = (typeof rawContent === "string" ? rawContent : rawContent.toString("utf8")).trim();
|
|
276
280
|
if (!content) {
|
|
277
281
|
return [];
|
package/dist/env/rewire.js
CHANGED
|
@@ -28,9 +28,17 @@ __export(rewire_exports, {
|
|
|
28
28
|
withEnvSync: () => withEnvSync
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(rewire_exports);
|
|
31
|
-
var import_async_hooks = require("async_hooks");
|
|
32
31
|
var import_helpers = require("./helpers");
|
|
33
|
-
|
|
32
|
+
let _async_hooks;
|
|
33
|
+
// @__NO_SIDE_EFFECTS__
|
|
34
|
+
function getAsyncHooks() {
|
|
35
|
+
if (_async_hooks === void 0) {
|
|
36
|
+
_async_hooks = require("async_hooks");
|
|
37
|
+
}
|
|
38
|
+
return _async_hooks;
|
|
39
|
+
}
|
|
40
|
+
const { AsyncLocalStorage } = /* @__PURE__ */ getAsyncHooks();
|
|
41
|
+
const isolatedOverridesStorage = new AsyncLocalStorage();
|
|
34
42
|
const sharedOverridesSymbol = Symbol.for(
|
|
35
43
|
"@socketsecurity/lib/env/rewire/test-overrides"
|
|
36
44
|
);
|