@tramvai/cli 4.41.56 → 4.41.90
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/bin/platform.js +26 -1
- package/bin/spawn.js +19 -7
- package/lib/builder/webpack/devServer/server.d.ts.map +1 -1
- package/lib/builder/webpack/devServer/server.js +65 -34
- package/lib/builder/webpack/devServer/server.js.map +1 -1
- package/lib/commands/add/add.d.ts +2 -2
- package/lib/commands/add/add.d.ts.map +1 -1
- package/lib/commands/add/add.js +2 -2
- package/lib/commands/add/add.js.map +1 -1
- package/lib/commands/add/checkPackageValidator.d.ts +1 -1
- package/lib/commands/add/checkPackageValidator.d.ts.map +1 -1
- package/lib/commands/add/checkPackageValidator.js +7 -2
- package/lib/commands/add/checkPackageValidator.js.map +1 -1
- package/lib/commands/add/command.d.ts +1 -1
- package/lib/commands/add/command.d.ts.map +1 -1
- package/lib/commands/add/command.js +1 -1
- package/lib/commands/add/command.js.map +1 -1
- 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 +9 -4
- 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 +7 -3
- package/lib/library/swc/index.js.map +1 -1
- package/lib/library/webpack/application/client/prod/optimization/splitChunks.d.ts.map +1 -1
- package/lib/library/webpack/application/client/prod/optimization/splitChunks.js +52 -1
- package/lib/library/webpack/application/client/prod/optimization/splitChunks.js.map +1 -1
- package/lib/library/webpack/blocks/serverInline.d.ts.map +1 -1
- package/lib/library/webpack/blocks/serverInline.js +7 -1
- package/lib/library/webpack/blocks/serverInline.js.map +1 -1
- package/lib/library/webpack/child-app/common.d.ts.map +1 -1
- package/lib/library/webpack/child-app/common.js +2 -0
- package/lib/library/webpack/child-app/common.js.map +1 -1
- package/lib/library/webpack/plugins/AutoPublicPathPlugin.d.ts +4 -0
- package/lib/library/webpack/plugins/AutoPublicPathPlugin.d.ts.map +1 -0
- package/lib/library/webpack/plugins/AutoPublicPathPlugin.js +23 -0
- package/lib/library/webpack/plugins/AutoPublicPathPlugin.js.map +1 -0
- package/lib/library/webpack/utils/transpiler.d.ts +12 -0
- package/lib/library/webpack/utils/transpiler.d.ts.map +1 -1
- package/lib/library/webpack/utils/transpiler.js.map +1 -1
- package/lib/schema/autogeneratedSchema.json +20 -15
- package/lib/typings/configEntry/application.d.ts +5 -0
- package/lib/typings/configEntry/application.d.ts.map +1 -1
- package/lib/utils/npmRequire.js +1 -1
- package/lib/utils/npmRequire.js.map +1 -1
- package/package.json +7 -6
- package/schema.json +20 -15
- package/src/builder/webpack/devServer/server.ts +38 -2
- package/src/commands/add/add.ts +3 -3
- package/src/commands/add/checkPackageValidator.ts +6 -2
- package/src/commands/add/command.ts +1 -1
- package/src/library/babel/index.ts +10 -3
- package/src/library/swc/__integration__/__snapshots__/swc.build.test.ts.snap +30 -11
- package/src/library/swc/__integration__/__snapshots__/swc.start.test.ts.snap +13 -2
- package/src/library/swc/__integration__/server.inline.ts +4 -0
- package/src/library/swc/index.ts +7 -2
- package/src/library/webpack/application/client/prod/optimization/splitChunks.ts +66 -2
- package/src/library/webpack/blocks/serverInline.ts +7 -1
- package/src/library/webpack/child-app/common.ts +3 -0
- package/src/library/webpack/plugins/AutoPublicPathPlugin.ts +23 -0
- package/src/library/webpack/utils/transpiler.ts +12 -0
- package/src/models/config.spec.ts +2 -0
- package/src/schema/autogeneratedSchema.json +20 -15
- package/src/schema/tramvai.spec.ts +1 -0
- package/src/typings/configEntry/application.ts +5 -0
- package/src/utils/npmRequire.ts +1 -1
|
@@ -13,14 +13,15 @@ exports[`client-legacy: create-token-pure.ts 1`] = `
|
|
|
13
13
|
`;
|
|
14
14
|
|
|
15
15
|
exports[`client-legacy: images/logo.svg\\?react 1`] = `
|
|
16
|
-
" /* harmony import */ var
|
|
16
|
+
" /* harmony import */ var _swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/@swc/helpers/esm/_object_spread.js"), _swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/@swc/helpers/esm/_object_spread_props.js"), react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("webpack/sharing/consume/default/react/jsx-runtime/react/jsx-runtime");
|
|
17
17
|
/* harmony import */ __webpack_require__("webpack/sharing/consume/default/react/react"),
|
|
18
18
|
/* harmony default export */ __webpack_exports__.Z = function(props) {
|
|
19
19
|
/*#__PURE__*/
|
|
20
|
-
return (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("svg", (0,
|
|
20
|
+
return (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("svg", (0, _swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_2__._)((0,
|
|
21
|
+
_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_3__._)({
|
|
21
22
|
xmlns: "http://www.w3.org/2000/svg",
|
|
22
23
|
viewBox: "0 0 80.9 72.2"
|
|
23
|
-
}, props, {
|
|
24
|
+
}, props), {
|
|
24
25
|
children: [
|
|
25
26
|
/*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", {
|
|
26
27
|
fill: "#fff",
|
|
@@ -152,13 +153,21 @@ exports[`client-legacy: server.inline.ts 1`] = `
|
|
|
152
153
|
/* binding */ return ForBrowser;
|
|
153
154
|
}
|
|
154
155
|
/* harmony export */ });
|
|
155
|
-
var ForBrowser = /*#__PURE__*/ function() {
|
|
156
|
-
function ForBrowser() {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
156
|
+
/* harmony import */ var _swc_helpers_class_call_check__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/@swc/helpers/esm/_class_call_check.js"), _swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/@swc/helpers/esm/_create_class.js"), _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/@swc/helpers/esm/_define_property.js"), ForBrowser = /*#__PURE__*/ function() {
|
|
157
|
+
function ForBrowser() {
|
|
158
|
+
(0, _swc_helpers_class_call_check__WEBPACK_IMPORTED_MODULE_0__._)(this, ForBrowser),
|
|
159
|
+
(0, _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_1__._)(this, "property", (function() {
|
|
160
|
+
console.log("Ok");
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
163
|
+
return (0, _swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__._)(ForBrowser, [ {
|
|
164
|
+
key: "test",
|
|
165
|
+
value: function() {
|
|
166
|
+
console.log("Ok");
|
|
167
|
+
}
|
|
168
|
+
} ]), ForBrowser;
|
|
160
169
|
}();
|
|
161
|
-
ForBrowser
|
|
170
|
+
/* harmony import */ (0, _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_1__._)(ForBrowser, "prop", "static");
|
|
162
171
|
},
|
|
163
172
|
"
|
|
164
173
|
`;
|
|
@@ -313,12 +322,18 @@ exports[`client-modern: server.inline.ts 1`] = `
|
|
|
313
322
|
/* binding */ return ForBrowser;
|
|
314
323
|
}
|
|
315
324
|
/* harmony export */ });
|
|
325
|
+
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/@swc/helpers/esm/_define_property.js");
|
|
316
326
|
class ForBrowser {
|
|
317
327
|
test() {
|
|
318
328
|
console.log("Ok");
|
|
319
329
|
}
|
|
330
|
+
constructor() {
|
|
331
|
+
(0, _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "property", (() => {
|
|
332
|
+
console.log("Ok");
|
|
333
|
+
}));
|
|
334
|
+
}
|
|
320
335
|
}
|
|
321
|
-
ForBrowser
|
|
336
|
+
(0, _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(ForBrowser, "prop", "static");
|
|
322
337
|
},
|
|
323
338
|
"
|
|
324
339
|
`;
|
|
@@ -478,7 +493,11 @@ exports[`server: server.inline.ts 1`] = `
|
|
|
478
493
|
}
|
|
479
494
|
/* harmony export */ });
|
|
480
495
|
var ForBrowser = /*#__PURE__*/ function() {
|
|
481
|
-
function ForBrowser() {
|
|
496
|
+
function ForBrowser() {
|
|
497
|
+
this.property = function() {
|
|
498
|
+
console.log("Ok");
|
|
499
|
+
};
|
|
500
|
+
}
|
|
482
501
|
return ForBrowser.prototype.test = function test() {
|
|
483
502
|
console.log("Ok");
|
|
484
503
|
}, ForBrowser;
|
|
@@ -405,15 +405,22 @@ exports[`client: server.inline.ts 1`] = `
|
|
|
405
405
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
406
406
|
/* harmony export */ ForBrowser: function() { return /* binding */ ForBrowser; }
|
|
407
407
|
/* harmony export */ });
|
|
408
|
+
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/@swc/helpers/esm/_define_property.js");
|
|
408
409
|
/* provided dependency */ var __react_refresh_utils__ = __webpack_require__("../../node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js");
|
|
409
410
|
__webpack_require__.$Refresh$.runtime = __webpack_require__("../../node_modules/react-refresh/runtime.js");
|
|
410
411
|
|
|
412
|
+
|
|
411
413
|
class ForBrowser {
|
|
412
414
|
test() {
|
|
413
415
|
console.log("Ok");
|
|
414
416
|
}
|
|
417
|
+
constructor(){
|
|
418
|
+
(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "property", ()=>{
|
|
419
|
+
console.log("Ok");
|
|
420
|
+
});
|
|
421
|
+
}
|
|
415
422
|
}
|
|
416
|
-
ForBrowser
|
|
423
|
+
(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(ForBrowser, "prop", "static");
|
|
417
424
|
|
|
418
425
|
|
|
419
426
|
const $ReactRefreshModuleId$ = __webpack_require__.$Refresh$.moduleId;
|
|
@@ -730,7 +737,11 @@ exports[`server: server.inline.ts 1`] = `
|
|
|
730
737
|
/* harmony export */ });
|
|
731
738
|
var ForBrowser = /*#__PURE__*/ function() {
|
|
732
739
|
"use strict";
|
|
733
|
-
function ForBrowser() {
|
|
740
|
+
function ForBrowser() {
|
|
741
|
+
this.property = function() {
|
|
742
|
+
console.log("Ok");
|
|
743
|
+
};
|
|
744
|
+
}
|
|
734
745
|
var _proto = ForBrowser.prototype;
|
|
735
746
|
_proto.test = function test() {
|
|
736
747
|
console.log("Ok");
|
package/src/library/swc/index.ts
CHANGED
|
@@ -26,6 +26,11 @@ export const getSwcOptions = (config: TranspilerConfig): SwcOptions => {
|
|
|
26
26
|
tramvai = false,
|
|
27
27
|
rootDir = process.cwd(),
|
|
28
28
|
generateDataQaTag = false,
|
|
29
|
+
// disabled because `arrayLikeIsIterable` and `iterableIsArray` assumtions is not supported yet in swc,
|
|
30
|
+
// this can leads to incorrect code generation e.g. when Set with spread is used - `[...new Set()] => [].concat(new Set())`
|
|
31
|
+
// TCORE-4904
|
|
32
|
+
loose = false,
|
|
33
|
+
externalHelpers = true,
|
|
29
34
|
} = config;
|
|
30
35
|
|
|
31
36
|
if (!warningWasShown) {
|
|
@@ -104,7 +109,7 @@ Having swc config may conflict with @tramvai/cli configuration`
|
|
|
104
109
|
// Use relevant core-js version, because it affects which polyfills are included
|
|
105
110
|
// https://github.com/swc-project/swc/blob/main/crates/swc_ecma_preset_env/data/core-js-compat/modules-by-versions.json
|
|
106
111
|
coreJs: require('core-js/package.json').version,
|
|
107
|
-
loose
|
|
112
|
+
loose,
|
|
108
113
|
mode: 'entry',
|
|
109
114
|
},
|
|
110
115
|
module: {
|
|
@@ -112,7 +117,7 @@ Having swc config may conflict with @tramvai/cli configuration`
|
|
|
112
117
|
},
|
|
113
118
|
isModule: 'unknown',
|
|
114
119
|
jsc: {
|
|
115
|
-
externalHelpers
|
|
120
|
+
externalHelpers,
|
|
116
121
|
parser: {
|
|
117
122
|
syntax: typescript ? 'typescript' : 'ecmascript',
|
|
118
123
|
decorators: true,
|
|
@@ -65,6 +65,50 @@ export const resolveFrameworksPaths = (rootDir: string, frameworksList: string[]
|
|
|
65
65
|
return topLevelFrameworkPaths;
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
+
const tramvaiScopes = ['@tramvai/', '@tramvai-tinkoff/'];
|
|
69
|
+
const tinkoffPackages = [
|
|
70
|
+
'@tinkoff/router',
|
|
71
|
+
'@tinkoff/logger',
|
|
72
|
+
'@tinkoff/dippy',
|
|
73
|
+
'@tinkoff/user-agent',
|
|
74
|
+
'@tinkoff/module-loader-client',
|
|
75
|
+
'@tinkoff/meta-tags-generate',
|
|
76
|
+
'@tinkoff/browser-cookies',
|
|
77
|
+
'@tinkoff/errors',
|
|
78
|
+
'@tinkoff/layout-factory',
|
|
79
|
+
'@tinkoff/url',
|
|
80
|
+
'@tinkoff/roles',
|
|
81
|
+
'@tinkoff/hook-runner',
|
|
82
|
+
'@tinkoff/pubsub',
|
|
83
|
+
'@tinkoff/browser-timings',
|
|
84
|
+
];
|
|
85
|
+
const tinkoffPackagesSet = new Set(tinkoffPackages);
|
|
86
|
+
|
|
87
|
+
function isTramvaiPackage(packageName: string | undefined) {
|
|
88
|
+
if (!packageName) return false;
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
tramvaiScopes.some((scope) => packageName.startsWith(scope)) ||
|
|
92
|
+
tinkoffPackagesSet.has(packageName)
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function normalizePath(packagePath: string) {
|
|
97
|
+
return packagePath.endsWith('/') ? packagePath : `${packagePath}/`;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const tramvaiPackagesPaths = [...tramvaiScopes, ...tinkoffPackages].map((packageName) =>
|
|
101
|
+
normalizePath(`/node_modules/${packageName}`)
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
function isTramvaiResource(resource: string | undefined) {
|
|
105
|
+
if (!resource) return false;
|
|
106
|
+
|
|
107
|
+
return tramvaiPackagesPaths.some((tramvaiPackagePath) => resource.includes(tramvaiPackagePath));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
type CacheGroup = Exclude<Required<SplitChunksOptions>, boolean>['cacheGroups'][string];
|
|
111
|
+
|
|
68
112
|
// eslint-disable-next-line max-statements
|
|
69
113
|
export const splitChunksConfig =
|
|
70
114
|
(configManager: ConfigManager<ApplicationConfigEntry>) => (config: Config) => {
|
|
@@ -72,13 +116,13 @@ export const splitChunksConfig =
|
|
|
72
116
|
|
|
73
117
|
const topLevelFrameworkPaths = resolveFrameworksPaths(rootDir, ['react', 'react-dom']);
|
|
74
118
|
|
|
75
|
-
const reactCacheGroup:
|
|
119
|
+
const reactCacheGroup: CacheGroup = {
|
|
76
120
|
chunks: 'all',
|
|
77
121
|
name: 'react',
|
|
78
122
|
// This regex ignores nested copies of framework libraries so they're bundled with their issuer.
|
|
79
123
|
// test: /(?<!node_modules.*)[\\/]node_modules[\\/](react|react-dom|scheduler|prop-types|use-subscription)[\\/]/,
|
|
80
124
|
test(module: webpack.Module) {
|
|
81
|
-
const resource = module.nameForCondition
|
|
125
|
+
const resource = module.nameForCondition?.();
|
|
82
126
|
|
|
83
127
|
if (!resource) {
|
|
84
128
|
return false;
|
|
@@ -93,6 +137,24 @@ export const splitChunksConfig =
|
|
|
93
137
|
// Don't let webpack eliminate this chunk (prevents this chunk from becoming a part of the commons chunk)
|
|
94
138
|
enforce: true,
|
|
95
139
|
};
|
|
140
|
+
|
|
141
|
+
const tramvaiCacheGroup: CacheGroup = splitChunks.frameworkChunk
|
|
142
|
+
? {
|
|
143
|
+
chunks: 'initial',
|
|
144
|
+
name: 'tramvai',
|
|
145
|
+
test(module: webpack.Module) {
|
|
146
|
+
const resource = module.nameForCondition?.();
|
|
147
|
+
const packageName = (module as webpack.NormalModule).resourceResolveData
|
|
148
|
+
?.descriptionFileData?.name as string | undefined;
|
|
149
|
+
|
|
150
|
+
return isTramvaiPackage(packageName) || isTramvaiResource(resource);
|
|
151
|
+
},
|
|
152
|
+
priority: 35,
|
|
153
|
+
// Don't let webpack eliminate this chunk (prevents this chunk from becoming a part of the commons chunk)
|
|
154
|
+
enforce: true,
|
|
155
|
+
}
|
|
156
|
+
: false;
|
|
157
|
+
|
|
96
158
|
let webpackSplitChunks: SplitChunksOptions = false;
|
|
97
159
|
|
|
98
160
|
switch (splitChunks.mode) {
|
|
@@ -130,6 +192,7 @@ export const splitChunksConfig =
|
|
|
130
192
|
default: false,
|
|
131
193
|
defaultVendors: false,
|
|
132
194
|
reactCacheGroup,
|
|
195
|
+
tramvaiCacheGroup,
|
|
133
196
|
shared,
|
|
134
197
|
},
|
|
135
198
|
};
|
|
@@ -141,6 +204,7 @@ export const splitChunksConfig =
|
|
|
141
204
|
default: false,
|
|
142
205
|
defaultVendors: false,
|
|
143
206
|
reactCacheGroup,
|
|
207
|
+
tramvaiCacheGroup,
|
|
144
208
|
commons: {
|
|
145
209
|
name: 'common-chunk',
|
|
146
210
|
minChunks: splitChunks.commonChunkSplitNumber,
|
|
@@ -17,7 +17,13 @@ export const serverInline = (configManager: ConfigManager<CliConfigEntry>) => (c
|
|
|
17
17
|
.batch(
|
|
18
18
|
addTranspilerLoader(
|
|
19
19
|
clientConfigManager,
|
|
20
|
-
getTranspilerConfig(clientConfigManager, {
|
|
20
|
+
getTranspilerConfig(clientConfigManager, {
|
|
21
|
+
typescript: type === 'ts',
|
|
22
|
+
// inline transpiler runtime helpers to prevent webpack imports in generated inline scripts
|
|
23
|
+
externalHelpers: false,
|
|
24
|
+
// minimize swc helpers usage to prevent inline scripts bloat, risks is minimal for rarely used inline scripts
|
|
25
|
+
loose: true,
|
|
26
|
+
})
|
|
21
27
|
)
|
|
22
28
|
);
|
|
23
29
|
};
|
|
@@ -20,6 +20,7 @@ import { extractCssPluginFactory } from '../blocks/extractCssPlugin';
|
|
|
20
20
|
import type { ModuleFederationFixRangeOptions } from '../plugins/ModuleFederationFixRange';
|
|
21
21
|
import { ModuleFederationFixRange } from '../plugins/ModuleFederationFixRange';
|
|
22
22
|
import { resolveFrameworksPaths } from '../application/client/prod/optimization/splitChunks';
|
|
23
|
+
import { PatchAutoPublicPathPlugin } from '../plugins/AutoPublicPathPlugin';
|
|
23
24
|
|
|
24
25
|
// eslint-disable-next-line max-statements
|
|
25
26
|
export default (configManager: ConfigManager<ChildAppConfigEntry>) => (config: Config) => {
|
|
@@ -164,6 +165,8 @@ export default (configManager: ConfigManager<ChildAppConfigEntry>) => (config: C
|
|
|
164
165
|
} as UniversalFederationPluginOptions,
|
|
165
166
|
]);
|
|
166
167
|
|
|
168
|
+
config.plugin('patch-auto-public-path').use(PatchAutoPublicPathPlugin);
|
|
169
|
+
|
|
167
170
|
config.plugin('module-federation-validate-duplicates').use(ModuleFederationFixRange, [
|
|
168
171
|
{
|
|
169
172
|
flexibleTramvaiVersions: shared.flexibleTramvaiVersions,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Fixes webpack AutoPublicPathPlugin error when fallback load of shared microfrontend chunk
|
|
2
|
+
// this happens because currentScript.src is not defined for an inline script
|
|
3
|
+
export class PatchAutoPublicPathPlugin {
|
|
4
|
+
apply(compiler) {
|
|
5
|
+
compiler.hooks.compilation.tap('PatchAutoPublicPathPlugin', (compilation) => {
|
|
6
|
+
compilation.hooks.runtimeModule.tap('PatchAutoPublicPathPlugin', (module) => {
|
|
7
|
+
if (module.constructor.name === 'AutoPublicPathRuntimeModule') {
|
|
8
|
+
const base = module.generate.bind(module);
|
|
9
|
+
|
|
10
|
+
// eslint-disable-next-line no-param-reassign
|
|
11
|
+
module.generate = function (...args) {
|
|
12
|
+
const result = base(...args);
|
|
13
|
+
|
|
14
|
+
return result.replace(
|
|
15
|
+
'document.currentScript.src',
|
|
16
|
+
'document.currentScript.src || document.currentScript.dataset.src'
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -23,6 +23,18 @@ export type TranspilerConfig = {
|
|
|
23
23
|
hot: boolean;
|
|
24
24
|
excludesPresetEnv: string[];
|
|
25
25
|
rootDir: string;
|
|
26
|
+
/**
|
|
27
|
+
* Enable or disable `loose` transformations:
|
|
28
|
+
* with swc loader - https://swc.rs/docs/configuration/compilation#jscloose
|
|
29
|
+
* with babel loader - https://babeljs.io/docs/babel-preset-env#loose
|
|
30
|
+
*/
|
|
31
|
+
loose?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Enable or disable external transpiler runtime helpers:
|
|
34
|
+
* with swc loader, pass value directly to `jsc.externalHelpers` option - https://swc.rs/docs/configuration/compilation#jscexternalhelpers
|
|
35
|
+
* with babel loader, when `false`, disable `@babel/plugin-transform-runtime` - https://babeljs.io/docs/babel-plugin-transform-runtime
|
|
36
|
+
*/
|
|
37
|
+
externalHelpers?: boolean;
|
|
26
38
|
};
|
|
27
39
|
|
|
28
40
|
export const addTranspilerLoader =
|
|
@@ -115,6 +115,7 @@ it('should populate defaults for config', () => {
|
|
|
115
115
|
"sourceMap": false,
|
|
116
116
|
"splitChunks": {
|
|
117
117
|
"commonChunkSplitNumber": 3,
|
|
118
|
+
"frameworkChunk": false,
|
|
118
119
|
"granularChunksMinSize": 20000,
|
|
119
120
|
"granularChunksSplitNumber": 2,
|
|
120
121
|
"mode": "granularChunks",
|
|
@@ -363,6 +364,7 @@ it('should populate defaults for overridable options', () => {
|
|
|
363
364
|
"sourceMap": false,
|
|
364
365
|
"splitChunks": {
|
|
365
366
|
"commonChunkSplitNumber": 3,
|
|
367
|
+
"frameworkChunk": false,
|
|
366
368
|
"granularChunksMinSize": 20000,
|
|
367
369
|
"granularChunksSplitNumber": 2,
|
|
368
370
|
"mode": "granularChunks",
|
|
@@ -116,6 +116,11 @@
|
|
|
116
116
|
"granularChunks"
|
|
117
117
|
]
|
|
118
118
|
},
|
|
119
|
+
"frameworkChunk": {
|
|
120
|
+
"title": "Move tramvai packages into a separate chunk",
|
|
121
|
+
"default": false,
|
|
122
|
+
"type": "boolean"
|
|
123
|
+
},
|
|
119
124
|
"granularChunksSplitNumber": {
|
|
120
125
|
"title": "Move module to shared chunk if used at least as many times in other chunks",
|
|
121
126
|
"default": 2,
|
|
@@ -1188,23 +1193,23 @@
|
|
|
1188
1193
|
"dotAll": {
|
|
1189
1194
|
"type": "boolean"
|
|
1190
1195
|
},
|
|
1191
|
-
"__@match@
|
|
1196
|
+
"__@match@7837": {
|
|
1192
1197
|
"type": "object",
|
|
1193
1198
|
"additionalProperties": false
|
|
1194
1199
|
},
|
|
1195
|
-
"__@replace@
|
|
1200
|
+
"__@replace@7839": {
|
|
1196
1201
|
"type": "object",
|
|
1197
1202
|
"additionalProperties": false
|
|
1198
1203
|
},
|
|
1199
|
-
"__@search@
|
|
1204
|
+
"__@search@7842": {
|
|
1200
1205
|
"type": "object",
|
|
1201
1206
|
"additionalProperties": false
|
|
1202
1207
|
},
|
|
1203
|
-
"__@split@
|
|
1208
|
+
"__@split@7844": {
|
|
1204
1209
|
"type": "object",
|
|
1205
1210
|
"additionalProperties": false
|
|
1206
1211
|
},
|
|
1207
|
-
"__@matchAll@
|
|
1212
|
+
"__@matchAll@7846": {
|
|
1208
1213
|
"type": "object",
|
|
1209
1214
|
"additionalProperties": false
|
|
1210
1215
|
}
|
|
@@ -1901,23 +1906,23 @@
|
|
|
1901
1906
|
"dotAll": {
|
|
1902
1907
|
"type": "boolean"
|
|
1903
1908
|
},
|
|
1904
|
-
"__@match@
|
|
1909
|
+
"__@match@7837": {
|
|
1905
1910
|
"type": "object",
|
|
1906
1911
|
"additionalProperties": false
|
|
1907
1912
|
},
|
|
1908
|
-
"__@replace@
|
|
1913
|
+
"__@replace@7839": {
|
|
1909
1914
|
"type": "object",
|
|
1910
1915
|
"additionalProperties": false
|
|
1911
1916
|
},
|
|
1912
|
-
"__@search@
|
|
1917
|
+
"__@search@7842": {
|
|
1913
1918
|
"type": "object",
|
|
1914
1919
|
"additionalProperties": false
|
|
1915
1920
|
},
|
|
1916
|
-
"__@split@
|
|
1921
|
+
"__@split@7844": {
|
|
1917
1922
|
"type": "object",
|
|
1918
1923
|
"additionalProperties": false
|
|
1919
1924
|
},
|
|
1920
|
-
"__@matchAll@
|
|
1925
|
+
"__@matchAll@7846": {
|
|
1921
1926
|
"type": "object",
|
|
1922
1927
|
"additionalProperties": false
|
|
1923
1928
|
}
|
|
@@ -2614,23 +2619,23 @@
|
|
|
2614
2619
|
"dotAll": {
|
|
2615
2620
|
"type": "boolean"
|
|
2616
2621
|
},
|
|
2617
|
-
"__@match@
|
|
2622
|
+
"__@match@7837": {
|
|
2618
2623
|
"type": "object",
|
|
2619
2624
|
"additionalProperties": false
|
|
2620
2625
|
},
|
|
2621
|
-
"__@replace@
|
|
2626
|
+
"__@replace@7839": {
|
|
2622
2627
|
"type": "object",
|
|
2623
2628
|
"additionalProperties": false
|
|
2624
2629
|
},
|
|
2625
|
-
"__@search@
|
|
2630
|
+
"__@search@7842": {
|
|
2626
2631
|
"type": "object",
|
|
2627
2632
|
"additionalProperties": false
|
|
2628
2633
|
},
|
|
2629
|
-
"__@split@
|
|
2634
|
+
"__@split@7844": {
|
|
2630
2635
|
"type": "object",
|
|
2631
2636
|
"additionalProperties": false
|
|
2632
2637
|
},
|
|
2633
|
-
"__@matchAll@
|
|
2638
|
+
"__@matchAll@7846": {
|
|
2634
2639
|
"type": "object",
|
|
2635
2640
|
"additionalProperties": false
|
|
2636
2641
|
}
|
|
@@ -144,6 +144,7 @@ describe('JSON schema для tramvai.json', () => {
|
|
|
144
144
|
"sourceMap": false,
|
|
145
145
|
"splitChunks": {
|
|
146
146
|
"commonChunkSplitNumber": 3,
|
|
147
|
+
"frameworkChunk": false,
|
|
147
148
|
"granularChunksMinSize": 20000,
|
|
148
149
|
"granularChunksSplitNumber": 2,
|
|
149
150
|
"mode": "granularChunks",
|
|
@@ -189,6 +189,11 @@ export interface ApplicationConfigEntry extends CliConfigEntry {
|
|
|
189
189
|
* @default "granularChunks"
|
|
190
190
|
*/
|
|
191
191
|
mode: 'granularChunks' | 'commonChunk' | false;
|
|
192
|
+
/**
|
|
193
|
+
* @title Move tramvai packages into a separate chunk
|
|
194
|
+
* @default false
|
|
195
|
+
*/
|
|
196
|
+
frameworkChunk: boolean;
|
|
192
197
|
/**
|
|
193
198
|
* @title Move module to shared chunk if used at least as many times in other chunks
|
|
194
199
|
* @default 2
|