@socketsecurity/lib 5.18.2 → 5.19.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.
Files changed (305) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +6 -5
  3. package/dist/abort.d.ts +3 -0
  4. package/dist/abort.js +1 -0
  5. package/dist/agent.d.ts +66 -49
  6. package/dist/agent.js +51 -50
  7. package/dist/ansi.d.ts +2 -5
  8. package/dist/ansi.js +3 -2
  9. package/dist/archives.d.ts +25 -21
  10. package/dist/archives.js +35 -34
  11. package/dist/argv/flags.d.ts +100 -91
  12. package/dist/argv/flags.js +88 -87
  13. package/dist/argv/parse.d.ts +30 -40
  14. package/dist/argv/parse.js +33 -32
  15. package/dist/arrays.d.ts +4 -8
  16. package/dist/arrays.js +1 -0
  17. package/dist/bin.d.ts +7 -5
  18. package/dist/bin.js +52 -29
  19. package/dist/cacache.d.ts +13 -12
  20. package/dist/cacache.js +9 -8
  21. package/dist/cache-with-ttl.d.ts +53 -35
  22. package/dist/cache-with-ttl.js +1 -0
  23. package/dist/colors.d.ts +5 -5
  24. package/dist/colors.js +1 -0
  25. package/dist/constants/agents.d.ts +5 -9
  26. package/dist/constants/agents.js +3 -2
  27. package/dist/constants/core.d.ts +5 -10
  28. package/dist/constants/core.js +2 -1
  29. package/dist/constants/encoding.d.ts +3 -3
  30. package/dist/constants/encoding.js +1 -0
  31. package/dist/constants/github.d.ts +3 -3
  32. package/dist/constants/github.js +1 -0
  33. package/dist/constants/licenses.d.ts +9 -2
  34. package/dist/constants/licenses.js +1 -0
  35. package/dist/constants/lifecycle-script-names.js +1 -0
  36. package/dist/constants/maintained-node-versions.d.ts +3 -0
  37. package/dist/constants/maintained-node-versions.js +1 -0
  38. package/dist/constants/node.d.ts +125 -16
  39. package/dist/constants/node.js +74 -73
  40. package/dist/constants/package-default-node-range.d.ts +3 -1
  41. package/dist/constants/package-default-node-range.js +2 -1
  42. package/dist/constants/package-default-socket-categories.d.ts +0 -1
  43. package/dist/constants/package-default-socket-categories.js +1 -0
  44. package/dist/constants/packages.d.ts +12 -17
  45. package/dist/constants/packages.js +31 -16
  46. package/dist/constants/platform.d.ts +1 -2
  47. package/dist/constants/platform.js +2 -1
  48. package/dist/constants/process.d.ts +18 -0
  49. package/dist/constants/process.js +1 -0
  50. package/dist/constants/socket.d.ts +4 -10
  51. package/dist/constants/socket.js +2 -1
  52. package/dist/constants/testing.d.ts +3 -3
  53. package/dist/constants/testing.js +1 -0
  54. package/dist/constants/time.d.ts +3 -4
  55. package/dist/constants/time.js +1 -0
  56. package/dist/constants/typescript.d.ts +10 -3
  57. package/dist/constants/typescript.js +5 -4
  58. package/dist/cover/code.d.ts +3 -0
  59. package/dist/cover/code.js +12 -12
  60. package/dist/cover/formatters.d.ts +12 -9
  61. package/dist/cover/formatters.js +19 -18
  62. package/dist/cover/type.d.ts +3 -0
  63. package/dist/cover/type.js +1 -0
  64. package/dist/cover/types.js +1 -0
  65. package/dist/debug.d.ts +32 -47
  66. package/dist/debug.js +97 -96
  67. package/dist/dlx/arborist.d.ts +134 -0
  68. package/dist/dlx/arborist.js +177 -0
  69. package/dist/dlx/binary.d.ts +25 -9
  70. package/dist/dlx/binary.js +34 -12
  71. package/dist/dlx/cache.d.ts +1 -0
  72. package/dist/dlx/cache.js +2 -1
  73. package/dist/dlx/detect.d.ts +15 -0
  74. package/dist/dlx/detect.js +28 -20
  75. package/dist/dlx/dir.d.ts +1 -11
  76. package/dist/dlx/dir.js +2 -12
  77. package/dist/dlx/integrity.d.ts +86 -0
  78. package/dist/dlx/integrity.js +112 -0
  79. package/dist/dlx/lockfile.d.ts +115 -0
  80. package/dist/dlx/lockfile.js +139 -0
  81. package/dist/dlx/manifest.d.ts +26 -1
  82. package/dist/dlx/manifest.js +9 -6
  83. package/dist/dlx/package.d.ts +58 -3
  84. package/dist/dlx/package.js +101 -74
  85. package/dist/dlx/packages.d.ts +1 -11
  86. package/dist/dlx/packages.js +3 -14
  87. package/dist/dlx/paths.d.ts +1 -0
  88. package/dist/dlx/paths.js +2 -1
  89. package/dist/effects/pulse-frames.js +1 -0
  90. package/dist/effects/text-shimmer.d.ts +13 -2
  91. package/dist/effects/text-shimmer.js +50 -46
  92. package/dist/effects/types.js +1 -0
  93. package/dist/effects/ultra.js +1 -0
  94. package/dist/env/ci.d.ts +6 -1
  95. package/dist/env/ci.js +1 -0
  96. package/dist/env/debug.d.ts +5 -1
  97. package/dist/env/debug.js +1 -0
  98. package/dist/env/github.d.ts +19 -23
  99. package/dist/env/github.js +5 -4
  100. package/dist/env/helpers.d.ts +21 -9
  101. package/dist/env/helpers.js +5 -11
  102. package/dist/env/home.d.ts +17 -4
  103. package/dist/env/home.js +2 -1
  104. package/dist/env/locale.d.ts +4 -3
  105. package/dist/env/locale.js +1 -0
  106. package/dist/env/node-auth-token.d.ts +5 -1
  107. package/dist/env/node-auth-token.js +1 -0
  108. package/dist/env/node-env.d.ts +5 -1
  109. package/dist/env/node-env.js +1 -0
  110. package/dist/env/npm.d.ts +4 -5
  111. package/dist/env/npm.js +1 -0
  112. package/dist/env/package-manager.d.ts +4 -3
  113. package/dist/env/package-manager.js +2 -1
  114. package/dist/env/path.d.ts +5 -1
  115. package/dist/env/path.js +1 -0
  116. package/dist/env/pre-commit.d.ts +5 -1
  117. package/dist/env/pre-commit.js +1 -0
  118. package/dist/env/rewire.d.ts +10 -0
  119. package/dist/env/rewire.js +7 -5
  120. package/dist/env/shell.d.ts +5 -1
  121. package/dist/env/shell.js +1 -0
  122. package/dist/env/socket-cli-shadow.d.ts +4 -5
  123. package/dist/env/socket-cli-shadow.js +1 -0
  124. package/dist/env/socket-cli.d.ts +4 -14
  125. package/dist/env/socket-cli.js +1 -0
  126. package/dist/env/socket.d.ts +6 -18
  127. package/dist/env/socket.js +4 -3
  128. package/dist/env/temp-dir.d.ts +4 -3
  129. package/dist/env/temp-dir.js +1 -0
  130. package/dist/env/term.d.ts +5 -1
  131. package/dist/env/term.js +1 -0
  132. package/dist/env/test.d.ts +4 -3
  133. package/dist/env/test.js +1 -0
  134. package/dist/env/windows.d.ts +4 -4
  135. package/dist/env/windows.js +1 -0
  136. package/dist/env/xdg.d.ts +4 -3
  137. package/dist/env/xdg.js +1 -0
  138. package/dist/env.d.ts +83 -23
  139. package/dist/env.js +112 -80
  140. package/dist/errors.js +1 -0
  141. package/dist/external/@npmcli/package-json.js +9 -3968
  142. package/dist/external/@socketregistry/packageurl-js.js +2 -2
  143. package/dist/external/debug.js +162 -328
  144. package/dist/external/external-pack.js +3 -2835
  145. package/dist/external/npm-pack.js +13939 -33342
  146. package/dist/external/zod.js +160 -7558
  147. package/dist/fs.d.ts +92 -113
  148. package/dist/fs.js +35 -35
  149. package/dist/git.d.ts +170 -164
  150. package/dist/git.js +113 -87
  151. package/dist/github.d.ts +249 -227
  152. package/dist/github.js +82 -81
  153. package/dist/globs.d.ts +31 -17
  154. package/dist/globs.js +51 -58
  155. package/dist/http-request.d.ts +99 -99
  156. package/dist/http-request.js +182 -156
  157. package/dist/ipc-cli.d.ts +28 -0
  158. package/dist/{utils/get-ipc.js → ipc-cli.js} +4 -3
  159. package/dist/ipc.d.ts +9 -299
  160. package/dist/ipc.js +18 -204
  161. package/dist/json/edit.d.ts +3 -1
  162. package/dist/json/edit.js +30 -30
  163. package/dist/json/format.d.ts +36 -36
  164. package/dist/json/format.js +22 -21
  165. package/dist/json/parse.d.ts +4 -2
  166. package/dist/json/parse.js +1 -0
  167. package/dist/json/types.js +1 -0
  168. package/dist/{links/index.d.ts → links.d.ts} +6 -2
  169. package/dist/{links/index.js → links.js} +5 -4
  170. package/dist/logger.d.ts +4 -6
  171. package/dist/logger.js +61 -53
  172. package/dist/memoization.d.ts +52 -49
  173. package/dist/memoization.js +55 -33
  174. package/dist/objects.d.ts +25 -44
  175. package/dist/objects.js +2 -1
  176. package/dist/package-extensions.d.ts +6 -0
  177. package/dist/package-extensions.js +2 -1
  178. package/dist/packages/edit.d.ts +3 -5
  179. package/dist/packages/edit.js +4 -3
  180. package/dist/packages/exports.d.ts +11 -14
  181. package/dist/packages/exports.js +11 -10
  182. package/dist/packages/isolation.d.ts +4 -0
  183. package/dist/packages/isolation.js +20 -19
  184. package/dist/packages/licenses.d.ts +3 -10
  185. package/dist/packages/licenses.js +2 -1
  186. package/dist/packages/manifest.d.ts +3 -3
  187. package/dist/packages/manifest.js +1 -0
  188. package/dist/packages/normalize.d.ts +3 -4
  189. package/dist/packages/normalize.js +1 -0
  190. package/dist/packages/operations.d.ts +3 -10
  191. package/dist/packages/operations.js +1 -0
  192. package/dist/packages/provenance.d.ts +10 -8
  193. package/dist/packages/provenance.js +55 -54
  194. package/dist/packages/specs.d.ts +3 -5
  195. package/dist/packages/specs.js +1 -0
  196. package/dist/packages/validation.d.ts +3 -3
  197. package/dist/packages/validation.js +1 -0
  198. package/dist/packages.d.ts +2 -17
  199. package/dist/packages.js +2 -1
  200. package/dist/paths/dirnames.d.ts +0 -2
  201. package/dist/paths/dirnames.js +1 -0
  202. package/dist/paths/exts.d.ts +0 -1
  203. package/dist/paths/exts.js +1 -0
  204. package/dist/paths/filenames.d.ts +0 -1
  205. package/dist/paths/filenames.js +1 -0
  206. package/dist/paths/globs.d.ts +0 -1
  207. package/dist/paths/globs.js +1 -0
  208. package/dist/paths/normalize.d.ts +115 -123
  209. package/dist/paths/normalize.js +128 -127
  210. package/dist/paths/packages.d.ts +3 -2
  211. package/dist/paths/packages.js +2 -1
  212. package/dist/paths/rewire.d.ts +9 -0
  213. package/dist/paths/rewire.js +5 -3
  214. package/dist/paths/socket.d.ts +37 -23
  215. package/dist/paths/socket.js +26 -25
  216. package/dist/performance.d.ts +87 -84
  217. package/dist/performance.js +97 -96
  218. package/dist/process-lock.d.ts +41 -1
  219. package/dist/process-lock.js +24 -17
  220. package/dist/promise-queue.d.ts +6 -0
  221. package/dist/promise-queue.js +1 -0
  222. package/dist/promises.d.ts +40 -55
  223. package/dist/promises.js +12 -11
  224. package/dist/regexps.d.ts +0 -5
  225. package/dist/regexps.js +1 -0
  226. package/dist/releases/github.d.ts +59 -63
  227. package/dist/releases/github.js +95 -100
  228. package/dist/releases/socket-btm.d.ts +9 -2
  229. package/dist/releases/socket-btm.js +32 -25
  230. package/dist/sea.d.ts +5 -0
  231. package/dist/sea.js +1 -0
  232. package/dist/shadow.d.ts +4 -0
  233. package/dist/shadow.js +1 -0
  234. package/dist/signal-exit.d.ts +7 -7
  235. package/dist/signal-exit.js +46 -45
  236. package/dist/sorts.d.ts +5 -7
  237. package/dist/sorts.js +11 -10
  238. package/dist/spawn.d.ts +96 -77
  239. package/dist/spawn.js +39 -38
  240. package/dist/spinner.d.ts +21 -22
  241. package/dist/spinner.js +15 -11
  242. package/dist/ssri.d.ts +31 -36
  243. package/dist/ssri.js +15 -14
  244. package/dist/stdio/_stream.d.ts +31 -0
  245. package/dist/stdio/_stream.js +57 -0
  246. package/dist/stdio/divider.d.ts +40 -36
  247. package/dist/stdio/divider.js +10 -9
  248. package/dist/stdio/footer.d.ts +20 -0
  249. package/dist/stdio/footer.js +12 -2
  250. package/dist/stdio/header.d.ts +4 -16
  251. package/dist/stdio/header.js +1 -9
  252. package/dist/stdio/stderr.d.ts +51 -39
  253. package/dist/stdio/stderr.js +19 -22
  254. package/dist/stdio/stdout.d.ts +54 -52
  255. package/dist/stdio/stdout.js +35 -33
  256. package/dist/streams.d.ts +4 -3
  257. package/dist/streams.js +1 -0
  258. package/dist/strings.d.ts +31 -85
  259. package/dist/strings.js +5 -49
  260. package/dist/suppress-warnings.d.ts +32 -15
  261. package/dist/suppress-warnings.js +14 -13
  262. package/dist/tables.d.ts +30 -26
  263. package/dist/tables.js +24 -23
  264. package/dist/temporary-executor.d.ts +4 -0
  265. package/dist/temporary-executor.js +1 -0
  266. package/dist/themes/context.d.ts +30 -26
  267. package/dist/themes/context.js +19 -18
  268. package/dist/themes/index.d.ts +0 -4
  269. package/dist/themes/index.js +1 -0
  270. package/dist/themes/themes.d.ts +1 -1
  271. package/dist/themes/themes.js +1 -0
  272. package/dist/themes/types.js +1 -0
  273. package/dist/themes/utils.d.ts +46 -43
  274. package/dist/themes/utils.js +45 -44
  275. package/dist/types.d.ts +48 -52
  276. package/dist/types.js +35 -35
  277. package/dist/url.d.ts +48 -53
  278. package/dist/url.js +38 -37
  279. package/dist/validation/json-parser.d.ts +19 -190
  280. package/dist/validation/json-parser.js +5 -69
  281. package/dist/validation/types.d.ts +9 -33
  282. package/dist/validation/types.js +1 -0
  283. package/dist/versions.d.ts +1 -0
  284. package/dist/versions.js +2 -1
  285. package/dist/words.d.ts +3 -6
  286. package/dist/words.js +1 -0
  287. package/dist/zod.js +1 -0
  288. package/package.json +34 -66
  289. package/dist/external/@inquirer/checkbox.js +0 -5
  290. package/dist/external/@inquirer/confirm.js +0 -5
  291. package/dist/external/@inquirer/input.js +0 -5
  292. package/dist/external/@inquirer/password.js +0 -5
  293. package/dist/external/@inquirer/search.js +0 -5
  294. package/dist/external/@inquirer/select.js +0 -5
  295. package/dist/functions.d.ts +0 -57
  296. package/dist/functions.js +0 -70
  297. package/dist/stdio/clear.d.ts +0 -140
  298. package/dist/stdio/clear.js +0 -95
  299. package/dist/stdio/mask.d.ts +0 -151
  300. package/dist/stdio/mask.js +0 -224
  301. package/dist/stdio/progress.d.ts +0 -148
  302. package/dist/stdio/progress.js +0 -212
  303. package/dist/stdio/prompts.d.ts +0 -195
  304. package/dist/stdio/prompts.js +0 -176
  305. package/dist/utils/get-ipc.d.ts +0 -15
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ "use strict";
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -27,8 +28,8 @@ __export(exports_exports, {
27
28
  resolvePackageJsonEntryExports: () => resolvePackageJsonEntryExports
28
29
  });
29
30
  module.exports = __toCommonJS(exports_exports);
30
- var import_core = require("../constants/core");
31
31
  var import_arrays = require("../arrays");
32
+ var import_core = require("../constants/core");
32
33
  var import_objects = require("../objects");
33
34
  // @__NO_SIDE_EFFECTS__
34
35
  function findTypesForSubpath(entryExports, subpath) {
@@ -68,15 +69,6 @@ function findTypesForSubpath(entryExports, subpath) {
68
69
  return void 0;
69
70
  }
70
71
  // @__NO_SIDE_EFFECTS__
71
- function getSubpaths(entryExports) {
72
- if (!(0, import_objects.isObject)(entryExports)) {
73
- return [];
74
- }
75
- return Object.getOwnPropertyNames(entryExports).filter(
76
- (key) => key.startsWith(".")
77
- );
78
- }
79
- // @__NO_SIDE_EFFECTS__
80
72
  function getExportFilePaths(entryExports) {
81
73
  if (!(0, import_objects.isObject)(entryExports)) {
82
74
  return [];
@@ -114,6 +106,15 @@ function getExportFilePaths(entryExports) {
114
106
  return [...new Set(paths)].filter((p) => p.startsWith("./"));
115
107
  }
116
108
  // @__NO_SIDE_EFFECTS__
109
+ function getSubpaths(entryExports) {
110
+ if (!(0, import_objects.isObject)(entryExports)) {
111
+ return [];
112
+ }
113
+ return Object.getOwnPropertyNames(entryExports).filter(
114
+ (key) => key.startsWith(".")
115
+ );
116
+ }
117
+ // @__NO_SIDE_EFFECTS__
117
118
  function isConditionalExports(entryExports) {
118
119
  if (!(0, import_objects.isObjectObject)(entryExports)) {
119
120
  return false;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @fileoverview Package isolation utilities for testing.
3
+ * Provides tools to set up isolated test environments for packages.
4
+ */
1
5
  import type { PackageJson } from '../packages';
2
6
  export type IsolatePackageOptions = {
3
7
  imports?: Record<string, string> | undefined;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ "use strict";
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -32,41 +33,36 @@ __export(isolation_exports, {
32
33
  isolatePackage: () => isolatePackage
33
34
  });
34
35
  module.exports = __toCommonJS(isolation_exports);
35
- var import_platform = require("../constants/platform");
36
36
  var import_npm_package_arg = __toESM(require("../external/npm-package-arg"));
37
- var import_spawn = require("../spawn");
37
+ var import_platform = require("../constants/platform");
38
38
  var import_normalize = require("../paths/normalize");
39
- var import_operations = require("./operations");
40
39
  var import_socket = require("../paths/socket");
40
+ var import_spawn = require("../spawn");
41
+ var import_operations = require("./operations");
42
+ const FS_CP_OPTIONS = {
43
+ dereference: true,
44
+ errorOnExist: false,
45
+ filter: (src) => !src.includes("node_modules") && !src.endsWith(".DS_Store"),
46
+ force: true,
47
+ recursive: true,
48
+ ...import_platform.WIN32 ? { maxRetries: 3, retryDelay: 100 } : {}
49
+ };
41
50
  let _fs;
51
+ let _path;
42
52
  // @__NO_SIDE_EFFECTS__
43
53
  function getFs() {
44
54
  if (_fs === void 0) {
45
- _fs = require("fs");
55
+ _fs = require("node:fs");
46
56
  }
47
57
  return _fs;
48
58
  }
49
- let _path;
50
59
  // @__NO_SIDE_EFFECTS__
51
60
  function getPath() {
52
61
  if (_path === void 0) {
53
- _path = require("path");
62
+ _path = require("node:path");
54
63
  }
55
64
  return _path;
56
65
  }
57
- const FS_CP_OPTIONS = {
58
- dereference: true,
59
- errorOnExist: false,
60
- filter: (src) => !src.includes("node_modules") && !src.endsWith(".DS_Store"),
61
- force: true,
62
- recursive: true,
63
- ...import_platform.WIN32 ? { maxRetries: 3, retryDelay: 100 } : {}
64
- };
65
- async function resolveRealPath(pathStr) {
66
- const fs = /* @__PURE__ */ getFs();
67
- const path = /* @__PURE__ */ getPath();
68
- return await fs.promises.realpath(pathStr).catch(() => path.resolve(pathStr));
69
- }
70
66
  async function mergePackageJson(pkgJsonPath, originalPkgJson) {
71
67
  const fs = /* @__PURE__ */ getFs();
72
68
  let pkgJson;
@@ -81,6 +77,11 @@ async function mergePackageJson(pkgJsonPath, originalPkgJson) {
81
77
  const mergedPkgJson = originalPkgJson ? { ...originalPkgJson, ...pkgJson } : pkgJson;
82
78
  return mergedPkgJson;
83
79
  }
80
+ async function resolveRealPath(pathStr) {
81
+ const fs = /* @__PURE__ */ getFs();
82
+ const path = /* @__PURE__ */ getPath();
83
+ return await fs.promises.realpath(pathStr).catch(() => path.resolve(pathStr));
84
+ }
84
85
  async function isolatePackage(packageSpec, options) {
85
86
  const fs = /* @__PURE__ */ getFs();
86
87
  const path = /* @__PURE__ */ getPath();
@@ -1,5 +1,7 @@
1
+ /**
2
+ * @fileoverview SPDX license parsing and analysis utilities.
3
+ */
1
4
  import type { LicenseNode } from '../packages';
2
- // Duplicated from spdx-expression-parse - AST node types.
3
5
  export interface SpdxLicenseNode {
4
6
  license: string;
5
7
  plus?: boolean | undefined;
@@ -11,7 +13,6 @@ export interface SpdxBinaryOperationNode {
11
13
  right: SpdxLicenseNode | SpdxBinaryOperationNode;
12
14
  }
13
15
  export type SpdxAstNode = SpdxLicenseNode | SpdxBinaryOperationNode;
14
- // Internal AST node types with type discriminator.
15
16
  export interface InternalLicenseNode extends SpdxLicenseNode {
16
17
  type: 'License';
17
18
  }
@@ -36,7 +37,6 @@ export interface LicenseVisitor {
36
37
  * // incompatible contains only the GPL-3.0 node
37
38
  * ```
38
39
  */
39
- /*@__NO_SIDE_EFFECTS__*/
40
40
  export declare function collectIncompatibleLicenses(licenseNodes: LicenseNode[]): LicenseNode[];
41
41
  /**
42
42
  * Collect warnings from license nodes.
@@ -47,7 +47,6 @@ export declare function collectIncompatibleLicenses(licenseNodes: LicenseNode[])
47
47
  * collectLicenseWarnings(nodes) // ['Package is unlicensed']
48
48
  * ```
49
49
  */
50
- /*@__NO_SIDE_EFFECTS__*/
51
50
  export declare function collectLicenseWarnings(licenseNodes: LicenseNode[]): string[];
52
51
  /**
53
52
  * Create an AST node from a raw node.
@@ -59,7 +58,6 @@ export declare function collectLicenseWarnings(licenseNodes: LicenseNode[]): str
59
58
  * // node.type === 'License'
60
59
  * ```
61
60
  */
62
- /*@__NO_SIDE_EFFECTS__*/
63
61
  export declare function createAstNode(rawNode: SpdxAstNode): InternalAstNode;
64
62
  /**
65
63
  * Create a binary operation AST node.
@@ -75,7 +73,6 @@ export declare function createAstNode(rawNode: SpdxAstNode): InternalAstNode;
75
73
  * // node.type === 'BinaryOperation'
76
74
  * ```
77
75
  */
78
- /*@__NO_SIDE_EFFECTS__*/
79
76
  export declare function createBinaryOperationNode(rawNodeParam: SpdxBinaryOperationNode): InternalBinaryOperationNode;
80
77
  /**
81
78
  * Create a license AST node.
@@ -86,7 +83,6 @@ export declare function createBinaryOperationNode(rawNodeParam: SpdxBinaryOperat
86
83
  * // node.type === 'License' && node.license === 'MIT'
87
84
  * ```
88
85
  */
89
- /*@__NO_SIDE_EFFECTS__*/
90
86
  export declare function createLicenseNode(rawNode: SpdxLicenseNode): InternalLicenseNode;
91
87
  /**
92
88
  * Parse an SPDX license expression into an AST.
@@ -97,7 +93,6 @@ export declare function createLicenseNode(rawNode: SpdxLicenseNode): InternalLic
97
93
  * // ast is a BinaryOperation node with MIT and Apache-2.0 leaves
98
94
  * ```
99
95
  */
100
- /*@__NO_SIDE_EFFECTS__*/
101
96
  export declare function parseSpdxExp(spdxExp: string): SpdxAstNode | undefined;
102
97
  /**
103
98
  * Parse package license field into structured license nodes.
@@ -108,7 +103,6 @@ export declare function parseSpdxExp(spdxExp: string): SpdxAstNode | undefined;
108
103
  * // [{ license: 'MIT' }]
109
104
  * ```
110
105
  */
111
- /*@__NO_SIDE_EFFECTS__*/
112
106
  export declare function resolvePackageLicenses(licenseFieldValue: string, where: string): LicenseNode[];
113
107
  /**
114
108
  * Traverse SPDX license AST and invoke visitor callbacks for each node.
@@ -123,5 +117,4 @@ export declare function resolvePackageLicenses(licenseFieldValue: string, where:
123
117
  * // licenses === ['MIT', 'Apache-2.0']
124
118
  * ```
125
119
  */
126
- /*@__NO_SIDE_EFFECTS__*/
127
120
  export declare function visitLicenses(ast: SpdxAstNode, visitor: LicenseVisitor): void;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ "use strict";
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -50,7 +51,7 @@ let _path;
50
51
  // @__NO_SIDE_EFFECTS__
51
52
  function getPath() {
52
53
  if (_path === void 0) {
53
- _path = require("path");
54
+ _path = require("node:path");
54
55
  }
55
56
  return _path;
56
57
  }
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @fileoverview Package manifest and packument fetching utilities.
3
+ */
1
4
  import type { PackageJson, PacoteOptions } from '../packages';
2
5
  /**
3
6
  * Create a package.json object for a Socket registry package.
@@ -10,7 +13,6 @@ import type { PackageJson, PacoteOptions } from '../packages';
10
13
  * })
11
14
  * ```
12
15
  */
13
- /*@__NO_SIDE_EFFECTS__*/
14
16
  export declare function createPackageJson(sockRegPkgName: string, directory: string, options?: PackageJson | undefined): PackageJson;
15
17
  /**
16
18
  * Fetch the manifest for a package.
@@ -20,7 +22,6 @@ export declare function createPackageJson(sockRegPkgName: string, directory: str
20
22
  * const manifest = await fetchPackageManifest('lodash@4.17.21')
21
23
  * ```
22
24
  */
23
- /*@__NO_SIDE_EFFECTS__*/
24
25
  export declare function fetchPackageManifest(pkgNameOrId: string, options?: PacoteOptions): Promise<unknown>;
25
26
  /**
26
27
  * Fetch the packument (package document) for a package.
@@ -30,5 +31,4 @@ export declare function fetchPackageManifest(pkgNameOrId: string, options?: Paco
30
31
  * const packument = await fetchPackagePackument('lodash')
31
32
  * ```
32
33
  */
33
- /*@__NO_SIDE_EFFECTS__*/
34
34
  export declare function fetchPackagePackument(pkgNameOrId: string, options?: PacoteOptions): Promise<unknown>;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ "use strict";
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @fileoverview Package.json normalization utilities.
3
+ */
1
4
  import type { NormalizeOptions, PackageJson } from '../packages';
2
5
  /**
3
6
  * Normalize a package.json object with standard npm package normalization.
@@ -8,7 +11,6 @@ import type { NormalizeOptions, PackageJson } from '../packages';
8
11
  * const normalized = normalizePackageJson(pkgJson)
9
12
  * ```
10
13
  */
11
- /*@__NO_SIDE_EFFECTS__*/
12
14
  export declare function normalizePackageJson(pkgJson: PackageJson, options?: NormalizeOptions): PackageJson;
13
15
  /**
14
16
  * Extract escaped scope from a Socket registry package name.
@@ -19,7 +21,6 @@ export declare function normalizePackageJson(pkgJson: PackageJson, options?: Nor
19
21
  * resolveEscapedScope('lodash') // undefined
20
22
  * ```
21
23
  */
22
- /*@__NO_SIDE_EFFECTS__*/
23
24
  export declare function resolveEscapedScope(sockRegPkgName: string): string | undefined;
24
25
  /**
25
26
  * Resolve original package name from Socket registry package name.
@@ -29,7 +30,6 @@ export declare function resolveEscapedScope(sockRegPkgName: string): string | un
29
30
  * resolveOriginalPackageName('@socketregistry/is-number') // 'is-number'
30
31
  * ```
31
32
  */
32
- /*@__NO_SIDE_EFFECTS__*/
33
33
  export declare function resolveOriginalPackageName(sockRegPkgName: string): string;
34
34
  /**
35
35
  * Convert escaped scope to standard npm scope format.
@@ -39,5 +39,4 @@ export declare function resolveOriginalPackageName(sockRegPkgName: string): stri
39
39
  * unescapeScope('babel__') // '@babel'
40
40
  * ```
41
41
  */
42
- /*@__NO_SIDE_EFFECTS__*/
43
42
  export declare function unescapeScope(escapedScope: string): string;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ "use strict";
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @fileoverview Package operations including extraction, packing, and I/O.
3
+ */
1
4
  import type { ExtractOptions, NormalizeOptions, PackageJson, PacoteOptions, ReadPackageJsonOptions } from '../packages';
2
5
  /**
3
6
  * Extract a package to a destination directory.
@@ -7,7 +10,6 @@ import type { ExtractOptions, NormalizeOptions, PackageJson, PacoteOptions, Read
7
10
  * await extractPackage('lodash@4.17.21', { dest: '/tmp/lodash' })
8
11
  * ```
9
12
  */
10
- /*@__NO_SIDE_EFFECTS__*/
11
13
  export declare function extractPackage(pkgNameOrId: string, options?: ExtractOptions, callback?: (destPath: string) => Promise<unknown>): Promise<void>;
12
14
  /**
13
15
  * Find package extensions for a given package.
@@ -17,7 +19,6 @@ export declare function extractPackage(pkgNameOrId: string, options?: ExtractOpt
17
19
  * const extensions = findPackageExtensions('my-pkg', '1.0.0')
18
20
  * ```
19
21
  */
20
- /*@__NO_SIDE_EFFECTS__*/
21
22
  export declare function findPackageExtensions(pkgName: string, pkgVer: string): unknown;
22
23
  /**
23
24
  * Get the release tag for a version.
@@ -29,7 +30,6 @@ export declare function findPackageExtensions(pkgName: string, pkgVer: string):
29
30
  * getReleaseTag('lodash') // ''
30
31
  * ```
31
32
  */
32
- /*@__NO_SIDE_EFFECTS__*/
33
33
  export declare function getReleaseTag(spec: string): string;
34
34
  /**
35
35
  * Pack a package tarball using pacote.
@@ -39,7 +39,6 @@ export declare function getReleaseTag(spec: string): string;
39
39
  * const tarball = await packPackage('lodash@4.17.21')
40
40
  * ```
41
41
  */
42
- /*@__NO_SIDE_EFFECTS__*/
43
42
  export declare function packPackage(spec: string, options?: PacoteOptions): Promise<unknown>;
44
43
  /**
45
44
  * Read and parse a package.json file asynchronously.
@@ -50,7 +49,6 @@ export declare function packPackage(spec: string, options?: PacoteOptions): Prom
50
49
  * console.log(pkgJson?.name)
51
50
  * ```
52
51
  */
53
- /*@__NO_SIDE_EFFECTS__*/
54
52
  export declare function readPackageJson(filepath: string, options?: ReadPackageJsonOptions): Promise<PackageJson | undefined>;
55
53
  /**
56
54
  * Read and parse package.json from a file path synchronously.
@@ -61,7 +59,6 @@ export declare function readPackageJson(filepath: string, options?: ReadPackageJ
61
59
  * console.log(pkgJson?.name)
62
60
  * ```
63
61
  */
64
- /*@__NO_SIDE_EFFECTS__*/
65
62
  export declare function readPackageJsonSync(filepath: string, options?: NormalizeOptions & {
66
63
  editable?: boolean;
67
64
  throws?: boolean;
@@ -74,7 +71,6 @@ export declare function readPackageJsonSync(filepath: string, options?: Normaliz
74
71
  * const url = await resolveGitHubTgzUrl('my-pkg@1.0.0', '/tmp/my-project')
75
72
  * ```
76
73
  */
77
- /*@__NO_SIDE_EFFECTS__*/
78
74
  export declare function resolveGitHubTgzUrl(pkgNameOrId: string, where?: unknown): Promise<string>;
79
75
  /**
80
76
  * Resolve full package name from a PURL object with custom delimiter.
@@ -85,7 +81,6 @@ export declare function resolveGitHubTgzUrl(pkgNameOrId: string, where?: unknown
85
81
  * resolvePackageName({ name: 'lodash' }) // 'lodash'
86
82
  * ```
87
83
  */
88
- /*@__NO_SIDE_EFFECTS__*/
89
84
  export declare function resolvePackageName(purlObj: {
90
85
  name: string;
91
86
  namespace?: string;
@@ -99,7 +94,5 @@ export declare function resolvePackageName(purlObj: {
99
94
  * resolveRegistryPackageName('lodash') // 'lodash'
100
95
  * ```
101
96
  */
102
- /*@__NO_SIDE_EFFECTS__*/
103
97
  export declare function resolveRegistryPackageName(pkgName: string): string;
104
- // Re-export types from lib/packages.
105
98
  export type { PackageJson } from '../packages';
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ "use strict";
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,21 +1,23 @@
1
+ /**
2
+ * @fileoverview Package provenance and attestation verification utilities.
3
+ */
1
4
  import type { ProvenanceOptions } from '../packages';
2
5
  /**
3
- * Convert raw attestation data to user-friendly provenance details.
6
+ * Fetch package provenance information from npm registry.
4
7
  *
5
8
  * @example
6
9
  * ```typescript
7
- * const details = getProvenanceDetails(attestationData)
8
- * // { level: 'trusted', repository: '...', commitSha: '...' }
10
+ * const provenance = await fetchPackageProvenance('lodash', '4.17.21')
9
11
  * ```
10
12
  */
11
- export declare function getProvenanceDetails(attestationData: unknown): unknown;
13
+ export declare function fetchPackageProvenance(pkgName: string, pkgVersion: string, options?: ProvenanceOptions): Promise<unknown>;
12
14
  /**
13
- * Fetch package provenance information from npm registry.
15
+ * Convert raw attestation data to user-friendly provenance details.
14
16
  *
15
17
  * @example
16
18
  * ```typescript
17
- * const provenance = await fetchPackageProvenance('lodash', '4.17.21')
19
+ * const details = getProvenanceDetails(attestationData)
20
+ * // { level: 'trusted', repository: '...', commitSha: '...' }
18
21
  * ```
19
22
  */
20
- /*@__NO_SIDE_EFFECTS__*/
21
- export declare function fetchPackageProvenance(pkgName: string, pkgVersion: string, options?: ProvenanceOptions): Promise<unknown>;
23
+ export declare function getProvenanceDetails(attestationData: unknown): unknown;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ "use strict";
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -42,29 +43,6 @@ const ArrayIsArray = Array.isArray;
42
43
  const SLSA_PROVENANCE_V0_2 = "https://slsa.dev/provenance/v0.2";
43
44
  const SLSA_PROVENANCE_V1_0 = "https://slsa.dev/provenance/v1";
44
45
  let _fetcher;
45
- // @__NO_SIDE_EFFECTS__
46
- function getFetcher() {
47
- if (_fetcher === void 0) {
48
- _fetcher = import_make_fetch_happen.default.defaults({
49
- cachePath: (0, import_packages.getPacoteCachePath)(),
50
- // Prefer-offline: Staleness checks for cached data will be bypassed, but
51
- // missing data will be requested from the server.
52
- // https://github.com/npm/make-fetch-happen?tab=readme-ov-file#--optscache
53
- cache: "force-cache"
54
- });
55
- }
56
- return _fetcher;
57
- }
58
- function getAttestations(attestationData) {
59
- const data = attestationData;
60
- if (!data.attestations || !ArrayIsArray(data.attestations)) {
61
- return [];
62
- }
63
- return data.attestations.filter((attestation) => {
64
- const att = attestation;
65
- return att.predicateType === SLSA_PROVENANCE_V0_2 || att.predicateType === SLSA_PROVENANCE_V1_0;
66
- });
67
- }
68
46
  function findProvenance(attestations) {
69
47
  for (const attestation of attestations) {
70
48
  const att = attestation;
@@ -94,6 +72,29 @@ function findProvenance(attestations) {
94
72
  }
95
73
  return void 0;
96
74
  }
75
+ function getAttestations(attestationData) {
76
+ const data = attestationData;
77
+ if (!data.attestations || !ArrayIsArray(data.attestations)) {
78
+ return [];
79
+ }
80
+ return data.attestations.filter((attestation) => {
81
+ const att = attestation;
82
+ return att.predicateType === SLSA_PROVENANCE_V0_2 || att.predicateType === SLSA_PROVENANCE_V1_0;
83
+ });
84
+ }
85
+ // @__NO_SIDE_EFFECTS__
86
+ function getFetcher() {
87
+ if (_fetcher === void 0) {
88
+ _fetcher = import_make_fetch_happen.default.defaults({
89
+ cachePath: (0, import_packages.getPacoteCachePath)(),
90
+ // Prefer-offline: Staleness checks for cached data will be bypassed, but
91
+ // missing data will be requested from the server.
92
+ // https://github.com/npm/make-fetch-happen?tab=readme-ov-file#--optscache
93
+ cache: "force-cache"
94
+ });
95
+ }
96
+ return _fetcher;
97
+ }
97
98
  function isTrustedPublisher(value) {
98
99
  if (typeof value !== "string" || !value) {
99
100
  return false;
@@ -120,6 +121,37 @@ function isTrustedPublisher(value) {
120
121
  }
121
122
  return value.includes("github") || value.includes("gitlab");
122
123
  }
124
+ // @__NO_SIDE_EFFECTS__
125
+ async function fetchPackageProvenance(pkgName, pkgVersion, options) {
126
+ const { signal, timeout = 1e4 } = {
127
+ __proto__: null,
128
+ ...options
129
+ };
130
+ if (signal?.aborted) {
131
+ return void 0;
132
+ }
133
+ const timeoutSignal = (0, import_abort.createTimeoutSignal)(timeout);
134
+ const compositeSignal = (0, import_abort.createCompositeAbortSignal)(signal, timeoutSignal);
135
+ const fetcher = /* @__PURE__ */ getFetcher();
136
+ try {
137
+ const response = await fetcher(
138
+ // The npm registry attestations API endpoint.
139
+ `${import_agents.NPM_REGISTRY_URL}/-/npm/v1/attestations/${encodeURIComponent(pkgName)}@${encodeURIComponent(pkgVersion)}`,
140
+ {
141
+ method: "GET",
142
+ signal: compositeSignal,
143
+ headers: {
144
+ "User-Agent": "socket-registry"
145
+ }
146
+ }
147
+ );
148
+ if (response.ok) {
149
+ return getProvenanceDetails(await response.json());
150
+ }
151
+ } catch {
152
+ }
153
+ return void 0;
154
+ }
123
155
  function getProvenanceDetails(attestationData) {
124
156
  const attestations = getAttestations(attestationData);
125
157
  if (!attestations.length) {
@@ -152,37 +184,6 @@ function getProvenanceDetails(attestationData) {
152
184
  workflowRunId
153
185
  };
154
186
  }
155
- // @__NO_SIDE_EFFECTS__
156
- async function fetchPackageProvenance(pkgName, pkgVersion, options) {
157
- const { signal, timeout = 1e4 } = {
158
- __proto__: null,
159
- ...options
160
- };
161
- if (signal?.aborted) {
162
- return void 0;
163
- }
164
- const timeoutSignal = (0, import_abort.createTimeoutSignal)(timeout);
165
- const compositeSignal = (0, import_abort.createCompositeAbortSignal)(signal, timeoutSignal);
166
- const fetcher = /* @__PURE__ */ getFetcher();
167
- try {
168
- const response = await fetcher(
169
- // The npm registry attestations API endpoint.
170
- `${import_agents.NPM_REGISTRY_URL}/-/npm/v1/attestations/${encodeURIComponent(pkgName)}@${encodeURIComponent(pkgVersion)}`,
171
- {
172
- method: "GET",
173
- signal: compositeSignal,
174
- headers: {
175
- "User-Agent": "socket-registry"
176
- }
177
- }
178
- );
179
- if (response.ok) {
180
- return getProvenanceDetails(await response.json());
181
- }
182
- } catch {
183
- }
184
- return void 0;
185
- }
186
187
  // Annotate the CommonJS export names for ESM import in node:
187
188
  0 && (module.exports = {
188
189
  fetchPackageProvenance,
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @fileoverview Package spec parsing and GitHub URL utilities.
3
+ */
1
4
  /**
2
5
  * Extract user and project from GitHub repository URL.
3
6
  *
@@ -7,7 +10,6 @@
7
10
  * // { user: 'lodash', project: 'lodash' }
8
11
  * ```
9
12
  */
10
- /*@__NO_SIDE_EFFECTS__*/
11
13
  export declare function getRepoUrlDetails(repoUrl?: string): {
12
14
  user: string;
13
15
  project: string;
@@ -21,7 +23,6 @@ export declare function getRepoUrlDetails(repoUrl?: string): {
21
23
  * // 'https://api.github.com/repos/lodash/lodash/git/ref/tags/v4.17.21'
22
24
  * ```
23
25
  */
24
- /*@__NO_SIDE_EFFECTS__*/
25
26
  export declare function gitHubTagRefUrl(user: string, project: string, tag: string): string;
26
27
  /**
27
28
  * Generate GitHub tarball download URL for a commit SHA.
@@ -32,7 +33,6 @@ export declare function gitHubTagRefUrl(user: string, project: string, tag: stri
32
33
  * // 'https://github.com/lodash/lodash/archive/abc123.tar.gz'
33
34
  * ```
34
35
  */
35
- /*@__NO_SIDE_EFFECTS__*/
36
36
  export declare function gitHubTgzUrl(user: string, project: string, sha: string): string;
37
37
  /**
38
38
  * Check if a package specifier is a GitHub tarball URL.
@@ -43,7 +43,6 @@ export declare function gitHubTgzUrl(user: string, project: string, sha: string)
43
43
  * isGitHubTgzSpec('lodash@4.17.21') // false
44
44
  * ```
45
45
  */
46
- /*@__NO_SIDE_EFFECTS__*/
47
46
  export declare function isGitHubTgzSpec(spec: unknown, where?: string): boolean;
48
47
  /**
49
48
  * Check if a package specifier is a GitHub URL with committish.
@@ -54,5 +53,4 @@ export declare function isGitHubTgzSpec(spec: unknown, where?: string): boolean;
54
53
  * isGitHubUrlSpec('lodash@4.17.21') // false
55
54
  * ```
56
55
  */
57
- /*@__NO_SIDE_EFFECTS__*/
58
56
  export declare function isGitHubUrlSpec(spec: unknown, where?: string): boolean;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ "use strict";
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @fileoverview Package name validation utilities.
3
+ */
1
4
  /**
2
5
  * Check if package name is a blessed Socket.dev package.
3
6
  *
@@ -7,7 +10,6 @@
7
10
  * isBlessedPackageName('lodash') // false
8
11
  * ```
9
12
  */
10
- /*@__NO_SIDE_EFFECTS__*/
11
13
  export declare function isBlessedPackageName(name: unknown): boolean;
12
14
  /**
13
15
  * Check if a type string represents a registry fetcher type.
@@ -18,7 +20,6 @@ export declare function isBlessedPackageName(name: unknown): boolean;
18
20
  * isRegistryFetcherType('git') // false
19
21
  * ```
20
22
  */
21
- /*@__NO_SIDE_EFFECTS__*/
22
23
  export declare function isRegistryFetcherType(type: string): boolean;
23
24
  /**
24
25
  * Check if a package name is valid according to npm naming rules.
@@ -29,5 +30,4 @@ export declare function isRegistryFetcherType(type: string): boolean;
29
30
  * isValidPackageName('.invalid') // false
30
31
  * ```
31
32
  */
32
- /*@__NO_SIDE_EFFECTS__*/
33
33
  export declare function isValidPackageName(name: string): boolean;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ "use strict";
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;