@modern-js/plugin 2.69.7 → 3.0.0-alpha.1
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/cjs/cli/api.js +119 -0
- package/dist/cjs/cli/context.js +85 -0
- package/dist/cjs/cli/hooks.js +65 -0
- package/dist/cjs/cli/index.js +68 -0
- package/dist/cjs/cli/run/config/createLoadedConfig.js +87 -0
- package/dist/cjs/cli/run/config/createResolvedConfig.js +48 -0
- package/dist/cjs/cli/run/config/loadConfig.js +113 -0
- package/dist/cjs/cli/run/create.js +187 -0
- package/dist/cjs/cli/run/index.js +56 -0
- package/dist/cjs/cli/run/run.js +57 -0
- package/dist/cjs/cli/run/types.js +18 -0
- package/dist/cjs/cli/run/utils/checkIsDuplicationPlugin.js +45 -0
- package/dist/cjs/cli/run/utils/commander.js +56 -0
- package/dist/cjs/cli/run/utils/createFileWatcher.js +112 -0
- package/dist/cjs/cli/run/utils/debug.js +37 -0
- package/dist/cjs/cli/run/utils/initAppDir.js +55 -0
- package/dist/cjs/cli/run/utils/mergeConfig.js +66 -0
- package/dist/cjs/hooks.js +169 -0
- package/dist/cjs/index.js +53 -26
- package/dist/cjs/manager.js +135 -0
- package/dist/cjs/runtime/api.js +95 -0
- package/dist/cjs/runtime/context.js +60 -0
- package/dist/cjs/runtime/hooks.js +46 -0
- package/dist/cjs/runtime/index.js +51 -0
- package/dist/cjs/runtime/run/create.js +79 -0
- package/dist/cjs/runtime/run/index.js +37 -0
- package/dist/cjs/runtime/run/types.js +18 -0
- package/dist/cjs/server/api.js +96 -0
- package/dist/cjs/server/context.js +75 -0
- package/dist/cjs/server/hooks.js +43 -0
- package/dist/cjs/server/index.js +54 -0
- package/dist/cjs/server/run/create.js +79 -0
- package/dist/cjs/server/run/index.js +40 -0
- package/dist/cjs/server/run/types.js +18 -0
- package/dist/cjs/types/cli/api.js +18 -0
- package/dist/cjs/types/cli/context.js +18 -0
- package/dist/cjs/types/cli/hooks.js +18 -0
- package/dist/cjs/types/cli/index.js +18 -0
- package/dist/cjs/types/cli/plugin.js +18 -0
- package/dist/cjs/types/hooks.js +18 -0
- package/dist/cjs/types/index.js +18 -0
- package/dist/cjs/types/plugin.js +18 -0
- package/dist/cjs/types/runtime/api.js +18 -0
- package/dist/cjs/types/runtime/context.js +18 -0
- package/dist/cjs/types/runtime/hooks.js +18 -0
- package/dist/cjs/types/runtime/index.js +18 -0
- package/dist/cjs/types/runtime/plugin.js +18 -0
- package/dist/cjs/types/server/api.js +18 -0
- package/dist/cjs/types/server/context.js +18 -0
- package/dist/cjs/types/server/hooks.js +18 -0
- package/dist/cjs/types/server/index.js +18 -0
- package/dist/cjs/types/server/plugin.js +18 -0
- package/dist/cjs/types/utils.js +18 -0
- package/dist/esm/cli/api.mjs +85 -0
- package/dist/esm/cli/context.mjs +38 -0
- package/dist/esm/cli/hooks.mjs +31 -0
- package/dist/esm/cli/index.mjs +7 -0
- package/dist/esm/cli/run/config/createLoadedConfig.mjs +53 -0
- package/dist/esm/cli/run/config/createResolvedConfig.mjs +14 -0
- package/dist/esm/cli/run/config/loadConfig.mjs +59 -0
- package/dist/esm/cli/run/create.mjs +150 -0
- package/dist/esm/cli/run/index.mjs +7 -0
- package/dist/esm/cli/run/run.mjs +23 -0
- package/dist/esm/cli/run/types.mjs +0 -0
- package/dist/esm/cli/run/utils/checkIsDuplicationPlugin.mjs +11 -0
- package/dist/esm/cli/run/utils/commander.mjs +16 -0
- package/dist/esm/cli/run/utils/createFileWatcher.mjs +68 -0
- package/dist/esm/cli/run/utils/debug.mjs +3 -0
- package/dist/esm/cli/run/utils/initAppDir.mjs +11 -0
- package/dist/esm/cli/run/utils/mergeConfig.mjs +32 -0
- package/dist/esm/hooks.mjs +120 -0
- package/dist/esm/index.mjs +3 -0
- package/dist/esm/manager.mjs +101 -0
- package/dist/esm/runtime/api.mjs +61 -0
- package/dist/esm/runtime/context.mjs +23 -0
- package/dist/esm/runtime/hooks.mjs +12 -0
- package/dist/esm/runtime/index.mjs +5 -0
- package/dist/esm/runtime/run/create.mjs +45 -0
- package/dist/esm/runtime/run/index.mjs +3 -0
- package/dist/esm/runtime/run/types.mjs +0 -0
- package/dist/esm/server/api.mjs +59 -0
- package/dist/esm/server/context.mjs +38 -0
- package/dist/esm/server/hooks.mjs +9 -0
- package/dist/esm/server/index.mjs +5 -0
- package/dist/esm/server/run/create.mjs +45 -0
- package/dist/esm/server/run/index.mjs +3 -0
- package/dist/esm/server/run/types.mjs +0 -0
- package/dist/esm/types/cli/api.mjs +0 -0
- package/dist/esm/types/cli/context.mjs +0 -0
- package/dist/esm/types/cli/hooks.mjs +0 -0
- package/dist/esm/types/cli/index.mjs +0 -0
- package/dist/esm/types/cli/plugin.mjs +0 -0
- package/dist/esm/types/hooks.mjs +0 -0
- package/dist/esm/types/index.mjs +0 -0
- package/dist/esm/types/plugin.mjs +0 -0
- package/dist/esm/types/runtime/api.mjs +0 -0
- package/dist/esm/types/runtime/context.mjs +0 -0
- package/dist/esm/types/runtime/hooks.mjs +0 -0
- package/dist/esm/types/runtime/index.mjs +0 -0
- package/dist/esm/types/runtime/plugin.mjs +0 -0
- package/dist/esm/types/server/api.mjs +0 -0
- package/dist/esm/types/server/context.mjs +0 -0
- package/dist/esm/types/server/hooks.mjs +0 -0
- package/dist/esm/types/server/index.mjs +0 -0
- package/dist/esm/types/server/plugin.mjs +0 -0
- package/dist/esm/types/utils.mjs +0 -0
- package/dist/esm-node/cli/api.mjs +85 -0
- package/dist/esm-node/cli/context.mjs +38 -0
- package/dist/esm-node/cli/hooks.mjs +31 -0
- package/dist/esm-node/cli/index.mjs +7 -0
- package/dist/esm-node/cli/run/config/createLoadedConfig.mjs +53 -0
- package/dist/esm-node/cli/run/config/createResolvedConfig.mjs +14 -0
- package/dist/esm-node/cli/run/config/loadConfig.mjs +59 -0
- package/dist/esm-node/cli/run/create.mjs +150 -0
- package/dist/esm-node/cli/run/index.mjs +7 -0
- package/dist/esm-node/cli/run/run.mjs +23 -0
- package/dist/esm-node/cli/run/utils/checkIsDuplicationPlugin.mjs +11 -0
- package/dist/esm-node/cli/run/utils/commander.mjs +16 -0
- package/dist/esm-node/cli/run/utils/createFileWatcher.mjs +68 -0
- package/dist/esm-node/cli/run/utils/debug.mjs +3 -0
- package/dist/esm-node/cli/run/utils/initAppDir.mjs +11 -0
- package/dist/esm-node/cli/run/utils/mergeConfig.mjs +32 -0
- package/dist/esm-node/hooks.mjs +120 -0
- package/dist/esm-node/index.mjs +3 -0
- package/dist/esm-node/manager.mjs +101 -0
- package/dist/esm-node/runtime/api.mjs +61 -0
- package/dist/esm-node/runtime/context.mjs +23 -0
- package/dist/esm-node/runtime/hooks.mjs +12 -0
- package/dist/esm-node/runtime/index.mjs +5 -0
- package/dist/esm-node/runtime/run/create.mjs +45 -0
- package/dist/esm-node/runtime/run/index.mjs +3 -0
- package/dist/esm-node/runtime/run/types.mjs +0 -0
- package/dist/esm-node/server/api.mjs +59 -0
- package/dist/esm-node/server/context.mjs +38 -0
- package/dist/esm-node/server/hooks.mjs +9 -0
- package/dist/esm-node/server/index.mjs +5 -0
- package/dist/esm-node/server/run/create.mjs +45 -0
- package/dist/esm-node/server/run/index.mjs +3 -0
- package/dist/esm-node/server/run/types.mjs +0 -0
- package/dist/esm-node/types/cli/api.mjs +0 -0
- package/dist/esm-node/types/cli/context.mjs +0 -0
- package/dist/esm-node/types/cli/hooks.mjs +0 -0
- package/dist/esm-node/types/cli/index.mjs +0 -0
- package/dist/esm-node/types/cli/plugin.mjs +0 -0
- package/dist/esm-node/types/hooks.mjs +0 -0
- package/dist/esm-node/types/index.mjs +0 -0
- package/dist/esm-node/types/plugin.mjs +0 -0
- package/dist/esm-node/types/runtime/api.mjs +0 -0
- package/dist/esm-node/types/runtime/context.mjs +0 -0
- package/dist/esm-node/types/runtime/hooks.mjs +0 -0
- package/dist/esm-node/types/runtime/index.mjs +0 -0
- package/dist/esm-node/types/runtime/plugin.mjs +0 -0
- package/dist/esm-node/types/server/api.mjs +0 -0
- package/dist/esm-node/types/server/context.mjs +0 -0
- package/dist/esm-node/types/server/hooks.mjs +0 -0
- package/dist/esm-node/types/server/index.mjs +0 -0
- package/dist/esm-node/types/server/plugin.mjs +0 -0
- package/dist/esm-node/types/utils.mjs +0 -0
- package/dist/types/cli/api.d.ts +8 -0
- package/dist/types/cli/context.d.ts +19 -0
- package/dist/types/cli/hooks.d.ts +42 -0
- package/dist/types/cli/index.d.ts +6 -0
- package/dist/types/cli/run/config/createLoadedConfig.d.ts +2 -0
- package/dist/types/cli/run/config/createResolvedConfig.d.ts +3 -0
- package/dist/types/cli/run/config/loadConfig.d.ts +25 -0
- package/dist/types/cli/run/create.d.ts +16 -0
- package/dist/types/cli/run/index.d.ts +13 -0
- package/dist/types/cli/run/run.d.ts +2 -0
- package/dist/types/cli/run/types.d.ts +32 -0
- package/dist/types/cli/run/utils/checkIsDuplicationPlugin.d.ts +1 -0
- package/dist/types/cli/run/utils/commander.d.ts +5 -0
- package/dist/types/cli/run/utils/createFileWatcher.d.ts +3 -0
- package/dist/types/cli/run/utils/debug.d.ts +1 -0
- package/dist/types/cli/run/utils/initAppDir.d.ts +1 -0
- package/dist/types/cli/run/utils/mergeConfig.d.ts +2 -0
- package/dist/types/hooks.d.ts +7 -0
- package/dist/types/index.d.ts +7 -4
- package/dist/types/manager.d.ts +5 -0
- package/dist/types/runtime/api.d.ts +9 -0
- package/dist/types/runtime/context.d.ts +11 -0
- package/dist/types/runtime/hooks.d.ts +2 -0
- package/dist/types/runtime/index.d.ts +5 -0
- package/dist/types/runtime/run/create.d.ts +7 -0
- package/dist/types/runtime/run/index.d.ts +5 -0
- package/dist/types/runtime/run/types.d.ts +6 -0
- package/dist/types/server/api.d.ts +9 -0
- package/dist/types/server/context.d.ts +13 -0
- package/dist/types/server/hooks.d.ts +9 -0
- package/dist/types/server/index.d.ts +4 -0
- package/dist/types/server/run/create.d.ts +7 -0
- package/dist/types/server/run/index.d.ts +8 -0
- package/dist/types/server/run/types.d.ts +22 -0
- package/dist/types/types/cli/api.d.ts +49 -0
- package/dist/types/types/cli/context.d.ts +42 -0
- package/dist/types/types/cli/hooks.d.ts +72 -0
- package/dist/types/types/cli/index.d.ts +4 -0
- package/dist/types/types/cli/plugin.d.ts +17 -0
- package/dist/types/types/hooks.d.ts +27 -0
- package/dist/types/types/index.d.ts +4 -0
- package/dist/types/types/plugin.d.ts +46 -0
- package/dist/types/types/runtime/api.d.ts +22 -0
- package/dist/types/types/runtime/context.d.ts +13 -0
- package/dist/types/types/runtime/hooks.d.ts +39 -0
- package/dist/types/types/runtime/index.d.ts +4 -0
- package/dist/types/types/runtime/plugin.d.ts +14 -0
- package/dist/types/types/server/api.d.ts +19 -0
- package/dist/types/types/server/context.d.ts +28 -0
- package/dist/types/types/server/hooks.d.ts +24 -0
- package/dist/types/types/server/index.d.ts +4 -0
- package/dist/types/types/server/plugin.d.ts +14 -0
- package/dist/types/types/utils.d.ts +7 -0
- package/package.json +68 -14
- package/rslib.config.mts +4 -0
- package/rstest.config.ts +5 -0
- package/dist/cjs/farrow-pipeline/context.js +0 -44
- package/dist/cjs/farrow-pipeline/counter.js +0 -37
- package/dist/cjs/farrow-pipeline/index.js +0 -87
- package/dist/cjs/manager/async.js +0 -124
- package/dist/cjs/manager/index.js +0 -26
- package/dist/cjs/manager/shared.js +0 -60
- package/dist/cjs/manager/sync.js +0 -194
- package/dist/cjs/manager/types.js +0 -16
- package/dist/cjs/waterfall/async.js +0 -68
- package/dist/cjs/waterfall/index.js +0 -24
- package/dist/cjs/waterfall/sync.js +0 -67
- package/dist/cjs/workflow/async.js +0 -60
- package/dist/cjs/workflow/index.js +0 -30
- package/dist/cjs/workflow/interrupt.js +0 -64
- package/dist/cjs/workflow/parallel.js +0 -53
- package/dist/cjs/workflow/sync.js +0 -56
- package/dist/cjs/workflow/syncParallel.js +0 -55
- package/dist/esm/index.js +0 -882
- package/dist/esm-node/farrow-pipeline/context.js +0 -20
- package/dist/esm-node/farrow-pipeline/counter.js +0 -13
- package/dist/esm-node/farrow-pipeline/index.js +0 -60
- package/dist/esm-node/index.js +0 -4
- package/dist/esm-node/manager/async.js +0 -106
- package/dist/esm-node/manager/index.js +0 -3
- package/dist/esm-node/manager/shared.js +0 -32
- package/dist/esm-node/manager/sync.js +0 -172
- package/dist/esm-node/waterfall/async.js +0 -42
- package/dist/esm-node/waterfall/index.js +0 -2
- package/dist/esm-node/waterfall/sync.js +0 -41
- package/dist/esm-node/workflow/async.js +0 -35
- package/dist/esm-node/workflow/index.js +0 -5
- package/dist/esm-node/workflow/interrupt.js +0 -39
- package/dist/esm-node/workflow/parallel.js +0 -28
- package/dist/esm-node/workflow/sync.js +0 -31
- package/dist/esm-node/workflow/syncParallel.js +0 -30
- package/dist/types/farrow-pipeline/context.d.ts +0 -12
- package/dist/types/farrow-pipeline/counter.d.ts +0 -11
- package/dist/types/farrow-pipeline/index.d.ts +0 -29
- package/dist/types/manager/async.d.ts +0 -54
- package/dist/types/manager/index.d.ts +0 -3
- package/dist/types/manager/shared.d.ts +0 -12
- package/dist/types/manager/sync.d.ts +0 -66
- package/dist/types/manager/types.d.ts +0 -33
- package/dist/types/waterfall/async.d.ts +0 -21
- package/dist/types/waterfall/index.d.ts +0 -2
- package/dist/types/waterfall/sync.d.ts +0 -20
- package/dist/types/workflow/async.d.ts +0 -12
- package/dist/types/workflow/index.d.ts +0 -5
- package/dist/types/workflow/interrupt.d.ts +0 -12
- package/dist/types/workflow/parallel.d.ts +0 -10
- package/dist/types/workflow/sync.d.ts +0 -11
- package/dist/types/workflow/syncParallel.d.ts +0 -10
- /package/dist/esm-node/{manager/types.js → cli/run/types.mjs} +0 -0
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
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
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var context_exports = {};
|
|
20
|
-
__export(context_exports, {
|
|
21
|
-
createContext: () => createContext
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(context_exports);
|
|
24
|
-
const createContext = (value) => {
|
|
25
|
-
let currentValue = value;
|
|
26
|
-
return {
|
|
27
|
-
use: () => ({
|
|
28
|
-
get value() {
|
|
29
|
-
return currentValue;
|
|
30
|
-
},
|
|
31
|
-
set value(v) {
|
|
32
|
-
currentValue = v;
|
|
33
|
-
}
|
|
34
|
-
}),
|
|
35
|
-
get: () => currentValue,
|
|
36
|
-
set: (v1) => {
|
|
37
|
-
currentValue = v1;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
-
0 && (module.exports = {
|
|
43
|
-
createContext
|
|
44
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
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
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var counter_exports = {};
|
|
20
|
-
__export(counter_exports, {
|
|
21
|
-
createCounter: () => createCounter
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(counter_exports);
|
|
24
|
-
const createCounter = (callback) => {
|
|
25
|
-
const dispatch = (index, input) => {
|
|
26
|
-
const next = (nextInput = input) => dispatch(index + 1, nextInput);
|
|
27
|
-
return callback(index, input, next);
|
|
28
|
-
};
|
|
29
|
-
return {
|
|
30
|
-
start: (input) => dispatch(0, input),
|
|
31
|
-
dispatch
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
-
0 && (module.exports = {
|
|
36
|
-
createCounter
|
|
37
|
-
});
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
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
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var farrow_pipeline_exports = {};
|
|
20
|
-
__export(farrow_pipeline_exports, {
|
|
21
|
-
createAsyncPipeline: () => createAsyncPipeline,
|
|
22
|
-
createContext: () => import_context.createContext,
|
|
23
|
-
createPipeline: () => createPipeline,
|
|
24
|
-
isPipeline: () => isPipeline
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(farrow_pipeline_exports);
|
|
27
|
-
var import_context = require("./context");
|
|
28
|
-
var import_counter = require("./counter");
|
|
29
|
-
const isPipeline = (input) => Boolean(input === null || input === void 0 ? void 0 : input[PipelineSymbol]);
|
|
30
|
-
const PipelineSymbol = Symbol.for("MODERN_PIPELINE");
|
|
31
|
-
const getMiddleware = (input) => {
|
|
32
|
-
if (typeof input === "function") {
|
|
33
|
-
return input;
|
|
34
|
-
} else if (input && typeof input.middleware === "function") {
|
|
35
|
-
return input.middleware;
|
|
36
|
-
}
|
|
37
|
-
throw new Error(`${input} is not a Middleware`);
|
|
38
|
-
};
|
|
39
|
-
const createPipeline = () => {
|
|
40
|
-
const middlewares = [];
|
|
41
|
-
const use = (...inputs) => {
|
|
42
|
-
middlewares.push(...inputs.map(getMiddleware));
|
|
43
|
-
return pipeline;
|
|
44
|
-
};
|
|
45
|
-
const createCurrentCounter = (onLast) => {
|
|
46
|
-
return (0, import_counter.createCounter)((index, input, next) => {
|
|
47
|
-
if (index >= middlewares.length) {
|
|
48
|
-
if (onLast) {
|
|
49
|
-
return onLast(input);
|
|
50
|
-
}
|
|
51
|
-
throw new Error(`Expect returning a value, but all middlewares just calling next()`);
|
|
52
|
-
}
|
|
53
|
-
return middlewares[index](input, next);
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
const currentCounter = createCurrentCounter();
|
|
57
|
-
const getCounter = (options) => {
|
|
58
|
-
if (!options) {
|
|
59
|
-
return currentCounter;
|
|
60
|
-
}
|
|
61
|
-
return createCurrentCounter(options === null || options === void 0 ? void 0 : options.onLast);
|
|
62
|
-
};
|
|
63
|
-
const run = (input, options) => getCounter(options).start(input);
|
|
64
|
-
const middleware = (input, next) => run(input, {
|
|
65
|
-
onLast: next
|
|
66
|
-
});
|
|
67
|
-
const pipeline = {
|
|
68
|
-
[PipelineSymbol]: true,
|
|
69
|
-
use,
|
|
70
|
-
run,
|
|
71
|
-
middleware
|
|
72
|
-
};
|
|
73
|
-
return pipeline;
|
|
74
|
-
};
|
|
75
|
-
const createAsyncPipeline = () => {
|
|
76
|
-
const pipeline = createPipeline();
|
|
77
|
-
return {
|
|
78
|
-
...pipeline
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
82
|
-
0 && (module.exports = {
|
|
83
|
-
createAsyncPipeline,
|
|
84
|
-
createContext,
|
|
85
|
-
createPipeline,
|
|
86
|
-
isPipeline
|
|
87
|
-
});
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
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
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var async_exports = {};
|
|
20
|
-
__export(async_exports, {
|
|
21
|
-
createAsyncManager: () => createAsyncManager
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(async_exports);
|
|
24
|
-
var import_shared = require("./shared");
|
|
25
|
-
var import_sync = require("./sync");
|
|
26
|
-
const ASYNC_PLUGIN_SYMBOL = "ASYNC_PLUGIN_SYMBOL";
|
|
27
|
-
const createAsyncManager = (hooks, api) => {
|
|
28
|
-
let index = 0;
|
|
29
|
-
let runners;
|
|
30
|
-
let currentHooks = {
|
|
31
|
-
...hooks
|
|
32
|
-
};
|
|
33
|
-
const useRunner = () => runners;
|
|
34
|
-
const registerHook = (extraHooks) => {
|
|
35
|
-
currentHooks = {
|
|
36
|
-
...extraHooks,
|
|
37
|
-
...currentHooks
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
const isPlugin = (input) => (0, import_shared.isObject)(input) && (0, import_shared.hasOwnProperty)(input, ASYNC_PLUGIN_SYMBOL) && input[ASYNC_PLUGIN_SYMBOL] === ASYNC_PLUGIN_SYMBOL;
|
|
41
|
-
const pluginAPI = {
|
|
42
|
-
...api,
|
|
43
|
-
useHookRunners: useRunner
|
|
44
|
-
};
|
|
45
|
-
const clone = (overrideAPI) => {
|
|
46
|
-
let plugins = [];
|
|
47
|
-
const addPlugin = (plugin) => {
|
|
48
|
-
if (!(0, import_shared.includePlugin)(plugins, plugin)) {
|
|
49
|
-
plugins.push({
|
|
50
|
-
...plugin
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
const usePlugin = (...input) => {
|
|
55
|
-
input.forEach((plugin) => {
|
|
56
|
-
if (isPlugin(plugin)) {
|
|
57
|
-
addPlugin(plugin);
|
|
58
|
-
} else if (typeof plugin === "function") {
|
|
59
|
-
const options = plugin();
|
|
60
|
-
addPlugin(createPlugin(options.setup, options));
|
|
61
|
-
} else if ((0, import_shared.isObject)(plugin)) {
|
|
62
|
-
addPlugin(createPlugin(plugin.setup, plugin));
|
|
63
|
-
} else if (process.env.NODE_ENV !== "production") {
|
|
64
|
-
console.warn(`Unknown plugin: ${JSON.stringify(plugin)}`);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
return manager;
|
|
68
|
-
};
|
|
69
|
-
const createPlugin = (setup = () => {
|
|
70
|
-
}, options = {}) => {
|
|
71
|
-
var _options_usePlugins;
|
|
72
|
-
if ((_options_usePlugins = options.usePlugins) === null || _options_usePlugins === void 0 ? void 0 : _options_usePlugins.length) {
|
|
73
|
-
options.usePlugins.forEach((plugin) => {
|
|
74
|
-
usePlugin(createPlugin(plugin.setup, plugin));
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
if (options.registerHook) {
|
|
78
|
-
registerHook(options.registerHook);
|
|
79
|
-
}
|
|
80
|
-
return {
|
|
81
|
-
...import_sync.DEFAULT_OPTIONS,
|
|
82
|
-
name: `No.${index++} plugin`,
|
|
83
|
-
...options,
|
|
84
|
-
ASYNC_PLUGIN_SYMBOL,
|
|
85
|
-
setup
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
const clear = () => {
|
|
89
|
-
plugins = [];
|
|
90
|
-
};
|
|
91
|
-
const init = async () => {
|
|
92
|
-
const sortedPlugins = (0, import_shared.sortPlugins)(plugins);
|
|
93
|
-
const mergedPluginAPI = {
|
|
94
|
-
...pluginAPI,
|
|
95
|
-
...overrideAPI
|
|
96
|
-
};
|
|
97
|
-
(0, import_shared.checkPlugins)(sortedPlugins);
|
|
98
|
-
const hooksList = [];
|
|
99
|
-
for (const plugin of sortedPlugins) {
|
|
100
|
-
hooksList.push(await plugin.setup(mergedPluginAPI));
|
|
101
|
-
}
|
|
102
|
-
runners = (0, import_sync.generateRunner)(hooksList, currentHooks);
|
|
103
|
-
return runners;
|
|
104
|
-
};
|
|
105
|
-
const run = (cb) => cb();
|
|
106
|
-
const manager = {
|
|
107
|
-
createPlugin,
|
|
108
|
-
isPlugin,
|
|
109
|
-
usePlugin,
|
|
110
|
-
init,
|
|
111
|
-
run,
|
|
112
|
-
clear,
|
|
113
|
-
clone,
|
|
114
|
-
registerHook,
|
|
115
|
-
useRunner
|
|
116
|
-
};
|
|
117
|
-
return manager;
|
|
118
|
-
};
|
|
119
|
-
return clone();
|
|
120
|
-
};
|
|
121
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
122
|
-
0 && (module.exports = {
|
|
123
|
-
createAsyncManager
|
|
124
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var manager_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(manager_exports);
|
|
18
|
-
__reExport(manager_exports, require("./sync"), module.exports);
|
|
19
|
-
__reExport(manager_exports, require("./async"), module.exports);
|
|
20
|
-
__reExport(manager_exports, require("./types"), module.exports);
|
|
21
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
-
0 && (module.exports = {
|
|
23
|
-
...require("./sync"),
|
|
24
|
-
...require("./async"),
|
|
25
|
-
...require("./types")
|
|
26
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
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
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var shared_exports = {};
|
|
20
|
-
__export(shared_exports, {
|
|
21
|
-
checkPlugins: () => checkPlugins,
|
|
22
|
-
hasOwnProperty: () => hasOwnProperty,
|
|
23
|
-
includePlugin: () => includePlugin,
|
|
24
|
-
isObject: () => isObject,
|
|
25
|
-
sortPlugins: () => sortPlugins
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(shared_exports);
|
|
28
|
-
var import_plugin_dag_sort = require("@modern-js/utils/universal/plugin-dag-sort");
|
|
29
|
-
const checkPlugins = (plugins) => {
|
|
30
|
-
if (process.env.NODE_ENV !== "production") {
|
|
31
|
-
plugins.forEach((origin) => {
|
|
32
|
-
origin.rivals.forEach((rival) => {
|
|
33
|
-
plugins.forEach((plugin) => {
|
|
34
|
-
if (rival === plugin.name) {
|
|
35
|
-
throw new Error(`${origin.name} has rival ${plugin.name}`);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
origin.required.forEach((required) => {
|
|
40
|
-
if (!plugins.some((plugin) => plugin.name === required)) {
|
|
41
|
-
throw new Error(`The plugin: ${required} is required when plugin: ${origin.name} is exist.`);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
function sortPlugins(input) {
|
|
48
|
-
return (0, import_plugin_dag_sort.pluginDagSort)(input.slice());
|
|
49
|
-
}
|
|
50
|
-
const includePlugin = (plugins, input) => plugins.some((plugin) => plugin.name === input.name);
|
|
51
|
-
const isObject = (obj) => obj !== null && typeof obj === "object";
|
|
52
|
-
const hasOwnProperty = (obj, prop) => obj.hasOwnProperty(prop);
|
|
53
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
-
0 && (module.exports = {
|
|
55
|
-
checkPlugins,
|
|
56
|
-
hasOwnProperty,
|
|
57
|
-
includePlugin,
|
|
58
|
-
isObject,
|
|
59
|
-
sortPlugins
|
|
60
|
-
});
|
package/dist/cjs/manager/sync.js
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
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
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var sync_exports = {};
|
|
20
|
-
__export(sync_exports, {
|
|
21
|
-
DEFAULT_OPTIONS: () => DEFAULT_OPTIONS,
|
|
22
|
-
cloneHook: () => cloneHook,
|
|
23
|
-
cloneHooksMap: () => cloneHooksMap,
|
|
24
|
-
createManager: () => createManager,
|
|
25
|
-
generateRunner: () => generateRunner
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(sync_exports);
|
|
28
|
-
var import_farrow_pipeline = require("../farrow-pipeline");
|
|
29
|
-
var import_waterfall = require("../waterfall");
|
|
30
|
-
var import_workflow = require("../workflow");
|
|
31
|
-
var import_shared = require("./shared");
|
|
32
|
-
const SYNC_PLUGIN_SYMBOL = "SYNC_PLUGIN_SYMBOL";
|
|
33
|
-
const DEFAULT_OPTIONS = {
|
|
34
|
-
name: "untitled",
|
|
35
|
-
pre: [],
|
|
36
|
-
post: [],
|
|
37
|
-
rivals: [],
|
|
38
|
-
required: [],
|
|
39
|
-
usePlugins: [],
|
|
40
|
-
registerHook: {}
|
|
41
|
-
};
|
|
42
|
-
const createManager = (hooks, api) => {
|
|
43
|
-
let index = 0;
|
|
44
|
-
let runners;
|
|
45
|
-
let currentHooks = {
|
|
46
|
-
...hooks
|
|
47
|
-
};
|
|
48
|
-
const useRunner = () => runners;
|
|
49
|
-
const registerHook = (extraHooks) => {
|
|
50
|
-
currentHooks = {
|
|
51
|
-
...extraHooks,
|
|
52
|
-
...currentHooks
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
const isPlugin = (input) => (0, import_shared.isObject)(input) && (0, import_shared.hasOwnProperty)(input, SYNC_PLUGIN_SYMBOL) && input[SYNC_PLUGIN_SYMBOL] === SYNC_PLUGIN_SYMBOL;
|
|
56
|
-
const pluginAPI = {
|
|
57
|
-
...api,
|
|
58
|
-
useHookRunners: useRunner
|
|
59
|
-
};
|
|
60
|
-
const clone = (overrideAPI) => {
|
|
61
|
-
let plugins = [];
|
|
62
|
-
const addPlugin = (plugin) => {
|
|
63
|
-
if (!(0, import_shared.includePlugin)(plugins, plugin)) {
|
|
64
|
-
plugins.push({
|
|
65
|
-
...plugin
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
const usePlugin = (...input) => {
|
|
70
|
-
input.forEach((plugin) => {
|
|
71
|
-
if (isPlugin(plugin)) {
|
|
72
|
-
addPlugin(plugin);
|
|
73
|
-
} else if (typeof plugin === "function") {
|
|
74
|
-
const options = plugin();
|
|
75
|
-
addPlugin(createPlugin(options.setup, options));
|
|
76
|
-
} else if ((0, import_shared.isObject)(plugin)) {
|
|
77
|
-
addPlugin(createPlugin(plugin.setup, plugin));
|
|
78
|
-
} else if (process.env.NODE_ENV !== "production") {
|
|
79
|
-
console.warn(`Unknown plugin: ${JSON.stringify(plugin)}`);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
return manager;
|
|
83
|
-
};
|
|
84
|
-
const createPlugin = (setup = () => {
|
|
85
|
-
}, options = {}) => {
|
|
86
|
-
var _options_usePlugins;
|
|
87
|
-
if ((_options_usePlugins = options.usePlugins) === null || _options_usePlugins === void 0 ? void 0 : _options_usePlugins.length) {
|
|
88
|
-
options.usePlugins.forEach((plugin) => {
|
|
89
|
-
usePlugin(createPlugin(plugin.setup, plugin));
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
if (options.registerHook) {
|
|
93
|
-
registerHook(options.registerHook);
|
|
94
|
-
}
|
|
95
|
-
return {
|
|
96
|
-
...DEFAULT_OPTIONS,
|
|
97
|
-
name: `No.${index++} plugin`,
|
|
98
|
-
...options,
|
|
99
|
-
SYNC_PLUGIN_SYMBOL,
|
|
100
|
-
setup
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
const clear = () => {
|
|
104
|
-
plugins = [];
|
|
105
|
-
};
|
|
106
|
-
const init = () => {
|
|
107
|
-
const sortedPlugins = (0, import_shared.sortPlugins)(plugins);
|
|
108
|
-
const mergedPluginAPI = {
|
|
109
|
-
...pluginAPI,
|
|
110
|
-
...overrideAPI
|
|
111
|
-
};
|
|
112
|
-
(0, import_shared.checkPlugins)(sortedPlugins);
|
|
113
|
-
const hooksList = sortedPlugins.map((plugin) => plugin.setup(mergedPluginAPI));
|
|
114
|
-
runners = generateRunner(hooksList, currentHooks);
|
|
115
|
-
return runners;
|
|
116
|
-
};
|
|
117
|
-
const run = (cb) => cb();
|
|
118
|
-
const manager = {
|
|
119
|
-
createPlugin,
|
|
120
|
-
isPlugin,
|
|
121
|
-
usePlugin,
|
|
122
|
-
init,
|
|
123
|
-
clear,
|
|
124
|
-
run,
|
|
125
|
-
registerHook,
|
|
126
|
-
useRunner,
|
|
127
|
-
clone
|
|
128
|
-
};
|
|
129
|
-
return manager;
|
|
130
|
-
};
|
|
131
|
-
return clone();
|
|
132
|
-
};
|
|
133
|
-
const generateRunner = (hooksList, hooksMap) => {
|
|
134
|
-
const runner = {};
|
|
135
|
-
const cloneShape = cloneHooksMap(hooksMap);
|
|
136
|
-
if (hooksMap) {
|
|
137
|
-
for (const key in cloneShape) {
|
|
138
|
-
hooksList.forEach((hooks) => {
|
|
139
|
-
if (hooks === null || hooks === void 0 ? void 0 : hooks[key]) {
|
|
140
|
-
cloneShape[key].use(hooks[key]);
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
runner[key] = (input, options) => cloneShape[key].run(input, {
|
|
144
|
-
...options
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return runner;
|
|
149
|
-
};
|
|
150
|
-
const cloneHook = (hook) => {
|
|
151
|
-
if ((0, import_waterfall.isWaterfall)(hook)) {
|
|
152
|
-
return (0, import_waterfall.createWaterfall)();
|
|
153
|
-
}
|
|
154
|
-
if ((0, import_waterfall.isAsyncWaterfall)(hook)) {
|
|
155
|
-
return (0, import_waterfall.createAsyncWaterfall)();
|
|
156
|
-
}
|
|
157
|
-
if ((0, import_workflow.isWorkflow)(hook)) {
|
|
158
|
-
return (0, import_workflow.createWorkflow)();
|
|
159
|
-
}
|
|
160
|
-
if ((0, import_workflow.isAsyncWorkflow)(hook)) {
|
|
161
|
-
return (0, import_workflow.createAsyncWorkflow)();
|
|
162
|
-
}
|
|
163
|
-
if ((0, import_workflow.isParallelWorkflow)(hook)) {
|
|
164
|
-
return (0, import_workflow.createParallelWorkflow)();
|
|
165
|
-
}
|
|
166
|
-
if ((0, import_workflow.isAsyncInterruptWorkflow)(hook)) {
|
|
167
|
-
return (0, import_workflow.createAsyncInterruptWorkflow)();
|
|
168
|
-
}
|
|
169
|
-
if ((0, import_workflow.isSyncParallelWorkflow)(hook)) {
|
|
170
|
-
return (0, import_workflow.createSyncParallelWorkflow)();
|
|
171
|
-
}
|
|
172
|
-
if ((0, import_farrow_pipeline.isPipeline)(hook)) {
|
|
173
|
-
return (0, import_farrow_pipeline.createPipeline)();
|
|
174
|
-
}
|
|
175
|
-
throw new Error(`Unknown hook: ${hook}`);
|
|
176
|
-
};
|
|
177
|
-
const cloneHooksMap = (record) => {
|
|
178
|
-
if (!record) {
|
|
179
|
-
return record;
|
|
180
|
-
}
|
|
181
|
-
const result = {};
|
|
182
|
-
for (const key in record) {
|
|
183
|
-
result[key] = cloneHook(record[key]);
|
|
184
|
-
}
|
|
185
|
-
return result;
|
|
186
|
-
};
|
|
187
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
188
|
-
0 && (module.exports = {
|
|
189
|
-
DEFAULT_OPTIONS,
|
|
190
|
-
cloneHook,
|
|
191
|
-
cloneHooksMap,
|
|
192
|
-
createManager,
|
|
193
|
-
generateRunner
|
|
194
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var types_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(types_exports);
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
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
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var async_exports = {};
|
|
20
|
-
__export(async_exports, {
|
|
21
|
-
createAsyncWaterfall: () => createAsyncWaterfall,
|
|
22
|
-
getAsyncBrook: () => getAsyncBrook,
|
|
23
|
-
isAsyncWaterfall: () => isAsyncWaterfall
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(async_exports);
|
|
26
|
-
var import_farrow_pipeline = require("../farrow-pipeline");
|
|
27
|
-
const ASYNC_WATERFALL_SYMBOL = Symbol.for("MODERN_ASYNC_WATERFALL");
|
|
28
|
-
const getAsyncBrook = (input) => {
|
|
29
|
-
if (typeof input === "function") {
|
|
30
|
-
return input;
|
|
31
|
-
}
|
|
32
|
-
if (input && typeof input.middleware === "function") {
|
|
33
|
-
return input.middleware;
|
|
34
|
-
}
|
|
35
|
-
throw new Error(`${input} is not a AsyncBrook or { brook: AsyncBrook }`);
|
|
36
|
-
};
|
|
37
|
-
const createAsyncWaterfall = () => {
|
|
38
|
-
const pipeline = (0, import_farrow_pipeline.createAsyncPipeline)();
|
|
39
|
-
const use = (...input) => {
|
|
40
|
-
pipeline.use(...input.map(getAsyncBrook).map(mapAsyncBrookToAsyncMiddleware));
|
|
41
|
-
return waterfall;
|
|
42
|
-
};
|
|
43
|
-
const run = (input, options) => pipeline.run(input, {
|
|
44
|
-
...options,
|
|
45
|
-
onLast: (input2) => input2
|
|
46
|
-
});
|
|
47
|
-
const middleware = (input) => {
|
|
48
|
-
return pipeline.run(input, {
|
|
49
|
-
onLast: (input2) => input2
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
const waterfall = {
|
|
53
|
-
...pipeline,
|
|
54
|
-
use,
|
|
55
|
-
run,
|
|
56
|
-
middleware,
|
|
57
|
-
[ASYNC_WATERFALL_SYMBOL]: true
|
|
58
|
-
};
|
|
59
|
-
return waterfall;
|
|
60
|
-
};
|
|
61
|
-
const isAsyncWaterfall = (input) => Boolean(input === null || input === void 0 ? void 0 : input[ASYNC_WATERFALL_SYMBOL]);
|
|
62
|
-
const mapAsyncBrookToAsyncMiddleware = (brook) => (input, next) => Promise.resolve(brook(input)).then((result) => next(result));
|
|
63
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
-
0 && (module.exports = {
|
|
65
|
-
createAsyncWaterfall,
|
|
66
|
-
getAsyncBrook,
|
|
67
|
-
isAsyncWaterfall
|
|
68
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var waterfall_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(waterfall_exports);
|
|
18
|
-
__reExport(waterfall_exports, require("./sync"), module.exports);
|
|
19
|
-
__reExport(waterfall_exports, require("./async"), module.exports);
|
|
20
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
21
|
-
0 && (module.exports = {
|
|
22
|
-
...require("./sync"),
|
|
23
|
-
...require("./async")
|
|
24
|
-
});
|