@tramvai/cli 2.111.0 → 2.112.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/start/providers/application/shared.js +4 -4
- package/lib/api/start/providers/application/shared.js.map +1 -1
- package/lib/api/start/providers/child-app/shared.js +1 -4
- package/lib/api/start/providers/child-app/shared.js.map +1 -1
- package/lib/api/start/providers/module/shared.js +1 -4
- package/lib/api/start/providers/module/shared.js.map +1 -1
- package/lib/api/start-prod/providers/application.js +4 -4
- package/lib/api/start-prod/providers/application.js.map +1 -1
- package/lib/api/start-prod/providers/child-app.js +4 -4
- package/lib/api/start-prod/providers/child-app.js.map +1 -1
- 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/typescript/index.d.ts +1 -1
- 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/detectPortSync.d.ts +13 -1
- package/lib/utils/detectPortSync.js +12 -2
- package/lib/utils/detectPortSync.js.map +1 -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/api/start/__integration__/start.test.ts +22 -3
- package/src/api/start/providers/application/shared.ts +5 -2
- package/src/api/start/providers/child-app/shared.ts +1 -1
- package/src/api/start/providers/module/shared.ts +1 -1
- package/src/api/start-prod/providers/application.ts +5 -2
- package/src/api/start-prod/providers/child-app.ts +4 -1
- 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/detectPortSync.ts +18 -2
- package/src/utils/tramvaiVersions.ts +26 -0
|
@@ -2,8 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.detectPortSync = void 0;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Try to detect port synchronously considering the fact, that if user requests
|
|
7
|
+
* a port explicitly, we should not try to detect a free one.
|
|
8
|
+
*
|
|
9
|
+
* Also, handle zero port (it means any random port) as the edge case,
|
|
10
|
+
* because we must pass a final number to the config manager.
|
|
11
|
+
*/
|
|
12
|
+
const detectPortSync = ({ request, fallback }) => {
|
|
13
|
+
if (request !== undefined && request !== 0) {
|
|
14
|
+
return request;
|
|
15
|
+
}
|
|
16
|
+
const commandResult = (0, child_process_1.execSync)(`npx detect-port ${request !== null && request !== void 0 ? request : fallback}`);
|
|
7
17
|
return parseInt(commandResult.toString('utf-8'), 10);
|
|
8
18
|
};
|
|
9
19
|
exports.detectPortSync = detectPortSync;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detectPortSync.js","sourceRoot":"","sources":["../../src/utils/detectPortSync.ts"],"names":[],"mappings":";;;AAAA,iDAAyC;
|
|
1
|
+
{"version":3,"file":"detectPortSync.js","sourceRoot":"","sources":["../../src/utils/detectPortSync.ts"],"names":[],"mappings":";;;AAAA,iDAAyC;AAOzC;;;;;;GAMG;AACI,MAAM,cAAc,GAAG,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAW,EAAU,EAAE;IACvE,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,CAAC,EAAE;QAC1C,OAAO,OAAO,CAAC;KAChB;IAED,MAAM,aAAa,GAAG,IAAA,wBAAQ,EAAC,mBAAmB,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,QAAQ,EAAE,CAAC,CAAC;IAEzE,OAAO,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;AACvD,CAAC,CAAC;AARW,QAAA,cAAc,kBAQzB"}
|
|
@@ -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.
|
|
3
|
+
"version": "2.112.0",
|
|
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.
|
|
74
|
+
"@tramvai/react": "2.112.0",
|
|
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": {
|
|
@@ -10,6 +10,7 @@ import { createServer } from '../utils/createServer';
|
|
|
10
10
|
import { listenServer } from '../utils/listenServer';
|
|
11
11
|
import { getListeningPort } from '../utils/getListeningPort';
|
|
12
12
|
import { stopServer } from '../utils/stopServer';
|
|
13
|
+
import { DEFAULT_PORT, DEFAULT_STATIC_PORT } from '../../../config/configManager';
|
|
13
14
|
|
|
14
15
|
const FIXTURES_DIR = resolve(__dirname, '__fixtures__');
|
|
15
16
|
|
|
@@ -261,7 +262,7 @@ describe('@tramvai/cli start command', () => {
|
|
|
261
262
|
return close();
|
|
262
263
|
});
|
|
263
264
|
|
|
264
|
-
it('should
|
|
265
|
+
it('should NOT try to launch app on the next available port if it was provided via config', async () => {
|
|
265
266
|
const testServerStub = createServer();
|
|
266
267
|
const testStaticServerStub = createServer();
|
|
267
268
|
|
|
@@ -270,12 +271,30 @@ describe('@tramvai/cli start command', () => {
|
|
|
270
271
|
await listenServer(testServerStub, '0.0.0.0', getPort() + 50);
|
|
271
272
|
await listenServer(testStaticServerStub, '0.0.0.0', getPort());
|
|
272
273
|
|
|
274
|
+
await expect(
|
|
275
|
+
start({
|
|
276
|
+
rootDir: FIXTURES_DIR,
|
|
277
|
+
target: 'app',
|
|
278
|
+
resolveSymlinks: false,
|
|
279
|
+
port: getListeningPort(testServerStub),
|
|
280
|
+
staticPort: getListeningPort(testStaticServerStub),
|
|
281
|
+
})
|
|
282
|
+
).rejects.toThrow('listen EADDRINUSE: address already in use');
|
|
283
|
+
|
|
284
|
+
return Promise.all([stopServer(testServerStub), stopServer(testStaticServerStub)]);
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
it('should try to launch app on the next available port if it was NOT provided via config', async () => {
|
|
288
|
+
const testServerStub = createServer();
|
|
289
|
+
const testStaticServerStub = createServer();
|
|
290
|
+
|
|
291
|
+
await listenServer(testServerStub, '0.0.0.0', DEFAULT_PORT);
|
|
292
|
+
await listenServer(testStaticServerStub, '0.0.0.0', DEFAULT_STATIC_PORT);
|
|
293
|
+
|
|
273
294
|
const { server, staticServer, close } = await start({
|
|
274
295
|
rootDir: FIXTURES_DIR,
|
|
275
296
|
target: 'app',
|
|
276
297
|
resolveSymlinks: false,
|
|
277
|
-
port: getListeningPort(testServerStub),
|
|
278
|
-
staticPort: getListeningPort(testStaticServerStub),
|
|
279
298
|
});
|
|
280
299
|
|
|
281
300
|
const testServer = supertestByPort(getListeningPort(server));
|
|
@@ -27,8 +27,11 @@ export const sharedProviders: readonly Provider[] = [
|
|
|
27
27
|
...parameters,
|
|
28
28
|
appEnv: parameters.env,
|
|
29
29
|
env: 'development',
|
|
30
|
-
port: detectPortSync(parameters.port
|
|
31
|
-
staticPort: detectPortSync(
|
|
30
|
+
port: detectPortSync({ request: parameters.port, fallback: DEFAULT_PORT }),
|
|
31
|
+
staticPort: detectPortSync({
|
|
32
|
+
request: parameters.staticPort,
|
|
33
|
+
fallback: DEFAULT_STATIC_PORT,
|
|
34
|
+
}),
|
|
32
35
|
}),
|
|
33
36
|
deps: {
|
|
34
37
|
configEntry: CONFIG_ENTRY_TOKEN,
|
|
@@ -23,7 +23,7 @@ export const sharedProviders: readonly Provider[] = [
|
|
|
23
23
|
...parameters,
|
|
24
24
|
appEnv: parameters.env,
|
|
25
25
|
env: 'development',
|
|
26
|
-
port: detectPortSync(parameters.port
|
|
26
|
+
port: detectPortSync({ request: parameters.port, fallback: DEFAULT_STATIC_MODULE_PORT }),
|
|
27
27
|
}),
|
|
28
28
|
deps: {
|
|
29
29
|
configEntry: CONFIG_ENTRY_TOKEN,
|
|
@@ -23,7 +23,7 @@ export const sharedProviders: readonly Provider[] = [
|
|
|
23
23
|
...parameters,
|
|
24
24
|
appEnv: parameters.env,
|
|
25
25
|
env: 'development',
|
|
26
|
-
port: detectPortSync(parameters.port
|
|
26
|
+
port: detectPortSync({ request: parameters.port, fallback: DEFAULT_STATIC_MODULE_PORT }),
|
|
27
27
|
}),
|
|
28
28
|
deps: {
|
|
29
29
|
configEntry: CONFIG_ENTRY_TOKEN,
|
|
@@ -30,8 +30,11 @@ export const applicationsProviders: readonly Provider[] = [
|
|
|
30
30
|
appEnv: parameters.env,
|
|
31
31
|
env: 'production',
|
|
32
32
|
buildType: 'client',
|
|
33
|
-
port: detectPortSync(parameters.port
|
|
34
|
-
staticPort: detectPortSync(
|
|
33
|
+
port: detectPortSync({ request: parameters.port, fallback: DEFAULT_PORT }),
|
|
34
|
+
staticPort: detectPortSync({
|
|
35
|
+
request: parameters.staticPort,
|
|
36
|
+
fallback: DEFAULT_STATIC_PORT,
|
|
37
|
+
}),
|
|
35
38
|
}),
|
|
36
39
|
deps: {
|
|
37
40
|
configEntry: CONFIG_ENTRY_TOKEN,
|
|
@@ -17,8 +17,11 @@ export const childAppProviders: readonly Provider[] = [
|
|
|
17
17
|
...parameters,
|
|
18
18
|
appEnv: parameters.env,
|
|
19
19
|
env: 'production',
|
|
20
|
-
staticPort: detectPortSync(parameters.staticPort ?? DEFAULT_STATIC_MODULE_PORT),
|
|
21
20
|
buildType: 'client',
|
|
21
|
+
staticPort: detectPortSync({
|
|
22
|
+
request: parameters.staticPort,
|
|
23
|
+
fallback: DEFAULT_STATIC_MODULE_PORT,
|
|
24
|
+
}),
|
|
22
25
|
}),
|
|
23
26
|
deps: {
|
|
24
27
|
configEntry: CONFIG_ENTRY_TOKEN,
|
|
@@ -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] = {
|