@modern-js/app-tools 2.53.1-alpha.3 → 2.54.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 (214) hide show
  1. package/bin/modern.js +0 -2
  2. package/dist/cjs/builder/shared/builderPlugins/adapterHtml.js +2 -1
  3. package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +2 -2
  4. package/dist/cjs/commands/build.js +2 -0
  5. package/dist/cjs/commands/deploy.js +2 -2
  6. package/dist/cjs/commands/dev.js +19 -5
  7. package/dist/cjs/commands/index.js +113 -7
  8. package/dist/cjs/commands/serve.js +19 -5
  9. package/dist/cjs/hooks.js +5 -0
  10. package/dist/cjs/index.js +14 -83
  11. package/dist/cjs/plugins/analyze/constants.js +56 -0
  12. package/dist/cjs/{analyze → plugins/analyze}/generateCode.js +11 -84
  13. package/dist/cjs/{analyze → plugins/analyze}/getBundleEntry.js +11 -20
  14. package/dist/cjs/{analyze → plugins/analyze}/getFileSystemEntry.js +33 -47
  15. package/dist/cjs/{analyze → plugins/analyze}/getServerRoutes.js +1 -1
  16. package/dist/cjs/{analyze → plugins/analyze}/index.js +9 -24
  17. package/dist/cjs/plugins/analyze/templates.js +101 -0
  18. package/dist/cjs/{analyze → plugins/analyze}/utils.js +12 -55
  19. package/dist/cjs/plugins/deploy/dependencies/index.js +16 -25
  20. package/dist/cjs/plugins/deploy/dependencies/utils.js +1 -2
  21. package/dist/cjs/plugins/deploy/platforms/netlify.js +5 -9
  22. package/dist/cjs/plugins/deploy/platforms/node.js +5 -13
  23. package/dist/cjs/plugins/deploy/platforms/vercel.js +5 -9
  24. package/dist/cjs/{initialize → plugins/initialize}/index.js +1 -1
  25. package/dist/cjs/plugins/serverBuild.js +10 -4
  26. package/dist/cjs/utils/createServer.js +1 -1
  27. package/dist/cjs/utils/{getServerInternalPlugins.js → loadPlugins.js} +18 -11
  28. package/dist/esm/builder/shared/builderPlugins/adapterHtml.js +4 -1
  29. package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +2 -2
  30. package/dist/esm/commands/build.js +16 -9
  31. package/dist/esm/commands/deploy.js +2 -2
  32. package/dist/esm/commands/dev.js +13 -9
  33. package/dist/esm/commands/index.js +411 -3
  34. package/dist/esm/commands/serve.js +12 -8
  35. package/dist/esm/hooks.js +5 -0
  36. package/dist/esm/index.js +12 -394
  37. package/dist/esm/plugins/analyze/constants.js +24 -0
  38. package/dist/esm/{analyze → plugins/analyze}/generateCode.js +27 -169
  39. package/dist/esm/plugins/analyze/getBundleEntry.js +101 -0
  40. package/dist/esm/plugins/analyze/getFileSystemEntry.js +195 -0
  41. package/dist/esm/{analyze → plugins/analyze}/getServerRoutes.js +1 -1
  42. package/dist/esm/{analyze → plugins/analyze}/index.js +42 -70
  43. package/dist/esm/plugins/analyze/templates.js +22 -0
  44. package/dist/esm/{analyze → plugins/analyze}/utils.js +13 -135
  45. package/dist/esm/plugins/deploy/dependencies/index.js +69 -94
  46. package/dist/esm/plugins/deploy/dependencies/utils.js +3 -4
  47. package/dist/esm/plugins/deploy/platforms/netlify.js +8 -10
  48. package/dist/esm/plugins/deploy/platforms/node.js +8 -14
  49. package/dist/esm/plugins/deploy/platforms/vercel.js +8 -10
  50. package/dist/esm/{initialize → plugins/initialize}/index.js +1 -1
  51. package/dist/esm/plugins/serverBuild.js +13 -6
  52. package/dist/esm/utils/createServer.js +2 -2
  53. package/dist/esm/utils/loadPlugins.js +64 -0
  54. package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.js +2 -1
  55. package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +2 -2
  56. package/dist/esm-node/commands/build.js +2 -0
  57. package/dist/esm-node/commands/deploy.js +2 -2
  58. package/dist/esm-node/commands/dev.js +11 -7
  59. package/dist/esm-node/commands/index.js +92 -3
  60. package/dist/esm-node/commands/serve.js +10 -6
  61. package/dist/esm-node/hooks.js +5 -0
  62. package/dist/esm-node/index.js +12 -79
  63. package/dist/esm-node/plugins/analyze/constants.js +24 -0
  64. package/dist/esm-node/{analyze → plugins/analyze}/generateCode.js +14 -87
  65. package/dist/esm-node/{analyze → plugins/analyze}/getBundleEntry.js +11 -20
  66. package/dist/esm-node/plugins/analyze/getFileSystemEntry.js +75 -0
  67. package/dist/esm-node/{analyze → plugins/analyze}/getServerRoutes.js +1 -1
  68. package/dist/esm-node/{analyze → plugins/analyze}/index.js +10 -25
  69. package/dist/esm-node/plugins/analyze/templates.js +75 -0
  70. package/dist/esm-node/{analyze → plugins/analyze}/utils.js +13 -52
  71. package/dist/esm-node/plugins/deploy/dependencies/index.js +18 -27
  72. package/dist/esm-node/plugins/deploy/dependencies/utils.js +1 -2
  73. package/dist/esm-node/plugins/deploy/platforms/netlify.js +6 -10
  74. package/dist/esm-node/plugins/deploy/platforms/node.js +6 -14
  75. package/dist/esm-node/plugins/deploy/platforms/vercel.js +6 -10
  76. package/dist/esm-node/{initialize → plugins/initialize}/index.js +1 -1
  77. package/dist/esm-node/plugins/serverBuild.js +11 -5
  78. package/dist/esm-node/utils/createServer.js +2 -2
  79. package/dist/esm-node/utils/loadPlugins.js +21 -0
  80. package/dist/types/builder/builder-webpack/createCopyPattern.d.ts +2 -2
  81. package/dist/types/commands/index.d.ts +10 -3
  82. package/dist/types/config/initialize/inits.d.ts +1 -1
  83. package/dist/types/exports/server.d.ts +4 -0
  84. package/dist/types/index.d.ts +2 -5
  85. package/dist/types/plugins/analyze/constants.d.ts +9 -0
  86. package/dist/types/{analyze → plugins/analyze}/generateCode.d.ts +1 -1
  87. package/dist/types/plugins/analyze/getBundleEntry.d.ts +4 -0
  88. package/dist/types/plugins/analyze/getFileSystemEntry.d.ts +5 -0
  89. package/dist/types/{analyze → plugins/analyze}/getHtmlTemplate.d.ts +1 -1
  90. package/dist/types/{analyze → plugins/analyze}/getServerRoutes.d.ts +1 -1
  91. package/dist/types/{analyze → plugins/analyze}/index.d.ts +1 -1
  92. package/dist/types/plugins/analyze/templates.d.ts +19 -0
  93. package/dist/types/{analyze → plugins/analyze}/utils.d.ts +4 -6
  94. package/dist/types/plugins/deploy/dependencies/index.d.ts +1 -9
  95. package/dist/types/plugins/deploy/dependencies/utils.d.ts +1 -7
  96. package/dist/types/{initialize → plugins/initialize}/index.d.ts +1 -1
  97. package/dist/types/types/hooks.d.ts +11 -1
  98. package/dist/types/utils/loadPlugins.d.ts +5 -0
  99. package/package.json +22 -30
  100. package/dist/cjs/analyze/constants.js +0 -122
  101. package/dist/cjs/analyze/getClientRoutes/getRoutes.js +0 -197
  102. package/dist/cjs/analyze/getClientRoutes/getRoutesLegacy.js +0 -195
  103. package/dist/cjs/analyze/getClientRoutes/index.js +0 -31
  104. package/dist/cjs/analyze/getClientRoutes/utils.js +0 -59
  105. package/dist/cjs/analyze/makeLegalIdentifier.js +0 -37
  106. package/dist/cjs/analyze/nestedRoutes.js +0 -295
  107. package/dist/cjs/analyze/templates.js +0 -444
  108. package/dist/cjs/plugins/deploy/exports.js +0 -28
  109. package/dist/esm/analyze/constants.js +0 -76
  110. package/dist/esm/analyze/getBundleEntry.js +0 -75
  111. package/dist/esm/analyze/getClientRoutes/getRoutes.js +0 -185
  112. package/dist/esm/analyze/getClientRoutes/getRoutesLegacy.js +0 -183
  113. package/dist/esm/analyze/getClientRoutes/index.js +0 -6
  114. package/dist/esm/analyze/getClientRoutes/utils.js +0 -28
  115. package/dist/esm/analyze/getFileSystemEntry.js +0 -113
  116. package/dist/esm/analyze/makeLegalIdentifier.js +0 -15
  117. package/dist/esm/analyze/nestedRoutes.js +0 -398
  118. package/dist/esm/analyze/templates.js +0 -435
  119. package/dist/esm/plugins/deploy/exports.js +0 -4
  120. package/dist/esm/utils/getServerInternalPlugins.js +0 -40
  121. package/dist/esm-node/analyze/constants.js +0 -76
  122. package/dist/esm-node/analyze/getClientRoutes/getRoutes.js +0 -163
  123. package/dist/esm-node/analyze/getClientRoutes/getRoutesLegacy.js +0 -161
  124. package/dist/esm-node/analyze/getClientRoutes/index.js +0 -6
  125. package/dist/esm-node/analyze/getClientRoutes/utils.js +0 -22
  126. package/dist/esm-node/analyze/getFileSystemEntry.js +0 -89
  127. package/dist/esm-node/analyze/makeLegalIdentifier.js +0 -13
  128. package/dist/esm-node/analyze/nestedRoutes.js +0 -259
  129. package/dist/esm-node/analyze/templates.js +0 -405
  130. package/dist/esm-node/plugins/deploy/exports.js +0 -4
  131. package/dist/esm-node/utils/getServerInternalPlugins.js +0 -15
  132. package/dist/js/modern/analyze/constants.js +0 -15
  133. package/dist/js/modern/analyze/generateCode.js +0 -179
  134. package/dist/js/modern/analyze/getBundleEntry.js +0 -75
  135. package/dist/js/modern/analyze/getClientRoutes.js +0 -219
  136. package/dist/js/modern/analyze/getFileSystemEntry.js +0 -74
  137. package/dist/js/modern/analyze/getHtmlTemplate.js +0 -82
  138. package/dist/js/modern/analyze/getServerRoutes.js +0 -192
  139. package/dist/js/modern/analyze/index.js +0 -148
  140. package/dist/js/modern/analyze/isDefaultExportFunction.js +0 -32
  141. package/dist/js/modern/analyze/makeLegalIdentifier.js +0 -16
  142. package/dist/js/modern/analyze/templates.js +0 -88
  143. package/dist/js/modern/analyze/utils.js +0 -92
  144. package/dist/js/modern/commands/build.js +0 -154
  145. package/dist/js/modern/commands/deploy.js +0 -5
  146. package/dist/js/modern/commands/dev.js +0 -95
  147. package/dist/js/modern/commands/index.js +0 -3
  148. package/dist/js/modern/commands/inspect.js +0 -69
  149. package/dist/js/modern/commands/start.js +0 -31
  150. package/dist/js/modern/exports/server.js +0 -1
  151. package/dist/js/modern/hooks.js +0 -21
  152. package/dist/js/modern/index.js +0 -109
  153. package/dist/js/modern/locale/en.js +0 -35
  154. package/dist/js/modern/locale/index.js +0 -9
  155. package/dist/js/modern/locale/zh.js +0 -35
  156. package/dist/js/modern/utils/config.js +0 -78
  157. package/dist/js/modern/utils/createCompiler.js +0 -61
  158. package/dist/js/modern/utils/createServer.js +0 -18
  159. package/dist/js/modern/utils/getSpecifiedEntries.js +0 -36
  160. package/dist/js/modern/utils/language.js +0 -5
  161. package/dist/js/modern/utils/printInstructions.js +0 -11
  162. package/dist/js/modern/utils/routes.js +0 -15
  163. package/dist/js/modern/utils/types.js +0 -0
  164. package/dist/js/node/analyze/constants.js +0 -36
  165. package/dist/js/node/analyze/generateCode.js +0 -208
  166. package/dist/js/node/analyze/getBundleEntry.js +0 -89
  167. package/dist/js/node/analyze/getClientRoutes.js +0 -241
  168. package/dist/js/node/analyze/getFileSystemEntry.js +0 -90
  169. package/dist/js/node/analyze/getHtmlTemplate.js +0 -106
  170. package/dist/js/node/analyze/getServerRoutes.js +0 -208
  171. package/dist/js/node/analyze/index.js +0 -178
  172. package/dist/js/node/analyze/isDefaultExportFunction.js +0 -50
  173. package/dist/js/node/analyze/makeLegalIdentifier.js +0 -24
  174. package/dist/js/node/analyze/templates.js +0 -106
  175. package/dist/js/node/analyze/utils.js +0 -113
  176. package/dist/js/node/commands/build.js +0 -174
  177. package/dist/js/node/commands/deploy.js +0 -14
  178. package/dist/js/node/commands/dev.js +0 -120
  179. package/dist/js/node/commands/index.js +0 -44
  180. package/dist/js/node/commands/inspect.js +0 -98
  181. package/dist/js/node/commands/start.js +0 -47
  182. package/dist/js/node/exports/server.js +0 -13
  183. package/dist/js/node/hooks.js +0 -39
  184. package/dist/js/node/index.js +0 -141
  185. package/dist/js/node/locale/en.js +0 -42
  186. package/dist/js/node/locale/index.js +0 -20
  187. package/dist/js/node/locale/zh.js +0 -42
  188. package/dist/js/node/utils/config.js +0 -103
  189. package/dist/js/node/utils/createCompiler.js +0 -81
  190. package/dist/js/node/utils/createServer.js +0 -35
  191. package/dist/js/node/utils/getSpecifiedEntries.js +0 -46
  192. package/dist/js/node/utils/language.js +0 -13
  193. package/dist/js/node/utils/printInstructions.js +0 -22
  194. package/dist/js/node/utils/routes.js +0 -25
  195. package/dist/js/node/utils/types.js +0 -0
  196. package/dist/types/analyze/constants.d.ts +0 -42
  197. package/dist/types/analyze/getBundleEntry.d.ts +0 -3
  198. package/dist/types/analyze/getClientRoutes/getRoutes.d.ts +0 -8
  199. package/dist/types/analyze/getClientRoutes/getRoutesLegacy.d.ts +0 -9
  200. package/dist/types/analyze/getClientRoutes/index.d.ts +0 -2
  201. package/dist/types/analyze/getClientRoutes/utils.d.ts +0 -5
  202. package/dist/types/analyze/getFileSystemEntry.d.ts +0 -4
  203. package/dist/types/analyze/makeLegalIdentifier.d.ts +0 -1
  204. package/dist/types/analyze/nestedRoutes.d.ts +0 -7
  205. package/dist/types/analyze/templates.d.ts +0 -30
  206. package/dist/types/plugins/deploy/exports.d.ts +0 -1
  207. package/dist/types/utils/getServerInternalPlugins.d.ts +0 -2
  208. /package/dist/cjs/{analyze → plugins/analyze}/getHtmlTemplate.js +0 -0
  209. /package/dist/cjs/{analyze → plugins/analyze}/isDefaultExportFunction.js +0 -0
  210. /package/dist/esm/{analyze → plugins/analyze}/getHtmlTemplate.js +0 -0
  211. /package/dist/esm/{analyze → plugins/analyze}/isDefaultExportFunction.js +0 -0
  212. /package/dist/esm-node/{analyze → plugins/analyze}/getHtmlTemplate.js +0 -0
  213. /package/dist/esm-node/{analyze → plugins/analyze}/isDefaultExportFunction.js +0 -0
  214. /package/dist/types/{analyze → plugins/analyze}/isDefaultExportFunction.d.ts +0 -0
@@ -1,13 +1,12 @@
1
1
  import * as path from "path";
2
2
  import { createDebugger, findExists, fs, isApiOnly, minimist, isDevCommand, getArgv } from "@modern-js/utils";
3
- import { cloneDeep } from "@modern-js/utils/lodash";
4
- import { printInstructions } from "../utils/printInstructions";
5
- import { generateRoutes, getPathWithoutExt } from "../utils/routes";
6
- import { emitResolvedConfig } from "../utils/config";
7
- import { getSelectedEntries } from "../utils/getSelectedEntries";
8
- import { initialNormalizedConfig } from "../config";
9
- import { createBuilderGenerator } from "../builder";
10
- import { checkIsBuildCommands, isPageComponentFile, parseModule, replaceWithAlias } from "./utils";
3
+ import { printInstructions } from "../../utils/printInstructions";
4
+ import { generateRoutes, getPathWithoutExt } from "../../utils/routes";
5
+ import { emitResolvedConfig } from "../../utils/config";
6
+ import { getSelectedEntries } from "../../utils/getSelectedEntries";
7
+ import { initialNormalizedConfig } from "../../config";
8
+ import { createBuilderGenerator } from "../../builder";
9
+ import { checkIsBuildCommands, parseModule, replaceWithAlias } from "./utils";
11
10
  import { APP_CONFIG_NAME, APP_INIT_EXPORTED, APP_INIT_IMPORTED } from "./constants";
12
11
  import { generateIndexCode } from "./generateCode";
13
12
  const debug = createDebugger("plugin-analyze");
@@ -16,7 +15,6 @@ var analyze_default = ({ bundler }) => ({
16
15
  setup: (api) => {
17
16
  let pagesDir = [];
18
17
  let nestedRouteEntries = [];
19
- let originEntrypoints = [];
20
18
  return {
21
19
  async prepare() {
22
20
  var _resolvedConfig_source;
@@ -50,7 +48,9 @@ var analyze_default = ({ bundler }) => ({
50
48
  import("./generateCode"),
51
49
  import("./getHtmlTemplate")
52
50
  ]);
53
- const entrypoints = getBundleEntry(appContext, resolvedConfig);
51
+ const { entrypoints } = await hookRunners.modifyEntrypoints({
52
+ entrypoints: await getBundleEntry(hookRunners, appContext, resolvedConfig)
53
+ });
54
54
  debug(`entrypoints: %o`, entrypoints);
55
55
  const initialRoutes = getServerRoutes(entrypoints, {
56
56
  appContext,
@@ -68,7 +68,6 @@ var analyze_default = ({ bundler }) => ({
68
68
  api.setAppContext(appContext);
69
69
  nestedRouteEntries = entrypoints.map((point) => point.nestedRoutesEntry).filter(Boolean);
70
70
  pagesDir = entrypoints.map((point) => point.entry).filter((entry) => entry && !path.extname(entry)).concat(nestedRouteEntries);
71
- originEntrypoints = cloneDeep(entrypoints);
72
71
  const { importsStatemets } = await generateCode(appContext, resolvedConfig, entrypoints, api);
73
72
  const htmlTemplates = await getHtmlTemplate(entrypoints, api, {
74
73
  appContext,
@@ -212,20 +211,6 @@ var analyze_default = ({ bundler }) => ({
212
211
  entrypoint,
213
212
  imports
214
213
  };
215
- },
216
- async fileChange(e) {
217
- const appContext = api.useAppContext();
218
- const { appDirectory } = appContext;
219
- const { filename, eventType } = e;
220
- const isPageFile = (name) => pagesDir.some((pageDir) => name.includes(pageDir));
221
- const absoluteFilePath = path.resolve(appDirectory, filename);
222
- const isRouteComponent = isPageFile(absoluteFilePath) && isPageComponentFile(absoluteFilePath);
223
- if (isRouteComponent && (eventType === "add" || eventType === "unlink")) {
224
- const resolvedConfig = api.useResolvedConfigContext();
225
- const { generateCode } = await import("./generateCode");
226
- const entrypoints = cloneDeep(originEntrypoints);
227
- generateCode(appContext, resolvedConfig, entrypoints, api);
228
- }
229
214
  }
230
215
  };
231
216
  }
@@ -0,0 +1,75 @@
1
+ import { APP_CONFIG_NAME } from "./constants";
2
+ const index = ({ mountId, imports, renderFunction: renderFunction2, exportStatement }) => `
3
+ const IS_BROWSER = typeof window !== 'undefined' && window.name !== 'nodejs';
4
+ const IS_REACT18 = process.env.IS_REACT18 === 'true';
5
+ const MOUNT_ID = '${mountId}';
6
+
7
+ ${imports}
8
+
9
+ let AppWrapper = null;
10
+
11
+ let root = null;
12
+
13
+ function render() {
14
+ ${renderFunction2}
15
+ }
16
+
17
+ AppWrapper = render();
18
+
19
+ ${exportStatement};
20
+ `;
21
+ const renderFunction = ({ plugins, customBootstrap, fileSystemRoutes, customRuntimeConfig }) => {
22
+ const bootstrap = "bootstrap(AppWrapper, MOUNT_ID, root, ReactDOM)";
23
+ const runtimePlugins = `...(runtimeConfig?.plugins || []),`;
24
+ return `
25
+ const finalAppConfig = {
26
+ ...App.config,
27
+ ...typeof ${APP_CONFIG_NAME} === 'function' ? ${APP_CONFIG_NAME}() : {},
28
+ }
29
+
30
+ AppWrapper = createApp({
31
+ plugins: [
32
+ ${plugins.map(({ name, options, args }) => `${name}({...${options}, ...finalAppConfig?.${args || name}}),`).join("\n")}
33
+ ${customRuntimeConfig ? runtimePlugins : ""}
34
+ ]
35
+ })(${fileSystemRoutes ? "" : `App`})
36
+
37
+
38
+ if(!AppWrapper.init && typeof appInit !== 'undefined') {
39
+ AppWrapper.init = appInit;
40
+ }
41
+
42
+
43
+ if (IS_BROWSER) {
44
+ ${customBootstrap ? `customBootstrap(AppWrapper, () => ${bootstrap});` : `${bootstrap};`}
45
+ }
46
+
47
+ return AppWrapper
48
+ `;
49
+ };
50
+ const html = (partials) => `
51
+ <!DOCTYPE html>
52
+ <html>
53
+ <head>
54
+
55
+ ${partials.top.join("\n")}
56
+
57
+ ${partials.head.join("\n")}
58
+
59
+ </head>
60
+
61
+ <body>
62
+ <div id="<%= mountId %>"><!--<?- html ?>--></div>
63
+ ${partials.body.join("\n")}
64
+ <!--<?- chunksMap.js ?>-->
65
+ <!--<?- SSRDataScript ?>-->
66
+ <!--<?- bottomTemplate ?>-->
67
+ </body>
68
+
69
+ </html>
70
+ `;
71
+ export {
72
+ html,
73
+ index,
74
+ renderFunction
75
+ };
@@ -1,9 +1,9 @@
1
1
  import fs from "fs";
2
2
  import path from "path";
3
- import { isReact18, normalizeToPosixPath, fs as fse, getCommand } from "@modern-js/utils";
3
+ import { isReact18, normalizeToPosixPath, getCommand, JS_EXTENSIONS } from "@modern-js/utils";
4
4
  import { transform } from "esbuild";
5
5
  import { parse } from "es-module-lexer";
6
- import { ACTION_EXPORT_NAME, FILE_SYSTEM_ROUTES_FILE_NAME, JS_EXTENSIONS, LOADER_EXPORT_NAME } from "./constants";
6
+ import { FILE_SYSTEM_ROUTES_FILE_NAME } from "./constants";
7
7
  const walkDirectory = (dir) => fs.readdirSync(dir).reduce((previous, filename) => {
8
8
  const filePath = path.join(dir, filename);
9
9
  if (fs.statSync(filePath).isDirectory()) {
@@ -18,7 +18,7 @@ const walkDirectory = (dir) => fs.readdirSync(dir).reduce((previous, filename) =
18
18
  ];
19
19
  }
20
20
  }, []);
21
- const getDefaultImports = ({ entrypoint, srcDirectory, appDirectory, internalSrcAlias, internalDirAlias }) => {
21
+ const getDefaultImports = ({ entrypoint, srcDirectory, appDirectory, internalSrcAlias, internalDirAlias, runtimeConfigFile, customRuntimeConfig }) => {
22
22
  const { entryName, fileSystemRoutes, customBootstrap, entry } = entrypoint;
23
23
  const imports = [
24
24
  {
@@ -89,21 +89,17 @@ const getDefaultImports = ({ entrypoint, srcDirectory, appDirectory, internalSrc
89
89
  value: normalizeToPosixPath(entry.replace(srcDirectory, internalSrcAlias))
90
90
  });
91
91
  }
92
- return imports;
93
- };
94
- const isPageComponentFile = (filePath) => {
95
- if (/\.(d|test|spec|e2e)\.(js|jsx|ts|tsx)$/.test(filePath)) {
96
- return false;
97
- }
98
- if ([
99
- ".js",
100
- ".jsx",
101
- ".ts",
102
- ".tsx"
103
- ].includes(path.extname(filePath))) {
104
- return true;
92
+ if (customRuntimeConfig) {
93
+ imports.push({
94
+ specifiers: [
95
+ {
96
+ local: "runtimeConfig"
97
+ }
98
+ ],
99
+ value: path.join(internalSrcAlias, runtimeConfigFile || "")
100
+ });
105
101
  }
106
- return false;
102
+ return imports;
107
103
  };
108
104
  const replaceWithAlias = (base, filePath, alias) => {
109
105
  if (filePath.includes(base)) {
@@ -123,37 +119,6 @@ const parseModule = async ({ source, filename }) => {
123
119
  }
124
120
  return await parse(content);
125
121
  };
126
- const hasLoader = async (filename, source) => {
127
- let content = source;
128
- if (!source) {
129
- content = (await fse.readFile(filename, "utf-8")).toString();
130
- }
131
- if (content) {
132
- const [, moduleExports] = await parseModule({
133
- source: content.toString(),
134
- filename
135
- });
136
- return moduleExports.some((e) => e.n === LOADER_EXPORT_NAME);
137
- }
138
- return false;
139
- };
140
- const hasAction = async (filename, source) => {
141
- let content = source;
142
- if (!source) {
143
- content = (await fse.readFile(filename, "utf-8")).toString();
144
- }
145
- if (content) {
146
- const [, moduleExports] = await parseModule({
147
- source: content.toString(),
148
- filename
149
- });
150
- return moduleExports.some((e) => e.n === ACTION_EXPORT_NAME);
151
- }
152
- return false;
153
- };
154
- const getServerLoadersFile = (internalDirectory, entryName) => {
155
- return path.join(internalDirectory, entryName, "route-server-loaders.js");
156
- };
157
122
  const getServerCombinedModueFile = (internalDirectory, entryName) => {
158
123
  return path.join(internalDirectory, entryName, "server-loader-combined.js");
159
124
  };
@@ -181,10 +146,6 @@ export {
181
146
  checkIsBuildCommands,
182
147
  getDefaultImports,
183
148
  getServerCombinedModueFile,
184
- getServerLoadersFile,
185
- hasAction,
186
- hasLoader,
187
- isPageComponentFile,
188
149
  isSubDirOrEqual,
189
150
  parseModule,
190
151
  replaceWithAlias,
@@ -1,11 +1,21 @@
1
- import path from "node:path";
1
+ import path, { isAbsolute } from "node:path";
2
2
  import { fs as fse, pkgUp, semver } from "@modern-js/utils";
3
3
  import { readPackageJSON } from "pkg-types";
4
4
  import { parseNodeModulePath } from "mlly";
5
- import { linkPackage, writePackage, isFile, findEntryFiles, traceFiles, findPackageParents, resolveTracedPath, readDirRecursive } from "./utils";
6
- const handleDependencies = async ({ appDir, serverRootDir, includeEntries, entryFilter, modifyPackageJson, copyWholePackage }) => {
5
+ import { linkPackage, writePackage, isFile, findEntryFiles, traceFiles, findPackageParents, resolveTracedPath } from "./utils";
6
+ const handleDependencies = async (appDir, serverRootDir, include, entryFilter) => {
7
7
  const base = "/";
8
8
  const entryFiles = await findEntryFiles(serverRootDir, entryFilter);
9
+ const includeEntries = include.map((item) => {
10
+ if (isAbsolute(item)) {
11
+ return item;
12
+ }
13
+ try {
14
+ return require.resolve(item);
15
+ } catch (error) {
16
+ }
17
+ return item;
18
+ });
9
19
  const fileTrace = await traceFiles(entryFiles.concat(includeEntries), serverRootDir, base);
10
20
  const currentProjectModules = path.join(appDir, "node_modules");
11
21
  const tracedFiles = Object.fromEntries(await Promise.all([
@@ -100,17 +110,9 @@ const handleDependencies = async ({ appDir, serverRootDir, includeEntries, entry
100
110
  }
101
111
  tracedPackage.versions[pkgJSON.version] = tracedPackageVersion;
102
112
  }
113
+ tracedFile.path.startsWith(tracedFile.pkgPath) && tracedPackageVersion.path === tracedFile.pkgPath && tracedPackageVersion.files.push(tracedFile.path);
103
114
  tracedFile.pkgName = pkgName;
104
115
  tracedFile.pkgVersion = pkgJSON.version;
105
- const shouldCopyWholePackage = copyWholePackage === null || copyWholePackage === void 0 ? void 0 : copyWholePackage(pkgName);
106
- if (tracedFile.path.startsWith(tracedFile.pkgPath) && tracedPackageVersion.path === tracedFile.pkgPath) {
107
- if (shouldCopyWholePackage) {
108
- const allFiles = await readDirRecursive(tracedFile.pkgPath);
109
- tracedPackageVersion.files.push(...allFiles);
110
- } else {
111
- tracedPackageVersion.files.push(tracedFile.path);
112
- }
113
- }
114
116
  }
115
117
  const multiVersionPkgs = {};
116
118
  const singleVersionPackages = [];
@@ -128,11 +130,7 @@ const handleDependencies = async ({ appDir, serverRootDir, includeEntries, entry
128
130
  await Promise.all(singleVersionPackages.map((pkgName) => {
129
131
  const pkg = tracedPackages[pkgName];
130
132
  const version = Object.keys(pkg.versions)[0];
131
- return writePackage({
132
- pkg,
133
- version,
134
- projectDir: serverRootDir
135
- });
133
+ return writePackage(pkg, version, serverRootDir);
136
134
  }));
137
135
  const projectPkgJson = await readPackageJSON(serverRootDir).catch(() => ({}));
138
136
  for (const [pkgName, pkgVersions] of Object.entries(multiVersionPkgs)) {
@@ -159,12 +157,7 @@ const handleDependencies = async ({ appDir, serverRootDir, includeEntries, entry
159
157
  for (const [version, parentPkgs] of versionEntires) {
160
158
  const pkg = tracedPackages[pkgName];
161
159
  const pkgDestPath = `.modernjs/${pkgName}@${version}/node_modules/${pkgName}`;
162
- await writePackage({
163
- pkg,
164
- version,
165
- projectDir: serverRootDir,
166
- _pkgPath: pkgDestPath
167
- });
160
+ await writePackage(pkg, version, serverRootDir, pkgDestPath);
168
161
  await linkPackage(pkgDestPath, `${pkgName}`, serverRootDir);
169
162
  for (const parentPkg of parentPkgs) {
170
163
  const parentPkgName = parentPkg.replace(/@[^@]+$/, "");
@@ -173,7 +166,7 @@ const handleDependencies = async ({ appDir, serverRootDir, includeEntries, entry
173
166
  }
174
167
  }
175
168
  const outputPkgPath = path.join(serverRootDir, "package.json");
176
- const newPkgJson = {
169
+ await fse.writeJSON(outputPkgPath, {
177
170
  name: `${projectPkgJson.name || "modernjs-project"}-prod`,
178
171
  version: projectPkgJson.version || "0.0.0",
179
172
  private: true,
@@ -183,9 +176,7 @@ const handleDependencies = async ({ appDir, serverRootDir, includeEntries, entry
183
176
  Object.keys(pkg.versions)[0]
184
177
  ])
185
178
  ].sort(([a], [b]) => a.localeCompare(b)))
186
- };
187
- const finalPkgJson = (modifyPackageJson === null || modifyPackageJson === void 0 ? void 0 : modifyPackageJson(newPkgJson)) || newPkgJson;
188
- await fse.writeJSON(outputPkgPath, finalPkgJson);
179
+ });
189
180
  };
190
181
  export {
191
182
  handleDependencies
@@ -10,8 +10,7 @@ function applyPublicCondition(pkg) {
10
10
  pkg.exports = pkg === null || pkg === void 0 ? void 0 : (_pkg_publishConfig1 = pkg.publishConfig) === null || _pkg_publishConfig1 === void 0 ? void 0 : _pkg_publishConfig1.exports;
11
11
  }
12
12
  }
13
- const writePackage = async (options) => {
14
- const { pkg, version, projectDir, _pkgPath } = options;
13
+ const writePackage = async (pkg, version, projectDir, _pkgPath) => {
15
14
  const pkgPath = _pkgPath || pkg.name;
16
15
  for (const src of pkg.versions[version].files) {
17
16
  if (src.includes("node_modules")) {
@@ -1,5 +1,5 @@
1
1
  import path from "node:path";
2
- import { ROUTE_SPEC_FILE, DEFAULT_SERVER_CONFIG, fs as fse, getInternalPlugins } from "@modern-js/utils";
2
+ import { ROUTE_SPEC_FILE, DEFAULT_SERVER_CONFIG, fs as fse } from "@modern-js/utils";
3
3
  import { isMainEntry } from "../../../utils/routes";
4
4
  import { genPluginImportsCode, serverAppContenxtTemplate } from "../utils";
5
5
  import { handleDependencies } from "../dependencies";
@@ -17,8 +17,8 @@ async function cleanDistDirectory(dir) {
17
17
  }
18
18
  }
19
19
  const createNetlifyPreset = (appContext, modernConfig, needModernServer) => {
20
- const { appDirectory, distDirectory, serverInternalPlugins, entrypoints } = appContext;
21
- const plugins = getInternalPlugins(appDirectory, serverInternalPlugins);
20
+ const { appDirectory, distDirectory, entrypoints, serverPlugins } = appContext;
21
+ const plugins = serverPlugins.map((plugin) => plugin.name);
22
22
  const netlifyOutput = path.join(appDirectory, ".netlify");
23
23
  const funcsDirectory = path.join(netlifyOutput, "functions");
24
24
  const entryFilePath = path.join(funcsDirectory, "index.js");
@@ -91,13 +91,9 @@ const createNetlifyPreset = (appContext, modernConfig, needModernServer) => {
91
91
  if (!needModernServer) {
92
92
  return;
93
93
  }
94
- await handleDependencies({
95
- appDir: appDirectory,
96
- serverRootDir: funcsDirectory,
97
- includeEntries: [
98
- require.resolve("@modern-js/prod-server")
99
- ]
100
- });
94
+ await handleDependencies(appDirectory, funcsDirectory, [
95
+ "@modern-js/prod-server"
96
+ ]);
101
97
  }
102
98
  };
103
99
  };
@@ -1,10 +1,10 @@
1
1
  import path from "node:path";
2
- import { ROUTE_SPEC_FILE, DEFAULT_SERVER_CONFIG, fs as fse, getInternalPlugins, chalk } from "@modern-js/utils";
2
+ import { ROUTE_SPEC_FILE, DEFAULT_SERVER_CONFIG, fs as fse, chalk } from "@modern-js/utils";
3
3
  import { genPluginImportsCode, serverAppContenxtTemplate } from "../utils";
4
4
  import { handleDependencies } from "../dependencies";
5
5
  const createNodePreset = (appContext, config) => {
6
- const { appDirectory, distDirectory, serverInternalPlugins } = appContext;
7
- const plugins = getInternalPlugins(appDirectory, serverInternalPlugins);
6
+ const { appDirectory, distDirectory, serverPlugins } = appContext;
7
+ const plugins = serverPlugins.map((plugin) => plugin.name);
8
8
  const outputDirectory = path.join(appDirectory, ".output");
9
9
  const staticDirectory = path.join(outputDirectory, "static");
10
10
  const entryFilePath = path.join(outputDirectory, "index.js");
@@ -45,17 +45,9 @@ const createNodePreset = (appContext, config) => {
45
45
  const filter = (filePath) => {
46
46
  return !filePath.startsWith(staticDirectory);
47
47
  };
48
- await handleDependencies({
49
- appDir: appDirectory,
50
- serverRootDir: outputDirectory,
51
- includeEntries: [
52
- require.resolve("@modern-js/prod-server")
53
- ],
54
- entryFilter: filter,
55
- copyWholePackage: (pkgName) => {
56
- return pkgName === "koa";
57
- }
58
- });
48
+ await handleDependencies(appDirectory, outputDirectory, [
49
+ "@modern-js/prod-server"
50
+ ], filter);
59
51
  }
60
52
  };
61
53
  };
@@ -1,11 +1,11 @@
1
1
  import path from "node:path";
2
- import { ROUTE_SPEC_FILE, DEFAULT_SERVER_CONFIG, fs as fse, getInternalPlugins } from "@modern-js/utils";
2
+ import { ROUTE_SPEC_FILE, DEFAULT_SERVER_CONFIG, fs as fse } from "@modern-js/utils";
3
3
  import { isMainEntry } from "../../../utils/routes";
4
4
  import { genPluginImportsCode, serverAppContenxtTemplate } from "../utils";
5
5
  import { handleDependencies } from "../dependencies";
6
6
  const createVercelPreset = (appContext, modernConfig, needModernServer) => {
7
- const { appDirectory, distDirectory, serverInternalPlugins, entrypoints } = appContext;
8
- const plugins = getInternalPlugins(appDirectory, serverInternalPlugins);
7
+ const { appDirectory, distDirectory, entrypoints, serverPlugins } = appContext;
8
+ const plugins = serverPlugins.map((plugin) => plugin.name);
9
9
  const vercelOutput = path.join(appDirectory, ".vercel");
10
10
  const outputDirectory = path.join(vercelOutput, "output");
11
11
  const funcsDirectory = path.join(outputDirectory, "functions", "index.func");
@@ -103,13 +103,9 @@ const createVercelPreset = (appContext, modernConfig, needModernServer) => {
103
103
  if (!needModernServer) {
104
104
  return;
105
105
  }
106
- await handleDependencies({
107
- appDir: appDirectory,
108
- serverRootDir: funcsDirectory,
109
- includeEntries: [
110
- require.resolve("@modern-js/prod-server")
111
- ]
112
- });
106
+ await handleDependencies(appDirectory, funcsDirectory, [
107
+ "@modern-js/prod-server"
108
+ ]);
113
109
  }
114
110
  };
115
111
  };
@@ -1,5 +1,5 @@
1
1
  import { ensureAbsolutePath, getPort, isDev, isDevCommand } from "@modern-js/utils";
2
- import { checkIsLegacyConfig, createDefaultConfig, createLegacyDefaultConfig, transformNormalizedConfig } from "../config";
2
+ import { checkIsLegacyConfig, createDefaultConfig, createLegacyDefaultConfig, transformNormalizedConfig } from "../../config";
3
3
  var initialize_default = ({ bundler }) => ({
4
4
  name: "@modern-js/plugin-initialize",
5
5
  post: [
@@ -1,11 +1,17 @@
1
1
  import path from "path";
2
2
  import fs from "fs";
3
- import { SERVER_DIR, SHARED_DIR } from "@modern-js/utils";
3
+ import { SERVER_DIR, SHARED_DIR, getMeta } from "@modern-js/utils";
4
4
  import { compile } from "@modern-js/server-utils";
5
5
  const TS_CONFIG_FILENAME = "tsconfig.json";
6
6
  function checkHasCache(appDir) {
7
- const tsFilepath = path.resolve(appDir, "server", "cache.ts");
8
- const jsfilepath = path.resolve(appDir, "server", "cache.js");
7
+ const tsFilepath = path.resolve(appDir, SERVER_DIR, "cache.ts");
8
+ const jsfilepath = path.resolve(appDir, SERVER_DIR, "cache.js");
9
+ return fs.existsSync(tsFilepath) || fs.existsSync(jsfilepath);
10
+ }
11
+ function checkHasConfig(appDir, metaName = "modern-js") {
12
+ const meta = getMeta(metaName);
13
+ const tsFilepath = path.resolve(appDir, SERVER_DIR, `${meta}.server.ts`);
14
+ const jsfilepath = path.resolve(appDir, SERVER_DIR, `${meta}.server.js`);
9
15
  return fs.existsSync(tsFilepath) || fs.existsSync(jsfilepath);
10
16
  }
11
17
  var serverBuild_default = () => ({
@@ -13,8 +19,8 @@ var serverBuild_default = () => ({
13
19
  setup(api) {
14
20
  return {
15
21
  async afterBuild() {
16
- const { appDirectory, distDirectory } = api.useAppContext();
17
- if (!checkHasCache(appDirectory)) {
22
+ const { appDirectory, distDirectory, metaName } = api.useAppContext();
23
+ if (!checkHasCache(appDirectory) && !checkHasConfig(appDirectory, metaName)) {
18
24
  return;
19
25
  }
20
26
  const modernConfig = api.useResolvedConfigContext();
@@ -1,5 +1,5 @@
1
1
  import { createDevServer } from "@modern-js/server";
2
- import { initProdMiddlewares } from "@modern-js/prod-server";
2
+ import { applyPlugins } from "@modern-js/prod-server";
3
3
  let server = null;
4
4
  const getServer = () => server;
5
5
  const setServer = (newServer) => {
@@ -15,7 +15,7 @@ const createServer = async (options) => {
15
15
  if (server) {
16
16
  server.close();
17
17
  }
18
- server = await createDevServer(options, initProdMiddlewares);
18
+ server = await createDevServer(options, applyPlugins);
19
19
  return server;
20
20
  };
21
21
  export {
@@ -0,0 +1,21 @@
1
+ import { loadServerPlugins as loadServerPluginInstances } from "@modern-js/prod-server";
2
+ async function getServerPlugins(api) {
3
+ const runner = api.useHookRunners();
4
+ const { plugins } = await runner._internalServerPlugins({
5
+ plugins: []
6
+ });
7
+ api.setAppContext({
8
+ ...api.useAppContext(),
9
+ serverPlugins: plugins
10
+ });
11
+ return plugins;
12
+ }
13
+ async function loadServerPlugins(api, appDirectory) {
14
+ const plugins = await getServerPlugins(api);
15
+ const instances = loadServerPluginInstances(plugins, appDirectory);
16
+ return instances;
17
+ }
18
+ export {
19
+ getServerPlugins,
20
+ loadServerPlugins
21
+ };
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
- import { CopyPluginOptions, WebpackChain } from '@modern-js/uni-builder';
2
+ import { CopyPluginOptions, RspackChain } from '@modern-js/uni-builder';
3
3
  import type { AppNormalizedConfig, Bundler, IAppContext } from '../../types';
4
- export declare function createPublicPattern(appContext: IAppContext, config: AppNormalizedConfig, chain: WebpackChain): {
4
+ export declare function createPublicPattern(appContext: IAppContext, config: AppNormalizedConfig, chain: RspackChain): {
5
5
  info: (file: {
6
6
  sourceFilename: string;
7
7
  }) => {
@@ -1,3 +1,10 @@
1
- export * from './dev';
2
- export * from './build';
3
- export * from './serve';
1
+ import { PluginAPI } from '@modern-js/core';
2
+ import { Command } from '@modern-js/utils';
3
+ import { AppTools } from '../types';
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
+ export declare const newCommand: (program: Command, locale: string) => void;
9
+ export declare const inspectCommand: (program: Command, api: PluginAPI<AppTools<'shared'>>) => void;
10
+ export declare const upgradeCommand: (program: Command) => void;
@@ -1,4 +1,4 @@
1
1
  import { AppNormalizedConfig, IAppContext } from '../../types';
2
2
  export declare function initHtmlConfig(config: AppNormalizedConfig<'shared'>, appContext: IAppContext): AppNormalizedConfig<'shared'>['html'];
3
3
  export declare function initSourceConfig(config: AppNormalizedConfig<'shared'>, appContext: IAppContext, bundler: 'webpack' | 'rspack'): void;
4
- export declare function createBuilderModuleScope(config: AppNormalizedConfig<'webpack'>): any;
4
+ export declare function createBuilderModuleScope(config: AppNormalizedConfig<'webpack'>): (string | RegExp)[] | undefined;
@@ -1 +1,5 @@
1
+ import { UnstableMiddleware, UnstableMiddlewareContext, UnstableNext } from '@modern-js/types';
2
+ export type RenderMiddleware = UnstableMiddleware;
3
+ export type RenderMiddlewareContext = UnstableMiddlewareContext;
4
+ export type RenderNext = UnstableNext;
1
5
  export { defineServerConfig as defineConfig } from '../utils/config';
@@ -1,13 +1,10 @@
1
- import { Command } from '@modern-js/utils';
2
- import { CliPlugin, PluginAPI } from '@modern-js/core';
1
+ import { CliPlugin } from '@modern-js/core';
3
2
  import { AppTools } from './types';
3
+ export { dev } from './commands/dev';
4
4
  export { mergeConfig } from '@modern-js/core';
5
- export { dev } from './commands';
6
5
  export * from './defineConfig';
7
6
  export * from './types';
8
7
  export type { RuntimeUserConfig } from './types/config';
9
- export declare const devCommand: (program: Command, api: PluginAPI<AppTools<'shared'>>) => Promise<void>;
10
- export declare const buildCommand: (program: Command, api: PluginAPI<AppTools<'shared'>>) => Promise<void>;
11
8
  export type AppToolsOptions = {
12
9
  /**
13
10
  * Specify which bundler to use for the build.
@@ -0,0 +1,9 @@
1
+ export declare const INDEX_FILE_NAME = "index";
2
+ export declare const FILE_SYSTEM_ROUTES_FILE_NAME = "routes.js";
3
+ export declare const ENTRY_POINT_FILE_NAME = "index.jsx";
4
+ export declare const ENTRY_BOOTSTRAP_FILE_NAME = "bootstrap.jsx";
5
+ export declare const HTML_PARTIALS_FOLDER = "html";
6
+ export declare const HTML_PARTIALS_EXTENSIONS: string[];
7
+ export declare const APP_CONFIG_NAME = "config";
8
+ export declare const APP_INIT_EXPORTED = "init";
9
+ export declare const APP_INIT_IMPORTED = "appInit";
@@ -1,7 +1,7 @@
1
1
  import { IAppContext, PluginAPI } from '@modern-js/core';
2
2
  import type { Entrypoint } from '@modern-js/types';
3
3
  import { RspackConfig, WebpackConfig } from '@rsbuild/shared';
4
- import { AppNormalizedConfig, AppTools, ImportStatement } from '../types';
4
+ import { AppNormalizedConfig, AppTools, ImportStatement } from '../../types';
5
5
  export declare const createImportStatements: (statements: ImportStatement[]) => string;
6
6
  export declare const generateCode: (appContext: IAppContext, config: AppNormalizedConfig<'shared'>, entrypoints: Entrypoint[], api: PluginAPI<AppTools<'shared'>>) => Promise<{
7
7
  importsStatemets: Map<string, ImportStatement[]>;
@@ -0,0 +1,4 @@
1
+ import type { Entrypoint } from '@modern-js/types';
2
+ import { CliHooksRunner } from '@modern-js/core';
3
+ import type { AppNormalizedConfig, AppTools, IAppContext } from '../../types';
4
+ export declare const getBundleEntry: (hookRunners: CliHooksRunner<AppTools<'shared'>>, appContext: IAppContext, config: AppNormalizedConfig<'shared'>) => Promise<Entrypoint[]>;
@@ -0,0 +1,5 @@
1
+ import type { Entrypoint } from '@modern-js/types';
2
+ import { CliHooksRunner } from '@modern-js/core';
3
+ import type { AppNormalizedConfig, AppTools, IAppContext } from '../../types';
4
+ export type { Entrypoint };
5
+ export declare const getFileSystemEntry: (hookRunners: CliHooksRunner<AppTools<'shared'>>, appContext: IAppContext, config: AppNormalizedConfig<'shared'>) => Promise<Entrypoint[]>;
@@ -1,5 +1,5 @@
1
1
  import type { Entrypoint, HtmlTemplates } from '@modern-js/types';
2
- import type { AppNormalizedConfig, AppTools, IAppContext, PluginAPI } from '../types';
2
+ import type { AppNormalizedConfig, AppTools, IAppContext, PluginAPI } from '../../types';
3
3
  export declare const getHtmlTemplate: (entrypoints: Entrypoint[], api: PluginAPI<AppTools<'shared'>>, { appContext, config, }: {
4
4
  appContext: IAppContext;
5
5
  config: AppNormalizedConfig<'shared'>;
@@ -1,6 +1,6 @@
1
1
  import type { IAppContext } from '@modern-js/core';
2
2
  import type { Entrypoint, ServerRoute } from '@modern-js/types';
3
- import type { AppNormalizedConfig } from '../types';
3
+ import type { AppNormalizedConfig } from '../../types';
4
4
  export declare const getServerRoutes: (entrypoints: Entrypoint[], { appContext, config, }: {
5
5
  appContext: IAppContext;
6
6
  config: AppNormalizedConfig<'shared'>;
@@ -1,5 +1,5 @@
1
1
  import type { CliPlugin } from '@modern-js/core';
2
- import { AppTools } from '../types';
2
+ import { AppTools } from '../../types';
3
3
  declare const _default: ({ bundler, }: {
4
4
  bundler: 'webpack' | 'rspack';
5
5
  }) => CliPlugin<AppTools<'shared'>>;