@plugjs/plug 0.0.14 → 0.0.16
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 +113 -110
- package/dist/build.cjs.map +2 -2
- package/dist/build.d.ts +14 -56
- package/dist/build.mjs +114 -111
- 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 +27 -61
- package/dist/helpers.cjs.map +2 -2
- package/dist/helpers.d.ts +29 -31
- package/dist/helpers.mjs +27 -62
- package/dist/helpers.mjs.map +2 -2
- package/dist/index.cjs +15 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +9 -13
- package/dist/index.mjs +7 -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 +69 -26
- package/dist/pipe.cjs.map +1 -1
- package/dist/pipe.d.ts +178 -119
- package/dist/pipe.mjs +71 -24
- 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 +20 -26
- package/dist/plugs/coverage.cjs.map +1 -1
- package/dist/plugs/coverage.d.ts +33 -30
- package/dist/plugs/coverage.mjs +21 -19
- package/dist/plugs/coverage.mjs.map +1 -1
- package/dist/plugs/debug.cjs +12 -36
- package/dist/plugs/debug.cjs.map +1 -1
- package/dist/plugs/debug.d.ts +4 -11
- package/dist/plugs/debug.mjs +30 -21
- 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 +71 -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 +8 -9
- package/src/async.ts +27 -19
- package/src/files.ts +6 -30
- package/src/fork.ts +35 -76
- package/src/helpers.ts +66 -99
- 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 +255 -170
- 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 +28 -26
- 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 +116 -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/plugs/debug.mjs
CHANGED
|
@@ -1,25 +1,34 @@
|
|
|
1
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
3
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
4
|
+
};
|
|
5
|
+
|
|
1
6
|
// plugs/debug.ts
|
|
2
|
-
import { $gry, $p, $und } from "../log.mjs";
|
|
7
|
+
import { $gry, $p, $und, $ylw } from "../log.mjs";
|
|
3
8
|
import { install } from "../pipe.mjs";
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
var require_debug = __commonJS({
|
|
10
|
+
"plugs/debug.ts"() {
|
|
11
|
+
install("debug", class Debug {
|
|
12
|
+
_title;
|
|
13
|
+
constructor(...args) {
|
|
14
|
+
const [title = "Debugging"] = args;
|
|
15
|
+
this._title = title;
|
|
16
|
+
}
|
|
17
|
+
async pipe(files, context) {
|
|
18
|
+
context.log.notice(this._title, `${$gry("(")}${$ylw(files.length)} ${$gry("files)")}`);
|
|
19
|
+
context.log.notice("- base dir:", $p(context.resolve("@")));
|
|
20
|
+
context.log.notice("- build file dir:", $p(context.resolve(".")));
|
|
21
|
+
context.log.notice("- files dir:", $p(files.directory));
|
|
22
|
+
if (files.length) {
|
|
23
|
+
const [path, ...paths] = files;
|
|
24
|
+
context.log.notice("- relative paths:", $und($gry(path)));
|
|
25
|
+
for (const p of paths)
|
|
26
|
+
context.log.notice("- :", $und($gry(p)));
|
|
27
|
+
}
|
|
28
|
+
return files;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
19
31
|
}
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
Debug
|
|
24
|
-
};
|
|
32
|
+
});
|
|
33
|
+
export default require_debug();
|
|
25
34
|
//# sourceMappingURL=debug.mjs.map
|
package/dist/plugs/debug.mjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/plugs/debug.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": ";;;;;;AACA,SAAS,MAAM,IAAI,MAAM,YAAY;AACrC,SAAS,eAA8C;AAFvD;AAAA;AAgBA,YAAQ,SAAS,MAAM,MAA6B;AAAA,MACjC;AAAA,MAEjB,eAAe,MAA+B;AAC5C,cAAM,CAAE,QAAQ,WAAY,IAAI;AAChC,aAAK,SAAS;AAAA,MAChB;AAAA,MAEA,MAAM,KAAK,OAAc,SAAkC;AACzD,gBAAQ,IAAI,OAAO,KAAK,QAAQ,GAAG,KAAK,GAAG,IAAI,KAAK,MAAM,MAAM,KAAK,KAAK,QAAQ,GAAG;AACrF,gBAAQ,IAAI,OAAO,sBAAsB,GAAG,QAAQ,QAAQ,GAAG,CAAC,CAAC;AACjE,gBAAQ,IAAI,OAAO,sBAAsB,GAAG,QAAQ,QAAQ,GAAG,CAAC,CAAC;AACjE,gBAAQ,IAAI,OAAO,sBAAsB,GAAG,MAAM,SAAS,CAAC;AAC5D,YAAI,MAAM,QAAQ;AAChB,gBAAM,CAAE,SAAS,KAAM,IAAI;AAC3B,kBAAQ,IAAI,OAAO,sBAAsB,KAAK,KAAK,IAAI,CAAC,CAAC;AACzD,qBAAW,KAAK;AAAO,oBAAQ,IAAI,OAAO,sBAAsB,KAAK,KAAK,CAAC,CAAC,CAAC;AAAA,QAC/E;AACA,eAAO;AAAA,MACT;AAAA,IACF,CAAC;AAAA;AAAA;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// plugs/esbuild/fix-extensions.ts
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { assertAbsolutePath,
|
|
3
|
+
import { assertAbsolutePath, resolveAbsolutePath, resolveFile } from "../../paths.mjs";
|
|
4
4
|
import { stat } from "../../utils/asyncfs.mjs";
|
|
5
5
|
function fixExtensions() {
|
|
6
6
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugs/esbuild/fix-extensions.ts"],
|
|
4
|
-
"mappings": ";AAAA,OAAO,UAAU;AAGjB,SAAS,oBAAoB,
|
|
4
|
+
"mappings": ";AAAA,OAAO,UAAU;AAGjB,SAAS,oBAAoB,qBAAqB,mBAAmB;AACrE,SAAS,YAAY;AA6Bd,SAAS,gBAAwB;AACtC,SAAO;AAAA,IACL,MAAM;AAAA,IAEN,MAAM,OAAa;AArCvB;AAuCM,YAAM,eAAe,SAAS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GA,cAAM,UAAU,KAAK,QAAQ,KAAK,YAAY,KAAK,IAAI;AACvD,cAAM,QAAQ,MAAM,KAAK,OAAO,EAAE,KAAK,CAACA,UAASA,MAAK,YAAY,GAAG,CAAC,UAAU,MAAU;AAC1F,YAAI,CAAE;AAAO,iBAAO,EAAE,UAAU,KAAK;AAGrC,mBAAW,OAAO,MAAM;AACtB,gBAAM,WAAW,KAAK,KAAK,KAAK,MAAM,QAAQ,KAAK;AACnD,gBAAM,WAAW,KAAK,QAAQ,KAAK,YAAY,QAAQ;AACvD,gBAAM,SAAS,MAAM,KAAK,QAAQ,EAAE,KAAK,CAACA,UAASA,MAAK,OAAO,GAAG,CAAC,UAAU,MAAU;AACvF,cAAI;AAAQ,mBAAO,EAAE,MAAM,GAAG,KAAK,aAAa,MAAM,UAAU,KAAK;AAAA,QACvE;AAGA,eAAO,EAAE,UAAU,KAAK;AAAA,MAC1B,CAAC;AAAA,IACH;AAAA,EACF;AACF;",
|
|
5
5
|
"names": ["stat"]
|
|
6
6
|
}
|
package/dist/plugs/esbuild.cjs
CHANGED
|
@@ -3,10 +3,6 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
6
|
var __copyProps = (to, from, except, desc) => {
|
|
11
7
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
8
|
for (let key of __getOwnPropNames(from))
|
|
@@ -20,30 +16,28 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
16
|
|
|
21
17
|
// plugs/esbuild.ts
|
|
22
18
|
var esbuild_exports = {};
|
|
23
|
-
__export(esbuild_exports, {
|
|
24
|
-
ESBuild: () => ESBuild
|
|
25
|
-
});
|
|
26
19
|
module.exports = __toCommonJS(esbuild_exports);
|
|
27
20
|
var import_esbuild = require("esbuild");
|
|
28
21
|
var import_node_path = require("node:path");
|
|
29
22
|
var import_assert = require("../assert.cjs");
|
|
23
|
+
var import_files = require("../files.cjs");
|
|
30
24
|
var import_log = require("../log.cjs");
|
|
31
25
|
var import_paths = require("../paths.cjs");
|
|
32
26
|
var import_pipe = require("../pipe.cjs");
|
|
33
27
|
var import_asyncfs = require("../utils/asyncfs.cjs");
|
|
34
28
|
__reExport(esbuild_exports, require("./esbuild/bundle-locals.cjs"), module.exports);
|
|
35
29
|
__reExport(esbuild_exports, require("./esbuild/fix-extensions.cjs"), module.exports);
|
|
36
|
-
|
|
30
|
+
(0, import_pipe.install)("esbuild", class ESBuild {
|
|
37
31
|
constructor(_options) {
|
|
38
32
|
this._options = _options;
|
|
39
33
|
}
|
|
40
|
-
async pipe(files,
|
|
34
|
+
async pipe(files, context) {
|
|
41
35
|
const entryPoints = [...files];
|
|
42
36
|
const absWorkingDir = files.directory;
|
|
43
37
|
const options = {
|
|
44
38
|
platform: "node",
|
|
45
39
|
target: `node${process.versions["node"].split(".")[0]}`,
|
|
46
|
-
format: this._options.format || await _moduleFormat(files.directory,
|
|
40
|
+
format: this._options.format || await _moduleFormat(files.directory, context.log),
|
|
47
41
|
outbase: absWorkingDir,
|
|
48
42
|
...this._options,
|
|
49
43
|
absWorkingDir,
|
|
@@ -54,24 +48,24 @@ var ESBuild = class {
|
|
|
54
48
|
(0, import_assert.assert)(!(options.outdir && options.outfile), 'Options "outfile" and "outdir" can not coexist');
|
|
55
49
|
let builder;
|
|
56
50
|
if (options.bundle && options.outfile && entryPoints.length === 1) {
|
|
57
|
-
builder =
|
|
51
|
+
builder = import_files.Files.builder(absWorkingDir);
|
|
58
52
|
const outputFile = (0, import_paths.resolveAbsolutePath)(absWorkingDir, options.outfile);
|
|
59
53
|
const entryPoint = (0, import_paths.resolveAbsolutePath)(absWorkingDir, entryPoints[0]);
|
|
60
54
|
options.outfile = outputFile;
|
|
61
|
-
|
|
55
|
+
context.log.debug("Bundling", (0, import_log.$p)(entryPoint), "into", (0, import_log.$p)(outputFile));
|
|
62
56
|
} else {
|
|
63
57
|
(0, import_assert.assert)(options.outdir, 'Option "outdir" must be specified');
|
|
64
|
-
builder =
|
|
58
|
+
builder = import_files.Files.builder(context.resolve(options.outdir));
|
|
65
59
|
options.outdir = builder.directory;
|
|
66
60
|
const message = options.bundle ? "Bundling" : "Transpiling";
|
|
67
|
-
|
|
61
|
+
context.log.debug(message, entryPoints.length, "files to", (0, import_log.$p)(builder.directory));
|
|
68
62
|
}
|
|
69
|
-
const report =
|
|
70
|
-
|
|
63
|
+
const report = context.log.report("ESBuild Report");
|
|
64
|
+
context.log.trace("Running ESBuild", options);
|
|
71
65
|
let esbuild;
|
|
72
66
|
try {
|
|
73
67
|
esbuild = await (0, import_esbuild.build)({ ...options, metafile: true });
|
|
74
|
-
|
|
68
|
+
context.log.trace("ESBuild Results", esbuild);
|
|
75
69
|
report.add(...esbuild.warnings.map((m) => convertMessage(import_log.WARN, m, absWorkingDir)));
|
|
76
70
|
report.add(...esbuild.errors.map((m) => convertMessage(import_log.ERROR, m, absWorkingDir)));
|
|
77
71
|
} catch (error) {
|
|
@@ -85,13 +79,13 @@ var ESBuild = class {
|
|
|
85
79
|
report.done();
|
|
86
80
|
(0, import_assert.assert)(esbuild, "ESBuild did not produce any result");
|
|
87
81
|
for (const file in esbuild.metafile.outputs) {
|
|
88
|
-
builder.
|
|
82
|
+
builder.add((0, import_paths.resolveAbsolutePath)(absWorkingDir, file));
|
|
89
83
|
}
|
|
90
84
|
const result = builder.build();
|
|
91
|
-
|
|
85
|
+
context.log.info("ESBuild produced", result.length, "files into", (0, import_log.$p)(result.directory));
|
|
92
86
|
return result;
|
|
93
87
|
}
|
|
94
|
-
};
|
|
88
|
+
});
|
|
95
89
|
function convertMessage(level, message, directory) {
|
|
96
90
|
const record = { level, message: message.text };
|
|
97
91
|
record.tags = [message.id, message.pluginName].filter((tag) => !!tag);
|
|
@@ -102,7 +96,6 @@ function convertMessage(level, message, directory) {
|
|
|
102
96
|
}
|
|
103
97
|
return record;
|
|
104
98
|
}
|
|
105
|
-
(0, import_pipe.install)("esbuild", ESBuild);
|
|
106
99
|
var _moduleFormatCache = /* @__PURE__ */ new Map();
|
|
107
100
|
async function _moduleFormat(directory, log) {
|
|
108
101
|
const type = _moduleFormatCache.get(directory);
|
|
@@ -131,8 +124,4 @@ async function _moduleFormat(directory, log) {
|
|
|
131
124
|
return type2;
|
|
132
125
|
}
|
|
133
126
|
}
|
|
134
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
135
|
-
0 && (module.exports = {
|
|
136
|
-
ESBuild
|
|
137
|
-
});
|
|
138
127
|
//# sourceMappingURL=esbuild.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/plugs/esbuild.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,qBAA0F;AAC1F,uBAAyB;AACzB,oBAAuB;AACvB,mBAAoC;AACpC,iBAAmE;AACnE,mBAAqE;AACrE,kBAAuD;AACvD,qBAAyB;AAIzB,4BAAc,wCAXd;AAYA,4BAAc,yCAZd;AAAA,IAiCA,qBAAQ,WAAW,MAAM,QAA+B;AAAA,EAEtD,YAA6B,UAA0B;AAA1B;AAAA,EAA2B;AAAA,EAExD,MAAM,KAAK,OAAc,SAAkC;AACzD,UAAM,cAAc,CAAE,GAAG,KAAM;AAC/B,UAAM,gBAAgB,MAAM;AAE5B,UAAM,UAAwB;AAAA,MAE5B,UAAU;AAAA,MACV,QAAQ,OAAO,QAAQ,SAAS,QAAQ,MAAM,GAAG,EAAE;AAAA,MAGnD,QAAQ,KAAK,SAAS,UAAU,MAAM,cAAc,MAAM,WAAW,QAA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,UAAUA,QAAO;AAC1E,uBAAmB,IAAI,WAAWA,KAAI;AACtC,WAAOA;AAAA,EACT,SAAS,OAAP;AAEA,QAAK,MAAM,SAAS,YAAc,MAAM,SAAS;AAAW,YAAM;AAAA,EACpE;AASA,QAAM,WAAO,2BAAS,SAAS;AAC/B,QAAM,aAAS,gCAAkB,SAAS;AAE1C,MAAK,SAAS,kBAAoB,WAAW,WAAY;AACvD,uBAAmB,IAAI,WAAW,KAAK;AACvC,WAAO;AAAA,EACT,OAAO;AAEL,UAAMA,QAAO,MAAM,cAAc,QAAQ,GAAG;AAC5C,uBAAmB,IAAI,WAAWA,KAAI;AACtC,WAAOA;AAAA,EACT;AACF;",
|
|
5
5
|
"names": ["type"]
|
|
6
6
|
}
|
package/dist/plugs/esbuild.d.ts
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
import { BuildOptions } from 'esbuild';
|
|
2
|
-
import { Files } from '../files.js';
|
|
3
|
-
import { Plug } from '../pipe.js';
|
|
4
|
-
import { Run } from '../run.js';
|
|
5
2
|
export declare type ESBuildOptions = Omit<BuildOptions, 'absWorkingDir' | 'entryPoints' | 'watch'>;
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
export declare class ESBuild implements Plug<Files> {
|
|
10
|
-
private readonly _options;
|
|
11
|
-
constructor(options: ESBuildOptions);
|
|
12
|
-
pipe(files: Files, run: Run): Promise<Files>;
|
|
13
|
-
}
|
|
14
|
-
declare module '../pipe.js' {
|
|
3
|
+
export * from './esbuild/bundle-locals';
|
|
4
|
+
export * from './esbuild/fix-extensions';
|
|
5
|
+
declare module '../pipe' {
|
|
15
6
|
interface Pipe {
|
|
16
7
|
/**
|
|
17
|
-
* Transpile and bundle
|
|
8
|
+
* Transpile and bundle with {@link https://esbuild.github.io/ esbuild}.
|
|
9
|
+
*
|
|
10
|
+
* For documentation on the _options_ to pass to _esbuild_ refer to its
|
|
11
|
+
* {@link https://esbuild.github.io/api/#build-api documentation}.
|
|
12
|
+
*
|
|
13
|
+
* @param options Build {@link ESBuildOptions | options} to pass to esbuild.
|
|
14
|
+
*
|
|
18
15
|
*/
|
|
19
|
-
esbuild:
|
|
16
|
+
esbuild(options: ESBuildOptions): Pipe;
|
|
20
17
|
}
|
|
21
18
|
}
|
|
22
|
-
export * from './esbuild/bundle-locals.js';
|
|
23
|
-
export * from './esbuild/fix-extensions.js';
|
package/dist/plugs/esbuild.mjs
CHANGED
|
@@ -2,23 +2,24 @@
|
|
|
2
2
|
import { build } from "esbuild";
|
|
3
3
|
import { basename } from "node:path";
|
|
4
4
|
import { assert } from "../assert.mjs";
|
|
5
|
+
import { Files } from "../files.mjs";
|
|
5
6
|
import { $p, ERROR, WARN } from "../log.mjs";
|
|
6
7
|
import { getAbsoluteParent, resolveAbsolutePath } from "../paths.mjs";
|
|
7
8
|
import { install } from "../pipe.mjs";
|
|
8
9
|
import { readFile } from "../utils/asyncfs.mjs";
|
|
9
10
|
export * from "./esbuild/bundle-locals.mjs";
|
|
10
11
|
export * from "./esbuild/fix-extensions.mjs";
|
|
11
|
-
|
|
12
|
+
install("esbuild", class ESBuild {
|
|
12
13
|
constructor(_options) {
|
|
13
14
|
this._options = _options;
|
|
14
15
|
}
|
|
15
|
-
async pipe(files,
|
|
16
|
+
async pipe(files, context) {
|
|
16
17
|
const entryPoints = [...files];
|
|
17
18
|
const absWorkingDir = files.directory;
|
|
18
19
|
const options = {
|
|
19
20
|
platform: "node",
|
|
20
21
|
target: `node${process.versions["node"].split(".")[0]}`,
|
|
21
|
-
format: this._options.format || await _moduleFormat(files.directory,
|
|
22
|
+
format: this._options.format || await _moduleFormat(files.directory, context.log),
|
|
22
23
|
outbase: absWorkingDir,
|
|
23
24
|
...this._options,
|
|
24
25
|
absWorkingDir,
|
|
@@ -29,24 +30,24 @@ var ESBuild = class {
|
|
|
29
30
|
assert(!(options.outdir && options.outfile), 'Options "outfile" and "outdir" can not coexist');
|
|
30
31
|
let builder;
|
|
31
32
|
if (options.bundle && options.outfile && entryPoints.length === 1) {
|
|
32
|
-
builder =
|
|
33
|
+
builder = Files.builder(absWorkingDir);
|
|
33
34
|
const outputFile = resolveAbsolutePath(absWorkingDir, options.outfile);
|
|
34
35
|
const entryPoint = resolveAbsolutePath(absWorkingDir, entryPoints[0]);
|
|
35
36
|
options.outfile = outputFile;
|
|
36
|
-
|
|
37
|
+
context.log.debug("Bundling", $p(entryPoint), "into", $p(outputFile));
|
|
37
38
|
} else {
|
|
38
39
|
assert(options.outdir, 'Option "outdir" must be specified');
|
|
39
|
-
builder =
|
|
40
|
+
builder = Files.builder(context.resolve(options.outdir));
|
|
40
41
|
options.outdir = builder.directory;
|
|
41
42
|
const message = options.bundle ? "Bundling" : "Transpiling";
|
|
42
|
-
|
|
43
|
+
context.log.debug(message, entryPoints.length, "files to", $p(builder.directory));
|
|
43
44
|
}
|
|
44
|
-
const report =
|
|
45
|
-
|
|
45
|
+
const report = context.log.report("ESBuild Report");
|
|
46
|
+
context.log.trace("Running ESBuild", options);
|
|
46
47
|
let esbuild;
|
|
47
48
|
try {
|
|
48
49
|
esbuild = await build({ ...options, metafile: true });
|
|
49
|
-
|
|
50
|
+
context.log.trace("ESBuild Results", esbuild);
|
|
50
51
|
report.add(...esbuild.warnings.map((m) => convertMessage(WARN, m, absWorkingDir)));
|
|
51
52
|
report.add(...esbuild.errors.map((m) => convertMessage(ERROR, m, absWorkingDir)));
|
|
52
53
|
} catch (error) {
|
|
@@ -60,13 +61,13 @@ var ESBuild = class {
|
|
|
60
61
|
report.done();
|
|
61
62
|
assert(esbuild, "ESBuild did not produce any result");
|
|
62
63
|
for (const file in esbuild.metafile.outputs) {
|
|
63
|
-
builder.
|
|
64
|
+
builder.add(resolveAbsolutePath(absWorkingDir, file));
|
|
64
65
|
}
|
|
65
66
|
const result = builder.build();
|
|
66
|
-
|
|
67
|
+
context.log.info("ESBuild produced", result.length, "files into", $p(result.directory));
|
|
67
68
|
return result;
|
|
68
69
|
}
|
|
69
|
-
};
|
|
70
|
+
});
|
|
70
71
|
function convertMessage(level, message, directory) {
|
|
71
72
|
const record = { level, message: message.text };
|
|
72
73
|
record.tags = [message.id, message.pluginName].filter((tag) => !!tag);
|
|
@@ -77,7 +78,6 @@ function convertMessage(level, message, directory) {
|
|
|
77
78
|
}
|
|
78
79
|
return record;
|
|
79
80
|
}
|
|
80
|
-
install("esbuild", ESBuild);
|
|
81
81
|
var _moduleFormatCache = /* @__PURE__ */ new Map();
|
|
82
82
|
async function _moduleFormat(directory, log) {
|
|
83
83
|
const type = _moduleFormatCache.get(directory);
|
|
@@ -106,7 +106,4 @@ async function _moduleFormat(directory, log) {
|
|
|
106
106
|
return type2;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
export {
|
|
110
|
-
ESBuild
|
|
111
|
-
};
|
|
112
109
|
//# sourceMappingURL=esbuild.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/plugs/esbuild.ts"],
|
|
4
|
-
"mappings": ";AAAA,SAAS,aAAiF;AAC1F,SAAS,gBAAgB;AACzB,SAAS,cAAc;
|
|
4
|
+
"mappings": ";AAAA,SAAS,aAAiF;AAC1F,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,SAAS,aAA2B;AACpC,SAAS,IAAI,OAA0C,YAAY;AACnE,SAAuB,mBAAmB,2BAA2B;AACrE,SAAS,eAA8C;AACvD,SAAS,gBAAgB;AAIzB,cAAc;AACd,cAAc;AAqBd,QAAQ,WAAW,MAAM,QAA+B;AAAA,EAEtD,YAA6B,UAA0B;AAA1B;AAAA,EAA2B;AAAA,EAExD,MAAM,KAAK,OAAc,SAAkC;AACzD,UAAM,cAAc,CAAE,GAAG,KAAM;AAC/B,UAAM,gBAAgB,MAAM;AAE5B,UAAM,UAAwB;AAAA,MAE5B,UAAU;AAAA,MACV,QAAQ,OAAO,QAAQ,SAAS,QAAQ,MAAM,GAAG,EAAE;AAAA,M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;AAC9C,QAAI,MAAM,SAAS,iCAAiC,KAAK,UAAUA,QAAO;AAC1E,uBAAmB,IAAI,WAAWA,KAAI;AACtC,WAAOA;AAAA,EACT,SAAS,OAAP;AAEA,QAAK,MAAM,SAAS,YAAc,MAAM,SAAS;AAAW,YAAM;AAAA,EACpE;AASA,QAAM,OAAO,SAAS,SAAS;AAC/B,QAAM,SAAS,kBAAkB,SAAS;AAE1C,MAAK,SAAS,kBAAoB,WAAW,WAAY;AACvD,uBAAmB,IAAI,WAAW,KAAK;AACvC,WAAO;AAAA,EACT,OAAO;AAEL,UAAMA,QAAO,MAAM,cAAc,QAAQ,GAAG;AAC5C,uBAAmB,IAAI,WAAWA,KAAI;AACtC,WAAOA;AAAA,EACT;AACF;",
|
|
5
5
|
"names": ["type"]
|
|
6
6
|
}
|
|
@@ -33,11 +33,11 @@ var ESLint = class {
|
|
|
33
33
|
constructor(arg = {}) {
|
|
34
34
|
this._options = typeof arg === "string" ? { configFile: arg } : arg;
|
|
35
35
|
}
|
|
36
|
-
async pipe(files,
|
|
36
|
+
async pipe(files, context) {
|
|
37
37
|
const { directory, configFile } = this._options;
|
|
38
|
-
const cwd = directory ?
|
|
38
|
+
const cwd = directory ? context.resolve(directory) : (0, import_paths.getCurrentWorkingDirectory)();
|
|
39
39
|
(0, import_assert.assert)((0, import_paths.resolveDirectory)(cwd), `ESLint directory ${(0, import_log.$p)(cwd)} does not exist`);
|
|
40
|
-
const overrideConfigFile = configFile ?
|
|
40
|
+
const overrideConfigFile = configFile ? context.resolve(configFile) : void 0;
|
|
41
41
|
if (overrideConfigFile) {
|
|
42
42
|
(0, import_assert.assert)((0, import_paths.resolveFile)(overrideConfigFile), `ESLint configuration ${(0, import_log.$p)(overrideConfigFile)} does not exist`);
|
|
43
43
|
}
|
|
@@ -50,7 +50,7 @@ var ESLint = class {
|
|
|
50
50
|
const settlements = await Promise.allSettled(promises);
|
|
51
51
|
const summary = settlements.reduce((summary2, settlement, i) => {
|
|
52
52
|
if (settlement.status === "rejected") {
|
|
53
|
-
|
|
53
|
+
context.log.error("Error linting", (0, import_log.$p)(paths[i]), settlement.reason);
|
|
54
54
|
summary2.failures++;
|
|
55
55
|
return summary2;
|
|
56
56
|
}
|
|
@@ -63,7 +63,7 @@ var ESLint = class {
|
|
|
63
63
|
const { results, failures } = summary;
|
|
64
64
|
if (failures)
|
|
65
65
|
throw (0, import_assert.failure)();
|
|
66
|
-
const report =
|
|
66
|
+
const report = context.log.report("ESLint Report");
|
|
67
67
|
for (const result of results) {
|
|
68
68
|
const { filePath, source, messages } = result;
|
|
69
69
|
const file = (0, import_paths.resolveAbsolutePath)((0, import_paths.getCurrentWorkingDirectory)(), filePath);
|
|
@@ -83,7 +83,6 @@ var ESLint = class {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
report.done(this._options.showSources);
|
|
86
|
-
return void 0;
|
|
87
86
|
}
|
|
88
87
|
};
|
|
89
88
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugs/eslint/runner.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAqC;AACrC,oBAAgC;AAEhC,iBAAwC;AACxC,mBAA+F;
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAqC;AACrC,oBAAgC;AAEhC,iBAAwC;AACxC,mBAA+F;AAE/F,qBAAyB;AAIzB,IAAqB,SAArB,MAAkD;AAAA,EAC/B;AAAA,EAGjB,YAAY,MAA8B,CAAC,GAAG;AAC5C,SAAK,WAAW,OAAO,QAAQ,WAAW,EAAE,YAAY,IAAI,IAAI;AAAA,EAClE;AAAA,EAEA,MAAM,KAAK,OAAc,SAAiC;AACxD,UAAM,EAAE,WAAW,WAAW,IAAI,KAAK;AA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A,QAAQ;AAAA,UACR;AAAA,UACA;AAAA,UACA,UAAU;AAAA,UACV,YAAY,SAAS;AAAA,QACvB,IAAI;AAGJ,cAAM,QAAQ,aAAa,IAAI,oBAAS,aAAa,IAAI,kBAAO;AAGhE,cAAM,SAAS,YAAY,OAAO,YAAY,SAAS,UAAU,OAAO,KAAK;AAG7E,eAAO,IAAI,EAAE,OAAO,SAAS,MAAM,MAAM,QAAQ,QAAQ,MAAM,OAAO,CAAC;AAAA,MACzE;AAAA,IACF;AAGA,WAAO,KAAK,KAAK,SAAS,WAAW;AAAA,EACvC;AACF;",
|
|
5
5
|
"names": ["RealESLint", "summary"]
|
|
6
6
|
}
|
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
import { Files } from '../../files
|
|
2
|
-
import { Plug } from '../../pipe
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
/** ESLint's own _current working directory_, where config files are. */
|
|
6
|
-
directory?: string;
|
|
7
|
-
/** Show sources in report? */
|
|
8
|
-
showSources?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* ESLint's _override_ configuration file: configurations specified in this
|
|
11
|
-
* file will override any other configuration specified elsewhere.
|
|
12
|
-
*/
|
|
13
|
-
configFile?: string;
|
|
14
|
-
}
|
|
15
|
-
/** Writes some info about the current {@link Files} being passed around. */
|
|
16
|
-
export default class ESLint implements Plug<undefined> {
|
|
1
|
+
import { Files } from '../../files';
|
|
2
|
+
import { PipeParameters, Plug, Context } from '../../pipe';
|
|
3
|
+
/** Runner implementation for the `ESLint` plug. */
|
|
4
|
+
export default class ESLint implements Plug<void> {
|
|
17
5
|
private readonly _options;
|
|
18
|
-
constructor();
|
|
19
|
-
|
|
20
|
-
constructor(options: ESLintOptions);
|
|
21
|
-
pipe(files: Files, run: Run): Promise<undefined>;
|
|
6
|
+
constructor(...arg: PipeParameters<'eslint'>);
|
|
7
|
+
pipe(files: Files, context: Context): Promise<void>;
|
|
22
8
|
}
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
import { ESLint as RealESLint } from "eslint";
|
|
3
3
|
import { assert, failure } from "../../assert.mjs";
|
|
4
4
|
import { $p, ERROR, NOTICE, WARN } from "../../log.mjs";
|
|
5
|
-
import { getCurrentWorkingDirectory, resolveDirectory, resolveFile
|
|
5
|
+
import { getCurrentWorkingDirectory, resolveAbsolutePath, resolveDirectory, resolveFile } from "../../paths.mjs";
|
|
6
6
|
import { readFile } from "../../utils/asyncfs.mjs";
|
|
7
7
|
var ESLint = class {
|
|
8
8
|
_options;
|
|
9
9
|
constructor(arg = {}) {
|
|
10
10
|
this._options = typeof arg === "string" ? { configFile: arg } : arg;
|
|
11
11
|
}
|
|
12
|
-
async pipe(files,
|
|
12
|
+
async pipe(files, context) {
|
|
13
13
|
const { directory, configFile } = this._options;
|
|
14
|
-
const cwd = directory ?
|
|
14
|
+
const cwd = directory ? context.resolve(directory) : getCurrentWorkingDirectory();
|
|
15
15
|
assert(resolveDirectory(cwd), `ESLint directory ${$p(cwd)} does not exist`);
|
|
16
|
-
const overrideConfigFile = configFile ?
|
|
16
|
+
const overrideConfigFile = configFile ? context.resolve(configFile) : void 0;
|
|
17
17
|
if (overrideConfigFile) {
|
|
18
18
|
assert(resolveFile(overrideConfigFile), `ESLint configuration ${$p(overrideConfigFile)} does not exist`);
|
|
19
19
|
}
|
|
@@ -26,7 +26,7 @@ var ESLint = class {
|
|
|
26
26
|
const settlements = await Promise.allSettled(promises);
|
|
27
27
|
const summary = settlements.reduce((summary2, settlement, i) => {
|
|
28
28
|
if (settlement.status === "rejected") {
|
|
29
|
-
|
|
29
|
+
context.log.error("Error linting", $p(paths[i]), settlement.reason);
|
|
30
30
|
summary2.failures++;
|
|
31
31
|
return summary2;
|
|
32
32
|
}
|
|
@@ -39,7 +39,7 @@ var ESLint = class {
|
|
|
39
39
|
const { results, failures } = summary;
|
|
40
40
|
if (failures)
|
|
41
41
|
throw failure();
|
|
42
|
-
const report =
|
|
42
|
+
const report = context.log.report("ESLint Report");
|
|
43
43
|
for (const result of results) {
|
|
44
44
|
const { filePath, source, messages } = result;
|
|
45
45
|
const file = resolveAbsolutePath(getCurrentWorkingDirectory(), filePath);
|
|
@@ -59,7 +59,6 @@ var ESLint = class {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
report.done(this._options.showSources);
|
|
62
|
-
return void 0;
|
|
63
62
|
}
|
|
64
63
|
};
|
|
65
64
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugs/eslint/runner.ts"],
|
|
4
|
-
"mappings": ";AAAA,SAAS,UAAU,kBAAkB;AACrC,SAAS,QAAQ,eAAe;AAEhC,SAAS,IAAI,OAAO,QAAQ,YAAY;AACxC,SAAS,4BAA4B,kBAAkB,
|
|
4
|
+
"mappings": ";AAAA,SAAS,UAAU,kBAAkB;AACrC,SAAS,QAAQ,eAAe;AAEhC,SAAS,IAAI,OAAO,QAAQ,YAAY;AACxC,SAAS,4BAA4B,qBAAqB,kBAAkB,mBAAmB;AAE/F,SAAS,gBAAgB;AAIzB,IAAqB,SAArB,MAAkD;AAAA,EAC/B;AAAA,EAGjB,YAAY,MAA8B,CAAC,GAAG;AAC5C,SAAK,WAAW,OAAO,QAAQ,WAAW,EAAE,YAAY,IAAI,IAAI;AAAA,EAClE;AAAA,EAEA,MAAM,KAAK,OAAc,SAAiC;AACxD,UAAM,EAAE,WAAW,WAAW,IAAI,KAAK;AAEvC,UAAM,MAAM,YAAY,QAAQ,QAAQ,SAAS,IAAI,2BAA2B;AAChF,WAAO,iBAAiB,GAAG,GAAG,oBAAoB,GAAG,GAAG,kBAAkB;AAE1E,UAAM,qBAAqB,aAAa,QAAQ,QAAQ,UAAU,IAAI;AACtE,QAAI,oBAAoB;AACtB,aAAO,YAAY,kBAAkB,GAAG,wBAAwB,GAAG,kBAAkB,kBAAkB;AAAA,IACzG;AAGA,UAAM,SAAS,IAAI,WAAW,EAAE,oBAAoB,IA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AAK,SAAS,WAAW;AAAA,EACvC;AACF;",
|
|
5
5
|
"names": ["summary"]
|
|
6
6
|
}
|
|
@@ -3,10 +3,6 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
6
|
var __copyProps = (to, from, except, desc) => {
|
|
11
7
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
8
|
for (let key of __getOwnPropNames(from))
|
|
@@ -17,23 +13,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
13
|
};
|
|
18
14
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
15
|
|
|
20
|
-
//
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
constructor(context, _definition) {
|
|
28
|
-
this.context = context;
|
|
29
|
-
this._definition = _definition;
|
|
30
|
-
}
|
|
31
|
-
async call(self, run) {
|
|
32
|
-
return await this._definition.call(self, self, run) || void 0;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
-
0 && (module.exports = {
|
|
37
|
-
TaskImpl
|
|
38
|
-
});
|
|
39
|
-
//# sourceMappingURL=task.cjs.map
|
|
16
|
+
// plugs/eslint.ts
|
|
17
|
+
var eslint_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(eslint_exports);
|
|
19
|
+
var import_paths = require("../paths.cjs");
|
|
20
|
+
var import_pipe = require("../pipe.cjs");
|
|
21
|
+
(0, import_pipe.installForking)("eslint", (0, import_paths.requireResolve)(__filename, "./eslint/runner"));
|
|
22
|
+
//# sourceMappingURL=eslint.cjs.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface ESLintOptions {
|
|
2
|
+
/** ESLint's own _current working directory_, where config files are. */
|
|
3
|
+
directory?: string;
|
|
4
|
+
/** Show sources in report? */
|
|
5
|
+
showSources?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* ESLint's _override_ configuration file: configurations specified in this
|
|
8
|
+
* file will override any other configuration specified elsewhere.
|
|
9
|
+
*/
|
|
10
|
+
configFile?: string;
|
|
11
|
+
}
|
|
12
|
+
declare module '../pipe' {
|
|
13
|
+
interface Pipe {
|
|
14
|
+
/**
|
|
15
|
+
* Run {@link https://eslint.org/ _ESlint_} over the input source files,
|
|
16
|
+
* using the configuration from the local `.eslintrc.*` file.
|
|
17
|
+
*/
|
|
18
|
+
eslint(): Promise<undefined>;
|
|
19
|
+
/**
|
|
20
|
+
* Run {@link https://eslint.org/ _ESlint_} over the input source files,
|
|
21
|
+
* using the configuration from the specified `configFile` (this wil
|
|
22
|
+
* override any `.eslintrc.*` file).
|
|
23
|
+
*
|
|
24
|
+
* @param configFile The configuration file to use
|
|
25
|
+
*/
|
|
26
|
+
eslint(configFile: string): Promise<undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* Run {@link https://eslint.org/ _ESlint_} over the input source files..
|
|
29
|
+
*
|
|
30
|
+
* @param options {@link ESLintOptions | Options} to pass to _ESLint_
|
|
31
|
+
*/
|
|
32
|
+
eslint(options: ESLintOptions): Promise<undefined>;
|
|
33
|
+
}
|
|
34
|
+
}
|