@modern-js/plugin-v2 2.63.0 → 2.63.1
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 -1
- package/dist/cjs/cli/context.js +1 -1
- package/dist/cjs/cli/run/create.js +1 -1
- package/dist/esm-node/cli/api.js +1 -1
- package/dist/esm-node/cli/context.js +1 -1
- package/dist/esm-node/cli/run/create.js +1 -1
- package/dist/types/cli/index.d.ts +1 -1
- package/dist/types/types/cli/api.d.ts +2 -2
- package/dist/types/types/cli/context.d.ts +4 -4
- package/dist/types/types/hooks.d.ts +1 -1
- package/package.json +8 -8
package/dist/cjs/cli/api.js
CHANGED
|
@@ -82,7 +82,7 @@ function initPluginAPI({ context }) {
|
|
|
82
82
|
modifyHtmlPartials: hooks.modifyHtmlPartials.tap,
|
|
83
83
|
addCommand: hooks.addCommand.tap,
|
|
84
84
|
onPrepare: hooks.onPrepare.tap,
|
|
85
|
-
|
|
85
|
+
addWatchFiles: hooks.addWatchFiles.tap,
|
|
86
86
|
onFileChanged: hooks.onFileChanged.tap,
|
|
87
87
|
onBeforeRestart: hooks.onBeforeRestart.tap,
|
|
88
88
|
onBeforeCreateCompiler: hooks.onBeforeCreateCompiler.tap,
|
package/dist/cjs/cli/context.js
CHANGED
|
@@ -43,7 +43,7 @@ function initAppContext(params) {
|
|
|
43
43
|
isProd: process.env.NODE_ENV === "production",
|
|
44
44
|
appDirectory,
|
|
45
45
|
srcDirectory: import_path.default.resolve(appDirectory, srcDir),
|
|
46
|
-
distDirectory:
|
|
46
|
+
distDirectory: "",
|
|
47
47
|
nodeModulesDirectory: import_path.default.resolve(appDirectory, "node_modules"),
|
|
48
48
|
plugins: params.plugins
|
|
49
49
|
};
|
|
@@ -99,7 +99,7 @@ const createCli = () => {
|
|
|
99
99
|
const extraConfigs = await context.hooks.config.call();
|
|
100
100
|
const normalizedConfig = await (0, import_createResolvedConfig.createResolveConfig)(loaded, extraConfigs);
|
|
101
101
|
const resolved = await context.hooks.modifyResolvedConfig.call(normalizedConfig);
|
|
102
|
-
context.normalizedConfig = resolved
|
|
102
|
+
context.normalizedConfig = resolved || normalizedConfig;
|
|
103
103
|
await pluginAPI.updateAppContext(context);
|
|
104
104
|
await context.hooks.onPrepare.call();
|
|
105
105
|
await ((_context_hooks = context.hooks) === null || _context_hooks === void 0 ? void 0 : _context_hooks.onAfterPrepare.call());
|
package/dist/esm-node/cli/api.js
CHANGED
|
@@ -59,7 +59,7 @@ function initPluginAPI({ context }) {
|
|
|
59
59
|
modifyHtmlPartials: hooks.modifyHtmlPartials.tap,
|
|
60
60
|
addCommand: hooks.addCommand.tap,
|
|
61
61
|
onPrepare: hooks.onPrepare.tap,
|
|
62
|
-
|
|
62
|
+
addWatchFiles: hooks.addWatchFiles.tap,
|
|
63
63
|
onFileChanged: hooks.onFileChanged.tap,
|
|
64
64
|
onBeforeRestart: hooks.onBeforeRestart.tap,
|
|
65
65
|
onBeforeCreateCompiler: hooks.onBeforeCreateCompiler.tap,
|
|
@@ -9,7 +9,7 @@ function initAppContext(params) {
|
|
|
9
9
|
isProd: process.env.NODE_ENV === "production",
|
|
10
10
|
appDirectory,
|
|
11
11
|
srcDirectory: path.resolve(appDirectory, srcDir),
|
|
12
|
-
distDirectory:
|
|
12
|
+
distDirectory: "",
|
|
13
13
|
nodeModulesDirectory: path.resolve(appDirectory, "node_modules"),
|
|
14
14
|
plugins: params.plugins
|
|
15
15
|
};
|
|
@@ -76,7 +76,7 @@ const createCli = () => {
|
|
|
76
76
|
const extraConfigs = await context.hooks.config.call();
|
|
77
77
|
const normalizedConfig = await createResolveConfig(loaded, extraConfigs);
|
|
78
78
|
const resolved = await context.hooks.modifyResolvedConfig.call(normalizedConfig);
|
|
79
|
-
context.normalizedConfig = resolved
|
|
79
|
+
context.normalizedConfig = resolved || normalizedConfig;
|
|
80
80
|
await pluginAPI.updateAppContext(context);
|
|
81
81
|
await context.hooks.onPrepare.call();
|
|
82
82
|
await ((_context_hooks = context.hooks) === null || _context_hooks === void 0 ? void 0 : _context_hooks.onAfterPrepare.call());
|
|
@@ -13,7 +13,7 @@ export type CLIPluginAPI<Extends extends CLIPluginExtends> = Readonly<{
|
|
|
13
13
|
getConfig: () => Readonly<Extends['config']>;
|
|
14
14
|
getNormalizedConfig: () => Readonly<Extends['normalizedConfig']>;
|
|
15
15
|
getHooks: () => Readonly<Hooks<Extends['config'], Extends['normalizedConfig']> & Extends['extendHooks']>;
|
|
16
|
-
updateAppContext: (appContext: DeepPartial<AppContext<Extends
|
|
16
|
+
updateAppContext: (appContext: DeepPartial<AppContext<Extends> & Extends['extendContext']>) => void;
|
|
17
17
|
config: PluginHookTap<ConfigFn<DeepPartial<Extends['config']>>>;
|
|
18
18
|
modifyConfig: PluginHookTap<ModifyConfigFn<Extends['config']>>;
|
|
19
19
|
modifyResolvedConfig: PluginHookTap<ModifyResolvedConfigFn<Extends['normalizedConfig']>>;
|
|
@@ -28,7 +28,7 @@ export type CLIPluginAPI<Extends extends CLIPluginExtends> = Readonly<{
|
|
|
28
28
|
modifyHtmlPartials: PluginHookTap<ModifyHtmlPartialsFn>;
|
|
29
29
|
addCommand: PluginHookTap<AddCommandFn>;
|
|
30
30
|
onPrepare: PluginHookTap<OnPrepareFn>;
|
|
31
|
-
|
|
31
|
+
addWatchFiles: PluginHookTap<AddWatchFilesFn>;
|
|
32
32
|
onFileChanged: PluginHookTap<OnFileChangedFn>;
|
|
33
33
|
onBeforeRestart: PluginHookTap<OnBeforeRestartFn>;
|
|
34
34
|
onBeforeCreateCompiler: PluginHookTap<OnBeforeCreateCompilerFn>;
|
|
@@ -4,7 +4,7 @@ import type { Hooks } from '../../cli/hooks';
|
|
|
4
4
|
import type { CLIPluginAPI } from './api';
|
|
5
5
|
import type { CLIPlugin, CLIPluginExtends } from './plugin';
|
|
6
6
|
export interface Entrypoint {
|
|
7
|
-
|
|
7
|
+
entryName: string;
|
|
8
8
|
entry: string;
|
|
9
9
|
}
|
|
10
10
|
/** The public context */
|
|
@@ -14,9 +14,9 @@ export type AppContext<Extends extends CLIPluginExtends> = {
|
|
|
14
14
|
command: string;
|
|
15
15
|
isProd: boolean;
|
|
16
16
|
appDirectory: string;
|
|
17
|
-
srcDirectory
|
|
18
|
-
distDirectory
|
|
19
|
-
nodeModulesDirectory
|
|
17
|
+
srcDirectory: string;
|
|
18
|
+
distDirectory: string;
|
|
19
|
+
nodeModulesDirectory: string;
|
|
20
20
|
plugins: CLIPlugin<Extends>[];
|
|
21
21
|
bundlerType?: 'webpack' | 'rspack' | 'esbuild';
|
|
22
22
|
builder?: UniBuilderInstance | UniBuilderWebpackInstance;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { UnwrapPromise } from './utils';
|
|
2
2
|
export type AsyncHook<Callback extends (...args: any[]) => any> = {
|
|
3
3
|
tap: (cb: Callback) => void;
|
|
4
|
-
call: (...args: Parameters<Callback>) => Promise<
|
|
4
|
+
call: (...args: Parameters<Callback>) => Promise<ReturnType<Callback>>;
|
|
5
5
|
};
|
|
6
6
|
export type CollectAsyncHook<Callback extends (...params: any[]) => any> = {
|
|
7
7
|
tap: (cb: Callback) => void;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.63.
|
|
18
|
+
"version": "2.63.1",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -61,19 +61,19 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@swc/helpers": "0.5.13",
|
|
64
|
-
"@modern-js/
|
|
65
|
-
"@modern-js/
|
|
64
|
+
"@modern-js/node-bundle-require": "2.63.1",
|
|
65
|
+
"@modern-js/utils": "2.63.1"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@rsbuild/core": "
|
|
68
|
+
"@rsbuild/core": "1.1.8",
|
|
69
69
|
"@types/jest": "^29",
|
|
70
70
|
"@types/node": "^14",
|
|
71
71
|
"jest": "^29",
|
|
72
72
|
"typescript": "^5",
|
|
73
|
-
"@modern-js/
|
|
74
|
-
"@modern-js/
|
|
75
|
-
"@scripts/build": "2.63.
|
|
76
|
-
"@scripts/jest-config": "2.63.
|
|
73
|
+
"@modern-js/types": "2.63.1",
|
|
74
|
+
"@modern-js/uni-builder": "2.63.1",
|
|
75
|
+
"@scripts/build": "2.63.1",
|
|
76
|
+
"@scripts/jest-config": "2.63.1"
|
|
77
77
|
},
|
|
78
78
|
"sideEffects": false,
|
|
79
79
|
"publishConfig": {
|