zephyr-xpack-internal 0.0.0-canary-20250728214036 → 0.0.0-canary-20250806121212
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.js +16 -1
- package/dist/federation-dashboard-legacy/get-build-stats.js.map +1 -1
- package/dist/federation-dashboard-legacy/utils/convert-to-graph/convert-to-graph.js +4 -6
- 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.js.map +1 -1
- package/dist/hooks/ze-emit-manifest.d.ts +37 -0
- package/dist/hooks/ze-emit-manifest.js +29 -0
- package/dist/hooks/ze-emit-manifest.js.map +1 -0
- package/dist/index.d.ts +6 -5
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/types/module-federation.types.d.ts +300 -0
- package/dist/types/module-federation.types.js +5 -0
- package/dist/types/module-federation.types.js.map +1 -0
- package/dist/xpack-extract/create-mf-runtime-code.js +1 -1
- package/dist/xpack-extract/create-mf-runtime-code.js.map +1 -1
- package/dist/xpack-extract/index.d.ts +1 -0
- package/dist/xpack-extract/index.js +3 -1
- package/dist/xpack-extract/index.js.map +1 -1
- package/dist/xpack-extract/is-legacy-mf-plugin.d.ts +2 -0
- package/dist/xpack-extract/is-legacy-mf-plugin.js +50 -0
- package/dist/xpack-extract/is-legacy-mf-plugin.js.map +1 -0
- package/dist/xpack-extract/iterate-federated-remote-config.d.ts +2 -2
- package/dist/xpack-extract/iterate-federated-remote-config.js +1 -1
- package/dist/xpack-extract/iterate-federated-remote-config.js.map +1 -1
- package/dist/xpack-extract/mut-webpack-federated-remotes-config.js +15 -2
- package/dist/xpack-extract/mut-webpack-federated-remotes-config.js.map +1 -1
- package/dist/xpack-extract/runtime-plugin-insert.d.ts +3 -0
- package/dist/xpack-extract/runtime-plugin-insert.js +51 -0
- package/dist/xpack-extract/runtime-plugin-insert.js.map +1 -0
- package/dist/xpack-extract/runtime-plugin.d.ts +9 -0
- package/dist/xpack-extract/runtime-plugin.js +152 -0
- package/dist/xpack-extract/runtime-plugin.js.map +1 -0
- package/dist/xpack.types.d.ts +8 -0
- package/package.json +3 -3
|
@@ -29,12 +29,26 @@ async function getBuildStats({ stats, stats_json, pluginOptions, EDGE_URL, DOMAI
|
|
|
29
29
|
const version = await ze_engine.snapshotId;
|
|
30
30
|
const application_uid = ze_engine.application_uid;
|
|
31
31
|
const buildId = await ze_engine.build_id;
|
|
32
|
+
const build_target = ze_engine.env.target ?? 'web';
|
|
32
33
|
// todo: add support for multiple federation configs
|
|
33
34
|
const mfConfig = Array.isArray(pluginOptions.mfConfig)
|
|
34
35
|
? pluginOptions.mfConfig[0]
|
|
35
36
|
: pluginOptions.mfConfig;
|
|
36
37
|
const { name, filename } = mfConfig ? ((0, extract_federation_config_1.extractFederatedConfig)(mfConfig) ?? {}) : {};
|
|
37
38
|
const remotes = ze_engine.federated_dependencies;
|
|
39
|
+
// Build zephyr:dependencies from federated_dependencies
|
|
40
|
+
const zephyrDependencies = {};
|
|
41
|
+
if (remotes) {
|
|
42
|
+
for (const dep of remotes) {
|
|
43
|
+
zephyrDependencies[dep.name] = {
|
|
44
|
+
application_uid: dep.application_uid,
|
|
45
|
+
remote_entry_url: dep.remote_entry_url,
|
|
46
|
+
default_url: dep.default_url,
|
|
47
|
+
name: dep.name,
|
|
48
|
+
library_type: dep.library_type || 'module',
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
38
52
|
const data_overrides = {
|
|
39
53
|
id: application_uid,
|
|
40
54
|
name: name,
|
|
@@ -48,7 +62,8 @@ async function getBuildStats({ stats, stats_json, pluginOptions, EDGE_URL, DOMAI
|
|
|
48
62
|
remote: filename,
|
|
49
63
|
remotes: remotes?.map(({ application_uid }) => application_uid) ?? [],
|
|
50
64
|
context: { isCI },
|
|
51
|
-
build_target
|
|
65
|
+
build_target,
|
|
66
|
+
'zephyr:dependencies': zephyrDependencies,
|
|
52
67
|
};
|
|
53
68
|
// todo: extend data
|
|
54
69
|
const res = Object.assign({}, convertedGraph, data_overrides, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-build-stats.js","sourceRoot":"","sources":["../../src/federation-dashboard-legacy/get-build-stats.ts"],"names":[],"mappings":";;AAiBA,
|
|
1
|
+
{"version":3,"file":"get-build-stats.js","sourceRoot":"","sources":["../../src/federation-dashboard-legacy/get-build-stats.ts"],"names":[],"mappings":";;AAiBA,sCA4FC;AA5GD,+CAA6D;AAE7D,0FAAoF;AAEpF,6GAA0G;AAYnG,KAAK,UAAU,aAAa,CAA2C,EAC5E,KAAK,EACL,UAAU,EACV,aAAa,EACb,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,SAAS,EAAE,SAAS,GAAG,SAAS,GAOjC;IACC,qBAAM,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC;IAC1E,MAAM,SAAS,GAAG,aAAa,CAAC,aAAa,CAAC;IAC9C,MAAM,GAAG,GAAG,SAAS,CAAC,qBAAqB,CAAC;IAC5C,MAAM,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC,aAAa,CAAC;IACxC,MAAM,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC,GAAG,CAAC;IAC/B,MAAM,eAAe,GAAG,IAAI,qDAAyB,CAAC;QACpD,GAAG;QACH,GAAG;QACH,OAAO,EAAE;YACP,IAAI;SACL;KACF,CAAC,CAAC;IAEH,qBAAM,CAAC,GAAG,CAAC,qCAAqC,EAAE,aAAa,CAAC,CAAC;IACjE,MAAM,cAAc,GAAG,eAAe,CAAC,mBAAmB,CAAC;QACzD,KAAK;QACL,UAAU;QACV,aAAa;KACd,CAAC,CAAC;IAEH,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,0BAAW,CAAC,uBAAQ,CAAC,8BAA8B,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,OAAO,G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AI,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,OAAO,EAAE,GAAG,CAAC,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC,eAAe,CAAC,IAAI,EAAE;QACrE,OAAO,EAAE,EAAE,IAAI,EAAE;QACjB,YAAY;QACZ,qBAAqB,EAAE,kBAAkB;KAC1C,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,qBAAM,CAAC,GAAG,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;IACzC,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -40,12 +40,10 @@ function convertToGraph(params
|
|
|
40
40
|
overrides: Object.values(overrides),
|
|
41
41
|
consumes: consumes.map((con) => ({
|
|
42
42
|
...con,
|
|
43
|
-
usedIn: Array.from(con.usedIn.values()).map((file) => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
48
|
-
}),
|
|
43
|
+
usedIn: Array.from(con.usedIn.values()).map((file) => ({
|
|
44
|
+
file,
|
|
45
|
+
url: `${sourceUrl}/${file}`,
|
|
46
|
+
})),
|
|
49
47
|
})),
|
|
50
48
|
modules: Object.values(modulesObj).map((mod) => ({
|
|
51
49
|
...mod,
|
|
@@ -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":";;AAsEA,
|
|
1
|
+
{"version":3,"file":"convert-to-graph.js","sourceRoot":"","sources":["../../../../src/federation-dashboard-legacy/utils/convert-to-graph/convert-to-graph.ts"],"names":[],"mappings":";;AAsEA,wCA0EC;AA9ID,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,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;QACJ,MAAM;QACN,QAAQ;QACR,YAAY,EAAE,MAAM;QACpB,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;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -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":";;AA6CA,
|
|
1
|
+
{"version":3,"file":"module-part-one.js","sourceRoot":"","sources":["../../../../src/federation-dashboard-legacy/utils/convert-to-graph/module-part-one.ts"],"names":[],"mappings":";;AA6CA,sCAsHC;AAnKD,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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,CAAC,CAAC;gBACpD,CAAC;qBAAM,CAAC;oBACN,MAAM,MAAM,GAAG;wBACb,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;4BACrB,IAAI,EAAE,WAAW,CAAC,IAAI;4BACtB,OAAO,EAAE,WAAW,CAAC,OAAO;4BAC5B,QAAQ,EAAE,WAAW,CAAC,QAAQ;4BAC9B,OAAO,EAAE,IAAA,0BAAW,EAAC,WAAW,CAAC;4BACjC,IAAI;yBACL;qBACF,CAAC;oBACF,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC,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;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"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ZephyrEngine } from 'zephyr-agent';
|
|
2
|
+
interface EmitManifestOptions {
|
|
3
|
+
pluginName: string;
|
|
4
|
+
zephyr_engine: ZephyrEngine;
|
|
5
|
+
}
|
|
6
|
+
interface EmitManifestCompiler {
|
|
7
|
+
webpack: {
|
|
8
|
+
sources: {
|
|
9
|
+
RawSource: new (source: string | Buffer) => any;
|
|
10
|
+
};
|
|
11
|
+
Compilation: {
|
|
12
|
+
PROCESS_ASSETS_STAGE_ADDITIONAL: number;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
hooks: {
|
|
16
|
+
thisCompilation: {
|
|
17
|
+
tap: (pluginName: string, cb: (compilation: EmitManifestCompilation) => void) => void;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
interface EmitManifestCompilation {
|
|
22
|
+
hooks: {
|
|
23
|
+
processAssets: {
|
|
24
|
+
tapPromise: (options: {
|
|
25
|
+
name: string;
|
|
26
|
+
stage: number;
|
|
27
|
+
}, cb: (assets: Record<string, any>) => Promise<void>) => void;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
emitAsset: (filename: string, source: any) => void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Emits the zephyr-manifest.json file during the build process This ensures the manifest
|
|
34
|
+
* is available for local development
|
|
35
|
+
*/
|
|
36
|
+
export declare function setupManifestEmission<T extends EmitManifestOptions, XCompiler extends EmitManifestCompiler>(pluginOptions: T, compiler: XCompiler): void;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupManifestEmission = setupManifestEmission;
|
|
4
|
+
const zephyr_agent_1 = require("zephyr-agent");
|
|
5
|
+
/**
|
|
6
|
+
* Emits the zephyr-manifest.json file during the build process This ensures the manifest
|
|
7
|
+
* is available for local development
|
|
8
|
+
*/
|
|
9
|
+
function setupManifestEmission(pluginOptions, compiler) {
|
|
10
|
+
const { pluginName, zephyr_engine } = pluginOptions;
|
|
11
|
+
const { RawSource } = compiler.webpack.sources;
|
|
12
|
+
compiler.hooks.thisCompilation.tap(pluginName, (compilation) => {
|
|
13
|
+
compilation.hooks.processAssets.tapPromise({
|
|
14
|
+
name: `${pluginName}:EmitManifest`,
|
|
15
|
+
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,
|
|
16
|
+
}, async () => {
|
|
17
|
+
// Wait for dependencies to be resolved
|
|
18
|
+
if (!zephyr_engine.federated_dependencies) {
|
|
19
|
+
zephyr_agent_1.ze_log.snapshot('[Zephyr Manifest] No federated dependencies to emit');
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
// Convert to JSON
|
|
23
|
+
const manifestContent = (0, zephyr_agent_1.createManifestContent)(zephyr_engine.federated_dependencies);
|
|
24
|
+
// Emit the asset
|
|
25
|
+
compilation.emitAsset('zephyr-manifest.json', new RawSource(manifestContent));
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=ze-emit-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ze-emit-manifest.js","sourceRoot":"","sources":["../../src/hooks/ze-emit-manifest.ts"],"names":[],"mappings":";;AAsCA,sDA8BC;AApED,+CAAgF;AAkChF;;;GAGG;AACH,SAAgB,qBAAqB,CAGnC,aAAgB,EAAE,QAAmB;IACrC,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC;IACpD,MAAM,EAAE,SAAS,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC;IAE/C,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,WAAW,EAAE,EAAE;QAC7D,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,UAAU,CACxC;YACE,IAAI,EAAE,GAAG,UAAU,eAAe;YAClC,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,+BAA+B;SACpE,EACD,KAAK,IAAI,EAAE;YACT,uCAAuC;YACvC,IAAI,CAAC,aAAa,CAAC,sBAAsB,EAAE,CAAC;gBAC1C,qBAAM,CAAC,QAAQ,CAAC,qDAAqD,CAAC,CAAC;gBACvE,OAAO;YACT,CAAC;YAED,kBAAkB;YAClB,MAAM,eAAe,GAAG,IAAA,oCAAqB,EAC3C,aAAa,CAAC,sBAAsB,CACrC,CAAC;YAEF,iBAAiB;YACjB,WAAW,CAAC,SAAS,CAAC,sBAAsB,EAAE,IAAI,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC;QAChF,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { createMfRuntimeCode, extractFederatedDependencyPairs, makeCopyOfModuleFederationOptions, mutWebpackFederatedRemotesConfig, xpack_delegate_module_template, } from './xpack-extract';
|
|
3
|
-
export { buildWebpackAssetMap } from './xpack-extract/build-webpack-assets-map';
|
|
1
|
+
export { onDeploymentDone, emitDeploymentDone } from './lifecycle-events';
|
|
4
2
|
export { isModuleFederationPlugin } from './xpack-extract/is-module-federation-plugin';
|
|
5
|
-
export
|
|
3
|
+
export { extractFederatedDependencyPairs, makeCopyOfModuleFederationOptions, mutWebpackFederatedRemotesConfig, xpack_delegate_module_template, } from './xpack-extract';
|
|
4
|
+
export { buildWebpackAssetMap } from './xpack-extract/build-webpack-assets-map';
|
|
5
|
+
export type { XPackConfiguration, ModuleFederationPlugin, XStats, XStatsCompilation, } from './xpack.types';
|
|
6
6
|
export { getBuildStats } from './federation-dashboard-legacy/get-build-stats';
|
|
7
|
-
export { logBuildSteps } from './hooks/ze-setup-build-steps-logging';
|
|
8
7
|
export { setupZeDeploy } from './hooks/ze-setup-ze-deploy';
|
|
8
|
+
export { logBuildSteps } from './hooks/ze-setup-build-steps-logging';
|
|
9
|
+
export { setupManifestEmission } from './hooks/ze-emit-manifest';
|
|
9
10
|
export { xpack_zephyr_agent } from './xpack-extract/ze-xpack-upload-agent';
|
|
10
11
|
export { detectAndStoreBaseHref } from './basehref/basehref-integration';
|
package/dist/index.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.detectAndStoreBaseHref = exports.xpack_zephyr_agent = exports.
|
|
3
|
+
exports.detectAndStoreBaseHref = exports.xpack_zephyr_agent = exports.setupManifestEmission = exports.logBuildSteps = exports.setupZeDeploy = exports.getBuildStats = exports.buildWebpackAssetMap = exports.xpack_delegate_module_template = exports.mutWebpackFederatedRemotesConfig = exports.makeCopyOfModuleFederationOptions = exports.extractFederatedDependencyPairs = exports.isModuleFederationPlugin = exports.emitDeploymentDone = exports.onDeploymentDone = void 0;
|
|
4
4
|
var lifecycle_events_1 = require("./lifecycle-events");
|
|
5
|
-
Object.defineProperty(exports, "emitDeploymentDone", { enumerable: true, get: function () { return lifecycle_events_1.emitDeploymentDone; } });
|
|
6
5
|
Object.defineProperty(exports, "onDeploymentDone", { enumerable: true, get: function () { return lifecycle_events_1.onDeploymentDone; } });
|
|
6
|
+
Object.defineProperty(exports, "emitDeploymentDone", { enumerable: true, get: function () { return lifecycle_events_1.emitDeploymentDone; } });
|
|
7
|
+
var is_module_federation_plugin_1 = require("./xpack-extract/is-module-federation-plugin");
|
|
8
|
+
Object.defineProperty(exports, "isModuleFederationPlugin", { enumerable: true, get: function () { return is_module_federation_plugin_1.isModuleFederationPlugin; } });
|
|
7
9
|
var xpack_extract_1 = require("./xpack-extract");
|
|
8
|
-
Object.defineProperty(exports, "createMfRuntimeCode", { enumerable: true, get: function () { return xpack_extract_1.createMfRuntimeCode; } });
|
|
9
10
|
Object.defineProperty(exports, "extractFederatedDependencyPairs", { enumerable: true, get: function () { return xpack_extract_1.extractFederatedDependencyPairs; } });
|
|
10
11
|
Object.defineProperty(exports, "makeCopyOfModuleFederationOptions", { enumerable: true, get: function () { return xpack_extract_1.makeCopyOfModuleFederationOptions; } });
|
|
11
12
|
Object.defineProperty(exports, "mutWebpackFederatedRemotesConfig", { enumerable: true, get: function () { return xpack_extract_1.mutWebpackFederatedRemotesConfig; } });
|
|
12
13
|
Object.defineProperty(exports, "xpack_delegate_module_template", { enumerable: true, get: function () { return xpack_extract_1.xpack_delegate_module_template; } });
|
|
13
14
|
var build_webpack_assets_map_1 = require("./xpack-extract/build-webpack-assets-map");
|
|
14
15
|
Object.defineProperty(exports, "buildWebpackAssetMap", { enumerable: true, get: function () { return build_webpack_assets_map_1.buildWebpackAssetMap; } });
|
|
15
|
-
var is_module_federation_plugin_1 = require("./xpack-extract/is-module-federation-plugin");
|
|
16
|
-
Object.defineProperty(exports, "isModuleFederationPlugin", { enumerable: true, get: function () { return is_module_federation_plugin_1.isModuleFederationPlugin; } });
|
|
17
16
|
var get_build_stats_1 = require("./federation-dashboard-legacy/get-build-stats");
|
|
18
17
|
Object.defineProperty(exports, "getBuildStats", { enumerable: true, get: function () { return get_build_stats_1.getBuildStats; } });
|
|
19
|
-
var ze_setup_build_steps_logging_1 = require("./hooks/ze-setup-build-steps-logging");
|
|
20
|
-
Object.defineProperty(exports, "logBuildSteps", { enumerable: true, get: function () { return ze_setup_build_steps_logging_1.logBuildSteps; } });
|
|
21
18
|
var ze_setup_ze_deploy_1 = require("./hooks/ze-setup-ze-deploy");
|
|
22
19
|
Object.defineProperty(exports, "setupZeDeploy", { enumerable: true, get: function () { return ze_setup_ze_deploy_1.setupZeDeploy; } });
|
|
20
|
+
var ze_setup_build_steps_logging_1 = require("./hooks/ze-setup-build-steps-logging");
|
|
21
|
+
Object.defineProperty(exports, "logBuildSteps", { enumerable: true, get: function () { return ze_setup_build_steps_logging_1.logBuildSteps; } });
|
|
22
|
+
var ze_emit_manifest_1 = require("./hooks/ze-emit-manifest");
|
|
23
|
+
Object.defineProperty(exports, "setupManifestEmission", { enumerable: true, get: function () { return ze_emit_manifest_1.setupManifestEmission; } });
|
|
23
24
|
var ze_xpack_upload_agent_1 = require("./xpack-extract/ze-xpack-upload-agent");
|
|
24
25
|
Object.defineProperty(exports, "xpack_zephyr_agent", { enumerable: true, get: function () { return ze_xpack_upload_agent_1.xpack_zephyr_agent; } });
|
|
25
26
|
var basehref_integration_1 = require("./basehref/basehref-integration");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA0E;AAAjE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA0E;AAAjE,oHAAA,gBAAgB,OAAA;AAAE,sHAAA,kBAAkB,OAAA;AAE7C,2FAAuF;AAA9E,uIAAA,wBAAwB,OAAA;AACjC,iDAKyB;AAJvB,gIAAA,+BAA+B,OAAA;AAC/B,kIAAA,iCAAiC,OAAA;AACjC,iIAAA,gCAAgC,OAAA;AAChC,+HAAA,8BAA8B,OAAA;AAEhC,qFAAgF;AAAvE,gIAAA,oBAAoB,OAAA;AAS7B,iFAA8E;AAArE,gHAAA,aAAa,OAAA;AAEtB,iEAA2D;AAAlD,mHAAA,aAAa,OAAA;AACtB,qFAAqE;AAA5D,6HAAA,aAAa,OAAA;AACtB,6DAAiE;AAAxD,yHAAA,qBAAqB,OAAA;AAE9B,+EAA2E;AAAlE,2HAAA,kBAAkB,OAAA;AAE3B,wEAAyE;AAAhE,8HAAA,sBAAsB,OAAA"}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
export interface ShareScopeMap {
|
|
2
|
+
[scopeName: string]: {
|
|
3
|
+
[pkgName: string]: {
|
|
4
|
+
[version: string]: {
|
|
5
|
+
get: () => any;
|
|
6
|
+
loaded?: boolean;
|
|
7
|
+
from?: string;
|
|
8
|
+
eager?: boolean;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface ShareInfos {
|
|
14
|
+
[pkgName: string]: {
|
|
15
|
+
version: string;
|
|
16
|
+
scope: string[];
|
|
17
|
+
useIn: string[];
|
|
18
|
+
from: string;
|
|
19
|
+
lib: () => any;
|
|
20
|
+
deps: string[];
|
|
21
|
+
strategy?: 'version-first' | 'loaded-first';
|
|
22
|
+
shareConfig?: any;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export interface Remote {
|
|
26
|
+
name: string;
|
|
27
|
+
alias?: string;
|
|
28
|
+
entry?: string;
|
|
29
|
+
type?: string;
|
|
30
|
+
shareScope?: string;
|
|
31
|
+
entryGlobalName?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface Shared {
|
|
34
|
+
version: string;
|
|
35
|
+
scope: string[];
|
|
36
|
+
useIn: string[];
|
|
37
|
+
from: string;
|
|
38
|
+
lib: () => any;
|
|
39
|
+
deps: string[];
|
|
40
|
+
strategy?: 'version-first' | 'loaded-first';
|
|
41
|
+
shareConfig?: any;
|
|
42
|
+
}
|
|
43
|
+
export interface Options {
|
|
44
|
+
name: string;
|
|
45
|
+
version?: string;
|
|
46
|
+
remotes: Remote[];
|
|
47
|
+
shared: {
|
|
48
|
+
[pkgName: string]: Shared[];
|
|
49
|
+
};
|
|
50
|
+
plugins?: FederationRuntimePlugin[];
|
|
51
|
+
shareStrategy?: 'version-first' | 'loaded-first';
|
|
52
|
+
}
|
|
53
|
+
export interface UserOptions {
|
|
54
|
+
name: string;
|
|
55
|
+
version?: string;
|
|
56
|
+
remotes?: Remote[];
|
|
57
|
+
shared?: Record<string, any>;
|
|
58
|
+
plugins?: FederationRuntimePlugin[];
|
|
59
|
+
shareStrategy?: 'version-first' | 'loaded-first';
|
|
60
|
+
}
|
|
61
|
+
export interface RemoteInfo {
|
|
62
|
+
name: string;
|
|
63
|
+
alias?: string;
|
|
64
|
+
entry: string;
|
|
65
|
+
type?: string;
|
|
66
|
+
shareScope?: string;
|
|
67
|
+
entryGlobalName?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface ModuleInfo {
|
|
70
|
+
name: string;
|
|
71
|
+
buildVersion: string;
|
|
72
|
+
publicPath: string;
|
|
73
|
+
types: {
|
|
74
|
+
path: string;
|
|
75
|
+
name: string;
|
|
76
|
+
zip?: string;
|
|
77
|
+
api?: string;
|
|
78
|
+
};
|
|
79
|
+
remotes: Array<{
|
|
80
|
+
federationContainerName: string;
|
|
81
|
+
moduleName: string;
|
|
82
|
+
alias: string;
|
|
83
|
+
entry: string;
|
|
84
|
+
}>;
|
|
85
|
+
shared: Array<{
|
|
86
|
+
id: string;
|
|
87
|
+
name: string;
|
|
88
|
+
version: string;
|
|
89
|
+
requiredVersion: string;
|
|
90
|
+
assets: {
|
|
91
|
+
js: {
|
|
92
|
+
sync: string[];
|
|
93
|
+
async: string[];
|
|
94
|
+
};
|
|
95
|
+
css: {
|
|
96
|
+
sync: string[];
|
|
97
|
+
async: string[];
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
}>;
|
|
101
|
+
exposes: Record<string, {
|
|
102
|
+
id: string;
|
|
103
|
+
name: string;
|
|
104
|
+
assets: {
|
|
105
|
+
js: {
|
|
106
|
+
sync: string[];
|
|
107
|
+
async: string[];
|
|
108
|
+
};
|
|
109
|
+
css: {
|
|
110
|
+
sync: string[];
|
|
111
|
+
async: string[];
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
}>;
|
|
115
|
+
}
|
|
116
|
+
export interface BeforeInitHookArgs {
|
|
117
|
+
userOptions: UserOptions;
|
|
118
|
+
options: Options;
|
|
119
|
+
origin: any;
|
|
120
|
+
shareInfo: ShareInfos;
|
|
121
|
+
}
|
|
122
|
+
export interface InitHookArgs {
|
|
123
|
+
options: Options;
|
|
124
|
+
origin: any;
|
|
125
|
+
}
|
|
126
|
+
export interface BeforeInitContainerHookArgs {
|
|
127
|
+
shareScope: ShareScopeMap[string];
|
|
128
|
+
initScope: Record<string, any>;
|
|
129
|
+
remoteEntryInitOptions: any;
|
|
130
|
+
remoteInfo: RemoteInfo;
|
|
131
|
+
origin: any;
|
|
132
|
+
}
|
|
133
|
+
export interface InitContainerHookArgs {
|
|
134
|
+
shareScope: ShareScopeMap[string];
|
|
135
|
+
initScope: Record<string, any>;
|
|
136
|
+
remoteEntryInitOptions: any;
|
|
137
|
+
remoteInfo: RemoteInfo;
|
|
138
|
+
remoteEntryExports: any;
|
|
139
|
+
origin: any;
|
|
140
|
+
id: string;
|
|
141
|
+
remoteSnapshot?: ModuleInfo;
|
|
142
|
+
}
|
|
143
|
+
export interface BeforeRegisterRemoteHookArgs {
|
|
144
|
+
remote: Remote;
|
|
145
|
+
origin: any;
|
|
146
|
+
}
|
|
147
|
+
export interface RegisterRemoteHookArgs {
|
|
148
|
+
remote: Remote;
|
|
149
|
+
origin: any;
|
|
150
|
+
}
|
|
151
|
+
export interface BeforeRequestHookArgs {
|
|
152
|
+
id: string;
|
|
153
|
+
options: Options;
|
|
154
|
+
origin: any;
|
|
155
|
+
}
|
|
156
|
+
export interface OnLoadHookArgs {
|
|
157
|
+
id: string;
|
|
158
|
+
expose: string;
|
|
159
|
+
pkgNameOrAlias: string;
|
|
160
|
+
remote: Remote;
|
|
161
|
+
options: any;
|
|
162
|
+
origin: any;
|
|
163
|
+
exposeModule: any;
|
|
164
|
+
exposeModuleFactory: any;
|
|
165
|
+
moduleInstance: any;
|
|
166
|
+
}
|
|
167
|
+
export interface AfterResolveHookArgs {
|
|
168
|
+
id: string;
|
|
169
|
+
pkgNameOrAlias: string;
|
|
170
|
+
expose: string;
|
|
171
|
+
remote: Remote;
|
|
172
|
+
options: Options;
|
|
173
|
+
origin: any;
|
|
174
|
+
remoteInfo: RemoteInfo;
|
|
175
|
+
remoteSnapshot?: ModuleInfo;
|
|
176
|
+
}
|
|
177
|
+
export interface BeforeLoadShareHookArgs {
|
|
178
|
+
pkgName: string;
|
|
179
|
+
shareInfo?: Shared;
|
|
180
|
+
shared: Options['shared'];
|
|
181
|
+
origin: any;
|
|
182
|
+
}
|
|
183
|
+
export interface LoadShareHookArgs {
|
|
184
|
+
origin: any;
|
|
185
|
+
pkgName: string;
|
|
186
|
+
shareInfos: ShareInfos;
|
|
187
|
+
}
|
|
188
|
+
export interface ResolveShareHookArgs {
|
|
189
|
+
shareScopeMap: ShareScopeMap;
|
|
190
|
+
scope: string;
|
|
191
|
+
pkgName: string;
|
|
192
|
+
version: string;
|
|
193
|
+
GlobalFederation: any;
|
|
194
|
+
resolver: () => Shared | undefined;
|
|
195
|
+
}
|
|
196
|
+
export interface InitContainerShareScopeMapHookArgs {
|
|
197
|
+
shareScope: ShareScopeMap[string];
|
|
198
|
+
options: Options;
|
|
199
|
+
origin: any;
|
|
200
|
+
scopeName: string;
|
|
201
|
+
hostShareScopeMap?: ShareScopeMap;
|
|
202
|
+
}
|
|
203
|
+
export interface BeforeLoadRemoteSnapshotHookArgs {
|
|
204
|
+
options: Options;
|
|
205
|
+
moduleInfo: Remote;
|
|
206
|
+
}
|
|
207
|
+
export interface LoadSnapshotHookArgs {
|
|
208
|
+
options: Options;
|
|
209
|
+
moduleInfo: Remote;
|
|
210
|
+
hostGlobalSnapshot: any;
|
|
211
|
+
globalSnapshot: any;
|
|
212
|
+
remoteSnapshot?: any;
|
|
213
|
+
}
|
|
214
|
+
export interface LoadRemoteSnapshotHookArgs {
|
|
215
|
+
options: Options;
|
|
216
|
+
moduleInfo: Remote;
|
|
217
|
+
manifestJson?: any;
|
|
218
|
+
manifestUrl?: string;
|
|
219
|
+
remoteSnapshot: ModuleInfo;
|
|
220
|
+
from: 'global' | 'manifest';
|
|
221
|
+
}
|
|
222
|
+
export interface AfterLoadSnapshotHookArgs {
|
|
223
|
+
id?: string;
|
|
224
|
+
host: any;
|
|
225
|
+
options: Options;
|
|
226
|
+
moduleInfo: Remote;
|
|
227
|
+
remoteSnapshot: ModuleInfo;
|
|
228
|
+
}
|
|
229
|
+
export interface GetModuleInfoHookArgs {
|
|
230
|
+
target: Record<string, any>;
|
|
231
|
+
key: any;
|
|
232
|
+
}
|
|
233
|
+
export interface CreateScriptHookArgs {
|
|
234
|
+
url: string;
|
|
235
|
+
attrs?: Record<string, any>;
|
|
236
|
+
}
|
|
237
|
+
export interface CreateLinkHookArgs {
|
|
238
|
+
url: string;
|
|
239
|
+
attrs?: Record<string, any>;
|
|
240
|
+
}
|
|
241
|
+
export interface FetchHookArgs {
|
|
242
|
+
url: string;
|
|
243
|
+
init: RequestInit;
|
|
244
|
+
}
|
|
245
|
+
export interface LoadEntryErrorHookArgs {
|
|
246
|
+
getRemoteEntry: any;
|
|
247
|
+
origin: any;
|
|
248
|
+
remoteInfo: RemoteInfo;
|
|
249
|
+
remoteEntryExports?: any;
|
|
250
|
+
globalLoading: Record<string, Promise<void | any> | undefined>;
|
|
251
|
+
uniqueKey: string;
|
|
252
|
+
}
|
|
253
|
+
export interface GetModuleFactoryHookArgs {
|
|
254
|
+
remoteEntryExports: any;
|
|
255
|
+
expose: string;
|
|
256
|
+
moduleInfo: RemoteInfo;
|
|
257
|
+
}
|
|
258
|
+
export type BeforeBridgeRenderHookArgs = Record<string, any>;
|
|
259
|
+
export type AfterBridgeRenderHookArgs = Record<string, any>;
|
|
260
|
+
export type BeforeBridgeDestroyHookArgs = Record<string, any>;
|
|
261
|
+
export type AfterBridgeDestroyHookArgs = Record<string, any>;
|
|
262
|
+
export interface FederationRuntimePlugin {
|
|
263
|
+
name: string;
|
|
264
|
+
version?: string;
|
|
265
|
+
beforeInit?: (args: BeforeInitHookArgs) => BeforeInitHookArgs | Promise<BeforeInitHookArgs>;
|
|
266
|
+
init?: (args: InitHookArgs) => void;
|
|
267
|
+
beforeInitContainer?: (args: BeforeInitContainerHookArgs) => BeforeInitContainerHookArgs | Promise<BeforeInitContainerHookArgs>;
|
|
268
|
+
initContainer?: (args: InitContainerHookArgs) => InitContainerHookArgs | Promise<InitContainerHookArgs>;
|
|
269
|
+
beforeRegisterRemote?: (args: BeforeRegisterRemoteHookArgs) => BeforeRegisterRemoteHookArgs | Promise<BeforeRegisterRemoteHookArgs>;
|
|
270
|
+
registerRemote?: (args: RegisterRemoteHookArgs) => RegisterRemoteHookArgs | Promise<RegisterRemoteHookArgs>;
|
|
271
|
+
beforeRequest?: (args: BeforeRequestHookArgs) => BeforeRequestHookArgs | Promise<BeforeRequestHookArgs>;
|
|
272
|
+
onLoad?: (args: OnLoadHookArgs) => void | Promise<void>;
|
|
273
|
+
afterResolve?: (args: AfterResolveHookArgs) => AfterResolveHookArgs | Promise<AfterResolveHookArgs>;
|
|
274
|
+
beforeLoadShare?: (args: BeforeLoadShareHookArgs) => BeforeLoadShareHookArgs | Promise<BeforeLoadShareHookArgs>;
|
|
275
|
+
loadShare?: (args: LoadShareHookArgs) => false | void | Promise<false | void>;
|
|
276
|
+
resolveShare?: (args: ResolveShareHookArgs) => ResolveShareHookArgs | Promise<ResolveShareHookArgs>;
|
|
277
|
+
initContainerShareScopeMap?: (args: InitContainerShareScopeMapHookArgs) => InitContainerShareScopeMapHookArgs | Promise<InitContainerShareScopeMapHookArgs>;
|
|
278
|
+
beforeLoadRemoteSnapshot?: (args: BeforeLoadRemoteSnapshotHookArgs) => void | Promise<void>;
|
|
279
|
+
loadSnapshot?: (args: LoadSnapshotHookArgs) => LoadSnapshotHookArgs | Promise<LoadSnapshotHookArgs>;
|
|
280
|
+
loadRemoteSnapshot?: (args: LoadRemoteSnapshotHookArgs) => LoadRemoteSnapshotHookArgs | Promise<LoadRemoteSnapshotHookArgs>;
|
|
281
|
+
afterLoadSnapshot?: (args: AfterLoadSnapshotHookArgs) => AfterLoadSnapshotHookArgs | Promise<AfterLoadSnapshotHookArgs>;
|
|
282
|
+
getModuleInfo?: (args: GetModuleInfoHookArgs) => void | {
|
|
283
|
+
value: any;
|
|
284
|
+
key: string;
|
|
285
|
+
};
|
|
286
|
+
createScript?: (args: CreateScriptHookArgs) => any;
|
|
287
|
+
createLink?: (args: CreateLinkHookArgs) => void | HTMLLinkElement;
|
|
288
|
+
fetch?: (args: FetchHookArgs) => false | void | Promise<Response>;
|
|
289
|
+
loadEntryError?: (args: LoadEntryErrorHookArgs) => Promise<(() => Promise<any>) | undefined>;
|
|
290
|
+
getModuleFactory?: (args: GetModuleFactoryHookArgs) => Promise<(() => Promise<any>) | undefined>;
|
|
291
|
+
beforeBridgeRender?: (args: BeforeBridgeRenderHookArgs) => void | Record<string, any>;
|
|
292
|
+
afterBridgeRender?: (args: AfterBridgeRenderHookArgs) => void | Record<string, any>;
|
|
293
|
+
beforeBridgeDestroy?: (args: BeforeBridgeDestroyHookArgs) => void | Record<string, any>;
|
|
294
|
+
afterBridgeDestroy?: (args: AfterBridgeDestroyHookArgs) => void | Record<string, any>;
|
|
295
|
+
}
|
|
296
|
+
export interface RemoteWithEntry {
|
|
297
|
+
name: string;
|
|
298
|
+
alias?: string;
|
|
299
|
+
entry: string;
|
|
300
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-federation.types.js","sourceRoot":"","sources":["../../src/types/module-federation.types.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,kDAAkD"}
|
|
@@ -11,7 +11,7 @@ function createMfRuntimeCode(zephyr_engine, deps, delegate_module_template) {
|
|
|
11
11
|
const promiseNewPromise = fnReplace.replace(strStart, strNewStart).replace(strEnd, '');
|
|
12
12
|
const { application_uid, remote_entry_url, default_url, name, library_type } = deps;
|
|
13
13
|
// If the builder is `repack` only return the remote url without any changes
|
|
14
|
-
if (zephyr_engine.builder === 'repack'
|
|
14
|
+
if (zephyr_engine.builder === 'repack') {
|
|
15
15
|
return remote_entry_url;
|
|
16
16
|
}
|
|
17
17
|
return promiseNewPromise
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-mf-runtime-code.js","sourceRoot":"","sources":["../../src/xpack-extract/create-mf-runtime-code.ts"],"names":[],"mappings":";;AAOA,kDAyBC;AAED,wEA4DC;AAvFD,SAAgB,mBAAmB,CACjC,aAA2B,EAC3B,IAA0B,EAC1B,wBAAmD;IAEnD,4CAA4C;IAC5C,MAAM,SAAS,GAAG,wBAAwB,CAAC,QAAQ,EAAE,CAAC;IACtD,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,oCAAoC,CAAC,CAAC;IAClE,MAAM,WAAW,GAAG,qBAAqB,CAAC;IAC1C,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,WAAW,CAAC,CAAC;IACvC,MAAM,iBAAiB,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC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,CAAC;gBACD,mBAAmB,CAAC,CAAC,CACnB,SAAS,EACT,GAAG,EAAE;oBACH,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;gBAC7B,CAAC,EACD,WAAW,EACX,WAAW,CACZ,CAAC;gBACF,OAAO;YACT,CAAC;YAED,OAAO,IAAI,QAAQ,CAAC,kBAAkB,SAAS,IAAI,CAAC,EAAE;iBACnD,IAAI,CAAC,CAAC,GAAY,EAAE,EAAE;gBACrB,IAAI,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,WAAW,EAAE,CAAC;oBAC7C,OAAO,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;gBACpC,CAAC;gBAED,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;YACtB,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1C,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACb,OAAO,CAAC,KAAK,CAAC,sCAAsC,gBAAgB,EAAE,EAAE,GAAG,CAAC,CAAC;QAC/E,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -5,3 +5,4 @@ export { isModuleFederationPlugin } from './is-module-federation-plugin';
|
|
|
5
5
|
export { iterateFederationConfig } from './iterate-federation-config';
|
|
6
6
|
export { makeCopyOfModuleFederationOptions } from './make-copy-of-module-federation-options';
|
|
7
7
|
export { mutWebpackFederatedRemotesConfig } from './mut-webpack-federated-remotes-config';
|
|
8
|
+
export { createZephyrRuntimePlugin } from './runtime-plugin';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mutWebpackFederatedRemotesConfig = exports.makeCopyOfModuleFederationOptions = exports.iterateFederationConfig = exports.isModuleFederationPlugin = exports.extractFederatedConfig = exports.parseRemotesAsEntries = exports.extractFederatedDependencyPairs = exports.xpack_delegate_module_template = exports.createMfRuntimeCode = void 0;
|
|
3
|
+
exports.createZephyrRuntimePlugin = exports.mutWebpackFederatedRemotesConfig = exports.makeCopyOfModuleFederationOptions = exports.iterateFederationConfig = exports.isModuleFederationPlugin = exports.extractFederatedConfig = exports.parseRemotesAsEntries = exports.extractFederatedDependencyPairs = exports.xpack_delegate_module_template = exports.createMfRuntimeCode = void 0;
|
|
4
4
|
var create_mf_runtime_code_1 = require("./create-mf-runtime-code");
|
|
5
5
|
Object.defineProperty(exports, "createMfRuntimeCode", { enumerable: true, get: function () { return create_mf_runtime_code_1.createMfRuntimeCode; } });
|
|
6
6
|
Object.defineProperty(exports, "xpack_delegate_module_template", { enumerable: true, get: function () { return create_mf_runtime_code_1.xpack_delegate_module_template; } });
|
|
@@ -17,4 +17,6 @@ var make_copy_of_module_federation_options_1 = require("./make-copy-of-module-fe
|
|
|
17
17
|
Object.defineProperty(exports, "makeCopyOfModuleFederationOptions", { enumerable: true, get: function () { return make_copy_of_module_federation_options_1.makeCopyOfModuleFederationOptions; } });
|
|
18
18
|
var mut_webpack_federated_remotes_config_1 = require("./mut-webpack-federated-remotes-config");
|
|
19
19
|
Object.defineProperty(exports, "mutWebpackFederatedRemotesConfig", { enumerable: true, get: function () { return mut_webpack_federated_remotes_config_1.mutWebpackFederatedRemotesConfig; } });
|
|
20
|
+
var runtime_plugin_1 = require("./runtime-plugin");
|
|
21
|
+
Object.defineProperty(exports, "createZephyrRuntimePlugin", { enumerable: true, get: function () { return runtime_plugin_1.createZephyrRuntimePlugin; } });
|
|
20
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/xpack-extract/index.ts"],"names":[],"mappings":";;;AAAA,mEAGkC;AAFhC,6HAAA,mBAAmB,OAAA;AACnB,wIAAA,8BAA8B,OAAA;AAEhC,2FAG8C;AAF5C,qJAAA,+BAA+B,OAAA;AAC/B,2IAAA,qBAAqB,OAAA;AAEvB,yEAAqE;AAA5D,mIAAA,sBAAsB,OAAA;AAC/B,6EAAyE;AAAhE,uIAAA,wBAAwB,OAAA;AACjC,yEAAsE;AAA7D,oIAAA,uBAAuB,OAAA;AAChC,mGAA6F;AAApF,2JAAA,iCAAiC,OAAA;AAC1C,+FAA0F;AAAjF,wJAAA,gCAAgC,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/xpack-extract/index.ts"],"names":[],"mappings":";;;AAAA,mEAGkC;AAFhC,6HAAA,mBAAmB,OAAA;AACnB,wIAAA,8BAA8B,OAAA;AAEhC,2FAG8C;AAF5C,qJAAA,+BAA+B,OAAA;AAC/B,2IAAA,qBAAqB,OAAA;AAEvB,yEAAqE;AAA5D,mIAAA,sBAAsB,OAAA;AAC/B,6EAAyE;AAAhE,uIAAA,wBAAwB,OAAA;AACjC,yEAAsE;AAA7D,oIAAA,uBAAuB,OAAA;AAChC,mGAA6F;AAApF,2JAAA,iCAAiC,OAAA;AAC1C,+FAA0F;AAAjF,wJAAA,gCAAgC,OAAA;AACzC,mDAA6D;AAApD,2HAAA,yBAAyB,OAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isLegacyMFPlugin = isLegacyMFPlugin;
|
|
4
|
+
const zephyr_agent_1 = require("zephyr-agent");
|
|
5
|
+
const extract_federation_config_1 = require("./extract-federation-config");
|
|
6
|
+
function isLegacyMFPlugin(plugin) {
|
|
7
|
+
const options = (0, extract_federation_config_1.extractFederatedConfig)(plugin);
|
|
8
|
+
if (!options) {
|
|
9
|
+
zephyr_agent_1.ze_log.mf('Not a Module Federation plugin');
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
// If constructor name doesn't match, definitely not webpack's
|
|
13
|
+
if (plugin.constructor.name !== 'ModuleFederationPlugin') {
|
|
14
|
+
zephyr_agent_1.ze_log.mf('Non-legacy Module Federation plugin identified. Current plugin name: ', plugin.constructor.name);
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const enhancedFeaturesChecks = [
|
|
18
|
+
// Core enhanced methods (likely present in most versions)
|
|
19
|
+
[plugin, 'getRemoteEntryUrls', 'function'],
|
|
20
|
+
[plugin, 'getContainerEntryModule', 'function'],
|
|
21
|
+
[plugin, 'invalidateRemote', 'function'],
|
|
22
|
+
// Newer enhanced methods (higher version requirements)
|
|
23
|
+
[plugin, 'statsResourceInfo'],
|
|
24
|
+
[plugin, 'getStats', 'function'],
|
|
25
|
+
// Configuration-based detection (version-agnostic)
|
|
26
|
+
[options, 'experiments'],
|
|
27
|
+
[options, 'runtimePlugins'],
|
|
28
|
+
[options, 'enhanced'],
|
|
29
|
+
// Internal properties (likely present across versions)
|
|
30
|
+
[plugin, '_experiments'],
|
|
31
|
+
[plugin, '_enhanced'],
|
|
32
|
+
];
|
|
33
|
+
for (const check of enhancedFeaturesChecks) {
|
|
34
|
+
if (hasProperty(...check)) {
|
|
35
|
+
zephyr_agent_1.ze_log.mf('Non-legacy Module Federation plugin identified. Plugin contains property: ', check[1]);
|
|
36
|
+
return false; // Has enhanced features, so NOT legacy
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// If we get here, it's webpack's native plugin
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
const hasProperty = (target, property, type) => {
|
|
43
|
+
const hasProp = property in target;
|
|
44
|
+
if (!(property in target))
|
|
45
|
+
return false;
|
|
46
|
+
if (type)
|
|
47
|
+
return typeof target[property] === type;
|
|
48
|
+
return hasProp;
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=is-legacy-mf-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-legacy-mf-plugin.js","sourceRoot":"","sources":["../../src/xpack-extract/is-legacy-mf-plugin.ts"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C;QACvD,CAAC;IACH,CAAC;IACD,+CAA+C;IAC/C,OAAO,IAAI,CAAC;AACd,CAAC;AAID,MAAM,WAAW,GAAG,CAAC,MAAW,EAAE,QAAgB,EAAE,IAAa,EAAW,EAAE;IAC5E,MAAM,OAAO,GAAG,QAAQ,IAAI,MAAM,CAAC;IAEnC,IAAI,CAAC,CAAC,QAAQ,IAAI,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IAExC,IAAI,IAAI;QAAE,OAAO,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;IAElD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { XFederatedRemotesConfig, XPackConfiguration } from '../xpack.types';
|
|
2
|
-
export declare function iterateFederatedRemoteConfig<Compiler, K = XFederatedRemotesConfig>(config: XPackConfiguration<Compiler>, for_remote: (federatedRemoteConfig: XFederatedRemotesConfig) => K): K[];
|
|
1
|
+
import type { ModuleFederationPlugin, XFederatedRemotesConfig, XPackConfiguration } from '../xpack.types';
|
|
2
|
+
export declare function iterateFederatedRemoteConfig<Compiler, K = XFederatedRemotesConfig>(config: XPackConfiguration<Compiler>, for_remote: (federatedRemoteConfig: XFederatedRemotesConfig, plugin: ModuleFederationPlugin) => K): K[];
|
|
@@ -18,7 +18,7 @@ function iterateFederatedRemoteConfig(config, for_remote) {
|
|
|
18
18
|
(0, zephyr_agent_1.logFn)('warn', `No federated config found for plugin: ${plugin.constructor.name}, skipping...`);
|
|
19
19
|
continue;
|
|
20
20
|
}
|
|
21
|
-
results.push(for_remote(federatedConfig));
|
|
21
|
+
results.push(for_remote(federatedConfig, plugin));
|
|
22
22
|
}
|
|
23
23
|
zephyr_agent_1.ze_log.remotes('iterateFederatedRemoteConfig.results', results);
|
|
24
24
|
return results;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iterate-federated-remote-config.js","sourceRoot":"","sources":["../../src/xpack-extract/iterate-federated-remote-config.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"iterate-federated-remote-config.js","sourceRoot":"","sources":["../../src/xpack-extract/iterate-federated-remote-config.ts"],"names":[],"mappings":";;AASA,oEA+BC;AAxCD,+CAA6C;AAM7C,2EAAqE;AACrE,+EAAyE;AAEzE,SAAgB,4BAA4B,CAC1C,MAAoC,EACpC,UAGM;IAEN,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,OAAO,GAAQ,EAAE,CAAC;IACxB,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACpC,IAAI,CAAC,IAAA,sDAAwB,EAAC,MAAM,CAAC,EAAE,CAAC;YACtC,SAAS;QACX,CAAC;QAED,MAAM,eAAe,GAAG,IAAA,kDAAsB,EAAC,MAAM,CAAC,CAAC;QAEvD,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,IAAA,oBAAK,EACH,MAAM,EACN,yCAAyC,MAAM,CAAC,WAAW,CAAC,IAAI,eAAe,CAChF,CAAC;YACF,SAAS;QACX,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD,CAAC;IACD,qBAAM,CAAC,OAAO,CAAC,sCAAsC,EAAE,OAAO,CAAC,CAAC;IAEhE,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -4,18 +4,29 @@ exports.mutWebpackFederatedRemotesConfig = mutWebpackFederatedRemotesConfig;
|
|
|
4
4
|
const zephyr_agent_1 = require("zephyr-agent");
|
|
5
5
|
const extract_federated_dependency_pairs_1 = require("./extract-federated-dependency-pairs");
|
|
6
6
|
const index_1 = require("./index");
|
|
7
|
+
const is_legacy_mf_plugin_1 = require("./is-legacy-mf-plugin");
|
|
7
8
|
const iterate_federated_remote_config_1 = require("./iterate-federated-remote-config");
|
|
9
|
+
const runtime_plugin_insert_1 = require("./runtime-plugin-insert");
|
|
8
10
|
function mutWebpackFederatedRemotesConfig(zephyr_engine, config, resolvedDependencyPairs, delegate_module_template = index_1.xpack_delegate_module_template) {
|
|
9
11
|
if (!resolvedDependencyPairs?.length) {
|
|
10
12
|
zephyr_agent_1.ze_log.remotes(`No resolved dependency pairs found, skipping...`);
|
|
11
13
|
return;
|
|
12
14
|
}
|
|
13
|
-
(
|
|
15
|
+
zephyr_agent_1.ze_log.remotes(`Processing ${resolvedDependencyPairs.length} resolved dependencies`);
|
|
16
|
+
(0, iterate_federated_remote_config_1.iterateFederatedRemoteConfig)(config, (remotesConfig, plugin) => {
|
|
14
17
|
const remotes = remotesConfig?.remotes;
|
|
15
18
|
if (!remotes) {
|
|
16
19
|
zephyr_agent_1.ze_log.remotes(`No remotes found for plugin: ${JSON.stringify(remotesConfig, null, 2)}`, 'skipping...');
|
|
17
20
|
return;
|
|
18
21
|
}
|
|
22
|
+
// Try runtime plugin insertion first if not legacy plugin
|
|
23
|
+
if (!(0, is_legacy_mf_plugin_1.isLegacyMFPlugin)(plugin)) {
|
|
24
|
+
const success = (0, runtime_plugin_insert_1.runtimePluginInsert)(remotesConfig, zephyr_engine, resolvedDependencyPairs);
|
|
25
|
+
// Skip legacy processing for this config
|
|
26
|
+
if (success)
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
// Legacy processing - only if runtime plugin wasn't inserted or isEnhanced is false
|
|
19
30
|
const library_type = remotesConfig.library?.type ?? 'var';
|
|
20
31
|
zephyr_agent_1.ze_log.remotes(`Library type: ${library_type}`);
|
|
21
32
|
const remoteEntries = (0, extract_federated_dependency_pairs_1.parseRemotesAsEntries)(remotes);
|
|
@@ -31,6 +42,7 @@ function mutWebpackFederatedRemotesConfig(zephyr_engine, config, resolvedDepende
|
|
|
31
42
|
zephyr_agent_1.ze_log.remotes(`Resolved dependency pair not found for remote: ${JSON.stringify(remote, null, 2)}`, 'skipping...');
|
|
32
43
|
return;
|
|
33
44
|
}
|
|
45
|
+
// Legacy behavior when runtime plugin is not enabled
|
|
34
46
|
// todo: this is a version with named export logic, we should take this into account later
|
|
35
47
|
const [v_app] = remote_version.includes('@')
|
|
36
48
|
? remote_version.split('@')
|
|
@@ -47,7 +59,8 @@ function mutWebpackFederatedRemotesConfig(zephyr_engine, config, resolvedDepende
|
|
|
47
59
|
const remoteIndex = remotes.indexOf(remote_name);
|
|
48
60
|
if (remoteIndex === -1)
|
|
49
61
|
return;
|
|
50
|
-
|
|
62
|
+
// @ts-expect-error - Nx's ModuleFederationPlugin has different remote types
|
|
63
|
+
remotes.splice(remoteIndex, 1, [remote_name, runtimeCode]);
|
|
51
64
|
return;
|
|
52
65
|
}
|
|
53
66
|
remotes[remote_name] = runtimeCode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mut-webpack-federated-remotes-config.js","sourceRoot":"","sources":["../../src/xpack-extract/mut-webpack-federated-remotes-config.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"mut-webpack-federated-remotes-config.js","sourceRoot":"","sources":["../../src/xpack-extract/mut-webpack-federated-remotes-config.ts"],"names":[],"mappings":";;AASA,4EAmGC;AA3GD,+CAAiE;AAEjE,6FAA6E;AAC7E,mCAA8E;AAC9E,+DAAyD;AACzD,uFAAiF;AACjF,mEAA8D;AAE9D,SAAgB,gCAAgC,CAC9C,aAA2B,EAC3B,MAAoC,EACpC,uBAAsD,EACtD,2BAAsD,sCAA8B;IAEpF,IAAI,CAAC,uBAAuB,EAAE,MAAM,EAAE,CAAC;QACrC,qBAAM,CAAC,OAAO,CAAC,iDAAiD,CAAC,CAAC;QAClE,OAAO;IACT,CAAC;IAED,qBAAM,CAAC,OAAO,CAAC,cAAc,uBAAuB,CAAC,MAAM,wBAAwB,CAAC,CAAC;IAErF,IAAA,8DAA4B,EAAC,MAAM,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,EAAE;QAC7D,MAAM,OAAO,GAAG,aAAa,EAAE,OAAO,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AC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type ZephyrEngine, type ZeResolvedDependency } from 'zephyr-agent';
|
|
2
|
+
import { type XFederatedRemotesConfig } from '../xpack.types';
|
|
3
|
+
export declare function runtimePluginInsert(remotesConfig: XFederatedRemotesConfig, zephyr_engine: ZephyrEngine, resolvedDependencyPairs: ZeResolvedDependency[]): boolean;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runtimePluginInsert = runtimePluginInsert;
|
|
4
|
+
const zephyr_agent_1 = require("zephyr-agent");
|
|
5
|
+
function runtimePluginInsert(remotesConfig, zephyr_engine, resolvedDependencyPairs) {
|
|
6
|
+
try {
|
|
7
|
+
const runtimePluginPath = require.resolve('./runtime-plugin');
|
|
8
|
+
zephyr_agent_1.ze_log.remotes(`Adding Zephyr runtime plugin: ${runtimePluginPath}`);
|
|
9
|
+
// Create resolved remotes map for runtime plugin with all dependencies
|
|
10
|
+
const resolvedRemotesMap = Object.fromEntries(resolvedDependencyPairs.map((dep) => [
|
|
11
|
+
dep.name,
|
|
12
|
+
{
|
|
13
|
+
application_uid: dep.application_uid,
|
|
14
|
+
remote_entry_url: dep.remote_entry_url,
|
|
15
|
+
default_url: dep.default_url,
|
|
16
|
+
name: dep.name,
|
|
17
|
+
library_type: dep.library_type,
|
|
18
|
+
},
|
|
19
|
+
]));
|
|
20
|
+
zephyr_agent_1.ze_log.remotes(`Resolved remotes map:`, JSON.stringify(resolvedRemotesMap, null, 2));
|
|
21
|
+
// Pass all resolved dependencies via resourceQuery to single runtime plugin
|
|
22
|
+
const queryData = {
|
|
23
|
+
builder: zephyr_engine.builder,
|
|
24
|
+
resolvedRemotes: resolvedRemotesMap,
|
|
25
|
+
};
|
|
26
|
+
// __resourceQuery data push
|
|
27
|
+
const runtimePluginWithQuery = runtimePluginPath + `?ze=${JSON.stringify(queryData)}`;
|
|
28
|
+
applyRuntimePlugin(remotesConfig, runtimePluginWithQuery);
|
|
29
|
+
return true; // Successfully inserted runtime plugin
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
zephyr_agent_1.ze_log.remotes(`Failed to resolve runtime plugin path: ${error}`);
|
|
33
|
+
return false; // Failed to insert runtime plugin
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function applyRuntimePlugin(remotesConfig, runtimePlugin) {
|
|
37
|
+
let configRef = remotesConfig;
|
|
38
|
+
// handle NxModuleFederationPlugin wrapper
|
|
39
|
+
if ('configOverride' in remotesConfig) {
|
|
40
|
+
remotesConfig.configOverride ?? (remotesConfig.configOverride = {});
|
|
41
|
+
configRef = remotesConfig.configOverride;
|
|
42
|
+
}
|
|
43
|
+
// Initialize runtimePlugins array if it doesn't exist
|
|
44
|
+
if (!configRef.runtimePlugins) {
|
|
45
|
+
configRef.runtimePlugins = [];
|
|
46
|
+
}
|
|
47
|
+
// Add the single runtime plugin with all data
|
|
48
|
+
configRef.runtimePlugins.push(runtimePlugin);
|
|
49
|
+
zephyr_agent_1.ze_log.remotes(`Runtime plugin added to Module Federation config`);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=runtime-plugin-insert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-plugin-insert.js","sourceRoot":"","sources":["../../src/xpack-extract/runtime-plugin-insert.ts"],"names":[],"mappings":";;AAGA,kDAyCC;AA5CD,+CAAoF;AAGpF,SAAgB,mBAAmB,CACjC,aAAsC,EACtC,aAA2B,EAC3B,uBAA+C;IAE/C,IAAI,CAAC;QACH,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAC9D,qBAAM,CAAC,OAAO,CAAC,iCAAiC,iBAAiB,EAAE,CAAC,CAAC;QAErE,uEAAuE;QACvE,MAAM,kBAAkB,GAAG,MAAM,C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,CAAC,cAAc,EAAE,CAAC;QAC9B,SAAS,CAAC,cAAc,GAAG,EAAE,CAAC;IAChC,CAAC;IAED,8CAA8C;IAC9C,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC7C,qBAAM,CAAC,OAAO,CAAC,kDAAkD,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FederationRuntimePlugin } from '../types/module-federation.types';
|
|
2
|
+
/**
|
|
3
|
+
* Zephyr Runtime Plugin for Module Federation This plugin handles dynamic remote URL
|
|
4
|
+
* resolution at runtime using compile-time information passed via __resourceQuery and
|
|
5
|
+
* beforeRequest hook to mutate URLs on the fly
|
|
6
|
+
*/
|
|
7
|
+
export declare function createZephyrRuntimePlugin(): FederationRuntimePlugin;
|
|
8
|
+
/** Default export for use with Module Federation runtime plugins array */
|
|
9
|
+
export default createZephyrRuntimePlugin;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createZephyrRuntimePlugin = createZephyrRuntimePlugin;
|
|
4
|
+
/** Fetches the zephyr-manifest.json file and returns the runtime plugin data */
|
|
5
|
+
async function fetchZephyrManifest() {
|
|
6
|
+
if (typeof window === 'undefined') {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
// Fetch the manifest from the same origin
|
|
11
|
+
const response = await fetch('/zephyr-manifest.json');
|
|
12
|
+
if (!response.ok) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const manifest = await response.json().catch(() => null);
|
|
16
|
+
if (!manifest) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
// Transform manifest dependencies to runtime plugin format
|
|
20
|
+
const resolvedRemotes = {};
|
|
21
|
+
if (manifest.dependencies) {
|
|
22
|
+
Object.entries(manifest.dependencies).forEach(([name, dep]) => {
|
|
23
|
+
resolvedRemotes[name] = {
|
|
24
|
+
application_uid: dep.application_uid,
|
|
25
|
+
remote_entry_url: dep.remote_entry_url,
|
|
26
|
+
default_url: dep.default_url,
|
|
27
|
+
name: dep.name,
|
|
28
|
+
library_type: 'module', // Default library type
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
builder: 'webpack', // Default to webpack, can be overridden by resourceQuery
|
|
34
|
+
resolvedRemotes,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Zephyr Runtime Plugin for Module Federation This plugin handles dynamic remote URL
|
|
43
|
+
* resolution at runtime using compile-time information passed via __resourceQuery and
|
|
44
|
+
* beforeRequest hook to mutate URLs on the fly
|
|
45
|
+
*/
|
|
46
|
+
function createZephyrRuntimePlugin() {
|
|
47
|
+
// Parse compile-time data from resourceQuery
|
|
48
|
+
let runtimeData = null;
|
|
49
|
+
let manifestPromise = null;
|
|
50
|
+
// Track which remotes have already been processed to avoid re-processing
|
|
51
|
+
const processedRemotes = new Set();
|
|
52
|
+
// Initialize manifest fetching
|
|
53
|
+
const initializeManifest = async () => {
|
|
54
|
+
try {
|
|
55
|
+
// Primary source: fetch the manifest file
|
|
56
|
+
runtimeData = await fetchZephyrManifest();
|
|
57
|
+
// Fallback for development: check resourceQuery
|
|
58
|
+
if (!runtimeData && typeof __resourceQuery !== 'undefined' && __resourceQuery) {
|
|
59
|
+
// Parse query string to get the 'ze' parameter
|
|
60
|
+
const params = new URLSearchParams(__resourceQuery);
|
|
61
|
+
const zeData = params.get('ze');
|
|
62
|
+
if (zeData) {
|
|
63
|
+
runtimeData = JSON.parse(zeData);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
console.error('Failed to load manifest:', error);
|
|
69
|
+
}
|
|
70
|
+
return runtimeData;
|
|
71
|
+
};
|
|
72
|
+
// Start fetching manifest immediately
|
|
73
|
+
manifestPromise = initializeManifest();
|
|
74
|
+
return {
|
|
75
|
+
name: 'zephyr-runtime-remote-resolver',
|
|
76
|
+
async beforeRequest(args) {
|
|
77
|
+
// Ensure manifest is loaded before processing
|
|
78
|
+
await manifestPromise;
|
|
79
|
+
const remotes = identifyRemotes(args, runtimeData, processedRemotes);
|
|
80
|
+
if (!remotes) {
|
|
81
|
+
return args;
|
|
82
|
+
}
|
|
83
|
+
const { targetRemote, resolvedRemote } = remotes;
|
|
84
|
+
// Get the resolved URL, checking session storage first
|
|
85
|
+
const resolvedUrl = getResolvedRemoteUrl(resolvedRemote);
|
|
86
|
+
// Update the remote entry URL
|
|
87
|
+
targetRemote.entry = resolvedUrl;
|
|
88
|
+
// Mark this remote as processed
|
|
89
|
+
processedRemotes.add(targetRemote.name);
|
|
90
|
+
return args;
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function identifyRemotes(args, runtimeData, processedRemotes) {
|
|
95
|
+
// No runtime plugin configured
|
|
96
|
+
if (!runtimeData) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
// No remotes defined
|
|
100
|
+
if (!args.options.remotes.length) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const { builder, resolvedRemotes } = runtimeData;
|
|
104
|
+
// For repack, we don't need to modify URLs
|
|
105
|
+
if (builder === 'repack') {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
// Extract remote name from args.id (format: "remoteName/componentName")
|
|
109
|
+
// initial hit will be "remoteName" but just in case, we can process all path requests too.
|
|
110
|
+
const remoteName = args.id.split('/')[0];
|
|
111
|
+
// Check if this remote has already been processed
|
|
112
|
+
if (processedRemotes.has(remoteName)) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
// Find the matching remote in the remotes array
|
|
116
|
+
const targetRemote = args.options.remotes.find((remote) => hasEntry(remote) && (remote.name === remoteName || remote.alias === remoteName));
|
|
117
|
+
const resolvedRemote = resolvedRemotes[targetRemote.alias ?? targetRemote.name];
|
|
118
|
+
// Check for resolved remotes entry for this specific remote called
|
|
119
|
+
// in runtime by the application
|
|
120
|
+
if (!resolvedRemote) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
// Type guard to check if a remote has an entry property
|
|
124
|
+
if (!hasEntry(targetRemote)) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
return { targetRemote, resolvedRemote };
|
|
128
|
+
}
|
|
129
|
+
function hasEntry(remote) {
|
|
130
|
+
return (remote !== null &&
|
|
131
|
+
remote !== undefined &&
|
|
132
|
+
typeof remote === 'object' &&
|
|
133
|
+
'entry' in remote &&
|
|
134
|
+
typeof remote.entry === 'string');
|
|
135
|
+
}
|
|
136
|
+
/** Resolves the actual remote URL, checking session storage for overrides */
|
|
137
|
+
function getResolvedRemoteUrl(resolvedRemote) {
|
|
138
|
+
const _window = typeof window !== 'undefined' ? window : globalThis;
|
|
139
|
+
// Check for session storage override (for development/testing)
|
|
140
|
+
const sessionEdgeURL = _window.sessionStorage?.getItem(resolvedRemote.application_uid);
|
|
141
|
+
// Use session URL if available, otherwise use resolved URL
|
|
142
|
+
let edgeUrl = sessionEdgeURL ?? resolvedRemote.remote_entry_url;
|
|
143
|
+
// Handle versioned remotes (name@url format)
|
|
144
|
+
if (edgeUrl.indexOf('@') !== -1) {
|
|
145
|
+
const [, url] = edgeUrl.split('@');
|
|
146
|
+
edgeUrl = url;
|
|
147
|
+
}
|
|
148
|
+
return edgeUrl;
|
|
149
|
+
}
|
|
150
|
+
/** Default export for use with Module Federation runtime plugins array */
|
|
151
|
+
exports.default = createZephyrRuntimePlugin;
|
|
152
|
+
//# sourceMappingURL=runtime-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-plugin.js","sourceRoot":"","sources":["../../src/xpack-extract/runtime-plugin.ts"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ACxD,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAC5B,OAAO;IACT,CAAC;IAED,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC;AAC1C,CAAC;AAED,SAAS,QAAQ,CAAC,MAAW;IAC3B,OAAO,CACL,MAAM,KAAK,IAAI;QACf,MAAM,KAAK,SAAS;QACpB,OAAO,MAAM,KAAK,QAAQ;QAC1B,OAAO,IAAI,MAAM;QACjB,OAAQ,MAAc,CAAC,KAAK,KAAK,QAAQ,CAC1C,CAAC;AACJ,CAAC;AAED,6EAA6E;AAC7E,SAAS,oBAAoB,CAC3B,cAA4D;IAE5D,MAAM,OAAO,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC;IAEpE,+DAA+D;IAC/D,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;IAEvF,2DAA2D;IAC3D,IAAI,OAAO,GAAG,cAAc,IAAI,cAAc,CAAC,gBAAgB,CAAC;IAEhE,6CAA6C;IAC7C,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QAChC,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAqB,CAAC;QACvD,OAAO,GAAG,GAAG,CAAC;IAChB,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,0EAA0E;AAC1E,kBAAe,yBAAyB,CAAC"}
|
package/dist/xpack.types.d.ts
CHANGED
|
@@ -23,6 +23,10 @@ export interface XFederatedRemotesConfig {
|
|
|
23
23
|
* actual output js.bundle and they want to put it in filename field)
|
|
24
24
|
*/
|
|
25
25
|
bundle_name?: string;
|
|
26
|
+
/** Runtime plugins for Module Federation */
|
|
27
|
+
runtimePlugins?: string[];
|
|
28
|
+
/** NxModuleFederationPlugin */
|
|
29
|
+
configOverride?: Omit<XFederatedRemotesConfig, 'exposes' | 'remotes' | 'name' | 'shared' | 'filename'>;
|
|
26
30
|
}
|
|
27
31
|
export interface ModuleFederationPlugin {
|
|
28
32
|
apply: (compiler: unknown) => void;
|
|
@@ -30,6 +34,10 @@ export interface ModuleFederationPlugin {
|
|
|
30
34
|
_options?: XFederatedRemotesConfig | {
|
|
31
35
|
config: XFederatedRemotesConfig;
|
|
32
36
|
};
|
|
37
|
+
/** For Nx Module Federation plugin */
|
|
38
|
+
options?: XFederatedRemotesConfig | {
|
|
39
|
+
config: XFederatedRemotesConfig;
|
|
40
|
+
};
|
|
33
41
|
/** Repack specific for now until Repack change how the config should be exposed */
|
|
34
42
|
config?: XFederatedRemotesConfig;
|
|
35
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zephyr-xpack-internal",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-20250806121212",
|
|
4
4
|
"description": "Xpack internals for Zephyr",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"@module-federation/automatic-vendor-federation": "^1.2.1",
|
|
20
20
|
"is-ci": "^4.1.0",
|
|
21
21
|
"tslib": "^2.8.1",
|
|
22
|
-
"zephyr-agent": "0.0.0-canary-
|
|
23
|
-
"zephyr-edge-contract": "0.0.0-canary-
|
|
22
|
+
"zephyr-agent": "0.0.0-canary-20250806121212",
|
|
23
|
+
"zephyr-edge-contract": "0.0.0-canary-20250806121212"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/is-ci": "3.0.4",
|