zephyr-xpack-internal 0.0.0-canary-20250115075631 → 0.0.0-canary-20250117215906
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 +9 -2
- 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.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 +0 -1
- 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 +13 -15
- 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 +31 -7
- package/package.json +3 -4
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ZephyrEngine } from 'zephyr-agent';
|
|
2
|
+
interface BuildSteps {
|
|
3
|
+
pluginName: string;
|
|
4
|
+
zephyr_engine: ZephyrEngine;
|
|
5
|
+
}
|
|
6
|
+
interface BuildStepsCompiler {
|
|
7
|
+
hooks: {
|
|
8
|
+
beforeCompile: {
|
|
9
|
+
tapAsync: (pluginName: string, cb: (params: unknown, cb: () => void) => Promise<void>) => void;
|
|
10
|
+
};
|
|
11
|
+
failed: {
|
|
12
|
+
tap: (pluginName: string, cb: (err: Error) => void) => void;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare function logBuildSteps<T extends BuildSteps, Compiler extends BuildStepsCompiler>(pluginOptions: T, compiler: Compiler): {
|
|
17
|
+
buildStartedAt: number;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logBuildSteps = void 0;
|
|
4
|
+
const zephyr_agent_1 = require("zephyr-agent");
|
|
5
|
+
function logBuildSteps(pluginOptions, compiler) {
|
|
6
|
+
const { pluginName } = pluginOptions;
|
|
7
|
+
let buildStartedAt = Date.now();
|
|
8
|
+
compiler.hooks.beforeCompile.tapAsync(pluginName, async (params, cb) => {
|
|
9
|
+
buildStartedAt = Date.now();
|
|
10
|
+
(0, zephyr_agent_1.ze_log)('build started at', buildStartedAt);
|
|
11
|
+
cb();
|
|
12
|
+
});
|
|
13
|
+
compiler.hooks.failed.tap(pluginName, (err) => {
|
|
14
|
+
(0, zephyr_agent_1.ze_log)(`build failed in ${Date.now() - buildStartedAt}ms`);
|
|
15
|
+
pluginOptions.zephyr_engine.logger.then((logger) => {
|
|
16
|
+
logger({
|
|
17
|
+
level: 'error',
|
|
18
|
+
action: 'build:failed',
|
|
19
|
+
message: zephyr_agent_1.ZephyrError.format(err),
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
return { buildStartedAt };
|
|
24
|
+
}
|
|
25
|
+
exports.logBuildSteps = logBuildSteps;
|
|
26
|
+
//# sourceMappingURL=ze-setup-build-steps-logging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ze-setup-build-steps-logging.js","sourceRoot":"","sources":["../../src/hooks/ze-setup-build-steps-logging.ts"],"names":[],"mappings":";;;AAAA,+CAAiE;AAqBjE,SAAgB,aAAa,CAC3B,aAAgB,EAChB,QAAkB;IAIlB,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,CAAC;IAErC,IAAI,cAAc,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAEhC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE;QACrE,cAAc,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC5B,IAAA,qBAAM,EAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC;QAC3C,EAAE,EAAE,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,EAAE;QAC5C,IAAA,qBAAM,EAAC,mBAAmB,IAAI,CAAC,GAAG,EAAE,GAAG,cAAc,IAAI,CAAC,CAAC;QAE3D,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YACjD,MAAM,CAAC;gBACL,KAAK,EAAE,OAAO;gBACd,MAAM,EAAE,cAAc;gBACtB,OAAO,EAAE,0BAAW,CAAC,MAAM,CAAC,GAAG,CAAC;aACjC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,cAAc,EAAE,CAAC;AAC5B,CAAC;AA7BD,sCA6BC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ZephyrEngine } from 'zephyr-agent';
|
|
2
|
+
import type { Source } from 'zephyr-edge-contract';
|
|
3
|
+
import { XStats } from '../xpack.types';
|
|
4
|
+
interface DeployPluginOptions {
|
|
5
|
+
pluginName: string;
|
|
6
|
+
zephyr_engine: ZephyrEngine;
|
|
7
|
+
wait_for_index_html?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface DeployCompiler {
|
|
10
|
+
webpack: {
|
|
11
|
+
Compilation: {
|
|
12
|
+
PROCESS_ASSETS_STAGE_REPORT: number;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
hooks: {
|
|
16
|
+
thisCompilation: {
|
|
17
|
+
tap: (pluginName: string, cb: (compilation: DeployCompilation) => void) => void;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
interface DeployCompilation {
|
|
22
|
+
getStats: () => XStats;
|
|
23
|
+
hooks: {
|
|
24
|
+
processAssets: {
|
|
25
|
+
tapPromise: (options: {
|
|
26
|
+
name: string;
|
|
27
|
+
stage: number;
|
|
28
|
+
}, cb: (assets: Record<string, Source>) => Promise<void>) => void;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export declare function setupZeDeploy<T extends DeployPluginOptions, XCompiler extends DeployCompiler>(pluginOptions: T, compiler: XCompiler): void;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupZeDeploy = void 0;
|
|
4
|
+
const index_1 = require("../lifecycle-events/index");
|
|
5
|
+
const ze_xpack_upload_agent_1 = require("../xpack-extract/ze-xpack-upload-agent");
|
|
6
|
+
function setupZeDeploy(pluginOptions, compiler) {
|
|
7
|
+
const { pluginName } = pluginOptions;
|
|
8
|
+
compiler.hooks.thisCompilation.tap(pluginName, (compilation) => {
|
|
9
|
+
compilation.hooks.processAssets.tapPromise({
|
|
10
|
+
name: pluginName,
|
|
11
|
+
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_REPORT,
|
|
12
|
+
}, async (assets) => {
|
|
13
|
+
const stats = compilation.getStats();
|
|
14
|
+
const stats_json = compilation.getStats().toJson();
|
|
15
|
+
await pluginOptions.zephyr_engine.start_new_build();
|
|
16
|
+
process.nextTick(ze_xpack_upload_agent_1.xpack_zephyr_agent, {
|
|
17
|
+
stats,
|
|
18
|
+
stats_json,
|
|
19
|
+
assets,
|
|
20
|
+
pluginOptions,
|
|
21
|
+
});
|
|
22
|
+
if (!pluginOptions.wait_for_index_html) {
|
|
23
|
+
await (0, index_1.onDeploymentDone)();
|
|
24
|
+
}
|
|
25
|
+
// empty line to separate logs from other plugins
|
|
26
|
+
console.log();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
exports.setupZeDeploy = setupZeDeploy;
|
|
31
|
+
//# sourceMappingURL=ze-setup-ze-deploy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ze-setup-ze-deploy.js","sourceRoot":"","sources":["../../src/hooks/ze-setup-ze-deploy.ts"],"names":[],"mappings":";;;AAAA,qDAA6D;AAC7D,kFAA4E;AAgC5E,SAAgB,aAAa,CAG3B,aAAgB,EAAE,QAAmB;IACrC,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,CAAC;IACrC,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,UAAU;YAChB,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,2BAA2B;SAChE,EACD,KAAK,EAAE,MAAM,EAAE,EAAE;YACf,MAAM,KAAK,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;YACrC,MAAM,UAAU,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC;YAEnD,MAAM,aAAa,CAAC,aAAa,CAAC,eAAe,EAAE,CAAC;YAEpD,OAAO,CAAC,QAAQ,CAAC,0CAAkB,EAAE;gBACnC,KAAK;gBACL,UAAU;gBACV,MAAM;gBACN,aAAa;aACd,CAAC,CAAC;YAEH,IAAI,CAAC,aAAa,CAAC,mBAAmB,EAAE,CAAC;gBACvC,MAAM,IAAA,wBAAgB,GAAE,CAAC;YAC3B,CAAC;YAED,iDAAiD;YACjD,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAjCD,sCAiCC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export { onDeploymentDone, emitDeploymentDone } from './lifecycle-events';
|
|
2
2
|
export { isModuleFederationPlugin } from './xpack-extract/is-module-federation-plugin';
|
|
3
|
-
export { extractFederatedDependencyPairs, makeCopyOfModuleFederationOptions, mutWebpackFederatedRemotesConfig, } from './xpack-extract';
|
|
3
|
+
export { extractFederatedDependencyPairs, makeCopyOfModuleFederationOptions, mutWebpackFederatedRemotesConfig, xpack_delegate_module_template, } from './xpack-extract';
|
|
4
4
|
export { buildWebpackAssetMap } from './xpack-extract/build-webpack-assets-map';
|
|
5
|
-
export type { XPackConfiguration, ModuleFederationPlugin } from './xpack.types';
|
|
5
|
+
export type { XPackConfiguration, ModuleFederationPlugin, XStats, XStatsCompilation, } from './xpack.types';
|
|
6
6
|
export { getBuildStats } from './federation-dashboard-legacy/get-build-stats';
|
|
7
|
+
export { setupZeDeploy } from './hooks/ze-setup-ze-deploy';
|
|
8
|
+
export { logBuildSteps } from './hooks/ze-setup-build-steps-logging';
|
|
9
|
+
export { xpack_zephyr_agent } from './xpack-extract/ze-xpack-upload-agent';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBuildStats = exports.buildWebpackAssetMap = exports.mutWebpackFederatedRemotesConfig = exports.makeCopyOfModuleFederationOptions = exports.extractFederatedDependencyPairs = exports.isModuleFederationPlugin = exports.emitDeploymentDone = exports.onDeploymentDone = void 0;
|
|
3
|
+
exports.xpack_zephyr_agent = 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
5
|
Object.defineProperty(exports, "onDeploymentDone", { enumerable: true, get: function () { return lifecycle_events_1.onDeploymentDone; } });
|
|
6
6
|
Object.defineProperty(exports, "emitDeploymentDone", { enumerable: true, get: function () { return lifecycle_events_1.emitDeploymentDone; } });
|
|
@@ -10,8 +10,15 @@ var xpack_extract_1 = require("./xpack-extract");
|
|
|
10
10
|
Object.defineProperty(exports, "extractFederatedDependencyPairs", { enumerable: true, get: function () { return xpack_extract_1.extractFederatedDependencyPairs; } });
|
|
11
11
|
Object.defineProperty(exports, "makeCopyOfModuleFederationOptions", { enumerable: true, get: function () { return xpack_extract_1.makeCopyOfModuleFederationOptions; } });
|
|
12
12
|
Object.defineProperty(exports, "mutWebpackFederatedRemotesConfig", { enumerable: true, get: function () { return xpack_extract_1.mutWebpackFederatedRemotesConfig; } });
|
|
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
16
|
var get_build_stats_1 = require("./federation-dashboard-legacy/get-build-stats");
|
|
16
17
|
Object.defineProperty(exports, "getBuildStats", { enumerable: true, get: function () { return get_build_stats_1.getBuildStats; } });
|
|
18
|
+
var ze_setup_ze_deploy_1 = require("./hooks/ze-setup-ze-deploy");
|
|
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_xpack_upload_agent_1 = require("./xpack-extract/ze-xpack-upload-agent");
|
|
23
|
+
Object.defineProperty(exports, "xpack_zephyr_agent", { enumerable: true, get: function () { return ze_xpack_upload_agent_1.xpack_zephyr_agent; } });
|
|
17
24
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
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;AAEtB,+EAA2E;AAAlE,2HAAA,kBAAkB,OAAA"}
|
package/dist/package.json
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { type ZeResolvedDependency } from 'zephyr-agent';
|
|
2
|
-
export declare function createMfRuntimeCode(deps: ZeResolvedDependency): string;
|
|
2
|
+
export declare function createMfRuntimeCode(deps: ZeResolvedDependency, delegate_module_template: () => unknown): string;
|
|
3
|
+
export declare function xpack_delegate_module_template(): unknown;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createMfRuntimeCode = void 0;
|
|
4
|
-
function createMfRuntimeCode(deps) {
|
|
3
|
+
exports.xpack_delegate_module_template = exports.createMfRuntimeCode = void 0;
|
|
4
|
+
function createMfRuntimeCode(deps, delegate_module_template) {
|
|
5
5
|
// prepare delegate function string template
|
|
6
6
|
const fnReplace = delegate_module_template.toString();
|
|
7
7
|
const strStart = new RegExp(/^function[\W\S]+return new Promise/);
|
|
@@ -17,7 +17,7 @@ function createMfRuntimeCode(deps) {
|
|
|
17
17
|
.replace('__LIBRARY_TYPE__', library_type);
|
|
18
18
|
}
|
|
19
19
|
exports.createMfRuntimeCode = createMfRuntimeCode;
|
|
20
|
-
function
|
|
20
|
+
function xpack_delegate_module_template() {
|
|
21
21
|
return new Promise((resolve, reject) => {
|
|
22
22
|
const _windows = typeof window !== 'undefined' ? window : globalThis;
|
|
23
23
|
const sessionEdgeURL = _windows.sessionStorage.getItem('__APPLICATION_UID__');
|
|
@@ -64,4 +64,5 @@ function delegate_module_template() {
|
|
|
64
64
|
});
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
+
exports.xpack_delegate_module_template = xpack_delegate_module_template;
|
|
67
68
|
//# sourceMappingURL=create-mf-runtime-code.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-mf-runtime-code.js","sourceRoot":"","sources":["../../src/xpack-extract/create-mf-runtime-code.ts"],"names":[],"mappings":";;;AAMA,SAAgB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"create-mf-runtime-code.js","sourceRoot":"","sources":["../../src/xpack-extract/create-mf-runtime-code.ts"],"names":[],"mappings":"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"}
|
|
@@ -2,30 +2,28 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.extractFederatedDependencyPairs = void 0;
|
|
4
4
|
const zephyr_agent_1 = require("zephyr-agent");
|
|
5
|
-
const
|
|
5
|
+
const iterate_federated_remote_config_1 = require("./iterate-federated-remote-config");
|
|
6
6
|
function extractFederatedDependencyPairs(config) {
|
|
7
|
+
const depsPairs = [];
|
|
7
8
|
const { zephyrDependencies } = (0, zephyr_agent_1.readPackageJson)(config.context ?? process.cwd());
|
|
8
9
|
if (zephyrDependencies) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
name,
|
|
12
|
-
version,
|
|
13
|
-
};
|
|
10
|
+
Object.entries(zephyrDependencies).map(([name, version]) => {
|
|
11
|
+
depsPairs.push({ name, version });
|
|
14
12
|
});
|
|
15
13
|
}
|
|
16
|
-
|
|
17
|
-
if (!
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return {
|
|
14
|
+
(0, iterate_federated_remote_config_1.iterateFederatedRemoteConfig)(config, (remotesConfig) => {
|
|
15
|
+
if (!remotesConfig?.remotes)
|
|
16
|
+
return;
|
|
17
|
+
Object.entries(remotesConfig.remotes).map(([remote_name, remote_version]) => {
|
|
18
|
+
depsPairs.push({
|
|
22
19
|
name: remote_name,
|
|
23
20
|
version: remote_version,
|
|
24
|
-
};
|
|
21
|
+
});
|
|
25
22
|
});
|
|
26
|
-
})
|
|
23
|
+
});
|
|
24
|
+
return depsPairs
|
|
27
25
|
.flat()
|
|
28
|
-
.filter(zephyr_agent_1.is_zephyr_dependency_pair);
|
|
26
|
+
.filter((dep) => (0, zephyr_agent_1.is_zephyr_dependency_pair)(dep));
|
|
29
27
|
}
|
|
30
28
|
exports.extractFederatedDependencyPairs = extractFederatedDependencyPairs;
|
|
31
29
|
//# sourceMappingURL=extract-federated-dependency-pairs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-federated-dependency-pairs.js","sourceRoot":"","sources":["../../src/xpack-extract/extract-federated-dependency-pairs.ts"],"names":[],"mappings":";;;AAAA,+CAIsB;
|
|
1
|
+
{"version":3,"file":"extract-federated-dependency-pairs.js","sourceRoot":"","sources":["../../src/xpack-extract/extract-federated-dependency-pairs.ts"],"names":[],"mappings":";;;AAAA,+CAIsB;AAItB,uFAAiF;AAEjF,SAAgB,+BAA+B,CAC7C,MAA+B;IAE/B,MAAM,SAAS,GAAuB,EAAE,CAAC;IAEzC,MAAM,EAAE,kBAAkB,EAAE,GAAG,IAAA,8BAAe,EAAC,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAChF,IAAI,kBAAkB,EAAE,CAAC;QACvB,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE;YACzD,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAsB,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAA,8DAA4B,EAAC,MAAM,EAAE,CAAC,aAAsC,EAAE,EAAE;QAC9E,IAAI,CAAC,aAAa,EAAE,OAAO;YAAE,OAAO;QACpC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,cAAc,CAAC,EAAE,EAAE;YAC1E,SAAS,CAAC,IAAI,CAAC;gBACb,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,cAAc;aACJ,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS;SACb,IAAI,EAAE;SACN,MAAM,CAAC,CAAC,GAAG,EAA2B,EAAE,CAAC,IAAA,wCAAyB,EAAC,GAAG,CAAC,CAAC,CAAC;AAC9E,CAAC;AAzBD,0EAyBC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createMfRuntimeCode } from './create-mf-runtime-code';
|
|
1
|
+
export { createMfRuntimeCode, xpack_delegate_module_template, } from './create-mf-runtime-code';
|
|
2
2
|
export { extractFederatedDependencyPairs } from './extract-federated-dependency-pairs';
|
|
3
3
|
export { isModuleFederationPlugin } from './is-module-federation-plugin';
|
|
4
4
|
export { iterateFederationConfig } from './iterate-federation-config';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mutWebpackFederatedRemotesConfig = exports.makeCopyOfModuleFederationOptions = exports.iterateFederationConfig = exports.isModuleFederationPlugin = exports.extractFederatedDependencyPairs = exports.createMfRuntimeCode = void 0;
|
|
3
|
+
exports.mutWebpackFederatedRemotesConfig = exports.makeCopyOfModuleFederationOptions = exports.iterateFederationConfig = exports.isModuleFederationPlugin = 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
|
+
Object.defineProperty(exports, "xpack_delegate_module_template", { enumerable: true, get: function () { return create_mf_runtime_code_1.xpack_delegate_module_template; } });
|
|
6
7
|
var extract_federated_dependency_pairs_1 = require("./extract-federated-dependency-pairs");
|
|
7
8
|
Object.defineProperty(exports, "extractFederatedDependencyPairs", { enumerable: true, get: function () { return extract_federated_dependency_pairs_1.extractFederatedDependencyPairs; } });
|
|
8
9
|
var is_module_federation_plugin_1 = require("./is-module-federation-plugin");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/xpack-extract/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
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,2FAAuF;AAA9E,qJAAA,+BAA+B,OAAA;AACxC,6EAAyE;AAAhE,uIAAA,wBAAwB,OAAA;AACjC,yEAAsE;AAA7D,oIAAA,uBAAuB,OAAA;AAChC,mGAA6F;AAApF,2JAAA,iCAAiC,OAAA;AAC1C,+FAA0F;AAAjF,wJAAA,gCAAgC,OAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { XFederatedRemotesConfig, XPackConfiguration } from '../xpack.types';
|
|
2
|
+
export declare function iterateFederatedRemoteConfig<Compiler, K = XFederatedRemotesConfig>(config: XPackConfiguration<Compiler>, for_remote: (federatedRemoteConfig: XFederatedRemotesConfig) => K): K[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.iterateFederatedRemoteConfig = void 0;
|
|
4
|
+
const is_module_federation_plugin_1 = require("./is-module-federation-plugin");
|
|
5
|
+
const zephyr_agent_1 = require("zephyr-agent");
|
|
6
|
+
function iterateFederatedRemoteConfig(config, for_remote) {
|
|
7
|
+
if (!config.plugins) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
const results = [];
|
|
11
|
+
for (const plugin of config.plugins) {
|
|
12
|
+
if (!(0, is_module_federation_plugin_1.isModuleFederationPlugin)(plugin)) {
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
if (plugin._options) {
|
|
16
|
+
results.push(for_remote(plugin._options));
|
|
17
|
+
}
|
|
18
|
+
else if (plugin.config) {
|
|
19
|
+
results.push(for_remote(plugin.config));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
(0, zephyr_agent_1.ze_log)('iterateFederatedRemoteConfig.results', results);
|
|
23
|
+
return results;
|
|
24
|
+
}
|
|
25
|
+
exports.iterateFederatedRemoteConfig = iterateFederatedRemoteConfig;
|
|
26
|
+
//# sourceMappingURL=iterate-federated-remote-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iterate-federated-remote-config.js","sourceRoot":"","sources":["../../src/xpack-extract/iterate-federated-remote-config.ts"],"names":[],"mappings":";;;AAAA,+EAAyE;AAEzE,+CAAsC;AAEtC,SAAgB,4BAA4B,CAC1C,MAAoC,EACpC,UAAiE;IAEjE,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;QACD,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC5C,CAAC;aAAM,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YACzB,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IACD,IAAA,qBAAM,EAAC,sCAAsC,EAAE,OAAO,CAAC,CAAC;IAExD,OAAO,OAAO,CAAC;AACjB,CAAC;AAtBD,oEAsBC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ModuleFederationPlugin, XPackConfiguration } from '../xpack.types';
|
|
2
|
-
export declare function iterateFederationConfig<
|
|
2
|
+
export declare function iterateFederationConfig<Compiler, K = ModuleFederationPlugin>(config: XPackConfiguration<Compiler>, for_remote: (plugin: ModuleFederationPlugin) => K): K[];
|
|
@@ -2,16 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.iterateFederationConfig = void 0;
|
|
4
4
|
const is_module_federation_plugin_1 = require("./is-module-federation-plugin");
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const zephyr_agent_1 = require("zephyr-agent");
|
|
6
|
+
function iterateFederationConfig(config, for_remote) {
|
|
7
7
|
if (!config.plugins) {
|
|
8
|
-
return
|
|
8
|
+
return [];
|
|
9
9
|
}
|
|
10
|
+
const results = [];
|
|
10
11
|
for (const plugin of config.plugins) {
|
|
11
|
-
if ((0, is_module_federation_plugin_1.isModuleFederationPlugin)(plugin)) {
|
|
12
|
-
|
|
12
|
+
if (!(0, is_module_federation_plugin_1.isModuleFederationPlugin)(plugin)) {
|
|
13
|
+
continue;
|
|
13
14
|
}
|
|
15
|
+
results.push(for_remote(plugin));
|
|
14
16
|
}
|
|
17
|
+
(0, zephyr_agent_1.ze_log)('iterateFederationConfig.results', results);
|
|
15
18
|
return results;
|
|
16
19
|
}
|
|
17
20
|
exports.iterateFederationConfig = iterateFederationConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iterate-federation-config.js","sourceRoot":"","sources":["../../src/xpack-extract/iterate-federation-config.ts"],"names":[],"mappings":";;;AAAA,+EAAyE;
|
|
1
|
+
{"version":3,"file":"iterate-federation-config.js","sourceRoot":"","sources":["../../src/xpack-extract/iterate-federation-config.ts"],"names":[],"mappings":";;;AAAA,+EAAyE;AAEzE,+CAAsC;AAEtC,SAAgB,uBAAuB,CACrC,MAAoC,EACpC,UAAiD;IAEjD,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;QACD,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IACnC,CAAC;IACD,IAAA,qBAAM,EAAC,iCAAiC,EAAE,OAAO,CAAC,CAAC;IAEnD,OAAO,OAAO,CAAC;AACjB,CAAC;AAlBD,0DAkBC"}
|
|
@@ -4,8 +4,10 @@ exports.makeCopyOfModuleFederationOptions = void 0;
|
|
|
4
4
|
const iterate_federation_config_1 = require("./iterate-federation-config");
|
|
5
5
|
function makeCopyOfModuleFederationOptions(config) {
|
|
6
6
|
return (0, iterate_federation_config_1.iterateFederationConfig)(config, (plugin) => {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
if (!plugin)
|
|
8
|
+
return;
|
|
9
|
+
return JSON.parse(JSON.stringify(plugin));
|
|
10
|
+
}).filter(Boolean);
|
|
9
11
|
}
|
|
10
12
|
exports.makeCopyOfModuleFederationOptions = makeCopyOfModuleFederationOptions;
|
|
11
13
|
//# sourceMappingURL=make-copy-of-module-federation-options.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-copy-of-module-federation-options.js","sourceRoot":"","sources":["../../src/xpack-extract/make-copy-of-module-federation-options.ts"],"names":[],"mappings":";;;AAAA,2EAAsE;AAGtE,SAAgB,iCAAiC,CAC/C,MAAoC;IAEpC,OAAO,IAAA,mDAAuB,EAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;QAChD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"make-copy-of-module-federation-options.js","sourceRoot":"","sources":["../../src/xpack-extract/make-copy-of-module-federation-options.ts"],"names":[],"mappings":";;;AAAA,2EAAsE;AAGtE,SAAgB,iCAAiC,CAC/C,MAAoC;IAEpC,OAAO,IAAA,mDAAuB,EAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;QAChD,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACrB,CAAC;AAPD,8EAOC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { type ZeResolvedDependency } from 'zephyr-agent';
|
|
2
2
|
import { XPackConfiguration } from '../xpack.types';
|
|
3
|
-
|
|
3
|
+
import { ZephyrEngine } from 'zephyr-agent';
|
|
4
|
+
export declare function mutWebpackFederatedRemotesConfig<Compiler>(zephyr_engine: ZephyrEngine, config: XPackConfiguration<Compiler>, resolvedDependencyPairs: ZeResolvedDependency[] | null, delegate_module_template?: () => unknown): void;
|
|
@@ -2,32 +2,46 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mutWebpackFederatedRemotesConfig = void 0;
|
|
4
4
|
const index_1 = require("./index");
|
|
5
|
-
|
|
5
|
+
const zephyr_agent_1 = require("zephyr-agent");
|
|
6
|
+
const iterate_federated_remote_config_1 = require("./iterate-federated-remote-config");
|
|
7
|
+
function mutWebpackFederatedRemotesConfig(zephyr_engine, config, resolvedDependencyPairs, delegate_module_template = index_1.xpack_delegate_module_template) {
|
|
6
8
|
if (!resolvedDependencyPairs?.length) {
|
|
9
|
+
(0, zephyr_agent_1.ze_log)(`No resolved dependency pairs found, skipping...`);
|
|
7
10
|
return;
|
|
8
11
|
}
|
|
9
|
-
(0,
|
|
10
|
-
|
|
12
|
+
(0, iterate_federated_remote_config_1.iterateFederatedRemoteConfig)(config, (remotesConfig) => {
|
|
13
|
+
const remotes = remotesConfig?.remotes;
|
|
14
|
+
if (!remotes) {
|
|
15
|
+
(0, zephyr_agent_1.ze_log)(`No remotes found for plugin: ${JSON.stringify(remotesConfig, null, 2)}`, 'skipping...');
|
|
11
16
|
return;
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
}
|
|
18
|
+
const library_type = (remotesConfig.library?.type ?? zephyr_engine.builder === 'repack')
|
|
19
|
+
? 'var'
|
|
20
|
+
: 'self';
|
|
21
|
+
(0, zephyr_agent_1.ze_log)(`Library type: ${library_type}`);
|
|
22
|
+
Object.entries(remotes).map((remote) => {
|
|
14
23
|
const [remote_name, remote_version] = remote;
|
|
15
24
|
const resolved_dep = resolvedDependencyPairs.find((dep) => dep.name === remote_name && dep.version === remote_version);
|
|
25
|
+
(0, zephyr_agent_1.ze_log)(`remote_name: ${remote_name}, remote_version: ${remote_version}`);
|
|
16
26
|
if (!resolved_dep) {
|
|
27
|
+
(0, zephyr_agent_1.ze_log)(`Resolved dependency pair not found for remote: ${JSON.stringify(remote, null, 2)}`, 'skipping...');
|
|
17
28
|
return;
|
|
18
29
|
}
|
|
19
|
-
//
|
|
20
|
-
const [v_app] = remote_version.split('@')
|
|
30
|
+
// todo: this is a version with named export logic, we should take this into account later
|
|
31
|
+
const [v_app] = remote_version.includes('@') ? remote_version.split('@') : [];
|
|
32
|
+
(0, zephyr_agent_1.ze_log)(`v_app: ${v_app}`);
|
|
21
33
|
if (v_app) {
|
|
22
34
|
resolved_dep.remote_entry_url = [v_app, resolved_dep.remote_entry_url].join('@');
|
|
35
|
+
(0, zephyr_agent_1.ze_log)(`Adding version to remote entry url: ${resolved_dep.remote_entry_url}`);
|
|
23
36
|
}
|
|
24
37
|
resolved_dep.library_type = library_type;
|
|
25
38
|
resolved_dep.name = remote_name;
|
|
26
39
|
// @ts-expect-error - TS7053: Element implicitly has an any type because expression of type string can't be used to index type RemotesObject | (string | RemotesObject)[]
|
|
27
40
|
// No index signature with a parameter of type string was found on type RemotesObject | (string | RemotesObject)[]
|
|
28
|
-
if (
|
|
41
|
+
if (remotes[remote_name]) {
|
|
29
42
|
// @ts-expect-error - read above
|
|
30
|
-
|
|
43
|
+
remotes[remote_name] = (0, index_1.createMfRuntimeCode)(resolved_dep, delegate_module_template);
|
|
44
|
+
(0, zephyr_agent_1.ze_log)(`Setting runtime code for remote: ${remotes}`);
|
|
31
45
|
}
|
|
32
46
|
});
|
|
33
47
|
});
|
|
@@ -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":";;;AACA,
|
|
1
|
+
{"version":3,"file":"mut-webpack-federated-remotes-config.js","sourceRoot":"","sources":["../../src/xpack-extract/mut-webpack-federated-remotes-config.ts"],"names":[],"mappings":";;;AACA,mCAA8E;AAC9E,+CAAsC;AAGtC,uFAAiF;AAEjF,SAAgB,gCAAgC,CAC9C,aAA2B,EAC3B,MAAoC,EACpC,uBAAsD,EACtD,2BAA0C,sCAA8B;IAExE,IAAI,CAAC,uBAAuB,EAAE,MAAM,EAAE,CAAC;QACrC,IAAA,qBAAM,EAAC,iDAAiD,CAAC,CAAC;QAC1D,OAAO;IACT,CAAC;IAED,IAAA,8DAA4B,EAAC,MAAM,EAAE,CAAC,aAAa,EAAE,EAAE;QACrD,MAAM,OAAO,GAAG,aAAa,EAAE,OAAO,CAAC;QACvC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,IAAA,qBAAM,EACJ,gCAAgC,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,EACxE,aAAa,CACd,CAAC;YACF,OAAO;QACT,CAAC;QAED,MAAM,YAAY,GAChB,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,IAAI,aAAa,CAAC,OAAO,KAAK,QAAQ,CAAC;YACjE,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,MAAM,CAAC;QACb,IAAA,qBAAM,EAAC,iBAAiB,YAAY,EAAE,CAAC,CAAC;QAExC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACrC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,MAAM,CAAC;YAC7C,MAAM,YAAY,GAAG,uBAAuB,CAAC,IAAI,CAC/C,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,WAAW,IAAI,GAAG,CAAC,OAAO,KAAK,cAAc,CACpE,CAAC;YAEF,IAAA,qBAAM,EAAC,gBAAgB,WAAW,qBAAqB,cAAc,EAAE,CAAC,CAAC;YAEzE,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,IAAA,qBAAM,EACJ,kDAAkD,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,EACnF,aAAa,CACd,CAAC;gBACF,OAAO;YACT,CAAC;YAED,0FAA0F;YAC1F,MAAM,CAAC,KAAK,CAAC,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAE9E,IAAA,qBAAM,EAAC,UAAU,KAAK,EAAE,CAAC,CAAC;YAC1B,IAAI,KAAK,EAAE,CAAC;gBACV,YAAY,CAAC,gBAAgB,GAAG,CAAC,KAAK,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACjF,IAAA,qBAAM,EAAC,uCAAuC,YAAY,CAAC,gBAAgB,EAAE,CAAC,CAAC;YACjF,CAAC;YAED,YAAY,CAAC,YAAY,GAAG,YAAY,CAAC;YACzC,YAAY,CAAC,IAAI,GAAG,WAAW,CAAC;YAChC,yKAAyK;YACzK,kHAAkH;YAClH,IAAI,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;gBACzB,gCAAgC;gBAChC,OAAO,CAAC,WAAW,CAAC,GAAG,IAAA,2BAAmB,EACxC,YAAY,EACZ,wBAAwB,CACzB,CAAC;gBACF,IAAA,qBAAM,EAAC,oCAAoC,OAAO,EAAE,CAAC,CAAC;YACxD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAlED,4EAkEC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ZephyrEngine } from 'zephyr-agent';
|
|
2
|
+
import { type Source } from 'zephyr-edge-contract';
|
|
3
|
+
import { ModuleFederationPlugin, XStats, XStatsCompilation } from '../xpack.types';
|
|
4
|
+
interface UploadAgentPluginOptions {
|
|
5
|
+
zephyr_engine: ZephyrEngine;
|
|
6
|
+
wait_for_index_html?: boolean;
|
|
7
|
+
mfConfig: ModuleFederationPlugin[] | ModuleFederationPlugin | undefined;
|
|
8
|
+
}
|
|
9
|
+
export interface ZephyrAgentProps<T> {
|
|
10
|
+
stats: XStats;
|
|
11
|
+
stats_json: XStatsCompilation;
|
|
12
|
+
pluginOptions: T;
|
|
13
|
+
assets: Record<string, Source>;
|
|
14
|
+
}
|
|
15
|
+
export declare function xpack_zephyr_agent<T extends UploadAgentPluginOptions>({ stats, stats_json, assets, pluginOptions, }: ZephyrAgentProps<T>): Promise<void>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.xpack_zephyr_agent = void 0;
|
|
4
|
+
const zephyr_agent_1 = require("zephyr-agent");
|
|
5
|
+
const build_webpack_assets_map_1 = require("../xpack-extract/build-webpack-assets-map");
|
|
6
|
+
const index_1 = require("../lifecycle-events/index");
|
|
7
|
+
const get_build_stats_1 = require("../federation-dashboard-legacy/get-build-stats");
|
|
8
|
+
async function xpack_zephyr_agent({ stats, stats_json, assets, pluginOptions, }) {
|
|
9
|
+
(0, zephyr_agent_1.ze_log)('Initiating: Zephyr Webpack Upload Agent');
|
|
10
|
+
const zeStart = Date.now();
|
|
11
|
+
const { wait_for_index_html, zephyr_engine } = pluginOptions;
|
|
12
|
+
try {
|
|
13
|
+
const assetsMap = await (0, build_webpack_assets_map_1.buildWebpackAssetMap)(assets, {
|
|
14
|
+
wait_for_index_html,
|
|
15
|
+
});
|
|
16
|
+
// webpack dash data
|
|
17
|
+
const { EDGE_URL, PLATFORM } = await zephyr_engine.application_configuration;
|
|
18
|
+
const dashData = await (0, get_build_stats_1.getBuildStats)({
|
|
19
|
+
stats,
|
|
20
|
+
stats_json,
|
|
21
|
+
assets,
|
|
22
|
+
pluginOptions,
|
|
23
|
+
EDGE_URL,
|
|
24
|
+
PLATFORM,
|
|
25
|
+
});
|
|
26
|
+
await zephyr_engine.upload_assets({
|
|
27
|
+
assetsMap,
|
|
28
|
+
mfConfig: pluginOptions.mfConfig,
|
|
29
|
+
buildStats: dashData,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
(0, zephyr_agent_1.logFn)('error', zephyr_agent_1.ZephyrError.format(err));
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
(0, index_1.emitDeploymentDone)();
|
|
37
|
+
// todo: log end
|
|
38
|
+
(0, zephyr_agent_1.ze_log)('Zephyr Webpack Upload Agent: Done in', Date.now() - zeStart, 'ms');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.xpack_zephyr_agent = xpack_zephyr_agent;
|
|
42
|
+
//# sourceMappingURL=ze-xpack-upload-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ze-xpack-upload-agent.js","sourceRoot":"","sources":["../../src/xpack-extract/ze-xpack-upload-agent.ts"],"names":[],"mappings":";;;AAAA,+CAAwE;AAOxE,wFAAiF;AACjF,qDAA+D;AAC/D,oFAA+E;AAgBxE,KAAK,UAAU,kBAAkB,CAAqC,EAC3E,KAAK,EACL,UAAU,EACV,MAAM,EACN,aAAa,GACO;IACpB,IAAA,qBAAM,EAAC,yCAAyC,CAAC,CAAC;IAElD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC3B,MAAM,EAAE,mBAAmB,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC;IAC7D,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,MAAM,IAAA,+CAAoB,EAAC,MAAM,EAAE;YACnD,mBAAmB;SACpB,CAAC,CAAC;QAEH,oBAAoB;QACpB,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,aAAa,CAAC,yBAAyB,CAAC;QAE7E,MAAM,QAAQ,GAAG,MAAM,IAAA,+BAAa,EAAC;YACnC,KAAK;YACL,UAAU;YACV,MAAM;YACN,aAAa;YACb,QAAQ;YACR,QAAQ;SACT,CAAC,CAAC;QAEH,MAAM,aAAa,CAAC,aAAa,CAAC;YAChC,SAAS;YACT,QAAQ,EAAE,aAAa,CAAC,QAGX;YACb,UAAU,EAAE,QAAuC;SACpD,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAA,oBAAK,EAAC,OAAO,EAAE,0BAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1C,CAAC;YAAS,CAAC;QACT,IAAA,0BAAkB,GAAE,CAAC;QACrB,gBAAgB;QAChB,IAAA,qBAAM,EAAC,sCAAsC,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,EAAE,IAAI,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC;AA1CD,gDA0CC"}
|
package/dist/xpack.types.d.ts
CHANGED
|
@@ -7,14 +7,26 @@ interface WebpackPluginInstance<Compiler> {
|
|
|
7
7
|
/** The run point of the plugin, required method. */
|
|
8
8
|
apply: (compiler: Compiler) => void;
|
|
9
9
|
}
|
|
10
|
+
export interface XFederatedRemotesConfig {
|
|
11
|
+
name: string;
|
|
12
|
+
library?: {
|
|
13
|
+
type?: string;
|
|
14
|
+
};
|
|
15
|
+
remotes?: (string | RemotesObject)[] | RemotesObject;
|
|
16
|
+
/** Repack: bundle file name */
|
|
17
|
+
filename?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Repack: Temporary field for repack to store bundle name (in their case it's the
|
|
20
|
+
* actual output js.bundle and they want to put it in filename field)
|
|
21
|
+
*/
|
|
22
|
+
bundle_name?: string;
|
|
23
|
+
}
|
|
10
24
|
export interface ModuleFederationPlugin {
|
|
11
25
|
apply: (compiler: unknown) => void;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
remotes?: (string | RemotesObject)[] | RemotesObject;
|
|
17
|
-
};
|
|
26
|
+
/** For Webpack/Rspack */
|
|
27
|
+
_options?: XFederatedRemotesConfig;
|
|
28
|
+
/** Repack specific for now until Repack change how the config should be exposed */
|
|
29
|
+
config?: XFederatedRemotesConfig;
|
|
18
30
|
}
|
|
19
31
|
interface RemotesObject {
|
|
20
32
|
[index: string]: string | RemotesConfig | string[];
|
|
@@ -59,15 +71,25 @@ export interface XCompiler {
|
|
|
59
71
|
loadScript: string;
|
|
60
72
|
};
|
|
61
73
|
};
|
|
74
|
+
rspack: {
|
|
75
|
+
RuntimeGlobals: {
|
|
76
|
+
loadScript: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
62
79
|
}
|
|
63
80
|
export interface XCompilation {
|
|
64
81
|
outputOptions: {
|
|
65
82
|
trustedTypes: boolean;
|
|
66
83
|
};
|
|
67
84
|
hooks: {
|
|
85
|
+
/** This is for Webpack */
|
|
68
86
|
additionalModuleRuntimeRequirements: {
|
|
69
87
|
tap: (name: string, callback: (module: XModule, set: Set<string>) => void) => void;
|
|
70
88
|
};
|
|
89
|
+
/** This is for Rspack */
|
|
90
|
+
additionalTreeRuntimeRequirements: {
|
|
91
|
+
tap: (name: string, callback: (chunk: XChunk, set: Set<string>) => void) => void;
|
|
92
|
+
};
|
|
71
93
|
};
|
|
72
94
|
}
|
|
73
95
|
export interface XModule {
|
|
@@ -84,11 +106,13 @@ interface XStatsReason {
|
|
|
84
106
|
}
|
|
85
107
|
export interface XStats {
|
|
86
108
|
compilation: {
|
|
109
|
+
name?: string;
|
|
110
|
+
namedChunks: ReadonlyMap<string, Readonly<XChunk>>;
|
|
87
111
|
options: {
|
|
88
112
|
context?: string;
|
|
89
113
|
};
|
|
90
|
-
namedChunks: ReadonlyMap<string, Readonly<XChunk>>;
|
|
91
114
|
};
|
|
115
|
+
toJson: () => XStatsCompilation;
|
|
92
116
|
}
|
|
93
117
|
export interface XStatsCompilation {
|
|
94
118
|
publicPath?: string;
|