@modern-js/plugin 2.35.1 → 2.36.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/dist/cjs/farrow-pipeline/context.js +24 -7
- package/dist/cjs/farrow-pipeline/counter.js +24 -7
- package/dist/cjs/farrow-pipeline/index.js +32 -24
- package/dist/cjs/index.js +26 -7
- package/dist/cjs/manager/async.js +33 -16
- package/dist/cjs/manager/index.js +24 -6
- package/dist/cjs/manager/shared.js +33 -26
- package/dist/cjs/manager/sync.js +52 -45
- package/dist/cjs/manager/types.js +15 -3
- package/dist/cjs/waterfall/async.js +29 -20
- package/dist/cjs/waterfall/index.js +22 -5
- package/dist/cjs/waterfall/sync.js +29 -20
- package/dist/cjs/workflow/async.js +27 -17
- package/dist/cjs/workflow/index.js +24 -6
- package/dist/cjs/workflow/parallel.js +27 -17
- package/dist/cjs/workflow/sync.js +27 -17
- package/dist/esm/index.js +35 -35
- package/dist/esm-node/farrow-pipeline/context.js +4 -1
- package/dist/esm-node/farrow-pipeline/counter.js +4 -1
- package/dist/esm-node/farrow-pipeline/index.js +9 -4
- package/dist/esm-node/manager/async.js +4 -1
- package/dist/esm-node/manager/shared.js +12 -5
- package/dist/esm-node/manager/sync.js +12 -5
- package/dist/esm-node/manager/types.js +0 -1
- package/dist/esm-node/waterfall/async.js +8 -3
- package/dist/esm-node/waterfall/sync.js +8 -3
- package/dist/esm-node/workflow/async.js +6 -2
- package/dist/esm-node/workflow/parallel.js +6 -2
- package/dist/esm-node/workflow/sync.js +6 -2
- package/package.json +4 -4
@@ -1,13 +1,26 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
4
|
-
|
5
|
-
Object.
|
6
|
-
|
7
|
-
|
8
|
-
|
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 });
|
9
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
|
10
22
|
});
|
23
|
+
module.exports = __toCommonJS(context_exports);
|
11
24
|
const createContext = (value) => {
|
12
25
|
let currentValue = value;
|
13
26
|
return {
|
@@ -25,3 +38,7 @@ const createContext = (value) => {
|
|
25
38
|
}
|
26
39
|
};
|
27
40
|
};
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
42
|
+
0 && (module.exports = {
|
43
|
+
createContext
|
44
|
+
});
|
@@ -1,13 +1,26 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
4
|
-
|
5
|
-
Object.
|
6
|
-
|
7
|
-
|
8
|
-
|
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 });
|
9
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
|
10
22
|
});
|
23
|
+
module.exports = __toCommonJS(counter_exports);
|
11
24
|
const createCounter = (callback) => {
|
12
25
|
const dispatch = (index, input) => {
|
13
26
|
const next = (nextInput = input) => dispatch(index + 1, nextInput);
|
@@ -18,3 +31,7 @@ const createCounter = (callback) => {
|
|
18
31
|
dispatch
|
19
32
|
};
|
20
33
|
};
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
35
|
+
0 && (module.exports = {
|
36
|
+
createCounter
|
37
|
+
});
|
@@ -1,30 +1,31 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
4
|
-
|
5
|
-
|
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) => {
|
6
7
|
for (var name in all)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return _context.createContext;
|
15
|
-
},
|
16
|
-
isPipeline: function() {
|
17
|
-
return isPipeline;
|
18
|
-
},
|
19
|
-
createPipeline: function() {
|
20
|
-
return createPipeline;
|
21
|
-
},
|
22
|
-
createAsyncPipeline: function() {
|
23
|
-
return createAsyncPipeline;
|
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 });
|
24
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
25
|
});
|
26
|
-
|
27
|
-
|
26
|
+
module.exports = __toCommonJS(farrow_pipeline_exports);
|
27
|
+
var import_context = require("./context");
|
28
|
+
var import_counter = require("./counter");
|
28
29
|
const isPipeline = (input) => Boolean(input === null || input === void 0 ? void 0 : input[PipelineSymbol]);
|
29
30
|
const PipelineSymbol = Symbol.for("MODERN_PIPELINE");
|
30
31
|
const getMiddleware = (input) => {
|
@@ -42,7 +43,7 @@ const createPipeline = () => {
|
|
42
43
|
return pipeline;
|
43
44
|
};
|
44
45
|
const createCurrentCounter = (onLast) => {
|
45
|
-
return (0,
|
46
|
+
return (0, import_counter.createCounter)((index, input, next) => {
|
46
47
|
if (index >= middlewares.length) {
|
47
48
|
if (onLast) {
|
48
49
|
return onLast(input);
|
@@ -77,3 +78,10 @@ const createAsyncPipeline = () => {
|
|
77
78
|
...pipeline
|
78
79
|
};
|
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
|
+
});
|
package/dist/cjs/index.js
CHANGED
@@ -1,9 +1,28 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
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 src_exports = {};
|
17
|
+
module.exports = __toCommonJS(src_exports);
|
18
|
+
__reExport(src_exports, require("./farrow-pipeline"), module.exports);
|
19
|
+
__reExport(src_exports, require("./waterfall"), module.exports);
|
20
|
+
__reExport(src_exports, require("./workflow"), module.exports);
|
21
|
+
__reExport(src_exports, require("./manager"), module.exports);
|
22
|
+
// Annotate the CommonJS export names for ESM import in node:
|
23
|
+
0 && (module.exports = {
|
24
|
+
...require("./farrow-pipeline"),
|
25
|
+
...require("./waterfall"),
|
26
|
+
...require("./workflow"),
|
27
|
+
...require("./manager")
|
4
28
|
});
|
5
|
-
const _export_star = require("@swc/helpers/_/_export_star");
|
6
|
-
_export_star._(require("./farrow-pipeline"), exports);
|
7
|
-
_export_star._(require("./waterfall"), exports);
|
8
|
-
_export_star._(require("./workflow"), exports);
|
9
|
-
_export_star._(require("./manager"), exports);
|
@@ -1,15 +1,28 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
4
|
-
|
5
|
-
Object.
|
6
|
-
|
7
|
-
|
8
|
-
|
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 });
|
9
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
|
10
22
|
});
|
11
|
-
|
12
|
-
|
23
|
+
module.exports = __toCommonJS(async_exports);
|
24
|
+
var import_sync = require("./sync");
|
25
|
+
var import_shared = require("./shared");
|
13
26
|
const ASYNC_PLUGIN_SYMBOL = "ASYNC_PLUGIN_SYMBOL";
|
14
27
|
const createAsyncManager = (hooks, api) => {
|
15
28
|
let index = 0;
|
@@ -24,7 +37,7 @@ const createAsyncManager = (hooks, api) => {
|
|
24
37
|
...currentHooks
|
25
38
|
};
|
26
39
|
};
|
27
|
-
const isPlugin = (input) => (0,
|
40
|
+
const isPlugin = (input) => (0, import_shared.isObject)(input) && (0, import_shared.hasOwnProperty)(input, ASYNC_PLUGIN_SYMBOL) && input[ASYNC_PLUGIN_SYMBOL] === ASYNC_PLUGIN_SYMBOL;
|
28
41
|
const pluginAPI = {
|
29
42
|
...api,
|
30
43
|
useHookRunners: useRunner
|
@@ -32,7 +45,7 @@ const createAsyncManager = (hooks, api) => {
|
|
32
45
|
const clone = (overrideAPI) => {
|
33
46
|
let plugins = [];
|
34
47
|
const addPlugin = (plugin) => {
|
35
|
-
if (!(0,
|
48
|
+
if (!(0, import_shared.includePlugin)(plugins, plugin)) {
|
36
49
|
plugins.push({
|
37
50
|
...plugin
|
38
51
|
});
|
@@ -45,7 +58,7 @@ const createAsyncManager = (hooks, api) => {
|
|
45
58
|
} else if (typeof plugin === "function") {
|
46
59
|
const options = plugin();
|
47
60
|
addPlugin(createPlugin(options.setup, options));
|
48
|
-
} else if ((0,
|
61
|
+
} else if ((0, import_shared.isObject)(plugin)) {
|
49
62
|
addPlugin(createPlugin(plugin.setup, plugin));
|
50
63
|
} else if (process.env.NODE_ENV !== "production") {
|
51
64
|
console.warn(`Unknown plugin: ${JSON.stringify(plugin)}`);
|
@@ -65,7 +78,7 @@ const createAsyncManager = (hooks, api) => {
|
|
65
78
|
registerHook(options.registerHook);
|
66
79
|
}
|
67
80
|
return {
|
68
|
-
...
|
81
|
+
...import_sync.DEFAULT_OPTIONS,
|
69
82
|
name: `No.${index++} plugin`,
|
70
83
|
...options,
|
71
84
|
ASYNC_PLUGIN_SYMBOL,
|
@@ -76,17 +89,17 @@ const createAsyncManager = (hooks, api) => {
|
|
76
89
|
plugins = [];
|
77
90
|
};
|
78
91
|
const init = async () => {
|
79
|
-
const sortedPlugins = (0,
|
92
|
+
const sortedPlugins = (0, import_shared.sortPlugins)(plugins);
|
80
93
|
const mergedPluginAPI = {
|
81
94
|
...pluginAPI,
|
82
95
|
...overrideAPI
|
83
96
|
};
|
84
|
-
(0,
|
97
|
+
(0, import_shared.checkPlugins)(sortedPlugins);
|
85
98
|
const hooksList = [];
|
86
99
|
for (const plugin of sortedPlugins) {
|
87
100
|
hooksList.push(await plugin.setup(mergedPluginAPI));
|
88
101
|
}
|
89
|
-
runners = (0,
|
102
|
+
runners = (0, import_sync.generateRunner)(hooksList, currentHooks);
|
90
103
|
return runners;
|
91
104
|
};
|
92
105
|
const run = (cb) => cb();
|
@@ -105,3 +118,7 @@ const createAsyncManager = (hooks, api) => {
|
|
105
118
|
};
|
106
119
|
return clone();
|
107
120
|
};
|
121
|
+
// Annotate the CommonJS export names for ESM import in node:
|
122
|
+
0 && (module.exports = {
|
123
|
+
createAsyncManager
|
124
|
+
});
|
@@ -1,8 +1,26 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
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")
|
4
26
|
});
|
5
|
-
const _export_star = require("@swc/helpers/_/_export_star");
|
6
|
-
_export_star._(require("./sync"), exports);
|
7
|
-
_export_star._(require("./async"), exports);
|
8
|
-
_export_star._(require("./types"), exports);
|
@@ -1,32 +1,31 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
4
|
-
|
5
|
-
|
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) => {
|
6
7
|
for (var name in all)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return checkPlugins;
|
15
|
-
},
|
16
|
-
sortPlugins: function() {
|
17
|
-
return sortPlugins;
|
18
|
-
},
|
19
|
-
includePlugin: function() {
|
20
|
-
return includePlugin;
|
21
|
-
},
|
22
|
-
isObject: function() {
|
23
|
-
return isObject;
|
24
|
-
},
|
25
|
-
hasOwnProperty: function() {
|
26
|
-
return hasOwnProperty;
|
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 });
|
27
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
|
28
26
|
});
|
29
|
-
|
27
|
+
module.exports = __toCommonJS(shared_exports);
|
28
|
+
var import_plugin_dag_sort = require("@modern-js/utils/universal/plugin-dag-sort");
|
30
29
|
const checkPlugins = (plugins) => {
|
31
30
|
if (process.env.NODE_ENV !== "production") {
|
32
31
|
plugins.forEach((origin) => {
|
@@ -46,8 +45,16 @@ const checkPlugins = (plugins) => {
|
|
46
45
|
}
|
47
46
|
};
|
48
47
|
function sortPlugins(input) {
|
49
|
-
return (0,
|
48
|
+
return (0, import_plugin_dag_sort.pluginDagSort)(input.slice());
|
50
49
|
}
|
51
50
|
const includePlugin = (plugins, input) => plugins.some((plugin) => plugin.name === input.name);
|
52
51
|
const isObject = (obj) => obj !== null && typeof obj === "object";
|
53
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
CHANGED
@@ -1,35 +1,34 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
4
|
-
|
5
|
-
|
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) => {
|
6
7
|
for (var name in all)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return DEFAULT_OPTIONS;
|
15
|
-
},
|
16
|
-
createManager: function() {
|
17
|
-
return createManager;
|
18
|
-
},
|
19
|
-
generateRunner: function() {
|
20
|
-
return generateRunner;
|
21
|
-
},
|
22
|
-
cloneHook: function() {
|
23
|
-
return cloneHook;
|
24
|
-
},
|
25
|
-
cloneHooksMap: function() {
|
26
|
-
return cloneHooksMap;
|
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 });
|
27
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
|
28
26
|
});
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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");
|
33
32
|
const SYNC_PLUGIN_SYMBOL = "SYNC_PLUGIN_SYMBOL";
|
34
33
|
const DEFAULT_OPTIONS = {
|
35
34
|
name: "untitled",
|
@@ -53,7 +52,7 @@ const createManager = (hooks, api) => {
|
|
53
52
|
...currentHooks
|
54
53
|
};
|
55
54
|
};
|
56
|
-
const isPlugin = (input) => (0,
|
55
|
+
const isPlugin = (input) => (0, import_shared.isObject)(input) && (0, import_shared.hasOwnProperty)(input, SYNC_PLUGIN_SYMBOL) && input[SYNC_PLUGIN_SYMBOL] === SYNC_PLUGIN_SYMBOL;
|
57
56
|
const pluginAPI = {
|
58
57
|
...api,
|
59
58
|
useHookRunners: useRunner
|
@@ -61,7 +60,7 @@ const createManager = (hooks, api) => {
|
|
61
60
|
const clone = (overrideAPI) => {
|
62
61
|
let plugins = [];
|
63
62
|
const addPlugin = (plugin) => {
|
64
|
-
if (!(0,
|
63
|
+
if (!(0, import_shared.includePlugin)(plugins, plugin)) {
|
65
64
|
plugins.push({
|
66
65
|
...plugin
|
67
66
|
});
|
@@ -74,7 +73,7 @@ const createManager = (hooks, api) => {
|
|
74
73
|
} else if (typeof plugin === "function") {
|
75
74
|
const options = plugin();
|
76
75
|
addPlugin(createPlugin(options.setup, options));
|
77
|
-
} else if ((0,
|
76
|
+
} else if ((0, import_shared.isObject)(plugin)) {
|
78
77
|
addPlugin(createPlugin(plugin.setup, plugin));
|
79
78
|
} else if (process.env.NODE_ENV !== "production") {
|
80
79
|
console.warn(`Unknown plugin: ${JSON.stringify(plugin)}`);
|
@@ -105,12 +104,12 @@ const createManager = (hooks, api) => {
|
|
105
104
|
plugins = [];
|
106
105
|
};
|
107
106
|
const init = () => {
|
108
|
-
const sortedPlugins = (0,
|
107
|
+
const sortedPlugins = (0, import_shared.sortPlugins)(plugins);
|
109
108
|
const mergedPluginAPI = {
|
110
109
|
...pluginAPI,
|
111
110
|
...overrideAPI
|
112
111
|
};
|
113
|
-
(0,
|
112
|
+
(0, import_shared.checkPlugins)(sortedPlugins);
|
114
113
|
const hooksList = sortedPlugins.map((plugin) => plugin.setup(mergedPluginAPI));
|
115
114
|
runners = generateRunner(hooksList, currentHooks);
|
116
115
|
return runners;
|
@@ -149,23 +148,23 @@ const generateRunner = (hooksList, hooksMap) => {
|
|
149
148
|
return runner;
|
150
149
|
};
|
151
150
|
const cloneHook = (hook) => {
|
152
|
-
if ((0,
|
153
|
-
return (0,
|
151
|
+
if ((0, import_waterfall.isWaterfall)(hook)) {
|
152
|
+
return (0, import_waterfall.createWaterfall)();
|
154
153
|
}
|
155
|
-
if ((0,
|
156
|
-
return (0,
|
154
|
+
if ((0, import_waterfall.isAsyncWaterfall)(hook)) {
|
155
|
+
return (0, import_waterfall.createAsyncWaterfall)();
|
157
156
|
}
|
158
|
-
if ((0,
|
159
|
-
return (0,
|
157
|
+
if ((0, import_workflow.isWorkflow)(hook)) {
|
158
|
+
return (0, import_workflow.createWorkflow)();
|
160
159
|
}
|
161
|
-
if ((0,
|
162
|
-
return (0,
|
160
|
+
if ((0, import_workflow.isAsyncWorkflow)(hook)) {
|
161
|
+
return (0, import_workflow.createAsyncWorkflow)();
|
163
162
|
}
|
164
|
-
if ((0,
|
165
|
-
return (0,
|
163
|
+
if ((0, import_workflow.isParallelWorkflow)(hook)) {
|
164
|
+
return (0, import_workflow.createParallelWorkflow)();
|
166
165
|
}
|
167
|
-
if ((0,
|
168
|
-
return (0,
|
166
|
+
if ((0, import_farrow_pipeline.isPipeline)(hook)) {
|
167
|
+
return (0, import_farrow_pipeline.createPipeline)();
|
169
168
|
}
|
170
169
|
throw new Error(`Unknown hook: ${hook}`);
|
171
170
|
};
|
@@ -179,3 +178,11 @@ const cloneHooksMap = (record) => {
|
|
179
178
|
}
|
180
179
|
return result;
|
181
180
|
};
|
181
|
+
// Annotate the CommonJS export names for ESM import in node:
|
182
|
+
0 && (module.exports = {
|
183
|
+
DEFAULT_OPTIONS,
|
184
|
+
cloneHook,
|
185
|
+
cloneHooksMap,
|
186
|
+
createManager,
|
187
|
+
generateRunner
|
188
|
+
});
|
@@ -1,4 +1,16 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
4
|
-
|
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,26 +1,29 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
4
|
-
|
5
|
-
|
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) => {
|
6
7
|
for (var name in all)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return getAsyncBrook;
|
15
|
-
},
|
16
|
-
createAsyncWaterfall: function() {
|
17
|
-
return createAsyncWaterfall;
|
18
|
-
},
|
19
|
-
isAsyncWaterfall: function() {
|
20
|
-
return isAsyncWaterfall;
|
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 });
|
21
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
|
22
24
|
});
|
23
|
-
|
25
|
+
module.exports = __toCommonJS(async_exports);
|
26
|
+
var import_farrow_pipeline = require("../farrow-pipeline");
|
24
27
|
const ASYNC_WATERFALL_SYMBOL = Symbol.for("MODERN_ASYNC_WATERFALL");
|
25
28
|
const getAsyncBrook = (input) => {
|
26
29
|
if (typeof input === "function") {
|
@@ -32,7 +35,7 @@ const getAsyncBrook = (input) => {
|
|
32
35
|
throw new Error(`${input} is not a AsyncBrook or { brook: AsyncBrook }`);
|
33
36
|
};
|
34
37
|
const createAsyncWaterfall = () => {
|
35
|
-
const pipeline = (0,
|
38
|
+
const pipeline = (0, import_farrow_pipeline.createAsyncPipeline)();
|
36
39
|
const use = (...input) => {
|
37
40
|
pipeline.use(...input.map(getAsyncBrook).map(mapAsyncBrookToAsyncMiddleware));
|
38
41
|
return waterfall;
|
@@ -57,3 +60,9 @@ const createAsyncWaterfall = () => {
|
|
57
60
|
};
|
58
61
|
const isAsyncWaterfall = (input) => Boolean(input === null || input === void 0 ? void 0 : input[ASYNC_WATERFALL_SYMBOL]);
|
59
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
|
+
});
|