zephyr-repack-plugin 0.0.0-canary-20241122175815 → 0.0.0-canary-20250121101024

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/README.md +3 -0
  2. package/dist/delegate-module/delegate-module-template.d.ts +1 -1
  3. package/dist/delegate-module/delegate-module-template.js +8 -4
  4. package/dist/delegate-module/delegate-module-template.js.map +1 -1
  5. package/dist/lib/utils/get-platform.d.ts +4 -0
  6. package/dist/lib/utils/get-platform.js +10 -3
  7. package/dist/lib/utils/get-platform.js.map +1 -1
  8. package/dist/lib/utils/ze-util-verification.d.ts +21 -0
  9. package/dist/lib/utils/ze-util-verification.js +40 -0
  10. package/dist/lib/utils/ze-util-verification.js.map +1 -0
  11. package/dist/lib/with-zephyr.d.ts +2 -2
  12. package/dist/lib/with-zephyr.js +31 -43
  13. package/dist/lib/with-zephyr.js.map +1 -1
  14. package/dist/lib/ze-repack-plugin.d.ts +6 -2
  15. package/dist/lib/ze-repack-plugin.js +4 -5
  16. package/dist/lib/ze-repack-plugin.js.map +1 -1
  17. package/dist/package.json +3 -5
  18. package/dist/type/zephyr-internal-types.d.ts +0 -18
  19. package/package.json +4 -6
  20. package/dist/delegate-module/replace-remote-with-delegate.d.ts +0 -2
  21. package/dist/delegate-module/replace-remote-with-delegate.js +0 -29
  22. package/dist/delegate-module/replace-remote-with-delegate.js.map +0 -1
  23. package/dist/delegate-module/zephyr-delegate.d.ts +0 -2
  24. package/dist/delegate-module/zephyr-delegate.js +0 -153
  25. package/dist/delegate-module/zephyr-delegate.js.map +0 -1
  26. package/dist/lib/build-stats/get-build-stats.d.ts +0 -3
  27. package/dist/lib/build-stats/get-build-stats.js +0 -62
  28. package/dist/lib/build-stats/get-build-stats.js.map +0 -1
  29. package/dist/lib/dependency-resolution/replace-remote-with-delegates.d.ts +0 -3
  30. package/dist/lib/dependency-resolution/replace-remote-with-delegates.js +0 -26
  31. package/dist/lib/dependency-resolution/replace-remote-with-delegates.js.map +0 -1
  32. package/dist/lib/federation-graph/compute-dependencies.d.ts +0 -10
  33. package/dist/lib/federation-graph/compute-dependencies.js +0 -73
  34. package/dist/lib/federation-graph/compute-dependencies.js.map +0 -1
  35. package/dist/lib/federation-graph/compute-version.d.ts +0 -4
  36. package/dist/lib/federation-graph/compute-version.js +0 -22
  37. package/dist/lib/federation-graph/compute-version.js.map +0 -1
  38. package/dist/lib/federation-graph/federation-plugin.d.ts +0 -54
  39. package/dist/lib/federation-graph/federation-plugin.js +0 -233
  40. package/dist/lib/federation-graph/federation-plugin.js.map +0 -1
  41. package/dist/lib/federation-graph/runtime-requirement.d.ts +0 -4
  42. package/dist/lib/federation-graph/runtime-requirement.js +0 -28
  43. package/dist/lib/federation-graph/runtime-requirement.js.map +0 -1
  44. package/dist/lib/federation-graph/utils/convert-dependencies.d.ts +0 -12
  45. package/dist/lib/federation-graph/utils/convert-dependencies.js +0 -31
  46. package/dist/lib/federation-graph/utils/convert-dependencies.js.map +0 -1
  47. package/dist/lib/federation-graph/utils/convert-to-graph.d.ts +0 -3
  48. package/dist/lib/federation-graph/utils/convert-to-graph.js +0 -53
  49. package/dist/lib/federation-graph/utils/convert-to-graph.js.map +0 -1
  50. package/dist/lib/federation-graph/utils/converted-dependencies.d.ts +0 -12
  51. package/dist/lib/federation-graph/utils/converted-dependencies.js +0 -31
  52. package/dist/lib/federation-graph/utils/converted-dependencies.js.map +0 -1
  53. package/dist/lib/federation-graph/utils/get-licenses.d.ts +0 -2
  54. package/dist/lib/federation-graph/utils/get-licenses.js +0 -25
  55. package/dist/lib/federation-graph/utils/get-licenses.js.map +0 -1
  56. package/dist/lib/federation-graph/utils/module-part-one.d.ts +0 -33
  57. package/dist/lib/federation-graph/utils/module-part-one.js +0 -138
  58. package/dist/lib/federation-graph/utils/module-part-one.js.map +0 -1
  59. package/dist/lib/federation-graph/utils/module-part-two.d.ts +0 -52
  60. package/dist/lib/federation-graph/utils/module-part-two.js +0 -150
  61. package/dist/lib/federation-graph/utils/module-part-two.js.map +0 -1
  62. package/dist/lib/federation-graph/utils/process-function-remotes.d.ts +0 -24
  63. package/dist/lib/federation-graph/utils/process-function-remotes.js +0 -35
  64. package/dist/lib/federation-graph/utils/process-function-remotes.js.map +0 -1
  65. package/dist/lib/federation-graph/validate-params.d.ts +0 -0
  66. package/dist/lib/federation-graph/validate-params.js +0 -2
  67. package/dist/lib/federation-graph/validate-params.js.map +0 -1
  68. package/dist/lib/repack_zephyr_agent.d.ts +0 -10
  69. package/dist/lib/repack_zephyr_agent.js +0 -58
  70. package/dist/lib/repack_zephyr_agent.js.map +0 -1
  71. package/dist/lib/set-up-build-id.d.ts +0 -3
  72. package/dist/lib/set-up-build-id.js +0 -36
  73. package/dist/lib/set-up-build-id.js.map +0 -1
  74. package/dist/lib/set-up-build-stats-logging.d.ts +0 -5
  75. package/dist/lib/set-up-build-stats-logging.js +0 -24
  76. package/dist/lib/set-up-build-stats-logging.js.map +0 -1
  77. package/dist/lib/set-up-deploy.d.ts +0 -3
  78. package/dist/lib/set-up-deploy.js +0 -35
  79. package/dist/lib/set-up-deploy.js.map +0 -1
  80. package/dist/lib/utils/federation-plugin-get-package-json.d.ts +0 -1
  81. package/dist/lib/utils/federation-plugin-get-package-json.js +0 -23
  82. package/dist/lib/utils/federation-plugin-get-package-json.js.map +0 -1
  83. package/dist/lib/utils/get-mf-config.d.ts +0 -9
  84. package/dist/lib/utils/get-mf-config.js +0 -24
  85. package/dist/lib/utils/get-mf-config.js.map +0 -1
  86. package/dist/lib/utils/plugin-search.d.ts +0 -11
  87. package/dist/lib/utils/plugin-search.js +0 -19
  88. package/dist/lib/utils/plugin-search.js.map +0 -1
  89. package/dist/type/convert-graph-params.d.ts +0 -63
  90. package/dist/type/convert-graph-params.js +0 -3
  91. package/dist/type/convert-graph-params.js.map +0 -1
  92. package/dist/type/federation-plugin-options.d.ts +0 -62
  93. package/dist/type/federation-plugin-options.js +0 -3
  94. package/dist/type/federation-plugin-options.js.map +0 -1
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBuildStats = void 0;
4
- const tslib_1 = require("tslib");
5
- const isCI = tslib_1.__importStar(require("is-ci"));
6
- const zephyr_edge_contract_1 = require("zephyr-edge-contract");
7
- const federation_plugin_1 = require("../federation-graph/federation-plugin");
8
- const zephyr_agent_1 = require("zephyr-agent");
9
- async function getBuildStats({ stats, stats_json, pluginOptions, }) {
10
- (0, zephyr_agent_1.ze_log)('Started getting build stats...');
11
- const dashboardPlugin = new federation_plugin_1.FederationDashboardPlugin({
12
- app: pluginOptions.app,
13
- git: pluginOptions.git,
14
- context: {
15
- isCI,
16
- },
17
- target: pluginOptions.target,
18
- });
19
- (0, zephyr_agent_1.ze_log)('process webpack graph...');
20
- const convertedGraph = dashboardPlugin.processRspackGraph({
21
- stats,
22
- stats_json,
23
- pluginOptions,
24
- });
25
- if (!convertedGraph) {
26
- throw new zephyr_agent_1.ZephyrError(zephyr_agent_1.ZeErrors.ERR_CONVERT_GRAPH_TO_DASHBOARD);
27
- }
28
- const build_id = await pluginOptions.zephyr_engine.build_id;
29
- const app_config = await pluginOptions.zephyr_engine.application_configuration;
30
- const version = (0, zephyr_edge_contract_1.flatCreateSnapshotId)({
31
- org: pluginOptions.app.org,
32
- project: pluginOptions.app.project,
33
- name: pluginOptions.app.name,
34
- username: app_config.username,
35
- buildId: build_id,
36
- });
37
- const remote_name = pluginOptions.mfConfig?.filename ?? 'mf-manifest.json';
38
- const { app, git } = pluginOptions;
39
- const data_overrides = {
40
- id: pluginOptions.application_uid,
41
- name: pluginOptions.mfConfig?.name,
42
- edge: { url: app_config.EDGE_URL },
43
- app: Object.assign({}, app, { buildId: build_id }),
44
- version,
45
- git,
46
- project: pluginOptions.app.project,
47
- tags: [],
48
- remote: remote_name,
49
- remotes: Object.keys(pluginOptions.mfConfig?.remotes || {}),
50
- context: {
51
- isCI: pluginOptions.zephyr_engine.env.isCI,
52
- },
53
- build_target: pluginOptions.target,
54
- };
55
- // todo: extend data
56
- // @ts-expect-error incompatible types
57
- const res = Object.assign({}, convertedGraph, data_overrides);
58
- (0, zephyr_agent_1.ze_log)('get build stats done.', res);
59
- return res;
60
- }
61
- exports.getBuildStats = getBuildStats;
62
- //# sourceMappingURL=get-build-stats.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-build-stats.js","sourceRoot":"","sources":["../../../src/lib/build-stats/get-build-stats.ts"],"names":[],"mappings":";;;;AAAA,oDAA8B;AAC9B,+DAA4D;AAE5D,6EAAkF;AAElF,+CAA6D;AAEtD,KAAK,UAAU,aAAa,CAAC,EAClC,KAAK,EACL,UAAU,EACV,aAAa,GACI;IACjB,IAAA,qBAAM,EAAC,gCAAgC,CAAC,CAAC;IAEzC,MAAM,eAAe,GAAG,IAAI,6CAAyB,CAAC;QACpD,GAAG,EAAE,aAAa,CAAC,GAAG;QACtB,GAAG,EAAE,aAAa,CAAC,GAAG;QACtB,OAAO,EAAE;YACP,IAAI;SACL;QACD,MAAM,EAAE,aAAa,CAAC,MAAM;KAC7B,CAAC,CAAC;IAEH,IAAA,qBAAM,EAAC,0BAA0B,CAAC,CAAC;IACnC,MAAM,cAAc,GAAG,eAAe,CAAC,kBAAkB,CAAC;QACxD,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;IACD,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,aAAa,CAAC,QAAS,CAAC;IAC7D,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAE/E,MAAM,OAAO,GAAG,IAAA,2CAAoB,EAAC;QACnC,GAAG,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG;QAC1B,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,OAAO;QAClC,IAAI,EAAE,aAAa,CAAC,GAAG,CAAC,IAAI;QAC5B,QAAQ,EAAE,UAAU,CAAC,QAAQ;QAC7B,OAAO,EAAE,QAAQ;KAClB,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,aAAa,CAAC,QAAQ,EAAE,QAAQ,IAAI,kBAAkB,CAAC;IAE3E,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,aAAa,CAAC;IACnC,MAAM,cAAc,GAAG;QACrB,EAAE,EAAE,aAAa,CAAC,eAAe;QACjC,IAAI,EAAE,aAAa,CAAC,QAAQ,EAAE,IAAI;QAClC,IAAI,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,QAAQ,EAAE;QAClC,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;QAClD,OAAO;QACP,GAAG;QACH,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,OAAO;QAClC,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,WAAW;QACnB,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,IAAI,EAAE,CAAC;QAC3D,OAAO,EAAE;YACP,IAAI,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI;SAC3C;QACD,YAAY,EAAE,aAAa,CAAC,MAAM;KACnC,CAAC;IAEF,oBAAoB;IACpB,sCAAsC;IACtC,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,cAAc,EAAE,cAAc,CAAqB,CAAC;IAClF,IAAA,qBAAM,EAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;IACrC,OAAO,GAAG,CAAC;AACb,CAAC;AA9DD,sCA8DC"}
@@ -1,3 +0,0 @@
1
- import { Configuration } from '@rspack/core';
2
- import { DelegateConfig } from '../../type/zephyr-internal-types';
3
- export declare function replace_remote_with_delegates(_config: Configuration, { org, project, target }: DelegateConfig): Promise<void>;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replace_remote_with_delegates = void 0;
4
- const zephyr_delegate_1 = require("../../delegate-module/zephyr-delegate");
5
- const plugin_search_1 = require("../utils/plugin-search");
6
- const zephyr_agent_1 = require("zephyr-agent");
7
- async function replace_remote_with_delegates(_config, { org, project, target }) {
8
- (0, zephyr_agent_1.ze_log)('start replacing remote with delegate...');
9
- (0, zephyr_agent_1.ze_log)('config plugins:', _config.plugins?.length);
10
- // Set public path to auto to resolve the remote dependency prevent Repack from using their own public path, need to set this as soon as possible
11
- // Reference: https://github.com/callstack/repack/blob/3b1f6021c199559989502f9ade978f2690e958ff/packages/repack/src/utils/getPublicPath.ts#L38
12
- // TODO: this should only be done in a remote, not in the host
13
- //_config.output!.publicPath = 'auto'
14
- const mf_plugins = _config.plugins?.filter(plugin_search_1.is_module_federation_plugin) || [];
15
- (0, zephyr_agent_1.ze_log)('found module federation plugins:', mf_plugins.length);
16
- const dependency_resolution_tasks = mf_plugins.map((mfConfig) => {
17
- (0, zephyr_agent_1.ze_log)('does mfConfig._options exist?', mfConfig?.config);
18
- return (0, zephyr_delegate_1.replace_remote_in_mf_config)(mfConfig, { org, project, target });
19
- });
20
- if (dependency_resolution_tasks) {
21
- const dependency_resolution_result = await Promise.all(dependency_resolution_tasks);
22
- (0, zephyr_agent_1.ze_log)('dependency resolution completed successfully:', dependency_resolution_result);
23
- }
24
- }
25
- exports.replace_remote_with_delegates = replace_remote_with_delegates;
26
- //# sourceMappingURL=replace-remote-with-delegates.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"replace-remote-with-delegates.js","sourceRoot":"","sources":["../../../src/lib/dependency-resolution/replace-remote-with-delegates.ts"],"names":[],"mappings":";;;AACA,2EAAoF;AACpF,0DAAqE;AAErE,+CAAsC;AAE/B,KAAK,UAAU,6BAA6B,CACjD,OAAsB,EACtB,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAkB;IAExC,IAAA,qBAAM,EAAC,yCAAyC,CAAC,CAAC;IAClD,IAAA,qBAAM,EAAC,iBAAiB,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAEnD,iJAAiJ;IACjJ,8IAA8I;IAC9I,8DAA8D;IAC9D,qCAAqC;IAErC,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,2CAA2B,CAAC,IAAI,EAAE,CAAC;IAC9E,IAAA,qBAAM,EAAC,kCAAkC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAE9D,MAAM,2BAA2B,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,QAAa,EAAE,EAAE;QACnE,IAAA,qBAAM,EAAC,+BAA+B,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC1D,OAAO,IAAA,6CAA2B,EAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;IAEH,IAAI,2BAA2B,EAAE,CAAC;QAChC,MAAM,4BAA4B,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;QACpF,IAAA,qBAAM,EAAC,+CAA+C,EAAE,4BAA4B,CAAC,CAAC;IACxF,CAAC;AACH,CAAC;AAxBD,sEAwBC"}
@@ -1,10 +0,0 @@
1
- import { TopLevelPackage } from '../../type/federation-plugin-options';
2
- interface ComputeDependenciesFederationOptions {
3
- exclude: string[];
4
- ignoreVersion?: string[] | boolean;
5
- packageJson: Record<string, any>;
6
- ignorePatchVersion?: boolean;
7
- shareFrom?: (keyof TopLevelPackage)[];
8
- }
9
- declare const ComputeSharedDependenciesFederation: ({ exclude, ignoreVersion, packageJson, ignorePatchVersion, shareFrom, }: ComputeDependenciesFederationOptions) => Record<string, string>;
10
- export default ComputeSharedDependenciesFederation;
@@ -1,73 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const find_package_json_1 = tslib_1.__importDefault(require("find-package-json"));
5
- const path = tslib_1.__importStar(require("path"));
6
- const fs = tslib_1.__importStar(require("fs"));
7
- const zephyr_agent_1 = require("zephyr-agent");
8
- const ComputeSharedDependenciesFederation = ({ exclude, ignoreVersion, packageJson, ignorePatchVersion = true, shareFrom = ['dependencies'], }) => {
9
- if (!packageJson) {
10
- throw new Error('ComputeDependencyFederation: You must pass the package.json file of your app');
11
- }
12
- if (!Array.isArray(shareFrom)) {
13
- throw new Error('ComputeDependencyFederation: shareFrom must be an array');
14
- }
15
- // Combine dependencies from specified package.json keys
16
- const combinedDependencies = shareFrom.reduce((acc, jsonKey) => {
17
- Object.assign(acc, packageJson[jsonKey]);
18
- return acc;
19
- }, {});
20
- // Filter dependencies based on exclusion list
21
- const shareableDependencies = Object.keys(combinedDependencies).filter((dependency) => !exclude.some((dep) => dependency.includes(dep)));
22
- return shareableDependencies.reduce((shared, pkg) => {
23
- let packageVersion;
24
- try {
25
- const packagePath = path.dirname(require.resolve(pkg));
26
- const packageJsonPath = path.join(packagePath, 'package.json');
27
- const packageExists = fs.existsSync(packageJsonPath);
28
- if (packageExists) {
29
- try {
30
- // eslint-disable-next-line @typescript-eslint/no-var-requires
31
- packageVersion = require(packageJsonPath).version.split('.');
32
- }
33
- catch (e) {
34
- throw new zephyr_agent_1.ZephyrError(zephyr_agent_1.ZeErrors.ERR_SHARED_PACKAGE, {
35
- cause: "We couldn't find Federation shared package's version - are you sure this is a valid package installed from npm registry?",
36
- });
37
- }
38
- }
39
- else {
40
- const f = (0, find_package_json_1.default)(packagePath);
41
- const jsonValue = f.next().value;
42
- const filePath = f.next().filename;
43
- if (!filePath || typeof filePath !== 'string') {
44
- (0, zephyr_agent_1.ze_log)("Package.json path not found - we couldn't find package.");
45
- }
46
- // eslint-disable-next-line @typescript-eslint/no-var-requires
47
- packageVersion = require(filePath).version.split('.');
48
- }
49
- if (ignorePatchVersion && packageVersion) {
50
- packageVersion.pop();
51
- }
52
- const versionedPkgName = packageVersion
53
- ? `${pkg}-${packageVersion.join('.')}`
54
- : pkg;
55
- if (ignoreVersion &&
56
- Array.isArray(ignoreVersion) &&
57
- ignoreVersion.includes(pkg)) {
58
- shared[pkg] = pkg;
59
- }
60
- else {
61
- shared[versionedPkgName] = pkg;
62
- }
63
- }
64
- catch (e) {
65
- // Skip package if there's an error
66
- (0, zephyr_agent_1.ze_log)(`Error during finding Federation required shared package: `, e, 'Skipping package to next...');
67
- return shared;
68
- }
69
- return shared;
70
- }, {});
71
- };
72
- exports.default = ComputeSharedDependenciesFederation;
73
- //# sourceMappingURL=compute-dependencies.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compute-dependencies.js","sourceRoot":"","sources":["../../../src/lib/federation-graph/compute-dependencies.ts"],"names":[],"mappings":";;;AAAA,kFAAqC;AACrC,mDAA6B;AAC7B,+CAAyB;AAEzB,+CAA6D;AAY7D,MAAM,mCAAmC,GAAG,CAAC,EAC3C,OAAO,EACP,aAAa,EACb,WAAW,EACX,kBAAkB,GAAG,IAAI,EACzB,SAAS,GAAG,CAAC,cAAc,CAAC,GACS,EAA0B,EAAE;IACjE,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,8EAA8E,CAC/E,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IAED,wDAAwD;IACxD,MAAM,oBAAoB,GAAG,SAAS,CAAC,MAAM,CAC3C,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;QACf,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;QACzC,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAAyB,CAC1B,CAAC;IAEF,8CAA8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AAC,yDAAyD,CAAC,CAAC;gBACpE,CAAC;gBACD,8DAA8D;gBAC9D,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACxD,CAAC;YAED,IAAI,kBAAkB,IAAI,cAAc,EAAE,CAAC;gBACzC,cAAc,CAAC,GAAG,EAAE,CAAC;YACvB,CAAC;YAED,MAAM,gBAAgB,GAAG,cAAc;gBACrC,CAAC,CAAC,GAAG,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBACtC,CAAC,CAAC,GAAG,CAAC;YAER,IACE,aAAa;gBACb,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC;gBAC5B,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,EAC3B,CAAC;gBACD,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;YACpB,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,gBAAgB,CAAC,GAAG,GAAG,CAAC;YACjC,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,mCAAmC;YACnC,IAAA,qBAAM,EACJ,2DAA2D,EAC3D,CAAC,EACD,6BAA6B,CAC9B,CAAC;YACF,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,EACD,EAA4B,CAC7B,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,mCAAmC,CAAC"}
@@ -1,4 +0,0 @@
1
- export declare let gitSha: string | undefined;
2
- export declare const computeVersionStrategy: (stats: {
3
- hash?: string;
4
- }, arg: string | undefined) => string | undefined;
@@ -1,22 +0,0 @@
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.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compute-version.js","sourceRoot":"","sources":["../../../src/lib/federation-graph/compute-version.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,KAAwB,EACxB,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;AAZW,QAAA,sBAAsB,0BAYjC"}
@@ -1,54 +0,0 @@
1
- import { Chunk, Compiler, Exposes, Remotes, Stats, StatsChunk, StatsCompilation } from '@rspack/core';
2
- import { ConvertedGraph, ZeUploadBuildStats } from 'zephyr-edge-contract';
3
- import { FederationDashboardPluginOptions, ProcessRspackGraphParams, TopLevelPackage } from '../../type/federation-plugin-options';
4
- export declare class FederationDashboardPlugin {
5
- _options: FederationDashboardPluginOptions;
6
- _data: string | undefined;
7
- allArgumentsUsed: [file: string, applicationID: string, name: string][];
8
- FederationPluginOptions: {
9
- name?: string;
10
- remotes?: Remotes;
11
- filename?: string;
12
- exposes?: Exposes;
13
- /** The actual bundle name updated to metadata */
14
- bundle_name?: string;
15
- };
16
- constructor(options: Partial<FederationDashboardPluginOptions>);
17
- /** @param {Compiler} compiler */
18
- apply(compiler: Compiler): void;
19
- processRspackGraph({ stats, stats_json, pluginOptions, }: ProcessRspackGraphParams): ConvertedGraph | undefined;
20
- getRemoteEntryChunk(stats: StatsCompilation, FederationPluginOptions: typeof this.FederationPluginOptions): StatsChunk | undefined;
21
- /**
22
- * Return { "main": [{...dep1Details}, {...dep2Details}], "vendor": [{...dep3Details}],
23
- *
24
- * 1. Useful for dynamic imports - object generated could inform the bundler or runtime
25
- * loader about which chunks are needed for specific part of the app, enabling better
26
- * performance optimization 1.1 if a chunk representing a React component dynamically
27
- * loads, this dependency graph can help the runtime understand what other chunks
28
- * need to be loaded alongside it.
29
- * 2. Optimized loading and caching: By mapping chunk dependencies, this function supports
30
- * advanced optimizations like caching. Chunks that haven’t changed between builds
31
- * can be cached separately, reducing the need for users to download unchanged code.
32
- *
33
- * }
34
- */
35
- getChunkDependencies(validChunkArray: Chunk[]): Record<string, never>;
36
- buildVendorFederationMap(liveStats: Stats): TopLevelPackage;
37
- mapToObjectRec(m: Record<string, Chunk[keyof Chunk]> | Map<string, Chunk[keyof Chunk]> | Chunk[keyof Chunk][]): Record<string, unknown>;
38
- /**
39
- * In a remote application, this function is used to find all the chunks that are
40
- * referenced by the remote entry chunk It won't return anything from HostApp
41
- */
42
- buildValidChunkArray(liveStats: Stats, FederationPluginOptions: typeof this.FederationPluginOptions): Chunk[];
43
- /**
44
- * We are doing this because the filename in React Native is the actual JS bundle, "How
45
- * we understand the filename is different in react native" - filename would be at the
46
- * end of the URL modified in get_mf_config.ts If we don't attach the remote bundle name
47
- * to metadata, we will have no track record of the actual bundle when we need it later
48
- * -- this is RePack specific.
49
- */
50
- attach_remote_bundle_name_to_metadata(): Record<string, string> | undefined;
51
- postDashboardData(dashData: any): Promise<{
52
- value: ZeUploadBuildStats;
53
- } | undefined>;
54
- }
@@ -1,233 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FederationDashboardPlugin = void 0;
4
- const tslib_1 = require("tslib");
5
- const path_1 = require("path");
6
- const compute_version_1 = require("./compute-version");
7
- const runtime_requirement_1 = require("./runtime-requirement");
8
- const plugin_search_1 = require("../utils/plugin-search");
9
- const federation_plugin_get_package_json_1 = require("../utils/federation-plugin-get-package-json");
10
- const compute_dependencies_1 = tslib_1.__importDefault(require("./compute-dependencies"));
11
- const convert_to_graph_1 = require("./utils/convert-to-graph");
12
- const zephyr_agent_1 = require("zephyr-agent");
13
- const remote_entry_last_part = 'mf-manifest.json';
14
- class FederationDashboardPlugin {
15
- constructor(options) {
16
- this.allArgumentsUsed = [];
17
- this.FederationPluginOptions = {};
18
- this._options = Object.assign({
19
- debug: false, // TODO?
20
- useAST: false, // TODO?
21
- }, options);
22
- }
23
- /** @param {Compiler} compiler */
24
- apply(compiler) {
25
- compiler.options.output.uniqueName = `v${Date.now()}`; // TODO, use user_buildID version
26
- new runtime_requirement_1.AddRuntimeRequirementToPromiseExternal().apply(compiler);
27
- const FederationPlugin = compiler.options.plugins.find(plugin_search_1.is_module_federation_plugin);
28
- // If FederationPlugin doesn't exists this is a standalone app, we don't need to do anything
29
- this._options.standalone = typeof FederationPlugin === 'undefined';
30
- if (FederationPlugin) {
31
- this.FederationPluginOptions = Object.assign({}, FederationPlugin._options, this._options.standalone || {});
32
- }
33
- else if (this._options.standalone) {
34
- this.FederationPluginOptions = {};
35
- }
36
- else {
37
- throw new Error('Statistic plugin is missing Module Federation of standalone option');
38
- }
39
- }
40
- processRspackGraph({ stats, stats_json, pluginOptions, }) {
41
- this.FederationPluginOptions = Object.assign({}, this.FederationPluginOptions, pluginOptions.mfConfig);
42
- const RemoteEntryChunk = this.getRemoteEntryChunk(stats_json, this.FederationPluginOptions);
43
- const validChunkArray = this.buildValidChunkArray(stats, this.FederationPluginOptions);
44
- const chunkDependencies = this.getChunkDependencies(validChunkArray);
45
- const vendorFederation = this.buildVendorFederationMap(stats);
46
- // TODO: this type casting might not be every compilation result from rspack, but it's fine for now
47
- const getPlatformFromStats = stats.compilation
48
- .name;
49
- const remotes = this.FederationPluginOptions?.remotes
50
- ? Object.keys(this.FederationPluginOptions.remotes)
51
- : [];
52
- const rawData = {
53
- name: this.FederationPluginOptions?.name,
54
- remotes: remotes,
55
- metadata: this.attach_remote_bundle_name_to_metadata() || {},
56
- topLevelPackage: vendorFederation || {},
57
- publicPath: stats_json.publicPath,
58
- federationRemoteEntry: RemoteEntryChunk,
59
- buildHash: stats_json.hash,
60
- environment: this._options.environment || 'development', // 'development' if not specified
61
- version: (0, compute_version_1.computeVersionStrategy)(stats_json, this._options.versionStrategy),
62
- posted: this._options.posted || new Date(), // Date.now() if not specified
63
- group: this._options.group, // 'default' if not specified, prior history be "group" is our project name, in the future we might want to reuse this field in case project name is not in the same repository.
64
- sha: compute_version_1.gitSha,
65
- modules: stats_json.modules,
66
- chunkDependencies,
67
- functionRemotes: this.allArgumentsUsed,
68
- target: this._options.target ?? getPlatformFromStats,
69
- };
70
- let graphData;
71
- try {
72
- graphData = (0, convert_to_graph_1.convertToGraph)(rawData);
73
- (0, zephyr_agent_1.ze_log)('\n\n', 'graphData', graphData, '\n\n');
74
- }
75
- catch (err) {
76
- console.warn('Error during dashboard data processing..');
77
- console.warn(err);
78
- }
79
- if (!graphData) {
80
- return;
81
- }
82
- return graphData;
83
- }
84
- // TODO: add notes on why we need these and what does these do
85
- getRemoteEntryChunk(stats, FederationPluginOptions) {
86
- if (!stats.chunks)
87
- return;
88
- // TODO: print all chunk name and see if it has the bundle name or actual remote name. in Rspack this field would return in remote application but won't return in host application due to Rspack's data structure - need external PR to fix
89
- return stats.chunks.find((chunk) => chunk.names?.find((name) => name === FederationPluginOptions.name));
90
- }
91
- /**
92
- * Return { "main": [{...dep1Details}, {...dep2Details}], "vendor": [{...dep3Details}],
93
- *
94
- * 1. Useful for dynamic imports - object generated could inform the bundler or runtime
95
- * loader about which chunks are needed for specific part of the app, enabling better
96
- * performance optimization 1.1 if a chunk representing a React component dynamically
97
- * loads, this dependency graph can help the runtime understand what other chunks
98
- * need to be loaded alongside it.
99
- * 2. Optimized loading and caching: By mapping chunk dependencies, this function supports
100
- * advanced optimizations like caching. Chunks that haven’t changed between builds
101
- * can be cached separately, reducing the need for users to download unchanged code.
102
- *
103
- * }
104
- */
105
- getChunkDependencies(validChunkArray) {
106
- return validChunkArray.reduce((acc, chunk) => {
107
- // getAllReferencedChunks is used in rspack to understand the dependencies between chunks, the information is crucial for code splitting, lazy loading and ensuring all necessary code is included in final bundle
108
- // Return a `Set` <key:chunk, value:compilation>
109
- // to ensure no duplicate data is included
110
- // source: https://github.com/web-infra-dev/rspack/blob/9c56263c9d731923031f17ed20dae180c99256a7/packages/rspack/src/Chunk.ts#L151
111
- const subset = chunk.getAllReferencedChunks();
112
- const stringifiableChunk = Array.from(subset).map((sub) => {
113
- const cleanSet = Object.getOwnPropertyNames(sub).reduce((acc, key) => {
114
- // TODO: Is this the correct chunk to be excluded ?
115
- if (key === '_groups')
116
- return acc;
117
- return Object.assign(acc, { [key]: sub[key] });
118
- }, {});
119
- return this.mapToObjectRec(cleanSet);
120
- });
121
- return Object.assign(acc, {
122
- [`${chunk.id}`]: stringifiableChunk,
123
- });
124
- }, {});
125
- }
126
- buildVendorFederationMap(liveStats) {
127
- // calling it "vendor", it's actually dependencies in module federation
128
- const vendorFederation = {};
129
- let packageJson;
130
- if (this._options.packageJsonPath) {
131
- try {
132
- packageJson = require(this._options.packageJsonPath);
133
- }
134
- catch (e) {
135
- throw new zephyr_agent_1.ZephyrError(zephyr_agent_1.ZeErrors.ERR_PACKAGE_JSON_NOT_FOUND, {
136
- data: {
137
- process: `While finding dependencies in package.json.`,
138
- cause: e,
139
- },
140
- });
141
- }
142
- }
143
- else {
144
- const initialPath = liveStats.compilation.options.context?.split(path_1.sep);
145
- packageJson = (0, federation_plugin_get_package_json_1.find_package_json)(initialPath);
146
- }
147
- if (packageJson) {
148
- // TODO: make sure all passed in value are correct
149
- vendorFederation.dependencies = (0, compute_dependencies_1.default)({
150
- exclude: [],
151
- ignoreVersion: false,
152
- packageJson,
153
- shareFrom: ['dependencies'],
154
- ignorePatchVersion: false,
155
- });
156
- vendorFederation.devDependencies = (0, compute_dependencies_1.default)({
157
- exclude: [],
158
- ignoreVersion: false,
159
- packageJson,
160
- shareFrom: ['devDependencies'],
161
- ignorePatchVersion: false,
162
- });
163
- vendorFederation.optionalDependencies = (0, compute_dependencies_1.default)({
164
- exclude: [],
165
- ignoreVersion: false,
166
- packageJson,
167
- shareFrom: ['optionalDependencies'],
168
- ignorePatchVersion: false,
169
- });
170
- }
171
- return vendorFederation;
172
- }
173
- // Clean up the Chunks to a clear object with keys
174
- mapToObjectRec(m) {
175
- const lo = {};
176
- for (const [key, value] of Object.entries(m)) {
177
- if (value instanceof Map && value.size > 0) {
178
- lo[key] = this.mapToObjectRec(value);
179
- }
180
- else if (value instanceof Set && value.size > 0) {
181
- lo[key] = this.mapToObjectRec(Array.from(value));
182
- }
183
- else {
184
- lo[key] = value;
185
- }
186
- }
187
- return lo;
188
- }
189
- /**
190
- * In a remote application, this function is used to find all the chunks that are
191
- * referenced by the remote entry chunk It won't return anything from HostApp
192
- */
193
- buildValidChunkArray(liveStats, FederationPluginOptions) {
194
- if (!FederationPluginOptions.name)
195
- return [];
196
- const namedChunkRefs = liveStats.compilation.namedChunks.get(FederationPluginOptions.name);
197
- if (!namedChunkRefs)
198
- return [];
199
- const AllReferencedChunksByRemote = namedChunkRefs.getAllReferencedChunks();
200
- const validChunkArray = [];
201
- Array.from(AllReferencedChunksByRemote).map((chunk) => {
202
- if (chunk.id !== FederationPluginOptions.name) {
203
- validChunkArray.push(chunk);
204
- }
205
- });
206
- return validChunkArray;
207
- }
208
- /**
209
- * We are doing this because the filename in React Native is the actual JS bundle, "How
210
- * we understand the filename is different in react native" - filename would be at the
211
- * end of the URL modified in get_mf_config.ts If we don't attach the remote bundle name
212
- * to metadata, we will have no track record of the actual bundle when we need it later
213
- * -- this is RePack specific.
214
- */
215
- attach_remote_bundle_name_to_metadata() {
216
- if (!this.FederationPluginOptions.exposes) {
217
- return;
218
- }
219
- // TODO: not sure if this error would break the build. Silently log it for now
220
- if (!this.FederationPluginOptions.bundle_name) {
221
- console.warn(zephyr_agent_1.ZeErrors.ERR_MF_CONFIG_MISSING_FILENAME);
222
- return;
223
- }
224
- return { remote_bundle_name: this.FederationPluginOptions.bundle_name };
225
- }
226
- // For debugging purpose?
227
- async postDashboardData(dashData // TODO: need stronger types
228
- ) {
229
- throw new Error('not implemented, override it');
230
- }
231
- }
232
- exports.FederationDashboardPlugin = FederationDashboardPlugin;
233
- //# sourceMappingURL=federation-plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"federation-plugin.js","sourceRoot":"","sources":["../../../src/lib/federation-graph/federation-plugin.ts"],"names":[],"mappings":";;;;AAAA,+BAA2B;AAY3B,uDAAmE;AAMnE,+DAA+E;AAC/E,0DAAqE;AACrE,oGAAgF;AAChF,0FAAmE;AAEnE,+DAA0D;AAC1D,+CAA6D;AAI7D,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AAElD,MAAa,yBAAyB;IAcpC,YAAY,OAAkD;QAX9D,qBAAgB,GAA0D,EAAE,CAAC;QAE7E,4BAAuB,GAOnB,EAAE,CAAC;QAGL,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAC3B;YACE,KAAK,EAAE,KAAK,EAAE,QAAQ;YACtB,MAAM,EAAE,KAAK,EAAE,QAAQ;SACxB,EACD,OAAO,CAC4B,CAAC;IACxC,CAAC;IAED,iCAAiC;IAEjC,KAAK,CAAC,QAAkB;QACtB,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,iCAAiC;QAExF,IAAI,4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AC7B,CAAC;QAEF,IAAI,CAAC,cAAc;YAAE,OAAO,EAAE,CAAC;QAE/B,MAAM,2BAA2B,GAAG,cAAc,CAAC,sBAAsB,EAAE,CAAC;QAE5E,MAAM,eAAe,GAAY,EAAE,CAAC;QAEpC,KAAK,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACpD,IAAI,KAAK,CAAC,EAAE,KAAK,uBAAuB,CAAC,IAAI,EAAE,CAAC;gBAC9C,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,eAAe,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACH,qCAAqC;QACnC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,CAAC;YAC1C,OAAO;QACT,CAAC;QACD,8EAA8E;QAC9E,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,WAAW,EAAE,CAAC;YAC9C,OAAO,CAAC,IAAI,CAAC,uBAAQ,CAAC,8BAA8B,CAAC,CAAC;YACtD,OAAO;QACT,CAAC;QAED,OAAO,EAAE,kBAAkB,EAAE,IAAI,CAAC,uBAAuB,CAAC,WAAW,EAAE,CAAC;IAC1E,CAAC;IAED,yBAAyB;IACzB,KAAK,CAAC,iBAAiB,CACrB,QAAa,CAAC,4BAA4B;;QAE1C,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;CACF;AAzTD,8DAyTC"}
@@ -1,4 +0,0 @@
1
- import { Compiler } from '@rspack/core';
2
- export declare class AddRuntimeRequirementToPromiseExternal {
3
- apply(compiler: Compiler): void;
4
- }
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AddRuntimeRequirementToPromiseExternal = void 0;
4
- class AddRuntimeRequirementToPromiseExternal {
5
- apply(compiler) {
6
- //
7
- compiler.hooks.compilation.tap('AddRuntimeRequirementToPromiseExternal', (compilation) => {
8
- // TODO: access runtime global
9
- const { RuntimeGlobals } = compiler.rspack;
10
- // compilation.outputOptions.trustedTypes are used in browser environment to ensure XSS attack, this won't be useful in React Native
11
- // reference: https://github.com/web-infra-dev/rspack/blob/52d7dcd48df764674f50e65b51297a7a697c15e7/packages/rspack/src/config/types.ts#L306
12
- if (compilation.outputOptions.trustedTypes) {
13
- compilation.hooks.additionalTreeRuntimeRequirements.tap('AddRuntimeRequirementToPromiseExternal', (chunk, set) => {
14
- if (chunk.externalType === 'promise') {
15
- set.add(RuntimeGlobals.loadScript);
16
- }
17
- });
18
- }
19
- // even if `trustedTypes` don't exists, there isn't an external type, load the script anyways
20
- // TODO: verify if this works
21
- compilation.hooks.additionalTreeRuntimeRequirements.tap('AddRuntimeRequirementToPromiseExternal', (chunk, set) => {
22
- set.add(RuntimeGlobals.loadScript);
23
- });
24
- });
25
- }
26
- }
27
- exports.AddRuntimeRequirementToPromiseExternal = AddRuntimeRequirementToPromiseExternal;
28
- //# sourceMappingURL=runtime-requirement.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-requirement.js","sourceRoot":"","sources":["../../../src/lib/federation-graph/runtime-requirement.ts"],"names":[],"mappings":";;;AACA,MAAa,sCAAsC;IACjD,KAAK,CAAC,QAAkB;QACtB,EAAE;QACF,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAC5B,wCAAwC,EACxC,CAAC,WAAwB,EAAE,EAAE;YAC3B,8BAA8B;YAC9B,MAAM,EAAE,cAAc,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC;YAC3C,oIAAoI;YACpI,4IAA4I;YAC5I,IAAI,WAAW,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC;gBAC3C,WAAW,CAAC,KAAK,CAAC,iCAAiC,CAAC,GAAG,CACrD,wCAAwC,EACxC,CAAC,KAAwC,EAAE,GAAG,EAAE,EAAE;oBAChD,IAAI,KAAK,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;wBACrC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;oBACrC,CAAC;gBACH,CAAC,CACF,CAAC;YACJ,CAAC;YAED,6FAA6F;YAC7F,6BAA6B;YAC7B,WAAW,CAAC,KAAK,CAAC,iCAAiC,CAAC,GAAG,CACrD,wCAAwC,EACxC,CAAC,KAAY,EAAE,GAAG,EAAE,EAAE;gBACpB,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;YACrC,CAAC,CACF,CAAC;QACJ,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AAhCD,wFAgCC"}
@@ -1,12 +0,0 @@
1
- import { TopLevelPackage } from '../../../type/federation-plugin-options';
2
- import { LocalPackageJson } from 'zephyr-edge-contract';
3
- export interface ConvertedDependencies {
4
- dependencies?: LocalPackageJson[];
5
- devDependencies?: LocalPackageJson[];
6
- optionalDependencies?: LocalPackageJson[];
7
- }
8
- export type NpmModules = Map<string, Record<string, LocalPackageJson>>;
9
- export declare function convertDependencies(params: {
10
- package: TopLevelPackage;
11
- npmModules: NpmModules;
12
- }): ConvertedDependencies;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertDependencies = void 0;
4
- function convertDependencies(params) {
5
- return {
6
- dependencies: convertDeps(params.npmModules, params.package.dependencies),
7
- devDependencies: convertDeps(params.npmModules, params.package.devDependencies),
8
- optionalDependencies: convertDeps(params.npmModules, params.package.optionalDependencies),
9
- };
10
- }
11
- exports.convertDependencies = convertDependencies;
12
- function convertDeps(npmModules, deps) {
13
- if (!deps)
14
- return;
15
- return Object.entries(deps).map(([version, name]) => {
16
- const dataFromGraph = npmModules.get(name);
17
- const versionVal = version.replace(`${name}-`, '');
18
- if (dataFromGraph) {
19
- const foundInGraph = Object.values(dataFromGraph).find((depData) => depData.version.startsWith(versionVal));
20
- if (foundInGraph) {
21
- const { name, version, license, size } = foundInGraph;
22
- return { name, version, license, size };
23
- }
24
- }
25
- return {
26
- name,
27
- version: versionVal,
28
- };
29
- });
30
- }
31
- //# sourceMappingURL=convert-dependencies.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"convert-dependencies.js","sourceRoot":"","sources":["../../../../src/lib/federation-graph/utils/convert-dependencies.ts"],"names":[],"mappings":";;;AAWA,SAAgB,mBAAmB,CAAC,MAGnC;IACC,OAAO;QACL,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC;QACzE,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC;QAC/E,oBAAoB,EAAE,WAAW,CAC/B,MAAM,CAAC,UAAU,EACjB,MAAM,CAAC,OAAO,CAAC,oBAAoB,CACpC;KACF,CAAC;AACJ,CAAC;AAZD,kDAYC;AAED,SAAS,WAAW,CAClB,UAAsB,EACtB,IAA6B;IAE7B,IAAI,CAAC,IAAI;QAAE,OAAO;IAElB,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;QAClD,MAAM,aAAa,GAAG,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAE3C,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,EAAE,EAAE,CAAC,CAAC;QAEnD,IAAI,aAAa,EAAE,CAAC;YAClB,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CACjE,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CACvC,CAAC;YAEF,IAAI,YAAY,EAAE,CAAC;gBACjB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,YAAY,CAAC;gBACtD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YAC1C,CAAC;QACH,CAAC;QAED,OAAO;YACL,IAAI;YACJ,OAAO,EAAE,UAAU;SACpB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,3 +0,0 @@
1
- import { ConvertToGraphParams } from '../../../type/convert-graph-params';
2
- import { ConvertedGraph } from 'zephyr-edge-contract';
3
- export declare function convertToGraph(params: ConvertToGraphParams): ConvertedGraph;