@modern-js/plugin 1.3.7 → 1.3.8
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.
- package/CHANGELOG.md +7 -0
- package/dist/js/modern/farrow-pipeline/asyncHooks.node.js +7 -1
- package/dist/js/node/farrow-pipeline/asyncHooks.node.js +8 -1
- package/dist/js/treeshaking/farrow-pipeline/asyncHooks.node.js +7 -1
- package/dist/types/farrow-pipeline/context.d.ts +2 -2
- package/dist/types/manager/runner.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -60,15 +60,21 @@ const createAsyncHooks = () => {
|
|
60
60
|
};
|
61
61
|
};
|
62
62
|
|
63
|
+
let enabled = false;
|
63
64
|
export const enable = () => {
|
65
|
+
if (enabled) {
|
66
|
+
return;
|
67
|
+
}
|
68
|
+
|
69
|
+
enabled = true;
|
64
70
|
const hooks = createAsyncHooks();
|
65
|
-
disable();
|
66
71
|
asyncHooksInterface.impl(hooks);
|
67
72
|
hooks.enable();
|
68
73
|
};
|
69
74
|
export const disable = () => {
|
70
75
|
var _asyncHooksInterface$;
|
71
76
|
|
77
|
+
enabled = false;
|
72
78
|
(_asyncHooksInterface$ = asyncHooksInterface.asyncHooks) === null || _asyncHooksInterface$ === void 0 ? void 0 : _asyncHooksInterface$.disable();
|
73
79
|
asyncHooksInterface.reset();
|
74
80
|
};
|
@@ -74,9 +74,15 @@ const createAsyncHooks = () => {
|
|
74
74
|
};
|
75
75
|
};
|
76
76
|
|
77
|
+
let enabled = false;
|
78
|
+
|
77
79
|
const enable = () => {
|
80
|
+
if (enabled) {
|
81
|
+
return;
|
82
|
+
}
|
83
|
+
|
84
|
+
enabled = true;
|
78
85
|
const hooks = createAsyncHooks();
|
79
|
-
disable();
|
80
86
|
asyncHooksInterface.impl(hooks);
|
81
87
|
hooks.enable();
|
82
88
|
};
|
@@ -86,6 +92,7 @@ exports.enable = enable;
|
|
86
92
|
const disable = () => {
|
87
93
|
var _asyncHooksInterface$;
|
88
94
|
|
95
|
+
enabled = false;
|
89
96
|
(_asyncHooksInterface$ = asyncHooksInterface.asyncHooks) === null || _asyncHooksInterface$ === void 0 ? void 0 : _asyncHooksInterface$.disable();
|
90
97
|
asyncHooksInterface.reset();
|
91
98
|
};
|
@@ -60,15 +60,21 @@ var createAsyncHooks = function createAsyncHooks() {
|
|
60
60
|
};
|
61
61
|
};
|
62
62
|
|
63
|
+
var enabled = false;
|
63
64
|
export var enable = function enable() {
|
65
|
+
if (enabled) {
|
66
|
+
return;
|
67
|
+
}
|
68
|
+
|
69
|
+
enabled = true;
|
64
70
|
var hooks = createAsyncHooks();
|
65
|
-
disable();
|
66
71
|
asyncHooksInterface.impl(hooks);
|
67
72
|
hooks.enable();
|
68
73
|
};
|
69
74
|
export var disable = function disable() {
|
70
75
|
var _asyncHooksInterface$;
|
71
76
|
|
77
|
+
enabled = false;
|
72
78
|
(_asyncHooksInterface$ = asyncHooksInterface.asyncHooks) === null || _asyncHooksInterface$ === void 0 ? void 0 : _asyncHooksInterface$.disable();
|
73
79
|
asyncHooksInterface.reset();
|
74
80
|
};
|
@@ -21,8 +21,8 @@ export declare const createContainer: (ContextStorage?: ContextStorage) => Conta
|
|
21
21
|
export declare type Hooks = {
|
22
22
|
useContainer: () => Container;
|
23
23
|
};
|
24
|
+
export type { AnyFn } from './asyncHooksInterface';
|
24
25
|
export declare const runHooks: <F extends import("./asyncHooksInterface").AnyFn>(f: F, implementations: Hooks) => ReturnType<F>;
|
25
26
|
export declare const useContainer: () => Container;
|
26
27
|
export declare const fromContainer: (container: Container) => Hooks;
|
27
|
-
export declare const runWithContainer: <F extends (...args: any) => any>(f: F, container: Container) => ReturnType<F>;
|
28
|
-
export {};
|
28
|
+
export declare const runWithContainer: <F extends (...args: any) => any>(f: F, container: Container) => ReturnType<F>;
|