@modern-js/app-tools 2.0.0-beta.2 → 2.0.0-canary.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 (231) hide show
  1. package/CHANGELOG.md +251 -0
  2. package/bin/modern.js +10 -1
  3. package/dist/js/modern/analyze/constants.js +38 -16
  4. package/dist/js/modern/analyze/generateCode.js +271 -211
  5. package/dist/js/modern/analyze/getBundleEntry.js +31 -32
  6. package/dist/js/modern/analyze/getClientRoutes/getRoutes.js +93 -49
  7. package/dist/js/modern/analyze/getClientRoutes/getRoutesLegacy.js +89 -47
  8. package/dist/js/modern/analyze/getClientRoutes/index.js +6 -2
  9. package/dist/js/modern/analyze/getClientRoutes/utils.js +23 -10
  10. package/dist/js/modern/analyze/getFileSystemEntry.js +43 -22
  11. package/dist/js/modern/analyze/getHtmlTemplate.js +89 -49
  12. package/dist/js/modern/analyze/getServerRoutes.js +122 -126
  13. package/dist/js/modern/analyze/index.js +193 -159
  14. package/dist/js/modern/analyze/isDefaultExportFunction.js +30 -16
  15. package/dist/js/modern/analyze/makeLegalIdentifier.js +10 -11
  16. package/dist/js/modern/analyze/nestedRoutes.js +110 -53
  17. package/dist/js/modern/analyze/templates.js +190 -77
  18. package/dist/js/modern/analyze/utils.js +98 -51
  19. package/dist/js/modern/builder/builderPlugins/compatModern.js +124 -107
  20. package/dist/js/modern/builder/index.js +123 -86
  21. package/dist/js/modern/builder/loaders/routerLoader.js +17 -0
  22. package/dist/js/modern/builder/loaders/serverModuleLoader.js +7 -0
  23. package/dist/js/modern/builder/share.js +22 -20
  24. package/dist/js/modern/builder/webpackPlugins/htmlAsyncChunkPlugin.js +23 -22
  25. package/dist/js/modern/builder/webpackPlugins/htmlBottomTemplate.js +31 -27
  26. package/dist/js/modern/builder/webpackPlugins/routerPlugin.js +98 -84
  27. package/dist/js/modern/commands/build.js +67 -42
  28. package/dist/js/modern/commands/deploy.js +27 -4
  29. package/dist/js/modern/commands/dev.js +93 -47
  30. package/dist/js/modern/commands/index.js +1 -1
  31. package/dist/js/modern/commands/inspect.js +30 -5
  32. package/dist/js/modern/commands/start.js +37 -16
  33. package/dist/js/modern/config/default.js +103 -114
  34. package/dist/js/modern/config/index.js +8 -2
  35. package/dist/js/modern/config/initial/createHtmlConfig.js +5 -2
  36. package/dist/js/modern/config/initial/createOutputConfig.js +11 -9
  37. package/dist/js/modern/config/initial/createSourceConfig.js +5 -2
  38. package/dist/js/modern/config/initial/createToolsConfig.js +7 -6
  39. package/dist/js/modern/config/initial/index.js +9 -4
  40. package/dist/js/modern/config/initial/inits.js +109 -73
  41. package/dist/js/modern/config/initial/transformNormalizedConfig.js +6 -3
  42. package/dist/js/modern/defineConfig.js +26 -11
  43. package/dist/js/modern/exports/server.js +4 -1
  44. package/dist/js/modern/hooks.js +10 -3
  45. package/dist/js/modern/index.js +140 -89
  46. package/dist/js/modern/initialize/index.js +98 -51
  47. package/dist/js/modern/locale/en.js +20 -21
  48. package/dist/js/modern/locale/index.js +6 -6
  49. package/dist/js/modern/locale/zh.js +21 -22
  50. package/dist/js/modern/schema/Schema.js +6 -5
  51. package/dist/js/modern/schema/index.js +51 -100
  52. package/dist/js/modern/schema/legacy.js +96 -231
  53. package/dist/js/modern/types/config/index.js +0 -1
  54. package/dist/js/modern/types/index.js +0 -1
  55. package/dist/js/modern/types/legacyConfig/output.js +0 -1
  56. package/dist/js/modern/utils/commands.js +5 -2
  57. package/dist/js/modern/utils/config.js +102 -41
  58. package/dist/js/modern/utils/createFileWatcher.js +84 -51
  59. package/dist/js/modern/utils/createServer.js +63 -17
  60. package/dist/js/modern/utils/getSpecifiedEntries.js +46 -19
  61. package/dist/js/modern/utils/language.js +6 -3
  62. package/dist/js/modern/utils/printInstructions.js +27 -8
  63. package/dist/js/modern/utils/restart.js +43 -16
  64. package/dist/js/modern/utils/routes.js +29 -12
  65. package/dist/js/node/analyze/constants.js +54 -35
  66. package/dist/js/node/analyze/generateCode.js +290 -228
  67. package/dist/js/node/analyze/getBundleEntry.js +55 -44
  68. package/dist/js/node/analyze/getClientRoutes/getRoutes.js +132 -76
  69. package/dist/js/node/analyze/getClientRoutes/getRoutesLegacy.js +128 -74
  70. package/dist/js/node/analyze/getClientRoutes/index.js +23 -17
  71. package/dist/js/node/analyze/getClientRoutes/utils.js +44 -21
  72. package/dist/js/node/analyze/getFileSystemEntry.js +70 -39
  73. package/dist/js/node/analyze/getHtmlTemplate.js +116 -61
  74. package/dist/js/node/analyze/getServerRoutes.js +143 -137
  75. package/dist/js/node/analyze/index.js +240 -174
  76. package/dist/js/node/analyze/isDefaultExportFunction.js +55 -26
  77. package/dist/js/node/analyze/makeLegalIdentifier.js +27 -15
  78. package/dist/js/node/analyze/nestedRoutes.js +140 -67
  79. package/dist/js/node/analyze/templates.js +211 -84
  80. package/dist/js/node/analyze/utils.js +123 -62
  81. package/dist/js/node/builder/builderPlugins/compatModern.js +152 -120
  82. package/dist/js/node/builder/index.js +151 -95
  83. package/dist/js/node/builder/loaders/routerLoader.js +36 -0
  84. package/dist/js/node/builder/loaders/serverModuleLoader.js +26 -0
  85. package/dist/js/node/builder/share.js +45 -25
  86. package/dist/js/node/builder/webpackPlugins/htmlAsyncChunkPlugin.js +39 -26
  87. package/dist/js/node/builder/webpackPlugins/htmlBottomTemplate.js +47 -31
  88. package/dist/js/node/builder/webpackPlugins/routerPlugin.js +116 -90
  89. package/dist/js/node/commands/build.js +89 -52
  90. package/dist/js/node/commands/deploy.js +45 -10
  91. package/dist/js/node/commands/dev.js +115 -61
  92. package/dist/js/node/commands/index.js +19 -38
  93. package/dist/js/node/commands/inspect.js +48 -11
  94. package/dist/js/node/commands/start.js +65 -27
  95. package/dist/js/node/config/default.js +119 -118
  96. package/dist/js/node/config/index.js +25 -29
  97. package/dist/js/node/config/initial/createHtmlConfig.js +22 -6
  98. package/dist/js/node/config/initial/createOutputConfig.js +28 -13
  99. package/dist/js/node/config/initial/createSourceConfig.js +22 -6
  100. package/dist/js/node/config/initial/createToolsConfig.js +24 -10
  101. package/dist/js/node/config/initial/index.js +28 -17
  102. package/dist/js/node/config/initial/inits.js +126 -81
  103. package/dist/js/node/config/initial/transformNormalizedConfig.js +31 -15
  104. package/dist/js/node/defineConfig.js +43 -17
  105. package/dist/js/node/exports/server.js +21 -10
  106. package/dist/js/node/hooks.js +44 -29
  107. package/dist/js/node/index.js +190 -130
  108. package/dist/js/node/initialize/index.js +116 -61
  109. package/dist/js/node/locale/en.js +36 -25
  110. package/dist/js/node/locale/index.js +27 -15
  111. package/dist/js/node/locale/zh.js +37 -26
  112. package/dist/js/node/schema/Schema.js +23 -10
  113. package/dist/js/node/schema/index.js +77 -114
  114. package/dist/js/node/schema/legacy.js +117 -240
  115. package/dist/js/node/types/config/index.js +17 -16
  116. package/dist/js/node/types/index.js +19 -38
  117. package/dist/js/node/types/legacyConfig/output.js +0 -5
  118. package/dist/js/node/utils/commands.js +21 -6
  119. package/dist/js/node/utils/config.js +120 -51
  120. package/dist/js/node/utils/createFileWatcher.js +104 -60
  121. package/dist/js/node/utils/createServer.js +86 -25
  122. package/dist/js/node/utils/getSpecifiedEntries.js +64 -25
  123. package/dist/js/node/utils/language.js +24 -8
  124. package/dist/js/node/utils/printInstructions.js +47 -16
  125. package/dist/js/node/utils/restart.js +61 -21
  126. package/dist/js/node/utils/routes.js +53 -18
  127. package/dist/js/treeshaking/analyze/constants.js +28 -16
  128. package/dist/js/treeshaking/analyze/generateCode.js +604 -355
  129. package/dist/js/treeshaking/analyze/getBundleEntry.js +52 -63
  130. package/dist/js/treeshaking/analyze/getClientRoutes/getRoutes.js +214 -168
  131. package/dist/js/treeshaking/analyze/getClientRoutes/getRoutesLegacy.js +215 -169
  132. package/dist/js/treeshaking/analyze/getClientRoutes/index.js +3 -2
  133. package/dist/js/treeshaking/analyze/getClientRoutes/utils.js +19 -20
  134. package/dist/js/treeshaking/analyze/getFileSystemEntry.js +89 -86
  135. package/dist/js/treeshaking/analyze/getHtmlTemplate.js +298 -125
  136. package/dist/js/treeshaking/analyze/getServerRoutes.js +210 -146
  137. package/dist/js/treeshaking/analyze/index.js +558 -303
  138. package/dist/js/treeshaking/analyze/isDefaultExportFunction.js +45 -26
  139. package/dist/js/treeshaking/analyze/makeLegalIdentifier.js +13 -16
  140. package/dist/js/treeshaking/analyze/nestedRoutes.js +414 -160
  141. package/dist/js/treeshaking/analyze/templates.js +432 -161
  142. package/dist/js/treeshaking/analyze/utils.js +361 -80
  143. package/dist/js/treeshaking/builder/builderPlugins/compatModern.js +281 -195
  144. package/dist/js/treeshaking/builder/index.js +371 -165
  145. package/dist/js/treeshaking/builder/loaders/routerLoader.js +13 -0
  146. package/dist/js/treeshaking/builder/loaders/serverModuleLoader.js +5 -0
  147. package/dist/js/treeshaking/builder/share.js +41 -44
  148. package/dist/js/treeshaking/builder/webpackPlugins/htmlAsyncChunkPlugin.js +108 -44
  149. package/dist/js/treeshaking/builder/webpackPlugins/htmlBottomTemplate.js +70 -39
  150. package/dist/js/treeshaking/builder/webpackPlugins/routerPlugin.js +332 -112
  151. package/dist/js/treeshaking/commands/build.js +286 -88
  152. package/dist/js/treeshaking/commands/deploy.js +153 -25
  153. package/dist/js/treeshaking/commands/dev.js +318 -132
  154. package/dist/js/treeshaking/commands/index.js +1 -1
  155. package/dist/js/treeshaking/commands/inspect.js +147 -32
  156. package/dist/js/treeshaking/commands/start.js +190 -68
  157. package/dist/js/treeshaking/config/default.js +210 -199
  158. package/dist/js/treeshaking/config/index.js +3 -2
  159. package/dist/js/treeshaking/config/initial/createHtmlConfig.js +19 -31
  160. package/dist/js/treeshaking/config/initial/createOutputConfig.js +43 -67
  161. package/dist/js/treeshaking/config/initial/createSourceConfig.js +37 -40
  162. package/dist/js/treeshaking/config/initial/createToolsConfig.js +23 -38
  163. package/dist/js/treeshaking/config/initial/index.js +10 -9
  164. package/dist/js/treeshaking/config/initial/inits.js +205 -106
  165. package/dist/js/treeshaking/config/initial/transformNormalizedConfig.js +27 -34
  166. package/dist/js/treeshaking/defineConfig.js +60 -13
  167. package/dist/js/treeshaking/exports/server.js +2 -1
  168. package/dist/js/treeshaking/hooks.js +26 -25
  169. package/dist/js/treeshaking/index.js +465 -257
  170. package/dist/js/treeshaking/initialize/index.js +290 -112
  171. package/dist/js/treeshaking/locale/en.js +34 -33
  172. package/dist/js/treeshaking/locale/index.js +5 -5
  173. package/dist/js/treeshaking/locale/zh.js +34 -33
  174. package/dist/js/treeshaking/schema/Schema.js +267 -69
  175. package/dist/js/treeshaking/schema/index.js +165 -121
  176. package/dist/js/treeshaking/schema/legacy.js +323 -256
  177. package/dist/js/treeshaking/types/config/deploy.js +1 -0
  178. package/dist/js/treeshaking/types/config/dev.js +1 -0
  179. package/dist/js/treeshaking/types/config/experiments.js +1 -0
  180. package/dist/js/treeshaking/types/config/html.js +1 -0
  181. package/dist/js/treeshaking/types/config/index.js +0 -1
  182. package/dist/js/treeshaking/types/config/output.js +1 -0
  183. package/dist/js/treeshaking/types/config/performance.js +1 -0
  184. package/dist/js/treeshaking/types/config/security.js +1 -0
  185. package/dist/js/treeshaking/types/config/source.js +1 -0
  186. package/dist/js/treeshaking/types/config/tools.js +1 -0
  187. package/dist/js/treeshaking/types/hooks.js +1 -0
  188. package/dist/js/treeshaking/types/index.js +0 -1
  189. package/dist/js/treeshaking/types/legacyConfig/deploy.js +1 -0
  190. package/dist/js/treeshaking/types/legacyConfig/dev.js +1 -0
  191. package/dist/js/treeshaking/types/legacyConfig/index.js +1 -0
  192. package/dist/js/treeshaking/types/legacyConfig/output.js +1 -1
  193. package/dist/js/treeshaking/types/legacyConfig/source.js +1 -0
  194. package/dist/js/treeshaking/types/legacyConfig/tools.js +1 -0
  195. package/dist/js/treeshaking/utils/commands.js +6 -5
  196. package/dist/js/treeshaking/utils/config.js +295 -117
  197. package/dist/js/treeshaking/utils/createFileWatcher.js +278 -118
  198. package/dist/js/treeshaking/utils/createServer.js +252 -67
  199. package/dist/js/treeshaking/utils/getSpecifiedEntries.js +182 -55
  200. package/dist/js/treeshaking/utils/language.js +6 -5
  201. package/dist/js/treeshaking/utils/printInstructions.js +151 -29
  202. package/dist/js/treeshaking/utils/restart.js +184 -42
  203. package/dist/js/treeshaking/utils/routes.js +151 -27
  204. package/dist/js/treeshaking/utils/types.js +1 -0
  205. package/dist/types/analyze/constants.d.ts +2 -0
  206. package/dist/types/analyze/index.d.ts +2 -0
  207. package/dist/types/analyze/templates.d.ts +8 -7
  208. package/dist/types/analyze/utils.d.ts +9 -1
  209. package/dist/types/builder/builderPlugins/compatModern.d.ts +2 -1
  210. package/dist/types/builder/index.d.ts +2 -2
  211. package/dist/types/builder/loaders/routerLoader.d.ts +3 -0
  212. package/dist/types/builder/loaders/serverModuleLoader.d.ts +3 -0
  213. package/dist/types/builder/webpackPlugins/routerPlugin.d.ts +1 -7
  214. package/dist/types/defineConfig.d.ts +1 -0
  215. package/dist/types/index.d.ts +2 -0
  216. package/dist/types/initialize/index.d.ts +2 -0
  217. package/dist/types/types/config/index.d.ts +1 -0
  218. package/dist/types/types/config/output.d.ts +0 -1
  219. package/dist/types/types/config/source.d.ts +1 -0
  220. package/dist/types/types/config/tools.d.ts +10 -1
  221. package/dist/types/types/hooks.d.ts +2 -1
  222. package/dist/types/types/legacyConfig/dev.d.ts +1 -0
  223. package/dist/types/types/legacyConfig/output.d.ts +1 -1
  224. package/dist/types/types/legacyConfig/source.d.ts +1 -0
  225. package/dist/types/types/legacyConfig/tools.d.ts +1 -0
  226. package/dist/types/utils/config.d.ts +1 -0
  227. package/dist/types/utils/createFileWatcher.d.ts +2 -1
  228. package/dist/types/utils/createServer.d.ts +1 -0
  229. package/dist/types/utils/restart.d.ts +1 -1
  230. package/lib/types.d.ts +1 -1
  231. package/package.json +27 -23
@@ -1,38 +1,57 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var stdin_exports = {};
19
+ __export(stdin_exports, {
20
+ APP_FILE_NAME: () => APP_FILE_NAME,
21
+ ENTRY_BOOTSTRAP_FILE_NAME: () => ENTRY_BOOTSTRAP_FILE_NAME,
22
+ ENTRY_POINT_FILE_NAME: () => ENTRY_POINT_FILE_NAME,
23
+ FILE_SYSTEM_ROUTES_COMPONENTS_DIR: () => FILE_SYSTEM_ROUTES_COMPONENTS_DIR,
24
+ FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP: () => FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP,
25
+ FILE_SYSTEM_ROUTES_FILE_NAME: () => FILE_SYSTEM_ROUTES_FILE_NAME,
26
+ FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT: () => FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT,
27
+ FILE_SYSTEM_ROUTES_IGNORED_REGEX: () => FILE_SYSTEM_ROUTES_IGNORED_REGEX,
28
+ FILE_SYSTEM_ROUTES_INDEX: () => FILE_SYSTEM_ROUTES_INDEX,
29
+ FILE_SYSTEM_ROUTES_LAYOUT: () => FILE_SYSTEM_ROUTES_LAYOUT,
30
+ HTML_PARTIALS_EXTENSIONS: () => HTML_PARTIALS_EXTENSIONS,
31
+ HTML_PARTIALS_FOLDER: () => HTML_PARTIALS_FOLDER,
32
+ INDEX_FILE_NAME: () => INDEX_FILE_NAME,
33
+ JS_EXTENSIONS: () => JS_EXTENSIONS,
34
+ LOADER_EXPORT_NAME: () => LOADER_EXPORT_NAME,
35
+ NESTED_ROUTES_DIR: () => NESTED_ROUTES_DIR,
36
+ PAGES_DIR_NAME: () => PAGES_DIR_NAME,
37
+ TEMP_LOADERS_DIR: () => TEMP_LOADERS_DIR
5
38
  });
6
- exports.PAGES_DIR_NAME = exports.NESTED_ROUTES_DIR = exports.JS_EXTENSIONS = exports.INDEX_FILE_NAME = exports.HTML_PARTIALS_FOLDER = exports.HTML_PARTIALS_EXTENSIONS = exports.FILE_SYSTEM_ROUTES_LAYOUT = exports.FILE_SYSTEM_ROUTES_INDEX = exports.FILE_SYSTEM_ROUTES_IGNORED_REGEX = exports.FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT = exports.FILE_SYSTEM_ROUTES_FILE_NAME = exports.FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP = exports.FILE_SYSTEM_ROUTES_COMPONENTS_DIR = exports.ENTRY_POINT_FILE_NAME = exports.ENTRY_BOOTSTRAP_FILE_NAME = exports.APP_FILE_NAME = void 0;
7
- const JS_EXTENSIONS = ['.js', '.ts', '.jsx', '.tsx'];
8
- exports.JS_EXTENSIONS = JS_EXTENSIONS;
9
- const INDEX_FILE_NAME = 'index';
10
- exports.INDEX_FILE_NAME = INDEX_FILE_NAME;
11
- const APP_FILE_NAME = 'App';
12
- exports.APP_FILE_NAME = APP_FILE_NAME;
13
- const PAGES_DIR_NAME = 'pages';
14
- exports.PAGES_DIR_NAME = PAGES_DIR_NAME;
15
- const NESTED_ROUTES_DIR = 'routes';
16
- exports.NESTED_ROUTES_DIR = NESTED_ROUTES_DIR;
17
- const FILE_SYSTEM_ROUTES_FILE_NAME = 'routes.js';
18
- exports.FILE_SYSTEM_ROUTES_FILE_NAME = FILE_SYSTEM_ROUTES_FILE_NAME;
19
- const ENTRY_POINT_FILE_NAME = 'index.js';
20
- exports.ENTRY_POINT_FILE_NAME = ENTRY_POINT_FILE_NAME;
21
- const ENTRY_BOOTSTRAP_FILE_NAME = 'bootstrap.js';
22
- exports.ENTRY_BOOTSTRAP_FILE_NAME = ENTRY_BOOTSTRAP_FILE_NAME;
39
+ module.exports = __toCommonJS(stdin_exports);
40
+ const JS_EXTENSIONS = [".js", ".ts", ".jsx", ".tsx"];
41
+ const INDEX_FILE_NAME = "index";
42
+ const APP_FILE_NAME = "App";
43
+ const PAGES_DIR_NAME = "pages";
44
+ const NESTED_ROUTES_DIR = "routes";
45
+ const FILE_SYSTEM_ROUTES_FILE_NAME = "routes.js";
46
+ const LOADER_EXPORT_NAME = "loader";
47
+ const TEMP_LOADERS_DIR = "__loaders__";
48
+ const ENTRY_POINT_FILE_NAME = "index.js";
49
+ const ENTRY_BOOTSTRAP_FILE_NAME = "bootstrap.js";
23
50
  const FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP = /^\[(\S+)\]([*+?]?)$/;
24
- exports.FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP = FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP;
25
- const FILE_SYSTEM_ROUTES_LAYOUT = '_layout';
26
- exports.FILE_SYSTEM_ROUTES_LAYOUT = FILE_SYSTEM_ROUTES_LAYOUT;
27
- const FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT = '_app';
28
- exports.FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT = FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT;
29
- const FILE_SYSTEM_ROUTES_INDEX = 'index';
30
- exports.FILE_SYSTEM_ROUTES_INDEX = FILE_SYSTEM_ROUTES_INDEX;
51
+ const FILE_SYSTEM_ROUTES_LAYOUT = "_layout";
52
+ const FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT = "_app";
53
+ const FILE_SYSTEM_ROUTES_INDEX = "index";
31
54
  const FILE_SYSTEM_ROUTES_IGNORED_REGEX = /\.(d|test|spec|e2e)\.(js|jsx|ts|tsx)$/;
32
- exports.FILE_SYSTEM_ROUTES_IGNORED_REGEX = FILE_SYSTEM_ROUTES_IGNORED_REGEX;
33
- const HTML_PARTIALS_FOLDER = 'html';
34
- exports.HTML_PARTIALS_FOLDER = HTML_PARTIALS_FOLDER;
35
- const HTML_PARTIALS_EXTENSIONS = ['.htm', '.html', '.ejs'];
36
- exports.HTML_PARTIALS_EXTENSIONS = HTML_PARTIALS_EXTENSIONS;
37
- const FILE_SYSTEM_ROUTES_COMPONENTS_DIR = 'internal_components';
38
- exports.FILE_SYSTEM_ROUTES_COMPONENTS_DIR = FILE_SYSTEM_ROUTES_COMPONENTS_DIR;
55
+ const HTML_PARTIALS_FOLDER = "html";
56
+ const HTML_PARTIALS_EXTENSIONS = [".htm", ".html", ".ejs"];
57
+ const FILE_SYSTEM_ROUTES_COMPONENTS_DIR = "internal_components";
@@ -1,29 +1,71 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
+ var stdin_exports = {};
25
+ __export(stdin_exports, {
26
+ createImportStatements: () => createImportStatements,
27
+ generateCode: () => generateCode
5
28
  });
6
- exports.generateCode = exports.createImportStatements = void 0;
7
- var _path = _interopRequireDefault(require("path"));
8
- var _utils = require("@modern-js/utils");
9
- var _core = require("@modern-js/core");
10
- var _esbuild = _interopRequireDefault(require("esbuild"));
11
- var _commands = require("../utils/commands");
12
- var templates = _interopRequireWildcard(require("./templates"));
13
- var _getClientRoutes = require("./getClientRoutes");
14
- var _constants = require("./constants");
15
- var _utils2 = require("./utils");
16
- var _nestedRoutes = require("./nestedRoutes");
17
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
- const createImportSpecifier = specifiers => {
21
- let defaults = '';
29
+ module.exports = __toCommonJS(stdin_exports);
30
+ var import_path = __toESM(require("path"));
31
+ var import_utils = require("@modern-js/utils");
32
+ var import_core = require("@modern-js/core");
33
+ var import_esbuild = require("esbuild");
34
+ var import_commands = require("../utils/commands");
35
+ var templates = __toESM(require("./templates"));
36
+ var import_getClientRoutes = require("./getClientRoutes");
37
+ var import_constants = require("./constants");
38
+ var import_utils2 = require("./utils");
39
+ var import_nestedRoutes = require("./nestedRoutes");
40
+ var __async = (__this, __arguments, generator) => {
41
+ return new Promise((resolve, reject) => {
42
+ var fulfilled = (value) => {
43
+ try {
44
+ step(generator.next(value));
45
+ } catch (e) {
46
+ reject(e);
47
+ }
48
+ };
49
+ var rejected = (value) => {
50
+ try {
51
+ step(generator.throw(value));
52
+ } catch (e) {
53
+ reject(e);
54
+ }
55
+ };
56
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
57
+ step((generator = generator.apply(__this, __arguments)).next());
58
+ });
59
+ };
60
+ const loader = {
61
+ ".js": "jsx",
62
+ ".ts": "tsx"
63
+ };
64
+ const EXTERNAL_REGEXP = /^[^./]|^\.[^./]|^\.\.[^/]/;
65
+ const createImportSpecifier = (specifiers) => {
66
+ let defaults = "";
22
67
  const named = [];
23
- for (const {
24
- local,
25
- imported
26
- } of specifiers) {
68
+ for (const { local, imported } of specifiers) {
27
69
  if (local && imported) {
28
70
  named.push(`${imported} as ${local}`);
29
71
  } else if (local) {
@@ -33,22 +75,18 @@ const createImportSpecifier = specifiers => {
33
75
  }
34
76
  }
35
77
  if (defaults && named.length) {
36
- return `${defaults}, { ${named.join(', ')} }`;
78
+ return `${defaults}, { ${named.join(", ")} }`;
37
79
  } else if (defaults) {
38
80
  return defaults;
39
81
  } else {
40
- return `{ ${named.join(', ')} }`;
82
+ return `{ ${named.join(", ")} }`;
41
83
  }
42
84
  };
43
- const createImportStatements = statements => {
44
- // merge import statements with the same value.
85
+ const createImportStatements = (statements) => {
86
+ var _a, _b;
45
87
  const deDuplicated = [];
46
- const seen = new Map();
47
- for (const {
48
- value,
49
- specifiers,
50
- initialize
51
- } of statements) {
88
+ const seen = /* @__PURE__ */ new Map();
89
+ for (const { value, specifiers, initialize } of statements) {
52
90
  if (!seen.has(value)) {
53
91
  deDuplicated.push({
54
92
  value,
@@ -57,228 +95,252 @@ const createImportStatements = statements => {
57
95
  });
58
96
  seen.set(value, specifiers);
59
97
  } else {
60
- var _deDuplicated$modifyI, _deDuplicated$modifyI2;
61
98
  seen.get(value).push(...specifiers);
62
- // make "initialize" param can be connected when multiple plugins were imported from same package
63
- const modifyIndex = deDuplicated.findIndex(v => v.value === value);
64
- const originInitialize = (_deDuplicated$modifyI = (_deDuplicated$modifyI2 = deDuplicated[modifyIndex]) === null || _deDuplicated$modifyI2 === void 0 ? void 0 : _deDuplicated$modifyI2.initialize) !== null && _deDuplicated$modifyI !== void 0 ? _deDuplicated$modifyI : '';
65
- deDuplicated[modifyIndex].initialize = originInitialize.concat(`\n${initialize || ''}`);
99
+ const modifyIndex = deDuplicated.findIndex((v) => v.value === value);
100
+ const originInitialize = (_b = (_a = deDuplicated[modifyIndex]) == null ? void 0 : _a.initialize) != null ? _b : "";
101
+ deDuplicated[modifyIndex].initialize = originInitialize.concat(
102
+ `
103
+ ${initialize || ""}`
104
+ );
66
105
  }
67
106
  }
68
- return deDuplicated.map(({
69
- value,
70
- specifiers,
71
- initialize
72
- }) => `import ${createImportSpecifier(specifiers)} from '${value}';\n${initialize || ''}`).join('\n');
107
+ return deDuplicated.map(
108
+ ({ value, specifiers, initialize }) => `import ${createImportSpecifier(specifiers)} from '${value}';
109
+ ${initialize || ""}`
110
+ ).join("\n");
73
111
  };
74
- exports.createImportStatements = createImportStatements;
75
- const buildLoader = async (entry, outfile) => {
76
- const loader = {
77
- '.js': 'jsx',
78
- '.ts': 'tsx'
79
- };
80
- const EXTERNAL_REGEXP = /^[^./]|^\.[^./]|^\.\.[^/]/;
81
- const command = (0, _commands.getCommand)();
82
- await _esbuild.default.build({
83
- format: 'cjs',
84
- platform: 'node',
85
- target: 'esnext',
112
+ const buildLoader = (entry, outfile) => __async(void 0, null, function* () {
113
+ const command = (0, import_commands.getCommand)();
114
+ yield (0, import_esbuild.build)({
115
+ format: "esm",
116
+ platform: "browser",
117
+ target: "esnext",
86
118
  loader,
87
- watch: command === 'dev' && {},
119
+ watch: command === "dev" && {},
88
120
  bundle: true,
89
- logLevel: 'error',
121
+ logLevel: "error",
90
122
  entryPoints: [entry],
91
123
  outfile,
92
- plugins: [{
93
- name: 'make-all-packages-external',
94
- setup(build) {
95
- // https://github.com/evanw/esbuild/issues/619#issuecomment-751995294
96
- build.onResolve({
97
- filter: EXTERNAL_REGEXP
98
- }, args => {
99
- let external = true;
100
- // FIXME: windows external entrypoint
101
- if (args.kind === 'entry-point') {
102
- external = false;
103
- }
104
- return {
105
- path: args.path,
106
- external
107
- };
108
- });
124
+ plugins: [
125
+ {
126
+ name: "make-all-packages-external",
127
+ setup(build2) {
128
+ build2.onResolve({ filter: EXTERNAL_REGEXP }, (args) => {
129
+ let external = true;
130
+ if (args.kind === "entry-point") {
131
+ external = false;
132
+ }
133
+ return {
134
+ path: args.path,
135
+ external
136
+ };
137
+ });
138
+ }
109
139
  }
110
- }]
140
+ ]
111
141
  });
112
- };
113
- const generateCode = async (appContext, config, entrypoints, api) => {
114
- var _config$runtime, _config$runtime$route;
142
+ });
143
+ const buildServerLoader = (entry, outfile) => __async(void 0, null, function* () {
144
+ const command = (0, import_commands.getCommand)();
145
+ yield (0, import_esbuild.build)({
146
+ format: "cjs",
147
+ platform: "node",
148
+ target: "esnext",
149
+ loader,
150
+ watch: command === "dev" && {},
151
+ bundle: true,
152
+ logLevel: "error",
153
+ entryPoints: [entry],
154
+ outfile
155
+ });
156
+ });
157
+ const generateCode = (appContext, config, entrypoints, api) => __async(void 0, null, function* () {
158
+ var _a, _b;
115
159
  const {
116
160
  internalDirectory,
117
161
  distDirectory,
118
162
  srcDirectory,
119
163
  internalDirAlias,
120
- internalSrcAlias
164
+ internalSrcAlias,
165
+ packageName
121
166
  } = appContext;
122
167
  const hookRunners = api.useHookRunners();
123
- const islegacy = Boolean(config === null || config === void 0 ? void 0 : (_config$runtime = config.runtime) === null || _config$runtime === void 0 ? void 0 : (_config$runtime$route = _config$runtime.router) === null || _config$runtime$route === void 0 ? void 0 : _config$runtime$route.legacy);
124
- const {
125
- mountId
126
- } = config.html;
127
- const getRoutes = islegacy ? _getClientRoutes.getClientRoutesLegacy : _getClientRoutes.getClientRoutes;
128
- await Promise.all(entrypoints.map(generateEntryCode));
129
- async function generateEntryCode(entrypoint) {
130
- const {
131
- entryName,
132
- isAutoMount,
133
- customBootstrap,
134
- fileSystemRoutes
135
- } = entrypoint;
136
- if (isAutoMount) {
137
- // generate routes file for file system routes entrypoint.
138
- if (fileSystemRoutes) {
139
- let initialRoutes = [];
140
- let nestedRoute = null;
141
- if (entrypoint.entry) {
142
- initialRoutes = getRoutes({
168
+ const islegacy = Boolean((_b = (_a = config == null ? void 0 : config.runtime) == null ? void 0 : _a.router) == null ? void 0 : _b.legacy);
169
+ const { mountId } = config.html;
170
+ const getRoutes = islegacy ? import_getClientRoutes.getClientRoutesLegacy : import_getClientRoutes.getClientRoutes;
171
+ yield Promise.all(entrypoints.map(generateEntryCode));
172
+ function generateEntryCode(entrypoint) {
173
+ return __async(this, null, function* () {
174
+ const { entryName, isAutoMount, customBootstrap, fileSystemRoutes } = entrypoint;
175
+ if (isAutoMount) {
176
+ if (fileSystemRoutes) {
177
+ let initialRoutes = [];
178
+ let nestedRoute = null;
179
+ if (entrypoint.entry) {
180
+ initialRoutes = getRoutes({
181
+ entrypoint,
182
+ srcDirectory,
183
+ srcAlias: internalSrcAlias,
184
+ internalDirectory,
185
+ internalDirAlias
186
+ });
187
+ }
188
+ if (entrypoint.nestedRoutesEntry) {
189
+ if (!islegacy) {
190
+ nestedRoute = yield (0, import_nestedRoutes.walk)(
191
+ entrypoint.nestedRoutesEntry,
192
+ entrypoint.nestedRoutesEntry,
193
+ {
194
+ name: internalSrcAlias,
195
+ basename: srcDirectory
196
+ },
197
+ entrypoint.entryName
198
+ );
199
+ if (nestedRoute) {
200
+ initialRoutes.unshift(nestedRoute);
201
+ }
202
+ } else {
203
+ import_utils.logger.error("Nested routes is not supported in legacy mode.");
204
+ process.exit(1);
205
+ }
206
+ }
207
+ const { routes } = yield hookRunners.modifyFileSystemRoutes({
143
208
  entrypoint,
144
- srcDirectory,
145
- srcAlias: internalSrcAlias,
146
- internalDirectory,
147
- internalDirAlias
209
+ routes: initialRoutes
148
210
  });
149
- }
150
- if (entrypoint.nestedRoutesEntry) {
151
- if (!islegacy) {
152
- nestedRoute = await (0, _nestedRoutes.walk)(entrypoint.nestedRoutesEntry, entrypoint.nestedRoutesEntry, {
153
- name: internalSrcAlias,
154
- basename: srcDirectory
155
- }, entrypoint.entryName);
156
- if (nestedRoute) {
157
- initialRoutes.unshift(nestedRoute);
158
- }
211
+ const config2 = (0, import_core.useResolvedConfigContext)();
212
+ const ssr = (0, import_utils.getEntryOptions)(
213
+ entryName,
214
+ config2.server.ssr,
215
+ config2.server.ssrByEntries,
216
+ packageName
217
+ );
218
+ let mode;
219
+ if (ssr) {
220
+ mode = typeof ssr === "object" ? ssr.mode || "string" : "string";
159
221
  } else {
160
- _utils.logger.error('Nested routes is not supported in legacy mode.');
161
- // eslint-disable-next-line no-process-exit
162
- process.exit(1);
222
+ mode = false;
163
223
  }
164
- }
165
- const {
166
- routes
167
- } = await hookRunners.modifyFileSystemRoutes({
168
- entrypoint,
169
- routes: initialRoutes
170
- });
171
- const config = (0, _core.useResolvedConfigContext)();
172
- const ssr = config === null || config === void 0 ? void 0 : config.server.ssr;
173
- let mode;
174
- if (ssr) {
175
- mode = typeof ssr === 'object' ? ssr.mode || 'string' : 'string';
176
- } else {
177
- mode = false;
178
- }
179
- if (mode === 'stream') {
180
- const hasPageRoute = routes.some(route => 'type' in route && route.type === 'page');
181
- if (hasPageRoute) {
182
- _utils.logger.error('streaming ssr is not supported when pages dir exists');
183
- // eslint-disable-next-line no-process-exit
184
- process.exit(1);
224
+ if (mode === "stream") {
225
+ const hasPageRoute = routes.some(
226
+ (route) => "type" in route && route.type === "page"
227
+ );
228
+ if (hasPageRoute) {
229
+ import_utils.logger.error(
230
+ "Streaming ssr is not supported when pages dir exists"
231
+ );
232
+ process.exit(1);
233
+ }
234
+ }
235
+ const { code: code2 } = yield hookRunners.beforeGenerateRoutes({
236
+ entrypoint,
237
+ code: yield templates.fileSystemRoutes({
238
+ routes,
239
+ ssrMode: mode,
240
+ nestedRoutesEntry: entrypoint.nestedRoutesEntry,
241
+ entryName: entrypoint.entryName,
242
+ internalDirectory
243
+ })
244
+ });
245
+ if (entrypoint.nestedRoutesEntry) {
246
+ const routesServerFile = import_path.default.join(
247
+ internalDirectory,
248
+ entryName,
249
+ "route-server-loaders.js"
250
+ );
251
+ const outputRoutesServerFile = import_path.default.join(
252
+ distDirectory,
253
+ import_utils.LOADER_ROUTES_DIR,
254
+ entryName,
255
+ "index.js"
256
+ );
257
+ const code3 = templates.routesForServer({
258
+ routes,
259
+ internalDirectory,
260
+ entryName
261
+ });
262
+ yield import_utils.fs.ensureFile(routesServerFile);
263
+ yield import_utils.fs.writeFile(routesServerFile, code3);
264
+ const loaderEntryFile = import_path.default.join(
265
+ internalDirectory,
266
+ entryName,
267
+ import_constants.TEMP_LOADERS_DIR,
268
+ "entry.js"
269
+ );
270
+ const loaderIndexFile = import_path.default.join(
271
+ internalDirectory,
272
+ entryName,
273
+ import_constants.TEMP_LOADERS_DIR,
274
+ "index.js"
275
+ );
276
+ if (yield import_utils.fs.pathExists(loaderEntryFile)) {
277
+ yield buildLoader(loaderEntryFile, loaderIndexFile);
278
+ }
279
+ if (yield import_utils.fs.pathExists(routesServerFile)) {
280
+ yield buildServerLoader(routesServerFile, outputRoutesServerFile);
281
+ }
185
282
  }
283
+ import_utils.fs.outputFileSync(
284
+ import_path.default.resolve(
285
+ internalDirectory,
286
+ `./${entryName}/${import_constants.FILE_SYSTEM_ROUTES_FILE_NAME}`
287
+ ),
288
+ code2,
289
+ "utf8"
290
+ );
186
291
  }
187
- const {
188
- code
189
- } = await hookRunners.beforeGenerateRoutes({
292
+ const { imports: importStatements } = yield hookRunners.modifyEntryImports({
190
293
  entrypoint,
191
- code: templates.fileSystemRoutes({
192
- routes,
193
- ssrMode: mode,
194
- nestedRoutesEntry: entrypoint.nestedRoutesEntry,
195
- entryName: entrypoint.entryName
294
+ imports: (0, import_utils2.getDefaultImports)({
295
+ entrypoint,
296
+ srcDirectory,
297
+ internalSrcAlias,
298
+ internalDirAlias,
299
+ internalDirectory
196
300
  })
197
301
  });
198
-
199
- // extract nested router loaders
200
- if (entrypoint.nestedRoutesEntry) {
201
- const routesServerFile = _path.default.join(internalDirectory, entryName, 'routes.server.js');
202
- const outputRoutesServerFile = _path.default.join(distDirectory, 'loader-routes', entryName, 'index.js');
203
- const code = templates.routesForServer({
204
- routes: routes,
205
- alias: {
206
- name: internalSrcAlias,
207
- basename: srcDirectory
208
- }
209
- });
210
- await _utils.fs.ensureFile(routesServerFile);
211
- await _utils.fs.writeFile(routesServerFile, code);
212
- await buildLoader(routesServerFile, outputRoutesServerFile);
213
- }
214
- _utils.fs.outputFileSync(_path.default.resolve(internalDirectory, `./${entryName}/${_constants.FILE_SYSTEM_ROUTES_FILE_NAME}`), code, 'utf8');
215
- }
216
-
217
- // call modifyEntryImports hook
218
- const {
219
- imports: importStatements
220
- } = await hookRunners.modifyEntryImports({
221
- entrypoint,
222
- imports: (0, _utils2.getDefaultImports)({
302
+ const { plugins } = yield hookRunners.modifyEntryRuntimePlugins({
223
303
  entrypoint,
224
- srcDirectory,
225
- internalSrcAlias,
226
- internalDirAlias,
227
- internalDirectory
228
- })
229
- });
230
-
231
- // call modifyEntryRuntimePlugins hook
232
- const {
233
- plugins
234
- } = await hookRunners.modifyEntryRuntimePlugins({
235
- entrypoint,
236
- plugins: []
237
- });
238
-
239
- // call modifyEntryRenderFunction hook
240
- const {
241
- code: renderFunction
242
- } = await hookRunners.modifyEntryRenderFunction({
243
- entrypoint,
244
- code: templates.renderFunction({
245
- plugins,
246
- customBootstrap,
247
- fileSystemRoutes
248
- })
249
- });
250
-
251
- // call modifyEntryExport hook
252
- const {
253
- exportStatement
254
- } = await hookRunners.modifyEntryExport({
255
- entrypoint,
256
- exportStatement: 'export default AppWrapper;'
257
- });
258
- const code = templates.index({
259
- mountId: mountId,
260
- imports: createImportStatements(importStatements),
261
- renderFunction,
262
- exportStatement
263
- });
264
- const entryFile = _path.default.resolve(internalDirectory, `./${entryName}/${_constants.ENTRY_POINT_FILE_NAME}`);
265
- entrypoint.entry = entryFile;
266
-
267
- // generate entry file.
268
- if (config.source.enableAsyncEntry) {
269
- const {
270
- code: asyncEntryCode
271
- } = await hookRunners.modifyAsyncEntry({
304
+ plugins: []
305
+ });
306
+ const { code: renderFunction } = yield hookRunners.modifyEntryRenderFunction({
307
+ entrypoint,
308
+ code: templates.renderFunction({
309
+ plugins,
310
+ customBootstrap,
311
+ fileSystemRoutes
312
+ })
313
+ });
314
+ const { exportStatement } = yield hookRunners.modifyEntryExport({
272
315
  entrypoint,
273
- code: `import('./${_constants.ENTRY_BOOTSTRAP_FILE_NAME}');`
316
+ exportStatement: "export default AppWrapper;"
274
317
  });
275
- _utils.fs.outputFileSync(entryFile, asyncEntryCode, 'utf8');
276
- const bootstrapFile = _path.default.resolve(internalDirectory, `./${entryName}/${_constants.ENTRY_BOOTSTRAP_FILE_NAME}`);
277
- _utils.fs.outputFileSync(bootstrapFile, code, 'utf8');
278
- } else {
279
- _utils.fs.outputFileSync(entryFile, code, 'utf8');
318
+ const code = templates.index({
319
+ mountId,
320
+ imports: createImportStatements(importStatements),
321
+ renderFunction,
322
+ exportStatement
323
+ });
324
+ const entryFile = import_path.default.resolve(
325
+ internalDirectory,
326
+ `./${entryName}/${import_constants.ENTRY_POINT_FILE_NAME}`
327
+ );
328
+ entrypoint.entry = entryFile;
329
+ if (config.source.enableAsyncEntry) {
330
+ const { code: asyncEntryCode } = yield hookRunners.modifyAsyncEntry({
331
+ entrypoint,
332
+ code: `import('./${import_constants.ENTRY_BOOTSTRAP_FILE_NAME}');`
333
+ });
334
+ import_utils.fs.outputFileSync(entryFile, asyncEntryCode, "utf8");
335
+ const bootstrapFile = import_path.default.resolve(
336
+ internalDirectory,
337
+ `./${entryName}/${import_constants.ENTRY_BOOTSTRAP_FILE_NAME}`
338
+ );
339
+ import_utils.fs.outputFileSync(bootstrapFile, code, "utf8");
340
+ } else {
341
+ import_utils.fs.outputFileSync(entryFile, code, "utf8");
342
+ }
280
343
  }
281
- }
344
+ });
282
345
  }
283
- };
284
- exports.generateCode = generateCode;
346
+ });