@tramvai/cli 5.53.80 → 6.62.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (401) hide show
  1. package/bin/spawn.js +8 -2
  2. package/lib/api/start/application.experimental.d.ts +7 -0
  3. package/lib/api/start/application.experimental.d.ts.map +1 -0
  4. package/lib/api/start/application.experimental.js +275 -0
  5. package/lib/api/start/application.experimental.js.map +1 -0
  6. package/lib/api/start/index.d.ts +1 -0
  7. package/lib/api/start/index.d.ts.map +1 -1
  8. package/lib/api/start/index.js +17 -6
  9. package/lib/api/start/index.js.map +1 -1
  10. package/lib/builder/webpack/devServer/setup.d.ts.map +1 -1
  11. package/lib/builder/webpack/devServer/setup.js +3 -1
  12. package/lib/builder/webpack/devServer/setup.js.map +1 -1
  13. package/lib/builder/webpack/providers/analyze/shared.d.ts.map +1 -1
  14. package/lib/builder/webpack/providers/analyze/shared.js +5 -9
  15. package/lib/builder/webpack/providers/analyze/shared.js.map +1 -1
  16. package/lib/builder/webpack/providers/client.d.ts.map +1 -1
  17. package/lib/builder/webpack/providers/client.js +10 -9
  18. package/lib/builder/webpack/providers/client.js.map +1 -1
  19. package/lib/builder/webpack/providers/server.d.ts.map +1 -1
  20. package/lib/builder/webpack/providers/server.js +10 -9
  21. package/lib/builder/webpack/providers/server.js.map +1 -1
  22. package/lib/cli/CLI.d.ts +1 -1
  23. package/lib/cli/CLI.d.ts.map +1 -1
  24. package/lib/cli/CLI.js.map +1 -1
  25. package/lib/cli/bin-init.js +0 -2
  26. package/lib/cli/bin-init.js.map +1 -1
  27. package/lib/cli/index.d.ts.map +1 -1
  28. package/lib/cli/index.js +1 -12
  29. package/lib/cli/index.js.map +1 -1
  30. package/lib/cli/runCLI.d.ts.map +1 -1
  31. package/lib/cli/runCLI.js.map +1 -1
  32. package/lib/commands/add/command.d.ts +1 -4
  33. package/lib/commands/add/command.d.ts.map +1 -1
  34. package/lib/commands/add/command.js +3 -2
  35. package/lib/commands/add/command.js.map +1 -1
  36. package/lib/commands/analyze/command.d.ts +1 -1
  37. package/lib/commands/analyze/command.d.ts.map +1 -1
  38. package/lib/commands/analyze/command.js +11 -13
  39. package/lib/commands/analyze/command.js.map +1 -1
  40. package/lib/commands/benchmark/command.d.ts +1 -1
  41. package/lib/commands/benchmark/command.d.ts.map +1 -1
  42. package/lib/commands/benchmark/command.js +8 -9
  43. package/lib/commands/benchmark/command.js.map +1 -1
  44. package/lib/commands/build/build.d.ts.map +1 -1
  45. package/lib/commands/build/build.js +1 -0
  46. package/lib/commands/build/build.js.map +1 -1
  47. package/lib/commands/build/command.d.ts +1 -1
  48. package/lib/commands/build/command.d.ts.map +1 -1
  49. package/lib/commands/build/command.js +12 -15
  50. package/lib/commands/build/command.js.map +1 -1
  51. package/lib/commands/generate/command.d.ts +1 -1
  52. package/lib/commands/generate/command.d.ts.map +1 -1
  53. package/lib/commands/generate/command.js +3 -2
  54. package/lib/commands/generate/command.js.map +1 -1
  55. package/lib/commands/lint/command.d.ts +1 -1
  56. package/lib/commands/lint/command.d.ts.map +1 -1
  57. package/lib/commands/lint/command.js +3 -2
  58. package/lib/commands/lint/command.js.map +1 -1
  59. package/lib/commands/new/command.d.ts +0 -1
  60. package/lib/commands/new/command.d.ts.map +1 -1
  61. package/lib/commands/new/command.js +0 -1
  62. package/lib/commands/new/command.js.map +1 -1
  63. package/lib/commands/new/steps/installDependencies.js +3 -3
  64. package/lib/commands/new/steps/installDependencies.js.map +1 -1
  65. package/lib/commands/start/command.d.ts +1 -1
  66. package/lib/commands/start/command.d.ts.map +1 -1
  67. package/lib/commands/start/command.js +18 -15
  68. package/lib/commands/start/command.js.map +1 -1
  69. package/lib/commands/start-prod/command.d.ts +1 -1
  70. package/lib/commands/start-prod/command.d.ts.map +1 -1
  71. package/lib/commands/start-prod/command.js +11 -13
  72. package/lib/commands/start-prod/command.js.map +1 -1
  73. package/lib/commands/static/command.d.ts +1 -1
  74. package/lib/commands/static/command.d.ts.map +1 -1
  75. package/lib/commands/static/command.js +7 -3
  76. package/lib/commands/static/command.js.map +1 -1
  77. package/lib/commands/update/command.d.ts +1 -4
  78. package/lib/commands/update/command.d.ts.map +1 -1
  79. package/lib/commands/update/command.js +3 -2
  80. package/lib/commands/update/command.js.map +1 -1
  81. package/lib/external/config.d.ts.map +1 -1
  82. package/lib/external/config.js.map +1 -1
  83. package/lib/library/babel/index.d.ts +3 -9
  84. package/lib/library/babel/index.d.ts.map +1 -1
  85. package/lib/library/babel/index.js +3 -132
  86. package/lib/library/babel/index.js.map +1 -1
  87. package/lib/library/swc/index.d.ts +3 -3
  88. package/lib/library/swc/index.d.ts.map +1 -1
  89. package/lib/library/swc/index.js +4 -114
  90. package/lib/library/swc/index.js.map +1 -1
  91. package/lib/library/webpack/application/client/common.d.ts.map +1 -1
  92. package/lib/library/webpack/application/client/common.js +10 -9
  93. package/lib/library/webpack/application/client/common.js.map +1 -1
  94. package/lib/library/webpack/application/common.d.ts.map +1 -1
  95. package/lib/library/webpack/application/common.js +3 -4
  96. package/lib/library/webpack/application/common.js.map +1 -1
  97. package/lib/library/webpack/blocks/pwa/client.d.ts.map +1 -1
  98. package/lib/library/webpack/blocks/pwa/client.js +9 -58
  99. package/lib/library/webpack/blocks/pwa/client.js.map +1 -1
  100. package/lib/library/webpack/blocks/resolve.d.ts.map +1 -1
  101. package/lib/library/webpack/blocks/resolve.js +1 -0
  102. package/lib/library/webpack/blocks/resolve.js.map +1 -1
  103. package/lib/library/webpack/child-app/client/common.d.ts.map +1 -1
  104. package/lib/library/webpack/child-app/client/common.js +2 -2
  105. package/lib/library/webpack/child-app/client/common.js.map +1 -1
  106. package/lib/library/webpack/child-app/common.d.ts.map +1 -1
  107. package/lib/library/webpack/child-app/common.js +3 -4
  108. package/lib/library/webpack/child-app/common.js.map +1 -1
  109. package/lib/library/webpack/utils/threadLoader.d.ts.map +1 -1
  110. package/lib/library/webpack/utils/threadLoader.js +20 -3
  111. package/lib/library/webpack/utils/threadLoader.js.map +1 -1
  112. package/lib/library/webpack/utils/transpiler.js +1 -1
  113. package/lib/library/webpack/utils/transpiler.js.map +1 -1
  114. package/lib/models/analytics/utils.d.ts +2 -1
  115. package/lib/models/analytics/utils.d.ts.map +1 -1
  116. package/lib/models/analytics/utils.js +3 -0
  117. package/lib/models/analytics/utils.js.map +1 -1
  118. package/lib/models/command.d.ts +1 -1
  119. package/lib/models/command.d.ts.map +1 -1
  120. package/lib/models/command.js +1 -1
  121. package/lib/models/command.js.map +1 -1
  122. package/lib/models/context.d.ts +1 -1
  123. package/lib/models/context.d.ts.map +1 -1
  124. package/lib/models/logger.d.ts +0 -1
  125. package/lib/models/logger.d.ts.map +1 -1
  126. package/lib/models/logger.js +2 -3
  127. package/lib/models/logger.js.map +1 -1
  128. package/lib/schema/autogeneratedSchema.json +15 -15
  129. package/lib/typings/configEntry/application.d.ts +1 -1
  130. package/lib/typings/configEntry/application.d.ts.map +1 -1
  131. package/lib/typings/public.d.ts +0 -1
  132. package/lib/typings/public.d.ts.map +1 -1
  133. package/lib/typings/public.js +0 -2
  134. package/lib/typings/public.js.map +1 -1
  135. package/lib/utils/cpu-profile.d.ts.map +1 -1
  136. package/lib/utils/cpu-profile.js +0 -1
  137. package/lib/utils/cpu-profile.js.map +1 -1
  138. package/package.json +23 -27
  139. package/schema.json +15 -15
  140. package/src/api/start/__integration__/start.test.ts +8 -0
  141. package/src/api/start/application.experimental.ts +305 -0
  142. package/src/api/start/index.ts +20 -4
  143. package/src/builder/webpack/devServer/setup.ts +1 -0
  144. package/src/builder/webpack/providers/analyze/shared.ts +6 -10
  145. package/src/builder/webpack/providers/client.ts +15 -10
  146. package/src/builder/webpack/providers/server.ts +15 -10
  147. package/src/cli/CLI.ts +1 -1
  148. package/src/cli/bin-init.ts +0 -2
  149. package/src/cli/index.ts +4 -11
  150. package/src/cli/runCLI.ts +0 -1
  151. package/src/commands/add/command.ts +3 -2
  152. package/src/commands/analyze/command.ts +12 -14
  153. package/src/commands/benchmark/command.ts +9 -10
  154. package/src/commands/build/build.ts +2 -0
  155. package/src/commands/build/command.ts +13 -16
  156. package/src/commands/generate/command.ts +3 -2
  157. package/src/commands/lint/command.ts +3 -2
  158. package/src/commands/new/command.ts +0 -2
  159. package/src/commands/new/steps/installDependencies.ts +3 -3
  160. package/src/commands/new/templates/shared/_prettierrc.js.hbs +1 -1
  161. package/src/commands/start/command.ts +20 -16
  162. package/src/commands/start-prod/command.ts +12 -14
  163. package/src/commands/static/command.ts +7 -3
  164. package/src/commands/update/command.ts +3 -2
  165. package/src/external/config.ts +1 -0
  166. package/src/library/babel/index.ts +3 -160
  167. package/src/library/swc/__integration__/__snapshots__/swc.build.test.ts.snap +46 -28
  168. package/src/library/swc/__integration__/__snapshots__/swc.start.test.ts.snap +12 -8
  169. package/src/library/swc/__integration__/swc.start.test.ts +4 -4
  170. package/src/library/swc/index.ts +3 -139
  171. package/src/library/webpack/application/client/common.ts +12 -7
  172. package/src/library/webpack/application/common.ts +8 -4
  173. package/src/library/webpack/blocks/pwa/client.ts +13 -64
  174. package/src/library/webpack/blocks/resolve.ts +1 -0
  175. package/src/library/webpack/child-app/client/common.ts +2 -2
  176. package/src/library/webpack/child-app/common.ts +7 -5
  177. package/src/library/webpack/utils/threadLoader.ts +21 -0
  178. package/src/library/webpack/utils/transpiler.ts +2 -2
  179. package/src/models/analytics/utils.ts +6 -2
  180. package/src/models/command.ts +3 -4
  181. package/src/models/context.ts +1 -1
  182. package/src/models/logger.ts +1 -3
  183. package/src/schema/autogeneratedSchema.json +15 -15
  184. package/src/typings/configEntry/application.ts +5 -1
  185. package/src/typings/public.ts +0 -2
  186. package/src/utils/cpu-profile.ts +0 -1
  187. package/lib/library/babel/plugins/create-token-pure.d.ts +0 -7
  188. package/lib/library/babel/plugins/create-token-pure.d.ts.map +0 -1
  189. package/lib/library/babel/plugins/create-token-pure.js +0 -39
  190. package/lib/library/babel/plugins/create-token-pure.js.map +0 -1
  191. package/lib/library/babel/plugins/fill-action-name.d.ts +0 -3
  192. package/lib/library/babel/plugins/fill-action-name.d.ts.map +0 -1
  193. package/lib/library/babel/plugins/fill-action-name.js +0 -107
  194. package/lib/library/babel/plugins/fill-action-name.js.map +0 -1
  195. package/lib/library/babel/plugins/fill-declare-action-name.d.ts +0 -6
  196. package/lib/library/babel/plugins/fill-declare-action-name.d.ts.map +0 -1
  197. package/lib/library/babel/plugins/fill-declare-action-name.js +0 -94
  198. package/lib/library/babel/plugins/fill-declare-action-name.js.map +0 -1
  199. package/lib/library/babel/plugins/lazy-component/lazy-component.d.ts +0 -7
  200. package/lib/library/babel/plugins/lazy-component/lazy-component.d.ts.map +0 -1
  201. package/lib/library/babel/plugins/lazy-component/lazy-component.js +0 -75
  202. package/lib/library/babel/plugins/lazy-component/lazy-component.js.map +0 -1
  203. package/lib/library/babel/plugins/lazy-component/legacy-universal-replace.d.ts +0 -14
  204. package/lib/library/babel/plugins/lazy-component/legacy-universal-replace.d.ts.map +0 -1
  205. package/lib/library/babel/plugins/lazy-component/legacy-universal-replace.js +0 -53
  206. package/lib/library/babel/plugins/lazy-component/legacy-universal-replace.js.map +0 -1
  207. package/lib/library/babel/plugins/lazy-component/properties/chunkName.d.ts +0 -3
  208. package/lib/library/babel/plugins/lazy-component/properties/chunkName.d.ts.map +0 -1
  209. package/lib/library/babel/plugins/lazy-component/properties/chunkName.js +0 -133
  210. package/lib/library/babel/plugins/lazy-component/properties/chunkName.js.map +0 -1
  211. package/lib/library/babel/plugins/lazy-component/properties/importAsync.d.ts +0 -3
  212. package/lib/library/babel/plugins/lazy-component/properties/importAsync.d.ts.map +0 -1
  213. package/lib/library/babel/plugins/lazy-component/properties/importAsync.js +0 -11
  214. package/lib/library/babel/plugins/lazy-component/properties/importAsync.js.map +0 -1
  215. package/lib/library/babel/plugins/lazy-component/properties/isReady.d.ts +0 -3
  216. package/lib/library/babel/plugins/lazy-component/properties/isReady.d.ts.map +0 -1
  217. package/lib/library/babel/plugins/lazy-component/properties/isReady.js +0 -14
  218. package/lib/library/babel/plugins/lazy-component/properties/isReady.js.map +0 -1
  219. package/lib/library/babel/plugins/lazy-component/properties/requireAsync.d.ts +0 -3
  220. package/lib/library/babel/plugins/lazy-component/properties/requireAsync.d.ts.map +0 -1
  221. package/lib/library/babel/plugins/lazy-component/properties/requireAsync.js +0 -15
  222. package/lib/library/babel/plugins/lazy-component/properties/requireAsync.js.map +0 -1
  223. package/lib/library/babel/plugins/lazy-component/properties/requireSync.d.ts +0 -3
  224. package/lib/library/babel/plugins/lazy-component/properties/requireSync.d.ts.map +0 -1
  225. package/lib/library/babel/plugins/lazy-component/properties/requireSync.js +0 -16
  226. package/lib/library/babel/plugins/lazy-component/properties/requireSync.js.map +0 -1
  227. package/lib/library/babel/plugins/lazy-component/properties/resolve.d.ts +0 -3
  228. package/lib/library/babel/plugins/lazy-component/properties/resolve.d.ts.map +0 -1
  229. package/lib/library/babel/plugins/lazy-component/properties/resolve.js +0 -14
  230. package/lib/library/babel/plugins/lazy-component/properties/resolve.js.map +0 -1
  231. package/lib/library/babel/plugins/lazy-component/properties/types.d.ts +0 -14
  232. package/lib/library/babel/plugins/lazy-component/properties/types.d.ts.map +0 -1
  233. package/lib/library/babel/plugins/lazy-component/properties/types.js +0 -3
  234. package/lib/library/babel/plugins/lazy-component/properties/types.js.map +0 -1
  235. package/lib/library/babel/plugins/lazy-component/properties/utils/webpackComments.d.ts +0 -14
  236. package/lib/library/babel/plugins/lazy-component/properties/utils/webpackComments.d.ts.map +0 -1
  237. package/lib/library/babel/plugins/lazy-component/properties/utils/webpackComments.js +0 -57
  238. package/lib/library/babel/plugins/lazy-component/properties/utils/webpackComments.js.map +0 -1
  239. package/lib/library/babel/plugins/provider-stack.d.ts +0 -4
  240. package/lib/library/babel/plugins/provider-stack.d.ts.map +0 -1
  241. package/lib/library/babel/plugins/provider-stack.js +0 -63
  242. package/lib/library/babel/plugins/provider-stack.js.map +0 -1
  243. package/lib/library/babel/plugins/react-compiler.d.ts +0 -13
  244. package/lib/library/babel/plugins/react-compiler.d.ts.map +0 -1
  245. package/lib/library/babel/plugins/react-compiler.js +0 -27
  246. package/lib/library/babel/plugins/react-compiler.js.map +0 -1
  247. package/lib/library/babel/plugins/react-element-info-unique.d.ts +0 -26
  248. package/lib/library/babel/plugins/react-element-info-unique.d.ts.map +0 -1
  249. package/lib/library/babel/plugins/react-element-info-unique.js +0 -112
  250. package/lib/library/babel/plugins/react-element-info-unique.js.map +0 -1
  251. package/lib/library/babel/plugins/types.h.d.ts +0 -7
  252. package/lib/library/babel/plugins/types.h.d.ts.map +0 -1
  253. package/lib/library/babel/plugins/types.h.js +0 -3
  254. package/lib/library/babel/plugins/types.h.js.map +0 -1
  255. package/lib/library/webpack/plugins/AssetsIntegritiesPlugin.d.ts +0 -8
  256. package/lib/library/webpack/plugins/AssetsIntegritiesPlugin.d.ts.map +0 -1
  257. package/lib/library/webpack/plugins/AssetsIntegritiesPlugin.js +0 -29
  258. package/lib/library/webpack/plugins/AssetsIntegritiesPlugin.js.map +0 -1
  259. package/lib/library/webpack/plugins/AutoPublicPathPlugin.d.ts +0 -4
  260. package/lib/library/webpack/plugins/AutoPublicPathPlugin.d.ts.map +0 -1
  261. package/lib/library/webpack/plugins/AutoPublicPathPlugin.js +0 -23
  262. package/lib/library/webpack/plugins/AutoPublicPathPlugin.js.map +0 -1
  263. package/lib/library/webpack/plugins/ModuleFederationFixRange.d.ts +0 -24
  264. package/lib/library/webpack/plugins/ModuleFederationFixRange.d.ts.map +0 -1
  265. package/lib/library/webpack/plugins/ModuleFederationFixRange.js +0 -127
  266. package/lib/library/webpack/plugins/ModuleFederationFixRange.js.map +0 -1
  267. package/lib/library/webpack/plugins/ModuleFederationIgnoreEntries.d.ts +0 -15
  268. package/lib/library/webpack/plugins/ModuleFederationIgnoreEntries.d.ts.map +0 -1
  269. package/lib/library/webpack/plugins/ModuleFederationIgnoreEntries.js +0 -49
  270. package/lib/library/webpack/plugins/ModuleFederationIgnoreEntries.js.map +0 -1
  271. package/lib/library/webpack/plugins/PolyfillCondition.d.ts +0 -8
  272. package/lib/library/webpack/plugins/PolyfillCondition.d.ts.map +0 -1
  273. package/lib/library/webpack/plugins/PolyfillCondition.js +0 -46
  274. package/lib/library/webpack/plugins/PolyfillCondition.js.map +0 -1
  275. package/lib/library/webpack/plugins/PurifyStatsPlugin.d.ts +0 -15
  276. package/lib/library/webpack/plugins/PurifyStatsPlugin.d.ts.map +0 -1
  277. package/lib/library/webpack/plugins/PurifyStatsPlugin.js +0 -47
  278. package/lib/library/webpack/plugins/PurifyStatsPlugin.js.map +0 -1
  279. package/lib/library/webpack/plugins/PwaIconsPlugin.d.ts +0 -12
  280. package/lib/library/webpack/plugins/PwaIconsPlugin.d.ts.map +0 -1
  281. package/lib/library/webpack/plugins/PwaIconsPlugin.js +0 -78
  282. package/lib/library/webpack/plugins/PwaIconsPlugin.js.map +0 -1
  283. package/lib/library/webpack/plugins/WebManifestPlugin.d.ts +0 -13
  284. package/lib/library/webpack/plugins/WebManifestPlugin.d.ts.map +0 -1
  285. package/lib/library/webpack/plugins/WebManifestPlugin.js +0 -47
  286. package/lib/library/webpack/plugins/WebManifestPlugin.js.map +0 -1
  287. package/lib/library/webpack/utils/polyfills/const.d.ts +0 -3
  288. package/lib/library/webpack/utils/polyfills/const.d.ts.map +0 -1
  289. package/lib/library/webpack/utils/polyfills/const.js +0 -49
  290. package/lib/library/webpack/utils/polyfills/const.js.map +0 -1
  291. package/lib/library/webpack/utils/polyfills/polyfillCondition.d.ts +0 -8
  292. package/lib/library/webpack/utils/polyfills/polyfillCondition.d.ts.map +0 -1
  293. package/lib/library/webpack/utils/polyfills/polyfillCondition.js +0 -51
  294. package/lib/library/webpack/utils/polyfills/polyfillCondition.js.map +0 -1
  295. package/lib/library/webpack/utils/polyfills/specToFeature.d.ts +0 -7
  296. package/lib/library/webpack/utils/polyfills/specToFeature.d.ts.map +0 -1
  297. package/lib/library/webpack/utils/polyfills/specToFeature.js +0 -207
  298. package/lib/library/webpack/utils/polyfills/specToFeature.js.map +0 -1
  299. package/lib/models/analytics/analytics.d.ts +0 -156
  300. package/lib/models/analytics/analytics.d.ts.map +0 -1
  301. package/lib/models/analytics/analytics.js +0 -259
  302. package/lib/models/analytics/analytics.js.map +0 -1
  303. package/lib/models/analytics/analytics.worker.d.ts +0 -5
  304. package/lib/models/analytics/analytics.worker.d.ts.map +0 -1
  305. package/lib/models/analytics/analytics.worker.js +0 -87
  306. package/lib/models/analytics/analytics.worker.js.map +0 -1
  307. package/lib/typings/pwa/index.d.ts +0 -80
  308. package/lib/typings/pwa/index.d.ts.map +0 -1
  309. package/lib/typings/pwa/index.js +0 -3
  310. package/lib/typings/pwa/index.js.map +0 -1
  311. package/lib/utils/errors.d.ts +0 -7
  312. package/lib/utils/errors.d.ts.map +0 -1
  313. package/lib/utils/errors.js +0 -43
  314. package/lib/utils/errors.js.map +0 -1
  315. package/lib/utils/memoryUsage.d.ts +0 -20
  316. package/lib/utils/memoryUsage.d.ts.map +0 -1
  317. package/lib/utils/memoryUsage.js +0 -51
  318. package/lib/utils/memoryUsage.js.map +0 -1
  319. package/lib/utils/sentry.d.ts +0 -2
  320. package/lib/utils/sentry.d.ts.map +0 -1
  321. package/lib/utils/sentry.js +0 -27
  322. package/lib/utils/sentry.js.map +0 -1
  323. package/src/library/babel/plugins/__fixtures__/create-token-pure/already-has-comment.ts +0 -5
  324. package/src/library/babel/plugins/__fixtures__/create-token-pure/do-nothing.ts +0 -10
  325. package/src/library/babel/plugins/__fixtures__/create-token-pure/from-core.ts +0 -5
  326. package/src/library/babel/plugins/__fixtures__/create-token-pure/from-dippy.ts +0 -5
  327. package/src/library/babel/plugins/__fixtures__/create-token-pure/many-imports.ts +0 -9
  328. package/src/library/babel/plugins/__fixtures__/fill-declare-action-name/import-mixed.ts +0 -17
  329. package/src/library/babel/plugins/__fixtures__/fill-declare-action-name/import-with-name.ts +0 -28
  330. package/src/library/babel/plugins/__fixtures__/fill-declare-action-name/import-without-name.ts +0 -25
  331. package/src/library/babel/plugins/__fixtures__/fill-declare-action-name/require-with-name.ts +0 -21
  332. package/src/library/babel/plugins/__fixtures__/fill-declare-action-name/require-without-name.ts +0 -19
  333. package/src/library/babel/plugins/__fixtures__/lazy-component/base.ts +0 -3
  334. package/src/library/babel/plugins/__fixtures__/lazy-component/cmp.tsx +0 -7
  335. package/src/library/babel/plugins/__fixtures__/lazy-component/comments.ts +0 -7
  336. package/src/library/babel/plugins/__fixtures__/lazy-component/dynamic.ts +0 -3
  337. package/src/library/babel/plugins/__fixtures__/lazy-component/inner/first.tsx +0 -7
  338. package/src/library/babel/plugins/__fixtures__/lazy-component/inner/path/cmp.tsx +0 -7
  339. package/src/library/babel/plugins/__fixtures__/lazy-component/inner/second.tsx +0 -7
  340. package/src/library/babel/plugins/__fixtures__/lazy-component/inner/third.tsx +0 -7
  341. package/src/library/babel/plugins/__fixtures__/lazy-component/lazy+hmr.ts +0 -3
  342. package/src/library/babel/plugins/__fixtures__/lazy-component/long-import.ts +0 -3
  343. package/src/library/babel/plugins/__fixtures__/lazy-component/not-lazy-import.ts +0 -7
  344. package/src/library/babel/plugins/__fixtures__/lazy-component/not-lazy.ts +0 -8
  345. package/src/library/babel/plugins/__fixtures__/legacy-universal-replace/cmp.tsx +0 -7
  346. package/src/library/babel/plugins/__fixtures__/legacy-universal-replace/not-universal.ts +0 -8
  347. package/src/library/babel/plugins/__fixtures__/legacy-universal-replace/platform-legacy.ts +0 -5
  348. package/src/library/babel/plugins/__fixtures__/legacy-universal-replace/react-universal.ts +0 -3
  349. package/src/library/babel/plugins/__fixtures__/legacy-universal-replace/tramvai/react/index.es.ts +0 -3
  350. package/src/library/babel/plugins/__fixtures__/provider-stack/add-stack.ts +0 -22
  351. package/src/library/babel/plugins/__fixtures__/provider-stack/check-function-name.ts +0 -10
  352. package/src/library/babel/plugins/__fixtures__/provider-stack/do-nothing.ts +0 -16
  353. package/src/library/babel/plugins/__fixtures__/provider-stack/error-in-scope.ts +0 -24
  354. package/src/library/babel/plugins/__fixtures__/provider-stack/inside-await.ts +0 -12
  355. package/src/library/babel/plugins/__fixtures__/provider-stack/module-decorator.ts +0 -27
  356. package/src/library/babel/plugins/__snapshots__/create-token-pure.spec.ts.snap +0 -108
  357. package/src/library/babel/plugins/__snapshots__/fill-declare-action-name.spec.ts.snap +0 -264
  358. package/src/library/babel/plugins/__snapshots__/provider-stack.spec.ts.snap +0 -362
  359. package/src/library/babel/plugins/create-token-pure.spec.ts +0 -39
  360. package/src/library/babel/plugins/create-token-pure.ts +0 -47
  361. package/src/library/babel/plugins/fill-action-name.ts +0 -126
  362. package/src/library/babel/plugins/fill-declare-action-name.spec.ts +0 -37
  363. package/src/library/babel/plugins/fill-declare-action-name.ts +0 -110
  364. package/src/library/babel/plugins/lazy-component/__snapshots__/lazy-component.spec.ts.snap +0 -313
  365. package/src/library/babel/plugins/lazy-component/__snapshots__/legacy-universal-replace.spec.ts.snap +0 -114
  366. package/src/library/babel/plugins/lazy-component/lazy-component.spec.ts +0 -46
  367. package/src/library/babel/plugins/lazy-component/lazy-component.ts +0 -91
  368. package/src/library/babel/plugins/lazy-component/legacy-universal-replace.spec.ts +0 -33
  369. package/src/library/babel/plugins/lazy-component/legacy-universal-replace.ts +0 -88
  370. package/src/library/babel/plugins/lazy-component/properties/chunkName.ts +0 -185
  371. package/src/library/babel/plugins/lazy-component/properties/importAsync.ts +0 -8
  372. package/src/library/babel/plugins/lazy-component/properties/isReady.ts +0 -19
  373. package/src/library/babel/plugins/lazy-component/properties/requireAsync.ts +0 -20
  374. package/src/library/babel/plugins/lazy-component/properties/requireSync.ts +0 -21
  375. package/src/library/babel/plugins/lazy-component/properties/resolve.ts +0 -21
  376. package/src/library/babel/plugins/lazy-component/properties/types.ts +0 -20
  377. package/src/library/babel/plugins/lazy-component/properties/utils/webpackComments.ts +0 -61
  378. package/src/library/babel/plugins/provider-stack.spec.ts +0 -55
  379. package/src/library/babel/plugins/provider-stack.ts +0 -88
  380. package/src/library/babel/plugins/react-compiler.ts +0 -39
  381. package/src/library/babel/plugins/react-element-info-unique.ts +0 -144
  382. package/src/library/babel/plugins/types.h.ts +0 -8
  383. package/src/library/webpack/plugins/AssetsIntegritiesPlugin.ts +0 -34
  384. package/src/library/webpack/plugins/AutoPublicPathPlugin.ts +0 -23
  385. package/src/library/webpack/plugins/ModuleFederationFixRange.ts +0 -181
  386. package/src/library/webpack/plugins/ModuleFederationIgnoreEntries.ts +0 -59
  387. package/src/library/webpack/plugins/PolyfillCondition.ts +0 -62
  388. package/src/library/webpack/plugins/PurifyStatsPlugin.ts +0 -57
  389. package/src/library/webpack/plugins/PwaIconsPlugin.ts +0 -94
  390. package/src/library/webpack/plugins/WebManifestPlugin.ts +0 -62
  391. package/src/library/webpack/utils/polyfills/__integration__/__snapshots__/condition.test.ts.snap +0 -1348
  392. package/src/library/webpack/utils/polyfills/__integration__/condition.test.ts +0 -128
  393. package/src/library/webpack/utils/polyfills/const.ts +0 -46
  394. package/src/library/webpack/utils/polyfills/polyfillCondition.ts +0 -63
  395. package/src/library/webpack/utils/polyfills/specToFeature.ts +0 -243
  396. package/src/models/analytics/analytics.ts +0 -488
  397. package/src/models/analytics/analytics.worker.ts +0 -102
  398. package/src/typings/pwa/index.ts +0 -83
  399. package/src/utils/errors.ts +0 -39
  400. package/src/utils/memoryUsage.ts +0 -58
  401. package/src/utils/sentry.ts +0 -25
@@ -0,0 +1,305 @@
1
+ import path from 'node:path';
2
+ import type { Container } from '@tinkoff/dippy';
3
+ import { StartParameters, start } from '@tramvai/api/lib/api/start';
4
+ import { ApplicationProject, Configuration } from '@tramvai/api/lib/config';
5
+ import {
6
+ COMMAND_PARAMETERS_TOKEN,
7
+ CONFIG_ENTRY_TOKEN,
8
+ CONFIG_ROOT_DIR_TOKEN,
9
+ } from '../../di/tokens';
10
+ import { getTramvaiConfig } from '../../utils/getTramvaiConfig';
11
+ import { ApplicationConfigEntry } from '../../typings/configEntry/application';
12
+ import type { Params, Result } from './index';
13
+
14
+ declare global {
15
+ // eslint-disable-next-line no-var, vars-on-top
16
+ var __TRAMVAI_EXIT_HANDLERS__: Array<() => Promise<any>>;
17
+ }
18
+
19
+ export const startApplicationExperimental = async (di: Container): Result => {
20
+ const configEntry = di.get(CONFIG_ENTRY_TOKEN);
21
+ const options = di.get(COMMAND_PARAMETERS_TOKEN as Params);
22
+ const rootDir = di.get(CONFIG_ROOT_DIR_TOKEN);
23
+
24
+ const inputParameters: StartParameters = {
25
+ name: configEntry.name,
26
+ mode: 'development',
27
+ buildType: options.buildType,
28
+ port: options.port,
29
+ host: options.host,
30
+ staticPort: options.staticPort,
31
+ staticHost: options.staticHost,
32
+ noServerRebuild: options.noServerRebuild,
33
+ noClientRebuild: options.noClientRebuild,
34
+ resolveSymlinks: options.resolveSymlinks,
35
+ fileCache: options.fileCache,
36
+ showProgress: true,
37
+ verboseLogging: options.verboseWebpack,
38
+ };
39
+
40
+ const { content, projects } = mapTramvaiJsonToNewTsConfig({ rootDir });
41
+
42
+ const hasSwcTranspiler = Object.values(content.projects).some((project) => {
43
+ if (
44
+ project.type !== 'application' ||
45
+ !(project as ApplicationConfigEntry).experiments?.transpilation
46
+ ) {
47
+ return false;
48
+ }
49
+ const { loader } = (project as ApplicationConfigEntry).experiments.transpilation;
50
+
51
+ if (typeof loader === 'string') {
52
+ // @ts-expect-error
53
+ return loader === 'swc';
54
+ }
55
+ // @ts-expect-error
56
+ return loader.development === 'swc';
57
+ });
58
+ const hasPwa = Object.values(content.projects).some((project) => {
59
+ if (project.type !== 'application' || !(project as ApplicationConfigEntry).experiments) {
60
+ return false;
61
+ }
62
+ const { pwa } = (project as ApplicationConfigEntry).experiments;
63
+ return !!pwa;
64
+ });
65
+
66
+ const extraConfiguration: Partial<Configuration> = {
67
+ projects,
68
+ plugins: [
69
+ '@tramvai/plugin-webpack-builder',
70
+ hasSwcTranspiler ? '@tramvai/plugin-swc-transpiler' : '@tramvai/plugin-babel-transpiler',
71
+ hasPwa && '@tramvai/plugin-webpack-pwa',
72
+ ].filter(Boolean),
73
+ };
74
+
75
+ const devServer = await start(inputParameters, extraConfiguration);
76
+
77
+ // CLI will wait for this handlers before exiting
78
+ // @reference `packages/cli/src/cli/runCLI.ts`
79
+ if (!global.__TRAMVAI_EXIT_HANDLERS__) {
80
+ global.__TRAMVAI_EXIT_HANDLERS__ = [];
81
+ }
82
+
83
+ global.__TRAMVAI_EXIT_HANDLERS__.push(async () => {
84
+ await devServer?.close?.();
85
+ });
86
+
87
+ try {
88
+ await devServer.buildPromise;
89
+ } catch (e) {
90
+ // some webpack build errors can be safely ignored
91
+ // TODO: strictErrorHandle parameter? used in `packages/cli/src/library/swc/__integration__/swc.start.test.ts` for old cli
92
+ }
93
+
94
+ return {
95
+ server: devServer.httpServer,
96
+ staticServer: devServer.staticHttpServer,
97
+ close: async () => {
98
+ await devServer.close();
99
+ },
100
+ invalidate: async () => {
101
+ await devServer.invalidate();
102
+ },
103
+ getBuildStats: () => {
104
+ return {};
105
+ },
106
+ builder: {
107
+ name: '@tramvai/plugin-webpack-builder',
108
+ start: async (options) => {
109
+ return {
110
+ close: async () => {
111
+ await devServer.close();
112
+ },
113
+ invalidate: async () => {
114
+ await devServer.invalidate();
115
+ },
116
+ getBuildStats: () => {
117
+ return {};
118
+ },
119
+ };
120
+ },
121
+ build: async (options) => {
122
+ return {
123
+ getBuildStats: () => {
124
+ return {};
125
+ },
126
+ };
127
+ },
128
+ analyze: async (options) => {},
129
+ on: (event, callback) => {
130
+ // TODO useful events as public new devServer API
131
+ },
132
+ },
133
+ };
134
+ };
135
+
136
+ /**
137
+ * Mapping from tramvai.json config format to new tramvai.config.ts,
138
+ * for seamless migration
139
+ */
140
+ // eslint-disable-next-line max-statements, complexity
141
+ function mapTramvaiJsonToNewTsConfig({ rootDir }: { rootDir: string }) {
142
+ const { content } = getTramvaiConfig(rootDir);
143
+ const projects: Configuration['projects'] = {};
144
+
145
+ for (const projectName in content.projects) {
146
+ const project = content.projects[projectName];
147
+
148
+ if (project.type === 'application') {
149
+ const applicationProject = project as ApplicationConfigEntry;
150
+
151
+ const mappedProject: ApplicationProject = {
152
+ name: projectName,
153
+ type: 'application',
154
+ deprecatedLessSupport: true,
155
+ };
156
+
157
+ if (applicationProject.root) {
158
+ mappedProject.sourceDir = applicationProject.root;
159
+ }
160
+ if (applicationProject.output) {
161
+ mappedProject.output = {};
162
+
163
+ if (applicationProject.output.server) {
164
+ mappedProject.output.server = applicationProject.output.server;
165
+ }
166
+ if (applicationProject.output.client) {
167
+ mappedProject.output.client = applicationProject.output.client;
168
+ }
169
+ if (applicationProject.output.static) {
170
+ mappedProject.output.static = applicationProject.output.static;
171
+ }
172
+ }
173
+ if (applicationProject.fileSystemPages) {
174
+ mappedProject.fileSystemPages = applicationProject.fileSystemPages;
175
+ }
176
+ if (applicationProject.experiments && 'runtimeChunk' in applicationProject.experiments) {
177
+ mappedProject.runtimeChunk = applicationProject.experiments.runtimeChunk;
178
+ }
179
+ if (applicationProject.experiments && 'viewTransitions' in applicationProject.experiments) {
180
+ mappedProject.experiments.viewTransitions = applicationProject.experiments.viewTransitions;
181
+ }
182
+ if (applicationProject.experiments && 'reactTransitions' in applicationProject.experiments) {
183
+ mappedProject.experiments.reactTransitions =
184
+ applicationProject.experiments.reactTransitions;
185
+ }
186
+ if (
187
+ applicationProject.experiments &&
188
+ 'enableFillDeclareActionNamePlugin' in applicationProject.experiments
189
+ ) {
190
+ mappedProject.enableFillDeclareActionNamePlugin =
191
+ applicationProject.experiments.enableFillDeclareActionNamePlugin;
192
+ }
193
+ if (applicationProject.serverApiDir) {
194
+ mappedProject.fileSystemPapiDir = path.resolve(applicationProject.serverApiDir);
195
+ }
196
+ if (applicationProject.postcss) {
197
+ mappedProject.postcss = applicationProject.postcss;
198
+
199
+ if (mappedProject.postcss.config) {
200
+ // TODO file outside src dir
201
+ if (mappedProject.postcss.config.startsWith(applicationProject.root)) {
202
+ mappedProject.postcss.config = mappedProject.postcss.config.replace(
203
+ `${applicationProject.root}/`,
204
+ ''
205
+ );
206
+ } else if (mappedProject.postcss.config.startsWith('./')) {
207
+ mappedProject.postcss.config = path.resolve(mappedProject.postcss.config);
208
+ }
209
+ }
210
+ }
211
+ if (applicationProject.polyfill) {
212
+ try {
213
+ if (require.resolve(mappedProject.polyfill).includes('node_modules')) {
214
+ mappedProject.polyfill = require.resolve(applicationProject.polyfill);
215
+ } else {
216
+ mappedProject.polyfill = path.resolve(applicationProject.polyfill);
217
+ }
218
+ } catch (e) {
219
+ mappedProject.polyfill = path.resolve(applicationProject.polyfill);
220
+ }
221
+ }
222
+ if (applicationProject.modernPolyfill) {
223
+ try {
224
+ if (require.resolve(mappedProject.modernPolyfill).includes('node_modules')) {
225
+ mappedProject.polyfill = require.resolve(applicationProject.modernPolyfill);
226
+ } else {
227
+ mappedProject.polyfill = path.resolve(applicationProject.modernPolyfill);
228
+ }
229
+ } catch (e) {
230
+ mappedProject.polyfill = path.resolve(applicationProject.modernPolyfill);
231
+ }
232
+ }
233
+ if (applicationProject.dedupe) {
234
+ mappedProject.dedupe = applicationProject.dedupe;
235
+ }
236
+ if ('integrity' in applicationProject) {
237
+ if (typeof applicationProject.integrity === 'boolean') {
238
+ mappedProject.integrity = {
239
+ enabled: applicationProject.integrity,
240
+ };
241
+ } else {
242
+ // @ts-expect-error inconsistent `hashFuncNames` types
243
+ mappedProject.integrity = applicationProject.integrity;
244
+ }
245
+ }
246
+ if (
247
+ applicationProject.splitChunks &&
248
+ (applicationProject.splitChunks.mode === 'granularChunks' ||
249
+ applicationProject.splitChunks.mode === false)
250
+ ) {
251
+ // @ts-expect-error `commonChunk` is not supported in new cli
252
+ mappedProject.splitChunks = applicationProject.splitChunks;
253
+ }
254
+ if (applicationProject.webpack?.resolveAlias) {
255
+ if (!mappedProject.webpack) {
256
+ mappedProject.webpack = {};
257
+ }
258
+ mappedProject.webpack.resolveAlias = applicationProject.webpack.resolveAlias;
259
+ }
260
+ if (applicationProject.webpack?.provide) {
261
+ if (!mappedProject.webpack) {
262
+ mappedProject.webpack = {};
263
+ }
264
+ mappedProject.webpack.provide = applicationProject.webpack.provide;
265
+ }
266
+ if (applicationProject.webpack?.watchOptions) {
267
+ if (!mappedProject.webpack) {
268
+ mappedProject.webpack = {};
269
+ }
270
+ mappedProject.webpack.watchOptions = applicationProject.webpack.watchOptions;
271
+ }
272
+ if (applicationProject.webpack && 'devtool' in applicationProject.webpack) {
273
+ if (!mappedProject.webpack) {
274
+ mappedProject.webpack = {};
275
+ }
276
+ mappedProject.webpack.devtool = applicationProject.webpack.devtool;
277
+ }
278
+ if (applicationProject.experiments?.pwa) {
279
+ mappedProject.pwa = {
280
+ workbox: {
281
+ ...applicationProject.experiments.pwa.workbox,
282
+ enabled:
283
+ typeof applicationProject.experiments.pwa.workbox.enabled === 'boolean'
284
+ ? applicationProject.experiments.pwa.workbox.enabled
285
+ : applicationProject.experiments.pwa.workbox.enabled.development,
286
+ },
287
+ sw: applicationProject.experiments.pwa.sw,
288
+ webmanifest: applicationProject.experiments.pwa.webmanifest,
289
+ icon: applicationProject.experiments.pwa.icon,
290
+ meta: applicationProject.experiments.pwa.meta,
291
+ };
292
+ }
293
+ if (applicationProject.externals) {
294
+ if (!mappedProject.webpack) {
295
+ mappedProject.webpack = {};
296
+ }
297
+ mappedProject.webpack.externals = applicationProject.externals;
298
+ }
299
+
300
+ projects[projectName] = mappedProject;
301
+ }
302
+ }
303
+
304
+ return { content, projects };
305
+ }
@@ -3,10 +3,7 @@ import type { PromiseType } from 'utility-types';
3
3
  import type { Provider } from '@tinkoff/dippy';
4
4
  import { createCommand } from '../../commands/createCommand';
5
5
  import type { WithConfig } from '../shared/types/withConfig';
6
- import { startApplication } from './application';
7
- import { startModule } from './module';
8
- import { CONFIG_ENTRY_TOKEN, PORT_MANAGER_TOKEN } from '../../di/tokens';
9
- import { startChildApp } from './child-app';
6
+ import { COMMAND_PARAMETERS_TOKEN, CONFIG_ENTRY_TOKEN, PORT_MANAGER_TOKEN } from '../../di/tokens';
10
7
  import type { Builder } from '../../typings/build/Builder';
11
8
 
12
9
  export type Params = WithConfig<{
@@ -33,6 +30,7 @@ export type Params = WithConfig<{
33
30
  onlyBundles?: string[];
34
31
  strictErrorHandle?: boolean;
35
32
  fileCache?: boolean;
33
+ experimentalWebpackWorkerThreads?: boolean;
36
34
  }>;
37
35
 
38
36
  export type Result<T extends string = any> = Promise<
@@ -49,17 +47,35 @@ export type StartCommand = (params: Params, providers?: Provider[]) => Result;
49
47
  export default createCommand({
50
48
  name: 'start',
51
49
  command: async (di): Result => {
50
+ const options = di.get(COMMAND_PARAMETERS_TOKEN as Params);
52
51
  const configEntry = di.get(CONFIG_ENTRY_TOKEN);
53
52
  const portManager = di.get(PORT_MANAGER_TOKEN);
54
53
 
54
+ if (options.experimentalWebpackWorkerThreads) {
55
+ if (configEntry.type !== 'application') {
56
+ throw new Error(
57
+ '--experimentalWebpackWorkerThreads option is only available for application project'
58
+ );
59
+ }
60
+
61
+ const { startApplicationExperimental } = require('./application.experimental');
62
+ return startApplicationExperimental(di);
63
+ }
64
+
55
65
  await portManager.computeAvailablePorts();
56
66
 
57
67
  switch (configEntry.type) {
58
68
  case 'application':
69
+ // eslint-disable-next-line no-case-declarations
70
+ const { startApplication } = require('./application');
59
71
  return startApplication(di);
60
72
  case 'module':
73
+ // eslint-disable-next-line no-case-declarations
74
+ const { startModule } = require('./module');
61
75
  return startModule(di);
62
76
  case 'child-app':
77
+ // eslint-disable-next-line no-case-declarations
78
+ const { startChildApp } = require('./child-app');
63
79
  return startChildApp(di);
64
80
  }
65
81
  },
@@ -84,6 +84,7 @@ export const createDevServer = ({
84
84
  if (configManager.hotRefresh.enabled) {
85
85
  app.use(
86
86
  getHotModulePrefix(configManager),
87
+ // @ts-ignore - https://github.com/DefinitelyTyped/DefinitelyTyped/pull/73338
87
88
  webpackHotMiddleware(compiler, { log: false, statsOptions: { cached: false } })
88
89
  );
89
90
  }
@@ -10,10 +10,6 @@ import {
10
10
  } from '../../../../di/tokens';
11
11
  import { toWebpackConfig } from '../../../../library/webpack/utils/toWebpackConfig';
12
12
  import { npmRequire, npmRequireList } from '../../../../utils/npmRequire';
13
- import { BundleAnalyzePlugin } from '../../analyzePlugins/bundle';
14
- import { StatoscopeAnalyzePlugin } from '../../analyzePlugins/statoscope';
15
- import { WhyBundledAnalyzePlugin } from '../../analyzePlugins/whyBundled';
16
- import { RsdoctorAnalyzePlugin } from '../../analyzePlugins/rsdoctor';
17
13
  import {
18
14
  CLIENT_CONFIG_MANAGER_TOKEN,
19
15
  INIT_HANDLER_TOKEN,
@@ -31,18 +27,18 @@ interface Type<T> extends Function {
31
27
  new (...args: any[]): T;
32
28
  }
33
29
 
34
- const pluginMap: Record<string, Type<AnalyzePlugin>> = {
35
- bundle: BundleAnalyzePlugin,
36
- whybundled: WhyBundledAnalyzePlugin,
37
- statoscope: StatoscopeAnalyzePlugin,
38
- rsdoctor: RsdoctorAnalyzePlugin,
30
+ const pluginMap: Record<string, () => Type<AnalyzePlugin>> = {
31
+ bundle: () => require('../../analyzePlugins/bundle').BundleAnalyzePlugin,
32
+ whybundled: () => require('../../analyzePlugins/whyBundled').WhyBundledAnalyzePlugin,
33
+ statoscope: () => require('../../analyzePlugins/statoscope').StatoscopeAnalyzePlugin,
34
+ rsdoctor: () => require('../../analyzePlugins/rsdoctor').RsdoctorAnalyzePlugin,
39
35
  };
40
36
 
41
37
  export const analyzeSharedProviders: Provider[] = [
42
38
  provide({
43
39
  provide: WEBPACK_ANALYZE_PLUGIN_TOKEN,
44
40
  useFactory: ({ pluginName }) => {
45
- const PluginClass = pluginMap[pluginName];
41
+ const PluginClass = pluginMap[pluginName]();
46
42
 
47
43
  if (!PluginClass) {
48
44
  throw new Error('Set correct plugin option');
@@ -7,18 +7,21 @@ import { CLIENT_CONFIG_MANAGER_TOKEN, WEBPACK_CLIENT_CONFIG_TOKEN } from '../tok
7
7
  import { CONFIG_GENERATOR_STUB } from '../stubs/config';
8
8
  import type { ConfigGenerator } from '../types';
9
9
 
10
- const CONFIG_MAP: Record<Env, Record<ProjectType, ConfigGenerator>> = {
10
+ const CONFIG_MAP: Record<Env, Record<ProjectType, () => ConfigGenerator>> = {
11
11
  development: {
12
- application: require('../../../library/webpack/application/client/dev').webpackClientConfig,
13
- module: require('../../../library/webpack/module/client/dev').webpackClientConfig,
14
- 'child-app': require('../../../library/webpack/child-app/client/dev').webpackClientConfig,
15
- package: CONFIG_GENERATOR_STUB,
12
+ application: () =>
13
+ require('../../../library/webpack/application/client/dev').webpackClientConfig,
14
+ module: () => require('../../../library/webpack/module/client/dev').webpackClientConfig,
15
+ 'child-app': () => require('../../../library/webpack/child-app/client/dev').webpackClientConfig,
16
+ package: () => CONFIG_GENERATOR_STUB,
16
17
  },
17
18
  production: {
18
- application: require('../../../library/webpack/application/client/prod').webpackClientConfig,
19
- module: require('../../../library/webpack/module/client/prod').webpackClientConfig,
20
- 'child-app': require('../../../library/webpack/child-app/client/prod').webpackClientConfig,
21
- package: CONFIG_GENERATOR_STUB,
19
+ application: () =>
20
+ require('../../../library/webpack/application/client/prod').webpackClientConfig,
21
+ module: () => require('../../../library/webpack/module/client/prod').webpackClientConfig,
22
+ 'child-app': () =>
23
+ require('../../../library/webpack/child-app/client/prod').webpackClientConfig,
24
+ package: () => CONFIG_GENERATOR_STUB,
22
25
  },
23
26
  };
24
27
 
@@ -26,7 +29,9 @@ export const clientProviders: Provider[] = [
26
29
  provide({
27
30
  provide: WEBPACK_CLIENT_CONFIG_TOKEN,
28
31
  useFactory: ({ configManager, showProgress }) => {
29
- return CONFIG_MAP[configManager.env][configManager.type]({
32
+ const webpackConfigFactory = CONFIG_MAP[configManager.env][configManager.type]();
33
+
34
+ return webpackConfigFactory({
30
35
  configManager,
31
36
  showProgress,
32
37
  });
@@ -7,18 +7,21 @@ import { SERVER_CONFIG_MANAGER_TOKEN, WEBPACK_SERVER_CONFIG_TOKEN } from '../tok
7
7
  import { CONFIG_GENERATOR_STUB } from '../stubs/config';
8
8
  import type { ConfigGenerator } from '../types';
9
9
 
10
- const CONFIG_MAP: Record<Env, Record<ProjectType, ConfigGenerator>> = {
10
+ const CONFIG_MAP: Record<Env, Record<ProjectType, () => ConfigGenerator>> = {
11
11
  development: {
12
- application: require('../../../library/webpack/application/server/dev').webpackServerConfig,
13
- module: require('../../../library/webpack/module/server/dev').webpackServerConfig,
14
- 'child-app': require('../../../library/webpack/child-app/server/dev').webpackServerConfig,
15
- package: CONFIG_GENERATOR_STUB,
12
+ application: () =>
13
+ require('../../../library/webpack/application/server/dev').webpackServerConfig,
14
+ module: () => require('../../../library/webpack/module/server/dev').webpackServerConfig,
15
+ 'child-app': () => require('../../../library/webpack/child-app/server/dev').webpackServerConfig,
16
+ package: () => CONFIG_GENERATOR_STUB,
16
17
  },
17
18
  production: {
18
- application: require('../../../library/webpack/application/server/prod').webpackServerConfig,
19
- module: require('../../../library/webpack/module/server/prod').webpackServerConfig,
20
- 'child-app': require('../../../library/webpack/child-app/server/prod').webpackServerConfig,
21
- package: CONFIG_GENERATOR_STUB,
19
+ application: () =>
20
+ require('../../../library/webpack/application/server/prod').webpackServerConfig,
21
+ module: () => require('../../../library/webpack/module/server/prod').webpackServerConfig,
22
+ 'child-app': () =>
23
+ require('../../../library/webpack/child-app/server/prod').webpackServerConfig,
24
+ package: () => CONFIG_GENERATOR_STUB,
22
25
  },
23
26
  };
24
27
 
@@ -37,7 +40,9 @@ export const serverProviders: Provider[] = [
37
40
  provide({
38
41
  provide: WEBPACK_SERVER_CONFIG_TOKEN,
39
42
  useFactory: ({ configManager, showProgress }) => {
40
- return CONFIG_MAP[configManager.env][configManager.type]({
43
+ const webpackConfigFactory = CONFIG_MAP[configManager.env][configManager.type]();
44
+
45
+ return webpackConfigFactory({
41
46
  configManager,
42
47
  showProgress,
43
48
  });
package/src/cli/CLI.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import type { PackageManager } from '@tinkoff/package-manager-wrapper';
2
+ import { AnalyticsService } from '@tramvai/api/lib/services/analytics';
2
3
  import { commander } from '../ui/commander';
3
4
  import { Context } from '../models/context';
4
5
  import type { Command, CommandMap, CommandResult } from '../models/command';
5
6
  import type { Logger } from '../models/logger';
6
7
  import type { Task, TaskMap } from '../models/task';
7
8
  import type { ConfigManager } from '../models/config';
8
- import { AnalyticsService } from '../models/analytics/analytics';
9
9
 
10
10
  export class CLI {
11
11
  context: Context;
@@ -1,9 +1,7 @@
1
1
  import resolve from 'resolve';
2
2
  import { clearExecArgv } from '../utils/clearExecArgv';
3
- import { initSentry } from '../utils/sentry';
4
3
 
5
4
  clearExecArgv();
6
- initSentry();
7
5
 
8
6
  resolve(
9
7
  '@tramvai/cli/lib/cli',
package/src/cli/index.ts CHANGED
@@ -1,9 +1,12 @@
1
1
  import path from 'path';
2
2
  import { resolvePackageManager, NpmPackageManager } from '@tinkoff/package-manager-wrapper';
3
+ import {
4
+ AnalyticsService,
5
+ resolveDependenciesProperties,
6
+ } from '@tramvai/api/lib/services/analytics';
3
7
  import { CLI } from './CLI';
4
8
  import { Logger } from '../models/logger';
5
9
  import { ConfigManager } from '../models/config';
6
- import { initSentry } from '../utils/sentry';
7
10
 
8
11
  import type { CommandMap } from '../models/command';
9
12
 
@@ -26,7 +29,6 @@ import type { TaskMap } from '../models/task';
26
29
  import { getRootFile } from '../utils/getRootFile';
27
30
  import { getTramvaiConfig } from '../utils/getTramvaiConfig';
28
31
  import { syncJsonFile } from '../utils/syncJsonFile';
29
- import { AnalyticsService, resolveDependenciesProperties } from '../models/analytics/analytics';
30
32
 
31
33
  async function loadCommands(): Promise<CommandMap> {
32
34
  return [
@@ -54,14 +56,8 @@ const defaultPackageInfo = { name: 'init app', version: '0.0.1' };
54
56
  export async function cliInitialized(cliArgs = process.argv) {
55
57
  const logger = new Logger();
56
58
  let analytics: AnalyticsService;
57
- const sentry = initSentry();
58
59
 
59
60
  try {
60
- const commandContext = {
61
- command: cliArgs[2] || '',
62
- argv: cliArgs,
63
- };
64
- sentry.setContext('command', commandContext);
65
61
  const commandsMap = await loadCommands();
66
62
  const tasksMap = await loadTasks();
67
63
 
@@ -126,10 +122,7 @@ export async function cliInitialized(cliArgs = process.argv) {
126
122
  message: e.message || e,
127
123
  payload: e.details || e.stack,
128
124
  });
129
- sentry.captureException(e);
130
125
 
131
126
  throw e;
132
- } finally {
133
- await sentry.close();
134
127
  }
135
128
  }
package/src/cli/runCLI.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import exit from 'exit';
2
-
3
2
  import { fixYarnSettingsOverride } from '../utils/fixYarnSettingsOverride';
4
3
  import { handleErrors } from '../utils/handleErrors';
5
4
 
@@ -1,5 +1,4 @@
1
1
  import { CLICommand } from '../../models/command';
2
- import { checkPackage } from './checkPackageValidator';
3
2
  import type { Params } from './add';
4
3
 
5
4
  class AddCommand extends CLICommand {
@@ -23,7 +22,9 @@ class AddCommand extends CLICommand {
23
22
 
24
23
  alias = '';
25
24
 
26
- validators = [checkPackage];
25
+ validators() {
26
+ return [require('./checkPackageValidator').checkPackage];
27
+ }
27
28
 
28
29
  async action(parameters: Params) {
29
30
  // used require for lazy code execution
@@ -1,10 +1,4 @@
1
1
  import { CLICommand } from '../../models/command';
2
- import { checkApplication } from '../../validators/commands/checkBuild';
3
- import { checkConfigExists } from '../../validators/commands/checkConfigExists';
4
- import { checkPwaDependencies } from '../../validators/commands/checkPwaDependencies';
5
- import { runMigrationsAndCheckVersions } from '../../validators/commands/runMigrationsAndCheckVersions';
6
- import { checkSwcDependencies } from '../../validators/commands/checkSwcDependencies';
7
- import { checkReactCompilerDependencies } from '../../validators/commands/checkReactCompilerDependencies';
8
2
 
9
3
  export type Params = {
10
4
  target: string;
@@ -46,14 +40,18 @@ class AnalyzeCommand extends CLICommand<Params> {
46
40
 
47
41
  alias = 'a';
48
42
 
49
- validators = [
50
- checkConfigExists,
51
- checkApplication,
52
- runMigrationsAndCheckVersions,
53
- checkPwaDependencies,
54
- checkSwcDependencies,
55
- checkReactCompilerDependencies,
56
- ];
43
+ validators() {
44
+ return [
45
+ require('../../validators/commands/checkConfigExists').checkConfigExists,
46
+ require('../../validators/commands/checkBuild').checkApplication,
47
+ require('../../validators/commands/runMigrationsAndCheckVersions')
48
+ .runMigrationsAndCheckVersions,
49
+ require('../../validators/commands/checkPwaDependencies').checkPwaDependencies,
50
+ require('../../validators/commands/checkSwcDependencies').checkSwcDependencies,
51
+ require('../../validators/commands/checkReactCompilerDependencies')
52
+ .checkReactCompilerDependencies,
53
+ ];
54
+ }
57
55
 
58
56
  action(parameters: Params) {
59
57
  // used require for lazy code execution
@@ -1,8 +1,4 @@
1
1
  import { CLICommand } from '../../models/command';
2
- import { checkApplication } from '../../validators/commands/checkBuild';
3
- import { checkConfigExists } from '../../validators/commands/checkConfigExists';
4
- import { checkDependencies } from '../../validators/commands/checkDependencies';
5
- import { runMigrationsAndCheckVersions } from '../../validators/commands/runMigrationsAndCheckVersions';
6
2
  import type { Params as StartParams } from '../start/command';
7
3
 
8
4
  export type Params = StartParams & {
@@ -45,12 +41,15 @@ export class BenchmarkCommand extends CLICommand<Params> {
45
41
 
46
42
  alias = 'bench';
47
43
 
48
- validators = [
49
- checkConfigExists,
50
- checkApplication,
51
- runMigrationsAndCheckVersions,
52
- checkDependencies,
53
- ];
44
+ validators() {
45
+ return [
46
+ require('../../validators/commands/checkConfigExists').checkConfigExists,
47
+ require('../../validators/commands/checkBuild').checkApplication,
48
+ require('../../validators/commands/runMigrationsAndCheckVersions')
49
+ .runMigrationsAndCheckVersions,
50
+ require('../../validators/commands/checkDependencies').checkDependencies,
51
+ ];
52
+ }
54
53
 
55
54
  action(parameters) {
56
55
  // used require for lazy code execution
@@ -5,6 +5,8 @@ import { app } from '../index';
5
5
  export default async (context: Context, parameters): Promise<CommandResult> => {
6
6
  await app.run('build', parameters);
7
7
 
8
+ // todo builder.getBuildStats and send analytics event "cli:command:build:stats"
9
+
8
10
  return Promise.resolve({
9
11
  status: 'ok',
10
12
  });