@modern-js/plugin 1.3.1 → 1.3.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 (90) hide show
  1. package/CHANGELOG.md +23 -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 +4 -4
  11. package/dist/js/modern/manager/runner.js +1 -1
  12. package/dist/js/modern/manager/sync.js +5 -6
  13. package/dist/js/modern/waterfall/async.js +4 -8
  14. package/dist/js/modern/waterfall/sync.js +4 -8
  15. package/dist/js/modern/workflow/async.js +1 -4
  16. package/dist/js/modern/workflow/parallel.js +2 -3
  17. package/dist/js/modern/workflow/sync.js +1 -1
  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 +4 -4
  27. package/dist/js/node/manager/runner.js +1 -1
  28. package/dist/js/node/manager/sync.js +5 -6
  29. package/dist/js/node/waterfall/async.js +4 -8
  30. package/dist/js/node/waterfall/sync.js +4 -8
  31. package/dist/js/node/workflow/async.js +1 -4
  32. package/dist/js/node/workflow/parallel.js +2 -3
  33. package/dist/js/node/workflow/sync.js +1 -1
  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 +9 -28
  45. package/dist/js/treeshaking/waterfall/async.js +12 -36
  46. package/dist/js/treeshaking/waterfall/sync.js +11 -31
  47. package/dist/js/treeshaking/workflow/async.js +6 -28
  48. package/dist/js/treeshaking/workflow/parallel.js +6 -26
  49. package/dist/js/treeshaking/workflow/sync.js +5 -24
  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 -10
  66. package/jest.config.js +0 -8
  67. package/modern.config.js +0 -2
  68. package/node.d.ts +0 -1
  69. package/node.js +0 -1
  70. package/tests/.eslintrc.js +0 -6
  71. package/tests/async.test.ts +0 -715
  72. package/tests/fixtures/async/base/bar.ts +0 -22
  73. package/tests/fixtures/async/base/foo.ts +0 -20
  74. package/tests/fixtures/async/base/fooManager.ts +0 -47
  75. package/tests/fixtures/async/core/index.ts +0 -174
  76. package/tests/fixtures/async/dynamic/bar.ts +0 -18
  77. package/tests/fixtures/async/dynamic/foo.ts +0 -27
  78. package/tests/fixtures/sync/base/bar.ts +0 -21
  79. package/tests/fixtures/sync/base/foo.ts +0 -20
  80. package/tests/fixtures/sync/base/fooManager.ts +0 -47
  81. package/tests/fixtures/sync/core/index.ts +0 -171
  82. package/tests/fixtures/sync/dynamic/bar.ts +0 -22
  83. package/tests/fixtures/sync/dynamic/foo.ts +0 -27
  84. package/tests/helpers.ts +0 -4
  85. package/tests/pipeline.test.ts +0 -607
  86. package/tests/sync.test.ts +0 -679
  87. package/tests/tsconfig.json +0 -13
  88. package/tests/waterfall.test.ts +0 -172
  89. package/tests/workflow.test.ts +0 -111
  90. package/tsconfig.json +0 -14
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @modern-js/plugin
2
2
 
3
+ ## 1.3.4
4
+
5
+ ### Patch Changes
6
+
7
+ - d5913bd96: feat: fork farrow-pipeline to remove tslib and reduce bundle size
8
+ - d32f35134: chore: add modern/jest/eslint/ts config files to .npmignore
9
+
10
+ ## 1.3.3
11
+
12
+ ### Patch Changes
13
+
14
+ - 6cffe99d: chore:
15
+ remove react eslint rules for `modern-js` rule set.
16
+ add .eslintrc for each package to speed up linting
17
+ - 60f7d8bf: feat: add tests dir to npmignore
18
+
19
+ ## 1.3.2
20
+
21
+ ### Patch Changes
22
+
23
+ - dc88abf9: fix: should allow to use plugin without setup function
24
+ - 0462ff77: feat: add compatible logic of plugin options with "setup" param
25
+
3
26
  ## 1.3.0
4
27
 
5
28
  ### Minor Changes
@@ -0,0 +1,74 @@
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 NodeAsyncHooks from 'async_hooks';
6
+ import * as asyncHooksInterface from "./asyncHooksInterface";
7
+
8
+ const createAsyncHooks = () => {
9
+ const store = new Map(); // eslint-disable-next-line node/no-unsupported-features/node-builtins
10
+
11
+ const hooks = NodeAsyncHooks.createHook({
12
+ init: (asyncId, _, triggerAsyncId) => {
13
+ if (store.has(triggerAsyncId)) {
14
+ const value = store.get(triggerAsyncId);
15
+
16
+ if (value) {
17
+ store.set(asyncId, value);
18
+ }
19
+ }
20
+ },
21
+ destroy: asyncId => {
22
+ if (store.has(asyncId)) {
23
+ store.delete(asyncId);
24
+ }
25
+ }
26
+ });
27
+
28
+ const set = value => {
29
+ store.set(NodeAsyncHooks.executionAsyncId(), value);
30
+ };
31
+
32
+ const get = () => {
33
+ return store.get(NodeAsyncHooks.executionAsyncId());
34
+ };
35
+
36
+ const clear = () => {
37
+ store.clear();
38
+ };
39
+
40
+ const enable = () => {
41
+ hooks.enable();
42
+ };
43
+
44
+ const disable = () => {
45
+ hooks.disable();
46
+ store.clear();
47
+ };
48
+
49
+ const entries = () => {
50
+ return store.entries();
51
+ };
52
+
53
+ return {
54
+ enable,
55
+ disable,
56
+ set,
57
+ get,
58
+ clear,
59
+ entries
60
+ };
61
+ };
62
+
63
+ export const enable = () => {
64
+ const hooks = createAsyncHooks();
65
+ disable();
66
+ asyncHooksInterface.impl(hooks);
67
+ hooks.enable();
68
+ };
69
+ export const disable = () => {
70
+ var _asyncHooksInterface$;
71
+
72
+ (_asyncHooksInterface$ = asyncHooksInterface.asyncHooks) === null || _asyncHooksInterface$ === void 0 ? void 0 : _asyncHooksInterface$.disable();
73
+ asyncHooksInterface.reset();
74
+ };
@@ -0,0 +1,12 @@
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
+ // eslint-disable-next-line import/no-mutable-exports
6
+ export let asyncHooks;
7
+ export const impl = implimentations => {
8
+ asyncHooks = implimentations;
9
+ };
10
+ export const reset = () => {
11
+ asyncHooks = undefined;
12
+ };
@@ -0,0 +1,99 @@
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 { createHooks } from "./hook";
6
+ const ContextSymbol = Symbol('Context');
7
+ export const createContext = value => {
8
+ const id = Symbol('ContextID');
9
+
10
+ const create = value => {
11
+ const use = () => {
12
+ const container = useContainer();
13
+ return Object.seal({
14
+ get value() {
15
+ return container.read(Context);
16
+ },
17
+
18
+ set value(v) {
19
+ container.write(Context, v);
20
+ }
21
+
22
+ });
23
+ };
24
+
25
+ const get = () => {
26
+ const container = useContainer();
27
+ return container.read(Context);
28
+ };
29
+
30
+ const set = v => {
31
+ const container = useContainer();
32
+ container.write(Context, v);
33
+ };
34
+
35
+ const Context = {
36
+ id,
37
+ [ContextSymbol]: value,
38
+ create,
39
+ use,
40
+ get,
41
+ set
42
+ };
43
+ return Context;
44
+ };
45
+
46
+ return create(value);
47
+ };
48
+
49
+ const createContextMap = storage => {
50
+ const contextMap = new Map();
51
+ const contexts = Object.values(storage); // eslint-disable-next-line @typescript-eslint/prefer-for-of
52
+
53
+ for (let i = 0; i < contexts.length; i++) {
54
+ contextMap.set(contexts[i].id, contexts[i]);
55
+ }
56
+
57
+ return contextMap;
58
+ };
59
+
60
+ export const createContainer = (ContextStorage = {}) => {
61
+ const contextMap = createContextMap(ContextStorage);
62
+
63
+ const read = context => {
64
+ const target = contextMap.get(context.id);
65
+
66
+ if (target) {
67
+ return target[ContextSymbol];
68
+ }
69
+
70
+ return context[ContextSymbol];
71
+ };
72
+
73
+ const write = (context, value) => {
74
+ contextMap.set(context.id, context.create(value));
75
+ };
76
+
77
+ return Object.freeze({
78
+ read,
79
+ write
80
+ });
81
+ };
82
+ const {
83
+ run,
84
+ hooks
85
+ } = createHooks({
86
+ useContainer: () => {
87
+ throw new Error(`Can't call useContainer out of scope, it should be placed on top of the function`);
88
+ }
89
+ });
90
+ export const runHooks = run;
91
+ export const {
92
+ useContainer
93
+ } = hooks;
94
+ export const fromContainer = container => ({
95
+ useContainer: () => {
96
+ return container;
97
+ }
98
+ });
99
+ export const runWithContainer = (f, container) => runHooks(f, fromContainer(container));
@@ -0,0 +1,18 @@
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 const createCounter = callback => {
6
+ const dispatch = (index, input) => {
7
+ const next = (nextInput = input) => dispatch(index + 1, nextInput);
8
+
9
+ return callback(index, input, next);
10
+ };
11
+
12
+ const start = input => dispatch(0, input);
13
+
14
+ return {
15
+ start,
16
+ dispatch
17
+ };
18
+ };
@@ -0,0 +1,42 @@
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 const createHooks = defaultHooks => {
7
+ let currentHooks = {};
8
+ const hooks = {};
9
+
10
+ for (const key in defaultHooks) {
11
+ // eslint-disable-next-line @typescript-eslint/no-loop-func
12
+ const f = (...args) => {
13
+ var _asyncHooks$get;
14
+
15
+ const hooks = currentHooks === defaultHooks ? (_asyncHooks$get = asyncHooks === null || asyncHooks === void 0 ? void 0 : asyncHooks.get()) !== null && _asyncHooks$get !== void 0 ? _asyncHooks$get : defaultHooks : currentHooks;
16
+ let handler = hooks[key];
17
+
18
+ if (typeof handler !== 'function') {
19
+ handler = defaultHooks[key];
20
+ }
21
+
22
+ return handler(...args);
23
+ };
24
+
25
+ hooks[key] = f;
26
+ }
27
+
28
+ const run = (f, implementations) => {
29
+ try {
30
+ currentHooks = implementations || defaultHooks;
31
+ asyncHooks === null || asyncHooks === void 0 ? void 0 : asyncHooks.set(currentHooks);
32
+ return f();
33
+ } finally {
34
+ currentHooks = defaultHooks;
35
+ }
36
+ };
37
+
38
+ return {
39
+ run,
40
+ hooks
41
+ };
42
+ };
@@ -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,93 @@
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
+ /**
8
+ * modified from https://github.com/farrow-js/farrow/tree/master/packages/farrow-pipeline
9
+ * license at https://github.com/farrow-js/farrow/blob/master/LICENSE
10
+ */
11
+ import { createContext, createContainer, fromContainer, runHooks, useContainer, runWithContainer } from "./context";
12
+ import { createCounter } from "./counter";
13
+ export { createContext, createContainer, useContainer, runWithContainer };
14
+ export const isPipeline = input => Boolean(input === null || input === void 0 ? void 0 : input[PipelineSymbol]);
15
+ const PipelineSymbol = Symbol('pipeline');
16
+
17
+ const 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(`${input} is not a Middleware`);
25
+ };
26
+
27
+ export const createPipeline = options => {
28
+ const config = _objectSpread({}, options);
29
+
30
+ const middlewares = [];
31
+
32
+ const use = (...inputs) => {
33
+ middlewares.push(...inputs.map(getMiddleware));
34
+ return pipeline;
35
+ };
36
+
37
+ const createCurrentCounter = (hooks, onLast, onLastWithContext) => {
38
+ return createCounter((index, input, next) => {
39
+ if (index >= middlewares.length) {
40
+ if (onLast) {
41
+ if (onLastWithContext) {
42
+ return runHooks(() => onLast(input), hooks);
43
+ }
44
+
45
+ return onLast(input);
46
+ }
47
+
48
+ throw new Error(`Expect returning a value, but all middlewares just calling next()`);
49
+ }
50
+
51
+ return runHooks(() => middlewares[index](input, next), hooks);
52
+ });
53
+ };
54
+
55
+ const currentContainer = createContainer(config.contexts);
56
+ const currentHooks = fromContainer(currentContainer);
57
+ const currentCounter = createCurrentCounter(currentHooks);
58
+
59
+ const getCounter = options => {
60
+ if (!options) {
61
+ return currentCounter;
62
+ }
63
+
64
+ if (options !== null && options !== void 0 && options.container) {
65
+ const hooks = fromContainer(options === null || options === void 0 ? void 0 : options.container);
66
+ return options !== null && options !== void 0 && options.onLast ? createCurrentCounter(hooks, options.onLast, typeof options.onLastWithContext === 'boolean' ? options.onLastWithContext : true) : createCurrentCounter(hooks);
67
+ }
68
+
69
+ return options !== null && options !== void 0 && options.onLast ? createCurrentCounter(currentHooks, options.onLast, typeof options.onLastWithContext === 'boolean' ? options.onLastWithContext : true) : createCurrentCounter(currentHooks);
70
+ };
71
+
72
+ const run = (input, options) => getCounter(options).start(input);
73
+
74
+ const middleware = (input, next) => {
75
+ const container = useContainer();
76
+ return run(input, {
77
+ container,
78
+ onLast: next
79
+ });
80
+ };
81
+
82
+ const pipeline = {
83
+ [PipelineSymbol]: true,
84
+ use,
85
+ run,
86
+ middleware
87
+ };
88
+ return pipeline;
89
+ };
90
+ export const createAsyncPipeline = options => {
91
+ const pipeline = createPipeline(options);
92
+ return _objectSpread({}, pipeline);
93
+ };
@@ -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";
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
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
6
 
7
- import { runWithContainer, createContainer } from 'farrow-pipeline';
7
+ import { runWithContainer, createContainer } from "../farrow-pipeline";
8
8
  import { isObject, generateRunner, hasOwnProperty, DEFAULT_OPTIONS } from "./sync";
9
9
  import { useRunner } from "./runner";
10
10
  const ASYNC_PLUGIN_SYMBOL = 'ASYNC_PLUGIN_SYMBOL';
@@ -41,12 +41,12 @@ export const createAsyncManager = (hooks, api) => {
41
41
  else if (typeof plugin === 'function') {
42
42
  const options = plugin();
43
43
  addPlugin(createPlugin(options.setup, options));
44
- } // plain plugin options with `setup` param
45
- else if (plugin.setup) {
44
+ } // plain plugin object
45
+ else if (isObject(plugin)) {
46
46
  addPlugin(createPlugin(plugin.setup, plugin));
47
47
  } // unknown plugin
48
48
  else {
49
- console.warn(`Unknown plugin: ${plugin.name || ''}`);
49
+ console.warn(`Unknown plugin: ${JSON.stringify(plugin)}`);
50
50
  }
51
51
  }
52
52
 
@@ -1,4 +1,4 @@
1
- import { createContext } from 'farrow-pipeline';
1
+ import { createContext } from "../farrow-pipeline";
2
2
  export const RunnerContext = createContext(null);
3
3
  export const useRunner = () => {
4
4
  const runner = RunnerContext.use().value;
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
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
6
 
7
- import { isPipeline, createPipeline, runWithContainer, createContainer } from 'farrow-pipeline';
7
+ import { isPipeline, createPipeline, runWithContainer, createContainer } from "../farrow-pipeline";
8
8
  import { isWaterfall, createWaterfall, isAsyncWaterfall, createAsyncWaterfall } from "../waterfall";
9
9
  import { isWorkflow, createWorkflow, isAsyncWorkflow, createAsyncWorkflow, isParallelWorkflow, createParallelWorkflow } from "../workflow";
10
10
  import { RunnerContext, useRunner } from "./runner";
@@ -51,12 +51,12 @@ export const createManager = (hooks, api) => {
51
51
  else if (typeof plugin === 'function') {
52
52
  const options = plugin();
53
53
  addPlugin(createPlugin(options.setup, options));
54
- } // plain plugin options with `setup` param
55
- else if (plugin.setup) {
54
+ } // plain plugin object
55
+ else if (isObject(plugin)) {
56
56
  addPlugin(createPlugin(plugin.setup, plugin));
57
57
  } // unknown plugin
58
58
  else {
59
- console.warn(`Unknown plugin: ${plugin.name || ''}`);
59
+ console.warn(`Unknown plugin: ${JSON.stringify(plugin)}`);
60
60
  }
61
61
  }
62
62
 
@@ -173,8 +173,7 @@ export const cloneHook = hook => {
173
173
 
174
174
  if (isPipeline(hook)) {
175
175
  return createPipeline();
176
- } // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
177
-
176
+ }
178
177
 
179
178
  throw new Error(`Unknown hook: ${hook}`);
180
179
  };
@@ -4,15 +4,14 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
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
6
 
7
- import { createAsyncPipeline, useContainer } from 'farrow-pipeline';
7
+ import { createAsyncPipeline, useContainer } from "../farrow-pipeline";
8
8
  const ASYNC_WATERFALL_SYMBOL = Symbol('ASYNC_WATERFALL_SYMBOL');
9
9
  export const getAsyncBrook = input => {
10
10
  if (typeof input === 'function') {
11
11
  return input;
12
12
  } else if (input && typeof input.middleware === 'function') {
13
13
  return input.middleware;
14
- } // eslint-disable-next-line @typescript-eslint/no-base-to-string,@typescript-eslint/restrict-template-expressions
15
-
14
+ }
16
15
 
17
16
  throw new Error(`${input} is not a AsyncBrook or { brook: AsyncBrook }`);
18
17
  };
@@ -24,15 +23,12 @@ export const createAsyncWaterfall = () => {
24
23
  return waterfall;
25
24
  };
26
25
 
27
- const run = (input, options) => // eslint-disable-next-line @typescript-eslint/no-shadow
28
- pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
26
+ const run = (input, options) => pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
29
27
  onLast: input => input
30
28
  }));
31
29
 
32
30
  const middleware = input => {
33
- // eslint-disable-next-line react-hooks/rules-of-hooks
34
- const container = useContainer(); // eslint-disable-next-line @typescript-eslint/no-shadow
35
-
31
+ const container = useContainer();
36
32
  return pipeline.run(input, {
37
33
  container,
38
34
  onLast: input => input
@@ -4,15 +4,14 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
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
6
 
7
- import { useContainer, createPipeline } from 'farrow-pipeline';
7
+ import { useContainer, createPipeline } from "../farrow-pipeline";
8
8
  const WATERFALL_SYMBOL = Symbol('WATERFALL_SYMBOL');
9
9
  export const getBrook = input => {
10
10
  if (typeof input === 'function') {
11
11
  return input;
12
12
  } else if (input && typeof input.middleware === 'function') {
13
13
  return input.middleware;
14
- } // eslint-disable-next-line @typescript-eslint/no-base-to-string,@typescript-eslint/restrict-template-expressions
15
-
14
+ }
16
15
 
17
16
  throw new Error(`${input} is not a Brook or { brook: Brook }`);
18
17
  };
@@ -24,15 +23,12 @@ export const createWaterfall = () => {
24
23
  return waterfall;
25
24
  };
26
25
 
27
- const run = (input, options) => // eslint-disable-next-line @typescript-eslint/no-shadow
28
- pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
26
+ const run = (input, options) => pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
29
27
  onLast: input => input
30
28
  }));
31
29
 
32
30
  const middleware = input => {
33
- // eslint-disable-next-line react-hooks/rules-of-hooks
34
- const container = useContainer(); // eslint-disable-next-line @typescript-eslint/no-shadow
35
-
31
+ const container = useContainer();
36
32
  return pipeline.run(input, {
37
33
  container,
38
34
  onLast: input => input
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
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
6
 
7
- import { createAsyncPipeline } from 'farrow-pipeline';
7
+ import { createAsyncPipeline } from "../farrow-pipeline";
8
8
  const ASYNC_WORKFLOW_SYMBOL = Symbol('ASYNC_WORKFLOW_SYMBOL');
9
9
  export const isAsyncWorkflow = input => Boolean(input === null || input === void 0 ? void 0 : input[ASYNC_WORKFLOW_SYMBOL]);
10
10
  export const createAsyncWorkflow = () => {
@@ -21,7 +21,6 @@ export const createAsyncWorkflow = () => {
21
21
  }));
22
22
 
23
23
  if (isPromise(result)) {
24
- // eslint-disable-next-line @typescript-eslint/no-shadow,promise/prefer-await-to-then
25
24
  return result.then(result => result.filter(Boolean));
26
25
  } else {
27
26
  return result.filter(Boolean);
@@ -40,7 +39,5 @@ export const createAsyncWorkflow = () => {
40
39
  const mapAsyncWorkerToAsyncMiddleware = worker => async (input, next) => [await worker(input), ...(await next(input))];
41
40
 
42
41
  function isPromise(obj) {
43
- /* eslint-disable promise/prefer-await-to-then */
44
42
  return Boolean(obj) && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
45
- /* eslint-enable promise/prefer-await-to-then */
46
43
  }
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
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
6
 
7
- import { createPipeline } from 'farrow-pipeline';
7
+ import { createPipeline } from "../farrow-pipeline";
8
8
  const PARALLEL_WORKFLOW_SYMBOL = Symbol('PARALLEL_WORKFLOW_SYMBOL');
9
9
  export const isParallelWorkflow = input => Boolean(input === null || input === void 0 ? void 0 : input[PARALLEL_WORKFLOW_SYMBOL]);
10
10
  export const createParallelWorkflow = () => {
@@ -15,8 +15,7 @@ export const createParallelWorkflow = () => {
15
15
  return workflow;
16
16
  };
17
17
 
18
- const run = async (input, options) => // eslint-disable-next-line promise/prefer-await-to-then
19
- Promise.all(pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
18
+ const run = async (input, options) => Promise.all(pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
20
19
  onLast: () => []
21
20
  }))).then(result => result.filter(Boolean));
22
21
 
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
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
6
 
7
- import { createPipeline } from 'farrow-pipeline';
7
+ import { createPipeline } from "../farrow-pipeline";
8
8
  const WORKFLOW_SYMBOL = Symbol('WORKFLOW_SYMBOL');
9
9
  export const createWorkflow = () => {
10
10
  const pipeline = createPipeline();