@modern-js/app-tools 2.27.0 → 2.28.0

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 (56) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/dist/cjs/analyze/generateCode.js +2 -2
  3. package/dist/cjs/analyze/getFileSystemEntry.js +2 -1
  4. package/dist/cjs/analyze/getServerRoutes.js +5 -4
  5. package/dist/cjs/analyze/index.js +209 -211
  6. package/dist/cjs/analyze/nestedRoutes.js +2 -2
  7. package/dist/cjs/analyze/templates.js +4 -4
  8. package/dist/cjs/analyze/utils.js +2 -1
  9. package/dist/cjs/builder/builder-rspack/adapterCopy.js +41 -43
  10. package/dist/cjs/builder/builder-webpack/adapterModern.js +23 -25
  11. package/dist/cjs/builder/generator/createBuilderProviderConfig.js +2 -1
  12. package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +11 -9
  13. package/dist/cjs/commands/build.js +2 -1
  14. package/dist/cjs/commands/dev.js +3 -2
  15. package/dist/cjs/commands/inspect.js +2 -1
  16. package/dist/cjs/commands/serve.js +2 -2
  17. package/dist/cjs/index.js +7 -2
  18. package/dist/cjs/initialize/index.js +70 -72
  19. package/dist/esm/analyze/generateCode.js +2 -2
  20. package/dist/esm/analyze/getFileSystemEntry.js +2 -1
  21. package/dist/esm/analyze/getServerRoutes.js +5 -4
  22. package/dist/esm/analyze/nestedRoutes.js +2 -2
  23. package/dist/esm/analyze/templates.js +4 -4
  24. package/dist/esm/analyze/utils.js +2 -1
  25. package/dist/esm/builder/builder-rspack/adapterCopy.js +1 -1
  26. package/dist/esm/builder/generator/createBuilderProviderConfig.js +2 -1
  27. package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +12 -10
  28. package/dist/esm/commands/build.js +2 -2
  29. package/dist/esm/commands/dev.js +5 -3
  30. package/dist/esm/commands/inspect.js +2 -2
  31. package/dist/esm/commands/serve.js +2 -2
  32. package/dist/esm/index.js +7 -5
  33. package/dist/esm-node/analyze/generateCode.js +2 -2
  34. package/dist/esm-node/analyze/getFileSystemEntry.js +2 -1
  35. package/dist/esm-node/analyze/getServerRoutes.js +5 -4
  36. package/dist/esm-node/analyze/index.js +209 -211
  37. package/dist/esm-node/analyze/nestedRoutes.js +2 -2
  38. package/dist/esm-node/analyze/templates.js +4 -4
  39. package/dist/esm-node/analyze/utils.js +2 -1
  40. package/dist/esm-node/builder/builder-rspack/adapterCopy.js +41 -43
  41. package/dist/esm-node/builder/builder-webpack/adapterModern.js +23 -25
  42. package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +2 -1
  43. package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +11 -9
  44. package/dist/esm-node/commands/build.js +2 -1
  45. package/dist/esm-node/commands/dev.js +3 -2
  46. package/dist/esm-node/commands/inspect.js +2 -1
  47. package/dist/esm-node/commands/serve.js +2 -2
  48. package/dist/esm-node/index.js +6 -4
  49. package/dist/esm-node/initialize/index.js +70 -72
  50. package/dist/types/analyze/getClientRoutes/getRoutes.d.ts +2 -2
  51. package/dist/types/analyze/nestedRoutes.d.ts +2 -2
  52. package/dist/types/analyze/templates.d.ts +3 -3
  53. package/dist/types/commands/dev.d.ts +4 -1
  54. package/dist/types/index.d.ts +1 -0
  55. package/dist/types/types/hooks.d.ts +2 -2
  56. package/package.json +24 -24
@@ -47,12 +47,13 @@ export const builderPluginAdapterSSR = (options) => ({
47
47
  }
48
48
  });
49
49
  const isStreamingSSR = (userConfig) => {
50
+ var _server;
50
51
  const isStreaming = (ssr) => ssr && typeof ssr === "object" && ssr.mode === "stream";
51
52
  const { server } = userConfig;
52
53
  if (isStreaming(server.ssr)) {
53
54
  return true;
54
55
  }
55
- if ((server === null || server === void 0 ? void 0 : server.ssrByEntries) && typeof server.ssrByEntries === "object") {
56
+ if (((_server = server) === null || _server === void 0 ? void 0 : _server.ssrByEntries) && typeof server.ssrByEntries === "object") {
56
57
  for (const name of Object.keys(server.ssrByEntries)) {
57
58
  if (isStreaming(server.ssrByEntries[name])) {
58
59
  return true;
@@ -69,33 +70,33 @@ function applyAsyncChunkHtmlPlugin({ chain, modernConfig, CHAIN_ID, HtmlBundlerP
69
70
  }
70
71
  }
71
72
  function applyRouterPlugin(chain, options) {
72
- var _normalizedConfig_runtime, _normalizedConfig_deploy_worker;
73
+ var _normalizedConfig_runtime, _normalizedConfig, _routerConfig, _normalizedConfig_deploy_worker;
73
74
  const { appContext, normalizedConfig } = options;
74
75
  const { entrypoints } = appContext;
75
76
  const existNestedRoutes = entrypoints.some((entrypoint) => entrypoint.nestedRoutesEntry);
76
- const routerConfig = normalizedConfig === null || normalizedConfig === void 0 ? void 0 : (_normalizedConfig_runtime = normalizedConfig.runtime) === null || _normalizedConfig_runtime === void 0 ? void 0 : _normalizedConfig_runtime.router;
77
- const routerManifest = Boolean(routerConfig === null || routerConfig === void 0 ? void 0 : routerConfig.manifest);
77
+ const routerConfig = (_normalizedConfig = normalizedConfig) === null || _normalizedConfig === void 0 ? void 0 : (_normalizedConfig_runtime = _normalizedConfig.runtime) === null || _normalizedConfig_runtime === void 0 ? void 0 : _normalizedConfig_runtime.router;
78
+ const routerManifest = Boolean((_routerConfig = routerConfig) === null || _routerConfig === void 0 ? void 0 : _routerConfig.manifest);
78
79
  const workerSSR = Boolean((_normalizedConfig_deploy_worker = normalizedConfig.deploy.worker) === null || _normalizedConfig_deploy_worker === void 0 ? void 0 : _normalizedConfig_deploy_worker.ssr);
79
80
  if (existNestedRoutes || routerManifest || workerSSR) {
80
81
  chain.plugin("route-plugin").use(RouterPlugin);
81
82
  }
82
83
  }
83
84
  function applyFilterEntriesBySSRConfig({ isProd, chain, appNormalizedConfig }) {
84
- var _ref;
85
+ var _outputConfig, _this, _outputConfig1, _outputConfig2, _outputConfig3;
85
86
  const { server: serverConfig, output: outputConfig } = appNormalizedConfig;
86
87
  const entries = chain.entryPoints.entries();
87
- if (isProd && ((outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg) === true || typeof ((_ref = outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg) === null || _ref === void 0 ? void 0 : _ref[0]) === "function")) {
88
+ if (isProd && (((_outputConfig = outputConfig) === null || _outputConfig === void 0 ? void 0 : _outputConfig.ssg) === true || typeof ((_this = (_outputConfig1 = outputConfig) === null || _outputConfig1 === void 0 ? void 0 : _outputConfig1.ssg) === null || _this === void 0 ? void 0 : _this[0]) === "function")) {
88
89
  return;
89
90
  }
90
91
  if (typeof entries === "undefined") {
91
92
  throw new Error("No entry found, one of src/routes/layout.tsx, src/App.tsx, src/index.tsx is required");
92
93
  }
93
94
  const entryNames = Object.keys(entries);
94
- if (isProd && entryNames.length === 1 && (outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg)) {
95
+ if (isProd && entryNames.length === 1 && ((_outputConfig2 = outputConfig) === null || _outputConfig2 === void 0 ? void 0 : _outputConfig2.ssg)) {
95
96
  return;
96
97
  }
97
98
  const ssgEntries = [];
98
- if (isProd && (outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg)) {
99
+ if (isProd && ((_outputConfig3 = outputConfig) === null || _outputConfig3 === void 0 ? void 0 : _outputConfig3.ssg)) {
99
100
  const { ssg } = outputConfig;
100
101
  entryNames.forEach((name) => {
101
102
  if (ssg[name]) {
@@ -105,7 +106,8 @@ function applyFilterEntriesBySSRConfig({ isProd, chain, appNormalizedConfig }) {
105
106
  }
106
107
  const { ssr, ssrByEntries } = serverConfig || {};
107
108
  entryNames.forEach((name) => {
108
- if (!ssgEntries.includes(name) && (ssr && (ssrByEntries === null || ssrByEntries === void 0 ? void 0 : ssrByEntries[name]) === false || !ssr && !(ssrByEntries === null || ssrByEntries === void 0 ? void 0 : ssrByEntries[name]))) {
109
+ var _ssrByEntries, _ssrByEntries1;
110
+ if (!ssgEntries.includes(name) && (ssr && ((_ssrByEntries = ssrByEntries) === null || _ssrByEntries === void 0 ? void 0 : _ssrByEntries[name]) === false || !ssr && !((_ssrByEntries1 = ssrByEntries) === null || _ssrByEntries1 === void 0 ? void 0 : _ssrByEntries1[name]))) {
109
111
  chain.entryPoints.delete(name);
110
112
  }
111
113
  });
@@ -3,7 +3,8 @@ import { logger } from "@modern-js/utils";
3
3
  import { generateRoutes } from "../utils/routes";
4
4
  import { buildServerConfig } from "../utils/config";
5
5
  export const build = async (api, options) => {
6
- if (options === null || options === void 0 ? void 0 : options.analyze) {
6
+ var _options;
7
+ if ((_options = options) === null || _options === void 0 ? void 0 : _options.analyze) {
7
8
  process.env.BUNDLE_ANALYZE = "true";
8
9
  }
9
10
  let resolvedConfig = api.useResolvedConfigContext();
@@ -5,7 +5,7 @@ import { setServer, createServer, injectDataLoaderPlugin } from "../utils/create
5
5
  import { generateRoutes } from "../utils/routes";
6
6
  import { buildServerConfig } from "../utils/config";
7
7
  import { getServerInternalPlugins } from "../utils/getServerInternalPlugins";
8
- export const dev = async (api, options) => {
8
+ export const dev = async (api, options, devServerOptions = {}) => {
9
9
  var _normalizedConfig_tools;
10
10
  if (options.analyze) {
11
11
  process.env.BUNDLE_ANALYZE = "true";
@@ -48,7 +48,8 @@ export const dev = async (api, options) => {
48
48
  pwd: appDirectory,
49
49
  config: normalizedConfig,
50
50
  serverConfigFile,
51
- internalPlugins: injectDataLoaderPlugin(serverInternalPlugins)
51
+ internalPlugins: injectDataLoaderPlugin(serverInternalPlugins),
52
+ ...devServerOptions
52
53
  };
53
54
  if (apiOnly) {
54
55
  var _normalizedConfig_dev;
@@ -1,5 +1,6 @@
1
1
  import { join } from "path";
2
2
  export const inspect = async (api, options) => {
3
+ var _appContext;
3
4
  const appContext = api.useAppContext();
4
5
  if (!appContext.builder) {
5
6
  throw new Error("Expect the Builder to have been initialized, But the appContext.builder received `undefined`");
@@ -7,7 +8,7 @@ export const inspect = async (api, options) => {
7
8
  return appContext.builder.inspectConfig({
8
9
  env: options.env,
9
10
  verbose: options.verbose,
10
- outputPath: join(appContext === null || appContext === void 0 ? void 0 : appContext.builder.context.distPath, options.output),
11
+ outputPath: join((_appContext = appContext) === null || _appContext === void 0 ? void 0 : _appContext.builder.context.distPath, options.output),
11
12
  writeToDisk: true
12
13
  });
13
14
  };
@@ -4,13 +4,13 @@ import { printInstructions } from "../utils/printInstructions";
4
4
  import { injectDataLoaderPlugin } from "../utils/createServer";
5
5
  import { getServerInternalPlugins } from "../utils/getServerInternalPlugins";
6
6
  export const start = async (api) => {
7
- var _userConfig_source, _userConfig_output_distPath;
7
+ var _userConfig_source, _userConfig, _userConfig_output_distPath;
8
8
  const appContext = api.useAppContext();
9
9
  const userConfig = api.useResolvedConfigContext();
10
10
  const hookRunners = api.useHookRunners();
11
11
  const { appDirectory, port, serverConfigFile, metaName } = appContext;
12
12
  logger.log(chalk.cyan(`Starting the modern server...`));
13
- const apiOnly = await isApiOnly(appContext.appDirectory, userConfig === null || userConfig === void 0 ? void 0 : (_userConfig_source = userConfig.source) === null || _userConfig_source === void 0 ? void 0 : _userConfig_source.entriesDir, appContext.apiDirectory);
13
+ const apiOnly = await isApiOnly(appContext.appDirectory, (_userConfig = userConfig) === null || _userConfig === void 0 ? void 0 : (_userConfig_source = _userConfig.source) === null || _userConfig_source === void 0 ? void 0 : _userConfig_source.entriesDir, appContext.apiDirectory);
14
14
  const serverInternalPlugins = await getServerInternalPlugins(api);
15
15
  const app = await server({
16
16
  pwd: appDirectory,
@@ -10,14 +10,15 @@ import { i18n, localeKeys } from "./locale";
10
10
  import { restart } from "./utils/restart";
11
11
  import { generateWatchFiles } from "./utils/generateWatchFiles";
12
12
  export { mergeConfig } from "@modern-js/core";
13
+ export { dev } from "./commands";
13
14
  export * from "./defineConfig";
14
15
  export * from "./types";
15
16
  export const devCommand = async (program, api) => {
16
17
  const runner = api.useHookRunners();
17
18
  const devToolMetas = await runner.registerDev();
18
19
  const devProgram = program.command("dev").alias("start").usage("[options]").description(i18n.t(localeKeys.command.dev.describe)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).option("-e --entry [entry...]", i18n.t(localeKeys.command.dev.entry)).option("--analyze", i18n.t(localeKeys.command.shared.analyze)).option("--api-only", i18n.t(localeKeys.command.dev.apiOnly)).option("--web-only", i18n.t(localeKeys.command.dev.webOnly)).action(async (options) => {
19
- const { dev } = await import("./commands/dev");
20
- await dev(api, options);
20
+ const { dev: dev2 } = await import("./commands/dev");
21
+ await dev2(api, options);
21
22
  });
22
23
  for (const meta of devToolMetas) {
23
24
  if (!meta.subCommands) {
@@ -59,6 +60,7 @@ export const buildCommand = async (program, api) => {
59
60
  export const appTools = (options = {
60
61
  bundler: "webpack"
61
62
  }) => {
63
+ var _options, _options1;
62
64
  return {
63
65
  name: "@modern-js/app-tools",
64
66
  post: [
@@ -74,10 +76,10 @@ export const appTools = (options = {
74
76
  registerHook: hooks,
75
77
  usePlugins: [
76
78
  initializePlugin({
77
- bundler: (options === null || options === void 0 ? void 0 : options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
79
+ bundler: ((_options = options) === null || _options === void 0 ? void 0 : _options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
78
80
  }),
79
81
  analyzePlugin({
80
- bundler: (options === null || options === void 0 ? void 0 : options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
82
+ bundler: ((_options1 = options) === null || _options1 === void 0 ? void 0 : _options1.bundler) === "experimental-rspack" ? "rspack" : "webpack"
81
83
  }),
82
84
  lintPlugin()
83
85
  ],
@@ -1,81 +1,79 @@
1
1
  import { ensureAbsolutePath, getPort, isDev, isDevCommand } from "@modern-js/utils";
2
2
  import { legacySchema, schema } from "../schema";
3
3
  import { checkIsLegacyConfig, createDefaultConfig, createLegacyDefaultConfig, transformNormalizedConfig } from "../config";
4
- export default ({ bundler }) => {
5
- return {
6
- name: "@modern-js/plugin-initialize",
7
- post: [
8
- "@modern-js/plugin-ssr",
9
- "@modern-js/plugin-document",
10
- "@modern-js/plugin-state",
11
- "@modern-js/plugin-router",
12
- "@modern-js/plugin-router-v5",
13
- "@modern-js/plugin-polyfill"
14
- ],
15
- setup(api) {
16
- const config = () => {
17
- const appContext = api.useAppContext();
4
+ export default ({ bundler }) => ({
5
+ name: "@modern-js/plugin-initialize",
6
+ post: [
7
+ "@modern-js/plugin-ssr",
8
+ "@modern-js/plugin-document",
9
+ "@modern-js/plugin-state",
10
+ "@modern-js/plugin-router",
11
+ "@modern-js/plugin-router-v5",
12
+ "@modern-js/plugin-polyfill"
13
+ ],
14
+ setup(api) {
15
+ const config = () => {
16
+ const appContext = api.useAppContext();
17
+ const userConfig = api.useConfigContext();
18
+ api.setAppContext({
19
+ ...appContext,
20
+ bundlerType: bundler
21
+ });
22
+ return checkIsLegacyConfig(userConfig) ? createLegacyDefaultConfig(appContext) : createDefaultConfig(appContext, bundler);
23
+ };
24
+ const validateSchema = () => {
25
+ const userConfig = api.useConfigContext();
26
+ const schemas = checkIsLegacyConfig(userConfig) ? legacySchema : schema;
27
+ return schemas.generate();
28
+ };
29
+ return {
30
+ config,
31
+ validateSchema,
32
+ async resolvedConfig({ resolved }) {
33
+ var _resolved_output_distPath;
34
+ let appContext = api.useAppContext();
18
35
  const userConfig = api.useConfigContext();
19
- api.setAppContext({
36
+ const port = await getServerPort(resolved);
37
+ appContext = {
20
38
  ...appContext,
21
- bundlerType: bundler
22
- });
23
- return checkIsLegacyConfig(userConfig) ? createLegacyDefaultConfig(appContext) : createDefaultConfig(appContext, bundler);
24
- };
25
- const validateSchema = () => {
26
- const userConfig = api.useConfigContext();
27
- const schemas = checkIsLegacyConfig(userConfig) ? legacySchema : schema;
28
- return schemas.generate();
29
- };
30
- return {
31
- config,
32
- validateSchema,
33
- async resolvedConfig({ resolved }) {
34
- var _resolved_output_distPath;
35
- let appContext = api.useAppContext();
36
- const userConfig = api.useConfigContext();
37
- const port = await getServerPort(resolved);
38
- appContext = {
39
- ...appContext,
40
- port,
41
- distDirectory: ensureAbsolutePath(appContext.distDirectory, ((_resolved_output_distPath = resolved.output.distPath) === null || _resolved_output_distPath === void 0 ? void 0 : _resolved_output_distPath.root) || "dist")
42
- };
43
- api.setAppContext(appContext);
44
- const normalizedConfig = checkIsLegacyConfig(resolved) ? transformNormalizedConfig(resolved) : resolved;
45
- resolved._raw = userConfig;
46
- resolved.server = {
47
- ...normalizedConfig.server || {},
48
- port
49
- };
50
- var _normalizedConfig_autoLoadPlugins;
51
- resolved.autoLoadPlugins = (_normalizedConfig_autoLoadPlugins = normalizedConfig.autoLoadPlugins) !== null && _normalizedConfig_autoLoadPlugins !== void 0 ? _normalizedConfig_autoLoadPlugins : false;
52
- stabilizeConfig(resolved, normalizedConfig, [
53
- "source",
54
- "bff",
55
- "dev",
56
- "html",
57
- "output",
58
- "tools",
59
- "testing",
60
- "plugins",
61
- "builderPlugins",
62
- "runtime",
63
- "runtimeByEntries",
64
- "deploy",
65
- "performance"
66
- ]);
67
- if (bundler === "webpack") {
68
- resolved.security = normalizedConfig.security || {};
69
- resolved.experiments = normalizedConfig.experiments;
70
- }
71
- return {
72
- resolved
73
- };
39
+ port,
40
+ distDirectory: ensureAbsolutePath(appContext.distDirectory, ((_resolved_output_distPath = resolved.output.distPath) === null || _resolved_output_distPath === void 0 ? void 0 : _resolved_output_distPath.root) || "dist")
41
+ };
42
+ api.setAppContext(appContext);
43
+ const normalizedConfig = checkIsLegacyConfig(resolved) ? transformNormalizedConfig(resolved) : resolved;
44
+ resolved._raw = userConfig;
45
+ resolved.server = {
46
+ ...normalizedConfig.server || {},
47
+ port
48
+ };
49
+ var _normalizedConfig_autoLoadPlugins;
50
+ resolved.autoLoadPlugins = (_normalizedConfig_autoLoadPlugins = normalizedConfig.autoLoadPlugins) !== null && _normalizedConfig_autoLoadPlugins !== void 0 ? _normalizedConfig_autoLoadPlugins : false;
51
+ stabilizeConfig(resolved, normalizedConfig, [
52
+ "source",
53
+ "bff",
54
+ "dev",
55
+ "html",
56
+ "output",
57
+ "tools",
58
+ "testing",
59
+ "plugins",
60
+ "builderPlugins",
61
+ "runtime",
62
+ "runtimeByEntries",
63
+ "deploy",
64
+ "performance"
65
+ ]);
66
+ if (bundler === "webpack") {
67
+ resolved.security = normalizedConfig.security || {};
68
+ resolved.experiments = normalizedConfig.experiments;
74
69
  }
75
- };
76
- }
77
- };
78
- };
70
+ return {
71
+ resolved
72
+ };
73
+ }
74
+ };
75
+ }
76
+ });
79
77
  function stabilizeConfig(resolve, config, keys) {
80
78
  keys.forEach((key) => {
81
79
  resolve[key] = config[key] || {};
@@ -1,4 +1,4 @@
1
- import type { Entrypoint, NestedRoute, PageRoute } from '@modern-js/types';
1
+ import type { Entrypoint, NestedRouteForCli, PageRoute } from '@modern-js/types';
2
2
  export declare const getClientRoutes: ({
3
3
  entrypoint,
4
4
  srcDirectory,
@@ -11,4 +11,4 @@ export declare const getClientRoutes: ({
11
11
  srcAlias: string;
12
12
  internalDirectory: string;
13
13
  internalDirAlias: string;
14
- }) => (NestedRoute | PageRoute)[];
14
+ }) => (NestedRouteForCli | PageRoute)[];
@@ -1,6 +1,6 @@
1
- import type { NestedRoute } from '@modern-js/types';
1
+ import type { NestedRouteForCli } from '@modern-js/types';
2
2
  export declare const getRouteId: (componentPath: string, routesDir: string, entryName: string, isMainEntry: boolean) => string;
3
3
  export declare const walk: (dirname: string, rootDir: string, alias: {
4
4
  name: string;
5
5
  basename: string;
6
- }, entryName: string, isMainEntry: boolean) => Promise<NestedRoute | null>;
6
+ }, entryName: string, isMainEntry: boolean) => Promise<NestedRouteForCli | null>;
@@ -1,4 +1,4 @@
1
- import type { Entrypoint, NestedRoute, PageRoute, RouteLegacy, SSRMode } from '@modern-js/types';
1
+ import type { Entrypoint, NestedRouteForCli, PageRoute, RouteLegacy, SSRMode } from '@modern-js/types';
2
2
  import type { AppNormalizedConfig, IAppContext, RuntimePlugin } from '../types';
3
3
  export declare const index: ({
4
4
  mountId,
@@ -28,7 +28,7 @@ export declare const html: (partials: {
28
28
  export declare const routesForServer: ({
29
29
  routes
30
30
  }: {
31
- routes: (NestedRoute | PageRoute)[];
31
+ routes: (NestedRouteForCli | PageRoute)[];
32
32
  }) => string;
33
33
  export declare const fileSystemRoutes: ({
34
34
  routes,
@@ -38,7 +38,7 @@ export declare const fileSystemRoutes: ({
38
38
  internalDirectory,
39
39
  splitRouteChunks
40
40
  }: {
41
- routes: RouteLegacy[] | (NestedRoute | PageRoute)[];
41
+ routes: RouteLegacy[] | (NestedRouteForCli | PageRoute)[];
42
42
  ssrMode?: SSRMode | undefined;
43
43
  nestedRoutesEntry?: string | undefined;
44
44
  entryName: string;
@@ -1,4 +1,7 @@
1
1
  import { PluginAPI } from '@modern-js/core';
2
2
  import { DevOptions } from '../utils/types';
3
3
  import type { AppTools } from '../types';
4
- export declare const dev: (api: PluginAPI<AppTools<'shared'>>, options: DevOptions) => Promise<void>;
4
+ export interface ExtraServerOptions {
5
+ useSSRWorker?: boolean;
6
+ }
7
+ export declare const dev: (api: PluginAPI<AppTools<'shared'>>, options: DevOptions, devServerOptions?: ExtraServerOptions) => Promise<void>;
@@ -2,6 +2,7 @@ import { Command } from '@modern-js/utils';
2
2
  import { CliPlugin, PluginAPI } from '@modern-js/core';
3
3
  import { AppTools } from './types';
4
4
  export { mergeConfig } from '@modern-js/core';
5
+ export { dev } from './commands';
5
6
  export * from './defineConfig';
6
7
  export * from './types';
7
8
  export type { RuntimeUserConfig } from './types/config';
@@ -1,6 +1,6 @@
1
1
  import type { webpack } from '@modern-js/builder-webpack-provider';
2
2
  import type { AsyncWaterfall, AsyncWorkflow, ParallelWorkflow } from '@modern-js/plugin';
3
- import type { Entrypoint, HtmlPartials, NestedRoute, PageRoute, RouteLegacy, ServerRoute } from '@modern-js/types';
3
+ import type { Entrypoint, HtmlPartials, NestedRouteForCli, PageRoute, RouteLegacy, ServerRoute } from '@modern-js/types';
4
4
  import type { RegisterBuildPlatformResult, DevToolData } from '@modern-js/core';
5
5
  import type { Stats, MultiStats } from '@modern-js/builder-shared';
6
6
  import type { Rspack } from '@modern-js/builder-rspack-provider';
@@ -43,7 +43,7 @@ export type AppToolsHooks<B extends Bundler = 'webpack'> = {
43
43
  }>;
44
44
  modifyFileSystemRoutes: AsyncWaterfall<{
45
45
  entrypoint: Entrypoint;
46
- routes: RouteLegacy[] | (NestedRoute | PageRoute)[];
46
+ routes: RouteLegacy[] | (NestedRouteForCli | PageRoute)[];
47
47
  }>;
48
48
  modifyServerRoutes: AsyncWaterfall<{
49
49
  routes: ServerRoute[];
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.27.0",
18
+ "version": "2.28.0",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -73,24 +73,24 @@
73
73
  "esbuild": "0.17.19",
74
74
  "rspack-plugin-virtual-module": "0.1.0",
75
75
  "@swc/helpers": "0.5.1",
76
- "@modern-js/builder": "2.27.0",
77
- "@modern-js/builder-plugin-esbuild": "2.27.0",
78
- "@modern-js/builder-plugin-node-polyfill": "2.27.0",
79
- "@modern-js/builder-shared": "2.27.0",
80
- "@modern-js/builder-webpack-provider": "2.27.0",
81
- "@modern-js/core": "2.27.0",
82
- "@modern-js/new-action": "2.27.0",
83
- "@modern-js/node-bundle-require": "2.27.0",
84
- "@modern-js/plugin": "2.27.0",
85
- "@modern-js/plugin-data-loader": "2.27.0",
86
- "@modern-js/plugin-i18n": "2.27.0",
87
- "@modern-js/plugin-lint": "2.27.0",
88
- "@modern-js/prod-server": "2.27.0",
89
- "@modern-js/server": "2.27.0",
90
- "@modern-js/types": "2.27.0",
91
- "@modern-js/upgrade": "2.27.0",
92
- "@modern-js/utils": "2.27.0",
93
- "@modern-js/server-core": "2.27.0"
76
+ "@modern-js/builder": "2.28.0",
77
+ "@modern-js/builder-plugin-esbuild": "2.28.0",
78
+ "@modern-js/builder-plugin-node-polyfill": "2.28.0",
79
+ "@modern-js/builder-shared": "2.28.0",
80
+ "@modern-js/builder-webpack-provider": "2.28.0",
81
+ "@modern-js/core": "2.28.0",
82
+ "@modern-js/new-action": "2.28.0",
83
+ "@modern-js/node-bundle-require": "2.28.0",
84
+ "@modern-js/plugin": "2.28.0",
85
+ "@modern-js/plugin-data-loader": "2.28.0",
86
+ "@modern-js/plugin-i18n": "2.28.0",
87
+ "@modern-js/plugin-lint": "2.28.0",
88
+ "@modern-js/prod-server": "2.28.0",
89
+ "@modern-js/server": "2.28.0",
90
+ "@modern-js/types": "2.28.0",
91
+ "@modern-js/upgrade": "2.28.0",
92
+ "@modern-js/utils": "2.28.0",
93
+ "@modern-js/server-core": "2.28.0"
94
94
  },
95
95
  "devDependencies": {
96
96
  "@types/babel__traverse": "^7.14.2",
@@ -99,13 +99,13 @@
99
99
  "jest": "^29",
100
100
  "typescript": "^5",
101
101
  "webpack": "^5.88.1",
102
- "@modern-js/builder-plugin-swc": "2.27.0",
103
- "@modern-js/builder-rspack-provider": "2.27.0",
104
- "@scripts/build": "2.27.0",
105
- "@scripts/jest-config": "2.27.0"
102
+ "@modern-js/builder-plugin-swc": "2.28.0",
103
+ "@modern-js/builder-rspack-provider": "2.28.0",
104
+ "@scripts/build": "2.28.0",
105
+ "@scripts/jest-config": "2.28.0"
106
106
  },
107
107
  "peerDependencies": {
108
- "@modern-js/builder-rspack-provider": "^2.27.0"
108
+ "@modern-js/builder-rspack-provider": "^2.28.0"
109
109
  },
110
110
  "peerDependenciesMeta": {
111
111
  "@modern-js/builder-rspack-provider": {