@plugjs/plug 0.0.15 → 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/build.cjs +10 -41
- package/dist/build.cjs.map +1 -1
- package/dist/build.d.ts +4 -2
- package/dist/build.mjs +11 -42
- package/dist/build.mjs.map +1 -1
- package/dist/helpers.cjs +7 -39
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.ts +23 -3
- package/dist/helpers.mjs +7 -39
- package/dist/helpers.mjs.map +1 -1
- package/dist/index.cjs +12 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +4 -0
- package/dist/index.mjs.map +1 -1
- package/dist/pipe.cjs +38 -2
- package/dist/pipe.cjs.map +1 -1
- package/dist/pipe.d.ts +38 -9
- package/dist/pipe.mjs +44 -3
- package/dist/pipe.mjs.map +1 -1
- package/dist/plugs/copy.cjs +1 -1
- package/dist/plugs/copy.cjs.map +1 -1
- package/dist/plugs/copy.mjs +1 -1
- package/dist/plugs/copy.mjs.map +1 -1
- package/dist/plugs/coverage.cjs +1 -1
- package/dist/plugs/coverage.cjs.map +1 -1
- package/dist/plugs/coverage.mjs +1 -1
- package/dist/plugs/coverage.mjs.map +1 -1
- package/dist/plugs/debug.cjs +6 -1
- package/dist/plugs/debug.cjs.map +1 -1
- package/dist/plugs/debug.d.ts +1 -1
- package/dist/plugs/debug.mjs +7 -2
- package/dist/plugs/debug.mjs.map +1 -1
- package/dist/types.d.ts +5 -6
- package/package.json +8 -9
- package/src/helpers.ts +34 -55
- package/src/index.ts +1 -1
- package/src/pipe.ts +83 -11
- package/src/plugs/copy.ts +1 -1
- package/src/plugs/debug.ts +11 -4
- package/src/types.ts +5 -12
package/dist/build.cjs
CHANGED
|
@@ -31,12 +31,12 @@ var import_pipe = require("./pipe.cjs");
|
|
|
31
31
|
var import_caller = require("./utils/caller.cjs");
|
|
32
32
|
var import_options = require("./utils/options.cjs");
|
|
33
33
|
var PipeImpl = class extends import_pipe.Pipe {
|
|
34
|
-
constructor(
|
|
35
|
-
super()
|
|
34
|
+
constructor(context, _promise) {
|
|
35
|
+
super(context, () => _promise.then((result) => {
|
|
36
|
+
(0, import_assert.assert)(result, "Unable to extend pipe");
|
|
37
|
+
return result;
|
|
38
|
+
}));
|
|
36
39
|
this._promise = _promise;
|
|
37
|
-
this._promises = _promises;
|
|
38
|
-
this._context = _context;
|
|
39
|
-
_promises.add(_promise);
|
|
40
40
|
}
|
|
41
41
|
[Symbol.toStringTag] = "PipeImpl";
|
|
42
42
|
then(onfulfilled, onrejected) {
|
|
@@ -48,22 +48,6 @@ var PipeImpl = class extends import_pipe.Pipe {
|
|
|
48
48
|
finally(onfinally) {
|
|
49
49
|
return this._promise.finally(onfinally);
|
|
50
50
|
}
|
|
51
|
-
plug(arg) {
|
|
52
|
-
const plug = typeof arg === "function" ? { pipe: arg } : arg;
|
|
53
|
-
const promise = this._promise.then(async (files) => {
|
|
54
|
-
(0, import_assert.assert)(files, "Unable to extend Pipe");
|
|
55
|
-
const result = await plug.pipe(files, this._context);
|
|
56
|
-
(0, import_assert.assert)(result, "Plug did not return a Files instance");
|
|
57
|
-
return result;
|
|
58
|
-
});
|
|
59
|
-
return new PipeImpl(promise, this._promises, this._context);
|
|
60
|
-
}
|
|
61
|
-
async run() {
|
|
62
|
-
return this._promise.then((whaps) => {
|
|
63
|
-
(0, import_assert.assert)(whaps, "Unable to run Pipe");
|
|
64
|
-
return whaps;
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
51
|
};
|
|
68
52
|
var TaskImpl = class {
|
|
69
53
|
constructor(buildFile, tasks, props, _def) {
|
|
@@ -81,7 +65,6 @@ var TaskImpl = class {
|
|
|
81
65
|
const tasks = Object.assign({}, this.tasks, state.tasks);
|
|
82
66
|
const stack = [...state.stack, this];
|
|
83
67
|
const cache = state.cache;
|
|
84
|
-
const promises = /* @__PURE__ */ new Set();
|
|
85
68
|
const context = new import_pipe.Context(this.buildFile, taskName);
|
|
86
69
|
const build2 = new Proxy({}, {
|
|
87
70
|
get(_, name) {
|
|
@@ -89,7 +72,7 @@ var TaskImpl = class {
|
|
|
89
72
|
return () => {
|
|
90
73
|
const state2 = { stack, cache, tasks, props };
|
|
91
74
|
const promise2 = tasks[name].call(state2, name);
|
|
92
|
-
return new PipeImpl(
|
|
75
|
+
return new PipeImpl(context, promise2);
|
|
93
76
|
};
|
|
94
77
|
} else if (name in props) {
|
|
95
78
|
return props[name];
|
|
@@ -99,24 +82,10 @@ var TaskImpl = class {
|
|
|
99
82
|
context.log.info("Running...");
|
|
100
83
|
const now = Date.now();
|
|
101
84
|
const promise = (0, import_async.runAsync)(context, taskName, async () => {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return result || void 0;
|
|
107
|
-
} finally {
|
|
108
|
-
const settlements = await Promise.allSettled([...promises]);
|
|
109
|
-
const errors = /* @__PURE__ */ new Set();
|
|
110
|
-
for (const settlement of settlements) {
|
|
111
|
-
if (settlement.status === "fulfilled")
|
|
112
|
-
continue;
|
|
113
|
-
if (!(0, import_assert.isBuildFailure)(settlement.reason)) {
|
|
114
|
-
errors.add(settlement.reason);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
for (const error of errors)
|
|
118
|
-
context.log.error(error);
|
|
119
|
-
}
|
|
85
|
+
let result = await this._def.call(build2);
|
|
86
|
+
if (result && "run" in result)
|
|
87
|
+
result = await result.run();
|
|
88
|
+
return result || void 0;
|
|
120
89
|
}).then((result) => {
|
|
121
90
|
context.log.notice(`Success ${(0, import_log.$ms)(Date.now() - now)}`);
|
|
122
91
|
return result;
|
package/dist/build.cjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/build.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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5
|
"names": ["build", "state", "promise", "call"]
|
|
6
6
|
}
|
package/dist/build.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type { Build, BuildDef,
|
|
1
|
+
import type { Build, BuildDef, Task, ThisBuild } from './types';
|
|
2
2
|
/** Compile a {@link BuildDef | build definition} into a {@link Build} */
|
|
3
3
|
export declare function build<D extends BuildDef, B extends ThisBuild<D>>(def: D & ThisType<B>): Build<D>;
|
|
4
4
|
/** Internal type identifying all _task names_ in a {@link Build} */
|
|
5
|
-
declare type TaskNames<B extends Build> = string & keyof
|
|
5
|
+
declare type TaskNames<B extends Build> = string & keyof {
|
|
6
|
+
[k in keyof B as B[k] extends Task ? k : never]?: B[k];
|
|
7
|
+
};
|
|
6
8
|
/** Internal type identifying all _property names_ in a {@link Build} */
|
|
7
9
|
declare type OverrideProps<B extends Build> = {
|
|
8
10
|
[k in keyof B as B[k] extends string ? k : never]?: string;
|
package/dist/build.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// build.ts
|
|
2
|
-
import { assert, fail, failure
|
|
2
|
+
import { assert, fail, failure } from "./assert.mjs";
|
|
3
3
|
import { runAsync } from "./async.mjs";
|
|
4
4
|
import { $ms, $t, getLogger, logOptions } from "./log.mjs";
|
|
5
5
|
import { Context, Pipe } from "./pipe.mjs";
|
|
6
6
|
import { findCaller } from "./utils/caller.mjs";
|
|
7
7
|
import { parseOptions } from "./utils/options.mjs";
|
|
8
8
|
var PipeImpl = class extends Pipe {
|
|
9
|
-
constructor(
|
|
10
|
-
super()
|
|
9
|
+
constructor(context, _promise) {
|
|
10
|
+
super(context, () => _promise.then((result) => {
|
|
11
|
+
assert(result, "Unable to extend pipe");
|
|
12
|
+
return result;
|
|
13
|
+
}));
|
|
11
14
|
this._promise = _promise;
|
|
12
|
-
this._promises = _promises;
|
|
13
|
-
this._context = _context;
|
|
14
|
-
_promises.add(_promise);
|
|
15
15
|
}
|
|
16
16
|
[Symbol.toStringTag] = "PipeImpl";
|
|
17
17
|
then(onfulfilled, onrejected) {
|
|
@@ -23,22 +23,6 @@ var PipeImpl = class extends Pipe {
|
|
|
23
23
|
finally(onfinally) {
|
|
24
24
|
return this._promise.finally(onfinally);
|
|
25
25
|
}
|
|
26
|
-
plug(arg) {
|
|
27
|
-
const plug = typeof arg === "function" ? { pipe: arg } : arg;
|
|
28
|
-
const promise = this._promise.then(async (files) => {
|
|
29
|
-
assert(files, "Unable to extend Pipe");
|
|
30
|
-
const result = await plug.pipe(files, this._context);
|
|
31
|
-
assert(result, "Plug did not return a Files instance");
|
|
32
|
-
return result;
|
|
33
|
-
});
|
|
34
|
-
return new PipeImpl(promise, this._promises, this._context);
|
|
35
|
-
}
|
|
36
|
-
async run() {
|
|
37
|
-
return this._promise.then((whaps) => {
|
|
38
|
-
assert(whaps, "Unable to run Pipe");
|
|
39
|
-
return whaps;
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
26
|
};
|
|
43
27
|
var TaskImpl = class {
|
|
44
28
|
constructor(buildFile, tasks, props, _def) {
|
|
@@ -56,7 +40,6 @@ var TaskImpl = class {
|
|
|
56
40
|
const tasks = Object.assign({}, this.tasks, state.tasks);
|
|
57
41
|
const stack = [...state.stack, this];
|
|
58
42
|
const cache = state.cache;
|
|
59
|
-
const promises = /* @__PURE__ */ new Set();
|
|
60
43
|
const context = new Context(this.buildFile, taskName);
|
|
61
44
|
const build2 = new Proxy({}, {
|
|
62
45
|
get(_, name) {
|
|
@@ -64,7 +47,7 @@ var TaskImpl = class {
|
|
|
64
47
|
return () => {
|
|
65
48
|
const state2 = { stack, cache, tasks, props };
|
|
66
49
|
const promise2 = tasks[name].call(state2, name);
|
|
67
|
-
return new PipeImpl(
|
|
50
|
+
return new PipeImpl(context, promise2);
|
|
68
51
|
};
|
|
69
52
|
} else if (name in props) {
|
|
70
53
|
return props[name];
|
|
@@ -74,24 +57,10 @@ var TaskImpl = class {
|
|
|
74
57
|
context.log.info("Running...");
|
|
75
58
|
const now = Date.now();
|
|
76
59
|
const promise = runAsync(context, taskName, async () => {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return result || void 0;
|
|
82
|
-
} finally {
|
|
83
|
-
const settlements = await Promise.allSettled([...promises]);
|
|
84
|
-
const errors = /* @__PURE__ */ new Set();
|
|
85
|
-
for (const settlement of settlements) {
|
|
86
|
-
if (settlement.status === "fulfilled")
|
|
87
|
-
continue;
|
|
88
|
-
if (!isBuildFailure(settlement.reason)) {
|
|
89
|
-
errors.add(settlement.reason);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
for (const error of errors)
|
|
93
|
-
context.log.error(error);
|
|
94
|
-
}
|
|
60
|
+
let result = await this._def.call(build2);
|
|
61
|
+
if (result && "run" in result)
|
|
62
|
+
result = await result.run();
|
|
63
|
+
return result || void 0;
|
|
95
64
|
}).then((result) => {
|
|
96
65
|
context.log.notice(`Success ${$ms(Date.now() - now)}`);
|
|
97
66
|
return result;
|
package/dist/build.mjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/build.ts"],
|
|
4
|
-
"mappings": ";AAYA,SAAS,QAAQ,MAAM,
|
|
4
|
+
"mappings": ";AAYA,SAAS,QAAQ,MAAM,eAAe;AACtC,SAAS,gBAAgB;AACzB,SAAS,KAAK,IAAI,WAAW,kBAAkB;AAE/C,SAAS,SAAS,YAAY;AAC9B,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAM7B,IAAM,WAAN,cAAuB,KAAgC;AAAA,EAGrD,YAAY,SAAmC,UAA2B;AACxE,UAAM,SAAS,MAAM,SAAS,KAAK,CAAC,WAAW;AAC7C,aAAO,QAAQ,uBAAuB;AACtC,aAAO;AAAA,IACT,CAAC,CAAC;AAJ2C;AAAA,EAK/C;AAAA,EAPA,CAAU,OAAO,eAAe;AAAA,EAahC,KACI,aACA,YACgB;AAClB,WAAO,KA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M,KAAK,IAAI;AAErB,QAAI;AAEF,iBAAW,YAAY,WAAW;AAChC,YAAI,YAAY,OAAO;AACrB,gBAAM,MAAM,UAAU,KAAK,OAAO,QAAQ;AAAA,QAC5C,OAAO;AACL,eAAK,QAAQ,GAAG,QAAQ,sBAAsB;AAAA,QAChD;AAAA,MACF;AACA,aAAO,OAAO,oBAAoB,IAAI,KAAK,IAAI,IAAI,GAAG,GAAG;AAAA,IAC3D,SAAS,OAAP;AACA,aAAO,MAAM,gBAAgB,IAAI,KAAK,IAAI,IAAI,GAAG,KAAK,KAAK;AAC3D,YAAM,QAAQ;AAAA,IAChB;AAAA,EACF;AAGA,QAAM,WAAW,OAAO,OAAO,CAAC,GAAG,OAAO,KAAK;AAG/C,SAAO,eAAe,UAAU,aAAa,EAAE,OAAOA,MAAK,CAAC;AAG5D,SAAO;AACT;AAgBO,SAAS,KACZH,WACG,MAGU;AACf,QAAM,EAAE,QAAQ,OAAO,SAAS,MAAM,IAAI,aAAa,MAAM,CAAC,CAAC;AAG/D,QAAMG,QAAmBH,OAAc;AAGvC,MAAI,OAAOG,UAAS;AAAY,SAAK,oBAAoB;AAGzD,SAAOA,MAAK,OAAO,KAAK;AAC1B;",
|
|
5
5
|
"names": ["build", "state", "promise", "call"]
|
|
6
6
|
}
|
package/dist/helpers.cjs
CHANGED
|
@@ -23,7 +23,7 @@ __export(helpers_exports, {
|
|
|
23
23
|
find: () => find,
|
|
24
24
|
isDirectory: () => isDirectory,
|
|
25
25
|
isFile: () => isFile,
|
|
26
|
-
|
|
26
|
+
resolve: () => resolve,
|
|
27
27
|
rmrf: () => rmrf
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(helpers_exports);
|
|
@@ -36,28 +36,10 @@ var import_pipe = require("./pipe.cjs");
|
|
|
36
36
|
var import_asyncfs = require("./utils/asyncfs.cjs");
|
|
37
37
|
var import_options = require("./utils/options.cjs");
|
|
38
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
39
|
function find(...args) {
|
|
59
40
|
const { params: globs, options } = (0, import_options.parseOptions)(args, {});
|
|
60
|
-
|
|
41
|
+
const context = (0, import_async.requireContext)();
|
|
42
|
+
return new import_pipe.Pipe(context, async () => {
|
|
61
43
|
const directory = options.directory ? context.resolve(options.directory) : (0, import_paths.getCurrentWorkingDirectory)();
|
|
62
44
|
const builder = import_files.Files.builder(directory);
|
|
63
45
|
for await (const file of (0, import_walk.walk)(directory, globs, options)) {
|
|
@@ -66,23 +48,6 @@ function find(...args) {
|
|
|
66
48
|
return builder.build();
|
|
67
49
|
});
|
|
68
50
|
}
|
|
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
|
-
}
|
|
86
51
|
async function rmrf(directory) {
|
|
87
52
|
const context = (0, import_async.requireContext)();
|
|
88
53
|
const dir = context.resolve(directory);
|
|
@@ -101,6 +66,9 @@ async function rmrf(directory) {
|
|
|
101
66
|
import_log.log.notice("Removing directory", (0, import_log.$p)(dir), "recursively");
|
|
102
67
|
await (0, import_asyncfs.rm)(dir, { recursive: true });
|
|
103
68
|
}
|
|
69
|
+
function resolve(...paths) {
|
|
70
|
+
return (0, import_async.requireContext)().resolve(...paths);
|
|
71
|
+
}
|
|
104
72
|
function isFile(...paths) {
|
|
105
73
|
const path = (0, import_async.requireContext)().resolve(...paths);
|
|
106
74
|
return (0, import_paths.resolveFile)(path);
|
|
@@ -114,7 +82,7 @@ function isDirectory(...paths) {
|
|
|
114
82
|
find,
|
|
115
83
|
isDirectory,
|
|
116
84
|
isFile,
|
|
117
|
-
|
|
85
|
+
resolve,
|
|
118
86
|
rmrf
|
|
119
87
|
});
|
|
120
88
|
//# 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,oBAAuB;AACvB,mBAA+B;AAC/B,mBAAsB;AACtB,iBAAwB;AACxB,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB;AACvB,mBAA+B;AAC/B,mBAAsB;AACtB,iBAAwB;AACxB,mBAAwF;AACxF,kBAAqB;AACrB,qBAAmB;AACnB,qBAA2C;AAC3C,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
}
|
package/dist/helpers.d.ts
CHANGED
|
@@ -6,16 +6,36 @@ export interface FindOptions extends WalkOptions {
|
|
|
6
6
|
/** The directory where to start looking for files. */
|
|
7
7
|
directory?: string;
|
|
8
8
|
}
|
|
9
|
+
/** Find files in the current directory using the specified _glob_. */
|
|
9
10
|
export declare function find(glob: string): Pipe;
|
|
11
|
+
/** Find files in the current directory using the specified _globs_. */
|
|
10
12
|
export declare function find(glob: string, ...globs: string[]): Pipe;
|
|
13
|
+
/** Find files using the specified _glob_ and {@link FindOptions | options}. */
|
|
11
14
|
export declare function find(glob: string, options: FindOptions): Pipe;
|
|
15
|
+
/** Find files using the specified _globs_ and {@link FindOptions | options}. */
|
|
12
16
|
export declare function find(glob: string, ...extra: [...globs: string[], options: FindOptions]): Pipe;
|
|
13
|
-
export declare function merge(...pipes: Pipe[]): Pipe;
|
|
14
17
|
/**
|
|
15
18
|
* Recursively remove the specified directory _**(use with care)**_.
|
|
16
19
|
*/
|
|
17
20
|
export declare function rmrf(directory: string): Promise<void>;
|
|
18
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Resolve a (set of) path(s) into an {@link AbsolutePath}.
|
|
23
|
+
*
|
|
24
|
+
* If the path (or first component thereof) starts with `@...`, then the
|
|
25
|
+
* resolved path will be relative to the directory containing the build file
|
|
26
|
+
* where the current task was defined, otherwise it will be relative to the
|
|
27
|
+
* current working directory.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolve(...paths: [string, ...string[]]): AbsolutePath;
|
|
30
|
+
/**
|
|
31
|
+
* Return an absolute path of the file if it exist on disk.
|
|
32
|
+
*
|
|
33
|
+
* See the comments on {@link resolve} to understand how paths are resolved.
|
|
34
|
+
*/
|
|
19
35
|
export declare function isFile(...paths: [string, ...string[]]): AbsolutePath | undefined;
|
|
20
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Return an absolute path of the directory if it exist on disk.
|
|
38
|
+
*
|
|
39
|
+
* See the comments on {@link resolve} to understand how paths are resolved.
|
|
40
|
+
*/
|
|
21
41
|
export declare function isDirectory(...paths: [string, ...string[]]): AbsolutePath | undefined;
|
package/dist/helpers.mjs
CHANGED
|
@@ -3,33 +3,15 @@ import { assert } from "./assert.mjs";
|
|
|
3
3
|
import { requireContext } from "./async.mjs";
|
|
4
4
|
import { Files } from "./files.mjs";
|
|
5
5
|
import { $p, log } from "./log.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { getCurrentWorkingDirectory, resolveDirectory, resolveFile } from "./paths.mjs";
|
|
7
7
|
import { Pipe } from "./pipe.mjs";
|
|
8
8
|
import { rm } from "./utils/asyncfs.mjs";
|
|
9
9
|
import { parseOptions } from "./utils/options.mjs";
|
|
10
10
|
import { walk } from "./utils/walk.mjs";
|
|
11
|
-
var PipeImpl = class extends Pipe {
|
|
12
|
-
constructor(_start) {
|
|
13
|
-
super();
|
|
14
|
-
this._start = _start;
|
|
15
|
-
}
|
|
16
|
-
plug(arg) {
|
|
17
|
-
const plug = typeof arg === "function" ? { pipe: arg } : arg;
|
|
18
|
-
const parent = this;
|
|
19
|
-
return new PipeImpl(async (context) => {
|
|
20
|
-
const files = await parent._start(context);
|
|
21
|
-
const files2 = await plug.pipe(files, context);
|
|
22
|
-
assert(files2, "Unable to extend pipe (part tres)");
|
|
23
|
-
return files2;
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
async run() {
|
|
27
|
-
return this._start(requireContext());
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
11
|
function find(...args) {
|
|
31
12
|
const { params: globs, options } = parseOptions(args, {});
|
|
32
|
-
|
|
13
|
+
const context = requireContext();
|
|
14
|
+
return new Pipe(context, async () => {
|
|
33
15
|
const directory = options.directory ? context.resolve(options.directory) : getCurrentWorkingDirectory();
|
|
34
16
|
const builder = Files.builder(directory);
|
|
35
17
|
for await (const file of walk(directory, globs, options)) {
|
|
@@ -38,23 +20,6 @@ function find(...args) {
|
|
|
38
20
|
return builder.build();
|
|
39
21
|
});
|
|
40
22
|
}
|
|
41
|
-
function merge(...pipes) {
|
|
42
|
-
return new PipeImpl(async () => {
|
|
43
|
-
if (pipes.length === 0)
|
|
44
|
-
return Files.builder(getCurrentWorkingDirectory()).build();
|
|
45
|
-
const results = [];
|
|
46
|
-
for (const pipe of pipes) {
|
|
47
|
-
const result = await pipe.run();
|
|
48
|
-
assert(result, "Pipe did not return a Files result");
|
|
49
|
-
results.push(result);
|
|
50
|
-
}
|
|
51
|
-
const [first, ...others] = results;
|
|
52
|
-
const firstDir = first.directory;
|
|
53
|
-
const otherDirs = others.map((f) => f.directory);
|
|
54
|
-
const directory = commonPath(firstDir, ...otherDirs);
|
|
55
|
-
return Files.builder(directory).merge(first, ...others).build();
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
23
|
async function rmrf(directory) {
|
|
59
24
|
const context = requireContext();
|
|
60
25
|
const dir = context.resolve(directory);
|
|
@@ -73,6 +38,9 @@ async function rmrf(directory) {
|
|
|
73
38
|
log.notice("Removing directory", $p(dir), "recursively");
|
|
74
39
|
await rm(dir, { recursive: true });
|
|
75
40
|
}
|
|
41
|
+
function resolve(...paths) {
|
|
42
|
+
return requireContext().resolve(...paths);
|
|
43
|
+
}
|
|
76
44
|
function isFile(...paths) {
|
|
77
45
|
const path = requireContext().resolve(...paths);
|
|
78
46
|
return resolveFile(path);
|
|
@@ -85,7 +53,7 @@ export {
|
|
|
85
53
|
find,
|
|
86
54
|
isDirectory,
|
|
87
55
|
isFile,
|
|
88
|
-
|
|
56
|
+
resolve,
|
|
89
57
|
rmrf
|
|
90
58
|
};
|
|
91
59
|
//# sourceMappingURL=helpers.mjs.map
|
package/dist/helpers.mjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/helpers.ts"],
|
|
4
|
-
"mappings": ";AAAA,SAAS,cAAc;AACvB,SAAS,sBAAsB;AAC/B,SAAS,aAAa;AACtB,SAAS,IAAI,WAAW;AACxB,SAA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,EAAE,QAAQ,GAAG,KAAK;AAC9C,SAAO,YAAY,IAAI;AACzB;AAOO,SAAS,eAAe,OAA0D;AACvF,QAAM,OAAO,eAAe,EAAE,QAAQ,GAAG,KAAK;AAC9C,SAAO,iBAAiB,IAAI;AAC9B;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,10 @@ 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
|
+
};
|
|
6
10
|
var __copyProps = (to, from, except, desc) => {
|
|
7
11
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
12
|
for (let key of __getOwnPropNames(from))
|
|
@@ -16,11 +20,19 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
16
20
|
|
|
17
21
|
// index.ts
|
|
18
22
|
var src_exports = {};
|
|
23
|
+
__export(src_exports, {
|
|
24
|
+
Pipe: () => import_pipe.Pipe
|
|
25
|
+
});
|
|
19
26
|
module.exports = __toCommonJS(src_exports);
|
|
27
|
+
var import_pipe = require("./pipe.cjs");
|
|
20
28
|
__reExport(src_exports, require("./assert.cjs"), module.exports);
|
|
21
29
|
__reExport(src_exports, require("./build.cjs"), module.exports);
|
|
22
30
|
__reExport(src_exports, require("./helpers.cjs"), module.exports);
|
|
23
31
|
__reExport(src_exports, require("./log.cjs"), module.exports);
|
|
24
32
|
__reExport(src_exports, require("./plugs.cjs"), module.exports);
|
|
25
33
|
__reExport(src_exports, require("./types.cjs"), module.exports);
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
Pipe
|
|
37
|
+
});
|
|
26
38
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kBAAqB;AAGrB,wBAAc,yBAPd;AAQA,wBAAc,wBARd;AASA,wBAAc,0BATd;AAUA,wBAAc,sBAVd;AAaA,wBAAc,wBAbd;AAcA,wBAAc,wBAdd;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference path="../extra/webassembly.d.ts" />
|
|
2
2
|
export type { AbsolutePath } from './paths';
|
|
3
3
|
export type { Files, FilesBuilder } from './files';
|
|
4
|
-
export
|
|
4
|
+
export { Pipe } from './pipe';
|
|
5
5
|
export * from './assert';
|
|
6
6
|
export * from './build';
|
|
7
7
|
export * from './helpers';
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
// index.ts
|
|
2
|
+
import { Pipe } from "./pipe.mjs";
|
|
2
3
|
export * from "./assert.mjs";
|
|
3
4
|
export * from "./build.mjs";
|
|
4
5
|
export * from "./helpers.mjs";
|
|
5
6
|
export * from "./log.mjs";
|
|
6
7
|
export * from "./plugs.mjs";
|
|
7
8
|
export * from "./types.mjs";
|
|
9
|
+
export {
|
|
10
|
+
Pipe
|
|
11
|
+
};
|
|
8
12
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
package/dist/pipe.cjs
CHANGED
|
@@ -26,10 +26,13 @@ __export(pipe_exports, {
|
|
|
26
26
|
installForking: () => installForking
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(pipe_exports);
|
|
29
|
-
var import_log = require("./log.cjs");
|
|
30
29
|
var import_paths = require("./paths.cjs");
|
|
31
|
-
var import_fork = require("./fork.cjs");
|
|
32
30
|
var import_path = require("path");
|
|
31
|
+
var import_assert = require("./assert.cjs");
|
|
32
|
+
var import_async = require("./async.cjs");
|
|
33
|
+
var import_files = require("./files.cjs");
|
|
34
|
+
var import_fork = require("./fork.cjs");
|
|
35
|
+
var import_log = require("./log.cjs");
|
|
33
36
|
var Context = class {
|
|
34
37
|
constructor(buildFile, taskName) {
|
|
35
38
|
this.buildFile = buildFile;
|
|
@@ -52,6 +55,39 @@ var Context = class {
|
|
|
52
55
|
var PipeProto = class {
|
|
53
56
|
};
|
|
54
57
|
var Pipe = class extends PipeProto {
|
|
58
|
+
constructor(_context, _run) {
|
|
59
|
+
super();
|
|
60
|
+
this._context = _context;
|
|
61
|
+
this._run = _run;
|
|
62
|
+
}
|
|
63
|
+
plug(arg) {
|
|
64
|
+
const plug = typeof arg === "function" ? { pipe: arg } : arg;
|
|
65
|
+
const parent = this;
|
|
66
|
+
const context = this._context;
|
|
67
|
+
return new Pipe(context, async () => {
|
|
68
|
+
const previous = await parent.run();
|
|
69
|
+
const current = await plug.pipe(previous, context);
|
|
70
|
+
(0, import_assert.assert)(current, "Unable to extend pipe");
|
|
71
|
+
return current;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
run() {
|
|
75
|
+
return this._run();
|
|
76
|
+
}
|
|
77
|
+
static merge(pipes) {
|
|
78
|
+
const context = (0, import_async.requireContext)();
|
|
79
|
+
return new Pipe(context, async () => {
|
|
80
|
+
if (pipes.length === 0)
|
|
81
|
+
return import_files.Files.builder((0, import_paths.getCurrentWorkingDirectory)()).build();
|
|
82
|
+
const [first, ...other] = await Promise.all(pipes.map((pipe) => {
|
|
83
|
+
return "run" in pipe ? pipe.run() : pipe;
|
|
84
|
+
}));
|
|
85
|
+
const firstDir = first.directory;
|
|
86
|
+
const otherDirs = other.map((f) => f.directory);
|
|
87
|
+
const directory = (0, import_paths.commonPath)(firstDir, ...otherDirs);
|
|
88
|
+
return import_files.Files.builder(directory).merge(first, ...other).build();
|
|
89
|
+
});
|
|
90
|
+
}
|
|
55
91
|
};
|
|
56
92
|
function install(name, ctor) {
|
|
57
93
|
function plug(...args) {
|
package/dist/pipe.cjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/pipe.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAMO;AAEP,kBAAoB;AACpB,oBAAuB;AACvB,mBAA+B;AAC/B,mBAAsB;AACtB,kBAA4B;AAC5B,iBAAkC;AA+B3B,IAAM,UAAN,MAAc;AAAA,EAMnB,YAEoB,WAEA,UAClB;AAHkB;AAEA;AAElB,SAAK,eAAW,gCAAkB,SAAS;AAC3C,SAAK,UAAM,sBAAU,QAAQ;AAAA,EAC/B;AAAA,EAZgB;AAAA,EAEA;AAAA,EAoBhB,QAAQ,SAAiB,OAA+B;AAEtD,QAAI,QAAQ,KAAK,WAAW,GAAG,GAAG;AAEhC,YAAM,aAAa,KAAK,UAAU,CAAC,EAAE,MAAM,eAAG,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AACjE,iBAAO,kCAAoB,KAAK,UAAU,GAAG,YAAY,GAAG,KAAK;AAAA,IACnE;AAGA,QAAI,CAAE;AAAM,iBAAO,yCAA2B;AAG9C,eAAO,sCAAoB,yCAA2B,GAAG,MAAM,GAAG,KAAK;AAAA,EACzE;AACF;AAUA,IAAe,YAAf,MAAyB;AAEzB;AAMO,IAAM,OAAN,cAAmB,UAAU;AAAA,EAClC,YACqB,UACA,MACnB;AACA,UAAM;AAHa;AACA;AAAA,EAGrB;AAAA,EAM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