@tramvai/cli 2.111.0 → 2.111.1
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/builder/webpack/tokens.d.ts +3 -0
- package/lib/commands/update/dependantLibs.d.ts +0 -1
- package/lib/commands/update/dependantLibs.js +3 -24
- package/lib/commands/update/dependantLibs.js.map +1 -1
- package/lib/commands/update/updatePackageJson.js +3 -5
- package/lib/commands/update/updatePackageJson.js.map +1 -1
- package/lib/di/tokens/config.d.ts +1 -0
- package/lib/library/webpack/application/client/common.js +7 -1
- package/lib/library/webpack/application/client/common.js.map +1 -1
- package/lib/library/webpack/child-app/client/common.js +7 -1
- package/lib/library/webpack/child-app/client/common.js.map +1 -1
- package/lib/library/webpack/child-app/moduleFederationShared.js +4 -4
- package/lib/library/webpack/plugins/ModuleFederationFixRange.d.ts +23 -0
- package/lib/library/webpack/plugins/ModuleFederationFixRange.js +125 -0
- package/lib/library/webpack/plugins/ModuleFederationFixRange.js.map +1 -0
- package/lib/schema/autogeneratedSchema.json +21 -3
- package/lib/typings/configEntry/cli.d.ts +7 -1
- package/lib/utils/tramvaiVersions.d.ts +3 -0
- package/lib/utils/tramvaiVersions.js +30 -0
- package/lib/utils/tramvaiVersions.js.map +1 -0
- package/package.json +6 -6
- package/schema.json +21 -3
- package/src/commands/update/dependantLibs.ts +1 -23
- package/src/commands/update/updatePackageJson.ts +2 -5
- package/src/library/swc/__integration__/__snapshots__/swc.start.test.ts.snap +14 -14
- package/src/library/webpack/application/client/common.ts +9 -1
- package/src/library/webpack/child-app/client/common.ts +9 -1
- package/src/library/webpack/child-app/moduleFederationShared.ts +4 -4
- package/src/library/webpack/plugins/ModuleFederationFixRange.ts +174 -0
- package/src/models/config.spec.ts +4 -0
- package/src/schema/autogeneratedSchema.json +21 -3
- package/src/schema/tramvai.spec.ts +2 -0
- package/src/typings/configEntry/cli.ts +7 -1
- package/src/utils/tramvaiVersions.ts +26 -0
|
@@ -104,6 +104,7 @@ export declare const CLIENT_CONFIG_MANAGER_TOKEN: {
|
|
|
104
104
|
};
|
|
105
105
|
shared: {
|
|
106
106
|
defaultTramvaiDependencies?: boolean;
|
|
107
|
+
flexibleTramvaiVersions: boolean;
|
|
107
108
|
deps: (string | {
|
|
108
109
|
name: string;
|
|
109
110
|
singleton: boolean;
|
|
@@ -219,6 +220,7 @@ export declare const CLIENT_MODERN_CONFIG_MANAGER_TOKEN: {
|
|
|
219
220
|
};
|
|
220
221
|
shared: {
|
|
221
222
|
defaultTramvaiDependencies?: boolean;
|
|
223
|
+
flexibleTramvaiVersions: boolean;
|
|
222
224
|
deps: (string | {
|
|
223
225
|
name: string;
|
|
224
226
|
singleton: boolean;
|
|
@@ -334,6 +336,7 @@ export declare const SERVER_CONFIG_MANAGER_TOKEN: {
|
|
|
334
336
|
};
|
|
335
337
|
shared: {
|
|
336
338
|
defaultTramvaiDependencies?: boolean;
|
|
339
|
+
flexibleTramvaiVersions: boolean;
|
|
337
340
|
deps: (string | {
|
|
338
341
|
name: string;
|
|
339
342
|
singleton: boolean;
|
|
@@ -1,33 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getLibPackageVersion =
|
|
3
|
+
exports.getLibPackageVersion = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const latest_version_1 = tslib_1.__importDefault(require("latest-version"));
|
|
6
6
|
const package_json_1 = tslib_1.__importDefault(require("package-json"));
|
|
7
|
-
|
|
8
|
-
// but we still want to update it
|
|
9
|
-
// actual version to update will be calculated from the some of the @tramvai/module
|
|
10
|
-
const DEPENDANT_LIBS_MAP = new Map([
|
|
11
|
-
['@tinkoff/logger', '@tramvai/module-log'],
|
|
12
|
-
['@tinkoff/dippy', '@tramvai/core'],
|
|
13
|
-
['@tinkoff/router', '@tramvai/module-router'],
|
|
14
|
-
['@tinkoff/url', '@tramvai/module-common'],
|
|
15
|
-
['@tinkoff/errors', '@tramvai/module-common'],
|
|
16
|
-
['@tinkoff/roles', '@tramvai/module-authenticate'],
|
|
17
|
-
['@tinkoff/pubsub', '@tramvai/module-common'],
|
|
18
|
-
['@tinkoff/hook-runner', '@tramvai/module-common'],
|
|
19
|
-
['@tinkoff/htmlpagebuilder', '@tramvai/module-render'],
|
|
20
|
-
['@tinkoff/browser-timings', '@tramvai/module-metrics'],
|
|
21
|
-
['@tinkoff/meta-tags-generate', '@tramvai/module-render'],
|
|
22
|
-
['@tinkoff/pack-polyfills', ''],
|
|
23
|
-
['@tinkoff/browserslist-config', '@tramvai/cli'],
|
|
24
|
-
]);
|
|
25
|
-
const isDependantLib = (name) => {
|
|
26
|
-
return DEPENDANT_LIBS_MAP.has(name);
|
|
27
|
-
};
|
|
28
|
-
exports.isDependantLib = isDependantLib;
|
|
7
|
+
const tramvaiVersions_1 = require("../../utils/tramvaiVersions");
|
|
29
8
|
const getLibPackageVersion = (name, unifiedVersion) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
-
const unifiedModule = DEPENDANT_LIBS_MAP.get(name);
|
|
9
|
+
const unifiedModule = tramvaiVersions_1.DEPENDANT_LIBS_MAP.get(name);
|
|
31
10
|
if (!unifiedModule) {
|
|
32
11
|
return (0, latest_version_1.default)(name);
|
|
33
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependantLibs.js","sourceRoot":"","sources":["../../../src/commands/update/dependantLibs.ts"],"names":[],"mappings":";;;;AAAA,4EAAqD;AACrD,wEAA0C;
|
|
1
|
+
{"version":3,"file":"dependantLibs.js","sourceRoot":"","sources":["../../../src/commands/update/dependantLibs.ts"],"names":[],"mappings":";;;;AAAA,4EAAqD;AACrD,wEAA0C;AAC1C,iEAAiE;AAE1D,MAAM,oBAAoB,GAAG,CAClC,IAAY,EACZ,cAAsB,EACO,EAAE;IAC/B,MAAM,aAAa,GAAG,oCAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAEnD,IAAI,CAAC,aAAa,EAAE;QAClB,OAAO,IAAA,wBAAuB,EAAC,IAAI,CAAC,CAAC;KACtC;IAED,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,IAAA,sBAAc,EAAC,aAAa,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC;IAE1F,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;QACvB,OAAO,CAAC,IAAI,CACV,6CAA6C,IAAI;6CACV,CACxC,CAAC;QAEF,OAAO;KACR;IAED,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC,CAAA,CAAC;AAtBW,QAAA,oBAAoB,wBAsB/B"}
|
|
@@ -8,9 +8,7 @@ const p_map_1 = tslib_1.__importDefault(require("p-map"));
|
|
|
8
8
|
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
9
9
|
const packageHasVersion_1 = require("../../utils/commands/dependencies/packageHasVersion");
|
|
10
10
|
const dependantLibs_1 = require("./dependantLibs");
|
|
11
|
-
const
|
|
12
|
-
return name.startsWith('@tramvai');
|
|
13
|
-
};
|
|
11
|
+
const tramvaiVersions_1 = require("../../utils/tramvaiVersions");
|
|
14
12
|
const getVersionFromDep = (dep) => {
|
|
15
13
|
var _a, _b;
|
|
16
14
|
if (dep) {
|
|
@@ -20,10 +18,10 @@ const getVersionFromDep = (dep) => {
|
|
|
20
18
|
const updateDependencies = (dependencies = {}, targetVersion, currentVersion, spinner) => {
|
|
21
19
|
return (0, p_map_1.default)(Object.keys(dependencies), (dep) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
22
20
|
let nextVersion;
|
|
23
|
-
if (isUnifiedVersion(dep) && getVersionFromDep(dependencies[dep]) === currentVersion) {
|
|
21
|
+
if ((0, tramvaiVersions_1.isUnifiedVersion)(dep) && getVersionFromDep(dependencies[dep]) === currentVersion) {
|
|
24
22
|
nextVersion = targetVersion;
|
|
25
23
|
}
|
|
26
|
-
else if ((0,
|
|
24
|
+
else if ((0, tramvaiVersions_1.isDependantLib)(dep)) {
|
|
27
25
|
const libVersion = yield (0, dependantLibs_1.getLibPackageVersion)(dep, targetVersion);
|
|
28
26
|
nextVersion = libVersion;
|
|
29
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updatePackageJson.js","sourceRoot":"","sources":["../../../src/commands/update/updatePackageJson.ts"],"names":[],"mappings":";;;;AAAA,mCAA2C;AAC3C,oDAAoB;AACpB,0DAAyB;AAEzB,sDAAsB;AACtB,2FAAwF;AACxF,
|
|
1
|
+
{"version":3,"file":"updatePackageJson.js","sourceRoot":"","sources":["../../../src/commands/update/updatePackageJson.ts"],"names":[],"mappings":";;;;AAAA,mCAA2C;AAC3C,oDAAoB;AACpB,0DAAyB;AAEzB,sDAAsB;AACtB,2FAAwF;AACxF,mDAAuD;AACvD,iEAA+E;AAE/E,MAAM,iBAAiB,GAAG,CAAC,GAAY,EAAE,EAAE;;IACzC,IAAI,GAAG,EAAE;QACP,OAAO,CAAA,MAAA,IAAA,cAAK,EAAC,GAAG,CAAC,0CAAE,OAAO,MAAI,MAAA,IAAA,mBAAU,EAAC,GAAG,CAAC,0CAAE,OAAO,CAAA,CAAC;KACxD;AACH,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CACzB,eAAuC,EAAE,EACzC,aAAqB,EACrB,cAAsB,EACtB,OAAY,EACZ,EAAE;IACF,OAAO,IAAA,eAAI,EACT,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EACzB,CAAO,GAAG,EAAE,EAAE;QACZ,IAAI,WAA+B,CAAC;QAEpC,IAAI,IAAA,kCAAgB,EAAC,GAAG,CAAC,IAAI,iBAAiB,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,cAAc,EAAE;YACpF,WAAW,GAAG,aAAa,CAAC;SAC7B;aAAM,IAAI,IAAA,gCAAc,EAAC,GAAG,CAAC,EAAE;YAC9B,MAAM,UAAU,GAAG,MAAM,IAAA,o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AE9D,IAAI;QACF,MAAM,kBAAkB,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;QACjF,MAAM,kBAAkB,CAAC,OAAO,CAAC,eAAe,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;QACpF,MAAM,kBAAkB,CAAC,OAAO,CAAC,gBAAgB,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;QAErF,YAAE,CAAC,aAAa,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;KACpE;YAAS;QACR,OAAO,CAAC,IAAI,EAAE,CAAC;KAChB;AACH,CAAC,CAAA,CAAC;AA3BW,QAAA,iBAAiB,qBA2B5B"}
|
|
@@ -18,8 +18,9 @@ const pagesResolve_1 = require("../../blocks/pagesResolve");
|
|
|
18
18
|
const configToEnv_1 = require("../../blocks/configToEnv");
|
|
19
19
|
const stats_1 = require("../../constants/stats");
|
|
20
20
|
const client_1 = require("../../blocks/pwa/client");
|
|
21
|
+
const ModuleFederationFixRange_1 = require("../../plugins/ModuleFederationFixRange");
|
|
21
22
|
exports.default = (configManager) => (config) => {
|
|
22
|
-
const { polyfill, fileSystemPages } = configManager;
|
|
23
|
+
const { polyfill, fileSystemPages, shared } = configManager;
|
|
23
24
|
const portal = path_1.default.resolve(configManager.rootDir, `packages/${process.env.APP_ID}/portal.js`);
|
|
24
25
|
const polyfillPath = path_1.default.resolve(configManager.rootDir, polyfill !== null && polyfill !== void 0 ? polyfill : 'src/polyfill');
|
|
25
26
|
const portalExists = fs_1.default.existsSync(portal);
|
|
@@ -45,6 +46,11 @@ exports.default = (configManager) => (config) => {
|
|
|
45
46
|
.end()
|
|
46
47
|
.when(portalExists, (cfg) => cfg.entry('portal').add(portal))
|
|
47
48
|
.when(polyfillExists, (cfg) => cfg.entry('polyfill').add(polyfillPath));
|
|
49
|
+
config.plugin('module-federation-validate-duplicates').use(ModuleFederationFixRange_1.ModuleFederationFixRange, [
|
|
50
|
+
{
|
|
51
|
+
flexibleTramvaiVersions: shared.flexibleTramvaiVersions,
|
|
52
|
+
},
|
|
53
|
+
]);
|
|
48
54
|
config
|
|
49
55
|
.plugin('stats-plugin')
|
|
50
56
|
.use(webpack_stats_plugin_1.StatsWriterPlugin, [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../src/library/webpack/application/client/common.ts"],"names":[],"mappings":";;;AAAA,wDAAwB;AACxB,oDAAoB;AAEpB,+DAAyD;AAIzD,+DAAmE;AAEnE,qEAAuC;AACvC,sCAA8C;AAC9C,mFAA6C;AAC7C,iEAAiC;AACjC,iEAAiC;AACjC,qEAAqC;AACrC,mEAAmC;AACnC,uFAAuD;AACvD,iFAAiD;AACjD,4DAAyD;AACzD,0DAAuD;AACvD,iDAAoF;AACpF,oDAAmD;AAEnD,kBAAe,CAAC,aAAoD,EAAE,EAAE,CAAC,CAAC,MAAc,EAAE,EAAE;IAC1F,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../src/library/webpack/application/client/common.ts"],"names":[],"mappings":";;;AAAA,wDAAwB;AACxB,oDAAoB;AAEpB,+DAAyD;AAIzD,+DAAmE;AAEnE,qEAAuC;AACvC,sCAA8C;AAC9C,mFAA6C;AAC7C,iEAAiC;AACjC,iEAAiC;AACjC,qEAAqC;AACrC,mEAAmC;AACnC,uFAAuD;AACvD,iFAAiD;AACjD,4DAAyD;AACzD,0DAAuD;AACvD,iDAAoF;AACpF,oDAAmD;AAEnD,qFAAkF;AAElF,kBAAe,CAAC,aAAoD,EAAE,EAAE,CAAC,CAAC,MAAc,EAAE,EAAE;IAC1F,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC;IA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|
|
|
6
6
|
const filesClient_1 = tslib_1.__importDefault(require("../../blocks/filesClient"));
|
|
7
7
|
const nodeClient_1 = tslib_1.__importDefault(require("../../blocks/nodeClient"));
|
|
8
8
|
const postcssAssets_1 = tslib_1.__importDefault(require("../../blocks/postcssAssets"));
|
|
9
|
+
const ModuleFederationFixRange_1 = require("../../plugins/ModuleFederationFixRange");
|
|
9
10
|
exports.default = (configManager) => (config) => {
|
|
10
|
-
const { name, version } = configManager;
|
|
11
|
+
const { name, version, shared } = configManager;
|
|
11
12
|
config.name('client');
|
|
12
13
|
config.batch((0, common_1.default)(configManager));
|
|
13
14
|
config.target(['web', 'es5']);
|
|
@@ -23,6 +24,11 @@ exports.default = (configManager) => (config) => {
|
|
|
23
24
|
filename: `${name}_stats@${version}.json`,
|
|
24
25
|
},
|
|
25
26
|
]);
|
|
27
|
+
config.plugin('module-federation-validate-duplicates').use(ModuleFederationFixRange_1.ModuleFederationFixRange, [
|
|
28
|
+
{
|
|
29
|
+
flexibleTramvaiVersions: shared.flexibleTramvaiVersions,
|
|
30
|
+
},
|
|
31
|
+
]);
|
|
26
32
|
config.batch((0, filesClient_1.default)(configManager)).batch((0, nodeClient_1.default)(configManager));
|
|
27
33
|
};
|
|
28
34
|
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../src/library/webpack/child-app/client/common.ts"],"names":[],"mappings":";;;AACA,kDAAiE;AAIjE,+DAA+B;AAC/B,mFAA6C;AAC7C,iFAAiD;AACjD,uFAAuD;AAGvD,kBAAe,CAAC,aAAiD,EAAE,EAAE,CAAC,CAAC,MAAc,EAAE,EAAE;IACvF,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../src/library/webpack/child-app/client/common.ts"],"names":[],"mappings":";;;AACA,kDAAiE;AAIjE,+DAA+B;AAC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shared: { deps, defaultTramvaiDependencies }, } = configManager;
|
|
15
15
|
const isChild = type === 'child-app';
|
|
16
|
-
let
|
|
16
|
+
let defaultDependenciesList = defaultTramvaiDependencies ? DEFAULT_DEPENDENCIES_LIST : [];
|
|
17
17
|
if (typeof defaultTramvaiDependencies === 'undefined') {
|
|
18
18
|
if (type === 'child-app') {
|
|
19
|
-
|
|
19
|
+
defaultDependenciesList = DEFAULT_DEPENDENCIES_LIST;
|
|
20
20
|
}
|
|
21
21
|
else if (type === 'application') {
|
|
22
22
|
const packageJson = (0, safeRequire_1.safeRequire)(path_1.default.resolve(rootDir, 'package.json'), true);
|
|
23
23
|
// add default dependencies only if child-app is in use to minimize bundle size for apps
|
|
24
24
|
// without child-apps
|
|
25
25
|
if ((_a = packageJson === null || packageJson === void 0 ? void 0 : packageJson.dependencies) === null || _a === void 0 ? void 0 : _a['@tramvai/module-child-app']) {
|
|
26
|
-
|
|
26
|
+
defaultDependenciesList = DEFAULT_DEPENDENCIES_LIST;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
return Object.assign(Object.assign({},
|
|
30
|
+
return Object.assign(Object.assign({}, defaultDependenciesList.concat(deps).reduce((acc, dep) => {
|
|
31
31
|
const { name, singleton = false } = typeof dep === 'string' ? { name: dep } : dep;
|
|
32
32
|
acc[name] = {
|
|
33
33
|
import: name,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type webpack from 'webpack';
|
|
2
|
+
import type { Compiler, NormalModule } from 'webpack';
|
|
3
|
+
type SemverRange = [number, number, number, number];
|
|
4
|
+
interface SharedModuleOptions {
|
|
5
|
+
shareKey: string;
|
|
6
|
+
requiredVersion?: SemverRange;
|
|
7
|
+
importResolved: string;
|
|
8
|
+
singleton?: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface SharedModule extends NormalModule {
|
|
11
|
+
options?: SharedModuleOptions;
|
|
12
|
+
}
|
|
13
|
+
export interface ModuleFederationFixRangeOptions {
|
|
14
|
+
flexibleTramvaiVersions: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare class ModuleFederationFixRange implements webpack.WebpackPluginInstance {
|
|
17
|
+
private flexibleTramvaiVersions;
|
|
18
|
+
private sharedModules;
|
|
19
|
+
constructor({ flexibleTramvaiVersions }: ModuleFederationFixRangeOptions);
|
|
20
|
+
apply(compiler: Compiler): void;
|
|
21
|
+
fixVersionRange(module: SharedModule): void;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ModuleFederationFixRange = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const resolve_1 = require("resolve");
|
|
6
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
+
// eslint-disable-next-line no-restricted-imports
|
|
8
|
+
const semver_1 = require("webpack/lib/util/semver");
|
|
9
|
+
const tramvaiVersions_1 = require("../../../utils/tramvaiVersions");
|
|
10
|
+
const PLUGIN_NAME = 'ModuleFederationValidateDuplicates';
|
|
11
|
+
const resolvePackageVersion = (name, basedir) => {
|
|
12
|
+
try {
|
|
13
|
+
const packageJsonPath = (0, resolve_1.sync)(`${name}/package.json`, {
|
|
14
|
+
basedir,
|
|
15
|
+
});
|
|
16
|
+
const packageJson = require(packageJsonPath);
|
|
17
|
+
return packageJson.version;
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
console.warn(`ModuleFederation: could not infer version for package "${name}"`);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
class ModuleFederationFixRange {
|
|
24
|
+
constructor({ flexibleTramvaiVersions }) {
|
|
25
|
+
// { name: { importResolved: { number }} }
|
|
26
|
+
this.sharedModules = new Map();
|
|
27
|
+
this.flexibleTramvaiVersions = flexibleTramvaiVersions !== null && flexibleTramvaiVersions !== void 0 ? flexibleTramvaiVersions : false;
|
|
28
|
+
}
|
|
29
|
+
apply(compiler) {
|
|
30
|
+
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (_, { normalModuleFactory }) => {
|
|
31
|
+
normalModuleFactory.hooks.factorize.intercept({
|
|
32
|
+
register: (tap) => {
|
|
33
|
+
if (tap.name === 'ConsumeSharedPlugin') {
|
|
34
|
+
const originalFn = tap.fn;
|
|
35
|
+
// eslint-disable-next-line no-param-reassign
|
|
36
|
+
tap.fn = (...args) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const module = yield originalFn(...args);
|
|
38
|
+
if (module === null || module === void 0 ? void 0 : module.options) {
|
|
39
|
+
this.fixVersionRange(module);
|
|
40
|
+
}
|
|
41
|
+
return module;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return tap;
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
compiler.hooks.done.tap(PLUGIN_NAME, () => {
|
|
49
|
+
const duplicates = [];
|
|
50
|
+
const criticalDuplicates = [];
|
|
51
|
+
for (const [name, shared] of this.sharedModules) {
|
|
52
|
+
if (shared.size > 1) {
|
|
53
|
+
duplicates.push({
|
|
54
|
+
name,
|
|
55
|
+
paths: [...shared.keys()],
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
for (const [path, versions] of shared) {
|
|
59
|
+
if (versions.size > 1) {
|
|
60
|
+
criticalDuplicates.push({ name, path });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// reset sharedModules info after compilation has ended
|
|
65
|
+
this.sharedModules = new Map();
|
|
66
|
+
if (duplicates.length) {
|
|
67
|
+
console.warn(`⚠️ ModuleFederation: Found duplicates for next shared modules:
|
|
68
|
+
${duplicates
|
|
69
|
+
.map(({ name, paths }) => {
|
|
70
|
+
return `\t${chalk_1.default.yellowBright(name)}: ${paths.join(', ')}`;
|
|
71
|
+
})
|
|
72
|
+
.join('\n')}
|
|
73
|
+
`);
|
|
74
|
+
}
|
|
75
|
+
if (criticalDuplicates.length) {
|
|
76
|
+
console.error(`❗ ModuleFederation: Found duplicates for shared modules with different major versions that are resolved to the same path:
|
|
77
|
+
${criticalDuplicates
|
|
78
|
+
.map(({ name, path }) => {
|
|
79
|
+
return `\t${chalk_1.default.red(name)}: ${path}`;
|
|
80
|
+
})
|
|
81
|
+
.join('\n')}`);
|
|
82
|
+
throw new Error('ModuleFederation: Different major versions have resolved to the same path for shared modules, please review errors above');
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
fixVersionRange(module) {
|
|
87
|
+
const { options, options: { shareKey: name, singleton, importResolved }, context, } = module;
|
|
88
|
+
let { requiredVersion } = options;
|
|
89
|
+
// ignore singletons as the actual version won't change anything
|
|
90
|
+
// and usually it is just a react and co libraries
|
|
91
|
+
if (!requiredVersion && context && !singleton) {
|
|
92
|
+
const version = resolvePackageVersion(name, context);
|
|
93
|
+
if (version) {
|
|
94
|
+
requiredVersion = (0, semver_1.parseRange)(version);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (!requiredVersion) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (requiredVersion && this.flexibleTramvaiVersions) {
|
|
101
|
+
const isTramvai = (0, tramvaiVersions_1.isUnifiedVersion)(name) || (0, tramvaiVersions_1.isDependantLib)(name);
|
|
102
|
+
if (isTramvai && requiredVersion[0] > 2) {
|
|
103
|
+
// 1 is used for `^` range modifier
|
|
104
|
+
// see https://github.com/webpack/webpack/blob/56363993156e06a1230c9759eba277a22e6b6604/lib/util/semver.js#LL235C20-L235C20
|
|
105
|
+
requiredVersion[0] = 1;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// change version in webpack module
|
|
109
|
+
options.requiredVersion = requiredVersion;
|
|
110
|
+
let shared = this.sharedModules.get(name);
|
|
111
|
+
if (!shared) {
|
|
112
|
+
shared = new Map();
|
|
113
|
+
this.sharedModules.set(name, shared);
|
|
114
|
+
}
|
|
115
|
+
let versions = shared.get(importResolved);
|
|
116
|
+
if (!versions) {
|
|
117
|
+
versions = new Set();
|
|
118
|
+
shared.set(importResolved, versions);
|
|
119
|
+
}
|
|
120
|
+
// save major version of the semver array
|
|
121
|
+
versions.add(requiredVersion[1]);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
exports.ModuleFederationFixRange = ModuleFederationFixRange;
|
|
125
|
+
//# sourceMappingURL=ModuleFederationFixRange.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModuleFederationFixRange.js","sourceRoot":"","sources":["../../../../src/library/webpack/plugins/ModuleFederationFixRange.ts"],"names":[],"mappings":";;;;AAEA,qCAA0C;AAE1C,0DAA0B;AAC1B,iDAAiD;AACjD,oDAAqD;AACrD,oEAAkF;AAElF,MAAM,WAAW,GAAG,oCAAoC,CAAC;AAezD,MAAM,qBAAqB,GAAG,CAAC,IAAY,EAAE,OAAe,EAAE,EAAE;IAC9D,IAAI;QACF,MAAM,eAAe,GAAG,IAAA,cAAO,EAAC,GAAG,IAAI,eAAe,EAAE;YACtD,OAAO;SACR,CAAC,CAAC;QACH,MAAM,WAAW,GAAoC,OAAO,CAAC,eAAe,CAAC,CAAC;QAE9E,OAAO,WAAW,CAAC,OAAO,CAAC;KAC5B;IAAC,OAAO,KAAU,EAAE;QACnB,OAAO,CAAC,IAAI,CAAC,0DAA0D,IAAI,GAAG,CAAC,CAAC;KACjF;AACH,CAAC,CAAC;AAMF,MAAa,wBAAwB;IAKnC,YAAY,EAAE,uBAAuB,EAAmC;QAHxE,0CAA0C;QAClC,kBAAa,GAA0C,IAAI,GAAG,EAAE,CAAC;QAGvE,IAAI,CAAC,uBAAuB,GAAG,uBAAuB,aAAvB,uBAAuB,cAAvB,uBAAuB,GAAI,KAAK,CAAC;IAClE,CAAC;IAED,KAAK,CAAC,QAAkB;QACtB,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,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,IAAA,mBAAU,EAAC,OAAO,CAAC,CAAC;aACvC;SACF;QAED,IAAI,CAAC,eAAe,EAAE;YACpB,OAAO;SACR;QAED,IAAI,eAAe,IAAI,IAAI,CAAC,uBAAuB,EAAE;YACnD,MAAM,SAAS,GAAG,IAAA,kCAAgB,EAAC,IAAI,CAAC,IAAI,IAAA,gCAAc,EAAC,IAAI,CAAC,CAAC;YAEjE,IAAI,SAAS,IAAI,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;gBACvC,mCAAmC;gBACnC,2HAA2H;gBAC3H,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;aACxB;SACF;QAED,mCAAmC;QACnC,OAAO,CAAC,eAAe,GAAG,eAAe,CAAC;QAE1C,IAAI,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAE1C,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;YACnB,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;SACtC;QAED,IAAI,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAE1C,IAAI,CAAC,QAAQ,EAAE;YACb,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;YACrB,MAAM,CAAC,GAAG,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;SACtC;QAED,yCAAyC;QACzC,QAAQ,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC;CACF;AApID,4DAoIC"}
|
|
@@ -1225,7 +1225,13 @@
|
|
|
1225
1225
|
"properties": {
|
|
1226
1226
|
"defaultTramvaiDependencies": {
|
|
1227
1227
|
"title": "Should default dependencies list be added to shared list",
|
|
1228
|
-
"description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of",
|
|
1228
|
+
"description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of tramvai/module-child-app is specified in package.json\nand for child-apps",
|
|
1229
|
+
"type": "boolean"
|
|
1230
|
+
},
|
|
1231
|
+
"flexibleTramvaiVersions": {
|
|
1232
|
+
"title": "add caret range specifier for tramvai dependencies",
|
|
1233
|
+
"description": "minimal versions are inferred from package.json",
|
|
1234
|
+
"default": true,
|
|
1229
1235
|
"type": "boolean"
|
|
1230
1236
|
},
|
|
1231
1237
|
"deps": {
|
|
@@ -1746,7 +1752,13 @@
|
|
|
1746
1752
|
"properties": {
|
|
1747
1753
|
"defaultTramvaiDependencies": {
|
|
1748
1754
|
"title": "Should default dependencies list be added to shared list",
|
|
1749
|
-
"description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of",
|
|
1755
|
+
"description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of tramvai/module-child-app is specified in package.json\nand for child-apps",
|
|
1756
|
+
"type": "boolean"
|
|
1757
|
+
},
|
|
1758
|
+
"flexibleTramvaiVersions": {
|
|
1759
|
+
"title": "add caret range specifier for tramvai dependencies",
|
|
1760
|
+
"description": "minimal versions are inferred from package.json",
|
|
1761
|
+
"default": true,
|
|
1750
1762
|
"type": "boolean"
|
|
1751
1763
|
},
|
|
1752
1764
|
"deps": {
|
|
@@ -2267,7 +2279,13 @@
|
|
|
2267
2279
|
"properties": {
|
|
2268
2280
|
"defaultTramvaiDependencies": {
|
|
2269
2281
|
"title": "Should default dependencies list be added to shared list",
|
|
2270
|
-
"description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of",
|
|
2282
|
+
"description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of tramvai/module-child-app is specified in package.json\nand for child-apps",
|
|
2283
|
+
"type": "boolean"
|
|
2284
|
+
},
|
|
2285
|
+
"flexibleTramvaiVersions": {
|
|
2286
|
+
"title": "add caret range specifier for tramvai dependencies",
|
|
2287
|
+
"description": "minimal versions are inferred from package.json",
|
|
2288
|
+
"default": true,
|
|
2271
2289
|
"type": "boolean"
|
|
2272
2290
|
},
|
|
2273
2291
|
"deps": {
|
|
@@ -269,10 +269,16 @@ export interface CliConfigEntry extends ConfigEntry {
|
|
|
269
269
|
/**
|
|
270
270
|
* @title Should default dependencies list be added to shared list
|
|
271
271
|
* @description It includes the list of commonly used dependencies in the child-apps
|
|
272
|
-
* By default, it is enabled in application in case of
|
|
272
|
+
* By default, it is enabled in application in case of tramvai/module-child-app is specified in package.json
|
|
273
273
|
* and for child-apps
|
|
274
274
|
*/
|
|
275
275
|
defaultTramvaiDependencies?: boolean;
|
|
276
|
+
/**
|
|
277
|
+
* @title add caret range specifier for tramvai dependencies
|
|
278
|
+
* @description minimal versions are inferred from package.json
|
|
279
|
+
* @default true
|
|
280
|
+
*/
|
|
281
|
+
flexibleTramvaiVersions: boolean;
|
|
276
282
|
/**
|
|
277
283
|
* @title list of the dependencies that will be shared
|
|
278
284
|
* @default []
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isDependantLib = exports.isUnifiedVersion = exports.DEPENDANT_LIBS_MAP = void 0;
|
|
4
|
+
// map of packages that is not in unified versioning
|
|
5
|
+
// but we still want to update it
|
|
6
|
+
// actual version to update will be calculated from the some of the @tramvai/module
|
|
7
|
+
exports.DEPENDANT_LIBS_MAP = new Map([
|
|
8
|
+
['@tinkoff/logger', '@tramvai/module-log'],
|
|
9
|
+
['@tinkoff/dippy', '@tramvai/core'],
|
|
10
|
+
['@tinkoff/router', '@tramvai/module-router'],
|
|
11
|
+
['@tinkoff/url', '@tramvai/module-common'],
|
|
12
|
+
['@tinkoff/errors', '@tramvai/module-common'],
|
|
13
|
+
['@tinkoff/roles', '@tramvai/module-authenticate'],
|
|
14
|
+
['@tinkoff/pubsub', '@tramvai/module-common'],
|
|
15
|
+
['@tinkoff/hook-runner', '@tramvai/module-common'],
|
|
16
|
+
['@tinkoff/htmlpagebuilder', '@tramvai/module-render'],
|
|
17
|
+
['@tinkoff/browser-timings', '@tramvai/module-metrics'],
|
|
18
|
+
['@tinkoff/meta-tags-generate', '@tramvai/module-render'],
|
|
19
|
+
['@tinkoff/pack-polyfills', ''],
|
|
20
|
+
['@tinkoff/browserslist-config', '@tramvai/cli'],
|
|
21
|
+
]);
|
|
22
|
+
const isUnifiedVersion = (name) => {
|
|
23
|
+
return name.startsWith('@tramvai');
|
|
24
|
+
};
|
|
25
|
+
exports.isUnifiedVersion = isUnifiedVersion;
|
|
26
|
+
const isDependantLib = (name) => {
|
|
27
|
+
return exports.DEPENDANT_LIBS_MAP.has(name);
|
|
28
|
+
};
|
|
29
|
+
exports.isDependantLib = isDependantLib;
|
|
30
|
+
//# sourceMappingURL=tramvaiVersions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tramvaiVersions.js","sourceRoot":"","sources":["../../src/utils/tramvaiVersions.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACpD,iCAAiC;AACjC,mFAAmF;AACtE,QAAA,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACxC,CAAC,iBAAiB,EAAE,qBAAqB,CAAC;IAC1C,CAAC,gBAAgB,EAAE,eAAe,CAAC;IACnC,CAAC,iBAAiB,EAAE,wBAAwB,CAAC;IAC7C,CAAC,cAAc,EAAE,wBAAwB,CAAC;IAC1C,CAAC,iBAAiB,EAAE,wBAAwB,CAAC;IAC7C,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAClD,CAAC,iBAAiB,EAAE,wBAAwB,CAAC;IAC7C,CAAC,sBAAsB,EAAE,wBAAwB,CAAC;IAClD,CAAC,0BAA0B,EAAE,wBAAwB,CAAC;IACtD,CAAC,0BAA0B,EAAE,yBAAyB,CAAC;IACvD,CAAC,6BAA6B,EAAE,wBAAwB,CAAC;IACzD,CAAC,yBAAyB,EAAE,EAAE,CAAC;IAC/B,CAAC,8BAA8B,EAAE,cAAc,CAAC;CACjD,CAAC,CAAC;AAEI,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAE,EAAE;IAC/C,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AACrC,CAAC,CAAC;AAFW,QAAA,gBAAgB,oBAE3B;AAEK,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,EAAE;IAC7C,OAAO,0BAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC,CAAC;AAFW,QAAA,cAAc,kBAEzB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/cli",
|
|
3
|
-
"version": "2.111.
|
|
3
|
+
"version": "2.111.1",
|
|
4
4
|
"description": "Cli инструмент для сборки и запуска приложений",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@discoveryjs/json-ext": "^0.5.7",
|
|
57
57
|
"@fastify/compress": "^6.2.0",
|
|
58
58
|
"@fastify/static": "^6.9.0",
|
|
59
|
-
"@module-federation/node": "^0.
|
|
59
|
+
"@module-federation/node": "^0.15.1",
|
|
60
60
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
|
|
61
61
|
"@sentry/node": "^6.2.5",
|
|
62
62
|
"@svgr/webpack": "^6.5.1",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@tinkoff/utils": "^2.1.3",
|
|
72
72
|
"@tinkoff/webpack-dedupe-plugin": "1.0.5",
|
|
73
73
|
"@tramvai/build": "3.1.3",
|
|
74
|
-
"@tramvai/react": "2.111.
|
|
74
|
+
"@tramvai/react": "2.111.1",
|
|
75
75
|
"@tramvai/tools-check-versions": "0.4.14",
|
|
76
76
|
"@tramvai/tools-migrate": "0.6.18",
|
|
77
77
|
"ajv": "^6.12.6",
|
|
@@ -157,11 +157,11 @@
|
|
|
157
157
|
"v8-compile-cache": "^2.3.0",
|
|
158
158
|
"validate-npm-package-name": "^3.0.0",
|
|
159
159
|
"wait-on": "^5.3.0",
|
|
160
|
-
"webpack": "5.
|
|
160
|
+
"webpack": "5.85.0",
|
|
161
161
|
"webpack-build-notifier": "^2.3.0",
|
|
162
|
-
"webpack-bundle-analyzer": "^4.
|
|
162
|
+
"webpack-bundle-analyzer": "^4.9.0",
|
|
163
163
|
"webpack-chain": "^6.5.1",
|
|
164
|
-
"webpack-dev-middleware": "^6.
|
|
164
|
+
"webpack-dev-middleware": "^6.1.1",
|
|
165
165
|
"webpack-hot-middleware": "^2.25.3",
|
|
166
166
|
"webpack-stats-plugin": "^1.1.1",
|
|
167
167
|
"webpackbar": "^5.0.2",
|
package/schema.json
CHANGED
|
@@ -1246,7 +1246,13 @@
|
|
|
1246
1246
|
"properties": {
|
|
1247
1247
|
"defaultTramvaiDependencies": {
|
|
1248
1248
|
"title": "Should default dependencies list be added to shared list",
|
|
1249
|
-
"description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of",
|
|
1249
|
+
"description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of tramvai/module-child-app is specified in package.json\nand for child-apps",
|
|
1250
|
+
"type": "boolean"
|
|
1251
|
+
},
|
|
1252
|
+
"flexibleTramvaiVersions": {
|
|
1253
|
+
"title": "add caret range specifier for tramvai dependencies",
|
|
1254
|
+
"description": "minimal versions are inferred from package.json",
|
|
1255
|
+
"default": true,
|
|
1250
1256
|
"type": "boolean"
|
|
1251
1257
|
},
|
|
1252
1258
|
"deps": {
|
|
@@ -1775,7 +1781,13 @@
|
|
|
1775
1781
|
"properties": {
|
|
1776
1782
|
"defaultTramvaiDependencies": {
|
|
1777
1783
|
"title": "Should default dependencies list be added to shared list",
|
|
1778
|
-
"description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of",
|
|
1784
|
+
"description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of tramvai/module-child-app is specified in package.json\nand for child-apps",
|
|
1785
|
+
"type": "boolean"
|
|
1786
|
+
},
|
|
1787
|
+
"flexibleTramvaiVersions": {
|
|
1788
|
+
"title": "add caret range specifier for tramvai dependencies",
|
|
1789
|
+
"description": "minimal versions are inferred from package.json",
|
|
1790
|
+
"default": true,
|
|
1779
1791
|
"type": "boolean"
|
|
1780
1792
|
},
|
|
1781
1793
|
"deps": {
|
|
@@ -2304,7 +2316,13 @@
|
|
|
2304
2316
|
"properties": {
|
|
2305
2317
|
"defaultTramvaiDependencies": {
|
|
2306
2318
|
"title": "Should default dependencies list be added to shared list",
|
|
2307
|
-
"description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of",
|
|
2319
|
+
"description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of tramvai/module-child-app is specified in package.json\nand for child-apps",
|
|
2320
|
+
"type": "boolean"
|
|
2321
|
+
},
|
|
2322
|
+
"flexibleTramvaiVersions": {
|
|
2323
|
+
"title": "add caret range specifier for tramvai dependencies",
|
|
2324
|
+
"description": "minimal versions are inferred from package.json",
|
|
2325
|
+
"default": true,
|
|
2308
2326
|
"type": "boolean"
|
|
2309
2327
|
},
|
|
2310
2328
|
"deps": {
|
|
@@ -1,28 +1,6 @@
|
|
|
1
1
|
import getLatestPackageVersion from 'latest-version';
|
|
2
2
|
import getPackageInfo from 'package-json';
|
|
3
|
-
|
|
4
|
-
// map of packages that is not in unified versioning
|
|
5
|
-
// but we still want to update it
|
|
6
|
-
// actual version to update will be calculated from the some of the @tramvai/module
|
|
7
|
-
const DEPENDANT_LIBS_MAP = new Map([
|
|
8
|
-
['@tinkoff/logger', '@tramvai/module-log'],
|
|
9
|
-
['@tinkoff/dippy', '@tramvai/core'],
|
|
10
|
-
['@tinkoff/router', '@tramvai/module-router'],
|
|
11
|
-
['@tinkoff/url', '@tramvai/module-common'],
|
|
12
|
-
['@tinkoff/errors', '@tramvai/module-common'],
|
|
13
|
-
['@tinkoff/roles', '@tramvai/module-authenticate'],
|
|
14
|
-
['@tinkoff/pubsub', '@tramvai/module-common'],
|
|
15
|
-
['@tinkoff/hook-runner', '@tramvai/module-common'],
|
|
16
|
-
['@tinkoff/htmlpagebuilder', '@tramvai/module-render'],
|
|
17
|
-
['@tinkoff/browser-timings', '@tramvai/module-metrics'],
|
|
18
|
-
['@tinkoff/meta-tags-generate', '@tramvai/module-render'],
|
|
19
|
-
['@tinkoff/pack-polyfills', ''],
|
|
20
|
-
['@tinkoff/browserslist-config', '@tramvai/cli'],
|
|
21
|
-
]);
|
|
22
|
-
|
|
23
|
-
export const isDependantLib = (name: string) => {
|
|
24
|
-
return DEPENDANT_LIBS_MAP.has(name);
|
|
25
|
-
};
|
|
3
|
+
import { DEPENDANT_LIBS_MAP } from '../../utils/tramvaiVersions';
|
|
26
4
|
|
|
27
5
|
export const getLibPackageVersion = async (
|
|
28
6
|
name: string,
|
|
@@ -4,11 +4,8 @@ import pMap from 'p-map';
|
|
|
4
4
|
import type { Ora } from 'ora';
|
|
5
5
|
import ora from 'ora';
|
|
6
6
|
import { packageHasVersion } from '../../utils/commands/dependencies/packageHasVersion';
|
|
7
|
-
import { getLibPackageVersion
|
|
8
|
-
|
|
9
|
-
const isUnifiedVersion = (name: string) => {
|
|
10
|
-
return name.startsWith('@tramvai');
|
|
11
|
-
};
|
|
7
|
+
import { getLibPackageVersion } from './dependantLibs';
|
|
8
|
+
import { isDependantLib, isUnifiedVersion } from '../../utils/tramvaiVersions';
|
|
12
9
|
|
|
13
10
|
const getVersionFromDep = (dep?: string) => {
|
|
14
11
|
if (dep) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`client: create-token-pure.ts 1`] = `
|
|
4
4
|
"__webpack_require__.r(__webpack_exports__);
|
|
5
5
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6
|
-
/* harmony export */
|
|
6
|
+
/* harmony export */ TEST_TOKEN: function() { return /* binding */ TEST_TOKEN; }
|
|
7
7
|
/* harmony export */ });
|
|
8
8
|
/* harmony import */ var _tramvai_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/library/swc/__integration__/mocks/tramvai-core.ts");
|
|
9
9
|
/* provided dependency */ var __react_refresh_utils__ = __webpack_require__("../../node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js");
|
|
@@ -149,7 +149,7 @@ __webpack_require__.$Refresh$.register(_c, "SvgLogo");
|
|
|
149
149
|
exports[`client: lazy-component.tsx 1`] = `
|
|
150
150
|
"__webpack_require__.r(__webpack_exports__);
|
|
151
151
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
152
|
-
/* harmony export */
|
|
152
|
+
/* harmony export */ Component: function() { return /* binding */ Component; }
|
|
153
153
|
/* harmony export */ });
|
|
154
154
|
/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("webpack/sharing/consume/default/react/jsx-dev-runtime/react/jsx-dev-runtime");
|
|
155
155
|
/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__);
|
|
@@ -242,7 +242,7 @@ if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Pr
|
|
|
242
242
|
exports[`client: node-env.ts 1`] = `
|
|
243
243
|
"__webpack_require__.r(__webpack_exports__);
|
|
244
244
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
245
|
-
/* harmony export */
|
|
245
|
+
/* harmony export */ func: function() { return /* binding */ func; }
|
|
246
246
|
/* harmony export */ });
|
|
247
247
|
/* provided dependency */ var __react_refresh_utils__ = __webpack_require__("../../node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js");
|
|
248
248
|
__webpack_require__.$Refresh$.runtime = __webpack_require__("../../node_modules/react-refresh/runtime.js");
|
|
@@ -294,7 +294,7 @@ if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Pr
|
|
|
294
294
|
exports[`client: provider-stack.ts 1`] = `
|
|
295
295
|
"__webpack_require__.r(__webpack_exports__);
|
|
296
296
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
297
|
-
/* harmony export */
|
|
297
|
+
/* harmony export */ providers: function() { return /* binding */ providers; }
|
|
298
298
|
/* harmony export */ });
|
|
299
299
|
/* harmony import */ var _tramvai_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/library/swc/__integration__/mocks/tramvai-core.ts");
|
|
300
300
|
/* harmony import */ var _create_token_pure__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./src/library/swc/__integration__/create-token-pure.ts");
|
|
@@ -352,7 +352,7 @@ if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Pr
|
|
|
352
352
|
exports[`client: react-svg.tsx 1`] = `
|
|
353
353
|
"__webpack_require__.r(__webpack_exports__);
|
|
354
354
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
355
|
-
/* harmony export */
|
|
355
|
+
/* harmony export */ Component: function() { return /* binding */ Component; }
|
|
356
356
|
/* harmony export */ });
|
|
357
357
|
/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("webpack/sharing/consume/default/react/jsx-dev-runtime/react/jsx-dev-runtime");
|
|
358
358
|
/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__);
|
|
@@ -417,7 +417,7 @@ if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Pr
|
|
|
417
417
|
exports[`client: server.inline.ts 1`] = `
|
|
418
418
|
"__webpack_require__.r(__webpack_exports__);
|
|
419
419
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
420
|
-
/* harmony export */
|
|
420
|
+
/* harmony export */ ForBrowser: function() { return /* binding */ ForBrowser; }
|
|
421
421
|
/* harmony export */ });
|
|
422
422
|
/* provided dependency */ var __react_refresh_utils__ = __webpack_require__("../../node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js");
|
|
423
423
|
__webpack_require__.$Refresh$.runtime = __webpack_require__("../../node_modules/react-refresh/runtime.js");
|
|
@@ -467,7 +467,7 @@ if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Pr
|
|
|
467
467
|
exports[`client: typeof-window.ts 1`] = `
|
|
468
468
|
"__webpack_require__.r(__webpack_exports__);
|
|
469
469
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
470
|
-
/* harmony export */
|
|
470
|
+
/* harmony export */ func: function() { return /* binding */ func; }
|
|
471
471
|
/* harmony export */ });
|
|
472
472
|
/* provided dependency */ var __react_refresh_utils__ = __webpack_require__("../../node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js");
|
|
473
473
|
__webpack_require__.$Refresh$.runtime = __webpack_require__("../../node_modules/react-refresh/runtime.js");
|
|
@@ -519,7 +519,7 @@ if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Pr
|
|
|
519
519
|
exports[`server: create-token-pure.ts 1`] = `
|
|
520
520
|
"__webpack_require__.r(__webpack_exports__);
|
|
521
521
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
522
|
-
/* harmony export */
|
|
522
|
+
/* harmony export */ TEST_TOKEN: function() { return /* binding */ TEST_TOKEN; }
|
|
523
523
|
/* harmony export */ });
|
|
524
524
|
/* harmony import */ var _tramvai_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/library/swc/__integration__/mocks/tramvai-core.ts");
|
|
525
525
|
|
|
@@ -614,7 +614,7 @@ const SvgLogo = (props)=>/*#__PURE__*/ (0,react_jsx_dev_runtime__WEBPACK_IMPORTE
|
|
|
614
614
|
exports[`server: lazy-component.tsx 1`] = `
|
|
615
615
|
"__webpack_require__.r(__webpack_exports__);
|
|
616
616
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
617
|
-
/* harmony export */
|
|
617
|
+
/* harmony export */ Component: function() { return /* binding */ Component; }
|
|
618
618
|
/* harmony export */ });
|
|
619
619
|
/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("webpack/sharing/consume/default/react/jsx-dev-runtime/react/jsx-dev-runtime");
|
|
620
620
|
/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__);
|
|
@@ -670,7 +670,7 @@ const Component = ()=>{
|
|
|
670
670
|
exports[`server: node-env.ts 1`] = `
|
|
671
671
|
"__webpack_require__.r(__webpack_exports__);
|
|
672
672
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
673
|
-
/* harmony export */
|
|
673
|
+
/* harmony export */ func: function() { return /* binding */ func; }
|
|
674
674
|
/* harmony export */ });
|
|
675
675
|
let internalFunc;
|
|
676
676
|
if (true) {
|
|
@@ -688,7 +688,7 @@ const func = ()=>{
|
|
|
688
688
|
exports[`server: provider-stack.ts 1`] = `
|
|
689
689
|
"__webpack_require__.r(__webpack_exports__);
|
|
690
690
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
691
|
-
/* harmony export */
|
|
691
|
+
/* harmony export */ providers: function() { return /* binding */ providers; }
|
|
692
692
|
/* harmony export */ });
|
|
693
693
|
/* harmony import */ var _tramvai_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/library/swc/__integration__/mocks/tramvai-core.ts");
|
|
694
694
|
/* harmony import */ var _create_token_pure__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./src/library/swc/__integration__/create-token-pure.ts");
|
|
@@ -712,7 +712,7 @@ const providers = [
|
|
|
712
712
|
exports[`server: react-svg.tsx 1`] = `
|
|
713
713
|
"__webpack_require__.r(__webpack_exports__);
|
|
714
714
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
715
|
-
/* harmony export */
|
|
715
|
+
/* harmony export */ Component: function() { return /* binding */ Component; }
|
|
716
716
|
/* harmony export */ });
|
|
717
717
|
/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("webpack/sharing/consume/default/react/jsx-dev-runtime/react/jsx-dev-runtime");
|
|
718
718
|
/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__);
|
|
@@ -740,7 +740,7 @@ const Component = ()=>{
|
|
|
740
740
|
exports[`server: server.inline.ts 1`] = `
|
|
741
741
|
"__webpack_require__.r(__webpack_exports__);
|
|
742
742
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
743
|
-
/* harmony export */
|
|
743
|
+
/* harmony export */ ForBrowser: function() { return /* binding */ ForBrowser; }
|
|
744
744
|
/* harmony export */ });
|
|
745
745
|
var ForBrowser = /*#__PURE__*/ function() {
|
|
746
746
|
"use strict";
|
|
@@ -760,7 +760,7 @@ ForBrowser.prop = "static";
|
|
|
760
760
|
exports[`server: typeof-window.ts 1`] = `
|
|
761
761
|
"__webpack_require__.r(__webpack_exports__);
|
|
762
762
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
763
|
-
/* harmony export */
|
|
763
|
+
/* harmony export */ func: function() { return /* binding */ func; }
|
|
764
764
|
/* harmony export */ });
|
|
765
765
|
let internalFunc;
|
|
766
766
|
if (false) {}
|
|
@@ -20,9 +20,11 @@ import { pagesResolve } from '../../blocks/pagesResolve';
|
|
|
20
20
|
import { configToEnv } from '../../blocks/configToEnv';
|
|
21
21
|
import { DEFAULT_STATS_OPTIONS, DEFAULT_STATS_FIELDS } from '../../constants/stats';
|
|
22
22
|
import { pwaBlock } from '../../blocks/pwa/client';
|
|
23
|
+
import type { ModuleFederationFixRangeOptions } from '../../plugins/ModuleFederationFixRange';
|
|
24
|
+
import { ModuleFederationFixRange } from '../../plugins/ModuleFederationFixRange';
|
|
23
25
|
|
|
24
26
|
export default (configManager: ConfigManager<ApplicationConfigEntry>) => (config: Config) => {
|
|
25
|
-
const { polyfill, fileSystemPages } = configManager;
|
|
27
|
+
const { polyfill, fileSystemPages, shared } = configManager;
|
|
26
28
|
|
|
27
29
|
const portal = path.resolve(configManager.rootDir, `packages/${process.env.APP_ID}/portal.js`);
|
|
28
30
|
const polyfillPath = path.resolve(configManager.rootDir, polyfill ?? 'src/polyfill');
|
|
@@ -52,6 +54,12 @@ export default (configManager: ConfigManager<ApplicationConfigEntry>) => (config
|
|
|
52
54
|
.when(portalExists, (cfg) => cfg.entry('portal').add(portal))
|
|
53
55
|
.when(polyfillExists, (cfg) => cfg.entry('polyfill').add(polyfillPath));
|
|
54
56
|
|
|
57
|
+
config.plugin('module-federation-validate-duplicates').use(ModuleFederationFixRange, [
|
|
58
|
+
{
|
|
59
|
+
flexibleTramvaiVersions: shared.flexibleTramvaiVersions,
|
|
60
|
+
} as ModuleFederationFixRangeOptions,
|
|
61
|
+
]);
|
|
62
|
+
|
|
55
63
|
config
|
|
56
64
|
.plugin('stats-plugin')
|
|
57
65
|
.use(StatsWriterPlugin, [
|
|
@@ -8,9 +8,11 @@ import files from '../../blocks/filesClient';
|
|
|
8
8
|
import nodeClient from '../../blocks/nodeClient';
|
|
9
9
|
import postcssAssets from '../../blocks/postcssAssets';
|
|
10
10
|
import type { ChildAppConfigEntry } from '../../../../typings/configEntry/child-app';
|
|
11
|
+
import type { ModuleFederationFixRangeOptions } from '../../plugins/ModuleFederationFixRange';
|
|
12
|
+
import { ModuleFederationFixRange } from '../../plugins/ModuleFederationFixRange';
|
|
11
13
|
|
|
12
14
|
export default (configManager: ConfigManager<ChildAppConfigEntry>) => (config: Config) => {
|
|
13
|
-
const { name, version } = configManager;
|
|
15
|
+
const { name, version, shared } = configManager;
|
|
14
16
|
config.name('client');
|
|
15
17
|
|
|
16
18
|
config.batch(common(configManager));
|
|
@@ -32,5 +34,11 @@ export default (configManager: ConfigManager<ChildAppConfigEntry>) => (config: C
|
|
|
32
34
|
},
|
|
33
35
|
]);
|
|
34
36
|
|
|
37
|
+
config.plugin('module-federation-validate-duplicates').use(ModuleFederationFixRange, [
|
|
38
|
+
{
|
|
39
|
+
flexibleTramvaiVersions: shared.flexibleTramvaiVersions,
|
|
40
|
+
} as ModuleFederationFixRangeOptions,
|
|
41
|
+
]);
|
|
42
|
+
|
|
35
43
|
config.batch(files(configManager)).batch(nodeClient(configManager));
|
|
36
44
|
};
|
|
@@ -20,24 +20,24 @@ export const getSharedModules = (
|
|
|
20
20
|
} = configManager;
|
|
21
21
|
const isChild = type === 'child-app';
|
|
22
22
|
|
|
23
|
-
let
|
|
23
|
+
let defaultDependenciesList = defaultTramvaiDependencies ? DEFAULT_DEPENDENCIES_LIST : [];
|
|
24
24
|
|
|
25
25
|
if (typeof defaultTramvaiDependencies === 'undefined') {
|
|
26
26
|
if (type === 'child-app') {
|
|
27
|
-
|
|
27
|
+
defaultDependenciesList = DEFAULT_DEPENDENCIES_LIST;
|
|
28
28
|
} else if (type === 'application') {
|
|
29
29
|
const packageJson = safeRequire(path.resolve(rootDir, 'package.json'), true);
|
|
30
30
|
|
|
31
31
|
// add default dependencies only if child-app is in use to minimize bundle size for apps
|
|
32
32
|
// without child-apps
|
|
33
33
|
if (packageJson?.dependencies?.['@tramvai/module-child-app']) {
|
|
34
|
-
|
|
34
|
+
defaultDependenciesList = DEFAULT_DEPENDENCIES_LIST;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
return {
|
|
40
|
-
...
|
|
40
|
+
...defaultDependenciesList.concat(deps).reduce((acc, dep) => {
|
|
41
41
|
const { name, singleton = false } = typeof dep === 'string' ? { name: dep } : dep;
|
|
42
42
|
|
|
43
43
|
acc[name] = {
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import type webpack from 'webpack';
|
|
2
|
+
import type { Compiler, NormalModule } from 'webpack';
|
|
3
|
+
import { sync as resolve } from 'resolve';
|
|
4
|
+
import type packageJson from 'package-json';
|
|
5
|
+
import chalk from 'chalk';
|
|
6
|
+
// eslint-disable-next-line no-restricted-imports
|
|
7
|
+
import { parseRange } from 'webpack/lib/util/semver';
|
|
8
|
+
import { isDependantLib, isUnifiedVersion } from '../../../utils/tramvaiVersions';
|
|
9
|
+
|
|
10
|
+
const PLUGIN_NAME = 'ModuleFederationValidateDuplicates';
|
|
11
|
+
|
|
12
|
+
type SemverRange = [number, number, number, number];
|
|
13
|
+
|
|
14
|
+
interface SharedModuleOptions {
|
|
15
|
+
shareKey: string;
|
|
16
|
+
requiredVersion?: SemverRange;
|
|
17
|
+
importResolved: string;
|
|
18
|
+
singleton?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface SharedModule extends NormalModule {
|
|
22
|
+
options?: SharedModuleOptions;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const resolvePackageVersion = (name: string, basedir: string) => {
|
|
26
|
+
try {
|
|
27
|
+
const packageJsonPath = resolve(`${name}/package.json`, {
|
|
28
|
+
basedir,
|
|
29
|
+
});
|
|
30
|
+
const packageJson: packageJson.FullMetadataOptions = require(packageJsonPath);
|
|
31
|
+
|
|
32
|
+
return packageJson.version;
|
|
33
|
+
} catch (error: any) {
|
|
34
|
+
console.warn(`ModuleFederation: could not infer version for package "${name}"`);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export interface ModuleFederationFixRangeOptions {
|
|
39
|
+
flexibleTramvaiVersions: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class ModuleFederationFixRange implements webpack.WebpackPluginInstance {
|
|
43
|
+
private flexibleTramvaiVersions: boolean;
|
|
44
|
+
// { name: { importResolved: { number }} }
|
|
45
|
+
private sharedModules: Map<string, Map<string, Set<number>>> = new Map();
|
|
46
|
+
|
|
47
|
+
constructor({ flexibleTramvaiVersions }: ModuleFederationFixRangeOptions) {
|
|
48
|
+
this.flexibleTramvaiVersions = flexibleTramvaiVersions ?? false;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
apply(compiler: Compiler) {
|
|
52
|
+
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (_, { normalModuleFactory }) => {
|
|
53
|
+
normalModuleFactory.hooks.factorize.intercept({
|
|
54
|
+
register: (tap) => {
|
|
55
|
+
if (tap.name === 'ConsumeSharedPlugin') {
|
|
56
|
+
const originalFn = tap.fn;
|
|
57
|
+
// eslint-disable-next-line no-param-reassign
|
|
58
|
+
tap.fn = async (...args) => {
|
|
59
|
+
const module: SharedModule | undefined = await originalFn(...args);
|
|
60
|
+
|
|
61
|
+
if (module?.options) {
|
|
62
|
+
this.fixVersionRange(module);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return module;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return tap;
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
compiler.hooks.done.tap(PLUGIN_NAME, () => {
|
|
75
|
+
const duplicates: Array<{ name: string; paths: string[] }> = [];
|
|
76
|
+
const criticalDuplicates: Array<{ name: string; path: string }> = [];
|
|
77
|
+
|
|
78
|
+
for (const [name, shared] of this.sharedModules) {
|
|
79
|
+
if (shared.size > 1) {
|
|
80
|
+
duplicates.push({
|
|
81
|
+
name,
|
|
82
|
+
paths: [...shared.keys()],
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
for (const [path, versions] of shared) {
|
|
87
|
+
if (versions.size > 1) {
|
|
88
|
+
criticalDuplicates.push({ name, path });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// reset sharedModules info after compilation has ended
|
|
94
|
+
this.sharedModules = new Map();
|
|
95
|
+
|
|
96
|
+
if (duplicates.length) {
|
|
97
|
+
console.warn(`⚠️ ModuleFederation: Found duplicates for next shared modules:
|
|
98
|
+
${duplicates
|
|
99
|
+
.map(({ name, paths }) => {
|
|
100
|
+
return `\t${chalk.yellowBright(name)}: ${paths.join(', ')}`;
|
|
101
|
+
})
|
|
102
|
+
.join('\n')}
|
|
103
|
+
`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (criticalDuplicates.length) {
|
|
107
|
+
console.error(
|
|
108
|
+
`❗ ModuleFederation: Found duplicates for shared modules with different major versions that are resolved to the same path:
|
|
109
|
+
${criticalDuplicates
|
|
110
|
+
.map(({ name, path }) => {
|
|
111
|
+
return `\t${chalk.red(name)}: ${path}`;
|
|
112
|
+
})
|
|
113
|
+
.join('\n')}`
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
throw new Error(
|
|
117
|
+
'ModuleFederation: Different major versions have resolved to the same path for shared modules, please review errors above'
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
fixVersionRange(module: SharedModule) {
|
|
124
|
+
const {
|
|
125
|
+
options,
|
|
126
|
+
options: { shareKey: name, singleton, importResolved },
|
|
127
|
+
context,
|
|
128
|
+
} = module;
|
|
129
|
+
let { requiredVersion } = options;
|
|
130
|
+
|
|
131
|
+
// ignore singletons as the actual version won't change anything
|
|
132
|
+
// and usually it is just a react and co libraries
|
|
133
|
+
if (!requiredVersion && context && !singleton) {
|
|
134
|
+
const version = resolvePackageVersion(name, context);
|
|
135
|
+
if (version) {
|
|
136
|
+
requiredVersion = parseRange(version);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (!requiredVersion) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (requiredVersion && this.flexibleTramvaiVersions) {
|
|
145
|
+
const isTramvai = isUnifiedVersion(name) || isDependantLib(name);
|
|
146
|
+
|
|
147
|
+
if (isTramvai && requiredVersion[0] > 2) {
|
|
148
|
+
// 1 is used for `^` range modifier
|
|
149
|
+
// see https://github.com/webpack/webpack/blob/56363993156e06a1230c9759eba277a22e6b6604/lib/util/semver.js#LL235C20-L235C20
|
|
150
|
+
requiredVersion[0] = 1;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// change version in webpack module
|
|
155
|
+
options.requiredVersion = requiredVersion;
|
|
156
|
+
|
|
157
|
+
let shared = this.sharedModules.get(name);
|
|
158
|
+
|
|
159
|
+
if (!shared) {
|
|
160
|
+
shared = new Map();
|
|
161
|
+
this.sharedModules.set(name, shared);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
let versions = shared.get(importResolved);
|
|
165
|
+
|
|
166
|
+
if (!versions) {
|
|
167
|
+
versions = new Set();
|
|
168
|
+
shared.set(importResolved, versions);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// save major version of the semver array
|
|
172
|
+
versions.add(requiredVersion[1]);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
@@ -103,6 +103,7 @@ it('should populate defaults for config', () => {
|
|
|
103
103
|
"serverApiDir": "src/api",
|
|
104
104
|
"shared": {
|
|
105
105
|
"deps": [],
|
|
106
|
+
"flexibleTramvaiVersions": true,
|
|
106
107
|
},
|
|
107
108
|
"sourceMap": false,
|
|
108
109
|
"splitChunks": {
|
|
@@ -159,6 +160,7 @@ it('should populate defaults for config', () => {
|
|
|
159
160
|
"root": "packages/child-app",
|
|
160
161
|
"shared": {
|
|
161
162
|
"deps": [],
|
|
163
|
+
"flexibleTramvaiVersions": true,
|
|
162
164
|
},
|
|
163
165
|
"sourceMap": false,
|
|
164
166
|
"terser": {
|
|
@@ -336,6 +338,7 @@ it('should populate defaults for overridable options', () => {
|
|
|
336
338
|
"serverApiDir": "src/api",
|
|
337
339
|
"shared": {
|
|
338
340
|
"deps": [],
|
|
341
|
+
"flexibleTramvaiVersions": true,
|
|
339
342
|
},
|
|
340
343
|
"sourceMap": false,
|
|
341
344
|
"splitChunks": {
|
|
@@ -406,6 +409,7 @@ it('should populate defaults for overridable options', () => {
|
|
|
406
409
|
"root": "packages/child-app",
|
|
407
410
|
"shared": {
|
|
408
411
|
"deps": [],
|
|
412
|
+
"flexibleTramvaiVersions": true,
|
|
409
413
|
},
|
|
410
414
|
"sourceMap": {
|
|
411
415
|
"development": true,
|
|
@@ -1225,7 +1225,13 @@
|
|
|
1225
1225
|
"properties": {
|
|
1226
1226
|
"defaultTramvaiDependencies": {
|
|
1227
1227
|
"title": "Should default dependencies list be added to shared list",
|
|
1228
|
-
"description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of",
|
|
1228
|
+
"description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of tramvai/module-child-app is specified in package.json\nand for child-apps",
|
|
1229
|
+
"type": "boolean"
|
|
1230
|
+
},
|
|
1231
|
+
"flexibleTramvaiVersions": {
|
|
1232
|
+
"title": "add caret range specifier for tramvai dependencies",
|
|
1233
|
+
"description": "minimal versions are inferred from package.json",
|
|
1234
|
+
"default": true,
|
|
1229
1235
|
"type": "boolean"
|
|
1230
1236
|
},
|
|
1231
1237
|
"deps": {
|
|
@@ -1746,7 +1752,13 @@
|
|
|
1746
1752
|
"properties": {
|
|
1747
1753
|
"defaultTramvaiDependencies": {
|
|
1748
1754
|
"title": "Should default dependencies list be added to shared list",
|
|
1749
|
-
"description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of",
|
|
1755
|
+
"description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of tramvai/module-child-app is specified in package.json\nand for child-apps",
|
|
1756
|
+
"type": "boolean"
|
|
1757
|
+
},
|
|
1758
|
+
"flexibleTramvaiVersions": {
|
|
1759
|
+
"title": "add caret range specifier for tramvai dependencies",
|
|
1760
|
+
"description": "minimal versions are inferred from package.json",
|
|
1761
|
+
"default": true,
|
|
1750
1762
|
"type": "boolean"
|
|
1751
1763
|
},
|
|
1752
1764
|
"deps": {
|
|
@@ -2267,7 +2279,13 @@
|
|
|
2267
2279
|
"properties": {
|
|
2268
2280
|
"defaultTramvaiDependencies": {
|
|
2269
2281
|
"title": "Should default dependencies list be added to shared list",
|
|
2270
|
-
"description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of",
|
|
2282
|
+
"description": "It includes the list of commonly used dependencies in the child-apps\nBy default, it is enabled in application in case of tramvai/module-child-app is specified in package.json\nand for child-apps",
|
|
2283
|
+
"type": "boolean"
|
|
2284
|
+
},
|
|
2285
|
+
"flexibleTramvaiVersions": {
|
|
2286
|
+
"title": "add caret range specifier for tramvai dependencies",
|
|
2287
|
+
"description": "minimal versions are inferred from package.json",
|
|
2288
|
+
"default": true,
|
|
2271
2289
|
"type": "boolean"
|
|
2272
2290
|
},
|
|
2273
2291
|
"deps": {
|
|
@@ -126,6 +126,7 @@ describe('JSON schema для tramvai.json', () => {
|
|
|
126
126
|
"serverApiDir": "src/api",
|
|
127
127
|
"shared": {
|
|
128
128
|
"deps": [],
|
|
129
|
+
"flexibleTramvaiVersions": true,
|
|
129
130
|
},
|
|
130
131
|
"sourceMap": false,
|
|
131
132
|
"splitChunks": {
|
|
@@ -182,6 +183,7 @@ describe('JSON schema для tramvai.json', () => {
|
|
|
182
183
|
"root": "src/module",
|
|
183
184
|
"shared": {
|
|
184
185
|
"deps": [],
|
|
186
|
+
"flexibleTramvaiVersions": true,
|
|
185
187
|
},
|
|
186
188
|
"sourceMap": false,
|
|
187
189
|
"terser": {
|
|
@@ -287,10 +287,16 @@ export interface CliConfigEntry extends ConfigEntry {
|
|
|
287
287
|
/**
|
|
288
288
|
* @title Should default dependencies list be added to shared list
|
|
289
289
|
* @description It includes the list of commonly used dependencies in the child-apps
|
|
290
|
-
* By default, it is enabled in application in case of
|
|
290
|
+
* By default, it is enabled in application in case of tramvai/module-child-app is specified in package.json
|
|
291
291
|
* and for child-apps
|
|
292
292
|
*/
|
|
293
293
|
defaultTramvaiDependencies?: boolean;
|
|
294
|
+
/**
|
|
295
|
+
* @title add caret range specifier for tramvai dependencies
|
|
296
|
+
* @description minimal versions are inferred from package.json
|
|
297
|
+
* @default true
|
|
298
|
+
*/
|
|
299
|
+
flexibleTramvaiVersions: boolean;
|
|
294
300
|
/**
|
|
295
301
|
* @title list of the dependencies that will be shared
|
|
296
302
|
* @default []
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// map of packages that is not in unified versioning
|
|
2
|
+
// but we still want to update it
|
|
3
|
+
// actual version to update will be calculated from the some of the @tramvai/module
|
|
4
|
+
export const DEPENDANT_LIBS_MAP = new Map([
|
|
5
|
+
['@tinkoff/logger', '@tramvai/module-log'],
|
|
6
|
+
['@tinkoff/dippy', '@tramvai/core'],
|
|
7
|
+
['@tinkoff/router', '@tramvai/module-router'],
|
|
8
|
+
['@tinkoff/url', '@tramvai/module-common'],
|
|
9
|
+
['@tinkoff/errors', '@tramvai/module-common'],
|
|
10
|
+
['@tinkoff/roles', '@tramvai/module-authenticate'],
|
|
11
|
+
['@tinkoff/pubsub', '@tramvai/module-common'],
|
|
12
|
+
['@tinkoff/hook-runner', '@tramvai/module-common'],
|
|
13
|
+
['@tinkoff/htmlpagebuilder', '@tramvai/module-render'],
|
|
14
|
+
['@tinkoff/browser-timings', '@tramvai/module-metrics'],
|
|
15
|
+
['@tinkoff/meta-tags-generate', '@tramvai/module-render'],
|
|
16
|
+
['@tinkoff/pack-polyfills', ''],
|
|
17
|
+
['@tinkoff/browserslist-config', '@tramvai/cli'],
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
export const isUnifiedVersion = (name: string) => {
|
|
21
|
+
return name.startsWith('@tramvai');
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const isDependantLib = (name: string) => {
|
|
25
|
+
return DEPENDANT_LIBS_MAP.has(name);
|
|
26
|
+
};
|