@modern-js/plugin 1.3.3 → 1.3.6

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 (71) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/js/modern/farrow-pipeline/asyncHooks.node.js +74 -0
  3. package/dist/js/modern/farrow-pipeline/asyncHooksInterface.js +12 -0
  4. package/dist/js/modern/farrow-pipeline/context.js +99 -0
  5. package/dist/js/modern/farrow-pipeline/counter.js +18 -0
  6. package/dist/js/modern/farrow-pipeline/hook.js +42 -0
  7. package/dist/js/modern/farrow-pipeline/index.js +19 -0
  8. package/dist/js/modern/farrow-pipeline/pipeline.js +93 -0
  9. package/dist/js/modern/index.js +1 -1
  10. package/dist/js/modern/manager/async.js +1 -1
  11. package/dist/js/modern/manager/runner.js +1 -1
  12. package/dist/js/modern/manager/sync.js +1 -1
  13. package/dist/js/modern/waterfall/async.js +3 -5
  14. package/dist/js/modern/waterfall/sync.js +3 -5
  15. package/dist/js/modern/workflow/async.js +2 -2
  16. package/dist/js/modern/workflow/parallel.js +2 -2
  17. package/dist/js/modern/workflow/sync.js +2 -2
  18. package/dist/js/node/farrow-pipeline/asyncHooks.node.js +93 -0
  19. package/dist/js/node/farrow-pipeline/asyncHooksInterface.js +26 -0
  20. package/dist/js/node/farrow-pipeline/context.js +120 -0
  21. package/dist/js/node/farrow-pipeline/counter.js +27 -0
  22. package/dist/js/node/farrow-pipeline/hook.js +52 -0
  23. package/dist/js/node/farrow-pipeline/index.js +18 -0
  24. package/dist/js/node/farrow-pipeline/pipeline.js +129 -0
  25. package/dist/js/node/index.js +1 -1
  26. package/dist/js/node/manager/async.js +1 -1
  27. package/dist/js/node/manager/runner.js +1 -1
  28. package/dist/js/node/manager/sync.js +1 -1
  29. package/dist/js/node/waterfall/async.js +3 -5
  30. package/dist/js/node/waterfall/sync.js +3 -5
  31. package/dist/js/node/workflow/async.js +2 -2
  32. package/dist/js/node/workflow/parallel.js +2 -2
  33. package/dist/js/node/workflow/sync.js +2 -2
  34. package/dist/js/treeshaking/farrow-pipeline/asyncHooks.node.js +74 -0
  35. package/dist/js/treeshaking/farrow-pipeline/asyncHooksInterface.js +12 -0
  36. package/dist/js/treeshaking/farrow-pipeline/context.js +103 -0
  37. package/dist/js/treeshaking/farrow-pipeline/counter.js +23 -0
  38. package/dist/js/treeshaking/farrow-pipeline/hook.js +46 -0
  39. package/dist/js/treeshaking/farrow-pipeline/index.js +19 -0
  40. package/dist/js/treeshaking/farrow-pipeline/pipeline.js +100 -0
  41. package/dist/js/treeshaking/index.js +1 -1
  42. package/dist/js/treeshaking/manager/async.js +8 -29
  43. package/dist/js/treeshaking/manager/runner.js +1 -1
  44. package/dist/js/treeshaking/manager/sync.js +5 -23
  45. package/dist/js/treeshaking/waterfall/async.js +10 -31
  46. package/dist/js/treeshaking/waterfall/sync.js +6 -23
  47. package/dist/js/treeshaking/workflow/async.js +12 -32
  48. package/dist/js/treeshaking/workflow/parallel.js +9 -28
  49. package/dist/js/treeshaking/workflow/sync.js +9 -28
  50. package/dist/types/farrow-pipeline/asyncHooks.node.d.ts +2 -0
  51. package/dist/types/farrow-pipeline/asyncHooksInterface.d.ts +19 -0
  52. package/dist/types/farrow-pipeline/context.d.ts +28 -0
  53. package/dist/types/farrow-pipeline/counter.d.ts +11 -0
  54. package/dist/types/farrow-pipeline/hook.d.ts +9 -0
  55. package/dist/types/farrow-pipeline/index.d.ts +19 -0
  56. package/dist/types/farrow-pipeline/pipeline.d.ts +38 -0
  57. package/dist/types/index.d.ts +1 -1
  58. package/dist/types/manager/runner.d.ts +1 -1
  59. package/dist/types/manager/sync.d.ts +1 -1
  60. package/dist/types/manager/types.d.ts +1 -1
  61. package/dist/types/waterfall/async.d.ts +1 -1
  62. package/dist/types/waterfall/sync.d.ts +1 -1
  63. package/dist/types/workflow/async.d.ts +1 -1
  64. package/dist/types/workflow/sync.d.ts +1 -1
  65. package/package.json +37 -8
  66. package/.eslintrc.js +0 -8
  67. package/jest.config.js +0 -7
  68. package/modern.config.js +0 -2
  69. package/node.d.ts +0 -1
  70. package/node.js +0 -1
  71. package/tsconfig.json +0 -14
@@ -0,0 +1,103 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+
3
+ /**
4
+ * modified from https://github.com/farrow-js/farrow/tree/master/packages/farrow-pipeline
5
+ * license at https://github.com/farrow-js/farrow/blob/master/LICENSE
6
+ */
7
+ import { createHooks } from "./hook";
8
+ var ContextSymbol = Symbol["for"]('MODERN_CONTEXT');
9
+ export var createContext = function createContext(value) {
10
+ var id = Symbol('MODERN_CONTEXT_ID');
11
+
12
+ var create = function create(value) {
13
+ var _Context;
14
+
15
+ var use = function use() {
16
+ var container = useContainer();
17
+ return Object.seal({
18
+ get value() {
19
+ return container.read(Context);
20
+ },
21
+
22
+ set value(v) {
23
+ container.write(Context, v);
24
+ }
25
+
26
+ });
27
+ };
28
+
29
+ var get = function get() {
30
+ var container = useContainer();
31
+ return container.read(Context);
32
+ };
33
+
34
+ var set = function set(v) {
35
+ var container = useContainer();
36
+ container.write(Context, v);
37
+ };
38
+
39
+ var Context = (_Context = {
40
+ id: id
41
+ }, _defineProperty(_Context, ContextSymbol, value), _defineProperty(_Context, "create", create), _defineProperty(_Context, "use", use), _defineProperty(_Context, "get", get), _defineProperty(_Context, "set", set), _Context);
42
+ return Context;
43
+ };
44
+
45
+ return create(value);
46
+ };
47
+
48
+ var createContextMap = function createContextMap(storage) {
49
+ var contextMap = new Map();
50
+ var contexts = Object.values(storage); // eslint-disable-next-line @typescript-eslint/prefer-for-of
51
+
52
+ for (var i = 0; i < contexts.length; i++) {
53
+ contextMap.set(contexts[i].id, contexts[i]);
54
+ }
55
+
56
+ return contextMap;
57
+ };
58
+
59
+ export var createContainer = function createContainer() {
60
+ var ContextStorage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
61
+ var contextMap = createContextMap(ContextStorage);
62
+
63
+ var read = function read(context) {
64
+ var target = contextMap.get(context.id);
65
+
66
+ if (target) {
67
+ return target[ContextSymbol];
68
+ }
69
+
70
+ return context[ContextSymbol];
71
+ };
72
+
73
+ var write = function write(context, value) {
74
+ contextMap.set(context.id, context.create(value));
75
+ };
76
+
77
+ return Object.freeze({
78
+ read: read,
79
+ write: write
80
+ });
81
+ };
82
+
83
+ var _createHooks = createHooks({
84
+ useContainer: function useContainer() {
85
+ throw new Error("Can't call useContainer out of scope, it should be placed on top of the function");
86
+ }
87
+ }),
88
+ run = _createHooks.run,
89
+ hooks = _createHooks.hooks;
90
+
91
+ export var runHooks = run;
92
+ var useContainer = hooks.useContainer;
93
+ export { useContainer };
94
+ export var fromContainer = function fromContainer(container) {
95
+ return {
96
+ useContainer: function useContainer() {
97
+ return container;
98
+ }
99
+ };
100
+ };
101
+ export var runWithContainer = function runWithContainer(f, container) {
102
+ return runHooks(f, fromContainer(container));
103
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * modified from https://github.com/farrow-js/farrow/tree/master/packages/farrow-pipeline
3
+ * license at https://github.com/farrow-js/farrow/blob/master/LICENSE
4
+ */
5
+ export var createCounter = function createCounter(callback) {
6
+ var dispatch = function dispatch(index, input) {
7
+ var next = function next() {
8
+ var nextInput = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : input;
9
+ return dispatch(index + 1, nextInput);
10
+ };
11
+
12
+ return callback(index, input, next);
13
+ };
14
+
15
+ var start = function start(input) {
16
+ return dispatch(0, input);
17
+ };
18
+
19
+ return {
20
+ start: start,
21
+ dispatch: dispatch
22
+ };
23
+ };
@@ -0,0 +1,46 @@
1
+ /**
2
+ * modified from https://github.com/farrow-js/farrow/tree/master/packages/farrow-pipeline
3
+ * license at https://github.com/farrow-js/farrow/blob/master/LICENSE
4
+ */
5
+ import { asyncHooks } from "./asyncHooksInterface";
6
+ export var createHooks = function createHooks(defaultHooks) {
7
+ var currentHooks = {};
8
+ var hooks = {};
9
+
10
+ var _loop = function _loop(key) {
11
+ // eslint-disable-next-line @typescript-eslint/no-loop-func
12
+ var f = function f() {
13
+ var _asyncHooks$get;
14
+
15
+ var hooks = currentHooks === defaultHooks ? (_asyncHooks$get = asyncHooks === null || asyncHooks === void 0 ? void 0 : asyncHooks.get()) !== null && _asyncHooks$get !== void 0 ? _asyncHooks$get : defaultHooks : currentHooks;
16
+ var handler = hooks[key];
17
+
18
+ if (typeof handler !== 'function') {
19
+ handler = defaultHooks[key];
20
+ }
21
+
22
+ return handler.apply(void 0, arguments);
23
+ };
24
+
25
+ hooks[key] = f;
26
+ };
27
+
28
+ for (var key in defaultHooks) {
29
+ _loop(key);
30
+ }
31
+
32
+ var run = function run(f, implementations) {
33
+ try {
34
+ currentHooks = implementations || defaultHooks;
35
+ asyncHooks === null || asyncHooks === void 0 ? void 0 : asyncHooks.set(currentHooks);
36
+ return f();
37
+ } finally {
38
+ currentHooks = defaultHooks;
39
+ }
40
+ };
41
+
42
+ return {
43
+ run: run,
44
+ hooks: hooks
45
+ };
46
+ };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * modified from https://github.com/farrow-js/farrow/tree/master/packages/farrow-pipeline
3
+ * license at https://github.com/farrow-js/farrow/blob/master/LICENSE
4
+ *
5
+ * removed:
6
+ * - dependencies:
7
+ * - tslib
8
+ * - files
9
+ * - compose.ts
10
+ * - methods:
11
+ * - usePipeline
12
+ * - assertContainer
13
+ * - assertContext
14
+ * - isContext
15
+ * - isContainer
16
+ * - pipeline.useLazy
17
+ * - context.assert
18
+ */
19
+ export * from "./pipeline";
@@ -0,0 +1,100 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
+
5
+ /**
6
+ * modified from https://github.com/farrow-js/farrow/tree/master/packages/farrow-pipeline
7
+ * license at https://github.com/farrow-js/farrow/blob/master/LICENSE
8
+ */
9
+ import { createContext, createContainer, fromContainer, runHooks, useContainer, runWithContainer } from "./context";
10
+ import { createCounter } from "./counter";
11
+ export { createContext, createContainer, useContainer, runWithContainer };
12
+ export var isPipeline = function isPipeline(input) {
13
+ return Boolean(input === null || input === void 0 ? void 0 : input[PipelineSymbol]);
14
+ };
15
+ var PipelineSymbol = Symbol["for"]('MODERN_PIPELINE');
16
+
17
+ var getMiddleware = function getMiddleware(input) {
18
+ if (typeof input === 'function') {
19
+ return input;
20
+ } else if (input && typeof input.middleware === 'function') {
21
+ return input.middleware;
22
+ }
23
+
24
+ throw new Error("".concat(input, " is not a Middleware"));
25
+ };
26
+
27
+ export var createPipeline = function createPipeline(options) {
28
+ var _pipeline;
29
+
30
+ var config = _objectSpread({}, options);
31
+
32
+ var middlewares = [];
33
+
34
+ var use = function use() {
35
+ for (var _len = arguments.length, inputs = new Array(_len), _key = 0; _key < _len; _key++) {
36
+ inputs[_key] = arguments[_key];
37
+ }
38
+
39
+ middlewares.push.apply(middlewares, _toConsumableArray(inputs.map(getMiddleware)));
40
+ return pipeline;
41
+ };
42
+
43
+ var createCurrentCounter = function createCurrentCounter(hooks, onLast, onLastWithContext) {
44
+ return createCounter(function (index, input, next) {
45
+ if (index >= middlewares.length) {
46
+ if (onLast) {
47
+ if (onLastWithContext) {
48
+ return runHooks(function () {
49
+ return onLast(input);
50
+ }, hooks);
51
+ }
52
+
53
+ return onLast(input);
54
+ }
55
+
56
+ throw new Error("Expect returning a value, but all middlewares just calling next()");
57
+ }
58
+
59
+ return runHooks(function () {
60
+ return middlewares[index](input, next);
61
+ }, hooks);
62
+ });
63
+ };
64
+
65
+ var currentContainer = createContainer(config.contexts);
66
+ var currentHooks = fromContainer(currentContainer);
67
+ var currentCounter = createCurrentCounter(currentHooks);
68
+
69
+ var getCounter = function getCounter(options) {
70
+ if (!options) {
71
+ return currentCounter;
72
+ }
73
+
74
+ if (options !== null && options !== void 0 && options.container) {
75
+ var hooks = fromContainer(options === null || options === void 0 ? void 0 : options.container);
76
+ return options !== null && options !== void 0 && options.onLast ? createCurrentCounter(hooks, options.onLast, typeof options.onLastWithContext === 'boolean' ? options.onLastWithContext : true) : createCurrentCounter(hooks);
77
+ }
78
+
79
+ return options !== null && options !== void 0 && options.onLast ? createCurrentCounter(currentHooks, options.onLast, typeof options.onLastWithContext === 'boolean' ? options.onLastWithContext : true) : createCurrentCounter(currentHooks);
80
+ };
81
+
82
+ var run = function run(input, options) {
83
+ return getCounter(options).start(input);
84
+ };
85
+
86
+ var middleware = function middleware(input, next) {
87
+ var container = useContainer();
88
+ return run(input, {
89
+ container: container,
90
+ onLast: next
91
+ });
92
+ };
93
+
94
+ var pipeline = (_pipeline = {}, _defineProperty(_pipeline, PipelineSymbol, true), _defineProperty(_pipeline, "use", use), _defineProperty(_pipeline, "run", run), _defineProperty(_pipeline, "middleware", middleware), _pipeline);
95
+ return pipeline;
96
+ };
97
+ export var createAsyncPipeline = function createAsyncPipeline(options) {
98
+ var pipeline = createPipeline(options);
99
+ return _objectSpread({}, pipeline);
100
+ };
@@ -1,4 +1,4 @@
1
- export * from 'farrow-pipeline';
1
+ export * from "./farrow-pipeline";
2
2
  export * from "./waterfall";
3
3
  export * from "./workflow";
4
4
  export * from "./manager";
@@ -1,30 +1,9 @@
1
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
-
3
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
-
5
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
-
7
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
8
-
9
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
10
-
11
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
12
-
13
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
14
-
15
- import _regeneratorRuntime from "@babel/runtime/regenerator";
16
-
17
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
18
-
19
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
20
-
21
- 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; }
22
-
23
- 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; }
24
-
25
- 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; }
26
-
27
- import { runWithContainer, createContainer } from 'farrow-pipeline';
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
3
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
4
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
5
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
6
+ import { runWithContainer, createContainer } from "../farrow-pipeline";
28
7
  import { isObject, generateRunner, hasOwnProperty, DEFAULT_OPTIONS } from "./sync";
29
8
  import { useRunner } from "./runner";
30
9
  var ASYNC_PLUGIN_SYMBOL = 'ASYNC_PLUGIN_SYMBOL';
@@ -113,9 +92,9 @@ export var createAsyncManager = function createAsyncManager(hooks, api) {
113
92
  var currentContainer = createContainer();
114
93
 
115
94
  var init = /*#__PURE__*/function () {
116
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
95
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
117
96
  var container, sortedPlugins, mergedPluginAPI, hooksList;
118
- return _regeneratorRuntime.wrap(function _callee$(_context) {
97
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
119
98
  while (1) {
120
99
  switch (_context.prev = _context.next) {
121
100
  case 0:
@@ -1,4 +1,4 @@
1
- import { createContext } from 'farrow-pipeline';
1
+ import { createContext } from "../farrow-pipeline";
2
2
  export var RunnerContext = createContext(null);
3
3
  export var useRunner = function useRunner() {
4
4
  var runner = RunnerContext.use().value;
@@ -1,26 +1,8 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
-
3
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
-
5
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
-
7
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
-
9
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
-
11
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
12
-
13
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14
-
15
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
16
-
17
- 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; }
18
-
19
- 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; }
20
-
21
- 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; }
22
-
23
- import { isPipeline, createPipeline, runWithContainer, createContainer } from 'farrow-pipeline';
1
+ import _typeof from "@babel/runtime/helpers/esm/typeof";
2
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
+ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
4
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
5
+ import { isPipeline, createPipeline, runWithContainer, createContainer } from "../farrow-pipeline";
24
6
  import { isWaterfall, createWaterfall, isAsyncWaterfall, createAsyncWaterfall } from "../waterfall";
25
7
  import { isWorkflow, createWorkflow, isAsyncWorkflow, createAsyncWorkflow, isParallelWorkflow, createParallelWorkflow } from "../workflow";
26
8
  import { RunnerContext, useRunner } from "./runner";
@@ -1,36 +1,16 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
-
3
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
-
5
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
6
-
7
- 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; }
8
-
9
- 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; }
10
-
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
-
13
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
14
-
15
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
16
-
17
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
18
-
19
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
20
-
21
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
22
-
23
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
24
-
25
- import { createAsyncPipeline, useContainer } from 'farrow-pipeline';
26
- var ASYNC_WATERFALL_SYMBOL = Symbol('ASYNC_WATERFALL_SYMBOL');
1
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
5
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
6
+ import { createAsyncPipeline, useContainer } from "../farrow-pipeline";
7
+ var ASYNC_WATERFALL_SYMBOL = Symbol["for"]('MODERN_ASYNC_WATERFALL');
27
8
  export var getAsyncBrook = function getAsyncBrook(input) {
28
9
  if (typeof input === 'function') {
29
10
  return input;
30
11
  } else if (input && typeof input.middleware === 'function') {
31
12
  return input.middleware;
32
- } // eslint-disable-next-line @typescript-eslint/no-base-to-string
33
-
13
+ }
34
14
 
35
15
  throw new Error("".concat(input, " is not a AsyncBrook or { brook: AsyncBrook }"));
36
16
  };
@@ -55,7 +35,6 @@ export var createAsyncWaterfall = function createAsyncWaterfall() {
55
35
  };
56
36
 
57
37
  var middleware = function middleware(input) {
58
- // eslint-disable-next-line react-hooks/rules-of-hooks
59
38
  var container = useContainer();
60
39
  return pipeline.run(input, {
61
40
  container: container,
@@ -79,8 +58,8 @@ export var isAsyncWaterfall = function isAsyncWaterfall(input) {
79
58
 
80
59
  var mapAsyncBrookToAsyncMiddleware = function mapAsyncBrookToAsyncMiddleware(brook) {
81
60
  return /*#__PURE__*/function () {
82
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(input, next) {
83
- return _regeneratorRuntime.wrap(function _callee$(_context) {
61
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(input, next) {
62
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
84
63
  while (1) {
85
64
  switch (_context.prev = _context.next) {
86
65
  case 0:
@@ -1,30 +1,14 @@
1
- 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; }
2
-
3
- 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; }
4
-
5
- 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; }
6
-
7
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8
-
9
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
-
11
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
12
-
13
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
14
-
15
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
16
-
17
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
18
-
19
- import { useContainer, createPipeline } from 'farrow-pipeline';
20
- var WATERFALL_SYMBOL = Symbol('WATERFALL_SYMBOL');
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
4
+ import { useContainer, createPipeline } from "../farrow-pipeline";
5
+ var WATERFALL_SYMBOL = Symbol["for"]('MODERN_WATERFALL');
21
6
  export var getBrook = function getBrook(input) {
22
7
  if (typeof input === 'function') {
23
8
  return input;
24
9
  } else if (input && typeof input.middleware === 'function') {
25
10
  return input.middleware;
26
- } // eslint-disable-next-line @typescript-eslint/no-base-to-string
27
-
11
+ }
28
12
 
29
13
  throw new Error("".concat(input, " is not a Brook or { brook: Brook }"));
30
14
  };
@@ -49,7 +33,6 @@ export var createWaterfall = function createWaterfall() {
49
33
  };
50
34
 
51
35
  var middleware = function middleware(input) {
52
- // eslint-disable-next-line react-hooks/rules-of-hooks
53
36
  var container = useContainer();
54
37
  return pipeline.run(input, {
55
38
  container: container,
@@ -1,31 +1,11 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
-
3
- import _regeneratorRuntime from "@babel/runtime/regenerator";
4
-
5
- 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; }
6
-
7
- 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; }
8
-
9
- 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; }
10
-
11
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
12
-
13
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
14
-
15
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
16
-
17
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
18
-
19
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
20
-
21
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
22
-
23
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
24
-
25
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
26
-
27
- import { createAsyncPipeline } from 'farrow-pipeline';
28
- var ASYNC_WORKFLOW_SYMBOL = Symbol('ASYNC_WORKFLOW_SYMBOL');
1
+ import _typeof from "@babel/runtime/helpers/esm/typeof";
2
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
4
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
5
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
6
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
7
+ import { createAsyncPipeline } from "../farrow-pipeline";
8
+ var ASYNC_WORKFLOW_SYMBOL = Symbol["for"]('MODERN_ASYNC_WORKFLOW');
29
9
  export var isAsyncWorkflow = function isAsyncWorkflow(input) {
30
10
  return Boolean(input === null || input === void 0 ? void 0 : input[ASYNC_WORKFLOW_SYMBOL]);
31
11
  };
@@ -42,9 +22,9 @@ export var createAsyncWorkflow = function createAsyncWorkflow() {
42
22
  };
43
23
 
44
24
  var run = /*#__PURE__*/function () {
45
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(input, options) {
25
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(input, options) {
46
26
  var result;
47
- return _regeneratorRuntime.wrap(function _callee$(_context) {
27
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
48
28
  while (1) {
49
29
  switch (_context.prev = _context.next) {
50
30
  case 0:
@@ -89,8 +69,8 @@ export var createAsyncWorkflow = function createAsyncWorkflow() {
89
69
 
90
70
  var mapAsyncWorkerToAsyncMiddleware = function mapAsyncWorkerToAsyncMiddleware(worker) {
91
71
  return /*#__PURE__*/function () {
92
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(input, next) {
93
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
72
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input, next) {
73
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
94
74
  while (1) {
95
75
  switch (_context2.prev = _context2.next) {
96
76
  case 0:
@@ -1,29 +1,10 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
-
3
- 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; }
4
-
5
- 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; }
6
-
7
- 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; }
8
-
9
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
10
-
11
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
12
-
13
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
14
-
15
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
16
-
17
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
18
-
19
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
20
-
21
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
22
-
23
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
24
-
25
- import { createPipeline } from 'farrow-pipeline';
26
- var PARALLEL_WORKFLOW_SYMBOL = Symbol('PARALLEL_WORKFLOW_SYMBOL');
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
3
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
5
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
6
+ import { createPipeline } from "../farrow-pipeline";
7
+ var PARALLEL_WORKFLOW_SYMBOL = Symbol["for"]('MODERN_PARALLEL_WORKFLOW');
27
8
  export var isParallelWorkflow = function isParallelWorkflow(input) {
28
9
  return Boolean(input === null || input === void 0 ? void 0 : input[PARALLEL_WORKFLOW_SYMBOL]);
29
10
  };
@@ -40,8 +21,8 @@ export var createParallelWorkflow = function createParallelWorkflow() {
40
21
  };
41
22
 
42
23
  var run = /*#__PURE__*/function () {
43
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(input, options) {
44
- return _regeneratorRuntime.wrap(function _callee$(_context) {
24
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(input, options) {
25
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
45
26
  while (1) {
46
27
  switch (_context.prev = _context.next) {
47
28
  case 0: