@modern-js/plugin 2.0.0-beta.2 → 2.0.0-beta.4

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/js/modern/farrow-pipeline/context.js +8 -10
  3. package/dist/js/modern/farrow-pipeline/counter.js +6 -8
  4. package/dist/js/modern/farrow-pipeline/index.js +1 -5
  5. package/dist/js/modern/farrow-pipeline/pipeline.js +37 -21
  6. package/dist/js/modern/index.js +1 -1
  7. package/dist/js/modern/manager/async.js +77 -38
  8. package/dist/js/modern/manager/index.js +1 -1
  9. package/dist/js/modern/manager/shared.js +20 -11
  10. package/dist/js/modern/manager/sync.js +80 -49
  11. package/dist/js/modern/utils/pluginDagSort.js +28 -21
  12. package/dist/js/modern/waterfall/async.js +63 -20
  13. package/dist/js/modern/waterfall/index.js +1 -1
  14. package/dist/js/modern/waterfall/sync.js +35 -18
  15. package/dist/js/modern/workflow/async.js +59 -17
  16. package/dist/js/modern/workflow/index.js +1 -1
  17. package/dist/js/modern/workflow/parallel.js +53 -11
  18. package/dist/js/modern/workflow/sync.js +30 -12
  19. package/dist/js/node/farrow-pipeline/context.js +25 -15
  20. package/dist/js/node/farrow-pipeline/counter.js +23 -13
  21. package/dist/js/node/farrow-pipeline/index.js +17 -16
  22. package/dist/js/node/farrow-pipeline/pipeline.js +54 -30
  23. package/dist/js/node/index.js +20 -49
  24. package/dist/js/node/manager/async.js +92 -47
  25. package/dist/js/node/manager/index.js +19 -38
  26. package/dist/js/node/manager/shared.js +38 -21
  27. package/dist/js/node/manager/sync.js +92 -71
  28. package/dist/js/node/utils/pluginDagSort.js +45 -26
  29. package/dist/js/node/waterfall/async.js +79 -28
  30. package/dist/js/node/waterfall/index.js +18 -27
  31. package/dist/js/node/waterfall/sync.js +54 -27
  32. package/dist/js/node/workflow/async.js +75 -24
  33. package/dist/js/node/workflow/index.js +19 -38
  34. package/dist/js/node/workflow/parallel.js +72 -19
  35. package/dist/js/node/workflow/sync.js +49 -20
  36. package/dist/js/treeshaking/farrow-pipeline/context.js +30 -34
  37. package/dist/js/treeshaking/farrow-pipeline/counter.js +16 -20
  38. package/dist/js/treeshaking/farrow-pipeline/index.js +1 -5
  39. package/dist/js/treeshaking/farrow-pipeline/pipeline.js +106 -59
  40. package/dist/js/treeshaking/index.js +1 -1
  41. package/dist/js/treeshaking/manager/async.js +297 -115
  42. package/dist/js/treeshaking/manager/index.js +1 -1
  43. package/dist/js/treeshaking/manager/shared.js +29 -29
  44. package/dist/js/treeshaking/manager/sync.js +213 -168
  45. package/dist/js/treeshaking/manager/types.js +1 -0
  46. package/dist/js/treeshaking/utils/pluginDagSort.js +67 -72
  47. package/dist/js/treeshaking/waterfall/async.js +266 -68
  48. package/dist/js/treeshaking/waterfall/index.js +1 -1
  49. package/dist/js/treeshaking/waterfall/sync.js +122 -46
  50. package/dist/js/treeshaking/workflow/async.js +285 -84
  51. package/dist/js/treeshaking/workflow/index.js +1 -1
  52. package/dist/js/treeshaking/workflow/parallel.js +244 -49
  53. package/dist/js/treeshaking/workflow/sync.js +110 -32
  54. package/dist/types/manager/async.d.ts +9 -0
  55. package/dist/types/manager/sync.d.ts +9 -0
  56. package/dist/types/manager/types.d.ts +9 -2
  57. package/package.json +3 -3
@@ -1,28 +1,52 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createAsyncPipeline = void 0;
7
- Object.defineProperty(exports, "createContext", {
8
- enumerable: true,
9
- get: function () {
10
- return _context.createContext;
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
14
  }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var stdin_exports = {};
19
+ __export(stdin_exports, {
20
+ createAsyncPipeline: () => createAsyncPipeline,
21
+ createContext: () => import_context.createContext,
22
+ createPipeline: () => createPipeline,
23
+ isPipeline: () => isPipeline
12
24
  });
13
- exports.isPipeline = exports.createPipeline = void 0;
14
- var _context = require("./context");
15
- var _counter = require("./counter");
16
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
18
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
- const isPipeline = input => Boolean(input === null || input === void 0 ? void 0 : input[PipelineSymbol]);
20
- exports.isPipeline = isPipeline;
21
- const PipelineSymbol = Symbol.for('MODERN_PIPELINE');
22
- const getMiddleware = input => {
23
- if (typeof input === 'function') {
25
+ module.exports = __toCommonJS(stdin_exports);
26
+ var import_context = require("./context");
27
+ var import_counter = require("./counter");
28
+ var __defProp2 = Object.defineProperty;
29
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
30
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
31
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
32
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
33
+ var __spreadValues = (a, b) => {
34
+ for (var prop in b || (b = {}))
35
+ if (__hasOwnProp2.call(b, prop))
36
+ __defNormalProp(a, prop, b[prop]);
37
+ if (__getOwnPropSymbols)
38
+ for (var prop of __getOwnPropSymbols(b)) {
39
+ if (__propIsEnum.call(b, prop))
40
+ __defNormalProp(a, prop, b[prop]);
41
+ }
42
+ return a;
43
+ };
44
+ const isPipeline = (input) => Boolean(input == null ? void 0 : input[PipelineSymbol]);
45
+ const PipelineSymbol = Symbol.for("MODERN_PIPELINE");
46
+ const getMiddleware = (input) => {
47
+ if (typeof input === "function") {
24
48
  return input;
25
- } else if (input && typeof input.middleware === 'function') {
49
+ } else if (input && typeof input.middleware === "function") {
26
50
  return input.middleware;
27
51
  }
28
52
  throw new Error(`${input} is not a Middleware`);
@@ -33,23 +57,25 @@ const createPipeline = () => {
33
57
  middlewares.push(...inputs.map(getMiddleware));
34
58
  return pipeline;
35
59
  };
36
- const createCurrentCounter = onLast => {
37
- return (0, _counter.createCounter)((index, input, next) => {
60
+ const createCurrentCounter = (onLast) => {
61
+ return (0, import_counter.createCounter)((index, input, next) => {
38
62
  if (index >= middlewares.length) {
39
63
  if (onLast) {
40
64
  return onLast(input);
41
65
  }
42
- throw new Error(`Expect returning a value, but all middlewares just calling next()`);
66
+ throw new Error(
67
+ `Expect returning a value, but all middlewares just calling next()`
68
+ );
43
69
  }
44
70
  return middlewares[index](input, next);
45
71
  });
46
72
  };
47
73
  const currentCounter = createCurrentCounter();
48
- const getCounter = options => {
74
+ const getCounter = (options) => {
49
75
  if (!options) {
50
76
  return currentCounter;
51
77
  }
52
- return createCurrentCounter(options === null || options === void 0 ? void 0 : options.onLast);
78
+ return createCurrentCounter(options == null ? void 0 : options.onLast);
53
79
  };
54
80
  const run = (input, options) => getCounter(options).start(input);
55
81
  const middleware = (input, next) => run(input, {
@@ -63,9 +89,7 @@ const createPipeline = () => {
63
89
  };
64
90
  return pipeline;
65
91
  };
66
- exports.createPipeline = createPipeline;
67
92
  const createAsyncPipeline = () => {
68
93
  const pipeline = createPipeline();
69
- return _objectSpread({}, pipeline);
94
+ return __spreadValues({}, pipeline);
70
95
  };
71
- exports.createAsyncPipeline = createAsyncPipeline;
@@ -1,49 +1,20 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _farrowPipeline = require("./farrow-pipeline");
7
- Object.keys(_farrowPipeline).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _farrowPipeline[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _farrowPipeline[key];
14
- }
15
- });
16
- });
17
- var _waterfall = require("./waterfall");
18
- Object.keys(_waterfall).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _waterfall[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _waterfall[key];
25
- }
26
- });
27
- });
28
- var _workflow = require("./workflow");
29
- Object.keys(_workflow).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _workflow[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function () {
35
- return _workflow[key];
36
- }
37
- });
38
- });
39
- var _manager = require("./manager");
40
- Object.keys(_manager).forEach(function (key) {
41
- if (key === "default" || key === "__esModule") return;
42
- if (key in exports && exports[key] === _manager[key]) return;
43
- Object.defineProperty(exports, key, {
44
- enumerable: true,
45
- get: function () {
46
- return _manager[key];
47
- }
48
- });
49
- });
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var stdin_exports = {};
16
+ module.exports = __toCommonJS(stdin_exports);
17
+ __reExport(stdin_exports, require("./farrow-pipeline"), module.exports);
18
+ __reExport(stdin_exports, require("./waterfall"), module.exports);
19
+ __reExport(stdin_exports, require("./workflow"), module.exports);
20
+ __reExport(stdin_exports, require("./manager"), module.exports);
@@ -1,71 +1,115 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var stdin_exports = {};
19
+ __export(stdin_exports, {
20
+ createAsyncManager: () => createAsyncManager
5
21
  });
6
- exports.createAsyncManager = void 0;
7
- var _sync = require("./sync");
8
- var _shared = require("./shared");
9
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
- const ASYNC_PLUGIN_SYMBOL = 'ASYNC_PLUGIN_SYMBOL';
22
+ module.exports = __toCommonJS(stdin_exports);
23
+ var import_sync = require("./sync");
24
+ var import_shared = require("./shared");
25
+ var __defProp2 = Object.defineProperty;
26
+ var __defProps = Object.defineProperties;
27
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
28
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
29
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
30
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
31
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
32
+ var __spreadValues = (a, b) => {
33
+ for (var prop in b || (b = {}))
34
+ if (__hasOwnProp2.call(b, prop))
35
+ __defNormalProp(a, prop, b[prop]);
36
+ if (__getOwnPropSymbols)
37
+ for (var prop of __getOwnPropSymbols(b)) {
38
+ if (__propIsEnum.call(b, prop))
39
+ __defNormalProp(a, prop, b[prop]);
40
+ }
41
+ return a;
42
+ };
43
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
44
+ var __async = (__this, __arguments, generator) => {
45
+ return new Promise((resolve, reject) => {
46
+ var fulfilled = (value) => {
47
+ try {
48
+ step(generator.next(value));
49
+ } catch (e) {
50
+ reject(e);
51
+ }
52
+ };
53
+ var rejected = (value) => {
54
+ try {
55
+ step(generator.throw(value));
56
+ } catch (e) {
57
+ reject(e);
58
+ }
59
+ };
60
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
61
+ step((generator = generator.apply(__this, __arguments)).next());
62
+ });
63
+ };
64
+ const ASYNC_PLUGIN_SYMBOL = "ASYNC_PLUGIN_SYMBOL";
13
65
  const createAsyncManager = (hooks, api) => {
14
66
  let index = 0;
15
67
  let runners;
16
- let currentHooks = _objectSpread({}, hooks);
68
+ let currentHooks = __spreadValues({}, hooks);
17
69
  const useRunner = () => runners;
18
- const registerHook = extraHooks => {
19
- currentHooks = _objectSpread(_objectSpread({}, extraHooks), currentHooks);
70
+ const registerHook = (extraHooks) => {
71
+ currentHooks = __spreadValues(__spreadValues({}, extraHooks), currentHooks);
20
72
  };
21
- const isPlugin = input => (0, _shared.isObject)(input) && (0, _shared.hasOwnProperty)(input, ASYNC_PLUGIN_SYMBOL) && input[ASYNC_PLUGIN_SYMBOL] === ASYNC_PLUGIN_SYMBOL;
22
- const pluginAPI = _objectSpread(_objectSpread({}, api), {}, {
73
+ const isPlugin = (input) => (0, import_shared.isObject)(input) && (0, import_shared.hasOwnProperty)(input, ASYNC_PLUGIN_SYMBOL) && input[ASYNC_PLUGIN_SYMBOL] === ASYNC_PLUGIN_SYMBOL;
74
+ const pluginAPI = __spreadProps(__spreadValues({}, api), {
23
75
  useHookRunners: useRunner
24
76
  });
25
- const clone = overrideAPI => {
77
+ const clone = (overrideAPI) => {
26
78
  let plugins = [];
27
- const addPlugin = plugin => {
28
- if (!(0, _shared.includePlugin)(plugins, plugin)) {
29
- plugins.push(_objectSpread({}, plugin));
79
+ const addPlugin = (plugin) => {
80
+ if (!(0, import_shared.includePlugin)(plugins, plugin)) {
81
+ plugins.push(__spreadValues({}, plugin));
30
82
  }
31
83
  };
32
84
  const usePlugin = (...input) => {
33
85
  for (const plugin of input) {
34
- // already created by createPlugin
35
86
  if (isPlugin(plugin)) {
36
87
  addPlugin(plugin);
37
- }
38
- // using function to return plugin options
39
- else if (typeof plugin === 'function') {
88
+ } else if (typeof plugin === "function") {
40
89
  const options = plugin();
41
90
  addPlugin(createPlugin(options.setup, options));
42
- }
43
- // plain plugin object
44
- else if ((0, _shared.isObject)(plugin)) {
91
+ } else if ((0, import_shared.isObject)(plugin)) {
45
92
  addPlugin(createPlugin(plugin.setup, plugin));
46
- }
47
- // unknown plugin
48
- else {
93
+ } else {
49
94
  console.warn(`Unknown plugin: ${JSON.stringify(plugin)}`);
50
95
  }
51
96
  }
52
97
  return manager;
53
98
  };
54
- const createPlugin = (
55
- // eslint-disable-next-line @typescript-eslint/no-empty-function
56
- setup = () => {}, options = {}) => {
57
- var _options$usePlugins;
58
- if ((_options$usePlugins = options.usePlugins) !== null && _options$usePlugins !== void 0 && _options$usePlugins.length) {
59
- options.usePlugins.forEach(plugin => {
99
+ const createPlugin = (setup = () => {
100
+ }, options = {}) => {
101
+ var _a;
102
+ if ((_a = options.usePlugins) == null ? void 0 : _a.length) {
103
+ options.usePlugins.forEach((plugin) => {
60
104
  usePlugin(createPlugin(plugin.setup, plugin));
61
105
  });
62
106
  }
63
107
  if (options.registerHook) {
64
108
  registerHook(options.registerHook);
65
109
  }
66
- return _objectSpread(_objectSpread(_objectSpread({}, _sync.DEFAULT_OPTIONS), {}, {
110
+ return __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, import_sync.DEFAULT_OPTIONS), {
67
111
  name: `No.${index++} plugin`
68
- }, options), {}, {
112
+ }), options), {
69
113
  ASYNC_PLUGIN_SYMBOL,
70
114
  setup
71
115
  });
@@ -73,15 +117,17 @@ const createAsyncManager = (hooks, api) => {
73
117
  const clear = () => {
74
118
  plugins = [];
75
119
  };
76
- const init = async () => {
77
- const sortedPlugins = (0, _shared.sortPlugins)(plugins);
78
- const mergedPluginAPI = _objectSpread(_objectSpread({}, pluginAPI), overrideAPI);
79
- (0, _shared.checkPlugins)(sortedPlugins);
80
- const hooksList = await Promise.all(sortedPlugins.map(plugin => plugin.setup(mergedPluginAPI)));
81
- runners = (0, _sync.generateRunner)(hooksList, currentHooks);
120
+ const init = () => __async(void 0, null, function* () {
121
+ const sortedPlugins = (0, import_shared.sortPlugins)(plugins);
122
+ const mergedPluginAPI = __spreadValues(__spreadValues({}, pluginAPI), overrideAPI);
123
+ (0, import_shared.checkPlugins)(sortedPlugins);
124
+ const hooksList = yield Promise.all(
125
+ sortedPlugins.map((plugin) => plugin.setup(mergedPluginAPI))
126
+ );
127
+ runners = (0, import_sync.generateRunner)(hooksList, currentHooks);
82
128
  return runners;
83
- };
84
- const run = cb => cb();
129
+ });
130
+ const run = (cb) => cb();
85
131
  const manager = {
86
132
  createPlugin,
87
133
  isPlugin,
@@ -97,4 +143,3 @@ const createAsyncManager = (hooks, api) => {
97
143
  };
98
144
  return clone();
99
145
  };
100
- exports.createAsyncManager = createAsyncManager;
@@ -1,38 +1,19 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _sync = require("./sync");
7
- Object.keys(_sync).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _sync[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _sync[key];
14
- }
15
- });
16
- });
17
- var _async = require("./async");
18
- Object.keys(_async).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _async[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _async[key];
25
- }
26
- });
27
- });
28
- var _types = require("./types");
29
- Object.keys(_types).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _types[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function () {
35
- return _types[key];
36
- }
37
- });
38
- });
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var stdin_exports = {};
16
+ module.exports = __toCommonJS(stdin_exports);
17
+ __reExport(stdin_exports, require("./sync"), module.exports);
18
+ __reExport(stdin_exports, require("./async"), module.exports);
19
+ __reExport(stdin_exports, require("./types"), module.exports);
@@ -1,35 +1,52 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var stdin_exports = {};
19
+ __export(stdin_exports, {
20
+ checkPlugins: () => checkPlugins,
21
+ hasOwnProperty: () => hasOwnProperty,
22
+ includePlugin: () => includePlugin,
23
+ isObject: () => isObject,
24
+ sortPlugins: () => sortPlugins
5
25
  });
6
- exports.isObject = exports.includePlugin = exports.hasOwnProperty = exports.checkPlugins = void 0;
7
- exports.sortPlugins = sortPlugins;
8
- var _pluginDagSort = require("../utils/pluginDagSort");
9
- const checkPlugins = plugins => {
10
- plugins.forEach(origin => {
11
- origin.rivals.forEach(rival => {
12
- plugins.forEach(plugin => {
26
+ module.exports = __toCommonJS(stdin_exports);
27
+ var import_pluginDagSort = require("../utils/pluginDagSort");
28
+ const checkPlugins = (plugins) => {
29
+ plugins.forEach((origin) => {
30
+ origin.rivals.forEach((rival) => {
31
+ plugins.forEach((plugin) => {
13
32
  if (rival === plugin.name) {
14
33
  throw new Error(`${origin.name} has rival ${plugin.name}`);
15
34
  }
16
35
  });
17
36
  });
18
- origin.required.forEach(required => {
19
- if (!plugins.some(plugin => plugin.name === required)) {
20
- throw new Error(`The plugin: ${required} is required when plugin: ${origin.name} is exist.`);
37
+ origin.required.forEach((required) => {
38
+ if (!plugins.some((plugin) => plugin.name === required)) {
39
+ throw new Error(
40
+ `The plugin: ${required} is required when plugin: ${origin.name} is exist.`
41
+ );
21
42
  }
22
43
  });
23
44
  });
24
45
  };
25
- exports.checkPlugins = checkPlugins;
26
46
  function sortPlugins(input) {
27
47
  const plugins = input.slice();
28
- return (0, _pluginDagSort.dagSort)(plugins);
48
+ return (0, import_pluginDagSort.dagSort)(plugins);
29
49
  }
30
- const includePlugin = (plugins, input) => plugins.some(plugin => plugin.name === input.name);
31
- exports.includePlugin = includePlugin;
32
- const isObject = obj => obj !== null && typeof obj === 'object';
33
- exports.isObject = isObject;
50
+ const includePlugin = (plugins, input) => plugins.some((plugin) => plugin.name === input.name);
51
+ const isObject = (obj) => obj !== null && typeof obj === "object";
34
52
  const hasOwnProperty = (obj, prop) => obj.hasOwnProperty(prop);
35
- exports.hasOwnProperty = hasOwnProperty;