zephyr-repack-plugin 0.0.0-canary-20241122175815 → 0.0.0-canary-20250121101024
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/dist/README.md +3 -0
- package/dist/delegate-module/delegate-module-template.d.ts +1 -1
- package/dist/delegate-module/delegate-module-template.js +8 -4
- package/dist/delegate-module/delegate-module-template.js.map +1 -1
- package/dist/lib/utils/get-platform.d.ts +4 -0
- package/dist/lib/utils/get-platform.js +10 -3
- package/dist/lib/utils/get-platform.js.map +1 -1
- package/dist/lib/utils/ze-util-verification.d.ts +21 -0
- package/dist/lib/utils/ze-util-verification.js +40 -0
- package/dist/lib/utils/ze-util-verification.js.map +1 -0
- package/dist/lib/with-zephyr.d.ts +2 -2
- package/dist/lib/with-zephyr.js +31 -43
- package/dist/lib/with-zephyr.js.map +1 -1
- package/dist/lib/ze-repack-plugin.d.ts +6 -2
- package/dist/lib/ze-repack-plugin.js +4 -5
- package/dist/lib/ze-repack-plugin.js.map +1 -1
- package/dist/package.json +3 -5
- package/dist/type/zephyr-internal-types.d.ts +0 -18
- package/package.json +4 -6
- package/dist/delegate-module/replace-remote-with-delegate.d.ts +0 -2
- package/dist/delegate-module/replace-remote-with-delegate.js +0 -29
- package/dist/delegate-module/replace-remote-with-delegate.js.map +0 -1
- package/dist/delegate-module/zephyr-delegate.d.ts +0 -2
- package/dist/delegate-module/zephyr-delegate.js +0 -153
- package/dist/delegate-module/zephyr-delegate.js.map +0 -1
- package/dist/lib/build-stats/get-build-stats.d.ts +0 -3
- package/dist/lib/build-stats/get-build-stats.js +0 -62
- package/dist/lib/build-stats/get-build-stats.js.map +0 -1
- package/dist/lib/dependency-resolution/replace-remote-with-delegates.d.ts +0 -3
- package/dist/lib/dependency-resolution/replace-remote-with-delegates.js +0 -26
- package/dist/lib/dependency-resolution/replace-remote-with-delegates.js.map +0 -1
- package/dist/lib/federation-graph/compute-dependencies.d.ts +0 -10
- package/dist/lib/federation-graph/compute-dependencies.js +0 -73
- package/dist/lib/federation-graph/compute-dependencies.js.map +0 -1
- package/dist/lib/federation-graph/compute-version.d.ts +0 -4
- package/dist/lib/federation-graph/compute-version.js +0 -22
- package/dist/lib/federation-graph/compute-version.js.map +0 -1
- package/dist/lib/federation-graph/federation-plugin.d.ts +0 -54
- package/dist/lib/federation-graph/federation-plugin.js +0 -233
- package/dist/lib/federation-graph/federation-plugin.js.map +0 -1
- package/dist/lib/federation-graph/runtime-requirement.d.ts +0 -4
- package/dist/lib/federation-graph/runtime-requirement.js +0 -28
- package/dist/lib/federation-graph/runtime-requirement.js.map +0 -1
- package/dist/lib/federation-graph/utils/convert-dependencies.d.ts +0 -12
- package/dist/lib/federation-graph/utils/convert-dependencies.js +0 -31
- package/dist/lib/federation-graph/utils/convert-dependencies.js.map +0 -1
- package/dist/lib/federation-graph/utils/convert-to-graph.d.ts +0 -3
- package/dist/lib/federation-graph/utils/convert-to-graph.js +0 -53
- package/dist/lib/federation-graph/utils/convert-to-graph.js.map +0 -1
- package/dist/lib/federation-graph/utils/converted-dependencies.d.ts +0 -12
- package/dist/lib/federation-graph/utils/converted-dependencies.js +0 -31
- package/dist/lib/federation-graph/utils/converted-dependencies.js.map +0 -1
- package/dist/lib/federation-graph/utils/get-licenses.d.ts +0 -2
- package/dist/lib/federation-graph/utils/get-licenses.js +0 -25
- package/dist/lib/federation-graph/utils/get-licenses.js.map +0 -1
- package/dist/lib/federation-graph/utils/module-part-one.d.ts +0 -33
- package/dist/lib/federation-graph/utils/module-part-one.js +0 -138
- package/dist/lib/federation-graph/utils/module-part-one.js.map +0 -1
- package/dist/lib/federation-graph/utils/module-part-two.d.ts +0 -52
- package/dist/lib/federation-graph/utils/module-part-two.js +0 -150
- package/dist/lib/federation-graph/utils/module-part-two.js.map +0 -1
- package/dist/lib/federation-graph/utils/process-function-remotes.d.ts +0 -24
- package/dist/lib/federation-graph/utils/process-function-remotes.js +0 -35
- package/dist/lib/federation-graph/utils/process-function-remotes.js.map +0 -1
- package/dist/lib/federation-graph/validate-params.d.ts +0 -0
- package/dist/lib/federation-graph/validate-params.js +0 -2
- package/dist/lib/federation-graph/validate-params.js.map +0 -1
- package/dist/lib/repack_zephyr_agent.d.ts +0 -10
- package/dist/lib/repack_zephyr_agent.js +0 -58
- package/dist/lib/repack_zephyr_agent.js.map +0 -1
- package/dist/lib/set-up-build-id.d.ts +0 -3
- package/dist/lib/set-up-build-id.js +0 -36
- package/dist/lib/set-up-build-id.js.map +0 -1
- package/dist/lib/set-up-build-stats-logging.d.ts +0 -5
- package/dist/lib/set-up-build-stats-logging.js +0 -24
- package/dist/lib/set-up-build-stats-logging.js.map +0 -1
- package/dist/lib/set-up-deploy.d.ts +0 -3
- package/dist/lib/set-up-deploy.js +0 -35
- package/dist/lib/set-up-deploy.js.map +0 -1
- package/dist/lib/utils/federation-plugin-get-package-json.d.ts +0 -1
- package/dist/lib/utils/federation-plugin-get-package-json.js +0 -23
- package/dist/lib/utils/federation-plugin-get-package-json.js.map +0 -1
- package/dist/lib/utils/get-mf-config.d.ts +0 -9
- package/dist/lib/utils/get-mf-config.js +0 -24
- package/dist/lib/utils/get-mf-config.js.map +0 -1
- package/dist/lib/utils/plugin-search.d.ts +0 -11
- package/dist/lib/utils/plugin-search.js +0 -19
- package/dist/lib/utils/plugin-search.js.map +0 -1
- package/dist/type/convert-graph-params.d.ts +0 -63
- package/dist/type/convert-graph-params.js +0 -3
- package/dist/type/convert-graph-params.js.map +0 -1
- package/dist/type/federation-plugin-options.d.ts +0 -62
- package/dist/type/federation-plugin-options.js +0 -3
- package/dist/type/federation-plugin-options.js.map +0 -1
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertToGraph = void 0;
|
|
4
|
-
const convert_dependencies_1 = require("./convert-dependencies");
|
|
5
|
-
const module_part_one_1 = require("./module-part-one");
|
|
6
|
-
const module_part_two_1 = require("./module-part-two");
|
|
7
|
-
const process_function_remotes_1 = require("./process-function-remotes");
|
|
8
|
-
function convertToGraph(params) {
|
|
9
|
-
const { name, modules, topLevelPackage, metadata, versionData, environment, version, posted, group, functionRemotes, sha, buildHash, } = params;
|
|
10
|
-
const { consumes, modulesObj, npmModules } = (0, module_part_one_1.modulePartOne)(modules);
|
|
11
|
-
const convertedDeps = (0, convert_dependencies_1.convertDependencies)({
|
|
12
|
-
package: topLevelPackage,
|
|
13
|
-
npmModules,
|
|
14
|
-
});
|
|
15
|
-
const { overrides } = (0, module_part_two_1.modulePartTwo)({
|
|
16
|
-
name,
|
|
17
|
-
modules,
|
|
18
|
-
modulesObj,
|
|
19
|
-
convertedDeps,
|
|
20
|
-
});
|
|
21
|
-
(0, process_function_remotes_1.processFunctionRemotes)({ functionRemotes, consumes });
|
|
22
|
-
const sourceUrl = metadata?.source?.url ?? '';
|
|
23
|
-
const remote = metadata?.remote ?? '';
|
|
24
|
-
return {
|
|
25
|
-
...convertedDeps,
|
|
26
|
-
id: name,
|
|
27
|
-
name: name,
|
|
28
|
-
remote,
|
|
29
|
-
metadata,
|
|
30
|
-
versionData,
|
|
31
|
-
overrides: Object.values(overrides),
|
|
32
|
-
consumes: consumes.map((con) => ({
|
|
33
|
-
...con,
|
|
34
|
-
usedIn: Array.from(con.usedIn.values()).map((file) => ({
|
|
35
|
-
file,
|
|
36
|
-
url: `${sourceUrl}/${file}`,
|
|
37
|
-
})),
|
|
38
|
-
})),
|
|
39
|
-
modules: Object.values(modulesObj).map((mod) => ({
|
|
40
|
-
...mod,
|
|
41
|
-
requires: Array.from(mod.requires.values()).filter((value) => typeof value === 'string'),
|
|
42
|
-
})),
|
|
43
|
-
environment,
|
|
44
|
-
version,
|
|
45
|
-
posted,
|
|
46
|
-
group,
|
|
47
|
-
sha,
|
|
48
|
-
buildHash,
|
|
49
|
-
target: params.target,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
exports.convertToGraph = convertToGraph;
|
|
53
|
-
//# sourceMappingURL=convert-to-graph.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convert-to-graph.js","sourceRoot":"","sources":["../../../../src/lib/federation-graph/utils/convert-to-graph.ts"],"names":[],"mappings":";;;AAEA,iEAA6D;AAC7D,uDAAkD;AAClD,uDAAkD;AAClD,yEAAoE;AAEpE,SAAgB,cAAc,CAAC,MAA4B;IACzD,MAAM,EACJ,IAAI,EACJ,OAAO,EACP,eAAe,EACf,QAAQ,EACR,WAAW,EACX,WAAW,EACX,OAAO,EACP,MAAM,EACN,KAAK,EACL,eAAe,EACf,GAAG,EACH,SAAS,GACV,GAAG,MAAM,CAAC;IAEX,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,IAAA,+BAAa,EAAC,OAAO,CAAC,CAAC;IAEpE,MAAM,aAAa,GAAG,IAAA,0CAAmB,EAAC;QACxC,OAAO,EAAE,eAAe;QACxB,UAAU;KACX,CAAC,CAAC;IAEH,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,+BAAa,EAAC;QAClC,IAAI;QACJ,OAAO;QACP,UAAU;QACV,aAAa;KACd,CAAC,CAAC;IAEH,IAAA,iDAAsB,EAAC,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC,CAAC;IAEtD,MAAM,SAAS,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC;IAC9C,MAAM,MAAM,GAAG,QAAQ,EAAE,MAAM,IAAI,EAAE,CAAC;IAEtC,OAAO;QACL,GAAG,aAAa;QAChB,EAAE,EAAE,IAAI;QACR,IAAI,EAAE,IAAI;QACV,MAAM;QACN,QAAQ;QACR,WAAW;QACX,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;QACnC,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAC/B,GAAG,GAAG;YACN,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBACrD,IAAI;gBACJ,GAAG,EAAE,GAAG,SAAS,IAAI,IAAI,EAAE;aAC5B,CAAC,CAAC;SACJ,CAAC,CAAC;QACH,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAC/C,GAAG,GAAG;YACN,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAChD,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CACrC;SACF,CAAC,CAAC;QACH,WAAW;QACX,OAAO;QACP,MAAM;QACN,KAAK;QACL,GAAG;QACH,SAAS;QACT,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC;AACJ,CAAC;AAhED,wCAgEC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { LocalPackageJson } from 'zephyr-edge-contract';
|
|
2
|
-
import { TopLevelPackage } from '../../../type/federation-plugin-options';
|
|
3
|
-
export interface ConvertedDependencies {
|
|
4
|
-
dependencies?: LocalPackageJson[];
|
|
5
|
-
devDependencies?: LocalPackageJson[];
|
|
6
|
-
optionalDependencies?: LocalPackageJson[];
|
|
7
|
-
}
|
|
8
|
-
export type NpmModules = Map<string, Record<string, LocalPackageJson>>;
|
|
9
|
-
export declare function convertDependencies(params: {
|
|
10
|
-
package: TopLevelPackage;
|
|
11
|
-
npmModules: NpmModules;
|
|
12
|
-
}): ConvertedDependencies;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertDependencies = void 0;
|
|
4
|
-
function convertDependencies(params) {
|
|
5
|
-
return {
|
|
6
|
-
dependencies: convertDeps(params.npmModules, params.package.dependencies),
|
|
7
|
-
devDependencies: convertDeps(params.npmModules, params.package.devDependencies),
|
|
8
|
-
optionalDependencies: convertDeps(params.npmModules, params.package.optionalDependencies),
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
exports.convertDependencies = convertDependencies;
|
|
12
|
-
function convertDeps(npmModules, deps) {
|
|
13
|
-
if (!deps)
|
|
14
|
-
return;
|
|
15
|
-
return Object.entries(deps).map(([version, name]) => {
|
|
16
|
-
const dataFromGraph = npmModules.get(name);
|
|
17
|
-
const versionVal = version.replace(`${name}-`, '');
|
|
18
|
-
if (dataFromGraph) {
|
|
19
|
-
const foundInGraph = Object.values(dataFromGraph).find((depData) => depData.version.startsWith(versionVal));
|
|
20
|
-
if (foundInGraph) {
|
|
21
|
-
const { name, version, license, size } = foundInGraph;
|
|
22
|
-
return { name, version, license, size };
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return {
|
|
26
|
-
name,
|
|
27
|
-
version: versionVal,
|
|
28
|
-
};
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=converted-dependencies.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"converted-dependencies.js","sourceRoot":"","sources":["../../../../src/lib/federation-graph/utils/converted-dependencies.ts"],"names":[],"mappings":";;;AAWA,SAAgB,mBAAmB,CAAC,MAGnC;IACC,OAAO;QACL,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC;QACzE,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC;QAC/E,oBAAoB,EAAE,WAAW,CAC/B,MAAM,CAAC,UAAU,EACjB,MAAM,CAAC,OAAO,CAAC,oBAAoB,CACpC;KACF,CAAC;AACJ,CAAC;AAZD,kDAYC;AAED,SAAS,WAAW,CAClB,UAAsB,EACtB,IAA6B;IAE7B,IAAI,CAAC,IAAI;QAAE,OAAO;IAElB,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;QAClD,MAAM,aAAa,GAAG,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAE3C,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,EAAE,EAAE,CAAC,CAAC;QAEnD,IAAI,aAAa,EAAE,CAAC;YAClB,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CACjE,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CACvC,CAAC;YAEF,IAAI,YAAY,EAAE,CAAC;gBACjB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,YAAY,CAAC;gBACtD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YAC1C,CAAC;QACH,CAAC;QAED,OAAO;YACL,IAAI;YACJ,OAAO,EAAE,UAAU;SACpB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getLicenses = void 0;
|
|
4
|
-
function getLicenses(packageJson) {
|
|
5
|
-
if (Array.isArray(packageJson.licenses)) {
|
|
6
|
-
return packageJson.licenses
|
|
7
|
-
.map((license) => license.type)
|
|
8
|
-
.join(', ');
|
|
9
|
-
}
|
|
10
|
-
if (typeof packageJson.licenses !== 'string' && packageJson.licenses?.type) {
|
|
11
|
-
return packageJson.licenses.type;
|
|
12
|
-
}
|
|
13
|
-
if (typeof packageJson.license !== 'string' && packageJson.license?.type) {
|
|
14
|
-
return packageJson.license.type;
|
|
15
|
-
}
|
|
16
|
-
if (typeof packageJson.licenses === 'string') {
|
|
17
|
-
return packageJson.licenses;
|
|
18
|
-
}
|
|
19
|
-
if (typeof packageJson.license === 'string') {
|
|
20
|
-
return packageJson.license;
|
|
21
|
-
}
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
exports.getLicenses = getLicenses;
|
|
25
|
-
//# sourceMappingURL=get-licenses.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-licenses.js","sourceRoot":"","sources":["../../../../src/lib/federation-graph/utils/get-licenses.ts"],"names":[],"mappings":";;;AAEA,SAAgB,WAAW,CAAC,WAA6B;IACvD,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxC,OAAO,WAAW,CAAC,QAAQ;aACxB,GAAG,CAAC,CAAC,OAAyB,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;aAChD,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAED,IAAI,OAAO,WAAW,CAAC,QAAQ,KAAK,QAAQ,IAAI,WAAW,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC3E,OAAO,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;IACnC,CAAC;IAED,IAAI,OAAO,WAAW,CAAC,OAAO,KAAK,QAAQ,IAAI,WAAW,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC;QACzE,OAAO,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC;IAClC,CAAC;IAED,IAAI,OAAO,WAAW,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC7C,OAAO,WAAW,CAAC,QAAQ,CAAC;IAC9B,CAAC;IAED,IAAI,OAAO,WAAW,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC5C,OAAO,WAAW,CAAC,OAAO,CAAC;IAC7B,CAAC;IAED,OAAO;AACT,CAAC;AAxBD,kCAwBC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { StatsModule } from '@rspack/core';
|
|
2
|
-
import { NpmModules } from './convert-dependencies';
|
|
3
|
-
import { ModuleObject } from './module-part-two';
|
|
4
|
-
export interface Consume {
|
|
5
|
-
consumingApplicationID: string;
|
|
6
|
-
applicationID: string | null;
|
|
7
|
-
name: string;
|
|
8
|
-
usedIn: Set<string>;
|
|
9
|
-
}
|
|
10
|
-
interface ModulePartOneReturn {
|
|
11
|
-
consumes: Consume[];
|
|
12
|
-
modulesObj: Record<string, ModuleObject>;
|
|
13
|
-
npmModules: NpmModules;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Module analyzes the build statistics from Rspack to identify three key aspects of
|
|
17
|
-
* Module Federation. It calculate remote-module, container entry and node_modules
|
|
18
|
-
*
|
|
19
|
-
* 1. Remote Modules (remote-module) // TODO: this is broken needs to fix Tracks which
|
|
20
|
-
* modules are being consumed from other federated applications Maps the relationships
|
|
21
|
-
* between consuming applications and their remote dependencies Records where these
|
|
22
|
-
* remote modules are being used within the application
|
|
23
|
-
* 2. Container Entry (container entry) Processes the entry points exposed by the Module
|
|
24
|
-
* Federation container Creates a mapping of exposed modules and their file locations
|
|
25
|
-
* 3. Node Modules (node_modules) Collects information about third-party dependencies Gathers
|
|
26
|
-
* metadata like package versions, licenses, and sizes Helps track shared dependencies
|
|
27
|
-
* between federated applications
|
|
28
|
-
*
|
|
29
|
-
* @param modules - The stats object from @rspack/core to parse.
|
|
30
|
-
* @returns An object containing the consumes, modulesObj, and npmModules.
|
|
31
|
-
*/
|
|
32
|
-
export declare function modulePartOne(modules: StatsModule[] | undefined): ModulePartOneReturn;
|
|
33
|
-
export {};
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.modulePartOne = void 0;
|
|
4
|
-
const node_path_1 = require("node:path");
|
|
5
|
-
const node_fs_1 = require("node:fs");
|
|
6
|
-
const get_licenses_1 = require("./get-licenses");
|
|
7
|
-
function isString(value) {
|
|
8
|
-
return typeof value === 'string';
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Module analyzes the build statistics from Rspack to identify three key aspects of
|
|
12
|
-
* Module Federation. It calculate remote-module, container entry and node_modules
|
|
13
|
-
*
|
|
14
|
-
* 1. Remote Modules (remote-module) // TODO: this is broken needs to fix Tracks which
|
|
15
|
-
* modules are being consumed from other federated applications Maps the relationships
|
|
16
|
-
* between consuming applications and their remote dependencies Records where these
|
|
17
|
-
* remote modules are being used within the application
|
|
18
|
-
* 2. Container Entry (container entry) Processes the entry points exposed by the Module
|
|
19
|
-
* Federation container Creates a mapping of exposed modules and their file locations
|
|
20
|
-
* 3. Node Modules (node_modules) Collects information about third-party dependencies Gathers
|
|
21
|
-
* metadata like package versions, licenses, and sizes Helps track shared dependencies
|
|
22
|
-
* between federated applications
|
|
23
|
-
*
|
|
24
|
-
* @param modules - The stats object from @rspack/core to parse.
|
|
25
|
-
* @returns An object containing the consumes, modulesObj, and npmModules.
|
|
26
|
-
*/
|
|
27
|
-
function modulePartOne(modules) {
|
|
28
|
-
const consumes = [];
|
|
29
|
-
const consumesByName = {};
|
|
30
|
-
const modulesObj = {};
|
|
31
|
-
const npmModules = new Map();
|
|
32
|
-
modules?.forEach((mod) => {
|
|
33
|
-
const { identifier, reasons, moduleType, nameForCondition, size } = mod;
|
|
34
|
-
if (!identifier)
|
|
35
|
-
return;
|
|
36
|
-
const data = identifier?.split(' ');
|
|
37
|
-
if (moduleType.includes('remote')) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* When the moduleType is remote-module, we need to extract the applicationID and name
|
|
42
|
-
* from the data array
|
|
43
|
-
*/
|
|
44
|
-
if (moduleType === 'remote-module') {
|
|
45
|
-
// currently this criteria is not met, so this block is not executed
|
|
46
|
-
if (data?.length === 4 && isString(data[3]) && isString(data[2])) {
|
|
47
|
-
const name = data[3].replace('./', '');
|
|
48
|
-
/** We also check if the applicationID is a valid URL */
|
|
49
|
-
let applicationID = data[2].replace('webpack/container/reference/', '');
|
|
50
|
-
if (applicationID.includes('?')) {
|
|
51
|
-
applicationID = new URLSearchParams(applicationID.split('?')[1]).get('remoteName');
|
|
52
|
-
}
|
|
53
|
-
const consume = {
|
|
54
|
-
consumingApplicationID: name,
|
|
55
|
-
applicationID,
|
|
56
|
-
name,
|
|
57
|
-
usedIn: new Set(),
|
|
58
|
-
};
|
|
59
|
-
consumes.push(consume);
|
|
60
|
-
if (nameForCondition) {
|
|
61
|
-
consumesByName[nameForCondition] = consume;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (reasons) {
|
|
65
|
-
reasons.forEach(({ userRequest, resolvedModule }) => {
|
|
66
|
-
if (!userRequest || !consumesByName[userRequest] || !resolvedModule)
|
|
67
|
-
return;
|
|
68
|
-
const module = resolvedModule.replace('./', '');
|
|
69
|
-
consumesByName[userRequest].usedIn.add(module);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
else if (data && data[0] === 'container' && data[1] === 'entry' && data[3]) {
|
|
74
|
-
JSON.parse(data[3]).forEach(([prefixedName, file]) => {
|
|
75
|
-
const name = prefixedName.replace('./', '');
|
|
76
|
-
modulesObj[file.import[0]] = {
|
|
77
|
-
id: `${name}:${name}`,
|
|
78
|
-
name,
|
|
79
|
-
applicationID: name,
|
|
80
|
-
requires: [],
|
|
81
|
-
file: file.import[0],
|
|
82
|
-
};
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
else if (nameForCondition && nameForCondition.includes('node_modules')) {
|
|
86
|
-
const contextArray = nameForCondition.split(node_path_1.sep);
|
|
87
|
-
const afterModule = nameForCondition.split('node_modules' + node_path_1.sep);
|
|
88
|
-
const search = afterModule[1] && afterModule[1].startsWith('@') ? 3 : 2;
|
|
89
|
-
contextArray.splice(contextArray.indexOf('node_modules') + search);
|
|
90
|
-
const context = contextArray.join(node_path_1.sep);
|
|
91
|
-
const packageJsonFile = (0, node_path_1.join)(context, 'package.json');
|
|
92
|
-
const packageJson = safe_read_package_json_sync(packageJsonFile);
|
|
93
|
-
if (packageJson) {
|
|
94
|
-
const existingPackage = npmModules.get(packageJson.name);
|
|
95
|
-
if (existingPackage) {
|
|
96
|
-
const existingReference = existingPackage[packageJson.version];
|
|
97
|
-
const data = {
|
|
98
|
-
name: packageJson.name,
|
|
99
|
-
version: packageJson.version,
|
|
100
|
-
homepage: packageJson.homepage,
|
|
101
|
-
license: (0, get_licenses_1.getLicenses)(packageJson),
|
|
102
|
-
size: (Number(existingReference.size) || 0) + (size ?? 0),
|
|
103
|
-
};
|
|
104
|
-
if (existingReference) {
|
|
105
|
-
Object.assign(existingReference, data);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
existingPackage[packageJson.version] = data;
|
|
109
|
-
}
|
|
110
|
-
npmModules.set(packageJson.name, existingPackage);
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
const newDep = {
|
|
114
|
-
[packageJson.version]: {
|
|
115
|
-
name: packageJson.name,
|
|
116
|
-
version: packageJson.version,
|
|
117
|
-
homepage: packageJson.homepage,
|
|
118
|
-
license: (0, get_licenses_1.getLicenses)(packageJson),
|
|
119
|
-
size,
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
npmModules.set(packageJson.name, newDep);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
return { consumes, modulesObj, npmModules };
|
|
128
|
-
}
|
|
129
|
-
exports.modulePartOne = modulePartOne;
|
|
130
|
-
function safe_read_package_json_sync(file_path) {
|
|
131
|
-
try {
|
|
132
|
-
return JSON.parse((0, node_fs_1.readFileSync)(file_path, { encoding: 'utf-8' }));
|
|
133
|
-
}
|
|
134
|
-
catch {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
//# sourceMappingURL=module-part-one.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module-part-one.js","sourceRoot":"","sources":["../../../../src/lib/federation-graph/utils/module-part-one.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AACtC,qCAAuC;AACvC,iDAA6C;AAmB7C,SAAS,QAAQ,CAAC,KAAU;IAC1B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,aAAa,CAAC,OAAkC;IAC9D,MAAM,QAAQ,GAAc,EAAE,CAAC;IAC/B,MAAM,cAAc,GAA4B,EAAE,CAAC;IACnD,MAAM,UAAU,GASZ,EAAE,CAAC;IACP,MAAM,UAAU,GAAG,IAAI,GAAG,EAA4C,CAAC;IAEvE,OAAO,EAAE,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACvB,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;QAExE,IAAI,CAAC,UAAU;YAAE,OAAO;QACxB,MAAM,IAAI,GAAG,UAAU,EAAE,KAAK,CAAC,GAAG,CAAa,CAAC;QAEhD,IAAI,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YAClC,OAAO;QACT,CAAC;QACD;;;WAGG;QACH,IAAI,UAAU,KAAK,eAAe,EAAE,CAAC;YACnC,oEAAoE;YAEpE,IAAI,IAAI,EAAE,MAAM,KAAK,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACjE,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBAEvC,wDAAwD;gBACxD,IAAI,aAAa,GAA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KAAK,CAAC,IAAA,sBAAY,EAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAqB,CAAC;IACxF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;IACT,CAAC;AACH,CAAC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { ConvertedDependencies } from './convert-dependencies';
|
|
2
|
-
import { StatsModule } from '@rspack/core';
|
|
3
|
-
export interface ModuleObject {
|
|
4
|
-
id: string;
|
|
5
|
-
name: string;
|
|
6
|
-
applicationID: string;
|
|
7
|
-
requires: string[];
|
|
8
|
-
file: string;
|
|
9
|
-
}
|
|
10
|
-
interface ModulePartTwoParams {
|
|
11
|
-
readonly name: string | undefined;
|
|
12
|
-
readonly modules: StatsModule[] | undefined;
|
|
13
|
-
readonly modulesObj: Record<string, ModuleObject>;
|
|
14
|
-
readonly convertedDeps: ConvertedDependencies;
|
|
15
|
-
}
|
|
16
|
-
export interface Overrides {
|
|
17
|
-
id: string;
|
|
18
|
-
name: string;
|
|
19
|
-
version: string;
|
|
20
|
-
location: string;
|
|
21
|
-
applicationID: string;
|
|
22
|
-
}
|
|
23
|
-
interface ModulePartTwoReturn {
|
|
24
|
-
overrides: Record<string, unknown>;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Analyzing shared dependencies and module overrides
|
|
28
|
-
*
|
|
29
|
-
* 1. Shared Module Analysis
|
|
30
|
-
*
|
|
31
|
-
* - Processes provide-module types (modules that are shared with other applications) //
|
|
32
|
-
* TODO: this is wrong and doesn't apply to Rspack - need to fix
|
|
33
|
-
* - Handles consume-shared-module types (modules that are consumed from the shared scope)
|
|
34
|
-
* // TODO: this is wrong and doesn't apply to Rspack
|
|
35
|
-
*
|
|
36
|
-
* - Need to fix
|
|
37
|
-
* - Builds dependency graphs between modules
|
|
38
|
-
*
|
|
39
|
-
* 2. Version Management
|
|
40
|
-
*
|
|
41
|
-
* - Tracks specific versions of shared dependencies
|
|
42
|
-
* - Handles version resolution for shared modules Creates override configurations for
|
|
43
|
-
* specific package versions
|
|
44
|
-
*
|
|
45
|
-
* @param name: Name of the federated app
|
|
46
|
-
* @param modules: Modules from the build stats
|
|
47
|
-
* @param modulesObj: Processed module objects
|
|
48
|
-
* @param convertedDeps: Converted dependencies
|
|
49
|
-
* @returns Overrides: Record<string, unknown>
|
|
50
|
-
*/
|
|
51
|
-
export declare function modulePartTwo(params: ModulePartTwoParams): ModulePartTwoReturn;
|
|
52
|
-
export {};
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.modulePartTwo = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Analyzing shared dependencies and module overrides
|
|
6
|
-
*
|
|
7
|
-
* 1. Shared Module Analysis
|
|
8
|
-
*
|
|
9
|
-
* - Processes provide-module types (modules that are shared with other applications) //
|
|
10
|
-
* TODO: this is wrong and doesn't apply to Rspack - need to fix
|
|
11
|
-
* - Handles consume-shared-module types (modules that are consumed from the shared scope)
|
|
12
|
-
* // TODO: this is wrong and doesn't apply to Rspack
|
|
13
|
-
*
|
|
14
|
-
* - Need to fix
|
|
15
|
-
* - Builds dependency graphs between modules
|
|
16
|
-
*
|
|
17
|
-
* 2. Version Management
|
|
18
|
-
*
|
|
19
|
-
* - Tracks specific versions of shared dependencies
|
|
20
|
-
* - Handles version resolution for shared modules Creates override configurations for
|
|
21
|
-
* specific package versions
|
|
22
|
-
*
|
|
23
|
-
* @param name: Name of the federated app
|
|
24
|
-
* @param modules: Modules from the build stats
|
|
25
|
-
* @param modulesObj: Processed module objects
|
|
26
|
-
* @param convertedDeps: Converted dependencies
|
|
27
|
-
* @returns Overrides: Record<string, unknown>
|
|
28
|
-
*/
|
|
29
|
-
function modulePartTwo(params) {
|
|
30
|
-
const { name, modules, modulesObj, convertedDeps } = params;
|
|
31
|
-
const overrides = {};
|
|
32
|
-
modules?.forEach((mod) => {
|
|
33
|
-
const { identifier, issuerName, reasons, moduleType } = mod;
|
|
34
|
-
let data = identifier?.split(' ');
|
|
35
|
-
// TODO: this is wrong and doesn't apply to Rspack - need to fix, supposed to process modules that are shared with other federated apps
|
|
36
|
-
if (moduleType === 'provide-module' && data) {
|
|
37
|
-
if (issuerName) {
|
|
38
|
-
// This is a hack
|
|
39
|
-
const issuerNameMinusExtension = issuerName.replace('.js', '');
|
|
40
|
-
if (modulesObj[issuerNameMinusExtension] &&
|
|
41
|
-
modulesObj[issuerNameMinusExtension].requires.indexOf(data[2]) === -1) {
|
|
42
|
-
modulesObj[issuerNameMinusExtension].requires.push(data[2]);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
if (reasons) {
|
|
46
|
-
reasons.forEach(({ module }) => {
|
|
47
|
-
// filters out entrypoints
|
|
48
|
-
if (module) {
|
|
49
|
-
const moduleMinusExtension = module.replace('.js', '');
|
|
50
|
-
if (modulesObj[moduleMinusExtension] &&
|
|
51
|
-
data &&
|
|
52
|
-
modulesObj[moduleMinusExtension].requires.indexOf(data[2]) === -1) {
|
|
53
|
-
modulesObj[moduleMinusExtension].requires.push(data[2]);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
let name;
|
|
59
|
-
let version;
|
|
60
|
-
if (data[3].startsWith('@')) {
|
|
61
|
-
const splitInfo = data[3].split('@');
|
|
62
|
-
splitInfo[0] = '@';
|
|
63
|
-
name = splitInfo[0] + splitInfo[1];
|
|
64
|
-
version = splitInfo[2];
|
|
65
|
-
}
|
|
66
|
-
else if (data[3].includes('@')) {
|
|
67
|
-
[name, version] = data[3].split('@');
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
[
|
|
71
|
-
convertedDeps.dependencies,
|
|
72
|
-
convertedDeps.devDependencies,
|
|
73
|
-
convertedDeps.optionalDependencies,
|
|
74
|
-
].forEach((deps) => {
|
|
75
|
-
if (!deps)
|
|
76
|
-
return;
|
|
77
|
-
const dep = deps.find(({ name }) => data && name === data[2]);
|
|
78
|
-
if (!dep)
|
|
79
|
-
return;
|
|
80
|
-
version = dep.version;
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
if (name && version) {
|
|
84
|
-
overrides[name] = {
|
|
85
|
-
id: name,
|
|
86
|
-
name,
|
|
87
|
-
version,
|
|
88
|
-
location: name,
|
|
89
|
-
applicationID: name,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
/** Next to analyse modules that are consumed from teh shared scope */
|
|
94
|
-
if (moduleType !== 'consume-shared-module') {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
data = identifier?.split('|');
|
|
98
|
-
if (issuerName && data) {
|
|
99
|
-
// This is a hack
|
|
100
|
-
const issuerNameMinusExtension = issuerName.replace('.js', '');
|
|
101
|
-
if (modulesObj[issuerNameMinusExtension] &&
|
|
102
|
-
modulesObj[issuerNameMinusExtension].requires.indexOf(data[2]) === -1) {
|
|
103
|
-
modulesObj[issuerNameMinusExtension].requires.push(data[2]);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
if (reasons) {
|
|
107
|
-
reasons.forEach(({ module }) => {
|
|
108
|
-
// filters out entrypoints
|
|
109
|
-
if (module) {
|
|
110
|
-
const moduleMinusExtension = module.replace('.js', '');
|
|
111
|
-
if (modulesObj[moduleMinusExtension] &&
|
|
112
|
-
data &&
|
|
113
|
-
modulesObj[moduleMinusExtension].requires.indexOf(data[2]) === -1) {
|
|
114
|
-
modulesObj[moduleMinusExtension].requires.push(data[2]);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
let version = '';
|
|
120
|
-
if (data && data[3] && data[3]?.startsWith('=')) {
|
|
121
|
-
version = data[3].replace('=', '');
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
[
|
|
125
|
-
convertedDeps.dependencies,
|
|
126
|
-
convertedDeps.devDependencies,
|
|
127
|
-
convertedDeps.optionalDependencies,
|
|
128
|
-
].forEach((deps) => {
|
|
129
|
-
if (!deps)
|
|
130
|
-
return;
|
|
131
|
-
const dep = deps.find(({ name }) => data && name === data[2]);
|
|
132
|
-
if (!dep)
|
|
133
|
-
return;
|
|
134
|
-
version = dep.version;
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
if (data && name) {
|
|
138
|
-
overrides[data[2]] = {
|
|
139
|
-
id: data[2],
|
|
140
|
-
name: data[2],
|
|
141
|
-
version,
|
|
142
|
-
location: data[2],
|
|
143
|
-
applicationID: name,
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
return { overrides };
|
|
148
|
-
}
|
|
149
|
-
exports.modulePartTwo = modulePartTwo;
|
|
150
|
-
//# sourceMappingURL=module-part-two.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module-part-two.js","sourceRoot":"","sources":["../../../../src/lib/federation-graph/utils/module-part-two.ts"],"names":[],"mappings":";;;AA+BA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAgB,aAAa,CAAC,MAA2B;IACvD,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC;IAC5D,MAAM,SAAS,GAAG,EAA+B,CAAC;IAElD,OAAO,EAAE,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACvB,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC;QAE5D,IAAI,IAAI,GAAG,UAAU,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;QAClC,uIAAuI;QACvI,IAAI,UAAU,KAAK,gBAAgB,IAAI,IAAI,EAAE,CAAC;YAC5C,IAAI,UAAU,EAAE,CAAC;gBACf,iBAAiB;gBACjB,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAA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AE,OAAO;gBAClB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,IAAI,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gBAE9D,IAAI,CAAC,GAAG;oBAAE,OAAO;gBACjB,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;YACxB,CAAC,CAAC,CAAC;QACL,CAAC;QAED,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;YACjB,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG;gBACnB,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;gBACX,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;gBACb,OAAO;gBACP,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;gBACjB,aAAa,EAAE,IAAI;aACpB,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,SAAS,EAAE,CAAC;AACvB,CAAC;AAnID,sCAmIC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Consume } from './module-part-one';
|
|
2
|
-
/**
|
|
3
|
-
* This function processes dynamic remote module imports in a Module Federation setup. It
|
|
4
|
-
* tracks which files in the application consume (import) remote modules from other
|
|
5
|
-
* federated applications.
|
|
6
|
-
*
|
|
7
|
-
* For example, if app1 dynamically imports Button from app2 like: const Button = await
|
|
8
|
-
* import('app2/Button')
|
|
9
|
-
*
|
|
10
|
-
* This would be tracked as:
|
|
11
|
-
*
|
|
12
|
-
* - ApplicationID: 'app2'
|
|
13
|
-
* - Name: 'Button'
|
|
14
|
-
* - ConsumingApplicationID: 'Button'
|
|
15
|
-
* - UsedIn: Set of files in app1 that import Button
|
|
16
|
-
*/
|
|
17
|
-
interface ProcessFunctionRemoteParams {
|
|
18
|
-
functionRemotes: [file: string, applicationID: string, name: string][];
|
|
19
|
-
consumes: Consume[];
|
|
20
|
-
}
|
|
21
|
-
export declare function processFunctionRemotes(params: ProcessFunctionRemoteParams): {
|
|
22
|
-
consumes: Consume[];
|
|
23
|
-
};
|
|
24
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.processFunctionRemotes = void 0;
|
|
4
|
-
function processFunctionRemotes(params) {
|
|
5
|
-
const { functionRemotes, consumes } = params;
|
|
6
|
-
// TODO move this into the main consumes loop
|
|
7
|
-
if (!Array.isArray(functionRemotes)) {
|
|
8
|
-
return { consumes };
|
|
9
|
-
}
|
|
10
|
-
const dynamicConsumes = Object.values(functionRemotes.reduce((acc, [file, applicationID, name]) => {
|
|
11
|
-
const cleanName = name.replace('./', '');
|
|
12
|
-
const objectId = `${applicationID}/${cleanName}`;
|
|
13
|
-
const cleanFile = file.replace('./', '');
|
|
14
|
-
const foundExistingConsume = consumes.find((consumeObj) => consumeObj.applicationID === applicationID && consumeObj.name === cleanName);
|
|
15
|
-
if (foundExistingConsume) {
|
|
16
|
-
foundExistingConsume.usedIn.add(cleanFile);
|
|
17
|
-
return acc;
|
|
18
|
-
}
|
|
19
|
-
if (acc[objectId]) {
|
|
20
|
-
acc[objectId].usedIn.add(cleanFile);
|
|
21
|
-
return acc;
|
|
22
|
-
}
|
|
23
|
-
acc[objectId] = {
|
|
24
|
-
applicationID,
|
|
25
|
-
name: cleanName,
|
|
26
|
-
consumingApplicationID: name,
|
|
27
|
-
usedIn: new Set([cleanFile]),
|
|
28
|
-
};
|
|
29
|
-
return acc;
|
|
30
|
-
}, {}));
|
|
31
|
-
consumes.push(...dynamicConsumes);
|
|
32
|
-
return { consumes };
|
|
33
|
-
}
|
|
34
|
-
exports.processFunctionRemotes = processFunctionRemotes;
|
|
35
|
-
//# sourceMappingURL=process-function-remotes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"process-function-remotes.js","sourceRoot":"","sources":["../../../../src/lib/federation-gra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CAAC;SAC7B,CAAC;QACF,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAA6B,CAC9B,CACF,CAAC;IACF,QAAQ,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC;IAClC,OAAO,EAAE,QAAQ,EAAE,CAAC;AACtB,CAAC;AAvCD,wDAuCC"}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-params.js","sourceRoot":"","sources":["../../../src/lib/federation-graph/validate-params.ts"],"names":[],"mappings":""}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Stats, StatsCompilation } from '@rspack/core';
|
|
2
|
-
import { type Source } from 'zephyr-edge-contract';
|
|
3
|
-
import { ZephyrRepackPluginOptions } from './ze-repack-plugin';
|
|
4
|
-
export interface ZephyrAgentProps {
|
|
5
|
-
stats: Stats;
|
|
6
|
-
stats_json: StatsCompilation;
|
|
7
|
-
pluginOptions: ZephyrRepackPluginOptions;
|
|
8
|
-
assets: Record<string, Source>;
|
|
9
|
-
}
|
|
10
|
-
export declare function repack_zephyr_agent({ stats, stats_json, assets, pluginOptions, }: ZephyrAgentProps): Promise<void>;
|