@tramvai/cli 2.64.0 → 2.66.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 (426) hide show
  1. package/README.md +46 -38
  2. package/lib/api/analyze/providers/shared.js +1 -1
  3. package/lib/api/analyze/providers/shared.js.map +1 -1
  4. package/lib/api/benchmark/index.d.ts +1 -1
  5. package/lib/api/build/child-app.js +3 -2
  6. package/lib/api/build/child-app.js.map +1 -1
  7. package/lib/api/build/module.js +1 -2
  8. package/lib/api/build/module.js.map +1 -1
  9. package/lib/api/build/providers/shared.js +1 -1
  10. package/lib/api/build/providers/shared.js.map +1 -1
  11. package/lib/api/index.d.ts +6 -2
  12. package/lib/api/index.js +3 -3
  13. package/lib/api/index.js.map +1 -1
  14. package/lib/api/shared/types/withConfig.d.ts +3 -2
  15. package/lib/api/start/providers/application/server.js +11 -18
  16. package/lib/api/start/providers/application/server.js.map +1 -1
  17. package/lib/api/start/providers/application/shared.js +17 -25
  18. package/lib/api/start/providers/application/shared.js.map +1 -1
  19. package/lib/api/start/providers/child-app/shared.js +19 -25
  20. package/lib/api/start/providers/child-app/shared.js.map +1 -1
  21. package/lib/api/start/providers/module/shared.js +18 -24
  22. package/lib/api/start/providers/module/shared.js.map +1 -1
  23. package/lib/api/start/utils/banner.js +3 -2
  24. package/lib/api/start/utils/banner.js.map +1 -1
  25. package/lib/api/start/utils/listenServer.js +3 -2
  26. package/lib/api/start/utils/listenServer.js.map +1 -1
  27. package/lib/api/start/utils/tips/tips.js +10 -8
  28. package/lib/api/start/utils/tips/tips.js.map +1 -1
  29. package/lib/api/start-prod/providers/application.js +6 -5
  30. package/lib/api/start-prod/providers/application.js.map +1 -1
  31. package/lib/api/start-prod/providers/child-app.js +3 -2
  32. package/lib/api/start-prod/providers/child-app.js.map +1 -1
  33. package/lib/api/start-prod/providers/shared.js +5 -13
  34. package/lib/api/start-prod/providers/shared.js.map +1 -1
  35. package/lib/builder/webpack/devServer/client.js +18 -15
  36. package/lib/builder/webpack/devServer/client.js.map +1 -1
  37. package/lib/builder/webpack/devServer/notifier.d.ts +2 -2
  38. package/lib/builder/webpack/devServer/notifier.js +3 -3
  39. package/lib/builder/webpack/devServer/notifier.js.map +1 -1
  40. package/lib/builder/webpack/devServer/pool/process/pool.js +3 -2
  41. package/lib/builder/webpack/devServer/pool/process/pool.js.map +1 -1
  42. package/lib/builder/webpack/devServer/pool/thread/pool.js +7 -0
  43. package/lib/builder/webpack/devServer/pool/thread/pool.js.map +1 -1
  44. package/lib/builder/webpack/devServer/server.js +7 -2
  45. package/lib/builder/webpack/devServer/server.js.map +1 -1
  46. package/lib/builder/webpack/providers/analyze/shared.js +3 -3
  47. package/lib/builder/webpack/providers/analyze/shared.js.map +1 -1
  48. package/lib/builder/webpack/providers/build/application/server.js.map +1 -1
  49. package/lib/builder/webpack/providers/build/client.js +3 -3
  50. package/lib/builder/webpack/providers/build/client.js.map +1 -1
  51. package/lib/builder/webpack/providers/build/server.js +1 -1
  52. package/lib/builder/webpack/providers/build/server.js.map +1 -1
  53. package/lib/builder/webpack/tokens.d.ts +313 -3
  54. package/lib/builder/webpack/tokens.js.map +1 -1
  55. package/lib/builder/webpack/utils/copyBuildFile.d.ts +2 -1
  56. package/lib/builder/webpack/utils/copyBuildFile.js +2 -3
  57. package/lib/builder/webpack/utils/copyBuildFile.js.map +1 -1
  58. package/lib/builder/webpack/utils/copyStatsJsonFile.d.ts +2 -1
  59. package/lib/builder/webpack/utils/copyStatsJsonFile.js +1 -1
  60. package/lib/builder/webpack/utils/copyStatsJsonFile.js.map +1 -1
  61. package/lib/cli/CLI.d.ts +2 -2
  62. package/lib/cli/CLI.js +2 -2
  63. package/lib/cli/CLI.js.map +1 -1
  64. package/lib/cli/index.js.map +1 -1
  65. package/lib/commands/analyze/command.d.ts +1 -1
  66. package/lib/commands/analyze/command.js.map +1 -1
  67. package/lib/commands/benchmark/command.d.ts +1 -1
  68. package/lib/commands/benchmark/command.js.map +1 -1
  69. package/lib/commands/build/command.d.ts +1 -1
  70. package/lib/commands/build/command.js.map +1 -1
  71. package/lib/commands/new/new.js +0 -1
  72. package/lib/commands/new/new.js.map +1 -1
  73. package/lib/commands/new/questions/packageManager.d.ts +1 -1
  74. package/lib/commands/new/questions/packageManager.js.map +1 -1
  75. package/lib/commands/new/questions/template.d.ts +1 -1
  76. package/lib/commands/new/questions/template.js.map +1 -1
  77. package/lib/commands/new/questions/testingFramework.d.ts +1 -1
  78. package/lib/commands/new/questions/testingFramework.js.map +1 -1
  79. package/lib/commands/new/questions/type.d.ts +1 -1
  80. package/lib/commands/new/questions/type.js.map +1 -1
  81. package/lib/commands/new/steps/initializationGit.d.ts +1 -1
  82. package/lib/commands/new/steps/initializationGit.js.map +1 -1
  83. package/lib/commands/start/command.d.ts +1 -1
  84. package/lib/commands/start/command.js.map +1 -1
  85. package/lib/commands/start-prod/command.d.ts +1 -1
  86. package/lib/commands/start-prod/command.js.map +1 -1
  87. package/lib/commands/static/application.js +4 -4
  88. package/lib/commands/static/application.js.map +1 -1
  89. package/lib/commands/static/command.d.ts +1 -1
  90. package/lib/commands/static/command.js.map +1 -1
  91. package/lib/commands/static/generate.js +2 -2
  92. package/lib/commands/static/generate.js.map +1 -1
  93. package/lib/commands/static/server.d.ts +2 -1
  94. package/lib/commands/static/server.js +1 -1
  95. package/lib/commands/static/server.js.map +1 -1
  96. package/lib/commands/static/staticServer.d.ts +2 -1
  97. package/lib/commands/static/staticServer.js +1 -1
  98. package/lib/commands/static/staticServer.js.map +1 -1
  99. package/lib/commands/update/updatePackageJson.js +3 -0
  100. package/lib/commands/update/updatePackageJson.js.map +1 -1
  101. package/lib/config/configManager.d.ts +15 -73
  102. package/lib/config/configManager.js +64 -92
  103. package/lib/config/configManager.js.map +1 -1
  104. package/lib/config/showConfig.d.ts +1 -1
  105. package/lib/config/showConfig.js +1 -1
  106. package/lib/config/showConfig.js.map +1 -1
  107. package/lib/config/validate.d.ts +5 -4
  108. package/lib/config/validate.js +2 -9
  109. package/lib/config/validate.js.map +1 -1
  110. package/lib/di/tokens/config.d.ts +106 -1
  111. package/lib/di/tokens/config.js.map +1 -1
  112. package/lib/external/config.d.ts +2 -2
  113. package/lib/library/babel/index.js +1 -0
  114. package/lib/library/babel/index.js.map +1 -1
  115. package/lib/library/swc/index.js +1 -1
  116. package/lib/library/swc/index.js.map +1 -1
  117. package/lib/library/webpack/application/client/common.js +6 -4
  118. package/lib/library/webpack/application/client/common.js.map +1 -1
  119. package/lib/library/webpack/application/client/dev.js +9 -8
  120. package/lib/library/webpack/application/client/dev.js.map +1 -1
  121. package/lib/library/webpack/application/client/prod/optimization/splitChunks.js +40 -39
  122. package/lib/library/webpack/application/client/prod/optimization/splitChunks.js.map +1 -1
  123. package/lib/library/webpack/application/client/prod.js +3 -4
  124. package/lib/library/webpack/application/client/prod.js.map +1 -1
  125. package/lib/library/webpack/application/server/common.js +5 -5
  126. package/lib/library/webpack/application/server/common.js.map +1 -1
  127. package/lib/library/webpack/application/server/dev.js +3 -6
  128. package/lib/library/webpack/application/server/dev.js.map +1 -1
  129. package/lib/library/webpack/application/server/prod.js +3 -4
  130. package/lib/library/webpack/application/server/prod.js.map +1 -1
  131. package/lib/library/webpack/blocks/apiResolve.js +1 -1
  132. package/lib/library/webpack/blocks/apiResolve.js.map +1 -1
  133. package/lib/library/webpack/blocks/configResolve.js +2 -2
  134. package/lib/library/webpack/blocks/configResolve.js.map +1 -1
  135. package/lib/library/webpack/blocks/configToEnv.js +5 -2
  136. package/lib/library/webpack/blocks/configToEnv.js.map +1 -1
  137. package/lib/library/webpack/blocks/css.d.ts +3 -1
  138. package/lib/library/webpack/blocks/css.js +17 -6
  139. package/lib/library/webpack/blocks/css.js.map +1 -1
  140. package/lib/library/webpack/blocks/extractCssPlugin.d.ts +4 -3
  141. package/lib/library/webpack/blocks/extractCssPlugin.js +4 -6
  142. package/lib/library/webpack/blocks/extractCssPlugin.js.map +1 -1
  143. package/lib/library/webpack/blocks/filesClient.d.ts +3 -2
  144. package/lib/library/webpack/blocks/filesClient.js +7 -7
  145. package/lib/library/webpack/blocks/filesClient.js.map +1 -1
  146. package/lib/library/webpack/blocks/filesServer.d.ts +2 -1
  147. package/lib/library/webpack/blocks/filesServer.js +3 -3
  148. package/lib/library/webpack/blocks/filesServer.js.map +1 -1
  149. package/lib/library/webpack/blocks/js.d.ts +2 -1
  150. package/lib/library/webpack/blocks/js.js +1 -1
  151. package/lib/library/webpack/blocks/js.js.map +1 -1
  152. package/lib/library/webpack/blocks/nodeClient.d.ts +2 -1
  153. package/lib/library/webpack/blocks/nodeClient.js +2 -2
  154. package/lib/library/webpack/blocks/nodeClient.js.map +1 -1
  155. package/lib/library/webpack/blocks/optimize.d.ts +2 -1
  156. package/lib/library/webpack/blocks/optimize.js +3 -3
  157. package/lib/library/webpack/blocks/optimize.js.map +1 -1
  158. package/lib/library/webpack/blocks/pagesResolve.js +1 -1
  159. package/lib/library/webpack/blocks/pagesResolve.js.map +1 -1
  160. package/lib/library/webpack/blocks/postcssAssets.d.ts +2 -1
  161. package/lib/library/webpack/blocks/postcssAssets.js +2 -2
  162. package/lib/library/webpack/blocks/postcssAssets.js.map +1 -1
  163. package/lib/library/webpack/blocks/serverInline.d.ts +2 -1
  164. package/lib/library/webpack/blocks/serverInline.js.map +1 -1
  165. package/lib/library/webpack/blocks/ts.d.ts +2 -1
  166. package/lib/library/webpack/blocks/ts.js.map +1 -1
  167. package/lib/library/webpack/child-app/client/common.d.ts +2 -2
  168. package/lib/library/webpack/child-app/client/common.js +1 -1
  169. package/lib/library/webpack/child-app/client/common.js.map +1 -1
  170. package/lib/library/webpack/child-app/client/dev.d.ts +2 -2
  171. package/lib/library/webpack/child-app/client/dev.js +6 -5
  172. package/lib/library/webpack/child-app/client/dev.js.map +1 -1
  173. package/lib/library/webpack/child-app/client/prod.d.ts +2 -2
  174. package/lib/library/webpack/child-app/client/prod.js.map +1 -1
  175. package/lib/library/webpack/child-app/common.d.ts +2 -2
  176. package/lib/library/webpack/child-app/common.js.map +1 -1
  177. package/lib/library/webpack/child-app/server/common.d.ts +2 -2
  178. package/lib/library/webpack/child-app/server/common.js +1 -1
  179. package/lib/library/webpack/child-app/server/common.js.map +1 -1
  180. package/lib/library/webpack/child-app/server/dev.d.ts +2 -2
  181. package/lib/library/webpack/child-app/server/dev.js.map +1 -1
  182. package/lib/library/webpack/child-app/server/prod.d.ts +2 -2
  183. package/lib/library/webpack/child-app/server/prod.js.map +1 -1
  184. package/lib/library/webpack/common/client/prod.d.ts +2 -1
  185. package/lib/library/webpack/common/client/prod.js +4 -5
  186. package/lib/library/webpack/common/client/prod.js.map +1 -1
  187. package/lib/library/webpack/common/main.d.ts +2 -1
  188. package/lib/library/webpack/common/main.js +3 -3
  189. package/lib/library/webpack/common/main.js.map +1 -1
  190. package/lib/library/webpack/common/server/prod.d.ts +2 -1
  191. package/lib/library/webpack/common/server/prod.js +4 -5
  192. package/lib/library/webpack/common/server/prod.js.map +1 -1
  193. package/lib/library/webpack/index.js +1 -2
  194. package/lib/library/webpack/index.js.map +1 -1
  195. package/lib/library/webpack/loaders/image-loader/index.d.ts +2 -1
  196. package/lib/library/webpack/loaders/image-loader/index.js.map +1 -1
  197. package/lib/library/webpack/loaders/pagesResolve.d.ts +10 -1
  198. package/lib/library/webpack/loaders/pagesResolve.js +4 -3
  199. package/lib/library/webpack/loaders/pagesResolve.js.map +1 -1
  200. package/lib/library/webpack/loaders/replaceContent.d.ts +6 -1
  201. package/lib/library/webpack/loaders/replaceContent.js +4 -3
  202. package/lib/library/webpack/loaders/replaceContent.js.map +1 -1
  203. package/lib/library/webpack/module/client/common.js +1 -1
  204. package/lib/library/webpack/module/client/common.js.map +1 -1
  205. package/lib/library/webpack/module/externals.d.ts +1 -1
  206. package/lib/library/webpack/module/externals.js.map +1 -1
  207. package/lib/library/webpack/module/resolveExternal.d.ts +1 -1
  208. package/lib/library/webpack/module/resolveExternal.js.map +1 -1
  209. package/lib/library/webpack/module/server/common.js +1 -1
  210. package/lib/library/webpack/module/server/common.js.map +1 -1
  211. package/lib/library/webpack/plugins/LazyModuleInitialization.d.ts +2 -2
  212. package/lib/library/webpack/plugins/LazyModuleInitialization.js +1 -0
  213. package/lib/library/webpack/plugins/LazyModuleInitialization.js.map +1 -1
  214. package/lib/library/webpack/plugins/WebpackBar/utils/index.d.ts +7 -7
  215. package/lib/library/webpack/plugins/WebpackBar/utils/index.js.map +1 -1
  216. package/lib/library/webpack/plugins/WebpackBar/utils/webpack.d.ts +2 -2
  217. package/lib/library/webpack/plugins/WebpackBar/utils/webpack.js.map +1 -1
  218. package/lib/library/webpack/types/webpack.d.ts +2 -2
  219. package/lib/library/webpack/utils/files.d.ts +4 -3
  220. package/lib/library/webpack/utils/files.js +2 -2
  221. package/lib/library/webpack/utils/files.js.map +1 -1
  222. package/lib/library/webpack/utils/transpiler.d.ts +3 -2
  223. package/lib/library/webpack/utils/transpiler.js +2 -2
  224. package/lib/library/webpack/utils/transpiler.js.map +1 -1
  225. package/lib/library/webpack/utils/workersPool.d.ts +3 -6
  226. package/lib/library/webpack/utils/workersPool.js +1 -1
  227. package/lib/library/webpack/utils/workersPool.js.map +1 -1
  228. package/lib/models/config.d.ts +2 -3
  229. package/lib/models/config.js +32 -3
  230. package/lib/models/config.js.map +1 -1
  231. package/lib/schema/ConfigSchema.d.ts +13 -4
  232. package/lib/schema/autogeneratedSchema.json +1808 -2074
  233. package/lib/typings/configEntry/application.d.ts +81 -86
  234. package/lib/typings/configEntry/child-app.d.ts +10 -29
  235. package/lib/typings/configEntry/cli.d.ts +254 -0
  236. package/lib/typings/configEntry/{CheckAsyncTsConfig.js → cli.js} +1 -1
  237. package/lib/typings/configEntry/cli.js.map +1 -0
  238. package/lib/typings/configEntry/common.d.ts +16 -276
  239. package/lib/typings/configEntry/common.js +15 -0
  240. package/lib/typings/configEntry/common.js.map +1 -1
  241. package/lib/typings/configEntry/module.d.ts +10 -29
  242. package/lib/typings/configEntry/package.d.ts +2 -1
  243. package/lib/ui/commander.js +1 -1
  244. package/lib/ui/commander.js.map +1 -1
  245. package/lib/utils/applyTemplate.js.map +1 -1
  246. package/lib/utils/detectPortSync.d.ts +1 -0
  247. package/lib/utils/detectPortSync.js +10 -0
  248. package/lib/utils/detectPortSync.js.map +1 -0
  249. package/lib/utils/safeRequire.js +5 -1
  250. package/lib/utils/safeRequire.js.map +1 -1
  251. package/lib/utils/webpackBuild.d.ts +2 -1
  252. package/lib/utils/webpackBuild.js +3 -3
  253. package/lib/utils/webpackBuild.js.map +1 -1
  254. package/package.json +14 -9
  255. package/schema.json +1802 -2068
  256. package/src/api/analyze/providers/shared.ts +3 -2
  257. package/src/api/benchmark/__integration__/__fixtures__/tramvai.json +1 -8
  258. package/src/api/benchmark/index.ts +1 -1
  259. package/src/api/build/__integration__/__fixtures__/app/App.tsx +0 -1
  260. package/src/api/build/__integration__/__fixtures__/app/index.tsx +14 -8
  261. package/src/api/build/__integration__/__fixtures__/app/server.tsx +0 -1
  262. package/src/api/build/__integration__/__fixtures__/tramvai.json +1 -10
  263. package/src/api/build/__integration__/build.test.ts +4 -13
  264. package/src/api/build/child-app.ts +4 -4
  265. package/src/api/build/module.ts +2 -4
  266. package/src/api/build/providers/shared.ts +2 -2
  267. package/src/api/index.ts +6 -2
  268. package/src/api/shared/types/withConfig.ts +5 -6
  269. package/src/api/start/__integration__/__fixtures__/app/index.tsx +11 -7
  270. package/src/api/start/__integration__/__fixtures__/tramvai.json +6 -17
  271. package/src/api/start/__integration__/start.test.ts +38 -13
  272. package/src/api/start/providers/application/server.ts +14 -23
  273. package/src/api/start/providers/application/shared.ts +26 -52
  274. package/src/api/start/providers/child-app/shared.ts +23 -46
  275. package/src/api/start/providers/module/shared.ts +24 -47
  276. package/src/api/start/utils/banner.ts +3 -2
  277. package/src/api/start/utils/listenServer.ts +2 -1
  278. package/src/api/start/utils/tips/tips.ts +11 -8
  279. package/src/api/start-prod/providers/application.ts +19 -19
  280. package/src/api/start-prod/providers/child-app.ts +7 -8
  281. package/src/api/start-prod/providers/shared.ts +6 -20
  282. package/src/builder/webpack/devServer/client.ts +22 -15
  283. package/src/builder/webpack/devServer/notifier.ts +6 -6
  284. package/src/builder/webpack/devServer/pool/process/pool.ts +3 -3
  285. package/src/builder/webpack/devServer/pool/thread/pool.ts +7 -0
  286. package/src/builder/webpack/devServer/server.ts +13 -6
  287. package/src/builder/webpack/providers/analyze/shared.ts +3 -2
  288. package/src/builder/webpack/providers/build/application/server.ts +5 -1
  289. package/src/builder/webpack/providers/build/client.ts +2 -2
  290. package/src/builder/webpack/providers/build/server.ts +1 -1
  291. package/src/builder/webpack/tokens.ts +4 -3
  292. package/src/builder/webpack/utils/copyBuildFile.ts +4 -5
  293. package/src/builder/webpack/utils/copyStatsJsonFile.ts +5 -2
  294. package/src/cli/CLI.ts +6 -6
  295. package/src/cli/index.ts +1 -1
  296. package/src/commands/analyze/command.ts +1 -1
  297. package/src/commands/benchmark/command.ts +1 -1
  298. package/src/commands/build/command.ts +2 -2
  299. package/src/commands/new/new.ts +0 -1
  300. package/src/commands/new/questions/packageManager.ts +1 -1
  301. package/src/commands/new/questions/template.ts +1 -1
  302. package/src/commands/new/questions/testingFramework.ts +1 -1
  303. package/src/commands/new/questions/type.ts +1 -1
  304. package/src/commands/new/steps/initializationGit.ts +1 -1
  305. package/src/commands/new/templates/app/monorepo/tramvai.json.hbs +6 -32
  306. package/src/commands/new/templates/app/multirepo/tramvai.json.hbs +6 -23
  307. package/src/commands/new/templates/child-app/monorepo/tramvai.json.hbs +3 -18
  308. package/src/commands/new/templates/child-app/multirepo/tramvai.json.hbs +3 -9
  309. package/src/commands/start/command.ts +2 -2
  310. package/src/commands/start-prod/command.ts +2 -2
  311. package/src/commands/static/application.ts +5 -14
  312. package/src/commands/static/command.ts +1 -1
  313. package/src/commands/static/generate.ts +2 -2
  314. package/src/commands/static/server.ts +5 -2
  315. package/src/commands/static/staticServer.ts +6 -3
  316. package/src/commands/update/updatePackageJson.ts +6 -2
  317. package/src/config/configManager.spec.ts +49 -0
  318. package/src/config/configManager.ts +129 -197
  319. package/src/config/showConfig.ts +2 -2
  320. package/src/config/validate.ts +14 -25
  321. package/src/di/tokens/config.ts +2 -1
  322. package/src/library/babel/index.ts +1 -0
  323. package/src/library/swc/__integration__/swc.build.test.ts +3 -21
  324. package/src/library/swc/__integration__/swc.start.test.ts +3 -21
  325. package/src/library/swc/index.ts +1 -1
  326. package/src/library/webpack/application/client/common.ts +7 -7
  327. package/src/library/webpack/application/client/dev.ts +9 -9
  328. package/src/library/webpack/application/client/prod/optimization/splitChunks.ts +43 -44
  329. package/src/library/webpack/application/client/prod.ts +3 -5
  330. package/src/library/webpack/application/server/common.ts +5 -8
  331. package/src/library/webpack/application/server/dev.ts +5 -6
  332. package/src/library/webpack/application/server/prod.ts +3 -9
  333. package/src/library/webpack/blocks/apiResolve.ts +1 -1
  334. package/src/library/webpack/blocks/configResolve.ts +2 -2
  335. package/src/library/webpack/blocks/configToEnv.ts +5 -2
  336. package/src/library/webpack/blocks/css.ts +26 -17
  337. package/src/library/webpack/blocks/extractCssPlugin.ts +11 -10
  338. package/src/library/webpack/blocks/filesClient.ts +52 -50
  339. package/src/library/webpack/blocks/filesServer.ts +4 -3
  340. package/src/library/webpack/blocks/js.ts +3 -2
  341. package/src/library/webpack/blocks/nodeClient.ts +4 -3
  342. package/src/library/webpack/blocks/optimize.ts +5 -6
  343. package/src/library/webpack/blocks/pagesResolve.ts +1 -1
  344. package/src/library/webpack/blocks/postcssAssets.ts +6 -7
  345. package/src/library/webpack/blocks/serverInline.ts +2 -1
  346. package/src/library/webpack/blocks/ts.ts +2 -1
  347. package/src/library/webpack/child-app/client/common.ts +3 -3
  348. package/src/library/webpack/child-app/client/dev.ts +8 -8
  349. package/src/library/webpack/child-app/client/prod.ts +2 -2
  350. package/src/library/webpack/child-app/common.ts +2 -2
  351. package/src/library/webpack/child-app/server/common.ts +3 -3
  352. package/src/library/webpack/child-app/server/dev.ts +2 -2
  353. package/src/library/webpack/child-app/server/prod.ts +2 -2
  354. package/src/library/webpack/common/client/prod.ts +10 -6
  355. package/src/library/webpack/common/main.ts +9 -4
  356. package/src/library/webpack/common/server/prod.ts +10 -6
  357. package/src/library/webpack/index.ts +2 -3
  358. package/src/library/webpack/loaders/image-loader/index.ts +2 -1
  359. package/src/library/webpack/loaders/pagesResolve.ts +17 -5
  360. package/src/library/webpack/loaders/replaceContent.ts +11 -2
  361. package/src/library/webpack/module/client/common.ts +1 -1
  362. package/src/library/webpack/module/externals.ts +1 -1
  363. package/src/library/webpack/module/resolveExternal.ts +1 -1
  364. package/src/library/webpack/module/server/common.ts +1 -1
  365. package/src/library/webpack/plugins/LazyModuleInitialization.ts +6 -1
  366. package/src/library/webpack/plugins/WebpackBar/utils/index.ts +8 -8
  367. package/src/library/webpack/plugins/WebpackBar/utils/webpack.ts +1 -1
  368. package/src/library/webpack/types/webpack.ts +2 -2
  369. package/src/library/webpack/utils/files.ts +4 -3
  370. package/src/library/webpack/utils/transpiler.ts +6 -11
  371. package/src/library/webpack/utils/workersPool.ts +6 -9
  372. package/src/models/config.spec.ts +352 -0
  373. package/src/models/config.ts +41 -9
  374. package/src/schema/ConfigSchema.ts +15 -4
  375. package/src/schema/autogeneratedSchema.json +1808 -2074
  376. package/src/schema/tramvai.spec.ts +89 -184
  377. package/src/typings/configEntry/application.ts +85 -87
  378. package/src/typings/configEntry/child-app.ts +10 -30
  379. package/src/typings/configEntry/cli.ts +271 -0
  380. package/src/typings/configEntry/common.ts +26 -278
  381. package/src/typings/configEntry/module.ts +11 -30
  382. package/src/typings/configEntry/package.ts +3 -1
  383. package/src/ui/commander.ts +1 -1
  384. package/src/utils/applyTemplate.ts +2 -2
  385. package/src/utils/detectPortSync.ts +7 -0
  386. package/src/utils/safeRequire.ts +6 -1
  387. package/src/utils/webpackBuild.ts +4 -3
  388. package/lib/library/webpack/plugins/DedupePlugin/DedupePlugin.d.ts +0 -37
  389. package/lib/library/webpack/plugins/DedupePlugin/DedupePlugin.js +0 -241
  390. package/lib/library/webpack/plugins/DedupePlugin/DedupePlugin.js.map +0 -1
  391. package/lib/library/webpack/plugins/DedupePlugin/index.d.ts +0 -1
  392. package/lib/library/webpack/plugins/DedupePlugin/index.js +0 -6
  393. package/lib/library/webpack/plugins/DedupePlugin/index.js.map +0 -1
  394. package/lib/typings/configEntry/CheckAsyncTsConfig.d.ts +0 -13
  395. package/lib/typings/configEntry/CheckAsyncTsConfig.js.map +0 -1
  396. package/src/library/webpack/plugins/DedupePlugin/DedupePlugin.spec.ts +0 -95
  397. package/src/library/webpack/plugins/DedupePlugin/DedupePlugin.ts +0 -307
  398. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-1/index.js +0 -3
  399. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-1/node_modules/package-dep/index.js +0 -1
  400. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-1/node_modules/package-dep/package.json +0 -7
  401. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-1/package.json +0 -7
  402. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-2/index.js +0 -3
  403. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-2/node_modules/package-dep/index.js +0 -1
  404. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-2/node_modules/package-dep/package.json +0 -7
  405. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-2/package.json +0 -7
  406. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-3/index.js +0 -3
  407. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-3/node_modules/package-dep/index.js +0 -1
  408. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-3/node_modules/package-dep/package.json +0 -7
  409. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-3/package.json +0 -7
  410. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-dep/index.js +0 -1
  411. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-dep/package.json +0 -7
  412. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-1/index.js +0 -3
  413. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-1/node_modules/package-esm-dep/index.js +0 -1
  414. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-1/node_modules/package-esm-dep/package.json +0 -8
  415. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-1/package.json +0 -8
  416. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-2/index.js +0 -3
  417. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-2/node_modules/package-esm-dep/index.js +0 -1
  418. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-2/node_modules/package-esm-dep/package.json +0 -8
  419. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-2/package.json +0 -8
  420. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/package-lock.json +0 -0
  421. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/package.json +0 -14
  422. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/src/index.js +0 -9
  423. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/tramvai.json +0 -67
  424. package/src/library/webpack/plugins/DedupePlugin/__integration__/DedupePlugin.test.ts +0 -90
  425. package/src/library/webpack/plugins/DedupePlugin/index.ts +0 -1
  426. package/src/typings/configEntry/CheckAsyncTsConfig.ts +0 -15
package/README.md CHANGED
@@ -44,21 +44,19 @@ After any command you can pass `--help` string, e.g. `tramvai --help` or `tramva
44
44
 
45
45
  ### Notifications settings
46
46
 
47
- Inside `tramvai.json` the settings for the notification can be specified at path `commands.serve.notifications`. Parameters are passed to [webpack-build-notifier](https://github.com/RoccoC/webpack-build-notifier#config-options). You can specify global configuration or a specific configuration either for client or server build.
47
+ Inside `tramvai.json` the settings for the notification can be specified at path `notifications`. Parameters are passed to [webpack-build-notifier](https://github.com/RoccoC/webpack-build-notifier#config-options). You can specify global configuration or a specific configuration either for client or server build.
48
48
 
49
49
  ```json
50
- "commands": {
51
- "serve": {
52
- "notifications": {
53
- "suppressSuccess": "always",
54
- "server": {
55
- "suppressWarning": true
56
- },
57
- "client": {
58
- "activateTerminalOnError": true
59
- }
60
- }
50
+ {
51
+ "notifications": {
52
+ "suppressSuccess": "always",
53
+ "server": {
54
+ "suppressWarning": true
55
+ },
56
+ "client": {
57
+ "activateTerminalOnError": true
61
58
  }
59
+ }
62
60
  }
63
61
  ```
64
62
 
@@ -67,17 +65,39 @@ Inside `tramvai.json` the settings for the notification can be specified at path
67
65
  Name generation is configured via the options `cssLocalIdentNameDev` and `cssLocalIdentNameProd` (common option `cssLocalIdentName` might be used to specify settings for both prod and dev).
68
66
 
69
67
  ```json
70
- "commands": {
71
- "build": {
72
- "configurations": {
73
- "postcss": {
74
- "cssLocalIdentName": "[hash:base64:5]", // default value (deprecated)
75
- "cssLocalIdentNameDev": "[name]__[local]_[minicss]", // available values see in the docs to [css-loader](https://github.com/webpack-contrib/css-loader)
76
- "cssLocalIdentNameProd": "[minicss]", // additionally new tag `minicss` can be used for the generating minimal css names. Based on [article](https://dev.to/denisx/reduce-bundle-size-via-one-letter-css-classname-hash-strategy-10g6)
77
- };
78
- };
79
- };
80
- };
68
+ {
69
+ "postcss": {
70
+ "cssLocalIdentName": "[hash:base64:5]", // default value (deprecated)
71
+ }
72
+ }
73
+ ```
74
+
75
+ or
76
+
77
+ ```json
78
+ {
79
+ "postcss": {
80
+ "cssLocalIdentName": {
81
+ "development": "[name]__[local]_[minicss]", // available values see in the docs to [css-loader](https://github.com/webpack-contrib/css-loader)
82
+ "production": "[minicss]", // additionally new tag `minicss` can be used for the generating minimal css names. Based on [article](https://dev.to/denisx/reduce-bundle-size-via-one-letter-css-classname-hash-strategy-10g6)
83
+ }
84
+ }
85
+ }
86
+ ```
87
+
88
+ ### CSS modules processing
89
+
90
+ By default, all `*.css` imports will be processed as CSS Modules.
91
+
92
+ IF you want to disable Modules for some files, for example with global styles, you can do it by adding `cssModulePattern` regexp to the config:
93
+
94
+ ```json
95
+ {
96
+ "postcss": {
97
+ // CSS Modules processing will be skipped for *.global.css files
98
+ "cssModulePattern": "/^(?!.global.css$).$/"
99
+ }
100
+ }
81
101
  ```
82
102
 
83
103
  ### Polyfills for the standard NodeJS modules
@@ -109,11 +129,10 @@ If you want to override path to tsconfig through **pluginOptions.tsconfig** the
109
129
 
110
130
  ### Deduplication of modules
111
131
 
112
- Option `commands.build.configurations.dedupe` controls the settings of plugin for the deduplication process. Available options are:
132
+ Option `dedupe` controls the settings of plugin for the deduplication process. Available options are:
113
133
 
114
134
  - `"equality"` - uses strict version comparison. Dedupes modules in `node_modules` with equal package version that are imported from different sources. E.g. imports for `node_modules/package/index.js` and `node_modules/nested-package/node_modules/package/index.js` are deduped into a single `node_modules/package/index.js` import whilst without dedupe it will bundle two files as separate modules.
115
135
  - `"semver"` - compares version of packages based on semver. It can dedupe all of the imports with the same major version and any of the minor and patch versions. E.g. next versions will be deduped: from `1.14.0` and `1.16.2` to `1.16.2`, from `0.14.1` and `0.16.5` to `0.16.5`, whilst versions `0.0.2` and `0.0.5` will be left without deduplication.
116
- - `false` - disable deduplication, by default
117
136
 
118
137
  ### Debug an app
119
138
 
@@ -142,7 +161,7 @@ By default, for browser is used the fastest sourcemaps, while for server no sour
142
161
 
143
162
  Flag `--debug` enables sourcemap generation for the server bundle.
144
163
 
145
- Option `commands.serve.configurations.sourceMap` enables sourcemap generation both for browser and server code.
164
+ Option `sourceMap` enables sourcemap generation both for browser and server code.
146
165
 
147
166
  ##### Production
148
167
 
@@ -150,23 +169,12 @@ By default, sourcemaps are disabled both for the client and server code.
150
169
 
151
170
  Flag `--debug` enables sourcemaps generation for the client and server bundles.
152
171
 
153
- Option `commands.build.configurations.sourceMap` enables sourcemap generation for the client bundle.
154
-
155
- Option `commands.build.configurations.sourceMapServer` enables sourcemap generation for the server bundle.
172
+ Option `sourceMap` enables sourcemap generation for bundle.
156
173
 
157
174
  ## Configuration
158
175
 
159
176
  Configuration is provided through json-file with the name `tramvai.json` in the root of the single-application/monorepo
160
177
 
161
- ### build or serve config?
162
-
163
- When you are deciding where to put specific settings in `tramvai.json` consider next statements:
164
-
165
- - `serve` config is only for development builds (using `tramvai start`)
166
- - `build` config mostly focused on production builds (`tramvai build`, `tramvai analyze`, `tramvai start-prod`) but may affect development builds as well (is this case this configs are merged)
167
-
168
- In conclusion: put most of the settings in the `build` config and put settings in the `serve` config only if they are specific to development builds or you need to override `build` settings to the development process.
169
-
170
178
  ## How to
171
179
 
172
180
  ### Code generation
@@ -8,7 +8,7 @@ exports.sharedProviders = [
8
8
  (0, dippy_1.provide)({
9
9
  provide: tokens_1.CONFIG_MANAGER_TOKEN,
10
10
  useFactory: ({ configEntry, parameters }) => {
11
- return new configManager_1.ConfigManager(configEntry, Object.assign(Object.assign({}, parameters), { env: 'production', buildType: 'client' }));
11
+ return (0, configManager_1.createConfigManager)(configEntry, Object.assign(Object.assign({}, parameters), { env: 'production', buildType: 'client' }));
12
12
  },
13
13
  deps: {
14
14
  configEntry: tokens_1.CONFIG_ENTRY_TOKEN,
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../src/api/analyze/providers/shared.ts"],"names":[],"mappings":";;;AACA,0CAAyC;AACzC,+CAI4B;AAC5B,iEAA8D;AAEjD,QAAA,eAAe,GAAwB;IAClD,IAAA,eAAO,EAAC;QACN,OAAO,EAAE,6BAAoB;QAC7B,UAAU,EAAE,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,EAAE;YAC1C,OAAO,IAAI,6BAAa,CAAC,WAAW,kCAC/B,UAAU,KACb,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,QAAQ,IACnB,CAAC;QACL,CAAC;QACD,IAAI,EAAE;YACJ,WAAW,EAAE,2BAAkB;YAC/B,UAAU,EAAE,iCAAwB;SACrC;KACF,CAAC;CACH,CAAC"}
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../src/api/analyze/providers/shared.ts"],"names":[],"mappings":";;;AACA,0CAAyC;AACzC,+CAI4B;AAC5B,iEAAoE;AAGvD,QAAA,eAAe,GAAwB;IAClD,IAAA,eAAO,EAAC;QACN,OAAO,EAAE,6BAAoB;QAC7B,UAAU,EAAE,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,EAAE;YAC1C,OAAO,IAAA,mCAAmB,EAAC,WAA6B,kCACnD,UAAU,KACb,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,QAAQ,IACnB,CAAC;QACL,CAAC;QACD,IAAI,EAAE;YACJ,WAAW,EAAE,2BAAkB;YAC/B,UAAU,EAAE,iCAAwB;SACrC;KACF,CAAC;CACH,CAAC"}
@@ -8,7 +8,7 @@ export interface Params {
8
8
  times?: number;
9
9
  }
10
10
  export interface Result {
11
- [key: string]: RunStats;
11
+ [key: string]: RunStats | undefined;
12
12
  }
13
13
  export type BenchmarkCommand = (params: StartParams | BuildParams, providers?: Provider[]) => Promise<StartResult | BuildResult>;
14
14
  declare const _default: import("../../typings/commands").Command;
@@ -7,7 +7,6 @@ const di_1 = require("../../utils/di");
7
7
  const tokens_1 = require("../../di/tokens");
8
8
  const buildChildApp = (di) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
9
9
  (0, di_1.registerProviders)(di, shared_1.sharedProviders);
10
- const configManager = di.get(tokens_1.CONFIG_MANAGER_TOKEN);
11
10
  const builderFactory = di.get(tokens_1.ABSTRACT_BUILDER_FACTORY_TOKEN);
12
11
  const builder = yield builderFactory.createBuilder('webpack', {
13
12
  options: {
@@ -16,7 +15,9 @@ const buildChildApp = (di) => tslib_1.__awaiter(void 0, void 0, void 0, function
16
15
  },
17
16
  });
18
17
  const builderBuild = yield builder.build({
19
- modern: configManager.modern,
18
+ // child-app either should be built for legacy code always
19
+ // or should be smart loaded depending on browser capabilities
20
+ modern: false,
20
21
  });
21
22
  return Object.assign({ builder }, builderBuild);
22
23
  });
@@ -1 +1 @@
1
- {"version":3,"file":"child-app.js","sourceRoot":"","sources":["../../../src/api/build/child-app.ts"],"names":[],"mappings":";;;;AAEA,+CAAqD;AACrD,uCAAmD;AACnD,4CAAuF;AAEhF,MAAM,aAAa,GAAG,CAAO,EAAa,EAAU,EAAE;IAC3D,IAAA,sBAAiB,EAAC,EAAE,EAAE,wBAAe,CAAC,CAAC;IAEvC,MAAM,aAAa,GAAG,EAAE,CAAC,GAAG,CAAC,6BAAoB,CAAC,CAAC;IAEnD,MAAM,cAAc,GAAG,EAAE,CAAC,GAAG,CAAC,uCAA8B,CAAC,CAAC;IAC9D,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,aAAa,CAAC,SAAS,EAAE;QAC5D,OAAO,EAAE;YACP,iBAAiB,EAAE,IAAI;YACvB,iBAAiB,EAAE,IAAI;SACxB;KACF,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC;QACvC,MAAM,EAAE,aAAa,CAAC,MAAM;KAC7B,CAAC,CAAC;IAEH,uBACE,OAAO,IACJ,YAAY,EACf;AACJ,CAAC,CAAA,CAAC;AArBW,QAAA,aAAa,iBAqBxB"}
1
+ {"version":3,"file":"child-app.js","sourceRoot":"","sources":["../../../src/api/build/child-app.ts"],"names":[],"mappings":";;;;AAEA,+CAAqD;AACrD,uCAAmD;AACnD,4CAAiE;AAE1D,MAAM,aAAa,GAAG,CAAO,EAAa,EAAU,EAAE;IAC3D,IAAA,sBAAiB,EAAC,EAAE,EAAE,wBAAe,CAAC,CAAC;IAEvC,MAAM,cAAc,GAAG,EAAE,CAAC,GAAG,CAAC,uCAA8B,CAAC,CAAC;IAC9D,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,aAAa,CAAC,SAAS,EAAE;QAC5D,OAAO,EAAE;YACP,iBAAiB,EAAE,IAAI;YACvB,iBAAiB,EAAE,IAAI;SACxB;KACF,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC;QACvC,0DAA0D;QAC1D,8DAA8D;QAC9D,MAAM,EAAE,KAAK;KACd,CAAC,CAAC;IAEH,uBACE,OAAO,IACJ,YAAY,EACf;AACJ,CAAC,CAAA,CAAC;AArBW,QAAA,aAAa,iBAqBxB"}
@@ -7,7 +7,6 @@ const di_1 = require("../../utils/di");
7
7
  const tokens_1 = require("../../di/tokens");
8
8
  const buildModule = (di) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
9
9
  (0, di_1.registerProviders)(di, [...shared_1.sharedProviders]);
10
- const configManager = di.get(tokens_1.CONFIG_MANAGER_TOKEN);
11
10
  const builderFactory = di.get(tokens_1.ABSTRACT_BUILDER_FACTORY_TOKEN);
12
11
  const builder = yield builderFactory.createBuilder('webpack', {
13
12
  options: {
@@ -16,7 +15,7 @@ const buildModule = (di) => tslib_1.__awaiter(void 0, void 0, void 0, function*
16
15
  },
17
16
  });
18
17
  const builderBuild = yield builder.build({
19
- modern: configManager.modern,
18
+ modern: false,
20
19
  });
21
20
  return Object.assign({ builder }, builderBuild);
22
21
  });
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/api/build/module.ts"],"names":[],"mappings":";;;;AAEA,+CAAqD;AACrD,uCAAmD;AACnD,4CAAuF;AAEhF,MAAM,WAAW,GAAG,CAAO,EAAa,EAAU,EAAE;IACzD,IAAA,sBAAiB,EAAC,EAAE,EAAE,CAAC,GAAG,wBAAe,CAAC,CAAC,CAAC;IAE5C,MAAM,aAAa,GAAG,EAAE,CAAC,GAAG,CAAC,6BAAoB,CAAC,CAAC;IAEnD,MAAM,cAAc,GAAG,EAAE,CAAC,GAAG,CAAC,uCAA8B,CAAC,CAAC;IAC9D,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,aAAa,CAAC,SAAS,EAAE;QAC5D,OAAO,EAAE;YACP,iBAAiB,EAAE,IAAI;YACvB,iBAAiB,EAAE,IAAI;SACxB;KACF,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC;QACvC,MAAM,EAAE,aAAa,CAAC,MAAM;KAC7B,CAAC,CAAC;IAEH,uBACE,OAAO,IACJ,YAAY,EACf;AACJ,CAAC,CAAA,CAAC;AArBW,QAAA,WAAW,eAqBtB"}
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/api/build/module.ts"],"names":[],"mappings":";;;;AAEA,+CAAqD;AACrD,uCAAmD;AACnD,4CAAiE;AAE1D,MAAM,WAAW,GAAG,CAAO,EAAa,EAAU,EAAE;IACzD,IAAA,sBAAiB,EAAC,EAAE,EAAE,CAAC,GAAG,wBAAe,CAAC,CAAC,CAAC;IAE5C,MAAM,cAAc,GAAG,EAAE,CAAC,GAAG,CAAC,uCAA8B,CAAC,CAAC;IAC9D,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,aAAa,CAAC,SAAS,EAAE;QAC5D,OAAO,EAAE;YACP,iBAAiB,EAAE,IAAI;YACvB,iBAAiB,EAAE,IAAI;SACxB;KACF,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC;QACvC,MAAM,EAAE,KAAK;KACd,CAAC,CAAC;IAEH,uBACE,OAAO,IACJ,YAAY,EACf;AACJ,CAAC,CAAA,CAAC;AAnBW,QAAA,WAAW,eAmBtB"}
@@ -7,7 +7,7 @@ exports.sharedProviders = [
7
7
  {
8
8
  provide: tokens_1.CONFIG_MANAGER_TOKEN,
9
9
  useFactory: ({ configEntry, parameters, }) => {
10
- return new configManager_1.ConfigManager(configEntry, Object.assign(Object.assign({}, parameters), { env: 'production', buildType: 'client' }));
10
+ return (0, configManager_1.createConfigManager)(configEntry, Object.assign(Object.assign({}, parameters), { env: 'production', buildType: 'client' }));
11
11
  },
12
12
  deps: {
13
13
  configEntry: tokens_1.CONFIG_ENTRY_TOKEN,
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../src/api/build/providers/shared.ts"],"names":[],"mappings":";;;AACA,+CAI4B;AAC5B,iEAA8D;AAIjD,QAAA,eAAe,GAAwB;IAClD;QACE,OAAO,EAAE,6BAAoB;QAC7B,UAAU,EAAE,CAAC,EACX,WAAW,EACX,UAAU,GAIX,EAAE,EAAE;YACH,OAAO,IAAI,6BAAa,CAAC,WAAW,kCAC/B,UAAU,KACb,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,QAAQ,IACnB,CAAC;QACL,CAAC;QACD,IAAI,EAAE;YACJ,WAAW,EAAE,2BAAkB;YAC/B,UAAU,EAAE,iCAAwB;SACrC;KACF;CACF,CAAC"}
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../src/api/build/providers/shared.ts"],"names":[],"mappings":";;;AACA,+CAI4B;AAC5B,iEAAoE;AAIvD,QAAA,eAAe,GAAwB;IAClD;QACE,OAAO,EAAE,6BAAoB;QAC7B,UAAU,EAAE,CAAC,EACX,WAAW,EACX,UAAU,GAIX,EAAE,EAAE;YACH,OAAO,IAAA,mCAAmB,EAAC,WAAW,kCACjC,UAAU,KACb,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,QAAQ,IACnB,CAAC;QACL,CAAC;QACD,IAAI,EAAE;YACJ,WAAW,EAAE,2BAAkB;YAC/B,UAAU,EAAE,iCAAwB;SACrC;KACF;CACF,CAAC"}
@@ -4,12 +4,16 @@ import type { BenchmarkCommand } from './benchmark';
4
4
  import type { AnalyzeCommand } from './analyze';
5
5
  import type { StartProdCommand } from './start-prod';
6
6
  export * from '../di/tokens';
7
- export { ConfigManager } from '../config/configManager';
7
+ export { ConfigManager, createConfigManager } from '../config/configManager';
8
+ export { CliConfigEntry } from '../typings/configEntry/cli';
9
+ export { ApplicationConfigEntry } from '../typings/configEntry/application';
10
+ export { ChildAppConfigEntry } from '../typings/configEntry/child-app';
11
+ export { ConvertToSchema } from '../schema/ConfigSchema';
8
12
  export { ConfigManager as ConfigManagerValidator } from '../models/config';
9
13
  export { getTramvaiConfig } from '../utils/getTramvaiConfig';
10
14
  export { syncJsonFile } from '../utils/syncJsonFile';
11
15
  export { babelConfigFactory } from '../library/babel';
12
- export { filesClientWebackRulesFactory } from '../library/webpack/blocks/filesClient';
16
+ export { filesClientWebpackRulesFactory } from '../library/webpack/blocks/filesClient';
13
17
  export { cssWebpackRulesFactory } from '../library/webpack/blocks/css';
14
18
  export { lessWebpackRulesFactory } from '../library/webpack/blocks/less';
15
19
  export { postcssAssetsWebpackRulesFactory } from '../library/webpack/blocks/postcssAssets';
package/lib/api/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.startProd = exports.analyze = exports.benchmark = exports.build = exports.start = exports.configToEnv = exports.extractCssPluginFactory = exports.postcssAssetsWebpackRulesFactory = exports.lessWebpackRulesFactory = exports.cssWebpackRulesFactory = exports.filesClientWebackRulesFactory = exports.babelConfigFactory = exports.syncJsonFile = exports.getTramvaiConfig = exports.ConfigManagerValidator = exports.ConfigManager = void 0;
3
+ exports.startProd = exports.analyze = exports.benchmark = exports.build = exports.start = exports.configToEnv = exports.extractCssPluginFactory = exports.postcssAssetsWebpackRulesFactory = exports.lessWebpackRulesFactory = exports.cssWebpackRulesFactory = exports.filesClientWebpackRulesFactory = exports.babelConfigFactory = exports.syncJsonFile = exports.getTramvaiConfig = exports.ConfigManagerValidator = exports.createConfigManager = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const noop_stream_1 = require("noop-stream");
6
6
  const tokens_1 = require("../di/tokens");
7
7
  const createApp_1 = require("../commands/createApp");
8
8
  tslib_1.__exportStar(require("../di/tokens"), exports);
9
9
  var configManager_1 = require("../config/configManager");
10
- Object.defineProperty(exports, "ConfigManager", { enumerable: true, get: function () { return configManager_1.ConfigManager; } });
10
+ Object.defineProperty(exports, "createConfigManager", { enumerable: true, get: function () { return configManager_1.createConfigManager; } });
11
11
  var config_1 = require("../models/config");
12
12
  Object.defineProperty(exports, "ConfigManagerValidator", { enumerable: true, get: function () { return config_1.ConfigManager; } });
13
13
  var getTramvaiConfig_1 = require("../utils/getTramvaiConfig");
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "syncJsonFile", { enumerable: true, get: function
17
17
  var babel_1 = require("../library/babel");
18
18
  Object.defineProperty(exports, "babelConfigFactory", { enumerable: true, get: function () { return babel_1.babelConfigFactory; } });
19
19
  var filesClient_1 = require("../library/webpack/blocks/filesClient");
20
- Object.defineProperty(exports, "filesClientWebackRulesFactory", { enumerable: true, get: function () { return filesClient_1.filesClientWebackRulesFactory; } });
20
+ Object.defineProperty(exports, "filesClientWebpackRulesFactory", { enumerable: true, get: function () { return filesClient_1.filesClientWebpackRulesFactory; } });
21
21
  var css_1 = require("../library/webpack/blocks/css");
22
22
  Object.defineProperty(exports, "cssWebpackRulesFactory", { enumerable: true, get: function () { return css_1.cssWebpackRulesFactory; } });
23
23
  var less_1 = require("../library/webpack/blocks/less");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;AAAA,6CAAiD;AACjD,yCAKsB;AACtB,qDAAkD;AAQlD,uDAA6B;AAC7B,yDAAwD;AAA/C,8GAAA,aAAa,OAAA;AACtB,2CAA2E;AAAlE,gHAAA,aAAa,OAA0B;AAChD,8DAA6D;AAApD,oHAAA,gBAAgB,OAAA;AACzB,sDAAqD;AAA5C,4GAAA,YAAY,OAAA;AACrB,0CAAsD;AAA7C,2GAAA,kBAAkB,OAAA;AAC3B,qEAAsF;AAA7E,4HAAA,6BAA6B,OAAA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AAEI,MAAM,KAAK,GAAiB,CAAC,UAAU,EAAE,SAAS,GAAG,EAAE,EAAE,EAAE;IAChE,OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AACjD,CAAC,CAAC;AAFW,QAAA,KAAK,SAEhB;AAEK,MAAM,KAAK,GAAiB,CAAC,UAAU,EAAE,SAAS,GAAG,EAAE,EAAE,EAAE;IAChE,OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AACjD,CAAC,CAAC;AAFW,QAAA,KAAK,SAEhB;AAEK,MAAM,SAAS,GAAqB,CAAC,UAAU,EAAE,SAAS,GAAG,EAAE,EAAE,EAAE;IACxE,OAAO,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AACrD,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB;AAEK,MAAM,OAAO,GAAmB,CAAC,UAAU,EAAE,SAAS,GAAG,EAAE,EAAE,EAAE;IACpE,OAAO,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AACnD,CAAC,CAAC;AAFW,QAAA,OAAO,WAElB;AAEK,MAAM,SAAS,GAAqB,CAAC,UAAU,EAAE,SAAS,GAAG,EAAE,EAAE,EAAE;IACxE,OAAO,GAAG,CAAC,GAAG,CAAC,YAAY,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AACtD,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB"}
@@ -1,10 +1,11 @@
1
+ import type { WithRootDir } from './withRootDir';
1
2
  import type { ApplicationConfigEntry } from '../../../typings/configEntry/application';
2
3
  import type { ModuleConfigEntry } from '../../../typings/configEntry/module';
3
- import type { WithRootDir } from './withRootDir';
4
4
  import type { PackageConfigEntry } from '../../../typings/configEntry/package';
5
5
  import type { ChildAppConfigEntry } from '../../../typings/configEntry/child-app';
6
+ import type { ConvertToSchema } from '../../../schema/ConfigSchema';
6
7
  export type WithConfig<T> = WithRootDir<T> & ({
7
8
  target: string;
8
9
  } | {
9
- config: ApplicationConfigEntry | ModuleConfigEntry | PackageConfigEntry | ChildAppConfigEntry;
10
+ config: ConvertToSchema<ApplicationConfigEntry | ModuleConfigEntry | PackageConfigEntry | ChildAppConfigEntry>;
10
11
  });
@@ -2,41 +2,34 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.serverProviders = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const dippy_1 = require("@tinkoff/dippy");
5
6
  const tokens_1 = require("../../tokens");
6
7
  const tokens_2 = require("../../../../di/tokens");
7
8
  const stopServer_1 = require("../../utils/stopServer");
8
9
  const createServer_1 = require("../../utils/createServer");
9
10
  const listenServer_1 = require("../../utils/listenServer");
10
11
  exports.serverProviders = [
11
- {
12
+ (0, dippy_1.provide)({
12
13
  provide: tokens_2.SERVER_TOKEN,
13
14
  useFactory: createServer_1.createServer,
14
- },
15
- {
15
+ }),
16
+ (0, dippy_1.provide)({
16
17
  provide: tokens_1.INIT_HANDLER_TOKEN,
17
18
  multi: true,
18
- useFactory: ({ server, parameters }) => {
19
+ useFactory: ({ server, configManager }) => {
19
20
  return function staticServerListen() {
20
21
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
21
- const { host = '0.0.0.0', port = 3000 } = parameters;
22
- try {
23
- yield (0, listenServer_1.listenServer)(server, host, port);
24
- }
25
- catch (error) {
26
- if (error.code === 'EADDRINUSE') {
27
- throw new Error(`Address '${host}:${port}' in use, either release this port or use options --port --host`);
28
- }
29
- throw error;
30
- }
22
+ const { host, port } = configManager;
23
+ yield (0, listenServer_1.listenServer)(server, host, port);
31
24
  });
32
25
  };
33
26
  },
34
27
  deps: {
35
28
  server: tokens_2.SERVER_TOKEN,
36
- parameters: tokens_2.COMMAND_PARAMETERS_TOKEN,
29
+ configManager: tokens_2.CONFIG_MANAGER_TOKEN,
37
30
  },
38
- },
39
- {
31
+ }),
32
+ (0, dippy_1.provide)({
40
33
  provide: tokens_1.CLOSE_HANDLER_TOKEN,
41
34
  multi: true,
42
35
  useFactory: ({ server }) => {
@@ -47,6 +40,6 @@ exports.serverProviders = [
47
40
  deps: {
48
41
  server: tokens_2.SERVER_TOKEN,
49
42
  },
50
- },
43
+ }),
51
44
  ];
52
45
  //# sourceMappingURL=server.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../../../src/api/start/providers/application/server.ts"],"names":[],"mappings":";;;;AACA,yCAAuE;AACvE,kDAA+E;AAC/E,uDAAoD;AACpD,2DAAwD;AACxD,2DAAwD;AAG3C,QAAA,eAAe,GAAwB;IAClD;QACE,OAAO,EAAE,qBAAY;QACrB,UAAU,EAAE,2BAAY;KACzB;IACD;QACE,OAAO,EAAE,2BAAkB;QAC3B,KAAK,EAAE,IAAI;QACX,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,UAAU,EAAuD,EAAE,EAAE;YAC1F,OAAO,SAAe,kBAAkB;;oBACtC,MAAM,EAAE,IAAI,GAAG,SAAS,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,UAAU,CAAC;oBAErD,IAAI;wBACF,MAAM,IAAA,2BAAY,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;qBACxC;oBAAC,OAAO,KAAK,EAAE;wBACd,IAAK,KAAa,CAAC,IAAI,KAAK,YAAY,EAAE;4BACxC,MAAM,IAAI,KAAK,CACb,YAAY,IAAI,IAAI,IAAI,iEAAiE,CAC1F,CAAC;yBACH;wBAED,MAAM,KAAK,CAAC;qBACb;gBACH,CAAC;aAAA,CAAC;QACJ,CAAC;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,qBAAY;YACpB,UAAU,EAAE,iCAAwB;SACrC;KACF;IACD;QACE,OAAO,EAAE,4BAAmB;QAC5B,KAAK,EAAE,IAAI;QACX,UAAU,EAAE,CAAC,EAAE,MAAM,EAAmC,EAAE,EAAE;YAC1D,OAAO,GAAG,EAAE;gBACV,OAAO,IAAA,uBAAU,EAAC,MAAM,CAAC,CAAC;YAC5B,CAAC,CAAC;QACJ,CAAC;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,qBAAY;SACrB;KACF;CACO,CAAC"}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../../../src/api/start/providers/application/server.ts"],"names":[],"mappings":";;;;AACA,0CAAyC;AAEzC,yCAAuE;AACvE,kDAA2E;AAC3E,uDAAoD;AACpD,2DAAwD;AACxD,2DAAwD;AAE3C,QAAA,eAAe,GAAwB;IAClD,IAAA,eAAO,EAAC;QACN,OAAO,EAAE,qBAAY;QACrB,UAAU,EAAE,2BAAY;KACzB,CAAC;IACF,IAAA,eAAO,EAAC;QACN,OAAO,EAAE,2BAAkB;QAC3B,KAAK,EAAE,IAAI;QACX,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,EAAE;YACxC,OAAO,SAAe,kBAAkB;;oBACtC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,aAAa,CAAC;oBAErC,MAAM,IAAA,2BAAY,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;gBACzC,CAAC;aAAA,CAAC;QACJ,CAAC;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,qBAAY;YACpB,aAAa,EAAE,6BAAoB;SACpC;KACF,CAAC;IACF,IAAA,eAAO,EAAC;QACN,OAAO,EAAE,4BAAmB;QAC5B,KAAK,EAAE,IAAI;QACX,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;YACzB,OAAO,GAAG,EAAE;gBACV,OAAO,IAAA,uBAAU,EAAC,MAAM,CAAC,CAAC;YAC5B,CAAC,CAAC;QACJ,CAAC;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,qBAAY;SACrB;KACF,CAAC;CACM,CAAC"}
@@ -2,55 +2,47 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sharedProviders = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const dippy_1 = require("@tinkoff/dippy");
5
6
  const tokens_1 = require("../../tokens");
6
7
  const tokens_2 = require("../../../../di/tokens");
7
8
  const stopServer_1 = require("../../utils/stopServer");
8
9
  const configManager_1 = require("../../../../config/configManager");
9
10
  const createServer_1 = require("../../utils/createServer");
10
11
  const listenServer_1 = require("../../utils/listenServer");
11
- const getListeningPort_1 = require("../../utils/getListeningPort");
12
+ const detectPortSync_1 = require("../../../../utils/detectPortSync");
12
13
  exports.sharedProviders = [
13
- {
14
+ (0, dippy_1.provide)({
14
15
  provide: tokens_2.CONFIG_MANAGER_TOKEN,
15
- useFactory: ({ configEntry, parameters, server, staticServer, }) => {
16
- return new configManager_1.ConfigManager(configEntry, Object.assign(Object.assign({}, parameters), { env: 'development', buildType: 'client', port: server ? (0, getListeningPort_1.getListeningPort)(server) : parameters.port, staticPort: (0, getListeningPort_1.getListeningPort)(staticServer) }));
16
+ useFactory: ({ configEntry, parameters }) => {
17
+ var _a, _b;
18
+ return (0, configManager_1.createConfigManager)(configEntry, Object.assign(Object.assign({}, parameters), { env: 'development', port: (0, detectPortSync_1.detectPortSync)((_a = parameters.port) !== null && _a !== void 0 ? _a : configManager_1.DEFAULT_PORT), staticPort: (0, detectPortSync_1.detectPortSync)((_b = parameters.staticPort) !== null && _b !== void 0 ? _b : configManager_1.DEFAULT_STATIC_PORT) }));
17
19
  },
18
20
  deps: {
19
21
  configEntry: tokens_2.CONFIG_ENTRY_TOKEN,
20
22
  parameters: tokens_2.COMMAND_PARAMETERS_TOKEN,
21
- staticServer: tokens_2.STATIC_SERVER_TOKEN,
22
- server: { token: tokens_2.SERVER_TOKEN, optional: true },
23
23
  },
24
- },
25
- {
24
+ }),
25
+ (0, dippy_1.provide)({
26
26
  provide: tokens_2.STATIC_SERVER_TOKEN,
27
27
  useFactory: createServer_1.createServer,
28
- },
29
- {
28
+ }),
29
+ (0, dippy_1.provide)({
30
30
  provide: tokens_1.INIT_HANDLER_TOKEN,
31
31
  multi: true,
32
- useFactory: ({ staticServer, parameters, }) => {
32
+ useFactory: ({ configManager, staticServer }) => {
33
33
  return function staticServerListen() {
34
34
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
35
- const { staticHost = 'localhost', staticPort = 4000 } = parameters;
36
- try {
37
- yield (0, listenServer_1.listenServer)(staticServer, staticHost.replace('localhost', '0.0.0.0'), staticPort);
38
- }
39
- catch (error) {
40
- if (error.code === 'EADDRINUSE') {
41
- throw new Error(`Address '${staticHost}:${staticPort}' in use, either release this port or use options --staticPort --staticHost`);
42
- }
43
- throw error;
44
- }
35
+ const { staticHost, staticPort } = configManager;
36
+ yield (0, listenServer_1.listenServer)(staticServer, staticHost.replace('localhost', '0.0.0.0'), staticPort);
45
37
  });
46
38
  };
47
39
  },
48
40
  deps: {
49
41
  staticServer: tokens_2.STATIC_SERVER_TOKEN,
50
- parameters: tokens_2.COMMAND_PARAMETERS_TOKEN,
42
+ configManager: tokens_2.CONFIG_MANAGER_TOKEN,
51
43
  },
52
- },
53
- {
44
+ }),
45
+ (0, dippy_1.provide)({
54
46
  provide: tokens_1.CLOSE_HANDLER_TOKEN,
55
47
  multi: true,
56
48
  useFactory: ({ staticServer }) => {
@@ -61,6 +53,6 @@ exports.sharedProviders = [
61
53
  deps: {
62
54
  staticServer: tokens_2.STATIC_SERVER_TOKEN,
63
55
  },
64
- },
56
+ }),
65
57
  ];
66
58
  //# sourceMappingURL=shared.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../../src/api/start/providers/application/shared.ts"],"names":[],"mappings":";;;;AACA,yCAAuE;AACvE,kDAM+B;AAC/B,uDAAoD;AAGpD,oEAAiE;AACjE,2DAAwD;AACxD,2DAAwD;AACxD,mEAAgE;AAEnD,QAAA,eAAe,GAAwB;IAClD;QACE,OAAO,EAAE,6BAAoB;QAC7B,UAAU,EAAE,CAAC,EACX,WAAW,EACX,UA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SACrC;KACF;IACD;QACE,OAAO,EAAE,4BAAmB;QAC5B,KAAK,EAAE,IAAI;QACX,UAAU,EAAE,CAAC,EAAE,YAAY,EAAgD,EAAE,EAAE;YAC7E,OAAO,GAAG,EAAE;gBACV,OAAO,IAAA,uBAAU,EAAC,YAAY,CAAC,CAAC;YAClC,CAAC,CAAC;QACJ,CAAC;QACD,IAAI,EAAE;YACJ,YAAY,EAAE,4BAAmB;SAClC;KACF;CACO,CAAC"}
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../../src/api/start/providers/application/shared.ts"],"names":[],"mappings":";;;;AACA,0CAAyC;AAEzC,yCAAuE;AACvE,kDAK+B;AAC/B,uDAAoD;AAEpD,oEAI0C;AAC1C,2DAAwD;AACxD,2DAAwD;AACxD,qEAAkE;AAErD,QAAA,eAAe,GAAwB;IAClD,IAAA,eAAO,EAAC;QACN,OAAO,EAAE,6BAAoB;QAC7B,UAAU,EAAE,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,EAAE;;YAC1C,OAAA,IAAA,mCAAmB,EAAC,WAAqC,kCACpD,UAAU,KACb,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,IAAA,+BAAc,EAAC,MAAA,UAAU,CAAC,IAAI,mCAAI,4BAAY,CAAC,EACrD,UAAU,EAAE,IAAA,+BAAc,EAAC,MAAA,UAAU,CAAC,UAAU,mCAAI,mCAAmB,CAAC,IACxE,CAAA;SAAA;QACJ,IAAI,EAAE;YACJ,WAAW,EAAE,2BAAkB;YAC/B,UAAU,EAAE,iCAAwB;SACrC;KACF,CAAC;IACF,IAAA,eAAO,EAAC;QACN,OAAO,EAAE,4BAAmB;QAC5B,UAAU,EAAE,2BAAY;KACzB,CAAC;IACF,IAAA,eAAO,EAAC;QACN,OAAO,EAAE,2BAAkB;QAC3B,KAAK,EAAE,IAAI;QACX,UAAU,EAAE,CAAC,EAAE,aAAa,EAAE,YAAY,EAAE,EAAE,EAAE;YAC9C,OAAO,SAAe,kBAAkB;;oBACtC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,aAAa,CAAC;oBAEjD,MAAM,IAAA,2BAAY,EAAC,YAAY,EAAE,UAAU,CAAC,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,UAAU,CAAC,CAAC;gBAC3F,CAAC;aAAA,CAAC;QACJ,CAAC;QACD,IAAI,EAAE;YACJ,YAAY,EAAE,4BAAmB;YACjC,aAAa,EAAE,6BAAoB;SACpC;KACF,CAAC;IACF,IAAA,eAAO,EAAC;QACN,OAAO,EAAE,4BAAmB;QAC5B,KAAK,EAAE,IAAI;QACX,UAAU,EAAE,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;YAC/B,OAAO,GAAG,EAAE;gBACV,OAAO,IAAA,uBAAU,EAAC,YAAY,CAAC,CAAC;YAClC,CAAC,CAAC;QACJ,CAAC;QACD,IAAI,EAAE;YACJ,YAAY,EAAE,4BAAmB;SAClC;KACF,CAAC;CACM,CAAC"}
@@ -2,54 +2,48 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sharedProviders = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const dippy_1 = require("@tinkoff/dippy");
5
6
  const tokens_1 = require("../../tokens");
6
7
  const tokens_2 = require("../../../../di/tokens");
7
- const configManager_1 = require("../../../../config/configManager");
8
8
  const workersPool_1 = require("../../../../library/webpack/utils/workersPool");
9
9
  const stopServer_1 = require("../../utils/stopServer");
10
10
  const createServer_1 = require("../../utils/createServer");
11
11
  const listenServer_1 = require("../../utils/listenServer");
12
+ const configManager_1 = require("../../../../config/configManager");
13
+ const detectPortSync_1 = require("../../../../utils/detectPortSync");
12
14
  exports.sharedProviders = [
13
- {
15
+ (0, dippy_1.provide)({
14
16
  provide: tokens_2.CONFIG_MANAGER_TOKEN,
15
- useFactory: ({ configEntry, parameters, }) => {
17
+ useFactory: ({ configEntry, parameters }) => {
16
18
  var _a;
17
- return new configManager_1.ConfigManager(configEntry, Object.assign(Object.assign({}, parameters), { env: 'development', port: (_a = parameters.port) !== null && _a !== void 0 ? _a : 4040, buildType: 'client' }));
19
+ return (0, configManager_1.createConfigManager)(configEntry, Object.assign(Object.assign({}, parameters), { env: 'development', port: (0, detectPortSync_1.detectPortSync)((_a = parameters.port) !== null && _a !== void 0 ? _a : configManager_1.DEFAULT_STATIC_MODULE_PORT) }));
18
20
  },
19
21
  deps: {
20
22
  configEntry: tokens_2.CONFIG_ENTRY_TOKEN,
21
23
  parameters: tokens_2.COMMAND_PARAMETERS_TOKEN,
22
24
  },
23
- },
24
- {
25
+ }),
26
+ (0, dippy_1.provide)({
25
27
  provide: tokens_2.STATIC_SERVER_TOKEN,
26
28
  useFactory: createServer_1.createServer,
27
- },
28
- {
29
+ }),
30
+ (0, dippy_1.provide)({
29
31
  provide: tokens_1.INIT_HANDLER_TOKEN,
30
32
  multi: true,
31
- useFactory: ({ staticServer, parameters, }) => {
33
+ useFactory: ({ staticServer, configManager }) => {
32
34
  return function staticServerListen() {
33
35
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
34
- const { host = 'localhost', port = 4040 } = parameters;
35
- try {
36
- yield (0, listenServer_1.listenServer)(staticServer, host, port);
37
- }
38
- catch (error) {
39
- if (error.code === 'EADDRINUSE') {
40
- throw new Error(`Address '${host}:${port}' in use, either release this port or use options --port --host`);
41
- }
42
- throw error;
43
- }
36
+ const { host, port } = configManager;
37
+ yield (0, listenServer_1.listenServer)(staticServer, host, port);
44
38
  });
45
39
  };
46
40
  },
47
41
  deps: {
48
42
  staticServer: tokens_2.STATIC_SERVER_TOKEN,
49
- parameters: tokens_2.COMMAND_PARAMETERS_TOKEN,
43
+ configManager: tokens_2.CONFIG_MANAGER_TOKEN,
50
44
  },
51
- },
52
- {
45
+ }),
46
+ (0, dippy_1.provide)({
53
47
  provide: tokens_1.CLOSE_HANDLER_TOKEN,
54
48
  multi: true,
55
49
  useFactory: ({ staticServer }) => {
@@ -60,8 +54,8 @@ exports.sharedProviders = [
60
54
  deps: {
61
55
  staticServer: tokens_2.STATIC_SERVER_TOKEN,
62
56
  },
63
- },
64
- {
57
+ }),
58
+ (0, dippy_1.provide)({
65
59
  provide: tokens_1.CLOSE_HANDLER_TOKEN,
66
60
  multi: true,
67
61
  useFactory: ({ configManager }) => {
@@ -72,6 +66,6 @@ exports.sharedProviders = [
72
66
  deps: {
73
67
  configManager: tokens_2.CONFIG_MANAGER_TOKEN,
74
68
  },
75
- },
69
+ }),
76
70
  ];
77
71
  //# sourceMappingURL=shared.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../../src/api/start/providers/child-app/shared.ts"],"names":[],"mappings":";;;;AACA,yCAAuE;AACvE,kDAK+B;AAG/B,oEAAiE;AACjE,+EAA0F;AAC1F,uDAAoD;AACpD,2DAAwD;AACxD,2DAAwD;AAE3C,QAAA,eAAe,GAAwB;IAClD;QACE,OAAO,EAAE,6BAAoB;QAC7B,UAAU,EAAE,CAAC,EACX,WAAW,EACX,UAAU,GAIX,EAAE,EAAE;;YACH,OAAO,IAAI,6BAAa,CAAC,WAAW,kCAC/B,UAAU,KACb,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,MAAA,UAAU,CAAC,IAAI,mCAAI,IAAI,EAC7B,SAAS,EAAE,QAAQ,IACnB,CAAC;QACL,CAAC;QACD,IAAI,EAAE;YACJ,WAAW,EAAE,2BAAkB;YAC/B,UAAU,EAAE,iCAAwB;SACrC;KACF;IACD;QACE,OAAO,EAAE,4BAAmB;QAC5B,UAAU,EAAE,2BAAY;KACzB;IACD;QACE,OAAO,EAAE,2BAAkB;QAC3B,KAAK,EAAE,IAAI;QACX,UAAU,EAAE,CAAC,EACX,YAAY,EACZ,UAAU,GAIX,EAAE,EAAE;YACH,OAAO,SAAe,kBAAkB;;oBACtC,MAAM,EAAE,IAAI,GAAG,WAAW,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,UAAU,CAAC;oBAEvD,IAAI;wBACF,MAAM,IAAA,2BAAY,EAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;qBAC9C;oBAAC,OAAO,KAAK,EAAE;wBACd,IAAK,KAAa,CAAC,IAAI,KAAK,YAAY,EAAE;4BACxC,MAAM,IAAI,KAAK,CACb,YAAY,IAAI,IAAI,IAAI,iEAAiE,CAC1F,CAAC;yBACH;wBAED,MAAM,KAAK,CAAC;qBACb;gBACH,CAAC;aAAA,CAAC;QACJ,CAAC;QACD,IAAI,EAAE;YACJ,YAAY,EAAE,4BAAmB;YACjC,UAAU,EAAE,iCAAwB;SACrC;KACF;IACD;QACE,OAAO,EAAE,4BAAmB;QAC5B,KAAK,EAAE,IAAI;QACX,UAAU,EAAE,CAAC,EAAE,YAAY,EAAgD,EAAE,EAAE;YAC7E,OAAO,GAAG,EAAE;gBACV,OAAO,IAAA,uBAAU,EAAC,YAAY,CAAC,CAAC;YAClC,CAAC,CAAC;QACJ,CAAC;QACD,IAAI,EAAE;YACJ,YAAY,EAAE,4BAAmB;SAClC;KACF;IACD;QACE,OAAO,EAAE,4BAAmB;QAC5B,KAAK,EAAE,IAAI;QACX,UAAU,EAAE,CAAC,EAAE,aAAa,EAAkD,EAAE,EAAE;YAChF,OAAO,GAAS,EAAE;gBAChB,MAAM,IAAA,uCAAyB,EAAC,aAAa,CAAC,CAAC;YACjD,CAAC,CAAA,CAAC;QACJ,CAAC;QACD,IAAI,EAAE;YACJ,aAAa,EAAE,6BAAoB;SACpC;KACF;CACO,CAAC"}
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../../src/api/start/providers/child-app/shared.ts"],"names":[],"mappings":";;;;AACA,0CAAyC;AACzC,yCAAuE;AACvE,kDAK+B;AAE/B,+EAA0F;AAC1F,uDAAoD;AACpD,2DAAwD;AACxD,2DAAwD;AACxD,oEAAmG;AACnG,qEAAkE;AAErD,QAAA,eAAe,GAAwB;IAClD,IAAA,eAAO,EAAC;QACN,OAAO,EAAE,6BAAoB;QAC7B,U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