@tramvai/cli 2.75.0 → 2.77.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 (53) hide show
  1. package/lib/builder/webpack/tokens.d.ts +21 -0
  2. package/lib/config/configManager.js +2 -1
  3. package/lib/config/configManager.js.map +1 -1
  4. package/lib/di/tokens/config.d.ts +7 -0
  5. package/lib/library/webpack/blocks/css.js +9 -2
  6. package/lib/library/webpack/blocks/css.js.map +1 -1
  7. package/lib/library/webpack/child-app/client/common.js +3 -17
  8. package/lib/library/webpack/child-app/client/common.js.map +1 -1
  9. package/lib/library/webpack/child-app/common.js +29 -11
  10. package/lib/library/webpack/child-app/common.js.map +1 -1
  11. package/lib/library/webpack/child-app/moduleFederationShared.d.ts +2 -1
  12. package/lib/library/webpack/child-app/moduleFederationShared.js +37 -11
  13. package/lib/library/webpack/child-app/moduleFederationShared.js.map +1 -1
  14. package/lib/library/webpack/child-app/server/common.js +11 -8
  15. package/lib/library/webpack/child-app/server/common.js.map +1 -1
  16. package/lib/library/webpack/common/main.js +3 -0
  17. package/lib/library/webpack/common/main.js.map +1 -1
  18. package/lib/library/webpack/loaders/childAppFallback.d.ts +6 -0
  19. package/lib/library/webpack/loaders/childAppFallback.js +26 -0
  20. package/lib/library/webpack/loaders/childAppFallback.js.map +1 -0
  21. package/lib/library/webpack/types/webpack.d.ts +2 -0
  22. package/lib/schema/autogeneratedSchema.json +262 -230
  23. package/lib/typings/configEntry/application.d.ts +1 -1
  24. package/lib/typings/configEntry/cli.d.ts +30 -0
  25. package/package.json +12 -11
  26. package/schema.json +262 -230
  27. package/src/api/build/__integration__/build.test.ts +0 -4
  28. package/src/config/configManager.ts +2 -1
  29. package/src/library/babel/plugins/__snapshots__/provider-stack.spec.ts.snap +2 -9
  30. package/src/library/babel/plugins/lazy-component/__snapshots__/lazy-component.spec.ts.snap +6 -70
  31. package/src/library/babel/plugins/lazy-component/__snapshots__/legacy-universal-replace.spec.ts.snap +2 -25
  32. package/src/library/swc/__integration__/__snapshots__/swc.build.test.ts.snap +2 -5
  33. package/src/library/swc/__integration__/__snapshots__/swc.start.test.ts.snap +31 -33
  34. package/src/library/webpack/application/client/dev.ts +1 -1
  35. package/src/library/webpack/application/client/prod.ts +1 -1
  36. package/src/library/webpack/blocks/css.ts +9 -2
  37. package/src/library/webpack/child-app/client/common.ts +3 -22
  38. package/src/library/webpack/child-app/common.ts +36 -14
  39. package/src/library/webpack/child-app/moduleFederationShared.ts +44 -2
  40. package/src/library/webpack/child-app/server/common.ts +13 -12
  41. package/src/library/webpack/common/main.ts +7 -0
  42. package/src/library/webpack/loaders/childAppFallback.ts +31 -0
  43. package/src/library/webpack/types/webpack.ts +5 -0
  44. package/src/models/config.spec.ts +12 -0
  45. package/src/schema/autogeneratedSchema.json +262 -230
  46. package/src/schema/tramvai.spec.ts +6 -0
  47. package/src/typings/configEntry/application.ts +1 -1
  48. package/src/typings/configEntry/cli.ts +33 -0
  49. package/src/typings/webpack-chain/index.d.ts +1 -1
  50. package/lib/library/webpack/plugins/LazyLibraryInitialization.d.ts +0 -20
  51. package/lib/library/webpack/plugins/LazyLibraryInitialization.js +0 -58
  52. package/lib/library/webpack/plugins/LazyLibraryInitialization.js.map +0 -1
  53. package/src/library/webpack/plugins/LazyLibraryInitialization.ts +0 -70
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/cli",
3
- "version": "2.75.0",
3
+ "version": "2.77.0",
4
4
  "description": "Cli инструмент для сборки и запуска приложений",
5
5
  "files": [
6
6
  "src",
@@ -56,9 +56,10 @@
56
56
  "@discoveryjs/json-ext": "^0.5.7",
57
57
  "@fastify/compress": "^6.1.1",
58
58
  "@fastify/static": "^6.5.0",
59
- "@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
59
+ "@module-federation/node": "^0.11.1",
60
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
60
61
  "@sentry/node": "^6.2.5",
61
- "@svgr/webpack": "^6.4.0",
62
+ "@svgr/webpack": "^6.5.1",
62
63
  "@tinkoff/browserslist-config": "0.2.4",
63
64
  "@tinkoff/dippy": "0.8.13",
64
65
  "@tinkoff/is-modern-lib": "2.0.6",
@@ -70,7 +71,7 @@
70
71
  "@tinkoff/utils": "^2.1.3",
71
72
  "@tinkoff/webpack-dedupe-plugin": "1.0.3",
72
73
  "@tramvai/build": "3.1.2",
73
- "@tramvai/react": "2.75.0",
74
+ "@tramvai/react": "2.77.0",
74
75
  "@tramvai/tools-check-versions": "0.4.9",
75
76
  "@tramvai/tools-migrate": "0.6.12",
76
77
  "ajv": "^6.12.6",
@@ -91,7 +92,7 @@
91
92
  "compression": "^1.7.4",
92
93
  "css-class-generator": "^2.0.0",
93
94
  "css-loader": "^6.7.1",
94
- "css-minimizer-webpack-plugin": "^4.0.0",
95
+ "css-minimizer-webpack-plugin": "^4.2.2",
95
96
  "csso-webpack-plugin": "2.0.0-beta.3",
96
97
  "death": "^1.1.0",
97
98
  "detect-port": "^1.5.1",
@@ -101,7 +102,7 @@
101
102
  "fastify": "^4.6.0",
102
103
  "figures": "^3.2.0",
103
104
  "find-cache-dir": "^3.3.2",
104
- "fork-ts-checker-webpack-plugin": "^6.5.2",
105
+ "fork-ts-checker-webpack-plugin": "^7.3.0",
105
106
  "fs-extra": "^9.1.0",
106
107
  "file-loader": "^6.2.0",
107
108
  "fs-readdir-recursive": "^1.1.0",
@@ -146,7 +147,7 @@
146
147
  "stoppable": "^1.1.0",
147
148
  "svgo": "^1.3.2",
148
149
  "svgo-loader": "^2.2.2",
149
- "terser-webpack-plugin": "^5.3.5",
150
+ "terser-webpack-plugin": "^5.3.6",
150
151
  "text-table": "^0.2.0",
151
152
  "thread-loader": "^3.0.4",
152
153
  "tsconfig-paths-webpack-plugin": "^4.0.0",
@@ -157,11 +158,11 @@
157
158
  "wait-on": "^5.3.0",
158
159
  "webpack": "5.75.0",
159
160
  "webpack-build-notifier": "^2.3.0",
160
- "webpack-bundle-analyzer": "^4.6.1",
161
+ "webpack-bundle-analyzer": "^4.7.0",
161
162
  "webpack-chain": "^6.5.1",
162
- "webpack-dev-middleware": "^5.3.3",
163
- "webpack-hot-middleware": "^2.25.2",
164
- "webpack-stats-plugin": "^1.1.0",
163
+ "webpack-dev-middleware": "^6.0.1",
164
+ "webpack-hot-middleware": "^2.25.3",
165
+ "webpack-stats-plugin": "^1.1.1",
165
166
  "webpackbar": "^5.0.2",
166
167
  "wrap-ansi": "^7.0.0"
167
168
  },
package/schema.json CHANGED
@@ -171,177 +171,120 @@
171
171
  "type": "boolean"
172
172
  },
173
173
  "typescript": {
174
- "anyOf": [
175
- {
174
+ "type": "object",
175
+ "properties": {
176
+ "memoryLimit": {
177
+ "type": "number"
178
+ },
179
+ "configFile": {
180
+ "type": "string"
181
+ },
182
+ "configOverwrite": {
176
183
  "type": "object",
177
184
  "properties": {
178
- "enabled": {
179
- "type": "boolean"
180
- },
181
- "memoryLimit": {
182
- "type": "number"
183
- },
184
- "configFile": {
185
- "type": "string"
186
- },
187
- "configOverwrite": {
188
- "type": "object",
189
- "properties": {
190
- "extends": {
191
- "type": "string"
192
- },
193
- "compilerOptions": {
194
- "type": "object",
195
- "properties": {},
196
- "additionalProperties": true
197
- },
198
- "include": {
199
- "type": "array",
200
- "items": {
201
- "type": "string"
202
- }
203
- },
204
- "exclude": {
205
- "type": "array",
206
- "items": {
207
- "type": "string"
208
- }
209
- },
210
- "files": {
211
- "type": "array",
212
- "items": {
213
- "type": "string"
214
- }
215
- },
216
- "references": {
217
- "type": "array",
218
- "items": {
219
- "type": "object",
220
- "properties": {
221
- "path": {
222
- "type": "string"
223
- },
224
- "prepend": {
225
- "type": "boolean"
226
- }
227
- },
228
- "additionalProperties": false
229
- }
230
- }
231
- },
232
- "additionalProperties": false
233
- },
234
- "context": {
235
- "type": "string"
236
- },
237
- "build": {
238
- "type": "boolean"
239
- },
240
- "mode": {
241
- "enum": [
242
- "readonly",
243
- "write-dts",
244
- "write-references",
245
- "write-tsbuildinfo"
246
- ],
185
+ "extends": {
247
186
  "type": "string"
248
187
  },
249
- "diagnosticOptions": {
250
- "type": "object",
251
- "properties": {
252
- "syntactic": {
253
- "type": "boolean"
254
- },
255
- "semantic": {
256
- "type": "boolean"
257
- },
258
- "declaration": {
259
- "type": "boolean"
260
- },
261
- "global": {
262
- "type": "boolean"
263
- }
264
- },
265
- "additionalProperties": false
266
- },
267
- "extensions": {
268
- "type": "object",
269
- "properties": {
270
- "vue": {
271
- "anyOf": [
272
- {
273
- "type": "object",
274
- "properties": {
275
- "enabled": {
276
- "type": "boolean"
277
- },
278
- "compiler": {
279
- "type": "string"
280
- }
281
- },
282
- "additionalProperties": false
283
- },
284
- {
285
- "type": "boolean"
286
- }
287
- ]
288
- }
289
- },
290
- "additionalProperties": false
188
+ "compilerOptions": {},
189
+ "include": {
190
+ "type": "array",
191
+ "items": {
192
+ "type": "string"
193
+ }
291
194
  },
292
- "profile": {
293
- "type": "boolean"
195
+ "exclude": {
196
+ "type": "array",
197
+ "items": {
198
+ "type": "string"
199
+ }
294
200
  },
295
- "typescriptPath": {
296
- "type": "string"
297
- }
298
- },
299
- "additionalProperties": false
300
- },
301
- {
302
- "type": "boolean"
303
- }
304
- ]
305
- },
306
- "eslint": {
307
- "type": "object",
308
- "properties": {
309
- "files": {
310
- "anyOf": [
311
- {
201
+ "files": {
312
202
  "type": "array",
313
203
  "items": {
314
204
  "type": "string"
315
205
  }
316
206
  },
317
- {
318
- "type": "string"
207
+ "references": {
208
+ "type": "array",
209
+ "items": {
210
+ "type": "object",
211
+ "properties": {
212
+ "path": {
213
+ "type": "string"
214
+ },
215
+ "prepend": {
216
+ "type": "boolean"
217
+ }
218
+ },
219
+ "additionalProperties": false
220
+ }
319
221
  }
320
- ]
222
+ },
223
+ "additionalProperties": false
224
+ },
225
+ "context": {
226
+ "type": "string"
321
227
  },
322
- "enabled": {
228
+ "build": {
323
229
  "type": "boolean"
324
230
  },
325
- "memoryLimit": {
326
- "type": "number"
231
+ "mode": {
232
+ "enum": [
233
+ "readonly",
234
+ "write-dts",
235
+ "write-references",
236
+ "write-tsbuildinfo"
237
+ ],
238
+ "type": "string"
327
239
  },
328
- "options": {
240
+ "diagnosticOptions": {
329
241
  "type": "object",
330
242
  "properties": {
331
- "cwd": {
332
- "type": "string"
243
+ "syntactic": {
244
+ "type": "boolean"
333
245
  },
334
- "extensions": {
335
- "type": "array",
336
- "items": {
337
- "type": "string"
338
- }
246
+ "semantic": {
247
+ "type": "boolean"
248
+ },
249
+ "declaration": {
250
+ "type": "boolean"
339
251
  },
340
- "fix": {
252
+ "global": {
341
253
  "type": "boolean"
342
254
  }
343
255
  },
344
256
  "additionalProperties": false
257
+ },
258
+ "extensions": {
259
+ "type": "object",
260
+ "properties": {
261
+ "vue": {
262
+ "anyOf": [
263
+ {
264
+ "type": "object",
265
+ "properties": {
266
+ "enabled": {
267
+ "type": "boolean"
268
+ },
269
+ "compiler": {
270
+ "type": "string"
271
+ }
272
+ },
273
+ "additionalProperties": false
274
+ },
275
+ {
276
+ "type": "boolean"
277
+ }
278
+ ]
279
+ }
280
+ },
281
+ "additionalProperties": false
282
+ },
283
+ "profile": {
284
+ "type": "boolean"
285
+ },
286
+ "typescriptPath": {
287
+ "type": "string"
345
288
  }
346
289
  },
347
290
  "additionalProperties": false
@@ -356,20 +299,37 @@
356
299
  "type": "object",
357
300
  "properties": {
358
301
  "type": {
359
- "anyOf": [
360
- {
361
- "type": "object",
362
- "additionalProperties": false
363
- },
364
- {
365
- "enum": [
366
- "basic",
367
- "codeframe"
368
- ],
369
- "type": "string"
370
- }
302
+ "type": "string",
303
+ "enum": [
304
+ "basic"
371
305
  ]
372
306
  },
307
+ "pathType": {
308
+ "enum": [
309
+ "absolute",
310
+ "relative"
311
+ ],
312
+ "type": "string"
313
+ }
314
+ },
315
+ "additionalProperties": false
316
+ },
317
+ {
318
+ "type": "object",
319
+ "properties": {
320
+ "type": {
321
+ "type": "string",
322
+ "enum": [
323
+ "codeframe"
324
+ ]
325
+ },
326
+ "pathType": {
327
+ "enum": [
328
+ "absolute",
329
+ "relative"
330
+ ],
331
+ "type": "string"
332
+ },
373
333
  "options": {
374
334
  "type": "object",
375
335
  "properties": {
@@ -426,9 +386,6 @@
426
386
  "file": {
427
387
  "type": "string"
428
388
  },
429
- "origin": {
430
- "type": "string"
431
- },
432
389
  "severity": {
433
390
  "enum": [
434
391
  "error",
@@ -456,9 +413,6 @@
456
413
  "file": {
457
414
  "type": "string"
458
415
  },
459
- "origin": {
460
- "type": "string"
461
- },
462
416
  "severity": {
463
417
  "enum": [
464
418
  "error",
@@ -489,9 +443,6 @@
489
443
  "file": {
490
444
  "type": "string"
491
445
  },
492
- "origin": {
493
- "type": "string"
494
- },
495
446
  "severity": {
496
447
  "enum": [
497
448
  "error",
@@ -519,9 +470,6 @@
519
470
  "file": {
520
471
  "type": "string"
521
472
  },
522
- "origin": {
523
- "type": "string"
524
- },
525
473
  "severity": {
526
474
  "enum": [
527
475
  "error",
@@ -541,73 +489,31 @@
541
489
  "additionalProperties": false
542
490
  },
543
491
  "logger": {
544
- "type": "object",
545
- "properties": {
546
- "infrastructure": {
547
- "anyOf": [
548
- {
492
+ "anyOf": [
493
+ {
494
+ "type": "object",
495
+ "properties": {
496
+ "log": {
549
497
  "type": "object",
550
- "properties": {
551
- "info": {
552
- "type": "object",
553
- "additionalProperties": false
554
- },
555
- "log": {
556
- "type": "object",
557
- "additionalProperties": false
558
- },
559
- "error": {
560
- "type": "object",
561
- "additionalProperties": false
562
- }
563
- },
564
498
  "additionalProperties": false
565
499
  },
566
- {
567
- "enum": [
568
- "console",
569
- "silent",
570
- "webpack-infrastructure"
571
- ],
572
- "type": "string"
573
- }
574
- ]
575
- },
576
- "issues": {
577
- "anyOf": [
578
- {
500
+ "error": {
579
501
  "type": "object",
580
- "properties": {
581
- "info": {
582
- "type": "object",
583
- "additionalProperties": false
584
- },
585
- "log": {
586
- "type": "object",
587
- "additionalProperties": false
588
- },
589
- "error": {
590
- "type": "object",
591
- "additionalProperties": false
592
- }
593
- },
594
502
  "additionalProperties": false
595
- },
596
- {
597
- "enum": [
598
- "console",
599
- "silent",
600
- "webpack-infrastructure"
601
- ],
602
- "type": "string"
603
503
  }
604
- ]
504
+ },
505
+ "additionalProperties": false
605
506
  },
606
- "devServer": {
607
- "type": "boolean"
507
+ {
508
+ "enum": [
509
+ "webpack-infrastructure"
510
+ ],
511
+ "type": "string"
608
512
  }
609
- },
610
- "additionalProperties": false
513
+ ]
514
+ },
515
+ "devServer": {
516
+ "type": "boolean"
611
517
  }
612
518
  },
613
519
  "additionalProperties": false
@@ -1100,6 +1006,48 @@
1100
1006
  }
1101
1007
  },
1102
1008
  "additionalProperties": false
1009
+ },
1010
+ "shared": {
1011
+ "title": "Specify dependencies that will be shared between application and child-apps",
1012
+ "description": "Properly defining that dependencies may greatly reduce filesize of loaded js on the client",
1013
+ "default": {},
1014
+ "type": "object",
1015
+ "properties": {
1016
+ "defaultTramvaiDependencies": {
1017
+ "title": "Should default dependencies list be added to shared list",
1018
+ "description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of",
1019
+ "type": "boolean"
1020
+ },
1021
+ "deps": {
1022
+ "title": "list of the dependencies that will be shared",
1023
+ "default": [],
1024
+ "type": "array",
1025
+ "items": {
1026
+ "anyOf": [
1027
+ {
1028
+ "type": "object",
1029
+ "properties": {
1030
+ "name": {
1031
+ "title": "name of the dependency import",
1032
+ "type": "string"
1033
+ },
1034
+ "singleton": {
1035
+ "title": "if dependency is marked as singleton the dependency will be initialized only once and will not be updated",
1036
+ "description": "Do not overuse that feature as it may lead to subtle bugs in case of different versions on different sides",
1037
+ "default": ": false",
1038
+ "type": "boolean"
1039
+ }
1040
+ },
1041
+ "additionalProperties": false
1042
+ },
1043
+ {
1044
+ "type": "string"
1045
+ }
1046
+ ]
1047
+ }
1048
+ }
1049
+ },
1050
+ "additionalProperties": false
1103
1051
  }
1104
1052
  },
1105
1053
  "required": [
@@ -1580,6 +1528,48 @@
1580
1528
  }
1581
1529
  },
1582
1530
  "additionalProperties": false
1531
+ },
1532
+ "shared": {
1533
+ "title": "Specify dependencies that will be shared between application and child-apps",
1534
+ "description": "Properly defining that dependencies may greatly reduce filesize of loaded js on the client",
1535
+ "default": {},
1536
+ "type": "object",
1537
+ "properties": {
1538
+ "defaultTramvaiDependencies": {
1539
+ "title": "Should default dependencies list be added to shared list",
1540
+ "description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of",
1541
+ "type": "boolean"
1542
+ },
1543
+ "deps": {
1544
+ "title": "list of the dependencies that will be shared",
1545
+ "default": [],
1546
+ "type": "array",
1547
+ "items": {
1548
+ "anyOf": [
1549
+ {
1550
+ "type": "object",
1551
+ "properties": {
1552
+ "name": {
1553
+ "title": "name of the dependency import",
1554
+ "type": "string"
1555
+ },
1556
+ "singleton": {
1557
+ "title": "if dependency is marked as singleton the dependency will be initialized only once and will not be updated",
1558
+ "description": "Do not overuse that feature as it may lead to subtle bugs in case of different versions on different sides",
1559
+ "default": ": false",
1560
+ "type": "boolean"
1561
+ }
1562
+ },
1563
+ "additionalProperties": false
1564
+ },
1565
+ {
1566
+ "type": "string"
1567
+ }
1568
+ ]
1569
+ }
1570
+ }
1571
+ },
1572
+ "additionalProperties": false
1583
1573
  }
1584
1574
  },
1585
1575
  "required": [
@@ -2060,6 +2050,48 @@
2060
2050
  }
2061
2051
  },
2062
2052
  "additionalProperties": false
2053
+ },
2054
+ "shared": {
2055
+ "title": "Specify dependencies that will be shared between application and child-apps",
2056
+ "description": "Properly defining that dependencies may greatly reduce filesize of loaded js on the client",
2057
+ "default": {},
2058
+ "type": "object",
2059
+ "properties": {
2060
+ "defaultTramvaiDependencies": {
2061
+ "title": "Should default dependencies list be added to shared list",
2062
+ "description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of",
2063
+ "type": "boolean"
2064
+ },
2065
+ "deps": {
2066
+ "title": "list of the dependencies that will be shared",
2067
+ "default": [],
2068
+ "type": "array",
2069
+ "items": {
2070
+ "anyOf": [
2071
+ {
2072
+ "type": "object",
2073
+ "properties": {
2074
+ "name": {
2075
+ "title": "name of the dependency import",
2076
+ "type": "string"
2077
+ },
2078
+ "singleton": {
2079
+ "title": "if dependency is marked as singleton the dependency will be initialized only once and will not be updated",
2080
+ "description": "Do not overuse that feature as it may lead to subtle bugs in case of different versions on different sides",
2081
+ "default": ": false",
2082
+ "type": "boolean"
2083
+ }
2084
+ },
2085
+ "additionalProperties": false
2086
+ },
2087
+ {
2088
+ "type": "string"
2089
+ }
2090
+ ]
2091
+ }
2092
+ }
2093
+ },
2094
+ "additionalProperties": false
2063
2095
  }
2064
2096
  },
2065
2097
  "required": [