@modern-js/app-tools 2.58.1 → 2.58.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (309) hide show
  1. package/dist/cjs/builder/builder-rspack/adapterCopy.js +1 -1
  2. package/dist/cjs/builder/builder-webpack/createCopyPattern.js +0 -1
  3. package/dist/cjs/builder/builder-webpack/index.js +1 -1
  4. package/dist/cjs/builder/generator/getBuilderEnvironments.js +1 -1
  5. package/dist/cjs/builder/generator/index.js +2 -2
  6. package/dist/cjs/builder/index.js +2 -2
  7. package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +8 -13
  8. package/dist/cjs/builder/shared/bundlerPlugins/RouterPlugin.js +2 -5
  9. package/dist/cjs/commands/build.js +21 -2
  10. package/dist/cjs/commands/dev.js +15 -5
  11. package/dist/cjs/commands/index.js +9 -9
  12. package/dist/cjs/commands/serve.js +4 -3
  13. package/dist/cjs/config/initialize/inits.js +4 -4
  14. package/dist/cjs/config/legacy/index.js +3 -3
  15. package/dist/cjs/esm/esbuild-loader.mjs +20 -0
  16. package/dist/cjs/esm/register-esm.mjs +66 -0
  17. package/dist/cjs/esm/ts-node-loader.mjs +21 -0
  18. package/dist/cjs/esm/utils.mjs +43 -0
  19. package/dist/cjs/index.js +8 -8
  20. package/dist/cjs/locale/index.js +1 -1
  21. package/dist/cjs/plugins/analyze/getServerRoutes.js +2 -2
  22. package/dist/cjs/plugins/analyze/index.js +9 -9
  23. package/dist/cjs/plugins/analyze/utils.js +1 -1
  24. package/dist/cjs/plugins/deploy/dependencies/index.js +2 -1
  25. package/dist/cjs/plugins/deploy/dependencies/utils.js +13 -2
  26. package/dist/cjs/plugins/deploy/index.js +2 -2
  27. package/dist/cjs/plugins/deploy/platforms/netlify-entry.js +3 -0
  28. package/dist/cjs/plugins/deploy/platforms/netlify-entry.mjs +1 -0
  29. package/dist/cjs/plugins/deploy/platforms/{netlifyEntry.js → netlify-handler.js} +6 -4
  30. package/dist/cjs/plugins/deploy/platforms/netlify.js +15 -6
  31. package/dist/cjs/plugins/deploy/platforms/node.js +14 -5
  32. package/dist/cjs/plugins/deploy/platforms/vercel-entry.js +3 -0
  33. package/dist/cjs/plugins/deploy/platforms/vercel-entry.mjs +3 -0
  34. package/dist/cjs/plugins/deploy/platforms/{vercelEntry.js → vercel-handler.js} +4 -1
  35. package/dist/cjs/plugins/deploy/platforms/vercel.js +15 -6
  36. package/dist/cjs/plugins/serverBuild.js +2 -2
  37. package/dist/cjs/utils/config.js +1 -1
  38. package/dist/cjs/utils/createServer.js +1 -1
  39. package/dist/cjs/utils/loadPlugins.js +1 -1
  40. package/dist/cjs/utils/register.js +50 -23
  41. package/dist/types/builder/builder-rspack/adapterCopy.d.ts +2 -2
  42. package/dist/types/builder/builder-rspack/index.d.ts +1 -1
  43. package/dist/types/builder/builder-webpack/adapterModern.d.ts +2 -2
  44. package/dist/types/builder/builder-webpack/index.d.ts +1 -1
  45. package/dist/types/builder/generator/createBuilderProviderConfig.d.ts +1 -1
  46. package/dist/types/builder/generator/index.d.ts +3 -3
  47. package/dist/types/builder/index.d.ts +1 -1
  48. package/dist/types/builder/shared/builderPlugins/adapterHtml.d.ts +1 -1
  49. package/dist/types/builder/shared/builderPlugins/adapterSSR.d.ts +1 -1
  50. package/dist/types/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.d.ts +1 -1
  51. package/dist/types/builder/shared/bundlerPlugins/HtmlBottomTemplate.d.ts +1 -1
  52. package/dist/types/builder/shared/bundlerPlugins/RouterPlugin.d.ts +1 -1
  53. package/dist/types/builder/shared/createCopyInfo.d.ts +1 -1
  54. package/dist/types/builder/shared/loaders/serverModuleLoader.d.ts +1 -1
  55. package/dist/types/builder/shared/types.d.ts +1 -1
  56. package/dist/types/commands/build.d.ts +2 -2
  57. package/dist/types/commands/dev.d.ts +3 -3
  58. package/dist/types/commands/index.d.ts +3 -3
  59. package/dist/types/commands/inspect.d.ts +1 -1
  60. package/dist/types/config/default.d.ts +1 -1
  61. package/dist/types/config/initialize/inits.d.ts +1 -1
  62. package/dist/types/config/legacy/createHtmlConfig.d.ts +1 -1
  63. package/dist/types/config/legacy/createOutputConfig.d.ts +1 -1
  64. package/dist/types/config/legacy/createSourceConfig.d.ts +1 -1
  65. package/dist/types/config/legacy/createToolsConfig.d.ts +1 -1
  66. package/dist/types/esm/esbuild-loader.d.mts +6 -0
  67. package/dist/types/esm/register-esm.d.mts +5 -0
  68. package/dist/types/esm/ts-node-loader.d.mts +6 -0
  69. package/dist/types/esm/utils.d.mts +6 -0
  70. package/dist/types/exports/server.d.ts +1 -1
  71. package/dist/types/hooks.d.ts +1 -1
  72. package/dist/types/index.d.ts +2 -2
  73. package/dist/types/plugins/analyze/getBundleEntry.d.ts +1 -1
  74. package/dist/types/plugins/analyze/getFileSystemEntry.d.ts +1 -1
  75. package/dist/types/plugins/analyze/index.d.ts +1 -1
  76. package/dist/types/plugins/deploy/dependencies/index.d.ts +1 -1
  77. package/dist/types/plugins/deploy/dependencies/utils.d.ts +1 -1
  78. package/dist/types/plugins/deploy/index.d.ts +2 -2
  79. package/dist/types/plugins/deploy/platforms/netlify-entry.d.cts +1 -0
  80. package/dist/types/plugins/deploy/platforms/netlify-entry.d.mts +1 -0
  81. package/dist/types/plugins/deploy/platforms/netlify-handler.d.cts +1 -0
  82. package/dist/types/plugins/deploy/platforms/netlify.d.ts +1 -1
  83. package/dist/types/plugins/deploy/platforms/node.d.ts +1 -1
  84. package/dist/types/plugins/deploy/platforms/platform.d.ts +2 -2
  85. package/dist/types/plugins/deploy/platforms/vercel-entry.d.mts +2 -0
  86. package/dist/types/plugins/deploy/platforms/vercel-entry.d.ts +2 -0
  87. package/dist/types/plugins/deploy/platforms/vercel-handler.d.cts +1 -0
  88. package/dist/types/plugins/deploy/platforms/vercel.d.ts +1 -1
  89. package/dist/types/plugins/deploy/utils.d.ts +1 -1
  90. package/dist/types/plugins/initialize/index.d.ts +1 -1
  91. package/dist/types/plugins/serverBuild.d.ts +1 -1
  92. package/dist/types/types/config/index.d.ts +8 -8
  93. package/dist/types/types/config/output.d.ts +1 -1
  94. package/dist/types/types/config/tools.d.ts +3 -3
  95. package/dist/types/types/hooks.d.ts +3 -3
  96. package/dist/types/types/index.d.ts +3 -3
  97. package/dist/types/types/legacyConfig/index.d.ts +3 -3
  98. package/dist/types/types/legacyConfig/tools.d.ts +1 -1
  99. package/dist/types/utils/createServer.d.ts +1 -1
  100. package/dist/types/utils/generateWatchFiles.d.ts +1 -1
  101. package/dist/types/utils/getSelectedEntries.d.ts +1 -1
  102. package/dist/types/utils/loadPlugins.d.ts +3 -3
  103. package/dist/types/utils/printInstructions.d.ts +1 -1
  104. package/dist/types/utils/register.d.ts +2 -2
  105. package/dist/types/utils/restart.d.ts +2 -2
  106. package/lib/types.d.ts +15 -0
  107. package/package.json +20 -20
  108. package/dist/esm/builder/builder-rspack/adapterCopy.js +0 -166
  109. package/dist/esm/builder/builder-rspack/index.js +0 -34
  110. package/dist/esm/builder/builder-webpack/adapterModern.js +0 -29
  111. package/dist/esm/builder/builder-webpack/createCopyPattern.js +0 -44
  112. package/dist/esm/builder/builder-webpack/index.js +0 -52
  113. package/dist/esm/builder/generator/createBuilderProviderConfig.js +0 -37
  114. package/dist/esm/builder/generator/getBuilderEnvironments.js +0 -81
  115. package/dist/esm/builder/generator/index.js +0 -94
  116. package/dist/esm/builder/index.js +0 -45
  117. package/dist/esm/builder/shared/builderPlugins/adapterBasic.js +0 -85
  118. package/dist/esm/builder/shared/builderPlugins/adapterHtml.js +0 -126
  119. package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +0 -270
  120. package/dist/esm/builder/shared/builderPlugins/adapterWorker.js +0 -43
  121. package/dist/esm/builder/shared/builderPlugins/index.js +0 -4
  122. package/dist/esm/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -51
  123. package/dist/esm/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -37
  124. package/dist/esm/builder/shared/bundlerPlugins/RouterPlugin.js +0 -317
  125. package/dist/esm/builder/shared/bundlerPlugins/index.js +0 -3
  126. package/dist/esm/builder/shared/createCopyInfo.js +0 -14
  127. package/dist/esm/builder/shared/index.js +0 -3
  128. package/dist/esm/builder/shared/loaders/serverModuleLoader.js +0 -7
  129. package/dist/esm/builder/shared/types.js +0 -0
  130. package/dist/esm/commands/build.js +0 -117
  131. package/dist/esm/commands/deploy.js +0 -48
  132. package/dist/esm/commands/dev.js +0 -169
  133. package/dist/esm/commands/index.js +0 -411
  134. package/dist/esm/commands/inspect.js +0 -28
  135. package/dist/esm/commands/serve.js +0 -93
  136. package/dist/esm/config/default.js +0 -190
  137. package/dist/esm/config/index.js +0 -3
  138. package/dist/esm/config/initialize/index.js +0 -9
  139. package/dist/esm/config/initialize/inits.js +0 -85
  140. package/dist/esm/config/legacy/createHtmlConfig.js +0 -21
  141. package/dist/esm/config/legacy/createOutputConfig.js +0 -45
  142. package/dist/esm/config/legacy/createSourceConfig.js +0 -46
  143. package/dist/esm/config/legacy/createToolsConfig.js +0 -28
  144. package/dist/esm/config/legacy/index.js +0 -43
  145. package/dist/esm/defineConfig.js +0 -16
  146. package/dist/esm/exports/server.js +0 -4
  147. package/dist/esm/hooks.js +0 -34
  148. package/dist/esm/index.js +0 -239
  149. package/dist/esm/locale/en.js +0 -43
  150. package/dist/esm/locale/index.js +0 -12
  151. package/dist/esm/locale/zh.js +0 -43
  152. package/dist/esm/plugins/analyze/constants.js +0 -14
  153. package/dist/esm/plugins/analyze/getBundleEntry.js +0 -102
  154. package/dist/esm/plugins/analyze/getFileSystemEntry.js +0 -238
  155. package/dist/esm/plugins/analyze/getHtmlTemplate.js +0 -178
  156. package/dist/esm/plugins/analyze/getServerRoutes.js +0 -132
  157. package/dist/esm/plugins/analyze/index.js +0 -380
  158. package/dist/esm/plugins/analyze/isDefaultExportFunction.js +0 -49
  159. package/dist/esm/plugins/analyze/templates.js +0 -6
  160. package/dist/esm/plugins/analyze/utils.js +0 -101
  161. package/dist/esm/plugins/deploy/dependencies/index.js +0 -614
  162. package/dist/esm/plugins/deploy/dependencies/utils.js +0 -394
  163. package/dist/esm/plugins/deploy/exports.js +0 -4
  164. package/dist/esm/plugins/deploy/index.js +0 -135
  165. package/dist/esm/plugins/deploy/platforms/netlify.js +0 -299
  166. package/dist/esm/plugins/deploy/platforms/netlifyEntry.js +0 -203
  167. package/dist/esm/plugins/deploy/platforms/node.js +0 -133
  168. package/dist/esm/plugins/deploy/platforms/nodeEntry.js +0 -108
  169. package/dist/esm/plugins/deploy/platforms/platform.js +0 -0
  170. package/dist/esm/plugins/deploy/platforms/vercel.js +0 -233
  171. package/dist/esm/plugins/deploy/platforms/vercelEntry.js +0 -203
  172. package/dist/esm/plugins/deploy/utils.js +0 -47
  173. package/dist/esm/plugins/initialize/index.js +0 -119
  174. package/dist/esm/plugins/serverBuild.js +0 -87
  175. package/dist/esm/types/config/deploy.js +0 -0
  176. package/dist/esm/types/config/dev.js +0 -0
  177. package/dist/esm/types/config/experiments.js +0 -0
  178. package/dist/esm/types/config/html.js +0 -0
  179. package/dist/esm/types/config/index.js +0 -1
  180. package/dist/esm/types/config/output.js +0 -0
  181. package/dist/esm/types/config/performance.js +0 -0
  182. package/dist/esm/types/config/security.js +0 -0
  183. package/dist/esm/types/config/source.js +0 -0
  184. package/dist/esm/types/config/testing.js +0 -0
  185. package/dist/esm/types/config/tools.js +0 -0
  186. package/dist/esm/types/hooks.js +0 -0
  187. package/dist/esm/types/index.js +0 -3
  188. package/dist/esm/types/legacyConfig/deploy.js +0 -0
  189. package/dist/esm/types/legacyConfig/dev.js +0 -0
  190. package/dist/esm/types/legacyConfig/index.js +0 -0
  191. package/dist/esm/types/legacyConfig/output.js +0 -0
  192. package/dist/esm/types/legacyConfig/source.js +0 -0
  193. package/dist/esm/types/legacyConfig/testing.js +0 -0
  194. package/dist/esm/types/legacyConfig/tools.js +0 -0
  195. package/dist/esm/types/utils.js +0 -0
  196. package/dist/esm/utils/config.js +0 -122
  197. package/dist/esm/utils/createServer.js +0 -58
  198. package/dist/esm/utils/env.js +0 -16
  199. package/dist/esm/utils/generateWatchFiles.js +0 -71
  200. package/dist/esm/utils/getSelectedEntries.js +0 -67
  201. package/dist/esm/utils/loadPlugins.js +0 -69
  202. package/dist/esm/utils/printInstructions.js +0 -32
  203. package/dist/esm/utils/register.js +0 -129
  204. package/dist/esm/utils/restart.js +0 -67
  205. package/dist/esm/utils/routes.js +0 -42
  206. package/dist/esm/utils/types.js +0 -0
  207. package/dist/esm-node/builder/builder-rspack/adapterCopy.js +0 -67
  208. package/dist/esm-node/builder/builder-rspack/index.js +0 -12
  209. package/dist/esm-node/builder/builder-webpack/adapterModern.js +0 -26
  210. package/dist/esm-node/builder/builder-webpack/createCopyPattern.js +0 -42
  211. package/dist/esm-node/builder/builder-webpack/index.js +0 -20
  212. package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +0 -44
  213. package/dist/esm-node/builder/generator/getBuilderEnvironments.js +0 -60
  214. package/dist/esm-node/builder/generator/index.js +0 -37
  215. package/dist/esm-node/builder/index.js +0 -11
  216. package/dist/esm-node/builder/shared/builderPlugins/adapterBasic.js +0 -48
  217. package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.js +0 -60
  218. package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +0 -156
  219. package/dist/esm-node/builder/shared/builderPlugins/adapterWorker.js +0 -27
  220. package/dist/esm-node/builder/shared/builderPlugins/index.js +0 -4
  221. package/dist/esm-node/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -30
  222. package/dist/esm-node/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -31
  223. package/dist/esm-node/builder/shared/bundlerPlugins/RouterPlugin.js +0 -231
  224. package/dist/esm-node/builder/shared/bundlerPlugins/index.js +0 -3
  225. package/dist/esm-node/builder/shared/createCopyInfo.js +0 -14
  226. package/dist/esm-node/builder/shared/index.js +0 -3
  227. package/dist/esm-node/builder/shared/loaders/serverModuleLoader.js +0 -7
  228. package/dist/esm-node/builder/shared/types.js +0 -0
  229. package/dist/esm-node/commands/build.js +0 -55
  230. package/dist/esm-node/commands/deploy.js +0 -12
  231. package/dist/esm-node/commands/dev.js +0 -95
  232. package/dist/esm-node/commands/index.js +0 -92
  233. package/dist/esm-node/commands/inspect.js +0 -15
  234. package/dist/esm-node/commands/serve.js +0 -51
  235. package/dist/esm-node/config/default.js +0 -197
  236. package/dist/esm-node/config/index.js +0 -3
  237. package/dist/esm-node/config/initialize/index.js +0 -9
  238. package/dist/esm-node/config/initialize/inits.js +0 -79
  239. package/dist/esm-node/config/legacy/createHtmlConfig.js +0 -21
  240. package/dist/esm-node/config/legacy/createOutputConfig.js +0 -45
  241. package/dist/esm-node/config/legacy/createSourceConfig.js +0 -29
  242. package/dist/esm-node/config/legacy/createToolsConfig.js +0 -28
  243. package/dist/esm-node/config/legacy/index.js +0 -43
  244. package/dist/esm-node/defineConfig.js +0 -13
  245. package/dist/esm-node/exports/server.js +0 -4
  246. package/dist/esm-node/hooks.js +0 -34
  247. package/dist/esm-node/index.js +0 -124
  248. package/dist/esm-node/locale/en.js +0 -43
  249. package/dist/esm-node/locale/index.js +0 -12
  250. package/dist/esm-node/locale/zh.js +0 -43
  251. package/dist/esm-node/plugins/analyze/constants.js +0 -14
  252. package/dist/esm-node/plugins/analyze/getBundleEntry.js +0 -61
  253. package/dist/esm-node/plugins/analyze/getFileSystemEntry.js +0 -100
  254. package/dist/esm-node/plugins/analyze/getHtmlTemplate.js +0 -74
  255. package/dist/esm-node/plugins/analyze/getServerRoutes.js +0 -132
  256. package/dist/esm-node/plugins/analyze/index.js +0 -166
  257. package/dist/esm-node/plugins/analyze/isDefaultExportFunction.js +0 -47
  258. package/dist/esm-node/plugins/analyze/templates.js +0 -24
  259. package/dist/esm-node/plugins/analyze/utils.js +0 -68
  260. package/dist/esm-node/plugins/deploy/dependencies/index.js +0 -201
  261. package/dist/esm-node/plugins/deploy/dependencies/utils.js +0 -126
  262. package/dist/esm-node/plugins/deploy/exports.js +0 -4
  263. package/dist/esm-node/plugins/deploy/index.js +0 -44
  264. package/dist/esm-node/plugins/deploy/platforms/netlify.js +0 -108
  265. package/dist/esm-node/plugins/deploy/platforms/netlifyEntry.js +0 -69
  266. package/dist/esm-node/plugins/deploy/platforms/node.js +0 -63
  267. package/dist/esm-node/plugins/deploy/platforms/nodeEntry.js +0 -44
  268. package/dist/esm-node/plugins/deploy/platforms/platform.js +0 -0
  269. package/dist/esm-node/plugins/deploy/platforms/vercel.js +0 -120
  270. package/dist/esm-node/plugins/deploy/platforms/vercelEntry.js +0 -69
  271. package/dist/esm-node/plugins/deploy/utils.js +0 -44
  272. package/dist/esm-node/plugins/initialize/index.js +0 -84
  273. package/dist/esm-node/plugins/serverBuild.js +0 -58
  274. package/dist/esm-node/types/config/deploy.js +0 -0
  275. package/dist/esm-node/types/config/dev.js +0 -0
  276. package/dist/esm-node/types/config/experiments.js +0 -0
  277. package/dist/esm-node/types/config/html.js +0 -0
  278. package/dist/esm-node/types/config/index.js +0 -1
  279. package/dist/esm-node/types/config/output.js +0 -0
  280. package/dist/esm-node/types/config/performance.js +0 -0
  281. package/dist/esm-node/types/config/security.js +0 -0
  282. package/dist/esm-node/types/config/source.js +0 -0
  283. package/dist/esm-node/types/config/testing.js +0 -0
  284. package/dist/esm-node/types/config/tools.js +0 -0
  285. package/dist/esm-node/types/hooks.js +0 -0
  286. package/dist/esm-node/types/index.js +0 -3
  287. package/dist/esm-node/types/legacyConfig/deploy.js +0 -0
  288. package/dist/esm-node/types/legacyConfig/dev.js +0 -0
  289. package/dist/esm-node/types/legacyConfig/index.js +0 -0
  290. package/dist/esm-node/types/legacyConfig/output.js +0 -0
  291. package/dist/esm-node/types/legacyConfig/source.js +0 -0
  292. package/dist/esm-node/types/legacyConfig/testing.js +0 -0
  293. package/dist/esm-node/types/legacyConfig/tools.js +0 -0
  294. package/dist/esm-node/types/utils.js +0 -0
  295. package/dist/esm-node/utils/config.js +0 -49
  296. package/dist/esm-node/utils/createServer.js +0 -26
  297. package/dist/esm-node/utils/env.js +0 -16
  298. package/dist/esm-node/utils/generateWatchFiles.js +0 -30
  299. package/dist/esm-node/utils/getSelectedEntries.js +0 -34
  300. package/dist/esm-node/utils/loadPlugins.js +0 -22
  301. package/dist/esm-node/utils/printInstructions.js +0 -11
  302. package/dist/esm-node/utils/register.js +0 -69
  303. package/dist/esm-node/utils/restart.js +0 -22
  304. package/dist/esm-node/utils/routes.js +0 -21
  305. package/dist/esm-node/utils/types.js +0 -0
  306. package/dist/types/plugins/deploy/platforms/netlifyEntry.d.ts +0 -2
  307. package/dist/types/plugins/deploy/platforms/vercelEntry.d.ts +0 -2
  308. /package/dist/cjs/plugins/deploy/platforms/{nodeEntry.js → node-entry.js} +0 -0
  309. /package/dist/types/plugins/deploy/platforms/{nodeEntry.d.ts → node-entry.d.ts} +0 -0
@@ -1,317 +0,0 @@
1
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
- import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
3
- import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
4
- import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
5
- import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
6
- import { createHash } from "crypto";
7
- import { merge, mergeWith } from "@modern-js/utils/lodash";
8
- import { ROUTE_MANIFEST_FILE } from "@modern-js/utils";
9
- import { ROUTE_MANIFEST } from "@modern-js/utils/universal/constants";
10
- var PLUGIN_NAME = "ModernjsRoutePlugin";
11
- var generateContentHash = function(content) {
12
- return createHash("md5").update(content).digest("hex").slice(0, 8);
13
- };
14
- var RouterPlugin = /* @__PURE__ */ function() {
15
- "use strict";
16
- function RouterPlugin2(param) {
17
- var _param_staticJsDir = param.staticJsDir, staticJsDir = _param_staticJsDir === void 0 ? "static/js" : _param_staticJsDir, HtmlBundlerPlugin = param.HtmlBundlerPlugin, enableInlineRouteManifests = param.enableInlineRouteManifests, _param_disableFilenameHash = param.disableFilenameHash, disableFilenameHash = _param_disableFilenameHash === void 0 ? false : _param_disableFilenameHash, _param_scriptLoading = param.scriptLoading, scriptLoading = _param_scriptLoading === void 0 ? "defer" : _param_scriptLoading, nonce = param.nonce;
18
- _class_call_check(this, RouterPlugin2);
19
- this.name = "RouterPlugin";
20
- this.HtmlBundlerPlugin = HtmlBundlerPlugin;
21
- this.enableInlineRouteManifests = enableInlineRouteManifests;
22
- this.staticJsDir = staticJsDir;
23
- this.disableFilenameHash = disableFilenameHash;
24
- this.scriptLoading = scriptLoading;
25
- this.nonce = nonce;
26
- }
27
- var _proto = RouterPlugin2.prototype;
28
- _proto.isTargetNodeOrWebWorker = function isTargetNodeOrWebWorker(target) {
29
- if (target === "node" || Array.isArray(target) && target.includes("node")) {
30
- return true;
31
- }
32
- if (target === "webworker" || Array.isArray(target) && target.includes("webworker")) {
33
- return true;
34
- }
35
- return false;
36
- };
37
- _proto.getEntryChunks = function getEntryChunks(compilation, chunks) {
38
- var entrypointsArray = Array.from(compilation.entrypoints.entries());
39
- var entryChunkIds = entrypointsArray.map(function(entrypoint) {
40
- return entrypoint[0];
41
- });
42
- var entryChunks = _to_consumable_array(chunks).filter(function(chunk) {
43
- var _chunk_names;
44
- return (_chunk_names = chunk.names) === null || _chunk_names === void 0 ? void 0 : _chunk_names.some(function(name) {
45
- return entryChunkIds.includes(name);
46
- });
47
- });
48
- return entryChunks;
49
- };
50
- _proto.getEntryChunkFiles = function getEntryChunkFiles(entryChunks) {
51
- return entryChunks.map(function(chunk) {
52
- return _to_consumable_array(chunk.files || []).find(function(fname) {
53
- return fname.includes(".js");
54
- });
55
- });
56
- };
57
- _proto.apply = function apply(compiler) {
58
- var _this = this;
59
- var target = compiler.options.target;
60
- if (this.isTargetNodeOrWebWorker(target)) {
61
- return;
62
- }
63
- var webpack = compiler.webpack;
64
- var isRspack = "rspackVersion" in webpack;
65
- var Compilation = webpack.Compilation, sources = webpack.sources;
66
- var RawSource = sources.RawSource;
67
- var normalizePath = function(path) {
68
- if (!path.endsWith("/")) {
69
- return "".concat(path, "/");
70
- }
71
- return path;
72
- };
73
- var chunksToHtmlName = /* @__PURE__ */ new Map();
74
- var ROUTE_MANIFEST_HOLDER = "route-manifest";
75
- var placeholder = "<!--<?- ".concat(ROUTE_MANIFEST_HOLDER, " ?>-->");
76
- compiler.hooks.thisCompilation.tap(PLUGIN_NAME, function(compilation) {
77
- _this.HtmlBundlerPlugin.getHooks(compilation).beforeEmit.tapAsync("RouterManifestPlugin", function(data, callback) {
78
- var outputName = data.outputName;
79
- var chunks = data.plugin.options.chunks;
80
- chunksToHtmlName.set(chunks, outputName);
81
- data.html = data.html.replace("</script>", "</script>".concat(placeholder));
82
- callback(null, data);
83
- });
84
- var _this1 = _this;
85
- compilation.hooks.processAssets.tapPromise({
86
- name: PLUGIN_NAME,
87
- stage: Compilation.PROCESS_ASSETS_STAGE_REPORT
88
- }, /* @__PURE__ */ _async_to_generator(function() {
89
- var _loop, stats, publicPath, _stats_chunks, chunks, namedChunkGroups, routeAssets, prevManifestAsset, prevManifestStr, prevManifest, asyncEntryNames, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, name, chunkGroup, assets, referenceCssAssets, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, asyncEntryName, syncEntryName, syncEntry, asyncEntry, manifest, entryNames, entryChunks, orignalEntryIds, entryChunkFiles, entryChunkFileIds, i;
90
- return _ts_generator(this, function(_state) {
91
- _loop = function(i2) {
92
- var entryName = entryNames[i2];
93
- var file = entryChunkFiles[i2];
94
- var chunkNames = entryChunks[i2].names;
95
- var chunkId = entryChunkFileIds[i2];
96
- var asset = compilation.assets[file];
97
- if (!asset || !chunkId) {
98
- return "continue";
99
- }
100
- var relatedAssets = {};
101
- if (entryChunkFiles.length > 1) {
102
- Object.keys(routeAssets).forEach(function(routeId) {
103
- var segments = routeId.split("_");
104
- var chunkName = segments[0];
105
- if (chunkNames === null || chunkNames === void 0 ? void 0 : chunkNames.includes(chunkName)) {
106
- relatedAssets[routeId] = routeAssets[routeId];
107
- }
108
- });
109
- } else {
110
- relatedAssets = routeAssets;
111
- }
112
- var manifest2 = {
113
- routeAssets: relatedAssets
114
- };
115
- var injectedContent = "\n ;(function(){\n window.".concat(ROUTE_MANIFEST, " = ").concat(JSON.stringify(manifest2, function(k, v) {
116
- if ((k === "assets" || k === "referenceCssAssets") && Array.isArray(v)) {
117
- return v.map(function(item) {
118
- return item.replace(publicPath, "");
119
- });
120
- }
121
- return v;
122
- }), ";\n })();\n ");
123
- var htmlName = void 0;
124
- var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;
125
- try {
126
- var _loop2 = function() {
127
- var _step_value2 = _sliced_to_array(_step2.value, 2), chunks2 = _step_value2[0], name2 = _step_value2[1];
128
- if (Array.isArray(chunkNames) && Array.isArray(chunks2) && chunkNames.every(function(value, index) {
129
- return value === chunks2[index];
130
- })) {
131
- htmlName = name2;
132
- return "break";
133
- }
134
- };
135
- for (var _iterator2 = chunksToHtmlName.entries()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
136
- var _ret = _loop2();
137
- if (_ret === "break")
138
- break;
139
- }
140
- } catch (err) {
141
- _didIteratorError2 = true;
142
- _iteratorError2 = err;
143
- } finally {
144
- try {
145
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
146
- _iterator2.return();
147
- }
148
- } finally {
149
- if (_didIteratorError2) {
150
- throw _iteratorError2;
151
- }
152
- }
153
- }
154
- var oldHtml = compilation.assets[htmlName];
155
- var enableInlineRouteManifests = _this1.enableInlineRouteManifests, disableFilenameHash = _this1.disableFilenameHash, staticJsDir = _this1.staticJsDir, scriptLoading = _this1.scriptLoading, nonce = _this1.nonce;
156
- var nonceAttr = nonce ? 'nonce="'.concat(nonce, '"') : "";
157
- if (oldHtml) {
158
- if (enableInlineRouteManifests) {
159
- compilation.updateAsset(
160
- htmlName,
161
- new RawSource(oldHtml.source().toString().replace(placeholder, "<script ".concat(nonceAttr, ">").concat(injectedContent, "</script>"))),
162
- // FIXME: The arguments third of updatgeAsset is a optional function in webpack.
163
- void 0
164
- );
165
- } else {
166
- var scriptPath = "".concat(staticJsDir, "/").concat(ROUTE_MANIFEST_HOLDER, "-").concat(entryName).concat(disableFilenameHash ? ".js" : ".".concat(generateContentHash(injectedContent), ".js"));
167
- var scriptUrl = "".concat(publicPath).concat(scriptPath);
168
- var scriptLoadingAttr = (
169
- // eslint-disable-next-line no-nested-ternary
170
- scriptLoading === "defer" ? scriptLoading : scriptLoading === "module" ? 'type="module"' : ""
171
- );
172
- var script = "<script ".concat(scriptLoadingAttr, " ").concat(nonceAttr, ' src="').concat(scriptUrl, '"></script>');
173
- compilation.updateAsset(
174
- htmlName,
175
- new RawSource(oldHtml.source().toString().replace(placeholder, script)),
176
- // FIXME: The arguments third of updatgeAsset is a optional function in webpack.
177
- void 0
178
- );
179
- compilation.emitAsset(scriptPath, new RawSource(injectedContent));
180
- }
181
- }
182
- };
183
- stats = compilation.getStats().toJson({
184
- all: false,
185
- publicPath: true,
186
- assets: true,
187
- chunkGroups: true,
188
- chunks: true,
189
- ids: true
190
- });
191
- publicPath = stats.publicPath, _stats_chunks = stats.chunks, chunks = _stats_chunks === void 0 ? [] : _stats_chunks, namedChunkGroups = stats.namedChunkGroups;
192
- routeAssets = {};
193
- if (!namedChunkGroups) {
194
- return [
195
- 2
196
- ];
197
- }
198
- prevManifestAsset = compilation.getAsset(ROUTE_MANIFEST_FILE);
199
- prevManifestStr = prevManifestAsset ? prevManifestAsset.source.source().toString() : JSON.stringify({
200
- routeAssets: {}
201
- });
202
- prevManifest = JSON.parse(prevManifestStr);
203
- asyncEntryNames = [];
204
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
205
- try {
206
- for (_iterator = Object.entries(namedChunkGroups)[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
207
- _step_value = _sliced_to_array(_step.value, 2), name = _step_value[0], chunkGroup = _step_value[1];
208
- if (name.startsWith("async-")) {
209
- asyncEntryNames.push(name);
210
- }
211
- assets = chunkGroup.assets.map(function(asset) {
212
- var filename = asset.name;
213
- return publicPath ? normalizePath(publicPath) + filename : filename;
214
- });
215
- referenceCssAssets = assets.filter(function(asset) {
216
- return /\.css$/.test(asset);
217
- });
218
- routeAssets[name] = {
219
- chunkIds: chunkGroup.chunks,
220
- assets,
221
- referenceCssAssets
222
- };
223
- if (prevManifest.routeAssets[name]) {
224
- mergeWith(routeAssets[name], prevManifest.routeAssets[name], function(obj, source) {
225
- if (Array.isArray(obj)) {
226
- return obj.concat(source);
227
- }
228
- return Object.assign(source, obj);
229
- });
230
- }
231
- }
232
- } catch (err) {
233
- _didIteratorError = true;
234
- _iteratorError = err;
235
- } finally {
236
- try {
237
- if (!_iteratorNormalCompletion && _iterator.return != null) {
238
- _iterator.return();
239
- }
240
- } finally {
241
- if (_didIteratorError) {
242
- throw _iteratorError;
243
- }
244
- }
245
- }
246
- if (asyncEntryNames.length > 0) {
247
- _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
248
- try {
249
- for (_iterator1 = asyncEntryNames[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
250
- asyncEntryName = _step1.value;
251
- syncEntryName = asyncEntryName.replace("async-", "");
252
- syncEntry = routeAssets[syncEntryName];
253
- asyncEntry = routeAssets[asyncEntryName];
254
- merge(syncEntry, asyncEntry);
255
- }
256
- } catch (err) {
257
- _didIteratorError1 = true;
258
- _iteratorError1 = err;
259
- } finally {
260
- try {
261
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
262
- _iterator1.return();
263
- }
264
- } finally {
265
- if (_didIteratorError1) {
266
- throw _iteratorError1;
267
- }
268
- }
269
- }
270
- }
271
- manifest = {
272
- routeAssets
273
- };
274
- entryNames = Array.from(compilation.entrypoints.keys());
275
- entryChunks = [];
276
- if (isRspack) {
277
- entryChunks = _this1.getEntryChunks(compilation, chunks);
278
- } else {
279
- orignalEntryIds = Object.keys(compilation.options.entry).map(function(entryName) {
280
- var chunk = compilation.namedChunks.get(entryName);
281
- if (chunk) {
282
- return chunk.id;
283
- }
284
- return entryName;
285
- });
286
- entryChunks = _this1.getEntryChunks(compilation, chunks).filter(function(chunk) {
287
- return orignalEntryIds.includes(chunk.id);
288
- });
289
- }
290
- entryChunkFiles = _this1.getEntryChunkFiles(entryChunks);
291
- entryChunkFileIds = entryChunks.map(function(chunk) {
292
- return chunk.id;
293
- });
294
- for (i = 0; i < entryChunkFiles.length; i++)
295
- _loop(i);
296
- if (prevManifestAsset) {
297
- compilation.updateAsset(
298
- ROUTE_MANIFEST_FILE,
299
- new RawSource(JSON.stringify(manifest, null, 2)),
300
- // FIXME: The arguments third of updatgeAsset is a optional function in webpack.
301
- void 0
302
- );
303
- } else {
304
- compilation.emitAsset(ROUTE_MANIFEST_FILE, new RawSource(JSON.stringify(manifest, null, 2)));
305
- }
306
- return [
307
- 2
308
- ];
309
- });
310
- }));
311
- });
312
- };
313
- return RouterPlugin2;
314
- }();
315
- export {
316
- RouterPlugin
317
- };
@@ -1,3 +0,0 @@
1
- export * from "./HtmlAsyncChunkPlugin";
2
- export * from "./HtmlBottomTemplate";
3
- export * from "./RouterPlugin";
@@ -1,14 +0,0 @@
1
- import path from "path";
2
- function createCopyInfo(appContext, config) {
3
- var configDir = path.resolve(appContext.appDirectory, config.source.configDir || "./config");
4
- var uploadDir = path.posix.join(configDir.replace(/\\/g, "/"), "upload");
5
- var publicDir = path.posix.join(configDir.replace(/\\/g, "/"), "public");
6
- return {
7
- configDir,
8
- uploadDir,
9
- publicDir
10
- };
11
- }
12
- export {
13
- createCopyInfo
14
- };
@@ -1,3 +0,0 @@
1
- export * from "./types";
2
- export * from "./builderPlugins";
3
- export * from "./createCopyInfo";
@@ -1,7 +0,0 @@
1
- function loader() {
2
- return "module.exports = {}";
3
- }
4
- var serverModuleLoader_default = loader;
5
- export {
6
- serverModuleLoader_default as default
7
- };
File without changes
@@ -1,117 +0,0 @@
1
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
- import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
3
- import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
4
- import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
5
- import { ResolvedConfigContext } from "@modern-js/core";
6
- import { logger } from "@modern-js/utils";
7
- import { loadServerPlugins } from "../utils/loadPlugins";
8
- import { generateRoutes } from "../utils/routes";
9
- import { buildServerConfig } from "../utils/config";
10
- import { registerCompiler } from "../utils/register";
11
- var build = function() {
12
- var _ref = _async_to_generator(function(api, options) {
13
- var _resolvedConfig_source, resolvedConfig, appContext, hookRunners, apiOnly, appDirectory, distDirectory, serverConfigFile, distDirectory1, appDirectory1, serverConfigFile1;
14
- return _ts_generator(this, function(_state) {
15
- switch (_state.label) {
16
- case 0:
17
- if (options === null || options === void 0 ? void 0 : options.analyze) {
18
- process.env.BUNDLE_ANALYZE = "true";
19
- }
20
- resolvedConfig = api.useResolvedConfigContext();
21
- appContext = api.useAppContext();
22
- hookRunners = api.useHookRunners();
23
- return [
24
- 4,
25
- loadServerPlugins(api, appContext.appDirectory, appContext.metaName)
26
- ];
27
- case 1:
28
- _state.sent();
29
- return [
30
- 4,
31
- registerCompiler(appContext.appDirectory, appContext.distDirectory, resolvedConfig === null || resolvedConfig === void 0 ? void 0 : (_resolvedConfig_source = resolvedConfig.source) === null || _resolvedConfig_source === void 0 ? void 0 : _resolvedConfig_source.alias)
32
- ];
33
- case 2:
34
- _state.sent();
35
- apiOnly = appContext.apiOnly;
36
- if (!apiOnly)
37
- return [
38
- 3,
39
- 7
40
- ];
41
- appDirectory = appContext.appDirectory, distDirectory = appContext.distDirectory, serverConfigFile = appContext.serverConfigFile;
42
- return [
43
- 4,
44
- hookRunners.beforeBuild({
45
- // "null" bundlerConfigs
46
- bundlerConfigs: void 0
47
- })
48
- ];
49
- case 3:
50
- _state.sent();
51
- return [
52
- 4,
53
- buildServerConfig({
54
- appDirectory,
55
- distDirectory,
56
- configFile: serverConfigFile
57
- })
58
- ];
59
- case 4:
60
- _state.sent();
61
- return [
62
- 4,
63
- generateRoutes(appContext)
64
- ];
65
- case 5:
66
- _state.sent();
67
- return [
68
- 4,
69
- hookRunners.afterBuild({
70
- // "null" stats
71
- stats: void 0
72
- })
73
- ];
74
- case 6:
75
- _state.sent();
76
- return [
77
- 2
78
- ];
79
- case 7:
80
- resolvedConfig = _object_spread_props(_object_spread({}, resolvedConfig), {
81
- cliOptions: options
82
- });
83
- ResolvedConfigContext.set(resolvedConfig);
84
- distDirectory1 = appContext.distDirectory, appDirectory1 = appContext.appDirectory, serverConfigFile1 = appContext.serverConfigFile;
85
- return [
86
- 4,
87
- buildServerConfig({
88
- appDirectory: appDirectory1,
89
- distDirectory: distDirectory1,
90
- configFile: serverConfigFile1
91
- })
92
- ];
93
- case 8:
94
- _state.sent();
95
- logger.info("Starting production build...");
96
- if (!appContext.builder) {
97
- throw new Error("Expect the Builder to have been initialized, But the appContext.builder received `undefined`");
98
- }
99
- return [
100
- 4,
101
- appContext.builder.build()
102
- ];
103
- case 9:
104
- _state.sent();
105
- return [
106
- 2
107
- ];
108
- }
109
- });
110
- });
111
- return function build2(api, options) {
112
- return _ref.apply(this, arguments);
113
- };
114
- }();
115
- export {
116
- build
117
- };
@@ -1,48 +0,0 @@
1
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
- import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
3
- import { getServerPlugins } from "../utils/loadPlugins";
4
- var deploy = function() {
5
- var _ref = _async_to_generator(function(api, options) {
6
- var hookRunners, metaName;
7
- return _ts_generator(this, function(_state) {
8
- switch (_state.label) {
9
- case 0:
10
- hookRunners = api.useHookRunners();
11
- metaName = api.useAppContext().metaName;
12
- return [
13
- 4,
14
- getServerPlugins(api, metaName)
15
- ];
16
- case 1:
17
- _state.sent();
18
- return [
19
- 4,
20
- hookRunners.beforeDeploy(options)
21
- ];
22
- case 2:
23
- _state.sent();
24
- return [
25
- 4,
26
- hookRunners.deploy(options)
27
- ];
28
- case 3:
29
- _state.sent();
30
- return [
31
- 4,
32
- hookRunners.afterDeploy(options)
33
- ];
34
- case 4:
35
- _state.sent();
36
- return [
37
- 2
38
- ];
39
- }
40
- });
41
- });
42
- return function deploy2(api, options) {
43
- return _ref.apply(this, arguments);
44
- };
45
- }();
46
- export {
47
- deploy
48
- };
@@ -1,169 +0,0 @@
1
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
- import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
3
- import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
4
- import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
5
- import path from "node:path";
6
- import { ResolvedConfigContext } from "@modern-js/core";
7
- import { DEFAULT_DEV_HOST, SERVER_DIR, getMeta, logger } from "@modern-js/utils";
8
- import { createDevServer } from "@modern-js/server";
9
- import { applyPlugins } from "@modern-js/prod-server";
10
- import { loadServerPlugins } from "../utils/loadPlugins";
11
- import { registerCompiler } from "../utils/register";
12
- import { printInstructions } from "../utils/printInstructions";
13
- import { setServer } from "../utils/createServer";
14
- import { generateRoutes } from "../utils/routes";
15
- import { buildServerConfig } from "../utils/config";
16
- var dev = function() {
17
- var _ref = _async_to_generator(function(api, options, devServerOptions) {
18
- var _normalizedConfig_source, _normalizedConfig_tools, _normalizedConfig_dev, normalizedConfig, appContext, hookRunners, appDirectory, distDirectory, port, apiOnly, serverConfigFile, metaName, serverRoutes, meta, serverConfigPath, pluginInstances, serverOptions, host, server, _ref2, server1, afterListen;
19
- return _ts_generator(this, function(_state) {
20
- switch (_state.label) {
21
- case 0:
22
- if (options.analyze) {
23
- process.env.BUNDLE_ANALYZE = "true";
24
- }
25
- normalizedConfig = api.useResolvedConfigContext();
26
- appContext = api.useAppContext();
27
- hookRunners = api.useHookRunners();
28
- return [
29
- 4,
30
- registerCompiler(appContext.appDirectory, appContext.distDirectory, normalizedConfig === null || normalizedConfig === void 0 ? void 0 : (_normalizedConfig_source = normalizedConfig.source) === null || _normalizedConfig_source === void 0 ? void 0 : _normalizedConfig_source.alias)
31
- ];
32
- case 1:
33
- _state.sent();
34
- normalizedConfig = _object_spread_props(_object_spread({}, normalizedConfig), {
35
- cliOptions: options
36
- });
37
- ResolvedConfigContext.set(normalizedConfig);
38
- appDirectory = appContext.appDirectory, distDirectory = appContext.distDirectory, port = appContext.port, apiOnly = appContext.apiOnly, serverConfigFile = appContext.serverConfigFile, metaName = appContext.metaName, serverRoutes = appContext.serverRoutes;
39
- return [
40
- 4,
41
- buildServerConfig({
42
- appDirectory,
43
- distDirectory,
44
- configFile: serverConfigFile,
45
- watch: true
46
- })
47
- ];
48
- case 2:
49
- _state.sent();
50
- meta = getMeta(metaName);
51
- serverConfigPath = path.resolve(appDirectory, SERVER_DIR, "".concat(meta, ".server"));
52
- return [
53
- 4,
54
- hookRunners.beforeDev()
55
- ];
56
- case 3:
57
- _state.sent();
58
- if (!appContext.builder && !apiOnly) {
59
- throw new Error("Expect the Builder to have been initialized, But the appContext.builder received `undefined`");
60
- }
61
- return [
62
- 4,
63
- generateRoutes(appContext)
64
- ];
65
- case 4:
66
- _state.sent();
67
- return [
68
- 4,
69
- loadServerPlugins(api, appDirectory, metaName)
70
- ];
71
- case 5:
72
- pluginInstances = _state.sent();
73
- serverOptions = _object_spread({
74
- metaName,
75
- dev: _object_spread({
76
- port,
77
- https: normalizedConfig.dev.https,
78
- host: normalizedConfig.dev.host
79
- }, (_normalizedConfig_tools = normalizedConfig.tools) === null || _normalizedConfig_tools === void 0 ? void 0 : _normalizedConfig_tools.devServer),
80
- appContext: {
81
- appDirectory,
82
- apiDirectory: appContext.apiDirectory,
83
- lambdaDirectory: appContext.lambdaDirectory,
84
- sharedDirectory: appContext.sharedDirectory
85
- },
86
- serverConfigPath,
87
- routes: serverRoutes,
88
- pwd: appDirectory,
89
- config: normalizedConfig,
90
- serverConfigFile,
91
- plugins: pluginInstances
92
- }, devServerOptions);
93
- host = ((_normalizedConfig_dev = normalizedConfig.dev) === null || _normalizedConfig_dev === void 0 ? void 0 : _normalizedConfig_dev.host) || DEFAULT_DEV_HOST;
94
- if (!apiOnly)
95
- return [
96
- 3,
97
- 7
98
- ];
99
- return [
100
- 4,
101
- createDevServer(_object_spread_props(_object_spread({}, serverOptions), {
102
- runCompile: false
103
- }), (devServerOptions === null || devServerOptions === void 0 ? void 0 : devServerOptions.applyPlugins) || applyPlugins)
104
- ];
105
- case 6:
106
- server = _state.sent().server;
107
- server.listen({
108
- port,
109
- host
110
- }, function() {
111
- printInstructions(hookRunners, appContext, normalizedConfig);
112
- });
113
- return [
114
- 3,
115
- 9
116
- ];
117
- case 7:
118
- return [
119
- 4,
120
- createDevServer(_object_spread_props(_object_spread({}, serverOptions), {
121
- builder: appContext.builder
122
- }), (devServerOptions === null || devServerOptions === void 0 ? void 0 : devServerOptions.applyPlugins) || applyPlugins)
123
- ];
124
- case 8:
125
- _ref2 = _state.sent(), server1 = _ref2.server, afterListen = _ref2.afterListen;
126
- server1.listen({
127
- port,
128
- host
129
- }, function() {
130
- var _ref3 = _async_to_generator(function(err) {
131
- return _ts_generator(this, function(_state2) {
132
- switch (_state2.label) {
133
- case 0:
134
- if (err) {
135
- logger.error("Occur error %s, when start dev server", err);
136
- }
137
- logger.debug("listen dev server done");
138
- return [
139
- 4,
140
- afterListen()
141
- ];
142
- case 1:
143
- _state2.sent();
144
- return [
145
- 2
146
- ];
147
- }
148
- });
149
- });
150
- return function(err) {
151
- return _ref3.apply(this, arguments);
152
- };
153
- }());
154
- setServer(server1);
155
- _state.label = 9;
156
- case 9:
157
- return [
158
- 2
159
- ];
160
- }
161
- });
162
- });
163
- return function dev2(api, options, devServerOptions) {
164
- return _ref.apply(this, arguments);
165
- };
166
- }();
167
- export {
168
- dev
169
- };