@modern-js/plugin-v2 2.64.2-alpha.1 → 2.64.2
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/cli/api.js +1 -0
- package/dist/cjs/cli/hooks.js +2 -1
- package/dist/esm/cli/api.js +2 -1
- package/dist/esm/cli/hooks.js +2 -1
- package/dist/esm-node/cli/api.js +1 -0
- package/dist/esm-node/cli/hooks.js +2 -1
- package/dist/types/cli/hooks.d.ts +3 -2
- package/dist/types/cli/index.d.ts +1 -1
- package/dist/types/types/cli/api.d.ts +2 -1
- package/dist/types/types/cli/hooks.d.ts +4 -1
- package/package.json +14 -13
package/dist/cjs/cli/api.js
CHANGED
|
@@ -99,6 +99,7 @@ function initPluginAPI({ context, pluginManager }) {
|
|
|
99
99
|
onBeforeExit: hooks.onBeforeExit.tap,
|
|
100
100
|
_internalRuntimePlugins: hooks._internalRuntimePlugins.tap,
|
|
101
101
|
_internalServerPlugins: hooks._internalServerPlugins.tap,
|
|
102
|
+
modifyServerRoutes: hooks.modifyServerRoutes.tap,
|
|
102
103
|
...extendsPluginApi
|
|
103
104
|
};
|
|
104
105
|
return new Proxy(pluginAPI, {
|
package/dist/cjs/cli/hooks.js
CHANGED
|
@@ -59,7 +59,8 @@ function initHooks() {
|
|
|
59
59
|
onAfterDeploy: (0, import_hooks.createAsyncHook)(),
|
|
60
60
|
onBeforeExit: (0, import_hooks.createAsyncHook)(),
|
|
61
61
|
_internalRuntimePlugins: (0, import_hooks.createAsyncHook)(),
|
|
62
|
-
_internalServerPlugins: (0, import_hooks.createAsyncHook)()
|
|
62
|
+
_internalServerPlugins: (0, import_hooks.createAsyncHook)(),
|
|
63
|
+
modifyServerRoutes: (0, import_hooks.createAsyncHook)()
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
66
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/esm/cli/api.js
CHANGED
|
@@ -84,7 +84,8 @@ function initPluginAPI(param) {
|
|
|
84
84
|
onAfterDeploy: hooks.onAfterDeploy.tap,
|
|
85
85
|
onBeforeExit: hooks.onBeforeExit.tap,
|
|
86
86
|
_internalRuntimePlugins: hooks._internalRuntimePlugins.tap,
|
|
87
|
-
_internalServerPlugins: hooks._internalServerPlugins.tap
|
|
87
|
+
_internalServerPlugins: hooks._internalServerPlugins.tap,
|
|
88
|
+
modifyServerRoutes: hooks.modifyServerRoutes.tap
|
|
88
89
|
}, extendsPluginApi);
|
|
89
90
|
return new Proxy(pluginAPI, {
|
|
90
91
|
get: function get(target, prop) {
|
package/dist/esm/cli/hooks.js
CHANGED
|
@@ -36,7 +36,8 @@ function initHooks() {
|
|
|
36
36
|
onAfterDeploy: createAsyncHook(),
|
|
37
37
|
onBeforeExit: createAsyncHook(),
|
|
38
38
|
_internalRuntimePlugins: createAsyncHook(),
|
|
39
|
-
_internalServerPlugins: createAsyncHook()
|
|
39
|
+
_internalServerPlugins: createAsyncHook(),
|
|
40
|
+
modifyServerRoutes: createAsyncHook()
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
43
|
export {
|
package/dist/esm-node/cli/api.js
CHANGED
|
@@ -76,6 +76,7 @@ function initPluginAPI({ context, pluginManager }) {
|
|
|
76
76
|
onBeforeExit: hooks.onBeforeExit.tap,
|
|
77
77
|
_internalRuntimePlugins: hooks._internalRuntimePlugins.tap,
|
|
78
78
|
_internalServerPlugins: hooks._internalServerPlugins.tap,
|
|
79
|
+
modifyServerRoutes: hooks.modifyServerRoutes.tap,
|
|
79
80
|
...extendsPluginApi
|
|
80
81
|
};
|
|
81
82
|
return new Proxy(pluginAPI, {
|
|
@@ -36,7 +36,8 @@ function initHooks() {
|
|
|
36
36
|
onAfterDeploy: createAsyncHook(),
|
|
37
37
|
onBeforeExit: createAsyncHook(),
|
|
38
38
|
_internalRuntimePlugins: createAsyncHook(),
|
|
39
|
-
_internalServerPlugins: createAsyncHook()
|
|
39
|
+
_internalServerPlugins: createAsyncHook(),
|
|
40
|
+
modifyServerRoutes: createAsyncHook()
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
43
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { OnAfterBuildFn, OnAfterCreateCompilerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnDevCompileDoneFn } from '@rsbuild/core';
|
|
2
|
-
import type { AddCommandFn, AddWatchFilesFn, ConfigFn, InternalRuntimePluginsFn, InternalServerPluginsFn, ModifyBundlerChainFn, ModifyConfigFn, ModifyHtmlPartialsFn, ModifyResolvedConfigFn, ModifyRsbuildConfigFn, ModifyRspackConfigFn, ModifyWebpackChainFn, ModifyWebpackConfigFn, OnAfterDeployFn, OnAfterDevFn, OnBeforeDeployFn, OnBeforeDevFn, OnBeforeExitFn, OnBeforeRestartFn, OnFileChangedFn, OnPrepareFn, RuntimePluginConfig, ServerPluginConfig } from '../types/cli/hooks';
|
|
2
|
+
import type { AddCommandFn, AddWatchFilesFn, ConfigFn, InternalRuntimePluginsFn, InternalServerPluginsFn, ModifyBundlerChainFn, ModifyConfigFn, ModifyHtmlPartialsFn, ModifyResolvedConfigFn, ModifyRsbuildConfigFn, ModifyRspackConfigFn, ModifyServerRoutesFn, ModifyWebpackChainFn, ModifyWebpackConfigFn, OnAfterDeployFn, OnAfterDevFn, OnBeforeDeployFn, OnBeforeDevFn, OnBeforeExitFn, OnBeforeRestartFn, OnFileChangedFn, OnPrepareFn, RuntimePluginConfig, ServerPluginConfig } from '../types/cli/hooks';
|
|
3
3
|
import type { DeepPartial } from '../types/utils';
|
|
4
|
-
export type { OnAfterBuildFn, OnAfterCreateCompilerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnDevCompileDoneFn, AddCommandFn, AddWatchFilesFn, ConfigFn, ModifyBundlerChainFn, ModifyConfigFn, ModifyHtmlPartialsFn, ModifyResolvedConfigFn, ModifyRsbuildConfigFn, ModifyRspackConfigFn, ModifyWebpackChainFn, ModifyWebpackConfigFn, OnAfterDeployFn, OnBeforeDeployFn, OnBeforeDevFn, OnAfterDevFn, OnBeforeExitFn, OnBeforeRestartFn, OnFileChangedFn, OnPrepareFn, InternalRuntimePluginsFn, InternalServerPluginsFn, RuntimePluginConfig, ServerPluginConfig, };
|
|
4
|
+
export type { OnAfterBuildFn, OnAfterCreateCompilerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnDevCompileDoneFn, AddCommandFn, AddWatchFilesFn, ConfigFn, ModifyBundlerChainFn, ModifyConfigFn, ModifyHtmlPartialsFn, ModifyResolvedConfigFn, ModifyRsbuildConfigFn, ModifyRspackConfigFn, ModifyWebpackChainFn, ModifyWebpackConfigFn, OnAfterDeployFn, OnBeforeDeployFn, OnBeforeDevFn, OnAfterDevFn, OnBeforeExitFn, OnBeforeRestartFn, OnFileChangedFn, OnPrepareFn, InternalRuntimePluginsFn, InternalServerPluginsFn, ModifyServerRoutesFn, RuntimePluginConfig, ServerPluginConfig, };
|
|
5
5
|
export declare function initHooks<Config, NormalizedConfig, ExtendBuildUtils, ExtendConfigUtils>(): {
|
|
6
6
|
/**
|
|
7
7
|
* add config for this cli plugin
|
|
@@ -39,5 +39,6 @@ export declare function initHooks<Config, NormalizedConfig, ExtendBuildUtils, Ex
|
|
|
39
39
|
onBeforeExit: import("..").AsyncHook<OnBeforeExitFn>;
|
|
40
40
|
_internalRuntimePlugins: import("..").AsyncHook<InternalRuntimePluginsFn>;
|
|
41
41
|
_internalServerPlugins: import("..").AsyncHook<InternalServerPluginsFn>;
|
|
42
|
+
modifyServerRoutes: import("..").AsyncHook<ModifyServerRoutesFn>;
|
|
42
43
|
};
|
|
43
44
|
export type Hooks<Config, NormalizedConfig, ExtendBuildUtils, ExtendConfigUtils> = ReturnType<typeof initHooks<Config, NormalizedConfig, ExtendBuildUtils, ExtendConfigUtils>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { initPluginAPI } from './api';
|
|
2
2
|
export { initAppContext, createContext } from './context';
|
|
3
|
-
export { initHooks, type Hooks, type OnAfterBuildFn, type OnAfterCreateCompilerFn, type OnBeforeBuildFn, type OnBeforeCreateCompilerFn, type OnDevCompileDoneFn, type AddCommandFn, type AddWatchFilesFn, type ConfigFn, type ModifyBundlerChainFn, type ModifyConfigFn, type ModifyHtmlPartialsFn, type ModifyResolvedConfigFn, type ModifyRsbuildConfigFn, type ModifyRspackConfigFn, type ModifyWebpackChainFn, type ModifyWebpackConfigFn, type OnAfterDeployFn, type OnBeforeDeployFn, type OnBeforeDevFn, type OnAfterDevFn, type OnBeforeExitFn, type OnBeforeRestartFn, type OnFileChangedFn, type OnPrepareFn, type InternalRuntimePluginsFn, type InternalServerPluginsFn, type RuntimePluginConfig, type ServerPluginConfig, } from './hooks';
|
|
3
|
+
export { initHooks, type Hooks, type OnAfterBuildFn, type OnAfterCreateCompilerFn, type OnBeforeBuildFn, type OnBeforeCreateCompilerFn, type OnDevCompileDoneFn, type AddCommandFn, type AddWatchFilesFn, type ConfigFn, type ModifyBundlerChainFn, type ModifyConfigFn, type ModifyHtmlPartialsFn, type ModifyResolvedConfigFn, type ModifyRsbuildConfigFn, type ModifyRspackConfigFn, type ModifyWebpackChainFn, type ModifyWebpackConfigFn, type OnAfterDeployFn, type OnBeforeDeployFn, type OnBeforeDevFn, type OnAfterDevFn, type OnBeforeExitFn, type OnBeforeRestartFn, type OnFileChangedFn, type OnPrepareFn, type InternalRuntimePluginsFn, type InternalServerPluginsFn, type ModifyServerRoutesFn, type RuntimePluginConfig, type ServerPluginConfig, } from './hooks';
|
|
4
4
|
export { cli, createLoadedConfig, initAppDir, createCli, loadEnv } from './run';
|
|
@@ -3,7 +3,7 @@ import type { Hooks } from '../../cli/hooks';
|
|
|
3
3
|
import type { PluginHook, PluginHookTap } from '../hooks';
|
|
4
4
|
import type { DeepPartial } from '../utils';
|
|
5
5
|
import type { AppContext } from './context';
|
|
6
|
-
import type { AddCommandFn, AddWatchFilesFn, ConfigFn, InternalRuntimePluginsFn, InternalServerPluginsFn, ModifyBundlerChainFn, ModifyConfigFn, ModifyHtmlPartialsFn, ModifyResolvedConfigFn, ModifyRsbuildConfigFn, ModifyRspackConfigFn, ModifyWebpackChainFn, ModifyWebpackConfigFn, OnAfterDeployFn, OnAfterDevFn, OnBeforeDeployFn, OnBeforeDevFn, OnBeforeExitFn, OnBeforeRestartFn, OnFileChangedFn, OnPrepareFn } from './hooks';
|
|
6
|
+
import type { AddCommandFn, AddWatchFilesFn, ConfigFn, InternalRuntimePluginsFn, InternalServerPluginsFn, ModifyBundlerChainFn, ModifyConfigFn, ModifyHtmlPartialsFn, ModifyResolvedConfigFn, ModifyRsbuildConfigFn, ModifyRspackConfigFn, ModifyServerRoutesFn, ModifyWebpackChainFn, ModifyWebpackConfigFn, OnAfterDeployFn, OnAfterDevFn, OnBeforeDeployFn, OnBeforeDevFn, OnBeforeExitFn, OnBeforeRestartFn, OnFileChangedFn, OnPrepareFn } from './hooks';
|
|
7
7
|
import type { CLIPluginExtends } from './plugin';
|
|
8
8
|
/**
|
|
9
9
|
* Define a generic CLI plugin API that provider can extend as needed.
|
|
@@ -44,6 +44,7 @@ export type CLIPluginAPI<Extends extends CLIPluginExtends> = Readonly<{
|
|
|
44
44
|
onBeforeExit: PluginHookTap<OnBeforeExitFn>;
|
|
45
45
|
_internalRuntimePlugins: PluginHookTap<InternalRuntimePluginsFn>;
|
|
46
46
|
_internalServerPlugins: PluginHookTap<InternalServerPluginsFn>;
|
|
47
|
+
modifyServerRoutes: PluginHookTap<ModifyServerRoutesFn>;
|
|
47
48
|
} & CLIPluginExtendsAPI<Extends>>;
|
|
48
49
|
export type CLIPluginExtendsAPI<Extends extends CLIPluginExtends> = {
|
|
49
50
|
[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>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ServerPlugin as ServerPluginConfig } from '@modern-js/types';
|
|
1
|
+
import type { ServerPlugin as ServerPluginConfig, ServerRoute } from '@modern-js/types';
|
|
2
2
|
import type { WebpackConfig } from '@modern-js/uni-builder';
|
|
3
3
|
import type { Command } from '@modern-js/utils/commander';
|
|
4
4
|
import type { ModifyBundlerChainUtils, ModifyRspackConfigUtils, ModifyWebpackChainUtils, ModifyWebpackConfigUtils, RsbuildConfig, Rspack, RspackChain } from '@rsbuild/core';
|
|
@@ -70,3 +70,6 @@ export type InternalRuntimePluginsFn = TransformFunction<{
|
|
|
70
70
|
export type InternalServerPluginsFn = TransformFunction<{
|
|
71
71
|
plugins: ServerPluginConfig[];
|
|
72
72
|
}>;
|
|
73
|
+
export type ModifyServerRoutesFn = TransformFunction<{
|
|
74
|
+
routes: ServerRoute[];
|
|
75
|
+
}>;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.64.2
|
|
18
|
+
"version": "2.64.2",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"types": "./dist/types/index.d.ts",
|
|
26
26
|
"node": {
|
|
27
27
|
"jsnext:source": "./src/index.ts",
|
|
28
|
-
"import": "./dist/esm
|
|
28
|
+
"import": "./dist/esm/index.js",
|
|
29
29
|
"require": "./dist/cjs/index.js"
|
|
30
30
|
},
|
|
31
31
|
"default": "./dist/esm/index.js"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"types": "./dist/types/runtime/index.d.ts",
|
|
45
45
|
"jsnext:source": "./src/runtime/index.ts",
|
|
46
46
|
"node": {
|
|
47
|
-
"import": "./dist/esm
|
|
47
|
+
"import": "./dist/esm/runtime/index.js",
|
|
48
48
|
"require": "./dist/cjs/runtime/index.js"
|
|
49
49
|
},
|
|
50
50
|
"default": "./dist/esm/runtime/index.js"
|
|
@@ -67,27 +67,28 @@
|
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"jiti": "1.21.7",
|
|
71
70
|
"@swc/helpers": "0.5.13",
|
|
72
|
-
"
|
|
73
|
-
"@modern-js/runtime-utils": "2.64.
|
|
71
|
+
"jiti": "1.21.7",
|
|
72
|
+
"@modern-js/runtime-utils": "2.64.2",
|
|
73
|
+
"@modern-js/utils": "2.64.2"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@rsbuild/core": "1.
|
|
77
|
-
"@types/react": "^18.3.11",
|
|
76
|
+
"@rsbuild/core": "1.2.7",
|
|
78
77
|
"@types/jest": "^29",
|
|
79
78
|
"@types/node": "^14",
|
|
79
|
+
"@types/react": "^18.3.11",
|
|
80
80
|
"jest": "^29",
|
|
81
81
|
"typescript": "^5",
|
|
82
|
-
"@
|
|
83
|
-
"@modern-js/
|
|
84
|
-
"@scripts/
|
|
85
|
-
"@
|
|
82
|
+
"@modern-js/types": "2.64.2",
|
|
83
|
+
"@modern-js/uni-builder": "2.64.2",
|
|
84
|
+
"@scripts/build": "2.64.2",
|
|
85
|
+
"@scripts/jest-config": "2.64.2"
|
|
86
86
|
},
|
|
87
87
|
"sideEffects": false,
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"registry": "https://registry.npmjs.org/",
|
|
90
|
-
"access": "public"
|
|
90
|
+
"access": "public",
|
|
91
|
+
"provenance": true
|
|
91
92
|
},
|
|
92
93
|
"scripts": {
|
|
93
94
|
"new": "modern-lib new",
|