@modern-js/plugin 0.0.0-nightly-20230921160618 → 0.0.0-nightly-20230923161059
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 +38 -26
- 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 +54 -46
- package/dist/cjs/manager/types.js +15 -3
- package/dist/cjs/waterfall/async.js +33 -21
- package/dist/cjs/waterfall/index.js +22 -5
- package/dist/cjs/waterfall/sync.js +33 -21
- package/dist/cjs/workflow/async.js +31 -18
- package/dist/cjs/workflow/index.js +24 -6
- package/dist/cjs/workflow/parallel.js +31 -18
- package/dist/cjs/workflow/sync.js +31 -18
- package/dist/esm/index.js +51 -43
- 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 +14 -5
- 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 +14 -6
- package/dist/esm-node/manager/types.js +0 -1
- package/dist/esm-node/waterfall/async.js +11 -3
- package/dist/esm-node/waterfall/sync.js +11 -3
- package/dist/esm-node/workflow/async.js +9 -2
- package/dist/esm-node/workflow/parallel.js +9 -2
- package/dist/esm-node/workflow/sync.js +9 -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,31 +1,35 @@
|
|
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
|
-
|
28
|
-
|
26
|
+
module.exports = __toCommonJS(farrow_pipeline_exports);
|
27
|
+
var import_context = require("./context");
|
28
|
+
var import_counter = require("./counter");
|
29
|
+
const isPipeline = (input) => {
|
30
|
+
var _input;
|
31
|
+
return Boolean((_input = input) === null || _input === void 0 ? void 0 : _input[PipelineSymbol]);
|
32
|
+
};
|
29
33
|
const PipelineSymbol = Symbol.for("MODERN_PIPELINE");
|
30
34
|
const getMiddleware = (input) => {
|
31
35
|
if (typeof input === "function") {
|
@@ -42,7 +46,7 @@ const createPipeline = () => {
|
|
42
46
|
return pipeline;
|
43
47
|
};
|
44
48
|
const createCurrentCounter = (onLast) => {
|
45
|
-
return (0,
|
49
|
+
return (0, import_counter.createCounter)((index, input, next) => {
|
46
50
|
if (index >= middlewares.length) {
|
47
51
|
if (onLast) {
|
48
52
|
return onLast(input);
|
@@ -54,10 +58,11 @@ const createPipeline = () => {
|
|
54
58
|
};
|
55
59
|
const currentCounter = createCurrentCounter();
|
56
60
|
const getCounter = (options) => {
|
61
|
+
var _options;
|
57
62
|
if (!options) {
|
58
63
|
return currentCounter;
|
59
64
|
}
|
60
|
-
return createCurrentCounter(options === null ||
|
65
|
+
return createCurrentCounter((_options = options) === null || _options === void 0 ? void 0 : _options.onLast);
|
61
66
|
};
|
62
67
|
const run = (input, options) => getCounter(options).start(input);
|
63
68
|
const middleware = (input, next) => run(input, {
|
@@ -77,3 +82,10 @@ const createAsyncPipeline = () => {
|
|
77
82
|
...pipeline
|
78
83
|
};
|
79
84
|
};
|
85
|
+
// Annotate the CommonJS export names for ESM import in node:
|
86
|
+
0 && (module.exports = {
|
87
|
+
createAsyncPipeline,
|
88
|
+
createContext,
|
89
|
+
createPipeline,
|
90
|
+
isPipeline
|
91
|
+
});
|
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;
|
@@ -137,7 +136,8 @@ const generateRunner = (hooksList, hooksMap) => {
|
|
137
136
|
if (hooksMap) {
|
138
137
|
for (const key in cloneShape) {
|
139
138
|
hooksList.forEach((hooks) => {
|
140
|
-
|
139
|
+
var _hooks;
|
140
|
+
if ((_hooks = hooks) === null || _hooks === void 0 ? void 0 : _hooks[key]) {
|
141
141
|
cloneShape[key].use(hooks[key]);
|
142
142
|
}
|
143
143
|
});
|
@@ -149,23 +149,23 @@ const generateRunner = (hooksList, hooksMap) => {
|
|
149
149
|
return runner;
|
150
150
|
};
|
151
151
|
const cloneHook = (hook) => {
|
152
|
-
if ((0,
|
153
|
-
return (0,
|
152
|
+
if ((0, import_waterfall.isWaterfall)(hook)) {
|
153
|
+
return (0, import_waterfall.createWaterfall)();
|
154
154
|
}
|
155
|
-
if ((0,
|
156
|
-
return (0,
|
155
|
+
if ((0, import_waterfall.isAsyncWaterfall)(hook)) {
|
156
|
+
return (0, import_waterfall.createAsyncWaterfall)();
|
157
157
|
}
|
158
|
-
if ((0,
|
159
|
-
return (0,
|
158
|
+
if ((0, import_workflow.isWorkflow)(hook)) {
|
159
|
+
return (0, import_workflow.createWorkflow)();
|
160
160
|
}
|
161
|
-
if ((0,
|
162
|
-
return (0,
|
161
|
+
if ((0, import_workflow.isAsyncWorkflow)(hook)) {
|
162
|
+
return (0, import_workflow.createAsyncWorkflow)();
|
163
163
|
}
|
164
|
-
if ((0,
|
165
|
-
return (0,
|
164
|
+
if ((0, import_workflow.isParallelWorkflow)(hook)) {
|
165
|
+
return (0, import_workflow.createParallelWorkflow)();
|
166
166
|
}
|
167
|
-
if ((0,
|
168
|
-
return (0,
|
167
|
+
if ((0, import_farrow_pipeline.isPipeline)(hook)) {
|
168
|
+
return (0, import_farrow_pipeline.createPipeline)();
|
169
169
|
}
|
170
170
|
throw new Error(`Unknown hook: ${hook}`);
|
171
171
|
};
|
@@ -179,3 +179,11 @@ const cloneHooksMap = (record) => {
|
|
179
179
|
}
|
180
180
|
return result;
|
181
181
|
};
|
182
|
+
// Annotate the CommonJS export names for ESM import in node:
|
183
|
+
0 && (module.exports = {
|
184
|
+
DEFAULT_OPTIONS,
|
185
|
+
cloneHook,
|
186
|
+
cloneHooksMap,
|
187
|
+
createManager,
|
188
|
+
generateRunner
|
189
|
+
});
|
@@ -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);
|