@modern-js/plugin 2.69.4 → 3.0.0-alpha.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.
Files changed (267) hide show
  1. package/dist/cjs/cli/api.js +119 -0
  2. package/dist/cjs/cli/context.js +85 -0
  3. package/dist/cjs/cli/hooks.js +65 -0
  4. package/dist/cjs/cli/index.js +68 -0
  5. package/dist/cjs/cli/run/config/createLoadedConfig.js +87 -0
  6. package/dist/cjs/cli/run/config/createResolvedConfig.js +48 -0
  7. package/dist/cjs/cli/run/config/loadConfig.js +113 -0
  8. package/dist/cjs/cli/run/create.js +187 -0
  9. package/dist/cjs/cli/run/index.js +56 -0
  10. package/dist/cjs/cli/run/run.js +57 -0
  11. package/dist/cjs/cli/run/types.js +18 -0
  12. package/dist/cjs/cli/run/utils/checkIsDuplicationPlugin.js +45 -0
  13. package/dist/cjs/cli/run/utils/commander.js +56 -0
  14. package/dist/cjs/cli/run/utils/createFileWatcher.js +112 -0
  15. package/dist/cjs/cli/run/utils/debug.js +37 -0
  16. package/dist/cjs/cli/run/utils/initAppDir.js +55 -0
  17. package/dist/cjs/cli/run/utils/mergeConfig.js +66 -0
  18. package/dist/cjs/hooks.js +169 -0
  19. package/dist/cjs/index.js +53 -26
  20. package/dist/cjs/manager.js +135 -0
  21. package/dist/cjs/runtime/api.js +95 -0
  22. package/dist/cjs/runtime/context.js +60 -0
  23. package/dist/cjs/runtime/hooks.js +46 -0
  24. package/dist/cjs/runtime/index.js +51 -0
  25. package/dist/cjs/runtime/run/create.js +79 -0
  26. package/dist/cjs/runtime/run/index.js +37 -0
  27. package/dist/cjs/runtime/run/types.js +18 -0
  28. package/dist/cjs/server/api.js +96 -0
  29. package/dist/cjs/server/context.js +75 -0
  30. package/dist/cjs/server/hooks.js +43 -0
  31. package/dist/cjs/server/index.js +54 -0
  32. package/dist/cjs/server/run/create.js +79 -0
  33. package/dist/cjs/server/run/index.js +40 -0
  34. package/dist/cjs/server/run/types.js +18 -0
  35. package/dist/cjs/types/cli/api.js +18 -0
  36. package/dist/cjs/types/cli/context.js +18 -0
  37. package/dist/cjs/types/cli/hooks.js +18 -0
  38. package/dist/cjs/types/cli/index.js +18 -0
  39. package/dist/cjs/types/cli/plugin.js +18 -0
  40. package/dist/cjs/types/hooks.js +18 -0
  41. package/dist/cjs/types/index.js +18 -0
  42. package/dist/cjs/types/plugin.js +18 -0
  43. package/dist/cjs/types/runtime/api.js +18 -0
  44. package/dist/cjs/types/runtime/context.js +18 -0
  45. package/dist/cjs/types/runtime/hooks.js +18 -0
  46. package/dist/cjs/types/runtime/index.js +18 -0
  47. package/dist/cjs/types/runtime/plugin.js +18 -0
  48. package/dist/cjs/types/server/api.js +18 -0
  49. package/dist/cjs/types/server/context.js +18 -0
  50. package/dist/cjs/types/server/hooks.js +18 -0
  51. package/dist/cjs/types/server/index.js +18 -0
  52. package/dist/cjs/types/server/plugin.js +18 -0
  53. package/dist/cjs/types/utils.js +18 -0
  54. package/dist/esm/cli/api.mjs +85 -0
  55. package/dist/esm/cli/context.mjs +38 -0
  56. package/dist/esm/cli/hooks.mjs +31 -0
  57. package/dist/esm/cli/index.mjs +7 -0
  58. package/dist/esm/cli/run/config/createLoadedConfig.mjs +53 -0
  59. package/dist/esm/cli/run/config/createResolvedConfig.mjs +14 -0
  60. package/dist/esm/cli/run/config/loadConfig.mjs +59 -0
  61. package/dist/esm/cli/run/create.mjs +150 -0
  62. package/dist/esm/cli/run/index.mjs +7 -0
  63. package/dist/esm/cli/run/run.mjs +23 -0
  64. package/dist/esm/cli/run/types.mjs +0 -0
  65. package/dist/esm/cli/run/utils/checkIsDuplicationPlugin.mjs +11 -0
  66. package/dist/esm/cli/run/utils/commander.mjs +16 -0
  67. package/dist/esm/cli/run/utils/createFileWatcher.mjs +68 -0
  68. package/dist/esm/cli/run/utils/debug.mjs +3 -0
  69. package/dist/esm/cli/run/utils/initAppDir.mjs +11 -0
  70. package/dist/esm/cli/run/utils/mergeConfig.mjs +32 -0
  71. package/dist/esm/hooks.mjs +120 -0
  72. package/dist/esm/index.mjs +3 -0
  73. package/dist/esm/manager.mjs +101 -0
  74. package/dist/esm/runtime/api.mjs +61 -0
  75. package/dist/esm/runtime/context.mjs +23 -0
  76. package/dist/esm/runtime/hooks.mjs +12 -0
  77. package/dist/esm/runtime/index.mjs +5 -0
  78. package/dist/esm/runtime/run/create.mjs +45 -0
  79. package/dist/esm/runtime/run/index.mjs +3 -0
  80. package/dist/esm/runtime/run/types.mjs +0 -0
  81. package/dist/esm/server/api.mjs +59 -0
  82. package/dist/esm/server/context.mjs +38 -0
  83. package/dist/esm/server/hooks.mjs +9 -0
  84. package/dist/esm/server/index.mjs +5 -0
  85. package/dist/esm/server/run/create.mjs +45 -0
  86. package/dist/esm/server/run/index.mjs +3 -0
  87. package/dist/esm/server/run/types.mjs +0 -0
  88. package/dist/esm/types/cli/api.mjs +0 -0
  89. package/dist/esm/types/cli/context.mjs +0 -0
  90. package/dist/esm/types/cli/hooks.mjs +0 -0
  91. package/dist/esm/types/cli/index.mjs +0 -0
  92. package/dist/esm/types/cli/plugin.mjs +0 -0
  93. package/dist/esm/types/hooks.mjs +0 -0
  94. package/dist/esm/types/index.mjs +0 -0
  95. package/dist/esm/types/plugin.mjs +0 -0
  96. package/dist/esm/types/runtime/api.mjs +0 -0
  97. package/dist/esm/types/runtime/context.mjs +0 -0
  98. package/dist/esm/types/runtime/hooks.mjs +0 -0
  99. package/dist/esm/types/runtime/index.mjs +0 -0
  100. package/dist/esm/types/runtime/plugin.mjs +0 -0
  101. package/dist/esm/types/server/api.mjs +0 -0
  102. package/dist/esm/types/server/context.mjs +0 -0
  103. package/dist/esm/types/server/hooks.mjs +0 -0
  104. package/dist/esm/types/server/index.mjs +0 -0
  105. package/dist/esm/types/server/plugin.mjs +0 -0
  106. package/dist/esm/types/utils.mjs +0 -0
  107. package/dist/esm-node/cli/api.mjs +85 -0
  108. package/dist/esm-node/cli/context.mjs +38 -0
  109. package/dist/esm-node/cli/hooks.mjs +31 -0
  110. package/dist/esm-node/cli/index.mjs +7 -0
  111. package/dist/esm-node/cli/run/config/createLoadedConfig.mjs +53 -0
  112. package/dist/esm-node/cli/run/config/createResolvedConfig.mjs +14 -0
  113. package/dist/esm-node/cli/run/config/loadConfig.mjs +59 -0
  114. package/dist/esm-node/cli/run/create.mjs +150 -0
  115. package/dist/esm-node/cli/run/index.mjs +7 -0
  116. package/dist/esm-node/cli/run/run.mjs +23 -0
  117. package/dist/esm-node/cli/run/utils/checkIsDuplicationPlugin.mjs +11 -0
  118. package/dist/esm-node/cli/run/utils/commander.mjs +16 -0
  119. package/dist/esm-node/cli/run/utils/createFileWatcher.mjs +68 -0
  120. package/dist/esm-node/cli/run/utils/debug.mjs +3 -0
  121. package/dist/esm-node/cli/run/utils/initAppDir.mjs +11 -0
  122. package/dist/esm-node/cli/run/utils/mergeConfig.mjs +32 -0
  123. package/dist/esm-node/hooks.mjs +120 -0
  124. package/dist/esm-node/index.mjs +3 -0
  125. package/dist/esm-node/manager.mjs +101 -0
  126. package/dist/esm-node/runtime/api.mjs +61 -0
  127. package/dist/esm-node/runtime/context.mjs +23 -0
  128. package/dist/esm-node/runtime/hooks.mjs +12 -0
  129. package/dist/esm-node/runtime/index.mjs +5 -0
  130. package/dist/esm-node/runtime/run/create.mjs +45 -0
  131. package/dist/esm-node/runtime/run/index.mjs +3 -0
  132. package/dist/esm-node/runtime/run/types.mjs +0 -0
  133. package/dist/esm-node/server/api.mjs +59 -0
  134. package/dist/esm-node/server/context.mjs +38 -0
  135. package/dist/esm-node/server/hooks.mjs +9 -0
  136. package/dist/esm-node/server/index.mjs +5 -0
  137. package/dist/esm-node/server/run/create.mjs +45 -0
  138. package/dist/esm-node/server/run/index.mjs +3 -0
  139. package/dist/esm-node/server/run/types.mjs +0 -0
  140. package/dist/esm-node/types/cli/api.mjs +0 -0
  141. package/dist/esm-node/types/cli/context.mjs +0 -0
  142. package/dist/esm-node/types/cli/hooks.mjs +0 -0
  143. package/dist/esm-node/types/cli/index.mjs +0 -0
  144. package/dist/esm-node/types/cli/plugin.mjs +0 -0
  145. package/dist/esm-node/types/hooks.mjs +0 -0
  146. package/dist/esm-node/types/index.mjs +0 -0
  147. package/dist/esm-node/types/plugin.mjs +0 -0
  148. package/dist/esm-node/types/runtime/api.mjs +0 -0
  149. package/dist/esm-node/types/runtime/context.mjs +0 -0
  150. package/dist/esm-node/types/runtime/hooks.mjs +0 -0
  151. package/dist/esm-node/types/runtime/index.mjs +0 -0
  152. package/dist/esm-node/types/runtime/plugin.mjs +0 -0
  153. package/dist/esm-node/types/server/api.mjs +0 -0
  154. package/dist/esm-node/types/server/context.mjs +0 -0
  155. package/dist/esm-node/types/server/hooks.mjs +0 -0
  156. package/dist/esm-node/types/server/index.mjs +0 -0
  157. package/dist/esm-node/types/server/plugin.mjs +0 -0
  158. package/dist/esm-node/types/utils.mjs +0 -0
  159. package/dist/types/cli/api.d.ts +8 -0
  160. package/dist/types/cli/context.d.ts +19 -0
  161. package/dist/types/cli/hooks.d.ts +42 -0
  162. package/dist/types/cli/index.d.ts +6 -0
  163. package/dist/types/cli/run/config/createLoadedConfig.d.ts +2 -0
  164. package/dist/types/cli/run/config/createResolvedConfig.d.ts +3 -0
  165. package/dist/types/cli/run/config/loadConfig.d.ts +25 -0
  166. package/dist/types/cli/run/create.d.ts +16 -0
  167. package/dist/types/cli/run/index.d.ts +13 -0
  168. package/dist/types/cli/run/run.d.ts +2 -0
  169. package/dist/types/cli/run/types.d.ts +32 -0
  170. package/dist/types/cli/run/utils/checkIsDuplicationPlugin.d.ts +1 -0
  171. package/dist/types/cli/run/utils/commander.d.ts +5 -0
  172. package/dist/types/cli/run/utils/createFileWatcher.d.ts +3 -0
  173. package/dist/types/cli/run/utils/debug.d.ts +1 -0
  174. package/dist/types/cli/run/utils/initAppDir.d.ts +1 -0
  175. package/dist/types/cli/run/utils/mergeConfig.d.ts +2 -0
  176. package/dist/types/hooks.d.ts +7 -0
  177. package/dist/types/index.d.ts +7 -4
  178. package/dist/types/manager.d.ts +5 -0
  179. package/dist/types/runtime/api.d.ts +9 -0
  180. package/dist/types/runtime/context.d.ts +11 -0
  181. package/dist/types/runtime/hooks.d.ts +2 -0
  182. package/dist/types/runtime/index.d.ts +5 -0
  183. package/dist/types/runtime/run/create.d.ts +7 -0
  184. package/dist/types/runtime/run/index.d.ts +5 -0
  185. package/dist/types/runtime/run/types.d.ts +6 -0
  186. package/dist/types/server/api.d.ts +9 -0
  187. package/dist/types/server/context.d.ts +13 -0
  188. package/dist/types/server/hooks.d.ts +9 -0
  189. package/dist/types/server/index.d.ts +4 -0
  190. package/dist/types/server/run/create.d.ts +7 -0
  191. package/dist/types/server/run/index.d.ts +8 -0
  192. package/dist/types/server/run/types.d.ts +22 -0
  193. package/dist/types/types/cli/api.d.ts +49 -0
  194. package/dist/types/types/cli/context.d.ts +42 -0
  195. package/dist/types/types/cli/hooks.d.ts +72 -0
  196. package/dist/types/types/cli/index.d.ts +4 -0
  197. package/dist/types/types/cli/plugin.d.ts +17 -0
  198. package/dist/types/types/hooks.d.ts +27 -0
  199. package/dist/types/types/index.d.ts +4 -0
  200. package/dist/types/types/plugin.d.ts +46 -0
  201. package/dist/types/types/runtime/api.d.ts +22 -0
  202. package/dist/types/types/runtime/context.d.ts +13 -0
  203. package/dist/types/types/runtime/hooks.d.ts +39 -0
  204. package/dist/types/types/runtime/index.d.ts +4 -0
  205. package/dist/types/types/runtime/plugin.d.ts +14 -0
  206. package/dist/types/types/server/api.d.ts +19 -0
  207. package/dist/types/types/server/context.d.ts +28 -0
  208. package/dist/types/types/server/hooks.d.ts +24 -0
  209. package/dist/types/types/server/index.d.ts +4 -0
  210. package/dist/types/types/server/plugin.d.ts +14 -0
  211. package/dist/types/types/utils.d.ts +7 -0
  212. package/package.json +68 -14
  213. package/rslib.config.mts +4 -0
  214. package/rstest.config.ts +5 -0
  215. package/dist/cjs/farrow-pipeline/context.js +0 -44
  216. package/dist/cjs/farrow-pipeline/counter.js +0 -37
  217. package/dist/cjs/farrow-pipeline/index.js +0 -87
  218. package/dist/cjs/manager/async.js +0 -124
  219. package/dist/cjs/manager/index.js +0 -26
  220. package/dist/cjs/manager/shared.js +0 -60
  221. package/dist/cjs/manager/sync.js +0 -194
  222. package/dist/cjs/manager/types.js +0 -16
  223. package/dist/cjs/waterfall/async.js +0 -68
  224. package/dist/cjs/waterfall/index.js +0 -24
  225. package/dist/cjs/waterfall/sync.js +0 -67
  226. package/dist/cjs/workflow/async.js +0 -60
  227. package/dist/cjs/workflow/index.js +0 -30
  228. package/dist/cjs/workflow/interrupt.js +0 -64
  229. package/dist/cjs/workflow/parallel.js +0 -53
  230. package/dist/cjs/workflow/sync.js +0 -56
  231. package/dist/cjs/workflow/syncParallel.js +0 -55
  232. package/dist/esm/index.js +0 -882
  233. package/dist/esm-node/farrow-pipeline/context.js +0 -20
  234. package/dist/esm-node/farrow-pipeline/counter.js +0 -13
  235. package/dist/esm-node/farrow-pipeline/index.js +0 -60
  236. package/dist/esm-node/index.js +0 -4
  237. package/dist/esm-node/manager/async.js +0 -106
  238. package/dist/esm-node/manager/index.js +0 -3
  239. package/dist/esm-node/manager/shared.js +0 -32
  240. package/dist/esm-node/manager/sync.js +0 -172
  241. package/dist/esm-node/waterfall/async.js +0 -42
  242. package/dist/esm-node/waterfall/index.js +0 -2
  243. package/dist/esm-node/waterfall/sync.js +0 -41
  244. package/dist/esm-node/workflow/async.js +0 -35
  245. package/dist/esm-node/workflow/index.js +0 -5
  246. package/dist/esm-node/workflow/interrupt.js +0 -39
  247. package/dist/esm-node/workflow/parallel.js +0 -28
  248. package/dist/esm-node/workflow/sync.js +0 -31
  249. package/dist/esm-node/workflow/syncParallel.js +0 -30
  250. package/dist/types/farrow-pipeline/context.d.ts +0 -12
  251. package/dist/types/farrow-pipeline/counter.d.ts +0 -11
  252. package/dist/types/farrow-pipeline/index.d.ts +0 -29
  253. package/dist/types/manager/async.d.ts +0 -54
  254. package/dist/types/manager/index.d.ts +0 -3
  255. package/dist/types/manager/shared.d.ts +0 -12
  256. package/dist/types/manager/sync.d.ts +0 -66
  257. package/dist/types/manager/types.d.ts +0 -33
  258. package/dist/types/waterfall/async.d.ts +0 -21
  259. package/dist/types/waterfall/index.d.ts +0 -2
  260. package/dist/types/waterfall/sync.d.ts +0 -20
  261. package/dist/types/workflow/async.d.ts +0 -12
  262. package/dist/types/workflow/index.d.ts +0 -5
  263. package/dist/types/workflow/interrupt.d.ts +0 -12
  264. package/dist/types/workflow/parallel.d.ts +0 -10
  265. package/dist/types/workflow/sync.d.ts +0 -11
  266. package/dist/types/workflow/syncParallel.d.ts +0 -10
  267. /package/dist/esm-node/{manager/types.js → cli/run/types.mjs} +0 -0
@@ -1,67 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
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
24
- });
25
- module.exports = __toCommonJS(sync_exports);
26
- var import_farrow_pipeline = require("../farrow-pipeline");
27
- const WATERFALL_SYMBOL = Symbol.for("MODERN_WATERFALL");
28
- const getBrook = (input) => {
29
- if (typeof input === "function") {
30
- return input;
31
- } else if (input && typeof input.middleware === "function") {
32
- return input.middleware;
33
- }
34
- throw new Error(`${input} is not a Brook or { brook: Brook }`);
35
- };
36
- const createWaterfall = () => {
37
- const pipeline = (0, import_farrow_pipeline.createPipeline)();
38
- const use = (...brooks) => {
39
- pipeline.use(...brooks.map(getBrook).map(mapBrookToMiddleware));
40
- return waterfall;
41
- };
42
- const run = (input, options) => pipeline.run(input, {
43
- ...options,
44
- onLast: (input2) => input2
45
- });
46
- const middleware = (input) => {
47
- return pipeline.run(input, {
48
- onLast: (input2) => input2
49
- });
50
- };
51
- const waterfall = {
52
- ...pipeline,
53
- use,
54
- run,
55
- middleware,
56
- [WATERFALL_SYMBOL]: true
57
- };
58
- return waterfall;
59
- };
60
- const isWaterfall = (input) => Boolean(input === null || input === void 0 ? void 0 : input[WATERFALL_SYMBOL]);
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,60 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
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
23
- });
24
- module.exports = __toCommonJS(async_exports);
25
- var import_farrow_pipeline = require("../farrow-pipeline");
26
- const ASYNC_WORKFLOW_SYMBOL = Symbol.for("MODERN_ASYNC_WORKFLOW");
27
- const isPromise = (obj) => obj && typeof obj.then === "function";
28
- const isAsyncWorkflow = (input) => Boolean(input === null || input === void 0 ? void 0 : input[ASYNC_WORKFLOW_SYMBOL]);
29
- const createAsyncWorkflow = () => {
30
- const pipeline = (0, import_farrow_pipeline.createAsyncPipeline)();
31
- const use = (...input) => {
32
- pipeline.use(...input.map(mapAsyncWorkerToAsyncMiddleware));
33
- return workflow;
34
- };
35
- const run = (input) => {
36
- const result = pipeline.run(input, {
37
- onLast: () => []
38
- });
39
- if (isPromise(result)) {
40
- return result.then((result2) => result2.filter(Boolean));
41
- }
42
- return result.filter(Boolean);
43
- };
44
- const workflow = {
45
- ...pipeline,
46
- use,
47
- run,
48
- [ASYNC_WORKFLOW_SYMBOL]: true
49
- };
50
- return workflow;
51
- };
52
- const mapAsyncWorkerToAsyncMiddleware = (worker) => (input, next) => Promise.resolve(worker(input)).then((result) => Promise.resolve(next(input)).then((nextResult) => [
53
- result,
54
- ...nextResult
55
- ]));
56
- // Annotate the CommonJS export names for ESM import in node:
57
- 0 && (module.exports = {
58
- createAsyncWorkflow,
59
- isAsyncWorkflow
60
- });
@@ -1,30 +0,0 @@
1
- "use strict";
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("./syncParallel"), module.exports);
20
- __reExport(workflow_exports, require("./parallel"), module.exports);
21
- __reExport(workflow_exports, require("./async"), module.exports);
22
- __reExport(workflow_exports, require("./interrupt"), module.exports);
23
- // Annotate the CommonJS export names for ESM import in node:
24
- 0 && (module.exports = {
25
- ...require("./sync"),
26
- ...require("./syncParallel"),
27
- ...require("./parallel"),
28
- ...require("./async"),
29
- ...require("./interrupt")
30
- });
@@ -1,64 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var interrupt_exports = {};
20
- __export(interrupt_exports, {
21
- createAsyncInterruptWorkflow: () => createAsyncInterruptWorkflow,
22
- isAsyncInterruptWorkflow: () => isAsyncInterruptWorkflow
23
- });
24
- module.exports = __toCommonJS(interrupt_exports);
25
- var import_farrow_pipeline = require("../farrow-pipeline");
26
- const ASYNC_INTERRUPT_WORKFLOW_SYMBOL = Symbol.for("ASYNC_INTERRUPT_WORKFLOW_SYMBOL");
27
- const isAsyncInterruptWorkflow = (input) => Boolean(input === null || input === void 0 ? void 0 : input[ASYNC_INTERRUPT_WORKFLOW_SYMBOL]);
28
- const createAsyncInterruptWorkflow = () => {
29
- const pipeline = (0, import_farrow_pipeline.createAsyncPipeline)();
30
- const use = (...input) => {
31
- pipeline.use(...input.map(mapAsyncWorkerToInterruptMiddleware));
32
- return workflow;
33
- };
34
- const run = async (input) => {
35
- const result = await pipeline.run(input, {
36
- onLast: () => []
37
- });
38
- return result;
39
- };
40
- const workflow = {
41
- ...pipeline,
42
- use,
43
- run,
44
- [ASYNC_INTERRUPT_WORKFLOW_SYMBOL]: true
45
- };
46
- return workflow;
47
- };
48
- const mapAsyncWorkerToInterruptMiddleware = (worker) => async (input, next) => {
49
- let isInterrupted = false;
50
- const interrupt = (value) => {
51
- isInterrupted = true;
52
- return value;
53
- };
54
- const result = await Promise.resolve(worker(input, interrupt));
55
- if (isInterrupted) {
56
- return result;
57
- }
58
- return Promise.resolve(next(input));
59
- };
60
- // Annotate the CommonJS export names for ESM import in node:
61
- 0 && (module.exports = {
62
- createAsyncInterruptWorkflow,
63
- isAsyncInterruptWorkflow
64
- });
@@ -1,53 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
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
23
- });
24
- module.exports = __toCommonJS(parallel_exports);
25
- var import_farrow_pipeline = require("../farrow-pipeline");
26
- const PARALLEL_WORKFLOW_SYMBOL = Symbol.for("MODERN_PARALLEL_WORKFLOW");
27
- const isParallelWorkflow = (input) => Boolean(input === null || input === void 0 ? void 0 : input[PARALLEL_WORKFLOW_SYMBOL]);
28
- const createParallelWorkflow = () => {
29
- const pipeline = (0, import_farrow_pipeline.createPipeline)();
30
- const use = (...input) => {
31
- pipeline.use(...input.map(mapParallelWorkerToAsyncMiddleware));
32
- return workflow;
33
- };
34
- const run = (input) => Promise.all(pipeline.run(input, {
35
- onLast: () => []
36
- })).then((result) => result.filter(Boolean));
37
- const workflow = {
38
- ...pipeline,
39
- run,
40
- use,
41
- [PARALLEL_WORKFLOW_SYMBOL]: true
42
- };
43
- return workflow;
44
- };
45
- const mapParallelWorkerToAsyncMiddleware = (worker) => (input, next) => [
46
- worker(input),
47
- ...next(input)
48
- ];
49
- // Annotate the CommonJS export names for ESM import in node:
50
- 0 && (module.exports = {
51
- createParallelWorkflow,
52
- isParallelWorkflow
53
- });
@@ -1,56 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
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
23
- });
24
- module.exports = __toCommonJS(sync_exports);
25
- var import_farrow_pipeline = require("../farrow-pipeline");
26
- const WORKFLOW_SYMBOL = Symbol.for("MODERN_WORKFLOW");
27
- const createWorkflow = () => {
28
- const pipeline = (0, import_farrow_pipeline.createPipeline)();
29
- const use = (...input) => {
30
- pipeline.use(...input.map(mapWorkerToMiddleware));
31
- return workflow;
32
- };
33
- const run = (input) => {
34
- const result = pipeline.run(input, {
35
- onLast: () => []
36
- });
37
- return result.filter(Boolean);
38
- };
39
- const workflow = {
40
- ...pipeline,
41
- use,
42
- run,
43
- [WORKFLOW_SYMBOL]: true
44
- };
45
- return workflow;
46
- };
47
- const isWorkflow = (input) => Boolean(input === null || input === void 0 ? void 0 : input[WORKFLOW_SYMBOL]);
48
- const mapWorkerToMiddleware = (worker) => (input, next) => [
49
- worker(input),
50
- ...next(input)
51
- ];
52
- // Annotate the CommonJS export names for ESM import in node:
53
- 0 && (module.exports = {
54
- createWorkflow,
55
- isWorkflow
56
- });
@@ -1,55 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var syncParallel_exports = {};
20
- __export(syncParallel_exports, {
21
- createSyncParallelWorkflow: () => createSyncParallelWorkflow,
22
- isSyncParallelWorkflow: () => isSyncParallelWorkflow
23
- });
24
- module.exports = __toCommonJS(syncParallel_exports);
25
- var import_farrow_pipeline = require("../farrow-pipeline");
26
- const SYNC_PARALLEL_WORKFLOW_SYMBOL = Symbol.for("SYNC_MODERN_PARALLEL_WORKFLOW");
27
- const isSyncParallelWorkflow = (input) => Boolean(input === null || input === void 0 ? void 0 : input[SYNC_PARALLEL_WORKFLOW_SYMBOL]);
28
- const createSyncParallelWorkflow = () => {
29
- const pipeline = (0, import_farrow_pipeline.createPipeline)();
30
- const use = (...input) => {
31
- pipeline.use(...input.map(mapSyncParallelWorkerToMiddleware));
32
- return workflow;
33
- };
34
- const run = (input) => {
35
- return pipeline.run(input, {
36
- onLast: () => []
37
- }).filter((result) => Boolean(result));
38
- };
39
- const workflow = {
40
- ...pipeline,
41
- run,
42
- use,
43
- [SYNC_PARALLEL_WORKFLOW_SYMBOL]: true
44
- };
45
- return workflow;
46
- };
47
- const mapSyncParallelWorkerToMiddleware = (worker) => (input, next) => [
48
- worker(input),
49
- ...next(input)
50
- ];
51
- // Annotate the CommonJS export names for ESM import in node:
52
- 0 && (module.exports = {
53
- createSyncParallelWorkflow,
54
- isSyncParallelWorkflow
55
- });