@modern-js/app-tools 2.63.1-alpha.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/bin/modern.js +1 -1
- package/dist/cjs/commands/build.js +13 -19
- package/dist/cjs/commands/deploy.js +5 -5
- package/dist/cjs/commands/dev.js +11 -11
- package/dist/cjs/commands/index.js +6 -6
- package/dist/cjs/commands/inspect.js +1 -1
- package/dist/cjs/commands/serve.js +4 -4
- package/dist/cjs/hooks.js +60 -0
- package/dist/cjs/index.js +5 -154
- package/dist/cjs/{compat → new/compat}/hooks.js +5 -5
- package/dist/cjs/{compat → new/compat}/index.js +1 -4
- package/dist/cjs/{utils/initAppContext.js → new/context.js} +3 -3
- package/dist/cjs/{utils → new}/getConfigFile.js +1 -1
- package/dist/cjs/new/index.js +79 -0
- package/dist/cjs/new/loadPlugins.js +57 -0
- package/dist/cjs/{run/index.js → new/run.js} +6 -6
- package/dist/cjs/{utils/isAutoLoadPlugins.js → new/utils/index.js} +6 -6
- package/dist/cjs/old.js +179 -0
- package/dist/cjs/plugins/serverBuild.js +32 -30
- package/dist/cjs/utils/loadPlugins.js +4 -35
- package/dist/cjs/utils/printInstructions.js +11 -2
- package/dist/cjs/utils/restart.js +2 -2
- package/dist/esm/commands/build.js +12 -18
- package/dist/esm/commands/deploy.js +6 -6
- package/dist/esm/commands/dev.js +11 -11
- package/dist/esm/commands/index.js +8 -8
- package/dist/esm/commands/inspect.js +1 -1
- package/dist/esm/commands/serve.js +6 -6
- package/dist/esm/hooks.js +36 -0
- package/dist/esm/index.js +2 -245
- package/dist/esm/{compat → new/compat}/hooks.js +25 -15
- package/dist/esm/{compat → new/compat}/index.js +1 -4
- package/dist/esm/{utils → new}/getConfigFile.js +1 -1
- package/dist/esm/new/index.js +55 -0
- package/dist/esm/new/loadPlugins.js +94 -0
- package/dist/esm/{run/index.js → new/run.js} +6 -6
- package/dist/esm/{utils/isAutoLoadPlugins.js → new/utils/index.js} +6 -6
- package/dist/esm/old.js +258 -0
- package/dist/esm/plugins/serverBuild.js +56 -52
- package/dist/esm/utils/loadPlugins.js +7 -95
- package/dist/esm/utils/printInstructions.js +28 -1
- package/dist/esm/utils/restart.js +3 -3
- package/dist/esm-node/commands/build.js +13 -19
- package/dist/esm-node/commands/deploy.js +5 -5
- package/dist/esm-node/commands/dev.js +12 -12
- package/dist/esm-node/commands/index.js +6 -6
- package/dist/esm-node/commands/inspect.js +1 -1
- package/dist/esm-node/commands/serve.js +5 -5
- package/dist/esm-node/hooks.js +36 -0
- package/dist/esm-node/index.js +2 -140
- package/dist/esm-node/{compat → new/compat}/hooks.js +5 -5
- package/dist/esm-node/{compat → new/compat}/index.js +1 -4
- package/dist/esm-node/{utils → new}/getConfigFile.js +1 -1
- package/dist/esm-node/new/index.js +52 -0
- package/dist/esm-node/new/loadPlugins.js +33 -0
- package/dist/esm-node/{run/index.js → new/run.js} +6 -6
- package/dist/esm-node/{utils/isAutoLoadPlugins.js → new/utils/index.js} +2 -2
- package/dist/esm-node/old.js +140 -0
- package/dist/esm-node/plugins/serverBuild.js +32 -30
- package/dist/esm-node/utils/loadPlugins.js +4 -34
- package/dist/esm-node/utils/printInstructions.js +9 -1
- package/dist/esm-node/utils/restart.js +2 -2
- package/dist/types/commands/build.d.ts +2 -2
- package/dist/types/commands/deploy.d.ts +2 -2
- package/dist/types/commands/dev.d.ts +2 -2
- package/dist/types/commands/index.d.ts +6 -6
- package/dist/types/commands/inspect.d.ts +2 -2
- package/dist/types/commands/serve.d.ts +2 -2
- package/dist/types/hooks.d.ts +2 -0
- package/dist/types/index.d.ts +3 -5
- package/dist/types/{compat → new/compat}/hooks.d.ts +2 -2
- package/dist/types/new/compat/index.d.ts +2 -0
- package/dist/types/new/index.d.ts +6 -0
- package/dist/types/new/loadPlugins.d.ts +9 -0
- package/dist/types/new/utils/index.d.ts +1 -0
- package/dist/types/old.d.ts +13 -0
- package/dist/types/plugins/serverBuild.d.ts +2 -2
- package/dist/types/types/index.d.ts +0 -2
- package/dist/types/types/new.d.ts +16 -11
- package/dist/types/utils/generateWatchFiles.d.ts +2 -2
- package/dist/types/utils/loadPlugins.d.ts +3 -13
- package/dist/types/utils/printInstructions.d.ts +3 -1
- package/dist/types/utils/restart.d.ts +3 -2
- package/package.json +23 -22
- package/dist/types/compat/index.d.ts +0 -2
- package/dist/types/utils/isAutoLoadPlugins.d.ts +0 -1
- /package/dist/cjs/{compat → new/compat}/utils.js +0 -0
- /package/dist/cjs/{constants.js → new/constants.js} +0 -0
- /package/dist/esm/{compat → new/compat}/utils.js +0 -0
- /package/dist/esm/{constants.js → new/constants.js} +0 -0
- /package/dist/esm/{utils/initAppContext.js → new/context.js} +0 -0
- /package/dist/esm-node/{compat → new/compat}/utils.js +0 -0
- /package/dist/esm-node/{constants.js → new/constants.js} +0 -0
- /package/dist/esm-node/{utils/initAppContext.js → new/context.js} +0 -0
- /package/dist/types/{compat → new/compat}/utils.d.ts +0 -0
- /package/dist/types/{constants.d.ts → new/constants.d.ts} +0 -0
- /package/dist/types/{utils/initAppContext.d.ts → new/context.d.ts} +0 -0
- /package/dist/types/{utils → new}/getConfigFile.d.ts +0 -0
- /package/dist/types/{run/index.d.ts → new/run.d.ts} +0 -0
|
@@ -17,38 +17,40 @@ function checkHasConfig(appDir, metaName = "modern-js") {
|
|
|
17
17
|
var serverBuild_default = () => ({
|
|
18
18
|
name: "@modern-js/server-build",
|
|
19
19
|
setup(api) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
20
|
+
return {
|
|
21
|
+
async afterBuild() {
|
|
22
|
+
const { appDirectory, distDirectory, metaName } = api.useAppContext();
|
|
23
|
+
if (!checkHasCache(appDirectory) && !checkHasConfig(appDirectory, metaName)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const modernConfig = api.useResolvedConfigContext();
|
|
27
|
+
const distDir = path.resolve(distDirectory);
|
|
28
|
+
const serverDir = path.resolve(appDirectory, SERVER_DIR);
|
|
29
|
+
const sharedDir = path.resolve(appDirectory, SHARED_DIR);
|
|
30
|
+
const tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
|
|
31
|
+
const sourceDirs = [];
|
|
32
|
+
if (fs.existsSync(serverDir)) {
|
|
33
|
+
sourceDirs.push(serverDir);
|
|
34
|
+
if (fs.existsSync(sharedDir)) {
|
|
35
|
+
sourceDirs.push(sharedDir);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const { server } = modernConfig;
|
|
39
|
+
const { alias } = modernConfig.source;
|
|
40
|
+
const { babel } = modernConfig.tools;
|
|
41
|
+
if (sourceDirs.length > 0) {
|
|
42
|
+
await compile(appDirectory, {
|
|
43
|
+
server,
|
|
44
|
+
alias,
|
|
45
|
+
babelConfig: babel
|
|
46
|
+
}, {
|
|
47
|
+
sourceDirs,
|
|
48
|
+
distDir,
|
|
49
|
+
tsconfigPath
|
|
50
|
+
});
|
|
35
51
|
}
|
|
36
52
|
}
|
|
37
|
-
|
|
38
|
-
const { alias } = modernConfig.source;
|
|
39
|
-
const { babel } = modernConfig.tools;
|
|
40
|
-
if (sourceDirs.length > 0) {
|
|
41
|
-
await compile(appDirectory, {
|
|
42
|
-
server,
|
|
43
|
-
alias,
|
|
44
|
-
babelConfig: babel
|
|
45
|
-
}, {
|
|
46
|
-
sourceDirs,
|
|
47
|
-
distDir,
|
|
48
|
-
tsconfigPath
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
});
|
|
53
|
+
};
|
|
52
54
|
}
|
|
53
55
|
});
|
|
54
56
|
export {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { loadServerPlugins as loadServerPluginInstances } from "@modern-js/prod-server";
|
|
2
|
-
import { compatibleRequire, createDebugger, dynamicImport, getInternalPlugins, tryResolve } from "@modern-js/utils";
|
|
3
|
-
const debug = createDebugger("load-plugins");
|
|
4
2
|
async function getServerPlugins(api, metaName = "modern-js") {
|
|
5
|
-
const
|
|
6
|
-
const { plugins } = await
|
|
3
|
+
const runner = api.useHookRunners();
|
|
4
|
+
const { plugins } = await runner._internalServerPlugins({
|
|
7
5
|
plugins: []
|
|
8
6
|
});
|
|
9
7
|
const filtedPlugins = plugins.filter((plugin) => plugin.name.includes(metaName));
|
|
10
|
-
api.
|
|
8
|
+
api.setAppContext({
|
|
9
|
+
...api.useAppContext(),
|
|
11
10
|
serverPlugins: filtedPlugins
|
|
12
11
|
});
|
|
13
12
|
return filtedPlugins;
|
|
@@ -17,36 +16,7 @@ async function loadServerPlugins(api, appDirectory, metaName) {
|
|
|
17
16
|
const instances = await loadServerPluginInstances(plugins, appDirectory);
|
|
18
17
|
return instances;
|
|
19
18
|
}
|
|
20
|
-
const resolveCliPlugin = async (p, appDirectory) => {
|
|
21
|
-
const pkg = typeof p === "string" ? p : p[0];
|
|
22
|
-
const pluginOptions = typeof p === "string" ? void 0 : p[1];
|
|
23
|
-
const path = tryResolve(pkg, appDirectory);
|
|
24
|
-
let module;
|
|
25
|
-
try {
|
|
26
|
-
module = await compatibleRequire(path);
|
|
27
|
-
} catch (e) {
|
|
28
|
-
({ default: module } = await dynamicImport(path));
|
|
29
|
-
}
|
|
30
|
-
if (typeof module === "function") {
|
|
31
|
-
const result = module(pluginOptions);
|
|
32
|
-
return result;
|
|
33
|
-
}
|
|
34
|
-
return module;
|
|
35
|
-
};
|
|
36
|
-
const loadInternalPlugins = async (appDirectory, internalPlugins, autoLoad, autoLoadPlugins) => {
|
|
37
|
-
const plugins = [
|
|
38
|
-
...autoLoadPlugins ? getInternalPlugins(appDirectory, internalPlugins) : [],
|
|
39
|
-
...autoLoad ? getInternalPlugins(appDirectory, autoLoad) : []
|
|
40
|
-
];
|
|
41
|
-
const loadedPlugins = await Promise.all(plugins.map((plugin) => {
|
|
42
|
-
const loadedPlugin = resolveCliPlugin(plugin, appDirectory);
|
|
43
|
-
debug(`resolve plugin %s: %s`, plugin, loadedPlugin);
|
|
44
|
-
return loadedPlugin;
|
|
45
|
-
}));
|
|
46
|
-
return loadedPlugins;
|
|
47
|
-
};
|
|
48
19
|
export {
|
|
49
20
|
getServerPlugins,
|
|
50
|
-
loadInternalPlugins,
|
|
51
21
|
loadServerPlugins
|
|
52
22
|
};
|
|
@@ -6,6 +6,14 @@ const printInstructions = async (hooks, appContext, config) => {
|
|
|
6
6
|
});
|
|
7
7
|
logger.log(instructions);
|
|
8
8
|
};
|
|
9
|
+
const printInstructionsCompat = async (hookRunners, appContext, config) => {
|
|
10
|
+
const message = prettyInstructions(appContext, config);
|
|
11
|
+
const { instructions } = await hookRunners.beforePrintInstructions({
|
|
12
|
+
instructions: message
|
|
13
|
+
});
|
|
14
|
+
logger.log(instructions);
|
|
15
|
+
};
|
|
9
16
|
export {
|
|
10
|
-
printInstructions
|
|
17
|
+
printInstructions,
|
|
18
|
+
printInstructionsCompat
|
|
11
19
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { cli } from "@modern-js/plugin-v2/cli";
|
|
2
2
|
import { chalk, clearConsole, getFullArgv, logger } from "@modern-js/utils";
|
|
3
3
|
import { program } from "@modern-js/utils/commander";
|
|
4
|
-
async function restart(
|
|
4
|
+
async function restart(hooksRunner, filename) {
|
|
5
5
|
clearConsole();
|
|
6
6
|
logger.info(`Restart because ${chalk.yellow(filename)} is changed...
|
|
7
7
|
`);
|
|
8
8
|
let hasGetError = false;
|
|
9
|
-
await
|
|
9
|
+
await hooksRunner.beforeRestart();
|
|
10
10
|
try {
|
|
11
11
|
await cli.init(cli.getPrevInitOptions());
|
|
12
12
|
} catch (err) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type PluginAPI } from '@modern-js/core';
|
|
2
2
|
import type { AppTools } from '../types';
|
|
3
3
|
import type { BuildOptions } from '../utils/types';
|
|
4
|
-
export declare const build: (api:
|
|
4
|
+
export declare const build: (api: PluginAPI<AppTools<'shared'>>, options?: BuildOptions) => Promise<void>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PluginAPI } from '@modern-js/core';
|
|
2
2
|
import type { AppTools } from '../types';
|
|
3
|
-
export declare const deploy: (api:
|
|
3
|
+
export declare const deploy: (api: PluginAPI<AppTools<'shared'>>, options: any) => Promise<void>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type PluginAPI } from '@modern-js/core';
|
|
2
2
|
import { type ApplyPlugins } from '@modern-js/server';
|
|
3
3
|
import type { AppTools } from '../types';
|
|
4
4
|
import type { DevOptions } from '../utils/types';
|
|
5
5
|
export interface ExtraServerOptions {
|
|
6
6
|
applyPlugins?: ApplyPlugins;
|
|
7
7
|
}
|
|
8
|
-
export declare const dev: (api:
|
|
8
|
+
export declare const dev: (api: PluginAPI<AppTools<'shared'>>, options: DevOptions, devServerOptions?: ExtraServerOptions) => Promise<void>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PluginAPI } from '@modern-js/core';
|
|
2
2
|
import { type Command } from '@modern-js/utils';
|
|
3
3
|
import type { AppTools } from '../types';
|
|
4
|
-
export declare const devCommand: (program: Command, api:
|
|
5
|
-
export declare const buildCommand: (program: Command, api:
|
|
6
|
-
export declare const serverCommand: (program: Command, api:
|
|
7
|
-
export declare const deployCommand: (program: Command, api:
|
|
4
|
+
export declare const devCommand: (program: Command, api: PluginAPI<AppTools<'shared'>>) => Promise<void>;
|
|
5
|
+
export declare const buildCommand: (program: Command, api: PluginAPI<AppTools<'shared'>>) => Promise<void>;
|
|
6
|
+
export declare const serverCommand: (program: Command, api: PluginAPI<AppTools<'shared'>>) => void;
|
|
7
|
+
export declare const deployCommand: (program: Command, api: PluginAPI<AppTools<'shared'>>) => void;
|
|
8
8
|
export declare const newCommand: (program: Command, locale: string) => void;
|
|
9
|
-
export declare const inspectCommand: (program: Command, api:
|
|
9
|
+
export declare const inspectCommand: (program: Command, api: PluginAPI<AppTools<'shared'>>) => void;
|
|
10
10
|
export declare const upgradeCommand: (program: Command) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PluginAPI } from '@modern-js/core';
|
|
2
2
|
import type { AppTools } from '../types';
|
|
3
3
|
import type { InspectOptions } from '../utils/types';
|
|
4
|
-
export declare const inspect: (api:
|
|
4
|
+
export declare const inspect: (api: PluginAPI<AppTools<'shared'>>, options: InspectOptions) => Promise<import("@rsbuild/core").InspectConfigResult<"rspack">>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PluginAPI } from '@modern-js/core';
|
|
2
2
|
import type { AppTools } from '../types';
|
|
3
|
-
export declare const start: (api:
|
|
3
|
+
export declare const start: (api: PluginAPI<AppTools<'shared'>>) => Promise<void>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export declare const appTools: (options?: AppToolsOptions) => CliPluginFuture<AppTools<'shared'>>;
|
|
1
|
+
import { appTools } from './new/index';
|
|
2
|
+
export { appTools };
|
|
3
|
+
export { initAppContext } from './new/index';
|
|
5
4
|
export { defineConfig, defineLegacyConfig } from './defineConfig';
|
|
6
5
|
export { mergeConfig } from '@modern-js/core';
|
|
7
6
|
export type { RuntimeUserConfig } from './types/config';
|
|
8
7
|
export { dev } from './commands/dev';
|
|
9
8
|
export type { DevOptions } from './utils/types';
|
|
10
9
|
export * from './types';
|
|
11
|
-
export { initAppContext };
|
|
12
10
|
export default appTools;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { InternalContext } from '@modern-js/plugin-v2';
|
|
2
|
-
import type { AppTools } from '
|
|
2
|
+
import type { AppTools } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* old plugin useHookRunners function result
|
|
5
5
|
*/
|
|
6
|
-
export declare function getHookRunners(context: InternalContext<AppTools
|
|
6
|
+
export declare function getHookRunners(context: InternalContext<AppTools>): Record<string, any>;
|
|
7
7
|
export declare function handleSetupResult(setupResult: Record<string, (...args: any) => any>, api: Record<string, any>): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type AppToolsOptions } from '../old';
|
|
2
|
+
import type { AppTools, CliPluginFuture } from '../types';
|
|
3
|
+
import { initAppContext } from './context';
|
|
4
|
+
export * from '../defineConfig';
|
|
5
|
+
export { initAppContext };
|
|
6
|
+
export declare const appTools: (options?: AppToolsOptions) => CliPluginFuture<AppTools<'shared'>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Plugin } from '@modern-js/plugin-v2';
|
|
2
|
+
import type { InternalPlugins } from '@modern-js/types';
|
|
3
|
+
/**
|
|
4
|
+
* Load internal plugins which in @modern-js scope and user's custom plugins.
|
|
5
|
+
* @param appDirectory - Application root directory.
|
|
6
|
+
* @param internalPlugins - Internal plugins.
|
|
7
|
+
* @returns Plugin Objects has been required.
|
|
8
|
+
*/
|
|
9
|
+
export declare const loadInternalPlugins: (appDirectory: string, internalPlugins?: InternalPlugins, autoLoad?: InternalPlugins, autoLoadPlugins?: boolean) => Promise<Plugin[]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getIsAutoLoadPlugins(appDirectory: string, configFile?: string, packageJsonConfig?: string): Promise<boolean>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CliPlugin } from '@modern-js/core';
|
|
2
|
+
import type { AppTools, AppToolsOptions } from './types';
|
|
3
|
+
export { dev } from './commands/dev';
|
|
4
|
+
export type { DevOptions } from './utils/types';
|
|
5
|
+
export { mergeConfig } from '@modern-js/core';
|
|
6
|
+
export * from './defineConfig';
|
|
7
|
+
export * from './types';
|
|
8
|
+
export type { RuntimeUserConfig } from './types/config';
|
|
9
|
+
/**
|
|
10
|
+
* The core package of the framework, providing CLI commands, build capabilities, configuration parsing and more.
|
|
11
|
+
*/
|
|
12
|
+
export declare const appTools: (options?: AppToolsOptions) => CliPlugin<AppTools<'shared'>>;
|
|
13
|
+
export default appTools;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { AppTools,
|
|
2
|
-
declare const _default: () =>
|
|
1
|
+
import type { AppTools, CliPlugin } from '../types';
|
|
2
|
+
declare const _default: () => CliPlugin<AppTools>;
|
|
3
3
|
export default _default;
|
|
@@ -5,7 +5,6 @@ import type { AppToolsHooks } from './hooks';
|
|
|
5
5
|
import type { AppToolsLegacyNormalizedConfig, AppToolsLegacyUserConfig } from './legacyConfig';
|
|
6
6
|
import type { AppToolsExtendAPI, AppToolsExtendContext, AppToolsExtendHooks } from './new';
|
|
7
7
|
import type { Bundler } from './utils';
|
|
8
|
-
export type { CLIPluginExtends };
|
|
9
8
|
export * from './hooks';
|
|
10
9
|
export * from './config';
|
|
11
10
|
export * from './legacyConfig';
|
|
@@ -34,4 +33,3 @@ export type AppToolsOptions = {
|
|
|
34
33
|
* */
|
|
35
34
|
bundler?: 'rspack' | 'webpack' | 'experimental-rspack';
|
|
36
35
|
};
|
|
37
|
-
export type { AppToolsExtendAPI, AppToolsExtendContext, AppToolsExtendHooks, AppToolsContext, AppToolsHooks as AppToolsFeatureHooks, } from './new';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { DevToolData, RegisterBuildPlatformResult } from '@modern-js/core';
|
|
2
|
-
import type { AppContext, AsyncHook,
|
|
2
|
+
import type { AppContext, AsyncHook, InternalContext, PluginHook, PluginHookTap, TransformFunction } from '@modern-js/plugin-v2';
|
|
3
3
|
import type { Hooks } from '@modern-js/plugin-v2/cli';
|
|
4
4
|
import type { Entrypoint, HtmlPartials, HtmlTemplates, NestedRouteForCli, PageRoute, RouteLegacy, ServerPlugin, ServerRoute } from '@modern-js/types';
|
|
5
5
|
import type { AppTools } from '.';
|
|
6
|
-
import type { getHookRunners } from '../compat/hooks';
|
|
6
|
+
import type { getHookRunners } from '../new/compat/hooks';
|
|
7
7
|
import type { AppToolsNormalizedConfig, AppToolsUserConfig } from './config';
|
|
8
8
|
import type { RuntimePlugin } from './hooks';
|
|
9
9
|
import type { Bundler } from './utils';
|
|
@@ -41,8 +41,18 @@ export type BeforeGenerateRoutesFn = TransformFunction<{
|
|
|
41
41
|
export type BeforePrintInstructionsFn = TransformFunction<{
|
|
42
42
|
instructions: string;
|
|
43
43
|
}>;
|
|
44
|
-
export type RegisterDevFn = (
|
|
45
|
-
|
|
44
|
+
export type RegisterDevFn = (params: {
|
|
45
|
+
name: string;
|
|
46
|
+
entry: string;
|
|
47
|
+
type: string;
|
|
48
|
+
config: any;
|
|
49
|
+
}) => Promise<DevToolData> | DevToolData;
|
|
50
|
+
export type RegisterBuildPlatformFn = (params: {
|
|
51
|
+
name: string;
|
|
52
|
+
entry: string;
|
|
53
|
+
type: string;
|
|
54
|
+
config: any;
|
|
55
|
+
}) => Promise<RegisterBuildPlatformResult> | RegisterBuildPlatformResult;
|
|
46
56
|
export type AddRuntimeExportsFn = () => Promise<void> | void;
|
|
47
57
|
export interface AppToolsExtendAPI<B extends Bundler = 'webpack'> {
|
|
48
58
|
onBeforeConfig: PluginHookTap<BeforeConfigFn>;
|
|
@@ -108,11 +118,11 @@ export interface AppToolsExtendHooks extends Record<string, PluginHook<(...args:
|
|
|
108
118
|
/**
|
|
109
119
|
* @deprecated
|
|
110
120
|
*/
|
|
111
|
-
registerDev:
|
|
121
|
+
registerDev: AsyncHook<RegisterDevFn>;
|
|
112
122
|
/**
|
|
113
123
|
* @deprecated
|
|
114
124
|
*/
|
|
115
|
-
registerBuildPlatform:
|
|
125
|
+
registerBuildPlatform: AsyncHook<RegisterBuildPlatformFn>;
|
|
116
126
|
/**
|
|
117
127
|
* @deprecated
|
|
118
128
|
*/
|
|
@@ -126,7 +136,6 @@ export type AppToolsExtendContext<B extends Bundler = 'webpack'> = {
|
|
|
126
136
|
internalSrcAlias: string;
|
|
127
137
|
apiDirectory: string;
|
|
128
138
|
lambdaDirectory: string;
|
|
129
|
-
serverConfigFile: string;
|
|
130
139
|
serverPlugins: ServerPlugin[];
|
|
131
140
|
moduleType: 'module' | 'commonjs';
|
|
132
141
|
/** Information for entry points */
|
|
@@ -148,10 +157,6 @@ export type AppToolsExtendContext<B extends Bundler = 'webpack'> = {
|
|
|
148
157
|
* @private
|
|
149
158
|
*/
|
|
150
159
|
htmlTemplates: HtmlTemplates;
|
|
151
|
-
/**
|
|
152
|
-
* @deprecated compat old plugin, default is app tools
|
|
153
|
-
*/
|
|
154
|
-
toolsType?: string;
|
|
155
160
|
};
|
|
156
161
|
export type AppToolsContext<B extends Bundler = 'webpack'> = AppContext<AppTools<B>> & AppToolsExtendContext<B>;
|
|
157
162
|
export type AppToolsHooks<B extends Bundler = 'webpack'> = Hooks<AppToolsUserConfig<B>, AppToolsNormalizedConfig> & AppToolsExtendHooks;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IAppContext } from '../types';
|
|
2
2
|
export declare const addServerConfigToDeps: (dependencies: string[], appDirectory: string, serverConfigFile: string) => Promise<void>;
|
|
3
|
-
export declare function generateWatchFiles(appContext:
|
|
3
|
+
export declare function generateWatchFiles(appContext: IAppContext, configDir?: string): Promise<string[]>;
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
import type { CLIPluginAPI } from '@modern-js/plugin-v2';
|
|
2
|
-
import type { Plugin } from '@modern-js/plugin-v2';
|
|
3
1
|
import type { ServerPlugin as ServerPluginInstance } from '@modern-js/server-core';
|
|
4
2
|
import type { ServerPlugin } from '@modern-js/types';
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function loadServerPlugins(api: CLIPluginAPI<AppTools<'shared'>>, appDirectory: string, metaName: string): Promise<ServerPluginInstance[]>;
|
|
9
|
-
/**
|
|
10
|
-
* Load internal plugins which in @modern-js scope and user's custom plugins.
|
|
11
|
-
* @param appDirectory - Application root directory.
|
|
12
|
-
* @param internalPlugins - Internal plugins.
|
|
13
|
-
* @returns Plugin Objects has been required.
|
|
14
|
-
*/
|
|
15
|
-
export declare const loadInternalPlugins: (appDirectory: string, internalPlugins?: InternalPlugins, autoLoad?: InternalPlugins, autoLoadPlugins?: boolean) => Promise<Plugin[]>;
|
|
3
|
+
import type { AppTools, PluginAPI } from '../types';
|
|
4
|
+
export declare function getServerPlugins(api: PluginAPI<AppTools<'shared'>>, metaName?: string): Promise<ServerPlugin[]>;
|
|
5
|
+
export declare function loadServerPlugins(api: PluginAPI<AppTools<'shared'>>, appDirectory: string, metaName: string): Promise<ServerPluginInstance[]>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CliHooksRunner, IAppContext } from '@modern-js/core';
|
|
2
|
+
import type { AppNormalizedConfig, AppTools } from '../types';
|
|
2
3
|
import type { AppToolsContext, AppToolsHooks } from '../types/new';
|
|
3
4
|
export declare const printInstructions: (hooks: AppToolsHooks<'shared'>, appContext: AppToolsContext<'shared'>, config: AppNormalizedConfig<'shared'>) => Promise<void>;
|
|
5
|
+
export declare const printInstructionsCompat: (hookRunners: CliHooksRunner<AppTools<'shared'>>, appContext: IAppContext, config: AppNormalizedConfig<'shared'>) => Promise<void>;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { ToRunners } from '@modern-js/core';
|
|
2
|
+
import type { AppToolsHooks } from '../types/hooks';
|
|
3
|
+
export declare function restart(hooksRunner: ToRunners<AppToolsHooks>, filename: string): Promise<void>;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.63.1
|
|
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",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"default": "./dist/cjs/index.js"
|
|
36
36
|
},
|
|
37
37
|
"./cli/run": {
|
|
38
|
-
"types": "./dist/types/run
|
|
39
|
-
"jsnext:source": "./src/run
|
|
40
|
-
"default": "./dist/cjs/run
|
|
38
|
+
"types": "./dist/types/new/run.d.ts",
|
|
39
|
+
"jsnext:source": "./src/new/run.ts",
|
|
40
|
+
"default": "./dist/cjs/new/run.js"
|
|
41
41
|
},
|
|
42
42
|
"./types": {
|
|
43
43
|
"types": "./lib/types.d.ts",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"./dist/types/index.d.ts"
|
|
65
65
|
],
|
|
66
66
|
"cli/run": [
|
|
67
|
-
"./dist/types/run
|
|
67
|
+
"./dist/types/new/run.d.ts"
|
|
68
68
|
],
|
|
69
69
|
"types": [
|
|
70
70
|
"./lib/types.d.ts"
|
|
@@ -96,20 +96,20 @@
|
|
|
96
96
|
"mlly": "^1.6.1",
|
|
97
97
|
"pkg-types": "^1.1.0",
|
|
98
98
|
"std-env": "^3.7.0",
|
|
99
|
-
"@modern-js/
|
|
100
|
-
"@modern-js/
|
|
101
|
-
"@modern-js/plugin": "2.63.
|
|
102
|
-
"@modern-js/plugin-
|
|
103
|
-
"@modern-js/
|
|
104
|
-
"@modern-js/
|
|
105
|
-
"@modern-js/
|
|
106
|
-
"@modern-js/
|
|
107
|
-
"@modern-js/server
|
|
108
|
-
"@modern-js/server-
|
|
109
|
-
"@modern-js/types": "2.63.
|
|
110
|
-
"@modern-js/uni-builder": "2.63.
|
|
111
|
-
"@modern-js/utils": "2.63.
|
|
112
|
-
"@modern-js/
|
|
99
|
+
"@modern-js/node-bundle-require": "2.63.1",
|
|
100
|
+
"@modern-js/core": "2.63.1",
|
|
101
|
+
"@modern-js/plugin": "2.63.1",
|
|
102
|
+
"@modern-js/plugin-data-loader": "2.63.1",
|
|
103
|
+
"@modern-js/prod-server": "2.63.1",
|
|
104
|
+
"@modern-js/plugin-v2": "2.63.1",
|
|
105
|
+
"@modern-js/plugin-i18n": "2.63.1",
|
|
106
|
+
"@modern-js/rsbuild-plugin-esbuild": "2.63.1",
|
|
107
|
+
"@modern-js/server": "2.63.1",
|
|
108
|
+
"@modern-js/server-core": "2.63.1",
|
|
109
|
+
"@modern-js/types": "2.63.1",
|
|
110
|
+
"@modern-js/uni-builder": "2.63.1",
|
|
111
|
+
"@modern-js/server-utils": "2.63.1",
|
|
112
|
+
"@modern-js/utils": "2.63.1"
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
115
115
|
"@rsbuild/plugin-webpack-swc": "1.0.9",
|
|
@@ -121,8 +121,8 @@
|
|
|
121
121
|
"tsconfig-paths": "^4.2.0",
|
|
122
122
|
"typescript": "^5",
|
|
123
123
|
"webpack": "^5.96.1",
|
|
124
|
-
"@scripts/
|
|
125
|
-
"@scripts/
|
|
124
|
+
"@scripts/jest-config": "2.63.1",
|
|
125
|
+
"@scripts/build": "2.63.1"
|
|
126
126
|
},
|
|
127
127
|
"peerDependencies": {
|
|
128
128
|
"ts-node": "^10.7.0",
|
|
@@ -139,7 +139,8 @@
|
|
|
139
139
|
"sideEffects": false,
|
|
140
140
|
"publishConfig": {
|
|
141
141
|
"registry": "https://registry.npmjs.org/",
|
|
142
|
-
"access": "public"
|
|
142
|
+
"access": "public",
|
|
143
|
+
"provenance": true
|
|
143
144
|
},
|
|
144
145
|
"scripts": {
|
|
145
146
|
"new": "modern-lib new",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isAutoLoadPlugins(appDirectory: string, configFile?: string, packageJsonConfig?: string): Promise<boolean>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|