@socketsecurity/lib 3.5.0 → 4.0.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.
- package/CHANGELOG.md +7 -0
- package/README.md +8 -8
- package/dist/agent.js +11 -24
- package/dist/bin.d.ts +97 -40
- package/dist/bin.js +129 -134
- package/dist/cacache.d.ts +5 -2
- package/dist/cacache.js +29 -18
- package/dist/cache-with-ttl.js +1 -1
- package/dist/constants/agents.d.ts +0 -4
- package/dist/constants/agents.js +13 -4
- package/dist/constants/node.d.ts +1 -0
- package/dist/constants/node.js +2 -5
- package/dist/constants/packages.js +22 -10
- package/dist/dlx-binary.js +9 -17
- package/dist/dlx-manifest.js +2 -2
- package/dist/dlx-package.js +22 -62
- package/dist/dlx.js +14 -14
- package/dist/fs.js +19 -24
- package/dist/git.d.ts +6 -6
- package/dist/git.js +11 -14
- package/dist/globs.js +16 -29
- package/dist/ipc.d.ts +4 -4
- package/dist/ipc.js +3 -3
- package/dist/logger.d.ts +0 -25
- package/dist/logger.js +0 -26
- package/dist/package-default-node-range.js +13 -3
- package/dist/package-extensions.d.ts +2 -1
- package/dist/package-extensions.js +12 -2
- package/dist/packages/editable.d.ts +0 -3
- package/dist/packages/editable.js +34 -24
- package/dist/packages/isolation.js +32 -32
- package/dist/packages/licenses.js +18 -32
- package/dist/packages/manifest.js +18 -33
- package/dist/packages/normalize.js +19 -43
- package/dist/packages/operations.js +33 -80
- package/dist/packages/provenance.js +14 -4
- package/dist/packages/specs.js +13 -12
- package/dist/packages/validation.js +12 -10
- package/dist/packages.d.ts +1 -1
- package/dist/packages.js +3 -3
- package/dist/paths/dirnames.d.ts +13 -0
- package/dist/paths/dirnames.js +50 -0
- package/dist/paths/exts.d.ts +18 -0
- package/dist/paths/exts.js +68 -0
- package/dist/paths/filenames.d.ts +16 -0
- package/dist/paths/filenames.js +62 -0
- package/dist/paths/globs.d.ts +10 -0
- package/dist/{argv/quote.js → paths/globs.js} +21 -19
- package/dist/{path.d.ts → paths/normalize.d.ts} +41 -0
- package/dist/{path.js → paths/normalize.js} +17 -4
- package/dist/{packages/paths.js → paths/packages.js} +8 -8
- package/dist/{paths.js → paths/socket.js} +29 -65
- package/dist/sea.js +2 -2
- package/dist/shadow.js +3 -3
- package/dist/sorts.js +12 -2
- package/dist/spawn.d.ts +15 -12
- package/dist/spawn.js +42 -30
- package/dist/spinner.d.ts +2 -6
- package/dist/spinner.js +6 -39
- package/dist/stdio/prompts.d.ts +8 -10
- package/dist/stdio/prompts.js +14 -12
- package/dist/streams.d.ts +0 -4
- package/dist/streams.js +3 -12
- package/dist/temporary-executor.js +3 -3
- package/dist/versions.js +31 -28
- package/package.json +28 -20
- package/dist/argv/quote.d.ts +0 -49
- package/dist/constants/paths.d.ts +0 -51
- package/dist/constants/paths.js +0 -152
- /package/dist/{packages/paths.d.ts → paths/packages.d.ts} +0 -0
- /package/dist/{paths.d.ts → paths/socket.d.ts} +0 -0
|
@@ -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 operations_exports = {};
|
|
21
31
|
__export(operations_exports, {
|
|
@@ -33,79 +43,29 @@ module.exports = __toCommonJS(operations_exports);
|
|
|
33
43
|
var import_packages = require("#constants/packages");
|
|
34
44
|
var import_process = require("#constants/process");
|
|
35
45
|
var import_socket = require("#constants/socket");
|
|
46
|
+
var import_cacache = __toESM(require("../external/cacache"));
|
|
47
|
+
var import_libnpmpack = __toESM(require("../external/libnpmpack"));
|
|
48
|
+
var import_make_fetch_happen = __toESM(require("../external/make-fetch-happen"));
|
|
49
|
+
var import_npm_package_arg = __toESM(require("../external/npm-package-arg"));
|
|
50
|
+
var import_packageurl_js = require("../external/@socketregistry/packageurl-js");
|
|
51
|
+
var import_pacote = __toESM(require("../external/pacote"));
|
|
52
|
+
var semver = __toESM(require("../external/semver"));
|
|
36
53
|
var import_fs = require("../fs");
|
|
37
54
|
var import_objects = require("../objects");
|
|
38
55
|
var import_normalize = require("./normalize");
|
|
39
|
-
var
|
|
56
|
+
var import_packages2 = require("../paths/packages");
|
|
40
57
|
var import_specs = require("./specs");
|
|
41
58
|
const abortSignal = (0, import_process.getAbortSignal)();
|
|
42
59
|
const packageExtensions = (0, import_packages.getPackageExtensions)();
|
|
43
60
|
const packumentCache = (0, import_packages.getPackumentCache)();
|
|
44
61
|
const pacoteCachePath = (0, import_packages.getPacoteCachePath)();
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
let _fetcher;
|
|
54
|
-
// @__NO_SIDE_EFFECTS__
|
|
55
|
-
function getFetcher() {
|
|
56
|
-
if (_fetcher === void 0) {
|
|
57
|
-
const makeFetchHappen = require("../external/make-fetch-happen");
|
|
58
|
-
_fetcher = makeFetchHappen.defaults({
|
|
59
|
-
cachePath: pacoteCachePath,
|
|
60
|
-
// Prefer-offline: Staleness checks for cached data will be bypassed, but
|
|
61
|
-
// missing data will be requested from the server.
|
|
62
|
-
// https://github.com/npm/make-fetch-happen?tab=readme-ov-file#--optscache
|
|
63
|
-
cache: "force-cache"
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
return _fetcher;
|
|
67
|
-
}
|
|
68
|
-
let _npmPackageArg;
|
|
69
|
-
// @__NO_SIDE_EFFECTS__
|
|
70
|
-
function getNpmPackageArg() {
|
|
71
|
-
if (_npmPackageArg === void 0) {
|
|
72
|
-
_npmPackageArg = require("../external/npm-package-arg");
|
|
73
|
-
}
|
|
74
|
-
return _npmPackageArg;
|
|
75
|
-
}
|
|
76
|
-
let _pack;
|
|
77
|
-
// @__NO_SIDE_EFFECTS__
|
|
78
|
-
function getPack() {
|
|
79
|
-
if (_pack === void 0) {
|
|
80
|
-
_pack = require("../external/libnpmpack");
|
|
81
|
-
}
|
|
82
|
-
return _pack;
|
|
83
|
-
}
|
|
84
|
-
let _PackageURL;
|
|
85
|
-
// @__NO_SIDE_EFFECTS__
|
|
86
|
-
function getPackageURL() {
|
|
87
|
-
if (_PackageURL === void 0) {
|
|
88
|
-
const packageUrlJs = require("../external/@socketregistry/packageurl-js");
|
|
89
|
-
_PackageURL = packageUrlJs.PackageURL;
|
|
90
|
-
}
|
|
91
|
-
return _PackageURL;
|
|
92
|
-
}
|
|
93
|
-
let _pacote;
|
|
94
|
-
// @__NO_SIDE_EFFECTS__
|
|
95
|
-
function getPacote() {
|
|
96
|
-
if (_pacote === void 0) {
|
|
97
|
-
_pacote = require("../external/pacote");
|
|
98
|
-
}
|
|
99
|
-
return _pacote;
|
|
100
|
-
}
|
|
101
|
-
let _semver;
|
|
102
|
-
// @__NO_SIDE_EFFECTS__
|
|
103
|
-
function getSemver() {
|
|
104
|
-
if (_semver === void 0) {
|
|
105
|
-
_semver = require("../external/semver");
|
|
106
|
-
}
|
|
107
|
-
return _semver;
|
|
108
|
-
}
|
|
62
|
+
const fetcher = import_make_fetch_happen.default.defaults({
|
|
63
|
+
cachePath: pacoteCachePath,
|
|
64
|
+
// Prefer-offline: Staleness checks for cached data will be bypassed, but
|
|
65
|
+
// missing data will be requested from the server.
|
|
66
|
+
// https://github.com/npm/make-fetch-happen?tab=readme-ov-file#--optscache
|
|
67
|
+
cache: "force-cache"
|
|
68
|
+
});
|
|
109
69
|
let _toEditablePackageJson;
|
|
110
70
|
// @__NO_SIDE_EFFECTS__
|
|
111
71
|
function _getToEditablePackageJson() {
|
|
@@ -139,19 +99,17 @@ async function extractPackage(pkgNameOrId, options, callback) {
|
|
|
139
99
|
preferOffline: true,
|
|
140
100
|
...extractOptions_
|
|
141
101
|
};
|
|
142
|
-
const pacote = /* @__PURE__ */ getPacote();
|
|
143
102
|
if (typeof dest === "string") {
|
|
144
|
-
await
|
|
103
|
+
await import_pacote.default.extract(pkgNameOrId, dest, extractOptions);
|
|
145
104
|
if (typeof actualCallback === "function") {
|
|
146
105
|
await actualCallback(dest);
|
|
147
106
|
}
|
|
148
107
|
} else {
|
|
149
|
-
|
|
150
|
-
await cacache.tmp.withTmp(
|
|
108
|
+
await import_cacache.default.tmp.withTmp(
|
|
151
109
|
pacoteCachePath,
|
|
152
110
|
{ tmpPrefix },
|
|
153
111
|
async (tmpDirPath) => {
|
|
154
|
-
await
|
|
112
|
+
await import_pacote.default.extract(pkgNameOrId, tmpDirPath, extractOptions);
|
|
155
113
|
if (typeof actualCallback === "function") {
|
|
156
114
|
await actualCallback(tmpDirPath);
|
|
157
115
|
}
|
|
@@ -168,7 +126,6 @@ function findPackageExtensions(pkgName, pkgVer) {
|
|
|
168
126
|
const lastAtSignIndex = selector.lastIndexOf("@");
|
|
169
127
|
const name = selector.slice(0, lastAtSignIndex);
|
|
170
128
|
if (pkgName === name) {
|
|
171
|
-
const semver = /* @__PURE__ */ getSemver();
|
|
172
129
|
const range = selector.slice(lastAtSignIndex + 1);
|
|
173
130
|
if (semver.satisfies(pkgVer, range)) {
|
|
174
131
|
if (result === void 0) {
|
|
@@ -200,8 +157,7 @@ function getReleaseTag(spec) {
|
|
|
200
157
|
}
|
|
201
158
|
// @__NO_SIDE_EFFECTS__
|
|
202
159
|
async function packPackage(spec, options) {
|
|
203
|
-
|
|
204
|
-
return await pack(spec, {
|
|
160
|
+
return await (0, import_libnpmpack.default)(spec, {
|
|
205
161
|
__proto__: null,
|
|
206
162
|
signal: abortSignal,
|
|
207
163
|
...options,
|
|
@@ -215,7 +171,7 @@ async function readPackageJson(filepath, options) {
|
|
|
215
171
|
__proto__: null,
|
|
216
172
|
...options
|
|
217
173
|
};
|
|
218
|
-
const pkgJson = await (0, import_fs.readJson)((0,
|
|
174
|
+
const pkgJson = await (0, import_fs.readJson)((0, import_packages2.resolvePackageJsonPath)(filepath), {
|
|
219
175
|
throws
|
|
220
176
|
});
|
|
221
177
|
if (pkgJson) {
|
|
@@ -237,7 +193,7 @@ function readPackageJsonSync(filepath, options) {
|
|
|
237
193
|
__proto__: null,
|
|
238
194
|
...options
|
|
239
195
|
};
|
|
240
|
-
const pkgJson = (0, import_fs.readJsonSync)((0,
|
|
196
|
+
const pkgJson = (0, import_fs.readJsonSync)((0, import_packages2.resolvePackageJsonPath)(filepath), { throws });
|
|
241
197
|
if (pkgJson) {
|
|
242
198
|
if (editable) {
|
|
243
199
|
const toEditablePackageJsonSync = /* @__PURE__ */ _getToEditablePackageJsonSync();
|
|
@@ -259,8 +215,7 @@ async function resolveGitHubTgzUrl(pkgNameOrId, where) {
|
|
|
259
215
|
return "";
|
|
260
216
|
}
|
|
261
217
|
const { version } = pkgJson;
|
|
262
|
-
const
|
|
263
|
-
const parsedSpec = npmPackageArg(
|
|
218
|
+
const parsedSpec = (0, import_npm_package_arg.default)(
|
|
264
219
|
pkgNameOrId,
|
|
265
220
|
whereIsPkgJson ? void 0 : where
|
|
266
221
|
);
|
|
@@ -276,7 +231,6 @@ async function resolveGitHubTgzUrl(pkgNameOrId, where) {
|
|
|
276
231
|
if (isGitHubUrl) {
|
|
277
232
|
apiUrl = (0, import_specs.gitHubTagRefUrl)(user, project, parsedSpec.gitCommittish || "");
|
|
278
233
|
} else {
|
|
279
|
-
const fetcher = /* @__PURE__ */ getFetcher();
|
|
280
234
|
const versionStr = version;
|
|
281
235
|
apiUrl = (0, import_specs.gitHubTagRefUrl)(user, project, `v${versionStr}`);
|
|
282
236
|
if (!(await fetcher(apiUrl, { method: "head" })).ok) {
|
|
@@ -287,7 +241,6 @@ async function resolveGitHubTgzUrl(pkgNameOrId, where) {
|
|
|
287
241
|
}
|
|
288
242
|
}
|
|
289
243
|
if (apiUrl) {
|
|
290
|
-
const fetcher = /* @__PURE__ */ getFetcher();
|
|
291
244
|
const resp = await fetcher(apiUrl);
|
|
292
245
|
const json = await resp.json();
|
|
293
246
|
const sha = json?.object?.sha;
|
|
@@ -305,7 +258,7 @@ function resolvePackageName(purlObj, delimiter = "/") {
|
|
|
305
258
|
}
|
|
306
259
|
// @__NO_SIDE_EFFECTS__
|
|
307
260
|
function resolveRegistryPackageName(pkgName) {
|
|
308
|
-
const purlObj =
|
|
261
|
+
const purlObj = import_packageurl_js.PackageURL.fromString(`pkg:npm/${pkgName}`);
|
|
309
262
|
return purlObj.namespace ? `${purlObj.namespace.slice(1)}${import_socket.REGISTRY_SCOPE_DELIMITER}${purlObj.name}` : pkgName;
|
|
310
263
|
}
|
|
311
264
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -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 provenance_exports = {};
|
|
21
31
|
__export(provenance_exports, {
|
|
@@ -24,6 +34,8 @@ __export(provenance_exports, {
|
|
|
24
34
|
});
|
|
25
35
|
module.exports = __toCommonJS(provenance_exports);
|
|
26
36
|
var import_agents = require("#constants/agents");
|
|
37
|
+
var import_packages = require("#constants/packages");
|
|
38
|
+
var import_make_fetch_happen = __toESM(require("../external/make-fetch-happen"));
|
|
27
39
|
var import_abort = require("../abort");
|
|
28
40
|
var import_url = require("../url");
|
|
29
41
|
const ArrayIsArray = Array.isArray;
|
|
@@ -33,10 +45,8 @@ let _fetcher;
|
|
|
33
45
|
// @__NO_SIDE_EFFECTS__
|
|
34
46
|
function getFetcher() {
|
|
35
47
|
if (_fetcher === void 0) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
_fetcher = makeFetchHappen.defaults({
|
|
39
|
-
cachePath: getPacoteCachePath(),
|
|
48
|
+
_fetcher = import_make_fetch_happen.default.defaults({
|
|
49
|
+
cachePath: (0, import_packages.getPacoteCachePath)(),
|
|
40
50
|
// Prefer-offline: Staleness checks for cached data will be bypassed, but
|
|
41
51
|
// missing data will be requested from the server.
|
|
42
52
|
// https://github.com/npm/make-fetch-happen?tab=readme-ov-file#--optscache
|
package/dist/packages/specs.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 specs_exports = {};
|
|
21
31
|
__export(specs_exports, {
|
|
@@ -26,16 +36,9 @@ __export(specs_exports, {
|
|
|
26
36
|
isGitHubUrlSpec: () => isGitHubUrlSpec
|
|
27
37
|
});
|
|
28
38
|
module.exports = __toCommonJS(specs_exports);
|
|
39
|
+
var import_npm_package_arg = __toESM(require("../external/npm-package-arg"));
|
|
29
40
|
var import_objects = require("../objects");
|
|
30
41
|
var import_strings = require("../strings");
|
|
31
|
-
let _npmPackageArg;
|
|
32
|
-
// @__NO_SIDE_EFFECTS__
|
|
33
|
-
function getNpmPackageArg() {
|
|
34
|
-
if (_npmPackageArg === void 0) {
|
|
35
|
-
_npmPackageArg = require("../external/npm-package-arg");
|
|
36
|
-
}
|
|
37
|
-
return _npmPackageArg;
|
|
38
|
-
}
|
|
39
42
|
// @__NO_SIDE_EFFECTS__
|
|
40
43
|
function getRepoUrlDetails(repoUrl = "") {
|
|
41
44
|
const userAndRepo = repoUrl.replace(/^.+github.com\//, "").split("/");
|
|
@@ -57,8 +60,7 @@ function isGitHubTgzSpec(spec, where) {
|
|
|
57
60
|
if ((0, import_objects.isObjectObject)(spec)) {
|
|
58
61
|
parsedSpec = spec;
|
|
59
62
|
} else {
|
|
60
|
-
|
|
61
|
-
parsedSpec = npmPackageArg(spec, where);
|
|
63
|
+
parsedSpec = (0, import_npm_package_arg.default)(spec, where);
|
|
62
64
|
}
|
|
63
65
|
const typedSpec = parsedSpec;
|
|
64
66
|
return typedSpec.type === "remote" && !!typedSpec.saveSpec?.endsWith(".tar.gz");
|
|
@@ -69,8 +71,7 @@ function isGitHubUrlSpec(spec, where) {
|
|
|
69
71
|
if ((0, import_objects.isObjectObject)(spec)) {
|
|
70
72
|
parsedSpec = spec;
|
|
71
73
|
} else {
|
|
72
|
-
|
|
73
|
-
parsedSpec = npmPackageArg(spec, where);
|
|
74
|
+
parsedSpec = (0, import_npm_package_arg.default)(spec, where);
|
|
74
75
|
}
|
|
75
76
|
const typedSpec = parsedSpec;
|
|
76
77
|
return typedSpec.type === "git" && typedSpec.hosted?.domain === "github.com" && (0, import_strings.isNonEmptyString)(typedSpec.gitCommittish);
|
|
@@ -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 validation_exports = {};
|
|
21
31
|
__export(validation_exports, {
|
|
@@ -24,14 +34,7 @@ __export(validation_exports, {
|
|
|
24
34
|
isValidPackageName: () => isValidPackageName
|
|
25
35
|
});
|
|
26
36
|
module.exports = __toCommonJS(validation_exports);
|
|
27
|
-
|
|
28
|
-
// @__NO_SIDE_EFFECTS__
|
|
29
|
-
function getValidateNpmPackageName() {
|
|
30
|
-
if (_validateNpmPackageName === void 0) {
|
|
31
|
-
_validateNpmPackageName = require("../external/validate-npm-package-name");
|
|
32
|
-
}
|
|
33
|
-
return _validateNpmPackageName;
|
|
34
|
-
}
|
|
37
|
+
var import_validate_npm_package_name = __toESM(require("../external/validate-npm-package-name"));
|
|
35
38
|
// @__NO_SIDE_EFFECTS__
|
|
36
39
|
function isBlessedPackageName(name) {
|
|
37
40
|
return typeof name === "string" && (name === "sfw" || name === "socket" || name.startsWith("@socketoverride/") || name.startsWith("@socketregistry/") || name.startsWith("@socketsecurity/"));
|
|
@@ -42,8 +45,7 @@ function isRegistryFetcherType(type) {
|
|
|
42
45
|
}
|
|
43
46
|
// @__NO_SIDE_EFFECTS__
|
|
44
47
|
function isValidPackageName(name) {
|
|
45
|
-
|
|
46
|
-
return validateNpmPackageName(name).validForOldPackages;
|
|
48
|
+
return (0, import_validate_npm_package_name.default)(name).validForOldPackages;
|
|
47
49
|
}
|
|
48
50
|
// Annotate the CommonJS export names for ESM import in node:
|
|
49
51
|
0 && (module.exports = {
|
package/dist/packages.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { collectIncompatibleLicenses, collectLicenseWarnings, createAstNode, cre
|
|
|
10
10
|
import { createPackageJson, fetchPackageManifest, fetchPackagePackument } from './packages/manifest';
|
|
11
11
|
import { normalizePackageJson, resolveEscapedScope, resolveOriginalPackageName, unescapeScope } from './packages/normalize';
|
|
12
12
|
import { extractPackage, findPackageExtensions, getReleaseTag, packPackage, readPackageJson, readPackageJsonSync, resolveGitHubTgzUrl, resolvePackageName, resolveRegistryPackageName } from './packages/operations';
|
|
13
|
-
import { resolvePackageJsonDirname, resolvePackageJsonPath } from './packages
|
|
13
|
+
import { resolvePackageJsonDirname, resolvePackageJsonPath } from './paths/packages';
|
|
14
14
|
import { fetchPackageProvenance, getProvenanceDetails } from './packages/provenance';
|
|
15
15
|
import { getRepoUrlDetails, gitHubTagRefUrl, gitHubTgzUrl, isGitHubTgzSpec, isGitHubUrlSpec } from './packages/specs';
|
|
16
16
|
import { isBlessedPackageName, isRegistryFetcherType, isValidPackageName } from './packages/validation';
|
package/dist/packages.js
CHANGED
|
@@ -56,9 +56,9 @@ __export(packages_exports, {
|
|
|
56
56
|
resolveEscapedScope: () => import_normalize.resolveEscapedScope,
|
|
57
57
|
resolveGitHubTgzUrl: () => import_operations.resolveGitHubTgzUrl,
|
|
58
58
|
resolveOriginalPackageName: () => import_normalize.resolveOriginalPackageName,
|
|
59
|
-
resolvePackageJsonDirname: () =>
|
|
59
|
+
resolvePackageJsonDirname: () => import_packages.resolvePackageJsonDirname,
|
|
60
60
|
resolvePackageJsonEntryExports: () => import_exports.resolvePackageJsonEntryExports,
|
|
61
|
-
resolvePackageJsonPath: () =>
|
|
61
|
+
resolvePackageJsonPath: () => import_packages.resolvePackageJsonPath,
|
|
62
62
|
resolvePackageLicenses: () => import_licenses.resolvePackageLicenses,
|
|
63
63
|
resolvePackageName: () => import_operations.resolvePackageName,
|
|
64
64
|
resolveRegistryPackageName: () => import_operations.resolveRegistryPackageName,
|
|
@@ -75,7 +75,7 @@ var import_licenses = require("./packages/licenses");
|
|
|
75
75
|
var import_manifest = require("./packages/manifest");
|
|
76
76
|
var import_normalize = require("./packages/normalize");
|
|
77
77
|
var import_operations = require("./packages/operations");
|
|
78
|
-
var
|
|
78
|
+
var import_packages = require("./paths/packages");
|
|
79
79
|
var import_provenance = require("./packages/provenance");
|
|
80
80
|
var import_specs = require("./packages/specs");
|
|
81
81
|
var import_validation = require("./packages/validation");
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Directory name and path pattern constants.
|
|
3
|
+
*/
|
|
4
|
+
// Directory names.
|
|
5
|
+
export declare const NODE_MODULES = "node_modules";
|
|
6
|
+
export declare const DOT_GIT_DIR = ".git";
|
|
7
|
+
export declare const DOT_GITHUB = ".github";
|
|
8
|
+
export declare const DOT_SOCKET_DIR = ".socket";
|
|
9
|
+
export declare const CACHE_DIR = "cache";
|
|
10
|
+
export declare const CACHE_TTL_DIR = "ttl";
|
|
11
|
+
// Path patterns.
|
|
12
|
+
export declare const NODE_MODULES_GLOB_RECURSIVE = "**/node_modules";
|
|
13
|
+
export declare const SLASH_NODE_MODULES_SLASH = "/node_modules/";
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Socket Lib - Built with esbuild */
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var dirnames_exports = {};
|
|
21
|
+
__export(dirnames_exports, {
|
|
22
|
+
CACHE_DIR: () => CACHE_DIR,
|
|
23
|
+
CACHE_TTL_DIR: () => CACHE_TTL_DIR,
|
|
24
|
+
DOT_GITHUB: () => DOT_GITHUB,
|
|
25
|
+
DOT_GIT_DIR: () => DOT_GIT_DIR,
|
|
26
|
+
DOT_SOCKET_DIR: () => DOT_SOCKET_DIR,
|
|
27
|
+
NODE_MODULES: () => NODE_MODULES,
|
|
28
|
+
NODE_MODULES_GLOB_RECURSIVE: () => NODE_MODULES_GLOB_RECURSIVE,
|
|
29
|
+
SLASH_NODE_MODULES_SLASH: () => SLASH_NODE_MODULES_SLASH
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(dirnames_exports);
|
|
32
|
+
const NODE_MODULES = "node_modules";
|
|
33
|
+
const DOT_GIT_DIR = ".git";
|
|
34
|
+
const DOT_GITHUB = ".github";
|
|
35
|
+
const DOT_SOCKET_DIR = ".socket";
|
|
36
|
+
const CACHE_DIR = "cache";
|
|
37
|
+
const CACHE_TTL_DIR = "ttl";
|
|
38
|
+
const NODE_MODULES_GLOB_RECURSIVE = "**/node_modules";
|
|
39
|
+
const SLASH_NODE_MODULES_SLASH = "/node_modules/";
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
CACHE_DIR,
|
|
43
|
+
CACHE_TTL_DIR,
|
|
44
|
+
DOT_GITHUB,
|
|
45
|
+
DOT_GIT_DIR,
|
|
46
|
+
DOT_SOCKET_DIR,
|
|
47
|
+
NODE_MODULES,
|
|
48
|
+
NODE_MODULES_GLOB_RECURSIVE,
|
|
49
|
+
SLASH_NODE_MODULES_SLASH
|
|
50
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview File extension constants.
|
|
3
|
+
*/
|
|
4
|
+
// File extensions.
|
|
5
|
+
export declare const EXT_CJS = ".cjs";
|
|
6
|
+
export declare const EXT_CMD = ".cmd";
|
|
7
|
+
export declare const EXT_CTS = ".cts";
|
|
8
|
+
export declare const EXT_DTS = ".d.ts";
|
|
9
|
+
export declare const EXT_JS = ".js";
|
|
10
|
+
export declare const EXT_JSON = ".json";
|
|
11
|
+
export declare const EXT_LOCK = ".lock";
|
|
12
|
+
export declare const EXT_LOCKB = ".lockb";
|
|
13
|
+
export declare const EXT_MD = ".md";
|
|
14
|
+
export declare const EXT_MJS = ".mjs";
|
|
15
|
+
export declare const EXT_MTS = ".mts";
|
|
16
|
+
export declare const EXT_PS1 = ".ps1";
|
|
17
|
+
export declare const EXT_YAML = ".yaml";
|
|
18
|
+
export declare const EXT_YML = ".yml";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Socket Lib - Built with esbuild */
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var exts_exports = {};
|
|
21
|
+
__export(exts_exports, {
|
|
22
|
+
EXT_CJS: () => EXT_CJS,
|
|
23
|
+
EXT_CMD: () => EXT_CMD,
|
|
24
|
+
EXT_CTS: () => EXT_CTS,
|
|
25
|
+
EXT_DTS: () => EXT_DTS,
|
|
26
|
+
EXT_JS: () => EXT_JS,
|
|
27
|
+
EXT_JSON: () => EXT_JSON,
|
|
28
|
+
EXT_LOCK: () => EXT_LOCK,
|
|
29
|
+
EXT_LOCKB: () => EXT_LOCKB,
|
|
30
|
+
EXT_MD: () => EXT_MD,
|
|
31
|
+
EXT_MJS: () => EXT_MJS,
|
|
32
|
+
EXT_MTS: () => EXT_MTS,
|
|
33
|
+
EXT_PS1: () => EXT_PS1,
|
|
34
|
+
EXT_YAML: () => EXT_YAML,
|
|
35
|
+
EXT_YML: () => EXT_YML
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(exts_exports);
|
|
38
|
+
const EXT_CJS = ".cjs";
|
|
39
|
+
const EXT_CMD = ".cmd";
|
|
40
|
+
const EXT_CTS = ".cts";
|
|
41
|
+
const EXT_DTS = ".d.ts";
|
|
42
|
+
const EXT_JS = ".js";
|
|
43
|
+
const EXT_JSON = ".json";
|
|
44
|
+
const EXT_LOCK = ".lock";
|
|
45
|
+
const EXT_LOCKB = ".lockb";
|
|
46
|
+
const EXT_MD = ".md";
|
|
47
|
+
const EXT_MJS = ".mjs";
|
|
48
|
+
const EXT_MTS = ".mts";
|
|
49
|
+
const EXT_PS1 = ".ps1";
|
|
50
|
+
const EXT_YAML = ".yaml";
|
|
51
|
+
const EXT_YML = ".yml";
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
EXT_CJS,
|
|
55
|
+
EXT_CMD,
|
|
56
|
+
EXT_CTS,
|
|
57
|
+
EXT_DTS,
|
|
58
|
+
EXT_JS,
|
|
59
|
+
EXT_JSON,
|
|
60
|
+
EXT_LOCK,
|
|
61
|
+
EXT_LOCKB,
|
|
62
|
+
EXT_MD,
|
|
63
|
+
EXT_MJS,
|
|
64
|
+
EXT_MTS,
|
|
65
|
+
EXT_PS1,
|
|
66
|
+
EXT_YAML,
|
|
67
|
+
EXT_YML
|
|
68
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview File name constants.
|
|
3
|
+
*/
|
|
4
|
+
// File names.
|
|
5
|
+
export declare const PACKAGE_JSON = "package.json";
|
|
6
|
+
export declare const TSCONFIG_JSON = "tsconfig.json";
|
|
7
|
+
export declare const LICENSE = "LICENSE";
|
|
8
|
+
export declare const LICENSE_MD = "LICENSE.md";
|
|
9
|
+
export declare const LICENSE_ORIGINAL = "LICENSE.original";
|
|
10
|
+
export declare const README_MD = "README.md";
|
|
11
|
+
export declare const CHANGELOG_MD = "CHANGELOG.md";
|
|
12
|
+
export declare const MANIFEST_JSON = "manifest.json";
|
|
13
|
+
export declare const EXTENSIONS_JSON = "extensions.json";
|
|
14
|
+
export declare const ESLINT_CONFIG_JS = "eslint.config.js";
|
|
15
|
+
export declare const GITIGNORE = ".gitignore";
|
|
16
|
+
export declare const DOT_PACKAGE_LOCK_JSON = ".package-lock.json";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Socket Lib - Built with esbuild */
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var filenames_exports = {};
|
|
21
|
+
__export(filenames_exports, {
|
|
22
|
+
CHANGELOG_MD: () => CHANGELOG_MD,
|
|
23
|
+
DOT_PACKAGE_LOCK_JSON: () => DOT_PACKAGE_LOCK_JSON,
|
|
24
|
+
ESLINT_CONFIG_JS: () => ESLINT_CONFIG_JS,
|
|
25
|
+
EXTENSIONS_JSON: () => EXTENSIONS_JSON,
|
|
26
|
+
GITIGNORE: () => GITIGNORE,
|
|
27
|
+
LICENSE: () => LICENSE,
|
|
28
|
+
LICENSE_MD: () => LICENSE_MD,
|
|
29
|
+
LICENSE_ORIGINAL: () => LICENSE_ORIGINAL,
|
|
30
|
+
MANIFEST_JSON: () => MANIFEST_JSON,
|
|
31
|
+
PACKAGE_JSON: () => PACKAGE_JSON,
|
|
32
|
+
README_MD: () => README_MD,
|
|
33
|
+
TSCONFIG_JSON: () => TSCONFIG_JSON
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(filenames_exports);
|
|
36
|
+
const PACKAGE_JSON = "package.json";
|
|
37
|
+
const TSCONFIG_JSON = "tsconfig.json";
|
|
38
|
+
const LICENSE = "LICENSE";
|
|
39
|
+
const LICENSE_MD = "LICENSE.md";
|
|
40
|
+
const LICENSE_ORIGINAL = "LICENSE.original";
|
|
41
|
+
const README_MD = "README.md";
|
|
42
|
+
const CHANGELOG_MD = "CHANGELOG.md";
|
|
43
|
+
const MANIFEST_JSON = "manifest.json";
|
|
44
|
+
const EXTENSIONS_JSON = "extensions.json";
|
|
45
|
+
const ESLINT_CONFIG_JS = "eslint.config.js";
|
|
46
|
+
const GITIGNORE = ".gitignore";
|
|
47
|
+
const DOT_PACKAGE_LOCK_JSON = ".package-lock.json";
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
CHANGELOG_MD,
|
|
51
|
+
DOT_PACKAGE_LOCK_JSON,
|
|
52
|
+
ESLINT_CONFIG_JS,
|
|
53
|
+
EXTENSIONS_JSON,
|
|
54
|
+
GITIGNORE,
|
|
55
|
+
LICENSE,
|
|
56
|
+
LICENSE_MD,
|
|
57
|
+
LICENSE_ORIGINAL,
|
|
58
|
+
MANIFEST_JSON,
|
|
59
|
+
PACKAGE_JSON,
|
|
60
|
+
README_MD,
|
|
61
|
+
TSCONFIG_JSON
|
|
62
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Glob pattern constants.
|
|
3
|
+
*/
|
|
4
|
+
// Glob patterns.
|
|
5
|
+
export declare const LICENSE_GLOB = "LICEN[CS]E{[.-]*,}";
|
|
6
|
+
export declare const LICENSE_GLOB_RECURSIVE = "**/LICEN[CS]E{[.-]*,}";
|
|
7
|
+
export declare const LICENSE_ORIGINAL_GLOB = "*.original{.*,}";
|
|
8
|
+
export declare const LICENSE_ORIGINAL_GLOB_RECURSIVE = "**/*.original{.*,}";
|
|
9
|
+
export declare const README_GLOB = "README{.*,}";
|
|
10
|
+
export declare const README_GLOB_RECURSIVE = "**/README{.*,}";
|