@alchemy.run/node-utils 0.0.4 → 2.0.0-beta.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +5 -0
- package/THIRD_PARTY_LICENSES.md +138 -0
- package/lib/ignore.d.ts +52 -2
- package/lib/ignore.d.ts.map +1 -1
- package/lib/ignore.js +50 -61
- package/lib/ignore.js.map +1 -1
- package/package.json +33 -31
- package/src/ignore.ts +157 -105
- package/lib/adapter.d.ts +0 -14
- package/lib/adapter.d.ts.map +0 -1
- package/lib/adapter.js +0 -65
- package/lib/adapter.js.map +0 -1
- package/lib/exit-hook.d.ts +0 -22
- package/lib/exit-hook.d.ts.map +0 -1
- package/lib/exit-hook.js +0 -86
- package/lib/exit-hook.js.map +0 -1
- package/lib/foreground-child.d.ts +0 -57
- package/lib/foreground-child.d.ts.map +0 -1
- package/lib/foreground-child.js +0 -201
- package/lib/foreground-child.js.map +0 -1
- package/lib/index.d.ts +0 -6
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -6
- package/lib/index.js.map +0 -1
- package/lib/lockfile-async.d.ts +0 -9
- package/lib/lockfile-async.d.ts.map +0 -1
- package/lib/lockfile-async.js +0 -23
- package/lib/lockfile-async.js.map +0 -1
- package/lib/lockfile.d.ts +0 -53
- package/lib/lockfile.d.ts.map +0 -1
- package/lib/lockfile.js +0 -287
- package/lib/lockfile.js.map +0 -1
- package/lib/mtime-precision.d.ts +0 -11
- package/lib/mtime-precision.d.ts.map +0 -1
- package/lib/mtime-precision.js +0 -40
- package/lib/mtime-precision.js.map +0 -1
- package/lib/retry.d.ts +0 -56
- package/lib/retry.d.ts.map +0 -1
- package/lib/retry.js +0 -203
- package/lib/retry.js.map +0 -1
- package/src/adapter.ts +0 -94
- package/src/exit-hook.ts +0 -96
- package/src/foreground-child.ts +0 -243
- package/src/index.ts +0 -5
- package/src/lockfile-async.ts +0 -44
- package/src/lockfile.ts +0 -502
- package/src/mtime-precision.ts +0 -83
- package/src/retry.ts +0 -309
package/lib/exit-hook.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lightweight replacement for the `exit-hook` npm package.
|
|
3
|
-
*
|
|
4
|
-
* The third-party `exit-hook` registers process listeners (`exit`, `SIGINT`,
|
|
5
|
-
* `SIGTERM`, and `message`) that are never removed — even after every
|
|
6
|
-
* callback has been unregistered. Those dangling listeners are harmless in
|
|
7
|
-
* long-running processes, but in short-lived child processes (e.g. those
|
|
8
|
-
* spawned by `node --test`) they can prevent clean exit by holding refs on
|
|
9
|
-
* handles such as the IPC channel.
|
|
10
|
-
*
|
|
11
|
-
* This module tracks the number of active registrations and removes **all**
|
|
12
|
-
* process listeners once the last registration is unregistered, so they
|
|
13
|
-
* cannot keep the event loop alive after dispose.
|
|
14
|
-
*/
|
|
15
|
-
const callbacks = new Set();
|
|
16
|
-
let registered = false;
|
|
17
|
-
let called = false;
|
|
18
|
-
function runCallbacks() {
|
|
19
|
-
if (called) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
called = true;
|
|
23
|
-
for (const callback of callbacks) {
|
|
24
|
-
callback();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function onExit() {
|
|
28
|
-
runCallbacks();
|
|
29
|
-
}
|
|
30
|
-
function onSignalInt() {
|
|
31
|
-
runCallbacks();
|
|
32
|
-
// eslint-disable-next-line unicorn/no-process-exit -- intentional: replicate default SIGINT behavior
|
|
33
|
-
process.exit(128 + 2);
|
|
34
|
-
}
|
|
35
|
-
function onSignalTerm() {
|
|
36
|
-
runCallbacks();
|
|
37
|
-
// eslint-disable-next-line unicorn/no-process-exit -- intentional: replicate default SIGTERM behavior
|
|
38
|
-
process.exit(128 + 15);
|
|
39
|
-
}
|
|
40
|
-
function onMessage(message) {
|
|
41
|
-
if (message === "shutdown") {
|
|
42
|
-
runCallbacks();
|
|
43
|
-
// eslint-disable-next-line unicorn/no-process-exit -- intentional: PM2 graceful shutdown
|
|
44
|
-
process.exit(0);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function addListeners() {
|
|
48
|
-
registered = true;
|
|
49
|
-
called = false;
|
|
50
|
-
process.on("exit", onExit);
|
|
51
|
-
process.on("SIGINT", onSignalInt);
|
|
52
|
-
process.on("SIGTERM", onSignalTerm);
|
|
53
|
-
// Only listen for IPC "shutdown" messages (PM2 support) when the process
|
|
54
|
-
// actually has an IPC channel. Even without this guard the listener is
|
|
55
|
-
// harmless when there is no channel, but being explicit avoids any
|
|
56
|
-
// accidental ref of a future channel.
|
|
57
|
-
if (process.send !== undefined) {
|
|
58
|
-
process.on("message", onMessage);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function removeListeners() {
|
|
62
|
-
registered = false;
|
|
63
|
-
process.removeListener("exit", onExit);
|
|
64
|
-
process.removeListener("SIGINT", onSignalInt);
|
|
65
|
-
process.removeListener("SIGTERM", onSignalTerm);
|
|
66
|
-
process.removeListener("message", onMessage);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Register a callback to run when the process exits. Returns a function
|
|
70
|
-
* that unregisters the callback. When the last callback is unregistered,
|
|
71
|
-
* all underlying process listeners are removed so they cannot keep the
|
|
72
|
-
* event loop alive.
|
|
73
|
-
*/
|
|
74
|
-
export function exitHook(callback) {
|
|
75
|
-
callbacks.add(callback);
|
|
76
|
-
if (!registered) {
|
|
77
|
-
addListeners();
|
|
78
|
-
}
|
|
79
|
-
return () => {
|
|
80
|
-
callbacks.delete(callback);
|
|
81
|
-
if (callbacks.size === 0 && registered) {
|
|
82
|
-
removeListeners();
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=exit-hook.js.map
|
package/lib/exit-hook.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exit-hook.js","sourceRoot":"","sources":["../src/exit-hook.ts"],"names":[],"m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C,SAAS,EAAE,SAAS,CAAC,CAAC;IACnC,CAAC;AACH,CAAC;AAED,SAAS,eAAe;IACtB,UAAU,GAAG,KAAK,CAAC;IACnB,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAC9C,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IAChD,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,QAAoB;IAC3C,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAExB,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,YAAY,EAAE,CAAC;IACjB,CAAC;IAED,OAAO,GAAG,EAAE;QACV,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC3B,IAAI,SAAS,CAAC,IAAI,KAAK,CAAC,IAAI,UAAU,EAAE,CAAC;YACvC,eAAe,EAAE,CAAC;QACpB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Run a child process in the foreground: proxy signals to it, forward stdio,
|
|
3
|
-
* bridge IPC, and exit with the child's code/signal. A watchdog process
|
|
4
|
-
* ensures the child is killed if the parent dies unexpectedly.
|
|
5
|
-
*
|
|
6
|
-
* Adapted from `foreground-child@4.0.3` (© Isaac Z. Schlueter et al.):
|
|
7
|
-
* https://github.com/tapjs/foreground-child
|
|
8
|
-
* Licensed under the Blue Oak Model License 1.0.0:
|
|
9
|
-
* https://blueoakcouncil.org/license/1.0.0
|
|
10
|
-
*
|
|
11
|
-
* The behavioral additions on top of upstream are:
|
|
12
|
-
* 1. Optional `stderrFilter` — upstream hardcodes `stdio = [0, 1, 2]`,
|
|
13
|
-
* which makes intercepting child stderr impossible without forking.
|
|
14
|
-
* When `stderrFilter` is provided, the child's stderr is piped,
|
|
15
|
-
* line-buffered, and each line is passed through the filter
|
|
16
|
-
* (return `false` to drop, `true` to forward).
|
|
17
|
-
* 2. Uses the in-tree {@link exitHook} instead of `signal-exit`, so this
|
|
18
|
-
* package has no external runtime dependencies.
|
|
19
|
-
*
|
|
20
|
-
* Everything else — signal proxying, the watchdog, IPC bridging, exit-code
|
|
21
|
-
* forwarding — is preserved verbatim from upstream.
|
|
22
|
-
*/
|
|
23
|
-
import { type ChildProcess } from "node:child_process";
|
|
24
|
-
type SyncCleanupResult = void | undefined | null | boolean | number | string | NodeJS.Signals;
|
|
25
|
-
export type CleanupResult = SyncCleanupResult | Promise<SyncCleanupResult>;
|
|
26
|
-
export interface ForegroundChildOptions {
|
|
27
|
-
/**
|
|
28
|
-
* Line-level filter for the child's stderr. Return `true` to forward the
|
|
29
|
-
* line to the parent's stderr, `false` to drop it. When omitted, the
|
|
30
|
-
* child's stderr is inherited directly (no buffering, no filtering).
|
|
31
|
-
*/
|
|
32
|
-
stderrFilter?: (line: string) => boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Called when the child closes. May return:
|
|
35
|
-
* - `false` — suppress propagation of the child's exit
|
|
36
|
-
* - `number` — override the parent's exit code
|
|
37
|
-
* - `string` (a signal name) — kill the parent with that signal
|
|
38
|
-
* - `void` / `undefined` — propagate the child's code/signal verbatim
|
|
39
|
-
* Async (Promise-returning) cleanup is supported.
|
|
40
|
-
*/
|
|
41
|
-
cleanup?: (code: number | null, signal: NodeJS.Signals | null, extra: {
|
|
42
|
-
watchdogPid: number | undefined;
|
|
43
|
-
}) => CleanupResult;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Run `program` with `args` as a foreground child of the current process.
|
|
47
|
-
*
|
|
48
|
-
* Signals received by the parent are proxied to the child, the child's stdio
|
|
49
|
-
* is connected to the parent's (with optional stderr filtering via
|
|
50
|
-
* {@link ForegroundChildOptions.stderrFilter}), IPC messages are bridged in
|
|
51
|
-
* both directions, and the parent exits with the child's exit code or
|
|
52
|
-
* signal. A watchdog subprocess ensures the child is force-killed if the
|
|
53
|
-
* parent dies unexpectedly.
|
|
54
|
-
*/
|
|
55
|
-
export declare function foregroundChild(program: string, args: ReadonlyArray<string>, opts?: ForegroundChildOptions): ChildProcess;
|
|
56
|
-
export {};
|
|
57
|
-
//# sourceMappingURL=foreground-child.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"foreground-child.d.ts","sourceRoot":"","sources":["../src/foreground-child.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,oBAAoB,CAAC;AAgF9D,KAAK,iBAAiB,GAClB,IAAI,GACJ,SAAS,GACT,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,MAAM,CAAC,OAAO,CAAC;AAEnB,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE3E,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACzC;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,CACR,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,EAC7B,KAAK,EAAE;QAAE,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,KACvC,aAAa,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,EAC3B,IAAI,GAAE,sBAA2B,GAChC,YAAY,CA6Fd"}
|
package/lib/foreground-child.js
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Run a child process in the foreground: proxy signals to it, forward stdio,
|
|
3
|
-
* bridge IPC, and exit with the child's code/signal. A watchdog process
|
|
4
|
-
* ensures the child is killed if the parent dies unexpectedly.
|
|
5
|
-
*
|
|
6
|
-
* Adapted from `foreground-child@4.0.3` (© Isaac Z. Schlueter et al.):
|
|
7
|
-
* https://github.com/tapjs/foreground-child
|
|
8
|
-
* Licensed under the Blue Oak Model License 1.0.0:
|
|
9
|
-
* https://blueoakcouncil.org/license/1.0.0
|
|
10
|
-
*
|
|
11
|
-
* The behavioral additions on top of upstream are:
|
|
12
|
-
* 1. Optional `stderrFilter` — upstream hardcodes `stdio = [0, 1, 2]`,
|
|
13
|
-
* which makes intercepting child stderr impossible without forking.
|
|
14
|
-
* When `stderrFilter` is provided, the child's stderr is piped,
|
|
15
|
-
* line-buffered, and each line is passed through the filter
|
|
16
|
-
* (return `false` to drop, `true` to forward).
|
|
17
|
-
* 2. Uses the in-tree {@link exitHook} instead of `signal-exit`, so this
|
|
18
|
-
* package has no external runtime dependencies.
|
|
19
|
-
*
|
|
20
|
-
* Everything else — signal proxying, the watchdog, IPC bridging, exit-code
|
|
21
|
-
* forwarding — is preserved verbatim from upstream.
|
|
22
|
-
*/
|
|
23
|
-
import { spawn } from "node:child_process";
|
|
24
|
-
import constants from "node:constants";
|
|
25
|
-
import { exitHook } from "./exit-hook.js";
|
|
26
|
-
const allSignals = Object.keys(constants).filter((k) => k.startsWith("SIG") && k !== "SIGPROF" && k !== "SIGKILL");
|
|
27
|
-
function proxySignals(child) {
|
|
28
|
-
const listeners = new Map();
|
|
29
|
-
for (const sig of allSignals) {
|
|
30
|
-
const listener = () => {
|
|
31
|
-
try {
|
|
32
|
-
child.kill(sig);
|
|
33
|
-
}
|
|
34
|
-
catch (_) { }
|
|
35
|
-
};
|
|
36
|
-
try {
|
|
37
|
-
process.on(sig, listener);
|
|
38
|
-
listeners.set(sig, listener);
|
|
39
|
-
}
|
|
40
|
-
catch (_) { }
|
|
41
|
-
}
|
|
42
|
-
const unproxy = () => {
|
|
43
|
-
for (const [sig, listener] of listeners) {
|
|
44
|
-
process.removeListener(sig, listener);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
child.on("exit", unproxy);
|
|
48
|
-
return unproxy;
|
|
49
|
-
}
|
|
50
|
-
const watchdogCode = String.raw `
|
|
51
|
-
const pid = parseInt(process.argv[1], 10)
|
|
52
|
-
process.title = 'node (foreground-child watchdog pid=' + pid + ')'
|
|
53
|
-
if (!isNaN(pid)) {
|
|
54
|
-
let barked = false
|
|
55
|
-
const interval = setInterval(() => {}, 60000)
|
|
56
|
-
const bark = () => {
|
|
57
|
-
clearInterval(interval)
|
|
58
|
-
if (barked) return
|
|
59
|
-
barked = true
|
|
60
|
-
process.removeListener('SIGHUP', bark)
|
|
61
|
-
setTimeout(() => {
|
|
62
|
-
try {
|
|
63
|
-
process.kill(pid, 'SIGKILL')
|
|
64
|
-
setTimeout(() => process.exit(), 200)
|
|
65
|
-
} catch (_) {}
|
|
66
|
-
}, 500)
|
|
67
|
-
}
|
|
68
|
-
process.on('SIGHUP', bark)
|
|
69
|
-
}
|
|
70
|
-
`;
|
|
71
|
-
function watchdog(child) {
|
|
72
|
-
let dogExited = false;
|
|
73
|
-
const dog = spawn(process.execPath, ["-e", watchdogCode, String(child.pid)], {
|
|
74
|
-
stdio: ["ignore", "ignore", "pipe"],
|
|
75
|
-
});
|
|
76
|
-
dog.on("exit", () => {
|
|
77
|
-
dogExited = true;
|
|
78
|
-
});
|
|
79
|
-
dog.stderr?.pipe(process.stderr, { end: false });
|
|
80
|
-
child.on("exit", () => {
|
|
81
|
-
if (!dogExited)
|
|
82
|
-
dog.kill("SIGKILL");
|
|
83
|
-
});
|
|
84
|
-
process.on("exit", () => {
|
|
85
|
-
if (!dogExited)
|
|
86
|
-
dog.kill("SIGKILL");
|
|
87
|
-
});
|
|
88
|
-
return dog;
|
|
89
|
-
}
|
|
90
|
-
function isPromise(o) {
|
|
91
|
-
return (!!o &&
|
|
92
|
-
typeof o === "object" &&
|
|
93
|
-
typeof o.then === "function");
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Run `program` with `args` as a foreground child of the current process.
|
|
97
|
-
*
|
|
98
|
-
* Signals received by the parent are proxied to the child, the child's stdio
|
|
99
|
-
* is connected to the parent's (with optional stderr filtering via
|
|
100
|
-
* {@link ForegroundChildOptions.stderrFilter}), IPC messages are bridged in
|
|
101
|
-
* both directions, and the parent exits with the child's exit code or
|
|
102
|
-
* signal. A watchdog subprocess ensures the child is force-killed if the
|
|
103
|
-
* parent dies unexpectedly.
|
|
104
|
-
*/
|
|
105
|
-
export function foregroundChild(program, args, opts = {}) {
|
|
106
|
-
const { stderrFilter, cleanup = () => { } } = opts;
|
|
107
|
-
const stdio = stderrFilter
|
|
108
|
-
? [0, 1, "pipe"]
|
|
109
|
-
: [0, 1, 2];
|
|
110
|
-
if (process.send)
|
|
111
|
-
stdio.push("ipc");
|
|
112
|
-
const child = spawn(program, args, { stdio });
|
|
113
|
-
if (stderrFilter && child.stderr) {
|
|
114
|
-
let buf = "";
|
|
115
|
-
child.stderr.on("data", (chunk) => {
|
|
116
|
-
buf += chunk.toString();
|
|
117
|
-
let nl;
|
|
118
|
-
while ((nl = buf.search(/\r?\n/)) !== -1) {
|
|
119
|
-
const eol = buf.startsWith("\r\n", nl) ? 2 : 1;
|
|
120
|
-
const line = buf.slice(0, nl + eol);
|
|
121
|
-
buf = buf.slice(nl + eol);
|
|
122
|
-
if (stderrFilter(line))
|
|
123
|
-
process.stderr.write(line);
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
child.stderr.on("end", () => {
|
|
127
|
-
if (buf && stderrFilter(buf))
|
|
128
|
-
process.stderr.write(buf);
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
const childHangup = () => {
|
|
132
|
-
try {
|
|
133
|
-
child.kill("SIGHUP");
|
|
134
|
-
}
|
|
135
|
-
catch (_) {
|
|
136
|
-
child.kill("SIGTERM");
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
const removeOnExit = exitHook(childHangup);
|
|
140
|
-
proxySignals(child);
|
|
141
|
-
const dog = watchdog(child);
|
|
142
|
-
let done = false;
|
|
143
|
-
dog.on("close", (code, signal) => {
|
|
144
|
-
if (done)
|
|
145
|
-
return;
|
|
146
|
-
child.kill("SIGKILL");
|
|
147
|
-
throw new Error("foreground-child watchdog process died unexpectedly!", {
|
|
148
|
-
cause: {
|
|
149
|
-
pid: dog.pid,
|
|
150
|
-
code,
|
|
151
|
-
signal,
|
|
152
|
-
watchedProcess: { cmd: program, args, pid: child.pid },
|
|
153
|
-
},
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
child.on("close", async (code, signal) => {
|
|
157
|
-
if (done)
|
|
158
|
-
return;
|
|
159
|
-
done = true;
|
|
160
|
-
const result = cleanup(code, signal, { watchdogPid: dog.pid });
|
|
161
|
-
const res = isPromise(result) ? await result : result;
|
|
162
|
-
removeOnExit();
|
|
163
|
-
if (res === false)
|
|
164
|
-
return;
|
|
165
|
-
let finalCode = code;
|
|
166
|
-
let finalSignal = signal;
|
|
167
|
-
if (typeof res === "string") {
|
|
168
|
-
finalSignal = res;
|
|
169
|
-
finalCode = null;
|
|
170
|
-
}
|
|
171
|
-
else if (typeof res === "number") {
|
|
172
|
-
finalCode = res;
|
|
173
|
-
finalSignal = null;
|
|
174
|
-
}
|
|
175
|
-
if (finalSignal) {
|
|
176
|
-
setTimeout(() => { }, 2000);
|
|
177
|
-
try {
|
|
178
|
-
process.kill(process.pid, finalSignal);
|
|
179
|
-
}
|
|
180
|
-
catch (_) {
|
|
181
|
-
process.kill(process.pid, "SIGTERM");
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
process.exit(finalCode ?? 0);
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
if (process.send) {
|
|
189
|
-
process.removeAllListeners("message");
|
|
190
|
-
child.on("message", (message, sendHandle) => {
|
|
191
|
-
process.send?.(message, sendHandle);
|
|
192
|
-
});
|
|
193
|
-
process.on("message", (message, sendHandle) => {
|
|
194
|
-
if (message === null)
|
|
195
|
-
return;
|
|
196
|
-
child.send(message, sendHandle);
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
return child;
|
|
200
|
-
}
|
|
201
|
-
//# sourceMappingURL=foreground-child.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"foreground-child.js","sourceRoot":"","sources":["../src/foreground-child.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI1C,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAC9C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,SAAS,CACrD,CAAC;AAEd,SAAS,YAAY,CAAC,KAAmB;IACvC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAsB,CAAC;IAChD,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,GAAS,EAAE;YAC1B,IAAI,CAAC;gBACH,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAClB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;QAChB,CAAC,CAAC;QACF,IAAI,CAAC;YACH,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;YAC1B,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAC/B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;IAChB,CA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,CAAC;QACjB,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;QACtC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;YAC1C,OAAO,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;YAC5C,IAAI,OAAO,KAAK,IAAI;gBAAE,OAAO;YAC7B,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/lib/index.d.ts
DELETED
package/lib/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC"}
|
package/lib/index.js
DELETED
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC"}
|
package/lib/lockfile-async.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { CheckOptions, LockOptions, ReleaseFn, UnlockOptions } from "./lockfile.ts";
|
|
2
|
-
export type { CheckOptions, LockOptions, ReleaseFn, UnlockOptions };
|
|
3
|
-
export declare function lock(file: string, options?: LockOptions): Promise<() => Promise<void>>;
|
|
4
|
-
export declare function lockSync(file: string, options?: LockOptions): () => void;
|
|
5
|
-
export declare function unlock(file: string, options?: UnlockOptions): Promise<void>;
|
|
6
|
-
export declare function unlockSync(file: string, options?: UnlockOptions): void;
|
|
7
|
-
export declare function check(file: string, options?: CheckOptions): Promise<boolean>;
|
|
8
|
-
export declare function checkSync(file: string, options?: CheckOptions): boolean;
|
|
9
|
-
//# sourceMappingURL=lockfile-async.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lockfile-async.d.ts","sourceRoot":"","sources":["../src/lockfile-async.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,SAAS,EACT,aAAa,EACd,MAAM,eAAe,CAAC;AAGvB,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;AAEpE,wBAAsB,IAAI,CACxB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAI9B;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,IAAI,CAOxE;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAE3E;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAEtE;AAED,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAE5E;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAEvE"}
|
package/lib/lockfile-async.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { toPromise, toSync, toSyncOptions } from "./adapter.js";
|
|
2
|
-
import * as lockfile from "./lockfile.js";
|
|
3
|
-
export async function lock(file, options) {
|
|
4
|
-
const release = await toPromise(lockfile.lock)(file, options);
|
|
5
|
-
return toPromise(release);
|
|
6
|
-
}
|
|
7
|
-
export function lockSync(file, options) {
|
|
8
|
-
const release = toSync(lockfile.lock)(file, toSyncOptions(options));
|
|
9
|
-
return toSync(release);
|
|
10
|
-
}
|
|
11
|
-
export function unlock(file, options) {
|
|
12
|
-
return toPromise(lockfile.unlock)(file, options);
|
|
13
|
-
}
|
|
14
|
-
export function unlockSync(file, options) {
|
|
15
|
-
return toSync(lockfile.unlock)(file, toSyncOptions(options));
|
|
16
|
-
}
|
|
17
|
-
export function check(file, options) {
|
|
18
|
-
return toPromise(lockfile.check)(file, options);
|
|
19
|
-
}
|
|
20
|
-
export function checkSync(file, options) {
|
|
21
|
-
return toSync(lockfile.check)(file, toSyncOptions(options));
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=lockfile-async.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lockfile-async.js","sourceRoot":"","sources":["../src/lockfile-async.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAOhE,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAI1C,MAAM,CAAC,KAAK,UAAU,IAAI,CACxB,IAAY,EACZ,OAAqB;IAErB,MAAM,OAAO,GAAG,MAAM,SAAS,CAAY,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAEzE,OAAO,SAAS,CAAO,OAAO,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,OAAqB;IAC1D,MAAM,OAAO,GAAG,MAAM,CAAY,QAAQ,CAAC,IAAI,CAAC,CAC9C,IAAI,EACJ,aAAa,CAAC,OAAO,CAAC,CACvB,CAAC;IAEF,OAAO,MAAM,CAAO,OAAO,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,IAAY,EAAE,OAAuB;IAC1D,OAAO,SAAS,CAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,OAAuB;IAC9D,OAAO,MAAM,CAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,IAAY,EAAE,OAAsB;IACxD,OAAO,SAAS,CAAU,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,OAAsB;IAC5D,OAAO,MAAM,CAAU,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;AACvE,CAAC"}
|
package/lib/lockfile.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { MtimePrecision } from "./mtime-precision.ts";
|
|
2
|
-
import * as retry from "./retry.ts";
|
|
3
|
-
type AnyFs = Record<string, any>;
|
|
4
|
-
export interface LockOptions {
|
|
5
|
-
stale?: number;
|
|
6
|
-
update?: number | null;
|
|
7
|
-
realpath?: boolean;
|
|
8
|
-
retries?: number | retry.OperationOptions;
|
|
9
|
-
fs?: AnyFs;
|
|
10
|
-
onCompromised?: (err: Error) => void;
|
|
11
|
-
lockfilePath?: string;
|
|
12
|
-
}
|
|
13
|
-
interface ResolvedLockOptions {
|
|
14
|
-
stale: number;
|
|
15
|
-
update: number;
|
|
16
|
-
realpath: boolean;
|
|
17
|
-
retries: retry.OperationOptions;
|
|
18
|
-
fs: AnyFs;
|
|
19
|
-
onCompromised: (err: Error) => void;
|
|
20
|
-
lockfilePath?: string;
|
|
21
|
-
}
|
|
22
|
-
export interface UnlockOptions {
|
|
23
|
-
realpath?: boolean;
|
|
24
|
-
fs?: AnyFs;
|
|
25
|
-
lockfilePath?: string;
|
|
26
|
-
}
|
|
27
|
-
export interface CheckOptions {
|
|
28
|
-
stale?: number;
|
|
29
|
-
realpath?: boolean;
|
|
30
|
-
fs?: AnyFs;
|
|
31
|
-
lockfilePath?: string;
|
|
32
|
-
}
|
|
33
|
-
interface InternalLock {
|
|
34
|
-
lockfilePath: string;
|
|
35
|
-
mtime: Date;
|
|
36
|
-
mtimePrecision: MtimePrecision;
|
|
37
|
-
options: ResolvedLockOptions;
|
|
38
|
-
lastUpdate: number;
|
|
39
|
-
updateDelay?: number | null;
|
|
40
|
-
updateTimeout?: ReturnType<typeof setTimeout> | null;
|
|
41
|
-
released?: boolean;
|
|
42
|
-
}
|
|
43
|
-
type ReleaseCallback = (err?: NodeJS.ErrnoException | null) => void;
|
|
44
|
-
export type ReleaseFn = (releasedCallback?: ReleaseCallback) => void;
|
|
45
|
-
type LockCallback = (err: NodeJS.ErrnoException | null, release?: ReleaseFn) => void;
|
|
46
|
-
type UnlockCallback = (err?: NodeJS.ErrnoException | null) => void;
|
|
47
|
-
type CheckCallback = (err: NodeJS.ErrnoException | null, locked?: boolean) => void;
|
|
48
|
-
export declare function lock(file: string, options: LockOptions | undefined, callback: LockCallback): void;
|
|
49
|
-
export declare function unlock(file: string, options: UnlockOptions | undefined, callback: UnlockCallback): void;
|
|
50
|
-
export declare function check(file: string, options: CheckOptions | undefined, callback: CheckCallback): void;
|
|
51
|
-
export declare function getLocks(): Record<string, InternalLock>;
|
|
52
|
-
export {};
|
|
53
|
-
//# sourceMappingURL=lockfile.d.ts.map
|
package/lib/lockfile.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lockfile.d.ts","sourceRoot":"","sources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