@tramvai/cli 2.48.3 → 2.49.2
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/api/benchmark/start.js +5 -7
- package/lib/api/benchmark/start.js.map +1 -1
- package/lib/api/start/providers/child-app/shared.js +1 -1
- package/lib/api/start/providers/child-app/shared.js.map +1 -1
- package/lib/api/start/providers/module/shared.js +1 -1
- package/lib/api/start/providers/module/shared.js.map +1 -1
- package/lib/builder/webpack/providers/shared.js +1 -1
- package/lib/builder/webpack/providers/shared.js.map +1 -1
- package/lib/library/babel/index.d.ts +6 -25
- package/lib/library/babel/index.js +3 -3
- package/lib/library/babel/index.js.map +1 -1
- package/lib/library/swc/index.d.ts +2 -18
- package/lib/library/swc/index.js +31 -5
- package/lib/library/swc/index.js.map +1 -1
- package/lib/library/typescript/index.d.ts +1 -1
- package/lib/library/webpack/blocks/js.js +7 -8
- package/lib/library/webpack/blocks/js.js.map +1 -1
- package/lib/library/webpack/blocks/resolve.js +13 -0
- package/lib/library/webpack/blocks/resolve.js.map +1 -1
- package/lib/library/webpack/blocks/ts.js +6 -2
- package/lib/library/webpack/blocks/ts.js.map +1 -1
- package/lib/library/webpack/utils/transpiler.d.ts +13 -7
- package/lib/library/webpack/utils/transpiler.js +5 -14
- package/lib/library/webpack/utils/transpiler.js.map +1 -1
- package/lib/library/webpack/utils/workersPool.d.ts +2 -2
- package/lib/library/webpack/utils/workersPool.js +24 -19
- package/lib/library/webpack/utils/workersPool.js.map +1 -1
- package/lib/schema/autogeneratedSchema.json +9 -9
- package/lib/typings/configEntry/common.d.ts +5 -3
- package/package.json +3 -2
- package/schema.json +9 -9
- package/src/api/benchmark/start.ts +6 -9
- package/src/api/start/providers/child-app/shared.ts +2 -2
- package/src/api/start/providers/module/shared.ts +2 -2
- package/src/builder/webpack/providers/shared.ts +2 -2
- package/src/commands/new/templates/app/multirepo/tramvai.json.hbs +0 -9
- package/src/commands/new/templates/child-app/multirepo/tramvai.json.hbs +0 -9
- package/src/library/babel/index.ts +4 -24
- package/src/library/swc/index.ts +54 -32
- package/src/library/webpack/blocks/js.ts +9 -10
- package/src/library/webpack/blocks/resolve.ts +15 -0
- package/src/library/webpack/blocks/ts.ts +7 -3
- package/src/library/webpack/utils/transpiler.ts +37 -5
- package/src/library/webpack/utils/workersPool.ts +20 -16
- package/src/schema/autogeneratedSchema.json +9 -9
- package/src/schema/tramvai.spec.ts +4 -4
- package/src/typings/configEntry/common.ts +5 -3
|
@@ -3,11 +3,31 @@ import { sync as resolve } from 'resolve';
|
|
|
3
3
|
import type { ConfigManager } from '../../../config/configManager';
|
|
4
4
|
import { getSwcOptions } from '../../swc';
|
|
5
5
|
import babelConfig from '../../babel';
|
|
6
|
+
import type { Env } from '../../../typings/Env';
|
|
7
|
+
import type { Target } from '../../../typings/target';
|
|
8
|
+
|
|
9
|
+
export type TranspilerConfig = {
|
|
10
|
+
env: Env;
|
|
11
|
+
target: Target;
|
|
12
|
+
modern: boolean;
|
|
13
|
+
isServer: boolean;
|
|
14
|
+
generateDataQaTag: boolean;
|
|
15
|
+
enableFillActionNamePlugin: boolean;
|
|
16
|
+
typescript: boolean;
|
|
17
|
+
modules: 'es6' | 'commonjs' | false;
|
|
18
|
+
loader: boolean;
|
|
19
|
+
removeTypeofWindow: boolean;
|
|
20
|
+
alias: Record<string, any>;
|
|
21
|
+
tramvai: boolean;
|
|
22
|
+
hot: boolean;
|
|
23
|
+
excludesPresetEnv: string[];
|
|
24
|
+
rootDir: string;
|
|
25
|
+
};
|
|
6
26
|
|
|
7
27
|
export const addTranspilerLoader = (
|
|
8
28
|
configManager: ConfigManager,
|
|
9
29
|
rule: Config.Use,
|
|
10
|
-
transpilerConfig:
|
|
30
|
+
transpilerConfig: TranspilerConfig
|
|
11
31
|
) => {
|
|
12
32
|
const { loader } = configManager.experiments.transpilation;
|
|
13
33
|
|
|
@@ -28,9 +48,17 @@ Please run "tramvai add --dev @tramvai/swc-integration" to fix the problem
|
|
|
28
48
|
}
|
|
29
49
|
};
|
|
30
50
|
|
|
31
|
-
export const getTranspilerConfig = (
|
|
32
|
-
|
|
33
|
-
|
|
51
|
+
export const getTranspilerConfig = (
|
|
52
|
+
configManager: ConfigManager,
|
|
53
|
+
overrideOptions: Partial<TranspilerConfig> = {}
|
|
54
|
+
): TranspilerConfig => {
|
|
55
|
+
const {
|
|
56
|
+
generateDataQaTag,
|
|
57
|
+
alias,
|
|
58
|
+
removeTypeofWindow,
|
|
59
|
+
enableFillActionNamePlugin,
|
|
60
|
+
excludesPresetEnv,
|
|
61
|
+
} = configManager.build.configurations;
|
|
34
62
|
const { env, modern } = configManager;
|
|
35
63
|
|
|
36
64
|
return {
|
|
@@ -42,9 +70,13 @@ export const getTranspilerConfig = (configManager: ConfigManager) => {
|
|
|
42
70
|
tramvai: true,
|
|
43
71
|
removeTypeofWindow,
|
|
44
72
|
hot: configManager.hotRefresh,
|
|
45
|
-
excludesPresetEnv
|
|
73
|
+
excludesPresetEnv,
|
|
46
74
|
enableFillActionNamePlugin,
|
|
47
75
|
rootDir: configManager.rootDir,
|
|
48
76
|
target: configManager.target,
|
|
77
|
+
loader: true,
|
|
78
|
+
modules: false,
|
|
79
|
+
typescript: false,
|
|
80
|
+
...overrideOptions,
|
|
49
81
|
};
|
|
50
82
|
};
|
|
@@ -25,35 +25,39 @@ const getCustomConfig = (configManager: ConfigManager) => {
|
|
|
25
25
|
return additionalConfig || {};
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const
|
|
28
|
+
const createTranspilerConfig = (configManager: ConfigManager) => {
|
|
29
29
|
return {
|
|
30
|
-
name: '
|
|
30
|
+
name: 'transpiler',
|
|
31
31
|
poolTimeout: configManager.env === 'development' ? Infinity : undefined,
|
|
32
32
|
workers: calculateNumberOfWorkers(),
|
|
33
33
|
...getCustomConfig(configManager),
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
export const
|
|
38
|
-
const config =
|
|
37
|
+
export const createWorkerPoolTranspiler = (configManager: ConfigManager) => {
|
|
38
|
+
const config = createTranspilerConfig(configManager);
|
|
39
39
|
|
|
40
|
-
if (!(
|
|
41
|
-
|
|
42
|
-
'
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
if (!(createWorkerPoolTranspiler as any).warmup) {
|
|
41
|
+
if (configManager.experiments.transpilation.loader === 'swc') {
|
|
42
|
+
threadLoader.warmup(config, ['swc-loader', '@swc/core']);
|
|
43
|
+
} else {
|
|
44
|
+
threadLoader.warmup(config, [
|
|
45
|
+
'babel-loader',
|
|
46
|
+
'@babel/preset-env',
|
|
47
|
+
'@babel/preset-typescript',
|
|
48
|
+
'@babel/preset-react',
|
|
49
|
+
'@babel/plugin-transform-runtime',
|
|
50
|
+
'babel-plugin-lodash',
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
(createWorkerPoolTranspiler as any).warmup = true;
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
return config;
|
|
53
57
|
};
|
|
54
58
|
|
|
55
|
-
export const
|
|
56
|
-
getPool(
|
|
59
|
+
export const closeWorkerPoolTranspiler = (configManager: ConfigManager) => {
|
|
60
|
+
getPool(createTranspilerConfig(configManager))?.disposeWorkers();
|
|
57
61
|
};
|
|
58
62
|
|
|
59
63
|
const createStylesConfig = (configManager: ConfigManager) => {
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
"additionalProperties": false
|
|
173
173
|
},
|
|
174
174
|
"alias": {
|
|
175
|
-
"title": "
|
|
175
|
+
"title": "`@@deprecated @tramvai/cli now supports baseUrl and paths from the app's tsconfig.json file.\nJust check or add configuration to your tsconfig file and remove alias from tramvai.json`",
|
|
176
176
|
"additionalProperties": true,
|
|
177
177
|
"type": "object"
|
|
178
178
|
},
|
|
@@ -976,12 +976,12 @@
|
|
|
976
976
|
},
|
|
977
977
|
"modern": {
|
|
978
978
|
"title": "Enable development build for modern browsers",
|
|
979
|
-
"default":
|
|
979
|
+
"default": true,
|
|
980
980
|
"type": "boolean"
|
|
981
981
|
},
|
|
982
982
|
"hotRefresh": {
|
|
983
983
|
"title": "Enable react hot-refresh",
|
|
984
|
-
"default":
|
|
984
|
+
"default": true,
|
|
985
985
|
"type": "boolean"
|
|
986
986
|
},
|
|
987
987
|
"hotRefreshOptions": {
|
|
@@ -1289,7 +1289,7 @@
|
|
|
1289
1289
|
"additionalProperties": false
|
|
1290
1290
|
},
|
|
1291
1291
|
"alias": {
|
|
1292
|
-
"title": "
|
|
1292
|
+
"title": "`@@deprecated @tramvai/cli now supports baseUrl and paths from the app's tsconfig.json file.\nJust check or add configuration to your tsconfig file and remove alias from tramvai.json`",
|
|
1293
1293
|
"additionalProperties": true,
|
|
1294
1294
|
"type": "object"
|
|
1295
1295
|
},
|
|
@@ -1571,12 +1571,12 @@
|
|
|
1571
1571
|
},
|
|
1572
1572
|
"modern": {
|
|
1573
1573
|
"title": "Enable development build for modern browsers",
|
|
1574
|
-
"default":
|
|
1574
|
+
"default": true,
|
|
1575
1575
|
"type": "boolean"
|
|
1576
1576
|
},
|
|
1577
1577
|
"hotRefresh": {
|
|
1578
1578
|
"title": "Enable react hot-refresh",
|
|
1579
|
-
"default":
|
|
1579
|
+
"default": true,
|
|
1580
1580
|
"type": "boolean"
|
|
1581
1581
|
},
|
|
1582
1582
|
"hotRefreshOptions": {
|
|
@@ -1864,7 +1864,7 @@
|
|
|
1864
1864
|
"additionalProperties": false
|
|
1865
1865
|
},
|
|
1866
1866
|
"alias": {
|
|
1867
|
-
"title": "
|
|
1867
|
+
"title": "`@@deprecated @tramvai/cli now supports baseUrl and paths from the app's tsconfig.json file.\nJust check or add configuration to your tsconfig file and remove alias from tramvai.json`",
|
|
1868
1868
|
"additionalProperties": true,
|
|
1869
1869
|
"type": "object"
|
|
1870
1870
|
},
|
|
@@ -2146,12 +2146,12 @@
|
|
|
2146
2146
|
},
|
|
2147
2147
|
"modern": {
|
|
2148
2148
|
"title": "Enable development build for modern browsers",
|
|
2149
|
-
"default":
|
|
2149
|
+
"default": true,
|
|
2150
2150
|
"type": "boolean"
|
|
2151
2151
|
},
|
|
2152
2152
|
"hotRefresh": {
|
|
2153
2153
|
"title": "Enable react hot-refresh",
|
|
2154
|
-
"default":
|
|
2154
|
+
"default": true,
|
|
2155
2155
|
"type": "boolean"
|
|
2156
2156
|
},
|
|
2157
2157
|
"hotRefreshOptions": {
|
|
@@ -166,8 +166,8 @@ describe('JSON schema для tramvai.json', () => {
|
|
|
166
166
|
"express",
|
|
167
167
|
"core-js",
|
|
168
168
|
],
|
|
169
|
-
"hotRefresh":
|
|
170
|
-
"modern":
|
|
169
|
+
"hotRefresh": true,
|
|
170
|
+
"modern": true,
|
|
171
171
|
"sourceMap": false,
|
|
172
172
|
},
|
|
173
173
|
"notifications": {},
|
|
@@ -234,8 +234,8 @@ describe('JSON schema для tramvai.json', () => {
|
|
|
234
234
|
"cacheUnaffected": true,
|
|
235
235
|
},
|
|
236
236
|
},
|
|
237
|
-
"hotRefresh":
|
|
238
|
-
"modern":
|
|
237
|
+
"hotRefresh": true,
|
|
238
|
+
"modern": true,
|
|
239
239
|
"sourceMap": false,
|
|
240
240
|
},
|
|
241
241
|
"notifications": {},
|
|
@@ -78,12 +78,12 @@ interface ServeConfig {
|
|
|
78
78
|
sourceMap?: boolean;
|
|
79
79
|
/**
|
|
80
80
|
* @title Enable development build for modern browsers
|
|
81
|
-
* @default
|
|
81
|
+
* @default true
|
|
82
82
|
*/
|
|
83
83
|
modern?: boolean;
|
|
84
84
|
/**
|
|
85
85
|
* @title Enable react hot-refresh
|
|
86
|
-
* @default
|
|
86
|
+
* @default true
|
|
87
87
|
*/
|
|
88
88
|
hotRefresh?: boolean;
|
|
89
89
|
/**
|
|
@@ -198,7 +198,9 @@ interface BuildConfig {
|
|
|
198
198
|
assetsConfig?: string;
|
|
199
199
|
};
|
|
200
200
|
/**
|
|
201
|
-
* @title
|
|
201
|
+
* @title `@@deprecated @tramvai/cli now supports baseUrl and paths from the app's tsconfig.json file.
|
|
202
|
+
* Just check or add configuration to your tsconfig file and remove alias from tramvai.json`
|
|
203
|
+
* @deprecated
|
|
202
204
|
* @additionalProperties true
|
|
203
205
|
*/
|
|
204
206
|
alias?: Record<string, any>;
|