@modern-js/plugin-v2 2.65.3 → 2.65.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.
- package/dist/cjs/runtime/api.js +1 -1
- package/dist/cjs/runtime/hooks.js +1 -1
- package/dist/cjs/runtime/run/create.js +2 -2
- package/dist/esm/runtime/api.js +1 -1
- package/dist/esm/runtime/hooks.js +1 -1
- package/dist/esm/runtime/run/create.js +4 -2
- package/dist/esm-node/runtime/api.js +1 -1
- package/dist/esm-node/runtime/hooks.js +1 -1
- package/dist/esm-node/runtime/run/create.js +2 -2
- package/dist/types/types/cli/hooks.d.ts +1 -1
- package/dist/types/types/runtime/api.d.ts +2 -2
- package/dist/types/types/runtime/hooks.d.ts +2 -2
- package/package.json +8 -8
package/dist/cjs/runtime/api.js
CHANGED
|
@@ -66,7 +66,7 @@ function initPluginAPI({ context, plugins }) {
|
|
|
66
66
|
updateRuntimeContext,
|
|
67
67
|
getHooks,
|
|
68
68
|
getRuntimeConfig,
|
|
69
|
-
|
|
69
|
+
config: hooks.config.tap,
|
|
70
70
|
onBeforeRender: hooks.onBeforeRender.tap,
|
|
71
71
|
wrapRoot: hooks.wrapRoot.tap,
|
|
72
72
|
pickContext: hooks.pickContext.tap,
|
|
@@ -27,7 +27,7 @@ function initHooks() {
|
|
|
27
27
|
onBeforeRender: (0, import_hooks.createAsyncInterruptHook)(),
|
|
28
28
|
wrapRoot: (0, import_hooks.createSyncHook)(),
|
|
29
29
|
pickContext: (0, import_hooks.createSyncHook)(),
|
|
30
|
-
|
|
30
|
+
config: (0, import_hooks.createCollectSyncHook)()
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -58,8 +58,8 @@ const createRuntime = () => {
|
|
|
58
58
|
}
|
|
59
59
|
function run(options) {
|
|
60
60
|
const { runtimeContext } = init(options);
|
|
61
|
-
const configs = runtimeContext.hooks.
|
|
62
|
-
runtimeContext.config = (0, import_merge.merge)({}, ...configs);
|
|
61
|
+
const configs = runtimeContext.hooks.config.call().filter((config) => Boolean(config));
|
|
62
|
+
runtimeContext.config = (0, import_merge.merge)({}, ...configs, runtimeContext.config || {});
|
|
63
63
|
return {
|
|
64
64
|
runtimeContext
|
|
65
65
|
};
|
package/dist/esm/runtime/api.js
CHANGED
|
@@ -48,7 +48,7 @@ function initPluginAPI(param) {
|
|
|
48
48
|
updateRuntimeContext,
|
|
49
49
|
getHooks,
|
|
50
50
|
getRuntimeConfig,
|
|
51
|
-
|
|
51
|
+
config: hooks.config.tap,
|
|
52
52
|
onBeforeRender: hooks.onBeforeRender.tap,
|
|
53
53
|
wrapRoot: hooks.wrapRoot.tap,
|
|
54
54
|
pickContext: hooks.pickContext.tap
|
|
@@ -51,12 +51,14 @@ var createRuntime = function() {
|
|
|
51
51
|
};
|
|
52
52
|
var run = function run2(options) {
|
|
53
53
|
var runtimeContext = init(options).runtimeContext;
|
|
54
|
-
var configs = runtimeContext.hooks.
|
|
54
|
+
var configs = runtimeContext.hooks.config.call().filter(function(config) {
|
|
55
55
|
return Boolean(config);
|
|
56
56
|
});
|
|
57
57
|
runtimeContext.config = merge.apply(void 0, [
|
|
58
58
|
{}
|
|
59
|
-
].concat(_to_consumable_array(configs)
|
|
59
|
+
].concat(_to_consumable_array(configs), [
|
|
60
|
+
runtimeContext.config || {}
|
|
61
|
+
]));
|
|
60
62
|
return {
|
|
61
63
|
runtimeContext
|
|
62
64
|
};
|
|
@@ -43,7 +43,7 @@ function initPluginAPI({ context, plugins }) {
|
|
|
43
43
|
updateRuntimeContext,
|
|
44
44
|
getHooks,
|
|
45
45
|
getRuntimeConfig,
|
|
46
|
-
|
|
46
|
+
config: hooks.config.tap,
|
|
47
47
|
onBeforeRender: hooks.onBeforeRender.tap,
|
|
48
48
|
wrapRoot: hooks.wrapRoot.tap,
|
|
49
49
|
pickContext: hooks.pickContext.tap,
|
|
@@ -35,8 +35,8 @@ const createRuntime = () => {
|
|
|
35
35
|
}
|
|
36
36
|
function run(options) {
|
|
37
37
|
const { runtimeContext } = init(options);
|
|
38
|
-
const configs = runtimeContext.hooks.
|
|
39
|
-
runtimeContext.config = merge({}, ...configs);
|
|
38
|
+
const configs = runtimeContext.hooks.config.call().filter((config) => Boolean(config));
|
|
39
|
+
runtimeContext.config = merge({}, ...configs, runtimeContext.config || {});
|
|
40
40
|
return {
|
|
41
41
|
runtimeContext
|
|
42
42
|
};
|
|
@@ -53,7 +53,7 @@ export type OnAfterDevFn = (params: {
|
|
|
53
53
|
}) => Promise<void> | void;
|
|
54
54
|
export type OnBeforeDeployFn = (options?: Record<string, any>) => Promise<void> | void;
|
|
55
55
|
export type OnAfterDeployFn = (options?: Record<string, any>) => Promise<void> | void;
|
|
56
|
-
export type OnBeforeExitFn = () => void;
|
|
56
|
+
export type OnBeforeExitFn = () => Promise<void> | void;
|
|
57
57
|
export type ModifyBundlerChainFn<ExtendsUtils> = (chain: RspackChain, utils: ModifyBundlerChainUtils & ExtendsUtils) => MaybePromise<void>;
|
|
58
58
|
export type ModifyRsbuildConfigUtils = {
|
|
59
59
|
/** Merge multiple Rsbuild config objects into one. */
|
|
@@ -2,7 +2,7 @@ import type { PluginHook, PluginHookTap } from '../hooks';
|
|
|
2
2
|
import type { DeepPartial } from '../utils';
|
|
3
3
|
import type { RuntimeContext } from './context';
|
|
4
4
|
import type { Hooks } from './hooks';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ConfigFn, OnBeforeRenderFn, PickContextFn, WrapRootFn } from './hooks';
|
|
6
6
|
import type { RuntimePluginExtends } from './plugin';
|
|
7
7
|
export type RuntimePluginAPI<Extends extends RuntimePluginExtends> = Readonly<{
|
|
8
8
|
updateRuntimeContext: (updateContext: DeepPartial<RuntimeContext>) => void;
|
|
@@ -11,7 +11,7 @@ export type RuntimePluginAPI<Extends extends RuntimePluginExtends> = Readonly<{
|
|
|
11
11
|
onBeforeRender: PluginHookTap<OnBeforeRenderFn<Extends['extendContext']>>;
|
|
12
12
|
wrapRoot: PluginHookTap<WrapRootFn>;
|
|
13
13
|
pickContext: PluginHookTap<PickContextFn<RuntimeContext>>;
|
|
14
|
-
|
|
14
|
+
config: PluginHookTap<ConfigFn<Extends['config']>>;
|
|
15
15
|
} & RuntimePluginExtendsAPI<Extends>>;
|
|
16
16
|
export type RuntimePluginExtendsAPI<Extends extends RuntimePluginExtends> = {
|
|
17
17
|
[K in keyof Extends['extendHooks']]: PluginHookTap<Extends['extendHooks'][K] extends PluginHook<infer Args> ? Args extends (...args: any[]) => any ? Args : (...args: any[]) => any : (...args: any[]) => any>;
|
|
@@ -3,10 +3,10 @@ import type { AsyncInterruptHook, CollectSyncHook, SyncHook } from '../hooks';
|
|
|
3
3
|
export type OnBeforeRenderFn<RuntimeContext> = (context: RuntimeContext, interrupt: (info: any) => any) => Promise<any> | any;
|
|
4
4
|
export type WrapRootFn = (root: React.ComponentType<any>) => React.ComponentType<any>;
|
|
5
5
|
export type PickContextFn<RuntimeContext> = (context: RuntimeContext) => RuntimeContext;
|
|
6
|
-
export type
|
|
6
|
+
export type ConfigFn<RuntimeConfig> = () => RuntimeConfig;
|
|
7
7
|
export type Hooks<RuntimeConfig, RuntimeContext> = {
|
|
8
8
|
onBeforeRender: AsyncInterruptHook<OnBeforeRenderFn<RuntimeContext>>;
|
|
9
9
|
wrapRoot: SyncHook<WrapRootFn>;
|
|
10
10
|
pickContext: SyncHook<PickContextFn<RuntimeContext>>;
|
|
11
|
-
|
|
11
|
+
config: CollectSyncHook<ConfigFn<RuntimeConfig>>;
|
|
12
12
|
};
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.65.
|
|
18
|
+
"version": "2.65.4",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -69,20 +69,20 @@
|
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@swc/helpers": "0.5.13",
|
|
71
71
|
"jiti": "1.21.7",
|
|
72
|
-
"@modern-js/runtime-utils": "2.65.
|
|
73
|
-
"@modern-js/utils": "2.65.
|
|
72
|
+
"@modern-js/runtime-utils": "2.65.4",
|
|
73
|
+
"@modern-js/utils": "2.65.4"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@rsbuild/core": "1.2.
|
|
76
|
+
"@rsbuild/core": "1.2.18",
|
|
77
77
|
"@types/jest": "^29",
|
|
78
78
|
"@types/node": "^14",
|
|
79
79
|
"@types/react": "^18.3.11",
|
|
80
80
|
"jest": "^29",
|
|
81
81
|
"typescript": "^5",
|
|
82
|
-
"@modern-js/types": "2.65.
|
|
83
|
-
"@
|
|
84
|
-
"@
|
|
85
|
-
"@scripts/jest-config": "2.65.
|
|
82
|
+
"@modern-js/types": "2.65.4",
|
|
83
|
+
"@scripts/build": "2.65.4",
|
|
84
|
+
"@modern-js/uni-builder": "2.65.4",
|
|
85
|
+
"@scripts/jest-config": "2.65.4"
|
|
86
86
|
},
|
|
87
87
|
"sideEffects": false,
|
|
88
88
|
"publishConfig": {
|