zephyr-xpack-internal 0.0.31 → 0.0.32
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/federation-dashboard-legacy/get-build-stats.d.ts +2 -2
- package/dist/federation-dashboard-legacy/get-build-stats.js +11 -4
- package/dist/federation-dashboard-legacy/get-build-stats.js.map +1 -1
- package/dist/federation-dashboard-legacy/utils/convert-to-graph/convert-to-graph.d.ts +33 -0
- package/dist/federation-dashboard-legacy/utils/convert-to-graph/convert-to-graph.js +2 -1
- package/dist/federation-dashboard-legacy/utils/convert-to-graph/convert-to-graph.js.map +1 -1
- package/dist/federation-dashboard-legacy/utils/convert-to-graph/module-part-one.d.ts +18 -0
- package/dist/federation-dashboard-legacy/utils/convert-to-graph/module-part-one.js +18 -0
- package/dist/federation-dashboard-legacy/utils/convert-to-graph/module-part-one.js.map +1 -1
- package/dist/federation-dashboard-legacy/utils/convert-to-graph/module-part-two.d.ts +25 -0
- package/dist/federation-dashboard-legacy/utils/convert-to-graph/module-part-two.js +25 -0
- package/dist/federation-dashboard-legacy/utils/convert-to-graph/module-part-two.js.map +1 -1
- package/dist/federation-dashboard-legacy/utils/convert-to-graph/process-function-remotes.d.ts +15 -0
- package/dist/federation-dashboard-legacy/utils/convert-to-graph/process-function-remotes.js.map +1 -1
- package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/FederationDashboardPlugin.d.ts +47 -2
- package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/FederationDashboardPlugin.js +59 -7
- package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/FederationDashboardPlugin.js.map +1 -1
- package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/add-runtime-requirement-to-promise-external.js +19 -2
- package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/add-runtime-requirement-to-promise-external.js.map +1 -1
- package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/federation-dashboard-plugin-options.d.ts +2 -0
- package/dist/hooks/ze-setup-build-steps-logging.d.ts +19 -0
- package/dist/hooks/ze-setup-build-steps-logging.js +26 -0
- package/dist/hooks/ze-setup-build-steps-logging.js.map +1 -0
- package/dist/hooks/ze-setup-ze-deploy.d.ts +33 -0
- package/dist/hooks/ze-setup-ze-deploy.js +31 -0
- package/dist/hooks/ze-setup-ze-deploy.js.map +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -2
- package/dist/xpack-extract/create-mf-runtime-code.d.ts +2 -1
- package/dist/xpack-extract/create-mf-runtime-code.js +4 -3
- package/dist/xpack-extract/create-mf-runtime-code.js.map +1 -1
- package/dist/xpack-extract/extract-federated-dependency-pairs.js +17 -10
- package/dist/xpack-extract/extract-federated-dependency-pairs.js.map +1 -1
- package/dist/xpack-extract/index.d.ts +1 -1
- package/dist/xpack-extract/index.js +2 -1
- package/dist/xpack-extract/index.js.map +1 -1
- package/dist/xpack-extract/iterate-federated-remote-config.d.ts +2 -0
- package/dist/xpack-extract/iterate-federated-remote-config.js +26 -0
- package/dist/xpack-extract/iterate-federated-remote-config.js.map +1 -0
- package/dist/xpack-extract/iterate-federation-config.d.ts +1 -1
- package/dist/xpack-extract/iterate-federation-config.js +8 -5
- package/dist/xpack-extract/iterate-federation-config.js.map +1 -1
- package/dist/xpack-extract/make-copy-of-module-federation-options.js +4 -2
- package/dist/xpack-extract/make-copy-of-module-federation-options.js.map +1 -1
- package/dist/xpack-extract/mut-webpack-federated-remotes-config.d.ts +2 -1
- package/dist/xpack-extract/mut-webpack-federated-remotes-config.js +23 -9
- package/dist/xpack-extract/mut-webpack-federated-remotes-config.js.map +1 -1
- package/dist/xpack-extract/ze-xpack-upload-agent.d.ts +16 -0
- package/dist/xpack-extract/ze-xpack-upload-agent.js +42 -0
- package/dist/xpack-extract/ze-xpack-upload-agent.js.map +1 -0
- package/dist/xpack.types.d.ts +36 -12
- package/package.json +3 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ZephyrBuildStats } from 'zephyr-edge-contract';
|
|
2
2
|
import { ZephyrEngine } from 'zephyr-agent';
|
|
3
3
|
import { ModuleFederationPlugin, XStats, XStatsCompilation } from '../xpack.types';
|
|
4
4
|
interface KnownAgentProps {
|
|
@@ -14,5 +14,5 @@ export declare function getBuildStats<ZephyrAgentProps extends KnownAgentProps>(
|
|
|
14
14
|
DOMAIN?: string;
|
|
15
15
|
PLATFORM?: string;
|
|
16
16
|
TYPE?: string;
|
|
17
|
-
}): Promise<
|
|
17
|
+
}): Promise<ZephyrBuildStats>;
|
|
18
18
|
export {};
|
|
@@ -15,8 +15,12 @@ async function getBuildStats({ stats, stats_json, pluginOptions, EDGE_URL, DOMAI
|
|
|
15
15
|
isCI,
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
|
-
(0, zephyr_agent_1.ze_log)('process webpack graph');
|
|
19
|
-
const convertedGraph = dashboardPlugin.processWebpackGraph({
|
|
18
|
+
(0, zephyr_agent_1.ze_log)('process webpack graph.pluginOptions', pluginOptions);
|
|
19
|
+
const convertedGraph = dashboardPlugin.processWebpackGraph({
|
|
20
|
+
stats,
|
|
21
|
+
stats_json,
|
|
22
|
+
pluginOptions,
|
|
23
|
+
});
|
|
20
24
|
if (!convertedGraph) {
|
|
21
25
|
throw new zephyr_agent_1.ZephyrError(zephyr_agent_1.ZeErrors.ERR_CONVERT_GRAPH_TO_DASHBOARD);
|
|
22
26
|
}
|
|
@@ -27,7 +31,7 @@ async function getBuildStats({ stats, stats_json, pluginOptions, EDGE_URL, DOMAI
|
|
|
27
31
|
const mfConfig = Array.isArray(pluginOptions.mfConfig)
|
|
28
32
|
? pluginOptions.mfConfig[0]
|
|
29
33
|
: pluginOptions.mfConfig;
|
|
30
|
-
const { name, filename, remotes } =
|
|
34
|
+
const { name, filename, remotes } = mfConfig?._options || mfConfig?.config || {};
|
|
31
35
|
const data_overrides = {
|
|
32
36
|
id: application_uid,
|
|
33
37
|
name: name,
|
|
@@ -43,7 +47,10 @@ async function getBuildStats({ stats, stats_json, pluginOptions, EDGE_URL, DOMAI
|
|
|
43
47
|
context: { isCI },
|
|
44
48
|
};
|
|
45
49
|
// todo: extend data
|
|
46
|
-
const res = Object.assign({}, convertedGraph, data_overrides
|
|
50
|
+
const res = Object.assign({}, convertedGraph, data_overrides, {
|
|
51
|
+
project: name, // Add missing project property
|
|
52
|
+
tags: [], // Add missing tags property with empty array as default
|
|
53
|
+
});
|
|
47
54
|
(0, zephyr_agent_1.ze_log)('get build stats done.', res);
|
|
48
55
|
return res;
|
|
49
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-build-stats.js","sourceRoot":"","sources":["../../src/federation-dashboard-legacy/get-build-stats.ts"],"names":[],"mappings":";;;AACA,6GAA0G;AAC1G,+CAA2E;AAapE,KAAK,UAAU,aAAa,CAA2C,EAC5E,KAAK,EACL,UAAU,EACV,aAAa,EACb,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,IAAI,GAML;IACC,IAAA,qBAAM,EAAC,6DAA6D,CAAC,CAAC;IACtE,MAAM,GAAG,GAAG,aAAa,CAAC,aAAa,CAAC,qBAAqB,CAAC;IAC9D,MAAM,EAAE,GAAG,EAAE,GAAG,aAAa,CAAC,aAAa,CAAC,aAAa,CAAC;IAC1D,MAAM,EAAE,IAAI,EAAE,GAAG,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC;IACjD,MAAM,eAAe,GAAG,IAAI,qDAAyB,CAAC;QACpD,GAAG;QACH,GAAG;QACH,OAAO,EAAE;YACP,IAAI;SACL;KACF,CAAC,CAAC;IAEH,IAAA,qBAAM,EAAC,
|
|
1
|
+
{"version":3,"file":"get-build-stats.js","sourceRoot":"","sources":["../../src/federation-dashboard-legacy/get-build-stats.ts"],"names":[],"mappings":";;;AACA,6GAA0G;AAC1G,+CAA2E;AAapE,KAAK,UAAU,aAAa,CAA2C,EAC5E,KAAK,EACL,UAAU,EAC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,GAAG;QACrB,EAAE,EAAE,eAAe;QACnB,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE;QACvB,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,QAAQ;QAClB,IAAI,EAAE,IAAI;QACV,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC;QACxC,OAAO;QACP,GAAG;QACH,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;QACnC,OAAO,EAAE,EAAE,IAAI,EAAE;KAClB,CAAC;IAEF,oBAAoB;IAEpB,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,cAAc,EAAE,cAAc,EAAE;QAC5D,OAAO,EAAE,IAAI,EAAE,+BAA+B;QAC9C,IAAI,EAAE,EAAE,EAAE,wDAAwD;KACnE,CAAqB,CAAC;IACvB,IAAA,qBAAM,EAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;IACrC,OAAO,GAAG,CAAC;AACb,CAAC;AAvED,sCAuEC"}
|
|
@@ -3,11 +3,29 @@ import { TopLevelPackage } from './validate-params';
|
|
|
3
3
|
import { XStatsChunk, XStatsModule } from '../../../xpack.types';
|
|
4
4
|
import { ConvertedGraph } from 'zephyr-edge-contract';
|
|
5
5
|
export interface ConvertToGraphParams {
|
|
6
|
+
/** Application name in module federation config */
|
|
6
7
|
name?: string;
|
|
8
|
+
/** Required filename in React Native actual output js.bundle */
|
|
9
|
+
filename?: string;
|
|
10
|
+
/** Key of remotes as a string of arrays */
|
|
7
11
|
remotes?: unknown;
|
|
12
|
+
/**
|
|
13
|
+
* Chunk of the remote entry,
|
|
14
|
+
*
|
|
15
|
+
* // TODO: in MF2 should it be js.bundle or mf-manifest.json?
|
|
16
|
+
*/
|
|
8
17
|
federationRemoteEntry: XStatsChunk | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Module compilation results return from getStats(), typically includes all chunks and
|
|
20
|
+
* modules needed for the build
|
|
21
|
+
*/
|
|
9
22
|
modules?: XStatsModule[];
|
|
23
|
+
/**
|
|
24
|
+
* Shared packages in package.json, an Object of Record<string, any>, could be
|
|
25
|
+
* `dependencies`, `devDependencies` or `optionalDependencies`
|
|
26
|
+
*/
|
|
10
27
|
topLevelPackage: TopLevelPackage;
|
|
28
|
+
/** PublicPath from getStats().toJson() */
|
|
11
29
|
publicPath?: string;
|
|
12
30
|
metadata: {
|
|
13
31
|
remote?: string;
|
|
@@ -16,13 +34,28 @@ export interface ConvertToGraphParams {
|
|
|
16
34
|
};
|
|
17
35
|
};
|
|
18
36
|
versionData?: never;
|
|
37
|
+
/**
|
|
38
|
+
* Either `development` or other development enviornment (`production`), default to
|
|
39
|
+
* `development` if not specified
|
|
40
|
+
*/
|
|
19
41
|
environment?: string;
|
|
42
|
+
/** Computed version based on file hash and _options.versionStrategy // */
|
|
20
43
|
version?: string;
|
|
44
|
+
/** Date.now() if not specified */
|
|
21
45
|
posted?: Date;
|
|
46
|
+
/** 'default' if not specified, not sure what it does and what it's supposed to do */
|
|
22
47
|
group?: string;
|
|
23
48
|
functionRemotes: [file: string, applicationID: string, name: string][];
|
|
49
|
+
/** Git sha */
|
|
24
50
|
sha?: string;
|
|
51
|
+
/** GetStats()'s hash */
|
|
25
52
|
buildHash?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Include referenced chunks in a remote, if the host app doesn't expose anything it
|
|
55
|
+
* will be empty
|
|
56
|
+
*/
|
|
26
57
|
chunkDependencies: unknown;
|
|
58
|
+
/** Repack specific 'ios' | 'android' | 'web' | undefined */
|
|
59
|
+
target?: 'ios' | 'android' | 'web' | undefined;
|
|
27
60
|
}
|
|
28
61
|
export declare function convertToGraph(params: ConvertToGraphParams): ConvertedGraph;
|
|
@@ -10,7 +10,7 @@ function convertToGraph(params
|
|
|
10
10
|
) {
|
|
11
11
|
const { name,
|
|
12
12
|
// federationRemoteEntry,
|
|
13
|
-
modules, topLevelPackage, metadata, versionData, environment, version, posted, group, functionRemotes, sha, buildHash, } = params;
|
|
13
|
+
modules, topLevelPackage, metadata, versionData, environment, version, posted, group, functionRemotes, sha, buildHash, target, } = params;
|
|
14
14
|
// validateParams(
|
|
15
15
|
// { federationRemoteEntry, modules, topLevelPackage /*, metadata*/ },
|
|
16
16
|
// standalone
|
|
@@ -35,6 +35,7 @@ function convertToGraph(params
|
|
|
35
35
|
name,
|
|
36
36
|
remote,
|
|
37
37
|
metadata,
|
|
38
|
+
build_target: target,
|
|
38
39
|
versionData,
|
|
39
40
|
overrides: Object.values(overrides),
|
|
40
41
|
consumes: consumes.map((con) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-to-graph.js","sourceRoot":"","sources":["../../../../src/federation-dashboard-legacy/utils/convert-to-graph/convert-to-graph.ts"],"names":[],"mappings":";;;AAEA,uDAAkD;AAClD,iEAA6D;AAC7D,uDAAkD;AAClD,yEAAoE;
|
|
1
|
+
{"version":3,"file":"convert-to-graph.js","sourceRoot":"","sources":["../../../../src/federation-dashboard-legacy/utils/convert-to-graph/convert-to-graph.ts"],"names":[],"mappings":";;;AAEA,uDAAkD;AAClD,iEAA6D;AAC7D,uDAAkD;AAClD,yEAAoE;AAiEpE,SAAgB,cAAc,CAC5B,MAA4B;AAC5B,uBAAuB;;IAEvB,MAAM,EACJ,IAAI;IACJ,yBAAyB;IACzB,OAAO,EACP,eAAe,EACf,QAAQ,EACR,WAAW,EACX,WAAW,EACX,OAAO,EACP,MAAM,EACN,KAAK,EACL,eAAe,EACf,GAAG,EACH,SAAS,EACT,MAAM,GACP,GAAG,MAAM,CAAC;IAEX,kBAAkB;IAClB,wEAAwE;IACxE,eAAe;IACf,KAAK;IAEL,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,IAAA,+BAAa,EAAC,OAAO,CAAC,CAAC;IAEpE,MAAM,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QACH,WAAW;QACX,OAAO;QACP,MAAM;QACN,KAAK;QACL,GAAG;QACH,SAAS;KACV,CAAC;AACJ,CAAC;AA1ED,wCA0EC"}
|
|
@@ -12,5 +12,23 @@ interface ModulePartOneReturn {
|
|
|
12
12
|
modulesObj: Record<string, ModuleObject>;
|
|
13
13
|
npmModules: NpmModules;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* TODO: needs full rewrite Module analyzes the build statistics from Rspack to identify
|
|
17
|
+
* three key aspects of Module Federation. It calculate remote-module, container entry and
|
|
18
|
+
* node_modules
|
|
19
|
+
*
|
|
20
|
+
* 1. Remote Modules (remote-module) // TODO: this is broken needs to fix Tracks which
|
|
21
|
+
* modules are being consumed from other federated applications Maps the relationships
|
|
22
|
+
* between consuming applications and their remote dependencies Records where these
|
|
23
|
+
* remote modules are being used within the application
|
|
24
|
+
* 2. Container Entry (container entry) Processes the entry points exposed by the Module
|
|
25
|
+
* Federation container Creates a mapping of exposed modules and their file locations
|
|
26
|
+
* 3. Node Modules (node_modules) Collects information about third-party dependencies Gathers
|
|
27
|
+
* metadata like package versions, licenses, and sizes Helps track shared dependencies
|
|
28
|
+
* between federated applications
|
|
29
|
+
*
|
|
30
|
+
* @param modules - The stats object from @rspack/core to parse.
|
|
31
|
+
* @returns An object containing the consumes, modulesObj, and npmModules.
|
|
32
|
+
*/
|
|
15
33
|
export declare function modulePartOne(modules: XStatsModule[] | undefined): ModulePartOneReturn;
|
|
16
34
|
export {};
|
|
@@ -7,6 +7,24 @@ const get_licenses_1 = require("./get-licenses");
|
|
|
7
7
|
function isString(value) {
|
|
8
8
|
return typeof value === 'string';
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* TODO: needs full rewrite Module analyzes the build statistics from Rspack to identify
|
|
12
|
+
* three key aspects of Module Federation. It calculate remote-module, container entry and
|
|
13
|
+
* node_modules
|
|
14
|
+
*
|
|
15
|
+
* 1. Remote Modules (remote-module) // TODO: this is broken needs to fix Tracks which
|
|
16
|
+
* modules are being consumed from other federated applications Maps the relationships
|
|
17
|
+
* between consuming applications and their remote dependencies Records where these
|
|
18
|
+
* remote modules are being used within the application
|
|
19
|
+
* 2. Container Entry (container entry) Processes the entry points exposed by the Module
|
|
20
|
+
* Federation container Creates a mapping of exposed modules and their file locations
|
|
21
|
+
* 3. Node Modules (node_modules) Collects information about third-party dependencies Gathers
|
|
22
|
+
* metadata like package versions, licenses, and sizes Helps track shared dependencies
|
|
23
|
+
* between federated applications
|
|
24
|
+
*
|
|
25
|
+
* @param modules - The stats object from @rspack/core to parse.
|
|
26
|
+
* @returns An object containing the consumes, modulesObj, and npmModules.
|
|
27
|
+
*/
|
|
10
28
|
function modulePartOne(modules) {
|
|
11
29
|
const consumes = [];
|
|
12
30
|
const consumesByName = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-part-one.js","sourceRoot":"","sources":["../../../../src/federation-dashboard-legacy/utils/convert-to-graph/module-part-one.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AACtC,qCAAuC;AACvC,iDAA6C;AAoB7C,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAED,SAAgB,aAAa,CAAC,OAAmC;IAC/D,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;QACxE,MAAM,IAAI,GAAG,UAAU,EAAE,KAAK,CAAC,GAAG,CAAuC,CAAC;QAE1E,IAAI,UAAU,KAAK,eAAe,EAAE,CAAC;YACnC,IAAI,IAAI,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C,IAAI,EAAE,MAAM,CAAC,CAAC;gBAC3C,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;AAC9C,CAAC;AAtHD,sCAsHC;AAED,SAAS,2BAA2B,CAAC,SAAiB;IACpD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,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
|
+
{"version":3,"file":"module-part-one.js","sourceRoot":"","sources":["../../../../src/federation-dashboard-legacy/utils/convert-to-graph/module-part-one.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AACtC,qCAAuC;AACvC,iDAA6C;AAoB7C,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AAEH,SAAgB,aAAa,CAAC,OAAmC;IAC/D,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;QACxE,MAAM,IAAI,GAAG,UAAU,EAAE,KAAK,CAAC,GAAG,CAAuC,CAAC;QAE1E,IAAI,UAAU,KAAK,eAAe,EAAE,CAAC;YACnC,IAAI,IAAI,EAAE,MAAM,KAAK,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAA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AC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;AAC9C,CAAC;AAtHD,sCAsHC;AAED,SAAS,2BAA2B,CAAC,SAAiB;IACpD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,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"}
|
|
@@ -23,5 +23,30 @@ export interface Overrides {
|
|
|
23
23
|
interface ModulePartTwoReturn {
|
|
24
24
|
overrides: Record<string, unknown>;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* TODO: needs full rewrite 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
|
+
*/
|
|
26
51
|
export declare function modulePartTwo(params: ModulePartTwoParams): ModulePartTwoReturn;
|
|
27
52
|
export {};
|
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.modulePartTwo = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* TODO: needs full rewrite 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
|
+
*/
|
|
4
29
|
function modulePartTwo(params) {
|
|
5
30
|
const { name, modules, modulesObj, convertedDeps } = params;
|
|
6
31
|
const overrides = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-part-two.js","sourceRoot":"","sources":["../../../../src/federation-dashboard-legacy/utils/convert-to-graph/module-part-two.ts"],"names":[],"mappings":";;;AA+BA,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,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,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAChD,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACrC,CAAC;aAAM,CAAC;YACN;gBACE,aAAa,CAAC,YAAY;gBAC1B,aAAa,CAAC,eAAe;gBAC7B,aAAa,CAAC,oBAAoB;aACnC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBACjB,IAAI,CAAC,IAAI;oBAAE,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;AAjID,sCAiIC"}
|
|
1
|
+
{"version":3,"file":"module-part-two.js","sourceRoot":"","sources":["../../../../src/federation-dashboard-legacy/utils/convert-to-graph/module-part-two.ts"],"names":[],"mappings":";;;AA+BA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,SAAgB,aAAa,CAAC,MAA2B;IACvD,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,GA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OAAO,GAAG,EAAE,CAAC;QAEjB,IAAI,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAChD,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACrC,CAAC;aAAM,CAAC;YACN;gBACE,aAAa,CAAC,YAAY;gBAC1B,aAAa,CAAC,eAAe;gBAC7B,aAAa,CAAC,oBAAoB;aACnC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBACjB,IAAI,CAAC,IAAI;oBAAE,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;AAjID,sCAiIC"}
|
package/dist/federation-dashboard-legacy/utils/convert-to-graph/process-function-remotes.d.ts
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
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
|
+
*/
|
|
2
17
|
interface ProcessFunctionRemoteParams {
|
|
3
18
|
functionRemotes: [file: string, applicationID: string, name: string][];
|
|
4
19
|
consumes: Consume[];
|
package/dist/federation-dashboard-legacy/utils/convert-to-graph/process-function-remotes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-function-remotes.js","sourceRoot":"","sources":["../../../../src/federation-dashboard-legacy/utils/convert-to-graph/process-function-remotes.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"process-function-remotes.js","sourceRoot":"","sources":["../../../../src/federation-dashboard-legacy/utils/convert-to-graph/process-function-remotes.ts"],"names":[],"mappings":";;;AAuBA,SAAgB,sBAAsB,CAAC,MAAmC;IAGxE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAC7C,6CAA6C;IAC7C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;QACpC,OAAO,EAAE,QAAQ,EAAE,CAAC;IACtB,CAAC;IACD,MAAM,eAAe,GAAc,MAAM,CAAC,MAAM,CAC9C,eAAe,CAAC,MAAM,CACpB,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,EAAE;QACnC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACzC,MAAM,QAAQ,GAAG,GAAG,aAAa,IAAI,SAAS,EAAE,CAAC;QACjD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACzC,MAAM,oBAAoB,GAAG,QAAQ,CAAC,IAAI,CACxC,CAAC,UAAU,EAAE,EAAE,CACb,UAAU,CAAC,aAAa,KAAK,aAAa,IAAI,UAAU,CAAC,IAAI,KAAK,SAAS,CAC9E,CAAC;QACF,IAAI,oBAAoB,EAAE,CAAC;YACzB,oBAAoB,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAC3C,OAAO,GAAG,CAAC;QACb,CAAC;QACD,IAAI,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YAClB,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YACpC,OAAO,GAAG,CAAC;QACb,CAAC;QACD,GAAG,CAAC,QAAQ,CAAC,GAAG;YACd,aAAa;YACb,IAAI,EAAE,SAAS;YACf,sBAAsB,EAAE,IAAI;YAC5B,MAAM,EAAE,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC;SAC7B,CAAC;QACF,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAA6B,CAC9B,CACF,CAAC;IACF,QAAQ,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC;IAElC,OAAO,EAAE,QAAQ,EAAE,CAAC;AACtB,CAAC;AAxCD,wDAwCC"}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { ConvertedGraph, ZeUploadBuildStats } from 'zephyr-edge-contract';
|
|
2
|
+
import { ZephyrEngine } from 'zephyr-agent';
|
|
2
3
|
import { TopLevelPackage } from '../convert-to-graph/validate-params';
|
|
3
4
|
import { FederationDashboardPluginOptions } from './federation-dashboard-plugin-options';
|
|
4
5
|
import { Exposes } from './federation-dashboard-types';
|
|
5
|
-
import { XChunk, XCompiler, XStats, XStatsChunk, XStatsCompilation } from '../../../xpack.types';
|
|
6
|
+
import { XChunk, XCompiler, XStats, XStatsChunk, XStatsCompilation, ModuleFederationPlugin } from '../../../xpack.types';
|
|
6
7
|
interface ProcessWebpackGraphParams {
|
|
7
8
|
stats: XStats;
|
|
8
9
|
stats_json: XStatsCompilation;
|
|
10
|
+
pluginOptions: {
|
|
11
|
+
zephyr_engine: ZephyrEngine;
|
|
12
|
+
mfConfig: ModuleFederationPlugin[] | ModuleFederationPlugin | undefined;
|
|
13
|
+
upload_file?: boolean;
|
|
14
|
+
target?: 'ios' | 'android' | 'web' | undefined;
|
|
15
|
+
};
|
|
9
16
|
}
|
|
10
17
|
export declare class FederationDashboardPlugin {
|
|
11
18
|
_options: FederationDashboardPluginOptions;
|
|
@@ -14,17 +21,55 @@ export declare class FederationDashboardPlugin {
|
|
|
14
21
|
FederationPluginOptions: {
|
|
15
22
|
name?: string;
|
|
16
23
|
remotes?: unknown;
|
|
24
|
+
/**
|
|
25
|
+
* **bundle_name**: This is a placeholder option since Repack is fast iterating on
|
|
26
|
+
* Module Federation, right now they are consuming JS bundle and ignore
|
|
27
|
+
* mf-manifest.json, but if it comes back this field will be needed to understand what
|
|
28
|
+
* bundle name to look for in mf-manifest.json, Available in
|
|
29
|
+
* ApplicationVersion.metadata.
|
|
30
|
+
*/
|
|
31
|
+
bundle_name?: string;
|
|
32
|
+
filename?: string;
|
|
17
33
|
exposes?: Exposes;
|
|
18
34
|
};
|
|
19
35
|
constructor(options: Partial<FederationDashboardPluginOptions>);
|
|
20
36
|
/** @param {Compiler} compiler */
|
|
21
37
|
apply(compiler: XCompiler): void;
|
|
22
|
-
processWebpackGraph({ stats, stats_json, }: ProcessWebpackGraphParams): ConvertedGraph | undefined;
|
|
38
|
+
processWebpackGraph({ stats, stats_json, pluginOptions, }: ProcessWebpackGraphParams): ConvertedGraph | undefined;
|
|
23
39
|
getRemoteEntryChunk(stats: XStatsCompilation, FederationPluginOptions: typeof this.FederationPluginOptions): XStatsChunk | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* TODO: needs a full rewrite because `_group` no longer exists in both Rspack and
|
|
42
|
+
* Webpack
|
|
43
|
+
*
|
|
44
|
+
* Return { "main": [{...dep1Details}, {...dep2Details}], "vendor": [{...dep3Details}],
|
|
45
|
+
*
|
|
46
|
+
* 1. Useful for dynamic imports - object generated could inform the bundler or runtime
|
|
47
|
+
* loader about which chunks are needed for specific part of the app, enabling better
|
|
48
|
+
* performance optimization 1.1 if a chunk representing a React component dynamically
|
|
49
|
+
* loads, this dependency graph can help the runtime understand what other chunks
|
|
50
|
+
* need to be loaded alongside it.
|
|
51
|
+
* 2. Optimized loading and caching: By mapping chunk dependencies, this function supports
|
|
52
|
+
* advanced optimizations like caching. Chunks that haven’t changed between builds
|
|
53
|
+
* can be cached separately, reducing the need for users to download unchanged code.
|
|
54
|
+
*
|
|
55
|
+
* }
|
|
56
|
+
*/
|
|
24
57
|
getChunkDependencies(validChunkArray: XChunk[]): Record<string, never>;
|
|
25
58
|
buildVendorFederationMap(liveStats: XStats): TopLevelPackage;
|
|
26
59
|
mapToObjectRec(m: Record<string, XChunk[keyof XChunk]> | Map<string, XChunk[keyof XChunk]> | XChunk[keyof XChunk][]): Record<string, unknown>;
|
|
60
|
+
/**
|
|
61
|
+
* In a remote application, this function is used to find all the chunks that are
|
|
62
|
+
* referenced by the remote entry chunk It won't return anything from HostApp
|
|
63
|
+
*/
|
|
27
64
|
buildValidChunkArray(liveStats: XStats, FederationPluginOptions: typeof this.FederationPluginOptions): XChunk[];
|
|
65
|
+
/**
|
|
66
|
+
* We are doing this because the filename in React Native is the actual JS bundle, "How
|
|
67
|
+
* we understand the filename is different in react native" - filename would be at the
|
|
68
|
+
* end of the URL modified in get_mf_config.ts If we don't attach the remote bundle name
|
|
69
|
+
* to metadata, we will have no track record of the actual bundle when we need it later
|
|
70
|
+
* -- this is RePack specific.
|
|
71
|
+
*/
|
|
72
|
+
attach_remote_bundle_name_to_metadata(): Record<string, string> | undefined;
|
|
28
73
|
postDashboardData(dashData: any): Promise<{
|
|
29
74
|
value: ZeUploadBuildStats;
|
|
30
75
|
} | undefined>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FederationDashboardPlugin = void 0;
|
|
4
4
|
const node_path_1 = require("node:path");
|
|
5
|
+
const zephyr_agent_1 = require("zephyr-agent");
|
|
5
6
|
const convert_to_graph_1 = require("../convert-to-graph/convert-to-graph");
|
|
6
7
|
const find_package_json_1 = require("./find-package-json");
|
|
7
8
|
const compute_version_strategy_1 = require("./compute-version-strategy");
|
|
@@ -164,7 +165,7 @@ class FederationDashboardPlugin {
|
|
|
164
165
|
this.allArgumentsUsed = Object.values(uniqueArgs);
|
|
165
166
|
if (callback) callback();
|
|
166
167
|
}*/
|
|
167
|
-
processWebpackGraph({ stats, stats_json, }) {
|
|
168
|
+
processWebpackGraph({ stats, stats_json, pluginOptions, }) {
|
|
168
169
|
// async processWebpackGraph(/*curCompiler: Compilation*/): Promise<unknown> {
|
|
169
170
|
// const stats = curCompiler.getStats();
|
|
170
171
|
// const stats_json = stats.toJson();
|
|
@@ -172,27 +173,36 @@ class FederationDashboardPlugin {
|
|
|
172
173
|
// this.parseModuleAst(curCompiler);
|
|
173
174
|
// }
|
|
174
175
|
// fs.writeFileSync('stats.json', JSON.stringify(stats, null, 2))
|
|
176
|
+
this.FederationPluginOptions = Object.assign({}, this.FederationPluginOptions, pluginOptions.mfConfig);
|
|
175
177
|
// get RemoteEntryChunk
|
|
176
178
|
const RemoteEntryChunk = this.getRemoteEntryChunk(stats_json, this.FederationPluginOptions);
|
|
177
179
|
const validChunkArray = this.buildValidChunkArray(stats, this.FederationPluginOptions);
|
|
178
180
|
const chunkDependencies = this.getChunkDependencies(validChunkArray);
|
|
179
181
|
const vendorFederation = this.buildVendorFederationMap(stats);
|
|
182
|
+
// TODO: this type casting might not be every compilation result from rspack, but it's fine for now
|
|
183
|
+
const getPlatformFromStats = stats.compilation
|
|
184
|
+
.name;
|
|
185
|
+
const remotes = this.FederationPluginOptions?.remotes
|
|
186
|
+
? Object.keys(this.FederationPluginOptions.remotes)
|
|
187
|
+
: {};
|
|
180
188
|
const rawData = {
|
|
181
189
|
name: this.FederationPluginOptions?.name,
|
|
182
|
-
|
|
183
|
-
|
|
190
|
+
filename: this.FederationPluginOptions?.filename || '',
|
|
191
|
+
remotes: remotes,
|
|
192
|
+
metadata: Object.assign({}, this._options.metadata, this.attach_remote_bundle_name_to_metadata()) || {},
|
|
184
193
|
topLevelPackage: vendorFederation || {},
|
|
185
194
|
publicPath: stats_json.publicPath,
|
|
186
195
|
federationRemoteEntry: RemoteEntryChunk,
|
|
187
196
|
buildHash: stats_json.hash,
|
|
188
|
-
environment: this._options.environment, // 'development' if not specified
|
|
197
|
+
environment: this._options.environment || 'development', // 'development' if not specified
|
|
189
198
|
version: (0, compute_version_strategy_1.computeVersionStrategy)(stats_json, this._options.versionStrategy),
|
|
190
|
-
posted: this._options.posted, // Date.now() if not specified
|
|
191
|
-
group: this._options.group, // 'default' if not specified
|
|
199
|
+
posted: this._options.posted || new Date(), // Date.now() if not specified
|
|
200
|
+
group: this._options.group || 'default', // 'default' if not specified
|
|
192
201
|
sha: compute_version_strategy_1.gitSha,
|
|
193
202
|
modules: stats_json.modules,
|
|
194
203
|
chunkDependencies,
|
|
195
204
|
functionRemotes: this.allArgumentsUsed,
|
|
205
|
+
target: pluginOptions.target || getPlatformFromStats,
|
|
196
206
|
};
|
|
197
207
|
let graphData;
|
|
198
208
|
try {
|
|
@@ -297,11 +307,30 @@ class FederationDashboardPlugin {
|
|
|
297
307
|
}
|
|
298
308
|
});*/
|
|
299
309
|
}
|
|
310
|
+
// TODO: add notes on why we need these and what does these do
|
|
300
311
|
getRemoteEntryChunk(stats, FederationPluginOptions) {
|
|
301
312
|
if (!stats.chunks)
|
|
302
313
|
return;
|
|
314
|
+
// TODO: print all chunk name and see if it has the bundle name or actual remote name. in Rspack this field would return in remote application but won't return in host application due to Rspack's data structure - need external PR to fix
|
|
303
315
|
return stats.chunks.find((chunk) => chunk.names?.find((name) => name === FederationPluginOptions.name));
|
|
304
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* TODO: needs a full rewrite because `_group` no longer exists in both Rspack and
|
|
319
|
+
* Webpack
|
|
320
|
+
*
|
|
321
|
+
* Return { "main": [{...dep1Details}, {...dep2Details}], "vendor": [{...dep3Details}],
|
|
322
|
+
*
|
|
323
|
+
* 1. Useful for dynamic imports - object generated could inform the bundler or runtime
|
|
324
|
+
* loader about which chunks are needed for specific part of the app, enabling better
|
|
325
|
+
* performance optimization 1.1 if a chunk representing a React component dynamically
|
|
326
|
+
* loads, this dependency graph can help the runtime understand what other chunks
|
|
327
|
+
* need to be loaded alongside it.
|
|
328
|
+
* 2. Optimized loading and caching: By mapping chunk dependencies, this function supports
|
|
329
|
+
* advanced optimizations like caching. Chunks that haven’t changed between builds
|
|
330
|
+
* can be cached separately, reducing the need for users to download unchanged code.
|
|
331
|
+
*
|
|
332
|
+
* }
|
|
333
|
+
*/
|
|
305
334
|
getChunkDependencies(validChunkArray) {
|
|
306
335
|
return validChunkArray.reduce((acc, chunk) => {
|
|
307
336
|
const subset = chunk.getAllReferencedChunks();
|
|
@@ -319,6 +348,7 @@ class FederationDashboardPlugin {
|
|
|
319
348
|
}, {});
|
|
320
349
|
}
|
|
321
350
|
buildVendorFederationMap(liveStats) {
|
|
351
|
+
// calling it "vendor", it's actually npm dependencies
|
|
322
352
|
const vendorFederation = {};
|
|
323
353
|
let packageJson;
|
|
324
354
|
if (this._options.packageJsonPath) {
|
|
@@ -357,6 +387,7 @@ class FederationDashboardPlugin {
|
|
|
357
387
|
}
|
|
358
388
|
return vendorFederation;
|
|
359
389
|
}
|
|
390
|
+
// Clean up the Chunks to a clear object with keys
|
|
360
391
|
mapToObjectRec(m) {
|
|
361
392
|
const lo = {};
|
|
362
393
|
for (const [key, value] of Object.entries(m)) {
|
|
@@ -372,6 +403,10 @@ class FederationDashboardPlugin {
|
|
|
372
403
|
}
|
|
373
404
|
return lo;
|
|
374
405
|
}
|
|
406
|
+
/**
|
|
407
|
+
* In a remote application, this function is used to find all the chunks that are
|
|
408
|
+
* referenced by the remote entry chunk It won't return anything from HostApp
|
|
409
|
+
*/
|
|
375
410
|
buildValidChunkArray(liveStats, FederationPluginOptions) {
|
|
376
411
|
if (!FederationPluginOptions.name)
|
|
377
412
|
return [];
|
|
@@ -409,8 +444,25 @@ class FederationDashboardPlugin {
|
|
|
409
444
|
|
|
410
445
|
return Array.from(directReasons);
|
|
411
446
|
}*/
|
|
447
|
+
/**
|
|
448
|
+
* We are doing this because the filename in React Native is the actual JS bundle, "How
|
|
449
|
+
* we understand the filename is different in react native" - filename would be at the
|
|
450
|
+
* end of the URL modified in get_mf_config.ts If we don't attach the remote bundle name
|
|
451
|
+
* to metadata, we will have no track record of the actual bundle when we need it later
|
|
452
|
+
* -- this is RePack specific.
|
|
453
|
+
*/
|
|
454
|
+
attach_remote_bundle_name_to_metadata() {
|
|
455
|
+
if (!this.FederationPluginOptions.exposes) {
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
// TODO: not sure if this error would break the build. Silently log it for now
|
|
459
|
+
if (!this.FederationPluginOptions.bundle_name) {
|
|
460
|
+
console.warn(zephyr_agent_1.ZeErrors.ERR_MF_CONFIG_MISSING_FILENAME);
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
return { remote_bundle_name: this.FederationPluginOptions.bundle_name };
|
|
464
|
+
}
|
|
412
465
|
async postDashboardData(dashData) {
|
|
413
|
-
console.log(dashData);
|
|
414
466
|
throw new Error('not implemented, override it');
|
|
415
467
|
}
|
|
416
468
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FederationDashboardPlugin.js","sourceRoot":"","sources":["../../../../src/federation-dashboard-legacy/utils/federation-dashboard-plugin/FederationDashboardPlugin.ts"],"names":[],"mappings":";;;AAAA,yCAAgC;
|
|
1
|
+
{"version":3,"file":"FederationDashboardPlugin.js","sourceRoot":"","sources":["../../../../src/federation-dashboard-legacy/utils/federation-dashboard-plugin/FederationDashboardPlugin.ts"],"names":[],"mappings":";;;AAAA,yCAAgC;AAGhC,+CAAsD;AACtD,2EAG8C;AAE9C,2DAAsD;AACtD,yEAA4E;AAE5E,+GAAuG;AAEvG,oGAA8F;AAU9F,wCAAwC;AACxC,8DAA8D;AAC9D,MAAM,yBAAyB,GAAG,OAAO,CAAC,gDAAgD,CAAC,CAAC;AAe5F,MAAa,yBAAyB;IAoBpC,mDAAmD;IACnD,YAAY,OAAkD;QAlB9D,qBAAgB,GAA0D,EAAE,CAAC;QAE7E,4BAAuB,GAanB,EAAE,CAAC;QAIL,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAC3B;YACE,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,KAAK;SACd,EACD,OAAO,CAC4B,CAAC;IACxC,CAAC;IAED,iCAAiC;IACjC,KAAK,CAAC,QAAmB;QACvB,+CAA+C;QAC/C,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QAEtD,IAAI,oFAAsC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAE7D,MAAM,gBAAgB,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,sDAAwB,CAAC,CAAC;QAEjF,uBAAuB;QACvB,IAAI,CAAC,QAAQ,CAAC,UAAU,GAAG,OAAO,gBAAgB,KAAK,WAAW,CAAC;QAEnE,IAAI,gBAAgB,EAAE,CAAC;YACrB,IAAI,CAAC,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAC1C,EAAE,EACF,gBAAgB,CAAC,QAAQ,EACzB,IAAI,CAAC,QAAQ,CAAC,UAAU,IAAI,EAAE,CAC/B,CAAC;QACJ,CAAC;aAAM,IAAI,IAAI,CAAC,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AW,CAAC,WAAW,CAAC,GAAG,CAC1D,uBAAuB,CAAC,IAAI,CAC7B,CAAC;QAEF,IAAI,CAAC,cAAc;YAAE,OAAO,EAAE,CAAC;QAE/B,MAAM,2BAA2B,GAAG,cAAc,CAAC,sBAAsB,EAAE,CAAC;QAE5E,MAAM,eAAe,GAAa,EAAE,CAAC;QACrC,KAAK,MAAM,KAAK,IAAI,2BAA2B,EAAE,CAAC;YAChD,IAAI,KAAK,CAAC,EAAE,KAAK,uBAAuB,CAAC,IAAI,EAAE,CAAC;gBAC9C,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IAEH;;;;;;OAMG;IACH,qCAAqC;QACnC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,CAAC;YAC1C,OAAO;QACT,CAAC;QACD,8EAA8E;QAC9E,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,WAAW,EAAE,CAAC;YAC9C,OAAO,CAAC,IAAI,CAAC,uBAAQ,CAAC,8BAA8B,CAAC,CAAC;YACtD,OAAO;QACT,CAAC;QAED,OAAO,EAAE,kBAAkB,EAAE,IAAI,CAAC,uBAAuB,CAAC,WAAW,EAAE,CAAC;IAC1E,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,QAAa;QAMnC,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;CACF;AAziBD,8DAyiBC"}
|
|
@@ -4,14 +4,31 @@ exports.AddRuntimeRequirementToPromiseExternal = void 0;
|
|
|
4
4
|
class AddRuntimeRequirementToPromiseExternal {
|
|
5
5
|
apply(compiler) {
|
|
6
6
|
compiler.hooks.compilation.tap('AddRuntimeRequirementToPromiseExternal', (compilation) => {
|
|
7
|
+
// TODO: access runtime global
|
|
7
8
|
const { RuntimeGlobals } = compiler.webpack;
|
|
9
|
+
// compilation.outputOptions.trustedTypes are used in browser environment to ensure XSS attack, this won't be useful in React Native
|
|
10
|
+
// reference: https://github.com/web-infra-dev/rspack/blob/52d7dcd48df764674f50e65b51297a7a697c15e7/packages/rspack/src/config/types.ts#L306
|
|
8
11
|
if (compilation.outputOptions.trustedTypes) {
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
// This is for Webpack
|
|
13
|
+
if (compilation.outputOptions.trustedTypes) {
|
|
14
|
+
compilation.hooks.additionalModuleRuntimeRequirements.tap('AddRuntimeRequirementToPromiseExternal', (module, set) => {
|
|
15
|
+
if (module.externalType === 'promise') {
|
|
16
|
+
set.add(RuntimeGlobals.loadScript);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
// This is for Rspack (include Repack)
|
|
21
|
+
compilation.hooks.additionalTreeRuntimeRequirements.tap('AddRuntimeRequirementToPromiseExternal', (chunk, set) => {
|
|
22
|
+
if (chunk.externalType === 'promise') {
|
|
11
23
|
set.add(RuntimeGlobals.loadScript);
|
|
12
24
|
}
|
|
13
25
|
});
|
|
14
26
|
}
|
|
27
|
+
// even if `trustedTypes` don't exists, there isn't an external type, load the script anyways
|
|
28
|
+
// TODO: verify if this works
|
|
29
|
+
compilation.hooks.additionalTreeRuntimeRequirements.tap('AddRuntimeRequirementToPromiseExternal', (chunk, set) => {
|
|
30
|
+
set.add(RuntimeGlobals.loadScript);
|
|
31
|
+
});
|
|
15
32
|
});
|
|
16
33
|
}
|
|
17
34
|
}
|