@tramvai/cli 5.50.0 → 5.53.78

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 (423) hide show
  1. package/__migrations__/d2023-02-01b-tramvai-config-refactoring.js +78 -80
  2. package/__migrations__/d2025-04-11b-tramvai-config-remove-modern.js +13 -0
  3. package/bin/spawn.js +69 -3
  4. package/lib/api/analyze/index.d.ts +0 -1
  5. package/lib/api/analyze/index.d.ts.map +1 -1
  6. package/lib/api/analyze/index.js +2 -2
  7. package/lib/api/analyze/index.js.map +1 -1
  8. package/lib/api/build/application.d.ts.map +1 -1
  9. package/lib/api/build/application.js +2 -5
  10. package/lib/api/build/application.js.map +1 -1
  11. package/lib/api/build/child-app.d.ts.map +1 -1
  12. package/lib/api/build/child-app.js +1 -5
  13. package/lib/api/build/child-app.js.map +1 -1
  14. package/lib/api/build/index.d.ts +0 -2
  15. package/lib/api/build/index.d.ts.map +1 -1
  16. package/lib/api/build/index.js.map +1 -1
  17. package/lib/api/build/module.d.ts.map +1 -1
  18. package/lib/api/build/module.js +1 -3
  19. package/lib/api/build/module.js.map +1 -1
  20. package/lib/api/index.d.ts.map +1 -1
  21. package/lib/api/index.js +0 -4
  22. package/lib/api/index.js.map +1 -1
  23. package/lib/api/start/index.d.ts +0 -1
  24. package/lib/api/start/index.d.ts.map +1 -1
  25. package/lib/api/start/index.js.map +1 -1
  26. package/lib/api/start/utils/banner.d.ts.map +1 -1
  27. package/lib/api/start/utils/banner.js +0 -1
  28. package/lib/api/start/utils/banner.js.map +1 -1
  29. package/lib/api/start/utils/tips/tips.d.ts.map +1 -1
  30. package/lib/api/start/utils/tips/tips.js +0 -8
  31. package/lib/api/start/utils/tips/tips.js.map +1 -1
  32. package/lib/builder/webpack/devServer/pool/process/pool.d.ts.map +1 -1
  33. package/lib/builder/webpack/devServer/pool/process/pool.js +0 -2
  34. package/lib/builder/webpack/devServer/pool/process/pool.js.map +1 -1
  35. package/lib/builder/webpack/devServer/server.d.ts.map +1 -1
  36. package/lib/builder/webpack/devServer/server.js +4 -0
  37. package/lib/builder/webpack/devServer/server.js.map +1 -1
  38. package/lib/builder/webpack/index.d.ts.map +1 -1
  39. package/lib/builder/webpack/index.js +3 -5
  40. package/lib/builder/webpack/index.js.map +1 -1
  41. package/lib/builder/webpack/providers/build/client.d.ts.map +1 -1
  42. package/lib/builder/webpack/providers/build/client.js +0 -1
  43. package/lib/builder/webpack/providers/build/client.js.map +1 -1
  44. package/lib/builder/webpack/providers/build/clientShared.d.ts.map +1 -1
  45. package/lib/builder/webpack/providers/build/clientShared.js +4 -6
  46. package/lib/builder/webpack/providers/build/clientShared.js.map +1 -1
  47. package/lib/builder/webpack/providers/client.d.ts.map +1 -1
  48. package/lib/builder/webpack/providers/client.js +0 -13
  49. package/lib/builder/webpack/providers/client.js.map +1 -1
  50. package/lib/builder/webpack/providers/shared.d.ts.map +1 -1
  51. package/lib/builder/webpack/providers/shared.js +2 -8
  52. package/lib/builder/webpack/providers/shared.js.map +1 -1
  53. package/lib/builder/webpack/tokens.d.ts +4 -139
  54. package/lib/builder/webpack/tokens.d.ts.map +1 -1
  55. package/lib/builder/webpack/tokens.js +1 -4
  56. package/lib/builder/webpack/tokens.js.map +1 -1
  57. package/lib/builder/webpack/utils/copyStatsJsonFile.d.ts.map +1 -1
  58. package/lib/builder/webpack/utils/copyStatsJsonFile.js +0 -11
  59. package/lib/builder/webpack/utils/copyStatsJsonFile.js.map +1 -1
  60. package/lib/cli/CLI.d.ts +2 -2
  61. package/lib/cli/CLI.d.ts.map +1 -1
  62. package/lib/cli/CLI.js +2 -2
  63. package/lib/cli/CLI.js.map +1 -1
  64. package/lib/cli/index.d.ts.map +1 -1
  65. package/lib/cli/index.js +28 -7
  66. package/lib/cli/index.js.map +1 -1
  67. package/lib/cli/runCLI.d.ts +3 -0
  68. package/lib/cli/runCLI.d.ts.map +1 -1
  69. package/lib/cli/runCLI.js +18 -6
  70. package/lib/cli/runCLI.js.map +1 -1
  71. package/lib/commands/build/command.d.ts +1 -1
  72. package/lib/commands/build/command.d.ts.map +1 -1
  73. package/lib/commands/build/command.js +41 -13
  74. package/lib/commands/build/command.js.map +1 -1
  75. package/lib/commands/createApp.d.ts.map +1 -1
  76. package/lib/commands/createApp.js +0 -1
  77. package/lib/commands/createApp.js.map +1 -1
  78. package/lib/commands/new/new.d.ts.map +1 -1
  79. package/lib/commands/new/new.js +28 -3
  80. package/lib/commands/new/new.js.map +1 -1
  81. package/lib/commands/start/command.d.ts +1 -1
  82. package/lib/commands/start/command.d.ts.map +1 -1
  83. package/lib/commands/start/command.js +39 -7
  84. package/lib/commands/start/command.js.map +1 -1
  85. package/lib/commands/start/start.d.ts +1 -1
  86. package/lib/commands/start/start.d.ts.map +1 -1
  87. package/lib/commands/start/start.js +2 -1
  88. package/lib/commands/start/start.js.map +1 -1
  89. package/lib/commands/static/application.d.ts.map +1 -1
  90. package/lib/commands/static/application.js +0 -1
  91. package/lib/commands/static/application.js.map +1 -1
  92. package/lib/commands/update/command.d.ts +6 -1
  93. package/lib/commands/update/command.d.ts.map +1 -1
  94. package/lib/commands/update/command.js +8 -1
  95. package/lib/commands/update/command.js.map +1 -1
  96. package/lib/commands/update/dependantLibs.d.ts +2 -1
  97. package/lib/commands/update/dependantLibs.d.ts.map +1 -1
  98. package/lib/commands/update/dependantLibs.js +17 -4
  99. package/lib/commands/update/dependantLibs.js.map +1 -1
  100. package/lib/commands/update/update.d.ts +2 -1
  101. package/lib/commands/update/update.d.ts.map +1 -1
  102. package/lib/commands/update/update.js +6 -6
  103. package/lib/commands/update/update.js.map +1 -1
  104. package/lib/commands/update/updatePackageJson.d.ts +1 -1
  105. package/lib/commands/update/updatePackageJson.d.ts.map +1 -1
  106. package/lib/commands/update/updatePackageJson.js +10 -14
  107. package/lib/commands/update/updatePackageJson.js.map +1 -1
  108. package/lib/config/configManager.d.ts +0 -1
  109. package/lib/config/configManager.d.ts.map +1 -1
  110. package/lib/config/configManager.js +2 -17
  111. package/lib/config/configManager.js.map +1 -1
  112. package/lib/config/validate.d.ts.map +1 -1
  113. package/lib/config/validate.js +8 -1
  114. package/lib/config/validate.js.map +1 -1
  115. package/lib/di/providers/index.d.ts +0 -1
  116. package/lib/di/providers/index.d.ts.map +1 -1
  117. package/lib/di/providers/index.js +0 -1
  118. package/lib/di/providers/index.js.map +1 -1
  119. package/lib/di/tokens/config.d.ts +2 -0
  120. package/lib/di/tokens/config.d.ts.map +1 -1
  121. package/lib/di/tokens/index.d.ts +0 -1
  122. package/lib/di/tokens/index.d.ts.map +1 -1
  123. package/lib/di/tokens/index.js +0 -1
  124. package/lib/di/tokens/index.js.map +1 -1
  125. package/lib/library/babel/index.d.ts +0 -44
  126. package/lib/library/babel/index.d.ts.map +1 -1
  127. package/lib/library/babel/index.js +6 -13
  128. package/lib/library/babel/index.js.map +1 -1
  129. package/lib/library/swc/index.js +1 -1
  130. package/lib/library/swc/index.js.map +1 -1
  131. package/lib/library/typescript/index.d.ts +0 -23
  132. package/lib/library/typescript/index.d.ts.map +1 -1
  133. package/lib/library/typescript/index.js +1 -2
  134. package/lib/library/typescript/index.js.map +1 -1
  135. package/lib/library/webpack/application/client/common.d.ts.map +1 -1
  136. package/lib/library/webpack/application/client/common.js +40 -6
  137. package/lib/library/webpack/application/client/common.js.map +1 -1
  138. package/lib/library/webpack/application/client/dev.js +2 -2
  139. package/lib/library/webpack/application/client/dev.js.map +1 -1
  140. package/lib/library/webpack/application/client/prod.d.ts.map +1 -1
  141. package/lib/library/webpack/application/client/prod.js +1 -2
  142. package/lib/library/webpack/application/client/prod.js.map +1 -1
  143. package/lib/library/webpack/application/common.js +1 -1
  144. package/lib/library/webpack/application/common.js.map +1 -1
  145. package/lib/library/webpack/application/server/common.js +1 -1
  146. package/lib/library/webpack/application/server/common.js.map +1 -1
  147. package/lib/library/webpack/application/server/dev.js +1 -1
  148. package/lib/library/webpack/application/server/dev.js.map +1 -1
  149. package/lib/library/webpack/application/server/prod.js +1 -1
  150. package/lib/library/webpack/application/server/prod.js.map +1 -1
  151. package/lib/library/webpack/blocks/css.d.ts.map +1 -1
  152. package/lib/library/webpack/blocks/css.js +15 -11
  153. package/lib/library/webpack/blocks/css.js.map +1 -1
  154. package/lib/library/webpack/blocks/optimize.js +2 -2
  155. package/lib/library/webpack/blocks/optimize.js.map +1 -1
  156. package/lib/library/webpack/blocks/pwa/client.d.ts.map +1 -1
  157. package/lib/library/webpack/blocks/pwa/client.js +2 -5
  158. package/lib/library/webpack/blocks/pwa/client.js.map +1 -1
  159. package/lib/library/webpack/blocks/pwa/shared.d.ts.map +1 -1
  160. package/lib/library/webpack/blocks/pwa/shared.js +2 -3
  161. package/lib/library/webpack/blocks/pwa/shared.js.map +1 -1
  162. package/lib/library/webpack/blocks/resolve.js +2 -2
  163. package/lib/library/webpack/blocks/resolve.js.map +1 -1
  164. package/lib/library/webpack/blocks/serverInline.d.ts.map +1 -1
  165. package/lib/library/webpack/blocks/serverInline.js +1 -2
  166. package/lib/library/webpack/blocks/serverInline.js.map +1 -1
  167. package/lib/library/webpack/blocks/sourcemaps.d.ts +1 -1
  168. package/lib/library/webpack/blocks/sourcemaps.d.ts.map +1 -1
  169. package/lib/library/webpack/blocks/sourcemaps.js +4 -2
  170. package/lib/library/webpack/blocks/sourcemaps.js.map +1 -1
  171. package/lib/library/webpack/child-app/client/common.d.ts.map +1 -1
  172. package/lib/library/webpack/child-app/client/common.js +8 -3
  173. package/lib/library/webpack/child-app/client/common.js.map +1 -1
  174. package/lib/library/webpack/child-app/client/dev.d.ts.map +1 -1
  175. package/lib/library/webpack/child-app/client/dev.js +5 -1
  176. package/lib/library/webpack/child-app/client/dev.js.map +1 -1
  177. package/lib/library/webpack/child-app/client/prod.d.ts.map +1 -1
  178. package/lib/library/webpack/child-app/client/prod.js +4 -0
  179. package/lib/library/webpack/child-app/client/prod.js.map +1 -1
  180. package/lib/library/webpack/child-app/common.d.ts.map +1 -1
  181. package/lib/library/webpack/child-app/common.js +1 -5
  182. package/lib/library/webpack/child-app/common.js.map +1 -1
  183. package/lib/library/webpack/child-app/server/dev.d.ts.map +1 -1
  184. package/lib/library/webpack/child-app/server/dev.js +4 -0
  185. package/lib/library/webpack/child-app/server/dev.js.map +1 -1
  186. package/lib/library/webpack/child-app/server/prod.d.ts.map +1 -1
  187. package/lib/library/webpack/child-app/server/prod.js +4 -0
  188. package/lib/library/webpack/child-app/server/prod.js.map +1 -1
  189. package/lib/library/webpack/common/client/prod.js +1 -1
  190. package/lib/library/webpack/common/client/prod.js.map +1 -1
  191. package/lib/library/webpack/common/main.d.ts.map +1 -1
  192. package/lib/library/webpack/common/main.js +1 -2
  193. package/lib/library/webpack/common/main.js.map +1 -1
  194. package/lib/library/webpack/constants/stats.d.ts.map +1 -1
  195. package/lib/library/webpack/constants/stats.js +2 -0
  196. package/lib/library/webpack/constants/stats.js.map +1 -1
  197. package/lib/library/webpack/loaders/image-loader/getImageMiniatureURL.js +1 -1
  198. package/lib/library/webpack/loaders/image-loader/getImageMiniatureURL.js.map +1 -1
  199. package/lib/library/webpack/module/client/common.js +1 -1
  200. package/lib/library/webpack/module/client/common.js.map +1 -1
  201. package/lib/library/webpack/module/externals.js +1 -1
  202. package/lib/library/webpack/module/externals.js.map +1 -1
  203. package/lib/library/webpack/module/server/common.js +1 -1
  204. package/lib/library/webpack/module/server/common.js.map +1 -1
  205. package/lib/library/webpack/plugins/AssetsIntegritiesPlugin.d.ts +8 -0
  206. package/lib/library/webpack/plugins/AssetsIntegritiesPlugin.d.ts.map +1 -0
  207. package/lib/library/webpack/plugins/AssetsIntegritiesPlugin.js +29 -0
  208. package/lib/library/webpack/plugins/AssetsIntegritiesPlugin.js.map +1 -0
  209. package/lib/library/webpack/plugins/PurifyStatsPlugin.d.ts +15 -0
  210. package/lib/library/webpack/plugins/PurifyStatsPlugin.d.ts.map +1 -0
  211. package/lib/library/webpack/plugins/PurifyStatsPlugin.js +47 -0
  212. package/lib/library/webpack/plugins/PurifyStatsPlugin.js.map +1 -0
  213. package/lib/library/webpack/plugins/RuntimePathPlugin.d.ts.map +1 -1
  214. package/lib/library/webpack/plugins/RuntimePathPlugin.js +7 -3
  215. package/lib/library/webpack/plugins/RuntimePathPlugin.js.map +1 -1
  216. package/lib/library/webpack/utils/transpiler.d.ts +0 -1
  217. package/lib/library/webpack/utils/transpiler.d.ts.map +1 -1
  218. package/lib/library/webpack/utils/transpiler.js +1 -5
  219. package/lib/library/webpack/utils/transpiler.js.map +1 -1
  220. package/lib/models/analytics/analytics.d.ts +156 -0
  221. package/lib/models/analytics/analytics.d.ts.map +1 -0
  222. package/lib/models/analytics/analytics.js +259 -0
  223. package/lib/models/analytics/analytics.js.map +1 -0
  224. package/lib/models/analytics/analytics.worker.d.ts +5 -0
  225. package/lib/models/analytics/analytics.worker.d.ts.map +1 -0
  226. package/lib/models/analytics/analytics.worker.js +87 -0
  227. package/lib/models/analytics/analytics.worker.js.map +1 -0
  228. package/lib/models/analytics/utils.d.ts +15 -0
  229. package/lib/models/analytics/utils.d.ts.map +1 -0
  230. package/lib/models/analytics/utils.js +85 -0
  231. package/lib/models/analytics/utils.js.map +1 -0
  232. package/lib/models/command.d.ts.map +1 -1
  233. package/lib/models/command.js +1 -7
  234. package/lib/models/command.js.map +1 -1
  235. package/lib/models/context.d.ts +4 -4
  236. package/lib/models/context.d.ts.map +1 -1
  237. package/lib/models/context.js +3 -2
  238. package/lib/models/context.js.map +1 -1
  239. package/lib/models/logger.d.ts +1 -0
  240. package/lib/models/logger.d.ts.map +1 -1
  241. package/lib/models/logger.js +2 -1
  242. package/lib/models/logger.js.map +1 -1
  243. package/lib/models/task.d.ts.map +1 -1
  244. package/lib/models/task.js +1 -7
  245. package/lib/models/task.js.map +1 -1
  246. package/lib/schema/autogeneratedSchema.json +161 -20
  247. package/lib/schema/topLevelSchema.d.ts +14 -0
  248. package/lib/schema/topLevelSchema.d.ts.map +1 -1
  249. package/lib/schema/topLevelSchema.js +14 -0
  250. package/lib/schema/topLevelSchema.js.map +1 -1
  251. package/lib/typings/build/Builder.d.ts +2 -6
  252. package/lib/typings/build/Builder.d.ts.map +1 -1
  253. package/lib/typings/configEntry/application.d.ts +10 -5
  254. package/lib/typings/configEntry/application.d.ts.map +1 -1
  255. package/lib/typings/configEntry/cli.d.ts +13 -0
  256. package/lib/typings/configEntry/cli.d.ts.map +1 -1
  257. package/lib/typings/projectType.d.ts +5 -0
  258. package/lib/typings/projectType.d.ts.map +1 -1
  259. package/lib/typings/target.d.ts +1 -1
  260. package/lib/typings/target.d.ts.map +1 -1
  261. package/lib/utils/commands/dependencies/findTramvaiVersion.d.ts +1 -1
  262. package/lib/utils/commands/dependencies/findTramvaiVersion.d.ts.map +1 -1
  263. package/lib/utils/commands/dependencies/findTramvaiVersion.js +4 -11
  264. package/lib/utils/commands/dependencies/findTramvaiVersion.js.map +1 -1
  265. package/lib/utils/commands/dependencies/getLatestPackageVersion.d.ts +1 -1
  266. package/lib/utils/commands/dependencies/getLatestPackageVersion.d.ts.map +1 -1
  267. package/lib/utils/commands/dependencies/getLatestPackageVersion.js +7 -3
  268. package/lib/utils/commands/dependencies/getLatestPackageVersion.js.map +1 -1
  269. package/lib/utils/cpu-profile.d.ts +3 -0
  270. package/lib/utils/cpu-profile.d.ts.map +1 -1
  271. package/lib/utils/cpu-profile.js +8 -3
  272. package/lib/utils/cpu-profile.js.map +1 -1
  273. package/lib/utils/errors.d.ts +7 -0
  274. package/lib/utils/errors.d.ts.map +1 -0
  275. package/lib/utils/errors.js +43 -0
  276. package/lib/utils/errors.js.map +1 -0
  277. package/lib/utils/memoryUsage.d.ts +20 -0
  278. package/lib/utils/memoryUsage.d.ts.map +1 -0
  279. package/lib/utils/memoryUsage.js +51 -0
  280. package/lib/utils/memoryUsage.js.map +1 -0
  281. package/lib/utils/safeRequire.d.ts +1 -1
  282. package/lib/utils/safeRequire.d.ts.map +1 -1
  283. package/lib/utils/safeRequire.js +13 -3
  284. package/lib/utils/safeRequire.js.map +1 -1
  285. package/package.json +13 -15
  286. package/schema.json +175 -20
  287. package/src/api/analyze/index.ts +2 -3
  288. package/src/api/benchmark/__integration__/__fixtures__/tramvai.json +3 -0
  289. package/src/api/build/__integration__/__fixtures__/tramvai.json +4 -2
  290. package/src/api/build/__integration__/build.test.ts +0 -1
  291. package/src/api/build/application.ts +2 -5
  292. package/src/api/build/child-app.ts +1 -5
  293. package/src/api/build/index.ts +0 -2
  294. package/src/api/build/module.ts +1 -3
  295. package/src/api/index.ts +1 -10
  296. package/src/api/start/__integration__/__fixtures__/app/server.tsx +1 -0
  297. package/src/api/start/__integration__/__fixtures__/package.json +0 -3
  298. package/src/api/start/__integration__/__fixtures__/tramvai.json +3 -0
  299. package/src/api/start/__integration__/start.test.ts +2 -1
  300. package/src/api/start/index.ts +0 -1
  301. package/src/api/start/utils/banner.ts +0 -1
  302. package/src/api/start/utils/tips/tips.ts +0 -9
  303. package/src/builder/webpack/devServer/pool/process/pool.ts +0 -2
  304. package/src/builder/webpack/devServer/server.ts +5 -0
  305. package/src/builder/webpack/index.ts +3 -5
  306. package/src/builder/webpack/providers/build/client.ts +0 -1
  307. package/src/builder/webpack/providers/build/clientShared.ts +5 -11
  308. package/src/builder/webpack/providers/client.ts +1 -19
  309. package/src/builder/webpack/providers/shared.ts +2 -9
  310. package/src/builder/webpack/tokens.ts +0 -9
  311. package/src/builder/webpack/utils/copyStatsJsonFile.ts +0 -17
  312. package/src/cli/CLI.ts +6 -4
  313. package/src/cli/index.ts +33 -8
  314. package/src/cli/runCLI.ts +26 -5
  315. package/src/commands/build/command.ts +45 -13
  316. package/src/commands/createApp.ts +0 -2
  317. package/src/commands/new/new.ts +39 -7
  318. package/src/commands/new/templates/packageManagerConfig/yarnPackageManagerConfig/_yarnrc.yml.hbs +9 -0
  319. package/src/commands/new/templates/shared/_gitignore.hbs +10 -0
  320. package/src/commands/new/templates/shared/package.json.hbs +5 -1
  321. package/src/commands/start/command.ts +42 -7
  322. package/src/commands/start/start.ts +7 -1
  323. package/src/commands/static/application.ts +0 -1
  324. package/src/commands/update/command.ts +9 -1
  325. package/src/commands/update/dependantLibs.ts +23 -8
  326. package/src/commands/update/update.ts +7 -6
  327. package/src/commands/update/updatePackageJson.spec.ts +66 -3
  328. package/src/commands/update/updatePackageJson.ts +28 -16
  329. package/src/config/__integration__/__fixtures__/relative/src/index.ts +0 -0
  330. package/src/config/__integration__/__fixtures__/relative/src/polyfill.ts +0 -0
  331. package/src/config/__integration__/validate.test.ts +94 -0
  332. package/src/config/configManager.ts +2 -19
  333. package/src/config/validate.ts +8 -1
  334. package/src/di/providers/index.ts +0 -1
  335. package/src/di/tokens/index.ts +0 -1
  336. package/src/library/babel/index.ts +8 -14
  337. package/src/library/babel/plugins/__snapshots__/create-token-pure.spec.ts.snap +6 -6
  338. package/src/library/babel/plugins/__snapshots__/fill-declare-action-name.spec.ts.snap +24 -26
  339. package/src/library/babel/plugins/__snapshots__/provider-stack.spec.ts.snap +40 -59
  340. package/src/library/babel/plugins/lazy-component/lazy-component.spec.ts +0 -1
  341. package/src/library/babel/plugins/lazy-component/legacy-universal-replace.spec.ts +0 -1
  342. package/src/library/swc/__integration__/__snapshots__/swc.build.test.ts.snap +15 -208
  343. package/src/library/swc/__integration__/__snapshots__/swc.start.test.ts.snap +7 -10
  344. package/src/library/swc/__integration__/swc.build.test.ts +1 -13
  345. package/src/library/swc/__integration__/swc.start.test.ts +3 -0
  346. package/src/library/swc/index.ts +1 -1
  347. package/src/library/typescript/index.ts +1 -3
  348. package/src/library/webpack/application/client/common.ts +63 -6
  349. package/src/library/webpack/application/client/dev.ts +2 -2
  350. package/src/library/webpack/application/client/prod.ts +1 -2
  351. package/src/library/webpack/application/common.ts +1 -1
  352. package/src/library/webpack/application/server/common.ts +1 -1
  353. package/src/library/webpack/application/server/dev.ts +1 -1
  354. package/src/library/webpack/application/server/prod.ts +1 -1
  355. package/src/library/webpack/blocks/css.ts +17 -11
  356. package/src/library/webpack/blocks/optimize.ts +2 -2
  357. package/src/library/webpack/blocks/pwa/client.ts +1 -6
  358. package/src/library/webpack/blocks/pwa/shared.ts +1 -3
  359. package/src/library/webpack/blocks/resolve.ts +2 -2
  360. package/src/library/webpack/blocks/serverInline.ts +1 -2
  361. package/src/library/webpack/blocks/sourcemaps.ts +4 -2
  362. package/src/library/webpack/child-app/client/common.ts +9 -3
  363. package/src/library/webpack/child-app/client/dev.ts +6 -1
  364. package/src/library/webpack/child-app/client/prod.ts +5 -0
  365. package/src/library/webpack/child-app/common.ts +1 -7
  366. package/src/library/webpack/child-app/server/dev.ts +5 -0
  367. package/src/library/webpack/child-app/server/prod.ts +5 -0
  368. package/src/library/webpack/common/client/prod.ts +1 -1
  369. package/src/library/webpack/common/main.ts +1 -5
  370. package/src/library/webpack/constants/stats.ts +2 -0
  371. package/src/library/webpack/loaders/image-loader/getImageMiniatureURL.ts +1 -1
  372. package/src/library/webpack/module/client/common.ts +1 -1
  373. package/src/library/webpack/module/externals.ts +1 -1
  374. package/src/library/webpack/module/server/common.ts +1 -1
  375. package/src/library/webpack/plugins/AssetsIntegritiesPlugin.ts +34 -0
  376. package/src/library/webpack/plugins/PurifyStatsPlugin.ts +57 -0
  377. package/src/library/webpack/plugins/RuntimePathPlugin.ts +8 -3
  378. package/src/library/webpack/utils/polyfills/__integration__/__snapshots__/condition.test.ts.snap +16 -16
  379. package/src/library/webpack/utils/transpiler.ts +1 -5
  380. package/src/models/analytics/analytics.ts +488 -0
  381. package/src/models/analytics/analytics.worker.ts +102 -0
  382. package/src/models/analytics/utils.ts +122 -0
  383. package/src/models/command.ts +1 -8
  384. package/src/models/config.spec.ts +6 -2
  385. package/src/models/context.ts +4 -5
  386. package/src/models/logger.ts +2 -0
  387. package/src/models/task.ts +1 -7
  388. package/src/schema/autogeneratedSchema.json +161 -20
  389. package/src/schema/topLevelSchema.js +14 -0
  390. package/src/schema/tramvai.spec.ts +3 -1
  391. package/src/typings/build/Builder.ts +3 -8
  392. package/src/typings/configEntry/application.ts +11 -6
  393. package/src/typings/configEntry/cli.ts +14 -0
  394. package/src/typings/projectType.ts +5 -0
  395. package/src/typings/target.ts +1 -1
  396. package/src/utils/commands/dependencies/findTramvaiVersion.ts +5 -12
  397. package/src/utils/commands/dependencies/getLatestPackageVersion.ts +11 -3
  398. package/src/utils/cpu-profile.ts +14 -3
  399. package/src/utils/errors.ts +39 -0
  400. package/src/utils/memoryUsage.ts +58 -0
  401. package/src/utils/safeRequire.spec.ts +36 -0
  402. package/src/utils/safeRequire.ts +12 -3
  403. package/lib/builder/webpack/providers/build/clientModern.d.ts +0 -3
  404. package/lib/builder/webpack/providers/build/clientModern.d.ts.map +0 -1
  405. package/lib/builder/webpack/providers/build/clientModern.js +0 -60
  406. package/lib/builder/webpack/providers/build/clientModern.js.map +0 -1
  407. package/lib/di/providers/analytics.d.ts +0 -3
  408. package/lib/di/providers/analytics.d.ts.map +0 -1
  409. package/lib/di/providers/analytics.js +0 -20
  410. package/lib/di/providers/analytics.js.map +0 -1
  411. package/lib/di/tokens/analytics.d.ts +0 -14
  412. package/lib/di/tokens/analytics.d.ts.map +0 -1
  413. package/lib/di/tokens/analytics.js +0 -8
  414. package/lib/di/tokens/analytics.js.map +0 -1
  415. package/lib/models/analytics.d.ts +0 -31
  416. package/lib/models/analytics.d.ts.map +0 -1
  417. package/lib/models/analytics.js +0 -79
  418. package/lib/models/analytics.js.map +0 -1
  419. package/src/builder/webpack/providers/build/clientModern.ts +0 -64
  420. package/src/di/providers/analytics.ts +0 -22
  421. package/src/di/tokens/analytics.ts +0 -8
  422. package/src/models/analytics.ts +0 -116
  423. /package/src/commands/new/templates/{shared → packageManagerConfig/defaultPackageManagerConfig}/_npmrc.hbs +0 -0
@@ -6,7 +6,7 @@ import type { ConfigManager } from '../../../config/configManager';
6
6
  import type { CliConfigEntry } from '../../../typings/configEntry/cli';
7
7
 
8
8
  export default (configManager: ConfigManager<CliConfigEntry>) => (config: Config) => {
9
- const { modern, debug, disableProdOptimization } = configManager;
9
+ const { debug, disableProdOptimization } = configManager;
10
10
 
11
11
  const isProductionProfilingEnabled = !!process.env.TRAMVAI_REACT_PROFILE;
12
12
  const tramvaiReactProfileTerserOptions = {
@@ -60,7 +60,7 @@ export default (configManager: ConfigManager<CliConfigEntry>) => (config: Config
60
60
  parallel: terser.parallel,
61
61
  terserOptions: {
62
62
  ...tramvaiReactProfileTerserOptions,
63
- ecma: modern ? 6 : 5,
63
+ ecma: 6,
64
64
  mangle: {
65
65
  // https://github.com/node-fetch/node-fetch/issues/667
66
66
  // иначе AbortSignal минифицируется и на сервере падает ошибка в node-fetch
@@ -18,7 +18,6 @@ export const pwaBlock =
18
18
  root,
19
19
  output,
20
20
  env,
21
- modern,
22
21
  sourceMap,
23
22
  assetsPrefix,
24
23
  } = configManager;
@@ -26,7 +25,7 @@ export const pwaBlock =
26
25
  config.batch(pwaSharedBlock(configManager));
27
26
 
28
27
  if (
29
- !safeRequireResolve('@tramvai/module-progressive-web-app', true) &&
28
+ !safeRequireResolve('@tramvai/module-progressive-web-app', rootDir, true) &&
30
29
  (pwa.workbox?.enabled || pwa.webmanifest?.enabled)
31
30
  ) {
32
31
  throw Error('PWA functional requires @tramvai/module-progressive-web-app installed');
@@ -101,10 +100,6 @@ export const pwaBlock =
101
100
  };
102
101
  }
103
102
 
104
- if (modern) {
105
- workboxOptions.swDest = workboxOptions.swDest.replace(/\.js$/, '.modern.js');
106
- }
107
-
108
103
  // @todo: break hmr on client when sw.ts is changed - infinity loop !!!
109
104
 
110
105
  const workboxPlugin = new InjectManifest(workboxOptions);
@@ -9,7 +9,6 @@ export const pwaSharedBlock =
9
9
  experiments: { pwa },
10
10
  rootDir,
11
11
  root,
12
- modern,
13
12
  } = configManager;
14
13
 
15
14
  config.plugin('define').tap((args) => [
@@ -22,9 +21,8 @@ export const pwaSharedBlock =
22
21
  'process.env.TRAMVAI_PWA_SW_SCOPE': JSON.stringify(pwa.sw?.scope),
23
22
  'process.env.TRAMVAI_PWA_MANIFEST_ENABLED': JSON.stringify(pwa.webmanifest?.enabled),
24
23
  'process.env.TRAMVAI_PWA_MANIFEST_DEST': JSON.stringify(pwa.webmanifest?.dest),
24
+ 'process.env.TRAMVAI_PWA_MANIFEST_SCOPE': JSON.stringify(pwa.webmanifest?.scope),
25
25
  'process.env.TRAMVAI_PWA_META': `'${JSON.stringify(pwa?.meta ?? {})}'`,
26
- // allows to detect that sw.modern.js is exists or not
27
- 'process.env.TRAMVAI_MODERN_BUILD': JSON.stringify(modern),
28
26
  },
29
27
  ]);
30
28
  };
@@ -6,11 +6,11 @@ import type { ConfigManager } from '../../../config/configManager';
6
6
  import { extensions } from '../../../config/constants';
7
7
 
8
8
  export default (configManager: ConfigManager) => (config: Config) => {
9
- const { rootDir, root, modern, buildType } = configManager;
9
+ const { rootDir, root, buildType } = configManager;
10
10
 
11
11
  config.resolve.mainFields.merge(
12
12
  [
13
- ...(modern && buildType === 'client' ? ['es2017', 'es2016', 'es2015'] : []),
13
+ ...(buildType === 'client' ? ['es2017', 'es2016', 'es2015'] : []),
14
14
  buildType === 'client' && 'browser',
15
15
  'module',
16
16
  'main',
@@ -4,8 +4,7 @@ import type { CliConfigEntry } from '../../../typings/configEntry/cli';
4
4
  import { addTranspilerLoader, getTranspilerConfig } from '../utils/transpiler';
5
5
 
6
6
  export const serverInline = (configManager: ConfigManager<CliConfigEntry>) => (config: Config) => {
7
- // создаём клиентский конфиг и отключаем modern режим
8
- const clientConfigManager = configManager.withSettings({ buildType: 'client', modern: false });
7
+ const clientConfigManager = configManager.withSettings({ buildType: 'client' });
9
8
 
10
9
  const addInlineHandler = (type: string) => {
11
10
  config.module
@@ -1,7 +1,7 @@
1
1
  import type Config from 'webpack-chain';
2
2
  import type { ConfigManager } from '../../../config/configManager';
3
3
 
4
- export default (configManager: ConfigManager) => (config: Config) => {
4
+ export default (configManager: ConfigManager, target: 'client' | 'server') => (config: Config) => {
5
5
  if (configManager.debug || configManager.env === 'development') {
6
6
  config.module
7
7
  .rule('source-map-loader')
@@ -10,7 +10,9 @@ export default (configManager: ConfigManager) => (config: Config) => {
10
10
  .use('source-map')
11
11
  .loader('source-map-loader');
12
12
 
13
- config.devtool('source-map');
13
+ // Chrome devtools does not support source maps with remote debug nodejs
14
+ // PR with fix: https://github.com/nodejs/node/pull/58077
15
+ config.devtool(target === 'server' ? 'inline-source-map' : 'source-map');
14
16
  } else {
15
17
  config.devtool('hidden-source-map');
16
18
  }
@@ -9,6 +9,7 @@ import files from '../../blocks/filesClient';
9
9
  import nodeClient from '../../blocks/nodeClient';
10
10
  import postcssAssets from '../../blocks/postcssAssets';
11
11
  import type { ChildAppConfigEntry } from '../../../../typings/configEntry/child-app';
12
+ import { purifyStatsPluginFactory } from '../../plugins/PurifyStatsPlugin';
12
13
 
13
14
  const IDENTIFIER_NAME_REPLACE_REGEX = /^([^a-zA-Z$_])/;
14
15
  const IDENTIFIER_ALPHA_NUMERIC_NAME_REPLACE_REGEX = /[^a-zA-Z0-9$]+/g;
@@ -26,7 +27,7 @@ export default (configManager: ConfigManager<ChildAppConfigEntry>) => (config: C
26
27
 
27
28
  config.batch(common(configManager));
28
29
 
29
- config.target(['web', 'es5']);
30
+ config.target(['web']);
30
31
 
31
32
  config.output
32
33
  .path(configManager.buildPath)
@@ -44,14 +45,19 @@ export default (configManager: ConfigManager<ChildAppConfigEntry>) => (config: C
44
45
  },
45
46
  ]);
46
47
 
48
+ const statsFileName = `${name}_stats_loadable@${version}.json`;
47
49
  config.plugin('loadable-stats-plugin').use(LoadablePlugin, [
48
50
  {
49
- writeToDisk: true,
50
- filename: `${name}_stats_loadable@${version}.json`,
51
+ filename: statsFileName,
52
+ outputAsset: true,
51
53
  // to prevent webpack modules with same id collision, because Child Apps builds are independent of each other
52
54
  chunkLoadingGlobal: toIdentifier(`__LOADABLE_LOADED_CHUNKS__child_app_${name}_${version}__`),
53
55
  },
54
56
  ]);
55
57
 
58
+ config
59
+ .plugin('assets-purify-plugin')
60
+ .use(purifyStatsPluginFactory('child-app'), [{ fileName: statsFileName }]);
61
+
56
62
  config.batch(files(configManager)).batch(nodeClient(configManager));
57
63
  };
@@ -9,6 +9,7 @@ import type { UI_SHOW_PROGRESS_TOKEN } from '../../../../di/tokens';
9
9
  import { extendEntry } from '../../utils/extendEntry';
10
10
  import type { ChildAppConfigEntry } from '../../../../typings/configEntry/child-app';
11
11
  import FancyReporter from '../../plugins/WebpackBar/reporters/fancy';
12
+ import sourcemaps from '../../blocks/sourcemaps';
12
13
 
13
14
  export const webpackClientConfig = ({
14
15
  configManager,
@@ -25,6 +26,10 @@ export const webpackClientConfig = ({
25
26
  config.mode('development');
26
27
  config.devtool(configManager.webpack.devtool ?? false);
27
28
 
29
+ if (configManager.sourceMap) {
30
+ config.batch(sourcemaps(configManager, 'client'));
31
+ }
32
+
28
33
  if (showProgress) {
29
34
  config.plugin('progress').use(WebpackBar, [
30
35
  {
@@ -59,7 +64,7 @@ export const webpackClientConfig = ({
59
64
 
60
65
  extendEntry(config.entry(configManager.name), {
61
66
  import: [
62
- 'webpack-hot-middleware/client?name=client&dynamicPublicPath=true&path=__webpack_hmr',
67
+ 'webpack-hot-middleware/client?name=client&dynamicPublicPath=true&path=__webpack_hmr&reload=true',
63
68
  ],
64
69
  });
65
70
  }
@@ -4,6 +4,7 @@ import common from './common';
4
4
  import optimize from '../../blocks/optimize';
5
5
  import commonProd from '../../common/client/prod';
6
6
  import type { ChildAppConfigEntry } from '../../../../typings/configEntry/child-app';
7
+ import sourcemaps from '../../blocks/sourcemaps';
7
8
 
8
9
  export const webpackClientConfig = ({
9
10
  configManager,
@@ -15,6 +16,10 @@ export const webpackClientConfig = ({
15
16
  config.batch(common(configManager));
16
17
  config.batch(commonProd(configManager));
17
18
 
19
+ if (configManager.sourceMap) {
20
+ config.batch(sourcemaps(configManager, 'client'));
21
+ }
22
+
18
23
  config.batch(optimize(configManager));
19
24
 
20
25
  return config;
@@ -14,7 +14,6 @@ import nodeClient from '../blocks/nodeClient';
14
14
  import type { SplitChunksOptions, UniversalFederationPluginOptions } from '../types/webpack';
15
15
  import { getSharedModules } from './moduleFederationShared';
16
16
  import { configToEnv } from '../blocks/configToEnv';
17
- import sourcemaps from '../blocks/sourcemaps';
18
17
  import type { ChildAppConfigEntry } from '../../../typings/configEntry/child-app';
19
18
  import { extractCssPluginFactory } from '../blocks/extractCssPlugin';
20
19
  import type { ModuleFederationFixRangeOptions } from '../plugins/ModuleFederationFixRange';
@@ -24,8 +23,7 @@ import { PatchAutoPublicPathPlugin } from '../plugins/AutoPublicPathPlugin';
24
23
 
25
24
  // eslint-disable-next-line max-statements
26
25
  export default (configManager: ConfigManager<ChildAppConfigEntry>) => (config: Config) => {
27
- const { name, root, rootDir, sourceMap, buildType, shared, env, hotRefresh, target } =
28
- configManager;
26
+ const { name, root, rootDir, buildType, shared, env, target } = configManager;
29
27
 
30
28
  const cssLocalIdentName =
31
29
  configManager.env === 'production'
@@ -54,10 +52,6 @@ export default (configManager: ConfigManager<ChildAppConfigEntry>) => (config: C
54
52
  })
55
53
  );
56
54
 
57
- if (sourceMap) {
58
- config.batch(sourcemaps(configManager));
59
- }
60
-
61
55
  config.batch(
62
56
  extractCssPluginFactory(configManager, {
63
57
  filename: `[name]@${configManager.version}.css`,
@@ -6,6 +6,7 @@ import commonDev from '../../common/dev';
6
6
  import type { UI_SHOW_PROGRESS_TOKEN } from '../../../../di/tokens';
7
7
  import type { ChildAppConfigEntry } from '../../../../typings/configEntry/child-app';
8
8
  import FancyReporter from '../../plugins/WebpackBar/reporters/fancy';
9
+ import sourcemaps from '../../blocks/sourcemaps';
9
10
 
10
11
  export const webpackServerConfig = ({
11
12
  configManager,
@@ -22,6 +23,10 @@ export const webpackServerConfig = ({
22
23
  config.mode('development');
23
24
  config.devtool(configManager.webpack.devtool ?? false);
24
25
 
26
+ if (configManager.sourceMap) {
27
+ config.batch(sourcemaps(configManager, 'server'));
28
+ }
29
+
25
30
  if (showProgress) {
26
31
  config.plugin('progress').use(WebpackBar, [
27
32
  {
@@ -4,6 +4,7 @@ import common from './common';
4
4
  import optimize from '../../blocks/optimize';
5
5
  import commonProd from '../../common/server/prod';
6
6
  import type { ChildAppConfigEntry } from '../../../../typings/configEntry/child-app';
7
+ import sourcemaps from '../../blocks/sourcemaps';
7
8
 
8
9
  export const webpackServerConfig = ({
9
10
  configManager,
@@ -17,5 +18,9 @@ export const webpackServerConfig = ({
17
18
 
18
19
  config.batch(optimize(configManager));
19
20
 
21
+ if (configManager.sourceMap) {
22
+ config.batch(sourcemaps(configManager, 'server'));
23
+ }
24
+
20
25
  return config;
21
26
  };
@@ -29,7 +29,7 @@ export default (configManager: ConfigManager<CliConfigEntry>) => (config: Config
29
29
  if (configManager.dedupe.enabled) {
30
30
  config.batch(
31
31
  dedupe(configManager, {
32
- showLogs: !configManager.modern,
32
+ showLogs: true,
33
33
  onDedupeInfo,
34
34
  })
35
35
  );
@@ -19,7 +19,6 @@ const filterNonExisted = (filePaths: string[]) => {
19
19
 
20
20
  const getConfigCacheNameAdditionalFlags = (configManager: ConfigManager<CliConfigEntry>) => {
21
21
  return [
22
- configManager.buildType === 'client' && configManager.modern ? 'modern' : '',
23
22
  configManager.debug ? 'debug' : '',
24
23
  process.env.TRAMVAI_REACT_PROFILE ? 'tramvai_react_profile' : '',
25
24
  configManager.resolveSymlinks ? '' : 'preserve_symlinks',
@@ -88,10 +87,7 @@ export default (configManager: ConfigManager<CliConfigEntry>) => (config: Config
88
87
  // It may be missing in cases when cli is running programmaticaly
89
88
  config: filterNonExisted([path.resolve(configManager.rootDir, 'tramvai.json')]),
90
89
  css: filterNonExisted([
91
- safeRequireResolve(
92
- path.resolve(configManager.rootDir, getPostcssConfigPath(configManager)),
93
- true
94
- ),
90
+ safeRequireResolve(getPostcssConfigPath(configManager), configManager.rootDir, true),
95
91
  ]),
96
92
  },
97
93
  // https://github.com/vercel/next.js/commit/ff5338ce03a3240a97a5c84f5ad5c31c0f53a6ce
@@ -5,6 +5,7 @@ export const DEFAULT_STATS_OPTIONS: StatsOptions = {
5
5
 
6
6
  publicPath: true,
7
7
  assets: true,
8
+ cachedAssets: true,
8
9
  outputPath: true, // выводит информацию о том в какой папке хранится билд на диске
9
10
  chunkGroups: true, // позволяет получить в stats поле namedChunkGroups которое потом используется в webpack-flush-chunks для получения чанков-зависимостей
10
11
  ids: true, // необходимо чтобы в chunksGroups были выставлены связи между модулями
@@ -14,6 +15,7 @@ export const DEFAULT_STATS_OPTIONS: StatsOptions = {
14
15
  export const DEFAULT_STATS_FIELDS: string[] = [
15
16
  'publicPath',
16
17
  'outputPath',
18
+ 'assets',
17
19
  'assetsByChunkName',
18
20
  'namedChunkGroups',
19
21
  'entrypoints',
@@ -4,7 +4,7 @@ const BLUR_WIDTH = 10;
4
4
  const BLUR_HEIGHT = 10;
5
5
 
6
6
  export const getImageMiniatureDataURL = async (content: Buffer, extension: string) => {
7
- const isSharpInstalled = Boolean(safeRequireResolve('sharp'));
7
+ const isSharpInstalled = Boolean(safeRequireResolve('sharp', __dirname));
8
8
  if (!isSharpInstalled) {
9
9
  return null;
10
10
  }
@@ -17,7 +17,7 @@ export default (configManager: ConfigManager<ModuleConfigEntry>) => (config: Con
17
17
 
18
18
  config.batch(common(configManager));
19
19
 
20
- config.target(['web', 'es5']);
20
+ config.target(['web']);
21
21
 
22
22
  config.output
23
23
  .path(configManager.buildPath)
@@ -1,6 +1,6 @@
1
1
  import resolveExternal from './resolveExternal';
2
2
 
3
- const modules = ['react', 'react-dom'];
3
+ const modules = ['react', 'react-dom', 'react/jsx-runtime', 'react/jsx-dev-runtime'];
4
4
 
5
5
  export default modules.reduce(
6
6
  (acc, name) => {
@@ -12,7 +12,7 @@ export default (configManager: ConfigManager<ModuleConfigEntry>) => (config: Con
12
12
 
13
13
  config.batch(common(configManager));
14
14
 
15
- config.target('node');
15
+ config.target(['node']);
16
16
 
17
17
  config.output
18
18
  .path(configManager.buildPath)
@@ -0,0 +1,34 @@
1
+ const TARGET_PLUGIN_NAME = 'stats-writer-plugin';
2
+
3
+ // Generate integrities field for stats.json
4
+ export default class AssetsIntegritiesPlugin {
5
+ constructor(private options: { fileName: string }) {
6
+ this.options = options;
7
+ }
8
+
9
+ apply(compiler) {
10
+ compiler.hooks.thisCompilation.tap(TARGET_PLUGIN_NAME, (compilation) => {
11
+ compilation.hooks.processAssets.tap(
12
+ {
13
+ name: TARGET_PLUGIN_NAME,
14
+ stage: compilation.constructor.PROCESS_ASSETS_STAGE_REPORT,
15
+ },
16
+ () => {
17
+ const { fileName } = this.options;
18
+ const statsJSON = JSON.parse(compilation.assets[fileName].source().toString());
19
+ const { assets } = statsJSON;
20
+
21
+ statsJSON.integrities = assets.reduce((acc, item) => {
22
+ acc[item.name] = item.integrity;
23
+ return acc;
24
+ }, {});
25
+
26
+ compilation.updateAsset(
27
+ fileName,
28
+ new compiler.webpack.sources.RawSource(JSON.stringify(statsJSON))
29
+ );
30
+ }
31
+ );
32
+ });
33
+ }
34
+ }
@@ -0,0 +1,57 @@
1
+ const targetStatsWriters = {
2
+ 'child-app': '@loadable/webpack-plugin',
3
+ application: 'stats-writer-plugin',
4
+ } as const;
5
+
6
+ type BuildTarget = keyof typeof targetStatsWriters;
7
+
8
+ const getTargetPluginName = (target: BuildTarget) => targetStatsWriters[target];
9
+
10
+ // Purify unused information from stats.json
11
+ export const purifyStatsPluginFactory = (target: BuildTarget) => {
12
+ const targetPluginName = getTargetPluginName(target);
13
+
14
+ return class PurifyStatsPlugin {
15
+ fileName: string;
16
+
17
+ constructor(options: { fileName: string }) {
18
+ this.fileName = options.fileName;
19
+ }
20
+
21
+ apply(compiler) {
22
+ compiler.hooks.make.tap(targetPluginName, (compilation) => {
23
+ compilation.hooks.processAssets.tap(
24
+ {
25
+ name: targetPluginName,
26
+ stage: compilation.constructor.PROCESS_ASSETS_STAGE_REPORT,
27
+ },
28
+ () => {
29
+ const { fileName } = this;
30
+ const statsJSON = JSON.parse(compilation.assets[fileName].source().toString());
31
+ const { assets } = statsJSON;
32
+
33
+ if (assets) {
34
+ if (target === 'application') {
35
+ delete statsJSON.assets;
36
+ } else {
37
+ statsJSON.assets = assets
38
+ .filter((asset) => /\.(js|mjs|cjs|css)$/.test(asset.name))
39
+ .map(({ name, type, chunks, chunkNames }) => ({
40
+ name,
41
+ type,
42
+ chunks,
43
+ chunkNames,
44
+ }));
45
+ }
46
+ }
47
+
48
+ compilation.updateAsset(
49
+ fileName,
50
+ new compiler.webpack.sources.RawSource(JSON.stringify(statsJSON))
51
+ );
52
+ }
53
+ );
54
+ });
55
+ }
56
+ };
57
+ };
@@ -28,11 +28,16 @@ export default class RuntimePathPlugin implements webpack.WebpackPluginInstance
28
28
  compilation.hooks.runtimeRequirementInTree
29
29
  .for(RuntimeGlobals.publicPath)
30
30
  .tap(PLUGIN_NAME, (chunk) => {
31
- // set custom public path only to entries as this way public path will be constructed in runtime
31
+ // set custom public path only to entries and webpack runtime as this way public path will be constructed in runtime
32
32
  // some of the webpack plugins may use [importModule](https://webpack.js.org/api/loaders/#thisimportmodule) that allows execute modules at build time
33
33
  // for example mini-css-extract-plugin uses this method that leads to error `window is not defined` at build if we don't
34
34
  // prevent adding dynamic code to every chunk altogether
35
- const isEntry = compilation.entries.has(chunk.name.toString());
35
+ const chunkName = chunk.name.toString();
36
+ const isEntry = compilation.entries.has(chunkName);
37
+ // webpack runtime chunk with runtimeChunk: 'single' option
38
+ const isWebpackRuntime = chunkName === 'runtime';
39
+
40
+ const needToPatchRuntime = isEntry || isWebpackRuntime;
36
41
 
37
42
  compilation.addRuntimeModule(
38
43
  chunk,
@@ -40,7 +45,7 @@ export default class RuntimePathPlugin implements webpack.WebpackPluginInstance
40
45
  generate() {
41
46
  // setting dynamic publicPath
42
47
  return `${RuntimeGlobals.publicPath} = ${
43
- isEntry ? publicPathEval : defaultPublicPath
48
+ needToPatchRuntime ? publicPathEval : defaultPublicPath
44
49
  };`;
45
50
  }
46
51
  } as any)('runtime-path-module')
@@ -87,7 +87,7 @@ exports[`polyfills spec to feature generator all feature expresssion should be v
87
87
  "es.array.to-spliced": true,
88
88
  "es.array.unshift": true,
89
89
  "es.array.with": true,
90
- "es.async-disposable-stack": false,
90
+ "es.async-disposable-stack": true,
91
91
  "es.data-view": true,
92
92
  "es.date": true,
93
93
  "es.date.get-year": true,
@@ -97,7 +97,7 @@ exports[`polyfills spec to feature generator all feature expresssion should be v
97
97
  "es.date.to-iso-string": true,
98
98
  "es.date.to-json": true,
99
99
  "es.date.to-string": true,
100
- "es.disposable-stack": false,
100
+ "es.disposable-stack": true,
101
101
  "es.error.cause": true,
102
102
  "es.escape": true,
103
103
  "es.function": true,
@@ -169,7 +169,7 @@ exports[`polyfills spec to feature generator all feature expresssion should be v
169
169
  "es.object.seal": true,
170
170
  "es.object.set-prototype-of": true,
171
171
  "es.object.values": true,
172
- "es.observable": false,
172
+ "es.observable": true,
173
173
  "es.parse-float": true,
174
174
  "es.parse-int": true,
175
175
  "es.promise": true,
@@ -236,7 +236,7 @@ exports[`polyfills spec to feature generator all feature expresssion should be v
236
236
  "es.string.trim": true,
237
237
  "es.string.trim-end": true,
238
238
  "es.string.trim-start": true,
239
- "es.suppressed-error": false,
239
+ "es.suppressed-error": true,
240
240
  "es.symbol": true,
241
241
  "es.symbol.description": true,
242
242
  "es.symbol.has-instance": true,
@@ -347,16 +347,16 @@ exports[`polyfills spec to feature generator all feature expresssion should be v
347
347
  "esnext.array.unique-by": false,
348
348
  "esnext.array.unshift": true,
349
349
  "esnext.array.with": true,
350
- "esnext.async-disposable-stack": false,
351
- "esnext.async-disposable-stack.constructor": false,
350
+ "esnext.async-disposable-stack": true,
351
+ "esnext.async-disposable-stack.constructor": true,
352
352
  "esnext.async-iterator": false,
353
353
  "esnext.bigint.range": false,
354
354
  "esnext.composite-key": false,
355
355
  "esnext.composite-symbol": false,
356
356
  "esnext.data-view": true,
357
- "esnext.data-view.get-float16": false,
357
+ "esnext.data-view.get-float16": true,
358
358
  "esnext.data-view.get-uint8-clamped": false,
359
- "esnext.data-view.set-float16": false,
359
+ "esnext.data-view.set-float16": true,
360
360
  "esnext.data-view.set-uint8-clamped": false,
361
361
  "esnext.date": true,
362
362
  "esnext.date.get-year": true,
@@ -366,10 +366,10 @@ exports[`polyfills spec to feature generator all feature expresssion should be v
366
366
  "esnext.date.to-iso-string": true,
367
367
  "esnext.date.to-json": true,
368
368
  "esnext.date.to-string": true,
369
- "esnext.disposable-stack": false,
370
- "esnext.disposable-stack.constructor": false,
369
+ "esnext.disposable-stack": true,
370
+ "esnext.disposable-stack.constructor": true,
371
371
  "esnext.error.cause": true,
372
- "esnext.error.is-error": false,
372
+ "esnext.error.is-error": true,
373
373
  "esnext.escape": true,
374
374
  "esnext.function": true,
375
375
  "esnext.function.bind": true,
@@ -417,7 +417,7 @@ exports[`polyfills spec to feature generator all feature expresssion should be v
417
417
  "esnext.math.deg-per-rad": false,
418
418
  "esnext.math.degrees": false,
419
419
  "esnext.math.expm1": true,
420
- "esnext.math.f16round": false,
420
+ "esnext.math.f16round": true,
421
421
  "esnext.math.fround": true,
422
422
  "esnext.math.fscale": false,
423
423
  "esnext.math.hypot": true,
@@ -483,7 +483,7 @@ exports[`polyfills spec to feature generator all feature expresssion should be v
483
483
  "esnext.object.seal": true,
484
484
  "esnext.object.set-prototype-of": true,
485
485
  "esnext.object.values": true,
486
- "esnext.observable": false,
486
+ "esnext.observable": true,
487
487
  "esnext.parse-float": true,
488
488
  "esnext.parse-int": true,
489
489
  "esnext.promise": true,
@@ -518,7 +518,7 @@ exports[`polyfills spec to feature generator all feature expresssion should be v
518
518
  "esnext.regexp": true,
519
519
  "esnext.regexp.constructor": true,
520
520
  "esnext.regexp.dot-all": true,
521
- "esnext.regexp.escape": false,
521
+ "esnext.regexp.escape": true,
522
522
  "esnext.regexp.exec": true,
523
523
  "esnext.regexp.flags": true,
524
524
  "esnext.regexp.sticky": true,
@@ -582,8 +582,8 @@ exports[`polyfills spec to feature generator all feature expresssion should be v
582
582
  "esnext.string.trim": true,
583
583
  "esnext.string.trim-end": true,
584
584
  "esnext.string.trim-start": true,
585
- "esnext.suppressed-error": false,
586
- "esnext.suppressed-error.constructor": false,
585
+ "esnext.suppressed-error": true,
586
+ "esnext.suppressed-error.constructor": true,
587
587
  "esnext.symbol": true,
588
588
  "esnext.symbol.async-dispose": true,
589
589
  "esnext.symbol.custom-matcher": false,
@@ -13,7 +13,6 @@ export type TranspilerConfig = {
13
13
  env: Env;
14
14
  target: Target;
15
15
  actualTarget: Target;
16
- modern: boolean;
17
16
  isServer: boolean;
18
17
  generateDataQaTag: boolean;
19
18
  enableFillActionNamePlugin: boolean;
@@ -77,7 +76,7 @@ export const getTranspilerConfig = (
77
76
  excludesPresetEnv,
78
77
  experiments: { enableFillDeclareActionNamePlugin, reactCompiler },
79
78
  } = configManager;
80
- const { env, modern } = configManager;
79
+ const { env } = configManager;
81
80
  const isServer = configManager.buildType === 'server';
82
81
 
83
82
  if (alias) {
@@ -90,8 +89,6 @@ Just check or add configuration to your tsconfig file and remove alias from tram
90
89
  if (!target) {
91
90
  if (isServer) {
92
91
  actualTarget = 'node';
93
- } else if (modern) {
94
- actualTarget = 'modern';
95
92
  }
96
93
  }
97
94
 
@@ -110,7 +107,6 @@ Just check or add configuration to your tsconfig file and remove alias from tram
110
107
  isServer,
111
108
  env,
112
109
  generateDataQaTag,
113
- modern,
114
110
  tramvai: true,
115
111
  removeTypeofWindow: true,
116
112
  hot: !!configManager.hotRefresh.enabled,