diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 3c6ed771..5968aca8 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -672,9 +672,9 @@ } }, "node_modules/adm-zip": { - "version": "0.5.13", - "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.13.tgz", - "integrity": "sha512-4U51tTl9J8UVEcuKGr6zRzY95tWoAa9l+ureGBNmsfleszjZblm5NyEEL/ZQxkhi86co5mZhSvL2T7gkZ6feYQ==", + "version": "0.5.14", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.14.tgz", + "integrity": "sha512-DnyqqifT4Jrcvb8USYjp6FHtBpEIz1mnXu6pTRHZ0RL69LbQYiO+0lDFg5+OKA7U29oWSs3a/i8fhn8ZcceIWg==", "engines": { "node": ">=12.0" } @@ -1100,9 +1100,9 @@ } }, "node_modules/foreground-child": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", - "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.0.tgz", + "integrity": "sha512-CrWQNaEl1/6WeZoarcM9LHupTo3RpZO2Pdk1vktwzPiQTsJnAKJmm3TACKeG5UZbWDfaH2AbvYxzP96y0MT7fA==", "dependencies": { "cross-spawn": "^7.0.0", "signal-exit": "^4.0.1" @@ -1241,9 +1241,9 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, "node_modules/jackspeak": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.2.3.tgz", - "integrity": "sha512-htOzIMPbpLid/Gq9/zaz9SfExABxqRe1sSCdxntlO/aMD6u0issZQiY25n2GKQUtJ02j7z5sfptlAOMpWWOmvw==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.0.tgz", + "integrity": "sha512-JVYhQnN59LVPFCEcVa2C3CrEKYacvjRfqIQl+h8oi91aLYQVWRYbxjPcv1bUiUy/kLmQaANrYfNMCO3kuEDHfw==", "dependencies": { "@isaacs/cliui": "^8.0.2" }, @@ -1726,9 +1726,9 @@ } }, "node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" }, "node_modules/tunnel": { "version": "0.0.6", diff --git a/node_modules/adm-zip/methods/inflater.js b/node_modules/adm-zip/methods/inflater.js index 17c7ee1f..8769e66e 100644 --- a/node_modules/adm-zip/methods/inflater.js +++ b/node_modules/adm-zip/methods/inflater.js @@ -2,7 +2,7 @@ const version = +(process.versions ? process.versions.node : "").split(".")[0] | module.exports = function (/*Buffer*/ inbuf, /*number*/ expectedLength) { var zlib = require("zlib"); - const option = version >= 15 ? { maxOutputLength: expectedLength } : {}; + const option = version >= 15 && expectedLength > 0 ? { maxOutputLength: expectedLength } : {}; return { inflate: function () { diff --git a/node_modules/adm-zip/package.json b/node_modules/adm-zip/package.json index 5d613ee3..5ed72c29 100644 --- a/node_modules/adm-zip/package.json +++ b/node_modules/adm-zip/package.json @@ -1,6 +1,6 @@ { "name": "adm-zip", - "version": "0.5.13", + "version": "0.5.14", "description": "Javascript implementation of zip for nodejs with support for electron original-fs. Allows user to create or extract zip files both in memory or to/from disk", "scripts": { "test": "mocha -R spec", diff --git a/node_modules/foreground-child/README.md b/node_modules/foreground-child/README.md index 3683298b..477ca571 100644 --- a/node_modules/foreground-child/README.md +++ b/node_modules/foreground-child/README.md @@ -88,3 +88,41 @@ status code rather than reporting the signal properly. This module tries to do the right thing, but on Windows systems, you may see that incorrect result. There is as far as I'm aware no workaround for this. + +## util: `foreground-child/proxy-signals` + +If you just want to proxy the signals to a child process that the +main process receives, you can use the `proxy-signals` export +from this package. + +```js +import { proxySignals } from 'foreground-child/proxy-signals' + +const childProcess = spawn('command', ['some', 'args']) +proxySignals(childProcess) +``` + +Now, any fatal signal received by the current process will be +proxied to the child process. + +It doesn't go in the other direction; ie, signals sent to the +child process will not affect the parent. For that, listen to the +child `exit` or `close` events, and handle them appropriately. + +## util: `foreground-child/watchdog` + +If you are spawning a child process, and want to ensure that it +isn't left dangling if the parent process exits, you can use the +watchdog utility exported by this module. + +```js +import { watchdog } from 'foreground-child/watchdog' + +const childProcess = spawn('command', ['some', 'args']) +const watchdogProcess = watchdog(childProcess) + +// watchdogProcess is a reference to the process monitoring the +// parent and child. There's usually no reason to do anything +// with it, as it's silent and will terminate +// automatically when it's no longer needed. +``` diff --git a/node_modules/foreground-child/dist/cjs/index.d.ts.map b/node_modules/foreground-child/dist/cjs/index.d.ts.map deleted file mode 100644 index a5dfb5da..00000000 --- a/node_modules/foreground-child/dist/cjs/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,YAAY,EAIZ,YAAY,EACb,MAAM,eAAe,CAAA;AAUtB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,OAAO,GAAG,CACpB,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC,OAAO,KAE3B,IAAI,GACJ,SAAS,GACT,MAA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AAM,EACf,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,SAAS,CAAC,EAAE,YAAY,EACxB,OAAO,CAAC,EAAE,OAAO,GAChB,YAAY,CAAA"} \ No newline at end of file diff --git a/node_modules/foreground-child/dist/cjs/index.js.map b/node_modules/foreground-child/dist/cjs/index.js.map deleted file mode 100644 index 15a25531..00000000 --- a/node_modules/foreground-child/dist/cjs/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,iDAMsB;AACtB,8DAAoC;AACpC,6CAAoC;AACpC,qDAA6C;AAC7C,+CAAwC;AAExC,qBAAqB;AACrB,MAAM,KAAK,GAAG,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,qBAAU,CAAC,CAAC,CAAC,qBAAS,CAAA;AA+CpE;;;;;;GAMG;AACI,MAAM,eAAe,GAAG,CAC7B,MAAc,EAMd,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC,GAAG,MAAM,CAAA;IACrE,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;QAC9B,OAAO,GAAG,IAAI,CAAA;QACd,SAAS,GAAG,EAAE,CAAA;QACd,IAAI,GAAG,EAAE,CAAA;KACV;SAAM,IAAI,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACrE,IAAI,OAAO,SAAS,KAAK,UAAU;YAAE,OAAO,GAAG,SAAS,CAAA;QACxD,SAAS,GAAG,IAAI,CAAA;QAChB,IAAI,GAAG,EAAE,CAAA;KACV;SAAM,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE;QAC1C,OAAO,GAAG,SAAS,CAAA;QACnB,SAAS,GAAG,EAAE,CAA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CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU,CAAA","sourcesContent":["import {\n ChildProcess,\n SendHandle,\n Serializable,\n spawn as nodeSpawn,\n SpawnOptions,\n} from 'child_process'\nimport crossSpawn from 'cross-spawn'\nimport { onExit } from 'signal-exit'\nimport { allSignals } from './all-signals.js'\nimport { watchdog } from './watchdog.js'\n\n/* c8 ignore start */\nconst spawn = process?.platform === 'win32' ? crossSpawn : nodeSpawn\n/* c8 ignore stop */\n\n/**\n * The signature for the cleanup method.\n *\n * Arguments indicate the exit status of the child process.\n *\n * If a Promise is returned, then the process is not terminated\n * until it resolves, and the resolution value is treated as the\n * exit status (if a number) or signal exit (if a signal string).\n *\n * If `undefined` is returned, then no change is made, and the parent\n * exits in the same way that the child exited.\n *\n * If boolean `false` is returned, then the parent's exit is canceled.\n *\n * If a number is returned, then the parent process exits with the number\n * as its exitCode.\n *\n * If a signal string is returned, then the parent process is killed with\n * the same signal that caused the child to exit.\n */\nexport type Cleanup = (\n code: number | null,\n signal: null | NodeJS.Signals\n) =>\n | void\n | undefined\n | number\n | NodeJS.Signals\n | false\n | Promise\n\nexport type FgArgs =\n | [program: string | string[], cleanup?: Cleanup]\n | [program: string[], opts?: SpawnOptions, cleanup?: Cleanup]\n | [program: string, cleanup?: Cleanup]\n | [program: string, opts?: SpawnOptions, cleanup?: Cleanup]\n | [program: string, args?: string[], cleanup?: Cleanup]\n | [\n program: string,\n args?: string[],\n opts?: SpawnOptions,\n cleanup?: Cleanup\n ]\n\n/**\n * Normalizes the arguments passed to `foregroundChild`.\n *\n * Exposed for testing.\n *\n * @internal\n */\nexport const normalizeFgArgs = (\n fgArgs: FgArgs\n): [\n program: string,\n args: string[],\n spawnOpts: SpawnOptions,\n cleanup: Cleanup\n] => {\n let [program, args = [], spawnOpts = {}, cleanup = () => {}] = fgArgs\n if (typeof args === 'function') {\n cleanup = args\n spawnOpts = {}\n args = []\n } else if (!!args && typeof args === 'object' && !Array.isArray(args)) {\n if (typeof spawnOpts === 'function') cleanup = spawnOpts\n spawnOpts = args\n args = []\n } else if (typeof spawnOpts === 'function') {\n cleanup = spawnOpts\n spawnOpts = {}\n }\n if (Array.isArray(program)) {\n const [pp, ...pa] = program\n program = pp\n args = pa\n }\n return [program, args, { ...spawnOpts }, cleanup]\n}\n\n/**\n * Spawn the specified program as a \"foreground\" process, or at least as\n * close as is possible given node's lack of exec-without-fork.\n *\n * Cleanup method may be used to modify or ignore the result of the child's\n * exit code or signal. If cleanup returns undefined (or a Promise that\n * resolves to undefined), then the parent will exit in the same way that\n * the child did.\n *\n * Return boolean `false` to prevent the parent's exit entirely.\n */\nexport function foregroundChild(\n cmd: string | string[],\n cleanup?: Cleanup\n): ChildProcess\nexport function foregroundChild(\n program: string,\n args?: string[],\n cleanup?: Cleanup\n): ChildProcess\nexport function foregroundChild(\n program: string,\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup\n): ChildProcess\nexport function foregroundChild(\n program: string,\n args?: string[],\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup\n): ChildProcess\nexport function foregroundChild(...fgArgs: FgArgs): ChildProcess {\n const [program, args, spawnOpts, cleanup] = normalizeFgArgs(fgArgs)\n\n spawnOpts.stdio = [0, 1, 2]\n if (process.send) {\n spawnOpts.stdio.push('ipc')\n }\n\n const child = spawn(program, args, spawnOpts)\n\n const unproxySignals = proxySignals(child)\n const childHangup = () => {\n try {\n child.kill('SIGHUP')\n\n /* c8 ignore start */\n } catch (_) {\n // SIGHUP is weird on windows\n child.kill('SIGTERM')\n }\n /* c8 ignore stop */\n }\n const removeOnExit = onExit(childHangup)\n\n const dog = watchdog(child)\n\n let done = false\n child.on('close', async (code, signal) => {\n dog.kill('SIGKILL')\n /* c8 ignore start */\n if (done) {\n return\n }\n /* c8 ignore stop */\n done = true\n const result = cleanup(code, signal)\n const res = isPromise(result) ? await result : result\n removeOnExit()\n unproxySignals()\n\n if (res === false) return\n else if (typeof res === 'string') {\n signal = res\n code = null\n } else if (typeof res === 'number') {\n code = res\n signal = null\n }\n\n if (signal) {\n // If there is nothing else keeping the event loop alive,\n // then there's a race between a graceful exit and getting\n // the signal to this process. Put this timeout here to\n // make sure we're still alive to get the signal, and thus\n // exit with the intended signal code.\n /* istanbul ignore next */\n setTimeout(() => {}, 2000)\n try {\n process.kill(process.pid, signal)\n /* c8 ignore start */\n } catch (_) {\n process.kill(process.pid, 'SIGTERM')\n }\n /* c8 ignore stop */\n } else {\n process.exit(code || 0)\n }\n })\n\n if (process.send) {\n process.removeAllListeners('message')\n\n child.on('message', (message, sendHandle) => {\n process.send?.(message, sendHandle)\n })\n\n process.on('message', (message, sendHandle) => {\n child.send(\n message as Serializable,\n sendHandle as SendHandle | undefined\n )\n })\n }\n\n return child\n}\n\n/**\n * Starts forwarding signals to `child` through `parent`.\n */\nconst proxySignals = (child: ChildProcess) => {\n const listeners = new Map()\n\n for (const sig of allSignals) {\n const listener = () => {\n // some signals can only be received, not sent\n try {\n child.kill(sig)\n /* c8 ignore start */\n } catch (_) {}\n /* c8 ignore stop */\n }\n try {\n // if it's a signal this system doesn't recognize, skip it\n process.on(sig, listener)\n listeners.set(sig, listener)\n /* c8 ignore start */\n } catch (_) {}\n /* c8 ignore stop */\n }\n\n return () => {\n for (const [sig, listener] of listeners) {\n process.removeListener(sig, listener)\n }\n }\n}\n\nconst isPromise = (o: any): o is Promise =>\n !!o && typeof o === 'object' && typeof o.then === 'function'\n"]} \ No newline at end of file diff --git a/node_modules/foreground-child/dist/cjs/watchdog.d.ts b/node_modules/foreground-child/dist/cjs/watchdog.d.ts deleted file mode 100644 index ad552b14..00000000 --- a/node_modules/foreground-child/dist/cjs/watchdog.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -/// -import { ChildProcess } from 'child_process'; -export declare const watchdog: (child: ChildProcess) => ChildProcess; -//# sourceMappingURL=watchdog.d.ts.map \ No newline at end of file diff --git a/node_modules/foreground-child/dist/cjs/watchdog.js.map b/node_modules/foreground-child/dist/cjs/watchdog.js.map deleted file mode 100644 index c8d89ab6..00000000 --- a/node_modules/foreground-child/dist/cjs/watchdog.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"watchdog.js","sourceRoot":"","sources":["../../src/watchdog.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,gEAAgE;AAChE,uCAAuC;;;AAEvC,iDAAmD;AAEnD,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;CAqB9B,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,KAAmB,EAAE,EAAE;IAC9C,IAAI,SAAS,GAAG,KAAK,CAAA;IACrB,MAAM,GAAG,GAAG,IAAA,qBAAK,EACf,OAAO,CAAC,QAAQ,EAChB,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EACvC;QACE,KAAK,EAAE,QAAQ;KAChB,CACF,CAAA;IACD,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,CAAA;IACxC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;QACpB,IAAI,CAAC,SAAS;YAAE,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;IACF,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAdY,QAAA,QAAQ,YAcpB","sourcesContent":["// this spawns a child process that listens for SIGHUP when the\n// parent process exits, and after 200ms, sends a SIGKILL to the\n// child, in case it did not terminate.\n\nimport { ChildProcess, spawn } from 'child_process'\n\nconst watchdogCode = String.raw`\nconst pid = parseInt(process.argv[1], 10)\nprocess.title = 'node (foreground-child watchdog pid=' + pid + ')'\nif (!isNaN(pid)) {\n let barked = false\n // keepalive\n const interval = setInterval(() => {}, 60000)\n const bark = () => {\n clearInterval(interval)\n if (barked) return\n barked = true\n process.removeListener('SIGHUP', bark)\n setTimeout(() => {\n try {\n process.kill(pid, 'SIGKILL')\n setTimeout(() => process.exit(), 200)\n } catch (_) {}\n }, 500)\n })\n process.on('SIGHUP', bark)\n}\n`\n\nexport const watchdog = (child: ChildProcess) => {\n let dogExited = false\n const dog = spawn(\n process.execPath,\n ['-e', watchdogCode, String(child.pid)],\n {\n stdio: 'ignore',\n }\n )\n dog.on('exit', () => (dogExited = true))\n child.on('exit', () => {\n if (!dogExited) dog.kill('SIGTERM')\n })\n return dog\n}\n"]} \ No newline at end of file diff --git a/node_modules/foreground-child/dist/cjs/all-signals.d.ts b/node_modules/foreground-child/dist/commonjs/all-signals.d.ts similarity index 100% rename from node_modules/foreground-child/dist/cjs/all-signals.d.ts rename to node_modules/foreground-child/dist/commonjs/all-signals.d.ts diff --git a/node_modules/foreground-child/dist/cjs/all-signals.d.ts.map b/node_modules/foreground-child/dist/commonjs/all-signals.d.ts.map similarity index 100% rename from node_modules/foreground-child/dist/cjs/all-signals.d.ts.map rename to node_modules/foreground-child/dist/commonjs/all-signals.d.ts.map diff --git a/node_modules/foreground-child/dist/cjs/all-signals.js b/node_modules/foreground-child/dist/commonjs/all-signals.js similarity index 100% rename from node_modules/foreground-child/dist/cjs/all-signals.js rename to node_modules/foreground-child/dist/commonjs/all-signals.js diff --git a/node_modules/foreground-child/dist/cjs/all-signals.js.map b/node_modules/foreground-child/dist/commonjs/all-signals.js.map similarity index 57% rename from node_modules/foreground-child/dist/cjs/all-signals.js.map rename to node_modules/foreground-child/dist/commonjs/all-signals.js.map index 3daeace7..51c056d7 100644 --- a/node_modules/foreground-child/dist/cjs/all-signals.js.map +++ b/node_modules/foreground-child/dist/commonjs/all-signals.js.map @@ -1 +1 @@ -{"version":3,"file":"all-signals.js","sourceRoot":"","sources":["../../src/all-signals.ts"],"names":[],"mappings":";;;;;;AAAA,oEAAsC;AACzB,QAAA,UAAU;AACrB,0EAA0E;AAC1E,MAAM,CAAC,IAAI,CAAC,wBAAS,CAAC,CAAC,MAAM,CAC3B,CAAC,CAAC,EAAE,CACF,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;IACnB,iDAAiD;IACjD,CAAC,KAAK,SAAS;IACf,yDAAyD;IACzD,CAAC,KAAK,SAAS,CACE,CAAA;AAEvB,8DAA8D;AAC9D,gEAAgE;AAChE,6DAA6D;AAC7D,gCAAgC;AAChC,EAAE;AACF,YAAY;AACZ,aAAa;AACb,aAAa;AACb,cAAc;AACd,gBAAgB;AAChB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,cAAc;AACd,gBAAgB;AAChB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,eAAe;AACf,eAAe","sourcesContent":["import constants from 'node:constants'\nexport const allSignals =\n // this is the full list of signals that Node will let us do anything with\n Object.keys(constants).filter(\n k =>\n k.startsWith('SIG') &&\n // https://github.com/tapjs/signal-exit/issues/21\n k !== 'SIGPROF' &&\n // no sense trying to listen for SIGKILL, it's impossible\n k !== 'SIGKILL'\n ) as NodeJS.Signals[]\n\n// These are some obscure signals that are reported by kill -l\n// on macOS, Linux, or Windows, but which don't have any mapping\n// in Node.js. No sense trying if they're just going to throw\n// every time on every platform.\n//\n// 'SIGEMT',\n// 'SIGLOST',\n// 'SIGPOLL',\n// 'SIGRTMAX',\n// 'SIGRTMAX-1',\n// 'SIGRTMAX-10',\n// 'SIGRTMAX-11',\n// 'SIGRTMAX-12',\n// 'SIGRTMAX-13',\n// 'SIGRTMAX-14',\n// 'SIGRTMAX-15',\n// 'SIGRTMAX-2',\n// 'SIGRTMAX-3',\n// 'SIGRTMAX-4',\n// 'SIGRTMAX-5',\n// 'SIGRTMAX-6',\n// 'SIGRTMAX-7',\n// 'SIGRTMAX-8',\n// 'SIGRTMAX-9',\n// 'SIGRTMIN',\n// 'SIGRTMIN+1',\n// 'SIGRTMIN+10',\n// 'SIGRTMIN+11',\n// 'SIGRTMIN+12',\n// 'SIGRTMIN+13',\n// 'SIGRTMIN+14',\n// 'SIGRTMIN+15',\n// 'SIGRTMIN+16',\n// 'SIGRTMIN+2',\n// 'SIGRTMIN+3',\n// 'SIGRTMIN+4',\n// 'SIGRTMIN+5',\n// 'SIGRTMIN+6',\n// 'SIGRTMIN+7',\n// 'SIGRTMIN+8',\n// 'SIGRTMIN+9',\n// 'SIGSTKFLT',\n// 'SIGUNUSED',\n"]} \ No newline at end of file +{"version":3,"file":"all-signals.js","sourceRoot":"","sources":["../../src/all-signals.ts"],"names":[],"mappings":";;;;;;AAAA,oEAAsC;AACzB,QAAA,UAAU;AACrB,0EAA0E;AAC1E,MAAM,CAAC,IAAI,CAAC,wBAAS,CAAC,CAAC,MAAM,CAC3B,CAAC,CAAC,EAAE,CACF,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;IACnB,iDAAiD;IACjD,CAAC,KAAK,SAAS;IACf,yDAAyD;IACzD,CAAC,KAAK,SAAS,CACE,CAAA;AAEvB,8DAA8D;AAC9D,gEAAgE;AAChE,6DAA6D;AAC7D,gCAAgC;AAChC,EAAE;AACF,YAAY;AACZ,aAAa;AACb,aAAa;AACb,cAAc;AACd,gBAAgB;AAChB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,cAAc;AACd,gBAAgB;AAChB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,eAAe;AACf,eAAe","sourcesContent":["import constants from 'node:constants'\nexport const allSignals =\n // this is the full list of signals that Node will let us do anything with\n Object.keys(constants).filter(\n k =>\n k.startsWith('SIG') &&\n // https://github.com/tapjs/signal-exit/issues/21\n k !== 'SIGPROF' &&\n // no sense trying to listen for SIGKILL, it's impossible\n k !== 'SIGKILL',\n ) as NodeJS.Signals[]\n\n// These are some obscure signals that are reported by kill -l\n// on macOS, Linux, or Windows, but which don't have any mapping\n// in Node.js. No sense trying if they're just going to throw\n// every time on every platform.\n//\n// 'SIGEMT',\n// 'SIGLOST',\n// 'SIGPOLL',\n// 'SIGRTMAX',\n// 'SIGRTMAX-1',\n// 'SIGRTMAX-10',\n// 'SIGRTMAX-11',\n// 'SIGRTMAX-12',\n// 'SIGRTMAX-13',\n// 'SIGRTMAX-14',\n// 'SIGRTMAX-15',\n// 'SIGRTMAX-2',\n// 'SIGRTMAX-3',\n// 'SIGRTMAX-4',\n// 'SIGRTMAX-5',\n// 'SIGRTMAX-6',\n// 'SIGRTMAX-7',\n// 'SIGRTMAX-8',\n// 'SIGRTMAX-9',\n// 'SIGRTMIN',\n// 'SIGRTMIN+1',\n// 'SIGRTMIN+10',\n// 'SIGRTMIN+11',\n// 'SIGRTMIN+12',\n// 'SIGRTMIN+13',\n// 'SIGRTMIN+14',\n// 'SIGRTMIN+15',\n// 'SIGRTMIN+16',\n// 'SIGRTMIN+2',\n// 'SIGRTMIN+3',\n// 'SIGRTMIN+4',\n// 'SIGRTMIN+5',\n// 'SIGRTMIN+6',\n// 'SIGRTMIN+7',\n// 'SIGRTMIN+8',\n// 'SIGRTMIN+9',\n// 'SIGSTKFLT',\n// 'SIGUNUSED',\n"]} \ No newline at end of file diff --git a/node_modules/foreground-child/dist/mjs/index.d.ts b/node_modules/foreground-child/dist/commonjs/index.d.ts similarity index 76% rename from node_modules/foreground-child/dist/mjs/index.d.ts rename to node_modules/foreground-child/dist/commonjs/index.d.ts index 24d67891..4883ca87 100644 --- a/node_modules/foreground-child/dist/mjs/index.d.ts +++ b/node_modules/foreground-child/dist/commonjs/index.d.ts @@ -22,7 +22,11 @@ import { ChildProcess, SpawnOptions } from 'child_process'; * the same signal that caused the child to exit. */ export type Cleanup = (code: number | null, signal: null | NodeJS.Signals) => void | undefined | number | NodeJS.Signals | false | Promise; -export type FgArgs = [program: string | string[], cleanup?: Cleanup] | [program: string[], opts?: SpawnOptions, cleanup?: Cleanup] | [program: string, cleanup?: Cleanup] | [program: string, opts?: SpawnOptions, cleanup?: Cleanup] | [program: string, args?: string[], cleanup?: Cleanup] | [ +export type FgArgs = [program: string | [cmd: string, ...args: string[]], cleanup?: Cleanup] | [ + program: [cmd: string, ...args: string[]], + opts?: SpawnOptions, + cleanup?: Cleanup +] | [program: string, cleanup?: Cleanup] | [program: string, opts?: SpawnOptions, cleanup?: Cleanup] | [program: string, args?: string[], cleanup?: Cleanup] | [ program: string, args?: string[], opts?: SpawnOptions, @@ -35,7 +39,12 @@ export type FgArgs = [program: string | string[], cleanup?: Cleanup] | [program: * * @internal */ -export declare const normalizeFgArgs: (fgArgs: FgArgs) => [program: string, args: string[], spawnOpts: SpawnOptions, cleanup: Cleanup]; +export declare const normalizeFgArgs: (fgArgs: FgArgs) => [ + program: string, + args: string[], + spawnOpts: SpawnOptions, + cleanup: Cleanup +]; /** * Spawn the specified program as a "foreground" process, or at least as * close as is possible given node's lack of exec-without-fork. @@ -47,7 +56,7 @@ export declare const normalizeFgArgs: (fgArgs: FgArgs) => [program: string, args * * Return boolean `false` to prevent the parent's exit entirely. */ -export declare function foregroundChild(cmd: string | string[], cleanup?: Cleanup): ChildProcess; +export declare function foregroundChild(cmd: string | [cmd: string, ...args: string[]], cleanup?: Cleanup): ChildProcess; export declare function foregroundChild(program: string, args?: string[], cleanup?: Cleanup): ChildProcess; export declare function foregroundChild(program: string, spawnOpts?: SpawnOptions, cleanup?: Cleanup): ChildProcess; export declare function foregroundChild(program: string, args?: string[], spawnOpts?: SpawnOptions, cleanup?: Cleanup): ChildProcess; diff --git a/node_modules/foreground-child/dist/commonjs/index.d.ts.map b/node_modules/foreground-child/dist/commonjs/index.d.ts.map new file mode 100644 index 00000000..dff7f0a2 --- /dev/null +++ b/node_modules/foreground-child/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,YAAY,EAIZ,YAAY,EACb,MAAM,eAAe,CAAA;AAUtB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,OAAO,GAAG,CACpB,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC,OAAO,KAE3B,IAAI,GACJ,SAAS,GACT,MAAM,GACN,MAAM,CAAC,OAAO,GACd,KAAK,GACL,OAAO,CAAC,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,CAAA;AAE/D,MAAM,MAAM,MAAM,GACd,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,GACvE;IACE,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC;IACzC,IAAI,CAAC,EAAE,YAAY;IACnB,OAAO,CAAC,EAAE,OAAO;CAClB,GACD,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,GACpC,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,GACzD,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,GACrD;IACE,OAAO,EAAE,MAAM;IACf,IAAI,CAAC,EAAE,MAAM,EAAE;IACf,IAAI,CAAC,EAAE,YAAY;IACnB,OAAO,CAAC,EAAE,OAAO;CAClB,CAAA;AAEL;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,WAClB,MAAM,KACb;IACD,OAAO,EAAE,MAAM;IACf,IAAI,EAAE,MAAM,EAAE;IACd,SAAS,EAAE,YAAY;IACvB,OAAO,EAAE,OAAO;CAqBjB,CAAA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC,EAC9C,OAAO,CAAC,EAAE,OAAO,GAChB,YAAY,CAAA;AACf,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,OAAO,CAAC,EAAE,OAAO,GAChB,YAAY,CAAA;AACf,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,YAAY,EACxB,OAAO,CAAC,EAAE,OAAO,GAChB,YAAY,CAAA;AACf,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,SAAS,CAAC,EAAE,YAAY,EACxB,OAAO,CAAC,EAAE,OAAO,GAChB,YAAY,CAAA"} \ No newline at end of file diff --git a/node_modules/foreground-child/dist/cjs/index.js b/node_modules/foreground-child/dist/commonjs/index.js similarity index 77% rename from node_modules/foreground-child/dist/cjs/index.js rename to node_modules/foreground-child/dist/commonjs/index.js index d522c981..8ea5413b 100644 --- a/node_modules/foreground-child/dist/cjs/index.js +++ b/node_modules/foreground-child/dist/commonjs/index.js @@ -7,7 +7,7 @@ exports.foregroundChild = exports.normalizeFgArgs = void 0; const child_process_1 = require("child_process"); const cross_spawn_1 = __importDefault(require("cross-spawn")); const signal_exit_1 = require("signal-exit"); -const all_signals_js_1 = require("./all-signals.js"); +const proxy_signals_js_1 = require("./proxy-signals.js"); const watchdog_js_1 = require("./watchdog.js"); /* c8 ignore start */ const spawn = process?.platform === 'win32' ? cross_spawn_1.default : child_process_1.spawn; @@ -50,7 +50,6 @@ function foregroundChild(...fgArgs) { spawnOpts.stdio.push('ipc'); } const child = spawn(program, args, spawnOpts); - const unproxySignals = proxySignals(child); const childHangup = () => { try { child.kill('SIGHUP'); @@ -63,20 +62,18 @@ function foregroundChild(...fgArgs) { /* c8 ignore stop */ }; const removeOnExit = (0, signal_exit_1.onExit)(childHangup); - const dog = (0, watchdog_js_1.watchdog)(child); + (0, proxy_signals_js_1.proxySignals)(child); + (0, watchdog_js_1.watchdog)(child); let done = false; child.on('close', async (code, signal) => { - dog.kill('SIGKILL'); /* c8 ignore start */ - if (done) { + if (done) return; - } /* c8 ignore stop */ done = true; const result = cleanup(code, signal); const res = isPromise(result) ? await result : result; removeOnExit(); - unproxySignals(); if (res === false) return; else if (typeof res === 'string') { @@ -120,35 +117,5 @@ function foregroundChild(...fgArgs) { return child; } exports.foregroundChild = foregroundChild; -/** - * Starts forwarding signals to `child` through `parent`. - */ -const proxySignals = (child) => { - const listeners = new Map(); - for (const sig of all_signals_js_1.allSignals) { - const listener = () => { - // some signals can only be received, not sent - try { - child.kill(sig); - /* c8 ignore start */ - } - catch (_) { } - /* c8 ignore stop */ - }; - try { - // if it's a signal this system doesn't recognize, skip it - process.on(sig, listener); - listeners.set(sig, listener); - /* c8 ignore start */ - } - catch (_) { } - /* c8 ignore stop */ - } - return () => { - for (const [sig, listener] of listeners) { - process.removeListener(sig, listener); - } - }; -}; const isPromise = (o) => !!o && typeof o === 'object' && typeof o.then === 'function'; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/foreground-child/dist/commonjs/index.js.map b/node_modules/foreground-child/dist/commonjs/index.js.map new file mode 100644 index 00000000..4729c3bb --- /dev/null +++ b/node_modules/foreground-child/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,iDAMsB;AACtB,8DAAoC;AACpC,6CAAoC;AACpC,yDAAiD;AACjD,+CAAwC;AAExC,qBAAqB;AACrB,MAAM,KAAK,GAAG,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,qBAAU,CAAC,CAAC,CAAC,qBAAS,CAAA;AAmDpE;;;;;;GAMG;AACI,MAAM,eAAe,GAAG,CAC7B,MAAc,EAMd,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC,GAAG,MAAM,CAAA;IACrE,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,OAAO,GAAG,IAAI,CAAA;QACd,SAAS,GAAG,EAAE,CAAA;QACd,IAAI,GAAG,EAAE,CAAA;IACX,CAAC;SAAM,IAAI,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACtE,IAAI,OAAO,SAAS,KAAK,UAAU;YAAE,OAAO,GAAG,SAAS,CAAA;QACxD,SAAS,GAAG,IAAI,CAAA;QAChB,IAAI,GAAG,EAAE,CAAA;IACX,CAAC;SAAM,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;QAC3C,OAAO,GAAG,SAAS,CAAA;QACnB,SAAS,GAAG,E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AE,CAAC;QACjB,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAA;QAErC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;YAC1C,OAAO,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;YAC5C,KAAK,CAAC,IAAI,CACR,OAAuB,EACvB,UAAoC,CACrC,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAjFD,0CAiFC;AAED,MAAM,SAAS,GAAG,CAAC,CAAM,EAAqB,EAAE,CAC9C,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU,CAAA","sourcesContent":["import {\n ChildProcess,\n SendHandle,\n Serializable,\n spawn as nodeSpawn,\n SpawnOptions,\n} from 'child_process'\nimport crossSpawn from 'cross-spawn'\nimport { onExit } from 'signal-exit'\nimport { proxySignals } from './proxy-signals.js'\nimport { watchdog } from './watchdog.js'\n\n/* c8 ignore start */\nconst spawn = process?.platform === 'win32' ? crossSpawn : nodeSpawn\n/* c8 ignore stop */\n\n/**\n * The signature for the cleanup method.\n *\n * Arguments indicate the exit status of the child process.\n *\n * If a Promise is returned, then the process is not terminated\n * until it resolves, and the resolution value is treated as the\n * exit status (if a number) or signal exit (if a signal string).\n *\n * If `undefined` is returned, then no change is made, and the parent\n * exits in the same way that the child exited.\n *\n * If boolean `false` is returned, then the parent's exit is canceled.\n *\n * If a number is returned, then the parent process exits with the number\n * as its exitCode.\n *\n * If a signal string is returned, then the parent process is killed with\n * the same signal that caused the child to exit.\n */\nexport type Cleanup = (\n code: number | null,\n signal: null | NodeJS.Signals,\n) =>\n | void\n | undefined\n | number\n | NodeJS.Signals\n | false\n | Promise\n\nexport type FgArgs =\n | [program: string | [cmd: string, ...args: string[]], cleanup?: Cleanup]\n | [\n program: [cmd: string, ...args: string[]],\n opts?: SpawnOptions,\n cleanup?: Cleanup,\n ]\n | [program: string, cleanup?: Cleanup]\n | [program: string, opts?: SpawnOptions, cleanup?: Cleanup]\n | [program: string, args?: string[], cleanup?: Cleanup]\n | [\n program: string,\n args?: string[],\n opts?: SpawnOptions,\n cleanup?: Cleanup,\n ]\n\n/**\n * Normalizes the arguments passed to `foregroundChild`.\n *\n * Exposed for testing.\n *\n * @internal\n */\nexport const normalizeFgArgs = (\n fgArgs: FgArgs,\n): [\n program: string,\n args: string[],\n spawnOpts: SpawnOptions,\n cleanup: Cleanup,\n] => {\n let [program, args = [], spawnOpts = {}, cleanup = () => {}] = fgArgs\n if (typeof args === 'function') {\n cleanup = args\n spawnOpts = {}\n args = []\n } else if (!!args && typeof args === 'object' && !Array.isArray(args)) {\n if (typeof spawnOpts === 'function') cleanup = spawnOpts\n spawnOpts = args\n args = []\n } else if (typeof spawnOpts === 'function') {\n cleanup = spawnOpts\n spawnOpts = {}\n }\n if (Array.isArray(program)) {\n const [pp, ...pa] = program\n program = pp\n args = pa\n }\n return [program, args, { ...spawnOpts }, cleanup]\n}\n\n/**\n * Spawn the specified program as a \"foreground\" process, or at least as\n * close as is possible given node's lack of exec-without-fork.\n *\n * Cleanup method may be used to modify or ignore the result of the child's\n * exit code or signal. If cleanup returns undefined (or a Promise that\n * resolves to undefined), then the parent will exit in the same way that\n * the child did.\n *\n * Return boolean `false` to prevent the parent's exit entirely.\n */\nexport function foregroundChild(\n cmd: string | [cmd: string, ...args: string[]],\n cleanup?: Cleanup,\n): ChildProcess\nexport function foregroundChild(\n program: string,\n args?: string[],\n cleanup?: Cleanup,\n): ChildProcess\nexport function foregroundChild(\n program: string,\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup,\n): ChildProcess\nexport function foregroundChild(\n program: string,\n args?: string[],\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup,\n): ChildProcess\nexport function foregroundChild(...fgArgs: FgArgs): ChildProcess {\n const [program, args, spawnOpts, cleanup] = normalizeFgArgs(fgArgs)\n\n spawnOpts.stdio = [0, 1, 2]\n if (process.send) {\n spawnOpts.stdio.push('ipc')\n }\n\n const child = spawn(program, args, spawnOpts)\n\n const childHangup = () => {\n try {\n child.kill('SIGHUP')\n\n /* c8 ignore start */\n } catch (_) {\n // SIGHUP is weird on windows\n child.kill('SIGTERM')\n }\n /* c8 ignore stop */\n }\n const removeOnExit = onExit(childHangup)\n\n proxySignals(child)\n watchdog(child)\n\n let done = false\n child.on('close', async (code, signal) => {\n /* c8 ignore start */\n if (done) return\n /* c8 ignore stop */\n done = true\n const result = cleanup(code, signal)\n const res = isPromise(result) ? await result : result\n removeOnExit()\n\n if (res === false) return\n else if (typeof res === 'string') {\n signal = res\n code = null\n } else if (typeof res === 'number') {\n code = res\n signal = null\n }\n\n if (signal) {\n // If there is nothing else keeping the event loop alive,\n // then there's a race between a graceful exit and getting\n // the signal to this process. Put this timeout here to\n // make sure we're still alive to get the signal, and thus\n // exit with the intended signal code.\n /* istanbul ignore next */\n setTimeout(() => {}, 2000)\n try {\n process.kill(process.pid, signal)\n /* c8 ignore start */\n } catch (_) {\n process.kill(process.pid, 'SIGTERM')\n }\n /* c8 ignore stop */\n } else {\n process.exit(code || 0)\n }\n })\n\n if (process.send) {\n process.removeAllListeners('message')\n\n child.on('message', (message, sendHandle) => {\n process.send?.(message, sendHandle)\n })\n\n process.on('message', (message, sendHandle) => {\n child.send(\n message as Serializable,\n sendHandle as SendHandle | undefined,\n )\n })\n }\n\n return child\n}\n\nconst isPromise = (o: any): o is Promise =>\n !!o && typeof o === 'object' && typeof o.then === 'function'\n"]} \ No newline at end of file diff --git a/node_modules/foreground-child/dist/cjs/package.json b/node_modules/foreground-child/dist/commonjs/package.json similarity index 100% rename from node_modules/foreground-child/dist/cjs/package.json rename to node_modules/foreground-child/dist/commonjs/package.json diff --git a/node_modules/foreground-child/dist/commonjs/proxy-signals.d.ts b/node_modules/foreground-child/dist/commonjs/proxy-signals.d.ts new file mode 100644 index 00000000..66090fd8 --- /dev/null +++ b/node_modules/foreground-child/dist/commonjs/proxy-signals.d.ts @@ -0,0 +1,7 @@ +/// +import { type ChildProcess } from 'child_process'; +/** + * Starts forwarding signals to `child` through `parent`. + */ +export declare const proxySignals: (child: ChildProcess) => () => void; +//# sourceMappingURL=proxy-signals.d.ts.map \ No newline at end of file diff --git a/node_modules/foreground-child/dist/commonjs/proxy-signals.d.ts.map b/node_modules/foreground-child/dist/commonjs/proxy-signals.d.ts.map new file mode 100644 index 00000000..9c98b7fc --- /dev/null +++ b/node_modules/foreground-child/dist/commonjs/proxy-signals.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"proxy-signals.d.ts","sourceRoot":"","sources":["../../src/proxy-signals.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AAGjD;;GAEG;AACH,eAAO,MAAM,YAAY,UAAW,YAAY,eA4B/C,CAAA"} \ No newline at end of file diff --git a/node_modules/foreground-child/dist/commonjs/proxy-signals.js b/node_modules/foreground-child/dist/commonjs/proxy-signals.js new file mode 100644 index 00000000..3913e7b4 --- /dev/null +++ b/node_modules/foreground-child/dist/commonjs/proxy-signals.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.proxySignals = void 0; +const all_signals_js_1 = require("./all-signals.js"); +/** + * Starts forwarding signals to `child` through `parent`. + */ +const proxySignals = (child) => { + const listeners = new Map(); + for (const sig of all_signals_js_1.allSignals) { + const listener = () => { + // some signals can only be received, not sent + try { + child.kill(sig); + /* c8 ignore start */ + } + catch (_) { } + /* c8 ignore stop */ + }; + try { + // if it's a signal this system doesn't recognize, skip it + process.on(sig, listener); + listeners.set(sig, listener); + /* c8 ignore start */ + } + catch (_) { } + /* c8 ignore stop */ + } + const unproxy = () => { + for (const [sig, listener] of listeners) { + process.removeListener(sig, listener); + } + }; + child.on('exit', unproxy); + return unproxy; +}; +exports.proxySignals = proxySignals; +//# sourceMappingURL=proxy-signals.js.map \ No newline at end of file diff --git a/node_modules/foreground-child/dist/commonjs/proxy-signals.js.map b/node_modules/foreground-child/dist/commonjs/proxy-signals.js.map new file mode 100644 index 00000000..19958227 --- /dev/null +++ b/node_modules/foreground-child/dist/commonjs/proxy-signals.js.map @@ -0,0 +1 @@ +{"version":3,"file":"proxy-signals.js","sourceRoot":"","sources":["../../src/proxy-signals.ts"],"names":[],"mappings":";;;AACA,qDAA6C;AAE7C;;GAEG;AACI,MAAM,YAAY,GAAG,CAAC,KAAmB,EAAE,EAAE;IAClD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAE,CAAA;IAE3B,KAAK,MAAM,GAAG,IAAI,2BAAU,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,GAAG,EAAE;YACpB,8CAA8C;YAC9C,IAAI,CAAC;gBACH,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;gBACf,qBAAqB;YACvB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;YACd,oBAAoB;QACtB,CAAC,CAAA;QACD,IAAI,CAAC;YACH,0DAA0D;YAC1D,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;YACzB,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;YAC5B,qBAAqB;QACvB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;QACd,oBAAoB;IACtB,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,KAAK,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,SAAS,EAAE,CAAC;YACxC,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;QACvC,CAAC;IACH,CAAC,CAAA;IACD,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzB,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AA5BY,QAAA,YAAY,gBA4BxB","sourcesContent":["import { type ChildProcess } from 'child_process'\nimport { allSignals } from './all-signals.js'\n\n/**\n * Starts forwarding signals to `child` through `parent`.\n */\nexport const proxySignals = (child: ChildProcess) => {\n const listeners = new Map()\n\n for (const sig of allSignals) {\n const listener = () => {\n // some signals can only be received, not sent\n try {\n child.kill(sig)\n /* c8 ignore start */\n } catch (_) {}\n /* c8 ignore stop */\n }\n try {\n // if it's a signal this system doesn't recognize, skip it\n process.on(sig, listener)\n listeners.set(sig, listener)\n /* c8 ignore start */\n } catch (_) {}\n /* c8 ignore stop */\n }\n\n const unproxy = () => {\n for (const [sig, listener] of listeners) {\n process.removeListener(sig, listener)\n }\n }\n child.on('exit', unproxy)\n return unproxy\n}\n"]} \ No newline at end of file diff --git a/node_modules/foreground-child/dist/commonjs/watchdog.d.ts b/node_modules/foreground-child/dist/commonjs/watchdog.d.ts new file mode 100644 index 00000000..6038d39a --- /dev/null +++ b/node_modules/foreground-child/dist/commonjs/watchdog.d.ts @@ -0,0 +1,11 @@ +/// +import { ChildProcess } from 'child_process'; +/** + * Pass in a ChildProcess, and this will spawn a watchdog process that + * will make sure it exits if the parent does, thus preventing any + * dangling detached zombie processes. + * + * If the child ends before the parent, then the watchdog will terminate. + */ +export declare const watchdog: (child: ChildProcess) => ChildProcess; +//# sourceMappingURL=watchdog.d.ts.map \ No newline at end of file diff --git a/node_modules/foreground-child/dist/cjs/watchdog.d.ts.map b/node_modules/foreground-child/dist/commonjs/watchdog.d.ts.map similarity index 60% rename from node_modules/foreground-child/dist/cjs/watchdog.d.ts.map rename to node_modules/foreground-child/dist/commonjs/watchdog.d.ts.map index 289f9916..cc6a668f 100644 --- a/node_modules/foreground-child/dist/cjs/watchdog.d.ts.map +++ b/node_modules/foreground-child/dist/commonjs/watchdog.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"watchdog.d.ts","sourceRoot":"","sources":["../../src/watchdog.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,YAAY,EAAS,MAAM,eAAe,CAAA;AAyBnD,eAAO,MAAM,QAAQ,UAAW,YAAY,iBAc3C,CAAA"} \ No newline at end of file +{"version":3,"file":"watchdog.d.ts","sourceRoot":"","sources":["../../src/watchdog.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,YAAY,EAAS,MAAM,eAAe,CAAA;AAyBnD;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,UAAW,YAAY,iBAc3C,CAAA"} \ No newline at end of file diff --git a/node_modules/foreground-child/dist/cjs/watchdog.js b/node_modules/foreground-child/dist/commonjs/watchdog.js similarity index 81% rename from node_modules/foreground-child/dist/cjs/watchdog.js rename to node_modules/foreground-child/dist/commonjs/watchdog.js index 5f553ac1..514e234c 100644 --- a/node_modules/foreground-child/dist/cjs/watchdog.js +++ b/node_modules/foreground-child/dist/commonjs/watchdog.js @@ -27,6 +27,13 @@ if (!isNaN(pid)) { process.on('SIGHUP', bark) } `; +/** + * Pass in a ChildProcess, and this will spawn a watchdog process that + * will make sure it exits if the parent does, thus preventing any + * dangling detached zombie processes. + * + * If the child ends before the parent, then the watchdog will terminate. + */ const watchdog = (child) => { let dogExited = false; const dog = (0, child_process_1.spawn)(process.execPath, ['-e', watchdogCode, String(child.pid)], { @@ -35,7 +42,7 @@ const watchdog = (child) => { dog.on('exit', () => (dogExited = true)); child.on('exit', () => { if (!dogExited) - dog.kill('SIGTERM'); + dog.kill('SIGKILL'); }); return dog; }; diff --git a/node_modules/foreground-child/dist/commonjs/watchdog.js.map b/node_modules/foreground-child/dist/commonjs/watchdog.js.map new file mode 100644 index 00000000..d486c97a --- /dev/null +++ b/node_modules/foreground-child/dist/commonjs/watchdog.js.map @@ -0,0 +1 @@ +{"version":3,"file":"watchdog.js","sourceRoot":"","sources":["../../src/watchdog.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,gEAAgE;AAChE,uCAAuC;;;AAEvC,iDAAmD;AAEnD,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;CAqB9B,CAAA;AAED;;;;;;GAMG;AACI,MAAM,QAAQ,GAAG,CAAC,KAAmB,EAAE,EAAE;IAC9C,IAAI,SAAS,GAAG,KAAK,CAAA;IACrB,MAAM,GAAG,GAAG,IAAA,qBAAK,EACf,OAAO,CAAC,QAAQ,EAChB,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EACvC;QACE,KAAK,EAAE,QAAQ;KAChB,CACF,CAAA;IACD,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,CAAA;IACxC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;QACpB,IAAI,CAAC,SAAS;YAAE,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;IACF,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAdY,QAAA,QAAQ,YAcpB","sourcesContent":["// this spawns a child process that listens for SIGHUP when the\n// parent process exits, and after 200ms, sends a SIGKILL to the\n// child, in case it did not terminate.\n\nimport { ChildProcess, spawn } from 'child_process'\n\nconst watchdogCode = String.raw`\nconst pid = parseInt(process.argv[1], 10)\nprocess.title = 'node (foreground-child watchdog pid=' + pid + ')'\nif (!isNaN(pid)) {\n let barked = false\n // keepalive\n const interval = setInterval(() => {}, 60000)\n const bark = () => {\n clearInterval(interval)\n if (barked) return\n barked = true\n process.removeListener('SIGHUP', bark)\n setTimeout(() => {\n try {\n process.kill(pid, 'SIGKILL')\n setTimeout(() => process.exit(), 200)\n } catch (_) {}\n }, 500)\n })\n process.on('SIGHUP', bark)\n}\n`\n\n/**\n * Pass in a ChildProcess, and this will spawn a watchdog process that\n * will make sure it exits if the parent does, thus preventing any\n * dangling detached zombie processes.\n *\n * If the child ends before the parent, then the watchdog will terminate.\n */\nexport const watchdog = (child: ChildProcess) => {\n let dogExited = false\n const dog = spawn(\n process.execPath,\n ['-e', watchdogCode, String(child.pid)],\n {\n stdio: 'ignore',\n },\n )\n dog.on('exit', () => (dogExited = true))\n child.on('exit', () => {\n if (!dogExited) dog.kill('SIGKILL')\n })\n return dog\n}\n"]} \ No newline at end of file diff --git a/node_modules/foreground-child/dist/mjs/all-signals.d.ts b/node_modules/foreground-child/dist/esm/all-signals.d.ts similarity index 62% rename from node_modules/foreground-child/dist/mjs/all-signals.d.ts rename to node_modules/foreground-child/dist/esm/all-signals.d.ts index 13c5af46..eefd0d2c 100644 --- a/node_modules/foreground-child/dist/mjs/all-signals.d.ts +++ b/node_modules/foreground-child/dist/esm/all-signals.d.ts @@ -1,3 +1,3 @@ -/// +/// export declare const allSignals: NodeJS.Signals[]; //# sourceMappingURL=all-signals.d.ts.map \ No newline at end of file diff --git a/node_modules/foreground-child/dist/mjs/all-signals.d.ts.map b/node_modules/foreground-child/dist/esm/all-signals.d.ts.map similarity index 100% rename from node_modules/foreground-child/dist/mjs/all-signals.d.ts.map rename to node_modules/foreground-child/dist/esm/all-signals.d.ts.map diff --git a/node_modules/foreground-child/dist/mjs/all-signals.js b/node_modules/foreground-child/dist/esm/all-signals.js similarity index 100% rename from node_modules/foreground-child/dist/mjs/all-signals.js rename to node_modules/foreground-child/dist/esm/all-signals.js diff --git a/node_modules/foreground-child/dist/mjs/all-signals.js.map b/node_modules/foreground-child/dist/esm/all-signals.js.map similarity index 56% rename from node_modules/foreground-child/dist/mjs/all-signals.js.map rename to node_modules/foreground-child/dist/esm/all-signals.js.map index 5a0c7d96..1c63c6b9 100644 --- a/node_modules/foreground-child/dist/mjs/all-signals.js.map +++ b/node_modules/foreground-child/dist/esm/all-signals.js.map @@ -1 +1 @@ -{"version":3,"file":"all-signals.js","sourceRoot":"","sources":["../../src/all-signals.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAA;AACtC,MAAM,CAAC,MAAM,UAAU;AACrB,0EAA0E;AAC1E,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAC3B,CAAC,CAAC,EAAE,CACF,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;IACnB,iDAAiD;IACjD,CAAC,KAAK,SAAS;IACf,yDAAyD;IACzD,CAAC,KAAK,SAAS,CACE,CAAA;AAEvB,8DAA8D;AAC9D,gEAAgE;AAChE,6DAA6D;AAC7D,gCAAgC;AAChC,EAAE;AACF,YAAY;AACZ,aAAa;AACb,aAAa;AACb,cAAc;AACd,gBAAgB;AAChB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,cAAc;AACd,gBAAgB;AAChB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,eAAe;AACf,eAAe","sourcesContent":["import constants from 'node:constants'\nexport const allSignals =\n // this is the full list of signals that Node will let us do anything with\n Object.keys(constants).filter(\n k =>\n k.startsWith('SIG') &&\n // https://github.com/tapjs/signal-exit/issues/21\n k !== 'SIGPROF' &&\n // no sense trying to listen for SIGKILL, it's impossible\n k !== 'SIGKILL'\n ) as NodeJS.Signals[]\n\n// These are some obscure signals that are reported by kill -l\n// on macOS, Linux, or Windows, but which don't have any mapping\n// in Node.js. No sense trying if they're just going to throw\n// every time on every platform.\n//\n// 'SIGEMT',\n// 'SIGLOST',\n// 'SIGPOLL',\n// 'SIGRTMAX',\n// 'SIGRTMAX-1',\n// 'SIGRTMAX-10',\n// 'SIGRTMAX-11',\n// 'SIGRTMAX-12',\n// 'SIGRTMAX-13',\n// 'SIGRTMAX-14',\n// 'SIGRTMAX-15',\n// 'SIGRTMAX-2',\n// 'SIGRTMAX-3',\n// 'SIGRTMAX-4',\n// 'SIGRTMAX-5',\n// 'SIGRTMAX-6',\n// 'SIGRTMAX-7',\n// 'SIGRTMAX-8',\n// 'SIGRTMAX-9',\n// 'SIGRTMIN',\n// 'SIGRTMIN+1',\n// 'SIGRTMIN+10',\n// 'SIGRTMIN+11',\n// 'SIGRTMIN+12',\n// 'SIGRTMIN+13',\n// 'SIGRTMIN+14',\n// 'SIGRTMIN+15',\n// 'SIGRTMIN+16',\n// 'SIGRTMIN+2',\n// 'SIGRTMIN+3',\n// 'SIGRTMIN+4',\n// 'SIGRTMIN+5',\n// 'SIGRTMIN+6',\n// 'SIGRTMIN+7',\n// 'SIGRTMIN+8',\n// 'SIGRTMIN+9',\n// 'SIGSTKFLT',\n// 'SIGUNUSED',\n"]} \ No newline at end of file +{"version":3,"file":"all-signals.js","sourceRoot":"","sources":["../../src/all-signals.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAA;AACtC,MAAM,CAAC,MAAM,UAAU;AACrB,0EAA0E;AAC1E,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAC3B,CAAC,CAAC,EAAE,CACF,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;IACnB,iDAAiD;IACjD,CAAC,KAAK,SAAS;IACf,yDAAyD;IACzD,CAAC,KAAK,SAAS,CACE,CAAA;AAEvB,8DAA8D;AAC9D,gEAAgE;AAChE,6DAA6D;AAC7D,gCAAgC;AAChC,EAAE;AACF,YAAY;AACZ,aAAa;AACb,aAAa;AACb,cAAc;AACd,gBAAgB;AAChB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,cAAc;AACd,gBAAgB;AAChB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,eAAe;AACf,eAAe","sourcesContent":["import constants from 'node:constants'\nexport const allSignals =\n // this is the full list of signals that Node will let us do anything with\n Object.keys(constants).filter(\n k =>\n k.startsWith('SIG') &&\n // https://github.com/tapjs/signal-exit/issues/21\n k !== 'SIGPROF' &&\n // no sense trying to listen for SIGKILL, it's impossible\n k !== 'SIGKILL',\n ) as NodeJS.Signals[]\n\n// These are some obscure signals that are reported by kill -l\n// on macOS, Linux, or Windows, but which don't have any mapping\n// in Node.js. No sense trying if they're just going to throw\n// every time on every platform.\n//\n// 'SIGEMT',\n// 'SIGLOST',\n// 'SIGPOLL',\n// 'SIGRTMAX',\n// 'SIGRTMAX-1',\n// 'SIGRTMAX-10',\n// 'SIGRTMAX-11',\n// 'SIGRTMAX-12',\n// 'SIGRTMAX-13',\n// 'SIGRTMAX-14',\n// 'SIGRTMAX-15',\n// 'SIGRTMAX-2',\n// 'SIGRTMAX-3',\n// 'SIGRTMAX-4',\n// 'SIGRTMAX-5',\n// 'SIGRTMAX-6',\n// 'SIGRTMAX-7',\n// 'SIGRTMAX-8',\n// 'SIGRTMAX-9',\n// 'SIGRTMIN',\n// 'SIGRTMIN+1',\n// 'SIGRTMIN+10',\n// 'SIGRTMIN+11',\n// 'SIGRTMIN+12',\n// 'SIGRTMIN+13',\n// 'SIGRTMIN+14',\n// 'SIGRTMIN+15',\n// 'SIGRTMIN+16',\n// 'SIGRTMIN+2',\n// 'SIGRTMIN+3',\n// 'SIGRTMIN+4',\n// 'SIGRTMIN+5',\n// 'SIGRTMIN+6',\n// 'SIGRTMIN+7',\n// 'SIGRTMIN+8',\n// 'SIGRTMIN+9',\n// 'SIGSTKFLT',\n// 'SIGUNUSED',\n"]} \ No newline at end of file diff --git a/node_modules/foreground-child/dist/cjs/index.d.ts b/node_modules/foreground-child/dist/esm/index.d.ts similarity index 73% rename from node_modules/foreground-child/dist/cjs/index.d.ts rename to node_modules/foreground-child/dist/esm/index.d.ts index 24d67891..bf5387a2 100644 --- a/node_modules/foreground-child/dist/cjs/index.d.ts +++ b/node_modules/foreground-child/dist/esm/index.d.ts @@ -1,5 +1,5 @@ -/// -/// +/// +/// import { ChildProcess, SpawnOptions } from 'child_process'; /** * The signature for the cleanup method. @@ -22,7 +22,11 @@ import { ChildProcess, SpawnOptions } from 'child_process'; * the same signal that caused the child to exit. */ export type Cleanup = (code: number | null, signal: null | NodeJS.Signals) => void | undefined | number | NodeJS.Signals | false | Promise; -export type FgArgs = [program: string | string[], cleanup?: Cleanup] | [program: string[], opts?: SpawnOptions, cleanup?: Cleanup] | [program: string, cleanup?: Cleanup] | [program: string, opts?: SpawnOptions, cleanup?: Cleanup] | [program: string, args?: string[], cleanup?: Cleanup] | [ +export type FgArgs = [program: string | [cmd: string, ...args: string[]], cleanup?: Cleanup] | [ + program: [cmd: string, ...args: string[]], + opts?: SpawnOptions, + cleanup?: Cleanup +] | [program: string, cleanup?: Cleanup] | [program: string, opts?: SpawnOptions, cleanup?: Cleanup] | [program: string, args?: string[], cleanup?: Cleanup] | [ program: string, args?: string[], opts?: SpawnOptions, @@ -35,7 +39,12 @@ export type FgArgs = [program: string | string[], cleanup?: Cleanup] | [program: * * @internal */ -export declare const normalizeFgArgs: (fgArgs: FgArgs) => [program: string, args: string[], spawnOpts: SpawnOptions, cleanup: Cleanup]; +export declare const normalizeFgArgs: (fgArgs: FgArgs) => [ + program: string, + args: string[], + spawnOpts: SpawnOptions, + cleanup: Cleanup +]; /** * Spawn the specified program as a "foreground" process, or at least as * close as is possible given node's lack of exec-without-fork. @@ -47,7 +56,7 @@ export declare const normalizeFgArgs: (fgArgs: FgArgs) => [program: string, args * * Return boolean `false` to prevent the parent's exit entirely. */ -export declare function foregroundChild(cmd: string | string[], cleanup?: Cleanup): ChildProcess; +export declare function foregroundChild(cmd: string | [cmd: string, ...args: string[]], cleanup?: Cleanup): ChildProcess; export declare function foregroundChild(program: string, args?: string[], cleanup?: Cleanup): ChildProcess; export declare function foregroundChild(program: string, spawnOpts?: SpawnOptions, cleanup?: Cleanup): ChildProcess; export declare function foregroundChild(program: string, args?: string[], spawnOpts?: SpawnOptions, cleanup?: Cleanup): ChildProcess; diff --git a/node_modules/foreground-child/dist/esm/index.d.ts.map b/node_modules/foreground-child/dist/esm/index.d.ts.map new file mode 100644 index 00000000..dff7f0a2 --- /dev/null +++ b/node_modules/foreground-child/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,YAAY,EAIZ,YAAY,EACb,MAAM,eAAe,CAAA;AAUtB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,OAAO,GAAG,CACpB,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC,OAAO,KAE3B,IAAI,GACJ,SAAS,GACT,MAAM,GACN,MAAM,CAAC,OAAO,GACd,KAAK,GACL,OAAO,CAAC,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,CAAA;AAE/D,MAAM,MAAM,MAAM,GACd,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,CA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AAI,CAAC,EAAE,MAAM,EAAE,EACf,SAAS,CAAC,EAAE,YAAY,EACxB,OAAO,CAAC,EAAE,OAAO,GAChB,YAAY,CAAA"} \ No newline at end of file diff --git a/node_modules/foreground-child/dist/mjs/index.js b/node_modules/foreground-child/dist/esm/index.js similarity index 76% rename from node_modules/foreground-child/dist/mjs/index.js rename to node_modules/foreground-child/dist/esm/index.js index 405b3959..d42ba8f3 100644 --- a/node_modules/foreground-child/dist/mjs/index.js +++ b/node_modules/foreground-child/dist/esm/index.js @@ -1,7 +1,7 @@ import { spawn as nodeSpawn, } from 'child_process'; import crossSpawn from 'cross-spawn'; import { onExit } from 'signal-exit'; -import { allSignals } from './all-signals.js'; +import { proxySignals } from './proxy-signals.js'; import { watchdog } from './watchdog.js'; /* c8 ignore start */ const spawn = process?.platform === 'win32' ? crossSpawn : nodeSpawn; @@ -43,7 +43,6 @@ export function foregroundChild(...fgArgs) { spawnOpts.stdio.push('ipc'); } const child = spawn(program, args, spawnOpts); - const unproxySignals = proxySignals(child); const childHangup = () => { try { child.kill('SIGHUP'); @@ -56,20 +55,18 @@ export function foregroundChild(...fgArgs) { /* c8 ignore stop */ }; const removeOnExit = onExit(childHangup); - const dog = watchdog(child); + proxySignals(child); + watchdog(child); let done = false; child.on('close', async (code, signal) => { - dog.kill('SIGKILL'); /* c8 ignore start */ - if (done) { + if (done) return; - } /* c8 ignore stop */ done = true; const result = cleanup(code, signal); const res = isPromise(result) ? await result : result; removeOnExit(); - unproxySignals(); if (res === false) return; else if (typeof res === 'string') { @@ -112,35 +109,5 @@ export function foregroundChild(...fgArgs) { } return child; } -/** - * Starts forwarding signals to `child` through `parent`. - */ -const proxySignals = (child) => { - const listeners = new Map(); - for (const sig of allSignals) { - const listener = () => { - // some signals can only be received, not sent - try { - child.kill(sig); - /* c8 ignore start */ - } - catch (_) { } - /* c8 ignore stop */ - }; - try { - // if it's a signal this system doesn't recognize, skip it - process.on(sig, listener); - listeners.set(sig, listener); - /* c8 ignore start */ - } - catch (_) { } - /* c8 ignore stop */ - } - return () => { - for (const [sig, listener] of listeners) { - process.removeListener(sig, listener); - } - }; -}; const isPromise = (o) => !!o && typeof o === 'object' && typeof o.then === 'function'; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/foreground-child/dist/esm/index.js.map b/node_modules/foreground-child/dist/esm/index.js.map new file mode 100644 index 00000000..92fc46d0 --- /dev/null +++ b/node_modules/foreground-child/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,IAAI,SAAS,GAEnB,MAAM,eAAe,CAAA;AACtB,OAAO,UAAU,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,qBAAqB;AACrB,MAAM,KAAK,GAAG,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAA;AAmDpE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,MAAc,EAMd,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC,GAAG,MAAM,CAAA;IACrE,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,OAAO,GAAG,IAAI,CAAA;QACd,SAAS,GAAG,EAAE,CAAA;QACd,IAAI,GAAG,EAAE,CAAA;IACX,CAAC;SAAM,IAAI,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACtE,IAAI,OA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AAC;YACD,oBAAoB;QACtB,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAA;QACzB,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAA;QAErC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;YAC1C,OAAO,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;YAC5C,KAAK,CAAC,IAAI,CACR,OAAuB,EACvB,UAAoC,CACrC,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,MAAM,SAAS,GAAG,CAAC,CAAM,EAAqB,EAAE,CAC9C,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU,CAAA","sourcesContent":["import {\n ChildProcess,\n SendHandle,\n Serializable,\n spawn as nodeSpawn,\n SpawnOptions,\n} from 'child_process'\nimport crossSpawn from 'cross-spawn'\nimport { onExit } from 'signal-exit'\nimport { proxySignals } from './proxy-signals.js'\nimport { watchdog } from './watchdog.js'\n\n/* c8 ignore start */\nconst spawn = process?.platform === 'win32' ? crossSpawn : nodeSpawn\n/* c8 ignore stop */\n\n/**\n * The signature for the cleanup method.\n *\n * Arguments indicate the exit status of the child process.\n *\n * If a Promise is returned, then the process is not terminated\n * until it resolves, and the resolution value is treated as the\n * exit status (if a number) or signal exit (if a signal string).\n *\n * If `undefined` is returned, then no change is made, and the parent\n * exits in the same way that the child exited.\n *\n * If boolean `false` is returned, then the parent's exit is canceled.\n *\n * If a number is returned, then the parent process exits with the number\n * as its exitCode.\n *\n * If a signal string is returned, then the parent process is killed with\n * the same signal that caused the child to exit.\n */\nexport type Cleanup = (\n code: number | null,\n signal: null | NodeJS.Signals,\n) =>\n | void\n | undefined\n | number\n | NodeJS.Signals\n | false\n | Promise\n\nexport type FgArgs =\n | [program: string | [cmd: string, ...args: string[]], cleanup?: Cleanup]\n | [\n program: [cmd: string, ...args: string[]],\n opts?: SpawnOptions,\n cleanup?: Cleanup,\n ]\n | [program: string, cleanup?: Cleanup]\n | [program: string, opts?: SpawnOptions, cleanup?: Cleanup]\n | [program: string, args?: string[], cleanup?: Cleanup]\n | [\n program: string,\n args?: string[],\n opts?: SpawnOptions,\n cleanup?: Cleanup,\n ]\n\n/**\n * Normalizes the arguments passed to `foregroundChild`.\n *\n * Exposed for testing.\n *\n * @internal\n */\nexport const normalizeFgArgs = (\n fgArgs: FgArgs,\n): [\n program: string,\n args: string[],\n spawnOpts: SpawnOptions,\n cleanup: Cleanup,\n] => {\n let [program, args = [], spawnOpts = {}, cleanup = () => {}] = fgArgs\n if (typeof args === 'function') {\n cleanup = args\n spawnOpts = {}\n args = []\n } else if (!!args && typeof args === 'object' && !Array.isArray(args)) {\n if (typeof spawnOpts === 'function') cleanup = spawnOpts\n spawnOpts = args\n args = []\n } else if (typeof spawnOpts === 'function') {\n cleanup = spawnOpts\n spawnOpts = {}\n }\n if (Array.isArray(program)) {\n const [pp, ...pa] = program\n program = pp\n args = pa\n }\n return [program, args, { ...spawnOpts }, cleanup]\n}\n\n/**\n * Spawn the specified program as a \"foreground\" process, or at least as\n * close as is possible given node's lack of exec-without-fork.\n *\n * Cleanup method may be used to modify or ignore the result of the child's\n * exit code or signal. If cleanup returns undefined (or a Promise that\n * resolves to undefined), then the parent will exit in the same way that\n * the child did.\n *\n * Return boolean `false` to prevent the parent's exit entirely.\n */\nexport function foregroundChild(\n cmd: string | [cmd: string, ...args: string[]],\n cleanup?: Cleanup,\n): ChildProcess\nexport function foregroundChild(\n program: string,\n args?: string[],\n cleanup?: Cleanup,\n): ChildProcess\nexport function foregroundChild(\n program: string,\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup,\n): ChildProcess\nexport function foregroundChild(\n program: string,\n args?: string[],\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup,\n): ChildProcess\nexport function foregroundChild(...fgArgs: FgArgs): ChildProcess {\n const [program, args, spawnOpts, cleanup] = normalizeFgArgs(fgArgs)\n\n spawnOpts.stdio = [0, 1, 2]\n if (process.send) {\n spawnOpts.stdio.push('ipc')\n }\n\n const child = spawn(program, args, spawnOpts)\n\n const childHangup = () => {\n try {\n child.kill('SIGHUP')\n\n /* c8 ignore start */\n } catch (_) {\n // SIGHUP is weird on windows\n child.kill('SIGTERM')\n }\n /* c8 ignore stop */\n }\n const removeOnExit = onExit(childHangup)\n\n proxySignals(child)\n watchdog(child)\n\n let done = false\n child.on('close', async (code, signal) => {\n /* c8 ignore start */\n if (done) return\n /* c8 ignore stop */\n done = true\n const result = cleanup(code, signal)\n const res = isPromise(result) ? await result : result\n removeOnExit()\n\n if (res === false) return\n else if (typeof res === 'string') {\n signal = res\n code = null\n } else if (typeof res === 'number') {\n code = res\n signal = null\n }\n\n if (signal) {\n // If there is nothing else keeping the event loop alive,\n // then there's a race between a graceful exit and getting\n // the signal to this process. Put this timeout here to\n // make sure we're still alive to get the signal, and thus\n // exit with the intended signal code.\n /* istanbul ignore next */\n setTimeout(() => {}, 2000)\n try {\n process.kill(process.pid, signal)\n /* c8 ignore start */\n } catch (_) {\n process.kill(process.pid, 'SIGTERM')\n }\n /* c8 ignore stop */\n } else {\n process.exit(code || 0)\n }\n })\n\n if (process.send) {\n process.removeAllListeners('message')\n\n child.on('message', (message, sendHandle) => {\n process.send?.(message, sendHandle)\n })\n\n process.on('message', (message, sendHandle) => {\n child.send(\n message as Serializable,\n sendHandle as SendHandle | undefined,\n )\n })\n }\n\n return child\n}\n\nconst isPromise = (o: any): o is Promise =>\n !!o && typeof o === 'object' && typeof o.then === 'function'\n"]} \ No newline at end of file diff --git a/node_modules/foreground-child/dist/mjs/package.json b/node_modules/foreground-child/dist/esm/package.json similarity index 100% rename from node_modules/foreground-child/dist/mjs/package.json rename to node_modules/foreground-child/dist/esm/package.json diff --git a/node_modules/foreground-child/dist/esm/proxy-signals.d.ts b/node_modules/foreground-child/dist/esm/proxy-signals.d.ts new file mode 100644 index 00000000..aadb9f64 --- /dev/null +++ b/node_modules/foreground-child/dist/esm/proxy-signals.d.ts @@ -0,0 +1,7 @@ +/// +import { type ChildProcess } from 'child_process'; +/** + * Starts forwarding signals to `child` through `parent`. + */ +export declare const proxySignals: (child: ChildProcess) => () => void; +//# sourceMappingURL=proxy-signals.d.ts.map \ No newline at end of file diff --git a/node_modules/foreground-child/dist/esm/proxy-signals.d.ts.map b/node_modules/foreground-child/dist/esm/proxy-signals.d.ts.map new file mode 100644 index 00000000..9c98b7fc --- /dev/null +++ b/node_modules/foreground-child/dist/esm/proxy-signals.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"proxy-signals.d.ts","sourceRoot":"","sources":["../../src/proxy-signals.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AAGjD;;GAEG;AACH,eAAO,MAAM,YAAY,UAAW,YAAY,eA4B/C,CAAA"} \ No newline at end of file diff --git a/node_modules/foreground-child/dist/esm/proxy-signals.js b/node_modules/foreground-child/dist/esm/proxy-signals.js new file mode 100644 index 00000000..8e1efe3e --- /dev/null +++ b/node_modules/foreground-child/dist/esm/proxy-signals.js @@ -0,0 +1,34 @@ +import { allSignals } from './all-signals.js'; +/** + * Starts forwarding signals to `child` through `parent`. + */ +export const proxySignals = (child) => { + const listeners = new Map(); + for (const sig of allSignals) { + const listener = () => { + // some signals can only be received, not sent + try { + child.kill(sig); + /* c8 ignore start */ + } + catch (_) { } + /* c8 ignore stop */ + }; + try { + // if it's a signal this system doesn't recognize, skip it + process.on(sig, listener); + listeners.set(sig, listener); + /* c8 ignore start */ + } + catch (_) { } + /* c8 ignore stop */ + } + const unproxy = () => { + for (const [sig, listener] of listeners) { + process.removeListener(sig, listener); + } + }; + child.on('exit', unproxy); + return unproxy; +}; +//# sourceMappingURL=proxy-signals.js.map \ No newline at end of file diff --git a/node_modules/foreground-child/dist/esm/proxy-signals.js.map b/node_modules/foreground-child/dist/esm/proxy-signals.js.map new file mode 100644 index 00000000..978750fc --- /dev/null +++ b/node_modules/foreground-child/dist/esm/proxy-signals.js.map @@ -0,0 +1 @@ +{"version":3,"file":"proxy-signals.js","sourceRoot":"","sources":["../../src/proxy-signals.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAmB,EAAE,EAAE;IAClD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAE,CAAA;IAE3B,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,GAAG,EAAE;YACpB,8CAA8C;YAC9C,IAAI,CAAC;gBACH,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;gBACf,qBAAqB;YACvB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;YACd,oBAAoB;QACtB,CAAC,CAAA;QACD,IAAI,CAAC;YACH,0DAA0D;YAC1D,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;YACzB,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;YAC5B,qBAAqB;QACvB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;QACd,oBAAoB;IACtB,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,KAAK,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,SAAS,EAAE,CAAC;YACxC,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;QACvC,CAAC;IACH,CAAC,CAAA;IACD,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzB,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA","sourcesContent":["import { type ChildProcess } from 'child_process'\nimport { allSignals } from './all-signals.js'\n\n/**\n * Starts forwarding signals to `child` through `parent`.\n */\nexport const proxySignals = (child: ChildProcess) => {\n const listeners = new Map()\n\n for (const sig of allSignals) {\n const listener = () => {\n // some signals can only be received, not sent\n try {\n child.kill(sig)\n /* c8 ignore start */\n } catch (_) {}\n /* c8 ignore stop */\n }\n try {\n // if it's a signal this system doesn't recognize, skip it\n process.on(sig, listener)\n listeners.set(sig, listener)\n /* c8 ignore start */\n } catch (_) {}\n /* c8 ignore stop */\n }\n\n const unproxy = () => {\n for (const [sig, listener] of listeners) {\n process.removeListener(sig, listener)\n }\n }\n child.on('exit', unproxy)\n return unproxy\n}\n"]} \ No newline at end of file diff --git a/node_modules/foreground-child/dist/esm/watchdog.d.ts b/node_modules/foreground-child/dist/esm/watchdog.d.ts new file mode 100644 index 00000000..edfdf4de --- /dev/null +++ b/node_modules/foreground-child/dist/esm/watchdog.d.ts @@ -0,0 +1,11 @@ +/// +import { ChildProcess } from 'child_process'; +/** + * Pass in a ChildProcess, and this will spawn a watchdog process that + * will make sure it exits if the parent does, thus preventing any + * dangling detached zombie processes. + * + * If the child ends before the parent, then the watchdog will terminate. + */ +export declare const watchdog: (child: ChildProcess) => ChildProcess; +//# sourceMappingURL=watchdog.d.ts.map \ No newline at end of file diff --git a/node_modules/foreground-child/dist/mjs/watchdog.d.ts.map b/node_modules/foreground-child/dist/esm/watchdog.d.ts.map similarity index 60% rename from node_modules/foreground-child/dist/mjs/watchdog.d.ts.map rename to node_modules/foreground-child/dist/esm/watchdog.d.ts.map index 289f9916..cc6a668f 100644 --- a/node_modules/foreground-child/dist/mjs/watchdog.d.ts.map +++ b/node_modules/foreground-child/dist/esm/watchdog.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"watchdog.d.ts","sourceRoot":"","sources":["../../src/watchdog.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,YAAY,EAAS,MAAM,eAAe,CAAA;AAyBnD,eAAO,MAAM,QAAQ,UAAW,YAAY,iBAc3C,CAAA"} \ No newline at end of file +{"version":3,"file":"watchdog.d.ts","sourceRoot":"","sources":["../../src/watchdog.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,YAAY,EAAS,MAAM,eAAe,CAAA;AAyBnD;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,UAAW,YAAY,iBAc3C,CAAA"} \ No newline at end of file diff --git a/node_modules/foreground-child/dist/mjs/watchdog.js b/node_modules/foreground-child/dist/esm/watchdog.js similarity index 79% rename from node_modules/foreground-child/dist/mjs/watchdog.js rename to node_modules/foreground-child/dist/esm/watchdog.js index 3b897a6c..7aa184ed 100644 --- a/node_modules/foreground-child/dist/mjs/watchdog.js +++ b/node_modules/foreground-child/dist/esm/watchdog.js @@ -24,6 +24,13 @@ if (!isNaN(pid)) { process.on('SIGHUP', bark) } `; +/** + * Pass in a ChildProcess, and this will spawn a watchdog process that + * will make sure it exits if the parent does, thus preventing any + * dangling detached zombie processes. + * + * If the child ends before the parent, then the watchdog will terminate. + */ export const watchdog = (child) => { let dogExited = false; const dog = spawn(process.execPath, ['-e', watchdogCode, String(child.pid)], { @@ -32,7 +39,7 @@ export const watchdog = (child) => { dog.on('exit', () => (dogExited = true)); child.on('exit', () => { if (!dogExited) - dog.kill('SIGTERM'); + dog.kill('SIGKILL'); }); return dog; }; diff --git a/node_modules/foreground-child/dist/esm/watchdog.js.map b/node_modules/foreground-child/dist/esm/watchdog.js.map new file mode 100644 index 00000000..6f4e39fb --- /dev/null +++ b/node_modules/foreground-child/dist/esm/watchdog.js.map @@ -0,0 +1 @@ +{"version":3,"file":"watchdog.js","sourceRoot":"","sources":["../../src/watchdog.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,gEAAgE;AAChE,uCAAuC;AAEvC,OAAO,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAA;AAEnD,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;CAqB9B,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAmB,EAAE,EAAE;IAC9C,IAAI,SAAS,GAAG,KAAK,CAAA;IACrB,MAAM,GAAG,GAAG,KAAK,CACf,OAAO,CAAC,QAAQ,EAChB,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EACvC;QACE,KAAK,EAAE,QAAQ;KAChB,CACF,CAAA;IACD,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,CAAA;IACxC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;QACpB,IAAI,CAAC,SAAS;YAAE,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;IACF,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA","sourcesContent":["// this spawns a child process that listens for SIGHUP when the\n// parent process exits, and after 200ms, sends a SIGKILL to the\n// child, in case it did not terminate.\n\nimport { ChildProcess, spawn } from 'child_process'\n\nconst watchdogCode = String.raw`\nconst pid = parseInt(process.argv[1], 10)\nprocess.title = 'node (foreground-child watchdog pid=' + pid + ')'\nif (!isNaN(pid)) {\n let barked = false\n // keepalive\n const interval = setInterval(() => {}, 60000)\n const bark = () => {\n clearInterval(interval)\n if (barked) return\n barked = true\n process.removeListener('SIGHUP', bark)\n setTimeout(() => {\n try {\n process.kill(pid, 'SIGKILL')\n setTimeout(() => process.exit(), 200)\n } catch (_) {}\n }, 500)\n })\n process.on('SIGHUP', bark)\n}\n`\n\n/**\n * Pass in a ChildProcess, and this will spawn a watchdog process that\n * will make sure it exits if the parent does, thus preventing any\n * dangling detached zombie processes.\n *\n * If the child ends before the parent, then the watchdog will terminate.\n */\nexport const watchdog = (child: ChildProcess) => {\n let dogExited = false\n const dog = spawn(\n process.execPath,\n ['-e', watchdogCode, String(child.pid)],\n {\n stdio: 'ignore',\n },\n )\n dog.on('exit', () => (dogExited = true))\n child.on('exit', () => {\n if (!dogExited) dog.kill('SIGKILL')\n })\n return dog\n}\n"]} \ No newline at end of file diff --git a/node_modules/foreground-child/dist/mjs/index.d.ts.map b/node_modules/foreground-child/dist/mjs/index.d.ts.map deleted file mode 100644 index a5dfb5da..00000000 --- a/node_modules/foreground-child/dist/mjs/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,YAAY,EAIZ,YAAY,EACb,MAAM,eAAe,CAAA;AAUtB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,OAAO,GAAG,CACpB,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC,OAAO,KAE3B,IAAI,GACJ,SAAS,GACT,MAAM,GACN,MAAM,CAAC,OAAO,GACd,KAAK,GACL,OAAO,CAAC,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,CAAA;AAE/D,MAAM,MAAM,MAAM,GACd,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,GAC/C,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,GAC3D,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,GACpC,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,GACzD,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,GACrD;IACE,OAAO,EAAE,MAAM;IACf,IAAI,CAAC,EAAE,MAAM,EAAE;IACf,IAAI,CAAC,EAAE,YAAY;IACnB,OAAO,CAAC,EAAE,OAAO;CAClB,CAAA;AAEL;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,WAClB,MAAM,iFA0Bf,CAAA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,EACtB,OAAO,CAAC,EAAE,OAAO,GAChB,YAAY,CAAA;AACf,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,OAAO,CAAC,EAAE,OAAO,GAChB,YAAY,CAAA;AACf,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,YAAY,EACxB,OAAO,CAAC,EAAE,OAAO,GAChB,YAAY,CAAA;AACf,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,SAAS,CAAC,EAAE,YAAY,EACxB,OAAO,CAAC,EAAE,OAAO,GAChB,YAAY,CAAA"} \ No newline at end of file diff --git a/node_modules/foreground-child/dist/mjs/index.js.map b/node_modules/foreground-child/dist/mjs/index.js.map deleted file mode 100644 index 41f5cc79..00000000 --- a/node_modules/foreground-child/dist/mjs/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,IAAI,SAAS,GAEnB,MAAM,eAAe,CAAA;AACtB,OAAO,UAAU,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE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rC,CAAA;QACH,CAAC,CAAC,CAAA;KACH;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;GAEG;AACH,MAAM,YAAY,GAAG,CAAC,KAAmB,EAAE,EAAE;IAC3C,MAAM,SAAS,GAAG,IAAI,GAAG,EAAE,CAAA;IAE3B,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE;QAC5B,MAAM,QAAQ,GAAG,GAAG,EAAE;YACpB,8CAA8C;YAC9C,IAAI;gBACF,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;gBACf,qBAAqB;aACtB;YAAC,OAAO,CAAC,EAAE,GAAE;YACd,oBAAoB;QACtB,CAAC,CAAA;QACD,IAAI;YACF,0DAA0D;YAC1D,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;YACzB,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;YAC5B,qBAAqB;SACtB;QAAC,OAAO,CAAC,EAAE,GAAE;QACd,oBAAoB;KACrB;IAED,OAAO,GAAG,EAAE;QACV,KAAK,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,SAAS,EAAE;YACvC,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;SACtC;IACH,CAAC,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,CAAM,EAAqB,EAAE,CAC9C,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU,CAAA","sourcesContent":["import {\n ChildProcess,\n SendHandle,\n Serializable,\n spawn as nodeSpawn,\n SpawnOptions,\n} from 'child_process'\nimport crossSpawn from 'cross-spawn'\nimport { onExit } from 'signal-exit'\nimport { allSignals } from './all-signals.js'\nimport { watchdog } from './watchdog.js'\n\n/* c8 ignore start */\nconst spawn = process?.platform === 'win32' ? crossSpawn : nodeSpawn\n/* c8 ignore stop */\n\n/**\n * The signature for the cleanup method.\n *\n * Arguments indicate the exit status of the child process.\n *\n * If a Promise is returned, then the process is not terminated\n * until it resolves, and the resolution value is treated as the\n * exit status (if a number) or signal exit (if a signal string).\n *\n * If `undefined` is returned, then no change is made, and the parent\n * exits in the same way that the child exited.\n *\n * If boolean `false` is returned, then the parent's exit is canceled.\n *\n * If a number is returned, then the parent process exits with the number\n * as its exitCode.\n *\n * If a signal string is returned, then the parent process is killed with\n * the same signal that caused the child to exit.\n */\nexport type Cleanup = (\n code: number | null,\n signal: null | NodeJS.Signals\n) =>\n | void\n | undefined\n | number\n | NodeJS.Signals\n | false\n | Promise\n\nexport type FgArgs =\n | [program: string | string[], cleanup?: Cleanup]\n | [program: string[], opts?: SpawnOptions, cleanup?: Cleanup]\n | [program: string, cleanup?: Cleanup]\n | [program: string, opts?: SpawnOptions, cleanup?: Cleanup]\n | [program: string, args?: string[], cleanup?: Cleanup]\n | [\n program: string,\n args?: string[],\n opts?: SpawnOptions,\n cleanup?: Cleanup\n ]\n\n/**\n * Normalizes the arguments passed to `foregroundChild`.\n *\n * Exposed for testing.\n *\n * @internal\n */\nexport const normalizeFgArgs = (\n fgArgs: FgArgs\n): [\n program: string,\n args: string[],\n spawnOpts: SpawnOptions,\n cleanup: Cleanup\n] => {\n let [program, args = [], spawnOpts = {}, cleanup = () => {}] = fgArgs\n if (typeof args === 'function') {\n cleanup = args\n spawnOpts = {}\n args = []\n } else if (!!args && typeof args === 'object' && !Array.isArray(args)) {\n if (typeof spawnOpts === 'function') cleanup = spawnOpts\n spawnOpts = args\n args = []\n } else if (typeof spawnOpts === 'function') {\n cleanup = spawnOpts\n spawnOpts = {}\n }\n if (Array.isArray(program)) {\n const [pp, ...pa] = program\n program = pp\n args = pa\n }\n return [program, args, { ...spawnOpts }, cleanup]\n}\n\n/**\n * Spawn the specified program as a \"foreground\" process, or at least as\n * close as is possible given node's lack of exec-without-fork.\n *\n * Cleanup method may be used to modify or ignore the result of the child's\n * exit code or signal. If cleanup returns undefined (or a Promise that\n * resolves to undefined), then the parent will exit in the same way that\n * the child did.\n *\n * Return boolean `false` to prevent the parent's exit entirely.\n */\nexport function foregroundChild(\n cmd: string | string[],\n cleanup?: Cleanup\n): ChildProcess\nexport function foregroundChild(\n program: string,\n args?: string[],\n cleanup?: Cleanup\n): ChildProcess\nexport function foregroundChild(\n program: string,\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup\n): ChildProcess\nexport function foregroundChild(\n program: string,\n args?: string[],\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup\n): ChildProcess\nexport function foregroundChild(...fgArgs: FgArgs): ChildProcess {\n const [program, args, spawnOpts, cleanup] = normalizeFgArgs(fgArgs)\n\n spawnOpts.stdio = [0, 1, 2]\n if (process.send) {\n spawnOpts.stdio.push('ipc')\n }\n\n const child = spawn(program, args, spawnOpts)\n\n const unproxySignals = proxySignals(child)\n const childHangup = () => {\n try {\n child.kill('SIGHUP')\n\n /* c8 ignore start */\n } catch (_) {\n // SIGHUP is weird on windows\n child.kill('SIGTERM')\n }\n /* c8 ignore stop */\n }\n const removeOnExit = onExit(childHangup)\n\n const dog = watchdog(child)\n\n let done = false\n child.on('close', async (code, signal) => {\n dog.kill('SIGKILL')\n /* c8 ignore start */\n if (done) {\n return\n }\n /* c8 ignore stop */\n done = true\n const result = cleanup(code, signal)\n const res = isPromise(result) ? await result : result\n removeOnExit()\n unproxySignals()\n\n if (res === false) return\n else if (typeof res === 'string') {\n signal = res\n code = null\n } else if (typeof res === 'number') {\n code = res\n signal = null\n }\n\n if (signal) {\n // If there is nothing else keeping the event loop alive,\n // then there's a race between a graceful exit and getting\n // the signal to this process. Put this timeout here to\n // make sure we're still alive to get the signal, and thus\n // exit with the intended signal code.\n /* istanbul ignore next */\n setTimeout(() => {}, 2000)\n try {\n process.kill(process.pid, signal)\n /* c8 ignore start */\n } catch (_) {\n process.kill(process.pid, 'SIGTERM')\n }\n /* c8 ignore stop */\n } else {\n process.exit(code || 0)\n }\n })\n\n if (process.send) {\n process.removeAllListeners('message')\n\n child.on('message', (message, sendHandle) => {\n process.send?.(message, sendHandle)\n })\n\n process.on('message', (message, sendHandle) => {\n child.send(\n message as Serializable,\n sendHandle as SendHandle | undefined\n )\n })\n }\n\n return child\n}\n\n/**\n * Starts forwarding signals to `child` through `parent`.\n */\nconst proxySignals = (child: ChildProcess) => {\n const listeners = new Map()\n\n for (const sig of allSignals) {\n const listener = () => {\n // some signals can only be received, not sent\n try {\n child.kill(sig)\n /* c8 ignore start */\n } catch (_) {}\n /* c8 ignore stop */\n }\n try {\n // if it's a signal this system doesn't recognize, skip it\n process.on(sig, listener)\n listeners.set(sig, listener)\n /* c8 ignore start */\n } catch (_) {}\n /* c8 ignore stop */\n }\n\n return () => {\n for (const [sig, listener] of listeners) {\n process.removeListener(sig, listener)\n }\n }\n}\n\nconst isPromise = (o: any): o is Promise =>\n !!o && typeof o === 'object' && typeof o.then === 'function'\n"]} \ No newline at end of file diff --git a/node_modules/foreground-child/dist/mjs/watchdog.d.ts b/node_modules/foreground-child/dist/mjs/watchdog.d.ts deleted file mode 100644 index ad552b14..00000000 --- a/node_modules/foreground-child/dist/mjs/watchdog.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -/// -import { ChildProcess } from 'child_process'; -export declare const watchdog: (child: ChildProcess) => ChildProcess; -//# sourceMappingURL=watchdog.d.ts.map \ No newline at end of file diff --git a/node_modules/foreground-child/dist/mjs/watchdog.js.map b/node_modules/foreground-child/dist/mjs/watchdog.js.map deleted file mode 100644 index 6fe2a6be..00000000 --- a/node_modules/foreground-child/dist/mjs/watchdog.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"watchdog.js","sourceRoot":"","sources":["../../src/watchdog.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,gEAAgE;AAChE,uCAAuC;AAEvC,OAAO,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAA;AAEnD,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;CAqB9B,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAmB,EAAE,EAAE;IAC9C,IAAI,SAAS,GAAG,KAAK,CAAA;IACrB,MAAM,GAAG,GAAG,KAAK,CACf,OAAO,CAAC,QAAQ,EAChB,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EACvC;QACE,KAAK,EAAE,QAAQ;KAChB,CACF,CAAA;IACD,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,CAAA;IACxC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;QACpB,IAAI,CAAC,SAAS;YAAE,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;IACF,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA","sourcesContent":["// this spawns a child process that listens for SIGHUP when the\n// parent process exits, and after 200ms, sends a SIGKILL to the\n// child, in case it did not terminate.\n\nimport { ChildProcess, spawn } from 'child_process'\n\nconst watchdogCode = String.raw`\nconst pid = parseInt(process.argv[1], 10)\nprocess.title = 'node (foreground-child watchdog pid=' + pid + ')'\nif (!isNaN(pid)) {\n let barked = false\n // keepalive\n const interval = setInterval(() => {}, 60000)\n const bark = () => {\n clearInterval(interval)\n if (barked) return\n barked = true\n process.removeListener('SIGHUP', bark)\n setTimeout(() => {\n try {\n process.kill(pid, 'SIGKILL')\n setTimeout(() => process.exit(), 200)\n } catch (_) {}\n }, 500)\n })\n process.on('SIGHUP', bark)\n}\n`\n\nexport const watchdog = (child: ChildProcess) => {\n let dogExited = false\n const dog = spawn(\n process.execPath,\n ['-e', watchdogCode, String(child.pid)],\n {\n stdio: 'ignore',\n }\n )\n dog.on('exit', () => (dogExited = true))\n child.on('exit', () => {\n if (!dogExited) dog.kill('SIGTERM')\n })\n return dog\n}\n"]} \ No newline at end of file diff --git a/node_modules/foreground-child/package.json b/node_modules/foreground-child/package.json index dfda3284..521abcb0 100644 --- a/node_modules/foreground-child/package.json +++ b/node_modules/foreground-child/package.json @@ -1,19 +1,45 @@ { "name": "foreground-child", - "version": "3.1.1", + "version": "3.2.0", "description": "Run a child as if it's the foreground process. Give it stdio. Exit when it exits.", - "main": "./dist/cjs/index.js", - "module": "./dist/mjs/index.js", - "types": "./dist/mjs/index.d.ts", + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", "exports": { + "./watchdog": { + "import": { + "source": "./src/watchdog.ts", + "types": "./dist/esm/watchdog.d.ts", + "default": "./dist/esm/watchdog.js" + }, + "require": { + "source": "./src/watchdog.ts", + "types": "./dist/commonjs/watchdog.d.ts", + "default": "./dist/commonjs/watchdog.js" + } + }, + "./proxy-signals": { + "import": { + "source": "./src/proxy-signals.ts", + "types": "./dist/esm/proxy-signals.d.ts", + "default": "./dist/esm/proxy-signals.js" + }, + "require": { + "source": "./src/proxy-signals.ts", + "types": "./dist/commonjs/proxy-signals.d.ts", + "default": "./dist/commonjs/proxy-signals.js" + } + }, + "./package.json": "./package.json", ".": { "import": { - "types": "./dist/mjs/index.d.ts", - "default": "./dist/mjs/index.js" + "source": "./src/index.ts", + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" }, "require": { - "types": "./dist/cjs/index.d.ts", - "default": "./dist/cjs/index.js" + "source": "./src/index.ts", + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" } } }, @@ -31,15 +57,16 @@ "preversion": "npm test", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", - "prepare": "tsc -p tsconfig.json && tsc -p tsconfig-esm.json && bash ./scripts/fixup.sh", + "prepare": "tshy", "pretest": "npm run prepare", "presnap": "npm run prepare", - "test": "c8 tap", - "snap": "c8 tap", - "format": "prettier --write . --loglevel warn", - "typedoc": "typedoc --tsconfig tsconfig-esm.json ./src/*.ts" + "test": "tap", + "snap": "tap", + "format": "prettier --write . --log-level warn", + "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" }, "prettier": { + "experimentalTernaries": true, "semi": false, "printWidth": 75, "tabWidth": 2, @@ -51,14 +78,7 @@ "endOfLine": "lf" }, "tap": { - "coverage": false, - "jobs": 1, - "node-arg": [ - "--no-warnings", - "--loader", - "ts-node/esm" - ], - "ts": false + "typecheck": true }, "repository": { "type": "git", @@ -70,14 +90,22 @@ "@types/cross-spawn": "^6.0.2", "@types/node": "^18.15.11", "@types/tap": "^15.0.8", - "c8": "^7.13.0", - "prettier": "^2.8.6", - "tap": "^16.3.4", - "ts-node": "^10.9.1", + "prettier": "^3.3.2", + "tap": "^19.2.5", + "tshy": "^1.15.1", "typedoc": "^0.24.2", "typescript": "^5.0.2" }, "funding": { "url": "https://github.com/sponsors/isaacs" - } + }, + "tshy": { + "exports": { + "./watchdog": "./src/watchdog.ts", + "./proxy-signals": "./src/proxy-signals.ts", + "./package.json": "./package.json", + ".": "./src/index.ts" + } + }, + "type": "module" } diff --git a/node_modules/jackspeak/README.md b/node_modules/jackspeak/README.md index eeac9e40..4ffea4b3 100644 --- a/node_modules/jackspeak/README.md +++ b/node_modules/jackspeak/README.md @@ -110,6 +110,12 @@ Options: programs do, so you can stop parsing and pass the positionals to the subcommand to parse. +- `stopAtPositionalTest` Conditional `stopAtPositional`. Provide + a function that takes a positional argument string and returns + boolean. If it returns `true`, then parsing will stop. Useful + when _some_ subcommands should parse the rest of the command + line options, and others should not. + ### `Jack.heading(text: string, level?: 1 | 2 | 3 | 4 | 5 | 6)` Define a short string heading, used in the `usage()` output. diff --git a/node_modules/jackspeak/dist/commonjs/index.d.ts b/node_modules/jackspeak/dist/commonjs/index.d.ts index b2f9789b..d28bcc18 100644 --- a/node_modules/jackspeak/dist/commonjs/index.d.ts +++ b/node_modules/jackspeak/dist/commonjs/index.d.ts @@ -189,6 +189,12 @@ export interface JackOptions { * @default false */ stopAtPositional?: boolean; + /** + * Conditional `stopAtPositional`. If set to a `(string)=>boolean` function, + * will be called with each positional argument encountered. If the function + * returns true, then parsing will stop at that point. + */ + stopAtPositionalTest?: (arg: string) => boolean; } /** * Class returned by the {@link jack} function and all configuration @@ -216,6 +222,8 @@ export declare class Jack { * an explicit CLI setting. */ parse(args?: string[]): Parsed; + loadEnvDefaults(): void; + applyDefaults(p: Parsed): void; /** * Only parse the command line arguments passed in. * Does not strip off the `node script.js` bits, so it must be just the @@ -228,6 +236,7 @@ export declare class Jack { * object. Useful when loading config files or other sources. */ validate(o: unknown): asserts o is Parsed['values']; + writeEnv(p: Parsed): void; /** * Add a heading to the usage output banner */ @@ -283,6 +292,7 @@ export declare class Jack { */ toJSON(): { [k: string]: { + hint?: string | undefined; default?: string | number | boolean | string[] | number[] | boolean[] | undefined; validOptions?: readonly number[] | readonly string[] | undefined; validate?: ((v: unknown) => v is string | number | boolean | string[] | number[] | boolean[]) | undefined; diff --git a/node_modules/jackspeak/dist/commonjs/index.d.ts.map b/node_modules/jackspeak/dist/commonjs/index.d.ts.map index 97653ab6..faf9ddd0 100644 --- a/node_modules/jackspeak/dist/commonjs/index.d.ts.map +++ b/node_modules/jackspeak/dist/commonjs/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAA;AAExD;;GAEG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAE3D,OAAO,EAAE,OAAO,EAAE,cAAc,EAAmB,MAAM,WAAW,CAAA;AA2DpE;;;GAGG;AACH,MAAM,MAAM,UAAU,CACpB,CAAC,SAAS,UAAU,GAAG,UAAU,EACjC,CAAC,SAAS,OAAO,GAAG,OAAO,IAE3B;IAAC,CAAC;IAAE,CAAC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CAAC,GACR,IAAI,CAAC,CAAC,GAAG,oBAAoB,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IAIrD;;OAEG;IACH,OAAO,CAAC,CAAC,SAAS,aAAa,CAAC,QAAQ,CAAC,EACvC,MAAM,EAAE,CAAC,GACR,IAAI,CAAC,CAAC,GAAG,oBAAoB,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAIpD;;OAEG;IACH,IAAI,CAAC,CAAC,SAAS,aAAa,CAAC,SAAS,EAAE,KAAK,CAAC,EAC5C,MAAM,EAAE,CAAC,GACR,IAAI,CAAC,CAAC,GAAG,oBAAoB,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IAItD;;OAEG;IACH,QAAQ,CAAC,CAAC,SAAS,aAAa,CAAC,SAAS,CAAC,EACzC,MAAM,EAAE,CAAC,GACR,IAAI,CAAC,CAAC,GAAG,oBAAoB,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAIrD;;;;OAIG;IACH,SAAS,CAAC,CAAC,SAAS,SAAS,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IA4EtD;;OAEG;IACH,KAAK,IAAI,MAAM;IAgGf;;OAEG;IACH,aAAa,IAAI,MAAM;IAgIvB;;OAEG;IACH,MAAM;;;;;;;;;;;;;IAqBN;;OAEG;IACH,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc;CAGpD;AAsED;;GAEG;AACH,eAAO,MAAM,IAAI,aAAa,WAAW,aAA2B,CAAA"} \ No newline at end of file diff --git a/node_modules/jackspeak/dist/commonjs/index.js b/node_modules/jackspeak/dist/commonjs/index.js index 9737d0d4..b0e016d1 100644 --- a/node_modules/jackspeak/dist/commonjs/index.js +++ b/node_modules/jackspeak/dist/commonjs/index.js @@ -365,9 +365,13 @@ class Jack { * an explicit CLI setting. */ parse(args = process.argv) { - if (args === process.argv) { - args = args.slice(process._eval !== undefined ? 1 : 2); - } + this.loadEnvDefaults(); + const p = this.parseRaw(args); + this.applyDefaults(p); + this.writeEnv(p); + return p; + } + loadEnvDefaults() { if (this.#envPrefix) { for (const [field, my] of Object.entries(this.#configSet)) { const ek = toEnvKey(this.#envPrefix, field); @@ -377,15 +381,14 @@ class Jack { } } } - const p = this.parseRaw(args); + } + applyDefaults(p) { for (const [field, c] of Object.entries(this.#configSet)) { if (c.default !== undefined && !(field in p.values)) { //@ts-ignore p.values[field] = c.default; } } - this.#writeEnv(p); - return p; } /** * Only parse the command line arguments passed in. @@ -394,6 +397,9 @@ class Jack { * Does not read from or write to the environment, or set defaults. */ parseRaw(args) { + if (args === process.argv) { + args = args.slice(process._eval !== undefined ? 1 : 2); + } const options = toParseArgsOptionsConfig(this.#configSet); const result = (0, parse_args_js_1.parseArgs)({ args, @@ -410,7 +416,8 @@ class Jack { for (const token of result.tokens) { if (token.kind === 'positional') { p.positionals.push(token.value); - if (this.#options.stopAtPositional) { + if (this.#options.stopAtPositional || + this.#options.stopAtPositionalTest?.(token.value)) { p.positionals.push(...args.slice(token.index + 1)); break; } @@ -567,7 +574,7 @@ class Jack { } } } - #writeEnv(p) { + writeEnv(p) { if (!this.#env || !this.#envPrefix) return; for (const [field, value] of Object.entries(p.values)) { @@ -922,6 +929,7 @@ class Jack { ...(def.validate ? { validate: def.validate } : {}), ...(def.validOptions ? { validOptions: def.validOptions } : {}), ...(def.default !== undefined ? { default: def.default } : {}), + ...(def.hint ? { hint: def.hint } : {}), }, ])); } @@ -965,8 +973,7 @@ const normalize = (s, pre = false) => { /* c8 ignore next */ const i = isFinite(si) ? si : 0; return ('\n```\n' + - split.map(s => `\u200b${s.substring(i)}`) - .join('\n') + + split.map(s => `\u200b${s.substring(i)}`).join('\n') + '\n```\n'); } return (s diff --git a/node_modules/jackspeak/dist/commonjs/index.js.map b/node_modules/jackspeak/dist/commonjs/index.js.map index ef6502b5..e30e58c7 100644 --- a/node_modules/jackspeak/dist/commonjs/index.js.map +++ b/node_modules/jackspeak/dist/commonjs/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAOA,yCAAoE;AACpE,mDAA2C;AAE3C,kDAAkD;AAClD,YAAY;AACZ,0DAAiC;AACjC,yCAAoC;AAEpC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CACpB,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAC3D,EAAE,CACH,CAAA;AAED,wCAAwC;AACxC,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;AAEzC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,GAAW,EAAU,EAAE;IACrD,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;SAC9C,IAAI,CAAC,GAAG,CAAC;SACT,IAAI,EAAE;SACN,WAAW,EAAE;SACb,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;AACvB,CAAC,CAAA;AAED,MAAM,QAAQ,GAAG,CACf,KAAkE,EAClE,QAAgB,IAAI,EACZ,EAAE;IACV,MAAM,GAAG,GACP,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK;QACjC,CAAC,CAAC,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC;YAC5B,KAAK,CAAC,CAAC,CAAC,GAAG;gBACX,CAAC,CAAC,GAAG;YACP,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;gBAC3C,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;oBACtB,KAAK,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AAC,CAAA;AAAvD,QAAA,IAAI,QAAmD","sourcesContent":["export type ConfigType = 'number' | 'string' | 'boolean'\n\n/**\n * Given a Jack object, get the typeof its ConfigSet\n */\nexport type Unwrap = J extends Jack ? C : never\n\nimport { inspect, InspectOptions, ParseArgsConfig } from 'node:util'\nimport { parseArgs } from './parse-args.js'\n\n// it's a tiny API, just cast it inline, it's fine\n//@ts-ignore\nimport cliui from '@isaacs/cliui'\nimport { basename } from 'node:path'\n\nconst width = Math.min(\n (process && process.stdout && process.stdout.columns) || 80,\n 80,\n)\n\n// indentation spaces from heading level\nconst indent = (n: number) => (n - 1) * 2\n\nconst toEnvKey = (pref: string, key: string): string => {\n return [pref, key.replace(/[^a-zA-Z0-9]+/g, ' ')]\n .join(' ')\n .trim()\n .toUpperCase()\n .replace(/ /g, '_')\n}\n\nconst toEnvVal = (\n value: string | boolean | number | string[] | boolean[] | number[],\n delim: string = '\\n',\n): string => {\n const str =\n typeof value === 'string' ? value\n : typeof value === 'boolean' ?\n value ? '1'\n : '0'\n : typeof value === 'number' ? String(value)\n : Array.isArray(value) ?\n value.map((v: string | number | boolean) => toEnvVal(v)).join(delim)\n : /* c8 ignore start */ undefined\n if (typeof str !== 'string') {\n throw new Error(\n `could not serialize value to environment: ${JSON.stringify(value)}`,\n )\n }\n /* c8 ignore stop */\n return str\n}\n\nconst fromEnvVal = (\n env: string,\n type: T,\n multiple: M,\n delim: string = '\\n',\n): ValidValue =>\n (multiple ?\n env ? env.split(delim).map(v => fromEnvVal(v, type, false))\n : []\n : type === 'string' ? env\n : type === 'boolean' ? env === '1'\n : +env.trim()) as ValidValue\n\n/**\n * Defines the type of value that is valid, given a config definition's\n * {@link ConfigType} and boolean multiple setting\n */\nexport type ValidValue<\n T extends ConfigType = ConfigType,\n M extends boolean = boolean,\n> =\n [T, M] extends ['number', true] ? number[]\n : [T, M] extends ['string', true] ? string[]\n : [T, M] extends ['boolean', true] ? boolean[]\n : [T, M] extends ['number', false] ? number\n : [T, M] extends ['string', false] ? string\n : [T, M] extends ['boolean', false] ? boolean\n : [T, M] extends ['string', boolean] ? string | string[]\n : [T, M] extends ['boolean', boolean] ? boolean | boolean[]\n : [T, M] extends ['number', boolean] ? number | number[]\n : [T, M] extends [ConfigType, false] ? string | number | boolean\n : [T, M] extends [ConfigType, true] ? string[] | number[] | boolean[]\n : string | number | boolean | string[] | number[] | boolean[]\n\n/**\n * The meta information for a config option definition, when the\n * type and multiple values can be inferred by the method being used\n */\nexport type ConfigOptionMeta<\n T extends ConfigType,\n M extends boolean = boolean,\n O extends\n | undefined\n | (T extends 'boolean' ? never\n : T extends 'string' ? readonly string[]\n : T extends 'number' ? readonly number[]\n : readonly number[] | readonly string[]) =\n | undefined\n | (T extends 'boolean' ? never\n : T extends 'string' ? readonly string[]\n : T extends 'number' ? readonly number[]\n : readonly number[] | readonly string[]),\n> = {\n default?:\n | undefined\n | (ValidValue &\n (O extends number[] | string[] ?\n M extends false ?\n O[number]\n : O[number][]\n : unknown))\n validOptions?: O\n description?: string\n validate?:\n | ((v: unknown) => v is ValidValue)\n | ((v: unknown) => boolean)\n short?: string | undefined\n type?: T\n hint?: T extends 'boolean' ? never : string\n delim?: M extends true ? string : never\n} & (M extends false ? { multiple?: false | undefined }\n: M extends true ? { multiple: true }\n: { multiple?: boolean })\n\n/**\n * A set of {@link ConfigOptionMeta} fields, referenced by their longOption\n * string values.\n */\nexport type ConfigMetaSet<\n T extends ConfigType,\n M extends boolean = boolean,\n> = {\n [longOption: string]: ConfigOptionMeta\n}\n\n/**\n * Infer {@link ConfigSet} fields from a given {@link ConfigMetaSet}\n */\nexport type ConfigSetFromMetaSet<\n T extends ConfigType,\n M extends boolean,\n S extends ConfigMetaSet,\n> = {\n [longOption in keyof S]: ConfigOptionBase\n}\n\n/**\n * Fields that can be set on a {@link ConfigOptionBase} or\n * {@link ConfigOptionMeta} based on whether or not the field is known to be\n * multiple.\n */\nexport type MultiType =\n M extends true ?\n {\n multiple: true\n delim?: string | undefined\n }\n : M extends false ?\n {\n multiple?: false | undefined\n delim?: undefined\n }\n : {\n multiple?: boolean | undefined\n delim?: string | undefined\n }\n\n/**\n * A config field definition, in its full representation.\n */\nexport type ConfigOptionBase<\n T extends ConfigType,\n M extends boolean = boolean,\n> = {\n type: T\n short?: string | undefined\n default?: ValidValue | undefined\n description?: string\n hint?: T extends 'boolean' ? undefined : string | undefined\n validate?: (v: unknown) => v is ValidValue\n validOptions?: T extends 'boolean' ? undefined\n : T extends 'string' ? readonly string[]\n : T extends 'number' ? readonly number[]\n : readonly number[] | readonly string[]\n} & MultiType\n\nexport const isConfigType = (t: string): t is ConfigType =>\n typeof t === 'string' &&\n (t === 'string' || t === 'number' || t === 'boolean')\n\nconst undefOrType = (v: unknown, t: string): boolean =>\n v === undefined || typeof v === t\nconst undefOrTypeArray = (v: unknown, t: string): boolean =>\n v === undefined || (Array.isArray(v) && v.every(x => typeof x === t))\n\nconst isValidOption = (v: unknown, vo: readonly unknown[]): boolean =>\n Array.isArray(v) ? v.every(x => isValidOption(x, vo)) : vo.includes(v)\n\n// print the value type, for error message reporting\nconst valueType = (\n v:\n | string\n | number\n | boolean\n | string[]\n | number[]\n | boolean[]\n | { type: ConfigType; multiple?: boolean },\n): string =>\n typeof v === 'string' ? 'string'\n : typeof v === 'boolean' ? 'boolean'\n : typeof v === 'number' ? 'number'\n : Array.isArray(v) ?\n joinTypes([...new Set(v.map(v => valueType(v)))]) + '[]'\n : `${v.type}${v.multiple ? '[]' : ''}`\n\nconst joinTypes = (types: string[]): string =>\n types.length === 1 && typeof types[0] === 'string' ?\n types[0]\n : `(${types.join('|')})`\n\nconst isValidValue = (\n v: unknown,\n type: T,\n multi: M,\n): v is ValidValue => {\n if (multi) {\n if (!Array.isArray(v)) return false\n return !v.some((v: unknown) => !isValidValue(v, type, false))\n }\n if (Array.isArray(v)) return false\n return typeof v === type\n}\n\nexport const isConfigOption = (\n o: any,\n type: T,\n multi: M,\n): o is ConfigOptionBase =>\n !!o &&\n typeof o === 'object' &&\n isConfigType(o.type) &&\n o.type === type &&\n undefOrType(o.short, 'string') &&\n undefOrType(o.description, 'string') &&\n undefOrType(o.hint, 'string') &&\n undefOrType(o.validate, 'function') &&\n (o.type === 'boolean' ?\n o.validOptions === undefined\n : undefOrTypeArray(o.validOptions, o.type)) &&\n (o.default === undefined || isValidValue(o.default, type, multi)) &&\n !!o.multiple === multi\n\n/**\n * A set of {@link ConfigOptionBase} objects, referenced by their longOption\n * string values.\n */\nexport type ConfigSet = {\n [longOption: string]: ConfigOptionBase\n}\n\n/**\n * The 'values' field returned by {@link Jack#parse}\n */\nexport type OptionsResults = {\n [k in keyof T]?: T[k]['validOptions'] extends (\n readonly string[] | readonly number[]\n ) ?\n T[k] extends ConfigOptionBase<'string' | 'number', false> ?\n T[k]['validOptions'][number]\n : T[k] extends ConfigOptionBase<'string' | 'number', true> ?\n T[k]['validOptions'][number][]\n : never\n : T[k] extends ConfigOptionBase<'string', false> ? string\n : T[k] extends ConfigOptionBase<'string', true> ? string[]\n : T[k] extends ConfigOptionBase<'number', false> ? number\n : T[k] extends ConfigOptionBase<'number', true> ? number[]\n : T[k] extends ConfigOptionBase<'boolean', false> ? boolean\n : T[k] extends ConfigOptionBase<'boolean', true> ? boolean[]\n : never\n}\n\n/**\n * The object retured by {@link Jack#parse}\n */\nexport type Parsed = {\n values: OptionsResults\n positionals: string[]\n}\n\nfunction num(\n o: ConfigOptionMeta<'number', false> = {},\n): ConfigOptionBase<'number', false> {\n const { default: def, validate: val, validOptions, ...rest } = o\n if (def !== undefined && !isValidValue(def, 'number', false)) {\n throw new TypeError('invalid default value', {\n cause: {\n found: def,\n wanted: 'number',\n },\n })\n }\n if (!undefOrTypeArray(validOptions, 'number')) {\n throw new TypeError('invalid validOptions', {\n cause: {\n found: validOptions,\n wanted: 'number[]',\n },\n })\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'number', false>)\n : undefined\n return {\n ...rest,\n default: def,\n validate,\n validOptions,\n type: 'number',\n multiple: false,\n }\n}\n\nfunction numList(\n o: ConfigOptionMeta<'number'> = {},\n): ConfigOptionBase<'number', true> {\n const { default: def, validate: val, validOptions, ...rest } = o\n if (def !== undefined && !isValidValue(def, 'number', true)) {\n throw new TypeError('invalid default value', {\n cause: {\n found: def,\n wanted: 'number[]',\n },\n })\n }\n if (!undefOrTypeArray(validOptions, 'number')) {\n throw new TypeError('invalid validOptions', {\n cause: {\n found: validOptions,\n wanted: 'number[]',\n },\n })\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'number', true>)\n : undefined\n return {\n ...rest,\n default: def,\n validate,\n validOptions,\n type: 'number',\n multiple: true,\n }\n}\n\nfunction opt(\n o: ConfigOptionMeta<'string', false> = {},\n): ConfigOptionBase<'string', false> {\n const { default: def, validate: val, validOptions, ...rest } = o\n if (def !== undefined && !isValidValue(def, 'string', false)) {\n throw new TypeError('invalid default value', {\n cause: {\n found: def,\n wanted: 'string',\n },\n })\n }\n if (!undefOrTypeArray(validOptions, 'string')) {\n throw new TypeError('invalid validOptions', {\n cause: {\n found: validOptions,\n wanted: 'string[]',\n },\n })\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'string', false>)\n : undefined\n return {\n ...rest,\n default: def,\n validate,\n validOptions,\n type: 'string',\n multiple: false,\n }\n}\n\nfunction optList(\n o: ConfigOptionMeta<'string'> = {},\n): ConfigOptionBase<'string', true> {\n const { default: def, validate: val, validOptions, ...rest } = o\n if (def !== undefined && !isValidValue(def, 'string', true)) {\n throw new TypeError('invalid default value', {\n cause: {\n found: def,\n wanted: 'string[]',\n },\n })\n }\n if (!undefOrTypeArray(validOptions, 'string')) {\n throw new TypeError('invalid validOptions', {\n cause: {\n found: validOptions,\n wanted: 'string[]',\n },\n })\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'string', true>)\n : undefined\n return {\n ...rest,\n default: def,\n validate,\n validOptions,\n type: 'string',\n multiple: true,\n }\n}\n\nfunction flag(\n o: ConfigOptionMeta<'boolean', false> = {},\n): ConfigOptionBase<'boolean', false> {\n const {\n hint,\n default: def,\n validate: val,\n ...rest\n } = o as ConfigOptionMeta<'boolean', false>\n delete (rest as ConfigOptionMeta<'string', false>).validOptions\n if (def !== undefined && !isValidValue(def, 'boolean', false)) {\n throw new TypeError('invalid default value')\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'boolean', false>)\n : undefined\n if (hint !== undefined) {\n throw new TypeError('cannot provide hint for flag')\n }\n return {\n ...rest,\n default: def,\n validate,\n type: 'boolean',\n multiple: false,\n }\n}\n\nfunction flagList(\n o: ConfigOptionMeta<'boolean'> = {},\n): ConfigOptionBase<'boolean', true> {\n const {\n hint,\n default: def,\n validate: val,\n ...rest\n } = o as ConfigOptionMeta<'boolean', false>\n delete (rest as ConfigOptionMeta<'string', false>).validOptions\n if (def !== undefined && !isValidValue(def, 'boolean', true)) {\n throw new TypeError('invalid default value')\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'boolean', true>)\n : undefined\n if (hint !== undefined) {\n throw new TypeError('cannot provide hint for flag list')\n }\n return {\n ...rest,\n default: def,\n validate,\n type: 'boolean',\n multiple: true,\n }\n}\nconst toParseArgsOptionsConfig = (\n options: ConfigSet,\n): Exclude => {\n const c: Exclude = {}\n for (const longOption in options) {\n const config = options[longOption]\n /* c8 ignore start */\n if (!config) {\n throw new Error('config must be an object: ' + longOption)\n }\n /* c8 ignore start */\n if (isConfigOption(config, 'number', true)) {\n c[longOption] = {\n type: 'string',\n multiple: true,\n default: config.default?.map(c => String(c)),\n }\n } else if (isConfigOption(config, 'number', false)) {\n c[longOption] = {\n type: 'string',\n multiple: false,\n default:\n config.default === undefined ?\n undefined\n : String(config.default),\n }\n } else {\n const conf = config as\n | ConfigOptionBase<'string'>\n | ConfigOptionBase<'boolean'>\n c[longOption] = {\n type: conf.type,\n multiple: !!conf.multiple,\n default: conf.default,\n }\n }\n const clo = c[longOption] as ConfigOptionBase\n if (typeof config.short === 'string') {\n clo.short = config.short\n }\n\n if (\n config.type === 'boolean' &&\n !longOption.startsWith('no-') &&\n !options[`no-${longOption}`]\n ) {\n c[`no-${longOption}`] = {\n type: 'boolean',\n multiple: config.multiple,\n }\n }\n }\n return c\n}\n\n/**\n * A row used when generating the {@link Jack#usage} string\n */\nexport interface Row {\n left?: string\n text: string\n skipLine?: boolean\n type?: string\n}\n\n/**\n * A heading for a section in the usage, created by the jack.heading()\n * method.\n *\n * First heading is always level 1, subsequent headings default to 2.\n *\n * The level of the nearest heading level sets the indentation of the\n * description that follows.\n */\nexport interface Heading extends Row {\n type: 'heading'\n text: string\n left?: ''\n skipLine?: boolean\n level: number\n pre?: boolean\n}\nconst isHeading = (r: { type?: string }): r is Heading =>\n r.type === 'heading'\n\n/**\n * An arbitrary blob of text describing some stuff, set by the\n * jack.description() method.\n *\n * Indentation determined by level of the nearest header.\n */\nexport interface Description extends Row {\n type: 'description'\n text: string\n left?: ''\n skipLine?: boolean\n pre?: boolean\n}\n\nconst isDescription = (r: { type?: string }): r is Description =>\n r.type === 'description'\n\n/**\n * A heading or description row used when generating the {@link Jack#usage}\n * string\n */\nexport type TextRow = Heading | Description\n\n/**\n * Either a {@link TextRow} or a reference to a {@link ConfigOptionBase}\n */\nexport type UsageField =\n | TextRow\n | {\n type: 'config'\n name: string\n value: ConfigOptionBase\n }\n\n/**\n * Options provided to the {@link Jack} constructor\n */\nexport interface JackOptions {\n /**\n * Whether to allow positional arguments\n *\n * @default true\n */\n allowPositionals?: boolean\n\n /**\n * Prefix to use when reading/writing the environment variables\n *\n * If not specified, environment behavior will not be available.\n */\n envPrefix?: string\n\n /**\n * Environment object to read/write. Defaults `process.env`.\n * No effect if `envPrefix` is not set.\n */\n env?: { [k: string]: string | undefined }\n\n /**\n * A short usage string. If not provided, will be generated from the\n * options provided, but that can of course be rather verbose if\n * there are a lot of options.\n */\n usage?: string\n\n /**\n * Stop parsing flags and opts at the first positional argument.\n * This is to support cases like `cmd [flags] [options]`, where\n * each subcommand may have different options. This effectively treats\n * any positional as a `--` argument. Only relevant if `allowPositionals`\n * is true.\n *\n * To do subcommands, set this option, look at the first positional, and\n * parse the remaining positionals as appropriate.\n *\n * @default false\n */\n stopAtPositional?: boolean\n}\n\n/**\n * Class returned by the {@link jack} function and all configuration\n * definition methods. This is what gets chained together.\n */\nexport class Jack {\n #configSet: C\n #shorts: { [k: string]: string }\n #options: JackOptions\n #fields: UsageField[] = []\n #env: { [k: string]: string | undefined }\n #envPrefix?: string\n #allowPositionals: boolean\n #usage?: string\n #usageMarkdown?: string\n\n constructor(options: JackOptions = {}) {\n this.#options = options\n this.#allowPositionals = options.allowPositionals !== false\n this.#env =\n this.#options.env === undefined ? process.env : this.#options.env\n this.#envPrefix = options.envPrefix\n // We need to fib a little, because it's always the same object, but it\n // starts out as having an empty config set. Then each method that adds\n // fields returns `this as Jack`\n this.#configSet = Object.create(null) as C\n this.#shorts = Object.create(null)\n }\n\n /**\n * Set the default value (which will still be overridden by env or cli)\n * as if from a parsed config file. The optional `source` param, if\n * provided, will be included in error messages if a value is invalid or\n * unknown.\n */\n setConfigValues(values: OptionsResults, source = '') {\n try {\n this.validate(values)\n } catch (er) {\n const e = er as Error\n if (source && e && typeof e === 'object') {\n if (e.cause && typeof e.cause === 'object') {\n Object.assign(e.cause, { path: source })\n } else {\n e.cause = { path: source }\n }\n }\n throw e\n }\n for (const [field, value] of Object.entries(values)) {\n const my = this.#configSet[field]\n // already validated, just for TS's benefit\n /* c8 ignore start */\n if (!my) {\n throw new Error('unexpected field in config set: ' + field, {\n cause: { found: field },\n })\n }\n /* c8 ignore stop */\n my.default = value\n }\n return this\n }\n\n /**\n * Parse a string of arguments, and return the resulting\n * `{ values, positionals }` object.\n *\n * If an {@link JackOptions#envPrefix} is set, then it will read default\n * values from the environment, and write the resulting values back\n * to the environment as well.\n *\n * Environment values always take precedence over any other value, except\n * an explicit CLI setting.\n */\n parse(args: string[] = process.argv): Parsed {\n if (args === process.argv) {\n args = args.slice(\n (process as { _eval?: string })._eval !== undefined ? 1 : 2,\n )\n }\n if (this.#envPrefix) {\n for (const [field, my] of Object.entries(this.#configSet)) {\n const ek = toEnvKey(this.#envPrefix, field)\n const env = this.#env[ek]\n if (env !== undefined) {\n my.default = fromEnvVal(env, my.type, !!my.multiple, my.delim)\n }\n }\n }\n\n const p = this.parseRaw(args)\n\n for (const [field, c] of Object.entries(this.#configSet)) {\n if (c.default !== undefined && !(field in p.values)) {\n //@ts-ignore\n p.values[field] = c.default\n }\n }\n\n this.#writeEnv(p)\n\n return p\n }\n\n /**\n * Only parse the command line arguments passed in.\n * Does not strip off the `node script.js` bits, so it must be just the\n * arguments you wish to have parsed.\n * Does not read from or write to the environment, or set defaults.\n */\n parseRaw(args: string[]): Parsed {\n const options = toParseArgsOptionsConfig(this.#configSet)\n const result = parseArgs({\n args,\n options,\n // always strict, but using our own logic\n strict: false,\n allowPositionals: this.#allowPositionals,\n tokens: true,\n })\n\n const p: Parsed = {\n values: {},\n positionals: [],\n }\n for (const token of result.tokens) {\n if (token.kind === 'positional') {\n p.positionals.push(token.value)\n if (this.#options.stopAtPositional) {\n p.positionals.push(...args.slice(token.index + 1))\n break\n }\n } else if (token.kind === 'option') {\n let value: string | number | boolean | undefined = undefined\n if (token.name.startsWith('no-')) {\n const my = this.#configSet[token.name]\n const pname = token.name.substring('no-'.length)\n const pos = this.#configSet[pname]\n if (\n pos &&\n pos.type === 'boolean' &&\n (!my ||\n (my.type === 'boolean' && !!my.multiple === !!pos.multiple))\n ) {\n value = false\n token.name = pname\n }\n }\n const my = this.#configSet[token.name]\n if (!my) {\n throw new Error(\n `Unknown option '${token.rawName}'. ` +\n `To specify a positional argument starting with a '-', ` +\n `place it at the end of the command after '--', as in ` +\n `'-- ${token.rawName}'`,\n {\n cause: {\n found:\n token.rawName + (token.value ? `=${token.value}` : ''),\n },\n },\n )\n }\n if (value === undefined) {\n if (token.value === undefined) {\n if (my.type !== 'boolean') {\n throw new Error(\n `No value provided for ${token.rawName}, expected ${my.type}`,\n {\n cause: {\n name: token.rawName,\n wanted: valueType(my),\n },\n },\n )\n }\n value = true\n } else {\n if (my.type === 'boolean') {\n throw new Error(\n `Flag ${token.rawName} does not take a value, received '${token.value}'`,\n { cause: { found: token } },\n )\n }\n if (my.type === 'string') {\n value = token.value\n } else {\n value = +token.value\n if (value !== value) {\n throw new Error(\n `Invalid value '${token.value}' provided for ` +\n `'${token.rawName}' option, expected number`,\n {\n cause: {\n name: token.rawName,\n found: token.value,\n wanted: 'number',\n },\n },\n )\n }\n }\n }\n }\n if (my.multiple) {\n const pv = p.values as {\n [k: string]: (string | number | boolean)[]\n }\n const tn = pv[token.name] ?? []\n pv[token.name] = tn\n tn.push(value)\n } else {\n const pv = p.values as { [k: string]: string | number | boolean }\n pv[token.name] = value\n }\n }\n }\n\n for (const [field, value] of Object.entries(p.values)) {\n const valid = this.#configSet[field]?.validate\n const validOptions = this.#configSet[field]?.validOptions\n let cause:\n | undefined\n | {\n name: string\n found: unknown\n validOptions?: readonly string[] | readonly number[]\n }\n if (validOptions && !isValidOption(value, validOptions)) {\n cause = { name: field, found: value, validOptions: validOptions }\n }\n if (valid && !valid(value)) {\n cause ??= { name: field, found: value }\n }\n if (cause) {\n throw new Error(\n `Invalid value provided for --${field}: ${JSON.stringify(\n value,\n )}`,\n { cause },\n )\n }\n }\n\n return p\n }\n\n /**\n * do not set fields as 'no-foo' if 'foo' exists and both are bools\n * just set foo.\n */\n #noNoFields(f: string, val: unknown, s: string = f) {\n if (!f.startsWith('no-') || typeof val !== 'boolean') return\n const yes = f.substring('no-'.length)\n // recurse so we get the core config key we care about.\n this.#noNoFields(yes, val, s)\n if (this.#configSet[yes]?.type === 'boolean') {\n throw new Error(\n `do not set '${s}', instead set '${yes}' as desired.`,\n { cause: { found: s, wanted: yes } },\n )\n }\n }\n\n /**\n * Validate that any arbitrary object is a valid configuration `values`\n * object. Useful when loading config files or other sources.\n */\n validate(o: unknown): asserts o is Parsed['values'] {\n if (!o || typeof o !== 'object') {\n throw new Error('Invalid config: not an object', {\n cause: { found: o },\n })\n }\n const opts = o as Record\n for (const field in o) {\n const value = opts[field]\n /* c8 ignore next - for TS */\n if (value === undefined) continue\n this.#noNoFields(field, value)\n const config = this.#configSet[field]\n if (!config) {\n throw new Error(`Unknown config option: ${field}`, {\n cause: { found: field },\n })\n }\n if (!isValidValue(value, config.type, !!config.multiple)) {\n throw new Error(\n `Invalid value ${valueType(\n value,\n )} for ${field}, expected ${valueType(config)}`,\n {\n cause: {\n name: field,\n found: value,\n wanted: valueType(config),\n },\n },\n )\n }\n let cause:\n | undefined\n | {\n name: string\n found: any\n validOptions?: readonly string[] | readonly number[]\n }\n if (\n config.validOptions &&\n !isValidOption(value, config.validOptions)\n ) {\n cause = {\n name: field,\n found: value,\n validOptions: config.validOptions,\n }\n }\n if (config.validate && !config.validate(value)) {\n cause ??= { name: field, found: value }\n }\n if (cause) {\n throw new Error(`Invalid config value for ${field}: ${value}`, {\n cause,\n })\n }\n }\n }\n\n #writeEnv(p: Parsed) {\n if (!this.#env || !this.#envPrefix) return\n for (const [field, value] of Object.entries(p.values)) {\n const my = this.#configSet[field]\n this.#env[toEnvKey(this.#envPrefix, field)] = toEnvVal(\n value,\n my?.delim,\n )\n }\n }\n\n /**\n * Add a heading to the usage output banner\n */\n heading(\n text: string,\n level?: 1 | 2 | 3 | 4 | 5 | 6,\n { pre = false }: { pre?: boolean } = {},\n ): Jack {\n if (level === undefined) {\n level = this.#fields.some(r => isHeading(r)) ? 2 : 1\n }\n this.#fields.push({ type: 'heading', text, level, pre })\n return this\n }\n\n /**\n * Add a long-form description to the usage output at this position.\n */\n description(text: string, { pre }: { pre?: boolean } = {}): Jack {\n this.#fields.push({ type: 'description', text, pre })\n return this\n }\n\n /**\n * Add one or more number fields.\n */\n num>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, num)\n }\n\n /**\n * Add one or more multiple number fields.\n */\n numList>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, numList)\n }\n\n /**\n * Add one or more string option fields.\n */\n opt>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, opt)\n }\n\n /**\n * Add one or more multiple string option fields.\n */\n optList>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, optList)\n }\n\n /**\n * Add one or more flag fields.\n */\n flag>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, flag)\n }\n\n /**\n * Add one or more multiple flag fields.\n */\n flagList>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, flagList)\n }\n\n /**\n * Generic field definition method. Similar to flag/flagList/number/etc,\n * but you must specify the `type` (and optionally `multiple` and `delim`)\n * fields on each one, or Jack won't know how to define them.\n */\n addFields(fields: F): Jack {\n const next = this as unknown as Jack\n for (const [name, field] of Object.entries(fields)) {\n this.#validateName(name, field)\n next.#fields.push({\n type: 'config',\n name,\n value: field as ConfigOptionBase,\n })\n }\n Object.assign(next.#configSet, fields)\n return next\n }\n\n #addFields<\n T extends ConfigType,\n M extends boolean,\n F extends ConfigMetaSet,\n >(\n fields: F,\n fn: (m: ConfigOptionMeta) => ConfigOptionBase,\n ): Jack> {\n type NextC = C & ConfigSetFromMetaSet\n const next = this as unknown as Jack\n Object.assign(\n next.#configSet,\n Object.fromEntries(\n Object.entries(fields).map(([name, field]) => {\n this.#validateName(name, field)\n const option = fn(field)\n next.#fields.push({\n type: 'config',\n name,\n value: option as ConfigOptionBase,\n })\n return [name, option]\n }),\n ),\n )\n return next\n }\n\n #validateName(name: string, field: { short?: string }) {\n if (!/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/.test(name)) {\n throw new TypeError(\n `Invalid option name: ${name}, ` +\n `must be '-' delimited ASCII alphanumeric`,\n )\n }\n if (this.#configSet[name]) {\n throw new TypeError(`Cannot redefine option ${field}`)\n }\n if (this.#shorts[name]) {\n throw new TypeError(\n `Cannot redefine option ${name}, already ` +\n `in use for ${this.#shorts[name]}`,\n )\n }\n if (field.short) {\n if (!/^[a-zA-Z0-9]$/.test(field.short)) {\n throw new TypeError(\n `Invalid ${name} short option: ${field.short}, ` +\n 'must be 1 ASCII alphanumeric character',\n )\n }\n if (this.#shorts[field.short]) {\n throw new TypeError(\n `Invalid ${name} short option: ${field.short}, ` +\n `already in use for ${this.#shorts[field.short]}`,\n )\n }\n this.#shorts[field.short] = name\n this.#shorts[name] = name\n }\n }\n\n /**\n * Return the usage banner for the given configuration\n */\n usage(): string {\n if (this.#usage) return this.#usage\n\n let headingLevel = 1\n const ui = cliui({ width })\n const first = this.#fields[0]\n let start = first?.type === 'heading' ? 1 : 0\n if (first?.type === 'heading') {\n ui.div({\n padding: [0, 0, 0, 0],\n text: normalize(first.text),\n })\n }\n ui.div({ padding: [0, 0, 0, 0], text: 'Usage:' })\n if (this.#options.usage) {\n ui.div({\n text: this.#options.usage,\n padding: [0, 0, 0, 2],\n })\n } else {\n const cmd = basename(String(process.argv[1]))\n const shortFlags: string[] = []\n const shorts: string[][] = []\n const flags: string[] = []\n const opts: string[][] = []\n for (const [field, config] of Object.entries(this.#configSet)) {\n if (config.short) {\n if (config.type === 'boolean') shortFlags.push(config.short)\n else shorts.push([config.short, config.hint || field])\n } else {\n if (config.type === 'boolean') flags.push(field)\n else opts.push([field, config.hint || field])\n }\n }\n const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''\n const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const lf = flags.map(k => ` --${k}`).join('')\n const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const usage = `${cmd}${sf}${so}${lf}${lo}`.trim()\n ui.div({\n text: usage,\n padding: [0, 0, 0, 2],\n })\n }\n\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n const maybeDesc = this.#fields[start]\n if (maybeDesc && isDescription(maybeDesc)) {\n const print = normalize(maybeDesc.text, maybeDesc.pre)\n start++\n ui.div({ padding: [0, 0, 0, 0], text: print })\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n }\n\n const { rows, maxWidth } = this.#usageRows(start)\n\n // every heading/description after the first gets indented by 2\n // extra spaces.\n for (const row of rows) {\n if (row.left) {\n // If the row is too long, don't wrap it\n // Bump the right-hand side down a line to make room\n const configIndent = indent(Math.max(headingLevel, 2))\n if (row.left.length > maxWidth - 3) {\n ui.div({ text: row.left, padding: [0, 0, 0, configIndent] })\n ui.div({ text: row.text, padding: [0, 0, 0, maxWidth] })\n } else {\n ui.div(\n {\n text: row.left,\n padding: [0, 1, 0, configIndent],\n width: maxWidth,\n },\n { padding: [0, 0, 0, 0], text: row.text },\n )\n }\n if (row.skipLine) {\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n }\n } else {\n if (isHeading(row)) {\n const { level } = row\n headingLevel = level\n // only h1 and h2 have bottom padding\n // h3-h6 do not\n const b = level <= 2 ? 1 : 0\n ui.div({ ...row, padding: [0, 0, b, indent(level)] })\n } else {\n ui.div({ ...row, padding: [0, 0, 1, indent(headingLevel + 1)] })\n }\n }\n }\n\n return (this.#usage = ui.toString())\n }\n\n /**\n * Return the usage banner markdown for the given configuration\n */\n usageMarkdown(): string {\n if (this.#usageMarkdown) return this.#usageMarkdown\n\n const out: string[] = []\n\n let headingLevel = 1\n const first = this.#fields[0]\n let start = first?.type === 'heading' ? 1 : 0\n if (first?.type === 'heading') {\n out.push(`# ${normalizeOneLine(first.text)}`)\n }\n out.push('Usage:')\n if (this.#options.usage) {\n out.push(normalizeMarkdown(this.#options.usage, true))\n } else {\n const cmd = basename(String(process.argv[1]))\n const shortFlags: string[] = []\n const shorts: string[][] = []\n const flags: string[] = []\n const opts: string[][] = []\n for (const [field, config] of Object.entries(this.#configSet)) {\n if (config.short) {\n if (config.type === 'boolean') shortFlags.push(config.short)\n else shorts.push([config.short, config.hint || field])\n } else {\n if (config.type === 'boolean') flags.push(field)\n else opts.push([field, config.hint || field])\n }\n }\n const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''\n const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const lf = flags.map(k => ` --${k}`).join('')\n const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const usage = `${cmd}${sf}${so}${lf}${lo}`.trim()\n out.push(normalizeMarkdown(usage, true))\n }\n\n const maybeDesc = this.#fields[start]\n if (maybeDesc && isDescription(maybeDesc)) {\n out.push(normalizeMarkdown(maybeDesc.text, maybeDesc.pre))\n start++\n }\n\n const { rows } = this.#usageRows(start)\n\n // heading level in markdown is number of # ahead of text\n for (const row of rows) {\n if (row.left) {\n out.push(\n '#'.repeat(headingLevel + 1) +\n ' ' +\n normalizeOneLine(row.left, true),\n )\n if (row.text) out.push(normalizeMarkdown(row.text))\n } else if (isHeading(row)) {\n const { level } = row\n headingLevel = level\n out.push(\n `${'#'.repeat(headingLevel)} ${normalizeOneLine(\n row.text,\n row.pre,\n )}`,\n )\n } else {\n out.push(normalizeMarkdown(row.text, !!(row as Description).pre))\n }\n }\n\n return (this.#usageMarkdown = out.join('\\n\\n') + '\\n')\n }\n\n #usageRows(start: number) {\n // turn each config type into a row, and figure out the width of the\n // left hand indentation for the option descriptions.\n let maxMax = Math.max(12, Math.min(26, Math.floor(width / 3)))\n let maxWidth = 8\n let prev: Row | TextRow | undefined = undefined\n const rows: (Row | TextRow)[] = []\n for (const field of this.#fields.slice(start)) {\n if (field.type !== 'config') {\n if (prev?.type === 'config') prev.skipLine = true\n prev = undefined\n field.text = normalize(field.text, !!field.pre)\n rows.push(field)\n continue\n }\n const { value } = field\n const desc = value.description || ''\n const mult = value.multiple ? 'Can be set multiple times' : ''\n const opts =\n value.validOptions?.length ?\n `Valid options:${value.validOptions.map(\n v => ` ${JSON.stringify(v)}`,\n )}`\n : ''\n const dmDelim = desc.includes('\\n') ? '\\n\\n' : '\\n'\n const extra = [opts, mult].join(dmDelim).trim()\n const text = (normalize(desc) + dmDelim + extra).trim()\n const hint =\n value.hint ||\n (value.type === 'number' ? 'n'\n : value.type === 'string' ? field.name\n : undefined)\n const short =\n !value.short ? ''\n : value.type === 'boolean' ? `-${value.short} `\n : `-${value.short}<${hint}> `\n const left =\n value.type === 'boolean' ?\n `${short}--${field.name}`\n : `${short}--${field.name}=<${hint}>`\n const row: Row = { text, left, type: 'config' }\n if (text.length > width - maxMax) {\n row.skipLine = true\n }\n if (prev && left.length > maxMax) prev.skipLine = true\n prev = row\n const len = left.length + 4\n if (len > maxWidth && len < maxMax) {\n maxWidth = len\n }\n\n rows.push(row)\n }\n\n return { rows, maxWidth }\n }\n\n /**\n * Return the configuration options as a plain object\n */\n toJSON() {\n return Object.fromEntries(\n Object.entries(this.#configSet).map(([field, def]) => [\n field,\n {\n type: def.type,\n ...(def.multiple ? { multiple: true } : {}),\n ...(def.delim ? { delim: def.delim } : {}),\n ...(def.short ? { short: def.short } : {}),\n ...(def.description ?\n { description: normalize(def.description) }\n : {}),\n ...(def.validate ? { validate: def.validate } : {}),\n ...(def.validOptions ? { validOptions: def.validOptions } : {}),\n ...(def.default !== undefined ? { default: def.default } : {}),\n },\n ]),\n )\n }\n\n /**\n * Custom printer for `util.inspect`\n */\n [inspect.custom](_: number, options: InspectOptions) {\n return `Jack ${inspect(this.toJSON(), options)}`\n }\n}\n\n// Unwrap and un-indent, so we can wrap description\n// strings however makes them look nice in the code.\nconst normalize = (s: string, pre = false) => {\n if (pre)\n // prepend a ZWSP to each line so cliui doesn't strip it.\n return s\n .split('\\n')\n .map(l => `\\u200b${l}`)\n .join('\\n')\n return s\n .split(/^\\s*```\\s*$/gm)\n .map((s, i) => {\n if (i % 2 === 1) {\n if (!s.trim()) {\n return `\\`\\`\\`\\n\\`\\`\\`\\n`\n }\n // outdent the ``` blocks, but preserve whitespace otherwise.\n const split = s.split('\\n')\n // throw out the \\n at the start and end\n split.pop()\n split.shift()\n const si = split.reduce((shortest, l) => {\n /* c8 ignore next */\n const ind = l.match(/^\\s*/)?.[0] ?? ''\n if (ind.length) return Math.min(ind.length, shortest)\n else return shortest\n }, Infinity)\n /* c8 ignore next */\n const i = isFinite(si) ? si : 0\n return (\n '\\n```\\n' +\n split.map(\n s =>\n `\\u200b${s.substring(i)}`,\n )\n .join('\\n') +\n '\\n```\\n'\n )\n }\n return (\n s\n // remove single line breaks, except for lists\n .replace(/([^\\n])\\n[ \\t]*([^\\n])/g, (_, $1, $2) =>\n !/^[-*]/.test($2) ? `${$1} ${$2}` : `${$1}\\n${$2}`,\n )\n // normalize mid-line whitespace\n .replace(/([^\\n])[ \\t]+([^\\n])/g, '$1 $2')\n // two line breaks are enough\n .replace(/\\n{3,}/g, '\\n\\n')\n // remove any spaces at the start of a line\n .replace(/\\n[ \\t]+/g, '\\n')\n .trim()\n )\n })\n .join('\\n')\n}\n\n// normalize for markdown printing, remove leading spaces on lines\nconst normalizeMarkdown = (s: string, pre: boolean = false): string => {\n const n = normalize(s, pre).replace(/\\\\/g, '\\\\\\\\')\n return pre ?\n `\\`\\`\\`\\n${n.replace(/\\u200b/g, '')}\\n\\`\\`\\``\n : n.replace(/\\n +/g, '\\n').trim()\n}\n\nconst normalizeOneLine = (s: string, pre: boolean = false) => {\n const n = normalize(s, pre)\n .replace(/[\\s\\u200b]+/g, ' ')\n .trim()\n return pre ? `\\`${n}\\`` : n\n}\n\n/**\n * Main entry point. Create and return a {@link Jack} object.\n */\nexport const jack = (options: JackOptions = {}) => new Jack(options)\n"]} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAOA,yCAAoE;AACpE,mDAA2C;AAE3C,kDAAkD;AAClD,YAAY;AACZ,0DAAiC;AACjC,yCAAoC;AAEpC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CACpB,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAC3D,EAAE,CACH,CAAA;AAED,wCAAwC;AACxC,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;AAEzC,MAAM,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uBAAuB,EAAE,OAAO,CAAC;YAC1C,6BAA6B;aAC5B,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;YAC3B,2CAA2C;aAC1C,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC;aAC1B,IAAI,EAAE,CACV,CAAA;IACH,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAA;AACf,CAAC,CAAA;AAED,kEAAkE;AAClE,MAAM,iBAAiB,GAAG,CAAC,CAAS,EAAE,MAAe,KAAK,EAAU,EAAE;IACpE,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IAClD,OAAO,GAAG,CAAC,CAAC;QACR,WAAW,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,UAAU;QAC/C,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAA;AACrC,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG,CAAC,CAAS,EAAE,MAAe,KAAK,EAAE,EAAE;IAC3D,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC;SACxB,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC;SAC5B,IAAI,EAAE,CAAA;IACT,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;AAC7B,CAAC,CAAA;AAED;;GAEG;AACI,MAAM,IAAI,GAAG,CAAC,UAAuB,EAAE,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAA;AAAvD,QAAA,IAAI,QAAmD","sourcesContent":["export type ConfigType = 'number' | 'string' | 'boolean'\n\n/**\n * Given a Jack object, get the typeof its ConfigSet\n */\nexport type Unwrap = J extends Jack ? C : never\n\nimport { inspect, InspectOptions, ParseArgsConfig } from 'node:util'\nimport { parseArgs } from './parse-args.js'\n\n// it's a tiny API, just cast it inline, it's fine\n//@ts-ignore\nimport cliui from '@isaacs/cliui'\nimport { basename } from 'node:path'\n\nconst width = Math.min(\n (process && process.stdout && process.stdout.columns) || 80,\n 80,\n)\n\n// indentation spaces from heading level\nconst indent = (n: number) => (n - 1) * 2\n\nconst toEnvKey = (pref: string, key: string): string => {\n return [pref, key.replace(/[^a-zA-Z0-9]+/g, ' ')]\n .join(' ')\n .trim()\n .toUpperCase()\n .replace(/ /g, '_')\n}\n\nconst toEnvVal = (\n value: string | boolean | number | string[] | boolean[] | number[],\n delim: string = '\\n',\n): string => {\n const str =\n typeof value === 'string' ? value\n : typeof value === 'boolean' ?\n value ? '1'\n : '0'\n : typeof value === 'number' ? String(value)\n : Array.isArray(value) ?\n value.map((v: string | number | boolean) => toEnvVal(v)).join(delim)\n : /* c8 ignore start */ undefined\n if (typeof str !== 'string') {\n throw new Error(\n `could not serialize value to environment: ${JSON.stringify(value)}`,\n )\n }\n /* c8 ignore stop */\n return str\n}\n\nconst fromEnvVal = (\n env: string,\n type: T,\n multiple: M,\n delim: string = '\\n',\n): ValidValue =>\n (multiple ?\n env ? env.split(delim).map(v => fromEnvVal(v, type, false))\n : []\n : type === 'string' ? env\n : type === 'boolean' ? env === '1'\n : +env.trim()) as ValidValue\n\n/**\n * Defines the type of value that is valid, given a config definition's\n * {@link ConfigType} and boolean multiple setting\n */\nexport type ValidValue<\n T extends ConfigType = ConfigType,\n M extends boolean = boolean,\n> =\n [T, M] extends ['number', true] ? number[]\n : [T, M] extends ['string', true] ? string[]\n : [T, M] extends ['boolean', true] ? boolean[]\n : [T, M] extends ['number', false] ? number\n : [T, M] extends ['string', false] ? string\n : [T, M] extends ['boolean', false] ? boolean\n : [T, M] extends ['string', boolean] ? string | string[]\n : [T, M] extends ['boolean', boolean] ? boolean | boolean[]\n : [T, M] extends ['number', boolean] ? number | number[]\n : [T, M] extends [ConfigType, false] ? string | number | boolean\n : [T, M] extends [ConfigType, true] ? string[] | number[] | boolean[]\n : string | number | boolean | string[] | number[] | boolean[]\n\n/**\n * The meta information for a config option definition, when the\n * type and multiple values can be inferred by the method being used\n */\nexport type ConfigOptionMeta<\n T extends ConfigType,\n M extends boolean = boolean,\n O extends\n | undefined\n | (T extends 'boolean' ? never\n : T extends 'string' ? readonly string[]\n : T extends 'number' ? readonly number[]\n : readonly number[] | readonly string[]) =\n | undefined\n | (T extends 'boolean' ? never\n : T extends 'string' ? readonly string[]\n : T extends 'number' ? readonly number[]\n : readonly number[] | readonly string[]),\n> = {\n default?:\n | undefined\n | (ValidValue &\n (O extends number[] | string[] ?\n M extends false ?\n O[number]\n : O[number][]\n : unknown))\n validOptions?: O\n description?: string\n validate?:\n | ((v: unknown) => v is ValidValue)\n | ((v: unknown) => boolean)\n short?: string | undefined\n type?: T\n hint?: T extends 'boolean' ? never : string\n delim?: M extends true ? string : never\n} & (M extends false ? { multiple?: false | undefined }\n: M extends true ? { multiple: true }\n: { multiple?: boolean })\n\n/**\n * A set of {@link ConfigOptionMeta} fields, referenced by their longOption\n * string values.\n */\nexport type ConfigMetaSet<\n T extends ConfigType,\n M extends boolean = boolean,\n> = {\n [longOption: string]: ConfigOptionMeta\n}\n\n/**\n * Infer {@link ConfigSet} fields from a given {@link ConfigMetaSet}\n */\nexport type ConfigSetFromMetaSet<\n T extends ConfigType,\n M extends boolean,\n S extends ConfigMetaSet,\n> = {\n [longOption in keyof S]: ConfigOptionBase\n}\n\n/**\n * Fields that can be set on a {@link ConfigOptionBase} or\n * {@link ConfigOptionMeta} based on whether or not the field is known to be\n * multiple.\n */\nexport type MultiType =\n M extends true ?\n {\n multiple: true\n delim?: string | undefined\n }\n : M extends false ?\n {\n multiple?: false | undefined\n delim?: undefined\n }\n : {\n multiple?: boolean | undefined\n delim?: string | undefined\n }\n\n/**\n * A config field definition, in its full representation.\n */\nexport type ConfigOptionBase<\n T extends ConfigType,\n M extends boolean = boolean,\n> = {\n type: T\n short?: string | undefined\n default?: ValidValue | undefined\n description?: string\n hint?: T extends 'boolean' ? undefined : string | undefined\n validate?: (v: unknown) => v is ValidValue\n validOptions?: T extends 'boolean' ? undefined\n : T extends 'string' ? readonly string[]\n : T extends 'number' ? readonly number[]\n : readonly number[] | readonly string[]\n} & MultiType\n\nexport const isConfigType = (t: string): t is ConfigType =>\n typeof t === 'string' &&\n (t === 'string' || t === 'number' || t === 'boolean')\n\nconst undefOrType = (v: unknown, t: string): boolean =>\n v === undefined || typeof v === t\nconst undefOrTypeArray = (v: unknown, t: string): boolean =>\n v === undefined || (Array.isArray(v) && v.every(x => typeof x === t))\n\nconst isValidOption = (v: unknown, vo: readonly unknown[]): boolean =>\n Array.isArray(v) ? v.every(x => isValidOption(x, vo)) : vo.includes(v)\n\n// print the value type, for error message reporting\nconst valueType = (\n v:\n | string\n | number\n | boolean\n | string[]\n | number[]\n | boolean[]\n | { type: ConfigType; multiple?: boolean },\n): string =>\n typeof v === 'string' ? 'string'\n : typeof v === 'boolean' ? 'boolean'\n : typeof v === 'number' ? 'number'\n : Array.isArray(v) ?\n joinTypes([...new Set(v.map(v => valueType(v)))]) + '[]'\n : `${v.type}${v.multiple ? '[]' : ''}`\n\nconst joinTypes = (types: string[]): string =>\n types.length === 1 && typeof types[0] === 'string' ?\n types[0]\n : `(${types.join('|')})`\n\nconst isValidValue = (\n v: unknown,\n type: T,\n multi: M,\n): v is ValidValue => {\n if (multi) {\n if (!Array.isArray(v)) return false\n return !v.some((v: unknown) => !isValidValue(v, type, false))\n }\n if (Array.isArray(v)) return false\n return typeof v === type\n}\n\nexport const isConfigOption = (\n o: any,\n type: T,\n multi: M,\n): o is ConfigOptionBase =>\n !!o &&\n typeof o === 'object' &&\n isConfigType(o.type) &&\n o.type === type &&\n undefOrType(o.short, 'string') &&\n undefOrType(o.description, 'string') &&\n undefOrType(o.hint, 'string') &&\n undefOrType(o.validate, 'function') &&\n (o.type === 'boolean' ?\n o.validOptions === undefined\n : undefOrTypeArray(o.validOptions, o.type)) &&\n (o.default === undefined || isValidValue(o.default, type, multi)) &&\n !!o.multiple === multi\n\n/**\n * A set of {@link ConfigOptionBase} objects, referenced by their longOption\n * string values.\n */\nexport type ConfigSet = {\n [longOption: string]: ConfigOptionBase\n}\n\n/**\n * The 'values' field returned by {@link Jack#parse}\n */\nexport type OptionsResults = {\n [k in keyof T]?: T[k]['validOptions'] extends (\n readonly string[] | readonly number[]\n ) ?\n T[k] extends ConfigOptionBase<'string' | 'number', false> ?\n T[k]['validOptions'][number]\n : T[k] extends ConfigOptionBase<'string' | 'number', true> ?\n T[k]['validOptions'][number][]\n : never\n : T[k] extends ConfigOptionBase<'string', false> ? string\n : T[k] extends ConfigOptionBase<'string', true> ? string[]\n : T[k] extends ConfigOptionBase<'number', false> ? number\n : T[k] extends ConfigOptionBase<'number', true> ? number[]\n : T[k] extends ConfigOptionBase<'boolean', false> ? boolean\n : T[k] extends ConfigOptionBase<'boolean', true> ? boolean[]\n : never\n}\n\n/**\n * The object retured by {@link Jack#parse}\n */\nexport type Parsed = {\n values: OptionsResults\n positionals: string[]\n}\n\nfunction num(\n o: ConfigOptionMeta<'number', false> = {},\n): ConfigOptionBase<'number', false> {\n const { default: def, validate: val, validOptions, ...rest } = o\n if (def !== undefined && !isValidValue(def, 'number', false)) {\n throw new TypeError('invalid default value', {\n cause: {\n found: def,\n wanted: 'number',\n },\n })\n }\n if (!undefOrTypeArray(validOptions, 'number')) {\n throw new TypeError('invalid validOptions', {\n cause: {\n found: validOptions,\n wanted: 'number[]',\n },\n })\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'number', false>)\n : undefined\n return {\n ...rest,\n default: def,\n validate,\n validOptions,\n type: 'number',\n multiple: false,\n }\n}\n\nfunction numList(\n o: ConfigOptionMeta<'number'> = {},\n): ConfigOptionBase<'number', true> {\n const { default: def, validate: val, validOptions, ...rest } = o\n if (def !== undefined && !isValidValue(def, 'number', true)) {\n throw new TypeError('invalid default value', {\n cause: {\n found: def,\n wanted: 'number[]',\n },\n })\n }\n if (!undefOrTypeArray(validOptions, 'number')) {\n throw new TypeError('invalid validOptions', {\n cause: {\n found: validOptions,\n wanted: 'number[]',\n },\n })\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'number', true>)\n : undefined\n return {\n ...rest,\n default: def,\n validate,\n validOptions,\n type: 'number',\n multiple: true,\n }\n}\n\nfunction opt(\n o: ConfigOptionMeta<'string', false> = {},\n): ConfigOptionBase<'string', false> {\n const { default: def, validate: val, validOptions, ...rest } = o\n if (def !== undefined && !isValidValue(def, 'string', false)) {\n throw new TypeError('invalid default value', {\n cause: {\n found: def,\n wanted: 'string',\n },\n })\n }\n if (!undefOrTypeArray(validOptions, 'string')) {\n throw new TypeError('invalid validOptions', {\n cause: {\n found: validOptions,\n wanted: 'string[]',\n },\n })\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'string', false>)\n : undefined\n return {\n ...rest,\n default: def,\n validate,\n validOptions,\n type: 'string',\n multiple: false,\n }\n}\n\nfunction optList(\n o: ConfigOptionMeta<'string'> = {},\n): ConfigOptionBase<'string', true> {\n const { default: def, validate: val, validOptions, ...rest } = o\n if (def !== undefined && !isValidValue(def, 'string', true)) {\n throw new TypeError('invalid default value', {\n cause: {\n found: def,\n wanted: 'string[]',\n },\n })\n }\n if (!undefOrTypeArray(validOptions, 'string')) {\n throw new TypeError('invalid validOptions', {\n cause: {\n found: validOptions,\n wanted: 'string[]',\n },\n })\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'string', true>)\n : undefined\n return {\n ...rest,\n default: def,\n validate,\n validOptions,\n type: 'string',\n multiple: true,\n }\n}\n\nfunction flag(\n o: ConfigOptionMeta<'boolean', false> = {},\n): ConfigOptionBase<'boolean', false> {\n const {\n hint,\n default: def,\n validate: val,\n ...rest\n } = o as ConfigOptionMeta<'boolean', false>\n delete (rest as ConfigOptionMeta<'string', false>).validOptions\n if (def !== undefined && !isValidValue(def, 'boolean', false)) {\n throw new TypeError('invalid default value')\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'boolean', false>)\n : undefined\n if (hint !== undefined) {\n throw new TypeError('cannot provide hint for flag')\n }\n return {\n ...rest,\n default: def,\n validate,\n type: 'boolean',\n multiple: false,\n }\n}\n\nfunction flagList(\n o: ConfigOptionMeta<'boolean'> = {},\n): ConfigOptionBase<'boolean', true> {\n const {\n hint,\n default: def,\n validate: val,\n ...rest\n } = o as ConfigOptionMeta<'boolean', false>\n delete (rest as ConfigOptionMeta<'string', false>).validOptions\n if (def !== undefined && !isValidValue(def, 'boolean', true)) {\n throw new TypeError('invalid default value')\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'boolean', true>)\n : undefined\n if (hint !== undefined) {\n throw new TypeError('cannot provide hint for flag list')\n }\n return {\n ...rest,\n default: def,\n validate,\n type: 'boolean',\n multiple: true,\n }\n}\nconst toParseArgsOptionsConfig = (\n options: ConfigSet,\n): Exclude => {\n const c: Exclude = {}\n for (const longOption in options) {\n const config = options[longOption]\n /* c8 ignore start */\n if (!config) {\n throw new Error('config must be an object: ' + longOption)\n }\n /* c8 ignore start */\n if (isConfigOption(config, 'number', true)) {\n c[longOption] = {\n type: 'string',\n multiple: true,\n default: config.default?.map(c => String(c)),\n }\n } else if (isConfigOption(config, 'number', false)) {\n c[longOption] = {\n type: 'string',\n multiple: false,\n default:\n config.default === undefined ?\n undefined\n : String(config.default),\n }\n } else {\n const conf = config as\n | ConfigOptionBase<'string'>\n | ConfigOptionBase<'boolean'>\n c[longOption] = {\n type: conf.type,\n multiple: !!conf.multiple,\n default: conf.default,\n }\n }\n const clo = c[longOption] as ConfigOptionBase\n if (typeof config.short === 'string') {\n clo.short = config.short\n }\n\n if (\n config.type === 'boolean' &&\n !longOption.startsWith('no-') &&\n !options[`no-${longOption}`]\n ) {\n c[`no-${longOption}`] = {\n type: 'boolean',\n multiple: config.multiple,\n }\n }\n }\n return c\n}\n\n/**\n * A row used when generating the {@link Jack#usage} string\n */\nexport interface Row {\n left?: string\n text: string\n skipLine?: boolean\n type?: string\n}\n\n/**\n * A heading for a section in the usage, created by the jack.heading()\n * method.\n *\n * First heading is always level 1, subsequent headings default to 2.\n *\n * The level of the nearest heading level sets the indentation of the\n * description that follows.\n */\nexport interface Heading extends Row {\n type: 'heading'\n text: string\n left?: ''\n skipLine?: boolean\n level: number\n pre?: boolean\n}\nconst isHeading = (r: { type?: string }): r is Heading =>\n r.type === 'heading'\n\n/**\n * An arbitrary blob of text describing some stuff, set by the\n * jack.description() method.\n *\n * Indentation determined by level of the nearest header.\n */\nexport interface Description extends Row {\n type: 'description'\n text: string\n left?: ''\n skipLine?: boolean\n pre?: boolean\n}\n\nconst isDescription = (r: { type?: string }): r is Description =>\n r.type === 'description'\n\n/**\n * A heading or description row used when generating the {@link Jack#usage}\n * string\n */\nexport type TextRow = Heading | Description\n\n/**\n * Either a {@link TextRow} or a reference to a {@link ConfigOptionBase}\n */\nexport type UsageField =\n | TextRow\n | {\n type: 'config'\n name: string\n value: ConfigOptionBase\n }\n\n/**\n * Options provided to the {@link Jack} constructor\n */\nexport interface JackOptions {\n /**\n * Whether to allow positional arguments\n *\n * @default true\n */\n allowPositionals?: boolean\n\n /**\n * Prefix to use when reading/writing the environment variables\n *\n * If not specified, environment behavior will not be available.\n */\n envPrefix?: string\n\n /**\n * Environment object to read/write. Defaults `process.env`.\n * No effect if `envPrefix` is not set.\n */\n env?: { [k: string]: string | undefined }\n\n /**\n * A short usage string. If not provided, will be generated from the\n * options provided, but that can of course be rather verbose if\n * there are a lot of options.\n */\n usage?: string\n\n /**\n * Stop parsing flags and opts at the first positional argument.\n * This is to support cases like `cmd [flags] [options]`, where\n * each subcommand may have different options. This effectively treats\n * any positional as a `--` argument. Only relevant if `allowPositionals`\n * is true.\n *\n * To do subcommands, set this option, look at the first positional, and\n * parse the remaining positionals as appropriate.\n *\n * @default false\n */\n stopAtPositional?: boolean\n\n /**\n * Conditional `stopAtPositional`. If set to a `(string)=>boolean` function,\n * will be called with each positional argument encountered. If the function\n * returns true, then parsing will stop at that point.\n */\n stopAtPositionalTest?: (arg: string) => boolean\n}\n\n/**\n * Class returned by the {@link jack} function and all configuration\n * definition methods. This is what gets chained together.\n */\nexport class Jack {\n #configSet: C\n #shorts: { [k: string]: string }\n #options: JackOptions\n #fields: UsageField[] = []\n #env: { [k: string]: string | undefined }\n #envPrefix?: string\n #allowPositionals: boolean\n #usage?: string\n #usageMarkdown?: string\n\n constructor(options: JackOptions = {}) {\n this.#options = options\n this.#allowPositionals = options.allowPositionals !== false\n this.#env =\n this.#options.env === undefined ? process.env : this.#options.env\n this.#envPrefix = options.envPrefix\n // We need to fib a little, because it's always the same object, but it\n // starts out as having an empty config set. Then each method that adds\n // fields returns `this as Jack`\n this.#configSet = Object.create(null) as C\n this.#shorts = Object.create(null)\n }\n\n /**\n * Set the default value (which will still be overridden by env or cli)\n * as if from a parsed config file. The optional `source` param, if\n * provided, will be included in error messages if a value is invalid or\n * unknown.\n */\n setConfigValues(values: OptionsResults, source = '') {\n try {\n this.validate(values)\n } catch (er) {\n const e = er as Error\n if (source && e && typeof e === 'object') {\n if (e.cause && typeof e.cause === 'object') {\n Object.assign(e.cause, { path: source })\n } else {\n e.cause = { path: source }\n }\n }\n throw e\n }\n for (const [field, value] of Object.entries(values)) {\n const my = this.#configSet[field]\n // already validated, just for TS's benefit\n /* c8 ignore start */\n if (!my) {\n throw new Error('unexpected field in config set: ' + field, {\n cause: { found: field },\n })\n }\n /* c8 ignore stop */\n my.default = value\n }\n return this\n }\n\n /**\n * Parse a string of arguments, and return the resulting\n * `{ values, positionals }` object.\n *\n * If an {@link JackOptions#envPrefix} is set, then it will read default\n * values from the environment, and write the resulting values back\n * to the environment as well.\n *\n * Environment values always take precedence over any other value, except\n * an explicit CLI setting.\n */\n parse(args: string[] = process.argv): Parsed {\n this.loadEnvDefaults()\n const p = this.parseRaw(args)\n this.applyDefaults(p)\n this.writeEnv(p)\n return p\n }\n\n loadEnvDefaults() {\n if (this.#envPrefix) {\n for (const [field, my] of Object.entries(this.#configSet)) {\n const ek = toEnvKey(this.#envPrefix, field)\n const env = this.#env[ek]\n if (env !== undefined) {\n my.default = fromEnvVal(env, my.type, !!my.multiple, my.delim)\n }\n }\n }\n }\n\n applyDefaults(p: Parsed) {\n for (const [field, c] of Object.entries(this.#configSet)) {\n if (c.default !== undefined && !(field in p.values)) {\n //@ts-ignore\n p.values[field] = c.default\n }\n }\n }\n\n /**\n * Only parse the command line arguments passed in.\n * Does not strip off the `node script.js` bits, so it must be just the\n * arguments you wish to have parsed.\n * Does not read from or write to the environment, or set defaults.\n */\n parseRaw(args: string[]): Parsed {\n if (args === process.argv) {\n args = args.slice(\n (process as { _eval?: string })._eval !== undefined ? 1 : 2,\n )\n }\n\n const options = toParseArgsOptionsConfig(this.#configSet)\n const result = parseArgs({\n args,\n options,\n // always strict, but using our own logic\n strict: false,\n allowPositionals: this.#allowPositionals,\n tokens: true,\n })\n\n const p: Parsed = {\n values: {},\n positionals: [],\n }\n for (const token of result.tokens) {\n if (token.kind === 'positional') {\n p.positionals.push(token.value)\n if (\n this.#options.stopAtPositional ||\n this.#options.stopAtPositionalTest?.(token.value)\n ) {\n p.positionals.push(...args.slice(token.index + 1))\n break\n }\n } else if (token.kind === 'option') {\n let value: string | number | boolean | undefined = undefined\n if (token.name.startsWith('no-')) {\n const my = this.#configSet[token.name]\n const pname = token.name.substring('no-'.length)\n const pos = this.#configSet[pname]\n if (\n pos &&\n pos.type === 'boolean' &&\n (!my ||\n (my.type === 'boolean' && !!my.multiple === !!pos.multiple))\n ) {\n value = false\n token.name = pname\n }\n }\n const my = this.#configSet[token.name]\n if (!my) {\n throw new Error(\n `Unknown option '${token.rawName}'. ` +\n `To specify a positional argument starting with a '-', ` +\n `place it at the end of the command after '--', as in ` +\n `'-- ${token.rawName}'`,\n {\n cause: {\n found:\n token.rawName + (token.value ? `=${token.value}` : ''),\n },\n },\n )\n }\n if (value === undefined) {\n if (token.value === undefined) {\n if (my.type !== 'boolean') {\n throw new Error(\n `No value provided for ${token.rawName}, expected ${my.type}`,\n {\n cause: {\n name: token.rawName,\n wanted: valueType(my),\n },\n },\n )\n }\n value = true\n } else {\n if (my.type === 'boolean') {\n throw new Error(\n `Flag ${token.rawName} does not take a value, received '${token.value}'`,\n { cause: { found: token } },\n )\n }\n if (my.type === 'string') {\n value = token.value\n } else {\n value = +token.value\n if (value !== value) {\n throw new Error(\n `Invalid value '${token.value}' provided for ` +\n `'${token.rawName}' option, expected number`,\n {\n cause: {\n name: token.rawName,\n found: token.value,\n wanted: 'number',\n },\n },\n )\n }\n }\n }\n }\n if (my.multiple) {\n const pv = p.values as {\n [k: string]: (string | number | boolean)[]\n }\n const tn = pv[token.name] ?? []\n pv[token.name] = tn\n tn.push(value)\n } else {\n const pv = p.values as { [k: string]: string | number | boolean }\n pv[token.name] = value\n }\n }\n }\n\n for (const [field, value] of Object.entries(p.values)) {\n const valid = this.#configSet[field]?.validate\n const validOptions = this.#configSet[field]?.validOptions\n let cause:\n | undefined\n | {\n name: string\n found: unknown\n validOptions?: readonly string[] | readonly number[]\n }\n if (validOptions && !isValidOption(value, validOptions)) {\n cause = { name: field, found: value, validOptions: validOptions }\n }\n if (valid && !valid(value)) {\n cause ??= { name: field, found: value }\n }\n if (cause) {\n throw new Error(\n `Invalid value provided for --${field}: ${JSON.stringify(\n value,\n )}`,\n { cause },\n )\n }\n }\n\n return p\n }\n\n /**\n * do not set fields as 'no-foo' if 'foo' exists and both are bools\n * just set foo.\n */\n #noNoFields(f: string, val: unknown, s: string = f) {\n if (!f.startsWith('no-') || typeof val !== 'boolean') return\n const yes = f.substring('no-'.length)\n // recurse so we get the core config key we care about.\n this.#noNoFields(yes, val, s)\n if (this.#configSet[yes]?.type === 'boolean') {\n throw new Error(\n `do not set '${s}', instead set '${yes}' as desired.`,\n { cause: { found: s, wanted: yes } },\n )\n }\n }\n\n /**\n * Validate that any arbitrary object is a valid configuration `values`\n * object. Useful when loading config files or other sources.\n */\n validate(o: unknown): asserts o is Parsed['values'] {\n if (!o || typeof o !== 'object') {\n throw new Error('Invalid config: not an object', {\n cause: { found: o },\n })\n }\n const opts = o as Record\n for (const field in o) {\n const value = opts[field]\n /* c8 ignore next - for TS */\n if (value === undefined) continue\n this.#noNoFields(field, value)\n const config = this.#configSet[field]\n if (!config) {\n throw new Error(`Unknown config option: ${field}`, {\n cause: { found: field },\n })\n }\n if (!isValidValue(value, config.type, !!config.multiple)) {\n throw new Error(\n `Invalid value ${valueType(\n value,\n )} for ${field}, expected ${valueType(config)}`,\n {\n cause: {\n name: field,\n found: value,\n wanted: valueType(config),\n },\n },\n )\n }\n let cause:\n | undefined\n | {\n name: string\n found: any\n validOptions?: readonly string[] | readonly number[]\n }\n if (\n config.validOptions &&\n !isValidOption(value, config.validOptions)\n ) {\n cause = {\n name: field,\n found: value,\n validOptions: config.validOptions,\n }\n }\n if (config.validate && !config.validate(value)) {\n cause ??= { name: field, found: value }\n }\n if (cause) {\n throw new Error(`Invalid config value for ${field}: ${value}`, {\n cause,\n })\n }\n }\n }\n\n writeEnv(p: Parsed) {\n if (!this.#env || !this.#envPrefix) return\n for (const [field, value] of Object.entries(p.values)) {\n const my = this.#configSet[field]\n this.#env[toEnvKey(this.#envPrefix, field)] = toEnvVal(\n value,\n my?.delim,\n )\n }\n }\n\n /**\n * Add a heading to the usage output banner\n */\n heading(\n text: string,\n level?: 1 | 2 | 3 | 4 | 5 | 6,\n { pre = false }: { pre?: boolean } = {},\n ): Jack {\n if (level === undefined) {\n level = this.#fields.some(r => isHeading(r)) ? 2 : 1\n }\n this.#fields.push({ type: 'heading', text, level, pre })\n return this\n }\n\n /**\n * Add a long-form description to the usage output at this position.\n */\n description(text: string, { pre }: { pre?: boolean } = {}): Jack {\n this.#fields.push({ type: 'description', text, pre })\n return this\n }\n\n /**\n * Add one or more number fields.\n */\n num>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, num)\n }\n\n /**\n * Add one or more multiple number fields.\n */\n numList>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, numList)\n }\n\n /**\n * Add one or more string option fields.\n */\n opt>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, opt)\n }\n\n /**\n * Add one or more multiple string option fields.\n */\n optList>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, optList)\n }\n\n /**\n * Add one or more flag fields.\n */\n flag>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, flag)\n }\n\n /**\n * Add one or more multiple flag fields.\n */\n flagList>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, flagList)\n }\n\n /**\n * Generic field definition method. Similar to flag/flagList/number/etc,\n * but you must specify the `type` (and optionally `multiple` and `delim`)\n * fields on each one, or Jack won't know how to define them.\n */\n addFields(fields: F): Jack {\n const next = this as unknown as Jack\n for (const [name, field] of Object.entries(fields)) {\n this.#validateName(name, field)\n next.#fields.push({\n type: 'config',\n name,\n value: field as ConfigOptionBase,\n })\n }\n Object.assign(next.#configSet, fields)\n return next\n }\n\n #addFields<\n T extends ConfigType,\n M extends boolean,\n F extends ConfigMetaSet,\n >(\n fields: F,\n fn: (m: ConfigOptionMeta) => ConfigOptionBase,\n ): Jack> {\n type NextC = C & ConfigSetFromMetaSet\n const next = this as unknown as Jack\n Object.assign(\n next.#configSet,\n Object.fromEntries(\n Object.entries(fields).map(([name, field]) => {\n this.#validateName(name, field)\n const option = fn(field)\n next.#fields.push({\n type: 'config',\n name,\n value: option as ConfigOptionBase,\n })\n return [name, option]\n }),\n ),\n )\n return next\n }\n\n #validateName(name: string, field: { short?: string }) {\n if (!/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/.test(name)) {\n throw new TypeError(\n `Invalid option name: ${name}, ` +\n `must be '-' delimited ASCII alphanumeric`,\n )\n }\n if (this.#configSet[name]) {\n throw new TypeError(`Cannot redefine option ${field}`)\n }\n if (this.#shorts[name]) {\n throw new TypeError(\n `Cannot redefine option ${name}, already ` +\n `in use for ${this.#shorts[name]}`,\n )\n }\n if (field.short) {\n if (!/^[a-zA-Z0-9]$/.test(field.short)) {\n throw new TypeError(\n `Invalid ${name} short option: ${field.short}, ` +\n 'must be 1 ASCII alphanumeric character',\n )\n }\n if (this.#shorts[field.short]) {\n throw new TypeError(\n `Invalid ${name} short option: ${field.short}, ` +\n `already in use for ${this.#shorts[field.short]}`,\n )\n }\n this.#shorts[field.short] = name\n this.#shorts[name] = name\n }\n }\n\n /**\n * Return the usage banner for the given configuration\n */\n usage(): string {\n if (this.#usage) return this.#usage\n\n let headingLevel = 1\n const ui = cliui({ width })\n const first = this.#fields[0]\n let start = first?.type === 'heading' ? 1 : 0\n if (first?.type === 'heading') {\n ui.div({\n padding: [0, 0, 0, 0],\n text: normalize(first.text),\n })\n }\n ui.div({ padding: [0, 0, 0, 0], text: 'Usage:' })\n if (this.#options.usage) {\n ui.div({\n text: this.#options.usage,\n padding: [0, 0, 0, 2],\n })\n } else {\n const cmd = basename(String(process.argv[1]))\n const shortFlags: string[] = []\n const shorts: string[][] = []\n const flags: string[] = []\n const opts: string[][] = []\n for (const [field, config] of Object.entries(this.#configSet)) {\n if (config.short) {\n if (config.type === 'boolean') shortFlags.push(config.short)\n else shorts.push([config.short, config.hint || field])\n } else {\n if (config.type === 'boolean') flags.push(field)\n else opts.push([field, config.hint || field])\n }\n }\n const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''\n const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const lf = flags.map(k => ` --${k}`).join('')\n const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const usage = `${cmd}${sf}${so}${lf}${lo}`.trim()\n ui.div({\n text: usage,\n padding: [0, 0, 0, 2],\n })\n }\n\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n const maybeDesc = this.#fields[start]\n if (maybeDesc && isDescription(maybeDesc)) {\n const print = normalize(maybeDesc.text, maybeDesc.pre)\n start++\n ui.div({ padding: [0, 0, 0, 0], text: print })\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n }\n\n const { rows, maxWidth } = this.#usageRows(start)\n\n // every heading/description after the first gets indented by 2\n // extra spaces.\n for (const row of rows) {\n if (row.left) {\n // If the row is too long, don't wrap it\n // Bump the right-hand side down a line to make room\n const configIndent = indent(Math.max(headingLevel, 2))\n if (row.left.length > maxWidth - 3) {\n ui.div({ text: row.left, padding: [0, 0, 0, configIndent] })\n ui.div({ text: row.text, padding: [0, 0, 0, maxWidth] })\n } else {\n ui.div(\n {\n text: row.left,\n padding: [0, 1, 0, configIndent],\n width: maxWidth,\n },\n { padding: [0, 0, 0, 0], text: row.text },\n )\n }\n if (row.skipLine) {\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n }\n } else {\n if (isHeading(row)) {\n const { level } = row\n headingLevel = level\n // only h1 and h2 have bottom padding\n // h3-h6 do not\n const b = level <= 2 ? 1 : 0\n ui.div({ ...row, padding: [0, 0, b, indent(level)] })\n } else {\n ui.div({ ...row, padding: [0, 0, 1, indent(headingLevel + 1)] })\n }\n }\n }\n\n return (this.#usage = ui.toString())\n }\n\n /**\n * Return the usage banner markdown for the given configuration\n */\n usageMarkdown(): string {\n if (this.#usageMarkdown) return this.#usageMarkdown\n\n const out: string[] = []\n\n let headingLevel = 1\n const first = this.#fields[0]\n let start = first?.type === 'heading' ? 1 : 0\n if (first?.type === 'heading') {\n out.push(`# ${normalizeOneLine(first.text)}`)\n }\n out.push('Usage:')\n if (this.#options.usage) {\n out.push(normalizeMarkdown(this.#options.usage, true))\n } else {\n const cmd = basename(String(process.argv[1]))\n const shortFlags: string[] = []\n const shorts: string[][] = []\n const flags: string[] = []\n const opts: string[][] = []\n for (const [field, config] of Object.entries(this.#configSet)) {\n if (config.short) {\n if (config.type === 'boolean') shortFlags.push(config.short)\n else shorts.push([config.short, config.hint || field])\n } else {\n if (config.type === 'boolean') flags.push(field)\n else opts.push([field, config.hint || field])\n }\n }\n const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''\n const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const lf = flags.map(k => ` --${k}`).join('')\n const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const usage = `${cmd}${sf}${so}${lf}${lo}`.trim()\n out.push(normalizeMarkdown(usage, true))\n }\n\n const maybeDesc = this.#fields[start]\n if (maybeDesc && isDescription(maybeDesc)) {\n out.push(normalizeMarkdown(maybeDesc.text, maybeDesc.pre))\n start++\n }\n\n const { rows } = this.#usageRows(start)\n\n // heading level in markdown is number of # ahead of text\n for (const row of rows) {\n if (row.left) {\n out.push(\n '#'.repeat(headingLevel + 1) +\n ' ' +\n normalizeOneLine(row.left, true),\n )\n if (row.text) out.push(normalizeMarkdown(row.text))\n } else if (isHeading(row)) {\n const { level } = row\n headingLevel = level\n out.push(\n `${'#'.repeat(headingLevel)} ${normalizeOneLine(\n row.text,\n row.pre,\n )}`,\n )\n } else {\n out.push(normalizeMarkdown(row.text, !!(row as Description).pre))\n }\n }\n\n return (this.#usageMarkdown = out.join('\\n\\n') + '\\n')\n }\n\n #usageRows(start: number) {\n // turn each config type into a row, and figure out the width of the\n // left hand indentation for the option descriptions.\n let maxMax = Math.max(12, Math.min(26, Math.floor(width / 3)))\n let maxWidth = 8\n let prev: Row | TextRow | undefined = undefined\n const rows: (Row | TextRow)[] = []\n for (const field of this.#fields.slice(start)) {\n if (field.type !== 'config') {\n if (prev?.type === 'config') prev.skipLine = true\n prev = undefined\n field.text = normalize(field.text, !!field.pre)\n rows.push(field)\n continue\n }\n const { value } = field\n const desc = value.description || ''\n const mult = value.multiple ? 'Can be set multiple times' : ''\n const opts =\n value.validOptions?.length ?\n `Valid options:${value.validOptions.map(\n v => ` ${JSON.stringify(v)}`,\n )}`\n : ''\n const dmDelim = desc.includes('\\n') ? '\\n\\n' : '\\n'\n const extra = [opts, mult].join(dmDelim).trim()\n const text = (normalize(desc) + dmDelim + extra).trim()\n const hint =\n value.hint ||\n (value.type === 'number' ? 'n'\n : value.type === 'string' ? field.name\n : undefined)\n const short =\n !value.short ? ''\n : value.type === 'boolean' ? `-${value.short} `\n : `-${value.short}<${hint}> `\n const left =\n value.type === 'boolean' ?\n `${short}--${field.name}`\n : `${short}--${field.name}=<${hint}>`\n const row: Row = { text, left, type: 'config' }\n if (text.length > width - maxMax) {\n row.skipLine = true\n }\n if (prev && left.length > maxMax) prev.skipLine = true\n prev = row\n const len = left.length + 4\n if (len > maxWidth && len < maxMax) {\n maxWidth = len\n }\n\n rows.push(row)\n }\n\n return { rows, maxWidth }\n }\n\n /**\n * Return the configuration options as a plain object\n */\n toJSON() {\n return Object.fromEntries(\n Object.entries(this.#configSet).map(([field, def]) => [\n field,\n {\n type: def.type,\n ...(def.multiple ? { multiple: true } : {}),\n ...(def.delim ? { delim: def.delim } : {}),\n ...(def.short ? { short: def.short } : {}),\n ...(def.description ?\n { description: normalize(def.description) }\n : {}),\n ...(def.validate ? { validate: def.validate } : {}),\n ...(def.validOptions ? { validOptions: def.validOptions } : {}),\n ...(def.default !== undefined ? { default: def.default } : {}),\n ...(def.hint ? { hint: def.hint } : {}),\n },\n ]),\n )\n }\n\n /**\n * Custom printer for `util.inspect`\n */\n [inspect.custom](_: number, options: InspectOptions) {\n return `Jack ${inspect(this.toJSON(), options)}`\n }\n}\n\n// Unwrap and un-indent, so we can wrap description\n// strings however makes them look nice in the code.\nconst normalize = (s: string, pre = false) => {\n if (pre)\n // prepend a ZWSP to each line so cliui doesn't strip it.\n return s\n .split('\\n')\n .map(l => `\\u200b${l}`)\n .join('\\n')\n return s\n .split(/^\\s*```\\s*$/gm)\n .map((s, i) => {\n if (i % 2 === 1) {\n if (!s.trim()) {\n return `\\`\\`\\`\\n\\`\\`\\`\\n`\n }\n // outdent the ``` blocks, but preserve whitespace otherwise.\n const split = s.split('\\n')\n // throw out the \\n at the start and end\n split.pop()\n split.shift()\n const si = split.reduce((shortest, l) => {\n /* c8 ignore next */\n const ind = l.match(/^\\s*/)?.[0] ?? ''\n if (ind.length) return Math.min(ind.length, shortest)\n else return shortest\n }, Infinity)\n /* c8 ignore next */\n const i = isFinite(si) ? si : 0\n return (\n '\\n```\\n' +\n split.map(s => `\\u200b${s.substring(i)}`).join('\\n') +\n '\\n```\\n'\n )\n }\n return (\n s\n // remove single line breaks, except for lists\n .replace(/([^\\n])\\n[ \\t]*([^\\n])/g, (_, $1, $2) =>\n !/^[-*]/.test($2) ? `${$1} ${$2}` : `${$1}\\n${$2}`,\n )\n // normalize mid-line whitespace\n .replace(/([^\\n])[ \\t]+([^\\n])/g, '$1 $2')\n // two line breaks are enough\n .replace(/\\n{3,}/g, '\\n\\n')\n // remove any spaces at the start of a line\n .replace(/\\n[ \\t]+/g, '\\n')\n .trim()\n )\n })\n .join('\\n')\n}\n\n// normalize for markdown printing, remove leading spaces on lines\nconst normalizeMarkdown = (s: string, pre: boolean = false): string => {\n const n = normalize(s, pre).replace(/\\\\/g, '\\\\\\\\')\n return pre ?\n `\\`\\`\\`\\n${n.replace(/\\u200b/g, '')}\\n\\`\\`\\``\n : n.replace(/\\n +/g, '\\n').trim()\n}\n\nconst normalizeOneLine = (s: string, pre: boolean = false) => {\n const n = normalize(s, pre)\n .replace(/[\\s\\u200b]+/g, ' ')\n .trim()\n return pre ? `\\`${n}\\`` : n\n}\n\n/**\n * Main entry point. Create and return a {@link Jack} object.\n */\nexport const jack = (options: JackOptions = {}) => new Jack(options)\n"]} \ No newline at end of file diff --git a/node_modules/jackspeak/dist/esm/index.d.ts b/node_modules/jackspeak/dist/esm/index.d.ts index 87d25698..214a1773 100644 --- a/node_modules/jackspeak/dist/esm/index.d.ts +++ b/node_modules/jackspeak/dist/esm/index.d.ts @@ -189,6 +189,12 @@ export interface JackOptions { * @default false */ stopAtPositional?: boolean; + /** + * Conditional `stopAtPositional`. If set to a `(string)=>boolean` function, + * will be called with each positional argument encountered. If the function + * returns true, then parsing will stop at that point. + */ + stopAtPositionalTest?: (arg: string) => boolean; } /** * Class returned by the {@link jack} function and all configuration @@ -216,6 +222,8 @@ export declare class Jack { * an explicit CLI setting. */ parse(args?: string[]): Parsed; + loadEnvDefaults(): void; + applyDefaults(p: Parsed): void; /** * Only parse the command line arguments passed in. * Does not strip off the `node script.js` bits, so it must be just the @@ -228,6 +236,7 @@ export declare class Jack { * object. Useful when loading config files or other sources. */ validate(o: unknown): asserts o is Parsed['values']; + writeEnv(p: Parsed): void; /** * Add a heading to the usage output banner */ @@ -283,6 +292,7 @@ export declare class Jack { */ toJSON(): { [k: string]: { + hint?: string | undefined; default?: string | number | boolean | string[] | number[] | boolean[] | undefined; validOptions?: readonly number[] | readonly string[] | undefined; validate?: ((v: unknown) => v is string | number | boolean | string[] | number[] | boolean[]) | undefined; diff --git a/node_modules/jackspeak/dist/esm/index.d.ts.map b/node_modules/jackspeak/dist/esm/index.d.ts.map index 97653ab6..faf9ddd0 100644 --- a/node_modules/jackspeak/dist/esm/index.d.ts.map +++ b/node_modules/jackspeak/dist/esm/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAA;AAExD;;GAEG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAE3D,OAAO,EAAE,OAAO,EAAE,cAAc,EAAmB,MAAM,WAAW,CAAA;AA2DpE;;;GAGG;AACH,MAAM,MAAM,UAAU,CACpB,CAAC,SAAS,UAAU,GAAG,UAAU,EACjC,CAAC,SAAS,OAAO,GAAG,OAAO,IAE3B;IAAC,CAAC;IAAE,CAAC;CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,MAAM,EAAE,GACxC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,MAAM,EAAE,GAC1C,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CA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C,CAAC,GAAG,oBAAoB,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAIpD;;OAEG;IACH,IAAI,CAAC,CAAC,SAAS,aAAa,CAAC,SAAS,EAAE,KAAK,CAAC,EAC5C,MAAM,EAAE,CAAC,GACR,IAAI,CAAC,CAAC,GAAG,oBAAoB,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IAItD;;OAEG;IACH,QAAQ,CAAC,CAAC,SAAS,aAAa,CAAC,SAAS,CAAC,EACzC,MAAM,EAAE,CAAC,GACR,IAAI,CAAC,CAAC,GAAG,oBAAoB,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAIrD;;;;OAIG;IACH,SAAS,CAAC,CAAC,SAAS,SAAS,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IA4EtD;;OAEG;IACH,KAAK,IAAI,MAAM;IAgGf;;OAEG;IACH,aAAa,IAAI,MAAM;IAgIvB;;OAEG;IACH,MAAM;;;;;;;;;;;;;IAqBN;;OAEG;IACH,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc;CAGpD;AAsED;;GAEG;AACH,eAAO,MAAM,IAAI,aAAa,WAAW,aAA2B,CAAA"} \ No newline at end of file diff --git a/node_modules/jackspeak/dist/esm/index.js b/node_modules/jackspeak/dist/esm/index.js index 0cceff7d..8eef5b4e 100644 --- a/node_modules/jackspeak/dist/esm/index.js +++ b/node_modules/jackspeak/dist/esm/index.js @@ -357,9 +357,13 @@ export class Jack { * an explicit CLI setting. */ parse(args = process.argv) { - if (args === process.argv) { - args = args.slice(process._eval !== undefined ? 1 : 2); - } + this.loadEnvDefaults(); + const p = this.parseRaw(args); + this.applyDefaults(p); + this.writeEnv(p); + return p; + } + loadEnvDefaults() { if (this.#envPrefix) { for (const [field, my] of Object.entries(this.#configSet)) { const ek = toEnvKey(this.#envPrefix, field); @@ -369,15 +373,14 @@ export class Jack { } } } - const p = this.parseRaw(args); + } + applyDefaults(p) { for (const [field, c] of Object.entries(this.#configSet)) { if (c.default !== undefined && !(field in p.values)) { //@ts-ignore p.values[field] = c.default; } } - this.#writeEnv(p); - return p; } /** * Only parse the command line arguments passed in. @@ -386,6 +389,9 @@ export class Jack { * Does not read from or write to the environment, or set defaults. */ parseRaw(args) { + if (args === process.argv) { + args = args.slice(process._eval !== undefined ? 1 : 2); + } const options = toParseArgsOptionsConfig(this.#configSet); const result = parseArgs({ args, @@ -402,7 +408,8 @@ export class Jack { for (const token of result.tokens) { if (token.kind === 'positional') { p.positionals.push(token.value); - if (this.#options.stopAtPositional) { + if (this.#options.stopAtPositional || + this.#options.stopAtPositionalTest?.(token.value)) { p.positionals.push(...args.slice(token.index + 1)); break; } @@ -559,7 +566,7 @@ export class Jack { } } } - #writeEnv(p) { + writeEnv(p) { if (!this.#env || !this.#envPrefix) return; for (const [field, value] of Object.entries(p.values)) { @@ -914,6 +921,7 @@ export class Jack { ...(def.validate ? { validate: def.validate } : {}), ...(def.validOptions ? { validOptions: def.validOptions } : {}), ...(def.default !== undefined ? { default: def.default } : {}), + ...(def.hint ? { hint: def.hint } : {}), }, ])); } @@ -956,8 +964,7 @@ const normalize = (s, pre = false) => { /* c8 ignore next */ const i = isFinite(si) ? si : 0; return ('\n```\n' + - split.map(s => `\u200b${s.substring(i)}`) - .join('\n') + + split.map(s => `\u200b${s.substring(i)}`).join('\n') + '\n```\n'); } return (s diff --git a/node_modules/jackspeak/dist/esm/index.js.map b/node_modules/jackspeak/dist/esm/index.js.map index 699f3e87..82c23b0a 100644 --- a/node_modules/jackspeak/dist/esm/index.js.map +++ b/node_modules/jackspeak/dist/esm/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAmC,MAAM,WAAW,CAAA;AACpE,OAAO,EA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EAAE,OAAO,CAAC;YAC1C,6BAA6B;aAC5B,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;YAC3B,2CAA2C;aAC1C,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC;aAC1B,IAAI,EAAE,CACV,CAAA;IACH,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAA;AACf,CAAC,CAAA;AAED,kEAAkE;AAClE,MAAM,iBAAiB,GAAG,CAAC,CAAS,EAAE,MAAe,KAAK,EAAU,EAAE;IACpE,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IAClD,OAAO,GAAG,CAAC,CAAC;QACR,WAAW,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,UAAU;QAC/C,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAA;AACrC,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG,CAAC,CAAS,EAAE,MAAe,KAAK,EAAE,EAAE;IAC3D,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC;SACxB,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC;SAC5B,IAAI,EAAE,CAAA;IACT,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;AAC7B,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,UAAuB,EAAE,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAA","sourcesContent":["export type ConfigType = 'number' | 'string' | 'boolean'\n\n/**\n * Given a Jack object, get the typeof its ConfigSet\n */\nexport type Unwrap = J extends Jack ? C : never\n\nimport { inspect, InspectOptions, ParseArgsConfig } from 'node:util'\nimport { parseArgs } from './parse-args.js'\n\n// it's a tiny API, just cast it inline, it's fine\n//@ts-ignore\nimport cliui from '@isaacs/cliui'\nimport { basename } from 'node:path'\n\nconst width = Math.min(\n (process && process.stdout && process.stdout.columns) || 80,\n 80,\n)\n\n// indentation spaces from heading level\nconst indent = (n: number) => (n - 1) * 2\n\nconst toEnvKey = (pref: string, key: string): string => {\n return [pref, key.replace(/[^a-zA-Z0-9]+/g, ' ')]\n .join(' ')\n .trim()\n .toUpperCase()\n .replace(/ /g, '_')\n}\n\nconst toEnvVal = (\n value: string | boolean | number | string[] | boolean[] | number[],\n delim: string = '\\n',\n): string => {\n const str =\n typeof value === 'string' ? value\n : typeof value === 'boolean' ?\n value ? '1'\n : '0'\n : typeof value === 'number' ? String(value)\n : Array.isArray(value) ?\n value.map((v: string | number | boolean) => toEnvVal(v)).join(delim)\n : /* c8 ignore start */ undefined\n if (typeof str !== 'string') {\n throw new Error(\n `could not serialize value to environment: ${JSON.stringify(value)}`,\n )\n }\n /* c8 ignore stop */\n return str\n}\n\nconst fromEnvVal = (\n env: string,\n type: T,\n multiple: M,\n delim: string = '\\n',\n): ValidValue =>\n (multiple ?\n env ? env.split(delim).map(v => fromEnvVal(v, type, false))\n : []\n : type === 'string' ? env\n : type === 'boolean' ? env === '1'\n : +env.trim()) as ValidValue\n\n/**\n * Defines the type of value that is valid, given a config definition's\n * {@link ConfigType} and boolean multiple setting\n */\nexport type ValidValue<\n T extends ConfigType = ConfigType,\n M extends boolean = boolean,\n> =\n [T, M] extends ['number', true] ? number[]\n : [T, M] extends ['string', true] ? string[]\n : [T, M] extends ['boolean', true] ? boolean[]\n : [T, M] extends ['number', false] ? number\n : [T, M] extends ['string', false] ? string\n : [T, M] extends ['boolean', false] ? boolean\n : [T, M] extends ['string', boolean] ? string | string[]\n : [T, M] extends ['boolean', boolean] ? boolean | boolean[]\n : [T, M] extends ['number', boolean] ? number | number[]\n : [T, M] extends [ConfigType, false] ? string | number | boolean\n : [T, M] extends [ConfigType, true] ? string[] | number[] | boolean[]\n : string | number | boolean | string[] | number[] | boolean[]\n\n/**\n * The meta information for a config option definition, when the\n * type and multiple values can be inferred by the method being used\n */\nexport type ConfigOptionMeta<\n T extends ConfigType,\n M extends boolean = boolean,\n O extends\n | undefined\n | (T extends 'boolean' ? never\n : T extends 'string' ? readonly string[]\n : T extends 'number' ? readonly number[]\n : readonly number[] | readonly string[]) =\n | undefined\n | (T extends 'boolean' ? never\n : T extends 'string' ? readonly string[]\n : T extends 'number' ? readonly number[]\n : readonly number[] | readonly string[]),\n> = {\n default?:\n | undefined\n | (ValidValue &\n (O extends number[] | string[] ?\n M extends false ?\n O[number]\n : O[number][]\n : unknown))\n validOptions?: O\n description?: string\n validate?:\n | ((v: unknown) => v is ValidValue)\n | ((v: unknown) => boolean)\n short?: string | undefined\n type?: T\n hint?: T extends 'boolean' ? never : string\n delim?: M extends true ? string : never\n} & (M extends false ? { multiple?: false | undefined }\n: M extends true ? { multiple: true }\n: { multiple?: boolean })\n\n/**\n * A set of {@link ConfigOptionMeta} fields, referenced by their longOption\n * string values.\n */\nexport type ConfigMetaSet<\n T extends ConfigType,\n M extends boolean = boolean,\n> = {\n [longOption: string]: ConfigOptionMeta\n}\n\n/**\n * Infer {@link ConfigSet} fields from a given {@link ConfigMetaSet}\n */\nexport type ConfigSetFromMetaSet<\n T extends ConfigType,\n M extends boolean,\n S extends ConfigMetaSet,\n> = {\n [longOption in keyof S]: ConfigOptionBase\n}\n\n/**\n * Fields that can be set on a {@link ConfigOptionBase} or\n * {@link ConfigOptionMeta} based on whether or not the field is known to be\n * multiple.\n */\nexport type MultiType =\n M extends true ?\n {\n multiple: true\n delim?: string | undefined\n }\n : M extends false ?\n {\n multiple?: false | undefined\n delim?: undefined\n }\n : {\n multiple?: boolean | undefined\n delim?: string | undefined\n }\n\n/**\n * A config field definition, in its full representation.\n */\nexport type ConfigOptionBase<\n T extends ConfigType,\n M extends boolean = boolean,\n> = {\n type: T\n short?: string | undefined\n default?: ValidValue | undefined\n description?: string\n hint?: T extends 'boolean' ? undefined : string | undefined\n validate?: (v: unknown) => v is ValidValue\n validOptions?: T extends 'boolean' ? undefined\n : T extends 'string' ? readonly string[]\n : T extends 'number' ? readonly number[]\n : readonly number[] | readonly string[]\n} & MultiType\n\nexport const isConfigType = (t: string): t is ConfigType =>\n typeof t === 'string' &&\n (t === 'string' || t === 'number' || t === 'boolean')\n\nconst undefOrType = (v: unknown, t: string): boolean =>\n v === undefined || typeof v === t\nconst undefOrTypeArray = (v: unknown, t: string): boolean =>\n v === undefined || (Array.isArray(v) && v.every(x => typeof x === t))\n\nconst isValidOption = (v: unknown, vo: readonly unknown[]): boolean =>\n Array.isArray(v) ? v.every(x => isValidOption(x, vo)) : vo.includes(v)\n\n// print the value type, for error message reporting\nconst valueType = (\n v:\n | string\n | number\n | boolean\n | string[]\n | number[]\n | boolean[]\n | { type: ConfigType; multiple?: boolean },\n): string =>\n typeof v === 'string' ? 'string'\n : typeof v === 'boolean' ? 'boolean'\n : typeof v === 'number' ? 'number'\n : Array.isArray(v) ?\n joinTypes([...new Set(v.map(v => valueType(v)))]) + '[]'\n : `${v.type}${v.multiple ? '[]' : ''}`\n\nconst joinTypes = (types: string[]): string =>\n types.length === 1 && typeof types[0] === 'string' ?\n types[0]\n : `(${types.join('|')})`\n\nconst isValidValue = (\n v: unknown,\n type: T,\n multi: M,\n): v is ValidValue => {\n if (multi) {\n if (!Array.isArray(v)) return false\n return !v.some((v: unknown) => !isValidValue(v, type, false))\n }\n if (Array.isArray(v)) return false\n return typeof v === type\n}\n\nexport const isConfigOption = (\n o: any,\n type: T,\n multi: M,\n): o is ConfigOptionBase =>\n !!o &&\n typeof o === 'object' &&\n isConfigType(o.type) &&\n o.type === type &&\n undefOrType(o.short, 'string') &&\n undefOrType(o.description, 'string') &&\n undefOrType(o.hint, 'string') &&\n undefOrType(o.validate, 'function') &&\n (o.type === 'boolean' ?\n o.validOptions === undefined\n : undefOrTypeArray(o.validOptions, o.type)) &&\n (o.default === undefined || isValidValue(o.default, type, multi)) &&\n !!o.multiple === multi\n\n/**\n * A set of {@link ConfigOptionBase} objects, referenced by their longOption\n * string values.\n */\nexport type ConfigSet = {\n [longOption: string]: ConfigOptionBase\n}\n\n/**\n * The 'values' field returned by {@link Jack#parse}\n */\nexport type OptionsResults = {\n [k in keyof T]?: T[k]['validOptions'] extends (\n readonly string[] | readonly number[]\n ) ?\n T[k] extends ConfigOptionBase<'string' | 'number', false> ?\n T[k]['validOptions'][number]\n : T[k] extends ConfigOptionBase<'string' | 'number', true> ?\n T[k]['validOptions'][number][]\n : never\n : T[k] extends ConfigOptionBase<'string', false> ? string\n : T[k] extends ConfigOptionBase<'string', true> ? string[]\n : T[k] extends ConfigOptionBase<'number', false> ? number\n : T[k] extends ConfigOptionBase<'number', true> ? number[]\n : T[k] extends ConfigOptionBase<'boolean', false> ? boolean\n : T[k] extends ConfigOptionBase<'boolean', true> ? boolean[]\n : never\n}\n\n/**\n * The object retured by {@link Jack#parse}\n */\nexport type Parsed = {\n values: OptionsResults\n positionals: string[]\n}\n\nfunction num(\n o: ConfigOptionMeta<'number', false> = {},\n): ConfigOptionBase<'number', false> {\n const { default: def, validate: val, validOptions, ...rest } = o\n if (def !== undefined && !isValidValue(def, 'number', false)) {\n throw new TypeError('invalid default value', {\n cause: {\n found: def,\n wanted: 'number',\n },\n })\n }\n if (!undefOrTypeArray(validOptions, 'number')) {\n throw new TypeError('invalid validOptions', {\n cause: {\n found: validOptions,\n wanted: 'number[]',\n },\n })\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'number', false>)\n : undefined\n return {\n ...rest,\n default: def,\n validate,\n validOptions,\n type: 'number',\n multiple: false,\n }\n}\n\nfunction numList(\n o: ConfigOptionMeta<'number'> = {},\n): ConfigOptionBase<'number', true> {\n const { default: def, validate: val, validOptions, ...rest } = o\n if (def !== undefined && !isValidValue(def, 'number', true)) {\n throw new TypeError('invalid default value', {\n cause: {\n found: def,\n wanted: 'number[]',\n },\n })\n }\n if (!undefOrTypeArray(validOptions, 'number')) {\n throw new TypeError('invalid validOptions', {\n cause: {\n found: validOptions,\n wanted: 'number[]',\n },\n })\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'number', true>)\n : undefined\n return {\n ...rest,\n default: def,\n validate,\n validOptions,\n type: 'number',\n multiple: true,\n }\n}\n\nfunction opt(\n o: ConfigOptionMeta<'string', false> = {},\n): ConfigOptionBase<'string', false> {\n const { default: def, validate: val, validOptions, ...rest } = o\n if (def !== undefined && !isValidValue(def, 'string', false)) {\n throw new TypeError('invalid default value', {\n cause: {\n found: def,\n wanted: 'string',\n },\n })\n }\n if (!undefOrTypeArray(validOptions, 'string')) {\n throw new TypeError('invalid validOptions', {\n cause: {\n found: validOptions,\n wanted: 'string[]',\n },\n })\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'string', false>)\n : undefined\n return {\n ...rest,\n default: def,\n validate,\n validOptions,\n type: 'string',\n multiple: false,\n }\n}\n\nfunction optList(\n o: ConfigOptionMeta<'string'> = {},\n): ConfigOptionBase<'string', true> {\n const { default: def, validate: val, validOptions, ...rest } = o\n if (def !== undefined && !isValidValue(def, 'string', true)) {\n throw new TypeError('invalid default value', {\n cause: {\n found: def,\n wanted: 'string[]',\n },\n })\n }\n if (!undefOrTypeArray(validOptions, 'string')) {\n throw new TypeError('invalid validOptions', {\n cause: {\n found: validOptions,\n wanted: 'string[]',\n },\n })\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'string', true>)\n : undefined\n return {\n ...rest,\n default: def,\n validate,\n validOptions,\n type: 'string',\n multiple: true,\n }\n}\n\nfunction flag(\n o: ConfigOptionMeta<'boolean', false> = {},\n): ConfigOptionBase<'boolean', false> {\n const {\n hint,\n default: def,\n validate: val,\n ...rest\n } = o as ConfigOptionMeta<'boolean', false>\n delete (rest as ConfigOptionMeta<'string', false>).validOptions\n if (def !== undefined && !isValidValue(def, 'boolean', false)) {\n throw new TypeError('invalid default value')\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'boolean', false>)\n : undefined\n if (hint !== undefined) {\n throw new TypeError('cannot provide hint for flag')\n }\n return {\n ...rest,\n default: def,\n validate,\n type: 'boolean',\n multiple: false,\n }\n}\n\nfunction flagList(\n o: ConfigOptionMeta<'boolean'> = {},\n): ConfigOptionBase<'boolean', true> {\n const {\n hint,\n default: def,\n validate: val,\n ...rest\n } = o as ConfigOptionMeta<'boolean', false>\n delete (rest as ConfigOptionMeta<'string', false>).validOptions\n if (def !== undefined && !isValidValue(def, 'boolean', true)) {\n throw new TypeError('invalid default value')\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'boolean', true>)\n : undefined\n if (hint !== undefined) {\n throw new TypeError('cannot provide hint for flag list')\n }\n return {\n ...rest,\n default: def,\n validate,\n type: 'boolean',\n multiple: true,\n }\n}\nconst toParseArgsOptionsConfig = (\n options: ConfigSet,\n): Exclude => {\n const c: Exclude = {}\n for (const longOption in options) {\n const config = options[longOption]\n /* c8 ignore start */\n if (!config) {\n throw new Error('config must be an object: ' + longOption)\n }\n /* c8 ignore start */\n if (isConfigOption(config, 'number', true)) {\n c[longOption] = {\n type: 'string',\n multiple: true,\n default: config.default?.map(c => String(c)),\n }\n } else if (isConfigOption(config, 'number', false)) {\n c[longOption] = {\n type: 'string',\n multiple: false,\n default:\n config.default === undefined ?\n undefined\n : String(config.default),\n }\n } else {\n const conf = config as\n | ConfigOptionBase<'string'>\n | ConfigOptionBase<'boolean'>\n c[longOption] = {\n type: conf.type,\n multiple: !!conf.multiple,\n default: conf.default,\n }\n }\n const clo = c[longOption] as ConfigOptionBase\n if (typeof config.short === 'string') {\n clo.short = config.short\n }\n\n if (\n config.type === 'boolean' &&\n !longOption.startsWith('no-') &&\n !options[`no-${longOption}`]\n ) {\n c[`no-${longOption}`] = {\n type: 'boolean',\n multiple: config.multiple,\n }\n }\n }\n return c\n}\n\n/**\n * A row used when generating the {@link Jack#usage} string\n */\nexport interface Row {\n left?: string\n text: string\n skipLine?: boolean\n type?: string\n}\n\n/**\n * A heading for a section in the usage, created by the jack.heading()\n * method.\n *\n * First heading is always level 1, subsequent headings default to 2.\n *\n * The level of the nearest heading level sets the indentation of the\n * description that follows.\n */\nexport interface Heading extends Row {\n type: 'heading'\n text: string\n left?: ''\n skipLine?: boolean\n level: number\n pre?: boolean\n}\nconst isHeading = (r: { type?: string }): r is Heading =>\n r.type === 'heading'\n\n/**\n * An arbitrary blob of text describing some stuff, set by the\n * jack.description() method.\n *\n * Indentation determined by level of the nearest header.\n */\nexport interface Description extends Row {\n type: 'description'\n text: string\n left?: ''\n skipLine?: boolean\n pre?: boolean\n}\n\nconst isDescription = (r: { type?: string }): r is Description =>\n r.type === 'description'\n\n/**\n * A heading or description row used when generating the {@link Jack#usage}\n * string\n */\nexport type TextRow = Heading | Description\n\n/**\n * Either a {@link TextRow} or a reference to a {@link ConfigOptionBase}\n */\nexport type UsageField =\n | TextRow\n | {\n type: 'config'\n name: string\n value: ConfigOptionBase\n }\n\n/**\n * Options provided to the {@link Jack} constructor\n */\nexport interface JackOptions {\n /**\n * Whether to allow positional arguments\n *\n * @default true\n */\n allowPositionals?: boolean\n\n /**\n * Prefix to use when reading/writing the environment variables\n *\n * If not specified, environment behavior will not be available.\n */\n envPrefix?: string\n\n /**\n * Environment object to read/write. Defaults `process.env`.\n * No effect if `envPrefix` is not set.\n */\n env?: { [k: string]: string | undefined }\n\n /**\n * A short usage string. If not provided, will be generated from the\n * options provided, but that can of course be rather verbose if\n * there are a lot of options.\n */\n usage?: string\n\n /**\n * Stop parsing flags and opts at the first positional argument.\n * This is to support cases like `cmd [flags] [options]`, where\n * each subcommand may have different options. This effectively treats\n * any positional as a `--` argument. Only relevant if `allowPositionals`\n * is true.\n *\n * To do subcommands, set this option, look at the first positional, and\n * parse the remaining positionals as appropriate.\n *\n * @default false\n */\n stopAtPositional?: boolean\n}\n\n/**\n * Class returned by the {@link jack} function and all configuration\n * definition methods. This is what gets chained together.\n */\nexport class Jack {\n #configSet: C\n #shorts: { [k: string]: string }\n #options: JackOptions\n #fields: UsageField[] = []\n #env: { [k: string]: string | undefined }\n #envPrefix?: string\n #allowPositionals: boolean\n #usage?: string\n #usageMarkdown?: string\n\n constructor(options: JackOptions = {}) {\n this.#options = options\n this.#allowPositionals = options.allowPositionals !== false\n this.#env =\n this.#options.env === undefined ? process.env : this.#options.env\n this.#envPrefix = options.envPrefix\n // We need to fib a little, because it's always the same object, but it\n // starts out as having an empty config set. Then each method that adds\n // fields returns `this as Jack`\n this.#configSet = Object.create(null) as C\n this.#shorts = Object.create(null)\n }\n\n /**\n * Set the default value (which will still be overridden by env or cli)\n * as if from a parsed config file. The optional `source` param, if\n * provided, will be included in error messages if a value is invalid or\n * unknown.\n */\n setConfigValues(values: OptionsResults, source = '') {\n try {\n this.validate(values)\n } catch (er) {\n const e = er as Error\n if (source && e && typeof e === 'object') {\n if (e.cause && typeof e.cause === 'object') {\n Object.assign(e.cause, { path: source })\n } else {\n e.cause = { path: source }\n }\n }\n throw e\n }\n for (const [field, value] of Object.entries(values)) {\n const my = this.#configSet[field]\n // already validated, just for TS's benefit\n /* c8 ignore start */\n if (!my) {\n throw new Error('unexpected field in config set: ' + field, {\n cause: { found: field },\n })\n }\n /* c8 ignore stop */\n my.default = value\n }\n return this\n }\n\n /**\n * Parse a string of arguments, and return the resulting\n * `{ values, positionals }` object.\n *\n * If an {@link JackOptions#envPrefix} is set, then it will read default\n * values from the environment, and write the resulting values back\n * to the environment as well.\n *\n * Environment values always take precedence over any other value, except\n * an explicit CLI setting.\n */\n parse(args: string[] = process.argv): Parsed {\n if (args === process.argv) {\n args = args.slice(\n (process as { _eval?: string })._eval !== undefined ? 1 : 2,\n )\n }\n if (this.#envPrefix) {\n for (const [field, my] of Object.entries(this.#configSet)) {\n const ek = toEnvKey(this.#envPrefix, field)\n const env = this.#env[ek]\n if (env !== undefined) {\n my.default = fromEnvVal(env, my.type, !!my.multiple, my.delim)\n }\n }\n }\n\n const p = this.parseRaw(args)\n\n for (const [field, c] of Object.entries(this.#configSet)) {\n if (c.default !== undefined && !(field in p.values)) {\n //@ts-ignore\n p.values[field] = c.default\n }\n }\n\n this.#writeEnv(p)\n\n return p\n }\n\n /**\n * Only parse the command line arguments passed in.\n * Does not strip off the `node script.js` bits, so it must be just the\n * arguments you wish to have parsed.\n * Does not read from or write to the environment, or set defaults.\n */\n parseRaw(args: string[]): Parsed {\n const options = toParseArgsOptionsConfig(this.#configSet)\n const result = parseArgs({\n args,\n options,\n // always strict, but using our own logic\n strict: false,\n allowPositionals: this.#allowPositionals,\n tokens: true,\n })\n\n const p: Parsed = {\n values: {},\n positionals: [],\n }\n for (const token of result.tokens) {\n if (token.kind === 'positional') {\n p.positionals.push(token.value)\n if (this.#options.stopAtPositional) {\n p.positionals.push(...args.slice(token.index + 1))\n break\n }\n } else if (token.kind === 'option') {\n let value: string | number | boolean | undefined = undefined\n if (token.name.startsWith('no-')) {\n const my = this.#configSet[token.name]\n const pname = token.name.substring('no-'.length)\n const pos = this.#configSet[pname]\n if (\n pos &&\n pos.type === 'boolean' &&\n (!my ||\n (my.type === 'boolean' && !!my.multiple === !!pos.multiple))\n ) {\n value = false\n token.name = pname\n }\n }\n const my = this.#configSet[token.name]\n if (!my) {\n throw new Error(\n `Unknown option '${token.rawName}'. ` +\n `To specify a positional argument starting with a '-', ` +\n `place it at the end of the command after '--', as in ` +\n `'-- ${token.rawName}'`,\n {\n cause: {\n found:\n token.rawName + (token.value ? `=${token.value}` : ''),\n },\n },\n )\n }\n if (value === undefined) {\n if (token.value === undefined) {\n if (my.type !== 'boolean') {\n throw new Error(\n `No value provided for ${token.rawName}, expected ${my.type}`,\n {\n cause: {\n name: token.rawName,\n wanted: valueType(my),\n },\n },\n )\n }\n value = true\n } else {\n if (my.type === 'boolean') {\n throw new Error(\n `Flag ${token.rawName} does not take a value, received '${token.value}'`,\n { cause: { found: token } },\n )\n }\n if (my.type === 'string') {\n value = token.value\n } else {\n value = +token.value\n if (value !== value) {\n throw new Error(\n `Invalid value '${token.value}' provided for ` +\n `'${token.rawName}' option, expected number`,\n {\n cause: {\n name: token.rawName,\n found: token.value,\n wanted: 'number',\n },\n },\n )\n }\n }\n }\n }\n if (my.multiple) {\n const pv = p.values as {\n [k: string]: (string | number | boolean)[]\n }\n const tn = pv[token.name] ?? []\n pv[token.name] = tn\n tn.push(value)\n } else {\n const pv = p.values as { [k: string]: string | number | boolean }\n pv[token.name] = value\n }\n }\n }\n\n for (const [field, value] of Object.entries(p.values)) {\n const valid = this.#configSet[field]?.validate\n const validOptions = this.#configSet[field]?.validOptions\n let cause:\n | undefined\n | {\n name: string\n found: unknown\n validOptions?: readonly string[] | readonly number[]\n }\n if (validOptions && !isValidOption(value, validOptions)) {\n cause = { name: field, found: value, validOptions: validOptions }\n }\n if (valid && !valid(value)) {\n cause ??= { name: field, found: value }\n }\n if (cause) {\n throw new Error(\n `Invalid value provided for --${field}: ${JSON.stringify(\n value,\n )}`,\n { cause },\n )\n }\n }\n\n return p\n }\n\n /**\n * do not set fields as 'no-foo' if 'foo' exists and both are bools\n * just set foo.\n */\n #noNoFields(f: string, val: unknown, s: string = f) {\n if (!f.startsWith('no-') || typeof val !== 'boolean') return\n const yes = f.substring('no-'.length)\n // recurse so we get the core config key we care about.\n this.#noNoFields(yes, val, s)\n if (this.#configSet[yes]?.type === 'boolean') {\n throw new Error(\n `do not set '${s}', instead set '${yes}' as desired.`,\n { cause: { found: s, wanted: yes } },\n )\n }\n }\n\n /**\n * Validate that any arbitrary object is a valid configuration `values`\n * object. Useful when loading config files or other sources.\n */\n validate(o: unknown): asserts o is Parsed['values'] {\n if (!o || typeof o !== 'object') {\n throw new Error('Invalid config: not an object', {\n cause: { found: o },\n })\n }\n const opts = o as Record\n for (const field in o) {\n const value = opts[field]\n /* c8 ignore next - for TS */\n if (value === undefined) continue\n this.#noNoFields(field, value)\n const config = this.#configSet[field]\n if (!config) {\n throw new Error(`Unknown config option: ${field}`, {\n cause: { found: field },\n })\n }\n if (!isValidValue(value, config.type, !!config.multiple)) {\n throw new Error(\n `Invalid value ${valueType(\n value,\n )} for ${field}, expected ${valueType(config)}`,\n {\n cause: {\n name: field,\n found: value,\n wanted: valueType(config),\n },\n },\n )\n }\n let cause:\n | undefined\n | {\n name: string\n found: any\n validOptions?: readonly string[] | readonly number[]\n }\n if (\n config.validOptions &&\n !isValidOption(value, config.validOptions)\n ) {\n cause = {\n name: field,\n found: value,\n validOptions: config.validOptions,\n }\n }\n if (config.validate && !config.validate(value)) {\n cause ??= { name: field, found: value }\n }\n if (cause) {\n throw new Error(`Invalid config value for ${field}: ${value}`, {\n cause,\n })\n }\n }\n }\n\n #writeEnv(p: Parsed) {\n if (!this.#env || !this.#envPrefix) return\n for (const [field, value] of Object.entries(p.values)) {\n const my = this.#configSet[field]\n this.#env[toEnvKey(this.#envPrefix, field)] = toEnvVal(\n value,\n my?.delim,\n )\n }\n }\n\n /**\n * Add a heading to the usage output banner\n */\n heading(\n text: string,\n level?: 1 | 2 | 3 | 4 | 5 | 6,\n { pre = false }: { pre?: boolean } = {},\n ): Jack {\n if (level === undefined) {\n level = this.#fields.some(r => isHeading(r)) ? 2 : 1\n }\n this.#fields.push({ type: 'heading', text, level, pre })\n return this\n }\n\n /**\n * Add a long-form description to the usage output at this position.\n */\n description(text: string, { pre }: { pre?: boolean } = {}): Jack {\n this.#fields.push({ type: 'description', text, pre })\n return this\n }\n\n /**\n * Add one or more number fields.\n */\n num>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, num)\n }\n\n /**\n * Add one or more multiple number fields.\n */\n numList>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, numList)\n }\n\n /**\n * Add one or more string option fields.\n */\n opt>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, opt)\n }\n\n /**\n * Add one or more multiple string option fields.\n */\n optList>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, optList)\n }\n\n /**\n * Add one or more flag fields.\n */\n flag>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, flag)\n }\n\n /**\n * Add one or more multiple flag fields.\n */\n flagList>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, flagList)\n }\n\n /**\n * Generic field definition method. Similar to flag/flagList/number/etc,\n * but you must specify the `type` (and optionally `multiple` and `delim`)\n * fields on each one, or Jack won't know how to define them.\n */\n addFields(fields: F): Jack {\n const next = this as unknown as Jack\n for (const [name, field] of Object.entries(fields)) {\n this.#validateName(name, field)\n next.#fields.push({\n type: 'config',\n name,\n value: field as ConfigOptionBase,\n })\n }\n Object.assign(next.#configSet, fields)\n return next\n }\n\n #addFields<\n T extends ConfigType,\n M extends boolean,\n F extends ConfigMetaSet,\n >(\n fields: F,\n fn: (m: ConfigOptionMeta) => ConfigOptionBase,\n ): Jack> {\n type NextC = C & ConfigSetFromMetaSet\n const next = this as unknown as Jack\n Object.assign(\n next.#configSet,\n Object.fromEntries(\n Object.entries(fields).map(([name, field]) => {\n this.#validateName(name, field)\n const option = fn(field)\n next.#fields.push({\n type: 'config',\n name,\n value: option as ConfigOptionBase,\n })\n return [name, option]\n }),\n ),\n )\n return next\n }\n\n #validateName(name: string, field: { short?: string }) {\n if (!/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/.test(name)) {\n throw new TypeError(\n `Invalid option name: ${name}, ` +\n `must be '-' delimited ASCII alphanumeric`,\n )\n }\n if (this.#configSet[name]) {\n throw new TypeError(`Cannot redefine option ${field}`)\n }\n if (this.#shorts[name]) {\n throw new TypeError(\n `Cannot redefine option ${name}, already ` +\n `in use for ${this.#shorts[name]}`,\n )\n }\n if (field.short) {\n if (!/^[a-zA-Z0-9]$/.test(field.short)) {\n throw new TypeError(\n `Invalid ${name} short option: ${field.short}, ` +\n 'must be 1 ASCII alphanumeric character',\n )\n }\n if (this.#shorts[field.short]) {\n throw new TypeError(\n `Invalid ${name} short option: ${field.short}, ` +\n `already in use for ${this.#shorts[field.short]}`,\n )\n }\n this.#shorts[field.short] = name\n this.#shorts[name] = name\n }\n }\n\n /**\n * Return the usage banner for the given configuration\n */\n usage(): string {\n if (this.#usage) return this.#usage\n\n let headingLevel = 1\n const ui = cliui({ width })\n const first = this.#fields[0]\n let start = first?.type === 'heading' ? 1 : 0\n if (first?.type === 'heading') {\n ui.div({\n padding: [0, 0, 0, 0],\n text: normalize(first.text),\n })\n }\n ui.div({ padding: [0, 0, 0, 0], text: 'Usage:' })\n if (this.#options.usage) {\n ui.div({\n text: this.#options.usage,\n padding: [0, 0, 0, 2],\n })\n } else {\n const cmd = basename(String(process.argv[1]))\n const shortFlags: string[] = []\n const shorts: string[][] = []\n const flags: string[] = []\n const opts: string[][] = []\n for (const [field, config] of Object.entries(this.#configSet)) {\n if (config.short) {\n if (config.type === 'boolean') shortFlags.push(config.short)\n else shorts.push([config.short, config.hint || field])\n } else {\n if (config.type === 'boolean') flags.push(field)\n else opts.push([field, config.hint || field])\n }\n }\n const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''\n const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const lf = flags.map(k => ` --${k}`).join('')\n const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const usage = `${cmd}${sf}${so}${lf}${lo}`.trim()\n ui.div({\n text: usage,\n padding: [0, 0, 0, 2],\n })\n }\n\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n const maybeDesc = this.#fields[start]\n if (maybeDesc && isDescription(maybeDesc)) {\n const print = normalize(maybeDesc.text, maybeDesc.pre)\n start++\n ui.div({ padding: [0, 0, 0, 0], text: print })\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n }\n\n const { rows, maxWidth } = this.#usageRows(start)\n\n // every heading/description after the first gets indented by 2\n // extra spaces.\n for (const row of rows) {\n if (row.left) {\n // If the row is too long, don't wrap it\n // Bump the right-hand side down a line to make room\n const configIndent = indent(Math.max(headingLevel, 2))\n if (row.left.length > maxWidth - 3) {\n ui.div({ text: row.left, padding: [0, 0, 0, configIndent] })\n ui.div({ text: row.text, padding: [0, 0, 0, maxWidth] })\n } else {\n ui.div(\n {\n text: row.left,\n padding: [0, 1, 0, configIndent],\n width: maxWidth,\n },\n { padding: [0, 0, 0, 0], text: row.text },\n )\n }\n if (row.skipLine) {\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n }\n } else {\n if (isHeading(row)) {\n const { level } = row\n headingLevel = level\n // only h1 and h2 have bottom padding\n // h3-h6 do not\n const b = level <= 2 ? 1 : 0\n ui.div({ ...row, padding: [0, 0, b, indent(level)] })\n } else {\n ui.div({ ...row, padding: [0, 0, 1, indent(headingLevel + 1)] })\n }\n }\n }\n\n return (this.#usage = ui.toString())\n }\n\n /**\n * Return the usage banner markdown for the given configuration\n */\n usageMarkdown(): string {\n if (this.#usageMarkdown) return this.#usageMarkdown\n\n const out: string[] = []\n\n let headingLevel = 1\n const first = this.#fields[0]\n let start = first?.type === 'heading' ? 1 : 0\n if (first?.type === 'heading') {\n out.push(`# ${normalizeOneLine(first.text)}`)\n }\n out.push('Usage:')\n if (this.#options.usage) {\n out.push(normalizeMarkdown(this.#options.usage, true))\n } else {\n const cmd = basename(String(process.argv[1]))\n const shortFlags: string[] = []\n const shorts: string[][] = []\n const flags: string[] = []\n const opts: string[][] = []\n for (const [field, config] of Object.entries(this.#configSet)) {\n if (config.short) {\n if (config.type === 'boolean') shortFlags.push(config.short)\n else shorts.push([config.short, config.hint || field])\n } else {\n if (config.type === 'boolean') flags.push(field)\n else opts.push([field, config.hint || field])\n }\n }\n const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''\n const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const lf = flags.map(k => ` --${k}`).join('')\n const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const usage = `${cmd}${sf}${so}${lf}${lo}`.trim()\n out.push(normalizeMarkdown(usage, true))\n }\n\n const maybeDesc = this.#fields[start]\n if (maybeDesc && isDescription(maybeDesc)) {\n out.push(normalizeMarkdown(maybeDesc.text, maybeDesc.pre))\n start++\n }\n\n const { rows } = this.#usageRows(start)\n\n // heading level in markdown is number of # ahead of text\n for (const row of rows) {\n if (row.left) {\n out.push(\n '#'.repeat(headingLevel + 1) +\n ' ' +\n normalizeOneLine(row.left, true),\n )\n if (row.text) out.push(normalizeMarkdown(row.text))\n } else if (isHeading(row)) {\n const { level } = row\n headingLevel = level\n out.push(\n `${'#'.repeat(headingLevel)} ${normalizeOneLine(\n row.text,\n row.pre,\n )}`,\n )\n } else {\n out.push(normalizeMarkdown(row.text, !!(row as Description).pre))\n }\n }\n\n return (this.#usageMarkdown = out.join('\\n\\n') + '\\n')\n }\n\n #usageRows(start: number) {\n // turn each config type into a row, and figure out the width of the\n // left hand indentation for the option descriptions.\n let maxMax = Math.max(12, Math.min(26, Math.floor(width / 3)))\n let maxWidth = 8\n let prev: Row | TextRow | undefined = undefined\n const rows: (Row | TextRow)[] = []\n for (const field of this.#fields.slice(start)) {\n if (field.type !== 'config') {\n if (prev?.type === 'config') prev.skipLine = true\n prev = undefined\n field.text = normalize(field.text, !!field.pre)\n rows.push(field)\n continue\n }\n const { value } = field\n const desc = value.description || ''\n const mult = value.multiple ? 'Can be set multiple times' : ''\n const opts =\n value.validOptions?.length ?\n `Valid options:${value.validOptions.map(\n v => ` ${JSON.stringify(v)}`,\n )}`\n : ''\n const dmDelim = desc.includes('\\n') ? '\\n\\n' : '\\n'\n const extra = [opts, mult].join(dmDelim).trim()\n const text = (normalize(desc) + dmDelim + extra).trim()\n const hint =\n value.hint ||\n (value.type === 'number' ? 'n'\n : value.type === 'string' ? field.name\n : undefined)\n const short =\n !value.short ? ''\n : value.type === 'boolean' ? `-${value.short} `\n : `-${value.short}<${hint}> `\n const left =\n value.type === 'boolean' ?\n `${short}--${field.name}`\n : `${short}--${field.name}=<${hint}>`\n const row: Row = { text, left, type: 'config' }\n if (text.length > width - maxMax) {\n row.skipLine = true\n }\n if (prev && left.length > maxMax) prev.skipLine = true\n prev = row\n const len = left.length + 4\n if (len > maxWidth && len < maxMax) {\n maxWidth = len\n }\n\n rows.push(row)\n }\n\n return { rows, maxWidth }\n }\n\n /**\n * Return the configuration options as a plain object\n */\n toJSON() {\n return Object.fromEntries(\n Object.entries(this.#configSet).map(([field, def]) => [\n field,\n {\n type: def.type,\n ...(def.multiple ? { multiple: true } : {}),\n ...(def.delim ? { delim: def.delim } : {}),\n ...(def.short ? { short: def.short } : {}),\n ...(def.description ?\n { description: normalize(def.description) }\n : {}),\n ...(def.validate ? { validate: def.validate } : {}),\n ...(def.validOptions ? { validOptions: def.validOptions } : {}),\n ...(def.default !== undefined ? { default: def.default } : {}),\n },\n ]),\n )\n }\n\n /**\n * Custom printer for `util.inspect`\n */\n [inspect.custom](_: number, options: InspectOptions) {\n return `Jack ${inspect(this.toJSON(), options)}`\n }\n}\n\n// Unwrap and un-indent, so we can wrap description\n// strings however makes them look nice in the code.\nconst normalize = (s: string, pre = false) => {\n if (pre)\n // prepend a ZWSP to each line so cliui doesn't strip it.\n return s\n .split('\\n')\n .map(l => `\\u200b${l}`)\n .join('\\n')\n return s\n .split(/^\\s*```\\s*$/gm)\n .map((s, i) => {\n if (i % 2 === 1) {\n if (!s.trim()) {\n return `\\`\\`\\`\\n\\`\\`\\`\\n`\n }\n // outdent the ``` blocks, but preserve whitespace otherwise.\n const split = s.split('\\n')\n // throw out the \\n at the start and end\n split.pop()\n split.shift()\n const si = split.reduce((shortest, l) => {\n /* c8 ignore next */\n const ind = l.match(/^\\s*/)?.[0] ?? ''\n if (ind.length) return Math.min(ind.length, shortest)\n else return shortest\n }, Infinity)\n /* c8 ignore next */\n const i = isFinite(si) ? si : 0\n return (\n '\\n```\\n' +\n split.map(\n s =>\n `\\u200b${s.substring(i)}`,\n )\n .join('\\n') +\n '\\n```\\n'\n )\n }\n return (\n s\n // remove single line breaks, except for lists\n .replace(/([^\\n])\\n[ \\t]*([^\\n])/g, (_, $1, $2) =>\n !/^[-*]/.test($2) ? `${$1} ${$2}` : `${$1}\\n${$2}`,\n )\n // normalize mid-line whitespace\n .replace(/([^\\n])[ \\t]+([^\\n])/g, '$1 $2')\n // two line breaks are enough\n .replace(/\\n{3,}/g, '\\n\\n')\n // remove any spaces at the start of a line\n .replace(/\\n[ \\t]+/g, '\\n')\n .trim()\n )\n })\n .join('\\n')\n}\n\n// normalize for markdown printing, remove leading spaces on lines\nconst normalizeMarkdown = (s: string, pre: boolean = false): string => {\n const n = normalize(s, pre).replace(/\\\\/g, '\\\\\\\\')\n return pre ?\n `\\`\\`\\`\\n${n.replace(/\\u200b/g, '')}\\n\\`\\`\\``\n : n.replace(/\\n +/g, '\\n').trim()\n}\n\nconst normalizeOneLine = (s: string, pre: boolean = false) => {\n const n = normalize(s, pre)\n .replace(/[\\s\\u200b]+/g, ' ')\n .trim()\n return pre ? `\\`${n}\\`` : n\n}\n\n/**\n * Main entry point. Create and return a {@link Jack} object.\n */\nexport const jack = (options: JackOptions = {}) => new Jack(options)\n"]} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAmC,MAAM,WAAW,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,kDAAkD;AAClD,YAAY;AACZ,OAAO,KAAK,MAAM,eAAe,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEpC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CACpB,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAC3D,EAAE,CACH,CAAA;AAED,wCAAwC;AACxC,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;AAEzC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,GAAW,EAAU,EAAE;IACrD,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CA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CAAC,IAAI,CAAC,CAAA;AACf,CAAC,CAAA;AAED,kEAAkE;AAClE,MAAM,iBAAiB,GAAG,CAAC,CAAS,EAAE,MAAe,KAAK,EAAU,EAAE;IACpE,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IAClD,OAAO,GAAG,CAAC,CAAC;QACR,WAAW,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,UAAU;QAC/C,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAA;AACrC,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG,CAAC,CAAS,EAAE,MAAe,KAAK,EAAE,EAAE;IAC3D,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC;SACxB,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC;SAC5B,IAAI,EAAE,CAAA;IACT,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;AAC7B,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,UAAuB,EAAE,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAA","sourcesContent":["export type ConfigType = 'number' | 'string' | 'boolean'\n\n/**\n * Given a Jack object, get the typeof its ConfigSet\n */\nexport type Unwrap = J extends Jack ? C : never\n\nimport { inspect, InspectOptions, ParseArgsConfig } from 'node:util'\nimport { parseArgs } from './parse-args.js'\n\n// it's a tiny API, just cast it inline, it's fine\n//@ts-ignore\nimport cliui from '@isaacs/cliui'\nimport { basename } from 'node:path'\n\nconst width = Math.min(\n (process && process.stdout && process.stdout.columns) || 80,\n 80,\n)\n\n// indentation spaces from heading level\nconst indent = (n: number) => (n - 1) * 2\n\nconst toEnvKey = (pref: string, key: string): string => {\n return [pref, key.replace(/[^a-zA-Z0-9]+/g, ' ')]\n .join(' ')\n .trim()\n .toUpperCase()\n .replace(/ /g, '_')\n}\n\nconst toEnvVal = (\n value: string | boolean | number | string[] | boolean[] | number[],\n delim: string = '\\n',\n): string => {\n const str =\n typeof value === 'string' ? value\n : typeof value === 'boolean' ?\n value ? '1'\n : '0'\n : typeof value === 'number' ? String(value)\n : Array.isArray(value) ?\n value.map((v: string | number | boolean) => toEnvVal(v)).join(delim)\n : /* c8 ignore start */ undefined\n if (typeof str !== 'string') {\n throw new Error(\n `could not serialize value to environment: ${JSON.stringify(value)}`,\n )\n }\n /* c8 ignore stop */\n return str\n}\n\nconst fromEnvVal = (\n env: string,\n type: T,\n multiple: M,\n delim: string = '\\n',\n): ValidValue =>\n (multiple ?\n env ? env.split(delim).map(v => fromEnvVal(v, type, false))\n : []\n : type === 'string' ? env\n : type === 'boolean' ? env === '1'\n : +env.trim()) as ValidValue\n\n/**\n * Defines the type of value that is valid, given a config definition's\n * {@link ConfigType} and boolean multiple setting\n */\nexport type ValidValue<\n T extends ConfigType = ConfigType,\n M extends boolean = boolean,\n> =\n [T, M] extends ['number', true] ? number[]\n : [T, M] extends ['string', true] ? string[]\n : [T, M] extends ['boolean', true] ? boolean[]\n : [T, M] extends ['number', false] ? number\n : [T, M] extends ['string', false] ? string\n : [T, M] extends ['boolean', false] ? boolean\n : [T, M] extends ['string', boolean] ? string | string[]\n : [T, M] extends ['boolean', boolean] ? boolean | boolean[]\n : [T, M] extends ['number', boolean] ? number | number[]\n : [T, M] extends [ConfigType, false] ? string | number | boolean\n : [T, M] extends [ConfigType, true] ? string[] | number[] | boolean[]\n : string | number | boolean | string[] | number[] | boolean[]\n\n/**\n * The meta information for a config option definition, when the\n * type and multiple values can be inferred by the method being used\n */\nexport type ConfigOptionMeta<\n T extends ConfigType,\n M extends boolean = boolean,\n O extends\n | undefined\n | (T extends 'boolean' ? never\n : T extends 'string' ? readonly string[]\n : T extends 'number' ? readonly number[]\n : readonly number[] | readonly string[]) =\n | undefined\n | (T extends 'boolean' ? never\n : T extends 'string' ? readonly string[]\n : T extends 'number' ? readonly number[]\n : readonly number[] | readonly string[]),\n> = {\n default?:\n | undefined\n | (ValidValue &\n (O extends number[] | string[] ?\n M extends false ?\n O[number]\n : O[number][]\n : unknown))\n validOptions?: O\n description?: string\n validate?:\n | ((v: unknown) => v is ValidValue)\n | ((v: unknown) => boolean)\n short?: string | undefined\n type?: T\n hint?: T extends 'boolean' ? never : string\n delim?: M extends true ? string : never\n} & (M extends false ? { multiple?: false | undefined }\n: M extends true ? { multiple: true }\n: { multiple?: boolean })\n\n/**\n * A set of {@link ConfigOptionMeta} fields, referenced by their longOption\n * string values.\n */\nexport type ConfigMetaSet<\n T extends ConfigType,\n M extends boolean = boolean,\n> = {\n [longOption: string]: ConfigOptionMeta\n}\n\n/**\n * Infer {@link ConfigSet} fields from a given {@link ConfigMetaSet}\n */\nexport type ConfigSetFromMetaSet<\n T extends ConfigType,\n M extends boolean,\n S extends ConfigMetaSet,\n> = {\n [longOption in keyof S]: ConfigOptionBase\n}\n\n/**\n * Fields that can be set on a {@link ConfigOptionBase} or\n * {@link ConfigOptionMeta} based on whether or not the field is known to be\n * multiple.\n */\nexport type MultiType =\n M extends true ?\n {\n multiple: true\n delim?: string | undefined\n }\n : M extends false ?\n {\n multiple?: false | undefined\n delim?: undefined\n }\n : {\n multiple?: boolean | undefined\n delim?: string | undefined\n }\n\n/**\n * A config field definition, in its full representation.\n */\nexport type ConfigOptionBase<\n T extends ConfigType,\n M extends boolean = boolean,\n> = {\n type: T\n short?: string | undefined\n default?: ValidValue | undefined\n description?: string\n hint?: T extends 'boolean' ? undefined : string | undefined\n validate?: (v: unknown) => v is ValidValue\n validOptions?: T extends 'boolean' ? undefined\n : T extends 'string' ? readonly string[]\n : T extends 'number' ? readonly number[]\n : readonly number[] | readonly string[]\n} & MultiType\n\nexport const isConfigType = (t: string): t is ConfigType =>\n typeof t === 'string' &&\n (t === 'string' || t === 'number' || t === 'boolean')\n\nconst undefOrType = (v: unknown, t: string): boolean =>\n v === undefined || typeof v === t\nconst undefOrTypeArray = (v: unknown, t: string): boolean =>\n v === undefined || (Array.isArray(v) && v.every(x => typeof x === t))\n\nconst isValidOption = (v: unknown, vo: readonly unknown[]): boolean =>\n Array.isArray(v) ? v.every(x => isValidOption(x, vo)) : vo.includes(v)\n\n// print the value type, for error message reporting\nconst valueType = (\n v:\n | string\n | number\n | boolean\n | string[]\n | number[]\n | boolean[]\n | { type: ConfigType; multiple?: boolean },\n): string =>\n typeof v === 'string' ? 'string'\n : typeof v === 'boolean' ? 'boolean'\n : typeof v === 'number' ? 'number'\n : Array.isArray(v) ?\n joinTypes([...new Set(v.map(v => valueType(v)))]) + '[]'\n : `${v.type}${v.multiple ? '[]' : ''}`\n\nconst joinTypes = (types: string[]): string =>\n types.length === 1 && typeof types[0] === 'string' ?\n types[0]\n : `(${types.join('|')})`\n\nconst isValidValue = (\n v: unknown,\n type: T,\n multi: M,\n): v is ValidValue => {\n if (multi) {\n if (!Array.isArray(v)) return false\n return !v.some((v: unknown) => !isValidValue(v, type, false))\n }\n if (Array.isArray(v)) return false\n return typeof v === type\n}\n\nexport const isConfigOption = (\n o: any,\n type: T,\n multi: M,\n): o is ConfigOptionBase =>\n !!o &&\n typeof o === 'object' &&\n isConfigType(o.type) &&\n o.type === type &&\n undefOrType(o.short, 'string') &&\n undefOrType(o.description, 'string') &&\n undefOrType(o.hint, 'string') &&\n undefOrType(o.validate, 'function') &&\n (o.type === 'boolean' ?\n o.validOptions === undefined\n : undefOrTypeArray(o.validOptions, o.type)) &&\n (o.default === undefined || isValidValue(o.default, type, multi)) &&\n !!o.multiple === multi\n\n/**\n * A set of {@link ConfigOptionBase} objects, referenced by their longOption\n * string values.\n */\nexport type ConfigSet = {\n [longOption: string]: ConfigOptionBase\n}\n\n/**\n * The 'values' field returned by {@link Jack#parse}\n */\nexport type OptionsResults = {\n [k in keyof T]?: T[k]['validOptions'] extends (\n readonly string[] | readonly number[]\n ) ?\n T[k] extends ConfigOptionBase<'string' | 'number', false> ?\n T[k]['validOptions'][number]\n : T[k] extends ConfigOptionBase<'string' | 'number', true> ?\n T[k]['validOptions'][number][]\n : never\n : T[k] extends ConfigOptionBase<'string', false> ? string\n : T[k] extends ConfigOptionBase<'string', true> ? string[]\n : T[k] extends ConfigOptionBase<'number', false> ? number\n : T[k] extends ConfigOptionBase<'number', true> ? number[]\n : T[k] extends ConfigOptionBase<'boolean', false> ? boolean\n : T[k] extends ConfigOptionBase<'boolean', true> ? boolean[]\n : never\n}\n\n/**\n * The object retured by {@link Jack#parse}\n */\nexport type Parsed = {\n values: OptionsResults\n positionals: string[]\n}\n\nfunction num(\n o: ConfigOptionMeta<'number', false> = {},\n): ConfigOptionBase<'number', false> {\n const { default: def, validate: val, validOptions, ...rest } = o\n if (def !== undefined && !isValidValue(def, 'number', false)) {\n throw new TypeError('invalid default value', {\n cause: {\n found: def,\n wanted: 'number',\n },\n })\n }\n if (!undefOrTypeArray(validOptions, 'number')) {\n throw new TypeError('invalid validOptions', {\n cause: {\n found: validOptions,\n wanted: 'number[]',\n },\n })\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'number', false>)\n : undefined\n return {\n ...rest,\n default: def,\n validate,\n validOptions,\n type: 'number',\n multiple: false,\n }\n}\n\nfunction numList(\n o: ConfigOptionMeta<'number'> = {},\n): ConfigOptionBase<'number', true> {\n const { default: def, validate: val, validOptions, ...rest } = o\n if (def !== undefined && !isValidValue(def, 'number', true)) {\n throw new TypeError('invalid default value', {\n cause: {\n found: def,\n wanted: 'number[]',\n },\n })\n }\n if (!undefOrTypeArray(validOptions, 'number')) {\n throw new TypeError('invalid validOptions', {\n cause: {\n found: validOptions,\n wanted: 'number[]',\n },\n })\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'number', true>)\n : undefined\n return {\n ...rest,\n default: def,\n validate,\n validOptions,\n type: 'number',\n multiple: true,\n }\n}\n\nfunction opt(\n o: ConfigOptionMeta<'string', false> = {},\n): ConfigOptionBase<'string', false> {\n const { default: def, validate: val, validOptions, ...rest } = o\n if (def !== undefined && !isValidValue(def, 'string', false)) {\n throw new TypeError('invalid default value', {\n cause: {\n found: def,\n wanted: 'string',\n },\n })\n }\n if (!undefOrTypeArray(validOptions, 'string')) {\n throw new TypeError('invalid validOptions', {\n cause: {\n found: validOptions,\n wanted: 'string[]',\n },\n })\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'string', false>)\n : undefined\n return {\n ...rest,\n default: def,\n validate,\n validOptions,\n type: 'string',\n multiple: false,\n }\n}\n\nfunction optList(\n o: ConfigOptionMeta<'string'> = {},\n): ConfigOptionBase<'string', true> {\n const { default: def, validate: val, validOptions, ...rest } = o\n if (def !== undefined && !isValidValue(def, 'string', true)) {\n throw new TypeError('invalid default value', {\n cause: {\n found: def,\n wanted: 'string[]',\n },\n })\n }\n if (!undefOrTypeArray(validOptions, 'string')) {\n throw new TypeError('invalid validOptions', {\n cause: {\n found: validOptions,\n wanted: 'string[]',\n },\n })\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'string', true>)\n : undefined\n return {\n ...rest,\n default: def,\n validate,\n validOptions,\n type: 'string',\n multiple: true,\n }\n}\n\nfunction flag(\n o: ConfigOptionMeta<'boolean', false> = {},\n): ConfigOptionBase<'boolean', false> {\n const {\n hint,\n default: def,\n validate: val,\n ...rest\n } = o as ConfigOptionMeta<'boolean', false>\n delete (rest as ConfigOptionMeta<'string', false>).validOptions\n if (def !== undefined && !isValidValue(def, 'boolean', false)) {\n throw new TypeError('invalid default value')\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'boolean', false>)\n : undefined\n if (hint !== undefined) {\n throw new TypeError('cannot provide hint for flag')\n }\n return {\n ...rest,\n default: def,\n validate,\n type: 'boolean',\n multiple: false,\n }\n}\n\nfunction flagList(\n o: ConfigOptionMeta<'boolean'> = {},\n): ConfigOptionBase<'boolean', true> {\n const {\n hint,\n default: def,\n validate: val,\n ...rest\n } = o as ConfigOptionMeta<'boolean', false>\n delete (rest as ConfigOptionMeta<'string', false>).validOptions\n if (def !== undefined && !isValidValue(def, 'boolean', true)) {\n throw new TypeError('invalid default value')\n }\n const validate =\n val ?\n (val as (v: unknown) => v is ValidValue<'boolean', true>)\n : undefined\n if (hint !== undefined) {\n throw new TypeError('cannot provide hint for flag list')\n }\n return {\n ...rest,\n default: def,\n validate,\n type: 'boolean',\n multiple: true,\n }\n}\nconst toParseArgsOptionsConfig = (\n options: ConfigSet,\n): Exclude => {\n const c: Exclude = {}\n for (const longOption in options) {\n const config = options[longOption]\n /* c8 ignore start */\n if (!config) {\n throw new Error('config must be an object: ' + longOption)\n }\n /* c8 ignore start */\n if (isConfigOption(config, 'number', true)) {\n c[longOption] = {\n type: 'string',\n multiple: true,\n default: config.default?.map(c => String(c)),\n }\n } else if (isConfigOption(config, 'number', false)) {\n c[longOption] = {\n type: 'string',\n multiple: false,\n default:\n config.default === undefined ?\n undefined\n : String(config.default),\n }\n } else {\n const conf = config as\n | ConfigOptionBase<'string'>\n | ConfigOptionBase<'boolean'>\n c[longOption] = {\n type: conf.type,\n multiple: !!conf.multiple,\n default: conf.default,\n }\n }\n const clo = c[longOption] as ConfigOptionBase\n if (typeof config.short === 'string') {\n clo.short = config.short\n }\n\n if (\n config.type === 'boolean' &&\n !longOption.startsWith('no-') &&\n !options[`no-${longOption}`]\n ) {\n c[`no-${longOption}`] = {\n type: 'boolean',\n multiple: config.multiple,\n }\n }\n }\n return c\n}\n\n/**\n * A row used when generating the {@link Jack#usage} string\n */\nexport interface Row {\n left?: string\n text: string\n skipLine?: boolean\n type?: string\n}\n\n/**\n * A heading for a section in the usage, created by the jack.heading()\n * method.\n *\n * First heading is always level 1, subsequent headings default to 2.\n *\n * The level of the nearest heading level sets the indentation of the\n * description that follows.\n */\nexport interface Heading extends Row {\n type: 'heading'\n text: string\n left?: ''\n skipLine?: boolean\n level: number\n pre?: boolean\n}\nconst isHeading = (r: { type?: string }): r is Heading =>\n r.type === 'heading'\n\n/**\n * An arbitrary blob of text describing some stuff, set by the\n * jack.description() method.\n *\n * Indentation determined by level of the nearest header.\n */\nexport interface Description extends Row {\n type: 'description'\n text: string\n left?: ''\n skipLine?: boolean\n pre?: boolean\n}\n\nconst isDescription = (r: { type?: string }): r is Description =>\n r.type === 'description'\n\n/**\n * A heading or description row used when generating the {@link Jack#usage}\n * string\n */\nexport type TextRow = Heading | Description\n\n/**\n * Either a {@link TextRow} or a reference to a {@link ConfigOptionBase}\n */\nexport type UsageField =\n | TextRow\n | {\n type: 'config'\n name: string\n value: ConfigOptionBase\n }\n\n/**\n * Options provided to the {@link Jack} constructor\n */\nexport interface JackOptions {\n /**\n * Whether to allow positional arguments\n *\n * @default true\n */\n allowPositionals?: boolean\n\n /**\n * Prefix to use when reading/writing the environment variables\n *\n * If not specified, environment behavior will not be available.\n */\n envPrefix?: string\n\n /**\n * Environment object to read/write. Defaults `process.env`.\n * No effect if `envPrefix` is not set.\n */\n env?: { [k: string]: string | undefined }\n\n /**\n * A short usage string. If not provided, will be generated from the\n * options provided, but that can of course be rather verbose if\n * there are a lot of options.\n */\n usage?: string\n\n /**\n * Stop parsing flags and opts at the first positional argument.\n * This is to support cases like `cmd [flags] [options]`, where\n * each subcommand may have different options. This effectively treats\n * any positional as a `--` argument. Only relevant if `allowPositionals`\n * is true.\n *\n * To do subcommands, set this option, look at the first positional, and\n * parse the remaining positionals as appropriate.\n *\n * @default false\n */\n stopAtPositional?: boolean\n\n /**\n * Conditional `stopAtPositional`. If set to a `(string)=>boolean` function,\n * will be called with each positional argument encountered. If the function\n * returns true, then parsing will stop at that point.\n */\n stopAtPositionalTest?: (arg: string) => boolean\n}\n\n/**\n * Class returned by the {@link jack} function and all configuration\n * definition methods. This is what gets chained together.\n */\nexport class Jack {\n #configSet: C\n #shorts: { [k: string]: string }\n #options: JackOptions\n #fields: UsageField[] = []\n #env: { [k: string]: string | undefined }\n #envPrefix?: string\n #allowPositionals: boolean\n #usage?: string\n #usageMarkdown?: string\n\n constructor(options: JackOptions = {}) {\n this.#options = options\n this.#allowPositionals = options.allowPositionals !== false\n this.#env =\n this.#options.env === undefined ? process.env : this.#options.env\n this.#envPrefix = options.envPrefix\n // We need to fib a little, because it's always the same object, but it\n // starts out as having an empty config set. Then each method that adds\n // fields returns `this as Jack`\n this.#configSet = Object.create(null) as C\n this.#shorts = Object.create(null)\n }\n\n /**\n * Set the default value (which will still be overridden by env or cli)\n * as if from a parsed config file. The optional `source` param, if\n * provided, will be included in error messages if a value is invalid or\n * unknown.\n */\n setConfigValues(values: OptionsResults, source = '') {\n try {\n this.validate(values)\n } catch (er) {\n const e = er as Error\n if (source && e && typeof e === 'object') {\n if (e.cause && typeof e.cause === 'object') {\n Object.assign(e.cause, { path: source })\n } else {\n e.cause = { path: source }\n }\n }\n throw e\n }\n for (const [field, value] of Object.entries(values)) {\n const my = this.#configSet[field]\n // already validated, just for TS's benefit\n /* c8 ignore start */\n if (!my) {\n throw new Error('unexpected field in config set: ' + field, {\n cause: { found: field },\n })\n }\n /* c8 ignore stop */\n my.default = value\n }\n return this\n }\n\n /**\n * Parse a string of arguments, and return the resulting\n * `{ values, positionals }` object.\n *\n * If an {@link JackOptions#envPrefix} is set, then it will read default\n * values from the environment, and write the resulting values back\n * to the environment as well.\n *\n * Environment values always take precedence over any other value, except\n * an explicit CLI setting.\n */\n parse(args: string[] = process.argv): Parsed {\n this.loadEnvDefaults()\n const p = this.parseRaw(args)\n this.applyDefaults(p)\n this.writeEnv(p)\n return p\n }\n\n loadEnvDefaults() {\n if (this.#envPrefix) {\n for (const [field, my] of Object.entries(this.#configSet)) {\n const ek = toEnvKey(this.#envPrefix, field)\n const env = this.#env[ek]\n if (env !== undefined) {\n my.default = fromEnvVal(env, my.type, !!my.multiple, my.delim)\n }\n }\n }\n }\n\n applyDefaults(p: Parsed) {\n for (const [field, c] of Object.entries(this.#configSet)) {\n if (c.default !== undefined && !(field in p.values)) {\n //@ts-ignore\n p.values[field] = c.default\n }\n }\n }\n\n /**\n * Only parse the command line arguments passed in.\n * Does not strip off the `node script.js` bits, so it must be just the\n * arguments you wish to have parsed.\n * Does not read from or write to the environment, or set defaults.\n */\n parseRaw(args: string[]): Parsed {\n if (args === process.argv) {\n args = args.slice(\n (process as { _eval?: string })._eval !== undefined ? 1 : 2,\n )\n }\n\n const options = toParseArgsOptionsConfig(this.#configSet)\n const result = parseArgs({\n args,\n options,\n // always strict, but using our own logic\n strict: false,\n allowPositionals: this.#allowPositionals,\n tokens: true,\n })\n\n const p: Parsed = {\n values: {},\n positionals: [],\n }\n for (const token of result.tokens) {\n if (token.kind === 'positional') {\n p.positionals.push(token.value)\n if (\n this.#options.stopAtPositional ||\n this.#options.stopAtPositionalTest?.(token.value)\n ) {\n p.positionals.push(...args.slice(token.index + 1))\n break\n }\n } else if (token.kind === 'option') {\n let value: string | number | boolean | undefined = undefined\n if (token.name.startsWith('no-')) {\n const my = this.#configSet[token.name]\n const pname = token.name.substring('no-'.length)\n const pos = this.#configSet[pname]\n if (\n pos &&\n pos.type === 'boolean' &&\n (!my ||\n (my.type === 'boolean' && !!my.multiple === !!pos.multiple))\n ) {\n value = false\n token.name = pname\n }\n }\n const my = this.#configSet[token.name]\n if (!my) {\n throw new Error(\n `Unknown option '${token.rawName}'. ` +\n `To specify a positional argument starting with a '-', ` +\n `place it at the end of the command after '--', as in ` +\n `'-- ${token.rawName}'`,\n {\n cause: {\n found:\n token.rawName + (token.value ? `=${token.value}` : ''),\n },\n },\n )\n }\n if (value === undefined) {\n if (token.value === undefined) {\n if (my.type !== 'boolean') {\n throw new Error(\n `No value provided for ${token.rawName}, expected ${my.type}`,\n {\n cause: {\n name: token.rawName,\n wanted: valueType(my),\n },\n },\n )\n }\n value = true\n } else {\n if (my.type === 'boolean') {\n throw new Error(\n `Flag ${token.rawName} does not take a value, received '${token.value}'`,\n { cause: { found: token } },\n )\n }\n if (my.type === 'string') {\n value = token.value\n } else {\n value = +token.value\n if (value !== value) {\n throw new Error(\n `Invalid value '${token.value}' provided for ` +\n `'${token.rawName}' option, expected number`,\n {\n cause: {\n name: token.rawName,\n found: token.value,\n wanted: 'number',\n },\n },\n )\n }\n }\n }\n }\n if (my.multiple) {\n const pv = p.values as {\n [k: string]: (string | number | boolean)[]\n }\n const tn = pv[token.name] ?? []\n pv[token.name] = tn\n tn.push(value)\n } else {\n const pv = p.values as { [k: string]: string | number | boolean }\n pv[token.name] = value\n }\n }\n }\n\n for (const [field, value] of Object.entries(p.values)) {\n const valid = this.#configSet[field]?.validate\n const validOptions = this.#configSet[field]?.validOptions\n let cause:\n | undefined\n | {\n name: string\n found: unknown\n validOptions?: readonly string[] | readonly number[]\n }\n if (validOptions && !isValidOption(value, validOptions)) {\n cause = { name: field, found: value, validOptions: validOptions }\n }\n if (valid && !valid(value)) {\n cause ??= { name: field, found: value }\n }\n if (cause) {\n throw new Error(\n `Invalid value provided for --${field}: ${JSON.stringify(\n value,\n )}`,\n { cause },\n )\n }\n }\n\n return p\n }\n\n /**\n * do not set fields as 'no-foo' if 'foo' exists and both are bools\n * just set foo.\n */\n #noNoFields(f: string, val: unknown, s: string = f) {\n if (!f.startsWith('no-') || typeof val !== 'boolean') return\n const yes = f.substring('no-'.length)\n // recurse so we get the core config key we care about.\n this.#noNoFields(yes, val, s)\n if (this.#configSet[yes]?.type === 'boolean') {\n throw new Error(\n `do not set '${s}', instead set '${yes}' as desired.`,\n { cause: { found: s, wanted: yes } },\n )\n }\n }\n\n /**\n * Validate that any arbitrary object is a valid configuration `values`\n * object. Useful when loading config files or other sources.\n */\n validate(o: unknown): asserts o is Parsed['values'] {\n if (!o || typeof o !== 'object') {\n throw new Error('Invalid config: not an object', {\n cause: { found: o },\n })\n }\n const opts = o as Record\n for (const field in o) {\n const value = opts[field]\n /* c8 ignore next - for TS */\n if (value === undefined) continue\n this.#noNoFields(field, value)\n const config = this.#configSet[field]\n if (!config) {\n throw new Error(`Unknown config option: ${field}`, {\n cause: { found: field },\n })\n }\n if (!isValidValue(value, config.type, !!config.multiple)) {\n throw new Error(\n `Invalid value ${valueType(\n value,\n )} for ${field}, expected ${valueType(config)}`,\n {\n cause: {\n name: field,\n found: value,\n wanted: valueType(config),\n },\n },\n )\n }\n let cause:\n | undefined\n | {\n name: string\n found: any\n validOptions?: readonly string[] | readonly number[]\n }\n if (\n config.validOptions &&\n !isValidOption(value, config.validOptions)\n ) {\n cause = {\n name: field,\n found: value,\n validOptions: config.validOptions,\n }\n }\n if (config.validate && !config.validate(value)) {\n cause ??= { name: field, found: value }\n }\n if (cause) {\n throw new Error(`Invalid config value for ${field}: ${value}`, {\n cause,\n })\n }\n }\n }\n\n writeEnv(p: Parsed) {\n if (!this.#env || !this.#envPrefix) return\n for (const [field, value] of Object.entries(p.values)) {\n const my = this.#configSet[field]\n this.#env[toEnvKey(this.#envPrefix, field)] = toEnvVal(\n value,\n my?.delim,\n )\n }\n }\n\n /**\n * Add a heading to the usage output banner\n */\n heading(\n text: string,\n level?: 1 | 2 | 3 | 4 | 5 | 6,\n { pre = false }: { pre?: boolean } = {},\n ): Jack {\n if (level === undefined) {\n level = this.#fields.some(r => isHeading(r)) ? 2 : 1\n }\n this.#fields.push({ type: 'heading', text, level, pre })\n return this\n }\n\n /**\n * Add a long-form description to the usage output at this position.\n */\n description(text: string, { pre }: { pre?: boolean } = {}): Jack {\n this.#fields.push({ type: 'description', text, pre })\n return this\n }\n\n /**\n * Add one or more number fields.\n */\n num>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, num)\n }\n\n /**\n * Add one or more multiple number fields.\n */\n numList>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, numList)\n }\n\n /**\n * Add one or more string option fields.\n */\n opt>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, opt)\n }\n\n /**\n * Add one or more multiple string option fields.\n */\n optList>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, optList)\n }\n\n /**\n * Add one or more flag fields.\n */\n flag>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, flag)\n }\n\n /**\n * Add one or more multiple flag fields.\n */\n flagList>(\n fields: F,\n ): Jack> {\n return this.#addFields(fields, flagList)\n }\n\n /**\n * Generic field definition method. Similar to flag/flagList/number/etc,\n * but you must specify the `type` (and optionally `multiple` and `delim`)\n * fields on each one, or Jack won't know how to define them.\n */\n addFields(fields: F): Jack {\n const next = this as unknown as Jack\n for (const [name, field] of Object.entries(fields)) {\n this.#validateName(name, field)\n next.#fields.push({\n type: 'config',\n name,\n value: field as ConfigOptionBase,\n })\n }\n Object.assign(next.#configSet, fields)\n return next\n }\n\n #addFields<\n T extends ConfigType,\n M extends boolean,\n F extends ConfigMetaSet,\n >(\n fields: F,\n fn: (m: ConfigOptionMeta) => ConfigOptionBase,\n ): Jack> {\n type NextC = C & ConfigSetFromMetaSet\n const next = this as unknown as Jack\n Object.assign(\n next.#configSet,\n Object.fromEntries(\n Object.entries(fields).map(([name, field]) => {\n this.#validateName(name, field)\n const option = fn(field)\n next.#fields.push({\n type: 'config',\n name,\n value: option as ConfigOptionBase,\n })\n return [name, option]\n }),\n ),\n )\n return next\n }\n\n #validateName(name: string, field: { short?: string }) {\n if (!/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/.test(name)) {\n throw new TypeError(\n `Invalid option name: ${name}, ` +\n `must be '-' delimited ASCII alphanumeric`,\n )\n }\n if (this.#configSet[name]) {\n throw new TypeError(`Cannot redefine option ${field}`)\n }\n if (this.#shorts[name]) {\n throw new TypeError(\n `Cannot redefine option ${name}, already ` +\n `in use for ${this.#shorts[name]}`,\n )\n }\n if (field.short) {\n if (!/^[a-zA-Z0-9]$/.test(field.short)) {\n throw new TypeError(\n `Invalid ${name} short option: ${field.short}, ` +\n 'must be 1 ASCII alphanumeric character',\n )\n }\n if (this.#shorts[field.short]) {\n throw new TypeError(\n `Invalid ${name} short option: ${field.short}, ` +\n `already in use for ${this.#shorts[field.short]}`,\n )\n }\n this.#shorts[field.short] = name\n this.#shorts[name] = name\n }\n }\n\n /**\n * Return the usage banner for the given configuration\n */\n usage(): string {\n if (this.#usage) return this.#usage\n\n let headingLevel = 1\n const ui = cliui({ width })\n const first = this.#fields[0]\n let start = first?.type === 'heading' ? 1 : 0\n if (first?.type === 'heading') {\n ui.div({\n padding: [0, 0, 0, 0],\n text: normalize(first.text),\n })\n }\n ui.div({ padding: [0, 0, 0, 0], text: 'Usage:' })\n if (this.#options.usage) {\n ui.div({\n text: this.#options.usage,\n padding: [0, 0, 0, 2],\n })\n } else {\n const cmd = basename(String(process.argv[1]))\n const shortFlags: string[] = []\n const shorts: string[][] = []\n const flags: string[] = []\n const opts: string[][] = []\n for (const [field, config] of Object.entries(this.#configSet)) {\n if (config.short) {\n if (config.type === 'boolean') shortFlags.push(config.short)\n else shorts.push([config.short, config.hint || field])\n } else {\n if (config.type === 'boolean') flags.push(field)\n else opts.push([field, config.hint || field])\n }\n }\n const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''\n const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const lf = flags.map(k => ` --${k}`).join('')\n const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const usage = `${cmd}${sf}${so}${lf}${lo}`.trim()\n ui.div({\n text: usage,\n padding: [0, 0, 0, 2],\n })\n }\n\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n const maybeDesc = this.#fields[start]\n if (maybeDesc && isDescription(maybeDesc)) {\n const print = normalize(maybeDesc.text, maybeDesc.pre)\n start++\n ui.div({ padding: [0, 0, 0, 0], text: print })\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n }\n\n const { rows, maxWidth } = this.#usageRows(start)\n\n // every heading/description after the first gets indented by 2\n // extra spaces.\n for (const row of rows) {\n if (row.left) {\n // If the row is too long, don't wrap it\n // Bump the right-hand side down a line to make room\n const configIndent = indent(Math.max(headingLevel, 2))\n if (row.left.length > maxWidth - 3) {\n ui.div({ text: row.left, padding: [0, 0, 0, configIndent] })\n ui.div({ text: row.text, padding: [0, 0, 0, maxWidth] })\n } else {\n ui.div(\n {\n text: row.left,\n padding: [0, 1, 0, configIndent],\n width: maxWidth,\n },\n { padding: [0, 0, 0, 0], text: row.text },\n )\n }\n if (row.skipLine) {\n ui.div({ padding: [0, 0, 0, 0], text: '' })\n }\n } else {\n if (isHeading(row)) {\n const { level } = row\n headingLevel = level\n // only h1 and h2 have bottom padding\n // h3-h6 do not\n const b = level <= 2 ? 1 : 0\n ui.div({ ...row, padding: [0, 0, b, indent(level)] })\n } else {\n ui.div({ ...row, padding: [0, 0, 1, indent(headingLevel + 1)] })\n }\n }\n }\n\n return (this.#usage = ui.toString())\n }\n\n /**\n * Return the usage banner markdown for the given configuration\n */\n usageMarkdown(): string {\n if (this.#usageMarkdown) return this.#usageMarkdown\n\n const out: string[] = []\n\n let headingLevel = 1\n const first = this.#fields[0]\n let start = first?.type === 'heading' ? 1 : 0\n if (first?.type === 'heading') {\n out.push(`# ${normalizeOneLine(first.text)}`)\n }\n out.push('Usage:')\n if (this.#options.usage) {\n out.push(normalizeMarkdown(this.#options.usage, true))\n } else {\n const cmd = basename(String(process.argv[1]))\n const shortFlags: string[] = []\n const shorts: string[][] = []\n const flags: string[] = []\n const opts: string[][] = []\n for (const [field, config] of Object.entries(this.#configSet)) {\n if (config.short) {\n if (config.type === 'boolean') shortFlags.push(config.short)\n else shorts.push([config.short, config.hint || field])\n } else {\n if (config.type === 'boolean') flags.push(field)\n else opts.push([field, config.hint || field])\n }\n }\n const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''\n const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const lf = flags.map(k => ` --${k}`).join('')\n const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join('')\n const usage = `${cmd}${sf}${so}${lf}${lo}`.trim()\n out.push(normalizeMarkdown(usage, true))\n }\n\n const maybeDesc = this.#fields[start]\n if (maybeDesc && isDescription(maybeDesc)) {\n out.push(normalizeMarkdown(maybeDesc.text, maybeDesc.pre))\n start++\n }\n\n const { rows } = this.#usageRows(start)\n\n // heading level in markdown is number of # ahead of text\n for (const row of rows) {\n if (row.left) {\n out.push(\n '#'.repeat(headingLevel + 1) +\n ' ' +\n normalizeOneLine(row.left, true),\n )\n if (row.text) out.push(normalizeMarkdown(row.text))\n } else if (isHeading(row)) {\n const { level } = row\n headingLevel = level\n out.push(\n `${'#'.repeat(headingLevel)} ${normalizeOneLine(\n row.text,\n row.pre,\n )}`,\n )\n } else {\n out.push(normalizeMarkdown(row.text, !!(row as Description).pre))\n }\n }\n\n return (this.#usageMarkdown = out.join('\\n\\n') + '\\n')\n }\n\n #usageRows(start: number) {\n // turn each config type into a row, and figure out the width of the\n // left hand indentation for the option descriptions.\n let maxMax = Math.max(12, Math.min(26, Math.floor(width / 3)))\n let maxWidth = 8\n let prev: Row | TextRow | undefined = undefined\n const rows: (Row | TextRow)[] = []\n for (const field of this.#fields.slice(start)) {\n if (field.type !== 'config') {\n if (prev?.type === 'config') prev.skipLine = true\n prev = undefined\n field.text = normalize(field.text, !!field.pre)\n rows.push(field)\n continue\n }\n const { value } = field\n const desc = value.description || ''\n const mult = value.multiple ? 'Can be set multiple times' : ''\n const opts =\n value.validOptions?.length ?\n `Valid options:${value.validOptions.map(\n v => ` ${JSON.stringify(v)}`,\n )}`\n : ''\n const dmDelim = desc.includes('\\n') ? '\\n\\n' : '\\n'\n const extra = [opts, mult].join(dmDelim).trim()\n const text = (normalize(desc) + dmDelim + extra).trim()\n const hint =\n value.hint ||\n (value.type === 'number' ? 'n'\n : value.type === 'string' ? field.name\n : undefined)\n const short =\n !value.short ? ''\n : value.type === 'boolean' ? `-${value.short} `\n : `-${value.short}<${hint}> `\n const left =\n value.type === 'boolean' ?\n `${short}--${field.name}`\n : `${short}--${field.name}=<${hint}>`\n const row: Row = { text, left, type: 'config' }\n if (text.length > width - maxMax) {\n row.skipLine = true\n }\n if (prev && left.length > maxMax) prev.skipLine = true\n prev = row\n const len = left.length + 4\n if (len > maxWidth && len < maxMax) {\n maxWidth = len\n }\n\n rows.push(row)\n }\n\n return { rows, maxWidth }\n }\n\n /**\n * Return the configuration options as a plain object\n */\n toJSON() {\n return Object.fromEntries(\n Object.entries(this.#configSet).map(([field, def]) => [\n field,\n {\n type: def.type,\n ...(def.multiple ? { multiple: true } : {}),\n ...(def.delim ? { delim: def.delim } : {}),\n ...(def.short ? { short: def.short } : {}),\n ...(def.description ?\n { description: normalize(def.description) }\n : {}),\n ...(def.validate ? { validate: def.validate } : {}),\n ...(def.validOptions ? { validOptions: def.validOptions } : {}),\n ...(def.default !== undefined ? { default: def.default } : {}),\n ...(def.hint ? { hint: def.hint } : {}),\n },\n ]),\n )\n }\n\n /**\n * Custom printer for `util.inspect`\n */\n [inspect.custom](_: number, options: InspectOptions) {\n return `Jack ${inspect(this.toJSON(), options)}`\n }\n}\n\n// Unwrap and un-indent, so we can wrap description\n// strings however makes them look nice in the code.\nconst normalize = (s: string, pre = false) => {\n if (pre)\n // prepend a ZWSP to each line so cliui doesn't strip it.\n return s\n .split('\\n')\n .map(l => `\\u200b${l}`)\n .join('\\n')\n return s\n .split(/^\\s*```\\s*$/gm)\n .map((s, i) => {\n if (i % 2 === 1) {\n if (!s.trim()) {\n return `\\`\\`\\`\\n\\`\\`\\`\\n`\n }\n // outdent the ``` blocks, but preserve whitespace otherwise.\n const split = s.split('\\n')\n // throw out the \\n at the start and end\n split.pop()\n split.shift()\n const si = split.reduce((shortest, l) => {\n /* c8 ignore next */\n const ind = l.match(/^\\s*/)?.[0] ?? ''\n if (ind.length) return Math.min(ind.length, shortest)\n else return shortest\n }, Infinity)\n /* c8 ignore next */\n const i = isFinite(si) ? si : 0\n return (\n '\\n```\\n' +\n split.map(s => `\\u200b${s.substring(i)}`).join('\\n') +\n '\\n```\\n'\n )\n }\n return (\n s\n // remove single line breaks, except for lists\n .replace(/([^\\n])\\n[ \\t]*([^\\n])/g, (_, $1, $2) =>\n !/^[-*]/.test($2) ? `${$1} ${$2}` : `${$1}\\n${$2}`,\n )\n // normalize mid-line whitespace\n .replace(/([^\\n])[ \\t]+([^\\n])/g, '$1 $2')\n // two line breaks are enough\n .replace(/\\n{3,}/g, '\\n\\n')\n // remove any spaces at the start of a line\n .replace(/\\n[ \\t]+/g, '\\n')\n .trim()\n )\n })\n .join('\\n')\n}\n\n// normalize for markdown printing, remove leading spaces on lines\nconst normalizeMarkdown = (s: string, pre: boolean = false): string => {\n const n = normalize(s, pre).replace(/\\\\/g, '\\\\\\\\')\n return pre ?\n `\\`\\`\\`\\n${n.replace(/\\u200b/g, '')}\\n\\`\\`\\``\n : n.replace(/\\n +/g, '\\n').trim()\n}\n\nconst normalizeOneLine = (s: string, pre: boolean = false) => {\n const n = normalize(s, pre)\n .replace(/[\\s\\u200b]+/g, ' ')\n .trim()\n return pre ? `\\`${n}\\`` : n\n}\n\n/**\n * Main entry point. Create and return a {@link Jack} object.\n */\nexport const jack = (options: JackOptions = {}) => new Jack(options)\n"]} \ No newline at end of file diff --git a/node_modules/jackspeak/package.json b/node_modules/jackspeak/package.json index d5518f25..f9f74306 100644 --- a/node_modules/jackspeak/package.json +++ b/node_modules/jackspeak/package.json @@ -1,6 +1,6 @@ { "name": "jackspeak", - "version": "3.2.3", + "version": "3.4.0", "description": "A very strict and proper argument parser.", "tshy": { "main": true, diff --git a/node_modules/tslib/package.json b/node_modules/tslib/package.json index 0a1fdec5..a8646d5c 100644 --- a/node_modules/tslib/package.json +++ b/node_modules/tslib/package.json @@ -2,7 +2,7 @@ "name": "tslib", "author": "Microsoft Corp.", "homepage": "https://www.typescriptlang.org/", - "version": "2.6.2", + "version": "2.6.3", "license": "0BSD", "description": "Runtime library for TypeScript helper functions", "keywords": [ diff --git a/node_modules/tslib/tslib.d.ts b/node_modules/tslib/tslib.d.ts index 104369b3..45762215 100644 --- a/node_modules/tslib/tslib.d.ts +++ b/node_modules/tslib/tslib.d.ts @@ -123,7 +123,7 @@ export declare function __generator(thisArg: any, body: Function): any; * Creates bindings for all enumerable properties of `m` on `exports` * * @param m The source object - * @param exports The `exports` object. + * @param o The `exports` object. */ export declare function __exportStar(m: any, o: any): void; diff --git a/node_modules/tslib/tslib.es6.js b/node_modules/tslib/tslib.es6.js index 7be1c943..b212c256 100644 --- a/node_modules/tslib/tslib.es6.js +++ b/node_modules/tslib/tslib.es6.js @@ -228,8 +228,9 @@ export function __await(v) { export function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; + function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } + function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } @@ -295,7 +296,7 @@ export function __classPrivateFieldIn(state, receiver) { export function __addDisposableResource(env, value, async) { if (value !== null && value !== void 0) { if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose; + var dispose, inner; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); dispose = value[Symbol.asyncDispose]; @@ -303,14 +304,17 @@ export function __addDisposableResource(env, value, async) { if (dispose === void 0) { if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); dispose = value[Symbol.dispose]; + if (async) inner = dispose; } if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; env.stack.push({ value: value, dispose: dispose, async: async }); } else if (async) { env.stack.push({ async: true }); } return value; + } var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { diff --git a/node_modules/tslib/tslib.es6.mjs b/node_modules/tslib/tslib.es6.mjs index c8e29993..0df91b1b 100644 --- a/node_modules/tslib/tslib.es6.mjs +++ b/node_modules/tslib/tslib.es6.mjs @@ -228,8 +228,9 @@ export function __await(v) { export function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; + function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } + function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } @@ -295,16 +296,18 @@ export function __classPrivateFieldIn(state, receiver) { export function __addDisposableResource(env, value, async) { if (value !== null && value !== void 0) { if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose; + var dispose, inner; if (async) { - if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; } if (dispose === void 0) { - if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + if (async) inner = dispose; } if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; env.stack.push({ value: value, dispose: dispose, async: async }); } else if (async) { diff --git a/node_modules/tslib/tslib.js b/node_modules/tslib/tslib.js index 343ecded..0f7c846b 100644 --- a/node_modules/tslib/tslib.js +++ b/node_modules/tslib/tslib.js @@ -276,10 +276,11 @@ var __disposeResources; __asyncGenerator = function (thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; + function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } + function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } @@ -343,7 +344,7 @@ var __disposeResources; __addDisposableResource = function (env, value, async) { if (value !== null && value !== void 0) { if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose; + var dispose, inner; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); dispose = value[Symbol.asyncDispose]; @@ -351,8 +352,10 @@ var __disposeResources; if (dispose === void 0) { if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); dispose = value[Symbol.dispose]; + if (async) inner = dispose; } if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; env.stack.push({ value: value, dispose: dispose, async: async }); } else if (async) { diff --git a/package-lock.json b/package-lock.json index 7ee695af..30b60dfe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -682,9 +682,9 @@ } }, "node_modules/adm-zip": { - "version": "0.5.13", - "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.13.tgz", - "integrity": "sha512-4U51tTl9J8UVEcuKGr6zRzY95tWoAa9l+ureGBNmsfleszjZblm5NyEEL/ZQxkhi86co5mZhSvL2T7gkZ6feYQ==", + "version": "0.5.14", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.14.tgz", + "integrity": "sha512-DnyqqifT4Jrcvb8USYjp6FHtBpEIz1mnXu6pTRHZ0RL69LbQYiO+0lDFg5+OKA7U29oWSs3a/i8fhn8ZcceIWg==", "engines": { "node": ">=12.0" } @@ -1110,9 +1110,9 @@ } }, "node_modules/foreground-child": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", - "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.0.tgz", + "integrity": "sha512-CrWQNaEl1/6WeZoarcM9LHupTo3RpZO2Pdk1vktwzPiQTsJnAKJmm3TACKeG5UZbWDfaH2AbvYxzP96y0MT7fA==", "dependencies": { "cross-spawn": "^7.0.0", "signal-exit": "^4.0.1" @@ -1251,9 +1251,9 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, "node_modules/jackspeak": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.2.3.tgz", - "integrity": "sha512-htOzIMPbpLid/Gq9/zaz9SfExABxqRe1sSCdxntlO/aMD6u0issZQiY25n2GKQUtJ02j7z5sfptlAOMpWWOmvw==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.0.tgz", + "integrity": "sha512-JVYhQnN59LVPFCEcVa2C3CrEKYacvjRfqIQl+h8oi91aLYQVWRYbxjPcv1bUiUy/kLmQaANrYfNMCO3kuEDHfw==", "dependencies": { "@isaacs/cliui": "^8.0.2" }, @@ -1736,9 +1736,9 @@ } }, "node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" }, "node_modules/tunnel": { "version": "0.0.6",