@modern-js/app-tools 2.4.0 → 2.5.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 (302) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/dist/{js/node → cjs}/analyze/constants.js +0 -0
  3. package/dist/cjs/analyze/generateCode.js +249 -0
  4. package/dist/{js/node → cjs}/analyze/getBundleEntry.js +6 -0
  5. package/dist/{js/node → cjs}/analyze/getClientRoutes/getRoutes.js +1 -18
  6. package/dist/{js/node → cjs}/analyze/getClientRoutes/getRoutesLegacy.js +1 -18
  7. package/dist/{js/node → cjs}/analyze/getClientRoutes/index.js +0 -0
  8. package/dist/{js/node → cjs}/analyze/getClientRoutes/utils.js +0 -0
  9. package/dist/{js/node → cjs}/analyze/getFileSystemEntry.js +0 -0
  10. package/dist/{js/node → cjs}/analyze/getHtmlTemplate.js +4 -24
  11. package/dist/{js/node → cjs}/analyze/getServerRoutes.js +22 -42
  12. package/dist/cjs/analyze/index.js +290 -0
  13. package/dist/{js/node → cjs}/analyze/isDefaultExportFunction.js +0 -0
  14. package/dist/{js/node → cjs}/analyze/makeLegalIdentifier.js +0 -0
  15. package/dist/{js/node → cjs}/analyze/nestedRoutes.js +16 -50
  16. package/dist/{js/node → cjs}/analyze/templates.js +16 -49
  17. package/dist/{js/node → cjs}/analyze/utils.js +9 -29
  18. package/dist/{js/node → cjs}/builder/builder-rspack/index.js +0 -0
  19. package/dist/{js/node → cjs}/builder/builder-webpack/builderPlugins/compatModern.js +0 -0
  20. package/dist/{js/node → cjs}/builder/builder-webpack/index.js +22 -62
  21. package/dist/{js/node → cjs}/builder/builder-webpack/webpackPlugins/RouterPlugin.js +7 -24
  22. package/dist/{js/node → cjs}/builder/builder-webpack/webpackPlugins/index.js +0 -0
  23. package/dist/{js/node → cjs}/builder/generator/createBuilderOptions.js +0 -0
  24. package/dist/{js/node → cjs}/builder/generator/createBuilderProviderConfig.js +14 -25
  25. package/dist/{js/node → cjs}/builder/generator/getBuilderTargets.js +4 -0
  26. package/dist/cjs/builder/generator/index.js +58 -0
  27. package/dist/{js/node → cjs}/builder/index.js +12 -34
  28. package/dist/{js/node → cjs}/builder/shared/builderPlugins/adapterModern.js +35 -34
  29. package/dist/{js/node → cjs}/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -0
  30. package/dist/{js/node → cjs}/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -0
  31. package/dist/{js/node → cjs}/builder/shared/createCopyPattern.js +0 -0
  32. package/dist/{js/node → cjs}/builder/shared/index.js +0 -0
  33. package/dist/{js/node → cjs}/builder/shared/loaders/serverModuleLoader.js +0 -0
  34. package/dist/{js/node → cjs}/builder/shared/types.js +0 -0
  35. package/dist/{js/node → cjs}/commands/build.js +9 -46
  36. package/dist/cjs/commands/deploy.js +31 -0
  37. package/dist/{js/node → cjs}/commands/dev.js +17 -52
  38. package/dist/{js/node → cjs}/commands/index.js +0 -0
  39. package/dist/{js/node → cjs}/commands/inspect.js +2 -22
  40. package/dist/{js/node → cjs}/commands/serve.js +8 -28
  41. package/dist/{js/node → cjs}/config/default.js +15 -26
  42. package/dist/{js/node → cjs}/config/index.js +0 -0
  43. package/dist/{js/node → cjs}/config/initialize/index.js +0 -0
  44. package/dist/{js/node → cjs}/config/initialize/inits.js +4 -20
  45. package/dist/{js/node → cjs}/config/legacy/createHtmlConfig.js +0 -0
  46. package/dist/{js/node → cjs}/config/legacy/createOutputConfig.js +0 -0
  47. package/dist/{js/node → cjs}/config/legacy/createSourceConfig.js +0 -0
  48. package/dist/{js/node → cjs}/config/legacy/createToolsConfig.js +0 -0
  49. package/dist/{js/node → cjs}/config/legacy/index.js +0 -0
  50. package/dist/cjs/defineConfig.js +33 -0
  51. package/dist/{js/node → cjs}/exports/server.js +0 -0
  52. package/dist/{js/node → cjs}/hooks.js +0 -0
  53. package/dist/cjs/index.js +198 -0
  54. package/dist/cjs/initialize/index.js +102 -0
  55. package/dist/{js/node → cjs}/locale/en.js +0 -0
  56. package/dist/{js/node → cjs}/locale/index.js +0 -0
  57. package/dist/{js/node → cjs}/locale/zh.js +0 -0
  58. package/dist/{js/node → cjs}/schema/Schema.js +0 -0
  59. package/dist/{js/node → cjs}/schema/index.js +0 -0
  60. package/dist/{js/node → cjs}/schema/legacy.js +0 -0
  61. package/dist/{js/node → cjs}/types/config/deploy.js +0 -0
  62. package/dist/{js/node → cjs}/types/config/dev.js +0 -0
  63. package/dist/{js/node → cjs}/types/config/experiments.js +0 -0
  64. package/dist/{js/node → cjs}/types/config/html.js +0 -0
  65. package/dist/{js/node → cjs}/types/config/index.js +0 -0
  66. package/dist/{js/node → cjs}/types/config/output.js +0 -0
  67. package/dist/{js/node → cjs}/types/config/performance.js +0 -0
  68. package/dist/{js/node → cjs}/types/config/security.js +0 -0
  69. package/dist/{js/node → cjs}/types/config/source.js +0 -0
  70. package/dist/{js/node → cjs}/types/config/tools.js +0 -0
  71. package/dist/{js/node → cjs}/types/hooks.js +0 -0
  72. package/dist/{js/node → cjs}/types/index.js +0 -0
  73. package/dist/{js/node → cjs}/types/legacyConfig/deploy.js +0 -0
  74. package/dist/{js/node → cjs}/types/legacyConfig/dev.js +0 -0
  75. package/dist/{js/node → cjs}/types/legacyConfig/index.js +0 -0
  76. package/dist/{js/node → cjs}/types/legacyConfig/output.js +0 -0
  77. package/dist/{js/node → cjs}/types/legacyConfig/source.js +0 -0
  78. package/dist/{js/node → cjs}/types/legacyConfig/tools.js +0 -0
  79. package/dist/{js/node → cjs}/types/utils.js +0 -0
  80. package/dist/{js/node → cjs}/utils/config.js +19 -57
  81. package/dist/{js/node → cjs}/utils/createServer.js +10 -46
  82. package/dist/{js/node → cjs}/utils/env.js +0 -0
  83. package/dist/{js/node → cjs}/utils/generateWatchFiles.js +16 -38
  84. package/dist/{js/node → cjs}/utils/getSelectedEntries.js +3 -23
  85. package/dist/cjs/utils/getServerInternalPlugins.js +41 -0
  86. package/dist/{js/node → cjs}/utils/language.js +0 -0
  87. package/dist/{js/node → cjs}/utils/printInstructions.js +3 -23
  88. package/dist/cjs/utils/restart.js +45 -0
  89. package/dist/{js/node → cjs}/utils/routes.js +3 -23
  90. package/dist/{js/node → cjs}/utils/types.js +0 -0
  91. package/dist/{js/treeshaking → esm}/analyze/constants.js +0 -0
  92. package/dist/{js/treeshaking → esm}/analyze/generateCode.js +14 -14
  93. package/dist/{js/treeshaking → esm}/analyze/getBundleEntry.js +4 -2
  94. package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/getRoutes.js +1 -1
  95. package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/getRoutesLegacy.js +1 -1
  96. package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/index.js +0 -0
  97. package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/utils.js +0 -0
  98. package/dist/{js/treeshaking → esm}/analyze/getFileSystemEntry.js +1 -1
  99. package/dist/{js/treeshaking → esm}/analyze/getHtmlTemplate.js +0 -0
  100. package/dist/{js/treeshaking → esm}/analyze/getServerRoutes.js +8 -6
  101. package/dist/{js/treeshaking → esm}/analyze/index.js +8 -8
  102. package/dist/{js/treeshaking → esm}/analyze/isDefaultExportFunction.js +0 -0
  103. package/dist/{js/treeshaking → esm}/analyze/makeLegalIdentifier.js +0 -0
  104. package/dist/{js/treeshaking → esm}/analyze/nestedRoutes.js +5 -5
  105. package/dist/{js/treeshaking → esm}/analyze/templates.js +8 -7
  106. package/dist/{js/treeshaking → esm}/analyze/utils.js +3 -3
  107. package/dist/{js/treeshaking → esm}/builder/builder-rspack/index.js +0 -0
  108. package/dist/{js/treeshaking → esm}/builder/builder-webpack/builderPlugins/compatModern.js +4 -4
  109. package/dist/{js/treeshaking → esm}/builder/builder-webpack/index.js +2 -2
  110. package/dist/{js/treeshaking → esm}/builder/builder-webpack/webpackPlugins/RouterPlugin.js +5 -2
  111. package/dist/{js/treeshaking → esm}/builder/builder-webpack/webpackPlugins/index.js +0 -0
  112. package/dist/{js/treeshaking → esm}/builder/generator/createBuilderOptions.js +2 -2
  113. package/dist/{js/treeshaking → esm}/builder/generator/createBuilderProviderConfig.js +0 -0
  114. package/dist/{js/treeshaking → esm}/builder/generator/getBuilderTargets.js +5 -1
  115. package/dist/{js/treeshaking → esm}/builder/generator/index.js +2 -2
  116. package/dist/{js/treeshaking → esm}/builder/index.js +0 -0
  117. package/dist/{js/treeshaking → esm}/builder/shared/builderPlugins/adapterModern.js +62 -13
  118. package/dist/{js/treeshaking → esm}/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -0
  119. package/dist/{js/treeshaking → esm}/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +2 -2
  120. package/dist/{js/treeshaking → esm}/builder/shared/createCopyPattern.js +0 -0
  121. package/dist/{js/treeshaking → esm}/builder/shared/index.js +0 -0
  122. package/dist/{js/treeshaking → esm}/builder/shared/loaders/serverModuleLoader.js +0 -0
  123. package/dist/{js/treeshaking → esm}/builder/shared/types.js +0 -0
  124. package/dist/{js/treeshaking → esm}/commands/build.js +0 -0
  125. package/dist/{js/treeshaking → esm}/commands/deploy.js +0 -0
  126. package/dist/{js/treeshaking → esm}/commands/dev.js +2 -2
  127. package/dist/{js/treeshaking → esm}/commands/index.js +0 -0
  128. package/dist/{js/treeshaking → esm}/commands/inspect.js +0 -0
  129. package/dist/{js/treeshaking → esm}/commands/serve.js +2 -2
  130. package/dist/{js/treeshaking → esm}/config/default.js +0 -0
  131. package/dist/{js/treeshaking → esm}/config/index.js +0 -0
  132. package/dist/{js/treeshaking → esm}/config/initialize/index.js +0 -0
  133. package/dist/{js/treeshaking → esm}/config/initialize/inits.js +2 -2
  134. package/dist/esm/config/legacy/createHtmlConfig.js +19 -0
  135. package/dist/{js/treeshaking → esm}/config/legacy/createOutputConfig.js +1 -1
  136. package/dist/{js/treeshaking → esm}/config/legacy/createSourceConfig.js +1 -1
  137. package/dist/{js/treeshaking → esm}/config/legacy/createToolsConfig.js +1 -1
  138. package/dist/{js/treeshaking → esm}/config/legacy/index.js +0 -0
  139. package/dist/{js/treeshaking → esm}/defineConfig.js +0 -0
  140. package/dist/{js/treeshaking → esm}/exports/server.js +0 -0
  141. package/dist/{js/treeshaking → esm}/hooks.js +0 -0
  142. package/dist/{js/treeshaking → esm}/index.js +0 -0
  143. package/dist/{js/treeshaking → esm}/initialize/index.js +2 -2
  144. package/dist/{js/treeshaking → esm}/locale/en.js +0 -0
  145. package/dist/{js/treeshaking → esm}/locale/index.js +0 -0
  146. package/dist/{js/treeshaking → esm}/locale/zh.js +0 -0
  147. package/dist/{js/treeshaking → esm}/schema/Schema.js +0 -0
  148. package/dist/{js/treeshaking → esm}/schema/index.js +0 -0
  149. package/dist/{js/treeshaking → esm}/schema/legacy.js +0 -0
  150. package/dist/{js/treeshaking → esm}/types/config/deploy.js +0 -0
  151. package/dist/{js/treeshaking → esm}/types/config/dev.js +0 -0
  152. package/dist/{js/treeshaking → esm}/types/config/experiments.js +0 -0
  153. package/dist/{js/treeshaking → esm}/types/config/html.js +0 -0
  154. package/dist/{js/treeshaking → esm}/types/config/index.js +0 -0
  155. package/dist/{js/treeshaking → esm}/types/config/output.js +0 -0
  156. package/dist/{js/treeshaking → esm}/types/config/performance.js +0 -0
  157. package/dist/{js/treeshaking → esm}/types/config/security.js +0 -0
  158. package/dist/{js/treeshaking → esm}/types/config/source.js +0 -0
  159. package/dist/{js/treeshaking → esm}/types/config/tools.js +0 -0
  160. package/dist/{js/treeshaking → esm}/types/hooks.js +0 -0
  161. package/dist/{js/treeshaking → esm}/types/index.js +0 -0
  162. package/dist/{js/treeshaking → esm}/types/legacyConfig/deploy.js +0 -0
  163. package/dist/{js/treeshaking → esm}/types/legacyConfig/dev.js +0 -0
  164. package/dist/{js/treeshaking → esm}/types/legacyConfig/index.js +0 -0
  165. package/dist/{js/treeshaking → esm}/types/legacyConfig/output.js +0 -0
  166. package/dist/{js/treeshaking → esm}/types/legacyConfig/source.js +0 -0
  167. package/dist/{js/treeshaking → esm}/types/legacyConfig/tools.js +0 -0
  168. package/dist/{js/treeshaking → esm}/types/utils.js +0 -0
  169. package/dist/{js/treeshaking → esm}/utils/config.js +2 -2
  170. package/dist/{js/treeshaking → esm}/utils/createServer.js +0 -0
  171. package/dist/{js/treeshaking → esm}/utils/env.js +0 -0
  172. package/dist/{js/treeshaking → esm}/utils/generateWatchFiles.js +0 -0
  173. package/dist/{js/treeshaking → esm}/utils/getSelectedEntries.js +0 -0
  174. package/dist/{js/treeshaking → esm}/utils/getServerInternalPlugins.js +2 -2
  175. package/dist/{js/treeshaking → esm}/utils/language.js +0 -0
  176. package/dist/{js/treeshaking → esm}/utils/printInstructions.js +0 -0
  177. package/dist/{js/treeshaking → esm}/utils/restart.js +0 -0
  178. package/dist/{js/treeshaking → esm}/utils/routes.js +0 -0
  179. package/dist/{js/treeshaking → esm}/utils/types.js +0 -0
  180. package/dist/{js/modern → esm-node}/analyze/constants.js +0 -0
  181. package/dist/esm-node/analyze/generateCode.js +225 -0
  182. package/dist/{js/modern → esm-node}/analyze/getBundleEntry.js +6 -0
  183. package/dist/{js/modern → esm-node}/analyze/getClientRoutes/getRoutes.js +1 -20
  184. package/dist/{js/modern → esm-node}/analyze/getClientRoutes/getRoutesLegacy.js +1 -20
  185. package/dist/{js/modern → esm-node}/analyze/getClientRoutes/index.js +0 -0
  186. package/dist/{js/modern → esm-node}/analyze/getClientRoutes/utils.js +0 -0
  187. package/dist/{js/modern → esm-node}/analyze/getFileSystemEntry.js +0 -0
  188. package/dist/{js/modern → esm-node}/analyze/getHtmlTemplate.js +4 -24
  189. package/dist/{js/modern → esm-node}/analyze/getServerRoutes.js +24 -45
  190. package/dist/esm-node/analyze/index.js +281 -0
  191. package/dist/{js/modern → esm-node}/analyze/isDefaultExportFunction.js +0 -0
  192. package/dist/{js/modern → esm-node}/analyze/makeLegalIdentifier.js +0 -0
  193. package/dist/{js/modern → esm-node}/analyze/nestedRoutes.js +16 -52
  194. package/dist/{js/modern → esm-node}/analyze/templates.js +16 -51
  195. package/dist/{js/modern → esm-node}/analyze/utils.js +9 -29
  196. package/dist/{js/modern → esm-node}/builder/builder-rspack/index.js +0 -0
  197. package/dist/{js/modern → esm-node}/builder/builder-webpack/builderPlugins/compatModern.js +0 -0
  198. package/dist/esm-node/builder/builder-webpack/index.js +51 -0
  199. package/dist/{js/modern → esm-node}/builder/builder-webpack/webpackPlugins/RouterPlugin.js +7 -24
  200. package/dist/{js/modern → esm-node}/builder/builder-webpack/webpackPlugins/index.js +0 -0
  201. package/dist/{js/modern → esm-node}/builder/generator/createBuilderOptions.js +0 -0
  202. package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +26 -0
  203. package/dist/{js/modern → esm-node}/builder/generator/getBuilderTargets.js +10 -1
  204. package/dist/esm-node/builder/generator/index.js +29 -0
  205. package/dist/esm-node/builder/index.js +17 -0
  206. package/dist/{js/modern → esm-node}/builder/shared/builderPlugins/adapterModern.js +35 -36
  207. package/dist/{js/modern → esm-node}/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -0
  208. package/dist/{js/modern → esm-node}/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -0
  209. package/dist/{js/modern → esm-node}/builder/shared/createCopyPattern.js +0 -0
  210. package/dist/{js/modern → esm-node}/builder/shared/index.js +0 -0
  211. package/dist/{js/modern → esm-node}/builder/shared/loaders/serverModuleLoader.js +0 -0
  212. package/dist/{js/modern → esm-node}/builder/shared/types.js +0 -0
  213. package/dist/esm-node/commands/build.js +52 -0
  214. package/dist/esm-node/commands/deploy.js +8 -0
  215. package/dist/esm-node/commands/dev.js +72 -0
  216. package/dist/{js/modern → esm-node}/commands/index.js +0 -0
  217. package/dist/esm-node/commands/inspect.js +18 -0
  218. package/dist/{js/modern → esm-node}/commands/serve.js +8 -28
  219. package/dist/{js/modern → esm-node}/config/default.js +15 -28
  220. package/dist/{js/modern → esm-node}/config/index.js +0 -0
  221. package/dist/{js/modern → esm-node}/config/initialize/index.js +0 -0
  222. package/dist/{js/modern → esm-node}/config/initialize/inits.js +4 -22
  223. package/dist/{js/modern → esm-node}/config/legacy/createHtmlConfig.js +0 -0
  224. package/dist/{js/modern → esm-node}/config/legacy/createOutputConfig.js +0 -0
  225. package/dist/{js/modern → esm-node}/config/legacy/createSourceConfig.js +0 -0
  226. package/dist/{js/modern → esm-node}/config/legacy/createToolsConfig.js +0 -0
  227. package/dist/{js/modern → esm-node}/config/legacy/index.js +0 -0
  228. package/dist/esm-node/defineConfig.js +9 -0
  229. package/dist/{js/modern → esm-node}/exports/server.js +0 -0
  230. package/dist/{js/modern → esm-node}/hooks.js +0 -0
  231. package/dist/esm-node/index.js +172 -0
  232. package/dist/esm-node/initialize/index.js +91 -0
  233. package/dist/{js/modern → esm-node}/locale/en.js +0 -0
  234. package/dist/{js/modern → esm-node}/locale/index.js +0 -0
  235. package/dist/{js/modern → esm-node}/locale/zh.js +0 -0
  236. package/dist/{js/modern → esm-node}/schema/Schema.js +0 -0
  237. package/dist/{js/modern → esm-node}/schema/index.js +0 -0
  238. package/dist/{js/modern → esm-node}/schema/legacy.js +0 -0
  239. package/dist/{js/modern → esm-node}/types/config/deploy.js +0 -0
  240. package/dist/{js/modern → esm-node}/types/config/dev.js +0 -0
  241. package/dist/{js/modern → esm-node}/types/config/experiments.js +0 -0
  242. package/dist/{js/modern → esm-node}/types/config/html.js +0 -0
  243. package/dist/{js/modern → esm-node}/types/config/index.js +0 -0
  244. package/dist/{js/modern → esm-node}/types/config/output.js +0 -0
  245. package/dist/{js/modern → esm-node}/types/config/performance.js +0 -0
  246. package/dist/{js/modern → esm-node}/types/config/security.js +0 -0
  247. package/dist/{js/modern → esm-node}/types/config/source.js +0 -0
  248. package/dist/{js/modern → esm-node}/types/config/tools.js +0 -0
  249. package/dist/{js/modern → esm-node}/types/hooks.js +0 -0
  250. package/dist/{js/modern → esm-node}/types/index.js +0 -0
  251. package/dist/{js/modern → esm-node}/types/legacyConfig/deploy.js +0 -0
  252. package/dist/{js/modern → esm-node}/types/legacyConfig/dev.js +0 -0
  253. package/dist/{js/modern → esm-node}/types/legacyConfig/index.js +0 -0
  254. package/dist/{js/modern → esm-node}/types/legacyConfig/output.js +0 -0
  255. package/dist/{js/modern → esm-node}/types/legacyConfig/source.js +0 -0
  256. package/dist/{js/modern → esm-node}/types/legacyConfig/tools.js +0 -0
  257. package/dist/{js/modern → esm-node}/types/utils.js +0 -0
  258. package/dist/esm-node/utils/config.js +88 -0
  259. package/dist/esm-node/utils/createServer.js +37 -0
  260. package/dist/{js/modern → esm-node}/utils/env.js +0 -0
  261. package/dist/esm-node/utils/generateWatchFiles.js +33 -0
  262. package/dist/{js/modern → esm-node}/utils/getSelectedEntries.js +3 -23
  263. package/dist/esm-node/utils/getServerInternalPlugins.js +18 -0
  264. package/dist/{js/modern → esm-node}/utils/language.js +0 -0
  265. package/dist/esm-node/utils/printInstructions.js +11 -0
  266. package/dist/esm-node/utils/restart.js +22 -0
  267. package/dist/esm-node/utils/routes.js +10 -0
  268. package/dist/{js/modern → esm-node}/utils/types.js +0 -0
  269. package/dist/types/types/config/tools.d.ts +1 -1
  270. package/dist/types/types/hooks.d.ts +5 -4
  271. package/dist/types/types/index.d.ts +3 -1
  272. package/package.json +30 -31
  273. package/dist/js/modern/analyze/generateCode.js +0 -247
  274. package/dist/js/modern/analyze/index.js +0 -329
  275. package/dist/js/modern/builder/builder-webpack/index.js +0 -93
  276. package/dist/js/modern/builder/generator/createBuilderProviderConfig.js +0 -39
  277. package/dist/js/modern/builder/generator/index.js +0 -53
  278. package/dist/js/modern/builder/index.js +0 -39
  279. package/dist/js/modern/commands/build.js +0 -91
  280. package/dist/js/modern/commands/deploy.js +0 -28
  281. package/dist/js/modern/commands/dev.js +0 -109
  282. package/dist/js/modern/commands/inspect.js +0 -38
  283. package/dist/js/modern/defineConfig.js +0 -27
  284. package/dist/js/modern/index.js +0 -221
  285. package/dist/js/modern/initialize/index.js +0 -132
  286. package/dist/js/modern/utils/config.js +0 -128
  287. package/dist/js/modern/utils/createServer.js +0 -75
  288. package/dist/js/modern/utils/generateWatchFiles.js +0 -55
  289. package/dist/js/modern/utils/getServerInternalPlugins.js +0 -58
  290. package/dist/js/modern/utils/printInstructions.js +0 -31
  291. package/dist/js/modern/utils/restart.js +0 -44
  292. package/dist/js/modern/utils/routes.js +0 -30
  293. package/dist/js/node/analyze/generateCode.js +0 -271
  294. package/dist/js/node/analyze/index.js +0 -336
  295. package/dist/js/node/builder/generator/index.js +0 -82
  296. package/dist/js/node/commands/deploy.js +0 -51
  297. package/dist/js/node/defineConfig.js +0 -49
  298. package/dist/js/node/index.js +0 -245
  299. package/dist/js/node/initialize/index.js +0 -141
  300. package/dist/js/node/utils/getServerInternalPlugins.js +0 -79
  301. package/dist/js/node/utils/restart.js +0 -67
  302. package/dist/js/treeshaking/config/legacy/createHtmlConfig.js +0 -19
@@ -0,0 +1,102 @@
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 initialize_exports = {};
19
+ __export(initialize_exports, {
20
+ default: () => initialize_default
21
+ });
22
+ module.exports = __toCommonJS(initialize_exports);
23
+ var import_utils = require("@modern-js/utils");
24
+ var import_schema = require("../schema");
25
+ var import_config = require("../config");
26
+ var initialize_default = ({
27
+ bundler
28
+ }) => ({
29
+ name: "@modern-js/plugin-initialize",
30
+ setup(api) {
31
+ const config = () => {
32
+ const appContext = api.useAppContext();
33
+ const userConfig = api.useConfigContext();
34
+ return (0, import_config.checkIsLegacyConfig)(userConfig) ? (0, import_config.createLegacyDefaultConfig)(appContext) : (0, import_config.createDefaultConfig)(appContext, bundler);
35
+ };
36
+ const validateSchema = () => {
37
+ const userConfig = api.useConfigContext();
38
+ const schemas = (0, import_config.checkIsLegacyConfig)(userConfig) ? import_schema.legacySchema : import_schema.schema;
39
+ return schemas.generate();
40
+ };
41
+ return {
42
+ config,
43
+ validateSchema,
44
+ async resolvedConfig({ resolved }) {
45
+ var _a;
46
+ let appContext = api.useAppContext();
47
+ const userConfig = api.useConfigContext();
48
+ const port = await getServerPort(resolved);
49
+ appContext = {
50
+ ...appContext,
51
+ port,
52
+ distDirectory: (0, import_utils.ensureAbsolutePath)(
53
+ appContext.distDirectory,
54
+ ((_a = resolved.output.distPath) == null ? void 0 : _a.root) || "dist"
55
+ )
56
+ };
57
+ api.setAppContext(appContext);
58
+ const normalizedConfig = (0, import_config.checkIsLegacyConfig)(resolved) ? (0, import_config.transformNormalizedConfig)(resolved) : resolved;
59
+ resolved._raw = userConfig;
60
+ resolved.server = {
61
+ ...normalizedConfig.server || {},
62
+ port
63
+ };
64
+ resolved.autoLoadPlugins = normalizedConfig.autoLoadPlugins || false;
65
+ stabilizeConfig(resolved, normalizedConfig, [
66
+ "source",
67
+ "bff",
68
+ "dev",
69
+ "html",
70
+ "output",
71
+ "tools",
72
+ "testing",
73
+ "plugins",
74
+ "builderPlugins",
75
+ "runtime",
76
+ "runtimeByEntries",
77
+ "deploy",
78
+ "performance"
79
+ ]);
80
+ if (bundler === "webpack") {
81
+ resolved.security = normalizedConfig.security || {};
82
+ resolved.experiments = normalizedConfig.experiments;
83
+ }
84
+ return { resolved };
85
+ }
86
+ };
87
+ }
88
+ });
89
+ function stabilizeConfig(resolve, config, keys) {
90
+ keys.forEach((key) => {
91
+ resolve[key] = config[key] || {};
92
+ });
93
+ }
94
+ async function getServerPort(config) {
95
+ const prodPort = config.server.port || 8080;
96
+ if ((0, import_utils.isDev)() && (0, import_utils.isDevCommand)()) {
97
+ return (0, import_utils.getPort)(config.dev.port || prodPort);
98
+ }
99
+ return prodPort;
100
+ }
101
+ // Annotate the CommonJS export names for ESM import in node:
102
+ 0 && (module.exports = {});
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,26 +1,9 @@
1
1
  var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
5
  var __getProtoOf = Object.getPrototypeOf;
9
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
7
  var __export = (target, all) => {
25
8
  for (var name in all)
26
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -38,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
38
21
  mod
39
22
  ));
40
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
41
- var __async = (__this, __arguments, generator) => {
42
- return new Promise((resolve, reject) => {
43
- var fulfilled = (value) => {
44
- try {
45
- step(generator.next(value));
46
- } catch (e) {
47
- reject(e);
48
- }
49
- };
50
- var rejected = (value) => {
51
- try {
52
- step(generator.throw(value));
53
- } catch (e) {
54
- reject(e);
55
- }
56
- };
57
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
58
- step((generator = generator.apply(__this, __arguments)).next());
59
- });
60
- };
61
24
  var config_exports = {};
62
25
  __export(config_exports, {
63
26
  buildServerConfig: () => buildServerConfig,
@@ -70,22 +33,20 @@ var path = __toESM(require("path"));
70
33
  var import_node_bundle_require = require("@modern-js/node-bundle-require");
71
34
  var import_utils = require("@modern-js/utils");
72
35
  const defineServerConfig = (config) => config;
73
- const buildServerConfig = (_0) => __async(void 0, [_0], function* ({
36
+ const buildServerConfig = async ({
74
37
  appDirectory,
75
38
  distDirectory,
76
39
  configFile,
77
40
  options
78
- }) {
79
- const configFilePath = yield (0, import_utils.getServerConfig)(appDirectory, configFile);
80
- const getOutputFile = (filepath) => __async(void 0, null, function* () {
81
- return path.resolve(
82
- distDirectory,
83
- `${filepath.replace(
84
- new RegExp(import_utils.CONFIG_FILE_EXTENSIONS.join("|")),
85
- ""
86
- )}.js`
87
- );
88
- });
41
+ }) => {
42
+ const configFilePath = await (0, import_utils.getServerConfig)(appDirectory, configFile);
43
+ const getOutputFile = async (filepath) => path.resolve(
44
+ distDirectory,
45
+ `${filepath.replace(
46
+ new RegExp(import_utils.CONFIG_FILE_EXTENSIONS.join("|")),
47
+ ""
48
+ )}.js`
49
+ );
89
50
  if (configFilePath) {
90
51
  const configHelperFilePath = path.normalize(
91
52
  path.join(distDirectory, "./config-helper.js")
@@ -93,9 +54,10 @@ const buildServerConfig = (_0) => __async(void 0, [_0], function* ({
93
54
  const helperCode = `
94
55
  export const defineConfig = (config) => config;
95
56
  `;
96
- yield import_utils.fs.ensureDir(distDirectory);
97
- yield import_utils.fs.writeFile(configHelperFilePath, helperCode);
98
- yield (0, import_node_bundle_require.bundle)(configFilePath, __spreadProps(__spreadValues({}, options), {
57
+ await import_utils.fs.ensureDir(distDirectory);
58
+ await import_utils.fs.writeFile(configHelperFilePath, helperCode);
59
+ await (0, import_node_bundle_require.bundle)(configFilePath, {
60
+ ...options,
99
61
  getOutputFile,
100
62
  esbuildPlugins: [
101
63
  {
@@ -114,9 +76,9 @@ const buildServerConfig = (_0) => __async(void 0, [_0], function* ({
114
76
  }
115
77
  }
116
78
  ]
117
- }));
79
+ });
118
80
  }
119
- });
81
+ };
120
82
  const safeReplacer = () => {
121
83
  const cache = [];
122
84
  const keyCache = [];
@@ -132,18 +94,18 @@ const safeReplacer = () => {
132
94
  return value;
133
95
  };
134
96
  };
135
- const emitResolvedConfig = (appDirectory, resolvedConfig) => __async(void 0, null, function* () {
97
+ const emitResolvedConfig = async (appDirectory, resolvedConfig) => {
136
98
  var _a;
137
99
  const outputPath = path.join(
138
100
  appDirectory,
139
101
  ((_a = resolvedConfig.output.distPath) == null ? void 0 : _a.root) || "./dist",
140
102
  import_utils.OUTPUT_CONFIG_FILE
141
103
  );
142
- yield import_utils.fs.writeJSON(outputPath, resolvedConfig, {
104
+ await import_utils.fs.writeJSON(outputPath, resolvedConfig, {
143
105
  spaces: 2,
144
106
  replacer: safeReplacer()
145
107
  });
146
- });
108
+ };
147
109
  // Annotate the CommonJS export names for ESM import in node:
148
110
  0 && (module.exports = {
149
111
  buildServerConfig,
@@ -1,26 +1,9 @@
1
1
  var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
5
  var __getProtoOf = Object.getPrototypeOf;
9
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
7
  var __export = (target, all) => {
25
8
  for (var name in all)
26
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -38,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
38
21
  mod
39
22
  ));
40
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
41
- var __async = (__this, __arguments, generator) => {
42
- return new Promise((resolve, reject) => {
43
- var fulfilled = (value) => {
44
- try {
45
- step(generator.next(value));
46
- } catch (e) {
47
- reject(e);
48
- }
49
- };
50
- var rejected = (value) => {
51
- try {
52
- step(generator.throw(value));
53
- } catch (e) {
54
- reject(e);
55
- }
56
- };
57
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
58
- step((generator = generator.apply(__this, __arguments)).next());
59
- });
60
- };
61
24
  var createServer_exports = {};
62
25
  __export(createServer_exports, {
63
26
  closeServer: () => closeServer,
@@ -73,28 +36,29 @@ const getServer = () => server;
73
36
  const setServer = (newServer) => {
74
37
  server = newServer;
75
38
  };
76
- const closeServer = () => __async(void 0, null, function* () {
39
+ const closeServer = async () => {
77
40
  if (server) {
78
- yield server.close();
41
+ await server.close();
79
42
  server = null;
80
43
  }
81
- });
82
- const createServer = (options) => __async(void 0, null, function* () {
44
+ };
45
+ const createServer = async (options) => {
83
46
  if (server) {
84
- yield server.close();
47
+ await server.close();
85
48
  }
86
49
  server = new import_server.Server(options);
87
- const app = yield server.init();
50
+ const app = await server.init();
88
51
  return app;
89
- });
52
+ };
90
53
  const injectDataLoaderPlugin = (internalPlugins) => {
91
54
  const DataLoaderPlugin = require.resolve("@modern-js/plugin-data-loader/server");
92
- return __spreadProps(__spreadValues({}, internalPlugins), {
55
+ return {
56
+ ...internalPlugins,
93
57
  "@modern-js/plugin-data-loader": {
94
58
  path: DataLoaderPlugin,
95
59
  forced: true
96
60
  }
97
- });
61
+ };
98
62
  };
99
63
  // Annotate the CommonJS export names for ESM import in node:
100
64
  0 && (module.exports = {
File without changes
@@ -21,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  mod
22
22
  ));
23
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
- var __async = (__this, __arguments, generator) => {
25
- return new Promise((resolve, reject) => {
26
- var fulfilled = (value) => {
27
- try {
28
- step(generator.next(value));
29
- } catch (e) {
30
- reject(e);
31
- }
32
- };
33
- var rejected = (value) => {
34
- try {
35
- step(generator.throw(value));
36
- } catch (e) {
37
- reject(e);
38
- }
39
- };
40
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
41
- step((generator = generator.apply(__this, __arguments)).next());
42
- });
43
- };
44
24
  var generateWatchFiles_exports = {};
45
25
  __export(generateWatchFiles_exports, {
46
26
  addServerConfigToDeps: () => addServerConfigToDeps,
@@ -56,27 +36,25 @@ const getPackageConfig = (appDirectory, packageJsonConfig) => {
56
36
  );
57
37
  return json[packageJsonConfig != null ? packageJsonConfig : PACKAGE_JSON_CONFIG_NAME];
58
38
  };
59
- const addServerConfigToDeps = (dependencies, appDirectory, serverConfigFile) => __async(void 0, null, function* () {
60
- const serverConfig = yield (0, import_utils.getServerConfig)(appDirectory, serverConfigFile);
39
+ const addServerConfigToDeps = async (dependencies, appDirectory, serverConfigFile) => {
40
+ const serverConfig = await (0, import_utils.getServerConfig)(appDirectory, serverConfigFile);
61
41
  if (serverConfig) {
62
42
  dependencies.push(serverConfig);
63
43
  }
64
- });
65
- function generateWatchFiles(appContext, configDir) {
66
- return __async(this, null, function* () {
67
- const { appDirectory, configFile } = appContext;
68
- const configPath = import_path.default.join(appDirectory, configDir || "");
69
- const dependencies = getPackageConfig(
70
- appContext.appDirectory,
71
- appContext.packageName
72
- ) ? [import_path.default.resolve(appDirectory, "./package.json")] : [];
73
- yield addServerConfigToDeps(
74
- dependencies,
75
- appContext.appDirectory,
76
- appContext.serverConfigFile
77
- );
78
- return [`${configPath}/html`, configFile || "./config", ...dependencies];
79
- });
44
+ };
45
+ async function generateWatchFiles(appContext, configDir) {
46
+ const { appDirectory, configFile } = appContext;
47
+ const configPath = import_path.default.join(appDirectory, configDir || "");
48
+ const dependencies = getPackageConfig(
49
+ appContext.appDirectory,
50
+ appContext.packageName
51
+ ) ? [import_path.default.resolve(appDirectory, "./package.json")] : [];
52
+ await addServerConfigToDeps(
53
+ dependencies,
54
+ appContext.appDirectory,
55
+ appContext.serverConfigFile
56
+ );
57
+ return [`${configPath}/html`, configFile || "./config", ...dependencies];
80
58
  }
81
59
  // Annotate the CommonJS export names for ESM import in node:
82
60
  0 && (module.exports = {
@@ -15,26 +15,6 @@ var __copyProps = (to, from, except, desc) => {
15
15
  return to;
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var __async = (__this, __arguments, generator) => {
19
- return new Promise((resolve, reject) => {
20
- var fulfilled = (value) => {
21
- try {
22
- step(generator.next(value));
23
- } catch (e) {
24
- reject(e);
25
- }
26
- };
27
- var rejected = (value) => {
28
- try {
29
- step(generator.throw(value));
30
- } catch (e) {
31
- reject(e);
32
- }
33
- };
34
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
35
- step((generator = generator.apply(__this, __arguments)).next());
36
- });
37
- };
38
18
  var getSelectedEntries_exports = {};
39
19
  __export(getSelectedEntries_exports, {
40
20
  getSelectedEntries: () => getSelectedEntries
@@ -42,13 +22,13 @@ __export(getSelectedEntries_exports, {
42
22
  module.exports = __toCommonJS(getSelectedEntries_exports);
43
23
  var import_utils = require("@modern-js/utils");
44
24
  var import_locale = require("../locale");
45
- const getSelectedEntries = (entry, entrypoints) => __async(void 0, null, function* () {
25
+ const getSelectedEntries = async (entry, entrypoints) => {
46
26
  const entryNames = entrypoints.map((e) => e.entryName);
47
27
  if (!entry) {
48
28
  return entryNames;
49
29
  }
50
30
  if (typeof entry === "boolean") {
51
- const { selected } = yield import_utils.inquirer.prompt([
31
+ const { selected } = await import_utils.inquirer.prompt([
52
32
  {
53
33
  type: "checkbox",
54
34
  name: "selected",
@@ -74,7 +54,7 @@ const getSelectedEntries = (entry, entrypoints) => __async(void 0, null, functio
74
54
  }
75
55
  });
76
56
  return entry;
77
- });
57
+ };
78
58
  // Annotate the CommonJS export names for ESM import in node:
79
59
  0 && (module.exports = {
80
60
  getSelectedEntries
@@ -0,0 +1,41 @@
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 getServerInternalPlugins_exports = {};
19
+ __export(getServerInternalPlugins_exports, {
20
+ getServerInternalPlugins: () => getServerInternalPlugins
21
+ });
22
+ module.exports = __toCommonJS(getServerInternalPlugins_exports);
23
+ async function getServerInternalPlugins(api) {
24
+ const hookRunners = api.useHookRunners();
25
+ const { plugins: serverPlugins } = await hookRunners.collectServerPlugins({
26
+ plugins: []
27
+ });
28
+ const serverInternalPlugins = serverPlugins.reduce(
29
+ (result, plugin) => Object.assign(result, plugin),
30
+ {}
31
+ );
32
+ api.setAppContext({
33
+ ...api.useAppContext(),
34
+ serverInternalPlugins
35
+ });
36
+ return serverInternalPlugins;
37
+ }
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ getServerInternalPlugins
41
+ });
File without changes
@@ -15,39 +15,19 @@ var __copyProps = (to, from, except, desc) => {
15
15
  return to;
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var __async = (__this, __arguments, generator) => {
19
- return new Promise((resolve, reject) => {
20
- var fulfilled = (value) => {
21
- try {
22
- step(generator.next(value));
23
- } catch (e) {
24
- reject(e);
25
- }
26
- };
27
- var rejected = (value) => {
28
- try {
29
- step(generator.throw(value));
30
- } catch (e) {
31
- reject(e);
32
- }
33
- };
34
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
35
- step((generator = generator.apply(__this, __arguments)).next());
36
- });
37
- };
38
18
  var printInstructions_exports = {};
39
19
  __export(printInstructions_exports, {
40
20
  printInstructions: () => printInstructions
41
21
  });
42
22
  module.exports = __toCommonJS(printInstructions_exports);
43
23
  var import_utils = require("@modern-js/utils");
44
- const printInstructions = (hookRunners, appContext, config) => __async(void 0, null, function* () {
24
+ const printInstructions = async (hookRunners, appContext, config) => {
45
25
  const message = (0, import_utils.prettyInstructions)(appContext, config);
46
- const { instructions } = yield hookRunners.beforePrintInstructions({
26
+ const { instructions } = await hookRunners.beforePrintInstructions({
47
27
  instructions: message
48
28
  });
49
29
  import_utils.logger.info(instructions);
50
- });
30
+ };
51
31
  // Annotate the CommonJS export names for ESM import in node:
52
32
  0 && (module.exports = {
53
33
  printInstructions
@@ -0,0 +1,45 @@
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 restart_exports = {};
19
+ __export(restart_exports, {
20
+ restart: () => restart
21
+ });
22
+ module.exports = __toCommonJS(restart_exports);
23
+ var import_core = require("@modern-js/core");
24
+ var import_utils = require("@modern-js/utils");
25
+ async function restart(hooksRunner, filename) {
26
+ (0, import_utils.clearConsole)();
27
+ import_utils.logger.info(`Restart because ${import_utils.chalk.yellow(filename)} is changed...
28
+ `);
29
+ let hasGetError = false;
30
+ await hooksRunner.beforeRestart();
31
+ try {
32
+ await import_core.cli.init(import_core.cli.getPrevInitOptions());
33
+ } catch (err) {
34
+ console.error(err);
35
+ hasGetError = true;
36
+ } finally {
37
+ if (!hasGetError) {
38
+ import_utils.program.parse(process.argv);
39
+ }
40
+ }
41
+ }
42
+ // Annotate the CommonJS export names for ESM import in node:
43
+ 0 && (module.exports = {
44
+ restart
45
+ });