zephyr-xpack-internal 0.0.1

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.
Files changed (85) hide show
  1. package/LICENSE +39 -0
  2. package/README.md +26 -0
  3. package/dist/federation-dashboard-legacy/get-build-stats.d.ts +18 -0
  4. package/dist/federation-dashboard-legacy/get-build-stats.js +51 -0
  5. package/dist/federation-dashboard-legacy/get-build-stats.js.map +1 -0
  6. package/dist/federation-dashboard-legacy/utils/convert-to-graph/convert-dependencies.d.ts +12 -0
  7. package/dist/federation-dashboard-legacy/utils/convert-to-graph/convert-dependencies.js +31 -0
  8. package/dist/federation-dashboard-legacy/utils/convert-to-graph/convert-dependencies.js.map +1 -0
  9. package/dist/federation-dashboard-legacy/utils/convert-to-graph/convert-to-graph.d.ts +28 -0
  10. package/dist/federation-dashboard-legacy/utils/convert-to-graph/convert-to-graph.js +60 -0
  11. package/dist/federation-dashboard-legacy/utils/convert-to-graph/convert-to-graph.js.map +1 -0
  12. package/dist/federation-dashboard-legacy/utils/convert-to-graph/get-licenses.d.ts +2 -0
  13. package/dist/federation-dashboard-legacy/utils/convert-to-graph/get-licenses.js +25 -0
  14. package/dist/federation-dashboard-legacy/utils/convert-to-graph/get-licenses.js.map +1 -0
  15. package/dist/federation-dashboard-legacy/utils/convert-to-graph/module-part-one.d.ts +16 -0
  16. package/dist/federation-dashboard-legacy/utils/convert-to-graph/module-part-one.js +110 -0
  17. package/dist/federation-dashboard-legacy/utils/convert-to-graph/module-part-one.js.map +1 -0
  18. package/dist/federation-dashboard-legacy/utils/convert-to-graph/module-part-two.d.ts +27 -0
  19. package/dist/federation-dashboard-legacy/utils/convert-to-graph/module-part-two.js +123 -0
  20. package/dist/federation-dashboard-legacy/utils/convert-to-graph/module-part-two.js.map +1 -0
  21. package/dist/federation-dashboard-legacy/utils/convert-to-graph/object-has-keys.d.ts +8 -0
  22. package/dist/federation-dashboard-legacy/utils/convert-to-graph/object-has-keys.js +22 -0
  23. package/dist/federation-dashboard-legacy/utils/convert-to-graph/object-has-keys.js.map +1 -0
  24. package/dist/federation-dashboard-legacy/utils/convert-to-graph/process-function-remotes.d.ts +9 -0
  25. package/dist/federation-dashboard-legacy/utils/convert-to-graph/process-function-remotes.js +35 -0
  26. package/dist/federation-dashboard-legacy/utils/convert-to-graph/process-function-remotes.js.map +1 -0
  27. package/dist/federation-dashboard-legacy/utils/convert-to-graph/validate-params.d.ts +34 -0
  28. package/dist/federation-dashboard-legacy/utils/convert-to-graph/validate-params.js +49 -0
  29. package/dist/federation-dashboard-legacy/utils/convert-to-graph/validate-params.js.map +1 -0
  30. package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/FederationDashboardPlugin.d.ts +32 -0
  31. package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/FederationDashboardPlugin.js +418 -0
  32. package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/FederationDashboardPlugin.js.map +1 -0
  33. package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/add-runtime-requirement-to-promise-external.d.ts +4 -0
  34. package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/add-runtime-requirement-to-promise-external.js +19 -0
  35. package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/add-runtime-requirement-to-promise-external.js.map +1 -0
  36. package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/compute-version-strategy.d.ts +4 -0
  37. package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/compute-version-strategy.js +22 -0
  38. package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/compute-version-strategy.js.map +1 -0
  39. package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/federation-dashboard-plugin-options.d.ts +31 -0
  40. package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/federation-dashboard-plugin-options.js +3 -0
  41. package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/federation-dashboard-plugin-options.js.map +1 -0
  42. package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/federation-dashboard-types.d.ts +17 -0
  43. package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/federation-dashboard-types.js +3 -0
  44. package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/federation-dashboard-types.js.map +1 -0
  45. package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/find-package-json.d.ts +1 -0
  46. package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/find-package-json.js +23 -0
  47. package/dist/federation-dashboard-legacy/utils/federation-dashboard-plugin/find-package-json.js.map +1 -0
  48. package/dist/federation-dashboard-legacy/utils/merge-graphs/merge-graphs.d.ts +20 -0
  49. package/dist/federation-dashboard-legacy/utils/merge-graphs/merge-graphs.js +84 -0
  50. package/dist/federation-dashboard-legacy/utils/merge-graphs/merge-graphs.js.map +1 -0
  51. package/dist/index.d.ts +6 -0
  52. package/dist/index.js +17 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/lifecycle-events/index.d.ts +2 -0
  55. package/dist/lifecycle-events/index.js +20 -0
  56. package/dist/lifecycle-events/index.js.map +1 -0
  57. package/dist/package.json +24 -0
  58. package/dist/xpack-extract/build-webpack-assets-map.d.ts +4 -0
  59. package/dist/xpack-extract/build-webpack-assets-map.js +40 -0
  60. package/dist/xpack-extract/build-webpack-assets-map.js.map +1 -0
  61. package/dist/xpack-extract/create-mf-runtime-code.d.ts +2 -0
  62. package/dist/xpack-extract/create-mf-runtime-code.js +67 -0
  63. package/dist/xpack-extract/create-mf-runtime-code.js.map +1 -0
  64. package/dist/xpack-extract/extract-federated-dependency-pairs.d.ts +3 -0
  65. package/dist/xpack-extract/extract-federated-dependency-pairs.js +22 -0
  66. package/dist/xpack-extract/extract-federated-dependency-pairs.js.map +1 -0
  67. package/dist/xpack-extract/index.d.ts +6 -0
  68. package/dist/xpack-extract/index.js +16 -0
  69. package/dist/xpack-extract/index.js.map +1 -0
  70. package/dist/xpack-extract/is-module-federation-plugin.d.ts +5 -0
  71. package/dist/xpack-extract/is-module-federation-plugin.js +14 -0
  72. package/dist/xpack-extract/is-module-federation-plugin.js.map +1 -0
  73. package/dist/xpack-extract/iterate-federation-config.d.ts +2 -0
  74. package/dist/xpack-extract/iterate-federation-config.js +18 -0
  75. package/dist/xpack-extract/iterate-federation-config.js.map +1 -0
  76. package/dist/xpack-extract/make-copy-of-module-federation-options.d.ts +2 -0
  77. package/dist/xpack-extract/make-copy-of-module-federation-options.js +11 -0
  78. package/dist/xpack-extract/make-copy-of-module-federation-options.js.map +1 -0
  79. package/dist/xpack-extract/mut-webpack-federated-remotes-config.d.ts +3 -0
  80. package/dist/xpack-extract/mut-webpack-federated-remotes-config.js +36 -0
  81. package/dist/xpack-extract/mut-webpack-federated-remotes-config.js.map +1 -0
  82. package/dist/xpack.types.d.ts +99 -0
  83. package/dist/xpack.types.js +3 -0
  84. package/dist/xpack.types.js.map +1 -0
  85. package/package.json +24 -0
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.computeVersionStrategy = exports.gitSha = void 0;
4
+ const node_child_process_1 = require("node:child_process");
5
+ try {
6
+ exports.gitSha = (0, node_child_process_1.execSync)('git rev-parse HEAD').toString().trim();
7
+ }
8
+ catch (e) {
9
+ console.error(e);
10
+ }
11
+ const computeVersionStrategy = (stats, arg) => {
12
+ switch (arg) {
13
+ case 'gitSha':
14
+ return exports.gitSha;
15
+ case 'buildHash':
16
+ return stats.hash;
17
+ default:
18
+ return arg ? arg.toString() : exports.gitSha;
19
+ }
20
+ };
21
+ exports.computeVersionStrategy = computeVersionStrategy;
22
+ //# sourceMappingURL=compute-version-strategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute-version-strategy.js","sourceRoot":"","sources":["../../../../src/federation-dashboard-legacy/utils/federation-dashboard-plugin/compute-version-strategy.ts"],"names":[],"mappings":";;;AAAA,2DAA8C;AAG9C,IAAI,CAAC;IACH,cAAM,GAAG,IAAA,6BAAQ,EAAC,oBAAoB,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;AAC5D,CAAC;AAAC,OAAO,CAAC,EAAE,CAAC;IACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC;AAEM,MAAM,sBAAsB,GAAG,CACpC,KAEC,EACD,GAAuB,EACH,EAAE;IACtB,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,QAAQ;YACX,OAAO,cAAM,CAAC;QAChB,KAAK,WAAW;YACd,OAAO,KAAK,CAAC,IAAI,CAAC;QACpB;YACE,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,cAAM,CAAC;IACzC,CAAC;AACH,CAAC,CAAC;AAdW,QAAA,sBAAsB,0BAcjC"}
@@ -0,0 +1,31 @@
1
+ export interface FederationDashboardPluginOptions {
2
+ app?: {
3
+ org: string;
4
+ project: string;
5
+ name: string;
6
+ version: string;
7
+ };
8
+ git?: {
9
+ name?: string;
10
+ email?: string;
11
+ branch: string;
12
+ commit: string;
13
+ };
14
+ context: {
15
+ isCI: boolean;
16
+ };
17
+ debug: boolean;
18
+ filename: string;
19
+ useAST: boolean;
20
+ standalone?: boolean;
21
+ dashboardURL?: string;
22
+ metadata?: Record<string, string | {
23
+ url: string;
24
+ }>;
25
+ environment?: string;
26
+ versionStrategy?: string;
27
+ posted?: Date;
28
+ group?: string;
29
+ nextjs?: string;
30
+ packageJsonPath?: string;
31
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=federation-dashboard-plugin-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"federation-dashboard-plugin-options.js","sourceRoot":"","sources":["../../../../src/federation-dashboard-legacy/utils/federation-dashboard-plugin/federation-dashboard-plugin-options.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ /// <reference types="node" />
2
+ export interface Source {
3
+ source: () => Buffer;
4
+ size: () => number;
5
+ }
6
+ export type Exposes = (string | ExposesObject)[] | ExposesObject;
7
+ interface ExposesObject {
8
+ [index: string]: string | ExposesConfig | string[];
9
+ }
10
+ /** Advanced configuration for modules that should be exposed by this container. */
11
+ interface ExposesConfig {
12
+ /** Request to a module that should be exposed by this container. */
13
+ import: string | string[];
14
+ /** Custom chunk name for the exposed module. */
15
+ name?: string;
16
+ }
17
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=federation-dashboard-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"federation-dashboard-types.js","sourceRoot":"","sources":["../../../../src/federation-dashboard-legacy/utils/federation-dashboard-plugin/federation-dashboard-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export declare const findPackageJson: (filePath: string[] | undefined) => undefined | unknown;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findPackageJson = void 0;
4
+ const node_fs_1 = require("node:fs");
5
+ const node_path_1 = require("node:path");
6
+ const findPackageJson = (filePath) => {
7
+ if (!filePath || filePath.length === 0) {
8
+ return;
9
+ }
10
+ if ((0, node_fs_1.existsSync)((0, node_path_1.join)(filePath.join(node_path_1.sep), 'package.json'))) {
11
+ try {
12
+ const file = (0, node_fs_1.readFileSync)((0, node_path_1.join)(filePath.join(node_path_1.sep), 'package.json'), 'utf-8');
13
+ return JSON.parse(file);
14
+ }
15
+ catch (e) {
16
+ console.error(e);
17
+ }
18
+ }
19
+ filePath.pop();
20
+ return (0, exports.findPackageJson)(filePath);
21
+ };
22
+ exports.findPackageJson = findPackageJson;
23
+ //# sourceMappingURL=find-package-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-package-json.js","sourceRoot":"","sources":["../../../../src/federation-dashboard-legacy/utils/federation-dashboard-plugin/find-package-json.ts"],"names":[],"mappings":";;;AAAA,qCAAmD;AACnD,yCAAsC;AAE/B,MAAM,eAAe,GAAG,CAAC,QAA8B,EAAuB,EAAE;IACrF,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvC,OAAO;IACT,CAAC;IACD,IAAI,IAAA,oBAAU,EAAC,IAAA,gBAAI,EAAC,QAAQ,CAAC,IAAI,CAAC,eAAG,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;QACzD,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,IAAA,sBAAY,EAAC,IAAA,gBAAI,EAAC,QAAQ,CAAC,IAAI,CAAC,eAAG,CAAC,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC;YAC7E,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IACD,QAAQ,CAAC,GAAG,EAAE,CAAC;IACf,OAAO,IAAA,uBAAe,EAAC,QAAQ,CAAC,CAAC;AACnC,CAAC,CAAC;AAdW,QAAA,eAAe,mBAc1B"}
@@ -0,0 +1,20 @@
1
+ import { ConvertedDependencies } from '../convert-to-graph/convert-dependencies';
2
+ import { ModuleObject, Overrides } from '../convert-to-graph/module-part-two';
3
+ type Graph = ConvertedDependencies & {
4
+ id: string;
5
+ name: string;
6
+ remote: string;
7
+ modules: ModuleObject[];
8
+ overrides: Overrides[];
9
+ consumes: {
10
+ consumingApplicationID: string;
11
+ applicationID: string | null;
12
+ name: string;
13
+ usedIn: {
14
+ file: string;
15
+ url: string;
16
+ }[];
17
+ }[];
18
+ };
19
+ export declare function mergeGraphs(graph1: Graph, graph2: Graph): Graph;
20
+ export {};
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mergeGraphs = void 0;
4
+ function mergeWithoutDupe(source) {
5
+ return source.reduce((acc, item) => {
6
+ if (typeof item === 'object') {
7
+ const isDupe = acc.find((existing) => {
8
+ return Object.entries(existing).every(([key, value]) => {
9
+ return item[key] === value;
10
+ });
11
+ });
12
+ if (!isDupe) {
13
+ acc.push(item);
14
+ }
15
+ }
16
+ else {
17
+ acc.push(item);
18
+ }
19
+ return acc;
20
+ }, []);
21
+ }
22
+ function mergeGraphs(graph1, graph2) {
23
+ graph1.devDependencies = mergeWithoutDupe([
24
+ ...(graph2.devDependencies ?? []),
25
+ ...(graph1.devDependencies ?? []),
26
+ ]);
27
+ graph1.dependencies = mergeWithoutDupe([
28
+ ...(graph2.dependencies ?? []),
29
+ ...(graph1.dependencies ?? []),
30
+ ]);
31
+ //exposed
32
+ graph2.modules.forEach((hostModules) => {
33
+ const existing = graph1.modules.find((sidecarModules) => {
34
+ return (hostModules.id === sidecarModules.id &&
35
+ hostModules.name === sidecarModules.name &&
36
+ hostModules.file === sidecarModules.file &&
37
+ hostModules.applicationID === sidecarModules.applicationID);
38
+ });
39
+ if (existing) {
40
+ existing.requires = Array.from(new Set([...existing.requires, ...hostModules.requires]));
41
+ }
42
+ else {
43
+ graph1.modules.push(hostModules);
44
+ }
45
+ });
46
+ //shares
47
+ graph2.overrides.forEach((hostOverrides) => {
48
+ const existing = graph1.overrides.find((sidecarOverrides) => {
49
+ return (sidecarOverrides.id === hostOverrides.id &&
50
+ sidecarOverrides.name === hostOverrides.name &&
51
+ sidecarOverrides.version === hostOverrides.version &&
52
+ sidecarOverrides.location === hostOverrides.location &&
53
+ sidecarOverrides.applicationID === hostOverrides.applicationID);
54
+ });
55
+ if (!existing) {
56
+ graph1.overrides.push(hostOverrides);
57
+ }
58
+ });
59
+ //consumes
60
+ graph2.consumes.forEach((hostConsumedModule) => {
61
+ const existing = graph1.consumes.find((sidecarConsumedModule) => {
62
+ return (sidecarConsumedModule.consumingApplicationID ===
63
+ hostConsumedModule.consumingApplicationID &&
64
+ sidecarConsumedModule.applicationID === hostConsumedModule.applicationID &&
65
+ sidecarConsumedModule.name === hostConsumedModule.name);
66
+ });
67
+ if (existing) {
68
+ hostConsumedModule.usedIn.forEach((consumedModule) => {
69
+ const alreadyExists = existing.usedIn.find(({ file, url }) => {
70
+ return consumedModule.file === file && consumedModule.url === url;
71
+ });
72
+ if (!alreadyExists) {
73
+ existing.usedIn.push(consumedModule);
74
+ }
75
+ });
76
+ }
77
+ else {
78
+ graph1.consumes.push(hostConsumedModule);
79
+ }
80
+ });
81
+ return graph1;
82
+ }
83
+ exports.mergeGraphs = mergeGraphs;
84
+ //# sourceMappingURL=merge-graphs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge-graphs.js","sourceRoot":"","sources":["../../../../src/federation-dashboard-legacy/utils/merge-graphs/merge-graphs.ts"],"names":[],"mappings":";;;AAIA,SAAS,gBAAgB,CAAC,MAA0B;IAClD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QACjC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACnC,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;oBACrD,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC;gBAC7B,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjB,CAAC;QACH,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAwB,CAAC,CAAC;AAC/B,CAAC;AAmBD,SAAg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AM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;gBACvC,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AApED,kCAoEC"}
@@ -0,0 +1,6 @@
1
+ export { onDeploymentDone, emitDeploymentDone } from './lifecycle-events';
2
+ export { isModuleFederationPlugin } from './xpack-extract/is-module-federation-plugin';
3
+ export { extractFederatedDependencyPairs, makeCopyOfModuleFederationOptions, mutWebpackFederatedRemotesConfig, } from './xpack-extract';
4
+ export { buildWebpackAssetMap } from './xpack-extract/build-webpack-assets-map';
5
+ export type { XPackConfiguration, ModuleFederationPlugin } from './xpack.types';
6
+ export { getBuildStats } from './federation-dashboard-legacy/get-build-stats';
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
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;
4
+ var lifecycle_events_1 = require("./lifecycle-events");
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; } });
9
+ var xpack_extract_1 = require("./xpack-extract");
10
+ Object.defineProperty(exports, "extractFederatedDependencyPairs", { enumerable: true, get: function () { return xpack_extract_1.extractFederatedDependencyPairs; } });
11
+ Object.defineProperty(exports, "makeCopyOfModuleFederationOptions", { enumerable: true, get: function () { return xpack_extract_1.makeCopyOfModuleFederationOptions; } });
12
+ Object.defineProperty(exports, "mutWebpackFederatedRemotesConfig", { enumerable: true, get: function () { return xpack_extract_1.mutWebpackFederatedRemotesConfig; } });
13
+ var build_webpack_assets_map_1 = require("./xpack-extract/build-webpack-assets-map");
14
+ Object.defineProperty(exports, "buildWebpackAssetMap", { enumerable: true, get: function () { return build_webpack_assets_map_1.buildWebpackAssetMap; } });
15
+ var get_build_stats_1 = require("./federation-dashboard-legacy/get-build-stats");
16
+ Object.defineProperty(exports, "getBuildStats", { enumerable: true, get: function () { return get_build_stats_1.getBuildStats; } });
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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,iDAIyB;AAHvB,gIAAA,+BAA+B,OAAA;AAC/B,kIAAA,iCAAiC,OAAA;AACjC,iIAAA,gCAAgC,OAAA;AAElC,qFAAgF;AAAvE,gIAAA,oBAAoB,OAAA;AAI7B,iFAA8E;AAArE,gHAAA,aAAa,OAAA"}
@@ -0,0 +1,2 @@
1
+ export declare function emitDeploymentDone(): void;
2
+ export declare function onDeploymentDone(): Promise<string>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.onDeploymentDone = exports.emitDeploymentDone = void 0;
4
+ const node_events_1 = require("node:events");
5
+ const zephyr_agent_1 = require("zephyr-agent");
6
+ const _lifecycle_events = new node_events_1.EventEmitter();
7
+ const _deployment_done = 'deployment-done';
8
+ function emitDeploymentDone() {
9
+ (0, zephyr_agent_1.ze_log)('Deployment done');
10
+ _lifecycle_events.emit(_deployment_done);
11
+ }
12
+ exports.emitDeploymentDone = emitDeploymentDone;
13
+ async function onDeploymentDone() {
14
+ return new Promise((resolve) => {
15
+ (0, zephyr_agent_1.ze_log)('Waiting for deployment done');
16
+ _lifecycle_events.once(_deployment_done, resolve);
17
+ });
18
+ }
19
+ exports.onDeploymentDone = onDeploymentDone;
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lifecycle-events/index.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAC3C,+CAAsC;AAEtC,MAAM,iBAAiB,GAAG,IAAI,0BAAY,EAAE,CAAC;AAE7C,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAE3C,SAAgB,kBAAkB;IAChC,IAAA,qBAAM,EAAC,iBAAiB,CAAC,CAAC;IAC1B,iBAAiB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;AAC3C,CAAC;AAHD,gDAGC;AAEM,KAAK,UAAU,gBAAgB;IACpC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAA,qBAAM,EAAC,6BAA6B,CAAC,CAAC;QACtC,iBAAiB,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC;AALD,4CAKC"}
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "zephyr-xpack-internal",
3
+ "version": "0.0.1",
4
+ "license": "Apache-2.0",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "type": "commonjs",
8
+ "scripts": {
9
+ "build": "nx run zephyr-xpack-internal:build",
10
+ "patch-version": "pnpm version"
11
+ },
12
+ "dependencies": {
13
+ "@module-federation/automatic-vendor-federation": "1.2.1",
14
+ "is-ci": "^3.0.1",
15
+ "tslib": "^2.3.0",
16
+ "webpack": "^5.93.0",
17
+ "zephyr-agent": "workspace:*",
18
+ "zephyr-edge-contract": "workspace:*"
19
+ },
20
+ "devDependencies": {
21
+ "@types/is-ci": "^3.0.4",
22
+ "@types/node-persist": "^3.1.8"
23
+ }
24
+ }
@@ -0,0 +1,4 @@
1
+ import type { Source, ZeBuildAssetsMap } from 'zephyr-edge-contract';
2
+ export declare function buildWebpackAssetMap(assets: Record<string, Source>, props: {
3
+ wait_for_index_html?: boolean;
4
+ }): Promise<ZeBuildAssetsMap>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildWebpackAssetMap = void 0;
4
+ const zephyr_agent_1 = require("zephyr-agent");
5
+ function getAssetType(asset) {
6
+ return asset.constructor.name;
7
+ }
8
+ function extractBuffer(asset) {
9
+ const className = getAssetType(asset);
10
+ switch (className) {
11
+ case 'CachedSource':
12
+ case 'CompatSource':
13
+ case 'RawSource':
14
+ case 'ConcatSource':
15
+ case 'SourceMapSource':
16
+ return asset?.buffer && asset.buffer();
17
+ case 'ReplaceSource':
18
+ return asset.source();
19
+ default:
20
+ return void 0;
21
+ }
22
+ }
23
+ async function buildWebpackAssetMap(assets, props) {
24
+ const { wait_for_index_html } = props;
25
+ (0, zephyr_agent_1.ze_log)('Building assets map from webpack assets.');
26
+ const assetsMap = (0, zephyr_agent_1.buildAssetsMap)(assets, extractBuffer, getAssetType);
27
+ if (wait_for_index_html) {
28
+ (0, zephyr_agent_1.ze_log)('Assets map built. Checking for index.html waiter.');
29
+ const index_html_content = await (0, zephyr_agent_1.onIndexHtmlResolved)();
30
+ const index_html_asset = (0, zephyr_agent_1.zeBuildAssets)({
31
+ filepath: 'index.html',
32
+ content: index_html_content,
33
+ });
34
+ assetsMap[index_html_asset.hash] = index_html_asset;
35
+ (0, zephyr_agent_1.ze_log)('Index.html added to assets map.');
36
+ }
37
+ return assetsMap;
38
+ }
39
+ exports.buildWebpackAssetMap = buildWebpackAssetMap;
40
+ //# sourceMappingURL=build-webpack-assets-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-webpack-assets-map.js","sourceRoot":"","sources":["../../src/xpack-extract/build-webpack-assets-map.ts"],"names":[],"mappings":";;;AACA,+CAA0F;AAE1F,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC;AAChC,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACtC,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,cAAc,CAAC;QACpB,KAAK,cAAc,CAAC;QACpB,KAAK,WAAW,CAAC;QACjB,KAAK,cAAc,CAAC;QACpB,KAAK,iBAAiB;YACpB,OAAO,KAAK,EAAE,MAAM,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACzC,KAAK,eAAe;YAClB,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;QACxB;YACE,OAAO,KAAK,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,oBAAoB,CACxC,MAA8B,EAC9B,KAAwC;IAExC,MAAM,EAAE,mBAAmB,EAAE,GAAG,KAAK,CAAC;IAEtC,IAAA,qBAAM,EAAC,0CAA0C,CAAC,CAAC;IACnD,MAAM,SAAS,GAAqB,IAAA,6BAAc,EAAC,MAAM,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;IAExF,IAAI,mBAAmB,EAAE,CAAC;QACxB,IAAA,qBAAM,EAAC,mDAAmD,CAAC,CAAC;QAE5D,MAAM,kBAAkB,GAAG,MAAM,IAAA,kCAAmB,GAAE,CAAC;QACvD,MAAM,gBAAgB,GAAG,IAAA,4BAAa,EAAC;YACrC,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,kBAAkB;SAC5B,CAAC,CAAC;QACH,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC;QACpD,IAAA,qBAAM,EAAC,iCAAiC,CAAC,CAAC;IAC5C,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAtBD,oDAsBC"}
@@ -0,0 +1,2 @@
1
+ import { type ZeResolvedDependency } from 'zephyr-agent';
2
+ export declare function createMfRuntimeCode(deps: ZeResolvedDependency): string;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createMfRuntimeCode = void 0;
4
+ function createMfRuntimeCode(deps) {
5
+ // prepare delegate function string template
6
+ const fnReplace = delegate_module_template.toString();
7
+ const strStart = new RegExp(/^function[\W\S]+return new Promise/);
8
+ const strNewStart = `promise new Promise`;
9
+ const strEnd = new RegExp(/;[^)}]+}$/);
10
+ const promiseNewPromise = fnReplace.replace(strStart, strNewStart).replace(strEnd, '');
11
+ const { application_uid, remote_entry_url, default_url, name, library_type } = deps;
12
+ return promiseNewPromise
13
+ .replace('__APPLICATION_UID__', application_uid)
14
+ .replace('__REMOTE_ENTRY_URL__', remote_entry_url)
15
+ .replace('__REMOTE_NAME__', name)
16
+ .replace('__DEFAULT_URL__', default_url)
17
+ .replace('__LIBRARY_TYPE__', library_type);
18
+ }
19
+ exports.createMfRuntimeCode = createMfRuntimeCode;
20
+ function delegate_module_template() {
21
+ return new Promise((resolve, reject) => {
22
+ const _windows = typeof window !== 'undefined' ? window : globalThis;
23
+ const sessionEdgeURL = _windows.sessionStorage.getItem('__APPLICATION_UID__');
24
+ const remote_entry_url = '__REMOTE_ENTRY_URL__';
25
+ const library_type = '__LIBRARY_TYPE__';
26
+ let edgeUrl = sessionEdgeURL ?? remote_entry_url;
27
+ let remote_name = '__REMOTE_NAME__';
28
+ if (edgeUrl.indexOf('@') !== -1) {
29
+ [remote_name, edgeUrl] = edgeUrl.split('@');
30
+ }
31
+ const resolve_entry = [
32
+ fetch(edgeUrl, { method: 'HEAD' })
33
+ .then(() => edgeUrl)
34
+ .catch(() => false),
35
+ ];
36
+ Promise.race(resolve_entry)
37
+ .then((remoteUrl) => {
38
+ if (typeof remoteUrl !== 'string')
39
+ return;
40
+ const _win = _windows;
41
+ if (typeof _win[remote_name] !== 'undefined') {
42
+ return resolve(_win[remote_name]);
43
+ }
44
+ if (typeof __webpack_require__ !== 'undefined' &&
45
+ typeof __webpack_require__.l === 'function' &&
46
+ // @ts-expect-error - library_type is inherited enum type instead of string
47
+ library_type !== 'module') {
48
+ __webpack_require__.l(remoteUrl, () => {
49
+ resolve(_win[remote_name]);
50
+ }, remote_name, remote_name);
51
+ return;
52
+ }
53
+ return new Function(`return import("${remoteUrl}")`)()
54
+ .then((mod) => {
55
+ if (typeof _win[remote_name] !== 'undefined') {
56
+ return resolve(_win[remote_name]);
57
+ }
58
+ return resolve(mod);
59
+ })
60
+ .catch((err) => reject(err));
61
+ })
62
+ .catch((err) => {
63
+ console.error(`Zephyr: error loading remote entry ${remote_entry_url}`, err);
64
+ });
65
+ });
66
+ }
67
+ //# sourceMappingURL=create-mf-runtime-code.js.map
@@ -0,0 +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,CAAC,IAA0B;IAC5D,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;IAEvF,MAAM,EAAE,eAAe,EAAE,gBAAgB,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAEpF,OAAO,iBAAiB;SACrB,OAAO,CAAC,qBAAqB,EAAE,eAAe,C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,IAAI,CAAC,WAAW,CAAC,KAAK,WAAW,EAAE,CAAC;gBAC7C,OAAO,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;YACpC,CAAC;YAED,IACE,OAAO,mBAAmB,KAAK,WAAW;gBAC1C,OAAO,mBAAmB,CAAC,CAAC,KAAK,UAAU;gBAC3C,2EAA2E;gBAC3E,YAAY,KAAK,QAAQ,EACzB,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"}
@@ -0,0 +1,3 @@
1
+ import { ZeDependencyPair } from 'zephyr-agent';
2
+ import { XPackConfiguration } from '../xpack.types';
3
+ export declare function extractFederatedDependencyPairs(config: XPackConfiguration<any>): ZeDependencyPair[];
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extractFederatedDependencyPairs = void 0;
4
+ const zephyr_agent_1 = require("zephyr-agent");
5
+ const iterate_federation_config_1 = require("./iterate-federation-config");
6
+ function extractFederatedDependencyPairs(config) {
7
+ return (0, iterate_federation_config_1.iterateFederationConfig)(config, (plugin) => {
8
+ if (!plugin._options.remotes)
9
+ return null;
10
+ return Object.entries(plugin._options.remotes).map((remote) => {
11
+ const [remote_name, remote_version] = remote;
12
+ return {
13
+ name: remote_name,
14
+ version: remote_version,
15
+ };
16
+ });
17
+ })
18
+ .flat()
19
+ .filter(zephyr_agent_1.is_zephyr_dependency_pair);
20
+ }
21
+ exports.extractFederatedDependencyPairs = extractFederatedDependencyPairs;
22
+ //# sourceMappingURL=extract-federated-dependency-pairs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-federated-dependency-pairs.js","sourceRoot":"","sources":["../../src/xpack-extract/extract-federated-dependency-pairs.ts"],"names":[],"mappings":";;;AAAA,+CAA2E;AAE3E,2EAAsE;AAGtE,SAAgB,+BAA+B,CAC7C,MAA+B;IAE/B,OAAO,IAAA,mDAAuB,EAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;QAChD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO;YAAE,OAAO,IAAI,CAAC;QAC1C,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YAC5D,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,MAAM,CAAC;YAC7C,OAAO;gBACL,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,cAAc;aACJ,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;SACC,IAAI,EAAE;SACN,MAAM,CAAC,wCAAyB,CAAC,CAAC;AACvC,CAAC;AAfD,0EAeC"}
@@ -0,0 +1,6 @@
1
+ export { createMfRuntimeCode } from './create-mf-runtime-code';
2
+ export { extractFederatedDependencyPairs } from './extract-federated-dependency-pairs';
3
+ export { isModuleFederationPlugin } from './is-module-federation-plugin';
4
+ export { iterateFederationConfig } from './iterate-federation-config';
5
+ export { makeCopyOfModuleFederationOptions } from './make-copy-of-module-federation-options';
6
+ export { mutWebpackFederatedRemotesConfig } from './mut-webpack-federated-remotes-config';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mutWebpackFederatedRemotesConfig = exports.makeCopyOfModuleFederationOptions = exports.iterateFederationConfig = exports.isModuleFederationPlugin = exports.extractFederatedDependencyPairs = exports.createMfRuntimeCode = void 0;
4
+ var create_mf_runtime_code_1 = require("./create-mf-runtime-code");
5
+ Object.defineProperty(exports, "createMfRuntimeCode", { enumerable: true, get: function () { return create_mf_runtime_code_1.createMfRuntimeCode; } });
6
+ var extract_federated_dependency_pairs_1 = require("./extract-federated-dependency-pairs");
7
+ Object.defineProperty(exports, "extractFederatedDependencyPairs", { enumerable: true, get: function () { return extract_federated_dependency_pairs_1.extractFederatedDependencyPairs; } });
8
+ var is_module_federation_plugin_1 = require("./is-module-federation-plugin");
9
+ Object.defineProperty(exports, "isModuleFederationPlugin", { enumerable: true, get: function () { return is_module_federation_plugin_1.isModuleFederationPlugin; } });
10
+ var iterate_federation_config_1 = require("./iterate-federation-config");
11
+ Object.defineProperty(exports, "iterateFederationConfig", { enumerable: true, get: function () { return iterate_federation_config_1.iterateFederationConfig; } });
12
+ var make_copy_of_module_federation_options_1 = require("./make-copy-of-module-federation-options");
13
+ Object.defineProperty(exports, "makeCopyOfModuleFederationOptions", { enumerable: true, get: function () { return make_copy_of_module_federation_options_1.makeCopyOfModuleFederationOptions; } });
14
+ var mut_webpack_federated_remotes_config_1 = require("./mut-webpack-federated-remotes-config");
15
+ Object.defineProperty(exports, "mutWebpackFederatedRemotesConfig", { enumerable: true, get: function () { return mut_webpack_federated_remotes_config_1.mutWebpackFederatedRemotesConfig; } });
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/xpack-extract/index.ts"],"names":[],"mappings":";;;AAAA,mEAA+D;AAAtD,6HAAA,mBAAmB,OAAA;AAC5B,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,5 @@
1
+ import { ModuleFederationPlugin, XPackConfiguration } from '../xpack.types';
2
+ /** @private */
3
+ type __webpack_plugin__ = NonNullable<XPackConfiguration<any>['plugins']>[number];
4
+ export declare function isModuleFederationPlugin(plugin?: __webpack_plugin__): plugin is ModuleFederationPlugin;
5
+ export {};
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isModuleFederationPlugin = void 0;
4
+ function isModuleFederationPlugin(plugin) {
5
+ if (!plugin || typeof plugin !== 'object')
6
+ return false;
7
+ if (typeof plugin.constructor.name?.includes === 'function' &&
8
+ plugin.constructor.name?.includes('ModuleFederationPlugin')) {
9
+ return true;
10
+ }
11
+ return Boolean(plugin['name']?.includes && plugin['name']?.includes('ModuleFederationPlugin'));
12
+ }
13
+ exports.isModuleFederationPlugin = isModuleFederationPlugin;
14
+ //# sourceMappingURL=is-module-federation-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-module-federation-plugin.js","sourceRoot":"","sources":["../../src/xpack-extract/is-module-federation-plugin.ts"],"names":[],"mappings":";;;AAKA,SAAgB,wBAAwB,CACtC,MAA2B;IAE3B,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAExD,IACE,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,KAAK,UAAU;QACvD,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,wBAAwB,CAAC,EAC3D,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,OAAO,CACZ,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,wBAAwB,CAAC,CAC/E,CAAC;AACJ,CAAC;AAfD,4DAeC"}
@@ -0,0 +1,2 @@
1
+ import { ModuleFederationPlugin, XPackConfiguration } from '../xpack.types';
2
+ export declare function iterateFederationConfig<T, Compiler>(config: XPackConfiguration<Compiler>, for_plugin: (plugin: ModuleFederationPlugin) => T): T[];
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.iterateFederationConfig = void 0;
4
+ const is_module_federation_plugin_1 = require("./is-module-federation-plugin");
5
+ function iterateFederationConfig(config, for_plugin) {
6
+ const results = [];
7
+ if (!config.plugins) {
8
+ return results;
9
+ }
10
+ for (const plugin of config.plugins) {
11
+ if ((0, is_module_federation_plugin_1.isModuleFederationPlugin)(plugin)) {
12
+ results.push(for_plugin(plugin));
13
+ }
14
+ }
15
+ return results;
16
+ }
17
+ exports.iterateFederationConfig = iterateFederationConfig;
18
+ //# sourceMappingURL=iterate-federation-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iterate-federation-config.js","sourceRoot":"","sources":["../../src/xpack-extract/iterate-federation-config.ts"],"names":[],"mappings":";;;AAAA,+EAAyE;AAGzE,SAAgB,uBAAuB,CACrC,MAAoC,EACpC,UAAiD;IAEjD,MAAM,OAAO,GAAQ,EAAE,CAAC;IACxB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACpC,IAAI,IAAA,sDAAwB,EAAC,MAAM,CAAC,EAAE,CAAC;YACrC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAfD,0DAeC"}
@@ -0,0 +1,2 @@
1
+ import { ModuleFederationPlugin, XPackConfiguration } from '../xpack.types';
2
+ export declare function makeCopyOfModuleFederationOptions<Compiler>(config: XPackConfiguration<Compiler>): ModuleFederationPlugin[] | undefined;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeCopyOfModuleFederationOptions = void 0;
4
+ const iterate_federation_config_1 = require("./iterate-federation-config");
5
+ function makeCopyOfModuleFederationOptions(config) {
6
+ return (0, iterate_federation_config_1.iterateFederationConfig)(config, (plugin) => {
7
+ return JSON.parse(JSON.stringify(plugin._options));
8
+ });
9
+ }
10
+ exports.makeCopyOfModuleFederationOptions = makeCopyOfModuleFederationOptions;
11
+ //# sourceMappingURL=make-copy-of-module-federation-options.js.map
@@ -0,0 +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,QAAQ,CAAC,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC;AAND,8EAMC"}
@@ -0,0 +1,3 @@
1
+ import { type ZeResolvedDependency } from 'zephyr-agent';
2
+ import { XPackConfiguration } from '../xpack.types';
3
+ export declare function mutWebpackFederatedRemotesConfig<Compiler>(config: XPackConfiguration<Compiler>, resolvedDependencyPairs: ZeResolvedDependency[] | null): void;