@modern-js/plugin-v2 0.0.0-nightly-20250113160332 → 0.0.0-nightly-20250115160310
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 +14 -2
- package/dist/cjs/cli/hooks.js +1 -0
- package/dist/cjs/cli/run/config/createLoadedConfig.js +7 -1
- package/dist/cjs/cli/run/create.js +2 -2
- package/dist/cjs/cli/run/utils/debug.js +29 -0
- package/dist/cjs/manager.js +2 -2
- package/dist/esm/index.js +6 -1
- package/dist/esm-node/cli/api.js +14 -2
- package/dist/esm-node/cli/hooks.js +1 -0
- package/dist/esm-node/cli/run/config/createLoadedConfig.js +7 -1
- package/dist/esm-node/cli/run/create.js +2 -2
- package/dist/esm-node/cli/run/utils/debug.js +5 -0
- package/dist/esm-node/manager.js +2 -2
- package/dist/types/cli/hooks.d.ts +3 -1
- package/dist/types/cli/index.d.ts +1 -1
- package/dist/types/cli/run/config/createLoadedConfig.d.ts +1 -1
- package/dist/types/cli/run/create.d.ts +3 -3
- package/dist/types/cli/run/index.d.ts +3 -3
- package/dist/types/cli/run/types.d.ts +11 -2
- package/dist/types/cli/run/utils/debug.d.ts +1 -0
- package/dist/types/types/cli/api.d.ts +2 -1
- package/dist/types/types/cli/hooks.d.ts +1 -1
- package/package.json +7 -7
package/dist/cjs/cli/api.js
CHANGED
|
@@ -22,11 +22,12 @@ __export(api_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(api_exports);
|
|
24
24
|
var import_lodash = require("@modern-js/utils/lodash");
|
|
25
|
+
var import_debug = require("./run/utils/debug");
|
|
25
26
|
function initPluginAPI({ context, pluginManager }) {
|
|
26
27
|
const { hooks, extendsHooks, plugins } = context;
|
|
27
28
|
function getAppContext() {
|
|
28
29
|
if (context) {
|
|
29
|
-
const { hooks: hooks2, extendsHooks: extendsHooks2, config, normalizedConfig, pluginAPI, ...appContext } = context;
|
|
30
|
+
const { hooks: hooks2, extendsHooks: extendsHooks2, config, normalizedConfig, pluginAPI: pluginAPI2, ...appContext } = context;
|
|
30
31
|
appContext._internalContext = context;
|
|
31
32
|
return appContext;
|
|
32
33
|
}
|
|
@@ -65,7 +66,7 @@ function initPluginAPI({ context, pluginManager }) {
|
|
|
65
66
|
function updateAppContext(updateContext) {
|
|
66
67
|
context = (0, import_lodash.merge)(context, updateContext);
|
|
67
68
|
}
|
|
68
|
-
|
|
69
|
+
const pluginAPI = {
|
|
69
70
|
isPluginExists: pluginManager.isPluginExists,
|
|
70
71
|
getAppContext,
|
|
71
72
|
getConfig,
|
|
@@ -87,6 +88,7 @@ function initPluginAPI({ context, pluginManager }) {
|
|
|
87
88
|
onFileChanged: hooks.onFileChanged.tap,
|
|
88
89
|
onBeforeRestart: hooks.onBeforeRestart.tap,
|
|
89
90
|
onBeforeCreateCompiler: hooks.onBeforeCreateCompiler.tap,
|
|
91
|
+
onDevCompileDone: hooks.onDevCompileDone.tap,
|
|
90
92
|
onAfterCreateCompiler: hooks.onAfterCreateCompiler.tap,
|
|
91
93
|
onBeforeBuild: hooks.onBeforeBuild.tap,
|
|
92
94
|
onAfterBuild: hooks.onAfterBuild.tap,
|
|
@@ -97,6 +99,16 @@ function initPluginAPI({ context, pluginManager }) {
|
|
|
97
99
|
onBeforeExit: hooks.onBeforeExit.tap,
|
|
98
100
|
...extendsPluginApi
|
|
99
101
|
};
|
|
102
|
+
return new Proxy(pluginAPI, {
|
|
103
|
+
get(target, prop) {
|
|
104
|
+
if (prop in target) {
|
|
105
|
+
return target[prop];
|
|
106
|
+
}
|
|
107
|
+
return () => {
|
|
108
|
+
(0, import_debug.debug)(`api.${prop.toString()} not exist`);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
});
|
|
100
112
|
}
|
|
101
113
|
// Annotate the CommonJS export names for ESM import in node:
|
|
102
114
|
0 && (module.exports = {
|
package/dist/cjs/cli/hooks.js
CHANGED
|
@@ -50,6 +50,7 @@ function initHooks() {
|
|
|
50
50
|
onBeforeRestart: (0, import_hooks.createAsyncHook)(),
|
|
51
51
|
onBeforeCreateCompiler: (0, import_hooks.createAsyncHook)(),
|
|
52
52
|
onAfterCreateCompiler: (0, import_hooks.createAsyncHook)(),
|
|
53
|
+
onDevCompileDone: (0, import_hooks.createAsyncHook)(),
|
|
53
54
|
onBeforeBuild: (0, import_hooks.createAsyncHook)(),
|
|
54
55
|
onAfterBuild: (0, import_hooks.createAsyncHook)(),
|
|
55
56
|
onBeforeDev: (0, import_hooks.createAsyncHook)(),
|
|
@@ -63,7 +63,7 @@ function assignPkgConfig(userConfig, pkgConfig) {
|
|
|
63
63
|
return void 0;
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
async function createLoadedConfig(appDirectory, configFilePath, packageJsonConfig) {
|
|
66
|
+
async function createLoadedConfig(appDirectory, configFilePath, packageJsonConfig, otherConfig) {
|
|
67
67
|
const configFile = (0, import_loadConfig.getConfigFilePath)(appDirectory, configFilePath);
|
|
68
68
|
const loaded = await (0, import_loadConfig.loadConfig)(appDirectory, configFile, packageJsonConfig);
|
|
69
69
|
if (!loaded.config && !loaded.pkgConfig) {
|
|
@@ -84,6 +84,12 @@ async function createLoadedConfig(appDirectory, configFilePath, packageJsonConfi
|
|
|
84
84
|
]);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
+
if (otherConfig) {
|
|
88
|
+
mergedConfig = (0, import_mergeConfig.mergeConfig)([
|
|
89
|
+
mergedConfig,
|
|
90
|
+
otherConfig
|
|
91
|
+
]);
|
|
92
|
+
}
|
|
87
93
|
return {
|
|
88
94
|
packageName: loaded.packageName,
|
|
89
95
|
config: mergedConfig,
|
|
@@ -40,12 +40,12 @@ const createCli = () => {
|
|
|
40
40
|
var _context_hooks_onAfterPrepare, _context_hooks;
|
|
41
41
|
pluginManager.clear();
|
|
42
42
|
initOptions = options;
|
|
43
|
-
const { metaName = "MODERN", configFile, command, version, packageJsonConfig, internalPlugins, handleSetupResult } = options;
|
|
43
|
+
const { metaName = "MODERN", configFile, config, command, version, packageJsonConfig, internalPlugins, handleSetupResult } = options;
|
|
44
44
|
const appDirectory = await (0, import_initAppDir.initAppDir)(options === null || options === void 0 ? void 0 : options.cwd);
|
|
45
45
|
(0, import_commander2.initCommandsMap)();
|
|
46
46
|
(0, import_commander2.setProgramVersion)(version);
|
|
47
47
|
(0, import_loadEnv.loadEnv)(appDirectory, process.env[`${metaName.toUpperCase()}_ENV`]);
|
|
48
|
-
const loaded = await (0, import_createLoadedConfig.createLoadedConfig)(appDirectory, configFile, packageJsonConfig);
|
|
48
|
+
const loaded = await (0, import_createLoadedConfig.createLoadedConfig)(appDirectory, configFile, packageJsonConfig, config);
|
|
49
49
|
const allPlugins = [
|
|
50
50
|
...internalPlugins || [],
|
|
51
51
|
...loaded.config.plugins || []
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var debug_exports = {};
|
|
20
|
+
__export(debug_exports, {
|
|
21
|
+
debug: () => debug
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(debug_exports);
|
|
24
|
+
var import_utils = require("@modern-js/utils");
|
|
25
|
+
const debug = (0, import_utils.createDebugger)("plugin-v2");
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
28
|
+
debug
|
|
29
|
+
});
|
package/dist/cjs/manager.js
CHANGED
|
@@ -22,7 +22,7 @@ __export(manager_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(manager_exports);
|
|
24
24
|
var import_utils = require("@modern-js/utils");
|
|
25
|
-
|
|
25
|
+
var import_debug = require("./cli/run/utils/debug");
|
|
26
26
|
function validatePlugin(plugin) {
|
|
27
27
|
const type = typeof plugin;
|
|
28
28
|
if (type !== "object" || plugin === null) {
|
|
@@ -135,7 +135,7 @@ function createPluginManager() {
|
|
|
135
135
|
visit(name);
|
|
136
136
|
});
|
|
137
137
|
result = result.filter((result2) => result2);
|
|
138
|
-
debug("CLI Plugins:", result.map((p) => p.name));
|
|
138
|
+
(0, import_debug.debug)("CLI Plugins:", result.map((p) => p.name));
|
|
139
139
|
return result;
|
|
140
140
|
};
|
|
141
141
|
const clear = () => {
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// src/manager.ts
|
|
2
2
|
import { _ as _type_of } from "@swc/helpers/_/_type_of";
|
|
3
|
-
import {
|
|
3
|
+
import { isFunction, logger } from "@modern-js/utils";
|
|
4
|
+
|
|
5
|
+
// src/cli/run/utils/debug.ts
|
|
6
|
+
import { createDebugger } from "@modern-js/utils";
|
|
4
7
|
var debug = createDebugger("plugin-v2");
|
|
8
|
+
|
|
9
|
+
// src/manager.ts
|
|
5
10
|
function validatePlugin(plugin) {
|
|
6
11
|
var type = typeof plugin === "undefined" ? "undefined" : _type_of(plugin);
|
|
7
12
|
if (type !== "object" || plugin === null) {
|
package/dist/esm-node/cli/api.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { merge } from "@modern-js/utils/lodash";
|
|
2
|
+
import { debug } from "./run/utils/debug";
|
|
2
3
|
function initPluginAPI({ context, pluginManager }) {
|
|
3
4
|
const { hooks, extendsHooks, plugins } = context;
|
|
4
5
|
function getAppContext() {
|
|
5
6
|
if (context) {
|
|
6
|
-
const { hooks: hooks2, extendsHooks: extendsHooks2, config, normalizedConfig, pluginAPI, ...appContext } = context;
|
|
7
|
+
const { hooks: hooks2, extendsHooks: extendsHooks2, config, normalizedConfig, pluginAPI: pluginAPI2, ...appContext } = context;
|
|
7
8
|
appContext._internalContext = context;
|
|
8
9
|
return appContext;
|
|
9
10
|
}
|
|
@@ -42,7 +43,7 @@ function initPluginAPI({ context, pluginManager }) {
|
|
|
42
43
|
function updateAppContext(updateContext) {
|
|
43
44
|
context = merge(context, updateContext);
|
|
44
45
|
}
|
|
45
|
-
|
|
46
|
+
const pluginAPI = {
|
|
46
47
|
isPluginExists: pluginManager.isPluginExists,
|
|
47
48
|
getAppContext,
|
|
48
49
|
getConfig,
|
|
@@ -64,6 +65,7 @@ function initPluginAPI({ context, pluginManager }) {
|
|
|
64
65
|
onFileChanged: hooks.onFileChanged.tap,
|
|
65
66
|
onBeforeRestart: hooks.onBeforeRestart.tap,
|
|
66
67
|
onBeforeCreateCompiler: hooks.onBeforeCreateCompiler.tap,
|
|
68
|
+
onDevCompileDone: hooks.onDevCompileDone.tap,
|
|
67
69
|
onAfterCreateCompiler: hooks.onAfterCreateCompiler.tap,
|
|
68
70
|
onBeforeBuild: hooks.onBeforeBuild.tap,
|
|
69
71
|
onAfterBuild: hooks.onAfterBuild.tap,
|
|
@@ -74,6 +76,16 @@ function initPluginAPI({ context, pluginManager }) {
|
|
|
74
76
|
onBeforeExit: hooks.onBeforeExit.tap,
|
|
75
77
|
...extendsPluginApi
|
|
76
78
|
};
|
|
79
|
+
return new Proxy(pluginAPI, {
|
|
80
|
+
get(target, prop) {
|
|
81
|
+
if (prop in target) {
|
|
82
|
+
return target[prop];
|
|
83
|
+
}
|
|
84
|
+
return () => {
|
|
85
|
+
debug(`api.${prop.toString()} not exist`);
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
});
|
|
77
89
|
}
|
|
78
90
|
export {
|
|
79
91
|
initPluginAPI
|
|
@@ -27,6 +27,7 @@ function initHooks() {
|
|
|
27
27
|
onBeforeRestart: createAsyncHook(),
|
|
28
28
|
onBeforeCreateCompiler: createAsyncHook(),
|
|
29
29
|
onAfterCreateCompiler: createAsyncHook(),
|
|
30
|
+
onDevCompileDone: createAsyncHook(),
|
|
30
31
|
onBeforeBuild: createAsyncHook(),
|
|
31
32
|
onAfterBuild: createAsyncHook(),
|
|
32
33
|
onBeforeDev: createAsyncHook(),
|
|
@@ -39,7 +39,7 @@ function assignPkgConfig(userConfig, pkgConfig) {
|
|
|
39
39
|
return void 0;
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
async function createLoadedConfig(appDirectory, configFilePath, packageJsonConfig) {
|
|
42
|
+
async function createLoadedConfig(appDirectory, configFilePath, packageJsonConfig, otherConfig) {
|
|
43
43
|
const configFile = getConfigFilePath(appDirectory, configFilePath);
|
|
44
44
|
const loaded = await loadConfig(appDirectory, configFile, packageJsonConfig);
|
|
45
45
|
if (!loaded.config && !loaded.pkgConfig) {
|
|
@@ -60,6 +60,12 @@ async function createLoadedConfig(appDirectory, configFilePath, packageJsonConfi
|
|
|
60
60
|
]);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
if (otherConfig) {
|
|
64
|
+
mergedConfig = mergeConfig([
|
|
65
|
+
mergedConfig,
|
|
66
|
+
otherConfig
|
|
67
|
+
]);
|
|
68
|
+
}
|
|
63
69
|
return {
|
|
64
70
|
packageName: loaded.packageName,
|
|
65
71
|
config: mergedConfig,
|
|
@@ -17,12 +17,12 @@ const createCli = () => {
|
|
|
17
17
|
var _context_hooks_onAfterPrepare, _context_hooks;
|
|
18
18
|
pluginManager.clear();
|
|
19
19
|
initOptions = options;
|
|
20
|
-
const { metaName = "MODERN", configFile, command, version, packageJsonConfig, internalPlugins, handleSetupResult } = options;
|
|
20
|
+
const { metaName = "MODERN", configFile, config, command, version, packageJsonConfig, internalPlugins, handleSetupResult } = options;
|
|
21
21
|
const appDirectory = await initAppDir(options === null || options === void 0 ? void 0 : options.cwd);
|
|
22
22
|
initCommandsMap();
|
|
23
23
|
setProgramVersion(version);
|
|
24
24
|
loadEnv(appDirectory, process.env[`${metaName.toUpperCase()}_ENV`]);
|
|
25
|
-
const loaded = await createLoadedConfig(appDirectory, configFile, packageJsonConfig);
|
|
25
|
+
const loaded = await createLoadedConfig(appDirectory, configFile, packageJsonConfig, config);
|
|
26
26
|
const allPlugins = [
|
|
27
27
|
...internalPlugins || [],
|
|
28
28
|
...loaded.config.plugins || []
|
package/dist/esm-node/manager.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { isFunction, logger } from "@modern-js/utils";
|
|
2
|
+
import { debug } from "./cli/run/utils/debug";
|
|
3
3
|
function validatePlugin(plugin) {
|
|
4
4
|
const type = typeof plugin;
|
|
5
5
|
if (type !== "object" || plugin === null) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { OnAfterBuildFn, OnAfterCreateCompilerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn } from '@rsbuild/core';
|
|
1
|
+
import type { OnAfterBuildFn, OnAfterCreateCompilerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnDevCompileDoneFn } from '@rsbuild/core';
|
|
2
2
|
import type { AddCommandFn, AddWatchFilesFn, ConfigFn, ModifyBundlerChainFn, ModifyConfigFn, ModifyHtmlPartialsFn, ModifyResolvedConfigFn, ModifyRsbuildConfigFn, ModifyRspackConfigFn, ModifyWebpackChainFn, ModifyWebpackConfigFn, OnAfterDeployFn, OnAfterDevFn, OnBeforeDeployFn, OnBeforeDevFn, OnBeforeExitFn, OnBeforeRestartFn, OnFileChangedFn, OnPrepareFn } 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, };
|
|
4
5
|
export declare function initHooks<Config, NormalizedConfig, ExtendBuildUtils>(): {
|
|
5
6
|
/**
|
|
6
7
|
* add config for this cli plugin
|
|
@@ -28,6 +29,7 @@ export declare function initHooks<Config, NormalizedConfig, ExtendBuildUtils>():
|
|
|
28
29
|
onBeforeRestart: import("..").AsyncHook<OnBeforeRestartFn>;
|
|
29
30
|
onBeforeCreateCompiler: import("..").AsyncHook<OnBeforeCreateCompilerFn>;
|
|
30
31
|
onAfterCreateCompiler: import("..").AsyncHook<OnAfterCreateCompilerFn>;
|
|
32
|
+
onDevCompileDone: import("..").AsyncHook<OnDevCompileDoneFn>;
|
|
31
33
|
onBeforeBuild: import("..").AsyncHook<OnBeforeBuildFn>;
|
|
32
34
|
onAfterBuild: import("..").AsyncHook<OnAfterBuildFn>;
|
|
33
35
|
onBeforeDev: import("..").AsyncHook<OnBeforeDevFn>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { initPluginAPI } from './api';
|
|
2
2
|
export { initAppContext, createContext } from './context';
|
|
3
|
-
export { initHooks, type Hooks } 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, } from './hooks';
|
|
4
4
|
export { cli, createLoadedConfig, initAppDir, createCli } from './run';
|
|
@@ -3,4 +3,4 @@ import type { LoadedConfig } from '../types';
|
|
|
3
3
|
* Assign the pkg config into the user config.
|
|
4
4
|
*/
|
|
5
5
|
export declare function assignPkgConfig<T>(userConfig: T, pkgConfig: T): {} & T;
|
|
6
|
-
export declare function createLoadedConfig<T>(appDirectory: string, configFilePath: string, packageJsonConfig?: string): Promise<LoadedConfig<T>>;
|
|
6
|
+
export declare function createLoadedConfig<T>(appDirectory: string, configFilePath: string, packageJsonConfig?: string, otherConfig?: T): Promise<LoadedConfig<T>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { CLIPluginExtends } from '../../types/cli/plugin';
|
|
2
2
|
import type { CLIRunOptions } from './types';
|
|
3
3
|
export declare const createCli: <Extends extends CLIPluginExtends>() => {
|
|
4
|
-
init: (options: CLIRunOptions) => Promise<{
|
|
4
|
+
init: (options: CLIRunOptions<Extends>) => Promise<{
|
|
5
5
|
appContext: import("../..").InternalContext<Extends>;
|
|
6
6
|
}>;
|
|
7
|
-
run: (options: CLIRunOptions) => Promise<void>;
|
|
8
|
-
getPrevInitOptions: () => CLIRunOptions
|
|
7
|
+
run: (options: CLIRunOptions<Extends>) => Promise<void>;
|
|
8
|
+
getPrevInitOptions: () => CLIRunOptions<Extends>;
|
|
9
9
|
};
|
|
@@ -3,9 +3,9 @@ export { createLoadedConfig } from './config/createLoadedConfig';
|
|
|
3
3
|
export { initAppDir } from './utils/initAppDir';
|
|
4
4
|
export { createCli };
|
|
5
5
|
export declare const cli: {
|
|
6
|
-
init: (options: import("./types").CLIRunOptions) => Promise<{
|
|
6
|
+
init: (options: import("./types").CLIRunOptions<import("../..").CLIPluginExtends<{}, {}, {}, {}, {}, {}>>) => Promise<{
|
|
7
7
|
appContext: import("../..").InternalContext<import("../..").CLIPluginExtends<{}, {}, {}, {}, {}, {}>>;
|
|
8
8
|
}>;
|
|
9
|
-
run: (options: import("./types").CLIRunOptions) => Promise<void>;
|
|
10
|
-
getPrevInitOptions: () => import("./types").CLIRunOptions
|
|
9
|
+
run: (options: import("./types").CLIRunOptions<import("../..").CLIPluginExtends<{}, {}, {}, {}, {}, {}>>) => Promise<void>;
|
|
10
|
+
getPrevInitOptions: () => import("./types").CLIRunOptions<import("../..").CLIPluginExtends<{}, {}, {}, {}, {}, {}>>;
|
|
11
11
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import type { CLIPluginExtends } from '../../types/cli';
|
|
1
2
|
import type { Plugin } from '../../types/plugin';
|
|
2
|
-
export interface CLIOptions {
|
|
3
|
+
export interface CLIOptions<Extends extends CLIPluginExtends = {
|
|
4
|
+
config: {};
|
|
5
|
+
}> {
|
|
3
6
|
cwd?: string;
|
|
4
7
|
version?: string;
|
|
5
8
|
metaName?: string;
|
|
@@ -7,6 +10,10 @@ export interface CLIOptions {
|
|
|
7
10
|
* The initial log message when CLI started
|
|
8
11
|
*/
|
|
9
12
|
initialLog?: string;
|
|
13
|
+
/**
|
|
14
|
+
* other config, overrides config file content
|
|
15
|
+
*/
|
|
16
|
+
config?: Extends['config'];
|
|
10
17
|
configFile: string;
|
|
11
18
|
/**
|
|
12
19
|
* @deprecated
|
|
@@ -23,6 +30,8 @@ export type LoadedConfig<T> = {
|
|
|
23
30
|
pkgConfig?: T;
|
|
24
31
|
jsConfig?: T;
|
|
25
32
|
};
|
|
26
|
-
export interface CLIRunOptions extends
|
|
33
|
+
export interface CLIRunOptions<Extends extends CLIPluginExtends = {
|
|
34
|
+
config: {};
|
|
35
|
+
}> extends CLIOptions<Extends> {
|
|
27
36
|
command: string;
|
|
28
37
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const debug: import("@modern-js/utils/compiled/debug").Debugger;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OnAfterBuildFn, OnAfterCreateCompilerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn } from '@rsbuild/core';
|
|
1
|
+
import type { OnAfterBuildFn, OnAfterCreateCompilerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnDevCompileDoneFn } from '@rsbuild/core';
|
|
2
2
|
import type { Hooks } from '../../cli/hooks';
|
|
3
3
|
import type { PluginHookTap } from '../hooks';
|
|
4
4
|
import type { DeepPartial } from '../utils';
|
|
@@ -34,6 +34,7 @@ export type CLIPluginAPI<Extends extends CLIPluginExtends> = Readonly<{
|
|
|
34
34
|
onBeforeRestart: PluginHookTap<OnBeforeRestartFn>;
|
|
35
35
|
onBeforeCreateCompiler: PluginHookTap<OnBeforeCreateCompilerFn>;
|
|
36
36
|
onAfterCreateCompiler: PluginHookTap<OnAfterCreateCompilerFn>;
|
|
37
|
+
onDevCompileDone: PluginHookTap<OnDevCompileDoneFn>;
|
|
37
38
|
onBeforeBuild: PluginHookTap<OnBeforeBuildFn>;
|
|
38
39
|
onAfterBuild: PluginHookTap<OnAfterBuildFn>;
|
|
39
40
|
onBeforeDev: PluginHookTap<OnBeforeDevFn>;
|
|
@@ -42,7 +42,7 @@ export type OnFileChangedFn = (params: {
|
|
|
42
42
|
export type OnBeforeRestartFn = () => Promise<void> | void;
|
|
43
43
|
export type OnBeforeDevFn = () => Promise<void> | void;
|
|
44
44
|
export type OnAfterDevFn = (params: {
|
|
45
|
-
|
|
45
|
+
port: number;
|
|
46
46
|
}) => Promise<void> | void;
|
|
47
47
|
export type OnBeforeDeployFn = (options: Record<string, any>) => Promise<void> | void;
|
|
48
48
|
export type OnAfterDeployFn = (options: Record<string, any>) => Promise<void> | void;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "0.0.0-nightly-
|
|
18
|
+
"version": "0.0.0-nightly-20250115160310",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@swc/helpers": "0.5.13",
|
|
64
|
-
"@modern-js/node-bundle-require": "0.0.0-nightly-
|
|
65
|
-
"@modern-js/utils": "0.0.0-nightly-
|
|
64
|
+
"@modern-js/node-bundle-require": "0.0.0-nightly-20250115160310",
|
|
65
|
+
"@modern-js/utils": "0.0.0-nightly-20250115160310"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@rsbuild/core": "1.1.13",
|
|
@@ -70,10 +70,10 @@
|
|
|
70
70
|
"@types/node": "^14",
|
|
71
71
|
"jest": "^29",
|
|
72
72
|
"typescript": "^5",
|
|
73
|
-
"@modern-js/types": "0.0.0-nightly-
|
|
74
|
-
"@
|
|
75
|
-
"@scripts/
|
|
76
|
-
"@
|
|
73
|
+
"@modern-js/types": "0.0.0-nightly-20250115160310",
|
|
74
|
+
"@scripts/build": "0.0.0-nightly-20250115160310",
|
|
75
|
+
"@scripts/jest-config": "0.0.0-nightly-20250115160310",
|
|
76
|
+
"@modern-js/uni-builder": "0.0.0-nightly-20250115160310"
|
|
77
77
|
},
|
|
78
78
|
"sideEffects": false,
|
|
79
79
|
"publishConfig": {
|