@plugjs/plug 0.0.14 → 0.0.15
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/dist/async.cjs +20 -19
- package/dist/async.cjs.map +1 -1
- package/dist/async.d.ts +9 -9
- package/dist/async.mjs +18 -17
- package/dist/async.mjs.map +1 -1
- package/dist/build.cjs +144 -110
- package/dist/build.cjs.map +2 -2
- package/dist/build.d.ts +12 -56
- package/dist/build.mjs +146 -112
- package/dist/build.mjs.map +2 -2
- package/dist/files.cjs +2 -16
- package/dist/files.cjs.map +1 -1
- package/dist/files.d.ts +3 -10
- package/dist/files.mjs +3 -17
- package/dist/files.mjs.map +1 -1
- package/dist/fork.cjs +28 -40
- package/dist/fork.cjs.map +1 -1
- package/dist/fork.d.ts +6 -27
- package/dist/fork.mjs +29 -40
- package/dist/fork.mjs.map +1 -1
- package/dist/helpers.cjs +61 -63
- package/dist/helpers.cjs.map +2 -2
- package/dist/helpers.d.ts +15 -37
- package/dist/helpers.mjs +61 -64
- package/dist/helpers.mjs.map +2 -2
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +9 -13
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/dist/log/colors.cjs +3 -1
- package/dist/log/colors.cjs.map +1 -1
- package/dist/log/colors.d.ts +2 -2
- package/dist/log/colors.mjs +3 -1
- package/dist/log/colors.mjs.map +1 -1
- package/dist/log/emit.d.ts +1 -1
- package/dist/log/logger.cjs +4 -0
- package/dist/log/logger.cjs.map +1 -1
- package/dist/log/logger.d.ts +4 -1
- package/dist/log/logger.mjs +4 -0
- package/dist/log/logger.mjs.map +1 -1
- package/dist/log/options.d.ts +1 -1
- package/dist/log/report.cjs +2 -11
- package/dist/log/report.cjs.map +1 -1
- package/dist/log/report.d.ts +36 -4
- package/dist/log/report.mjs +1 -10
- package/dist/log/report.mjs.map +1 -1
- package/dist/log.cjs +1 -1
- package/dist/log.cjs.map +1 -1
- package/dist/log.d.ts +6 -6
- package/dist/log.mjs +2 -2
- package/dist/log.mjs.map +1 -1
- package/dist/pipe.cjs +41 -34
- package/dist/pipe.cjs.map +1 -1
- package/dist/pipe.d.ts +149 -119
- package/dist/pipe.mjs +38 -32
- package/dist/pipe.mjs.map +1 -1
- package/dist/plugs/copy.cjs +15 -25
- package/dist/plugs/copy.cjs.map +2 -2
- package/dist/plugs/copy.d.ts +14 -13
- package/dist/plugs/copy.mjs +15 -17
- package/dist/plugs/copy.mjs.map +2 -2
- package/dist/plugs/coverage/analysis.d.ts +2 -2
- package/dist/plugs/coverage/report.cjs +1 -1
- package/dist/plugs/coverage/report.cjs.map +1 -1
- package/dist/plugs/coverage/report.d.ts +3 -3
- package/dist/plugs/coverage/report.mjs +1 -1
- package/dist/plugs/coverage/report.mjs.map +1 -1
- package/dist/plugs/coverage.cjs +19 -25
- package/dist/plugs/coverage.cjs.map +1 -1
- package/dist/plugs/coverage.d.ts +33 -30
- package/dist/plugs/coverage.mjs +20 -18
- package/dist/plugs/coverage.mjs.map +1 -1
- package/dist/plugs/debug.cjs +8 -37
- package/dist/plugs/debug.cjs.map +1 -1
- package/dist/plugs/debug.d.ts +4 -11
- package/dist/plugs/debug.mjs +24 -20
- package/dist/plugs/debug.mjs.map +1 -1
- package/dist/plugs/esbuild/fix-extensions.mjs +1 -1
- package/dist/plugs/esbuild/fix-extensions.mjs.map +1 -1
- package/dist/plugs/esbuild.cjs +14 -25
- package/dist/plugs/esbuild.cjs.map +1 -1
- package/dist/plugs/esbuild.d.ts +11 -16
- package/dist/plugs/esbuild.mjs +14 -17
- package/dist/plugs/esbuild.mjs.map +1 -1
- package/dist/plugs/eslint/runner.cjs +5 -6
- package/dist/plugs/eslint/runner.cjs.map +1 -1
- package/dist/plugs/eslint/runner.d.ts +6 -20
- package/dist/plugs/eslint/runner.mjs +6 -7
- package/dist/plugs/eslint/runner.mjs.map +1 -1
- package/dist/{task.cjs → plugs/eslint.cjs} +7 -24
- package/dist/plugs/eslint.cjs.map +6 -0
- package/dist/plugs/eslint.d.ts +34 -0
- package/dist/plugs/eslint.mjs +5 -0
- package/dist/plugs/eslint.mjs.map +6 -0
- package/dist/plugs/exec.cjs +20 -24
- package/dist/plugs/exec.cjs.map +1 -1
- package/dist/plugs/exec.d.ts +53 -53
- package/dist/plugs/exec.mjs +20 -23
- package/dist/plugs/exec.mjs.map +1 -1
- package/dist/plugs/filter.cjs +9 -19
- package/dist/plugs/filter.cjs.map +1 -1
- package/dist/plugs/filter.d.ts +21 -15
- package/dist/plugs/filter.mjs +10 -12
- package/dist/plugs/filter.mjs.map +1 -1
- package/dist/plugs/mocha/reporter.cjs +12 -6
- package/dist/plugs/mocha/reporter.cjs.map +1 -1
- package/dist/plugs/mocha/reporter.d.ts +0 -2
- package/dist/plugs/mocha/reporter.mjs +11 -4
- package/dist/plugs/mocha/reporter.mjs.map +1 -1
- package/dist/plugs/mocha/runner.cjs +4 -5
- package/dist/plugs/mocha/runner.cjs.map +1 -1
- package/dist/plugs/mocha/runner.d.ts +5 -31
- package/dist/plugs/mocha/runner.mjs +5 -6
- package/dist/plugs/mocha/runner.mjs.map +1 -1
- package/dist/plugs/mocha.cjs +22 -0
- package/dist/plugs/mocha.cjs.map +6 -0
- package/dist/plugs/mocha.d.ts +35 -0
- package/dist/plugs/mocha.mjs +5 -0
- package/dist/plugs/mocha.mjs.map +6 -0
- package/dist/plugs/rmf.cjs +4 -32
- package/dist/plugs/rmf.cjs.map +1 -1
- package/dist/plugs/rmf.d.ts +8 -12
- package/dist/plugs/rmf.mjs +25 -20
- package/dist/plugs/rmf.mjs.map +1 -1
- package/dist/plugs/tsc/compiler.d.ts +1 -1
- package/dist/plugs/tsc/options.d.ts +1 -1
- package/dist/plugs/tsc/report.d.ts +2 -2
- package/dist/plugs/tsc/runner.cjs +12 -11
- package/dist/plugs/tsc/runner.cjs.map +1 -1
- package/dist/plugs/tsc/runner.d.ts +4 -9
- package/dist/plugs/tsc/runner.mjs +12 -11
- package/dist/plugs/tsc/runner.mjs.map +1 -1
- package/dist/plugs/tsc.cjs +7 -0
- package/dist/plugs/tsc.cjs.map +6 -0
- package/dist/plugs/tsc.d.ts +36 -0
- package/dist/plugs/tsc.mjs +15 -0
- package/dist/plugs/tsc.mjs.map +6 -0
- package/dist/plugs.cjs +3 -5
- package/dist/plugs.cjs.map +1 -1
- package/dist/plugs.d.ts +10 -17
- package/dist/plugs.mjs +3 -5
- package/dist/plugs.mjs.map +1 -1
- package/dist/types.cjs +19 -0
- package/dist/types.cjs.map +6 -0
- package/dist/types.d.ts +72 -0
- package/dist/types.mjs +1 -0
- package/dist/types.mjs.map +6 -0
- package/dist/utils/caller.cjs +8 -11
- package/dist/utils/caller.cjs.map +2 -2
- package/dist/utils/caller.d.ts +2 -7
- package/dist/utils/caller.mjs +8 -11
- package/dist/utils/caller.mjs.map +2 -2
- package/dist/utils/options.cjs +4 -6
- package/dist/utils/options.cjs.map +1 -1
- package/dist/utils/options.d.ts +16 -15
- package/dist/utils/options.mjs +4 -6
- package/dist/utils/options.mjs.map +1 -1
- package/dist/utils/walk.d.ts +2 -2
- package/extra/cli.mjs +31 -20
- package/extra/ts-loader.mjs +6 -5
- package/package.json +6 -6
- package/src/async.ts +27 -19
- package/src/files.ts +6 -30
- package/src/fork.ts +35 -76
- package/src/helpers.ts +89 -101
- package/src/index.ts +10 -15
- package/src/log/colors.ts +4 -3
- package/src/log/emit.ts +4 -4
- package/src/log/logger.ts +12 -4
- package/src/log/options.ts +1 -1
- package/src/log/report.ts +8 -22
- package/src/log/spinner.ts +3 -3
- package/src/log.ts +9 -9
- package/src/paths.ts +1 -1
- package/src/pipe.ts +191 -178
- package/src/plugs/copy.ts +40 -31
- package/src/plugs/coverage/analysis.ts +4 -4
- package/src/plugs/coverage/report.ts +6 -5
- package/src/plugs/coverage.ts +64 -53
- package/src/plugs/debug.ts +22 -27
- package/src/plugs/esbuild/fix-extensions.ts +2 -2
- package/src/plugs/esbuild.ts +42 -46
- package/src/plugs/eslint/runner.ts +16 -31
- package/src/plugs/eslint.ts +42 -0
- package/src/plugs/exec.ts +93 -82
- package/src/plugs/filter.ts +42 -27
- package/src/plugs/mocha/reporter.ts +10 -5
- package/src/plugs/mocha/runner.ts +12 -38
- package/src/plugs/mocha.ts +41 -0
- package/src/plugs/rmf.ts +21 -25
- package/src/plugs/tsc/compiler.ts +1 -1
- package/src/plugs/tsc/options.ts +2 -2
- package/src/plugs/tsc/report.ts +2 -2
- package/src/plugs/tsc/runner.ts +24 -30
- package/src/plugs/tsc.ts +45 -0
- package/src/plugs.ts +10 -25
- package/src/types.ts +123 -0
- package/src/utils/caller.ts +11 -22
- package/src/utils/options.ts +49 -17
- package/src/utils/walk.ts +4 -4
- package/dist/run.cjs +0 -90
- package/dist/run.cjs.map +0 -6
- package/dist/run.d.ts +0 -89
- package/dist/run.mjs +0 -65
- package/dist/run.mjs.map +0 -6
- package/dist/task.cjs.map +0 -6
- package/dist/task.d.ts +0 -15
- package/dist/task.mjs +0 -14
- package/dist/task.mjs.map +0 -6
- package/src/run.ts +0 -159
- package/src/task.ts +0 -26
package/dist/fork.cjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/fork.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAAqB;AACrB,oBAAgC;AAChC,mBAAyB;AACzB,mBAAsB;AACtB,iBAAiD;AACjD,mBAA2D;AAC3D,kBAA0C;AAkCnC,IAAe,cAAf,MAAuD;AAAA,EAC5D,YACqB,aACA,YACnB;AAFmB;AACA;AAAA,EAClB;AAAA,EAEH,KAAK,OAAc,SAAuC;AACxD,UAAM,UAAoB;AAAA,MACxB,YAAY,KAAK;AAAA,MACjB,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AAQ,KAAK,GAAG,CAAC,QAAe,MAAM,OAAO,GAAG,IAAI,QAAQ,CAAC;AAAA,MAC/E,CAAC;AAAA,IACH,CAAC;AAGD,YAAQ,KAAK,MAAM;AACjB,cAAQ,IAAI,MAAM,qBAAqB;AACvC,cAAQ,KAAK,CAAC;AAAA,IAChB,GAAG,CAAC,UAAU;AACZ,cAAQ,IAAI,MAAM,gDAAgD,KAAK;AACvE,cAAQ,KAAK,CAAC;AAAA,IAChB,CAAC;AAAA,EACH,CAAC;AACH;",
|
|
5
5
|
"names": ["message", "result"]
|
|
6
6
|
}
|
package/dist/fork.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Files } from './files
|
|
2
|
-
import { LogOptions } from './log
|
|
3
|
-
import { AbsolutePath } from './paths
|
|
4
|
-
import { Plug,
|
|
5
|
-
import { Run } from './run.js';
|
|
1
|
+
import { Files } from './files';
|
|
2
|
+
import { LogOptions } from './log';
|
|
3
|
+
import { AbsolutePath } from './paths';
|
|
4
|
+
import { Plug, PlugResult, Context } from './pipe';
|
|
6
5
|
/** Fork data, from parent to child process */
|
|
7
6
|
export interface ForkData {
|
|
8
7
|
/** Script name for the Plug to execute */
|
|
@@ -13,8 +12,6 @@ export interface ForkData {
|
|
|
13
12
|
taskName: string;
|
|
14
13
|
/** Build file name */
|
|
15
14
|
buildFile: AbsolutePath;
|
|
16
|
-
/** Build directory */
|
|
17
|
-
buildDir: AbsolutePath;
|
|
18
15
|
/** Files directory */
|
|
19
16
|
filesDir: AbsolutePath;
|
|
20
17
|
/** All files to pipe */
|
|
@@ -31,27 +28,9 @@ export interface ForkResult {
|
|
|
31
28
|
/** All files returned by the plug */
|
|
32
29
|
filesList?: AbsolutePath[] | undefined;
|
|
33
30
|
}
|
|
34
|
-
|
|
35
|
-
* Install a _forking_ {@link Plug} in the {@link Pipe}, in other words
|
|
36
|
-
* execute the plug in a separate process.
|
|
37
|
-
*
|
|
38
|
-
* As a contract, if the _last non-null_ parameter of the constructor is an
|
|
39
|
-
* object and contains the key `coverageDir`, the process will be forked with
|
|
40
|
-
* the approptiately resolved `NODE_V8_COVERAGE` environment variable.
|
|
41
|
-
*
|
|
42
|
-
* Also, forking plugs require some special attention:
|
|
43
|
-
*
|
|
44
|
-
* * plug functions are not supported, only classes implementing the
|
|
45
|
-
* {@link Plug} interface can be used with this.
|
|
46
|
-
*
|
|
47
|
-
* * the class itself _MUST_ be exported as the _default_ export for the
|
|
48
|
-
* `scriptFile` specified below. This is to simplify interoperability between
|
|
49
|
-
* CommonJS and ESM modules as we use dynamic `import(...)` statements.
|
|
50
|
-
*/
|
|
51
|
-
export declare function installForking(plugName: PlugName, scriptFile: AbsolutePath): void;
|
|
52
|
-
export declare abstract class ForkingPlug implements Plug<Files | undefined> {
|
|
31
|
+
export declare abstract class ForkingPlug implements Plug<PlugResult> {
|
|
53
32
|
private readonly _scriptFile;
|
|
54
33
|
private readonly _arguments;
|
|
55
34
|
constructor(_scriptFile: AbsolutePath, _arguments: any[]);
|
|
56
|
-
pipe(files: Files,
|
|
35
|
+
pipe(files: Files, context: Context): Promise<PlugResult>;
|
|
57
36
|
}
|
package/dist/fork.mjs
CHANGED
|
@@ -2,44 +2,35 @@
|
|
|
2
2
|
import { fork } from "node:child_process";
|
|
3
3
|
import { assert, failure } from "./assert.mjs";
|
|
4
4
|
import { runAsync } from "./async.mjs";
|
|
5
|
+
import { Files } from "./files.mjs";
|
|
5
6
|
import { $gry, $p, logOptions } from "./log.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { RunImpl } from "./run.mjs";
|
|
9
|
-
function installForking(plugName, scriptFile) {
|
|
10
|
-
const ctor = class extends ForkingPlug {
|
|
11
|
-
constructor(...args) {
|
|
12
|
-
super(scriptFile, args);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
install(plugName, ctor);
|
|
16
|
-
}
|
|
7
|
+
import { requireFilename, resolveFile } from "./paths.mjs";
|
|
8
|
+
import { Context } from "./pipe.mjs";
|
|
17
9
|
var ForkingPlug = class {
|
|
18
10
|
constructor(_scriptFile, _arguments) {
|
|
19
11
|
this._scriptFile = _scriptFile;
|
|
20
12
|
this._arguments = _arguments;
|
|
21
13
|
}
|
|
22
|
-
pipe(files,
|
|
14
|
+
pipe(files, context) {
|
|
23
15
|
const message = {
|
|
24
16
|
scriptFile: this._scriptFile,
|
|
25
17
|
constructorArgs: this._arguments,
|
|
26
|
-
taskName:
|
|
27
|
-
buildFile:
|
|
28
|
-
buildDir: run.buildDir,
|
|
18
|
+
taskName: context.taskName,
|
|
19
|
+
buildFile: context.buildFile,
|
|
29
20
|
filesDir: files.directory,
|
|
30
21
|
filesList: [...files.absolutePaths()],
|
|
31
|
-
logOpts: logOptions.fork(
|
|
22
|
+
logOpts: logOptions.fork(context.taskName)
|
|
32
23
|
};
|
|
33
24
|
const script = requireFilename(import.meta.url);
|
|
34
|
-
|
|
25
|
+
context.log.debug("About to fork plug from", $p(script));
|
|
35
26
|
const env = { ...process.env };
|
|
36
27
|
for (let i = this._arguments.length - 1; i >= 0; i--) {
|
|
37
28
|
if (this._arguments[i] == null)
|
|
38
29
|
continue;
|
|
39
30
|
if (typeof this._arguments[i] === "object") {
|
|
40
31
|
if (typeof this._arguments[i].coverageDir === "string") {
|
|
41
|
-
const dir = env.NODE_V8_COVERAGE =
|
|
42
|
-
|
|
32
|
+
const dir = env.NODE_V8_COVERAGE = context.resolve(this._arguments[i].coverageDir);
|
|
33
|
+
context.log.debug("Forked process will produce coverage in", $p(dir));
|
|
43
34
|
}
|
|
44
35
|
}
|
|
45
36
|
}
|
|
@@ -47,46 +38,46 @@ var ForkingPlug = class {
|
|
|
47
38
|
stdio: ["ignore", "inherit", "inherit", "ipc"],
|
|
48
39
|
env
|
|
49
40
|
});
|
|
50
|
-
|
|
41
|
+
context.log.info("Running", $p(script), $gry(`(pid=${child.pid})`));
|
|
51
42
|
let done = false;
|
|
52
43
|
return new Promise((resolve, reject) => {
|
|
53
44
|
let result = void 0;
|
|
54
45
|
child.on("error", (error) => {
|
|
55
|
-
|
|
46
|
+
context.log.error("Child process error", error);
|
|
56
47
|
return done || reject(failure());
|
|
57
48
|
});
|
|
58
49
|
child.on("message", (message2) => {
|
|
59
|
-
|
|
50
|
+
context.log.debug("Message from child process", message2);
|
|
60
51
|
result = message2;
|
|
61
52
|
});
|
|
62
53
|
child.on("exit", (code, signal) => {
|
|
63
54
|
if (signal) {
|
|
64
|
-
|
|
55
|
+
context.log.error(`Child process exited with signal ${signal}`, $gry(`(pid=${child.pid})`));
|
|
65
56
|
return done || reject(failure());
|
|
66
57
|
} else if (code !== 0) {
|
|
67
|
-
|
|
58
|
+
context.log.error(`Child process exited with code ${code}`, $gry(`(pid=${child.pid})`));
|
|
68
59
|
return done || reject(failure());
|
|
69
60
|
} else if (!result) {
|
|
70
|
-
|
|
61
|
+
context.log.error("Child process exited with no result", $gry(`(pid=${child.pid})`));
|
|
71
62
|
return done || reject(failure());
|
|
72
63
|
} else if (result.failed) {
|
|
73
64
|
return done || reject(failure());
|
|
74
65
|
}
|
|
75
|
-
return done || resolve(message.filesDir && message.filesList ?
|
|
66
|
+
return done || resolve(message.filesDir && message.filesList ? Files.builder(message.filesDir).add(...message.filesList).build() : void 0);
|
|
76
67
|
});
|
|
77
68
|
try {
|
|
78
69
|
const result2 = child.send(message, (error) => {
|
|
79
70
|
if (error) {
|
|
80
|
-
|
|
71
|
+
context.log.error("Error sending message to child process (callback failure)", error);
|
|
81
72
|
reject(failure());
|
|
82
73
|
}
|
|
83
74
|
});
|
|
84
75
|
if (!result2) {
|
|
85
|
-
|
|
76
|
+
context.log.error("Error sending message to child process (send returned false)");
|
|
86
77
|
reject(failure());
|
|
87
78
|
}
|
|
88
79
|
} catch (error) {
|
|
89
|
-
|
|
80
|
+
context.log.error("Error sending message to child process (exception caught)", error);
|
|
90
81
|
reject(failure());
|
|
91
82
|
}
|
|
92
83
|
}).finally(() => done = true);
|
|
@@ -104,15 +95,14 @@ if (process.argv[1] === requireFilename(import.meta.url) && process.send) {
|
|
|
104
95
|
constructorArgs,
|
|
105
96
|
taskName,
|
|
106
97
|
buildFile,
|
|
107
|
-
buildDir,
|
|
108
98
|
filesDir,
|
|
109
99
|
filesList,
|
|
110
100
|
logOpts
|
|
111
101
|
} = message;
|
|
112
102
|
Object.assign(logOptions, logOpts);
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
const result = runAsync(
|
|
103
|
+
const context = new Context(buildFile, taskName);
|
|
104
|
+
context.log.debug("Message from parent process", message);
|
|
105
|
+
const result = runAsync(context, taskName, async () => {
|
|
116
106
|
assert(resolveFile(scriptFile), `Script file ${$p(scriptFile)} not found`);
|
|
117
107
|
const script = await import(scriptFile);
|
|
118
108
|
let Ctor = script;
|
|
@@ -123,8 +113,8 @@ if (process.argv[1] === requireFilename(import.meta.url) && process.send) {
|
|
|
123
113
|
`Script ${$p(scriptFile)} does not export a default constructor`
|
|
124
114
|
);
|
|
125
115
|
const plug = new Ctor(...constructorArgs);
|
|
126
|
-
const files =
|
|
127
|
-
return plug.pipe(files,
|
|
116
|
+
const files = Files.builder(filesDir).add(...filesList).build();
|
|
117
|
+
return plug.pipe(files, context);
|
|
128
118
|
});
|
|
129
119
|
const promise = result.then((result2) => {
|
|
130
120
|
const message2 = result2 ? { failed: false, filesDir: result2.directory, filesList: [...result2.absolutePaths()] } : { failed: false };
|
|
@@ -132,22 +122,21 @@ if (process.argv[1] === requireFilename(import.meta.url) && process.send) {
|
|
|
132
122
|
process.send(message2, (err) => err ? reject(err) : resolve());
|
|
133
123
|
});
|
|
134
124
|
}, (error) => {
|
|
135
|
-
|
|
125
|
+
context.log.error(error);
|
|
136
126
|
return new Promise((resolve, reject) => {
|
|
137
127
|
process.send({ failed: true }, (err) => err ? reject(err) : resolve());
|
|
138
128
|
});
|
|
139
129
|
});
|
|
140
130
|
promise.then(() => {
|
|
141
|
-
|
|
131
|
+
context.log.debug("Forked plug exiting");
|
|
142
132
|
process.exit(0);
|
|
143
133
|
}, (error) => {
|
|
144
|
-
|
|
134
|
+
context.log.error("Error sending message back to parent process", error);
|
|
145
135
|
process.exit(1);
|
|
146
136
|
});
|
|
147
137
|
});
|
|
148
138
|
}
|
|
149
139
|
export {
|
|
150
|
-
ForkingPlug
|
|
151
|
-
installForking
|
|
140
|
+
ForkingPlug
|
|
152
141
|
};
|
|
153
142
|
//# sourceMappingURL=fork.mjs.map
|
package/dist/fork.mjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/fork.ts"],
|
|
4
|
-
"mappings": ";AAAA,SAAS,YAAY;AACrB,SAAS,QAAQ,eAAe;AAChC,SAAS,gBAAgB;
|
|
4
|
+
"mappings": ";AAAA,SAAS,YAAY;AACrB,SAAS,QAAQ,eAAe;AAChC,SAAS,gBAAgB;AACzB,SAAS,aAAa;AACtB,SAAS,MAAM,IAAgB,kBAAkB;AACjD,SAAuB,iBAAiB,mBAAmB;AAC3D,SAA2B,eAAe;AAkCnC,IAAe,cAAf,MAAuD;AAAA,EAC5D,YACqB,aACA,YACnB;AAFmB;AACA;AAAA,EAClB;AAAA,EAEH,KAAK,OAAc,SAAuC;AACxD,UAAM,UAAoB;AAAA,MACxB,YAAY,KAAK;AAAA,MACjB,iBAAiB,KAAK;AAAA,MACtB,UAAU,QAAQ;AAAA,MAClB,WAAW,QAAQ;AAAA,MACnB,UAAU,MAAM;AAAA,MAChB,WAAW,CAAE,GAAG,MAAM,cAAc,CAAE;AAAA,MACtC,SAAS,WAAW,KAAK,QAAQ,QAAQ;AAAA,IAC3C;AAGA,UAAM,SAAS,gBAAgB,eAAS;AACxC,YAAQ,IAAI,MAAM,2BAA2B,GAAG,MAAM,CAAC;AAGvD,UAAM,MAAM,EAAE,GAAG,QAAQ,IAAI;AAG7B,aAAS,IAAI,KAAK,WAAW,SAAS,GAAG,KAAK,GAAG,KAAM;AACrD,UAAI,KAAK,WAAW,MAAM;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}, "__esModule", { value: tru
|
|
|
20
20
|
// helpers.ts
|
|
21
21
|
var helpers_exports = {};
|
|
22
22
|
__export(helpers_exports, {
|
|
23
|
-
files: () => files,
|
|
24
23
|
find: () => find,
|
|
25
24
|
isDirectory: () => isDirectory,
|
|
26
25
|
isFile: () => isFile,
|
|
27
26
|
merge: () => merge,
|
|
28
|
-
|
|
29
|
-
resolve: () => resolve,
|
|
30
|
-
rmrf: () => rmrf,
|
|
31
|
-
setLogLevel: () => setLogLevel
|
|
27
|
+
rmrf: () => rmrf
|
|
32
28
|
});
|
|
33
29
|
module.exports = __toCommonJS(helpers_exports);
|
|
34
|
-
var import_paths = require("./paths.cjs");
|
|
35
30
|
var import_assert = require("./assert.cjs");
|
|
36
31
|
var import_async = require("./async.cjs");
|
|
32
|
+
var import_files = require("./files.cjs");
|
|
37
33
|
var import_log = require("./log.cjs");
|
|
34
|
+
var import_paths = require("./paths.cjs");
|
|
35
|
+
var import_pipe = require("./pipe.cjs");
|
|
38
36
|
var import_asyncfs = require("./utils/asyncfs.cjs");
|
|
37
|
+
var import_options = require("./utils/options.cjs");
|
|
38
|
+
var import_walk = require("./utils/walk.cjs");
|
|
39
|
+
var PipeImpl = class extends import_pipe.Pipe {
|
|
40
|
+
constructor(_start) {
|
|
41
|
+
super();
|
|
42
|
+
this._start = _start;
|
|
43
|
+
}
|
|
44
|
+
plug(arg) {
|
|
45
|
+
const plug = typeof arg === "function" ? { pipe: arg } : arg;
|
|
46
|
+
const parent = this;
|
|
47
|
+
return new PipeImpl(async (context) => {
|
|
48
|
+
const files = await parent._start(context);
|
|
49
|
+
const files2 = await plug.pipe(files, context);
|
|
50
|
+
(0, import_assert.assert)(files2, "Unable to extend pipe (part tres)");
|
|
51
|
+
return files2;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
async run() {
|
|
55
|
+
return this._start((0, import_async.requireContext)());
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
function find(...args) {
|
|
59
|
+
const { params: globs, options } = (0, import_options.parseOptions)(args, {});
|
|
60
|
+
return new PipeImpl(async (context) => {
|
|
61
|
+
const directory = options.directory ? context.resolve(options.directory) : (0, import_paths.getCurrentWorkingDirectory)();
|
|
62
|
+
const builder = import_files.Files.builder(directory);
|
|
63
|
+
for await (const file of (0, import_walk.walk)(directory, globs, options)) {
|
|
64
|
+
builder.add(file);
|
|
65
|
+
}
|
|
66
|
+
return builder.build();
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function merge(...pipes) {
|
|
70
|
+
return new PipeImpl(async () => {
|
|
71
|
+
if (pipes.length === 0)
|
|
72
|
+
return import_files.Files.builder((0, import_paths.getCurrentWorkingDirectory)()).build();
|
|
73
|
+
const results = [];
|
|
74
|
+
for (const pipe of pipes) {
|
|
75
|
+
const result = await pipe.run();
|
|
76
|
+
(0, import_assert.assert)(result, "Pipe did not return a Files result");
|
|
77
|
+
results.push(result);
|
|
78
|
+
}
|
|
79
|
+
const [first, ...others] = results;
|
|
80
|
+
const firstDir = first.directory;
|
|
81
|
+
const otherDirs = others.map((f) => f.directory);
|
|
82
|
+
const directory = (0, import_paths.commonPath)(firstDir, ...otherDirs);
|
|
83
|
+
return import_files.Files.builder(directory).merge(first, ...others).build();
|
|
84
|
+
});
|
|
85
|
+
}
|
|
39
86
|
async function rmrf(directory) {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
const dir = run.resolve(directory);
|
|
87
|
+
const context = (0, import_async.requireContext)();
|
|
88
|
+
const dir = context.resolve(directory);
|
|
43
89
|
(0, import_assert.assert)(
|
|
44
90
|
dir !== (0, import_paths.getCurrentWorkingDirectory)(),
|
|
45
91
|
`Cowardly refusing to wipe current working directory ${(0, import_log.$p)(dir)}`
|
|
46
92
|
);
|
|
47
93
|
(0, import_assert.assert)(
|
|
48
|
-
dir !==
|
|
94
|
+
dir !== context.resolve("@"),
|
|
49
95
|
`Cowardly refusing to wipe build file directory ${(0, import_log.$p)(dir)}`
|
|
50
96
|
);
|
|
51
97
|
if (!(0, import_paths.resolveDirectory)(dir)) {
|
|
@@ -55,68 +101,20 @@ async function rmrf(directory) {
|
|
|
55
101
|
import_log.log.notice("Removing directory", (0, import_log.$p)(dir), "recursively");
|
|
56
102
|
await (0, import_asyncfs.rm)(dir, { recursive: true });
|
|
57
103
|
}
|
|
58
|
-
function setLogLevel(level) {
|
|
59
|
-
const run = (0, import_async.currentRun)();
|
|
60
|
-
(0, import_assert.assert)(run, "Unable to find files outside a running task");
|
|
61
|
-
return run.setLogLevel(level);
|
|
62
|
-
}
|
|
63
|
-
function resolve(...paths) {
|
|
64
|
-
const run = (0, import_async.currentRun)();
|
|
65
|
-
(0, import_assert.assert)(run, "Unable to find files outside a running task");
|
|
66
|
-
return run.resolve(...paths);
|
|
67
|
-
}
|
|
68
|
-
function files(first, ...paths) {
|
|
69
|
-
const run = (0, import_async.currentRun)();
|
|
70
|
-
(0, import_assert.assert)(run, "Unable to create files builder outside a running task");
|
|
71
|
-
if (typeof first === "string") {
|
|
72
|
-
return run.files(first, ...paths);
|
|
73
|
-
} else if (first) {
|
|
74
|
-
return run.files(first);
|
|
75
|
-
} else {
|
|
76
|
-
return run.files();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
function merge(args) {
|
|
80
|
-
const run = (0, import_async.currentRun)();
|
|
81
|
-
(0, import_assert.assert)(run, "Unable to create files builder outside a running task");
|
|
82
|
-
const promise = Promise.resolve().then(async () => {
|
|
83
|
-
if (args.length === 0)
|
|
84
|
-
return run.pipe(run.files().build());
|
|
85
|
-
const instances = await Promise.all(args);
|
|
86
|
-
const [first, ...others] = instances;
|
|
87
|
-
const firstDir = first.directory;
|
|
88
|
-
const otherDirs = others.map((f) => f.directory);
|
|
89
|
-
const directory = (0, import_paths.commonPath)(firstDir, ...otherDirs);
|
|
90
|
-
return run.files(directory).merge(first, ...others).build();
|
|
91
|
-
});
|
|
92
|
-
return run.pipe(promise);
|
|
93
|
-
}
|
|
94
|
-
function find(glob, ...args) {
|
|
95
|
-
const run = (0, import_async.currentRun)();
|
|
96
|
-
(0, import_assert.assert)(run, "Unable to find files outside a running task");
|
|
97
|
-
return run.find(glob, ...args);
|
|
98
|
-
}
|
|
99
|
-
function pipe(files2) {
|
|
100
|
-
const run = (0, import_async.currentRun)();
|
|
101
|
-
(0, import_assert.assert)(run, "Unable to create pipes outside a running task");
|
|
102
|
-
return run.pipe(files2);
|
|
103
|
-
}
|
|
104
104
|
function isFile(...paths) {
|
|
105
|
-
|
|
105
|
+
const path = (0, import_async.requireContext)().resolve(...paths);
|
|
106
|
+
return (0, import_paths.resolveFile)(path);
|
|
106
107
|
}
|
|
107
108
|
function isDirectory(...paths) {
|
|
108
|
-
|
|
109
|
+
const path = (0, import_async.requireContext)().resolve(...paths);
|
|
110
|
+
return (0, import_paths.resolveDirectory)(path);
|
|
109
111
|
}
|
|
110
112
|
// Annotate the CommonJS export names for ESM import in node:
|
|
111
113
|
0 && (module.exports = {
|
|
112
|
-
files,
|
|
113
114
|
find,
|
|
114
115
|
isDirectory,
|
|
115
116
|
isFile,
|
|
116
117
|
merge,
|
|
117
|
-
|
|
118
|
-
resolve,
|
|
119
|
-
rmrf,
|
|
120
|
-
setLogLevel
|
|
118
|
+
rmrf
|
|
121
119
|
});
|
|
122
120
|
//# sourceMappingURL=helpers.cjs.map
|
package/dist/helpers.cjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/helpers.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
5
|
-
"names": [
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB;AACvB,mBAA+B;AAC/B,mBAAsB;AACtB,iBAAwB;AACxB,mBAAoG;AACp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UAAU,MAAO,IAAI;AAE7B,UAAM,WAAW,MAAM;AACvB,UAAM,YAAY,OAAO,IAAI,CAAC,MAAM,EAAE,SAAS;AAE/C,UAAM,gBAAY,yBAAW,UAAU,GAAG,SAAS;AAEnD,WAAO,mBAAM,QAAQ,SAAS,EAAE,MAAM,OAAO,GAAG,MAAM,EAAE,MAAM;AAAA,EAChE,CAAC;AACH;AAKA,eAAsB,KAAK,WAAkC;AAC3D,QAAM,cAAU,6BAAe;AAC/B,QAAM,MAAM,QAAQ,QAAQ,SAAS;AAErC;AAAA,IAAO,YAAQ,yCAA2B;AAAA,IACtC,2DAAuD,eAAG,GAAG;AAAA,EAAG;AAEpE;AAAA,IAAO,QAAQ,QAAQ,QAAQ,GAAG;AAAA,IAC9B,sDAAkD,eAAG,GAAG;AAAA,EAAG;AAE/D,MAAI,KAAE,+BAAiB,GAAG,GAAG;AAC3B,mBAAI,KAAK,iBAAa,eAAG,GAAG,GAAG,WAAW;AAC1C;AAAA,EACF;AAEA,iBAAI,OAAO,0BAAsB,eAAG,GAAG,GAAG,aAAa;AACvD,YAAM,mBAAG,KAAK,EAAE,WAAW,KAAK,CAAC;AACnC;AAGO,SAAS,UAAU,OAA0D;AAClF,QAAM,WAAO,6BAAe,EAAE,QAAQ,GAAG,KAAK;AAC9C,aAAO,0BAAY,IAAI;AACzB;AAGO,SAAS,eAAe,OAA0D;AACvF,QAAM,WAAO,6BAAe,EAAE,QAAQ,GAAG,KAAK;AAC9C,aAAO,+BAAiB,IAAI;AAC9B;",
|
|
5
|
+
"names": []
|
|
6
6
|
}
|
package/dist/helpers.d.ts
CHANGED
|
@@ -1,43 +1,21 @@
|
|
|
1
|
-
import { AbsolutePath } from './paths
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { AbsolutePath } from './paths';
|
|
2
|
+
import { Pipe } from './pipe';
|
|
3
|
+
import { WalkOptions } from './utils/walk';
|
|
4
|
+
/** The {@link FindOptions} interface defines the options for finding files. */
|
|
5
|
+
export interface FindOptions extends WalkOptions {
|
|
6
|
+
/** The directory where to start looking for files. */
|
|
7
|
+
directory?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function find(glob: string): Pipe;
|
|
10
|
+
export declare function find(glob: string, ...globs: string[]): Pipe;
|
|
11
|
+
export declare function find(glob: string, options: FindOptions): Pipe;
|
|
12
|
+
export declare function find(glob: string, ...extra: [...globs: string[], options: FindOptions]): Pipe;
|
|
13
|
+
export declare function merge(...pipes: Pipe[]): Pipe;
|
|
7
14
|
/**
|
|
8
15
|
* Recursively remove the specified directory _**(use with care)**_.
|
|
9
16
|
*/
|
|
10
17
|
export declare function rmrf(directory: string): Promise<void>;
|
|
11
|
-
/**
|
|
12
|
-
* Set the current _log level_.
|
|
13
|
-
*
|
|
14
|
-
* The _level_ will be applied _only_ within the execution of the current task.
|
|
15
|
-
*/
|
|
16
|
-
export declare function setLogLevel(level: LogLevelString): void;
|
|
17
|
-
/**
|
|
18
|
-
* Resolve a path into an {@link AbsolutePath}.
|
|
19
|
-
*
|
|
20
|
-
* If the path starts with `@...` it is considered to be relative to the
|
|
21
|
-
* _directory containing the build file where the task was defined_, otherwise
|
|
22
|
-
* it will be relative to the {@link process.cwd | current working directory}.
|
|
23
|
-
*/
|
|
24
|
-
export declare function resolve(...paths: string[]): AbsolutePath;
|
|
25
|
-
/**
|
|
26
|
-
* Create a new {@link Files} instance.
|
|
27
|
-
*/
|
|
28
|
-
export declare function files(files: Files): FilesBuilder;
|
|
29
|
-
export declare function files(directory: string, ...paths: string[]): FilesBuilder;
|
|
30
|
-
/**
|
|
31
|
-
* Merge multiple {@link Files} instance.
|
|
32
|
-
*/
|
|
33
|
-
export declare function merge(args: (Files | Promise<Files>)[]): Promise<Files> & Pipe;
|
|
34
|
-
/**
|
|
35
|
-
* Find files according to the globs and {@link FindOptions} specified.
|
|
36
|
-
*/
|
|
37
|
-
export declare function find(glob: string, ...args: ParseOptions<FindOptions>): Pipe & Promise<Files>;
|
|
38
|
-
/** Create a {@link Pipe} from a {@link Files} instance. */
|
|
39
|
-
export declare function pipe(files: Files | Promise<Files>): Pipe & Promise<Files>;
|
|
40
18
|
/** Return an absolute path of the file if it exist on disk */
|
|
41
|
-
export declare function isFile(...paths: string[]): AbsolutePath | undefined;
|
|
19
|
+
export declare function isFile(...paths: [string, ...string[]]): AbsolutePath | undefined;
|
|
42
20
|
/** Return an absolute path of the file if it exist on disk */
|
|
43
|
-
export declare function isDirectory(...paths: string[]): AbsolutePath | undefined;
|
|
21
|
+
export declare function isDirectory(...paths: [string, ...string[]]): AbsolutePath | undefined;
|