@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.
Files changed (99) hide show
  1. package/bin/modern.js +1 -1
  2. package/dist/cjs/commands/build.js +13 -19
  3. package/dist/cjs/commands/deploy.js +5 -5
  4. package/dist/cjs/commands/dev.js +11 -11
  5. package/dist/cjs/commands/index.js +6 -6
  6. package/dist/cjs/commands/inspect.js +1 -1
  7. package/dist/cjs/commands/serve.js +4 -4
  8. package/dist/cjs/hooks.js +60 -0
  9. package/dist/cjs/index.js +5 -154
  10. package/dist/cjs/{compat → new/compat}/hooks.js +5 -5
  11. package/dist/cjs/{compat → new/compat}/index.js +1 -4
  12. package/dist/cjs/{utils/initAppContext.js → new/context.js} +3 -3
  13. package/dist/cjs/{utils → new}/getConfigFile.js +1 -1
  14. package/dist/cjs/new/index.js +79 -0
  15. package/dist/cjs/new/loadPlugins.js +57 -0
  16. package/dist/cjs/{run/index.js → new/run.js} +6 -6
  17. package/dist/cjs/{utils/isAutoLoadPlugins.js → new/utils/index.js} +6 -6
  18. package/dist/cjs/old.js +179 -0
  19. package/dist/cjs/plugins/serverBuild.js +32 -30
  20. package/dist/cjs/utils/loadPlugins.js +4 -35
  21. package/dist/cjs/utils/printInstructions.js +11 -2
  22. package/dist/cjs/utils/restart.js +2 -2
  23. package/dist/esm/commands/build.js +12 -18
  24. package/dist/esm/commands/deploy.js +6 -6
  25. package/dist/esm/commands/dev.js +11 -11
  26. package/dist/esm/commands/index.js +8 -8
  27. package/dist/esm/commands/inspect.js +1 -1
  28. package/dist/esm/commands/serve.js +6 -6
  29. package/dist/esm/hooks.js +36 -0
  30. package/dist/esm/index.js +2 -245
  31. package/dist/esm/{compat → new/compat}/hooks.js +25 -15
  32. package/dist/esm/{compat → new/compat}/index.js +1 -4
  33. package/dist/esm/{utils → new}/getConfigFile.js +1 -1
  34. package/dist/esm/new/index.js +55 -0
  35. package/dist/esm/new/loadPlugins.js +94 -0
  36. package/dist/esm/{run/index.js → new/run.js} +6 -6
  37. package/dist/esm/{utils/isAutoLoadPlugins.js → new/utils/index.js} +6 -6
  38. package/dist/esm/old.js +258 -0
  39. package/dist/esm/plugins/serverBuild.js +56 -52
  40. package/dist/esm/utils/loadPlugins.js +7 -95
  41. package/dist/esm/utils/printInstructions.js +28 -1
  42. package/dist/esm/utils/restart.js +3 -3
  43. package/dist/esm-node/commands/build.js +13 -19
  44. package/dist/esm-node/commands/deploy.js +5 -5
  45. package/dist/esm-node/commands/dev.js +12 -12
  46. package/dist/esm-node/commands/index.js +6 -6
  47. package/dist/esm-node/commands/inspect.js +1 -1
  48. package/dist/esm-node/commands/serve.js +5 -5
  49. package/dist/esm-node/hooks.js +36 -0
  50. package/dist/esm-node/index.js +2 -140
  51. package/dist/esm-node/{compat → new/compat}/hooks.js +5 -5
  52. package/dist/esm-node/{compat → new/compat}/index.js +1 -4
  53. package/dist/esm-node/{utils → new}/getConfigFile.js +1 -1
  54. package/dist/esm-node/new/index.js +52 -0
  55. package/dist/esm-node/new/loadPlugins.js +33 -0
  56. package/dist/esm-node/{run/index.js → new/run.js} +6 -6
  57. package/dist/esm-node/{utils/isAutoLoadPlugins.js → new/utils/index.js} +2 -2
  58. package/dist/esm-node/old.js +140 -0
  59. package/dist/esm-node/plugins/serverBuild.js +32 -30
  60. package/dist/esm-node/utils/loadPlugins.js +4 -34
  61. package/dist/esm-node/utils/printInstructions.js +9 -1
  62. package/dist/esm-node/utils/restart.js +2 -2
  63. package/dist/types/commands/build.d.ts +2 -2
  64. package/dist/types/commands/deploy.d.ts +2 -2
  65. package/dist/types/commands/dev.d.ts +2 -2
  66. package/dist/types/commands/index.d.ts +6 -6
  67. package/dist/types/commands/inspect.d.ts +2 -2
  68. package/dist/types/commands/serve.d.ts +2 -2
  69. package/dist/types/hooks.d.ts +2 -0
  70. package/dist/types/index.d.ts +3 -5
  71. package/dist/types/{compat → new/compat}/hooks.d.ts +2 -2
  72. package/dist/types/new/compat/index.d.ts +2 -0
  73. package/dist/types/new/index.d.ts +6 -0
  74. package/dist/types/new/loadPlugins.d.ts +9 -0
  75. package/dist/types/new/utils/index.d.ts +1 -0
  76. package/dist/types/old.d.ts +13 -0
  77. package/dist/types/plugins/serverBuild.d.ts +2 -2
  78. package/dist/types/types/index.d.ts +0 -2
  79. package/dist/types/types/new.d.ts +16 -11
  80. package/dist/types/utils/generateWatchFiles.d.ts +2 -2
  81. package/dist/types/utils/loadPlugins.d.ts +3 -13
  82. package/dist/types/utils/printInstructions.d.ts +3 -1
  83. package/dist/types/utils/restart.d.ts +3 -2
  84. package/package.json +23 -22
  85. package/dist/types/compat/index.d.ts +0 -2
  86. package/dist/types/utils/isAutoLoadPlugins.d.ts +0 -1
  87. /package/dist/cjs/{compat → new/compat}/utils.js +0 -0
  88. /package/dist/cjs/{constants.js → new/constants.js} +0 -0
  89. /package/dist/esm/{compat → new/compat}/utils.js +0 -0
  90. /package/dist/esm/{constants.js → new/constants.js} +0 -0
  91. /package/dist/esm/{utils/initAppContext.js → new/context.js} +0 -0
  92. /package/dist/esm-node/{compat → new/compat}/utils.js +0 -0
  93. /package/dist/esm-node/{constants.js → new/constants.js} +0 -0
  94. /package/dist/esm-node/{utils/initAppContext.js → new/context.js} +0 -0
  95. /package/dist/types/{compat → new/compat}/utils.d.ts +0 -0
  96. /package/dist/types/{constants.d.ts → new/constants.d.ts} +0 -0
  97. /package/dist/types/{utils/initAppContext.d.ts → new/context.d.ts} +0 -0
  98. /package/dist/types/{utils → new}/getConfigFile.d.ts +0 -0
  99. /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
- api.onAfterBuild(async () => {
21
- const { appDirectory, distDirectory, metaName } = api.getAppContext();
22
- if (!checkHasCache(appDirectory) && !checkHasConfig(appDirectory, metaName)) {
23
- return;
24
- }
25
- const modernConfig = api.getNormalizedConfig();
26
- const distDir = path.resolve(distDirectory);
27
- const serverDir = path.resolve(appDirectory, SERVER_DIR);
28
- const sharedDir = path.resolve(appDirectory, SHARED_DIR);
29
- const tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
30
- const sourceDirs = [];
31
- if (fs.existsSync(serverDir)) {
32
- sourceDirs.push(serverDir);
33
- if (fs.existsSync(sharedDir)) {
34
- sourceDirs.push(sharedDir);
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
- const { server } = modernConfig;
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 hooks = api.getHooks();
6
- const { plugins } = await hooks._internalServerPlugins.call({
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.updateAppContext({
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(hooks, filename) {
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 hooks.onBeforeRestart.call();
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 { CLIPluginAPI } from '@modern-js/plugin-v2';
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: CLIPluginAPI<AppTools<'shared'>>, options?: BuildOptions) => Promise<void>;
4
+ export declare const build: (api: PluginAPI<AppTools<'shared'>>, options?: BuildOptions) => Promise<void>;
@@ -1,3 +1,3 @@
1
- import type { CLIPluginAPI } from '@modern-js/plugin-v2';
1
+ import type { PluginAPI } from '@modern-js/core';
2
2
  import type { AppTools } from '../types';
3
- export declare const deploy: (api: CLIPluginAPI<AppTools<'shared'>>, options: any) => Promise<void>;
3
+ export declare const deploy: (api: PluginAPI<AppTools<'shared'>>, options: any) => Promise<void>;
@@ -1,8 +1,8 @@
1
- import type { CLIPluginAPI } from '@modern-js/plugin-v2';
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: CLIPluginAPI<AppTools<'shared'>>, options: DevOptions, devServerOptions?: ExtraServerOptions) => Promise<void>;
8
+ export declare const dev: (api: PluginAPI<AppTools<'shared'>>, options: DevOptions, devServerOptions?: ExtraServerOptions) => Promise<void>;
@@ -1,10 +1,10 @@
1
- import type { CLIPluginAPI } from '@modern-js/plugin-v2';
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: CLIPluginAPI<AppTools<'shared'>>) => Promise<void>;
5
- export declare const buildCommand: (program: Command, api: CLIPluginAPI<AppTools<'shared'>>) => Promise<void>;
6
- export declare const serverCommand: (program: Command, api: CLIPluginAPI<AppTools<'shared'>>) => void;
7
- export declare const deployCommand: (program: Command, api: CLIPluginAPI<AppTools<'shared'>>) => void;
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: CLIPluginAPI<AppTools<'shared'>>) => void;
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 { CLIPluginAPI } from '@modern-js/plugin-v2';
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: CLIPluginAPI<AppTools<'shared'>>, options: InspectOptions) => Promise<import("@rsbuild/core").InspectConfigResult<"rspack">>;
4
+ export declare const inspect: (api: PluginAPI<AppTools<'shared'>>, options: InspectOptions) => Promise<import("@rsbuild/core").InspectConfigResult<"rspack">>;
@@ -1,3 +1,3 @@
1
- import type { CLIPluginAPI } from '@modern-js/plugin-v2';
1
+ import type { PluginAPI } from '@modern-js/core';
2
2
  import type { AppTools } from '../types';
3
- export declare const start: (api: CLIPluginAPI<AppTools<'shared'>>) => Promise<void>;
3
+ export declare const start: (api: PluginAPI<AppTools<'shared'>>) => Promise<void>;
@@ -0,0 +1,2 @@
1
+ import type { AppToolsHooks } from './types/hooks';
2
+ export declare const hooks: AppToolsHooks;
@@ -1,12 +1,10 @@
1
- import type { AppTools, AppToolsOptions, CliPluginFuture } from './types';
2
- import { initAppContext } from './utils/initAppContext';
3
- export * from './defineConfig';
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 '../types';
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<'shared'>>): Record<string, any>;
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,2 @@
1
+ import type { AppTools, CliPluginFuture } from '../../types';
2
+ export declare const compatPlugin: () => CliPluginFuture<AppTools>;
@@ -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, CliPluginFuture } from '../types';
2
- declare const _default: () => CliPluginFuture<AppTools<'shared'>>;
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, CollectAsyncHook, InternalContext, PluginHook, PluginHookTap, TransformFunction } from '@modern-js/plugin-v2';
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 = () => Promise<DevToolData> | DevToolData;
45
- export type RegisterBuildPlatformFn = () => Promise<RegisterBuildPlatformResult> | RegisterBuildPlatformResult;
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: CollectAsyncHook<RegisterDevFn>;
121
+ registerDev: AsyncHook<RegisterDevFn>;
112
122
  /**
113
123
  * @deprecated
114
124
  */
115
- registerBuildPlatform: CollectAsyncHook<RegisterBuildPlatformFn>;
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 { AppToolsContext } from '../types/new';
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: AppToolsContext<'shared'>, configDir?: string): Promise<string[]>;
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 { InternalPlugins } from '@modern-js/types';
6
- import type { AppTools } from '../types';
7
- export declare function getServerPlugins(api: CLIPluginAPI<AppTools<'shared'>>, metaName?: string): Promise<ServerPlugin[]>;
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 { AppNormalizedConfig } from '../types';
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 { AppToolsHooks } from '../types/new';
2
- export declare function restart(hooks: AppToolsHooks<'shared'>, filename: string): Promise<void>;
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-alpha.0",
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/index.d.ts",
39
- "jsnext:source": "./src/run/index.ts",
40
- "default": "./dist/cjs/run/index.js"
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/index.d.ts"
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/core": "2.63.0",
100
- "@modern-js/node-bundle-require": "2.63.0",
101
- "@modern-js/plugin": "2.63.0",
102
- "@modern-js/plugin-i18n": "2.63.0",
103
- "@modern-js/plugin-v2": "2.63.0",
104
- "@modern-js/prod-server": "2.63.0",
105
- "@modern-js/rsbuild-plugin-esbuild": "2.63.0",
106
- "@modern-js/server": "2.63.0",
107
- "@modern-js/server-core": "2.63.0",
108
- "@modern-js/server-utils": "2.63.0",
109
- "@modern-js/types": "2.63.0",
110
- "@modern-js/uni-builder": "2.63.0",
111
- "@modern-js/utils": "2.63.0",
112
- "@modern-js/plugin-data-loader": "2.63.0"
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/build": "2.63.0",
125
- "@scripts/jest-config": "2.63.0"
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,2 +0,0 @@
1
- import type { AppTools, CliPluginFuture } from '../types';
2
- export declare const compatPlugin: () => CliPluginFuture<AppTools<'shared'>>;
@@ -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