@socketsecurity/lib 5.18.1 → 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 +49 -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 -70
  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;
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @fileoverview Maintained Node.js versions without external dependencies.
3
+ */
1
4
  declare const maintainedNodeVersions: readonly string[] & {
2
5
  current: string;
3
6
  last: string;
@@ -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;
@@ -1,30 +1,139 @@
1
- // Version detection.
2
- export declare function getNodeVersion(): string;
3
- export declare function getNodeMajorVersion(): number;
4
- export declare function getNodeMinorVersion(): number;
5
- export declare function getNodePatchVersion(): number;
6
- // Maintained Node.js versions.
1
+ /**
2
+ * @fileoverview Node.js runtime version and capability helpers.
3
+ * Provides getters for the current Node version (major/minor/patch), the
4
+ * maintained-versions list, and feature-detection flags for APIs that vary
5
+ * across Node releases.
6
+ */
7
+ /**
8
+ * Get the absolute path to the currently running Node.js binary.
9
+ *
10
+ * @returns The value of `process.execPath`.
11
+ */
12
+ export declare function getExecPath(): string;
13
+ /**
14
+ * Get the list of Node.js major versions currently under long-term support.
15
+ *
16
+ * @returns The static `maintainedNodeVersions` array shared across the library.
17
+ */
7
18
  export declare function getMaintainedNodeVersions(): readonly string[] & {
8
19
  current: string;
9
20
  last: string;
10
21
  next: string;
11
22
  previous: string;
12
23
  };
13
- // Feature detection.
24
+ /**
25
+ * Get the flags used to block Node.js debugger attachment via SIGUSR1.
26
+ * Returns `['--disable-sigusr1']` on runtimes that support it and falls back
27
+ * to `['--no-inspect']` on older versions.
28
+ *
29
+ * @returns A non-empty array of CLI flags suitable for passing to `node`.
30
+ */
31
+ export declare function getNodeDisableSigusr1Flags(): string[];
32
+ /**
33
+ * Get the hardening flags Socket applies when spawning Node.js subprocesses.
34
+ * Always includes `--disable-proto=delete`. Also adds `--permission` plus the
35
+ * grants from {@link getNodePermissionFlags} on Node 24+,
36
+ * `--experimental-permission` on Node 20-23, and
37
+ * `--force-node-api-uncaught-exceptions-policy` on Node 22+.
38
+ *
39
+ * @returns A non-empty array of CLI flags suitable for passing to `node`.
40
+ */
41
+ export declare function getNodeHardenFlags(): string[];
42
+ /**
43
+ * Get the major component of the current Node.js version.
44
+ *
45
+ * @returns The major version number, or `0` if it cannot be parsed.
46
+ */
47
+ export declare function getNodeMajorVersion(): number;
48
+ /**
49
+ * Get the minor component of the current Node.js version.
50
+ *
51
+ * @returns The minor version number, or `0` if it cannot be parsed.
52
+ */
53
+ export declare function getNodeMinorVersion(): number;
54
+ /**
55
+ * Get the flags that silence Node.js runtime warnings and deprecation notices.
56
+ * Always returns `['--no-warnings', '--no-deprecation']` across all versions.
57
+ *
58
+ * @returns A non-empty array of CLI flags suitable for passing to `node`.
59
+ */
60
+ export declare function getNodeNoWarningsFlags(): string[];
61
+ /**
62
+ * Get the patch component of the current Node.js version.
63
+ *
64
+ * @returns The patch version number, or `0` if it cannot be parsed.
65
+ */
66
+ export declare function getNodePatchVersion(): number;
67
+ /**
68
+ * Get the permission-grant flags needed to run npm under Node.js 24+'s
69
+ * `--permission` model. The array is non-empty only on Node.js 24+ and
70
+ * includes `--allow-fs-read=*`, `--allow-fs-write=*`, and
71
+ * `--allow-child-process`. Older versions return an empty array.
72
+ *
73
+ * @returns The permission flag list (possibly empty) for the current runtime.
74
+ */
75
+ export declare function getNodePermissionFlags(): string[];
76
+ /**
77
+ * Get the full Node.js version string from `process.version`.
78
+ *
79
+ * @returns The runtime version, including the leading `v` (e.g. `v22.11.0`).
80
+ */
81
+ export declare function getNodeVersion(): string;
82
+ /**
83
+ * Check whether the current runtime exposes the `module.enableCompileCache()` API.
84
+ * The API is available on Node.js 24+.
85
+ *
86
+ * @returns `true` when the current runtime is Node.js 24 or newer.
87
+ */
14
88
  export declare function supportsNodeCompileCacheApi(): boolean;
89
+ /**
90
+ * Check whether the current runtime honors the `NODE_COMPILE_CACHE` env var.
91
+ * Env-var-based compile caching is available on Node.js 22+.
92
+ *
93
+ * @returns `true` when the current runtime is Node.js 22 or newer.
94
+ */
15
95
  export declare function supportsNodeCompileCacheEnvVar(): boolean;
96
+ /**
97
+ * Check whether the current runtime supports the `--disable-sigusr1` CLI flag.
98
+ * Flag landed in v22.14.0 and v23.7.0 and was stabilized in v22.20.0 / v24.8.0.
99
+ *
100
+ * @returns `true` when the runtime exposes `--disable-sigusr1`.
101
+ */
102
+ export declare function supportsNodeDisableSigusr1Flag(): boolean;
103
+ /**
104
+ * Check whether the current runtime supports the `--disable-warning` CLI flag.
105
+ * The flag is available on Node.js 21+.
106
+ *
107
+ * @returns `true` when the current runtime is Node.js 21 or newer.
108
+ */
16
109
  export declare function supportsNodeDisableWarningFlag(): boolean;
110
+ /**
111
+ * Check whether the current runtime supports the permission model CLI flags
112
+ * (`--experimental-permission` on Node 20-23, `--permission` on Node 24+).
113
+ *
114
+ * @returns `true` when the current runtime is Node.js 20 or newer.
115
+ */
17
116
  export declare function supportsNodePermissionFlag(): boolean;
117
+ /**
118
+ * Check whether `require()` can synchronously load ESM modules.
119
+ * Requires Node.js 22.12+ or Node.js 23+.
120
+ *
121
+ * @returns `true` when the runtime supports `require()`-ing ES modules.
122
+ */
18
123
  export declare function supportsNodeRequireModule(): boolean;
124
+ /**
125
+ * Check whether the current runtime supports `node --run <script>`.
126
+ * Requires Node.js 22.11+ or Node.js 23+.
127
+ *
128
+ * @returns `true` when the runtime can execute package.json scripts via `--run`.
129
+ */
19
130
  export declare function supportsNodeRun(): boolean;
20
- export declare function supportsNodeDisableSigusr1Flag(): boolean;
21
- export declare function getNodeDisableSigusr1Flags(): string[];
131
+ /**
132
+ * Check whether this process was spawned with an IPC channel.
133
+ * When `true`, `process.send()` is callable to message the parent process.
134
+ *
135
+ * @returns `true` when the current process has an IPC channel to its parent.
136
+ */
22
137
  export declare function supportsProcessSend(): boolean;
23
- export declare function getNodePermissionFlags(): string[];
24
- export declare function getNodeHardenFlags(): string[];
25
- export declare function getNodeNoWarningsFlags(): string[];
26
- // Execution path.
27
- export declare function getExecPath(): string;
28
- // Node.js constants.
29
- export declare const NODE_SEA_FUSE = "NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2";
30
138
  export declare const ESNEXT = "esnext";
139
+ export declare const NODE_SEA_FUSE = "NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2";
@@ -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;
@@ -54,8 +55,38 @@ module.exports = __toCommonJS(node_exports);
54
55
  var import_node_process = __toESM(require("node:process"));
55
56
  var import_maintained_node_versions = require("./maintained-node-versions");
56
57
  const NODE_VERSION = import_node_process.default.version;
57
- function getNodeVersion() {
58
- return NODE_VERSION;
58
+ let _nodeDisableSigusr1Flags;
59
+ let _nodeHardenFlags;
60
+ let _nodeNoWarningsFlags;
61
+ let _nodePermissionFlags;
62
+ function getExecPath() {
63
+ return import_node_process.default.execPath;
64
+ }
65
+ function getMaintainedNodeVersions() {
66
+ return import_maintained_node_versions.maintainedNodeVersions;
67
+ }
68
+ function getNodeDisableSigusr1Flags() {
69
+ if (_nodeDisableSigusr1Flags === void 0) {
70
+ _nodeDisableSigusr1Flags = supportsNodeDisableSigusr1Flag() ? ["--disable-sigusr1"] : ["--no-inspect"];
71
+ }
72
+ return _nodeDisableSigusr1Flags;
73
+ }
74
+ function getNodeHardenFlags() {
75
+ if (_nodeHardenFlags === void 0) {
76
+ const major = getNodeMajorVersion();
77
+ const flags = ["--disable-proto=delete"];
78
+ if (major >= 24) {
79
+ flags.push("--permission");
80
+ flags.push(...getNodePermissionFlags());
81
+ } else if (major >= 20) {
82
+ flags.push("--experimental-permission");
83
+ }
84
+ if (major >= 22) {
85
+ flags.push("--force-node-api-uncaught-exceptions-policy");
86
+ }
87
+ _nodeHardenFlags = flags;
88
+ }
89
+ return _nodeHardenFlags;
59
90
  }
60
91
  function getNodeMajorVersion() {
61
92
  const major = NODE_VERSION.slice(1).split(".")[0] ?? "0";
@@ -64,11 +95,35 @@ function getNodeMajorVersion() {
64
95
  function getNodeMinorVersion() {
65
96
  return Number.parseInt(NODE_VERSION.split(".")[1] ?? "0", 10);
66
97
  }
98
+ function getNodeNoWarningsFlags() {
99
+ if (_nodeNoWarningsFlags === void 0) {
100
+ _nodeNoWarningsFlags = ["--no-warnings", "--no-deprecation"];
101
+ }
102
+ return _nodeNoWarningsFlags;
103
+ }
67
104
  function getNodePatchVersion() {
68
105
  return Number.parseInt(NODE_VERSION.split(".")[2] ?? "0", 10);
69
106
  }
70
- function getMaintainedNodeVersions() {
71
- return import_maintained_node_versions.maintainedNodeVersions;
107
+ function getNodePermissionFlags() {
108
+ if (_nodePermissionFlags === void 0) {
109
+ const major = getNodeMajorVersion();
110
+ if (major >= 24) {
111
+ _nodePermissionFlags = [
112
+ // Allow reading from the entire filesystem (npm needs to read package.json, node_modules, etc.).
113
+ "--allow-fs-read=*",
114
+ // Allow writing to the entire filesystem (npm needs to write to node_modules, cache, etc.).
115
+ "--allow-fs-write=*",
116
+ // Allow spawning child processes (npm needs to run lifecycle scripts, git, etc.).
117
+ "--allow-child-process"
118
+ ];
119
+ } else {
120
+ _nodePermissionFlags = [];
121
+ }
122
+ }
123
+ return _nodePermissionFlags;
124
+ }
125
+ function getNodeVersion() {
126
+ return NODE_VERSION;
72
127
  }
73
128
  function supportsNodeCompileCacheApi() {
74
129
  const major = getNodeMajorVersion();
@@ -78,22 +133,6 @@ function supportsNodeCompileCacheEnvVar() {
78
133
  const major = getNodeMajorVersion();
79
134
  return major >= 22;
80
135
  }
81
- function supportsNodeDisableWarningFlag() {
82
- const major = getNodeMajorVersion();
83
- return major >= 21;
84
- }
85
- function supportsNodePermissionFlag() {
86
- const major = getNodeMajorVersion();
87
- return major >= 20;
88
- }
89
- function supportsNodeRequireModule() {
90
- const major = getNodeMajorVersion();
91
- return major >= 23 || major === 22 && getNodeMinorVersion() >= 12;
92
- }
93
- function supportsNodeRun() {
94
- const major = getNodeMajorVersion();
95
- return major >= 23 || major === 22 && getNodeMinorVersion() >= 11;
96
- }
97
136
  function supportsNodeDisableSigusr1Flag() {
98
137
  const major = getNodeMajorVersion();
99
138
  const minor = getNodeMinorVersion();
@@ -108,65 +147,27 @@ function supportsNodeDisableSigusr1Flag() {
108
147
  }
109
148
  return false;
110
149
  }
111
- let _nodeDisableSigusr1Flags;
112
- function getNodeDisableSigusr1Flags() {
113
- if (_nodeDisableSigusr1Flags === void 0) {
114
- _nodeDisableSigusr1Flags = supportsNodeDisableSigusr1Flag() ? ["--disable-sigusr1"] : ["--no-inspect"];
115
- }
116
- return _nodeDisableSigusr1Flags;
117
- }
118
- function supportsProcessSend() {
119
- return typeof import_node_process.default.send === "function";
150
+ function supportsNodeDisableWarningFlag() {
151
+ const major = getNodeMajorVersion();
152
+ return major >= 21;
120
153
  }
121
- let _nodeHardenFlags;
122
- let _nodePermissionFlags;
123
- function getNodePermissionFlags() {
124
- if (_nodePermissionFlags === void 0) {
125
- const major = getNodeMajorVersion();
126
- if (major >= 24) {
127
- _nodePermissionFlags = [
128
- // Allow reading from the entire filesystem (npm needs to read package.json, node_modules, etc.).
129
- "--allow-fs-read=*",
130
- // Allow writing to the entire filesystem (npm needs to write to node_modules, cache, etc.).
131
- "--allow-fs-write=*",
132
- // Allow spawning child processes (npm needs to run lifecycle scripts, git, etc.).
133
- "--allow-child-process"
134
- ];
135
- } else {
136
- _nodePermissionFlags = [];
137
- }
138
- }
139
- return _nodePermissionFlags;
154
+ function supportsNodePermissionFlag() {
155
+ const major = getNodeMajorVersion();
156
+ return major >= 20;
140
157
  }
141
- function getNodeHardenFlags() {
142
- if (_nodeHardenFlags === void 0) {
143
- const major = getNodeMajorVersion();
144
- const flags = ["--disable-proto=delete"];
145
- if (major >= 24) {
146
- flags.push("--permission");
147
- flags.push(...getNodePermissionFlags());
148
- } else if (major >= 20) {
149
- flags.push("--experimental-permission");
150
- }
151
- if (major >= 22) {
152
- flags.push("--force-node-api-uncaught-exceptions-policy");
153
- }
154
- _nodeHardenFlags = flags;
155
- }
156
- return _nodeHardenFlags;
158
+ function supportsNodeRequireModule() {
159
+ const major = getNodeMajorVersion();
160
+ return major >= 23 || major === 22 && getNodeMinorVersion() >= 12;
157
161
  }
158
- let _nodeNoWarningsFlags;
159
- function getNodeNoWarningsFlags() {
160
- if (_nodeNoWarningsFlags === void 0) {
161
- _nodeNoWarningsFlags = ["--no-warnings", "--no-deprecation"];
162
- }
163
- return _nodeNoWarningsFlags;
162
+ function supportsNodeRun() {
163
+ const major = getNodeMajorVersion();
164
+ return major >= 23 || major === 22 && getNodeMinorVersion() >= 11;
164
165
  }
165
- function getExecPath() {
166
- return import_node_process.default.execPath;
166
+ function supportsProcessSend() {
167
+ return typeof import_node_process.default.send === "function";
167
168
  }
168
- const NODE_SEA_FUSE = "NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2";
169
169
  const ESNEXT = "esnext";
170
+ const NODE_SEA_FUSE = "NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2";
170
171
  // Annotate the CommonJS export names for ESM import in node:
171
172
  0 && (module.exports = {
172
173
  ESNEXT,
@@ -1,3 +1,5 @@
1
- /* c8 ignore next - External semver call */
1
+ /**
2
+ * @fileoverview Default Node.js version range for packages.
3
+ */
2
4
  declare const packageDefaultNodeRange: string;
3
5
  export { packageDefaultNodeRange };
@@ -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;
@@ -33,7 +34,7 @@ __export(package_default_node_range_exports, {
33
34
  });
34
35
  module.exports = __toCommonJS(package_default_node_range_exports);
35
36
  var import_maintained_node_versions = require("./maintained-node-versions");
36
- var semver = __toESM(require("../external/semver.js"));
37
+ var semver = __toESM(require("../external/semver"));
37
38
  const packageDefaultNodeRange = `>=${semver.parse(import_maintained_node_versions.maintainedNodeVersions.last).major}`;
38
39
  // Annotate the CommonJS export names for ESM import in node:
39
40
  0 && (module.exports = {
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * @fileoverview Default Socket security categories for packages.
3
3
  */
4
- // Default category for new packages
5
4
  declare const packageDefaultSocketCategories: readonly string[];
6
5
  export { packageDefaultSocketCategories };
@@ -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;
@@ -1,26 +1,21 @@
1
- // Package constants.
1
+ /**
2
+ * @fileoverview Package metadata, defaults, extensions, and lifecycle helpers.
3
+ * Exposes lazily-memoized accessors for package defaults (Node range, Socket
4
+ * categories), the pacote cache path, lifecycle script names, and known
5
+ * package extensions used during manifest processing.
6
+ */
2
7
  export declare const PACKAGE = "package";
3
8
  export declare const AT_LATEST = "@latest";
4
9
  export declare const LATEST = "latest";
5
10
  export declare const PACKAGE_DEFAULT_VERSION = "1.0.0";
6
- // Package default Node range.
7
- /*@__NO_SIDE_EFFECTS__*/
11
+ /**
12
+ * Clear the packument cache. Useful for long-running processes that want to
13
+ * force a re-fetch of registry metadata.
14
+ */
15
+ export declare function clearPackumentCache(): void;
16
+ export declare function getLifecycleScriptNames(): string[];
8
17
  export declare function getPackageDefaultNodeRange(): string | undefined;
9
- // Package default Socket categories.
10
- /*@__NO_SIDE_EFFECTS__*/
11
18
  export declare function getPackageDefaultSocketCategories(): readonly string[];
12
- // Package extensions.
13
- /*@__NO_SIDE_EFFECTS__*/
14
19
  export declare function getPackageExtensions(): Iterable<[string, unknown]>;
15
- // NPM lifecycle event.
16
- /*@__NO_SIDE_EFFECTS__*/
17
- export declare function getNpmLifecycleEvent(): string | undefined;
18
- // Lifecycle script names.
19
- /*@__NO_SIDE_EFFECTS__*/
20
- export declare function getLifecycleScriptNames(): string[];
21
- // Packument cache.
22
- /*@__NO_SIDE_EFFECTS__*/
23
20
  export declare function getPackumentCache(): Map<string, unknown>;
24
- // Pacote cache path.
25
- /*@__NO_SIDE_EFFECTS__*/
26
21
  export declare function getPacoteCachePath(): 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;
@@ -33,8 +34,8 @@ __export(packages_exports, {
33
34
  LATEST: () => LATEST,
34
35
  PACKAGE: () => PACKAGE,
35
36
  PACKAGE_DEFAULT_VERSION: () => PACKAGE_DEFAULT_VERSION,
37
+ clearPackumentCache: () => clearPackumentCache,
36
38
  getLifecycleScriptNames: () => getLifecycleScriptNames,
37
- getNpmLifecycleEvent: () => getNpmLifecycleEvent,
38
39
  getPackageDefaultNodeRange: () => getPackageDefaultNodeRange,
39
40
  getPackageDefaultSocketCategories: () => getPackageDefaultSocketCategories,
40
41
  getPackageExtensions: () => getPackageExtensions,
@@ -42,13 +43,12 @@ __export(packages_exports, {
42
43
  getPacoteCachePath: () => getPacoteCachePath
43
44
  });
44
45
  module.exports = __toCommonJS(packages_exports);
45
- var import_npm = require("../env/npm");
46
+ var import_pacote = __toESM(require("../external/pacote"));
47
+ var import_package_extensions = require("../package-extensions");
48
+ var import_normalize = require("../paths/normalize");
46
49
  var import_lifecycle_script_names = require("./lifecycle-script-names");
47
50
  var import_package_default_node_range = require("./package-default-node-range");
48
51
  var import_package_default_socket_categories = require("./package-default-socket-categories");
49
- var import_package_extensions = require("../package-extensions");
50
- var import_pacote = __toESM(require("../external/pacote"));
51
- var import_normalize = require("../paths/normalize");
52
52
  let _lifecycleScriptNames;
53
53
  let _packageDefaultNodeRange;
54
54
  let _packageDefaultSocketCategories;
@@ -59,6 +59,18 @@ const PACKAGE = "package";
59
59
  const AT_LATEST = "@latest";
60
60
  const LATEST = "latest";
61
61
  const PACKAGE_DEFAULT_VERSION = "1.0.0";
62
+ function clearPackumentCache() {
63
+ if (_packumentCache !== void 0) {
64
+ _packumentCache.clear();
65
+ }
66
+ }
67
+ // @__NO_SIDE_EFFECTS__
68
+ function getLifecycleScriptNames() {
69
+ if (_lifecycleScriptNames === void 0) {
70
+ _lifecycleScriptNames = Array.from(import_lifecycle_script_names.lifecycleScriptNames);
71
+ }
72
+ return _lifecycleScriptNames;
73
+ }
62
74
  // @__NO_SIDE_EFFECTS__
63
75
  function getPackageDefaultNodeRange() {
64
76
  if (_packageDefaultNodeRange === void 0) {
@@ -80,21 +92,24 @@ function getPackageExtensions() {
80
92
  }
81
93
  return _packageExtensions;
82
94
  }
83
- // @__NO_SIDE_EFFECTS__
84
- function getNpmLifecycleEvent() {
85
- return (0, import_npm.getNpmLifecycleEvent)();
86
- }
87
- // @__NO_SIDE_EFFECTS__
88
- function getLifecycleScriptNames() {
89
- if (_lifecycleScriptNames === void 0) {
90
- _lifecycleScriptNames = Array.from(import_lifecycle_script_names.lifecycleScriptNames);
95
+ const PACKUMENT_CACHE_MAX = 500;
96
+ class BoundedPackumentCache extends Map {
97
+ set(key, value) {
98
+ if (this.has(key)) {
99
+ this.delete(key);
100
+ } else if (this.size >= PACKUMENT_CACHE_MAX) {
101
+ const oldest = this.keys().next().value;
102
+ if (oldest !== void 0) {
103
+ this.delete(oldest);
104
+ }
105
+ }
106
+ return super.set(key, value);
91
107
  }
92
- return _lifecycleScriptNames;
93
108
  }
94
109
  // @__NO_SIDE_EFFECTS__
95
110
  function getPackumentCache() {
96
111
  if (_packumentCache === void 0) {
97
- _packumentCache = /* @__PURE__ */ new Map();
112
+ _packumentCache = new BoundedPackumentCache();
98
113
  }
99
114
  return _packumentCache;
100
115
  }
@@ -124,8 +139,8 @@ function getPacoteCachePath() {
124
139
  LATEST,
125
140
  PACKAGE,
126
141
  PACKAGE_DEFAULT_VERSION,
142
+ clearPackumentCache,
127
143
  getLifecycleScriptNames,
128
- getNpmLifecycleEvent,
129
144
  getPackageDefaultNodeRange,
130
145
  getPackageDefaultSocketCategories,
131
146
  getPackageExtensions,
@@ -1,3 +1,4 @@
1
+ /** @fileoverview Platform detection and OS-specific constants. */
1
2
  /**
2
3
  * CPU architecture type.
3
4
  */
@@ -18,10 +19,8 @@ export declare function getArch(): Arch;
18
19
  * Get the current platform (memoized).
19
20
  */
20
21
  export declare function getPlatform(): Platform;
21
- // Platform detection (memoized at module load).
22
22
  export declare const DARWIN: boolean;
23
23
  export declare const WIN32: boolean;
24
- // File permission modes.
25
24
  export declare const S_IXUSR = 64;
26
25
  export declare const S_IXGRP = 8;
27
26
  export declare const S_IXOTH = 1;
@@ -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;
@@ -32,7 +33,7 @@ let _os;
32
33
  // @__NO_SIDE_EFFECTS__
33
34
  function getOs() {
34
35
  if (_os === void 0) {
35
- _os = require("os");
36
+ _os = require("node:os");
36
37
  }
37
38
  return _os;
38
39
  }
@@ -1,2 +1,20 @@
1
+ /**
2
+ * @fileoverview Process control helpers.
3
+ * Lazily creates and exposes a shared `AbortController` and its `AbortSignal`
4
+ * so cooperating modules can coordinate cancellation from a single source.
5
+ */
6
+ /**
7
+ * Get the process-scoped shared `AbortController` singleton.
8
+ * Cooperating modules use this to coordinate cancellation across the library.
9
+ *
10
+ * @returns The lazily-created shared `AbortController` instance.
11
+ */
1
12
  export declare function getAbortController(): AbortController;
13
+ /**
14
+ * Get the process-scoped shared `AbortSignal` singleton.
15
+ * This is the `signal` property of {@link getAbortController}'s controller and
16
+ * is intended to be passed to APIs that accept an `AbortSignal`.
17
+ *
18
+ * @returns The shared `AbortSignal` instance.
19
+ */
2
20
  export declare function getAbortSignal(): AbortSignal;
@@ -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;
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Socket.dev APIs, scopes, organizations, and application names.
2
+ * @fileoverview Socket.dev branding and identifier constants.
3
+ * Centralizes API base URLs, the public API key, website/docs URLs, npm
4
+ * scopes, GitHub org/repo names, and app name strings used across the
5
+ * Socket toolchain.
3
6
  */
4
- // Socket.dev API.
5
7
  export declare const SOCKET_API_BASE_URL = "https://api.socket.dev/v0";
6
8
  export declare const SOCKET_PUBLIC_API_KEY = "sktsec_t_--RAN5U4ivauy4w37-6aoKyYPDt5ZbaT5JBVMqiwKo_api";
7
- // Alias for backward compatibility.
8
9
  export declare const SOCKET_PUBLIC_API_TOKEN = "sktsec_t_--RAN5U4ivauy4w37-6aoKyYPDt5ZbaT5JBVMqiwKo_api";
9
- // Socket.dev URLs.
10
10
  export declare const SOCKET_WEBSITE_URL = "https://socket.dev";
11
11
  export declare const SOCKET_CONTACT_URL = "https://socket.dev/contact";
12
12
  export declare const SOCKET_DASHBOARD_URL = "https://socket.dev/dashboard";
@@ -15,29 +15,23 @@ export declare const SOCKET_PRICING_URL = "https://socket.dev/pricing";
15
15
  export declare const SOCKET_STATUS_URL = "https://status.socket.dev";
16
16
  export declare const SOCKET_DOCS_URL = "https://docs.socket.dev";
17
17
  export declare const SOCKET_DOCS_CONTACT_URL = "https://docs.socket.dev/docs/contact-support";
18
- // Socket.dev scopes.
19
18
  export declare const SOCKET_REGISTRY_SCOPE = "@socketregistry";
20
19
  export declare const SOCKET_SECURITY_SCOPE = "@socketsecurity";
21
20
  export declare const SOCKET_OVERRIDE_SCOPE = "@socketoverride";
22
- // Socket.dev organization and repositories.
23
21
  export declare const SOCKET_GITHUB_ORG = "SocketDev";
24
22
  export declare const SOCKET_REGISTRY_REPO_NAME = "socket-registry";
25
23
  export declare const SOCKET_REGISTRY_PACKAGE_NAME = "@socketsecurity/registry";
26
24
  export declare const SOCKET_REGISTRY_NPM_ORG = "socketregistry";
27
- // Socket.dev application names.
28
25
  export declare const SOCKET_CLI_APP_NAME = "socket";
29
26
  export declare const SOCKET_DLX_APP_NAME = "dlx";
30
27
  export declare const SOCKET_FIREWALL_APP_NAME = "sfw";
31
28
  export declare const SOCKET_REGISTRY_APP_NAME = "registry";
32
29
  export declare const SOCKET_APP_PREFIX = "_";
33
- // Socket.dev lib.
34
30
  export declare const SOCKET_LIB_NAME = "@socketsecurity/lib";
35
31
  export declare const SOCKET_LIB_VERSION: string;
36
32
  export declare const SOCKET_LIB_URL = "https://github.com/SocketDev/socket-lib";
37
33
  export declare const SOCKET_LIB_USER_AGENT: string;
38
- // Socket.dev IPC.
39
34
  export declare const SOCKET_IPC_HANDSHAKE = "SOCKET_IPC_HANDSHAKE";
40
- // Socket.dev cache and registry.
41
35
  export declare const CACHE_SOCKET_API_DIR = "socket-api";
42
36
  export declare const REGISTRY = "registry";
43
37
  export declare const REGISTRY_SCOPE_DELIMITER = "__";
@@ -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;
@@ -76,7 +77,7 @@ const SOCKET_FIREWALL_APP_NAME = "sfw";
76
77
  const SOCKET_REGISTRY_APP_NAME = "registry";
77
78
  const SOCKET_APP_PREFIX = "_";
78
79
  const SOCKET_LIB_NAME = "@socketsecurity/lib";
79
- const SOCKET_LIB_VERSION = "5.18.1";
80
+ const SOCKET_LIB_VERSION = "5.19.0";
80
81
  const SOCKET_LIB_URL = "https://github.com/SocketDev/socket-lib";
81
82
  const SOCKET_LIB_USER_AGENT = `socketsecurity-lib/${SOCKET_LIB_VERSION} (${SOCKET_LIB_URL})`;
82
83
  const SOCKET_IPC_HANDSHAKE = "SOCKET_IPC_HANDSHAKE";