@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,4 +1,4 @@
1
- import { AppNormalizedConfig, IAppContext } from '../../types';
1
+ import type { AppNormalizedConfig, IAppContext } from '../../types';
2
2
  export declare function initHtmlConfig(config: AppNormalizedConfig<'shared'>, appContext: IAppContext): AppNormalizedConfig<'shared'>['html'];
3
3
  export declare function initSourceConfig(config: AppNormalizedConfig<'shared'>, appContext: IAppContext, bundler: 'webpack' | 'rspack'): void;
4
4
  export declare function createBuilderModuleScope(config: AppNormalizedConfig<'webpack'>): (string | RegExp)[] | undefined;
@@ -1,2 +1,2 @@
1
- import { AppLegacyNormalizedConfig, AppNormalizedConfig } from '../../types';
1
+ import type { AppLegacyNormalizedConfig, AppNormalizedConfig } from '../../types';
2
2
  export declare function createHtmlConfig(config: Readonly<AppLegacyNormalizedConfig>): AppNormalizedConfig<'webpack'>['html'];
@@ -1,2 +1,2 @@
1
- import { AppLegacyNormalizedConfig, AppNormalizedConfig } from '../../types';
1
+ import type { AppLegacyNormalizedConfig, AppNormalizedConfig } from '../../types';
2
2
  export declare function createOutputConfig(config: Readonly<AppLegacyNormalizedConfig>): AppNormalizedConfig<'webpack'>['output'];
@@ -1,2 +1,2 @@
1
- import { AppLegacyNormalizedConfig, AppNormalizedConfig } from '../../types';
1
+ import type { AppLegacyNormalizedConfig, AppNormalizedConfig } from '../../types';
2
2
  export declare function createSourceConfig(config: AppLegacyNormalizedConfig): AppNormalizedConfig<'webpack'>['source'];
@@ -1,2 +1,2 @@
1
- import { AppLegacyNormalizedConfig, AppNormalizedConfig } from '../../types';
1
+ import type { AppLegacyNormalizedConfig, AppNormalizedConfig } from '../../types';
2
2
  export declare function createToolsConfig(config: AppLegacyNormalizedConfig): AppNormalizedConfig<'webpack'>['tools'];
@@ -0,0 +1,6 @@
1
+ export function initialize({ appDir, alias, tsconfigPath }: {
2
+ appDir: any;
3
+ alias: any;
4
+ tsconfigPath: any;
5
+ }): Promise<void>;
6
+ export function resolve(specifier: any, context: any, defaultResolve: any): any;
@@ -0,0 +1,5 @@
1
+ export function registerEsm({ appDir, distDir, alias }: {
2
+ appDir: any;
3
+ distDir: any;
4
+ alias: any;
5
+ }): Promise<void>;
@@ -0,0 +1,6 @@
1
+ export function initialize({ appDir, alias, tsconfigPath }: {
2
+ appDir: any;
3
+ alias: any;
4
+ tsconfigPath: any;
5
+ }): Promise<void>;
6
+ export function resolve(specifier: any, context: any, defaultResolve: any): any;
@@ -0,0 +1,6 @@
1
+ export function createMatchPath({ alias, appDir, tsconfigPath }: {
2
+ alias: any;
3
+ appDir: any;
4
+ tsconfigPath: any;
5
+ }): tsConfigPaths.MatchPath;
6
+ import tsConfigPaths from '@modern-js/utils/tsconfig-paths';
@@ -1,4 +1,4 @@
1
- import { UnstableMiddleware, UnstableMiddlewareContext, UnstableNext } from '@modern-js/types';
1
+ import type { UnstableMiddleware, UnstableMiddlewareContext, UnstableNext } from '@modern-js/types';
2
2
  export type { ServerPlugin } from '@modern-js/server-core';
3
3
  export type RenderMiddleware = UnstableMiddleware;
4
4
  export type RenderMiddlewareContext = UnstableMiddlewareContext;
@@ -1,2 +1,2 @@
1
- import { AppToolsHooks } from './types/hooks';
1
+ import type { AppToolsHooks } from './types/hooks';
2
2
  export declare const hooks: AppToolsHooks;
@@ -1,5 +1,5 @@
1
- import { CliPlugin } from '@modern-js/core';
2
- import { AppTools } from './types';
1
+ import type { CliPlugin } from '@modern-js/core';
2
+ import type { AppTools } from './types';
3
3
  export { dev } from './commands/dev';
4
4
  export type { DevOptions } from './utils/types';
5
5
  export { mergeConfig } from '@modern-js/core';
@@ -1,4 +1,4 @@
1
+ import type { CliHooksRunner } from '@modern-js/core';
1
2
  import type { Entrypoint } from '@modern-js/types';
2
- import { CliHooksRunner } from '@modern-js/core';
3
3
  import type { AppNormalizedConfig, AppTools, IAppContext } from '../../types';
4
4
  export declare const getBundleEntry: (hookRunners: CliHooksRunner<AppTools<'shared'>>, appContext: IAppContext, config: AppNormalizedConfig<'shared'>) => Promise<Entrypoint[]>;
@@ -1,5 +1,5 @@
1
+ import type { CliHooksRunner } from '@modern-js/core';
1
2
  import type { Entrypoint } from '@modern-js/types';
2
- import { CliHooksRunner } from '@modern-js/core';
3
3
  import type { AppNormalizedConfig, AppTools, IAppContext } from '../../types';
4
4
  export type { Entrypoint };
5
5
  export declare const getFileSystemEntry: (hookRunners: CliHooksRunner<AppTools<'shared'>>, appContext: IAppContext, config: AppNormalizedConfig<'shared'>) => Promise<Entrypoint[]>;
@@ -1,5 +1,5 @@
1
1
  import type { CliPlugin } from '@modern-js/core';
2
- import { AppTools } from '../../types';
2
+ import type { AppTools } from '../../types';
3
3
  declare const _default: ({ bundler, }: {
4
4
  bundler: 'webpack' | 'rspack';
5
5
  }) => CliPlugin<AppTools<'shared'>>;
@@ -1,5 +1,5 @@
1
- import type { PackageJson } from 'pkg-types';
2
1
  import type { NodeFileTraceOptions } from '@vercel/nft';
2
+ import type { PackageJson } from 'pkg-types';
3
3
  import { traceFiles as defaultTraceFiles } from './utils';
4
4
  export type { NodeFileTraceOptions } from '@vercel/nft';
5
5
  export { nodeFileTrace } from '@vercel/nft';
@@ -1,5 +1,5 @@
1
+ import { type NodeFileTraceOptions } from '@vercel/nft';
1
2
  import type { PackageJson } from 'pkg-types';
2
- import { NodeFileTraceOptions } from '@vercel/nft';
3
3
  export type TracedPackage = {
4
4
  name: string;
5
5
  versions: Record<string, {
@@ -1,4 +1,4 @@
1
- import { CliPlugin } from '@modern-js/core';
2
- import { AppTools } from '../../types';
1
+ import type { CliPlugin } from '@modern-js/core';
2
+ import type { AppTools } from '../../types';
3
3
  declare const _default: () => CliPlugin<AppTools>;
4
4
  export default _default;
@@ -0,0 +1 @@
1
+ export default handler;
@@ -0,0 +1 @@
1
+ export { handler as default } from "./netlify-handler.cjs";
@@ -0,0 +1 @@
1
+ export function handler(request: any, context: any): Promise<any>;
@@ -1,2 +1,2 @@
1
- import { CreatePreset } from './platform';
1
+ import type { CreatePreset } from './platform';
2
2
  export declare const createNetlifyPreset: CreatePreset;
@@ -1,2 +1,2 @@
1
- import { CreatePreset } from './platform';
1
+ import type { CreatePreset } from './platform';
2
2
  export declare const createNodePreset: CreatePreset;
@@ -1,5 +1,5 @@
1
- import { IAppContext, NormalizedConfig } from '@modern-js/core';
2
- import { AppTools } from '../../../types';
1
+ import type { IAppContext, NormalizedConfig } from '@modern-js/core';
2
+ import type { AppTools } from '../../../types';
3
3
  export type CreatePreset = (appContext: IAppContext, config: NormalizedConfig<AppTools>, needModernServer?: boolean) => DeployPreset;
4
4
  type DeployPreset = {
5
5
  prepare?: () => Promise<void>;
@@ -0,0 +1,2 @@
1
+ export default handler;
2
+ import { handler } from './vercel-handler.cjs';
@@ -0,0 +1,2 @@
1
+ export = handler;
2
+ import { handler } from "./vercel-handler.cjs";
@@ -0,0 +1 @@
1
+ export function handler(req: any, res: any): Promise<any>;
@@ -1,2 +1,2 @@
1
- import { CreatePreset } from './platform';
1
+ import type { CreatePreset } from './platform';
2
2
  export declare const createVercelPreset: CreatePreset;
@@ -1,4 +1,4 @@
1
- import { IAppContext } from '@modern-js/core';
1
+ import type { IAppContext } from '@modern-js/core';
2
2
  export type ServerAppContext = {
3
3
  sharedDirectory: string;
4
4
  apiDirectory: string;
@@ -1,4 +1,4 @@
1
- import type { CliPlugin, AppTools } from '../../types';
1
+ import type { AppTools, CliPlugin } from '../../types';
2
2
  declare const _default: ({ bundler, }: {
3
3
  bundler: 'rspack' | 'webpack';
4
4
  }) => CliPlugin<AppTools<'shared'>>;
@@ -1,3 +1,3 @@
1
- import { CliPlugin, AppTools } from '../types';
1
+ import type { AppTools, CliPlugin } from '../types';
2
2
  declare const _default: () => CliPlugin<AppTools>;
3
3
  export default _default;
@@ -1,17 +1,17 @@
1
- import type { ServerUserConfig, BffUserConfig } from '@modern-js/server-core';
2
- import type { UniBuilderPlugin, LooseRsbuildPlugin } from '@modern-js/uni-builder';
1
+ import type { BffUserConfig, ServerUserConfig } from '@modern-js/server-core';
2
+ import type { LooseRsbuildPlugin, UniBuilderPlugin } from '@modern-js/uni-builder';
3
3
  import type { RsbuildConfig } from '@rsbuild/core';
4
4
  import type { Bundler } from '../utils';
5
+ import type { DeployUserConfig } from './deploy';
6
+ import type { DevUserConfig } from './dev';
7
+ import type { ExperimentsUserConfig } from './experiments';
8
+ import type { HtmlUserConfig } from './html';
5
9
  import type { OutputUserConfig } from './output';
10
+ import type { PerformanceUserConfig } from './performance';
11
+ import type { SecurityUserConfig } from './security';
6
12
  import type { SourceUserConfig } from './source';
7
13
  import type { TestingUserConfig } from './testing';
8
- import type { DevUserConfig } from './dev';
9
14
  import type { ToolsUserConfig } from './tools';
10
- import type { HtmlUserConfig } from './html';
11
- import type { SecurityUserConfig } from './security';
12
- import type { DeployUserConfig } from './deploy';
13
- import type { ExperimentsUserConfig } from './experiments';
14
- import type { PerformanceUserConfig } from './performance';
15
15
  export * from './output';
16
16
  export interface RuntimeUserConfig {
17
17
  [name: string]: any;
@@ -1,5 +1,5 @@
1
- import type { UniBuilderConfig } from '@modern-js/uni-builder';
2
1
  import type { SSGConfig } from '@modern-js/types';
2
+ import type { UniBuilderConfig } from '@modern-js/uni-builder';
3
3
  import type { UnwrapBuilderConfig } from '../utils';
4
4
  export interface OutputUserConfig extends UnwrapBuilderConfig<UniBuilderConfig, 'output'> {
5
5
  /**
@@ -1,8 +1,8 @@
1
- import type { JestConfig } from '@modern-js/types';
2
- import type { PluginSwcOptions } from '@rsbuild/plugin-swc';
3
1
  import type { PluginEsbuildOptions } from '@modern-js/rsbuild-plugin-esbuild';
2
+ import type { JestConfig } from '@modern-js/types';
4
3
  import type { UniBuilderConfig } from '@modern-js/uni-builder';
5
- import type { UnwrapBuilderConfig, Bundler } from '../utils';
4
+ import type { PluginSwcOptions } from '@rsbuild/plugin-swc';
5
+ import type { Bundler, UnwrapBuilderConfig } from '../utils';
6
6
  export type Tailwindcss = Record<string, any> | ((options: Record<string, any>) => Record<string, any> | void);
7
7
  type BuilderToolsConfig = UnwrapBuilderConfig<UniBuilderConfig, 'tools'>;
8
8
  export interface ToolsUserConfig<B extends Bundler = 'webpack'> extends Omit<BuilderToolsConfig, 'swc'> {
@@ -1,8 +1,8 @@
1
+ import type { DevToolData, RegisterBuildPlatformResult } from '@modern-js/core';
1
2
  import type { AsyncWaterfall, AsyncWorkflow, ParallelWorkflow } from '@modern-js/plugin';
2
3
  import type { Entrypoint, HtmlPartials, NestedRouteForCli, PageRoute, RouteLegacy, ServerPlugin, ServerRoute } from '@modern-js/types';
3
- import type { RegisterBuildPlatformResult, DevToolData } from '@modern-js/core';
4
- import type { Rspack, webpack, Stats, MultiStats } from '@modern-js/uni-builder';
5
- import { Bundler } from './utils';
4
+ import type { MultiStats, Rspack, Stats, webpack } from '@modern-js/uni-builder';
5
+ import type { Bundler } from './utils';
6
6
  export interface ImportSpecifier {
7
7
  local?: string;
8
8
  imported?: string;
@@ -1,8 +1,8 @@
1
1
  import type { NormalizedConfig, UserConfig } from '@modern-js/core';
2
- import type { AppToolsUserConfig, AppToolsNormalizedConfig } from './config';
2
+ import type { AppToolsNormalizedConfig, AppToolsUserConfig } from './config';
3
3
  import type { AppToolsHooks } from './hooks';
4
- import type { AppToolsLegacyUserConfig, AppToolsLegacyNormalizedConfig } from './legacyConfig';
5
- import { Bundler } from './utils';
4
+ import type { AppToolsLegacyNormalizedConfig, AppToolsLegacyUserConfig } from './legacyConfig';
5
+ import type { Bundler } from './utils';
6
6
  export * from './hooks';
7
7
  export * from './config';
8
8
  export * from './legacyConfig';
@@ -1,10 +1,10 @@
1
- import type { ServerUserConfig as LegacyServerUserConfig, BffUserConfig as LegacyBffUserConfig } from '@modern-js/server-core';
1
+ import type { BffUserConfig as LegacyBffUserConfig, ServerUserConfig as LegacyServerUserConfig } from '@modern-js/server-core';
2
+ import type { DeployLegacyUserConfig } from './deploy';
2
3
  import type { DevUserLegacyConfig } from './dev';
3
4
  import type { OutputLegacyUserConfig } from './output';
4
5
  import type { SourceLegacyUserConfig } from './source';
5
- import type { DeployLegacyUserConfig } from './deploy';
6
- import type { ToolsLegacyUserConfig } from './tools';
7
6
  import type { TestingLegacyUserConfig } from './testing';
7
+ import type { ToolsLegacyUserConfig } from './tools';
8
8
  export type { DevUserLegacyConfig } from './dev';
9
9
  export type { OutputLegacyUserConfig } from './output';
10
10
  export type { DeployLegacyUserConfig } from './deploy';
@@ -1,4 +1,4 @@
1
- import type { JestConfig, DevServerOptions } from '@modern-js/types';
1
+ import type { DevServerOptions, JestConfig } from '@modern-js/types';
2
2
  import type { UniBuilderConfig } from '@modern-js/uni-builder';
3
3
  type BuilderToolsConfig = Required<UniBuilderConfig>['tools'];
4
4
  export type ToolsLegacyUserConfig = BuilderToolsConfig & {
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import type { Server } from 'node:http';
3
- import { ModernDevServerOptions } from '@modern-js/server';
3
+ import { type ModernDevServerOptions } from '@modern-js/server';
4
4
  export declare const getServer: () => Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse> | null;
5
5
  export declare const setServer: (newServer: Server) => void;
6
6
  export declare const closeServer: () => Promise<void>;
@@ -1,3 +1,3 @@
1
- import { IAppContext } from '../types';
1
+ import type { IAppContext } from '../types';
2
2
  export declare const addServerConfigToDeps: (dependencies: string[], appDirectory: string, serverConfigFile: string) => Promise<void>;
3
3
  export declare function generateWatchFiles(appContext: IAppContext, configDir?: string): Promise<string[]>;
@@ -1,4 +1,4 @@
1
- import { Entrypoint } from '@modern-js/types';
1
+ import type { Entrypoint } from '@modern-js/types';
2
2
  /**
3
3
  * Allow user to select entrypoints to build.
4
4
  */
@@ -1,5 +1,5 @@
1
- import { ServerPlugin as ServerPluginInstance } from '@modern-js/server-core';
2
- import { ServerPlugin } from '@modern-js/types';
3
- import { AppTools, PluginAPI } from '../types';
1
+ import type { ServerPlugin as ServerPluginInstance } from '@modern-js/server-core';
2
+ import type { ServerPlugin } from '@modern-js/types';
3
+ import type { AppTools, PluginAPI } from '../types';
4
4
  export declare function getServerPlugins(api: PluginAPI<AppTools<'shared'>>, metaName?: string): Promise<ServerPlugin[]>;
5
5
  export declare function loadServerPlugins(api: PluginAPI<AppTools<'shared'>>, appDirectory: string, metaName: string): Promise<ServerPluginInstance[]>;
@@ -1,3 +1,3 @@
1
- import type { IAppContext, CliHooksRunner } from '@modern-js/core';
1
+ import type { CliHooksRunner, IAppContext } from '@modern-js/core';
2
2
  import type { AppNormalizedConfig, AppTools } from '../types';
3
3
  export declare const printInstructions: (hookRunners: CliHooksRunner<AppTools<'shared'>>, appContext: IAppContext, config: AppNormalizedConfig<'shared'>) => Promise<void>;
@@ -1,3 +1,3 @@
1
- import { Alias } from '@modern-js/utils';
1
+ import { type Alias } from '@modern-js/utils';
2
2
  import type { ConfigChain } from '@rsbuild/core';
3
- export declare const registerCompiler: (appDir: string | undefined, distDir: string, alias?: ConfigChain<Alias>) => Promise<void>;
3
+ export declare const registerCompiler: (appDir: string, distDir: string, alias?: ConfigChain<Alias>) => Promise<void>;
@@ -1,3 +1,3 @@
1
- import { ToRunners } from '@modern-js/core';
2
- import { AppToolsHooks } from '../types/hooks';
1
+ import { type ToRunners } from '@modern-js/core';
2
+ import type { AppToolsHooks } from '../types/hooks';
3
3
  export declare function restart(hooksRunner: ToRunners<AppToolsHooks>, filename: string): Promise<void>;
package/lib/types.d.ts CHANGED
@@ -36,6 +36,11 @@ declare module '*.png' {
36
36
  export default src;
37
37
  }
38
38
 
39
+ declare module '*.avif' {
40
+ const src: string;
41
+ export default src;
42
+ }
43
+
39
44
  declare module '*.ico' {
40
45
  const src: string;
41
46
  export default src;
@@ -91,6 +96,11 @@ declare module '*.png?inline' {
91
96
  export default src;
92
97
  }
93
98
 
99
+ declare module '*.avif?inline' {
100
+ const src: string;
101
+ export default src;
102
+ }
103
+
94
104
  declare module '*.ico?inline' {
95
105
  const src: string;
96
106
  export default src;
@@ -137,6 +147,11 @@ declare module '*.png?url' {
137
147
  export default src;
138
148
  }
139
149
 
150
+ declare module '*.avif?url' {
151
+ const src: string;
152
+ export default src;
153
+ }
154
+
140
155
  declare module '*.ico?url' {
141
156
  const src: string;
142
157
  export default src;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.58.1",
18
+ "version": "2.58.3",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -77,7 +77,7 @@
77
77
  "@babel/parser": "^7.22.15",
78
78
  "@babel/traverse": "^7.23.2",
79
79
  "@babel/types": "^7.24.7",
80
- "@rsbuild/core": "1.0.1-beta.13",
80
+ "@rsbuild/core": "1.0.1-beta.14",
81
81
  "@rsbuild/plugin-node-polyfill": "1.0.4",
82
82
  "@swc/helpers": "0.5.3",
83
83
  "@vercel/nft": "^0.26.4",
@@ -88,33 +88,33 @@
88
88
  "mlly": "^1.6.1",
89
89
  "pkg-types": "^1.1.0",
90
90
  "std-env": "^3.7.0",
91
- "@modern-js/core": "2.58.1",
92
- "@modern-js/node-bundle-require": "2.58.1",
93
- "@modern-js/plugin": "2.58.1",
94
- "@modern-js/plugin-data-loader": "2.58.1",
95
- "@modern-js/plugin-i18n": "2.58.1",
96
- "@modern-js/prod-server": "2.58.1",
97
- "@modern-js/plugin-lint": "2.58.1",
98
- "@modern-js/server": "2.58.1",
99
- "@modern-js/rsbuild-plugin-esbuild": "2.58.1",
100
- "@modern-js/server-utils": "2.58.1",
101
- "@modern-js/server-core": "2.58.1",
102
- "@modern-js/types": "2.58.1",
103
- "@modern-js/uni-builder": "2.58.1",
104
- "@modern-js/utils": "2.58.1"
91
+ "@modern-js/core": "2.58.3",
92
+ "@modern-js/node-bundle-require": "2.58.3",
93
+ "@modern-js/plugin": "2.58.3",
94
+ "@modern-js/plugin-i18n": "2.58.3",
95
+ "@modern-js/plugin-lint": "2.58.3",
96
+ "@modern-js/prod-server": "2.58.3",
97
+ "@modern-js/rsbuild-plugin-esbuild": "2.58.3",
98
+ "@modern-js/server": "2.58.3",
99
+ "@modern-js/server-utils": "2.58.3",
100
+ "@modern-js/plugin-data-loader": "2.58.3",
101
+ "@modern-js/types": "2.58.3",
102
+ "@modern-js/server-core": "2.58.3",
103
+ "@modern-js/uni-builder": "2.58.3",
104
+ "@modern-js/utils": "2.58.3"
105
105
  },
106
106
  "devDependencies": {
107
- "@rsbuild/plugin-swc": "1.0.1-beta.13",
107
+ "@rsbuild/plugin-swc": "1.0.1-beta.14",
108
108
  "@types/babel__traverse": "7.18.5",
109
109
  "@types/jest": "^29",
110
- "@types/node": "^14",
110
+ "@types/node": "^16",
111
111
  "jest": "^29",
112
112
  "ts-node": "^10.9.1",
113
113
  "tsconfig-paths": "^4.2.0",
114
114
  "typescript": "^5",
115
115
  "webpack": "^5.93.0",
116
- "@scripts/build": "2.58.1",
117
- "@scripts/jest-config": "2.58.1"
116
+ "@scripts/build": "2.58.3",
117
+ "@scripts/jest-config": "2.58.3"
118
118
  },
119
119
  "sideEffects": false,
120
120
  "publishConfig": {
@@ -1,166 +0,0 @@
1
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
- import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
3
- import { _ as _type_of } from "@swc/helpers/_/_type_of";
4
- import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
5
- import path from "path";
6
- import fs from "@modern-js/utils/fs-extra";
7
- import { logger, removeTailSlash } from "@modern-js/utils";
8
- import { createCopyInfo } from "../shared";
9
- var builderPluginAdpaterCopy = function(options) {
10
- return {
11
- name: "builder-plugin-adapter-rspack-copy",
12
- setup: function setup(api) {
13
- var publicPath;
14
- api.modifyBundlerChain(function(chain, param) {
15
- var CHAIN_ID = param.CHAIN_ID;
16
- chain.plugin(CHAIN_ID.PLUGIN.COPY).tap(function(args) {
17
- var _args_;
18
- return [
19
- {
20
- patterns: _to_consumable_array(((_args_ = args[0]) === null || _args_ === void 0 ? void 0 : _args_.patterns) || []).concat(_to_consumable_array(createConfigBuiltinCopy(options)))
21
- }
22
- ];
23
- });
24
- });
25
- api.modifyRspackConfig(function(config) {
26
- var _config_output;
27
- publicPath = (_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.publicPath;
28
- });
29
- api.onDevCompileDone(/* @__PURE__ */ _async_to_generator(function() {
30
- return _ts_generator(this, function(_state) {
31
- switch (_state.label) {
32
- case 0:
33
- return [
34
- 4,
35
- transformHtmlFiles()
36
- ];
37
- case 1:
38
- _state.sent();
39
- return [
40
- 2
41
- ];
42
- }
43
- });
44
- }));
45
- api.onAfterBuild(/* @__PURE__ */ _async_to_generator(function() {
46
- return _ts_generator(this, function(_state) {
47
- switch (_state.label) {
48
- case 0:
49
- return [
50
- 4,
51
- transformHtmlFiles()
52
- ];
53
- case 1:
54
- _state.sent();
55
- return [
56
- 2
57
- ];
58
- }
59
- });
60
- }));
61
- function transformHtmlFiles() {
62
- return _transformHtmlFiles.apply(this, arguments);
63
- }
64
- function _transformHtmlFiles() {
65
- _transformHtmlFiles = /** transform public/*.html manaully */
66
- _async_to_generator(function() {
67
- var _normalizedConfig_output_distPath, normalizedConfig, publicDir, HTML_REGEXP, filepaths;
68
- return _ts_generator(this, function(_state) {
69
- switch (_state.label) {
70
- case 0:
71
- normalizedConfig = options.normalizedConfig;
72
- publicDir = path.resolve(((_normalizedConfig_output_distPath = normalizedConfig.output.distPath) === null || _normalizedConfig_output_distPath === void 0 ? void 0 : _normalizedConfig_output_distPath.root) || "./dist", "./public");
73
- if (!fs.existsSync(publicDir) || !fs.statSync(publicDir).isDirectory()) {
74
- return [
75
- 2
76
- ];
77
- }
78
- HTML_REGEXP = /\.html?$/;
79
- return [
80
- 4,
81
- fs.readdir(publicDir)
82
- ];
83
- case 1:
84
- filepaths = _state.sent().map(function(file) {
85
- return path.resolve(publicDir, file);
86
- });
87
- return [
88
- 4,
89
- Promise.all(filepaths.filter(function(file) {
90
- return HTML_REGEXP.test(file);
91
- }).map(function() {
92
- var _ref = _async_to_generator(function(file) {
93
- var content;
94
- return _ts_generator(this, function(_state2) {
95
- switch (_state2.label) {
96
- case 0:
97
- return [
98
- 4,
99
- fs.readFile(file, "utf-8")
100
- ];
101
- case 1:
102
- content = _state2.sent();
103
- if (!(publicPath && typeof publicPath === "string"))
104
- return [
105
- 3,
106
- 3
107
- ];
108
- return [
109
- 4,
110
- fs.writeFile(file, content.replace(/<%=\s*assetPrefix\s*%>/g, removeTailSlash(publicPath)))
111
- ];
112
- case 2:
113
- _state2.sent();
114
- return [
115
- 3,
116
- 5
117
- ];
118
- case 3:
119
- logger.warn("Expect get a string from `publicPath`, but receive `".concat(typeof publicPath === "undefined" ? "undefined" : _type_of(publicPath), "`."));
120
- return [
121
- 4,
122
- fs.writeFile(file, content.replace(/<%=\s*assetPrefix\s*%>/g, removeTailSlash("/")))
123
- ];
124
- case 4:
125
- _state2.sent();
126
- _state2.label = 5;
127
- case 5:
128
- return [
129
- 2
130
- ];
131
- }
132
- });
133
- });
134
- return function(file) {
135
- return _ref.apply(this, arguments);
136
- };
137
- }()))
138
- ];
139
- case 2:
140
- _state.sent();
141
- return [
142
- 2
143
- ];
144
- }
145
- });
146
- });
147
- return _transformHtmlFiles.apply(this, arguments);
148
- }
149
- }
150
- };
151
- };
152
- function createConfigBuiltinCopy(options) {
153
- var normalizedConfig = options.normalizedConfig, appContext = options.appContext;
154
- var publicDir = createCopyInfo(appContext, normalizedConfig).publicDir;
155
- return [
156
- {
157
- from: "**/*",
158
- to: "public",
159
- context: publicDir,
160
- noErrorOnMissing: true
161
- }
162
- ];
163
- }
164
- export {
165
- builderPluginAdpaterCopy
166
- };