@modern-js/plugin 1.3.8 → 1.4.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 (58) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/js/modern/farrow-pipeline/context.js +14 -75
  3. package/dist/js/modern/farrow-pipeline/index.js +0 -14
  4. package/dist/js/modern/farrow-pipeline/pipeline.js +12 -29
  5. package/dist/js/modern/manager/async.js +4 -11
  6. package/dist/js/modern/manager/runner.js +1 -9
  7. package/dist/js/modern/manager/sync.js +8 -16
  8. package/dist/js/modern/waterfall/async.js +1 -3
  9. package/dist/js/modern/waterfall/sync.js +1 -3
  10. package/dist/js/modern/workflow/async.js +3 -3
  11. package/dist/js/modern/workflow/parallel.js +2 -2
  12. package/dist/js/modern/workflow/sync.js +3 -3
  13. package/dist/js/node/farrow-pipeline/context.js +15 -88
  14. package/dist/js/node/farrow-pipeline/pipeline.js +10 -45
  15. package/dist/js/node/manager/async.js +4 -12
  16. package/dist/js/node/manager/runner.js +1 -9
  17. package/dist/js/node/manager/sync.js +8 -15
  18. package/dist/js/node/waterfall/async.js +0 -2
  19. package/dist/js/node/waterfall/sync.js +0 -2
  20. package/dist/js/node/workflow/async.js +3 -3
  21. package/dist/js/node/workflow/parallel.js +2 -2
  22. package/dist/js/node/workflow/sync.js +3 -3
  23. package/dist/js/treeshaking/farrow-pipeline/context.js +14 -75
  24. package/dist/js/treeshaking/farrow-pipeline/index.js +0 -14
  25. package/dist/js/treeshaking/farrow-pipeline/pipeline.js +10 -29
  26. package/dist/js/treeshaking/manager/async.js +10 -17
  27. package/dist/js/treeshaking/manager/runner.js +1 -7
  28. package/dist/js/treeshaking/manager/sync.js +9 -17
  29. package/dist/js/treeshaking/waterfall/async.js +1 -3
  30. package/dist/js/treeshaking/waterfall/sync.js +1 -3
  31. package/dist/js/treeshaking/workflow/async.js +6 -6
  32. package/dist/js/treeshaking/workflow/parallel.js +5 -5
  33. package/dist/js/treeshaking/workflow/sync.js +3 -3
  34. package/dist/types/farrow-pipeline/context.d.ts +5 -20
  35. package/dist/types/farrow-pipeline/index.d.ts +0 -14
  36. package/dist/types/farrow-pipeline/pipeline.d.ts +5 -14
  37. package/dist/types/manager/async.d.ts +4 -7
  38. package/dist/types/manager/runner.d.ts +0 -1
  39. package/dist/types/manager/sync.d.ts +5 -9
  40. package/dist/types/manager/types.d.ts +1 -6
  41. package/dist/types/waterfall/async.d.ts +1 -7
  42. package/dist/types/waterfall/sync.d.ts +0 -7
  43. package/dist/types/workflow/async.d.ts +1 -7
  44. package/dist/types/workflow/parallel.d.ts +2 -9
  45. package/dist/types/workflow/sync.d.ts +1 -10
  46. package/package.json +1 -12
  47. package/dist/js/modern/farrow-pipeline/asyncHooks.node.js +0 -80
  48. package/dist/js/modern/farrow-pipeline/asyncHooksInterface.js +0 -12
  49. package/dist/js/modern/farrow-pipeline/hook.js +0 -42
  50. package/dist/js/node/farrow-pipeline/asyncHooks.node.js +0 -100
  51. package/dist/js/node/farrow-pipeline/asyncHooksInterface.js +0 -26
  52. package/dist/js/node/farrow-pipeline/hook.js +0 -52
  53. package/dist/js/treeshaking/farrow-pipeline/asyncHooks.node.js +0 -80
  54. package/dist/js/treeshaking/farrow-pipeline/asyncHooksInterface.js +0 -12
  55. package/dist/js/treeshaking/farrow-pipeline/hook.js +0 -46
  56. package/dist/types/farrow-pipeline/asyncHooks.node.d.ts +0 -2
  57. package/dist/types/farrow-pipeline/asyncHooksInterface.d.ts +0 -19
  58. package/dist/types/farrow-pipeline/hook.d.ts +0 -9
@@ -1,26 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.reset = exports.impl = exports.asyncHooks = void 0;
7
-
8
- /**
9
- * modified from https://github.com/farrow-js/farrow/tree/master/packages/farrow-pipeline
10
- * license at https://github.com/farrow-js/farrow/blob/master/LICENSE
11
- */
12
- // eslint-disable-next-line import/no-mutable-exports
13
- let asyncHooks;
14
- exports.asyncHooks = asyncHooks;
15
-
16
- const impl = implimentations => {
17
- exports.asyncHooks = asyncHooks = implimentations;
18
- };
19
-
20
- exports.impl = impl;
21
-
22
- const reset = () => {
23
- exports.asyncHooks = asyncHooks = undefined;
24
- };
25
-
26
- exports.reset = reset;
@@ -1,52 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createHooks = void 0;
7
-
8
- var _asyncHooksInterface = require("./asyncHooksInterface");
9
-
10
- /**
11
- * modified from https://github.com/farrow-js/farrow/tree/master/packages/farrow-pipeline
12
- * license at https://github.com/farrow-js/farrow/blob/master/LICENSE
13
- */
14
- const createHooks = defaultHooks => {
15
- let currentHooks = {};
16
- const hooks = {};
17
-
18
- for (const key in defaultHooks) {
19
- // eslint-disable-next-line @typescript-eslint/no-loop-func
20
- const f = (...args) => {
21
- var _asyncHooks$get;
22
-
23
- const hooks = currentHooks === defaultHooks ? (_asyncHooks$get = _asyncHooksInterface.asyncHooks === null || _asyncHooksInterface.asyncHooks === void 0 ? void 0 : _asyncHooksInterface.asyncHooks.get()) !== null && _asyncHooks$get !== void 0 ? _asyncHooks$get : defaultHooks : currentHooks;
24
- let handler = hooks[key];
25
-
26
- if (typeof handler !== 'function') {
27
- handler = defaultHooks[key];
28
- }
29
-
30
- return handler(...args);
31
- };
32
-
33
- hooks[key] = f;
34
- }
35
-
36
- const run = (f, implementations) => {
37
- try {
38
- currentHooks = implementations || defaultHooks;
39
- _asyncHooksInterface.asyncHooks === null || _asyncHooksInterface.asyncHooks === void 0 ? void 0 : _asyncHooksInterface.asyncHooks.set(currentHooks);
40
- return f();
41
- } finally {
42
- currentHooks = defaultHooks;
43
- }
44
- };
45
-
46
- return {
47
- run,
48
- hooks
49
- };
50
- };
51
-
52
- exports.createHooks = createHooks;
@@ -1,80 +0,0 @@
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
- var createAsyncHooks = function createAsyncHooks() {
9
- var store = new Map(); // eslint-disable-next-line node/no-unsupported-features/node-builtins
10
-
11
- var hooks = NodeAsyncHooks.createHook({
12
- init: function init(asyncId, _, triggerAsyncId) {
13
- if (store.has(triggerAsyncId)) {
14
- var value = store.get(triggerAsyncId);
15
-
16
- if (value) {
17
- store.set(asyncId, value);
18
- }
19
- }
20
- },
21
- destroy: function destroy(asyncId) {
22
- if (store.has(asyncId)) {
23
- store["delete"](asyncId);
24
- }
25
- }
26
- });
27
-
28
- var set = function set(value) {
29
- store.set(NodeAsyncHooks.executionAsyncId(), value);
30
- };
31
-
32
- var get = function get() {
33
- return store.get(NodeAsyncHooks.executionAsyncId());
34
- };
35
-
36
- var clear = function clear() {
37
- store.clear();
38
- };
39
-
40
- var enable = function enable() {
41
- hooks.enable();
42
- };
43
-
44
- var disable = function disable() {
45
- hooks.disable();
46
- store.clear();
47
- };
48
-
49
- var entries = function entries() {
50
- return store.entries();
51
- };
52
-
53
- return {
54
- enable: enable,
55
- disable: disable,
56
- set: set,
57
- get: get,
58
- clear: clear,
59
- entries: entries
60
- };
61
- };
62
-
63
- var enabled = false;
64
- export var enable = function enable() {
65
- if (enabled) {
66
- return;
67
- }
68
-
69
- enabled = true;
70
- var hooks = createAsyncHooks();
71
- asyncHooksInterface.impl(hooks);
72
- hooks.enable();
73
- };
74
- export var disable = function disable() {
75
- var _asyncHooksInterface$;
76
-
77
- enabled = false;
78
- (_asyncHooksInterface$ = asyncHooksInterface.asyncHooks) === null || _asyncHooksInterface$ === void 0 ? void 0 : _asyncHooksInterface$.disable();
79
- asyncHooksInterface.reset();
80
- };
@@ -1,12 +0,0 @@
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 var asyncHooks;
7
- export var impl = function impl(implimentations) {
8
- asyncHooks = implimentations;
9
- };
10
- export var reset = function reset() {
11
- asyncHooks = undefined;
12
- };
@@ -1,46 +0,0 @@
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
- };
@@ -1,2 +0,0 @@
1
- export declare const enable: () => void;
2
- export declare const disable: () => void;
@@ -1,19 +0,0 @@
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 declare type AnyFn = (...args: any) => any;
6
- export declare type Hooks = {
7
- [key: string]: AnyFn;
8
- };
9
- export declare type AsyncHooks = {
10
- enable: () => void;
11
- disable: () => void;
12
- set: (value: Hooks) => void;
13
- get: () => Hooks | undefined;
14
- clear: () => void;
15
- entries: () => IterableIterator<[number, Hooks]>;
16
- } | undefined;
17
- export declare let asyncHooks: AsyncHooks;
18
- export declare const impl: (implimentations: AsyncHooks) => void;
19
- export declare const reset: () => void;
@@ -1,9 +0,0 @@
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 { Hooks, AnyFn } from './asyncHooksInterface';
6
- export declare const createHooks: <HS extends Hooks>(defaultHooks: HS) => {
7
- run: <F extends AnyFn>(f: F, implementations: HS) => ReturnType<F>;
8
- hooks: HS;
9
- };