@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.
@@ -1,7 +1,24 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
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")
4
24
  });
5
- const _export_star = require("@swc/helpers/_/_export_star");
6
- _export_star._(require("./sync"), exports);
7
- _export_star._(require("./async"), exports);
@@ -1,26 +1,29 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
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
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- getBrook: function() {
14
- return getBrook;
15
- },
16
- createWaterfall: function() {
17
- return createWaterfall;
18
- },
19
- isWaterfall: function() {
20
- return isWaterfall;
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 sync_exports = {};
20
+ __export(sync_exports, {
21
+ createWaterfall: () => createWaterfall,
22
+ getBrook: () => getBrook,
23
+ isWaterfall: () => isWaterfall
22
24
  });
23
- const _farrowpipeline = require("../farrow-pipeline");
25
+ module.exports = __toCommonJS(sync_exports);
26
+ var import_farrow_pipeline = require("../farrow-pipeline");
24
27
  const WATERFALL_SYMBOL = Symbol.for("MODERN_WATERFALL");
25
28
  const getBrook = (input) => {
26
29
  if (typeof input === "function") {
@@ -31,7 +34,7 @@ const getBrook = (input) => {
31
34
  throw new Error(`${input} is not a Brook or { brook: Brook }`);
32
35
  };
33
36
  const createWaterfall = () => {
34
- const pipeline = (0, _farrowpipeline.createPipeline)();
37
+ const pipeline = (0, import_farrow_pipeline.createPipeline)();
35
38
  const use = (...brooks) => {
36
39
  pipeline.use(...brooks.map(getBrook).map(mapBrookToMiddleware));
37
40
  return waterfall;
@@ -56,3 +59,9 @@ const createWaterfall = () => {
56
59
  };
57
60
  const isWaterfall = (input) => Boolean(input === null || input === void 0 ? void 0 : input[WATERFALL_SYMBOL]);
58
61
  const mapBrookToMiddleware = (brook) => (input, next) => next(brook(input));
62
+ // Annotate the CommonJS export names for ESM import in node:
63
+ 0 && (module.exports = {
64
+ createWaterfall,
65
+ getBrook,
66
+ isWaterfall
67
+ });
@@ -1,28 +1,33 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
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
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- isAsyncWorkflow: function() {
14
- return isAsyncWorkflow;
15
- },
16
- createAsyncWorkflow: function() {
17
- return createAsyncWorkflow;
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 });
18
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var async_exports = {};
20
+ __export(async_exports, {
21
+ createAsyncWorkflow: () => createAsyncWorkflow,
22
+ isAsyncWorkflow: () => isAsyncWorkflow
19
23
  });
20
- const _farrowpipeline = require("../farrow-pipeline");
24
+ module.exports = __toCommonJS(async_exports);
25
+ var import_farrow_pipeline = require("../farrow-pipeline");
21
26
  const ASYNC_WORKFLOW_SYMBOL = Symbol.for("MODERN_ASYNC_WORKFLOW");
22
27
  const isPromise = (obj) => obj && typeof obj.then === "function";
23
28
  const isAsyncWorkflow = (input) => Boolean(input === null || input === void 0 ? void 0 : input[ASYNC_WORKFLOW_SYMBOL]);
24
29
  const createAsyncWorkflow = () => {
25
- const pipeline = (0, _farrowpipeline.createAsyncPipeline)();
30
+ const pipeline = (0, import_farrow_pipeline.createAsyncPipeline)();
26
31
  const use = (...input) => {
27
32
  pipeline.use(...input.map(mapAsyncWorkerToAsyncMiddleware));
28
33
  return workflow;
@@ -48,3 +53,8 @@ const mapAsyncWorkerToAsyncMiddleware = (worker) => (input, next) => Promise.res
48
53
  result,
49
54
  ...nextResult
50
55
  ]));
56
+ // Annotate the CommonJS export names for ESM import in node:
57
+ 0 && (module.exports = {
58
+ createAsyncWorkflow,
59
+ isAsyncWorkflow
60
+ });
@@ -1,8 +1,26 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
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 workflow_exports = {};
17
+ module.exports = __toCommonJS(workflow_exports);
18
+ __reExport(workflow_exports, require("./sync"), module.exports);
19
+ __reExport(workflow_exports, require("./parallel"), module.exports);
20
+ __reExport(workflow_exports, require("./async"), module.exports);
21
+ // Annotate the CommonJS export names for ESM import in node:
22
+ 0 && (module.exports = {
23
+ ...require("./sync"),
24
+ ...require("./parallel"),
25
+ ...require("./async")
4
26
  });
5
- const _export_star = require("@swc/helpers/_/_export_star");
6
- _export_star._(require("./sync"), exports);
7
- _export_star._(require("./parallel"), exports);
8
- _export_star._(require("./async"), exports);
@@ -1,27 +1,32 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
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
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- isParallelWorkflow: function() {
14
- return isParallelWorkflow;
15
- },
16
- createParallelWorkflow: function() {
17
- return createParallelWorkflow;
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 });
18
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var parallel_exports = {};
20
+ __export(parallel_exports, {
21
+ createParallelWorkflow: () => createParallelWorkflow,
22
+ isParallelWorkflow: () => isParallelWorkflow
19
23
  });
20
- const _farrowpipeline = require("../farrow-pipeline");
24
+ module.exports = __toCommonJS(parallel_exports);
25
+ var import_farrow_pipeline = require("../farrow-pipeline");
21
26
  const PARALLEL_WORKFLOW_SYMBOL = Symbol.for("MODERN_PARALLEL_WORKFLOW");
22
27
  const isParallelWorkflow = (input) => Boolean(input === null || input === void 0 ? void 0 : input[PARALLEL_WORKFLOW_SYMBOL]);
23
28
  const createParallelWorkflow = () => {
24
- const pipeline = (0, _farrowpipeline.createPipeline)();
29
+ const pipeline = (0, import_farrow_pipeline.createPipeline)();
25
30
  const use = (...input) => {
26
31
  pipeline.use(...input.map(mapParallelWorkerToAsyncMiddleware));
27
32
  return workflow;
@@ -41,3 +46,8 @@ const mapParallelWorkerToAsyncMiddleware = (worker) => (input, next) => [
41
46
  worker(input),
42
47
  ...next(input)
43
48
  ];
49
+ // Annotate the CommonJS export names for ESM import in node:
50
+ 0 && (module.exports = {
51
+ createParallelWorkflow,
52
+ isParallelWorkflow
53
+ });
@@ -1,26 +1,31 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
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
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- createWorkflow: function() {
14
- return createWorkflow;
15
- },
16
- isWorkflow: function() {
17
- return isWorkflow;
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 });
18
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var sync_exports = {};
20
+ __export(sync_exports, {
21
+ createWorkflow: () => createWorkflow,
22
+ isWorkflow: () => isWorkflow
19
23
  });
20
- const _farrowpipeline = require("../farrow-pipeline");
24
+ module.exports = __toCommonJS(sync_exports);
25
+ var import_farrow_pipeline = require("../farrow-pipeline");
21
26
  const WORKFLOW_SYMBOL = Symbol.for("MODERN_WORKFLOW");
22
27
  const createWorkflow = () => {
23
- const pipeline = (0, _farrowpipeline.createPipeline)();
28
+ const pipeline = (0, import_farrow_pipeline.createPipeline)();
24
29
  const use = (...input) => {
25
30
  pipeline.use(...input.map(mapWorkerToMiddleware));
26
31
  return workflow;
@@ -44,3 +49,8 @@ const mapWorkerToMiddleware = (worker) => (input, next) => [
44
49
  worker(input),
45
50
  ...next(input)
46
51
  ];
52
+ // Annotate the CommonJS export names for ESM import in node:
53
+ 0 && (module.exports = {
54
+ createWorkflow,
55
+ isWorkflow
56
+ });
package/dist/esm/index.js CHANGED
@@ -39,7 +39,7 @@ var createCounter = function(callback) {
39
39
  start: function(input) {
40
40
  return dispatch(0, input);
41
41
  },
42
- dispatch: dispatch
42
+ dispatch
43
43
  };
44
44
  };
45
45
 
@@ -140,9 +140,9 @@ var createWaterfall = function() {
140
140
  });
141
141
  };
142
142
  var waterfall = _object_spread_props(_object_spread2({}, pipeline), _define_property2({
143
- use: use,
144
- run: run,
145
- middleware: middleware
143
+ use,
144
+ run,
145
+ middleware
146
146
  }, WATERFALL_SYMBOL, true));
147
147
  return waterfall;
148
148
  };
@@ -195,9 +195,9 @@ var createAsyncWaterfall = function() {
195
195
  });
196
196
  };
197
197
  var waterfall = _object_spread_props2(_object_spread3({}, pipeline), _define_property3({
198
- use: use,
199
- run: run,
200
- middleware: middleware
198
+ use,
199
+ run,
200
+ middleware
201
201
  }, ASYNC_WATERFALL_SYMBOL, true));
202
202
  return waterfall;
203
203
  };
@@ -237,8 +237,8 @@ var createWorkflow = function() {
237
237
  return result.filter(Boolean);
238
238
  };
239
239
  var workflow = _object_spread_props3(_object_spread4({}, pipeline), _define_property4({
240
- use: use,
241
- run: run
240
+ use,
241
+ run
242
242
  }, WORKFLOW_SYMBOL, true));
243
243
  return workflow;
244
244
  };
@@ -282,8 +282,8 @@ var createParallelWorkflow = function() {
282
282
  });
283
283
  };
284
284
  var workflow = _object_spread_props4(_object_spread5({}, pipeline), _define_property5({
285
- run: run,
286
- use: use
285
+ run,
286
+ use
287
287
  }, PARALLEL_WORKFLOW_SYMBOL, true));
288
288
  return workflow;
289
289
  };
@@ -331,8 +331,8 @@ var createAsyncWorkflow = function() {
331
331
  return result.filter(Boolean);
332
332
  };
333
333
  var workflow = _object_spread_props5(_object_spread6({}, pipeline), _define_property6({
334
- use: use,
335
- run: run
334
+ use,
335
+ run
336
336
  }, ASYNC_WORKFLOW_SYMBOL, true));
337
337
  return workflow;
338
338
  };
@@ -456,8 +456,8 @@ var createManager = function(hooks, api) {
456
456
  return _object_spread_props6(_object_spread7(_object_spread_props6(_object_spread7({}, DEFAULT_OPTIONS), {
457
457
  name: "No.".concat(index++, " plugin")
458
458
  }), options), {
459
- SYNC_PLUGIN_SYMBOL: SYNC_PLUGIN_SYMBOL,
460
- setup: setup
459
+ SYNC_PLUGIN_SYMBOL,
460
+ setup
461
461
  });
462
462
  };
463
463
  var clear = function() {
@@ -477,15 +477,15 @@ var createManager = function(hooks, api) {
477
477
  return cb();
478
478
  };
479
479
  var manager = {
480
- createPlugin: createPlugin,
481
- isPlugin: isPlugin,
482
- usePlugin: usePlugin,
483
- init: init,
484
- clear: clear,
485
- run: run,
486
- registerHook: registerHook,
487
- useRunner: useRunner,
488
- clone: clone
480
+ createPlugin,
481
+ isPlugin,
482
+ usePlugin,
483
+ init,
484
+ clear,
485
+ run,
486
+ registerHook,
487
+ useRunner,
488
+ clone
489
489
  };
490
490
  return manager;
491
491
  };
@@ -604,8 +604,8 @@ var createAsyncManager = function(hooks, api) {
604
604
  return _object_spread_props7(_object_spread8(_object_spread_props7(_object_spread8({}, DEFAULT_OPTIONS), {
605
605
  name: "No.".concat(index++, " plugin")
606
606
  }), options), {
607
- ASYNC_PLUGIN_SYMBOL: ASYNC_PLUGIN_SYMBOL,
608
- setup: setup
607
+ ASYNC_PLUGIN_SYMBOL,
608
+ setup
609
609
  });
610
610
  };
611
611
  var clear = function() {
@@ -698,15 +698,15 @@ var createAsyncManager = function(hooks, api) {
698
698
  return cb();
699
699
  };
700
700
  var manager = {
701
- createPlugin: createPlugin,
702
- isPlugin: isPlugin,
703
- usePlugin: usePlugin,
704
- init: init,
705
- run: run,
706
- clear: clear,
707
- clone: clone,
708
- registerHook: registerHook,
709
- useRunner: useRunner
701
+ createPlugin,
702
+ isPlugin,
703
+ usePlugin,
704
+ init,
705
+ run,
706
+ clear,
707
+ clone,
708
+ registerHook,
709
+ useRunner
710
710
  };
711
711
  return manager;
712
712
  };
@@ -1,4 +1,4 @@
1
- export const createContext = (value) => {
1
+ const createContext = (value) => {
2
2
  let currentValue = value;
3
3
  return {
4
4
  use: () => ({
@@ -15,3 +15,6 @@ export const createContext = (value) => {
15
15
  }
16
16
  };
17
17
  };
18
+ export {
19
+ createContext
20
+ };
@@ -1,4 +1,4 @@
1
- export const createCounter = (callback) => {
1
+ const createCounter = (callback) => {
2
2
  const dispatch = (index, input) => {
3
3
  const next = (nextInput = input) => dispatch(index + 1, nextInput);
4
4
  return callback(index, input, next);
@@ -8,3 +8,6 @@ export const createCounter = (callback) => {
8
8
  dispatch
9
9
  };
10
10
  };
11
+ export {
12
+ createCounter
13
+ };
@@ -1,7 +1,6 @@
1
1
  import { createContext } from "./context";
2
2
  import { createCounter } from "./counter";
3
- export { createContext };
4
- export const isPipeline = (input) => Boolean(input === null || input === void 0 ? void 0 : input[PipelineSymbol]);
3
+ const isPipeline = (input) => Boolean(input === null || input === void 0 ? void 0 : input[PipelineSymbol]);
5
4
  const PipelineSymbol = Symbol.for("MODERN_PIPELINE");
6
5
  const getMiddleware = (input) => {
7
6
  if (typeof input === "function") {
@@ -11,7 +10,7 @@ const getMiddleware = (input) => {
11
10
  }
12
11
  throw new Error(`${input} is not a Middleware`);
13
12
  };
14
- export const createPipeline = () => {
13
+ const createPipeline = () => {
15
14
  const middlewares = [];
16
15
  const use = (...inputs) => {
17
16
  middlewares.push(...inputs.map(getMiddleware));
@@ -47,9 +46,15 @@ export const createPipeline = () => {
47
46
  };
48
47
  return pipeline;
49
48
  };
50
- export const createAsyncPipeline = () => {
49
+ const createAsyncPipeline = () => {
51
50
  const pipeline = createPipeline();
52
51
  return {
53
52
  ...pipeline
54
53
  };
55
54
  };
55
+ export {
56
+ createAsyncPipeline,
57
+ createContext,
58
+ createPipeline,
59
+ isPipeline
60
+ };
@@ -1,7 +1,7 @@
1
1
  import { generateRunner, DEFAULT_OPTIONS } from "./sync";
2
2
  import { checkPlugins, isObject, hasOwnProperty, sortPlugins, includePlugin } from "./shared";
3
3
  const ASYNC_PLUGIN_SYMBOL = "ASYNC_PLUGIN_SYMBOL";
4
- export const createAsyncManager = (hooks, api) => {
4
+ const createAsyncManager = (hooks, api) => {
5
5
  let index = 0;
6
6
  let runners;
7
7
  let currentHooks = {
@@ -95,3 +95,6 @@ export const createAsyncManager = (hooks, api) => {
95
95
  };
96
96
  return clone();
97
97
  };
98
+ export {
99
+ createAsyncManager
100
+ };
@@ -1,5 +1,5 @@
1
1
  import { pluginDagSort } from "@modern-js/utils/universal/plugin-dag-sort";
2
- export const checkPlugins = (plugins) => {
2
+ const checkPlugins = (plugins) => {
3
3
  if (process.env.NODE_ENV !== "production") {
4
4
  plugins.forEach((origin) => {
5
5
  origin.rivals.forEach((rival) => {
@@ -17,9 +17,16 @@ export const checkPlugins = (plugins) => {
17
17
  });
18
18
  }
19
19
  };
20
- export function sortPlugins(input) {
20
+ function sortPlugins(input) {
21
21
  return pluginDagSort(input.slice());
22
22
  }
23
- export const includePlugin = (plugins, input) => plugins.some((plugin) => plugin.name === input.name);
24
- export const isObject = (obj) => obj !== null && typeof obj === "object";
25
- export const hasOwnProperty = (obj, prop) => obj.hasOwnProperty(prop);
23
+ const includePlugin = (plugins, input) => plugins.some((plugin) => plugin.name === input.name);
24
+ const isObject = (obj) => obj !== null && typeof obj === "object";
25
+ const hasOwnProperty = (obj, prop) => obj.hasOwnProperty(prop);
26
+ export {
27
+ checkPlugins,
28
+ hasOwnProperty,
29
+ includePlugin,
30
+ isObject,
31
+ sortPlugins
32
+ };
@@ -3,7 +3,7 @@ import { isWaterfall, createWaterfall, isAsyncWaterfall, createAsyncWaterfall }
3
3
  import { isWorkflow, createWorkflow, isAsyncWorkflow, createAsyncWorkflow, isParallelWorkflow, createParallelWorkflow } from "../workflow";
4
4
  import { checkPlugins, hasOwnProperty, includePlugin, isObject, sortPlugins } from "./shared";
5
5
  const SYNC_PLUGIN_SYMBOL = "SYNC_PLUGIN_SYMBOL";
6
- export const DEFAULT_OPTIONS = {
6
+ const DEFAULT_OPTIONS = {
7
7
  name: "untitled",
8
8
  pre: [],
9
9
  post: [],
@@ -12,7 +12,7 @@ export const DEFAULT_OPTIONS = {
12
12
  usePlugins: [],
13
13
  registerHook: {}
14
14
  };
15
- export const createManager = (hooks, api) => {
15
+ const createManager = (hooks, api) => {
16
16
  let index = 0;
17
17
  let runners;
18
18
  let currentHooks = {
@@ -103,7 +103,7 @@ export const createManager = (hooks, api) => {
103
103
  };
104
104
  return clone();
105
105
  };
106
- export const generateRunner = (hooksList, hooksMap) => {
106
+ const generateRunner = (hooksList, hooksMap) => {
107
107
  const runner = {};
108
108
  const cloneShape = cloneHooksMap(hooksMap);
109
109
  if (hooksMap) {
@@ -120,7 +120,7 @@ export const generateRunner = (hooksList, hooksMap) => {
120
120
  }
121
121
  return runner;
122
122
  };
123
- export const cloneHook = (hook) => {
123
+ const cloneHook = (hook) => {
124
124
  if (isWaterfall(hook)) {
125
125
  return createWaterfall();
126
126
  }
@@ -141,7 +141,7 @@ export const cloneHook = (hook) => {
141
141
  }
142
142
  throw new Error(`Unknown hook: ${hook}`);
143
143
  };
144
- export const cloneHooksMap = (record) => {
144
+ const cloneHooksMap = (record) => {
145
145
  if (!record) {
146
146
  return record;
147
147
  }
@@ -151,3 +151,10 @@ export const cloneHooksMap = (record) => {
151
151
  }
152
152
  return result;
153
153
  };
154
+ export {
155
+ DEFAULT_OPTIONS,
156
+ cloneHook,
157
+ cloneHooksMap,
158
+ createManager,
159
+ generateRunner
160
+ };
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +1,6 @@
1
1
  import { createAsyncPipeline } from "../farrow-pipeline";
2
2
  const ASYNC_WATERFALL_SYMBOL = Symbol.for("MODERN_ASYNC_WATERFALL");
3
- export const getAsyncBrook = (input) => {
3
+ const getAsyncBrook = (input) => {
4
4
  if (typeof input === "function") {
5
5
  return input;
6
6
  }
@@ -9,7 +9,7 @@ export const getAsyncBrook = (input) => {
9
9
  }
10
10
  throw new Error(`${input} is not a AsyncBrook or { brook: AsyncBrook }`);
11
11
  };
12
- export const createAsyncWaterfall = () => {
12
+ const createAsyncWaterfall = () => {
13
13
  const pipeline = createAsyncPipeline();
14
14
  const use = (...input) => {
15
15
  pipeline.use(...input.map(getAsyncBrook).map(mapAsyncBrookToAsyncMiddleware));
@@ -33,5 +33,10 @@ export const createAsyncWaterfall = () => {
33
33
  };
34
34
  return waterfall;
35
35
  };
36
- export const isAsyncWaterfall = (input) => Boolean(input === null || input === void 0 ? void 0 : input[ASYNC_WATERFALL_SYMBOL]);
36
+ const isAsyncWaterfall = (input) => Boolean(input === null || input === void 0 ? void 0 : input[ASYNC_WATERFALL_SYMBOL]);
37
37
  const mapAsyncBrookToAsyncMiddleware = (brook) => (input, next) => Promise.resolve(brook(input)).then((result) => next(result));
38
+ export {
39
+ createAsyncWaterfall,
40
+ getAsyncBrook,
41
+ isAsyncWaterfall
42
+ };
@@ -1,6 +1,6 @@
1
1
  import { createPipeline } from "../farrow-pipeline";
2
2
  const WATERFALL_SYMBOL = Symbol.for("MODERN_WATERFALL");
3
- export const getBrook = (input) => {
3
+ const getBrook = (input) => {
4
4
  if (typeof input === "function") {
5
5
  return input;
6
6
  } else if (input && typeof input.middleware === "function") {
@@ -8,7 +8,7 @@ export const getBrook = (input) => {
8
8
  }
9
9
  throw new Error(`${input} is not a Brook or { brook: Brook }`);
10
10
  };
11
- export const createWaterfall = () => {
11
+ const createWaterfall = () => {
12
12
  const pipeline = createPipeline();
13
13
  const use = (...brooks) => {
14
14
  pipeline.use(...brooks.map(getBrook).map(mapBrookToMiddleware));
@@ -32,5 +32,10 @@ export const createWaterfall = () => {
32
32
  };
33
33
  return waterfall;
34
34
  };
35
- export const isWaterfall = (input) => Boolean(input === null || input === void 0 ? void 0 : input[WATERFALL_SYMBOL]);
35
+ const isWaterfall = (input) => Boolean(input === null || input === void 0 ? void 0 : input[WATERFALL_SYMBOL]);
36
36
  const mapBrookToMiddleware = (brook) => (input, next) => next(brook(input));
37
+ export {
38
+ createWaterfall,
39
+ getBrook,
40
+ isWaterfall
41
+ };