@tramvai/cli 5.46.1 → 5.47.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.
- package/lib/library/babel/index.d.ts +1 -1
- package/lib/library/babel/index.d.ts.map +1 -1
- package/lib/library/babel/index.js +5 -23
- package/lib/library/babel/index.js.map +1 -1
- package/lib/library/swc/index.d.ts.map +1 -1
- package/lib/library/swc/index.js +6 -20
- package/lib/library/swc/index.js.map +1 -1
- package/lib/library/webpack/application/client/common.d.ts.map +1 -1
- package/lib/library/webpack/application/client/common.js +6 -1
- package/lib/library/webpack/application/client/common.js.map +1 -1
- package/lib/library/webpack/plugins/PolyfillCondition.d.ts +8 -0
- package/lib/library/webpack/plugins/PolyfillCondition.d.ts.map +1 -0
- package/lib/library/webpack/plugins/PolyfillCondition.js +46 -0
- package/lib/library/webpack/plugins/PolyfillCondition.js.map +1 -0
- package/lib/library/webpack/utils/polyfills/const.d.ts +3 -0
- package/lib/library/webpack/utils/polyfills/const.d.ts.map +1 -0
- package/lib/library/webpack/utils/polyfills/const.js +49 -0
- package/lib/library/webpack/utils/polyfills/const.js.map +1 -0
- package/lib/library/webpack/utils/polyfills/polyfillCondition.d.ts +8 -0
- package/lib/library/webpack/utils/polyfills/polyfillCondition.d.ts.map +1 -0
- package/lib/library/webpack/utils/polyfills/polyfillCondition.js +51 -0
- package/lib/library/webpack/utils/polyfills/polyfillCondition.js.map +1 -0
- package/lib/library/webpack/utils/polyfills/specToFeature.d.ts +7 -0
- package/lib/library/webpack/utils/polyfills/specToFeature.d.ts.map +1 -0
- package/lib/library/webpack/utils/polyfills/specToFeature.js +207 -0
- package/lib/library/webpack/utils/polyfills/specToFeature.js.map +1 -0
- package/lib/library/webpack/utils/transpiler.d.ts +2 -0
- package/lib/library/webpack/utils/transpiler.d.ts.map +1 -1
- package/lib/library/webpack/utils/transpiler.js +25 -3
- package/lib/library/webpack/utils/transpiler.js.map +1 -1
- package/lib/schema/autogeneratedSchema.json +3 -6
- package/lib/typings/configEntry/cli.d.ts +1 -2
- package/lib/typings/configEntry/cli.d.ts.map +1 -1
- package/package.json +5 -3
- package/schema.json +3 -6
- package/src/library/babel/index.ts +5 -28
- package/src/library/babel/plugins/lazy-component/lazy-component.spec.ts +2 -1
- package/src/library/babel/plugins/lazy-component/legacy-universal-replace.spec.ts +2 -1
- package/src/library/swc/index.ts +7 -26
- package/src/library/webpack/application/client/common.ts +7 -1
- package/src/library/webpack/plugins/PolyfillCondition.ts +62 -0
- package/src/library/webpack/utils/polyfills/__integration__/__snapshots__/condition.test.ts.snap +1348 -0
- package/src/library/webpack/utils/polyfills/__integration__/condition.test.ts +128 -0
- package/src/library/webpack/utils/polyfills/const.ts +46 -0
- package/src/library/webpack/utils/polyfills/polyfillCondition.ts +63 -0
- package/src/library/webpack/utils/polyfills/specToFeature.ts +243 -0
- package/src/library/webpack/utils/transpiler.ts +32 -2
- package/src/schema/autogeneratedSchema.json +3 -6
- package/src/typings/configEntry/cli.ts +1 -2
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSpecToFeatureDict = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
6
|
+
const camelCaseName_1 = tslib_1.__importDefault(require("@tinkoff/utils/string/camelCaseName"));
|
|
7
|
+
const const_1 = require("./const");
|
|
8
|
+
// built-in-definitions.js file is not listed in the package.json exports of package, so it cannot be imported
|
|
9
|
+
// workaround this by using require with an absolute path to file
|
|
10
|
+
const pathToDep = require.resolve('babel-plugin-polyfill-corejs3/package.json');
|
|
11
|
+
const definitions = require(node_path_1.default.join(node_path_1.default.dirname(pathToDep), '/lib/built-in-definitions.js'));
|
|
12
|
+
// A list of new primitives, their support in browsers was added recently
|
|
13
|
+
const newPrimitivies = {
|
|
14
|
+
'weak-map': 'window.WeakMap',
|
|
15
|
+
'weak-set': 'window.WeakSet',
|
|
16
|
+
'async-disposable-stack': 'window.AsyncDisposableStack',
|
|
17
|
+
'disposable-stack': 'window.DisposableStack',
|
|
18
|
+
'suppressed-error': 'window.SuppressedError',
|
|
19
|
+
'web.immediate': 'window.setImmediate',
|
|
20
|
+
observable: 'window.Observable',
|
|
21
|
+
};
|
|
22
|
+
// A list of primitives for which there are no polyfills, but they are needed as a base for methods like JSON.stringify
|
|
23
|
+
const missingBuiltIns = {
|
|
24
|
+
...newPrimitivies,
|
|
25
|
+
'typed-array': 'window.Int8Array',
|
|
26
|
+
'uint8-array': 'window.Uint8Array',
|
|
27
|
+
string: 'window.String',
|
|
28
|
+
array: 'window.Array',
|
|
29
|
+
object: 'window.Object',
|
|
30
|
+
math: 'window.Math',
|
|
31
|
+
function: 'window.Function',
|
|
32
|
+
json: 'window.JSON',
|
|
33
|
+
};
|
|
34
|
+
// Exclude fetch builtin, because its treated as object.constructor
|
|
35
|
+
const excludedBuiltIns = ['fetch'];
|
|
36
|
+
const isBuiltInExcluded = (builtInName) => excludedBuiltIns.includes(builtInName);
|
|
37
|
+
// Exclude iterators
|
|
38
|
+
// we do not provide polyfills for them and their support check is much more complicated
|
|
39
|
+
// es.iterator, es.async-iterator, esnext.async-iterator, esnext.iterator
|
|
40
|
+
const isSpecExcluded = (specName) => /(es(next)?)?\.(async-)?iterator/.test(specName) || const_1.ignoredPolyfills.includes(specName);
|
|
41
|
+
const specToFeatureDict = {};
|
|
42
|
+
function _addFeature(specName, primitive, method, isInstance) {
|
|
43
|
+
if (specToFeatureDict[specName]) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
let checkExpression = isInstance
|
|
47
|
+
? `'${method}' in ${primitive}.prototype`
|
|
48
|
+
: `${primitive}.${method}`;
|
|
49
|
+
// For new primitives, we add a check for the existence of the primitive itself.
|
|
50
|
+
// for example WeakMap && WeakMap.from
|
|
51
|
+
// since WeakMap itself may not be supported in the browser, WeakMap check support may also be required
|
|
52
|
+
const isPrimitiveNew = Boolean(Object.values(newPrimitivies).includes(primitive));
|
|
53
|
+
if (isPrimitiveNew) {
|
|
54
|
+
checkExpression = `${primitive} && ${checkExpression}`;
|
|
55
|
+
}
|
|
56
|
+
specToFeatureDict[specName] = checkExpression;
|
|
57
|
+
specToFeatureDict[specName.replace('es.', 'esnext.')] = checkExpression;
|
|
58
|
+
}
|
|
59
|
+
const addStaticFeature = (specName, primitive, method) => _addFeature(specName, primitive, method, false);
|
|
60
|
+
const addInstanceFeature = (specName, primitive, method) => _addFeature(specName, primitive, method, true);
|
|
61
|
+
const methods = {};
|
|
62
|
+
function addMethod(specName, expression) {
|
|
63
|
+
methods[specName] = expression;
|
|
64
|
+
}
|
|
65
|
+
const instanceMethods = new Set(['web.url.to-json']);
|
|
66
|
+
const globals = new Set();
|
|
67
|
+
function _addGlobal(globalList, isInstance) {
|
|
68
|
+
globalList.forEach((globalSpecName) => {
|
|
69
|
+
globals.add(globalSpecName);
|
|
70
|
+
if (isInstance) {
|
|
71
|
+
instanceMethods.add(globalSpecName);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
const addInstanceGlobal = (globalList) => _addGlobal(globalList, true);
|
|
76
|
+
const addGlobal = (globalList) => _addGlobal(globalList, false);
|
|
77
|
+
/**
|
|
78
|
+
* For conversion, a dictionary of the form `spec: feature` needs to be created
|
|
79
|
+
* we use a file from babel-plugin-polyfill-corejs3 for this - https://github.com/babel/babel-polyfills/blob/main/packages/babel-plugin-polyfill-corejs3/src/built-in-definitions.ts
|
|
80
|
+
* as a result we get dictinary like { 'es.array.at: 'Array.prototype.at', 'es.object.assign': 'Object.assign' }
|
|
81
|
+
*/
|
|
82
|
+
function getSpecToFeatureDict() {
|
|
83
|
+
const { BuiltIns, InstanceProperties, StaticProperties } = definitions;
|
|
84
|
+
// JS primitives: Number, Reflect, Set, Map...
|
|
85
|
+
const builtIns = Object.keys(BuiltIns).reduce((acc, builtInKey) => {
|
|
86
|
+
const { name: builtInName, global } = BuiltIns[builtInKey];
|
|
87
|
+
if (isBuiltInExcluded(builtInKey))
|
|
88
|
+
return acc;
|
|
89
|
+
addGlobal(global);
|
|
90
|
+
const removeBaseMethodNames = (builtInName) => builtInName.replace('.constructor', '').replace('.to-string', '');
|
|
91
|
+
acc[removeBaseMethodNames(builtInName)] = `window.${builtInKey}`;
|
|
92
|
+
acc[removeBaseMethodNames(builtInName).replace('es.', 'esnext.')] = `window.${builtInKey}`;
|
|
93
|
+
return acc;
|
|
94
|
+
}, {});
|
|
95
|
+
// Some primitives are missing, so we add them manually
|
|
96
|
+
Object.keys(missingBuiltIns).forEach((missingBuiltInName) => {
|
|
97
|
+
builtIns[`es.${missingBuiltInName}`] = `${missingBuiltIns[missingBuiltInName]}`;
|
|
98
|
+
builtIns[`esnext.${missingBuiltInName}`] = `${missingBuiltIns[missingBuiltInName]}`;
|
|
99
|
+
});
|
|
100
|
+
function parseSpec(spec) {
|
|
101
|
+
// es.string.push
|
|
102
|
+
const splitName = spec.split('.');
|
|
103
|
+
// es.string
|
|
104
|
+
const builtInName = splitName.slice(0, -1).join('.');
|
|
105
|
+
// String
|
|
106
|
+
const primitiveExpr = builtIns[builtInName];
|
|
107
|
+
// push
|
|
108
|
+
const methodName = splitName.at(-1);
|
|
109
|
+
return {
|
|
110
|
+
builtInName,
|
|
111
|
+
primitiveExpr,
|
|
112
|
+
methodName,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
// Instance methods, for example [1, 2, 3].at(), 'some_string'.toLowerCase()...
|
|
116
|
+
Object.keys(InstanceProperties).forEach((instancePropertyName) => {
|
|
117
|
+
const { name: instanceSpecName, global } = InstanceProperties[instancePropertyName];
|
|
118
|
+
if (isSpecExcluded(instanceSpecName))
|
|
119
|
+
return;
|
|
120
|
+
const { primitiveExpr, methodName } = parseSpec(instanceSpecName);
|
|
121
|
+
addMethod(methodName, instancePropertyName);
|
|
122
|
+
addInstanceGlobal(global);
|
|
123
|
+
// Some instance methods have no parent
|
|
124
|
+
// for example Symbol.constructor is es.Symbol
|
|
125
|
+
if (!primitiveExpr)
|
|
126
|
+
return;
|
|
127
|
+
addInstanceFeature(instanceSpecName, primitiveExpr, instancePropertyName);
|
|
128
|
+
});
|
|
129
|
+
// Static methods for example Object.assign(), RegExp.escape()...
|
|
130
|
+
Object.keys(StaticProperties).forEach((primitiveName) => {
|
|
131
|
+
const staticPrimitiveProperties = StaticProperties[primitiveName];
|
|
132
|
+
Object.keys(staticPrimitiveProperties).forEach((staticPropertyName) => {
|
|
133
|
+
const { name: staticSpecName, global } = staticPrimitiveProperties[staticPropertyName];
|
|
134
|
+
if (isSpecExcluded(staticSpecName))
|
|
135
|
+
return;
|
|
136
|
+
const { methodName } = parseSpec(staticSpecName);
|
|
137
|
+
addGlobal(global);
|
|
138
|
+
addMethod(methodName, staticPropertyName);
|
|
139
|
+
// For some reason, several static properties have names that match a builtin
|
|
140
|
+
// we ignore such properties since their support in browsers appeared at the same time as the builtin itself
|
|
141
|
+
// for example Promise and Promise.all
|
|
142
|
+
if (builtIns[staticSpecName])
|
|
143
|
+
return;
|
|
144
|
+
addStaticFeature(staticSpecName, primitiveName, staticPropertyName);
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
function isFeatureExists(specName) {
|
|
148
|
+
return Boolean(builtIns[specName]) || Boolean(specToFeatureDict[specName]);
|
|
149
|
+
}
|
|
150
|
+
// Each spec has a list of globals, which also need to be converted into an expression for support check
|
|
151
|
+
// but not all globals can have their method name determined unambiguously
|
|
152
|
+
[...globals].forEach((globalSpecName) => {
|
|
153
|
+
if (!isFeatureExists(globalSpecName)) {
|
|
154
|
+
if (isSpecExcluded(globalSpecName))
|
|
155
|
+
return;
|
|
156
|
+
const { methodName, primitiveExpr, builtInName } = parseSpec(globalSpecName);
|
|
157
|
+
// es.array-buffer.from
|
|
158
|
+
const globalNameSplit = globalSpecName.split('.');
|
|
159
|
+
// Trying to find a support check expression for a method from the already bypassed spec
|
|
160
|
+
// for example, array and typed-array have the findLastIndex method, but typed-array is listed in global
|
|
161
|
+
const featureMethod = methodName === 'constructor' ? 'constructor' : methods[methodName];
|
|
162
|
+
// We consider a method to be simple if its name does not contain a '-'
|
|
163
|
+
// every, filter, map can be left as it is, the method in the language is called the same way
|
|
164
|
+
const isMethodSimple = !/-/.test(methodName);
|
|
165
|
+
// Primitives don't have a method, so its length is 2
|
|
166
|
+
// for example es.symbol или es.string
|
|
167
|
+
const isPrimitive = globalNameSplit.length === 2;
|
|
168
|
+
if (isPrimitive) {
|
|
169
|
+
builtIns[globalSpecName] = `${BuiltIns[globalSpecName]}`;
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
// Trying to determine the type of method from global static or instance
|
|
173
|
+
const globalInstancePrimitives = [
|
|
174
|
+
'es.array-buffer',
|
|
175
|
+
'es.typed-array',
|
|
176
|
+
'es.symbol',
|
|
177
|
+
'web.url-search-params',
|
|
178
|
+
'esnext.weak-map',
|
|
179
|
+
'esnext.weak-set',
|
|
180
|
+
'uint8-array',
|
|
181
|
+
];
|
|
182
|
+
const isInstanceMethod = globalInstancePrimitives.includes(builtInName) || instanceMethods.has(globalSpecName);
|
|
183
|
+
let method;
|
|
184
|
+
if (featureMethod) {
|
|
185
|
+
method = featureMethod;
|
|
186
|
+
}
|
|
187
|
+
else if (isMethodSimple) {
|
|
188
|
+
method = methodName;
|
|
189
|
+
}
|
|
190
|
+
else if (primitiveExpr) {
|
|
191
|
+
// couldn't find a similar method in the original list and it contains '-'
|
|
192
|
+
// speculatively translating it to camelCase web.url.can-parse => URL.canParse
|
|
193
|
+
method = (0, camelCaseName_1.default)(methodName);
|
|
194
|
+
}
|
|
195
|
+
isInstanceMethod
|
|
196
|
+
? addInstanceFeature(globalSpecName, primitiveExpr, method)
|
|
197
|
+
: addStaticFeature(globalSpecName, primitiveExpr, method);
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
return fixBrokenSpec({ ...builtIns, ...specToFeatureDict });
|
|
201
|
+
}
|
|
202
|
+
exports.getSpecToFeatureDict = getSpecToFeatureDict;
|
|
203
|
+
function fixBrokenSpec(specs) {
|
|
204
|
+
specs['es.string.italics'] = "'italics' in window.String.prototype";
|
|
205
|
+
return specs;
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=specToFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specToFeature.js","sourceRoot":"","sources":["../../../../../src/library/webpack/utils/polyfills/specToFeature.ts"],"names":[],"mappings":";;;;AAAA,kEAA6B;AAC7B,gGAAgE;AAChE,mCAA2C;AAE3C,8GAA8G;AAC9G,iEAAiE;AACjE,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,4CAA4C,CAAC,CAAC;AAChF,MAAM,WAAW,GAAG,OAAO,CAAC,mBAAI,CAAC,IAAI,CAAC,mBAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,8BAA8B,CAAC,CAAC,CAAC;AAEhG,yEAAyE;AACzE,MAAM,cAAc,GAAG;IACrB,UAAU,EAAE,gBAAgB;IAC5B,UAAU,EAAE,gBAAgB;IAC5B,wBAAwB,EAAE,6BAA6B;IACvD,kBAAkB,EAAE,wBAAwB;IAC5C,kBAAkB,EAAE,wBAAwB;IAC5C,eAAe,EAAE,qBAAqB;IACtC,UAAU,EAAE,mBAAmB;CAChC,CAAC;AAEF,uHAAuH;AACvH,MAAM,eAAe,GAAG;IACtB,GAAG,cAAc;IACjB,aAAa,EAAE,kBAAkB;IACjC,aAAa,EAAE,mBAAmB;IAClC,MAAM,EAAE,eAAe;IACvB,KAAK,EAAE,cAAc;IACrB,MAAM,EAAE,eAAe;IACvB,IAAI,EAAE,aAAa;IACnB,QAAQ,EAAE,iBAAiB;IAC3B,IAAI,EAAE,aAAa;CACpB,CAAC;AAEF,mEAAmE;AACnE,MAAM,gBAAgB,GAAG,CAAC,OAAO,CAAC,CAAC;AACnC,MAAM,iBAAiB,GAAG,CAAC,WAAW,EAA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CAAC,WAAW,CAAC,IAAI,eAAe,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAExF,IAAI,MAAc,CAAC;YACnB,IAAI,aAAa,EAAE;gBACjB,MAAM,GAAG,aAAa,CAAC;aACxB;iBAAM,IAAI,cAAc,EAAE;gBACzB,MAAM,GAAG,UAAU,CAAC;aACrB;iBAAM,IAAI,aAAa,EAAE;gBACxB,0EAA0E;gBAC1E,8EAA8E;gBAC9E,MAAM,GAAG,IAAA,uBAAa,EAAC,UAAU,CAAC,CAAC;aACpC;YAED,gBAAgB;gBACd,CAAC,CAAC,kBAAkB,CAAC,cAAc,EAAE,aAAa,EAAE,MAAM,CAAC;gBAC3D,CAAC,CAAC,gBAAgB,CAAC,cAAc,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;SAC7D;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,aAAa,CAAC,EAAE,GAAG,QAAQ,EAAE,GAAG,iBAAiB,EAAE,CAAC,CAAC;AAC9D,CAAC;AA/ID,oDA+IC;AAED,SAAS,aAAa,CAAC,KAA6B;IAClD,KAAK,CAAC,mBAAmB,CAAC,GAAG,sCAAsC,CAAC;IACpE,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -6,6 +6,7 @@ import type { CliConfigEntry, ReactCompilerOptions } from '../../../typings/conf
|
|
|
6
6
|
export type TranspilerConfig = {
|
|
7
7
|
env: Env;
|
|
8
8
|
target: Target;
|
|
9
|
+
actualTarget: Target;
|
|
9
10
|
modern: boolean;
|
|
10
11
|
isServer: boolean;
|
|
11
12
|
generateDataQaTag: boolean;
|
|
@@ -19,6 +20,7 @@ export type TranspilerConfig = {
|
|
|
19
20
|
hot: boolean;
|
|
20
21
|
excludesPresetEnv: string[];
|
|
21
22
|
rootDir: string;
|
|
23
|
+
browsersListTargets: string[];
|
|
22
24
|
reactCompiler: boolean | ReactCompilerOptions;
|
|
23
25
|
/**
|
|
24
26
|
* Enable or disable `loose` transformations:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transpiler.d.ts","sourceRoot":"","sources":["../../../../src/library/webpack/utils/transpiler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"transpiler.d.ts","sourceRoot":"","sources":["../../../../src/library/webpack/utils/transpiler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAGnE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAE7F,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,GAAG,CAAC;IACT,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,0BAA0B,EAAE,OAAO,CAAC;IACpC,iCAAiC,EAAE,OAAO,CAAC;IAC3C,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,KAAK,GAAG,UAAU,GAAG,KAAK,CAAC;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;IACb,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,aAAa,EAAE,OAAO,GAAG,oBAAoB,CAAC;IAC9C;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,mBAAmB,kBACd,cAAc,cAAc,CAAC,oBAAoB,gBAAgB,YAC1E,OAAO,GAAG,gBAkBhB,CAAC;AAEJ,eAAO,MAAM,mBAAmB,kBACf,cAAc,cAAc,CAAC,oBAC3B,QAAQ,gBAAgB,CAAC,KACzC,gBA4DF,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTranspilerConfig = exports.addTranspilerLoader = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const resolve_1 = require("resolve");
|
|
6
|
+
const browserslist_config_1 = tslib_1.__importDefault(require("@tinkoff/browserslist-config"));
|
|
7
|
+
const browserslist_1 = tslib_1.__importDefault(require("browserslist"));
|
|
5
8
|
const swc_1 = require("../../swc");
|
|
6
9
|
const babel_1 = require("../../babel");
|
|
7
10
|
const addTranspilerLoader = (configManager, transpilerConfig) => (rule) => {
|
|
@@ -23,14 +26,31 @@ Please run "npx tramvai add --dev @tramvai/swc-integration" to fix the problem
|
|
|
23
26
|
};
|
|
24
27
|
exports.addTranspilerLoader = addTranspilerLoader;
|
|
25
28
|
const getTranspilerConfig = (configManager, overrideOptions = {}) => {
|
|
26
|
-
const { generateDataQaTag, alias, enableFillActionNamePlugin, excludesPresetEnv, experiments: { enableFillDeclareActionNamePlugin, reactCompiler }, } = configManager;
|
|
29
|
+
const { generateDataQaTag, alias, target, rootDir, enableFillActionNamePlugin, excludesPresetEnv, experiments: { enableFillDeclareActionNamePlugin, reactCompiler }, } = configManager;
|
|
27
30
|
const { env, modern } = configManager;
|
|
31
|
+
const isServer = configManager.buildType === 'server';
|
|
28
32
|
if (alias) {
|
|
29
33
|
console.warn(`"alias" option deprecated and ignored as cli now supports baseUrl and paths from the app's tsconfig.json file.
|
|
30
34
|
Just check or add configuration to your tsconfig file and remove alias from tramvai.json`);
|
|
31
35
|
}
|
|
36
|
+
let actualTarget = target;
|
|
37
|
+
if (!target) {
|
|
38
|
+
if (isServer) {
|
|
39
|
+
actualTarget = 'node';
|
|
40
|
+
}
|
|
41
|
+
else if (modern) {
|
|
42
|
+
actualTarget = 'modern';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const browserslistConfigRaw = browserslist_1.default.findConfig(rootDir);
|
|
46
|
+
// Set defaults if the explicit config for browserslist was not found or the config does not contain the necessary targets
|
|
47
|
+
const browserslistQuery = browserslistConfigRaw?.[actualTarget] ?? browserslist_config_1.default[actualTarget] ?? browserslist_config_1.default.defaults;
|
|
48
|
+
const browsersListTargets = (0, browserslist_1.default)(browserslistQuery, {
|
|
49
|
+
mobileToDesktop: true,
|
|
50
|
+
env: actualTarget,
|
|
51
|
+
});
|
|
32
52
|
return {
|
|
33
|
-
isServer
|
|
53
|
+
isServer,
|
|
34
54
|
env,
|
|
35
55
|
generateDataQaTag,
|
|
36
56
|
modern,
|
|
@@ -40,7 +60,9 @@ Just check or add configuration to your tsconfig file and remove alias from tram
|
|
|
40
60
|
excludesPresetEnv,
|
|
41
61
|
enableFillActionNamePlugin,
|
|
42
62
|
rootDir: configManager.rootDir,
|
|
43
|
-
target
|
|
63
|
+
target,
|
|
64
|
+
actualTarget,
|
|
65
|
+
browsersListTargets,
|
|
44
66
|
loader: true,
|
|
45
67
|
modules: false,
|
|
46
68
|
typescript: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transpiler.js","sourceRoot":"","sources":["../../../../src/library/webpack/utils/transpiler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transpiler.js","sourceRoot":"","sources":["../../../../src/library/webpack/utils/transpiler.ts"],"names":[],"mappings":";;;;AACA,qCAA0C;AAC1C,+FAAsD;AACtD,wEAAwC;AAExC,mCAA0C;AAC1C,uCAAiD;AAsC1C,MAAM,mBAAmB,GAC9B,CAAC,aAA4C,EA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AAE;YACZ,YAAY,GAAG,MAAM,CAAC;SACvB;aAAM,IAAI,MAAM,EAAE;YACjB,YAAY,GAAG,QAAQ,CAAC;SACzB;KACF;IAED,MAAM,qBAAqB,GAAG,sBAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAE/D,0HAA0H;IAC1H,MAAM,iBAAiB,GACrB,qBAAqB,EAAE,CAAC,YAAY,CAAC,IAAI,6BAAU,CAAC,YAAY,CAAC,IAAI,6BAAU,CAAC,QAAQ,CAAC;IAE3F,MAAM,mBAAmB,GAAG,IAAA,sBAAY,EAAC,iBAAiB,EAAE;QAC1D,eAAe,EAAE,IAAI;QACrB,GAAG,EAAE,YAAY;KAClB,CAAC,CAAC;IAEH,OAAO;QACL,QAAQ;QACR,GAAG;QACH,iBAAiB;QACjB,MAAM;QACN,OAAO,EAAE,IAAI;QACb,kBAAkB,EAAE,IAAI;QACxB,GAAG,EAAE,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,OAAO;QACvC,iBAAiB;QACjB,0BAA0B;QAC1B,OAAO,EAAE,aAAa,CAAC,OAAO;QAC9B,MAAM;QACN,YAAY;QACZ,mBAAmB;QACnB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,KAAK;QACd,UAAU,EAAE,KAAK;QACjB,iCAAiC;QACjC,aAAa;QACb,GAAG,eAAe;KACnB,CAAC;AACJ,CAAC,CAAC;AA/DW,QAAA,mBAAmB,uBA+D9B"}
|
|
@@ -1016,8 +1016,7 @@
|
|
|
1016
1016
|
]
|
|
1017
1017
|
},
|
|
1018
1018
|
"excludesPresetEnv": {
|
|
1019
|
-
"title": "List of modules to exclude from `@babel/preset-env`",
|
|
1020
|
-
"description": "Option doesn't affect build with swc loader",
|
|
1019
|
+
"title": "List of modules to exclude from `@babel/preset-env` and `swc-loader`",
|
|
1021
1020
|
"type": "array",
|
|
1022
1021
|
"items": {
|
|
1023
1022
|
"type": "string"
|
|
@@ -1808,8 +1807,7 @@
|
|
|
1808
1807
|
"additionalProperties": false
|
|
1809
1808
|
},
|
|
1810
1809
|
"excludesPresetEnv": {
|
|
1811
|
-
"title": "List of modules to exclude from `@babel/preset-env`",
|
|
1812
|
-
"description": "Option doesn't affect build with swc loader",
|
|
1810
|
+
"title": "List of modules to exclude from `@babel/preset-env` and `swc-loader`",
|
|
1813
1811
|
"type": "array",
|
|
1814
1812
|
"items": {
|
|
1815
1813
|
"type": "string"
|
|
@@ -2560,8 +2558,7 @@
|
|
|
2560
2558
|
"additionalProperties": false
|
|
2561
2559
|
},
|
|
2562
2560
|
"excludesPresetEnv": {
|
|
2563
|
-
"title": "List of modules to exclude from `@babel/preset-env`",
|
|
2564
|
-
"description": "Option doesn't affect build with swc loader",
|
|
2561
|
+
"title": "List of modules to exclude from `@babel/preset-env` and `swc-loader`",
|
|
2565
2562
|
"type": "array",
|
|
2566
2563
|
"items": {
|
|
2567
2564
|
"type": "string"
|
|
@@ -125,8 +125,7 @@ export interface CliConfigEntry extends ConfigEntry {
|
|
|
125
125
|
*/
|
|
126
126
|
experiments: Experiments;
|
|
127
127
|
/**
|
|
128
|
-
* @title List of modules to exclude from `@babel/preset-env`
|
|
129
|
-
* @description Option doesn't affect build with swc loader
|
|
128
|
+
* @title List of modules to exclude from `@babel/preset-env` and `swc-loader`
|
|
130
129
|
*/
|
|
131
130
|
excludesPresetEnv?: string[];
|
|
132
131
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/typings/configEntry/cli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE/D,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,KAAK,CAAC;AAClD,MAAM,MAAM,QAAQ,GAAG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AAI,EAAE,KAAK,CACP,MAAM,GACN;YACE;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YACb;;;;eAIG;YACH,SAAS,EAAE,OAAO,CAAC;SACpB,CACJ,CAAC;KACH,CAAC;CACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.47.0",
|
|
4
4
|
"description": "Cli инструмент для сборки и запуска приложений",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@tinkoff/utils": "^2.1.3",
|
|
76
76
|
"@tinkoff/webpack-dedupe-plugin": "4.0.3",
|
|
77
77
|
"@tramvai/build": "6.1.1",
|
|
78
|
-
"@tramvai/react": "5.
|
|
78
|
+
"@tramvai/react": "5.47.0",
|
|
79
79
|
"@tramvai/tools-check-versions": "0.7.7",
|
|
80
80
|
"@tramvai/tools-migrate": "0.9.8",
|
|
81
81
|
"ajv": "^8.12.0",
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
"autoprefixer": "^10.4.8",
|
|
84
84
|
"babel-loader": "^8.2.5",
|
|
85
85
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
86
|
+
"babel-plugin-polyfill-corejs3": "^0.11.1",
|
|
86
87
|
"babel-plugin-transform-define": "^2.0.1",
|
|
87
88
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
88
89
|
"boxen": "^4.2.0",
|
|
@@ -92,7 +93,8 @@
|
|
|
92
93
|
"chokidar": "^3.6.0",
|
|
93
94
|
"commander": "^6.2.1",
|
|
94
95
|
"compression": "^1.7.4",
|
|
95
|
-
"core-js": "
|
|
96
|
+
"core-js": "3.40.0",
|
|
97
|
+
"core-js-compat": "3.40.0",
|
|
96
98
|
"css-class-generator": "^2.0.0",
|
|
97
99
|
"css-loader": "^6.7.1",
|
|
98
100
|
"css-minimizer-webpack-plugin": "^5.0.1",
|
package/schema.json
CHANGED
|
@@ -1038,8 +1038,7 @@
|
|
|
1038
1038
|
]
|
|
1039
1039
|
},
|
|
1040
1040
|
"excludesPresetEnv": {
|
|
1041
|
-
"title": "List of modules to exclude from `@babel/preset-env`",
|
|
1042
|
-
"description": "Option doesn't affect build with swc loader",
|
|
1041
|
+
"title": "List of modules to exclude from `@babel/preset-env` and `swc-loader`",
|
|
1043
1042
|
"type": "array",
|
|
1044
1043
|
"items": {
|
|
1045
1044
|
"type": "string"
|
|
@@ -1839,8 +1838,7 @@
|
|
|
1839
1838
|
"additionalProperties": false
|
|
1840
1839
|
},
|
|
1841
1840
|
"excludesPresetEnv": {
|
|
1842
|
-
"title": "List of modules to exclude from `@babel/preset-env`",
|
|
1843
|
-
"description": "Option doesn't affect build with swc loader",
|
|
1841
|
+
"title": "List of modules to exclude from `@babel/preset-env` and `swc-loader`",
|
|
1844
1842
|
"type": "array",
|
|
1845
1843
|
"items": {
|
|
1846
1844
|
"type": "string"
|
|
@@ -2600,8 +2598,7 @@
|
|
|
2600
2598
|
"additionalProperties": false
|
|
2601
2599
|
},
|
|
2602
2600
|
"excludesPresetEnv": {
|
|
2603
|
-
"title": "List of modules to exclude from `@babel/preset-env`",
|
|
2604
|
-
"description": "Option doesn't affect build with swc loader",
|
|
2601
|
+
"title": "List of modules to exclude from `@babel/preset-env` and `swc-loader`",
|
|
2605
2602
|
"type": "array",
|
|
2606
2603
|
"items": {
|
|
2607
2604
|
"type": "string"
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
import browserslist from 'browserslist';
|
|
3
|
-
import envTargets from '@tinkoff/browserslist-config';
|
|
4
2
|
import { sync as resolve } from 'resolve';
|
|
5
3
|
import type { TransformOptions } from '@babel/core';
|
|
6
4
|
|
|
@@ -33,10 +31,9 @@ function hasJsxRuntime() {
|
|
|
33
31
|
// eslint-disable-next-line complexity
|
|
34
32
|
export const babelConfigFactory = ({
|
|
35
33
|
env = 'development',
|
|
36
|
-
target,
|
|
37
|
-
modern,
|
|
38
34
|
isServer = false,
|
|
39
35
|
modules = false,
|
|
36
|
+
actualTarget,
|
|
40
37
|
generateDataQaTag = true,
|
|
41
38
|
enableFillActionNamePlugin = false,
|
|
42
39
|
enableFillDeclareActionNamePlugin = false,
|
|
@@ -49,32 +46,12 @@ export const babelConfigFactory = ({
|
|
|
49
46
|
tramvai = false,
|
|
50
47
|
hot = false,
|
|
51
48
|
excludesPresetEnv,
|
|
52
|
-
|
|
49
|
+
browsersListTargets,
|
|
53
50
|
reactCompiler = false,
|
|
54
51
|
loose = true,
|
|
55
52
|
externalHelpers = true,
|
|
56
53
|
}: Partial<TranspilerConfig>) => {
|
|
57
54
|
const cfg = envConfig[env] || {};
|
|
58
|
-
let resultTarget = target;
|
|
59
|
-
|
|
60
|
-
if (!target) {
|
|
61
|
-
if (isServer) {
|
|
62
|
-
resultTarget = 'node';
|
|
63
|
-
} else if (modern) {
|
|
64
|
-
resultTarget = 'modern';
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const browserslistConfigRaw = browserslist.findConfig(rootDir);
|
|
69
|
-
|
|
70
|
-
// выставляем дефолты если явный конфиг для browserslist не был найден или в нём нет нужного targets
|
|
71
|
-
const browserslistQuery =
|
|
72
|
-
browserslistConfigRaw?.[resultTarget] ?? envTargets[resultTarget] ?? envTargets.defaults;
|
|
73
|
-
|
|
74
|
-
const targets = browserslist(browserslistQuery, {
|
|
75
|
-
mobileToDesktop: true,
|
|
76
|
-
env: resultTarget,
|
|
77
|
-
});
|
|
78
55
|
|
|
79
56
|
const babelConfig = {
|
|
80
57
|
// по умолчанию sourceType: 'module' и тогда бабель рассматривает все файлы как es-модули, что может
|
|
@@ -104,9 +81,9 @@ export const babelConfigFactory = ({
|
|
|
104
81
|
corejs: require('core-js/package.json').version,
|
|
105
82
|
// TODO: will be deprecated in babel@8 - https://babeljs.io/docs/babel-preset-env#loose
|
|
106
83
|
loose,
|
|
107
|
-
targets,
|
|
108
|
-
browserslistEnv:
|
|
109
|
-
bugfixes:
|
|
84
|
+
targets: browsersListTargets,
|
|
85
|
+
browserslistEnv: actualTarget,
|
|
86
|
+
bugfixes: actualTarget === 'modern',
|
|
110
87
|
exclude: excludesPresetEnv,
|
|
111
88
|
},
|
|
112
89
|
],
|
package/src/library/swc/index.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import isEmpty from '@tinkoff/utils/is/empty';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { existsSync } from 'fs';
|
|
4
|
-
import browserslist from 'browserslist';
|
|
5
|
-
import envTargets from '@tinkoff/browserslist-config';
|
|
6
4
|
import { sync as resolve } from 'resolve';
|
|
7
5
|
import findCacheDir from 'find-cache-dir';
|
|
8
6
|
import type { Options as SwcOptions } from '@swc/core';
|
|
@@ -16,10 +14,10 @@ let warningWasShown = false;
|
|
|
16
14
|
export const getSwcOptions = (config: TranspilerConfig): SwcOptions => {
|
|
17
15
|
const {
|
|
18
16
|
env = 'development',
|
|
19
|
-
target,
|
|
20
|
-
modern,
|
|
21
17
|
isServer = false,
|
|
22
18
|
modules = false,
|
|
19
|
+
excludesPresetEnv,
|
|
20
|
+
browsersListTargets,
|
|
23
21
|
typescript = false,
|
|
24
22
|
hot = false,
|
|
25
23
|
removeTypeofWindow,
|
|
@@ -82,34 +80,17 @@ Having swc config may conflict with @tramvai/cli configuration`
|
|
|
82
80
|
}
|
|
83
81
|
}
|
|
84
82
|
|
|
85
|
-
let resultTarget = target;
|
|
86
|
-
|
|
87
|
-
if (!target) {
|
|
88
|
-
if (isServer) {
|
|
89
|
-
resultTarget = 'node';
|
|
90
|
-
} else if (modern) {
|
|
91
|
-
resultTarget = 'modern';
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const browserslistConfigRaw = browserslist.findConfig(rootDir);
|
|
96
|
-
|
|
97
|
-
// выставляем дефолты если явный конфиг для browserslist не был найден или в нём нет нужного targets
|
|
98
|
-
const browserslistQuery =
|
|
99
|
-
browserslistConfigRaw?.[resultTarget] ?? envTargets[resultTarget] ?? envTargets.defaults;
|
|
100
|
-
|
|
101
|
-
const targets = browserslist(browserslistQuery, {
|
|
102
|
-
mobileToDesktop: true,
|
|
103
|
-
env: resultTarget,
|
|
104
|
-
});
|
|
105
|
-
|
|
106
83
|
return {
|
|
107
84
|
env: {
|
|
108
|
-
targets,
|
|
85
|
+
targets: browsersListTargets,
|
|
109
86
|
// Use relevant core-js version, because it affects which polyfills are included
|
|
110
87
|
// https://github.com/swc-project/swc/blob/main/crates/swc_ecma_preset_env/data/core-js-compat/modules-by-versions.json
|
|
111
88
|
coreJs: require('core-js/package.json').version,
|
|
89
|
+
// disabled because `arrayLikeIsIterable` and `iterableIsArray` assumtions is not supported yet in swc,
|
|
90
|
+
// this can leads to incorrect code generation e.g. when Set with spread is used - `[...new Set()] => [].concat(new Set())`
|
|
91
|
+
// TCORE-4904
|
|
112
92
|
loose,
|
|
93
|
+
exclude: excludesPresetEnv,
|
|
113
94
|
mode: 'entry',
|
|
114
95
|
},
|
|
115
96
|
module: {
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
WEBPACK_DEBUG_STATS_FIELDS,
|
|
28
28
|
} from '../../constants/stats';
|
|
29
29
|
import { pwaBlock } from '../../blocks/pwa/client';
|
|
30
|
+
import PolyfillConditionPlugin from '../../plugins/PolyfillCondition';
|
|
30
31
|
|
|
31
32
|
export default (configManager: ConfigManager<ApplicationConfigEntry>) => (config: Config) => {
|
|
32
33
|
const { polyfill, fileSystemPages, env } = configManager;
|
|
@@ -59,11 +60,13 @@ export default (configManager: ConfigManager<ApplicationConfigEntry>) => (config
|
|
|
59
60
|
.when(portalExists, (cfg) => cfg.entry('portal').add(portal))
|
|
60
61
|
.when(polyfillExists, (cfg) => cfg.entry('polyfill').add(polyfillPath));
|
|
61
62
|
|
|
63
|
+
const statsFileName = configManager.modern ? 'stats.modern.json' : 'stats.json';
|
|
64
|
+
|
|
62
65
|
config
|
|
63
66
|
.plugin('stats-plugin')
|
|
64
67
|
.use(StatsWriterPlugin, [
|
|
65
68
|
{
|
|
66
|
-
filename:
|
|
69
|
+
filename: statsFileName,
|
|
67
70
|
stats: {
|
|
68
71
|
...(env === 'development' ? DEV_STATS_OPTIONS : DEFAULT_STATS_OPTIONS),
|
|
69
72
|
...(configManager.verboseWebpack ? WEBPACK_DEBUG_STATS_OPTIONS : {}),
|
|
@@ -75,6 +78,9 @@ export default (configManager: ConfigManager<ApplicationConfigEntry>) => (config
|
|
|
75
78
|
},
|
|
76
79
|
])
|
|
77
80
|
.end()
|
|
81
|
+
.plugin('polyfill-condition-plugin')
|
|
82
|
+
.use(PolyfillConditionPlugin, [{ filename: statsFileName }])
|
|
83
|
+
.end()
|
|
78
84
|
.plugin('define')
|
|
79
85
|
.tap((args) => [
|
|
80
86
|
{
|