@socketsecurity/lib 3.0.1 → 3.0.3

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 (259) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/abort.js +60 -1
  3. package/dist/abort.js.map +2 -2
  4. package/dist/agent.js +289 -1
  5. package/dist/agent.js.map +2 -2
  6. package/dist/ansi.js +60 -1
  7. package/dist/ansi.js.map +2 -2
  8. package/dist/argv/flags.js +282 -1
  9. package/dist/argv/flags.js.map +2 -2
  10. package/dist/argv/parse.js +171 -1
  11. package/dist/argv/parse.js.map +2 -2
  12. package/dist/arrays.js +85 -1
  13. package/dist/arrays.js.map +2 -2
  14. package/dist/bin.js +419 -5
  15. package/dist/bin.js.map +2 -2
  16. package/dist/cacache.js +139 -1
  17. package/dist/cacache.js.map +2 -2
  18. package/dist/cache-with-ttl.js +223 -1
  19. package/dist/cache-with-ttl.js.map +2 -2
  20. package/dist/constants/agents.js +126 -1
  21. package/dist/constants/agents.js.map +2 -2
  22. package/dist/constants/core.d.ts +1 -1
  23. package/dist/constants/core.js +57 -2
  24. package/dist/constants/core.js.map +3 -3
  25. package/dist/constants/encoding.js +48 -1
  26. package/dist/constants/encoding.js.map +2 -2
  27. package/dist/constants/github.js +30 -1
  28. package/dist/constants/github.js.map +2 -2
  29. package/dist/constants/licenses.js +66 -1
  30. package/dist/constants/licenses.js.map +2 -2
  31. package/dist/constants/node.js +185 -1
  32. package/dist/constants/node.js.map +2 -2
  33. package/dist/constants/packages.js +128 -1
  34. package/dist/constants/packages.js.map +2 -2
  35. package/dist/constants/paths.js +150 -1
  36. package/dist/constants/paths.js.map +2 -2
  37. package/dist/constants/platform.js +41 -1
  38. package/dist/constants/platform.js.map +2 -2
  39. package/dist/constants/process.js +52 -1
  40. package/dist/constants/process.js.map +2 -2
  41. package/dist/constants/socket.js +102 -1
  42. package/dist/constants/socket.js.map +2 -2
  43. package/dist/constants/testing.js +36 -1
  44. package/dist/constants/testing.js.map +2 -2
  45. package/dist/constants/time.js +39 -1
  46. package/dist/constants/time.js.map +2 -2
  47. package/dist/constants/typescript.js +54 -1
  48. package/dist/constants/typescript.js.map +2 -2
  49. package/dist/cover/code.js +135 -1
  50. package/dist/cover/code.js.map +2 -2
  51. package/dist/cover/formatters.js +101 -11
  52. package/dist/cover/formatters.js.map +2 -2
  53. package/dist/cover/type.js +63 -1
  54. package/dist/cover/type.js.map +2 -2
  55. package/dist/cover/types.js +15 -1
  56. package/dist/cover/types.js.map +2 -2
  57. package/dist/debug.js +337 -2
  58. package/dist/debug.js.map +2 -2
  59. package/dist/dlx-binary.js +408 -7
  60. package/dist/dlx-binary.js.map +2 -2
  61. package/dist/dlx-package.js +278 -7
  62. package/dist/dlx-package.js.map +2 -2
  63. package/dist/dlx.js +214 -7
  64. package/dist/dlx.js.map +3 -3
  65. package/dist/effects/pulse-frames.js +64 -1
  66. package/dist/effects/pulse-frames.js.map +2 -2
  67. package/dist/effects/text-shimmer.js +174 -1
  68. package/dist/effects/text-shimmer.js.map +2 -2
  69. package/dist/effects/types.js +15 -1
  70. package/dist/effects/types.js.map +2 -2
  71. package/dist/effects/ultra.js +61 -1
  72. package/dist/effects/ultra.js.map +2 -2
  73. package/dist/env/ci.js +31 -1
  74. package/dist/env/ci.js.map +2 -2
  75. package/dist/env/debug.js +30 -1
  76. package/dist/env/debug.js.map +2 -2
  77. package/dist/env/github.js +65 -1
  78. package/dist/env/github.js.map +2 -2
  79. package/dist/env/helpers.js +47 -1
  80. package/dist/env/helpers.js.map +2 -2
  81. package/dist/env/home.js +30 -1
  82. package/dist/env/home.js.map +2 -2
  83. package/dist/env/locale.js +40 -1
  84. package/dist/env/locale.js.map +2 -2
  85. package/dist/env/node-auth-token.js +30 -1
  86. package/dist/env/node-auth-token.js.map +2 -2
  87. package/dist/env/node-env.js +30 -1
  88. package/dist/env/node-env.js.map +2 -2
  89. package/dist/env/npm.js +50 -1
  90. package/dist/env/npm.js.map +2 -2
  91. package/dist/env/package-manager.js +73 -1
  92. package/dist/env/package-manager.js.map +2 -2
  93. package/dist/env/path.js +30 -1
  94. package/dist/env/path.js.map +2 -2
  95. package/dist/env/pre-commit.js +31 -1
  96. package/dist/env/pre-commit.js.map +2 -2
  97. package/dist/env/rewire.js +72 -1
  98. package/dist/env/rewire.js.map +2 -2
  99. package/dist/env/shell.js +30 -1
  100. package/dist/env/shell.js.map +2 -2
  101. package/dist/env/socket-cli-shadow.js +51 -1
  102. package/dist/env/socket-cli-shadow.js.map +2 -2
  103. package/dist/env/socket-cli.js +86 -1
  104. package/dist/env/socket-cli.js.map +2 -2
  105. package/dist/env/socket.js +101 -1
  106. package/dist/env/socket.js.map +2 -2
  107. package/dist/env/temp-dir.js +40 -1
  108. package/dist/env/temp-dir.js.map +2 -2
  109. package/dist/env/term.js +30 -1
  110. package/dist/env/term.js.map +2 -2
  111. package/dist/env/test.js +43 -1
  112. package/dist/env/test.js.map +2 -2
  113. package/dist/env/windows.js +45 -1
  114. package/dist/env/windows.js.map +2 -2
  115. package/dist/env/xdg.js +40 -1
  116. package/dist/env/xdg.js.map +2 -2
  117. package/dist/env.js +170 -1
  118. package/dist/env.js.map +2 -2
  119. package/dist/fs.js +670 -7
  120. package/dist/fs.js.map +2 -2
  121. package/dist/functions.js +68 -1
  122. package/dist/functions.js.map +2 -2
  123. package/dist/git.js +329 -2
  124. package/dist/git.js.map +2 -2
  125. package/dist/github.js +202 -1
  126. package/dist/github.js.map +2 -2
  127. package/dist/globs.js +149 -1
  128. package/dist/globs.js.map +3 -3
  129. package/dist/http-request.js +335 -3
  130. package/dist/http-request.js.map +2 -2
  131. package/dist/index.js +69 -1
  132. package/dist/index.js.map +2 -2
  133. package/dist/ipc.js +244 -1
  134. package/dist/ipc.js.map +2 -2
  135. package/dist/json.js +73 -1
  136. package/dist/json.js.map +2 -2
  137. package/dist/links/index.js +60 -1
  138. package/dist/links/index.js.map +2 -2
  139. package/dist/logger.js +1384 -1
  140. package/dist/logger.js.map +2 -2
  141. package/dist/maintained-node-versions.js +35 -1
  142. package/dist/maintained-node-versions.js.map +2 -2
  143. package/dist/memoization.js +210 -1
  144. package/dist/memoization.js.map +2 -2
  145. package/dist/objects.js +311 -1
  146. package/dist/objects.js.map +2 -2
  147. package/dist/packages/editable.js +356 -9
  148. package/dist/packages/editable.js.map +2 -2
  149. package/dist/packages/exports.js +162 -1
  150. package/dist/packages/exports.js.map +2 -2
  151. package/dist/packages/isolation.js +187 -1
  152. package/dist/packages/isolation.js.map +2 -2
  153. package/dist/packages/licenses.js +214 -1
  154. package/dist/packages/licenses.js.map +2 -2
  155. package/dist/packages/manifest.js +190 -1
  156. package/dist/packages/manifest.js.map +2 -2
  157. package/dist/packages/normalize.js +132 -1
  158. package/dist/packages/normalize.js.map +2 -2
  159. package/dist/packages/operations.js +320 -1
  160. package/dist/packages/operations.js.map +2 -2
  161. package/dist/packages/paths.js +53 -1
  162. package/dist/packages/paths.js.map +2 -2
  163. package/dist/packages/provenance.js +178 -1
  164. package/dist/packages/provenance.js.map +2 -2
  165. package/dist/packages/specs.js +83 -1
  166. package/dist/packages/specs.js.map +2 -2
  167. package/dist/packages/validation.js +51 -1
  168. package/dist/packages/validation.js.map +2 -2
  169. package/dist/packages.js +129 -1
  170. package/dist/packages.js.map +2 -2
  171. package/dist/path.js +446 -1
  172. package/dist/path.js.map +2 -2
  173. package/dist/paths/rewire.js +79 -1
  174. package/dist/paths/rewire.js.map +2 -2
  175. package/dist/paths.js +190 -1
  176. package/dist/paths.js.map +2 -2
  177. package/dist/performance.js +216 -15
  178. package/dist/performance.js.map +2 -2
  179. package/dist/process-lock.js +287 -8
  180. package/dist/process-lock.js.map +2 -2
  181. package/dist/promise-queue.js +109 -1
  182. package/dist/promise-queue.js.map +2 -2
  183. package/dist/promises.js +267 -1
  184. package/dist/promises.js.map +2 -2
  185. package/dist/prompts/index.js +45 -1
  186. package/dist/prompts/index.js.map +2 -2
  187. package/dist/prompts.js +58 -1
  188. package/dist/prompts.js.map +2 -2
  189. package/dist/regexps.js +30 -1
  190. package/dist/regexps.js.map +2 -2
  191. package/dist/sea.js +44 -1
  192. package/dist/sea.js.map +2 -2
  193. package/dist/shadow.js +58 -1
  194. package/dist/shadow.js.map +2 -2
  195. package/dist/signal-exit.js +248 -1
  196. package/dist/signal-exit.js.map +3 -3
  197. package/dist/sorts.js +94 -1
  198. package/dist/sorts.js.map +3 -3
  199. package/dist/spawn.js +200 -1
  200. package/dist/spawn.js.map +2 -2
  201. package/dist/spinner.js +961 -1
  202. package/dist/spinner.js.map +2 -2
  203. package/dist/ssri.js +71 -1
  204. package/dist/ssri.js.map +2 -2
  205. package/dist/stdio/clear.js +82 -1
  206. package/dist/stdio/clear.js.map +2 -2
  207. package/dist/stdio/divider.js +89 -3
  208. package/dist/stdio/divider.js.map +2 -2
  209. package/dist/stdio/footer.js +94 -2
  210. package/dist/stdio/footer.js.map +2 -2
  211. package/dist/stdio/header.js +100 -2
  212. package/dist/stdio/header.js.map +2 -2
  213. package/dist/stdio/mask.js +207 -5
  214. package/dist/stdio/mask.js.map +2 -2
  215. package/dist/stdio/progress.js +209 -2
  216. package/dist/stdio/progress.js.map +2 -2
  217. package/dist/stdio/prompts.js +88 -1
  218. package/dist/stdio/prompts.js.map +2 -2
  219. package/dist/stdio/stderr.js +89 -2
  220. package/dist/stdio/stderr.js.map +2 -2
  221. package/dist/stdio/stdout.js +103 -2
  222. package/dist/stdio/stdout.js.map +2 -2
  223. package/dist/streams.js +78 -1
  224. package/dist/streams.js.map +2 -2
  225. package/dist/strings.js +251 -3
  226. package/dist/strings.js.map +2 -2
  227. package/dist/suppress-warnings.js +98 -1
  228. package/dist/suppress-warnings.js.map +2 -2
  229. package/dist/tables.js +128 -3
  230. package/dist/tables.js.map +2 -2
  231. package/dist/temporary-executor.js +53 -1
  232. package/dist/temporary-executor.js.map +2 -2
  233. package/dist/themes/context.js +71 -1
  234. package/dist/themes/context.js.map +2 -2
  235. package/dist/themes/index.js +57 -1
  236. package/dist/themes/index.js.map +2 -2
  237. package/dist/themes/themes.js +195 -1
  238. package/dist/themes/themes.js.map +2 -2
  239. package/dist/themes/types.js +15 -1
  240. package/dist/themes/types.js.map +2 -2
  241. package/dist/themes/utils.js +116 -1
  242. package/dist/themes/utils.js.map +2 -2
  243. package/dist/types.js +59 -1
  244. package/dist/types.js.map +2 -2
  245. package/dist/url.js +142 -1
  246. package/dist/url.js.map +2 -2
  247. package/dist/utils/get-ipc.js +58 -1
  248. package/dist/utils/get-ipc.js.map +2 -2
  249. package/dist/validation/json-parser.js +127 -1
  250. package/dist/validation/json-parser.js.map +2 -2
  251. package/dist/validation/types.js +15 -1
  252. package/dist/validation/types.js.map +2 -2
  253. package/dist/versions.js +154 -1
  254. package/dist/versions.js.map +2 -2
  255. package/dist/words.js +50 -1
  256. package/dist/words.js.map +2 -2
  257. package/dist/zod.js +27 -1
  258. package/dist/zod.js.map +2 -2
  259. package/package.json +1 -1
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/prompts/index.ts"],
4
4
  "sourcesContent": ["/**\n * @fileoverview Themed interactive prompts for terminal input.\n * Provides type definitions and utilities for themed prompt interactions.\n *\n * Note: This module provides the theme-aware API structure.\n * Actual prompt implementations should be added based on project needs.\n */\n\nimport type { Theme } from '../themes/types'\nimport type { ThemeName } from '../themes/themes'\n\n/**\n * Base options for all prompts.\n */\nexport type PromptBaseOptions = {\n /** Prompt message to display */\n message: string\n /** Theme to use (overrides global) */\n theme?: Theme | ThemeName | undefined\n}\n\n/**\n * Options for text input prompts.\n */\nexport type InputPromptOptions = PromptBaseOptions & {\n /** Default value */\n default?: string | undefined\n /** Validation function */\n validate?: ((value: string) => boolean | string) | undefined\n /** Placeholder text */\n placeholder?: string | undefined\n}\n\n/**\n * Options for confirmation prompts.\n */\nexport type ConfirmPromptOptions = PromptBaseOptions & {\n /** Default value */\n default?: boolean | undefined\n}\n\n/**\n * Choice option for select prompts.\n */\nexport type Choice<T = string> = {\n /** Display label */\n label: string\n /** Value to return */\n value: T\n /** Optional description */\n description?: string | undefined\n /** Whether this choice is disabled */\n disabled?: boolean | undefined\n}\n\n/**\n * Options for selection prompts.\n */\nexport type SelectPromptOptions<T = string> = PromptBaseOptions & {\n /** Array of choices */\n choices: Array<Choice<T>>\n /** Default selected value */\n default?: T | undefined\n}\n\n/**\n * Text input prompt (themed).\n *\n * @param options - Input prompt configuration\n * @returns Promise resolving to user input\n *\n * @example\n * ```ts\n * import { input } from '@socketsecurity/lib/prompts'\n *\n * const name = await input({\n * message: 'Enter your name:',\n * default: 'User',\n * validate: (v) => v.length > 0 || 'Name required'\n * })\n * ```\n */\nexport async function input(_options: InputPromptOptions): Promise<string> {\n // Note: Implement actual prompt logic\n // For now, return a mock implementation\n throw new Error(\n 'input() not yet implemented - add prompt library integration',\n )\n}\n\n/**\n * Confirmation prompt (themed).\n *\n * @param options - Confirm prompt configuration\n * @returns Promise resolving to boolean\n *\n * @example\n * ```ts\n * import { confirm } from '@socketsecurity/lib/prompts'\n *\n * const proceed = await confirm({\n * message: 'Continue with installation?',\n * default: true\n * })\n * ```\n */\nexport async function confirm(\n _options: ConfirmPromptOptions,\n): Promise<boolean> {\n // Note: Implement actual prompt logic\n throw new Error(\n 'confirm() not yet implemented - add prompt library integration',\n )\n}\n\n/**\n * Selection prompt (themed).\n *\n * @template T - Type of choice values\n * @param options - Select prompt configuration\n * @returns Promise resolving to selected value\n *\n * @example\n * ```ts\n * import { select } from '@socketsecurity/lib/prompts'\n *\n * const choice = await select({\n * message: 'Select environment:',\n * choices: [\n * { label: 'Development', value: 'dev' },\n * { label: 'Staging', value: 'staging' },\n * { label: 'Production', value: 'prod' }\n * ]\n * })\n * ```\n */\nexport async function select<T = string>(\n _options: SelectPromptOptions<T>,\n): Promise<T> {\n // Note: Implement actual prompt logic\n throw new Error(\n 'select() not yet implemented - add prompt library integration',\n )\n}\n"],
5
- "mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,UAAAC,EAAA,WAAAC,IAAA,eAAAC,EAAAL,GAkFA,eAAsBG,EAAMG,EAA+C,CAGzE,MAAM,IAAI,MACR,8DACF,CACF,CAkBA,eAAsBJ,EACpBI,EACkB,CAElB,MAAM,IAAI,MACR,gEACF,CACF,CAuBA,eAAsBF,EACpBE,EACY,CAEZ,MAAM,IAAI,MACR,+DACF,CACF",
6
- "names": ["prompts_exports", "__export", "confirm", "input", "select", "__toCommonJS", "_options"]
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkFA,eAAsB,MAAM,UAA+C;AAGzE,QAAM,IAAI;AAAA,IACR;AAAA,EACF;AACF;AAkBA,eAAsB,QACpB,UACkB;AAElB,QAAM,IAAI;AAAA,IACR;AAAA,EACF;AACF;AAuBA,eAAsB,OACpB,UACY;AAEZ,QAAM,IAAI;AAAA,IACR;AAAA,EACF;AACF;",
6
+ "names": []
7
7
  }
package/dist/prompts.js CHANGED
@@ -1,3 +1,60 @@
1
1
  /* Socket Lib - Built with esbuild */
2
- var d=Object.create;var s=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var S=(r,e)=>{for(var t in e)s(r,t,{get:e[t],enumerable:!0})},p=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of m(e))!h.call(r,a)&&a!==t&&s(r,a,{get:()=>e[a],enumerable:!(n=g(e,a))||n.enumerable});return r};var o=(r,e,t)=>(t=r!=null?d(x(r)):{},p(e||!r||!r.__esModule?s(t,"default",{value:r,enumerable:!0}):t,r)),b=r=>p(s({},"__esModule",{value:!0}),r);var y={};S(y,{confirm:()=>i.default,createSeparator:()=>w,input:()=>f.default,password:()=>l.default,search:()=>u.default,select:()=>c.default});module.exports=b(y);var i=o(require('./external/@inquirer/confirm')),f=o(require('./external/@inquirer/input')),l=o(require('./external/@inquirer/password')),u=o(require('./external/@inquirer/search')),c=o(require('./external/@inquirer/select'));function w(r){return{type:"separator",separator:r||"\u2500\u2500\u2500\u2500\u2500\u2500\u2500",line:r||"\u2500\u2500\u2500\u2500\u2500\u2500\u2500"}}0&&(module.exports={confirm,createSeparator,input,password,search,select});
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var prompts_exports = {};
30
+ __export(prompts_exports, {
31
+ confirm: () => import_confirm.default,
32
+ createSeparator: () => createSeparator,
33
+ input: () => import_input.default,
34
+ password: () => import_password.default,
35
+ search: () => import_search.default,
36
+ select: () => import_select.default
37
+ });
38
+ module.exports = __toCommonJS(prompts_exports);
39
+ var import_confirm = __toESM(require('./external/@inquirer/confirm'));
40
+ var import_input = __toESM(require('./external/@inquirer/input'));
41
+ var import_password = __toESM(require('./external/@inquirer/password'));
42
+ var import_search = __toESM(require('./external/@inquirer/search'));
43
+ var import_select = __toESM(require('./external/@inquirer/select'));
44
+ function createSeparator(text) {
45
+ return {
46
+ type: "separator",
47
+ separator: text || "\u2500\u2500\u2500\u2500\u2500\u2500\u2500",
48
+ line: text || "\u2500\u2500\u2500\u2500\u2500\u2500\u2500"
49
+ };
50
+ }
51
+ // Annotate the CommonJS export names for ESM import in node:
52
+ 0 && (module.exports = {
53
+ confirm,
54
+ createSeparator,
55
+ input,
56
+ password,
57
+ search,
58
+ select
59
+ });
3
60
  //# sourceMappingURL=prompts.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/prompts.ts"],
4
4
  "sourcesContent": ["/**\n * @fileoverview Interactive prompt utilities for CLI applications.\n * Re-exports commonly used prompt functions from inquirer packages.\n */\n\nexport { default as confirm } from '@inquirer/confirm'\nexport { default as input } from '@inquirer/input'\nexport { default as password } from '@inquirer/password'\nexport { default as search } from '@inquirer/search'\nexport { default as select } from '@inquirer/select'\n\n// Export types - Choice is a type interface, not a direct export\nexport interface Choice<Value = unknown> {\n value: Value\n name?: string\n description?: string\n short?: string\n disabled?: boolean | string\n}\n\n// Create a Separator type that matches the expected interface\nexport interface Separator {\n type: 'separator'\n separator?: string\n line?: string\n}\n\n/**\n * Create a separator for select prompts.\n */\nexport function createSeparator(text?: string): Separator {\n return {\n type: 'separator',\n separator: text || '\u2500\u2500\u2500\u2500\u2500\u2500\u2500',\n line: text || '\u2500\u2500\u2500\u2500\u2500\u2500\u2500',\n }\n}\n"],
5
- "mappings": ";6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2CAAAE,EAAA,sGAAAC,EAAAH,GAKA,IAAAI,EAAmC,gCACnCC,EAAiC,8BACjCC,EAAoC,iCACpCC,EAAkC,+BAClCC,EAAkC,+BAqB3B,SAASN,EAAgBO,EAA0B,CACxD,MAAO,CACL,KAAM,YACN,UAAWA,GAAQ,6CACnB,KAAMA,GAAQ,4CAChB,CACF",
6
- "names": ["prompts_exports", "__export", "createSeparator", "__toCommonJS", "import_confirm", "import_input", "import_password", "import_search", "import_select", "text"]
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,qBAAmC;AACnC,mBAAiC;AACjC,sBAAoC;AACpC,oBAAkC;AAClC,oBAAkC;AAqB3B,SAAS,gBAAgB,MAA0B;AACxD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,WAAW,QAAQ;AAAA,IACnB,MAAM,QAAQ;AAAA,EAChB;AACF;",
6
+ "names": []
7
7
  }
package/dist/regexps.js CHANGED
@@ -1,3 +1,32 @@
1
1
  /* Socket Lib - Built with esbuild */
2
- var g=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var a=(e,r)=>{for(var t in r)g(e,t,{get:r[t],enumerable:!0})},o=(e,r,t,p)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of i(r))!s.call(e,n)&&n!==t&&g(e,n,{get:()=>r[n],enumerable:!(p=c(r,n))||p.enumerable});return e};var u=e=>o(g({},"__esModule",{value:!0}),e);var $={};a($,{escapeRegExp:()=>x});module.exports=u($);function x(e){return e.replace(/[\\|{}()[\]^$+*?.]/g,"\\$&")}0&&(module.exports={escapeRegExp});
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var regexps_exports = {};
20
+ __export(regexps_exports, {
21
+ escapeRegExp: () => escapeRegExp
22
+ });
23
+ module.exports = __toCommonJS(regexps_exports);
24
+ // @__NO_SIDE_EFFECTS__
25
+ function escapeRegExp(str) {
26
+ return str.replace(/[\\|{}()[\]^$+*?.]/g, "\\$&");
27
+ }
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ escapeRegExp
31
+ });
3
32
  //# sourceMappingURL=regexps.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/regexps.ts"],
4
4
  "sourcesContent": ["/**\n * @fileoverview Regular expression utilities including escape-string-regexp implementation.\n * Provides regex escaping and pattern matching helpers.\n */\n\n// Inlined escape-string-regexp:\n// https://socket.dev/npm/package/escape-string-regexp/overview/5.0.0\n// MIT License\n// Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n\n/**\n * Escape special characters in a string for use in a regular expression.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function escapeRegExp(str: string): string {\n // Escape characters with special meaning either inside or outside character sets.\n // Use a simple backslash escape when it's always valid, and a `\\xnn` escape when\n // the simpler form would be disallowed by Unicode patterns' stricter grammar.\n return str.replace(/[\\\\|{}()[\\]^$+*?.]/g, '\\\\$&')\n}\n"],
5
- "mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,IAAA,eAAAC,EAAAH,GAcO,SAASE,EAAaE,EAAqB,CAIhD,OAAOA,EAAI,QAAQ,sBAAuB,MAAM,CAClD",
6
- "names": ["regexps_exports", "__export", "escapeRegExp", "__toCommonJS", "str"]
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcO,SAAS,aAAa,KAAqB;AAIhD,SAAO,IAAI,QAAQ,uBAAuB,MAAM;AAClD;",
6
+ "names": []
7
7
  }
package/dist/sea.js CHANGED
@@ -1,3 +1,46 @@
1
1
  /* Socket Lib - Built with esbuild */
2
- var o=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var c=(n,e)=>{for(var a in e)o(n,a,{get:e[a],enumerable:!0})},p=(n,e,a,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of f(e))!l.call(n,r)&&r!==a&&o(n,r,{get:()=>e[r],enumerable:!(t=d(e,r))||t.enumerable});return n};var g=n=>p(o({},"__esModule",{value:!0}),n);var h={};c(h,{getSeaBinaryPath:()=>S,isSeaBinary:()=>u});module.exports=g(h);var s=require("./path");let i;function S(){return u()&&process.argv[0]?(0,s.normalizePath)(process.argv[0]):void 0}function u(){if(i===void 0)try{i=require("node:sea").isSea()}catch{i=!1}return i??!1}0&&(module.exports={getSeaBinaryPath,isSeaBinary});
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var sea_exports = {};
20
+ __export(sea_exports, {
21
+ getSeaBinaryPath: () => getSeaBinaryPath,
22
+ isSeaBinary: () => isSeaBinary
23
+ });
24
+ module.exports = __toCommonJS(sea_exports);
25
+ var import_path = require("./path");
26
+ let _isSea;
27
+ function getSeaBinaryPath() {
28
+ return isSeaBinary() && process.argv[0] ? (0, import_path.normalizePath)(process.argv[0]) : void 0;
29
+ }
30
+ function isSeaBinary() {
31
+ if (_isSea === void 0) {
32
+ try {
33
+ const seaModule = require("node:sea");
34
+ _isSea = seaModule.isSea();
35
+ } catch {
36
+ _isSea = false;
37
+ }
38
+ }
39
+ return _isSea ?? false;
40
+ }
41
+ // Annotate the CommonJS export names for ESM import in node:
42
+ 0 && (module.exports = {
43
+ getSeaBinaryPath,
44
+ isSeaBinary
45
+ });
3
46
  //# sourceMappingURL=sea.js.map
package/dist/sea.js.map CHANGED
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/sea.ts"],
4
4
  "sourcesContent": ["/**\n * @fileoverview SEA (Single Executable Application) detection utilities for Socket ecosystem.\n * Provides reliable detection of whether the current process is running\n * as a Node.js Single Executable Application.\n */\n\nimport { normalizePath } from './path'\n\n/**\n * Cached SEA detection result.\n */\nlet _isSea: boolean | undefined\n\n/**\n * Get the current SEA binary path.\n * Only valid when running as a SEA binary.\n */\nexport function getSeaBinaryPath(): string | undefined {\n return isSeaBinary() && process.argv[0]\n ? normalizePath(process.argv[0])\n : undefined\n}\n\n/**\n * Detect if the current process is running as a SEA binary.\n * Uses Node.js 24+ native API with caching for performance.\n */\nexport function isSeaBinary(): boolean {\n if (_isSea === undefined) {\n try {\n // Use Node.js 24+ native SEA detection API.\n // eslint-disable-next-line n/no-unsupported-features/node-builtins\n const seaModule = require('node:sea')\n _isSea = seaModule.isSea()\n } catch {\n // Node.js < 24 or SEA module not available.\n _isSea = false\n }\n }\n return _isSea ?? false\n}\n"],
5
- "mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,EAAA,gBAAAC,IAAA,eAAAC,EAAAJ,GAMA,IAAAK,EAA8B,kBAK9B,IAAIC,EAMG,SAASJ,GAAuC,CACrD,OAAOC,EAAY,GAAK,QAAQ,KAAK,CAAC,KAClC,iBAAc,QAAQ,KAAK,CAAC,CAAC,EAC7B,MACN,CAMO,SAASA,GAAuB,CACrC,GAAIG,IAAW,OACb,GAAI,CAIFA,EADkB,QAAQ,UAAU,EACjB,MAAM,CAC3B,MAAQ,CAENA,EAAS,EACX,CAEF,OAAOA,GAAU,EACnB",
6
- "names": ["sea_exports", "__export", "getSeaBinaryPath", "isSeaBinary", "__toCommonJS", "import_path", "_isSea"]
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,kBAA8B;AAK9B,IAAI;AAMG,SAAS,mBAAuC;AACrD,SAAO,YAAY,KAAK,QAAQ,KAAK,CAAC,QAClC,2BAAc,QAAQ,KAAK,CAAC,CAAC,IAC7B;AACN;AAMO,SAAS,cAAuB;AACrC,MAAI,WAAW,QAAW;AACxB,QAAI;AAGF,YAAM,YAAY,QAAQ,UAAU;AACpC,eAAS,UAAU,MAAM;AAAA,IAC3B,QAAQ;AAEN,eAAS;AAAA,IACX;AAAA,EACF;AACA,SAAO,UAAU;AACnB;",
6
+ "names": []
7
7
  }
package/dist/shadow.js CHANGED
@@ -1,3 +1,60 @@
1
1
  /* Socket Lib - Built with esbuild */
2
- var r=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var f=(e,n)=>{for(var o in n)r(e,o,{get:n[o],enumerable:!0})},m=(e,n,o,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of l(n))!u.call(e,t)&&t!==o&&r(e,t,{get:()=>n[t],enumerable:!(s=p(n,t))||s.enumerable});return e};var w=e=>m(r({},"__esModule",{value:!0}),e);var h={};f(h,{shouldSkipShadow:()=>_});module.exports=w(h);var i=require("./path");function _(e,n){const{cwd:o=process.cwd(),win32:s=!1}={__proto__:null,...n};if(s&&e)return!0;const t=process.env.npm_config_user_agent;if(t?.includes("exec")||t?.includes("npx")||t?.includes("dlx"))return!0;const a=(0,i.normalizePath)(o),c=process.env.npm_config_cache;return c&&a.includes((0,i.normalizePath)(c))?!0:["_npx",".pnpm-store","dlx-",".yarn/$$","AppData/Local/Temp/xfs-"].some(d=>a.includes(d))}0&&(module.exports={shouldSkipShadow});
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var shadow_exports = {};
20
+ __export(shadow_exports, {
21
+ shouldSkipShadow: () => shouldSkipShadow
22
+ });
23
+ module.exports = __toCommonJS(shadow_exports);
24
+ var import_path = require("./path");
25
+ function shouldSkipShadow(binPath, options) {
26
+ const { cwd = process.cwd(), win32 = false } = {
27
+ __proto__: null,
28
+ ...options
29
+ };
30
+ if (win32 && binPath) {
31
+ return true;
32
+ }
33
+ const userAgent = process.env["npm_config_user_agent"];
34
+ if (userAgent?.includes("exec") || userAgent?.includes("npx") || userAgent?.includes("dlx")) {
35
+ return true;
36
+ }
37
+ const normalizedCwd = (0, import_path.normalizePath)(cwd);
38
+ const npmCache = process.env["npm_config_cache"];
39
+ if (npmCache && normalizedCwd.includes((0, import_path.normalizePath)(npmCache))) {
40
+ return true;
41
+ }
42
+ const tempPatterns = [
43
+ // npm's npx cache directory
44
+ "_npx",
45
+ // pnpm dlx temporary store
46
+ ".pnpm-store",
47
+ // Common dlx directory prefix
48
+ "dlx-",
49
+ // Yarn Berry PnP virtual packages.
50
+ ".yarn/$$",
51
+ // Yarn on Windows uses normalized forward slash paths.
52
+ "AppData/Local/Temp/xfs-"
53
+ ];
54
+ return tempPatterns.some((pattern) => normalizedCwd.includes(pattern));
55
+ }
56
+ // Annotate the CommonJS export names for ESM import in node:
57
+ 0 && (module.exports = {
58
+ shouldSkipShadow
59
+ });
3
60
  //# sourceMappingURL=shadow.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/shadow.ts"],
4
4
  "sourcesContent": ["/**\n * @fileoverview Shadow binary installation utilities for Socket ecosystem.\n * Provides logic to determine when shadow binary installation should be skipped.\n */\n\nimport { normalizePath } from './path'\n\nexport interface ShadowInstallationOptions {\n cwd?: string | undefined\n win32?: boolean | undefined\n}\n\n/**\n * Determines if shadow binaries should be installed.\n * Shadows should NOT be installed when:\n * - Running in a temporary execution context (exec/npx/dlx)\n * - On Windows with an existing binary path (required for Windows to function)\n *\n * @param binPath - Path to the binary being shadowed\n * @param options - Configuration options\n * @param options.cwd - Current working directory path to check\n * @param options.win32 - Whether running on Windows\n * @returns true if shadow installation should be skipped\n */\nexport function shouldSkipShadow(\n binPath: string,\n options?: ShadowInstallationOptions | undefined,\n): boolean {\n const { cwd = process.cwd(), win32 = false } = {\n __proto__: null,\n ...options,\n } as ShadowInstallationOptions\n\n // Windows compatibility: Skip shadow installation if binary is already found.\n //\n // This check is required because Windows handles executables differently than Unix:\n // 1. File locking - Windows locks running executables, so cmd-shim creation would\n // fail with EBUSY/EACCES errors when trying to create wrapper files.\n // 2. PATH conflicts - Attempting to shadow an already-resolved binary can create\n // circular references or ambiguous command resolution.\n // 3. Registry integration - Windows package managers often use system-level\n // integrations beyond just PATH that our shadowing would interfere with.\n //\n // Without this check, users would see \"Access Denied\" or file locking errors\n // that are difficult to debug. This is not a performance optimization - the\n // shadow installation will fail without it.\n if (win32 && binPath) {\n return true\n }\n\n // Check environment variable for exec/npx/dlx indicators.\n const userAgent = process.env['npm_config_user_agent']\n if (\n userAgent?.includes('exec') ||\n userAgent?.includes('npx') ||\n userAgent?.includes('dlx')\n ) {\n return true\n }\n\n // Normalize the cwd path for consistent checking across platforms.\n const normalizedCwd = normalizePath(cwd)\n\n // Check if running from npm's npx cache.\n const npmCache = process.env['npm_config_cache']\n if (npmCache && normalizedCwd.includes(normalizePath(npmCache))) {\n return true\n }\n\n // Check common temporary execution path patterns.\n const tempPatterns = [\n // npm's npx cache directory\n '_npx',\n // pnpm dlx temporary store\n '.pnpm-store',\n // Common dlx directory prefix\n 'dlx-',\n // Yarn Berry PnP virtual packages.\n '.yarn/$$',\n // Yarn on Windows uses normalized forward slash paths.\n 'AppData/Local/Temp/xfs-',\n ]\n\n return tempPatterns.some(pattern => normalizedCwd.includes(pattern))\n}\n"],
5
- "mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAKA,IAAAI,EAA8B,kBAmBvB,SAASF,EACdG,EACAC,EACS,CACT,KAAM,CAAE,IAAAC,EAAM,QAAQ,IAAI,EAAG,MAAAC,EAAQ,EAAM,EAAI,CAC7C,UAAW,KACX,GAAGF,CACL,EAeA,GAAIE,GAASH,EACX,MAAO,GAIT,MAAMI,EAAY,QAAQ,IAAI,sBAC9B,GACEA,GAAW,SAAS,MAAM,GAC1BA,GAAW,SAAS,KAAK,GACzBA,GAAW,SAAS,KAAK,EAEzB,MAAO,GAIT,MAAMC,KAAgB,iBAAcH,CAAG,EAGjCI,EAAW,QAAQ,IAAI,iBAC7B,OAAIA,GAAYD,EAAc,YAAS,iBAAcC,CAAQ,CAAC,EACrD,GAIY,CAEnB,OAEA,cAEA,OAEA,WAEA,yBACF,EAEoB,KAAKC,GAAWF,EAAc,SAASE,CAAO,CAAC,CACrE",
6
- "names": ["shadow_exports", "__export", "shouldSkipShadow", "__toCommonJS", "import_path", "binPath", "options", "cwd", "win32", "userAgent", "normalizedCwd", "npmCache", "pattern"]
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,kBAA8B;AAmBvB,SAAS,iBACd,SACA,SACS;AACT,QAAM,EAAE,MAAM,QAAQ,IAAI,GAAG,QAAQ,MAAM,IAAI;AAAA,IAC7C,WAAW;AAAA,IACX,GAAG;AAAA,EACL;AAeA,MAAI,SAAS,SAAS;AACpB,WAAO;AAAA,EACT;AAGA,QAAM,YAAY,QAAQ,IAAI,uBAAuB;AACrD,MACE,WAAW,SAAS,MAAM,KAC1B,WAAW,SAAS,KAAK,KACzB,WAAW,SAAS,KAAK,GACzB;AACA,WAAO;AAAA,EACT;AAGA,QAAM,oBAAgB,2BAAc,GAAG;AAGvC,QAAM,WAAW,QAAQ,IAAI,kBAAkB;AAC/C,MAAI,YAAY,cAAc,aAAS,2BAAc,QAAQ,CAAC,GAAG;AAC/D,WAAO;AAAA,EACT;AAGA,QAAM,eAAe;AAAA;AAAA,IAEnB;AAAA;AAAA,IAEA;AAAA;AAAA,IAEA;AAAA;AAAA,IAEA;AAAA;AAAA,IAEA;AAAA,EACF;AAEA,SAAO,aAAa,KAAK,aAAW,cAAc,SAAS,OAAO,CAAC;AACrE;",
6
+ "names": []
7
7
  }
@@ -1,3 +1,250 @@
1
1
  /* Socket Lib - Built with esbuild */
2
- var g=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var T=(e,t)=>{for(var s in t)g(e,s,{get:t[s],enumerable:!0})},w=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of h(t))!P.call(e,r)&&r!==s&&g(e,r,{get:()=>t[r],enumerable:!(n=G(t,r))||n.enumerable});return e};var R=e=>w(g({},"__esModule",{value:!0}),e);var U={};T(U,{load:()=>v,onExit:()=>k,signals:()=>C,unload:()=>E});module.exports=R(U);const S=Reflect.apply,i=globalThis.process,p=i?.emit,y=i?.platform??"",x=i?.reallyExit,b=y==="win32";let m;function N(){return m===void 0&&(m=require("node:events")),m}let o;function d(){if(o===void 0){if(i?.__signal_exit_emitter__)o=i.__signal_exit_emitter__;else if(i){const e=N().EventEmitter;o=i.__signal_exit_emitter__=new e,o.count=0,o.emitted={__proto__:null}}o&&!o.infinite&&(o.setMaxListeners(Number.POSITIVE_INFINITY),o.infinite=!0)}return o}let c;function L(){if(c===void 0){c={__proto__:null};const e=d(),t=_();for(const s of t)c[s]=function(){if((i?.listeners(s)||[]).length===e.count){const a=b&&s==="SIGHUP"?"SIGINT":s;i?.kill(i?.pid,a)}}}return c}let l;function _(){return l===void 0&&(l=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"],b||l.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),y==="linux"&&l.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")),l}function u(e,t,s){const n=d();n.emitted?.[e]||(n.emitted&&(n.emitted[e]=!0),n.emit(e,t,s))}let f=!1;function v(){if(f||!i)return;f=!0;const e=d();e.count!==void 0&&(e.count+=1);const t=_(),s=L();l=t.filter(n=>{try{return i.on(n,s[n]),!0}catch{}return!1}),i.emit=O,i.reallyExit=M}function O(e,t,...s){if(e==="exit"){let n=t;if(n===void 0){const I=i?.exitCode;n=typeof I=="number"?I:void 0}else i&&(i.exitCode=n);const r=S(p,this,[e,n,...s]),a=typeof n=="number"?n:null;return r}return S(p,this,[e,t,...s])}function M(e){const t=e||0;throw i&&(i.exitCode=t),S(x,i,[t]),new Error("processReallyExit should never return")}function k(e,t){if(!i)return function(){};if(typeof e!="function")throw new TypeError("a callback must be provided for exit handler");const{alwaysLast:s}={__proto__:null,...t};let n="exit";s&&(n="afterexit");const r=d();return r.on(n,e),function(){r.removeListener(n,e),!r.listeners("exit").length&&r.listeners("afterexit").length}}function C(){return l}function E(){if(!f||!i)return;f=!1;const e=_(),t=L();for(const n of e)try{i.removeListener(n,t[n])}catch{}i.emit=p,x!==void 0&&(i.reallyExit=x);const s=d();s.count!==void 0&&(s.count-=1)}0&&(module.exports={load,onExit,signals,unload});
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var signal_exit_exports = {};
20
+ __export(signal_exit_exports, {
21
+ load: () => load,
22
+ onExit: () => onExit,
23
+ signals: () => signals,
24
+ unload: () => unload
25
+ });
26
+ module.exports = __toCommonJS(signal_exit_exports);
27
+ const ReflectApply = Reflect.apply;
28
+ const globalProcess = globalThis.process;
29
+ const originalProcessEmit = globalProcess?.emit;
30
+ const platform = globalProcess?.platform ?? "";
31
+ const originalProcessReallyExit = globalProcess?.reallyExit;
32
+ const WIN32 = platform === "win32";
33
+ let _events;
34
+ // @__NO_SIDE_EFFECTS__
35
+ function getEvents() {
36
+ if (_events === void 0) {
37
+ _events = require("node:events");
38
+ }
39
+ return _events;
40
+ }
41
+ let _emitter;
42
+ // @__NO_SIDE_EFFECTS__
43
+ function getEmitter() {
44
+ if (_emitter === void 0) {
45
+ if (globalProcess?.__signal_exit_emitter__) {
46
+ _emitter = globalProcess.__signal_exit_emitter__;
47
+ } else if (globalProcess) {
48
+ const EventEmitter = (/* @__PURE__ */ getEvents()).EventEmitter;
49
+ _emitter = globalProcess.__signal_exit_emitter__ = new EventEmitter();
50
+ _emitter.count = 0;
51
+ _emitter.emitted = { __proto__: null };
52
+ }
53
+ if (_emitter && !_emitter.infinite) {
54
+ _emitter.setMaxListeners(Number.POSITIVE_INFINITY);
55
+ _emitter.infinite = true;
56
+ }
57
+ }
58
+ return _emitter;
59
+ }
60
+ let _sigListeners;
61
+ // @__NO_SIDE_EFFECTS__
62
+ function getSignalListeners() {
63
+ if (_sigListeners === void 0) {
64
+ _sigListeners = { __proto__: null };
65
+ const emitter = /* @__PURE__ */ getEmitter();
66
+ const sigs = /* @__PURE__ */ getSignals();
67
+ for (const sig of sigs) {
68
+ _sigListeners[sig] = function listener() {
69
+ const listeners = globalProcess?.listeners(sig) || [];
70
+ if (listeners.length === emitter.count) {
71
+ /* @__PURE__ */ unload();
72
+ /* @__PURE__ */ emit("exit", null, sig);
73
+ /* @__PURE__ */ emit("afterexit", null, sig);
74
+ const killSig = WIN32 && sig === "SIGHUP" ? "SIGINT" : sig;
75
+ globalProcess?.kill(globalProcess?.pid, killSig);
76
+ }
77
+ };
78
+ }
79
+ }
80
+ return _sigListeners;
81
+ }
82
+ let _signals;
83
+ // @__NO_SIDE_EFFECTS__
84
+ function getSignals() {
85
+ if (_signals === void 0) {
86
+ _signals = ["SIGABRT", "SIGALRM", "SIGHUP", "SIGINT", "SIGTERM"];
87
+ if (!WIN32) {
88
+ _signals.push(
89
+ "SIGVTALRM",
90
+ "SIGXCPU",
91
+ "SIGXFSZ",
92
+ "SIGUSR2",
93
+ "SIGTRAP",
94
+ "SIGSYS",
95
+ "SIGQUIT",
96
+ "SIGIOT"
97
+ // should detect profiler and enable/disable accordingly.
98
+ // see #21
99
+ // 'SIGPROF'
100
+ );
101
+ }
102
+ if (platform === "linux") {
103
+ _signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT", "SIGUNUSED");
104
+ }
105
+ }
106
+ return _signals;
107
+ }
108
+ // @__NO_SIDE_EFFECTS__
109
+ function emit(event, code, signal) {
110
+ const emitter = /* @__PURE__ */ getEmitter();
111
+ if (emitter.emitted?.[event]) {
112
+ return;
113
+ }
114
+ if (emitter.emitted) {
115
+ emitter.emitted[event] = true;
116
+ }
117
+ emitter.emit(event, code, signal);
118
+ }
119
+ let loaded = false;
120
+ // @__NO_SIDE_EFFECTS__
121
+ function load() {
122
+ if (loaded || !globalProcess) {
123
+ return;
124
+ }
125
+ loaded = true;
126
+ const emitter = /* @__PURE__ */ getEmitter();
127
+ if (emitter.count !== void 0) {
128
+ emitter.count += 1;
129
+ }
130
+ const sigs = /* @__PURE__ */ getSignals();
131
+ const sigListeners = /* @__PURE__ */ getSignalListeners();
132
+ _signals = sigs.filter((sig) => {
133
+ try {
134
+ globalProcess.on(
135
+ sig,
136
+ sigListeners[sig]
137
+ );
138
+ return true;
139
+ } catch {
140
+ }
141
+ return false;
142
+ });
143
+ globalProcess.emit = processEmit;
144
+ globalProcess.reallyExit = processReallyExit;
145
+ }
146
+ // @__NO_SIDE_EFFECTS__
147
+ function processEmit(eventName, exitCode, ...args) {
148
+ if (eventName === "exit") {
149
+ let actualExitCode = exitCode;
150
+ if (actualExitCode === void 0) {
151
+ const processExitCode = globalProcess?.exitCode;
152
+ actualExitCode = typeof processExitCode === "number" ? processExitCode : void 0;
153
+ } else if (globalProcess) {
154
+ globalProcess.exitCode = actualExitCode;
155
+ }
156
+ const result = ReflectApply(
157
+ originalProcessEmit,
158
+ this,
159
+ [eventName, actualExitCode, ...args]
160
+ );
161
+ const numExitCode = typeof actualExitCode === "number" ? actualExitCode : null;
162
+ /* @__PURE__ */ emit("exit", numExitCode, null);
163
+ /* @__PURE__ */ emit("afterexit", numExitCode, null);
164
+ return result;
165
+ }
166
+ return ReflectApply(
167
+ originalProcessEmit,
168
+ this,
169
+ [eventName, exitCode, ...args]
170
+ );
171
+ }
172
+ // @__NO_SIDE_EFFECTS__
173
+ function processReallyExit(code) {
174
+ const exitCode = code || 0;
175
+ if (globalProcess) {
176
+ globalProcess.exitCode = exitCode;
177
+ }
178
+ /* @__PURE__ */ emit("exit", exitCode, null);
179
+ /* @__PURE__ */ emit("afterexit", exitCode, null);
180
+ ReflectApply(
181
+ originalProcessReallyExit,
182
+ globalProcess,
183
+ [exitCode]
184
+ );
185
+ throw new Error("processReallyExit should never return");
186
+ }
187
+ // @__NO_SIDE_EFFECTS__
188
+ function onExit(cb, options) {
189
+ if (!globalProcess) {
190
+ return function remove() {
191
+ };
192
+ }
193
+ if (typeof cb !== "function") {
194
+ throw new TypeError("a callback must be provided for exit handler");
195
+ }
196
+ if (loaded === false) {
197
+ /* @__PURE__ */ load();
198
+ }
199
+ const { alwaysLast } = { __proto__: null, ...options };
200
+ let eventName = "exit";
201
+ if (alwaysLast) {
202
+ eventName = "afterexit";
203
+ }
204
+ const emitter = /* @__PURE__ */ getEmitter();
205
+ emitter.on(eventName, cb);
206
+ return function remove() {
207
+ emitter.removeListener(eventName, cb);
208
+ if (!emitter.listeners("exit").length && !emitter.listeners("afterexit").length) {
209
+ /* @__PURE__ */ unload();
210
+ }
211
+ };
212
+ }
213
+ // @__NO_SIDE_EFFECTS__
214
+ function signals() {
215
+ return _signals;
216
+ }
217
+ // @__NO_SIDE_EFFECTS__
218
+ function unload() {
219
+ if (!loaded || !globalProcess) {
220
+ return;
221
+ }
222
+ loaded = false;
223
+ const sigs = /* @__PURE__ */ getSignals();
224
+ const sigListeners = /* @__PURE__ */ getSignalListeners();
225
+ for (const sig of sigs) {
226
+ try {
227
+ globalProcess.removeListener(
228
+ sig,
229
+ sigListeners[sig]
230
+ );
231
+ } catch {
232
+ }
233
+ }
234
+ globalProcess.emit = originalProcessEmit;
235
+ if (originalProcessReallyExit !== void 0) {
236
+ globalProcess.reallyExit = originalProcessReallyExit;
237
+ }
238
+ const emitter = /* @__PURE__ */ getEmitter();
239
+ if (emitter.count !== void 0) {
240
+ emitter.count -= 1;
241
+ }
242
+ }
243
+ // Annotate the CommonJS export names for ESM import in node:
244
+ 0 && (module.exports = {
245
+ load,
246
+ onExit,
247
+ signals,
248
+ unload
249
+ });
3
250
  //# sourceMappingURL=signal-exit.js.map