@nx/rspack 19.6.0 → 19.7.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 (111) hide show
  1. package/executors.json +20 -0
  2. package/migrations.json +17 -0
  3. package/module-federation.d.ts +1 -0
  4. package/module-federation.js +5 -0
  5. package/module-federation.js.map +1 -0
  6. package/package.json +9 -4
  7. package/src/executors/dev-server/dev-server.impl.d.ts +4 -1
  8. package/src/executors/dev-server/dev-server.impl.js +18 -10
  9. package/src/executors/dev-server/dev-server.impl.js.map +1 -1
  10. package/src/executors/dev-server/lib/get-dev-server-config.d.ts +4 -0
  11. package/src/executors/dev-server/lib/get-dev-server-config.js +71 -0
  12. package/src/executors/dev-server/lib/get-dev-server-config.js.map +1 -0
  13. package/src/executors/dev-server/lib/serve-path.d.ts +3 -0
  14. package/src/executors/dev-server/lib/serve-path.js +45 -0
  15. package/src/executors/dev-server/lib/serve-path.js.map +1 -0
  16. package/src/executors/dev-server/schema.d.ts +5 -1
  17. package/src/executors/dev-server/schema.json +30 -2
  18. package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +6 -0
  19. package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +166 -0
  20. package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js.map +1 -0
  21. package/src/executors/module-federation-dev-server/schema.d.ts +18 -0
  22. package/src/executors/module-federation-dev-server/schema.json +100 -0
  23. package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +21 -0
  24. package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +209 -0
  25. package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js.map +1 -0
  26. package/src/executors/module-federation-ssr-dev-server/schema.json +82 -0
  27. package/src/executors/module-federation-static-server/module-federation-static-server.impl.d.ts +12 -0
  28. package/src/executors/module-federation-static-server/module-federation-static-server.impl.js +252 -0
  29. package/src/executors/module-federation-static-server/module-federation-static-server.impl.js.map +1 -0
  30. package/src/executors/module-federation-static-server/schema.d.ts +3 -0
  31. package/src/executors/module-federation-static-server/schema.json +14 -0
  32. package/src/executors/rspack/rspack.impl.js +3 -3
  33. package/src/executors/rspack/rspack.impl.js.map +1 -1
  34. package/src/executors/rspack/schema.d.ts +10 -1
  35. package/src/executors/rspack/schema.json +61 -7
  36. package/src/executors/ssr-dev-server/lib/wait-until-server-is-listening.d.ts +1 -0
  37. package/src/executors/ssr-dev-server/lib/wait-until-server-is-listening.js +40 -0
  38. package/src/executors/ssr-dev-server/lib/wait-until-server-is-listening.js.map +1 -0
  39. package/src/executors/ssr-dev-server/schema.d.ts +11 -0
  40. package/src/executors/ssr-dev-server/schema.json +39 -0
  41. package/src/executors/ssr-dev-server/ssr-dev-server.impl.d.ts +8 -0
  42. package/src/executors/ssr-dev-server/ssr-dev-server.impl.js +52 -0
  43. package/src/executors/ssr-dev-server/ssr-dev-server.impl.js.map +1 -0
  44. package/src/generators/application/application.js +2 -2
  45. package/src/generators/application/application.js.map +1 -1
  46. package/src/utils/create-compiler.d.ts +3 -1
  47. package/src/utils/create-compiler.js +12 -2
  48. package/src/utils/create-compiler.js.map +1 -1
  49. package/src/utils/module-federation/build-static.remotes.d.ts +4 -0
  50. package/src/utils/module-federation/build-static.remotes.js +73 -0
  51. package/src/utils/module-federation/build-static.remotes.js.map +1 -0
  52. package/src/utils/module-federation/dependencies.d.ts +6 -0
  53. package/src/utils/module-federation/dependencies.js +58 -0
  54. package/src/utils/module-federation/dependencies.js.map +1 -0
  55. package/src/utils/module-federation/get-remotes-for-host.d.ts +16 -0
  56. package/src/utils/module-federation/get-remotes-for-host.js +103 -0
  57. package/src/utils/module-federation/get-remotes-for-host.js.map +1 -0
  58. package/src/utils/module-federation/index.d.ts +6 -0
  59. package/src/utils/module-federation/index.js +10 -0
  60. package/src/utils/module-federation/index.js.map +1 -0
  61. package/src/utils/module-federation/models/index.d.ts +47 -0
  62. package/src/utils/module-federation/models/index.js +3 -0
  63. package/src/utils/module-federation/models/index.js.map +1 -0
  64. package/src/utils/module-federation/package-json.d.ts +8 -0
  65. package/src/utils/module-federation/package-json.js +13 -0
  66. package/src/utils/module-federation/package-json.js.map +1 -0
  67. package/src/utils/module-federation/parse-static-remotes-config.d.ts +13 -0
  68. package/src/utils/module-federation/parse-static-remotes-config.js +35 -0
  69. package/src/utils/module-federation/parse-static-remotes-config.js.map +1 -0
  70. package/src/utils/module-federation/plugins/runtime-library-control.plugin.d.ts +3 -0
  71. package/src/utils/module-federation/plugins/runtime-library-control.plugin.js +55 -0
  72. package/src/utils/module-federation/plugins/runtime-library-control.plugin.js.map +1 -0
  73. package/src/utils/module-federation/public-api.d.ts +8 -0
  74. package/src/utils/module-federation/public-api.js +21 -0
  75. package/src/utils/module-federation/public-api.js.map +1 -0
  76. package/src/utils/module-federation/remotes.d.ts +19 -0
  77. package/src/utils/module-federation/remotes.js +78 -0
  78. package/src/utils/module-federation/remotes.js.map +1 -0
  79. package/src/utils/module-federation/secondary-entry-points.d.ts +12 -0
  80. package/src/utils/module-federation/secondary-entry-points.js +105 -0
  81. package/src/utils/module-federation/secondary-entry-points.js.map +1 -0
  82. package/src/utils/module-federation/share.d.ts +48 -0
  83. package/src/utils/module-federation/share.js +232 -0
  84. package/src/utils/module-federation/share.js.map +1 -0
  85. package/src/utils/module-federation/start-remote-proxies.d.ts +5 -0
  86. package/src/utils/module-federation/start-remote-proxies.js +46 -0
  87. package/src/utils/module-federation/start-remote-proxies.js.map +1 -0
  88. package/src/utils/module-federation/start-ssr-remote-proxies.d.ts +5 -0
  89. package/src/utils/module-federation/start-ssr-remote-proxies.js +60 -0
  90. package/src/utils/module-federation/start-ssr-remote-proxies.js.map +1 -0
  91. package/src/utils/module-federation/typescript.d.ts +4 -0
  92. package/src/utils/module-federation/typescript.js +53 -0
  93. package/src/utils/module-federation/typescript.js.map +1 -0
  94. package/src/utils/module-federation/with-module-federation/package-json.d.ts +8 -0
  95. package/src/utils/module-federation/with-module-federation/package-json.js +13 -0
  96. package/src/utils/module-federation/with-module-federation/package-json.js.map +1 -0
  97. package/src/utils/module-federation/with-module-federation/utils.d.ts +12 -0
  98. package/src/utils/module-federation/with-module-federation/utils.js +78 -0
  99. package/src/utils/module-federation/with-module-federation/utils.js.map +1 -0
  100. package/src/utils/module-federation/with-module-federation/with-module-federation-ssr.d.ts +3 -0
  101. package/src/utils/module-federation/with-module-federation/with-module-federation-ssr.js +42 -0
  102. package/src/utils/module-federation/with-module-federation/with-module-federation-ssr.js.map +1 -0
  103. package/src/utils/module-federation/with-module-federation/with-module-federation.d.ts +8 -0
  104. package/src/utils/module-federation/with-module-federation/with-module-federation.js +52 -0
  105. package/src/utils/module-federation/with-module-federation/with-module-federation.js.map +1 -0
  106. package/src/utils/versions.d.ts +3 -3
  107. package/src/utils/versions.js +3 -3
  108. package/src/utils/with-nx.js +41 -15
  109. package/src/utils/with-nx.js.map +1 -1
  110. package/src/utils/with-web.js +8 -4
  111. package/src/utils/with-web.js.map +1 -1
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const runtimeStore = {
4
+ sharedPackagesFromDev: {},
5
+ };
6
+ if (process.env.NX_MF_DEV_REMOTES) {
7
+ // process.env.NX_MF_DEV_REMOTES is replaced by an array value via DefinePlugin, even though the original value is a stringified array.
8
+ runtimeStore.devRemotes = process.env
9
+ .NX_MF_DEV_REMOTES;
10
+ }
11
+ const nxRuntimeLibraryControlPlugin = function () {
12
+ return {
13
+ name: 'nx-runtime-library-control-plugin',
14
+ beforeInit(args) {
15
+ runtimeStore.name = args.options.name;
16
+ return args;
17
+ },
18
+ resolveShare: (args) => {
19
+ const { shareScopeMap, scope, pkgName, version, GlobalFederation } = args;
20
+ const originalResolver = args.resolver;
21
+ args.resolver = function () {
22
+ if (!runtimeStore.sharedPackagesFromDev[pkgName]) {
23
+ if (!GlobalFederation.__INSTANCES__) {
24
+ return originalResolver();
25
+ }
26
+ else if (!runtimeStore.devRemotes) {
27
+ return originalResolver();
28
+ }
29
+ const devRemoteInstanceToUse = GlobalFederation.__INSTANCES__.find((instance) => instance.options.shared[pkgName] &&
30
+ runtimeStore.devRemotes.find((dr) => instance.name === dr));
31
+ if (!devRemoteInstanceToUse) {
32
+ return originalResolver();
33
+ }
34
+ runtimeStore.sharedPackagesFromDev[pkgName] =
35
+ devRemoteInstanceToUse.name;
36
+ }
37
+ const remoteInstanceName = runtimeStore.sharedPackagesFromDev[pkgName];
38
+ const remoteInstance = GlobalFederation.__INSTANCES__.find((instance) => instance.name === remoteInstanceName);
39
+ try {
40
+ const remotePkgInfo = remoteInstance.options.shared[pkgName].find((shared) => shared.from === remoteInstanceName);
41
+ remotePkgInfo.useIn.push(runtimeStore.name);
42
+ remotePkgInfo.useIn = Array.from(new Set(remotePkgInfo.useIn));
43
+ shareScopeMap[scope][pkgName][version] = remotePkgInfo;
44
+ return remotePkgInfo;
45
+ }
46
+ catch (_a) {
47
+ return originalResolver();
48
+ }
49
+ };
50
+ return args;
51
+ },
52
+ };
53
+ };
54
+ exports.default = nxRuntimeLibraryControlPlugin;
55
+ //# sourceMappingURL=runtime-library-control.plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-library-control.plugin.js","sourceRoot":"","sources":["../../../../../../../packages/rspack/src/utils/module-federation/plugins/runtime-library-control.plugin.ts"],"names":[],"mappings":";;AAEA,MAAM,YAAY,GAId;IACF,qBAAqB,EAAE,EAAE;CAC1B,CAAC;AAEF,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC;IAClC,uIAAuI;IACvI,YAAY,CAAC,UAAU,GAAG,OAAO,CAAC,GAAG;SAClC,iBAAwC,CAAC;AAC9C,CAAC;AAED,MAAM,6BAA6B,GACjC;IACE,OAAO;QACL,IAAI,EAAE,mCAAmC;QACzC,UAAU,CAAC,IAAI;YACb,YAAY,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;Y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AAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAC/D,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,kBAAkB,CAC/C,CAAC;oBACF,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;oBAC5C,aAAa,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;oBAC/D,aAAa,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,aAAa,CAAC;oBACvD,OAAO,aAAa,CAAC;gBACvB,CAAC;gBAAC,WAAM,CAAC;oBACP,OAAO,gBAAgB,EAAE,CAAC;gBAC5B,CAAC;YACH,CAAC,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEJ,kBAAe,6BAA6B,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { AdditionalSharedConfig, ModuleFederationConfig, ModuleFederationLibrary, Remotes, SharedFunction, SharedLibraryConfig, SharedWorkspaceLibraryConfig, WorkspaceLibrary, WorkspaceLibrarySecondaryEntryPoint } from './models';
2
+ import { applyAdditionalShared, applySharedFunction, getNpmPackageSharedConfig, sharePackages, shareWorkspaceLibraries } from './share';
3
+ import { mapRemotes, mapRemotesForSSR } from './remotes';
4
+ import { getDependentPackagesForProject } from './dependencies';
5
+ import { readRootPackageJson } from './package-json';
6
+ import { withModuleFederation } from './with-module-federation/with-module-federation';
7
+ import { withModuleFederationForSSR } from './with-module-federation/with-module-federation-ssr';
8
+ export { AdditionalSharedConfig, applyAdditionalShared, applySharedFunction, getDependentPackagesForProject, getNpmPackageSharedConfig, mapRemotes, mapRemotesForSSR, ModuleFederationConfig, ModuleFederationLibrary, readRootPackageJson, Remotes, SharedFunction, SharedLibraryConfig, SharedWorkspaceLibraryConfig, sharePackages, shareWorkspaceLibraries, withModuleFederation, withModuleFederationForSSR, WorkspaceLibrary, WorkspaceLibrarySecondaryEntryPoint, };
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withModuleFederationForSSR = exports.withModuleFederation = exports.shareWorkspaceLibraries = exports.sharePackages = exports.readRootPackageJson = exports.mapRemotesForSSR = exports.mapRemotes = exports.getNpmPackageSharedConfig = exports.getDependentPackagesForProject = exports.applySharedFunction = exports.applyAdditionalShared = void 0;
4
+ const share_1 = require("./share");
5
+ Object.defineProperty(exports, "applyAdditionalShared", { enumerable: true, get: function () { return share_1.applyAdditionalShared; } });
6
+ Object.defineProperty(exports, "applySharedFunction", { enumerable: true, get: function () { return share_1.applySharedFunction; } });
7
+ Object.defineProperty(exports, "getNpmPackageSharedConfig", { enumerable: true, get: function () { return share_1.getNpmPackageSharedConfig; } });
8
+ Object.defineProperty(exports, "sharePackages", { enumerable: true, get: function () { return share_1.sharePackages; } });
9
+ Object.defineProperty(exports, "shareWorkspaceLibraries", { enumerable: true, get: function () { return share_1.shareWorkspaceLibraries; } });
10
+ const remotes_1 = require("./remotes");
11
+ Object.defineProperty(exports, "mapRemotes", { enumerable: true, get: function () { return remotes_1.mapRemotes; } });
12
+ Object.defineProperty(exports, "mapRemotesForSSR", { enumerable: true, get: function () { return remotes_1.mapRemotesForSSR; } });
13
+ const dependencies_1 = require("./dependencies");
14
+ Object.defineProperty(exports, "getDependentPackagesForProject", { enumerable: true, get: function () { return dependencies_1.getDependentPackagesForProject; } });
15
+ const package_json_1 = require("./package-json");
16
+ Object.defineProperty(exports, "readRootPackageJson", { enumerable: true, get: function () { return package_json_1.readRootPackageJson; } });
17
+ const with_module_federation_1 = require("./with-module-federation/with-module-federation");
18
+ Object.defineProperty(exports, "withModuleFederation", { enumerable: true, get: function () { return with_module_federation_1.withModuleFederation; } });
19
+ const with_module_federation_ssr_1 = require("./with-module-federation/with-module-federation-ssr");
20
+ Object.defineProperty(exports, "withModuleFederationForSSR", { enumerable: true, get: function () { return with_module_federation_ssr_1.withModuleFederationForSSR; } });
21
+ //# sourceMappingURL=public-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-api.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/utils/module-federation/public-api.ts"],"names":[],"mappings":";;;AAYA,mCAMiB;AAaf,sGAlBA,6BAAqB,OAkBA;AACrB,oGAlBA,2BAAmB,OAkBA;AAEnB,0GAnBA,iCAAyB,OAmBA;AAUzB,8FA5BA,qBAAa,OA4BA;AACb,wGA5BA,+BAAuB,OA4BA;AAzBzB,uCAAyD;AAevD,2FAfO,oBAAU,OAeP;AACV,iGAhBmB,0BAAgB,OAgBnB;AAdlB,iDAAgE;AAW9D,+GAXO,6CAA8B,OAWP;AAThC,iDAAqD;AAenD,oGAfO,kCAAmB,OAeP;AAbrB,4FAAuF;AAoBrF,qGApBO,6CAAoB,OAoBP;AAnBtB,oGAAiG;AAoB/F,2GApBO,uDAA0B,OAoBP"}
@@ -0,0 +1,19 @@
1
+ import { Remotes } from './models';
2
+ /**
3
+ * Map remote names to a format that can be understood and used by Module
4
+ * Federation.
5
+ *
6
+ * @param remotes - The remotes to map
7
+ * @param remoteEntryExt - The file extension of the remoteEntry file
8
+ * @param determineRemoteUrl - The function used to lookup the URL of the served remote
9
+ */
10
+ export declare function mapRemotes(remotes: Remotes, remoteEntryExt: 'js' | 'mjs', determineRemoteUrl: (remote: string) => string): Record<string, string>;
11
+ /**
12
+ * Map remote names to a format that can be understood and used by Module
13
+ * Federation.
14
+ *
15
+ * @param remotes - The remotes to map
16
+ * @param remoteEntryExt - The file extension of the remoteEntry file
17
+ * @param determineRemoteUrl - The function used to lookup the URL of the served remote
18
+ */
19
+ export declare function mapRemotesForSSR(remotes: Remotes, remoteEntryExt: 'js' | 'mjs', determineRemoteUrl: (remote: string) => string): Record<string, string>;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapRemotes = mapRemotes;
4
+ exports.mapRemotesForSSR = mapRemotesForSSR;
5
+ const path_1 = require("path");
6
+ /**
7
+ * Map remote names to a format that can be understood and used by Module
8
+ * Federation.
9
+ *
10
+ * @param remotes - The remotes to map
11
+ * @param remoteEntryExt - The file extension of the remoteEntry file
12
+ * @param determineRemoteUrl - The function used to lookup the URL of the served remote
13
+ */
14
+ function mapRemotes(remotes, remoteEntryExt, determineRemoteUrl) {
15
+ const mappedRemotes = {};
16
+ for (const remote of remotes) {
17
+ if (Array.isArray(remote)) {
18
+ mappedRemotes[remote[0]] = handleArrayRemote(remote, remoteEntryExt);
19
+ }
20
+ else if (typeof remote === 'string') {
21
+ mappedRemotes[remote] = handleStringRemote(remote, determineRemoteUrl);
22
+ }
23
+ }
24
+ return mappedRemotes;
25
+ }
26
+ // Helper function to deal with remotes that are arrays
27
+ function handleArrayRemote(remote, remoteEntryExt) {
28
+ const [remoteName, remoteLocation] = remote;
29
+ const remoteLocationExt = (0, path_1.extname)(remoteLocation);
30
+ // If remote location already has .js or .mjs extension
31
+ if (['.js', '.mjs'].includes(remoteLocationExt)) {
32
+ return remoteLocation;
33
+ }
34
+ const baseRemote = remoteLocation.endsWith('/')
35
+ ? remoteLocation.slice(0, -1)
36
+ : remoteLocation;
37
+ const globalPrefix = `${remoteName.replace(/-/g, '_')}@`;
38
+ // if the remote is defined with anything other than http then we assume it's a promise based remote
39
+ // In that case we should use what the user provides as the remote location
40
+ if (!remoteLocation.startsWith('promise new Promise')) {
41
+ return `${globalPrefix}${baseRemote}/remoteEntry.${remoteEntryExt}`;
42
+ }
43
+ else {
44
+ return remoteLocation;
45
+ }
46
+ }
47
+ // Helper function to deal with remotes that are strings
48
+ function handleStringRemote(remote, determineRemoteUrl) {
49
+ const globalPrefix = `${remote.replace(/-/g, '_')}@`;
50
+ return `${globalPrefix}${determineRemoteUrl(remote)}`;
51
+ }
52
+ /**
53
+ * Map remote names to a format that can be understood and used by Module
54
+ * Federation.
55
+ *
56
+ * @param remotes - The remotes to map
57
+ * @param remoteEntryExt - The file extension of the remoteEntry file
58
+ * @param determineRemoteUrl - The function used to lookup the URL of the served remote
59
+ */
60
+ function mapRemotesForSSR(remotes, remoteEntryExt, determineRemoteUrl) {
61
+ const mappedRemotes = {};
62
+ for (const remote of remotes) {
63
+ if (Array.isArray(remote)) {
64
+ const [remoteName, remoteLocation] = remote;
65
+ const remoteLocationExt = (0, path_1.extname)(remoteLocation);
66
+ mappedRemotes[remoteName] = `${remoteName}@${['.js', '.mjs'].includes(remoteLocationExt)
67
+ ? remoteLocation
68
+ : `${remoteLocation.endsWith('/')
69
+ ? remoteLocation.slice(0, -1)
70
+ : remoteLocation}/remoteEntry.${remoteEntryExt}`}`;
71
+ }
72
+ else if (typeof remote === 'string') {
73
+ mappedRemotes[remote] = `${remote}@${determineRemoteUrl(remote)}`;
74
+ }
75
+ }
76
+ return mappedRemotes;
77
+ }
78
+ //# sourceMappingURL=remotes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remotes.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/utils/module-federation/remotes.ts"],"names":[],"mappings":";;AAWA,gCAgBC;AAgDD,4CA0BC;AArGD,+BAA+B;AAG/B;;;;;;;GAOG;AACH,SAAgB,UAAU,CACxB,OAAgB,EAChB,cAA4B,EAC5B,kBAA8C;IAE9C,MAAM,aAAa,GAAG,EAAE,CAAC;IAEzB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1B,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;QACvE,CAAC;aAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YACtC,aAAa,CAAC,MAAM,CAAC,GAAG,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC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K,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1B,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,GAAG,MAAM,CAAC;YAC5C,MAAM,iBAAiB,GAAG,IAAA,cAAO,EAAC,cAAc,CAAC,CAAC;YAClD,aAAa,CAAC,UAAU,CAAC,GAAG,GAAG,UAAU,IACvC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC;gBACzC,CAAC,CAAC,cAAc;gBAChB,CAAC,CAAC,GACE,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC;oBAC1B,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;oBAC7B,CAAC,CAAC,cACN,gBAAgB,cAAc,EACpC,EAAE,CAAC;QACL,CAAC;aAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YACtC,aAAa,CAAC,MAAM,CAAC,GAAG,GAAG,MAAM,IAAI,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;QACpE,CAAC;IACH,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { WorkspaceLibrary } from './models';
2
+ import { WorkspaceLibrarySecondaryEntryPoint } from './models';
3
+ export declare function collectWorkspaceLibrarySecondaryEntryPoints(library: WorkspaceLibrary, tsconfigPathAliases: Record<string, string[]>): WorkspaceLibrarySecondaryEntryPoint[];
4
+ export declare function getNonNodeModulesSubDirs(directory: string): string[];
5
+ export declare function recursivelyCollectSecondaryEntryPointsFromDirectory(pkgName: string, pkgVersion: string, pkgRoot: string, mainEntryPointExports: any | undefined, directories: string[], collectedPackages: {
6
+ name: string;
7
+ version: string;
8
+ }[]): void;
9
+ export declare function collectPackageSecondaryEntryPoints(pkgName: string, pkgVersion: string, collectedPackages: {
10
+ name: string;
11
+ version: string;
12
+ }[]): void;
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.collectWorkspaceLibrarySecondaryEntryPoints = collectWorkspaceLibrarySecondaryEntryPoints;
4
+ exports.getNonNodeModulesSubDirs = getNonNodeModulesSubDirs;
5
+ exports.recursivelyCollectSecondaryEntryPointsFromDirectory = recursivelyCollectSecondaryEntryPointsFromDirectory;
6
+ exports.collectPackageSecondaryEntryPoints = collectPackageSecondaryEntryPoints;
7
+ const devkit_1 = require("@nx/devkit");
8
+ const fs_1 = require("fs");
9
+ const package_json_1 = require("nx/src/utils/package-json");
10
+ const path_1 = require("path");
11
+ function collectWorkspaceLibrarySecondaryEntryPoints(library, tsconfigPathAliases) {
12
+ const libraryRoot = (0, path_1.join)(devkit_1.workspaceRoot, library.root);
13
+ const needsSecondaryEntryPointsCollected = (0, fs_1.existsSync)((0, path_1.join)(libraryRoot, 'ng-package.json'));
14
+ const secondaryEntryPoints = [];
15
+ if (needsSecondaryEntryPointsCollected) {
16
+ const tsConfigAliasesForLibWithSecondaryEntryPoints = Object.entries(tsconfigPathAliases).reduce((acc, [tsKey, tsPaths]) => {
17
+ if (!tsKey.startsWith(library.importKey)) {
18
+ return Object.assign({}, acc);
19
+ }
20
+ if (tsPaths.some((path) => path.startsWith(`${library.root}/`))) {
21
+ acc = Object.assign(Object.assign({}, acc), { [tsKey]: tsPaths });
22
+ }
23
+ return acc;
24
+ }, {});
25
+ for (const [alias] of Object.entries(tsConfigAliasesForLibWithSecondaryEntryPoints)) {
26
+ const pathToLib = (0, path_1.dirname)((0, path_1.join)(devkit_1.workspaceRoot, tsconfigPathAliases[alias][0]));
27
+ let searchDir = pathToLib;
28
+ while (searchDir !== libraryRoot) {
29
+ if ((0, fs_1.existsSync)((0, path_1.join)(searchDir, 'ng-package.json'))) {
30
+ secondaryEntryPoints.push({ name: alias, path: pathToLib });
31
+ break;
32
+ }
33
+ searchDir = (0, path_1.dirname)(searchDir);
34
+ }
35
+ }
36
+ }
37
+ return secondaryEntryPoints;
38
+ }
39
+ function getNonNodeModulesSubDirs(directory) {
40
+ return (0, fs_1.readdirSync)(directory)
41
+ .filter((file) => file !== 'node_modules')
42
+ .map((file) => (0, path_1.join)(directory, file))
43
+ .filter((file) => (0, fs_1.lstatSync)(file).isDirectory());
44
+ }
45
+ function recursivelyCollectSecondaryEntryPointsFromDirectory(pkgName, pkgVersion, pkgRoot, mainEntryPointExports, directories, collectedPackages) {
46
+ for (const directory of directories) {
47
+ const packageJsonPath = (0, path_1.join)(directory, 'package.json');
48
+ const relativeEntryPointPath = (0, path_1.relative)(pkgRoot, directory);
49
+ const entryPointName = (0, devkit_1.joinPathFragments)(pkgName, relativeEntryPointPath);
50
+ if ((0, fs_1.existsSync)(packageJsonPath)) {
51
+ try {
52
+ // require the secondary entry point to try to rule out sample code
53
+ require.resolve(entryPointName, { paths: [devkit_1.workspaceRoot] });
54
+ const { name } = (0, devkit_1.readJsonFile)(packageJsonPath);
55
+ // further check to make sure what we were able to require is the
56
+ // same as the package name
57
+ if (name === entryPointName) {
58
+ collectedPackages.push({ name, version: pkgVersion });
59
+ }
60
+ }
61
+ catch (_a) {
62
+ // do nothing
63
+ }
64
+ }
65
+ else if (mainEntryPointExports) {
66
+ // if the package.json doesn't exist, check if the directory is
67
+ // exported by the main entry point
68
+ const entryPointExportKey = `./${relativeEntryPointPath}`;
69
+ const entryPointInfo = mainEntryPointExports[entryPointExportKey];
70
+ if (entryPointInfo) {
71
+ collectedPackages.push({
72
+ name: entryPointName,
73
+ version: pkgVersion,
74
+ });
75
+ }
76
+ }
77
+ const subDirs = getNonNodeModulesSubDirs(directory);
78
+ recursivelyCollectSecondaryEntryPointsFromDirectory(pkgName, pkgVersion, pkgRoot, mainEntryPointExports, subDirs, collectedPackages);
79
+ }
80
+ }
81
+ function collectPackageSecondaryEntryPoints(pkgName, pkgVersion, collectedPackages) {
82
+ let pathToPackage;
83
+ let packageJsonPath;
84
+ let packageJson;
85
+ try {
86
+ ({ path: packageJsonPath, packageJson } = (0, package_json_1.readModulePackageJson)(pkgName));
87
+ pathToPackage = (0, path_1.dirname)(packageJsonPath);
88
+ }
89
+ catch (_a) {
90
+ // the package.json might not resolve if the package has the "exports"
91
+ // entry and is not exporting the package.json file, fall back to trying
92
+ // to find it from the top-level node_modules
93
+ pathToPackage = (0, path_1.join)(devkit_1.workspaceRoot, 'node_modules', pkgName);
94
+ packageJsonPath = (0, path_1.join)(pathToPackage, 'package.json');
95
+ if (!(0, fs_1.existsSync)(packageJsonPath)) {
96
+ // might not exist if it's nested in another package, just return here
97
+ return;
98
+ }
99
+ packageJson = (0, devkit_1.readJsonFile)(packageJsonPath);
100
+ }
101
+ const { exports } = packageJson;
102
+ const subDirs = getNonNodeModulesSubDirs(pathToPackage);
103
+ recursivelyCollectSecondaryEntryPointsFromDirectory(pkgName, pkgVersion, pathToPackage, exports, subDirs, collectedPackages);
104
+ }
105
+ //# sourceMappingURL=secondary-entry-points.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secondary-entry-points.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/utils/module-federation/secondary-entry-points.ts"],"names":[],"mappings":";;AAOA,kGA2CC;AAED,4DAKC;AAED,kHAgDC;AAED,gFAkCC;AA/ID,uCAA4E;AAC5E,2BAAwD;AACxD,4DAA+E;AAC/E,+BAA+C;AAI/C,SAAgB,2CAA2C,CACzD,OAAyB,EACzB,mBAA6C;IAE7C,MAAM,WAAW,GAAG,IAAA,WAAI,EAAC,sBAAa,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,MAAM,kCAAkC,GAAG,IAAA,eAAU,EACnD,IAAA,WAAI,EAAC,WAAW,EAAE,iBAAiB,CAAC,CACrC,CAAC;IAEF,MAAM,oBAAoB,GAA0C,EAAE,CAAC;IACvE,IAAI,kCAAkC,EAAE,CAAC;QACvC,MAAM,6CAA6C,GAAG,MAAM,CAAC,OAAO,CAClE,mBAAmB,CACpB,CAAC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mDAAmD,CACjD,OAAO,EACP,UAAU,EACV,aAAa,EACb,OAAO,EACP,OAAO,EACP,iBAAiB,CAClB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { type ProjectGraph } from '@nx/devkit';
2
+ import type { SharedLibraryConfig, SharedWorkspaceLibraryConfig, WorkspaceLibrary } from './models';
3
+ import { AdditionalSharedConfig, SharedFunction } from './models';
4
+ /**
5
+ * Build an object of functions to be used with the ModuleFederationPlugin to
6
+ * share Nx Workspace Libraries between Hosts and Remotes.
7
+ *
8
+ * @param workspaceLibs - The Nx Workspace Libraries to share
9
+ * @param tsConfigPath - The path to TS Config File that contains the Path Mappings for the Libraries
10
+ */
11
+ export declare function shareWorkspaceLibraries(workspaceLibs: WorkspaceLibrary[], tsConfigPath?: string): SharedWorkspaceLibraryConfig;
12
+ /**
13
+ * Build the Module Federation Share Config for a specific package and the
14
+ * specified version of that package.
15
+ * @param pkgName - Name of the package to share
16
+ * @param version - Version of the package to require by other apps in the Module Federation setup
17
+ */
18
+ export declare function getNpmPackageSharedConfig(pkgName: string, version: string): SharedLibraryConfig | undefined;
19
+ /**
20
+ * Create a dictionary of packages and their Module Federation Shared Config
21
+ * from an array of package names.
22
+ *
23
+ * Lookup the versions of the packages from the root package.json file in the
24
+ * workspace.
25
+ * @param packages - Array of package names as strings
26
+ */
27
+ export declare function sharePackages(packages: string[]): Record<string, SharedLibraryConfig>;
28
+ /**
29
+ * Apply a custom function provided by the user that will modify the Shared Config
30
+ * of the dependencies for the Module Federation build.
31
+ *
32
+ * @param sharedConfig - The original Shared Config to be modified
33
+ * @param sharedFn - The custom function to run
34
+ */
35
+ export declare function applySharedFunction(sharedConfig: Record<string, SharedLibraryConfig>, sharedFn: SharedFunction | undefined): void;
36
+ /**
37
+ * Add additional dependencies to the shared package that may not have been
38
+ * discovered by the project graph.
39
+ *
40
+ * This can be useful for applications that use a Dependency Injection system
41
+ * that expects certain Singleton values to be present in the shared injection
42
+ * hierarchy.
43
+ *
44
+ * @param sharedConfig - The original Shared Config
45
+ * @param additionalShared - The additional dependencies to add
46
+ * @param projectGraph - The Nx project graph
47
+ */
48
+ export declare function applyAdditionalShared(sharedConfig: Record<string, SharedLibraryConfig>, additionalShared: AdditionalSharedConfig | undefined, projectGraph: ProjectGraph): void;
@@ -0,0 +1,232 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shareWorkspaceLibraries = shareWorkspaceLibraries;
4
+ exports.getNpmPackageSharedConfig = getNpmPackageSharedConfig;
5
+ exports.sharePackages = sharePackages;
6
+ exports.applySharedFunction = applySharedFunction;
7
+ exports.applyAdditionalShared = applyAdditionalShared;
8
+ const devkit_1 = require("@nx/devkit");
9
+ const core_1 = require("@rspack/core");
10
+ const fs_1 = require("fs");
11
+ const path_1 = require("path");
12
+ const package_json_1 = require("./package-json");
13
+ const secondary_entry_points_1 = require("./secondary-entry-points");
14
+ const typescript_1 = require("./typescript");
15
+ /**
16
+ * Build an object of functions to be used with the ModuleFederationPlugin to
17
+ * share Nx Workspace Libraries between Hosts and Remotes.
18
+ *
19
+ * @param workspaceLibs - The Nx Workspace Libraries to share
20
+ * @param tsConfigPath - The path to TS Config File that contains the Path Mappings for the Libraries
21
+ */
22
+ function shareWorkspaceLibraries(workspaceLibs, tsConfigPath) {
23
+ var _a;
24
+ if (tsConfigPath === void 0) { tsConfigPath = (_a = process.env.NX_TSCONFIG_PATH) !== null && _a !== void 0 ? _a : (0, typescript_1.getRootTsConfigPath)(); }
25
+ if (!workspaceLibs) {
26
+ return getEmptySharedLibrariesConfig();
27
+ }
28
+ const tsconfigPathAliases = (0, typescript_1.readTsPathMappings)(tsConfigPath);
29
+ if (!Object.keys(tsconfigPathAliases).length) {
30
+ return getEmptySharedLibrariesConfig();
31
+ }
32
+ // Nested projects must come first, sort them as such
33
+ const sortedTsConfigPathAliases = {};
34
+ Object.keys(tsconfigPathAliases)
35
+ .sort((a, b) => {
36
+ return b.split('/').length - a.split('/').length;
37
+ })
38
+ .forEach((key) => (sortedTsConfigPathAliases[key] = tsconfigPathAliases[key]));
39
+ const pathMappings = [];
40
+ for (const [key, paths] of Object.entries(sortedTsConfigPathAliases)) {
41
+ const library = workspaceLibs.find((lib) => lib.importKey === key);
42
+ if (!library) {
43
+ continue;
44
+ }
45
+ // This is for Angular Projects that use ng-package.json
46
+ // It will do nothing for React Projects
47
+ (0, secondary_entry_points_1.collectWorkspaceLibrarySecondaryEntryPoints)(library, sortedTsConfigPathAliases).forEach(({ name, path }) => pathMappings.push({
48
+ name,
49
+ path,
50
+ }));
51
+ pathMappings.push({
52
+ name: key,
53
+ path: (0, path_1.normalize)((0, path_1.join)(devkit_1.workspaceRoot, paths[0])),
54
+ });
55
+ }
56
+ return {
57
+ getAliases: () => pathMappings.reduce((aliases, library) => (Object.assign(Object.assign({}, aliases), {
58
+ // If the library path ends in a wildcard, remove it as webpack can't handle this in resolve.alias
59
+ // e.g. path/to/my/lib/* -> path/to/my/lib
60
+ [library.name]: library.path.replace(/\/\*$/, '') })), {}),
61
+ getLibraries: (projectRoot, eager) => {
62
+ let pkgJson = null;
63
+ if (projectRoot &&
64
+ (0, fs_1.existsSync)((0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, projectRoot, 'package.json'))) {
65
+ pkgJson = (0, devkit_1.readJsonFile)((0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, projectRoot, 'package.json'));
66
+ }
67
+ return pathMappings.reduce((libraries, library) => {
68
+ var _a;
69
+ // Check to see if the library version is declared in the app's package.json
70
+ let version = (_a = pkgJson === null || pkgJson === void 0 ? void 0 : pkgJson.dependencies) === null || _a === void 0 ? void 0 : _a[library.name];
71
+ if (!version && workspaceLibs.length > 0) {
72
+ const workspaceLib = workspaceLibs.find((lib) => lib.importKey === library.name);
73
+ const libPackageJsonPath = workspaceLib
74
+ ? (0, path_1.join)(workspaceLib.root, 'package.json')
75
+ : null;
76
+ if (libPackageJsonPath && (0, fs_1.existsSync)(libPackageJsonPath)) {
77
+ pkgJson = (0, devkit_1.readJsonFile)(libPackageJsonPath);
78
+ if (pkgJson) {
79
+ version = pkgJson.version;
80
+ }
81
+ }
82
+ }
83
+ return Object.assign(Object.assign({}, libraries), { [library.name]: Object.assign(Object.assign({}, (version
84
+ ? {
85
+ requiredVersion: version,
86
+ singleton: true,
87
+ }
88
+ : { requiredVersion: false })), { eager }) });
89
+ }, {});
90
+ },
91
+ getReplacementPlugin: () => new core_1.NormalModuleReplacementPlugin(/./, (req) => {
92
+ if (!req.request.startsWith('.')) {
93
+ return;
94
+ }
95
+ const from = req.context;
96
+ const to = (0, path_1.normalize)((0, path_1.join)(req.context, req.request));
97
+ for (const library of pathMappings) {
98
+ const libFolder = (0, path_1.normalize)((0, path_1.dirname)(library.path));
99
+ if (!from.startsWith(libFolder) && to.startsWith(libFolder)) {
100
+ const newReq = library.name.endsWith('/*')
101
+ ? /**
102
+ * req usually is in the form of "../../../path/to/file"
103
+ * library.path is usually in the form of "/Users/username/path/to/Workspace/path/to/library"
104
+ *
105
+ * When a wildcard is used in the TS path mappings, we want to get everything after the import to
106
+ * re-route the request correctly inline with the webpack resolve.alias
107
+ */
108
+ (0, path_1.join)(library.name, req.request.split(library.path.replace(devkit_1.workspaceRoot, '').replace('/*', ''))[1])
109
+ : library.name;
110
+ req.request = newReq;
111
+ }
112
+ }
113
+ }),
114
+ };
115
+ }
116
+ /**
117
+ * Build the Module Federation Share Config for a specific package and the
118
+ * specified version of that package.
119
+ * @param pkgName - Name of the package to share
120
+ * @param version - Version of the package to require by other apps in the Module Federation setup
121
+ */
122
+ function getNpmPackageSharedConfig(pkgName, version) {
123
+ if (!version) {
124
+ devkit_1.logger.warn(`Could not find a version for "${pkgName}" in the root "package.json" ` +
125
+ 'when collecting shared packages for the Module Federation setup. ' +
126
+ 'The package will not be shared.');
127
+ return undefined;
128
+ }
129
+ return { singleton: true, strictVersion: true, requiredVersion: version };
130
+ }
131
+ /**
132
+ * Create a dictionary of packages and their Module Federation Shared Config
133
+ * from an array of package names.
134
+ *
135
+ * Lookup the versions of the packages from the root package.json file in the
136
+ * workspace.
137
+ * @param packages - Array of package names as strings
138
+ */
139
+ function sharePackages(packages) {
140
+ const pkgJson = (0, package_json_1.readRootPackageJson)();
141
+ const allPackages = [];
142
+ packages.forEach((pkg) => {
143
+ var _a, _b, _c;
144
+ const pkgVersion = (_b = (_a = pkgJson.dependencies) === null || _a === void 0 ? void 0 : _a[pkg]) !== null && _b !== void 0 ? _b : (_c = pkgJson.devDependencies) === null || _c === void 0 ? void 0 : _c[pkg];
145
+ allPackages.push({ name: pkg, version: pkgVersion });
146
+ (0, secondary_entry_points_1.collectPackageSecondaryEntryPoints)(pkg, pkgVersion, allPackages);
147
+ });
148
+ return allPackages.reduce((shared, pkg) => {
149
+ const config = getNpmPackageSharedConfig(pkg.name, pkg.version);
150
+ if (config) {
151
+ shared[pkg.name] = config;
152
+ }
153
+ return shared;
154
+ }, {});
155
+ }
156
+ /**
157
+ * Apply a custom function provided by the user that will modify the Shared Config
158
+ * of the dependencies for the Module Federation build.
159
+ *
160
+ * @param sharedConfig - The original Shared Config to be modified
161
+ * @param sharedFn - The custom function to run
162
+ */
163
+ function applySharedFunction(sharedConfig, sharedFn) {
164
+ if (!sharedFn) {
165
+ return;
166
+ }
167
+ for (const [libraryName, library] of Object.entries(sharedConfig)) {
168
+ const mappedDependency = sharedFn(libraryName, library);
169
+ if (mappedDependency === false) {
170
+ delete sharedConfig[libraryName];
171
+ continue;
172
+ }
173
+ else if (!mappedDependency) {
174
+ continue;
175
+ }
176
+ sharedConfig[libraryName] = mappedDependency;
177
+ }
178
+ }
179
+ /**
180
+ * Add additional dependencies to the shared package that may not have been
181
+ * discovered by the project graph.
182
+ *
183
+ * This can be useful for applications that use a Dependency Injection system
184
+ * that expects certain Singleton values to be present in the shared injection
185
+ * hierarchy.
186
+ *
187
+ * @param sharedConfig - The original Shared Config
188
+ * @param additionalShared - The additional dependencies to add
189
+ * @param projectGraph - The Nx project graph
190
+ */
191
+ function applyAdditionalShared(sharedConfig, additionalShared, projectGraph) {
192
+ if (!additionalShared) {
193
+ return;
194
+ }
195
+ for (const shared of additionalShared) {
196
+ if (typeof shared === 'string') {
197
+ addStringDependencyToSharedConfig(sharedConfig, shared, projectGraph);
198
+ }
199
+ else if (Array.isArray(shared)) {
200
+ sharedConfig[shared[0]] = shared[1];
201
+ }
202
+ else if (typeof shared === 'object') {
203
+ sharedConfig[shared.libraryName] = shared.sharedConfig;
204
+ }
205
+ }
206
+ }
207
+ function addStringDependencyToSharedConfig(sharedConfig, dependency, projectGraph) {
208
+ var _a, _b, _c, _d;
209
+ if (projectGraph.nodes[dependency]) {
210
+ sharedConfig[dependency] = { requiredVersion: false };
211
+ }
212
+ else if ((_a = projectGraph.externalNodes) === null || _a === void 0 ? void 0 : _a[`npm:${dependency}`]) {
213
+ const pkgJson = (0, package_json_1.readRootPackageJson)();
214
+ const config = getNpmPackageSharedConfig(dependency, (_c = (_b = pkgJson.dependencies) === null || _b === void 0 ? void 0 : _b[dependency]) !== null && _c !== void 0 ? _c : (_d = pkgJson.devDependencies) === null || _d === void 0 ? void 0 : _d[dependency]);
215
+ if (!config) {
216
+ return;
217
+ }
218
+ sharedConfig[dependency] = config;
219
+ }
220
+ else {
221
+ throw new Error(`The specified dependency "${dependency}" in the additionalShared configuration does not exist in the project graph. ` +
222
+ `Please check your additionalShared configuration and make sure you are including valid workspace projects or npm packages.`);
223
+ }
224
+ }
225
+ function getEmptySharedLibrariesConfig() {
226
+ return {
227
+ getAliases: () => ({}),
228
+ getLibraries: () => ({}),
229
+ getReplacementPlugin: () => new core_1.NormalModuleReplacementPlugin(/./, () => undefined),
230
+ };
231
+ }
232
+ //# sourceMappingURL=share.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"share.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/utils/module-federation/share.ts"],"names":[],"mappings":";;AA+BA,0DA4IC;AAQD,8DAeC;AAUD,sCAoBC;AASD,kDAmBC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AAC,GAAG,MAAM,CAAC;IACpC,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CACb,6BAA6B,UAAU,+EAA+E;YACpH,4HAA4H,CAC/H,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,6BAA6B;IACpC,OAAO;QACL,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;QACtB,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;QACxB,oBAAoB,EAAE,GAAG,EAAE,CACzB,IAAI,oCAA6B,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC;KAC1D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { StaticRemotesConfig } from './parse-static-remotes-config';
2
+ export declare function startRemoteProxies(staticRemotesConfig: StaticRemotesConfig, mappedLocationsOfRemotes: Record<string, string>, sslOptions?: {
3
+ pathToCert: string;
4
+ pathToKey: string;
5
+ }): void;