@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.
- package/CHANGELOG.md +24 -0
- package/dist/abort.js +60 -1
- package/dist/abort.js.map +2 -2
- package/dist/agent.js +289 -1
- package/dist/agent.js.map +2 -2
- package/dist/ansi.js +60 -1
- package/dist/ansi.js.map +2 -2
- package/dist/argv/flags.js +282 -1
- package/dist/argv/flags.js.map +2 -2
- package/dist/argv/parse.js +171 -1
- package/dist/argv/parse.js.map +2 -2
- package/dist/arrays.js +85 -1
- package/dist/arrays.js.map +2 -2
- package/dist/bin.js +419 -5
- package/dist/bin.js.map +2 -2
- package/dist/cacache.js +139 -1
- package/dist/cacache.js.map +2 -2
- package/dist/cache-with-ttl.js +223 -1
- package/dist/cache-with-ttl.js.map +2 -2
- package/dist/constants/agents.js +126 -1
- package/dist/constants/agents.js.map +2 -2
- package/dist/constants/core.d.ts +1 -1
- package/dist/constants/core.js +57 -2
- package/dist/constants/core.js.map +3 -3
- package/dist/constants/encoding.js +48 -1
- package/dist/constants/encoding.js.map +2 -2
- package/dist/constants/github.js +30 -1
- package/dist/constants/github.js.map +2 -2
- package/dist/constants/licenses.js +66 -1
- package/dist/constants/licenses.js.map +2 -2
- package/dist/constants/node.js +185 -1
- package/dist/constants/node.js.map +2 -2
- package/dist/constants/packages.js +128 -1
- package/dist/constants/packages.js.map +2 -2
- package/dist/constants/paths.js +150 -1
- package/dist/constants/paths.js.map +2 -2
- package/dist/constants/platform.js +41 -1
- package/dist/constants/platform.js.map +2 -2
- package/dist/constants/process.js +52 -1
- package/dist/constants/process.js.map +2 -2
- package/dist/constants/socket.js +102 -1
- package/dist/constants/socket.js.map +2 -2
- package/dist/constants/testing.js +36 -1
- package/dist/constants/testing.js.map +2 -2
- package/dist/constants/time.js +39 -1
- package/dist/constants/time.js.map +2 -2
- package/dist/constants/typescript.js +54 -1
- package/dist/constants/typescript.js.map +2 -2
- package/dist/cover/code.js +135 -1
- package/dist/cover/code.js.map +2 -2
- package/dist/cover/formatters.js +101 -11
- package/dist/cover/formatters.js.map +2 -2
- package/dist/cover/type.js +63 -1
- package/dist/cover/type.js.map +2 -2
- package/dist/cover/types.js +15 -1
- package/dist/cover/types.js.map +2 -2
- package/dist/debug.js +337 -2
- package/dist/debug.js.map +2 -2
- package/dist/dlx-binary.js +408 -7
- package/dist/dlx-binary.js.map +2 -2
- package/dist/dlx-package.js +278 -7
- package/dist/dlx-package.js.map +2 -2
- package/dist/dlx.js +214 -7
- package/dist/dlx.js.map +3 -3
- package/dist/effects/pulse-frames.js +64 -1
- package/dist/effects/pulse-frames.js.map +2 -2
- package/dist/effects/text-shimmer.js +174 -1
- package/dist/effects/text-shimmer.js.map +2 -2
- package/dist/effects/types.js +15 -1
- package/dist/effects/types.js.map +2 -2
- package/dist/effects/ultra.js +61 -1
- package/dist/effects/ultra.js.map +2 -2
- package/dist/env/ci.js +31 -1
- package/dist/env/ci.js.map +2 -2
- package/dist/env/debug.js +30 -1
- package/dist/env/debug.js.map +2 -2
- package/dist/env/github.js +65 -1
- package/dist/env/github.js.map +2 -2
- package/dist/env/helpers.js +47 -1
- package/dist/env/helpers.js.map +2 -2
- package/dist/env/home.js +30 -1
- package/dist/env/home.js.map +2 -2
- package/dist/env/locale.js +40 -1
- package/dist/env/locale.js.map +2 -2
- package/dist/env/node-auth-token.js +30 -1
- package/dist/env/node-auth-token.js.map +2 -2
- package/dist/env/node-env.js +30 -1
- package/dist/env/node-env.js.map +2 -2
- package/dist/env/npm.js +50 -1
- package/dist/env/npm.js.map +2 -2
- package/dist/env/package-manager.js +73 -1
- package/dist/env/package-manager.js.map +2 -2
- package/dist/env/path.js +30 -1
- package/dist/env/path.js.map +2 -2
- package/dist/env/pre-commit.js +31 -1
- package/dist/env/pre-commit.js.map +2 -2
- package/dist/env/rewire.js +72 -1
- package/dist/env/rewire.js.map +2 -2
- package/dist/env/shell.js +30 -1
- package/dist/env/shell.js.map +2 -2
- package/dist/env/socket-cli-shadow.js +51 -1
- package/dist/env/socket-cli-shadow.js.map +2 -2
- package/dist/env/socket-cli.js +86 -1
- package/dist/env/socket-cli.js.map +2 -2
- package/dist/env/socket.js +101 -1
- package/dist/env/socket.js.map +2 -2
- package/dist/env/temp-dir.js +40 -1
- package/dist/env/temp-dir.js.map +2 -2
- package/dist/env/term.js +30 -1
- package/dist/env/term.js.map +2 -2
- package/dist/env/test.js +43 -1
- package/dist/env/test.js.map +2 -2
- package/dist/env/windows.js +45 -1
- package/dist/env/windows.js.map +2 -2
- package/dist/env/xdg.js +40 -1
- package/dist/env/xdg.js.map +2 -2
- package/dist/env.js +170 -1
- package/dist/env.js.map +2 -2
- package/dist/fs.js +670 -7
- package/dist/fs.js.map +2 -2
- package/dist/functions.js +68 -1
- package/dist/functions.js.map +2 -2
- package/dist/git.js +329 -2
- package/dist/git.js.map +2 -2
- package/dist/github.js +202 -1
- package/dist/github.js.map +2 -2
- package/dist/globs.js +149 -1
- package/dist/globs.js.map +3 -3
- package/dist/http-request.js +335 -3
- package/dist/http-request.js.map +2 -2
- package/dist/index.js +69 -1
- package/dist/index.js.map +2 -2
- package/dist/ipc.js +244 -1
- package/dist/ipc.js.map +2 -2
- package/dist/json.js +73 -1
- package/dist/json.js.map +2 -2
- package/dist/links/index.js +60 -1
- package/dist/links/index.js.map +2 -2
- package/dist/logger.js +1384 -1
- package/dist/logger.js.map +2 -2
- package/dist/maintained-node-versions.js +35 -1
- package/dist/maintained-node-versions.js.map +2 -2
- package/dist/memoization.js +210 -1
- package/dist/memoization.js.map +2 -2
- package/dist/objects.js +311 -1
- package/dist/objects.js.map +2 -2
- package/dist/packages/editable.js +356 -9
- package/dist/packages/editable.js.map +2 -2
- package/dist/packages/exports.js +162 -1
- package/dist/packages/exports.js.map +2 -2
- package/dist/packages/isolation.js +187 -1
- package/dist/packages/isolation.js.map +2 -2
- package/dist/packages/licenses.js +214 -1
- package/dist/packages/licenses.js.map +2 -2
- package/dist/packages/manifest.js +190 -1
- package/dist/packages/manifest.js.map +2 -2
- package/dist/packages/normalize.js +132 -1
- package/dist/packages/normalize.js.map +2 -2
- package/dist/packages/operations.js +320 -1
- package/dist/packages/operations.js.map +2 -2
- package/dist/packages/paths.js +53 -1
- package/dist/packages/paths.js.map +2 -2
- package/dist/packages/provenance.js +178 -1
- package/dist/packages/provenance.js.map +2 -2
- package/dist/packages/specs.js +83 -1
- package/dist/packages/specs.js.map +2 -2
- package/dist/packages/validation.js +51 -1
- package/dist/packages/validation.js.map +2 -2
- package/dist/packages.js +129 -1
- package/dist/packages.js.map +2 -2
- package/dist/path.js +446 -1
- package/dist/path.js.map +2 -2
- package/dist/paths/rewire.js +79 -1
- package/dist/paths/rewire.js.map +2 -2
- package/dist/paths.js +190 -1
- package/dist/paths.js.map +2 -2
- package/dist/performance.js +216 -15
- package/dist/performance.js.map +2 -2
- package/dist/process-lock.js +287 -8
- package/dist/process-lock.js.map +2 -2
- package/dist/promise-queue.js +109 -1
- package/dist/promise-queue.js.map +2 -2
- package/dist/promises.js +267 -1
- package/dist/promises.js.map +2 -2
- package/dist/prompts/index.js +45 -1
- package/dist/prompts/index.js.map +2 -2
- package/dist/prompts.js +58 -1
- package/dist/prompts.js.map +2 -2
- package/dist/regexps.js +30 -1
- package/dist/regexps.js.map +2 -2
- package/dist/sea.js +44 -1
- package/dist/sea.js.map +2 -2
- package/dist/shadow.js +58 -1
- package/dist/shadow.js.map +2 -2
- package/dist/signal-exit.js +248 -1
- package/dist/signal-exit.js.map +3 -3
- package/dist/sorts.js +94 -1
- package/dist/sorts.js.map +3 -3
- package/dist/spawn.js +200 -1
- package/dist/spawn.js.map +2 -2
- package/dist/spinner.js +961 -1
- package/dist/spinner.js.map +2 -2
- package/dist/ssri.js +71 -1
- package/dist/ssri.js.map +2 -2
- package/dist/stdio/clear.js +82 -1
- package/dist/stdio/clear.js.map +2 -2
- package/dist/stdio/divider.js +89 -3
- package/dist/stdio/divider.js.map +2 -2
- package/dist/stdio/footer.js +94 -2
- package/dist/stdio/footer.js.map +2 -2
- package/dist/stdio/header.js +100 -2
- package/dist/stdio/header.js.map +2 -2
- package/dist/stdio/mask.js +207 -5
- package/dist/stdio/mask.js.map +2 -2
- package/dist/stdio/progress.js +209 -2
- package/dist/stdio/progress.js.map +2 -2
- package/dist/stdio/prompts.js +88 -1
- package/dist/stdio/prompts.js.map +2 -2
- package/dist/stdio/stderr.js +89 -2
- package/dist/stdio/stderr.js.map +2 -2
- package/dist/stdio/stdout.js +103 -2
- package/dist/stdio/stdout.js.map +2 -2
- package/dist/streams.js +78 -1
- package/dist/streams.js.map +2 -2
- package/dist/strings.js +251 -3
- package/dist/strings.js.map +2 -2
- package/dist/suppress-warnings.js +98 -1
- package/dist/suppress-warnings.js.map +2 -2
- package/dist/tables.js +128 -3
- package/dist/tables.js.map +2 -2
- package/dist/temporary-executor.js +53 -1
- package/dist/temporary-executor.js.map +2 -2
- package/dist/themes/context.js +71 -1
- package/dist/themes/context.js.map +2 -2
- package/dist/themes/index.js +57 -1
- package/dist/themes/index.js.map +2 -2
- package/dist/themes/themes.js +195 -1
- package/dist/themes/themes.js.map +2 -2
- package/dist/themes/types.js +15 -1
- package/dist/themes/types.js.map +2 -2
- package/dist/themes/utils.js +116 -1
- package/dist/themes/utils.js.map +2 -2
- package/dist/types.js +59 -1
- package/dist/types.js.map +2 -2
- package/dist/url.js +142 -1
- package/dist/url.js.map +2 -2
- package/dist/utils/get-ipc.js +58 -1
- package/dist/utils/get-ipc.js.map +2 -2
- package/dist/validation/json-parser.js +127 -1
- package/dist/validation/json-parser.js.map +2 -2
- package/dist/validation/types.js +15 -1
- package/dist/validation/types.js.map +2 -2
- package/dist/versions.js +154 -1
- package/dist/versions.js.map +2 -2
- package/dist/words.js +50 -1
- package/dist/words.js.map +2 -2
- package/dist/zod.js +27 -1
- package/dist/zod.js.map +2 -2
- package/package.json +1 -1
package/dist/signal-exit.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/signal-exit.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @fileoverview Process signal handling utilities.\n * Provides cross-platform signal exit detection and cleanup handlers.\n */\n\n// Inlined signal-exit:\n// https://socket.dev/npm/package/signal-exit/overview/4.1.0\n// ISC License\n// Copyright (c) 2015-2023 Benjamin Coe, Isaac Z. Schlueter, and Contributors\n\n// This is not the set of all possible signals.\n//\n// It IS, however, the set of all signals that trigger\n// an exit on either Linux or BSD systems. Linux is a\n// superset of the signal names supported on BSD, and\n// the unknown signals just fail to register, so we can\n// catch that easily enough.\n//\n// Don't bother with SIGKILL. It's uncatchable, which\n// means that we can't fire any callbacks anyway.\n//\n// If a user does happen to register a handler on a non-\n// fatal signal like SIGWINCH or something, and then\n// exit, it'll end up firing `process.emit('exit')`, so\n// the handler will be fired anyway.\n//\n// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised\n// artificially, inherently leave the process in a\n// state from which it is not safe to try and enter JS\n// listeners.\n\n// IMPORTANT: Do not use destructuring here - use direct assignment instead.\n// tsgo has a bug that incorrectly transpiles destructured exports, resulting in\n// `exports.SomeName = void 0;` which causes runtime errors.\n// See: https://github.com/SocketDev/socket-packageurl-js/issues/3\nconst ReflectApply = Reflect.apply\nconst globalProcess = globalThis.process as\n | (NodeJS.Process & {\n __signal_exit_emitter__?: any\n reallyExit?: (code?: number | undefined) => never\n })\n | undefined\nconst originalProcessEmit = globalProcess?.emit\nconst platform = globalProcess?.platform ?? ''\nconst originalProcessReallyExit = globalProcess?.reallyExit as\n | ((code?: number | undefined) => never)\n | undefined\nconst WIN32 = platform === 'win32'\n\nlet _events: typeof import('node:events') | undefined\n/*@__NO_SIDE_EFFECTS__*/\nfunction getEvents() {\n if (_events === undefined) {\n // Use non-'node:' prefixed require to avoid Webpack errors.\n\n _events = /*@__PURE__*/ require('node:events')\n }\n return _events as typeof import('node:events')\n}\n\n// Type for tracking emitted signals.\ntype EmittedSignals = {\n // Using string as signals can include custom events like 'exit' and 'afterexit'.\n [signal: string]: boolean\n}\n\ntype SignalExitEmitter = import('node:events').EventEmitter & {\n count?: number\n emitted?: EmittedSignals\n infinite?: boolean\n}\nlet _emitter: SignalExitEmitter | undefined\n/*@__NO_SIDE_EFFECTS__*/\nfunction getEmitter() {\n if (_emitter === undefined) {\n if (globalProcess?.__signal_exit_emitter__) {\n _emitter = globalProcess.__signal_exit_emitter__\n } else if (globalProcess) {\n const EventEmitter = getEvents().EventEmitter\n _emitter = globalProcess.__signal_exit_emitter__ =\n new EventEmitter() as SignalExitEmitter\n _emitter.count = 0\n _emitter.emitted = { __proto__: null } as unknown as EmittedSignals\n }\n // Because this emitter is a global, we have to check to see if a\n // previous version of this library failed to enable infinite listeners.\n // I know what you're about to say. But literally everything about\n // signal-exit is a compromise with evil. Get used to it.\n if (_emitter && !_emitter.infinite) {\n _emitter.setMaxListeners(Number.POSITIVE_INFINITY)\n _emitter.infinite = true\n }\n }\n return _emitter as SignalExitEmitter\n}\n\ntype SignalListener = () => void\n// Type for signal listeners indexed by signal name.\ntype SignalListenerMap = {\n [signal: string]: SignalListener\n}\nlet _sigListeners: SignalListenerMap | undefined\n/*@__NO_SIDE_EFFECTS__*/\nfunction getSignalListeners() {\n if (_sigListeners === undefined) {\n _sigListeners = { __proto__: null } as unknown as SignalListenerMap\n const emitter = getEmitter()\n const sigs = getSignals()\n for (const sig of sigs) {\n _sigListeners[sig] = function listener() {\n // If there are no other listeners, an exit is coming!\n // Simplest way: remove us and then re-send the signal.\n // We know that this will kill the process, so we can\n // safely emit now.\n const listeners = globalProcess?.listeners(sig as NodeJS.Signals) || []\n if (listeners.length === emitter.count) {\n unload()\n emit('exit', null, sig)\n emit('afterexit', null, sig)\n // \"SIGHUP\" throws an `ENOSYS` error on Windows,\n // so use a supported signal instead.\n const killSig = WIN32 && sig === 'SIGHUP' ? 'SIGINT' : sig\n globalProcess?.kill(globalProcess?.pid, killSig)\n }\n }\n }\n }\n return _sigListeners as SignalListenerMap\n}\n\nlet _signals: string[] | undefined\n/*@__NO_SIDE_EFFECTS__*/\nfunction getSignals() {\n if (_signals === undefined) {\n _signals = ['SIGABRT', 'SIGALRM', 'SIGHUP', 'SIGINT', 'SIGTERM']\n if (!WIN32) {\n _signals.push(\n 'SIGVTALRM',\n 'SIGXCPU',\n 'SIGXFSZ',\n 'SIGUSR2',\n 'SIGTRAP',\n 'SIGSYS',\n 'SIGQUIT',\n 'SIGIOT',\n // should detect profiler and enable/disable accordingly.\n // see #21\n // 'SIGPROF'\n )\n }\n if (platform === 'linux') {\n _signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT', 'SIGUNUSED')\n }\n }\n return _signals as string[]\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nfunction emit(event: string, code: number | null, signal: string | null): void {\n const emitter = getEmitter()\n if (emitter.emitted?.[event]) {\n return\n }\n if (emitter.emitted) {\n emitter.emitted[event] = true\n }\n emitter.emit(event, code, signal)\n}\n\nlet loaded = false\n\n/**\n * Load signal handlers and hook into process exit events.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function load(): void {\n if (loaded || !globalProcess) {\n return\n }\n loaded = true\n\n // This is the number of onSignalExit's that are in play.\n // It's important so that we can count the correct number of\n // listeners on signals, and don't wait for the other one to\n // handle it instead of us.\n const emitter = getEmitter()\n if (emitter.count !== undefined) {\n emitter.count += 1\n }\n\n const sigs = getSignals()\n const sigListeners = getSignalListeners()\n _signals = sigs.filter(sig => {\n try {\n globalProcess.on(\n sig as NodeJS.Signals,\n sigListeners[sig] as SignalListener,\n )\n return true\n } catch {}\n return false\n })\n\n globalProcess.emit = processEmit as typeof globalProcess.emit\n globalProcess.reallyExit = processReallyExit\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nfunction processEmit(\n this: NodeJS.Process,\n eventName: string,\n exitCode?: number | undefined,\n ...args: any[]\n): boolean {\n if (eventName === 'exit') {\n let actualExitCode = exitCode\n if (actualExitCode === undefined) {\n const processExitCode = globalProcess?.exitCode\n actualExitCode =\n typeof processExitCode === 'number' ? processExitCode : undefined\n } else if (globalProcess) {\n globalProcess.exitCode = actualExitCode\n }\n const result = ReflectApply(\n originalProcessEmit as (...args: unknown[]) => boolean,\n this,\n [eventName, actualExitCode, ...args],\n ) as boolean\n const numExitCode =\n typeof actualExitCode === 'number' ? actualExitCode : null\n emit('exit', numExitCode, null)\n emit('afterexit', numExitCode, null)\n return result\n }\n return ReflectApply(\n originalProcessEmit as (...args: unknown[]) => boolean,\n this,\n [eventName, exitCode, ...args],\n ) as boolean\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nfunction processReallyExit(code?: number | undefined): never {\n const exitCode = code || 0\n if (globalProcess) {\n globalProcess.exitCode = exitCode\n }\n emit('exit', exitCode, null)\n emit('afterexit', exitCode, null)\n ReflectApply(\n originalProcessReallyExit as (code?: number) => never,\n globalProcess,\n [exitCode],\n )\n throw new Error('processReallyExit should never return')\n}\n\nexport interface OnExitOptions {\n alwaysLast?: boolean\n}\n\n/**\n * Register a callback to run on process exit or signal.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function onExit(\n cb: (code: number | null, signal: string | null) => void,\n options?: OnExitOptions | undefined,\n): () => void {\n if (!globalProcess) {\n return function remove() {}\n }\n if (typeof cb !== 'function') {\n throw new TypeError('a callback must be provided for exit handler')\n }\n if (loaded === false) {\n load()\n }\n const { alwaysLast } = { __proto__: null, ...options } as OnExitOptions\n\n let eventName = 'exit'\n if (alwaysLast) {\n eventName = 'afterexit'\n }\n\n const emitter = getEmitter()\n emitter.on(eventName, cb)\n\n return function remove() {\n emitter.removeListener(eventName, cb)\n if (\n !emitter.listeners('exit').length &&\n !emitter.listeners('afterexit').length\n ) {\n unload()\n }\n }\n}\n\n/**\n * Get the list of signals that are currently being monitored.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function signals(): string[] | undefined {\n return _signals\n}\n\n/**\n * Unload signal handlers and restore original process behavior.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function unload(): void {\n if (!loaded || !globalProcess) {\n return\n }\n loaded = false\n\n const sigs = getSignals()\n const sigListeners = getSignalListeners()\n for (const sig of sigs) {\n try {\n globalProcess.removeListener(\n sig as NodeJS.Signals,\n sigListeners[sig] as SignalListener,\n )\n } catch {}\n }\n globalProcess.emit = originalProcessEmit as typeof globalProcess.emit\n if (originalProcessReallyExit !== undefined) {\n globalProcess.reallyExit = originalProcessReallyExit\n }\n const emitter = getEmitter()\n if (emitter.count !== undefined) {\n emitter.count -= 1\n }\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["/**\n * @fileoverview Process signal handling utilities.\n * Provides cross-platform signal exit detection and cleanup handlers.\n */\n\n// Inlined signal-exit:\n// https://socket.dev/npm/package/signal-exit/overview/4.1.0\n// ISC License\n// Copyright (c) 2015-2023 Benjamin Coe, Isaac Z. Schlueter, and Contributors\n\n// This is not the set of all possible signals.\n//\n// It IS, however, the set of all signals that trigger\n// an exit on either Linux or BSD systems. Linux is a\n// superset of the signal names supported on BSD, and\n// the unknown signals just fail to register, so we can\n// catch that easily enough.\n//\n// Don't bother with SIGKILL. It's uncatchable, which\n// means that we can't fire any callbacks anyway.\n//\n// If a user does happen to register a handler on a non-\n// fatal signal like SIGWINCH or something, and then\n// exit, it'll end up firing `process.emit('exit')`, so\n// the handler will be fired anyway.\n//\n// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised\n// artificially, inherently leave the process in a\n// state from which it is not safe to try and enter JS\n// listeners.\n\n// IMPORTANT: Do not use destructuring here - use direct assignment instead.\n// tsgo has a bug that incorrectly transpiles destructured exports, resulting in\n// `exports.SomeName = void 0;` which causes runtime errors.\n// See: https://github.com/SocketDev/socket-packageurl-js/issues/3\nconst ReflectApply = Reflect.apply\nconst globalProcess = globalThis.process as\n | (NodeJS.Process & {\n __signal_exit_emitter__?: import('node:events').EventEmitter\n reallyExit?: (code?: number | undefined) => never\n })\n | undefined\nconst originalProcessEmit = globalProcess?.emit\nconst platform = globalProcess?.platform ?? ''\nconst originalProcessReallyExit = globalProcess?.reallyExit as\n | ((code?: number | undefined) => never)\n | undefined\nconst WIN32 = platform === 'win32'\n\nlet _events: typeof import('node:events') | undefined\n/*@__NO_SIDE_EFFECTS__*/\nfunction getEvents() {\n if (_events === undefined) {\n // Use non-'node:' prefixed require to avoid Webpack errors.\n\n _events = /*@__PURE__*/ require('node:events')\n }\n return _events as typeof import('node:events')\n}\n\n// Type for tracking emitted signals.\ntype EmittedSignals = {\n // Using string as signals can include custom events like 'exit' and 'afterexit'.\n [signal: string]: boolean\n}\n\ntype SignalExitEmitter = import('node:events').EventEmitter & {\n count?: number\n emitted?: EmittedSignals\n infinite?: boolean\n}\nlet _emitter: SignalExitEmitter | undefined\n/*@__NO_SIDE_EFFECTS__*/\nfunction getEmitter() {\n if (_emitter === undefined) {\n if (globalProcess?.__signal_exit_emitter__) {\n _emitter = globalProcess.__signal_exit_emitter__\n } else if (globalProcess) {\n const EventEmitter = getEvents().EventEmitter\n _emitter = globalProcess.__signal_exit_emitter__ =\n new EventEmitter() as SignalExitEmitter\n _emitter.count = 0\n _emitter.emitted = { __proto__: null } as unknown as EmittedSignals\n }\n // Because this emitter is a global, we have to check to see if a\n // previous version of this library failed to enable infinite listeners.\n // I know what you're about to say. But literally everything about\n // signal-exit is a compromise with evil. Get used to it.\n if (_emitter && !_emitter.infinite) {\n _emitter.setMaxListeners(Number.POSITIVE_INFINITY)\n _emitter.infinite = true\n }\n }\n return _emitter as SignalExitEmitter\n}\n\ntype SignalListener = () => void\n// Type for signal listeners indexed by signal name.\ntype SignalListenerMap = {\n [signal: string]: SignalListener\n}\nlet _sigListeners: SignalListenerMap | undefined\n/*@__NO_SIDE_EFFECTS__*/\nfunction getSignalListeners() {\n if (_sigListeners === undefined) {\n _sigListeners = { __proto__: null } as unknown as SignalListenerMap\n const emitter = getEmitter()\n const sigs = getSignals()\n for (const sig of sigs) {\n _sigListeners[sig] = function listener() {\n // If there are no other listeners, an exit is coming!\n // Simplest way: remove us and then re-send the signal.\n // We know that this will kill the process, so we can\n // safely emit now.\n const listeners = globalProcess?.listeners(sig as NodeJS.Signals) || []\n if (listeners.length === emitter.count) {\n unload()\n emit('exit', null, sig)\n emit('afterexit', null, sig)\n // \"SIGHUP\" throws an `ENOSYS` error on Windows,\n // so use a supported signal instead.\n const killSig = WIN32 && sig === 'SIGHUP' ? 'SIGINT' : sig\n globalProcess?.kill(globalProcess?.pid, killSig)\n }\n }\n }\n }\n return _sigListeners as SignalListenerMap\n}\n\nlet _signals: string[] | undefined\n/*@__NO_SIDE_EFFECTS__*/\nfunction getSignals() {\n if (_signals === undefined) {\n _signals = ['SIGABRT', 'SIGALRM', 'SIGHUP', 'SIGINT', 'SIGTERM']\n if (!WIN32) {\n _signals.push(\n 'SIGVTALRM',\n 'SIGXCPU',\n 'SIGXFSZ',\n 'SIGUSR2',\n 'SIGTRAP',\n 'SIGSYS',\n 'SIGQUIT',\n 'SIGIOT',\n // should detect profiler and enable/disable accordingly.\n // see #21\n // 'SIGPROF'\n )\n }\n if (platform === 'linux') {\n _signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT', 'SIGUNUSED')\n }\n }\n return _signals as string[]\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nfunction emit(event: string, code: number | null, signal: string | null): void {\n const emitter = getEmitter()\n if (emitter.emitted?.[event]) {\n return\n }\n if (emitter.emitted) {\n emitter.emitted[event] = true\n }\n emitter.emit(event, code, signal)\n}\n\nlet loaded = false\n\n/**\n * Load signal handlers and hook into process exit events.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function load(): void {\n if (loaded || !globalProcess) {\n return\n }\n loaded = true\n\n // This is the number of onSignalExit's that are in play.\n // It's important so that we can count the correct number of\n // listeners on signals, and don't wait for the other one to\n // handle it instead of us.\n const emitter = getEmitter()\n if (emitter.count !== undefined) {\n emitter.count += 1\n }\n\n const sigs = getSignals()\n const sigListeners = getSignalListeners()\n _signals = sigs.filter(sig => {\n try {\n globalProcess.on(\n sig as NodeJS.Signals,\n sigListeners[sig] as SignalListener,\n )\n return true\n } catch {}\n return false\n })\n\n globalProcess.emit = processEmit as typeof globalProcess.emit\n globalProcess.reallyExit = processReallyExit\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nfunction processEmit(\n this: NodeJS.Process,\n eventName: string,\n exitCode?: number | undefined,\n ...args: any[]\n): boolean {\n if (eventName === 'exit') {\n let actualExitCode = exitCode\n if (actualExitCode === undefined) {\n const processExitCode = globalProcess?.exitCode\n actualExitCode =\n typeof processExitCode === 'number' ? processExitCode : undefined\n } else if (globalProcess) {\n globalProcess.exitCode = actualExitCode\n }\n const result = ReflectApply(\n originalProcessEmit as (...args: unknown[]) => boolean,\n this,\n [eventName, actualExitCode, ...args],\n ) as boolean\n const numExitCode =\n typeof actualExitCode === 'number' ? actualExitCode : null\n emit('exit', numExitCode, null)\n emit('afterexit', numExitCode, null)\n return result\n }\n return ReflectApply(\n originalProcessEmit as (...args: unknown[]) => boolean,\n this,\n [eventName, exitCode, ...args],\n ) as boolean\n}\n\n/*@__NO_SIDE_EFFECTS__*/\nfunction processReallyExit(code?: number | undefined): never {\n const exitCode = code || 0\n if (globalProcess) {\n globalProcess.exitCode = exitCode\n }\n emit('exit', exitCode, null)\n emit('afterexit', exitCode, null)\n ReflectApply(\n originalProcessReallyExit as (code?: number) => never,\n globalProcess,\n [exitCode],\n )\n throw new Error('processReallyExit should never return')\n}\n\nexport interface OnExitOptions {\n alwaysLast?: boolean\n}\n\n/**\n * Register a callback to run on process exit or signal.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function onExit(\n cb: (code: number | null, signal: string | null) => void,\n options?: OnExitOptions | undefined,\n): () => void {\n if (!globalProcess) {\n return function remove() {}\n }\n if (typeof cb !== 'function') {\n throw new TypeError('a callback must be provided for exit handler')\n }\n if (loaded === false) {\n load()\n }\n const { alwaysLast } = { __proto__: null, ...options } as OnExitOptions\n\n let eventName = 'exit'\n if (alwaysLast) {\n eventName = 'afterexit'\n }\n\n const emitter = getEmitter()\n emitter.on(eventName, cb)\n\n return function remove() {\n emitter.removeListener(eventName, cb)\n if (\n !emitter.listeners('exit').length &&\n !emitter.listeners('afterexit').length\n ) {\n unload()\n }\n }\n}\n\n/**\n * Get the list of signals that are currently being monitored.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function signals(): string[] | undefined {\n return _signals\n}\n\n/**\n * Unload signal handlers and restore original process behavior.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function unload(): void {\n if (!loaded || !globalProcess) {\n return\n }\n loaded = false\n\n const sigs = getSignals()\n const sigListeners = getSignalListeners()\n for (const sig of sigs) {\n try {\n globalProcess.removeListener(\n sig as NodeJS.Signals,\n sigListeners[sig] as SignalListener,\n )\n } catch {}\n }\n globalProcess.emit = originalProcessEmit as typeof globalProcess.emit\n if (originalProcessReallyExit !== undefined) {\n globalProcess.reallyExit = originalProcessReallyExit\n }\n const emitter = getEmitter()\n if (emitter.count !== undefined) {\n emitter.count -= 1\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmCA,MAAM,eAAe,QAAQ;AAC7B,MAAM,gBAAgB,WAAW;AAMjC,MAAM,sBAAsB,eAAe;AAC3C,MAAM,WAAW,eAAe,YAAY;AAC5C,MAAM,4BAA4B,eAAe;AAGjD,MAAM,QAAQ,aAAa;AAE3B,IAAI;AAAA;AAEJ,SAAS,YAAY;AACnB,MAAI,YAAY,QAAW;AAGzB,cAAwB,QAAQ,aAAa;AAAA,EAC/C;AACA,SAAO;AACT;AAaA,IAAI;AAAA;AAEJ,SAAS,aAAa;AACpB,MAAI,aAAa,QAAW;AAC1B,QAAI,eAAe,yBAAyB;AAC1C,iBAAW,cAAc;AAAA,IAC3B,WAAW,eAAe;AACxB,YAAM,gB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,MAAI,QAAQ,UAAU,QAAW;AAC/B,YAAQ,SAAS;AAAA,EACnB;AACF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/sorts.js
CHANGED
|
@@ -1,3 +1,96 @@
|
|
|
1
1
|
/* Socket Lib - Built with esbuild */
|
|
2
|
-
var
|
|
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 sorts_exports = {};
|
|
20
|
+
__export(sorts_exports, {
|
|
21
|
+
compareSemver: () => compareSemver,
|
|
22
|
+
compareStr: () => compareStr,
|
|
23
|
+
localeCompare: () => localeCompare,
|
|
24
|
+
naturalCompare: () => naturalCompare,
|
|
25
|
+
naturalSorter: () => naturalSorter
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(sorts_exports);
|
|
28
|
+
let _localeCompare;
|
|
29
|
+
// @__NO_SIDE_EFFECTS__
|
|
30
|
+
function localeCompare(x, y) {
|
|
31
|
+
if (_localeCompare === void 0) {
|
|
32
|
+
_localeCompare = new Intl.Collator().compare;
|
|
33
|
+
}
|
|
34
|
+
return _localeCompare(x, y);
|
|
35
|
+
}
|
|
36
|
+
let _naturalCompare;
|
|
37
|
+
// @__NO_SIDE_EFFECTS__
|
|
38
|
+
function naturalCompare(x, y) {
|
|
39
|
+
if (_naturalCompare === void 0) {
|
|
40
|
+
_naturalCompare = new Intl.Collator(
|
|
41
|
+
// The `undefined` locale means it uses the default locale of the user's
|
|
42
|
+
// environment.
|
|
43
|
+
void 0,
|
|
44
|
+
{
|
|
45
|
+
// Enables numeric sorting: numbers in strings are compared by value,
|
|
46
|
+
// e.g. 'file2' comes before 'file10' as numbers and not 'file10' before
|
|
47
|
+
// 'file2' as plain text.
|
|
48
|
+
numeric: true,
|
|
49
|
+
// Makes the comparison case-insensitive and ignores diacritics, e.g.
|
|
50
|
+
// 'a', 'A', and 'á' are treated as equivalent.
|
|
51
|
+
sensitivity: "base"
|
|
52
|
+
}
|
|
53
|
+
).compare;
|
|
54
|
+
}
|
|
55
|
+
return _naturalCompare(x, y);
|
|
56
|
+
}
|
|
57
|
+
let _naturalSorter;
|
|
58
|
+
// @__NO_SIDE_EFFECTS__
|
|
59
|
+
function naturalSorter(arrayToSort) {
|
|
60
|
+
if (_naturalSorter === void 0) {
|
|
61
|
+
const fastSort = require("./external/fast-sort");
|
|
62
|
+
_naturalSorter = fastSort.createNewSortInstance({
|
|
63
|
+
comparer: naturalCompare
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return _naturalSorter(arrayToSort);
|
|
67
|
+
}
|
|
68
|
+
// @__NO_SIDE_EFFECTS__
|
|
69
|
+
function compareStr(a, b) {
|
|
70
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
71
|
+
}
|
|
72
|
+
// @__NO_SIDE_EFFECTS__
|
|
73
|
+
function compareSemver(a, b) {
|
|
74
|
+
const semver = require("./external/semver");
|
|
75
|
+
const validA = semver.valid(a);
|
|
76
|
+
const validB = semver.valid(b);
|
|
77
|
+
if (!validA && !validB) {
|
|
78
|
+
return 0;
|
|
79
|
+
}
|
|
80
|
+
if (!validA) {
|
|
81
|
+
return -1;
|
|
82
|
+
}
|
|
83
|
+
if (!validB) {
|
|
84
|
+
return 1;
|
|
85
|
+
}
|
|
86
|
+
return semver.compare(a, b);
|
|
87
|
+
}
|
|
88
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
89
|
+
0 && (module.exports = {
|
|
90
|
+
compareSemver,
|
|
91
|
+
compareStr,
|
|
92
|
+
localeCompare,
|
|
93
|
+
naturalCompare,
|
|
94
|
+
naturalSorter
|
|
95
|
+
});
|
|
3
96
|
//# sourceMappingURL=sorts.js.map
|
package/dist/sorts.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/sorts.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @fileoverview Sorting comparison functions including locale-aware and natural sorting.\n * Provides various comparison utilities for arrays and collections.\n */\n\nlet _localeCompare: ((x: string, y: string) => number) | undefined\n/**\n * Compare two strings using locale-aware comparison.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function localeCompare(x: string, y: string): number {\n if (_localeCompare === undefined) {\n // Lazily call new Intl.Collator() because in Node it can take 10-14ms.\n _localeCompare = new Intl.Collator().compare\n }\n return _localeCompare(x, y)\n}\n\nlet _naturalCompare: ((x: string, y: string) => number) | undefined\n/**\n * Compare two strings using natural sorting (numeric-aware, case-insensitive).\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function naturalCompare(x: string, y: string): number {\n if (_naturalCompare === undefined) {\n // Lazily call new Intl.Collator() because in Node it can take 10-14ms.\n _naturalCompare = new Intl.Collator(\n // The `undefined` locale means it uses the default locale of the user's\n // environment.\n undefined,\n {\n // Enables numeric sorting: numbers in strings are compared by value,\n // e.g. 'file2' comes before 'file10' as numbers and not 'file10' before\n // 'file2' as plain text.\n numeric: true,\n // Makes the comparison case-insensitive and ignores diacritics, e.g.\n // 'a', 'A', and '\u00E1' are treated as equivalent.\n sensitivity: 'base',\n },\n ).compare\n }\n return _naturalCompare(x, y)\n}\n\n// Type for fast-sort sorter function.\ntype FastSortFunction = ReturnType<\n typeof import('fast-sort').createNewSortInstance\n>\n\nlet _naturalSorter: FastSortFunction | undefined\n/**\n * Sort an array using natural comparison.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function naturalSorter<T>(\n arrayToSort: T[],\n): ReturnType<FastSortFunction> {\n if (_naturalSorter === undefined) {\n const fastSort
|
|
5
|
-
"mappings": ";
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["/**\n * @fileoverview Sorting comparison functions including locale-aware and natural sorting.\n * Provides various comparison utilities for arrays and collections.\n */\n\nlet _localeCompare: ((x: string, y: string) => number) | undefined\n/**\n * Compare two strings using locale-aware comparison.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function localeCompare(x: string, y: string): number {\n if (_localeCompare === undefined) {\n // Lazily call new Intl.Collator() because in Node it can take 10-14ms.\n _localeCompare = new Intl.Collator().compare\n }\n return _localeCompare(x, y)\n}\n\nlet _naturalCompare: ((x: string, y: string) => number) | undefined\n/**\n * Compare two strings using natural sorting (numeric-aware, case-insensitive).\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function naturalCompare(x: string, y: string): number {\n if (_naturalCompare === undefined) {\n // Lazily call new Intl.Collator() because in Node it can take 10-14ms.\n _naturalCompare = new Intl.Collator(\n // The `undefined` locale means it uses the default locale of the user's\n // environment.\n undefined,\n {\n // Enables numeric sorting: numbers in strings are compared by value,\n // e.g. 'file2' comes before 'file10' as numbers and not 'file10' before\n // 'file2' as plain text.\n numeric: true,\n // Makes the comparison case-insensitive and ignores diacritics, e.g.\n // 'a', 'A', and '\u00E1' are treated as equivalent.\n sensitivity: 'base',\n },\n ).compare\n }\n return _naturalCompare(x, y)\n}\n\n// Type for fast-sort sorter function.\ntype FastSortFunction = ReturnType<\n typeof import('fast-sort').createNewSortInstance\n>\n\nlet _naturalSorter: FastSortFunction | undefined\n/**\n * Sort an array using natural comparison.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function naturalSorter<T>(\n arrayToSort: T[],\n): ReturnType<FastSortFunction> {\n if (_naturalSorter === undefined) {\n const fastSort =\n /*@__PURE__*/ require('./external/fast-sort') as typeof import('fast-sort')\n _naturalSorter = fastSort.createNewSortInstance({\n comparer: naturalCompare,\n }) as FastSortFunction\n }\n return (_naturalSorter as FastSortFunction)(arrayToSort)\n}\n\n/**\n * Simple string comparison.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function compareStr(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0\n}\n\n/**\n * Compare semantic versions.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function compareSemver(a: string, b: string): number {\n const semver =\n /*@__PURE__*/ require('./external/semver') as typeof import('semver')\n const validA: string | null = semver.valid(a)\n const validB: string | null = semver.valid(b)\n\n if (!validA && !validB) {\n return 0\n }\n if (!validA) {\n return -1\n }\n if (!validB) {\n return 1\n }\n return semver.compare(a, b) as number\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,IAAI;AAAA;AAKG,SAAS,cAAc,GAAW,GAAmB;AAC1D,MAAI,mBAAmB,QAAW;AAEhC,qBAAiB,IAAI,KAAK,SAAS,EAAE;AAAA,EACvC;AACA,SAAO,eAAe,GAAG,CAAC;AAC5B;AAEA,IAAI;AAAA;AAKG,SAAS,eAAe,GAAW,GAAmB;AAC3D,MAAI,oBAAoB,QAAW;AAEjC,sBAAkB,IAAI,KAAK;AAAA;AAAA;AAAA,MAGzB;AAAA,MACA;AAAA;AAAA;AAAA;AAAA,QAIE,SAAS;AAAA;AAAA;AAAA,QAGT,aAAa;AAAA,MACf;AAAA,IACF,EAAE;AAAA,EACJ;AACA,SAAO,gBAAgB,GAAG,CAAC;AAC7B;AAOA,IAAI;AAAA;AAKG,SAAS,cACd,aAC8B;AAC9B,MAAI,mBAAmB,QAAW;AAChC,UAAM,WACU,QAAQ,sBAAsB;AAC9C,qBAAiB,SAAS,sBAAsB;AAAA,MAC9C,UAAU;AAAA,IACZ,CAAC;AAAA,EACH;AACA,SAAQ,eAAoC,WAAW;AACzD;AAAA;AAMO,SAAS,WAAW,GAAW,GAAmB;AACvD,SAAO,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI;AAClC;AAAA;AAMO,SAAS,cAAc,GAAW,GAAmB;AAC1D,QAAM,SACU,QAAQ,mBAAmB;AAC3C,QAAM,SAAwB,OAAO,MAAM,CAAC;AAC5C,QAAM,SAAwB,OAAO,MAAM,CAAC;AAE5C,MAAI,CAAC,UAAU,CAAC,QAAQ;AACtB,WAAO;AAAA,EACT;AACA,MAAI,CAAC,QAAQ;AACX,WAAO;AAAA,EACT;AACA,MAAI,CAAC,QAAQ;AACX,WAAO;AAAA,EACT;AACA,SAAO,OAAO,QAAQ,GAAG,CAAC;AAC5B;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/spawn.js
CHANGED
|
@@ -1,3 +1,202 @@
|
|
|
1
1
|
/* Socket Lib - Built with esbuild */
|
|
2
|
-
var
|
|
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 spawn_exports = {};
|
|
20
|
+
__export(spawn_exports, {
|
|
21
|
+
isSpawnError: () => isSpawnError,
|
|
22
|
+
isStdioType: () => isStdioType,
|
|
23
|
+
spawn: () => spawn,
|
|
24
|
+
spawnSync: () => spawnSync
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(spawn_exports);
|
|
27
|
+
var import_process = require("#constants/process");
|
|
28
|
+
var import_arrays = require("./arrays");
|
|
29
|
+
var import_objects = require("./objects");
|
|
30
|
+
var import_strings = require("./strings");
|
|
31
|
+
const abortSignal = (0, import_process.getAbortSignal)();
|
|
32
|
+
const spinner = (0, import_process.getSpinner)();
|
|
33
|
+
const windowsScriptExtRegExp = /\.(?:cmd|bat|ps1)$/i;
|
|
34
|
+
let _child_process;
|
|
35
|
+
// @__NO_SIDE_EFFECTS__
|
|
36
|
+
function getChildProcess() {
|
|
37
|
+
if (_child_process === void 0) {
|
|
38
|
+
_child_process = require("node:child_process");
|
|
39
|
+
}
|
|
40
|
+
return _child_process;
|
|
41
|
+
}
|
|
42
|
+
let _npmCliPromiseSpawn;
|
|
43
|
+
// @__NO_SIDE_EFFECTS__
|
|
44
|
+
function getNpmcliPromiseSpawn() {
|
|
45
|
+
if (_npmCliPromiseSpawn === void 0) {
|
|
46
|
+
_npmCliPromiseSpawn = require("./external/@npmcli/promise-spawn");
|
|
47
|
+
}
|
|
48
|
+
return _npmCliPromiseSpawn;
|
|
49
|
+
}
|
|
50
|
+
let _path;
|
|
51
|
+
// @__NO_SIDE_EFFECTS__
|
|
52
|
+
function getPath() {
|
|
53
|
+
if (_path === void 0) {
|
|
54
|
+
_path = require("node:path");
|
|
55
|
+
}
|
|
56
|
+
return _path;
|
|
57
|
+
}
|
|
58
|
+
// @__NO_SIDE_EFFECTS__
|
|
59
|
+
function isSpawnError(value) {
|
|
60
|
+
if (value === null || typeof value !== "object") {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
const err = value;
|
|
64
|
+
return (0, import_objects.hasOwn)(err, "code") && typeof err["code"] !== "undefined" || (0, import_objects.hasOwn)(err, "errno") && typeof err["errno"] !== "undefined" || (0, import_objects.hasOwn)(err, "syscall") && typeof err["syscall"] === "string";
|
|
65
|
+
}
|
|
66
|
+
// @__NO_SIDE_EFFECTS__
|
|
67
|
+
function isStdioType(stdio, type) {
|
|
68
|
+
if (arguments.length === 1) {
|
|
69
|
+
const validTypes = ["pipe", "ignore", "inherit", "overlapped"];
|
|
70
|
+
return typeof stdio === "string" && validTypes.includes(stdio);
|
|
71
|
+
}
|
|
72
|
+
return stdio === type || (stdio === null || stdio === void 0) && type === "pipe" || (0, import_arrays.isArray)(stdio) && stdio.length > 2 && stdio[0] === type && stdio[1] === type && stdio[2] === type;
|
|
73
|
+
}
|
|
74
|
+
// @__NO_SIDE_EFFECTS__
|
|
75
|
+
function stripAnsiFromSpawnResult(result) {
|
|
76
|
+
const res = result;
|
|
77
|
+
const { stderr, stdout } = res;
|
|
78
|
+
if (typeof stdout === "string") {
|
|
79
|
+
res.stdout = (0, import_strings.stripAnsi)(stdout);
|
|
80
|
+
}
|
|
81
|
+
if (typeof stderr === "string") {
|
|
82
|
+
res.stderr = (0, import_strings.stripAnsi)(stderr);
|
|
83
|
+
}
|
|
84
|
+
return res;
|
|
85
|
+
}
|
|
86
|
+
function spawn(cmd, args, options, extra) {
|
|
87
|
+
const shell = (0, import_objects.getOwn)(options, "shell");
|
|
88
|
+
const WIN32 = process.platform === "win32";
|
|
89
|
+
let actualCmd = cmd;
|
|
90
|
+
if (WIN32 && shell && windowsScriptExtRegExp.test(actualCmd)) {
|
|
91
|
+
const path = /* @__PURE__ */ getPath();
|
|
92
|
+
actualCmd = path.basename(actualCmd, path.extname(actualCmd));
|
|
93
|
+
}
|
|
94
|
+
const {
|
|
95
|
+
spinner: optionsSpinner = spinner,
|
|
96
|
+
stripAnsi: shouldStripAnsi = true,
|
|
97
|
+
...spawnOptions
|
|
98
|
+
} = { __proto__: null, ...options };
|
|
99
|
+
const spinnerInstance = optionsSpinner;
|
|
100
|
+
const { env, stdio, stdioString = true } = spawnOptions;
|
|
101
|
+
const wasSpinning = !!spinnerInstance?.isSpinning;
|
|
102
|
+
const shouldStopSpinner = wasSpinning && !/* @__PURE__ */ isStdioType(stdio, "ignore") && !/* @__PURE__ */ isStdioType(stdio, "pipe");
|
|
103
|
+
const shouldRestartSpinner = shouldStopSpinner;
|
|
104
|
+
if (shouldStopSpinner) {
|
|
105
|
+
spinnerInstance.stop();
|
|
106
|
+
}
|
|
107
|
+
const npmCliPromiseSpawn = /* @__PURE__ */ getNpmcliPromiseSpawn();
|
|
108
|
+
const envToUse = env ? {
|
|
109
|
+
__proto__: null,
|
|
110
|
+
...process.env,
|
|
111
|
+
...env
|
|
112
|
+
} : process.env;
|
|
113
|
+
const promiseSpawnOpts = {
|
|
114
|
+
__proto__: null,
|
|
115
|
+
cwd: typeof spawnOptions.cwd === "string" ? spawnOptions.cwd : void 0,
|
|
116
|
+
env: envToUse,
|
|
117
|
+
signal: abortSignal,
|
|
118
|
+
stdio: spawnOptions.stdio,
|
|
119
|
+
stdioString,
|
|
120
|
+
shell: spawnOptions.shell,
|
|
121
|
+
timeout: spawnOptions.timeout,
|
|
122
|
+
uid: spawnOptions.uid,
|
|
123
|
+
gid: spawnOptions.gid
|
|
124
|
+
};
|
|
125
|
+
const spawnPromise = npmCliPromiseSpawn(
|
|
126
|
+
actualCmd,
|
|
127
|
+
args ? [...args] : [],
|
|
128
|
+
promiseSpawnOpts,
|
|
129
|
+
extra
|
|
130
|
+
);
|
|
131
|
+
const oldSpawnPromise = spawnPromise;
|
|
132
|
+
let newSpawnPromise;
|
|
133
|
+
if (shouldStripAnsi && stdioString) {
|
|
134
|
+
newSpawnPromise = spawnPromise.then((result) => {
|
|
135
|
+
const strippedResult = /* @__PURE__ */ stripAnsiFromSpawnResult(result);
|
|
136
|
+
if ("code" in strippedResult) {
|
|
137
|
+
;
|
|
138
|
+
strippedResult.exitCode = strippedResult.code;
|
|
139
|
+
}
|
|
140
|
+
return strippedResult;
|
|
141
|
+
}).catch((error) => {
|
|
142
|
+
throw /* @__PURE__ */ stripAnsiFromSpawnResult(error);
|
|
143
|
+
});
|
|
144
|
+
} else {
|
|
145
|
+
newSpawnPromise = spawnPromise.then((result) => {
|
|
146
|
+
if ("code" in result) {
|
|
147
|
+
const res = result;
|
|
148
|
+
res.exitCode = result.code;
|
|
149
|
+
return res;
|
|
150
|
+
}
|
|
151
|
+
return result;
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
if (shouldRestartSpinner) {
|
|
155
|
+
newSpawnPromise = newSpawnPromise.finally(() => {
|
|
156
|
+
spinnerInstance.start();
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
;
|
|
160
|
+
newSpawnPromise.process = oldSpawnPromise.process;
|
|
161
|
+
newSpawnPromise.stdin = oldSpawnPromise.stdin;
|
|
162
|
+
return newSpawnPromise;
|
|
163
|
+
}
|
|
164
|
+
function spawnSync(cmd, args, options) {
|
|
165
|
+
const shell = (0, import_objects.getOwn)(options, "shell");
|
|
166
|
+
const WIN32 = process.platform === "win32";
|
|
167
|
+
let actualCmd = cmd;
|
|
168
|
+
if (WIN32 && shell && windowsScriptExtRegExp.test(actualCmd)) {
|
|
169
|
+
const path = /* @__PURE__ */ getPath();
|
|
170
|
+
actualCmd = path.basename(actualCmd, path.extname(actualCmd));
|
|
171
|
+
}
|
|
172
|
+
const { stripAnsi: shouldStripAnsi = true, ...rawSpawnOptions } = {
|
|
173
|
+
__proto__: null,
|
|
174
|
+
...options
|
|
175
|
+
};
|
|
176
|
+
const { stdioString: rawStdioString = true } = rawSpawnOptions;
|
|
177
|
+
const rawEncoding = rawStdioString ? "utf8" : "buffer";
|
|
178
|
+
const spawnOptions = {
|
|
179
|
+
encoding: rawEncoding,
|
|
180
|
+
...rawSpawnOptions
|
|
181
|
+
};
|
|
182
|
+
const stdioString = spawnOptions.encoding !== "buffer";
|
|
183
|
+
const result = (/* @__PURE__ */ getChildProcess()).spawnSync(actualCmd, args, spawnOptions);
|
|
184
|
+
if (stdioString) {
|
|
185
|
+
const { stderr, stdout } = result;
|
|
186
|
+
if (stdout) {
|
|
187
|
+
result.stdout = stdout.toString().trim();
|
|
188
|
+
}
|
|
189
|
+
if (stderr) {
|
|
190
|
+
result.stderr = stderr.toString().trim();
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return shouldStripAnsi && stdioString ? /* @__PURE__ */ stripAnsiFromSpawnResult(result) : result;
|
|
194
|
+
}
|
|
195
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
196
|
+
0 && (module.exports = {
|
|
197
|
+
isSpawnError,
|
|
198
|
+
isStdioType,
|
|
199
|
+
spawn,
|
|
200
|
+
spawnSync
|
|
201
|
+
});
|
|
3
202
|
//# sourceMappingURL=spawn.js.map
|
package/dist/spawn.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/spawn.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * @fileoverview Child process spawning utilities with cross-platform support.\n * Provides enhanced spawn functionality with stdio handling and error management.\n *\n * SECURITY: Array-Based Arguments Prevent Command Injection\n *\n * This module uses array-based arguments for all command execution, which is the\n * PRIMARY DEFENSE against command injection attacks. When you pass arguments as\n * an array to spawn():\n *\n * spawn('npx', ['sfw', tool, ...args], { shell: true })\n *\n * Node.js handles escaping automatically. Each argument is passed directly to the\n * OS without shell interpretation. Shell metacharacters like ; | & $ ( ) ` are\n * treated as LITERAL STRINGS, not as commands. This approach is secure even when\n * shell: true is used on Windows for .cmd/.bat file resolution.\n *\n * UNSAFE ALTERNATIVE (not used in this codebase):\n * spawn(`npx sfw ${tool} ${args.join(' ')}`, { shell: true }) // \u2716 VULNERABLE\n *\n * String concatenation allows injection. For example, if tool = \"foo; rm -rf /\",\n * the shell would execute both commands. Array-based arguments prevent this.\n *\n * References:\n * - https://nodejs.org/api/child_process.html#child_processspawncommand-args-options\n * - https://cheatsheetseries.owasp.org/cheatsheets/Nodejs_Security_Cheat_Sheet.html\n */\n\nimport { getAbortSignal, getSpinner } from '#constants/process'\n\nimport { isArray } from './arrays'\n\nconst abortSignal = getAbortSignal()\nconst spinner = getSpinner()\n\nimport { getOwn, hasOwn } from './objects'\nimport { stripAnsi } from './strings'\n\n// Define BufferEncoding type for TypeScript compatibility.\ntype BufferEncoding = globalThis.BufferEncoding\n\nconst windowsScriptExtRegExp = /\\.(?:cmd|bat|ps1)$/i\n\nlet _child_process: typeof import('node:child_process') | undefined\n/**\n * Lazily load the `child_process` module to avoid Webpack bundling issues.\n *\n * @returns The Node.js `child_process` module\n *\n * @example\n * const childProcess = getChildProcess()\n * childProcess.spawnSync('ls', ['-la'])\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction getChildProcess() {\n if (_child_process === undefined) {\n // Use non-'node:' prefixed require to avoid Webpack errors.\n\n _child_process = /*@__PURE__*/ require('node:child_process')\n }\n return _child_process as typeof import('node:child_process')\n}\n\n/**\n * Options for spawning a child process with promise-based completion.\n *\n * @property {string | undefined} cwd - Current working directory for the process\n * @property {boolean | undefined} stdioString - Convert stdio output to strings (default: `true`)\n * @property {StdioType | undefined} stdio - Stdio configuration (`'pipe'`, `'ignore'`, `'inherit'`, or array)\n * @property {NodeJS.ProcessEnv | undefined} env - Environment variables for the process\n * @property {boolean | string | undefined} shell - Whether to run command in shell, or path to shell\n * @property {AbortSignal | undefined} signal - Signal to abort the process\n * @property {number | undefined} timeout - Maximum time in milliseconds before killing the process\n * @property {number | undefined} uid - User identity of the process (POSIX only)\n * @property {number | undefined} gid - Group identity of the process (POSIX only)\n */\nexport type PromiseSpawnOptions = {\n cwd?: string | undefined\n stdioString?: boolean | undefined\n stdio?: StdioType | undefined\n env?: NodeJS.ProcessEnv | undefined\n shell?: boolean | string | undefined\n signal?: AbortSignal | undefined\n timeout?: number | undefined\n uid?: number | undefined\n gid?: number | undefined\n}\n\n/**\n * Result returned by {@link spawn} when the child process completes.\n * This is a Promise that resolves with process exit information and output,\n * with additional properties for accessing the running process and stdin stream.\n *\n * @property {ChildProcessType} process - The running child process instance\n * @property {WritableStreamType | null} stdin - Writable stream for process stdin, or `null` if not piped\n *\n * @example\n * const result = spawn('echo', ['hello'])\n * result.stdin?.write('additional input\\n')\n * const { code, stdout } = await result\n * console.log(stdout) // 'hello'\n */\nexport type PromiseSpawnResult = Promise<{\n cmd: string\n args: string[] | readonly string[]\n code: number\n signal: NodeJS.Signals | null\n stdout: string | Buffer\n stderr: string | Buffer\n}> & {\n process: ChildProcessType\n stdin: WritableStreamType | null\n}\n\nlet _npmCliPromiseSpawn:\n | ((\n cmd: string,\n args: string[],\n options?: PromiseSpawnOptions | undefined,\n extra?: SpawnExtra | undefined,\n ) => PromiseSpawnResult)\n | undefined\n/**\n * Lazily load the `@npmcli/promise-spawn` module for async process spawning.\n *\n * @returns The promise-spawn module that provides Promise-based spawn functionality\n *\n * @example\n * const promiseSpawn = getNpmcliPromiseSpawn()\n * await promiseSpawn('git', ['status'])\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction getNpmcliPromiseSpawn() {\n if (_npmCliPromiseSpawn === undefined) {\n _npmCliPromiseSpawn = /*@__PURE__*/ require('./external/@npmcli/promise-spawn')\n }\n return _npmCliPromiseSpawn as unknown as typeof import('@npmcli/promise-spawn')\n}\n\nlet _path: typeof import('node:path') | undefined\n/**\n * Lazily load the `path` module to avoid Webpack bundling issues.\n *\n * @returns The Node.js `path` module\n *\n * @example\n * const path = getPath()\n * const basename = path.basename('/foo/bar.txt')\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction getPath() {\n if (_path === undefined) {\n // Use non-'node:' prefixed require to avoid Webpack errors.\n\n _path = /*@__PURE__*/ require('node:path')\n }\n return _path as typeof import('node:path')\n}\n\n/**\n * Error object thrown when a spawned process fails.\n * Extends the standard Error with process-specific information including exit code,\n * signal, command details, and captured output.\n *\n * @property {string[]} args - Arguments passed to the command\n * @property {string} cmd - Command that was executed\n * @property {number} code - Process exit code\n * @property {string} name - Error name (typically `'Error'`)\n * @property {string} message - Error message describing the failure\n * @property {NodeJS.Signals | null} signal - Signal that terminated the process, if any\n * @property {string} stack - Stack trace of the error\n * @property {string | Buffer} stderr - Standard error output from the process\n * @property {string | Buffer} stdout - Standard output from the process\n *\n * @example\n * try {\n * await spawn('exit', ['1'])\n * } catch (error) {\n * if (isSpawnError(error)) {\n * console.error(`Command failed with code ${error.code}`)\n * console.error(`stderr: ${error.stderr}`)\n * }\n * }\n */\nexport type SpawnError = {\n args: string[]\n cmd: string\n code: number\n name: string\n message: string\n signal: NodeJS.Signals | null\n stack: string\n stderr: string | Buffer\n stdout: string | Buffer\n}\n\n/**\n * Spawn error variant where stdout and stderr are guaranteed to be strings.\n * This type is used when `stdioString: true` is set in spawn options.\n *\n * @property {string} stdout - Standard output as a string\n * @property {string} stderr - Standard error as a string\n */\nexport type SpawnErrorWithOutputString = SpawnError & {\n stdout: string\n stderr: string\n}\n\n/**\n * Spawn error variant where stdout and stderr are guaranteed to be Buffers.\n * This type is used when `stdioString: false` is set in spawn options.\n *\n * @property {Buffer} stdout - Standard output as a Buffer\n * @property {Buffer} stderr - Standard error as a Buffer\n */\nexport type SpawnErrorWithOutputBuffer = SpawnError & {\n stdout: Buffer\n stderr: Buffer\n}\n\n/**\n * Extra options passed to the underlying promise-spawn implementation.\n * This is an open-ended object for passing additional metadata or configuration.\n */\nexport type SpawnExtra = Record<string, unknown>\n\n/**\n * Valid values for individual stdio streams.\n * - `'pipe'` - Creates a pipe between child and parent (default)\n * - `'ignore'` - Ignores the stream\n * - `'inherit'` - Uses parent's stream\n * - `'overlapped'` - Windows-specific overlapped I/O\n */\nexport type IOType = 'pipe' | 'ignore' | 'inherit' | 'overlapped'\n\n/**\n * Configuration for process stdio (stdin, stdout, stderr) streams.\n * Can be a single value applied to all streams, or an array specifying each stream individually.\n * - `'ipc'` - Creates an IPC channel for communication with the parent\n *\n * @example\n * // All streams piped\n * stdio: 'pipe'\n *\n * @example\n * // Custom configuration per stream: [stdin, stdout, stderr]\n * stdio: ['ignore', 'pipe', 'pipe']\n */\nexport type StdioType = IOType | 'ipc' | Array<IOType | 'ipc'>\n\n/**\n * Result object returned by {@link spawnSync} when the child process completes synchronously.\n *\n * @template T - Type of stdout/stderr (string or Buffer)\n * @property {number} pid - Process ID of the spawned child\n * @property {Array<T | null>} output - Array containing stdout/stderr values\n * @property {T} stdout - Standard output from the process\n * @property {T} stderr - Standard error from the process\n * @property {number | null} status - Exit code, or `null` if killed by signal\n * @property {NodeJS.Signals | null} signal - Signal that terminated the process, or `null`\n * @property {Error | undefined} error - Error object if the spawn failed\n */\nexport interface SpawnSyncReturns<T> {\n pid: number\n output: Array<T | null>\n stdout: T\n stderr: T\n status: number | null\n signal: NodeJS.Signals | null\n error?: Error | undefined\n}\n\n/**\n * Check if a value is a spawn error with expected error properties.\n * Tests for common error properties from child process failures.\n *\n * @param {unknown} value - Value to check\n * @returns {boolean} `true` if the value has spawn error properties\n *\n * @example\n * try {\n * await spawn('nonexistent-command')\n * } catch (error) {\n * if (isSpawnError(error)) {\n * console.error(`Spawn failed: ${error.code}`)\n * }\n * }\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function isSpawnError(value: unknown): value is SpawnError {\n if (value === null || typeof value !== 'object') {\n return false\n }\n // Check for spawn-specific error properties.\n const err = value as Record<string, unknown>\n return (\n (hasOwn(err, 'code') && typeof err['code'] !== 'undefined') ||\n (hasOwn(err, 'errno') && typeof err['errno'] !== 'undefined') ||\n (hasOwn(err, 'syscall') && typeof err['syscall'] === 'string')\n )\n}\n\n/**\n * Check if stdio configuration matches a specific type.\n * When called with one argument, validates if it's a valid stdio type.\n * When called with two arguments, checks if the stdio config matches the specified type.\n *\n * @param {string | string[]} stdio - Stdio configuration to check\n * @param {StdioType | undefined} type - Expected stdio type (optional)\n * @returns {boolean} `true` if stdio matches the type or is valid\n *\n * @example\n * // Check if valid stdio type\n * isStdioType('pipe') // true\n * isStdioType('invalid') // false\n *\n * @example\n * // Check if stdio matches specific type\n * isStdioType('pipe', 'pipe') // true\n * isStdioType(['pipe', 'pipe', 'pipe'], 'pipe') // true\n * isStdioType('ignore', 'pipe') // false\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function isStdioType(\n stdio: string | string[],\n type?: StdioType | undefined,\n): boolean {\n // If called with one argument, check if it's a valid stdio type.\n // biome-ignore lint/complexity/noArguments: Function overload detection for single vs two-arg calls.\n if (arguments.length === 1) {\n const validTypes = ['pipe', 'ignore', 'inherit', 'overlapped']\n return typeof stdio === 'string' && validTypes.includes(stdio)\n }\n // Original two-argument behavior.\n return (\n stdio === type ||\n ((stdio === null || stdio === undefined) && type === 'pipe') ||\n (isArray(stdio) &&\n stdio.length > 2 &&\n stdio[0] === type &&\n stdio[1] === type &&\n stdio[2] === type)\n )\n}\n\n/**\n * Strip ANSI escape codes from spawn result stdout and stderr.\n * Modifies the result object in place to remove color codes and formatting.\n *\n * @param {unknown} result - Spawn result object with stdout/stderr properties\n * @returns {unknown} The modified result object\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction stripAnsiFromSpawnResult(result: unknown): unknown {\n const res = result as {\n stdout?: string | Buffer\n stderr?: string | Buffer\n }\n const { stderr, stdout } = res\n if (typeof stdout === 'string') {\n res.stdout = stripAnsi(stdout)\n }\n if (typeof stderr === 'string') {\n res.stderr = stripAnsi(stderr)\n }\n return res\n}\n\n/*@__NO_SIDE_EFFECTS__*/\n// Duplicated from Node.js child_process.SpawnOptions\n// These are the options passed to child_process.spawn()\ninterface NodeSpawnOptions {\n cwd?: string | URL | undefined\n env?: NodeJS.ProcessEnv | undefined\n argv0?: string | undefined\n stdio?: any\n detached?: boolean | undefined\n uid?: number | undefined\n gid?: number | undefined\n serialization?: 'json' | 'advanced' | undefined\n shell?: boolean | string | undefined\n windowsVerbatimArguments?: boolean | undefined\n windowsHide?: boolean | undefined\n signal?: AbortSignal | undefined\n timeout?: number | undefined\n killSignal?: NodeJS.Signals | number | undefined\n}\n\n// Duplicated from Node.js child_process.ChildProcess\n// This represents a spawned child process\ninterface ChildProcessType {\n stdin: NodeJS.WritableStream | null\n stdout: NodeJS.ReadableStream | null\n stderr: NodeJS.ReadableStream | null\n readonly channel?: any\n readonly stdio: [\n NodeJS.WritableStream | null,\n NodeJS.ReadableStream | null,\n NodeJS.ReadableStream | null,\n NodeJS.ReadableStream | NodeJS.WritableStream | null | undefined,\n NodeJS.ReadableStream | NodeJS.WritableStream | null | undefined,\n ]\n readonly killed: boolean\n readonly pid?: number | undefined\n readonly connected: boolean\n readonly exitCode: number | null\n readonly signalCode: NodeJS.Signals | null\n readonly spawnargs: string[]\n readonly spawnfile: string\n kill(signal?: NodeJS.Signals | number): boolean\n send(message: any, callback?: (error: Error | null) => void): boolean\n send(\n message: any,\n sendHandle?: any | undefined,\n callback?: (error: Error | null) => void,\n ): boolean\n send(\n message: any,\n sendHandle?: any | undefined,\n options?: any | undefined,\n callback?: (error: Error | null) => void,\n ): boolean\n disconnect(): void\n unref(): void\n ref(): void\n}\n\n// Duplicated from Node.js stream.Writable\ninterface WritableStreamType {\n writable: boolean\n writableEnded: boolean\n writableFinished: boolean\n writableHighWaterMark: number\n writableLength: number\n writableObjectMode: boolean\n writableCorked: number\n destroyed: boolean\n write(\n chunk: any,\n encoding?: BufferEncoding | undefined,\n callback?: (error?: Error | null) => void,\n ): boolean\n write(chunk: any, callback?: (error?: Error | null) => void): boolean\n end(cb?: () => void): this\n end(chunk: any, cb?: () => void): this\n end(chunk: any, encoding?: BufferEncoding | undefined, cb?: () => void): this\n cork(): void\n uncork(): void\n destroy(error?: Error | undefined): this\n}\n\n/**\n * Options for spawning a child process with {@link spawn}.\n * Extends Node.js spawn options with additional Socket-specific functionality.\n *\n * @property {import('./spinner').Spinner | undefined} spinner - Spinner instance to pause during execution\n * @property {boolean | undefined} stdioString - Convert output to strings (default: `true`)\n * @property {boolean | undefined} stripAnsi - Remove ANSI codes from output (default: `true`)\n * @property {string | URL | undefined} cwd - Current working directory\n * @property {NodeJS.ProcessEnv | undefined} env - Environment variables\n * @property {StdioType | undefined} stdio - Stdio configuration\n * @property {boolean | string | undefined} shell - Run command in shell\n * @property {number | undefined} timeout - Timeout in milliseconds\n * @property {AbortSignal | undefined} signal - Abort signal\n * @property {number | undefined} uid - User identity (POSIX)\n * @property {number | undefined} gid - Group identity (POSIX)\n */\nexport type SpawnOptions = import('./objects').Remap<\n NodeSpawnOptions & {\n spinner?: import('./spinner').Spinner | undefined\n stdioString?: boolean\n stripAnsi?: boolean\n }\n>\nexport type SpawnResult = PromiseSpawnResult\n/**\n * Result object returned when a spawned process completes.\n *\n * @property {string} cmd - Command that was executed\n * @property {string[] | readonly string[]} args - Arguments passed to the command\n * @property {number} code - Process exit code\n * @property {NodeJS.Signals | null} signal - Signal that terminated the process, if any\n * @property {string | Buffer} stdout - Standard output (string if `stdioString: true`, Buffer otherwise)\n * @property {string | Buffer} stderr - Standard error (string if `stdioString: true`, Buffer otherwise)\n */\nexport type SpawnStdioResult = {\n cmd: string\n args: string[] | readonly string[]\n code: number\n signal: NodeJS.Signals | null\n stdout: string | Buffer\n stderr: string | Buffer\n}\n\n/**\n * Spawn a child process and return a promise that resolves when it completes.\n * Provides enhanced error handling, output capture, and cross-platform support.\n *\n * SECURITY: This function uses array-based arguments which prevent command injection.\n * Arguments in the `args` array are passed directly to the OS without shell\n * interpretation. Shell metacharacters (;|&$()`) are treated as literal strings,\n * not as commands or operators. This is the PRIMARY SECURITY DEFENSE.\n *\n * Even when shell: true is used (on Windows for .cmd/.bat execution), the array-based\n * approach remains secure because Node.js properly escapes each argument before passing\n * to the shell.\n *\n * @param {string} cmd - Command to execute (not user-controlled)\n * @param {string[] | readonly string[] | undefined} args - Array of arguments (safe even with user input)\n * @param {SpawnOptions | undefined} options - Spawn options for process configuration\n * @param {SpawnExtra | undefined} extra - Extra options for promise-spawn\n * @returns {SpawnResult} Promise that resolves with process exit information\n *\n * @throws {SpawnError} When the process exits with non-zero code or is terminated by signal\n *\n * @example\n * // Basic usage - spawn and wait for completion\n * const result = await spawn('git', ['status'])\n * console.log(result.stdout)\n *\n * @example\n * // With options - set working directory and environment\n * const result = await spawn('npm', ['install'], {\n * cwd: '/path/to/project',\n * env: { NODE_ENV: 'production' }\n * })\n *\n * @example\n * // \u2714 DO THIS - Array-based arguments (safe)\n * spawn('git', ['commit', '-m', userMessage])\n * // Each argument is properly escaped, even if userMessage = \"foo; rm -rf /\"\n *\n * @example\n * // \u2716 NEVER DO THIS - String concatenation (vulnerable)\n * spawn(`git commit -m \"${userMessage}\"`, { shell: true })\n * // Vulnerable to injection if userMessage = '\"; rm -rf / #'\n *\n * @example\n * // Access stdin for interactive processes\n * const result = spawn('cat', [])\n * result.stdin?.write('Hello\\n')\n * result.stdin?.end()\n * const { stdout } = await result\n * console.log(stdout) // 'Hello'\n *\n * @example\n * // Handle errors with exit codes\n * try {\n * await spawn('exit', ['1'])\n * } catch (error) {\n * if (isSpawnError(error)) {\n * console.error(`Failed with code ${error.code}`)\n * console.error(error.stderr)\n * }\n * }\n */\nexport function spawn(\n cmd: string,\n args?: string[] | readonly string[],\n options?: SpawnOptions | undefined,\n extra?: SpawnExtra | undefined,\n): SpawnResult {\n // Windows cmd.exe command resolution for .cmd/.bat/.ps1 files:\n //\n // When shell: true is used on Windows with script files (.cmd, .bat, .ps1),\n // cmd.exe can have issues executing full paths. The solution is to use just\n // the command basename without extension and let cmd.exe find it via PATH.\n //\n // How cmd.exe resolves commands:\n // 1. Searches current directory first\n // 2. Then searches each directory in PATH environment variable\n // 3. For each directory, tries extensions from PATHEXT (.COM, .EXE, .BAT, .CMD, etc.)\n // 4. Executes the first match found\n //\n // Example: Given 'C:\\pnpm\\pnpm.cmd' with shell: true\n // 1. Extract basename without extension: 'pnpm'\n // 2. cmd.exe searches PATH directories for 'pnpm'\n // 3. PATHEXT causes it to try 'pnpm.com', 'pnpm.exe', 'pnpm.bat', 'pnpm.cmd', etc.\n // 4. Finds and executes 'C:\\pnpm\\pnpm.cmd'\n //\n // This approach is consistent with how other tools handle Windows execution:\n // - npm's promise-spawn: uses which.sync() to find commands in PATH\n // - cross-spawn: spawns cmd.exe with escaped arguments\n // - execa: uses cross-spawn under the hood for Windows support\n //\n // See: https://github.com/nodejs/node/issues/3675\n const shell = getOwn(options, 'shell')\n // Inline WIN32 constant for coverage mode compatibility\n const WIN32 = process.platform === 'win32'\n let actualCmd = cmd\n if (WIN32 && shell && windowsScriptExtRegExp.test(actualCmd)) {\n const path = getPath()\n // Extract just the command name without path and extension.\n actualCmd = path.basename(actualCmd, path.extname(actualCmd))\n }\n const {\n spinner: optionsSpinner = spinner,\n stripAnsi: shouldStripAnsi = true,\n ...spawnOptions\n } = { __proto__: null, ...options } as SpawnOptions\n const spinnerInstance = optionsSpinner\n const { env, stdio, stdioString = true } = spawnOptions\n // The stdio option can be a string or an array.\n // https://nodejs.org/api/child_process.html#optionsstdio\n const wasSpinning = !!spinnerInstance?.isSpinning\n const shouldStopSpinner =\n wasSpinning && !isStdioType(stdio, 'ignore') && !isStdioType(stdio, 'pipe')\n const shouldRestartSpinner = shouldStopSpinner\n if (shouldStopSpinner) {\n spinnerInstance.stop()\n }\n const npmCliPromiseSpawn = getNpmcliPromiseSpawn()\n // Use __proto__: null to prevent prototype pollution when passing to\n // third-party code, Node.js built-ins, or JavaScript built-in methods.\n // https://github.com/npm/promise-spawn\n // https://github.com/nodejs/node/blob/v24.0.1/lib/child_process.js#L674-L678\n // Preserve Windows process.env Proxy behavior when no custom env is provided.\n // On Windows, process.env is a Proxy that provides case-insensitive access\n // (PATH vs Path vs path). Spreading creates a plain object that loses this.\n // Only spread when we have custom environment variables to merge.\n const envToUse = env\n ? ({\n __proto__: null,\n ...process.env,\n ...env,\n } as unknown as NodeJS.ProcessEnv)\n : process.env\n\n const promiseSpawnOpts = {\n __proto__: null,\n cwd: typeof spawnOptions.cwd === 'string' ? spawnOptions.cwd : undefined,\n env: envToUse,\n signal: abortSignal,\n stdio: spawnOptions.stdio,\n stdioString,\n shell: spawnOptions.shell,\n timeout: spawnOptions.timeout,\n uid: spawnOptions.uid,\n gid: spawnOptions.gid,\n } as unknown as PromiseSpawnOptions\n const spawnPromise = npmCliPromiseSpawn(\n actualCmd,\n args ? [...args] : [],\n promiseSpawnOpts as Parameters<typeof npmCliPromiseSpawn>[2],\n extra,\n )\n const oldSpawnPromise = spawnPromise\n let newSpawnPromise: PromiseSpawnResult\n if (shouldStripAnsi && stdioString) {\n newSpawnPromise = spawnPromise\n .then(result => {\n const strippedResult = stripAnsiFromSpawnResult(result)\n // Add exitCode as an alias for code.\n if ('code' in (strippedResult as { code?: number })) {\n ;(strippedResult as { code: number; exitCode: number }).exitCode = (\n strippedResult as { code: number }\n ).code\n }\n return strippedResult\n })\n .catch(error => {\n throw stripAnsiFromSpawnResult(error)\n }) as PromiseSpawnResult\n } else {\n newSpawnPromise = spawnPromise.then(result => {\n // Add exitCode as an alias for code.\n if ('code' in result) {\n const res = result as typeof result & { exitCode: number }\n res.exitCode = result.code\n return res\n }\n return result\n }) as PromiseSpawnResult\n }\n if (shouldRestartSpinner) {\n newSpawnPromise = newSpawnPromise.finally(() => {\n spinnerInstance.start()\n }) as PromiseSpawnResult\n }\n // Copy process and stdin properties from original promise\n ;(newSpawnPromise as unknown as PromiseSpawnResult).process =\n oldSpawnPromise.process\n ;(newSpawnPromise as unknown as PromiseSpawnResult).stdin = (\n oldSpawnPromise as unknown as PromiseSpawnResult\n ).stdin\n return newSpawnPromise as SpawnResult\n}\n\n/*@__NO_SIDE_EFFECTS__*/\n/**\n * Options for synchronously spawning a child process with {@link spawnSync}.\n * Same as {@link SpawnOptions} but excludes the `spinner` property (not applicable for synchronous execution).\n */\nexport type SpawnSyncOptions = Omit<SpawnOptions, 'spinner'>\n\n/**\n * Synchronously spawn a child process and wait for it to complete.\n * Blocks execution until the process exits, returning all output and exit information.\n *\n * WARNING: This function blocks the event loop. Use {@link spawn} for async operations.\n *\n * @param {string} cmd - Command to execute\n * @param {string[] | readonly string[] | undefined} args - Array of arguments\n * @param {SpawnSyncOptions | undefined} options - Spawn options for process configuration\n * @returns {SpawnSyncReturns<string | Buffer>} Process result with exit code and captured output\n *\n * @example\n * // Basic synchronous spawn\n * const result = spawnSync('git', ['status'])\n * console.log(result.stdout)\n * console.log(result.status) // exit code\n *\n * @example\n * // With options\n * const result = spawnSync('npm', ['install'], {\n * cwd: '/path/to/project',\n * stdioString: true\n * })\n * if (result.status !== 0) {\n * console.error(result.stderr)\n * }\n *\n * @example\n * // Get raw buffer output\n * const result = spawnSync('cat', ['binary-file'], {\n * stdioString: false\n * })\n * console.log(result.stdout) // Buffer\n *\n * @example\n * // Handle process errors\n * const result = spawnSync('nonexistent-command')\n * if (result.error) {\n * console.error('Failed to spawn:', result.error)\n * }\n */\nexport function spawnSync(\n cmd: string,\n args?: string[] | readonly string[],\n options?: SpawnSyncOptions | undefined,\n): SpawnSyncReturns<string | Buffer> {\n // Windows cmd.exe command resolution for .cmd/.bat/.ps1 files:\n // See spawn() function above for detailed explanation of this approach.\n const shell = getOwn(options, 'shell')\n // Inline WIN32 constant for coverage mode compatibility\n const WIN32 = process.platform === 'win32'\n let actualCmd = cmd\n if (WIN32 && shell && windowsScriptExtRegExp.test(actualCmd)) {\n const path = getPath()\n // Extract just the command name without path and extension.\n actualCmd = path.basename(actualCmd, path.extname(actualCmd))\n }\n const { stripAnsi: shouldStripAnsi = true, ...rawSpawnOptions } = {\n __proto__: null,\n ...options,\n } as SpawnSyncOptions\n const { stdioString: rawStdioString = true } = rawSpawnOptions\n const rawEncoding = rawStdioString ? 'utf8' : 'buffer'\n const spawnOptions = {\n encoding: rawEncoding,\n ...rawSpawnOptions,\n } as NodeSpawnOptions & { encoding: BufferEncoding | 'buffer' }\n const stdioString = spawnOptions.encoding !== 'buffer'\n const result = getChildProcess().spawnSync(actualCmd, args, spawnOptions)\n if (stdioString) {\n const { stderr, stdout } = result\n if (stdout) {\n result.stdout = stdout.toString().trim()\n }\n if (stderr) {\n result.stderr = stderr.toString().trim()\n }\n }\n return (\n shouldStripAnsi && stdioString ? stripAnsiFromSpawnResult(result) : result\n ) as SpawnSyncReturns<string | Buffer>\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BA,qBAA2C;AAE3C,oBAAwB;AAKxB,qBAA+B;AAC/B,qBAA0B;AAJ1B,MAAM,kBAAc,+BAAe;AACnC,MAAM,cAAU,2BAAW;AAQ3B,MAAM,yBAAyB;AAE/B,IAAI;AAAA;AAWJ,SAAS,kBAAkB;AACzB,MAAI,mBAAmB,QAAW;AAGhC,qBAA+B,QAAQ,oBAAoB;AAAA,EAC7D;AACA,SAAO;AACT;AAqDA,IAAI;AAAA;AAkBJ,SAAS,wBAAwB;AAC/B,MAAI,wBAAwB,QAAW;AACrC,0BAAoC,QAAQ,kCAAkC;AAAA,EAChF;AACA,SAAO;AACT;AAEA,IAAI;AAAA;AAWJ,SAAS,UAAU;AACjB,MAAI,UAAU,QAAW;AAGvB,YAAsB,QAAQ,WAAW;AAAA,EAC3C;AACA,SAAO;AACT;AAAA;AAoIO,SAAS,aAAa,OAAqC;AAChE,MAAI,UAAU,QAAQ,OAAO,UAAU,UAAU;AAC/C,WAAO;AAAA,EACT;AAEA,QAAM,MAAM;AACZ,aACG,uBAAO,KAAK,MAAM,KAAK,OAAO,IAAI,MAAM,MAAM,mBAC9C,uBAAO,KAAK,OAAO,KAAK,OAAO,IAAI,OAAO,MAAM,mBAChD,uBAAO,KAAK,SAAS,KAAK,OAAO,IAAI,SAAS,MAAM;AAEzD;AAAA;AAuBO,SAAS,YACd,OACA,MACS;AAGT,MAAI,UAAU,WAAW,GAAG;AA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