Updated the files.
This commit is contained in:
parent
1553e6b971
commit
753967d4f5
23418 changed files with 3784666 additions and 0 deletions
15
my-app/node_modules/foreground-child/LICENSE
generated
vendored
Executable file
15
my-app/node_modules/foreground-child/LICENSE
generated
vendored
Executable file
|
@ -0,0 +1,15 @@
|
|||
The ISC License
|
||||
|
||||
Copyright (c) 2015-2023 Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
90
my-app/node_modules/foreground-child/README.md
generated
vendored
Executable file
90
my-app/node_modules/foreground-child/README.md
generated
vendored
Executable file
|
@ -0,0 +1,90 @@
|
|||
# foreground-child
|
||||
|
||||
Run a child as if it's the foreground process. Give it stdio. Exit
|
||||
when it exits.
|
||||
|
||||
Mostly this module is here to support some use cases around
|
||||
wrapping child processes for test coverage and such. But it's
|
||||
also generally useful any time you want one program to execute
|
||||
another as if it's the "main" process, for example, if a program
|
||||
takes a `--cmd` argument to execute in some way.
|
||||
|
||||
## USAGE
|
||||
|
||||
```js
|
||||
import { foregroundChild } from 'foreground-child'
|
||||
// hybrid module, this also works:
|
||||
// const { foregroundChild } = require('foreground-child')
|
||||
|
||||
// cats out this file
|
||||
const child = foregroundChild('cat', [__filename])
|
||||
|
||||
// At this point, it's best to just do nothing else.
|
||||
// return or whatever.
|
||||
// If the child gets a signal, or just exits, then this
|
||||
// parent process will exit in the same way.
|
||||
```
|
||||
|
||||
You can provide custom spawn options by passing an object after
|
||||
the program and arguments:
|
||||
|
||||
```js
|
||||
const child = foregroundChild(`cat ${__filename}`, { shell: true })
|
||||
```
|
||||
|
||||
A callback can optionally be provided, if you want to perform an
|
||||
action before your foreground-child exits:
|
||||
|
||||
```js
|
||||
const child = foregroundChild('cat', [__filename], spawnOptions, () => {
|
||||
doSomeActions()
|
||||
})
|
||||
```
|
||||
|
||||
The callback can return a Promise in order to perform
|
||||
asynchronous actions. If the callback does not return a promise,
|
||||
then it must complete its actions within a single JavaScript
|
||||
tick.
|
||||
|
||||
```js
|
||||
const child = foregroundChild('cat', [__filename], async () => {
|
||||
await doSomeAsyncActions()
|
||||
})
|
||||
```
|
||||
|
||||
If the callback throws or rejects, then it will be unhandled, and
|
||||
node will exit in error.
|
||||
|
||||
If the callback returns a string value, then that will be used as
|
||||
the signal to exit the parent process. If it returns a number,
|
||||
then that number will be used as the parent exit status code. If
|
||||
it returns boolean `false`, then the parent process will not be
|
||||
terminated. If it returns `undefined`, then it will exit with the
|
||||
same signal/code as the child process.
|
||||
|
||||
## Caveats
|
||||
|
||||
The "normal" standard IO file descriptors (0, 1, and 2 for stdin,
|
||||
stdout, and stderr respectively) are shared with the child process.
|
||||
Additionally, if there is an IPC channel set up in the parent, then
|
||||
messages are proxied to the child on file descriptor 3.
|
||||
|
||||
In Node, it's possible to also map arbitrary file descriptors
|
||||
into a child process. In these cases, foreground-child will not
|
||||
map the file descriptors into the child. If file descriptors 0,
|
||||
1, or 2 are used for the IPC channel, then strange behavior may
|
||||
happen (like printing IPC messages to stderr, for example).
|
||||
|
||||
Note that a SIGKILL will always kill the parent process, but
|
||||
will not proxy the signal to the child process, because SIGKILL
|
||||
cannot be caught. In order to address this, a special "watchdog"
|
||||
child process is spawned which will send a SIGKILL to the child
|
||||
process if it does not terminate within half a second after the
|
||||
watchdog receives a SIGHUP due to its parent terminating.
|
||||
|
||||
On Windows, issuing a `process.kill(process.pid, signal)` with a
|
||||
fatal termination signal may cause the process to exit with a `1`
|
||||
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.
|
3
my-app/node_modules/foreground-child/dist/cjs/all-signals.d.ts
generated
vendored
Executable file
3
my-app/node_modules/foreground-child/dist/cjs/all-signals.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,3 @@
|
|||
/// <reference types="node" />
|
||||
export declare const allSignals: NodeJS.Signals[];
|
||||
//# sourceMappingURL=all-signals.d.ts.map
|
1
my-app/node_modules/foreground-child/dist/cjs/all-signals.d.ts.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/dist/cjs/all-signals.d.ts.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"all-signals.d.ts","sourceRoot":"","sources":["../../src/all-signals.ts"],"names":[],"mappings":";AACA,eAAO,MAAM,UAAU,kBASA,CAAA"}
|
58
my-app/node_modules/foreground-child/dist/cjs/all-signals.js
generated
vendored
Executable file
58
my-app/node_modules/foreground-child/dist/cjs/all-signals.js
generated
vendored
Executable file
|
@ -0,0 +1,58 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.allSignals = void 0;
|
||||
const node_constants_1 = __importDefault(require("node:constants"));
|
||||
exports.allSignals =
|
||||
// this is the full list of signals that Node will let us do anything with
|
||||
Object.keys(node_constants_1.default).filter(k => k.startsWith('SIG') &&
|
||||
// https://github.com/tapjs/signal-exit/issues/21
|
||||
k !== 'SIGPROF' &&
|
||||
// no sense trying to listen for SIGKILL, it's impossible
|
||||
k !== 'SIGKILL');
|
||||
// These are some obscure signals that are reported by kill -l
|
||||
// on macOS, Linux, or Windows, but which don't have any mapping
|
||||
// in Node.js. No sense trying if they're just going to throw
|
||||
// every time on every platform.
|
||||
//
|
||||
// 'SIGEMT',
|
||||
// 'SIGLOST',
|
||||
// 'SIGPOLL',
|
||||
// 'SIGRTMAX',
|
||||
// 'SIGRTMAX-1',
|
||||
// 'SIGRTMAX-10',
|
||||
// 'SIGRTMAX-11',
|
||||
// 'SIGRTMAX-12',
|
||||
// 'SIGRTMAX-13',
|
||||
// 'SIGRTMAX-14',
|
||||
// 'SIGRTMAX-15',
|
||||
// 'SIGRTMAX-2',
|
||||
// 'SIGRTMAX-3',
|
||||
// 'SIGRTMAX-4',
|
||||
// 'SIGRTMAX-5',
|
||||
// 'SIGRTMAX-6',
|
||||
// 'SIGRTMAX-7',
|
||||
// 'SIGRTMAX-8',
|
||||
// 'SIGRTMAX-9',
|
||||
// 'SIGRTMIN',
|
||||
// 'SIGRTMIN+1',
|
||||
// 'SIGRTMIN+10',
|
||||
// 'SIGRTMIN+11',
|
||||
// 'SIGRTMIN+12',
|
||||
// 'SIGRTMIN+13',
|
||||
// 'SIGRTMIN+14',
|
||||
// 'SIGRTMIN+15',
|
||||
// 'SIGRTMIN+16',
|
||||
// 'SIGRTMIN+2',
|
||||
// 'SIGRTMIN+3',
|
||||
// 'SIGRTMIN+4',
|
||||
// 'SIGRTMIN+5',
|
||||
// 'SIGRTMIN+6',
|
||||
// 'SIGRTMIN+7',
|
||||
// 'SIGRTMIN+8',
|
||||
// 'SIGRTMIN+9',
|
||||
// 'SIGSTKFLT',
|
||||
// 'SIGUNUSED',
|
||||
//# sourceMappingURL=all-signals.js.map
|
1
my-app/node_modules/foreground-child/dist/cjs/all-signals.js.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/dist/cjs/all-signals.js.map
generated
vendored
Executable file
|
@ -0,0 +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"]}
|
54
my-app/node_modules/foreground-child/dist/cjs/index.d.ts
generated
vendored
Executable file
54
my-app/node_modules/foreground-child/dist/cjs/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,54 @@
|
|||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import { ChildProcess, SpawnOptions } from 'child_process';
|
||||
/**
|
||||
* The signature for the cleanup method.
|
||||
*
|
||||
* Arguments indicate the exit status of the child process.
|
||||
*
|
||||
* If a Promise is returned, then the process is not terminated
|
||||
* until it resolves, and the resolution value is treated as the
|
||||
* exit status (if a number) or signal exit (if a signal string).
|
||||
*
|
||||
* If `undefined` is returned, then no change is made, and the parent
|
||||
* exits in the same way that the child exited.
|
||||
*
|
||||
* If boolean `false` is returned, then the parent's exit is canceled.
|
||||
*
|
||||
* If a number is returned, then the parent process exits with the number
|
||||
* as its exitCode.
|
||||
*
|
||||
* If a signal string is returned, then the parent process is killed with
|
||||
* 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<void | undefined | number | NodeJS.Signals | false>;
|
||||
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] | [
|
||||
program: string,
|
||||
args?: string[],
|
||||
opts?: SpawnOptions,
|
||||
cleanup?: Cleanup
|
||||
];
|
||||
/**
|
||||
* Normalizes the arguments passed to `foregroundChild`.
|
||||
*
|
||||
* Exposed for testing.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* Cleanup method may be used to modify or ignore the result of the child's
|
||||
* exit code or signal. If cleanup returns undefined (or a Promise that
|
||||
* resolves to undefined), then the parent will exit in the same way that
|
||||
* the child did.
|
||||
*
|
||||
* Return boolean `false` to prevent the parent's exit entirely.
|
||||
*/
|
||||
export declare function foregroundChild(cmd: string | 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;
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
my-app/node_modules/foreground-child/dist/cjs/index.d.ts.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/dist/cjs/index.d.ts.map
generated
vendored
Executable file
|
@ -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,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"}
|
154
my-app/node_modules/foreground-child/dist/cjs/index.js
generated
vendored
Executable file
154
my-app/node_modules/foreground-child/dist/cjs/index.js
generated
vendored
Executable file
|
@ -0,0 +1,154 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
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 watchdog_js_1 = require("./watchdog.js");
|
||||
/* c8 ignore start */
|
||||
const spawn = process?.platform === 'win32' ? cross_spawn_1.default : child_process_1.spawn;
|
||||
/**
|
||||
* Normalizes the arguments passed to `foregroundChild`.
|
||||
*
|
||||
* Exposed for testing.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
const normalizeFgArgs = (fgArgs) => {
|
||||
let [program, args = [], spawnOpts = {}, cleanup = () => { }] = fgArgs;
|
||||
if (typeof args === 'function') {
|
||||
cleanup = args;
|
||||
spawnOpts = {};
|
||||
args = [];
|
||||
}
|
||||
else if (!!args && typeof args === 'object' && !Array.isArray(args)) {
|
||||
if (typeof spawnOpts === 'function')
|
||||
cleanup = spawnOpts;
|
||||
spawnOpts = args;
|
||||
args = [];
|
||||
}
|
||||
else if (typeof spawnOpts === 'function') {
|
||||
cleanup = spawnOpts;
|
||||
spawnOpts = {};
|
||||
}
|
||||
if (Array.isArray(program)) {
|
||||
const [pp, ...pa] = program;
|
||||
program = pp;
|
||||
args = pa;
|
||||
}
|
||||
return [program, args, { ...spawnOpts }, cleanup];
|
||||
};
|
||||
exports.normalizeFgArgs = normalizeFgArgs;
|
||||
function foregroundChild(...fgArgs) {
|
||||
const [program, args, spawnOpts, cleanup] = (0, exports.normalizeFgArgs)(fgArgs);
|
||||
spawnOpts.stdio = [0, 1, 2];
|
||||
if (process.send) {
|
||||
spawnOpts.stdio.push('ipc');
|
||||
}
|
||||
const child = spawn(program, args, spawnOpts);
|
||||
const unproxySignals = proxySignals(child);
|
||||
const childHangup = () => {
|
||||
try {
|
||||
child.kill('SIGHUP');
|
||||
/* c8 ignore start */
|
||||
}
|
||||
catch (_) {
|
||||
// SIGHUP is weird on windows
|
||||
child.kill('SIGTERM');
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
};
|
||||
const removeOnExit = (0, signal_exit_1.onExit)(childHangup);
|
||||
const dog = (0, watchdog_js_1.watchdog)(child);
|
||||
let done = false;
|
||||
child.on('close', async (code, signal) => {
|
||||
dog.kill('SIGKILL');
|
||||
/* c8 ignore start */
|
||||
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') {
|
||||
signal = res;
|
||||
code = null;
|
||||
}
|
||||
else if (typeof res === 'number') {
|
||||
code = res;
|
||||
signal = null;
|
||||
}
|
||||
if (signal) {
|
||||
// If there is nothing else keeping the event loop alive,
|
||||
// then there's a race between a graceful exit and getting
|
||||
// the signal to this process. Put this timeout here to
|
||||
// make sure we're still alive to get the signal, and thus
|
||||
// exit with the intended signal code.
|
||||
/* istanbul ignore next */
|
||||
setTimeout(() => { }, 2000);
|
||||
try {
|
||||
process.kill(process.pid, signal);
|
||||
/* c8 ignore start */
|
||||
}
|
||||
catch (_) {
|
||||
process.kill(process.pid, 'SIGTERM');
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
}
|
||||
else {
|
||||
process.exit(code || 0);
|
||||
}
|
||||
});
|
||||
if (process.send) {
|
||||
process.removeAllListeners('message');
|
||||
child.on('message', (message, sendHandle) => {
|
||||
process.send?.(message, sendHandle);
|
||||
});
|
||||
process.on('message', (message, sendHandle) => {
|
||||
child.send(message, sendHandle);
|
||||
});
|
||||
}
|
||||
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
|
1
my-app/node_modules/foreground-child/dist/cjs/index.js.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/dist/cjs/index.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
3
my-app/node_modules/foreground-child/dist/cjs/package.json
generated
vendored
Executable file
3
my-app/node_modules/foreground-child/dist/cjs/package.json
generated
vendored
Executable file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"type": "commonjs"
|
||||
}
|
4
my-app/node_modules/foreground-child/dist/cjs/watchdog.d.ts
generated
vendored
Executable file
4
my-app/node_modules/foreground-child/dist/cjs/watchdog.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,4 @@
|
|||
/// <reference types="node" />
|
||||
import { ChildProcess } from 'child_process';
|
||||
export declare const watchdog: (child: ChildProcess) => ChildProcess;
|
||||
//# sourceMappingURL=watchdog.d.ts.map
|
1
my-app/node_modules/foreground-child/dist/cjs/watchdog.d.ts.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/dist/cjs/watchdog.d.ts.map
generated
vendored
Executable file
|
@ -0,0 +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"}
|
43
my-app/node_modules/foreground-child/dist/cjs/watchdog.js
generated
vendored
Executable file
43
my-app/node_modules/foreground-child/dist/cjs/watchdog.js
generated
vendored
Executable file
|
@ -0,0 +1,43 @@
|
|||
"use strict";
|
||||
// this spawns a child process that listens for SIGHUP when the
|
||||
// parent process exits, and after 200ms, sends a SIGKILL to the
|
||||
// child, in case it did not terminate.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.watchdog = void 0;
|
||||
const child_process_1 = require("child_process");
|
||||
const watchdogCode = String.raw `
|
||||
const pid = parseInt(process.argv[1], 10)
|
||||
process.title = 'node (foreground-child watchdog pid=' + pid + ')'
|
||||
if (!isNaN(pid)) {
|
||||
let barked = false
|
||||
// keepalive
|
||||
const interval = setInterval(() => {}, 60000)
|
||||
const bark = () => {
|
||||
clearInterval(interval)
|
||||
if (barked) return
|
||||
barked = true
|
||||
process.removeListener('SIGHUP', bark)
|
||||
setTimeout(() => {
|
||||
try {
|
||||
process.kill(pid, 'SIGKILL')
|
||||
setTimeout(() => process.exit(), 200)
|
||||
} catch (_) {}
|
||||
}, 500)
|
||||
})
|
||||
process.on('SIGHUP', bark)
|
||||
}
|
||||
`;
|
||||
const watchdog = (child) => {
|
||||
let dogExited = false;
|
||||
const dog = (0, child_process_1.spawn)(process.execPath, ['-e', watchdogCode, String(child.pid)], {
|
||||
stdio: 'ignore',
|
||||
});
|
||||
dog.on('exit', () => (dogExited = true));
|
||||
child.on('exit', () => {
|
||||
if (!dogExited)
|
||||
dog.kill('SIGTERM');
|
||||
});
|
||||
return dog;
|
||||
};
|
||||
exports.watchdog = watchdog;
|
||||
//# sourceMappingURL=watchdog.js.map
|
1
my-app/node_modules/foreground-child/dist/cjs/watchdog.js.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/dist/cjs/watchdog.js.map
generated
vendored
Executable file
|
@ -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;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"]}
|
3
my-app/node_modules/foreground-child/dist/mjs/all-signals.d.ts
generated
vendored
Executable file
3
my-app/node_modules/foreground-child/dist/mjs/all-signals.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,3 @@
|
|||
/// <reference types="node" />
|
||||
export declare const allSignals: NodeJS.Signals[];
|
||||
//# sourceMappingURL=all-signals.d.ts.map
|
1
my-app/node_modules/foreground-child/dist/mjs/all-signals.d.ts.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/dist/mjs/all-signals.d.ts.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"all-signals.d.ts","sourceRoot":"","sources":["../../src/all-signals.ts"],"names":[],"mappings":";AACA,eAAO,MAAM,UAAU,kBASA,CAAA"}
|
52
my-app/node_modules/foreground-child/dist/mjs/all-signals.js
generated
vendored
Executable file
52
my-app/node_modules/foreground-child/dist/mjs/all-signals.js
generated
vendored
Executable file
|
@ -0,0 +1,52 @@
|
|||
import constants from 'node:constants';
|
||||
export const allSignals =
|
||||
// this is the full list of signals that Node will let us do anything with
|
||||
Object.keys(constants).filter(k => k.startsWith('SIG') &&
|
||||
// https://github.com/tapjs/signal-exit/issues/21
|
||||
k !== 'SIGPROF' &&
|
||||
// no sense trying to listen for SIGKILL, it's impossible
|
||||
k !== 'SIGKILL');
|
||||
// These are some obscure signals that are reported by kill -l
|
||||
// on macOS, Linux, or Windows, but which don't have any mapping
|
||||
// in Node.js. No sense trying if they're just going to throw
|
||||
// every time on every platform.
|
||||
//
|
||||
// 'SIGEMT',
|
||||
// 'SIGLOST',
|
||||
// 'SIGPOLL',
|
||||
// 'SIGRTMAX',
|
||||
// 'SIGRTMAX-1',
|
||||
// 'SIGRTMAX-10',
|
||||
// 'SIGRTMAX-11',
|
||||
// 'SIGRTMAX-12',
|
||||
// 'SIGRTMAX-13',
|
||||
// 'SIGRTMAX-14',
|
||||
// 'SIGRTMAX-15',
|
||||
// 'SIGRTMAX-2',
|
||||
// 'SIGRTMAX-3',
|
||||
// 'SIGRTMAX-4',
|
||||
// 'SIGRTMAX-5',
|
||||
// 'SIGRTMAX-6',
|
||||
// 'SIGRTMAX-7',
|
||||
// 'SIGRTMAX-8',
|
||||
// 'SIGRTMAX-9',
|
||||
// 'SIGRTMIN',
|
||||
// 'SIGRTMIN+1',
|
||||
// 'SIGRTMIN+10',
|
||||
// 'SIGRTMIN+11',
|
||||
// 'SIGRTMIN+12',
|
||||
// 'SIGRTMIN+13',
|
||||
// 'SIGRTMIN+14',
|
||||
// 'SIGRTMIN+15',
|
||||
// 'SIGRTMIN+16',
|
||||
// 'SIGRTMIN+2',
|
||||
// 'SIGRTMIN+3',
|
||||
// 'SIGRTMIN+4',
|
||||
// 'SIGRTMIN+5',
|
||||
// 'SIGRTMIN+6',
|
||||
// 'SIGRTMIN+7',
|
||||
// 'SIGRTMIN+8',
|
||||
// 'SIGRTMIN+9',
|
||||
// 'SIGSTKFLT',
|
||||
// 'SIGUNUSED',
|
||||
//# sourceMappingURL=all-signals.js.map
|
1
my-app/node_modules/foreground-child/dist/mjs/all-signals.js.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/dist/mjs/all-signals.js.map
generated
vendored
Executable file
|
@ -0,0 +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"]}
|
54
my-app/node_modules/foreground-child/dist/mjs/index.d.ts
generated
vendored
Executable file
54
my-app/node_modules/foreground-child/dist/mjs/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,54 @@
|
|||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import { ChildProcess, SpawnOptions } from 'child_process';
|
||||
/**
|
||||
* The signature for the cleanup method.
|
||||
*
|
||||
* Arguments indicate the exit status of the child process.
|
||||
*
|
||||
* If a Promise is returned, then the process is not terminated
|
||||
* until it resolves, and the resolution value is treated as the
|
||||
* exit status (if a number) or signal exit (if a signal string).
|
||||
*
|
||||
* If `undefined` is returned, then no change is made, and the parent
|
||||
* exits in the same way that the child exited.
|
||||
*
|
||||
* If boolean `false` is returned, then the parent's exit is canceled.
|
||||
*
|
||||
* If a number is returned, then the parent process exits with the number
|
||||
* as its exitCode.
|
||||
*
|
||||
* If a signal string is returned, then the parent process is killed with
|
||||
* 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<void | undefined | number | NodeJS.Signals | false>;
|
||||
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] | [
|
||||
program: string,
|
||||
args?: string[],
|
||||
opts?: SpawnOptions,
|
||||
cleanup?: Cleanup
|
||||
];
|
||||
/**
|
||||
* Normalizes the arguments passed to `foregroundChild`.
|
||||
*
|
||||
* Exposed for testing.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* Cleanup method may be used to modify or ignore the result of the child's
|
||||
* exit code or signal. If cleanup returns undefined (or a Promise that
|
||||
* resolves to undefined), then the parent will exit in the same way that
|
||||
* the child did.
|
||||
*
|
||||
* Return boolean `false` to prevent the parent's exit entirely.
|
||||
*/
|
||||
export declare function foregroundChild(cmd: string | 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;
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
my-app/node_modules/foreground-child/dist/mjs/index.d.ts.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/dist/mjs/index.d.ts.map
generated
vendored
Executable file
|
@ -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,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"}
|
146
my-app/node_modules/foreground-child/dist/mjs/index.js
generated
vendored
Executable file
146
my-app/node_modules/foreground-child/dist/mjs/index.js
generated
vendored
Executable file
|
@ -0,0 +1,146 @@
|
|||
import { spawn as nodeSpawn, } from 'child_process';
|
||||
import crossSpawn from 'cross-spawn';
|
||||
import { onExit } from 'signal-exit';
|
||||
import { allSignals } from './all-signals.js';
|
||||
import { watchdog } from './watchdog.js';
|
||||
/* c8 ignore start */
|
||||
const spawn = process?.platform === 'win32' ? crossSpawn : nodeSpawn;
|
||||
/**
|
||||
* Normalizes the arguments passed to `foregroundChild`.
|
||||
*
|
||||
* Exposed for testing.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export const normalizeFgArgs = (fgArgs) => {
|
||||
let [program, args = [], spawnOpts = {}, cleanup = () => { }] = fgArgs;
|
||||
if (typeof args === 'function') {
|
||||
cleanup = args;
|
||||
spawnOpts = {};
|
||||
args = [];
|
||||
}
|
||||
else if (!!args && typeof args === 'object' && !Array.isArray(args)) {
|
||||
if (typeof spawnOpts === 'function')
|
||||
cleanup = spawnOpts;
|
||||
spawnOpts = args;
|
||||
args = [];
|
||||
}
|
||||
else if (typeof spawnOpts === 'function') {
|
||||
cleanup = spawnOpts;
|
||||
spawnOpts = {};
|
||||
}
|
||||
if (Array.isArray(program)) {
|
||||
const [pp, ...pa] = program;
|
||||
program = pp;
|
||||
args = pa;
|
||||
}
|
||||
return [program, args, { ...spawnOpts }, cleanup];
|
||||
};
|
||||
export function foregroundChild(...fgArgs) {
|
||||
const [program, args, spawnOpts, cleanup] = normalizeFgArgs(fgArgs);
|
||||
spawnOpts.stdio = [0, 1, 2];
|
||||
if (process.send) {
|
||||
spawnOpts.stdio.push('ipc');
|
||||
}
|
||||
const child = spawn(program, args, spawnOpts);
|
||||
const unproxySignals = proxySignals(child);
|
||||
const childHangup = () => {
|
||||
try {
|
||||
child.kill('SIGHUP');
|
||||
/* c8 ignore start */
|
||||
}
|
||||
catch (_) {
|
||||
// SIGHUP is weird on windows
|
||||
child.kill('SIGTERM');
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
};
|
||||
const removeOnExit = onExit(childHangup);
|
||||
const dog = watchdog(child);
|
||||
let done = false;
|
||||
child.on('close', async (code, signal) => {
|
||||
dog.kill('SIGKILL');
|
||||
/* c8 ignore start */
|
||||
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') {
|
||||
signal = res;
|
||||
code = null;
|
||||
}
|
||||
else if (typeof res === 'number') {
|
||||
code = res;
|
||||
signal = null;
|
||||
}
|
||||
if (signal) {
|
||||
// If there is nothing else keeping the event loop alive,
|
||||
// then there's a race between a graceful exit and getting
|
||||
// the signal to this process. Put this timeout here to
|
||||
// make sure we're still alive to get the signal, and thus
|
||||
// exit with the intended signal code.
|
||||
/* istanbul ignore next */
|
||||
setTimeout(() => { }, 2000);
|
||||
try {
|
||||
process.kill(process.pid, signal);
|
||||
/* c8 ignore start */
|
||||
}
|
||||
catch (_) {
|
||||
process.kill(process.pid, 'SIGTERM');
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
}
|
||||
else {
|
||||
process.exit(code || 0);
|
||||
}
|
||||
});
|
||||
if (process.send) {
|
||||
process.removeAllListeners('message');
|
||||
child.on('message', (message, sendHandle) => {
|
||||
process.send?.(message, sendHandle);
|
||||
});
|
||||
process.on('message', (message, sendHandle) => {
|
||||
child.send(message, sendHandle);
|
||||
});
|
||||
}
|
||||
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
|
1
my-app/node_modules/foreground-child/dist/mjs/index.js.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/dist/mjs/index.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
3
my-app/node_modules/foreground-child/dist/mjs/package.json
generated
vendored
Executable file
3
my-app/node_modules/foreground-child/dist/mjs/package.json
generated
vendored
Executable file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"type": "module"
|
||||
}
|
4
my-app/node_modules/foreground-child/dist/mjs/watchdog.d.ts
generated
vendored
Executable file
4
my-app/node_modules/foreground-child/dist/mjs/watchdog.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,4 @@
|
|||
/// <reference types="node" />
|
||||
import { ChildProcess } from 'child_process';
|
||||
export declare const watchdog: (child: ChildProcess) => ChildProcess;
|
||||
//# sourceMappingURL=watchdog.d.ts.map
|
1
my-app/node_modules/foreground-child/dist/mjs/watchdog.d.ts.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/dist/mjs/watchdog.d.ts.map
generated
vendored
Executable file
|
@ -0,0 +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"}
|
39
my-app/node_modules/foreground-child/dist/mjs/watchdog.js
generated
vendored
Executable file
39
my-app/node_modules/foreground-child/dist/mjs/watchdog.js
generated
vendored
Executable file
|
@ -0,0 +1,39 @@
|
|||
// this spawns a child process that listens for SIGHUP when the
|
||||
// parent process exits, and after 200ms, sends a SIGKILL to the
|
||||
// child, in case it did not terminate.
|
||||
import { spawn } from 'child_process';
|
||||
const watchdogCode = String.raw `
|
||||
const pid = parseInt(process.argv[1], 10)
|
||||
process.title = 'node (foreground-child watchdog pid=' + pid + ')'
|
||||
if (!isNaN(pid)) {
|
||||
let barked = false
|
||||
// keepalive
|
||||
const interval = setInterval(() => {}, 60000)
|
||||
const bark = () => {
|
||||
clearInterval(interval)
|
||||
if (barked) return
|
||||
barked = true
|
||||
process.removeListener('SIGHUP', bark)
|
||||
setTimeout(() => {
|
||||
try {
|
||||
process.kill(pid, 'SIGKILL')
|
||||
setTimeout(() => process.exit(), 200)
|
||||
} catch (_) {}
|
||||
}, 500)
|
||||
})
|
||||
process.on('SIGHUP', bark)
|
||||
}
|
||||
`;
|
||||
export const watchdog = (child) => {
|
||||
let dogExited = false;
|
||||
const dog = spawn(process.execPath, ['-e', watchdogCode, String(child.pid)], {
|
||||
stdio: 'ignore',
|
||||
});
|
||||
dog.on('exit', () => (dogExited = true));
|
||||
child.on('exit', () => {
|
||||
if (!dogExited)
|
||||
dog.kill('SIGTERM');
|
||||
});
|
||||
return dog;
|
||||
};
|
||||
//# sourceMappingURL=watchdog.js.map
|
1
my-app/node_modules/foreground-child/dist/mjs/watchdog.js.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/dist/mjs/watchdog.js.map
generated
vendored
Executable file
|
@ -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,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"]}
|
16
my-app/node_modules/foreground-child/node_modules/signal-exit/LICENSE.txt
generated
vendored
Executable file
16
my-app/node_modules/foreground-child/node_modules/signal-exit/LICENSE.txt
generated
vendored
Executable file
|
@ -0,0 +1,16 @@
|
|||
The ISC License
|
||||
|
||||
Copyright (c) 2015-2023 Benjamin Coe, Isaac Z. Schlueter, and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software
|
||||
for any purpose with or without fee is hereby granted, provided
|
||||
that the above copyright notice and this permission notice
|
||||
appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
|
||||
LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
74
my-app/node_modules/foreground-child/node_modules/signal-exit/README.md
generated
vendored
Executable file
74
my-app/node_modules/foreground-child/node_modules/signal-exit/README.md
generated
vendored
Executable file
|
@ -0,0 +1,74 @@
|
|||
# signal-exit
|
||||
|
||||
When you want to fire an event no matter how a process exits:
|
||||
|
||||
- reaching the end of execution.
|
||||
- explicitly having `process.exit(code)` called.
|
||||
- having `process.kill(pid, sig)` called.
|
||||
- receiving a fatal signal from outside the process
|
||||
|
||||
Use `signal-exit`.
|
||||
|
||||
```js
|
||||
// Hybrid module, either works
|
||||
import { onExit } from 'signal-exit'
|
||||
// or:
|
||||
// const { onExit } = require('signal-exit')
|
||||
|
||||
onExit((code, signal) => {
|
||||
console.log('process exited!', code, signal)
|
||||
})
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
`remove = onExit((code, signal) => {}, options)`
|
||||
|
||||
The return value of the function is a function that will remove
|
||||
the handler.
|
||||
|
||||
Note that the function _only_ fires for signals if the signal
|
||||
would cause the process to exit. That is, there are no other
|
||||
listeners, and it is a fatal signal.
|
||||
|
||||
If the global `process` object is not suitable for this purpose
|
||||
(ie, it's unset, or doesn't have an `emit` method, etc.) then the
|
||||
`onExit` function is a no-op that returns a no-op `remove` method.
|
||||
|
||||
### Options
|
||||
|
||||
- `alwaysLast`: Run this handler after any other signal or exit
|
||||
handlers. This causes `process.emit` to be monkeypatched.
|
||||
|
||||
### Capturing Signal Exits
|
||||
|
||||
If the handler returns an exact boolean `true`, and the exit is a
|
||||
due to signal, then the signal will be considered handled, and
|
||||
will _not_ trigger a synthetic `process.kill(process.pid,
|
||||
signal)` after firing the `onExit` handlers.
|
||||
|
||||
In this case, it your responsibility as the caller to exit with a
|
||||
signal (for example, by calling `process.kill()`) if you wish to
|
||||
preserve the same exit status that would otherwise have occurred.
|
||||
If you do not, then the process will likely exit gracefully with
|
||||
status 0 at some point, assuming that no other terminating signal
|
||||
or other exit trigger occurs.
|
||||
|
||||
Prior to calling handlers, the `onExit` machinery is unloaded, so
|
||||
any subsequent exits or signals will not be handled, even if the
|
||||
signal is captured and the exit is thus prevented.
|
||||
|
||||
Note that numeric code exits may indicate that the process is
|
||||
already committed to exiting, for example due to a fatal
|
||||
exception or unhandled promise rejection, and so there is no way to
|
||||
prevent it safely.
|
||||
|
||||
### Browser Fallback
|
||||
|
||||
The `'signal-exit/browser'` module is the same fallback shim that
|
||||
just doesn't do anything, but presents the same function
|
||||
interface.
|
||||
|
||||
Patches welcome to add something that hooks onto
|
||||
`window.onbeforeunload` or similar, but it might just not be a
|
||||
thing that makes sense there.
|
12
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/browser.d.ts
generated
vendored
Executable file
12
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/browser.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* This is a browser shim that provides the same functional interface
|
||||
* as the main node export, but it does nothing.
|
||||
* @module
|
||||
*/
|
||||
import type { Handler } from './index.js';
|
||||
export declare const onExit: (cb: Handler, opts: {
|
||||
alwaysLast?: boolean;
|
||||
}) => () => void;
|
||||
export declare const load: () => void;
|
||||
export declare const unload: () => void;
|
||||
//# sourceMappingURL=browser.d.ts.map
|
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/browser.d.ts.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/browser.d.ts.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,eAAO,MAAM,MAAM,EAAE,CACnB,EAAE,EAAE,OAAO,EACX,IAAI,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,KAC3B,MAAM,IAAqB,CAAA;AAChC,eAAO,MAAM,IAAI,YAAW,CAAA;AAC5B,eAAO,MAAM,MAAM,YAAW,CAAA"}
|
10
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/browser.js
generated
vendored
Executable file
10
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/browser.js
generated
vendored
Executable file
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.unload = exports.load = exports.onExit = void 0;
|
||||
const onExit = () => () => { };
|
||||
exports.onExit = onExit;
|
||||
const load = () => { };
|
||||
exports.load = load;
|
||||
const unload = () => { };
|
||||
exports.unload = unload;
|
||||
//# sourceMappingURL=browser.js.map
|
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/browser.js.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/browser.js.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":";;;AAMO,MAAM,MAAM,GAGD,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC,CAAA;AAHnB,QAAA,MAAM,UAGa;AACzB,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA;AAAf,QAAA,IAAI,QAAW;AACrB,MAAM,MAAM,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA;AAAjB,QAAA,MAAM,UAAW","sourcesContent":["/**\n * This is a browser shim that provides the same functional interface\n * as the main node export, but it does nothing.\n * @module\n */\nimport type { Handler } from './index.js'\nexport const onExit: (\n cb: Handler,\n opts: { alwaysLast?: boolean }\n) => () => void = () => () => {}\nexport const load = () => {}\nexport const unload = () => {}\n"]}
|
48
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/index.d.ts
generated
vendored
Executable file
48
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,48 @@
|
|||
/// <reference types="node" />
|
||||
import { signals } from './signals.js';
|
||||
export { signals };
|
||||
/**
|
||||
* A function that takes an exit code and signal as arguments
|
||||
*
|
||||
* In the case of signal exits *only*, a return value of true
|
||||
* will indicate that the signal is being handled, and we should
|
||||
* not synthetically exit with the signal we received. Regardless
|
||||
* of the handler return value, the handler is unloaded when an
|
||||
* otherwise fatal signal is received, so you get exactly 1 shot
|
||||
* at it, unless you add another onExit handler at that point.
|
||||
*
|
||||
* In the case of numeric code exits, we may already have committed
|
||||
* to exiting the process, for example via a fatal exception or
|
||||
* unhandled promise rejection, so it is impossible to stop safely.
|
||||
*/
|
||||
export type Handler = (code: number | null | undefined, signal: NodeJS.Signals | null) => true | void;
|
||||
export declare const
|
||||
/**
|
||||
* Called when the process is exiting, whether via signal, explicit
|
||||
* exit, or running out of stuff to do.
|
||||
*
|
||||
* If the global process object is not suitable for instrumentation,
|
||||
* then this will be a no-op.
|
||||
*
|
||||
* Returns a function that may be used to unload signal-exit.
|
||||
*/
|
||||
onExit: (cb: Handler, opts?: {
|
||||
alwaysLast?: boolean | undefined;
|
||||
} | undefined) => () => void,
|
||||
/**
|
||||
* Load the listeners. Likely you never need to call this, unless
|
||||
* doing a rather deep integration with signal-exit functionality.
|
||||
* Mostly exposed for the benefit of testing.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
load: () => void,
|
||||
/**
|
||||
* Unload the listeners. Likely you never need to call this, unless
|
||||
* doing a rather deep integration with signal-exit functionality.
|
||||
* Mostly exposed for the benefit of testing.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
unload: () => void;
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/index.d.ts.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/index.d.ts.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,CAAA;AAuBlB;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,OAAO,GAAG,CACpB,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC/B,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,KAC1B,IAAI,GAAG,IAAI,CAAA;AA8QhB,eAAO;AACL;;;;;;;;GAQG;AACH,MAAM,OAzMO,OAAO;;wBAPiD,IAAI;AAkNzE;;;;;;GAMG;AACH,IAAI;AAEJ;;;;;;GAMG;AACH,MAAM,YAGP,CAAA"}
|
279
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/index.js
generated
vendored
Executable file
279
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/index.js
generated
vendored
Executable file
|
@ -0,0 +1,279 @@
|
|||
"use strict";
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.unload = exports.load = exports.onExit = exports.signals = void 0;
|
||||
// Note: since nyc uses this module to output coverage, any lines
|
||||
// that are in the direct sync flow of nyc's outputCoverage are
|
||||
// ignored, since we can never get coverage for them.
|
||||
// grab a reference to node's real process object right away
|
||||
const signals_js_1 = require("./signals.js");
|
||||
Object.defineProperty(exports, "signals", { enumerable: true, get: function () { return signals_js_1.signals; } });
|
||||
const processOk = (process) => !!process &&
|
||||
typeof process === 'object' &&
|
||||
typeof process.removeListener === 'function' &&
|
||||
typeof process.emit === 'function' &&
|
||||
typeof process.reallyExit === 'function' &&
|
||||
typeof process.listeners === 'function' &&
|
||||
typeof process.kill === 'function' &&
|
||||
typeof process.pid === 'number' &&
|
||||
typeof process.on === 'function';
|
||||
const kExitEmitter = Symbol.for('signal-exit emitter');
|
||||
const global = globalThis;
|
||||
const ObjectDefineProperty = Object.defineProperty.bind(Object);
|
||||
// teeny special purpose ee
|
||||
class Emitter {
|
||||
emitted = {
|
||||
afterExit: false,
|
||||
exit: false,
|
||||
};
|
||||
listeners = {
|
||||
afterExit: [],
|
||||
exit: [],
|
||||
};
|
||||
count = 0;
|
||||
id = Math.random();
|
||||
constructor() {
|
||||
if (global[kExitEmitter]) {
|
||||
return global[kExitEmitter];
|
||||
}
|
||||
ObjectDefineProperty(global, kExitEmitter, {
|
||||
value: this,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false,
|
||||
});
|
||||
}
|
||||
on(ev, fn) {
|
||||
this.listeners[ev].push(fn);
|
||||
}
|
||||
removeListener(ev, fn) {
|
||||
const list = this.listeners[ev];
|
||||
const i = list.indexOf(fn);
|
||||
/* c8 ignore start */
|
||||
if (i === -1) {
|
||||
return;
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
if (i === 0 && list.length === 1) {
|
||||
list.length = 0;
|
||||
}
|
||||
else {
|
||||
list.splice(i, 1);
|
||||
}
|
||||
}
|
||||
emit(ev, code, signal) {
|
||||
if (this.emitted[ev]) {
|
||||
return false;
|
||||
}
|
||||
this.emitted[ev] = true;
|
||||
let ret = false;
|
||||
for (const fn of this.listeners[ev]) {
|
||||
ret = fn(code, signal) === true || ret;
|
||||
}
|
||||
if (ev === 'exit') {
|
||||
ret = this.emit('afterExit', code, signal) || ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
class SignalExitBase {
|
||||
}
|
||||
const signalExitWrap = (handler) => {
|
||||
return {
|
||||
onExit(cb, opts) {
|
||||
return handler.onExit(cb, opts);
|
||||
},
|
||||
load() {
|
||||
return handler.load();
|
||||
},
|
||||
unload() {
|
||||
return handler.unload();
|
||||
},
|
||||
};
|
||||
};
|
||||
class SignalExitFallback extends SignalExitBase {
|
||||
onExit() {
|
||||
return () => { };
|
||||
}
|
||||
load() { }
|
||||
unload() { }
|
||||
}
|
||||
class SignalExit extends SignalExitBase {
|
||||
// "SIGHUP" throws an `ENOSYS` error on Windows,
|
||||
// so use a supported signal instead
|
||||
/* c8 ignore start */
|
||||
#hupSig = process.platform === 'win32' ? 'SIGINT' : 'SIGHUP';
|
||||
/* c8 ignore stop */
|
||||
#emitter = new Emitter();
|
||||
#process;
|
||||
#originalProcessEmit;
|
||||
#originalProcessReallyExit;
|
||||
#sigListeners = {};
|
||||
#loaded = false;
|
||||
constructor(process) {
|
||||
super();
|
||||
this.#process = process;
|
||||
// { <signal>: <listener fn>, ... }
|
||||
this.#sigListeners = {};
|
||||
for (const sig of signals_js_1.signals) {
|
||||
this.#sigListeners[sig] = () => {
|
||||
// If there are no other listeners, an exit is coming!
|
||||
// Simplest way: remove us and then re-send the signal.
|
||||
// We know that this will kill the process, so we can
|
||||
// safely emit now.
|
||||
const listeners = this.#process.listeners(sig);
|
||||
let { count } = this.#emitter;
|
||||
// This is a workaround for the fact that signal-exit v3 and signal
|
||||
// exit v4 are not aware of each other, and each will attempt to let
|
||||
// the other handle it, so neither of them do. To correct this, we
|
||||
// detect if we're the only handler *except* for previous versions
|
||||
// of signal-exit, and increment by the count of listeners it has
|
||||
// created.
|
||||
/* c8 ignore start */
|
||||
const p = process;
|
||||
if (typeof p.__signal_exit_emitter__ === 'object' &&
|
||||
typeof p.__signal_exit_emitter__.count === 'number') {
|
||||
count += p.__signal_exit_emitter__.count;
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
if (listeners.length === count) {
|
||||
this.unload();
|
||||
const ret = this.#emitter.emit('exit', null, sig);
|
||||
/* c8 ignore start */
|
||||
const s = sig === 'SIGHUP' ? this.#hupSig : sig;
|
||||
if (!ret)
|
||||
process.kill(process.pid, s);
|
||||
/* c8 ignore stop */
|
||||
}
|
||||
};
|
||||
}
|
||||
this.#originalProcessReallyExit = process.reallyExit;
|
||||
this.#originalProcessEmit = process.emit;
|
||||
}
|
||||
onExit(cb, opts) {
|
||||
/* c8 ignore start */
|
||||
if (!processOk(this.#process)) {
|
||||
return () => { };
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
if (this.#loaded === false) {
|
||||
this.load();
|
||||
}
|
||||
const ev = opts?.alwaysLast ? 'afterExit' : 'exit';
|
||||
this.#emitter.on(ev, cb);
|
||||
return () => {
|
||||
this.#emitter.removeListener(ev, cb);
|
||||
if (this.#emitter.listeners['exit'].length === 0 &&
|
||||
this.#emitter.listeners['afterExit'].length === 0) {
|
||||
this.unload();
|
||||
}
|
||||
};
|
||||
}
|
||||
load() {
|
||||
if (this.#loaded) {
|
||||
return;
|
||||
}
|
||||
this.#loaded = true;
|
||||
// This is the number of onSignalExit's that are in play.
|
||||
// It's important so that we can count the correct number of
|
||||
// listeners on signals, and don't wait for the other one to
|
||||
// handle it instead of us.
|
||||
this.#emitter.count += 1;
|
||||
for (const sig of signals_js_1.signals) {
|
||||
try {
|
||||
const fn = this.#sigListeners[sig];
|
||||
if (fn)
|
||||
this.#process.on(sig, fn);
|
||||
}
|
||||
catch (_) { }
|
||||
}
|
||||
this.#process.emit = (ev, ...a) => {
|
||||
return this.#processEmit(ev, ...a);
|
||||
};
|
||||
this.#process.reallyExit = (code) => {
|
||||
return this.#processReallyExit(code);
|
||||
};
|
||||
}
|
||||
unload() {
|
||||
if (!this.#loaded) {
|
||||
return;
|
||||
}
|
||||
this.#loaded = false;
|
||||
signals_js_1.signals.forEach(sig => {
|
||||
const listener = this.#sigListeners[sig];
|
||||
/* c8 ignore start */
|
||||
if (!listener) {
|
||||
throw new Error('Listener not defined for signal: ' + sig);
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
try {
|
||||
this.#process.removeListener(sig, listener);
|
||||
/* c8 ignore start */
|
||||
}
|
||||
catch (_) { }
|
||||
/* c8 ignore stop */
|
||||
});
|
||||
this.#process.emit = this.#originalProcessEmit;
|
||||
this.#process.reallyExit = this.#originalProcessReallyExit;
|
||||
this.#emitter.count -= 1;
|
||||
}
|
||||
#processReallyExit(code) {
|
||||
/* c8 ignore start */
|
||||
if (!processOk(this.#process)) {
|
||||
return 0;
|
||||
}
|
||||
this.#process.exitCode = code || 0;
|
||||
/* c8 ignore stop */
|
||||
this.#emitter.emit('exit', this.#process.exitCode, null);
|
||||
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
||||
}
|
||||
#processEmit(ev, ...args) {
|
||||
const og = this.#originalProcessEmit;
|
||||
if (ev === 'exit' && processOk(this.#process)) {
|
||||
if (typeof args[0] === 'number') {
|
||||
this.#process.exitCode = args[0];
|
||||
/* c8 ignore start */
|
||||
}
|
||||
/* c8 ignore start */
|
||||
const ret = og.call(this.#process, ev, ...args);
|
||||
/* c8 ignore start */
|
||||
this.#emitter.emit('exit', this.#process.exitCode, null);
|
||||
/* c8 ignore stop */
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
return og.call(this.#process, ev, ...args);
|
||||
}
|
||||
}
|
||||
}
|
||||
const process = globalThis.process;
|
||||
// wrap so that we call the method on the actual handler, without
|
||||
// exporting it directly.
|
||||
_a = signalExitWrap(processOk(process) ? new SignalExit(process) : new SignalExitFallback()),
|
||||
/**
|
||||
* Called when the process is exiting, whether via signal, explicit
|
||||
* exit, or running out of stuff to do.
|
||||
*
|
||||
* If the global process object is not suitable for instrumentation,
|
||||
* then this will be a no-op.
|
||||
*
|
||||
* Returns a function that may be used to unload signal-exit.
|
||||
*/
|
||||
exports.onExit = _a.onExit,
|
||||
/**
|
||||
* Load the listeners. Likely you never need to call this, unless
|
||||
* doing a rather deep integration with signal-exit functionality.
|
||||
* Mostly exposed for the benefit of testing.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
exports.load = _a.load,
|
||||
/**
|
||||
* Unload the listeners. Likely you never need to call this, unless
|
||||
* doing a rather deep integration with signal-exit functionality.
|
||||
* Mostly exposed for the benefit of testing.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
exports.unload = _a.unload;
|
||||
//# sourceMappingURL=index.js.map
|
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/index.js.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/index.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
3
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/package.json
generated
vendored
Executable file
3
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/package.json
generated
vendored
Executable file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"type": "commonjs"
|
||||
}
|
29
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/signals.d.ts
generated
vendored
Executable file
29
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/signals.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,29 @@
|
|||
/// <reference types="node" />
|
||||
/**
|
||||
* This is not the set of all possible signals.
|
||||
*
|
||||
* It IS, however, the set of all signals that trigger
|
||||
* an exit on either Linux or BSD systems. Linux is a
|
||||
* superset of the signal names supported on BSD, and
|
||||
* the unknown signals just fail to register, so we can
|
||||
* catch that easily enough.
|
||||
*
|
||||
* Windows signals are a different set, since there are
|
||||
* signals that terminate Windows processes, but don't
|
||||
* terminate (or don't even exist) on Posix systems.
|
||||
*
|
||||
* Don't bother with SIGKILL. It's uncatchable, which
|
||||
* means that we can't fire any callbacks anyway.
|
||||
*
|
||||
* If a user does happen to register a handler on a non-
|
||||
* fatal signal like SIGWINCH or something, and then
|
||||
* exit, it'll end up firing `process.emit('exit')`, so
|
||||
* the handler will be fired anyway.
|
||||
*
|
||||
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
||||
* artificially, inherently leave the process in a
|
||||
* state from which it is not safe to try and enter JS
|
||||
* listeners.
|
||||
*/
|
||||
export declare const signals: NodeJS.Signals[];
|
||||
//# sourceMappingURL=signals.d.ts.map
|
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/signals.d.ts.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/signals.d.ts.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../src/signals.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,OAAO,EAAO,CAAA"}
|
42
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/signals.js
generated
vendored
Executable file
42
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/signals.js
generated
vendored
Executable file
|
@ -0,0 +1,42 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.signals = void 0;
|
||||
/**
|
||||
* This is not the set of all possible signals.
|
||||
*
|
||||
* It IS, however, the set of all signals that trigger
|
||||
* an exit on either Linux or BSD systems. Linux is a
|
||||
* superset of the signal names supported on BSD, and
|
||||
* the unknown signals just fail to register, so we can
|
||||
* catch that easily enough.
|
||||
*
|
||||
* Windows signals are a different set, since there are
|
||||
* signals that terminate Windows processes, but don't
|
||||
* terminate (or don't even exist) on Posix systems.
|
||||
*
|
||||
* Don't bother with SIGKILL. It's uncatchable, which
|
||||
* means that we can't fire any callbacks anyway.
|
||||
*
|
||||
* If a user does happen to register a handler on a non-
|
||||
* fatal signal like SIGWINCH or something, and then
|
||||
* exit, it'll end up firing `process.emit('exit')`, so
|
||||
* the handler will be fired anyway.
|
||||
*
|
||||
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
||||
* artificially, inherently leave the process in a
|
||||
* state from which it is not safe to try and enter JS
|
||||
* listeners.
|
||||
*/
|
||||
exports.signals = [];
|
||||
exports.signals.push('SIGHUP', 'SIGINT', 'SIGTERM');
|
||||
if (process.platform !== 'win32') {
|
||||
exports.signals.push('SIGALRM', 'SIGABRT', 'SIGVTALRM', 'SIGXCPU', 'SIGXFSZ', 'SIGUSR2', 'SIGTRAP', 'SIGSYS', 'SIGQUIT', 'SIGIOT'
|
||||
// should detect profiler and enable/disable accordingly.
|
||||
// see #21
|
||||
// 'SIGPROF'
|
||||
);
|
||||
}
|
||||
if (process.platform === 'linux') {
|
||||
exports.signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT');
|
||||
}
|
||||
//# sourceMappingURL=signals.js.map
|
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/signals.js.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/cjs/signals.js.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"signals.js","sourceRoot":"","sources":["../../src/signals.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACU,QAAA,OAAO,GAAqB,EAAE,CAAA;AAC3C,eAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAA;AAE3C,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;IAChC,eAAO,CAAC,IAAI,CACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,QAAQ,EACR,SAAS,EACT,QAAQ;IACR,yDAAyD;IACzD,UAAU;IACV,YAAY;KACb,CAAA;CACF;AAED,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;IAChC,eAAO,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAA;CACxD","sourcesContent":["/**\n * This is not the set of all possible signals.\n *\n * It IS, however, the set of all signals that trigger\n * an exit on either Linux or BSD systems. Linux is a\n * superset of the signal names supported on BSD, and\n * the unknown signals just fail to register, so we can\n * catch that easily enough.\n *\n * Windows signals are a different set, since there are\n * signals that terminate Windows processes, but don't\n * terminate (or don't even exist) on Posix systems.\n *\n * Don't bother with SIGKILL. It's uncatchable, which\n * means that we can't fire any callbacks anyway.\n *\n * If a user does happen to register a handler on a non-\n * fatal signal like SIGWINCH or something, and then\n * exit, it'll end up firing `process.emit('exit')`, so\n * the handler will be fired anyway.\n *\n * SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised\n * artificially, inherently leave the process in a\n * state from which it is not safe to try and enter JS\n * listeners.\n */\nexport const signals: NodeJS.Signals[] = []\nsignals.push('SIGHUP', 'SIGINT', 'SIGTERM')\n\nif (process.platform !== 'win32') {\n signals.push(\n 'SIGALRM',\n 'SIGABRT',\n 'SIGVTALRM',\n 'SIGXCPU',\n 'SIGXFSZ',\n 'SIGUSR2',\n 'SIGTRAP',\n 'SIGSYS',\n 'SIGQUIT',\n 'SIGIOT'\n // should detect profiler and enable/disable accordingly.\n // see #21\n // 'SIGPROF'\n )\n}\n\nif (process.platform === 'linux') {\n signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT')\n}\n"]}
|
12
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/browser.d.ts
generated
vendored
Executable file
12
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/browser.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* This is a browser shim that provides the same functional interface
|
||||
* as the main node export, but it does nothing.
|
||||
* @module
|
||||
*/
|
||||
import type { Handler } from './index.js';
|
||||
export declare const onExit: (cb: Handler, opts: {
|
||||
alwaysLast?: boolean;
|
||||
}) => () => void;
|
||||
export declare const load: () => void;
|
||||
export declare const unload: () => void;
|
||||
//# sourceMappingURL=browser.d.ts.map
|
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/browser.d.ts.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/browser.d.ts.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,eAAO,MAAM,MAAM,EAAE,CACnB,EAAE,EAAE,OAAO,EACX,IAAI,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,KAC3B,MAAM,IAAqB,CAAA;AAChC,eAAO,MAAM,IAAI,YAAW,CAAA;AAC5B,eAAO,MAAM,MAAM,YAAW,CAAA"}
|
4
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/browser.js
generated
vendored
Executable file
4
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/browser.js
generated
vendored
Executable file
|
@ -0,0 +1,4 @@
|
|||
export const onExit = () => () => { };
|
||||
export const load = () => { };
|
||||
export const unload = () => { };
|
||||
//# sourceMappingURL=browser.js.map
|
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/browser.js.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/browser.js.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,MAAM,GAGD,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC,CAAA;AAChC,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA;AAC5B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA","sourcesContent":["/**\n * This is a browser shim that provides the same functional interface\n * as the main node export, but it does nothing.\n * @module\n */\nimport type { Handler } from './index.js'\nexport const onExit: (\n cb: Handler,\n opts: { alwaysLast?: boolean }\n) => () => void = () => () => {}\nexport const load = () => {}\nexport const unload = () => {}\n"]}
|
48
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/index.d.ts
generated
vendored
Executable file
48
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,48 @@
|
|||
/// <reference types="node" />
|
||||
import { signals } from './signals.js';
|
||||
export { signals };
|
||||
/**
|
||||
* A function that takes an exit code and signal as arguments
|
||||
*
|
||||
* In the case of signal exits *only*, a return value of true
|
||||
* will indicate that the signal is being handled, and we should
|
||||
* not synthetically exit with the signal we received. Regardless
|
||||
* of the handler return value, the handler is unloaded when an
|
||||
* otherwise fatal signal is received, so you get exactly 1 shot
|
||||
* at it, unless you add another onExit handler at that point.
|
||||
*
|
||||
* In the case of numeric code exits, we may already have committed
|
||||
* to exiting the process, for example via a fatal exception or
|
||||
* unhandled promise rejection, so it is impossible to stop safely.
|
||||
*/
|
||||
export type Handler = (code: number | null | undefined, signal: NodeJS.Signals | null) => true | void;
|
||||
export declare const
|
||||
/**
|
||||
* Called when the process is exiting, whether via signal, explicit
|
||||
* exit, or running out of stuff to do.
|
||||
*
|
||||
* If the global process object is not suitable for instrumentation,
|
||||
* then this will be a no-op.
|
||||
*
|
||||
* Returns a function that may be used to unload signal-exit.
|
||||
*/
|
||||
onExit: (cb: Handler, opts?: {
|
||||
alwaysLast?: boolean | undefined;
|
||||
} | undefined) => () => void,
|
||||
/**
|
||||
* Load the listeners. Likely you never need to call this, unless
|
||||
* doing a rather deep integration with signal-exit functionality.
|
||||
* Mostly exposed for the benefit of testing.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
load: () => void,
|
||||
/**
|
||||
* Unload the listeners. Likely you never need to call this, unless
|
||||
* doing a rather deep integration with signal-exit functionality.
|
||||
* Mostly exposed for the benefit of testing.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
unload: () => void;
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/index.d.ts.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/index.d.ts.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,CAAA;AAuBlB;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,OAAO,GAAG,CACpB,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC/B,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,KAC1B,IAAI,GAAG,IAAI,CAAA;AA8QhB,eAAO;AACL;;;;;;;;GAQG;AACH,MAAM,OAzMO,OAAO;;wBAPiD,IAAI;AAkNzE;;;;;;GAMG;AACH,IAAI;AAEJ;;;;;;GAMG;AACH,MAAM,YAGP,CAAA"}
|
275
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/index.js
generated
vendored
Executable file
275
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/index.js
generated
vendored
Executable file
|
@ -0,0 +1,275 @@
|
|||
// Note: since nyc uses this module to output coverage, any lines
|
||||
// that are in the direct sync flow of nyc's outputCoverage are
|
||||
// ignored, since we can never get coverage for them.
|
||||
// grab a reference to node's real process object right away
|
||||
import { signals } from './signals.js';
|
||||
export { signals };
|
||||
const processOk = (process) => !!process &&
|
||||
typeof process === 'object' &&
|
||||
typeof process.removeListener === 'function' &&
|
||||
typeof process.emit === 'function' &&
|
||||
typeof process.reallyExit === 'function' &&
|
||||
typeof process.listeners === 'function' &&
|
||||
typeof process.kill === 'function' &&
|
||||
typeof process.pid === 'number' &&
|
||||
typeof process.on === 'function';
|
||||
const kExitEmitter = Symbol.for('signal-exit emitter');
|
||||
const global = globalThis;
|
||||
const ObjectDefineProperty = Object.defineProperty.bind(Object);
|
||||
// teeny special purpose ee
|
||||
class Emitter {
|
||||
emitted = {
|
||||
afterExit: false,
|
||||
exit: false,
|
||||
};
|
||||
listeners = {
|
||||
afterExit: [],
|
||||
exit: [],
|
||||
};
|
||||
count = 0;
|
||||
id = Math.random();
|
||||
constructor() {
|
||||
if (global[kExitEmitter]) {
|
||||
return global[kExitEmitter];
|
||||
}
|
||||
ObjectDefineProperty(global, kExitEmitter, {
|
||||
value: this,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false,
|
||||
});
|
||||
}
|
||||
on(ev, fn) {
|
||||
this.listeners[ev].push(fn);
|
||||
}
|
||||
removeListener(ev, fn) {
|
||||
const list = this.listeners[ev];
|
||||
const i = list.indexOf(fn);
|
||||
/* c8 ignore start */
|
||||
if (i === -1) {
|
||||
return;
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
if (i === 0 && list.length === 1) {
|
||||
list.length = 0;
|
||||
}
|
||||
else {
|
||||
list.splice(i, 1);
|
||||
}
|
||||
}
|
||||
emit(ev, code, signal) {
|
||||
if (this.emitted[ev]) {
|
||||
return false;
|
||||
}
|
||||
this.emitted[ev] = true;
|
||||
let ret = false;
|
||||
for (const fn of this.listeners[ev]) {
|
||||
ret = fn(code, signal) === true || ret;
|
||||
}
|
||||
if (ev === 'exit') {
|
||||
ret = this.emit('afterExit', code, signal) || ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
class SignalExitBase {
|
||||
}
|
||||
const signalExitWrap = (handler) => {
|
||||
return {
|
||||
onExit(cb, opts) {
|
||||
return handler.onExit(cb, opts);
|
||||
},
|
||||
load() {
|
||||
return handler.load();
|
||||
},
|
||||
unload() {
|
||||
return handler.unload();
|
||||
},
|
||||
};
|
||||
};
|
||||
class SignalExitFallback extends SignalExitBase {
|
||||
onExit() {
|
||||
return () => { };
|
||||
}
|
||||
load() { }
|
||||
unload() { }
|
||||
}
|
||||
class SignalExit extends SignalExitBase {
|
||||
// "SIGHUP" throws an `ENOSYS` error on Windows,
|
||||
// so use a supported signal instead
|
||||
/* c8 ignore start */
|
||||
#hupSig = process.platform === 'win32' ? 'SIGINT' : 'SIGHUP';
|
||||
/* c8 ignore stop */
|
||||
#emitter = new Emitter();
|
||||
#process;
|
||||
#originalProcessEmit;
|
||||
#originalProcessReallyExit;
|
||||
#sigListeners = {};
|
||||
#loaded = false;
|
||||
constructor(process) {
|
||||
super();
|
||||
this.#process = process;
|
||||
// { <signal>: <listener fn>, ... }
|
||||
this.#sigListeners = {};
|
||||
for (const sig of signals) {
|
||||
this.#sigListeners[sig] = () => {
|
||||
// If there are no other listeners, an exit is coming!
|
||||
// Simplest way: remove us and then re-send the signal.
|
||||
// We know that this will kill the process, so we can
|
||||
// safely emit now.
|
||||
const listeners = this.#process.listeners(sig);
|
||||
let { count } = this.#emitter;
|
||||
// This is a workaround for the fact that signal-exit v3 and signal
|
||||
// exit v4 are not aware of each other, and each will attempt to let
|
||||
// the other handle it, so neither of them do. To correct this, we
|
||||
// detect if we're the only handler *except* for previous versions
|
||||
// of signal-exit, and increment by the count of listeners it has
|
||||
// created.
|
||||
/* c8 ignore start */
|
||||
const p = process;
|
||||
if (typeof p.__signal_exit_emitter__ === 'object' &&
|
||||
typeof p.__signal_exit_emitter__.count === 'number') {
|
||||
count += p.__signal_exit_emitter__.count;
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
if (listeners.length === count) {
|
||||
this.unload();
|
||||
const ret = this.#emitter.emit('exit', null, sig);
|
||||
/* c8 ignore start */
|
||||
const s = sig === 'SIGHUP' ? this.#hupSig : sig;
|
||||
if (!ret)
|
||||
process.kill(process.pid, s);
|
||||
/* c8 ignore stop */
|
||||
}
|
||||
};
|
||||
}
|
||||
this.#originalProcessReallyExit = process.reallyExit;
|
||||
this.#originalProcessEmit = process.emit;
|
||||
}
|
||||
onExit(cb, opts) {
|
||||
/* c8 ignore start */
|
||||
if (!processOk(this.#process)) {
|
||||
return () => { };
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
if (this.#loaded === false) {
|
||||
this.load();
|
||||
}
|
||||
const ev = opts?.alwaysLast ? 'afterExit' : 'exit';
|
||||
this.#emitter.on(ev, cb);
|
||||
return () => {
|
||||
this.#emitter.removeListener(ev, cb);
|
||||
if (this.#emitter.listeners['exit'].length === 0 &&
|
||||
this.#emitter.listeners['afterExit'].length === 0) {
|
||||
this.unload();
|
||||
}
|
||||
};
|
||||
}
|
||||
load() {
|
||||
if (this.#loaded) {
|
||||
return;
|
||||
}
|
||||
this.#loaded = true;
|
||||
// This is the number of onSignalExit's that are in play.
|
||||
// It's important so that we can count the correct number of
|
||||
// listeners on signals, and don't wait for the other one to
|
||||
// handle it instead of us.
|
||||
this.#emitter.count += 1;
|
||||
for (const sig of signals) {
|
||||
try {
|
||||
const fn = this.#sigListeners[sig];
|
||||
if (fn)
|
||||
this.#process.on(sig, fn);
|
||||
}
|
||||
catch (_) { }
|
||||
}
|
||||
this.#process.emit = (ev, ...a) => {
|
||||
return this.#processEmit(ev, ...a);
|
||||
};
|
||||
this.#process.reallyExit = (code) => {
|
||||
return this.#processReallyExit(code);
|
||||
};
|
||||
}
|
||||
unload() {
|
||||
if (!this.#loaded) {
|
||||
return;
|
||||
}
|
||||
this.#loaded = false;
|
||||
signals.forEach(sig => {
|
||||
const listener = this.#sigListeners[sig];
|
||||
/* c8 ignore start */
|
||||
if (!listener) {
|
||||
throw new Error('Listener not defined for signal: ' + sig);
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
try {
|
||||
this.#process.removeListener(sig, listener);
|
||||
/* c8 ignore start */
|
||||
}
|
||||
catch (_) { }
|
||||
/* c8 ignore stop */
|
||||
});
|
||||
this.#process.emit = this.#originalProcessEmit;
|
||||
this.#process.reallyExit = this.#originalProcessReallyExit;
|
||||
this.#emitter.count -= 1;
|
||||
}
|
||||
#processReallyExit(code) {
|
||||
/* c8 ignore start */
|
||||
if (!processOk(this.#process)) {
|
||||
return 0;
|
||||
}
|
||||
this.#process.exitCode = code || 0;
|
||||
/* c8 ignore stop */
|
||||
this.#emitter.emit('exit', this.#process.exitCode, null);
|
||||
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
||||
}
|
||||
#processEmit(ev, ...args) {
|
||||
const og = this.#originalProcessEmit;
|
||||
if (ev === 'exit' && processOk(this.#process)) {
|
||||
if (typeof args[0] === 'number') {
|
||||
this.#process.exitCode = args[0];
|
||||
/* c8 ignore start */
|
||||
}
|
||||
/* c8 ignore start */
|
||||
const ret = og.call(this.#process, ev, ...args);
|
||||
/* c8 ignore start */
|
||||
this.#emitter.emit('exit', this.#process.exitCode, null);
|
||||
/* c8 ignore stop */
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
return og.call(this.#process, ev, ...args);
|
||||
}
|
||||
}
|
||||
}
|
||||
const process = globalThis.process;
|
||||
// wrap so that we call the method on the actual handler, without
|
||||
// exporting it directly.
|
||||
export const {
|
||||
/**
|
||||
* Called when the process is exiting, whether via signal, explicit
|
||||
* exit, or running out of stuff to do.
|
||||
*
|
||||
* If the global process object is not suitable for instrumentation,
|
||||
* then this will be a no-op.
|
||||
*
|
||||
* Returns a function that may be used to unload signal-exit.
|
||||
*/
|
||||
onExit,
|
||||
/**
|
||||
* Load the listeners. Likely you never need to call this, unless
|
||||
* doing a rather deep integration with signal-exit functionality.
|
||||
* Mostly exposed for the benefit of testing.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
load,
|
||||
/**
|
||||
* Unload the listeners. Likely you never need to call this, unless
|
||||
* doing a rather deep integration with signal-exit functionality.
|
||||
* Mostly exposed for the benefit of testing.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
unload, } = signalExitWrap(processOk(process) ? new SignalExit(process) : new SignalExitFallback());
|
||||
//# sourceMappingURL=index.js.map
|
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/index.js.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/index.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
3
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/package.json
generated
vendored
Executable file
3
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/package.json
generated
vendored
Executable file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"type": "module"
|
||||
}
|
29
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/signals.d.ts
generated
vendored
Executable file
29
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/signals.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,29 @@
|
|||
/// <reference types="node" />
|
||||
/**
|
||||
* This is not the set of all possible signals.
|
||||
*
|
||||
* It IS, however, the set of all signals that trigger
|
||||
* an exit on either Linux or BSD systems. Linux is a
|
||||
* superset of the signal names supported on BSD, and
|
||||
* the unknown signals just fail to register, so we can
|
||||
* catch that easily enough.
|
||||
*
|
||||
* Windows signals are a different set, since there are
|
||||
* signals that terminate Windows processes, but don't
|
||||
* terminate (or don't even exist) on Posix systems.
|
||||
*
|
||||
* Don't bother with SIGKILL. It's uncatchable, which
|
||||
* means that we can't fire any callbacks anyway.
|
||||
*
|
||||
* If a user does happen to register a handler on a non-
|
||||
* fatal signal like SIGWINCH or something, and then
|
||||
* exit, it'll end up firing `process.emit('exit')`, so
|
||||
* the handler will be fired anyway.
|
||||
*
|
||||
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
||||
* artificially, inherently leave the process in a
|
||||
* state from which it is not safe to try and enter JS
|
||||
* listeners.
|
||||
*/
|
||||
export declare const signals: NodeJS.Signals[];
|
||||
//# sourceMappingURL=signals.d.ts.map
|
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/signals.d.ts.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/signals.d.ts.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../src/signals.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,OAAO,EAAO,CAAA"}
|
39
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/signals.js
generated
vendored
Executable file
39
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/signals.js
generated
vendored
Executable file
|
@ -0,0 +1,39 @@
|
|||
/**
|
||||
* This is not the set of all possible signals.
|
||||
*
|
||||
* It IS, however, the set of all signals that trigger
|
||||
* an exit on either Linux or BSD systems. Linux is a
|
||||
* superset of the signal names supported on BSD, and
|
||||
* the unknown signals just fail to register, so we can
|
||||
* catch that easily enough.
|
||||
*
|
||||
* Windows signals are a different set, since there are
|
||||
* signals that terminate Windows processes, but don't
|
||||
* terminate (or don't even exist) on Posix systems.
|
||||
*
|
||||
* Don't bother with SIGKILL. It's uncatchable, which
|
||||
* means that we can't fire any callbacks anyway.
|
||||
*
|
||||
* If a user does happen to register a handler on a non-
|
||||
* fatal signal like SIGWINCH or something, and then
|
||||
* exit, it'll end up firing `process.emit('exit')`, so
|
||||
* the handler will be fired anyway.
|
||||
*
|
||||
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
||||
* artificially, inherently leave the process in a
|
||||
* state from which it is not safe to try and enter JS
|
||||
* listeners.
|
||||
*/
|
||||
export const signals = [];
|
||||
signals.push('SIGHUP', 'SIGINT', 'SIGTERM');
|
||||
if (process.platform !== 'win32') {
|
||||
signals.push('SIGALRM', 'SIGABRT', 'SIGVTALRM', 'SIGXCPU', 'SIGXFSZ', 'SIGUSR2', 'SIGTRAP', 'SIGSYS', 'SIGQUIT', 'SIGIOT'
|
||||
// should detect profiler and enable/disable accordingly.
|
||||
// see #21
|
||||
// 'SIGPROF'
|
||||
);
|
||||
}
|
||||
if (process.platform === 'linux') {
|
||||
signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT');
|
||||
}
|
||||
//# sourceMappingURL=signals.js.map
|
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/signals.js.map
generated
vendored
Executable file
1
my-app/node_modules/foreground-child/node_modules/signal-exit/dist/mjs/signals.js.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"signals.js","sourceRoot":"","sources":["../../src/signals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,OAAO,GAAqB,EAAE,CAAA;AAC3C,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAA;AAE3C,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;IAChC,OAAO,CAAC,IAAI,CACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,QAAQ,EACR,SAAS,EACT,QAAQ;IACR,yDAAyD;IACzD,UAAU;IACV,YAAY;KACb,CAAA;CACF;AAED,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;IAChC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAA;CACxD","sourcesContent":["/**\n * This is not the set of all possible signals.\n *\n * It IS, however, the set of all signals that trigger\n * an exit on either Linux or BSD systems. Linux is a\n * superset of the signal names supported on BSD, and\n * the unknown signals just fail to register, so we can\n * catch that easily enough.\n *\n * Windows signals are a different set, since there are\n * signals that terminate Windows processes, but don't\n * terminate (or don't even exist) on Posix systems.\n *\n * Don't bother with SIGKILL. It's uncatchable, which\n * means that we can't fire any callbacks anyway.\n *\n * If a user does happen to register a handler on a non-\n * fatal signal like SIGWINCH or something, and then\n * exit, it'll end up firing `process.emit('exit')`, so\n * the handler will be fired anyway.\n *\n * SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised\n * artificially, inherently leave the process in a\n * state from which it is not safe to try and enter JS\n * listeners.\n */\nexport const signals: NodeJS.Signals[] = []\nsignals.push('SIGHUP', 'SIGINT', 'SIGTERM')\n\nif (process.platform !== 'win32') {\n signals.push(\n 'SIGALRM',\n 'SIGABRT',\n 'SIGVTALRM',\n 'SIGXCPU',\n 'SIGXFSZ',\n 'SIGUSR2',\n 'SIGTRAP',\n 'SIGSYS',\n 'SIGQUIT',\n 'SIGIOT'\n // should detect profiler and enable/disable accordingly.\n // see #21\n // 'SIGPROF'\n )\n}\n\nif (process.platform === 'linux') {\n signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT')\n}\n"]}
|
106
my-app/node_modules/foreground-child/node_modules/signal-exit/package.json
generated
vendored
Executable file
106
my-app/node_modules/foreground-child/node_modules/signal-exit/package.json
generated
vendored
Executable file
|
@ -0,0 +1,106 @@
|
|||
{
|
||||
"name": "signal-exit",
|
||||
"version": "4.1.0",
|
||||
"description": "when you want to fire an event no matter how a process exits.",
|
||||
"main": "./dist/cjs/index.js",
|
||||
"module": "./dist/mjs/index.js",
|
||||
"browser": "./dist/mjs/browser.js",
|
||||
"types": "./dist/mjs/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/mjs/index.d.ts",
|
||||
"default": "./dist/mjs/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/cjs/index.d.ts",
|
||||
"default": "./dist/cjs/index.js"
|
||||
}
|
||||
},
|
||||
"./signals": {
|
||||
"import": {
|
||||
"types": "./dist/mjs/signals.d.ts",
|
||||
"default": "./dist/mjs/signals.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/cjs/signals.d.ts",
|
||||
"default": "./dist/cjs/signals.js"
|
||||
}
|
||||
},
|
||||
"./browser": {
|
||||
"import": {
|
||||
"types": "./dist/mjs/browser.d.ts",
|
||||
"default": "./dist/mjs/browser.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/cjs/browser.d.ts",
|
||||
"default": "./dist/cjs/browser.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tapjs/signal-exit.git"
|
||||
},
|
||||
"keywords": [
|
||||
"signal",
|
||||
"exit"
|
||||
],
|
||||
"author": "Ben Coe <ben@npmjs.com>",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@types/cross-spawn": "^6.0.2",
|
||||
"@types/node": "^18.15.11",
|
||||
"@types/signal-exit": "^3.0.1",
|
||||
"@types/tap": "^15.0.8",
|
||||
"c8": "^7.13.0",
|
||||
"prettier": "^2.8.6",
|
||||
"tap": "^16.3.4",
|
||||
"ts-node": "^10.9.1",
|
||||
"typedoc": "^0.23.28",
|
||||
"typescript": "^5.0.2"
|
||||
},
|
||||
"scripts": {
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"prepublishOnly": "git push origin --follow-tags",
|
||||
"preprepare": "rm -rf dist",
|
||||
"prepare": "tsc -p tsconfig.json && tsc -p tsconfig-esm.json && bash ./scripts/fixup.sh",
|
||||
"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"
|
||||
},
|
||||
"prettier": {
|
||||
"semi": false,
|
||||
"printWidth": 75,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"jsxSingleQuote": false,
|
||||
"bracketSameLine": true,
|
||||
"arrowParens": "avoid",
|
||||
"endOfLine": "lf"
|
||||
},
|
||||
"tap": {
|
||||
"coverage": false,
|
||||
"jobs": 1,
|
||||
"node-arg": [
|
||||
"--no-warnings",
|
||||
"--loader",
|
||||
"ts-node/esm"
|
||||
],
|
||||
"ts": false
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
}
|
83
my-app/node_modules/foreground-child/package.json
generated
vendored
Executable file
83
my-app/node_modules/foreground-child/package.json
generated
vendored
Executable file
|
@ -0,0 +1,83 @@
|
|||
{
|
||||
"name": "foreground-child",
|
||||
"version": "3.1.1",
|
||||
"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",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/mjs/index.d.ts",
|
||||
"default": "./dist/mjs/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/cjs/index.d.ts",
|
||||
"default": "./dist/cjs/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"dependencies": {
|
||||
"cross-spawn": "^7.0.0",
|
||||
"signal-exit": "^4.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"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",
|
||||
"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"
|
||||
},
|
||||
"prettier": {
|
||||
"semi": false,
|
||||
"printWidth": 75,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"jsxSingleQuote": false,
|
||||
"bracketSameLine": true,
|
||||
"arrowParens": "avoid",
|
||||
"endOfLine": "lf"
|
||||
},
|
||||
"tap": {
|
||||
"coverage": false,
|
||||
"jobs": 1,
|
||||
"node-arg": [
|
||||
"--no-warnings",
|
||||
"--loader",
|
||||
"ts-node/esm"
|
||||
],
|
||||
"ts": false
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/tapjs/foreground-child.git"
|
||||
},
|
||||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@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",
|
||||
"typedoc": "^0.24.2",
|
||||
"typescript": "^5.0.2"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue