@tramvai/cli 3.31.3 → 3.32.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"prod.d.ts","sourceRoot":"","sources":["../../../../../src/library/webpack/application/server/prod.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,eAAe,CAAC;AAGnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAO1F,eAAO,MAAM,mBAAmB;mBAGf,cAAc,sBAAsB,CAAC;YA+ErD,CAAC"}
1
+ {"version":3,"file":"prod.d.ts","sourceRoot":"","sources":["../../../../../src/library/webpack/application/server/prod.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,eAAe,CAAC;AAGnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAO1F,eAAO,MAAM,mBAAmB;mBAGf,cAAc,sBAAsB,CAAC;YAqFrD,CAAC"}
@@ -15,6 +15,8 @@ const webpackServerConfig = ({ configManager, }) => {
15
15
  config.batch((0, prod_1.default)(configManager));
16
16
  config.bail(true);
17
17
  config.externals(configManager.externals.map((s) => new RegExp(`^${s}`)));
18
+ const minifierValueFromConfig = configManager.experiments.minifier;
19
+ const minifier = minifierValueFromConfig === 'swc' ? terser_webpack_plugin_1.default.swcMinify : terser_webpack_plugin_1.default.terserMinify;
18
20
  if (configManager.disableProdOptimization) {
19
21
  // with this option for id of module path to file will be used
20
22
  config.optimization.set('moduleIds', 'named');
@@ -22,6 +24,7 @@ const webpackServerConfig = ({ configManager, }) => {
22
24
  config.optimization.set('concatenateModules', false);
23
25
  config.plugin('terser').use(terser_webpack_plugin_1.default, [
24
26
  {
27
+ minify: minifier,
25
28
  extractComments: false,
26
29
  terserOptions: {
27
30
  ecma: 5,
@@ -33,13 +36,7 @@ const webpackServerConfig = ({ configManager, }) => {
33
36
  drop_debugger: !debug,
34
37
  dead_code: true,
35
38
  },
36
- output: {
37
- comments: true,
38
- semicolons: false,
39
- preserve_annotations: true,
40
- indent_start: 2,
41
- beautify: true,
42
- },
39
+ output: Object.assign(Object.assign({ comments: true, semicolons: false, preserve_annotations: true }, (minifierValueFromConfig === 'swc' ? {} : { indent_start: 2 })), { beautify: true }),
43
40
  },
44
41
  },
45
42
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"prod.js","sourceRoot":"","sources":["../../../../../src/library/webpack/application/server/prod.ts"],"names":[],"mappings":";;;;AAAA,0EAAmC;AACnC,0FAAiD;AAKjD,gGAAgE;AAChE,8DAA8B;AAC9B,iFAAiD;AACjD,4EAAkD;AAE3C,MAAM,mBAAmB,GAAG,CAAC,EAClC,aAAa,GAGd,EAAE,EAAE;IACH,MAAM,MAAM,GAAG,IAAI,uBAAM,EAAE,CAAC;IAC5B,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,aAAa,CAAC;IAE3C,MAAM,CAAC,KAAK,CAAC,IAAA,gBAAM,EAAC,aAAa,CAAC,CAAC,CAAC;IACpC,MAAM,CAAC,KAAK,CAAC,IAAA,cAAU,EAAC,aAAa,CAAC,CAAC,CAAC;IAExC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAElB,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAE1E,IAAI,aAAa,CAAC,uBAAuB,EAAE;QACzC,8DAA8D;QAC9D,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAC9C,sEAAsE;QACtE,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,oBAAoB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C,MAAM,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,2BAAiB,EAAE;QACnD;YACE,UAAU,EAAE,2BAA2B;SACxC;KACF,CAAC,CAAC;IAEH,IAAI,SAAS,EAAE;QACb,MAAM,CAAC,KAAK,CAAC,IAAA,oBAAU,EAAC,aAAa,CAAC,CAAC,CAAC;KACzC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAxFW,QAAA,mBAAmB,uBAwF9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"optimize.d.ts","sourceRoot":"","sources":["../../../../src/library/webpack/blocks/optimize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;wCAExC,cAAc,cAAc,CAAC,cAAc,MAAM;AAAhF,wBA0EE"}
1
+ {"version":3,"file":"optimize.d.ts","sourceRoot":"","sources":["../../../../src/library/webpack/blocks/optimize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;wCAExC,cAAc,cAAc,CAAC,cAAc,MAAM;AAAhF,wBA6EE"}
@@ -11,6 +11,8 @@ exports.default = (configManager) => (config) => {
11
11
  keep_fnames: isProductionProfilingEnabled,
12
12
  keep_classnames: isProductionProfilingEnabled,
13
13
  };
14
+ const minifierValueFromConfig = configManager.experiments.minifier;
15
+ const minifier = minifierValueFromConfig === 'swc' ? terser_webpack_plugin_1.default.swcMinify : terser_webpack_plugin_1.default.terserMinify;
14
16
  if (disableProdOptimization) {
15
17
  // with this option for id of module path to file will be used
16
18
  config.optimization.set('moduleIds', 'named');
@@ -18,14 +20,9 @@ exports.default = (configManager) => (config) => {
18
20
  config.optimization.set('concatenateModules', false);
19
21
  config.plugin('terser').use(terser_webpack_plugin_1.default, [
20
22
  {
23
+ minify: minifier,
21
24
  extractComments: false,
22
- terserOptions: Object.assign(Object.assign({}, tramvaiReactProfileTerserOptions), { ecma: 6, mangle: false, output: {
23
- comments: true,
24
- semicolons: false,
25
- preserve_annotations: true,
26
- indent_start: 2,
27
- beautify: true,
28
- }, compress: {
25
+ terserOptions: Object.assign(Object.assign({}, tramvaiReactProfileTerserOptions), { ecma: 6, mangle: false, output: Object.assign(Object.assign({ comments: true, semicolons: false, preserve_annotations: true }, (minifierValueFromConfig === 'swc' ? {} : { indent_start: 2 })), { beautify: true }), compress: {
29
26
  passes: 2,
30
27
  drop_debugger: !debug,
31
28
  } }),
@@ -37,9 +34,7 @@ exports.default = (configManager) => (config) => {
37
34
  config.plugin('terser').use(terser_webpack_plugin_1.default, [
38
35
  {
39
36
  extractComments: false,
40
- minify: configManager.experiments.minifier === 'swc'
41
- ? terser_webpack_plugin_1.default.swcMinify
42
- : terser_webpack_plugin_1.default.terserMinify,
37
+ minify: minifier,
43
38
  parallel: terser.parallel,
44
39
  terserOptions: Object.assign(Object.assign({}, tramvaiReactProfileTerserOptions), { ecma: modern ? 6 : 5, mangle: {
45
40
  // https://github.com/node-fetch/node-fetch/issues/667
@@ -1 +1 @@
1
- {"version":3,"file":"optimize.js","sourceRoot":"","sources":["../../../../src/library/webpack/blocks/optimize.ts"],"names":[],"mappings":";;;AACA,0FAAiD;AACjD,wGAAwD;AACxD,sFAAoD;AAIpD,kBAAe,CAAC,aAA4C,EAAE,EAAE,CAAC,CAAC,MAAc,EAAE,EAAE;IAClF,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,uBAAuB,EAAE,GAAG,aAAa,CAAC;IAEjE,MAAM,4BAA4B,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;IACzE,MAAM,gCAAgC,GAAG;QACvC,WAAW,EAAE,4BAA4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AAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,6BAAwB,EAAE,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;KAC/E;SAAM;QACL,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,sCAAY,CAAC,CAAC;KAClD;AACH,CAAC,CAAC"}
@@ -1178,23 +1178,23 @@
1178
1178
  "dotAll": {
1179
1179
  "type": "boolean"
1180
1180
  },
1181
- "__@match@6864": {
1181
+ "__@match@6869": {
1182
1182
  "type": "object",
1183
1183
  "additionalProperties": false
1184
1184
  },
1185
- "__@replace@6866": {
1185
+ "__@replace@6871": {
1186
1186
  "type": "object",
1187
1187
  "additionalProperties": false
1188
1188
  },
1189
- "__@search@6869": {
1189
+ "__@search@6874": {
1190
1190
  "type": "object",
1191
1191
  "additionalProperties": false
1192
1192
  },
1193
- "__@split@6871": {
1193
+ "__@split@6876": {
1194
1194
  "type": "object",
1195
1195
  "additionalProperties": false
1196
1196
  },
1197
- "__@matchAll@6873": {
1197
+ "__@matchAll@6878": {
1198
1198
  "type": "object",
1199
1199
  "additionalProperties": false
1200
1200
  }
@@ -1881,23 +1881,23 @@
1881
1881
  "dotAll": {
1882
1882
  "type": "boolean"
1883
1883
  },
1884
- "__@match@6864": {
1884
+ "__@match@6869": {
1885
1885
  "type": "object",
1886
1886
  "additionalProperties": false
1887
1887
  },
1888
- "__@replace@6866": {
1888
+ "__@replace@6871": {
1889
1889
  "type": "object",
1890
1890
  "additionalProperties": false
1891
1891
  },
1892
- "__@search@6869": {
1892
+ "__@search@6874": {
1893
1893
  "type": "object",
1894
1894
  "additionalProperties": false
1895
1895
  },
1896
- "__@split@6871": {
1896
+ "__@split@6876": {
1897
1897
  "type": "object",
1898
1898
  "additionalProperties": false
1899
1899
  },
1900
- "__@matchAll@6873": {
1900
+ "__@matchAll@6878": {
1901
1901
  "type": "object",
1902
1902
  "additionalProperties": false
1903
1903
  }
@@ -2584,23 +2584,23 @@
2584
2584
  "dotAll": {
2585
2585
  "type": "boolean"
2586
2586
  },
2587
- "__@match@6864": {
2587
+ "__@match@6869": {
2588
2588
  "type": "object",
2589
2589
  "additionalProperties": false
2590
2590
  },
2591
- "__@replace@6866": {
2591
+ "__@replace@6871": {
2592
2592
  "type": "object",
2593
2593
  "additionalProperties": false
2594
2594
  },
2595
- "__@search@6869": {
2595
+ "__@search@6874": {
2596
2596
  "type": "object",
2597
2597
  "additionalProperties": false
2598
2598
  },
2599
- "__@split@6871": {
2599
+ "__@split@6876": {
2600
2600
  "type": "object",
2601
2601
  "additionalProperties": false
2602
2602
  },
2603
- "__@matchAll@6873": {
2603
+ "__@matchAll@6878": {
2604
2604
  "type": "object",
2605
2605
  "additionalProperties": false
2606
2606
  }
@@ -1,5 +1,3 @@
1
1
  import type { Validator } from './validator.h';
2
- import type { TranspilationExperiments, TranspilationLoader } from '../../typings/configEntry/cli';
3
- export declare const extractLoaderFromConfigEntry: (transpilationExperiments?: TranspilationExperiments) => TranspilationLoader;
4
2
  export declare const checkSwcDependencies: Validator;
5
3
  //# sourceMappingURL=checkSwcDependencies.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkSwcDependencies.d.ts","sourceRoot":"","sources":["../../../src/validators/commands/checkSwcDependencies.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAInG,eAAO,MAAM,4BAA4B,8BACZ,wBAAwB,KAClD,mBAaF,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,SA+DlC,CAAC"}
1
+ {"version":3,"file":"checkSwcDependencies.d.ts","sourceRoot":"","sources":["../../../src/validators/commands/checkSwcDependencies.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAiB/C,eAAO,MAAM,oBAAoB,EAAE,SAsElC,CAAC"}
@@ -1,27 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkSwcDependencies = exports.extractLoaderFromConfigEntry = void 0;
3
+ exports.checkSwcDependencies = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const resolve_1 = require("resolve");
6
6
  const validator = 'checkSwcDependencies';
7
- const extractLoaderFromConfigEntry = (transpilationExperiments) => {
7
+ const extractFieldFromConfigEntry = (experimentField, defaultValue) => {
8
8
  var _a;
9
- const defaultTranspiler = 'babel';
10
- if (!transpilationExperiments) {
11
- return defaultTranspiler;
9
+ if (!experimentField)
10
+ return defaultValue;
11
+ if (typeof experimentField === 'string') {
12
+ return experimentField;
12
13
  }
13
- const { loader } = transpilationExperiments;
14
- if (typeof loader === 'string') {
15
- return loader;
16
- }
17
- return (_a = loader[process.env.NODE_ENV]) !== null && _a !== void 0 ? _a : defaultTranspiler;
14
+ return (_a = experimentField[process.env.NODE_ENV]) !== null && _a !== void 0 ? _a : defaultValue;
18
15
  };
19
- exports.extractLoaderFromConfigEntry = extractLoaderFromConfigEntry;
20
16
  const checkSwcDependencies = (context, parameters) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
21
- var _a;
17
+ var _a, _b, _c;
22
18
  const configEntry = context.config.getProject(parameters.target);
23
- const loader = (0, exports.extractLoaderFromConfigEntry)((_a = configEntry === null || configEntry === void 0 ? void 0 : configEntry.experiments) === null || _a === void 0 ? void 0 : _a.transpilation);
24
- if (loader === 'babel') {
19
+ const loader = extractFieldFromConfigEntry((_b = (_a = configEntry === null || configEntry === void 0 ? void 0 : configEntry.experiments) === null || _a === void 0 ? void 0 : _a.transpilation) === null || _b === void 0 ? void 0 : _b.loader, 'babel');
20
+ const minifier = extractFieldFromConfigEntry((_c = configEntry === null || configEntry === void 0 ? void 0 : configEntry.experiments) === null || _c === void 0 ? void 0 : _c.minifier, 'terser');
21
+ if (!(loader === 'swc' || minifier === 'swc')) {
25
22
  return {
26
23
  name: validator,
27
24
  status: 'ok',
@@ -48,7 +45,7 @@ const checkSwcDependencies = (context, parameters) => tslib_1.__awaiter(void 0,
48
45
  return {
49
46
  name: validator,
50
47
  status: 'error',
51
- message: '@swc/core or @tramvai/swc-integration module is not found. Continue without checking dependencies. Install @tramvai/swc-integration package in case if you use swc-loader',
48
+ message: '@swc/core or @tramvai/swc-integration module is not found. Continue without checking dependencies. Install @tramvai/swc-integration package in case if you use swc-loader/swc-minifier',
52
49
  };
53
50
  }
54
51
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"checkSwcDependencies.js","sourceRoot":"","sources":["../../../src/validators/commands/checkSwcDependencies.ts"],"names":[],"mappings":";;;;AAAA,qCAA0C;AAI1C,MAAM,SAAS,GAAG,sBAAsB,CAAC;AAElC,MAAM,4BAA4B,GAAG,CAC1C,wBAAmD,EAC9B,EAAE;;IACvB,MAAM,iBAAiB,GAAG,OAAO,CAAC;IAClC,IAAI,CAAC,wBAAwB,EAAE;QAC7B,OAAO,iBAAiB,CAAC;KAC1B;IAED,MAAM,EAAE,MAAM,EAAE,GAAG,wBAAwB,CAAC;IAE5C,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC9B,OAAO,MAAa,CAAC;KACtB;IAED,OAAO,MAAA,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,mCAAI,iBAAiB,CAAC;AAC3D,CAAC,CAAC;AAfW,QAAA,4BAA4B,gCAevC;AAEK,MAAM,oBAAoB,GAAc,CAAO,OAAO,EAAE,UAAU,EAAE,EAAE;;IAC3E,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAEjE,MAAM,MAAM,GAAG,IAAA,oCAA4B,EAAC,MAAC,WAAmB,aAAnB,WAAW,uBAAX,WAAW,CAAU,WAAW,0CAAE,aAAa,CAAC,CAAC;IAE9F,IAAI,MAAM,KAAK,OAAO,EAAE;QACtB,OA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IAAI;SACb,CAAC;KACH;IAED,OAAO;QACL,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,OAAO;QACf,OAAO,EAAE;qCACwB,sBAAsB;yBAClC,cAAc;0BACb,eAAe,GAAG;KACzC,CAAC;AACJ,CAAC,CAAA,CAAC;AA/DW,QAAA,oBAAoB,wBA+D/B"}
1
+ {"version":3,"file":"checkSwcDependencies.js","sourceRoot":"","sources":["../../../src/validators/commands/checkSwcDependencies.ts"],"names":[],"mappings":";;;;AAAA,qCAA0C;AAI1C,MAAM,SAAS,GAAG,sBAAsB,CAAC;AAEzC,MAAM,2BAA2B,GAAG,CAClC,eAAkB,EAClB,YAAe,EACZ,EAAE;;IACL,IAAI,CAAC,eAAe;QAAE,OAAO,YAAY,CAAC;IAC1C,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE;QACvC,OAAO,eAAoB,CAAC;KAC7B;IAED,OAAO,MAAA,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,mCAAI,YAAY,CAAC;AAC/D,CAAC,CAAC;AAEK,MAAM,oBAAoB,GAAc,CAAO,OAAO,EAAE,UAAU,EAAE,EAAE;;IAC3E,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAEjE,MAAM,MAAM,GAAG,2BAA2B,CACxC,MAAA,MAAC,WAAmB,aAAnB,WAAW,uBAAX,WAAW,CAAU,WAAW,0CAAE,aAAa,0CAAE,MAAM,EACxD,OAAO,CACR,CAAC;IACF,MAAM,QAAQ,GAAG,2BAA2B,CAC1C,MAAC,WAAmB,aAAnB,WAAW,uBAAX,WAAW,CAAU,WAAW,0CAAE,QAAQ,EAC3C,QAAQ,CACT,CAAC;IAEF,IAAI,CAAC,CAAC,MAAM,KAAK,KAAK,IAAI,QAAQ,KAAK,KAAK,CAAC,EAAE;QAC7C,OAAO;YACL,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,IAAI;SACb,C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QACf,MAAM,EAAE,OAAO;QACf,OAAO,EAAE;qCACwB,sBAAsB;yBAClC,cAAc;0BACb,eAAe,GAAG;KACzC,CAAC;AACJ,CAAC,CAAA,CAAC;AAtEW,QAAA,oBAAoB,wBAsE/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/cli",
3
- "version": "3.31.3",
3
+ "version": "3.32.3",
4
4
  "description": "Cli инструмент для сборки и запуска приложений",
5
5
  "files": [
6
6
  "src",
@@ -72,7 +72,7 @@
72
72
  "@tinkoff/utils": "^2.1.3",
73
73
  "@tinkoff/webpack-dedupe-plugin": "2.0.2",
74
74
  "@tramvai/build": "4.1.1",
75
- "@tramvai/react": "3.31.3",
75
+ "@tramvai/react": "3.32.3",
76
76
  "@tramvai/tools-check-versions": "0.5.3",
77
77
  "@tramvai/tools-migrate": "0.7.3",
78
78
  "ajv": "^8.12.0",
package/schema.json CHANGED
@@ -1200,23 +1200,23 @@
1200
1200
  "dotAll": {
1201
1201
  "type": "boolean"
1202
1202
  },
1203
- "__@match@6864": {
1203
+ "__@match@6869": {
1204
1204
  "type": "object",
1205
1205
  "additionalProperties": false
1206
1206
  },
1207
- "__@replace@6866": {
1207
+ "__@replace@6871": {
1208
1208
  "type": "object",
1209
1209
  "additionalProperties": false
1210
1210
  },
1211
- "__@search@6869": {
1211
+ "__@search@6874": {
1212
1212
  "type": "object",
1213
1213
  "additionalProperties": false
1214
1214
  },
1215
- "__@split@6871": {
1215
+ "__@split@6876": {
1216
1216
  "type": "object",
1217
1217
  "additionalProperties": false
1218
1218
  },
1219
- "__@matchAll@6873": {
1219
+ "__@matchAll@6878": {
1220
1220
  "type": "object",
1221
1221
  "additionalProperties": false
1222
1222
  }
@@ -1912,23 +1912,23 @@
1912
1912
  "dotAll": {
1913
1913
  "type": "boolean"
1914
1914
  },
1915
- "__@match@6864": {
1915
+ "__@match@6869": {
1916
1916
  "type": "object",
1917
1917
  "additionalProperties": false
1918
1918
  },
1919
- "__@replace@6866": {
1919
+ "__@replace@6871": {
1920
1920
  "type": "object",
1921
1921
  "additionalProperties": false
1922
1922
  },
1923
- "__@search@6869": {
1923
+ "__@search@6874": {
1924
1924
  "type": "object",
1925
1925
  "additionalProperties": false
1926
1926
  },
1927
- "__@split@6871": {
1927
+ "__@split@6876": {
1928
1928
  "type": "object",
1929
1929
  "additionalProperties": false
1930
1930
  },
1931
- "__@matchAll@6873": {
1931
+ "__@matchAll@6878": {
1932
1932
  "type": "object",
1933
1933
  "additionalProperties": false
1934
1934
  }
@@ -2624,23 +2624,23 @@
2624
2624
  "dotAll": {
2625
2625
  "type": "boolean"
2626
2626
  },
2627
- "__@match@6864": {
2627
+ "__@match@6869": {
2628
2628
  "type": "object",
2629
2629
  "additionalProperties": false
2630
2630
  },
2631
- "__@replace@6866": {
2631
+ "__@replace@6871": {
2632
2632
  "type": "object",
2633
2633
  "additionalProperties": false
2634
2634
  },
2635
- "__@search@6869": {
2635
+ "__@search@6874": {
2636
2636
  "type": "object",
2637
2637
  "additionalProperties": false
2638
2638
  },
2639
- "__@split@6871": {
2639
+ "__@split@6876": {
2640
2640
  "type": "object",
2641
2641
  "additionalProperties": false
2642
2642
  },
2643
- "__@matchAll@6873": {
2643
+ "__@matchAll@6878": {
2644
2644
  "type": "object",
2645
2645
  "additionalProperties": false
2646
2646
  }
@@ -24,6 +24,10 @@ export const webpackServerConfig = ({
24
24
 
25
25
  config.externals(configManager.externals.map((s) => new RegExp(`^${s}`)));
26
26
 
27
+ const minifierValueFromConfig = configManager.experiments.minifier;
28
+ const minifier =
29
+ minifierValueFromConfig === 'swc' ? TerserPlugin.swcMinify : TerserPlugin.terserMinify;
30
+
27
31
  if (configManager.disableProdOptimization) {
28
32
  // with this option for id of module path to file will be used
29
33
  config.optimization.set('moduleIds', 'named');
@@ -32,6 +36,7 @@ export const webpackServerConfig = ({
32
36
 
33
37
  config.plugin('terser').use(TerserPlugin, [
34
38
  {
39
+ minify: minifier,
35
40
  extractComments: false,
36
41
  terserOptions: {
37
42
  ecma: 5, // на сервере в страницу встраивается код, который может подключаться через import и terser его соптимизирует в es6
@@ -47,7 +52,8 @@ export const webpackServerConfig = ({
47
52
  comments: true,
48
53
  semicolons: false,
49
54
  preserve_annotations: true,
50
- indent_start: 2,
55
+ // currently doesn't support by swc
56
+ ...(minifierValueFromConfig === 'swc' ? {} : { indent_start: 2 }),
51
57
  beautify: true,
52
58
  },
53
59
  },
@@ -14,6 +14,10 @@ export default (configManager: ConfigManager<CliConfigEntry>) => (config: Config
14
14
  keep_classnames: isProductionProfilingEnabled,
15
15
  };
16
16
 
17
+ const minifierValueFromConfig = configManager.experiments.minifier;
18
+ const minifier =
19
+ minifierValueFromConfig === 'swc' ? TerserPlugin.swcMinify : TerserPlugin.terserMinify;
20
+
17
21
  if (disableProdOptimization) {
18
22
  // with this option for id of module path to file will be used
19
23
  config.optimization.set('moduleIds', 'named');
@@ -22,6 +26,7 @@ export default (configManager: ConfigManager<CliConfigEntry>) => (config: Config
22
26
 
23
27
  config.plugin('terser').use(TerserPlugin, [
24
28
  {
29
+ minify: minifier,
25
30
  extractComments: false,
26
31
  terserOptions: {
27
32
  ...tramvaiReactProfileTerserOptions,
@@ -31,7 +36,8 @@ export default (configManager: ConfigManager<CliConfigEntry>) => (config: Config
31
36
  comments: true,
32
37
  semicolons: false,
33
38
  preserve_annotations: true,
34
- indent_start: 2,
39
+ // currently doesn't support by swc
40
+ ...(minifierValueFromConfig === 'swc' ? {} : { indent_start: 2 }),
35
41
  beautify: true,
36
42
  },
37
43
  compress: {
@@ -50,10 +56,7 @@ export default (configManager: ConfigManager<CliConfigEntry>) => (config: Config
50
56
  config.plugin('terser').use(TerserPlugin, [
51
57
  {
52
58
  extractComments: false,
53
- minify:
54
- configManager.experiments.minifier === 'swc'
55
- ? TerserPlugin.swcMinify
56
- : TerserPlugin.terserMinify,
59
+ minify: minifier,
57
60
  parallel: terser.parallel,
58
61
  terserOptions: {
59
62
  ...tramvaiReactProfileTerserOptions,
@@ -1178,23 +1178,23 @@
1178
1178
  "dotAll": {
1179
1179
  "type": "boolean"
1180
1180
  },
1181
- "__@match@6864": {
1181
+ "__@match@6869": {
1182
1182
  "type": "object",
1183
1183
  "additionalProperties": false
1184
1184
  },
1185
- "__@replace@6866": {
1185
+ "__@replace@6871": {
1186
1186
  "type": "object",
1187
1187
  "additionalProperties": false
1188
1188
  },
1189
- "__@search@6869": {
1189
+ "__@search@6874": {
1190
1190
  "type": "object",
1191
1191
  "additionalProperties": false
1192
1192
  },
1193
- "__@split@6871": {
1193
+ "__@split@6876": {
1194
1194
  "type": "object",
1195
1195
  "additionalProperties": false
1196
1196
  },
1197
- "__@matchAll@6873": {
1197
+ "__@matchAll@6878": {
1198
1198
  "type": "object",
1199
1199
  "additionalProperties": false
1200
1200
  }
@@ -1881,23 +1881,23 @@
1881
1881
  "dotAll": {
1882
1882
  "type": "boolean"
1883
1883
  },
1884
- "__@match@6864": {
1884
+ "__@match@6869": {
1885
1885
  "type": "object",
1886
1886
  "additionalProperties": false
1887
1887
  },
1888
- "__@replace@6866": {
1888
+ "__@replace@6871": {
1889
1889
  "type": "object",
1890
1890
  "additionalProperties": false
1891
1891
  },
1892
- "__@search@6869": {
1892
+ "__@search@6874": {
1893
1893
  "type": "object",
1894
1894
  "additionalProperties": false
1895
1895
  },
1896
- "__@split@6871": {
1896
+ "__@split@6876": {
1897
1897
  "type": "object",
1898
1898
  "additionalProperties": false
1899
1899
  },
1900
- "__@matchAll@6873": {
1900
+ "__@matchAll@6878": {
1901
1901
  "type": "object",
1902
1902
  "additionalProperties": false
1903
1903
  }
@@ -2584,23 +2584,23 @@
2584
2584
  "dotAll": {
2585
2585
  "type": "boolean"
2586
2586
  },
2587
- "__@match@6864": {
2587
+ "__@match@6869": {
2588
2588
  "type": "object",
2589
2589
  "additionalProperties": false
2590
2590
  },
2591
- "__@replace@6866": {
2591
+ "__@replace@6871": {
2592
2592
  "type": "object",
2593
2593
  "additionalProperties": false
2594
2594
  },
2595
- "__@search@6869": {
2595
+ "__@search@6874": {
2596
2596
  "type": "object",
2597
2597
  "additionalProperties": false
2598
2598
  },
2599
- "__@split@6871": {
2599
+ "__@split@6876": {
2600
2600
  "type": "object",
2601
2601
  "additionalProperties": false
2602
2602
  },
2603
- "__@matchAll@6873": {
2603
+ "__@matchAll@6878": {
2604
2604
  "type": "object",
2605
2605
  "additionalProperties": false
2606
2606
  }
@@ -1,9 +1,12 @@
1
1
  import { sync as mockResolve } from 'resolve';
2
2
  import type { Context } from '../../models/context';
3
3
  import { checkSwcDependencies } from './checkSwcDependencies';
4
- import type { TranspilationLoader } from '../../typings/configEntry/cli';
4
+ import type { TranspilationLoader, Minifier } from '../../typings/configEntry/cli';
5
5
 
6
- const getContextWithLoader = (loader: TranspilationLoader) => {
6
+ const getContextWithExperimentalOptions = (
7
+ loader: TranspilationLoader,
8
+ minifier: Minifier = 'terser'
9
+ ) => {
7
10
  return {
8
11
  config: {
9
12
  getProject: () => {
@@ -12,6 +15,7 @@ const getContextWithLoader = (loader: TranspilationLoader) => {
12
15
  transpilation: {
13
16
  loader,
14
17
  },
18
+ minifier,
15
19
  },
16
20
  };
17
21
  },
@@ -59,7 +63,7 @@ jest.mock('resolve', () => ({
59
63
 
60
64
  describe('validators/checkSwcDependencies', () => {
61
65
  const mockLog = jest.fn();
62
- const context = getContextWithLoader('swc');
66
+ const context = getContextWithExperimentalOptions('swc');
63
67
 
64
68
  beforeEach(() => {
65
69
  mockLog.mockClear();
@@ -68,7 +72,8 @@ describe('validators/checkSwcDependencies', () => {
68
72
  });
69
73
 
70
74
  it('returns ok if there is no @tramvai/swc-integration with babel transpiler', async () => {
71
- expect(await checkSwcDependencies(getContextWithLoader('babel'), {})).toMatchInlineSnapshot(`
75
+ expect(await checkSwcDependencies(getContextWithExperimentalOptions('babel'), {}))
76
+ .toMatchInlineSnapshot(`
72
77
  {
73
78
  "name": "checkSwcDependencies",
74
79
  "status": "ok",
@@ -77,9 +82,9 @@ describe('validators/checkSwcDependencies', () => {
77
82
  });
78
83
 
79
84
  it('returns error if there is no @tramvai/swc-integration with swc transpiler', async () => {
80
- const result = await checkSwcDependencies(context, {});
85
+ const result = await checkSwcDependencies(getContextWithExperimentalOptions('swc'), {});
81
86
  expect(result.message).toBe(
82
- '@swc/core or @tramvai/swc-integration module is not found. Continue without checking dependencies. Install @tramvai/swc-integration package in case if you use swc-loader'
87
+ '@swc/core or @tramvai/swc-integration module is not found. Continue without checking dependencies. Install @tramvai/swc-integration package in case if you use swc-loader/swc-minifier'
83
88
  );
84
89
  expect(result.status).toBe('error');
85
90
  });
@@ -140,11 +145,38 @@ describe('validators/checkSwcDependencies', () => {
140
145
  `);
141
146
  });
142
147
  it('returns ok with babel transpiler', async () => {
143
- expect(await checkSwcDependencies(getContextWithLoader('babel'), {})).toMatchInlineSnapshot(`
148
+ expect(await checkSwcDependencies(getContextWithExperimentalOptions('babel'), {}))
149
+ .toMatchInlineSnapshot(`
144
150
  {
145
151
  "name": "checkSwcDependencies",
146
152
  "status": "ok",
147
153
  }
148
154
  `);
149
155
  });
156
+
157
+ it('returns ok with terser transpiler', async () => {
158
+ expect(await checkSwcDependencies(getContextWithExperimentalOptions('babel', 'terser'), {}))
159
+ .toMatchInlineSnapshot(`
160
+ {
161
+ "name": "checkSwcDependencies",
162
+ "status": "ok",
163
+ }
164
+ `);
165
+ });
166
+
167
+ it('returns error with swc transpiler', async () => {
168
+ mockSwcIntegration('1.0.0', '1.0.0', '1.0.1');
169
+
170
+ expect(await checkSwcDependencies(getContextWithExperimentalOptions('babel', 'swc'), {}))
171
+ .toMatchInlineSnapshot(`
172
+ {
173
+ "message": "Version of @swc/core mismatch between
174
+ @tramvai/swc-integration (version: 1.0.0),
175
+ @tramvai/cli (version: 1.0.0) and
176
+ process.cwd() (version: 1.0.1)",
177
+ "name": "checkSwcDependencies",
178
+ "status": "error",
179
+ }
180
+ `);
181
+ });
150
182
  });
@@ -1,32 +1,34 @@
1
1
  import { sync as resolve } from 'resolve';
2
2
  import type { Validator } from './validator.h';
3
- import type { TranspilationExperiments, TranspilationLoader } from '../../typings/configEntry/cli';
3
+ import type { Experiments, TranspilationLoader, Minifier } from '../../typings/configEntry/cli';
4
4
 
5
5
  const validator = 'checkSwcDependencies';
6
6
 
7
- export const extractLoaderFromConfigEntry = (
8
- transpilationExperiments?: TranspilationExperiments
9
- ): TranspilationLoader => {
10
- const defaultTranspiler = 'babel';
11
- if (!transpilationExperiments) {
12
- return defaultTranspiler;
7
+ const extractFieldFromConfigEntry = <T extends Minifier | TranspilationLoader>(
8
+ experimentField: T,
9
+ defaultValue: T
10
+ ): T => {
11
+ if (!experimentField) return defaultValue;
12
+ if (typeof experimentField === 'string') {
13
+ return experimentField as T;
13
14
  }
14
15
 
15
- const { loader } = transpilationExperiments;
16
-
17
- if (typeof loader === 'string') {
18
- return loader as any;
19
- }
20
-
21
- return loader[process.env.NODE_ENV] ?? defaultTranspiler;
16
+ return experimentField[process.env.NODE_ENV] ?? defaultValue;
22
17
  };
23
18
 
24
19
  export const checkSwcDependencies: Validator = async (context, parameters) => {
25
20
  const configEntry = context.config.getProject(parameters.target);
26
21
 
27
- const loader = extractLoaderFromConfigEntry((configEntry as any)?.experiments?.transpilation);
22
+ const loader = extractFieldFromConfigEntry<TranspilationLoader>(
23
+ (configEntry as any)?.experiments?.transpilation?.loader,
24
+ 'babel'
25
+ );
26
+ const minifier = extractFieldFromConfigEntry<Minifier>(
27
+ (configEntry as any)?.experiments?.minifier,
28
+ 'terser'
29
+ );
28
30
 
29
- if (loader === 'babel') {
31
+ if (!(loader === 'swc' || minifier === 'swc')) {
30
32
  return {
31
33
  name: validator,
32
34
  status: 'ok',
@@ -55,7 +57,7 @@ export const checkSwcDependencies: Validator = async (context, parameters) => {
55
57
  name: validator,
56
58
  status: 'error',
57
59
  message:
58
- '@swc/core or @tramvai/swc-integration module is not found. Continue without checking dependencies. Install @tramvai/swc-integration package in case if you use swc-loader',
60
+ '@swc/core or @tramvai/swc-integration module is not found. Continue without checking dependencies. Install @tramvai/swc-integration package in case if you use swc-loader/swc-minifier',
59
61
  };
60
62
  }
61
63