@modern-js/plugin 2.15.0 → 2.17.0
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/CHANGELOG.md +25 -0
- package/dist/cjs/farrow-pipeline/context.js +9 -27
- package/dist/cjs/farrow-pipeline/counter.js +7 -25
- package/dist/cjs/farrow-pipeline/index.js +25 -38
- package/dist/cjs/index.js +21 -20
- package/dist/cjs/manager/async.js +25 -41
- package/dist/cjs/manager/index.js +20 -19
- package/dist/cjs/manager/shared.js +16 -34
- package/dist/cjs/manager/sync.js +48 -60
- package/dist/cjs/manager/types.js +4 -15
- package/dist/cjs/waterfall/async.js +25 -34
- package/dist/cjs/waterfall/index.js +19 -18
- package/dist/cjs/waterfall/sync.js +24 -31
- package/dist/cjs/workflow/async.js +25 -33
- package/dist/cjs/workflow/index.js +20 -19
- package/dist/cjs/workflow/parallel.js +25 -33
- package/dist/cjs/workflow/sync.js +23 -29
- package/dist/esm/index.js +1123 -637
- package/dist/esm-node/farrow-pipeline/context.js +3 -6
- package/dist/esm-node/farrow-pipeline/counter.js +1 -4
- package/dist/esm-node/farrow-pipeline/index.js +11 -14
- package/dist/esm-node/manager/async.js +11 -18
- package/dist/esm-node/manager/shared.js +8 -17
- package/dist/esm-node/manager/sync.js +21 -42
- package/dist/esm-node/manager/types.js +1 -0
- package/dist/esm-node/waterfall/async.js +14 -16
- package/dist/esm-node/waterfall/sync.js +12 -10
- package/dist/esm-node/workflow/async.js +12 -13
- package/dist/esm-node/workflow/parallel.js +11 -10
- package/dist/esm-node/workflow/sync.js +10 -7
- package/package.json +10 -5
- package/dist/cjs/utils/pluginDagSort.js +0 -79
- package/dist/esm-node/utils/pluginDagSort.js +0 -56
- package/dist/types/utils/pluginDagSort.d.ts +0 -1
@@ -1,36 +1,30 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
function _export(target, all) {
|
6
6
|
for (var name in all)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
-
}
|
15
|
-
return to;
|
16
|
-
};
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
-
var sync_exports = {};
|
19
|
-
__export(sync_exports, {
|
7
|
+
Object.defineProperty(target, name, {
|
8
|
+
enumerable: true,
|
9
|
+
get: all[name]
|
10
|
+
});
|
11
|
+
}
|
12
|
+
_export(exports, {
|
20
13
|
createWorkflow: () => createWorkflow,
|
21
14
|
isWorkflow: () => isWorkflow
|
22
15
|
});
|
23
|
-
|
24
|
-
var import_farrow_pipeline = require("../farrow-pipeline");
|
16
|
+
const _farrowpipeline = require("../farrow-pipeline");
|
25
17
|
const WORKFLOW_SYMBOL = Symbol.for("MODERN_WORKFLOW");
|
26
18
|
const createWorkflow = () => {
|
27
|
-
const pipeline = (0,
|
19
|
+
const pipeline = (0, _farrowpipeline.createPipeline)();
|
28
20
|
const use = (...input) => {
|
29
21
|
pipeline.use(...input.map(mapWorkerToMiddleware));
|
30
22
|
return workflow;
|
31
23
|
};
|
32
24
|
const run = (input) => {
|
33
|
-
const result = pipeline.run(input, {
|
25
|
+
const result = pipeline.run(input, {
|
26
|
+
onLast: () => []
|
27
|
+
});
|
34
28
|
return result.filter(Boolean);
|
35
29
|
};
|
36
30
|
const workflow = {
|
@@ -41,10 +35,10 @@ const createWorkflow = () => {
|
|
41
35
|
};
|
42
36
|
return workflow;
|
43
37
|
};
|
44
|
-
const isWorkflow = (input) =>
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
38
|
+
const isWorkflow = (input) => {
|
39
|
+
return Boolean(input === null || input === void 0 ? void 0 : input[WORKFLOW_SYMBOL]);
|
40
|
+
};
|
41
|
+
const mapWorkerToMiddleware = (worker) => (input, next) => [
|
42
|
+
worker(input),
|
43
|
+
...next(input)
|
44
|
+
];
|