@softarc/native-federation-orchestrator 4.0.0-RC3 → 4.0.0-RC4

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.
@@ -1552,7 +1552,7 @@ function createDetermineSharedExternals(config, ports) {
1552
1552
  }
1553
1553
  }
1554
1554
 
1555
- // node_modules/.pnpm/@softarc+native-federation@4.0.0-RC3_typescript@5.9.3_47bb4de43df406d114d8f653e70c5696/node_modules/@softarc/native-federation/src/lib/domain/core/build-notification-options.contract.js
1555
+ // node_modules/.pnpm/@softarc+native-federation@4.0.0-RC4_typescript@5.9.3_b0fd05590f82ec18d047413a60a6fe2a/node_modules/@softarc/native-federation/src/lib/domain/core/build-notification-options.contract.js
1556
1556
  var BuildNotificationType;
1557
1557
  (function(BuildNotificationType2) {
1558
1558
  BuildNotificationType2["COMPLETED"] = "federation-rebuild-complete";
@@ -1560,7 +1560,7 @@ var BuildNotificationType;
1560
1560
  BuildNotificationType2["CANCELLED"] = "federation-rebuild-cancelled";
1561
1561
  })(BuildNotificationType || (BuildNotificationType = {}));
1562
1562
 
1563
- // node_modules/.pnpm/@softarc+native-federation@4.0.0-RC3_typescript@5.9.3_47bb4de43df406d114d8f653e70c5696/node_modules/@softarc/native-federation/src/lib/domain/core/chunk.js
1563
+ // node_modules/.pnpm/@softarc+native-federation@4.0.0-RC4_typescript@5.9.3_b0fd05590f82ec18d047413a60a6fe2a/node_modules/@softarc/native-federation/src/lib/domain/core/chunk.js
1564
1564
  var CHUNK_PREFIX = "@nf-internal";
1565
1565
  function toChunkImport(fileName) {
1566
1566
  if (fileName.startsWith("./")) {
@@ -1579,8 +1579,8 @@ function createGenerateImportMap(config, ports) {
1579
1579
  addScopedExternals(importMap, chunkBundles);
1580
1580
  addshareScopeExternals(importMap, chunkBundles);
1581
1581
  addGlobalSharedExternals(importMap, chunkBundles);
1582
+ addRemoteInfos(importMap, chunkBundles);
1582
1583
  addChunkImports(importMap, chunkBundles);
1583
- addRemoteInfos(importMap);
1584
1584
  return Promise.resolve(importMap);
1585
1585
  } catch (e) {
1586
1586
  return Promise.reject(e);
@@ -1632,6 +1632,9 @@ function createGenerateImportMap(config, ports) {
1632
1632
  const scope = getScope2(shareScope, version.remotes[0].name, externalName);
1633
1633
  let targetFileUrl = join(scope, version.remotes[0].file);
1634
1634
  version.remotes[0].cached = true;
1635
+ if (version.action === "share") {
1636
+ registerBundleChunks(chunkBundles, version.remotes[0].name, version.remotes[0].bundle);
1637
+ }
1635
1638
  if (version.action === "skip") {
1636
1639
  if (!override) {
1637
1640
  override = findOverride(external, shareScope, externalName) ?? "NOT_AVAILABLE";
@@ -1724,10 +1727,11 @@ function createGenerateImportMap(config, ports) {
1724
1727
  function addToGlobal(importMap, imports) {
1725
1728
  importMap.imports = Object.assign(importMap.imports, imports);
1726
1729
  }
1727
- function addRemoteInfos(importMap) {
1730
+ function addRemoteInfos(importMap, chunkBundles) {
1728
1731
  const remotes = ports.remoteInfoRepo.getAll();
1729
1732
  for (const [remoteName, remote] of Object.entries(remotes)) {
1730
1733
  addRemoteExposedModules(importMap, remoteName, remote);
1734
+ registerBundleChunks(chunkBundles, remoteName, "mapping-or-exposed");
1731
1735
  }
1732
1736
  }
1733
1737
  function addRemoteExposedModules(importMap, remoteName, remote) {
@@ -1744,18 +1748,18 @@ function createGenerateImportMap(config, ports) {
1744
1748
  return chunkBundles;
1745
1749
  }
1746
1750
  function addChunkImports(importMap, chunkBundles) {
1747
- const chunkImports = Object.entries(chunkBundles).reduce((imports, [remoteName, bundles]) => {
1751
+ Object.entries(chunkBundles).forEach(([remoteName, bundles]) => {
1748
1752
  const baseUrl = getScope2("CHUNKS", remoteName);
1749
- Array.from(bundles).forEach((bundleName) => {
1753
+ const imports = Array.from(bundles).reduce((_imports, bundleName) => {
1750
1754
  ports.sharedChunksRepo.tryGet(remoteName, bundleName).ifPresent((files) => {
1751
1755
  files.forEach((file) => {
1752
- imports[toChunkImport(file)] = join(baseUrl, file);
1756
+ _imports[toChunkImport(file)] = join(baseUrl, file);
1753
1757
  });
1754
1758
  });
1755
- });
1756
- return imports;
1757
- }, {});
1758
- addToGlobal(importMap, chunkImports);
1759
+ return _imports;
1760
+ }, {});
1761
+ if (Object.keys(imports).length > 0) addToScope(importMap, baseUrl, imports);
1762
+ });
1759
1763
  return importMap;
1760
1764
  }
1761
1765
  function getScope2(ctx, remoteName, externalName) {
@@ -2348,7 +2352,7 @@ function createConvertToImportMap({ log }, ports) {
2348
2352
  return;
2349
2353
  }
2350
2354
  const remoteEntryScope = getScope(remoteEntry.url);
2351
- const chunkBundles = /* @__PURE__ */ new Set();
2355
+ const chunkBundles = /* @__PURE__ */ new Set(["mapping-or-exposed"]);
2352
2356
  remoteEntry.shared.forEach((external) => {
2353
2357
  if (!external.singleton) {
2354
2358
  addToScopes(
@@ -2416,16 +2420,19 @@ function createConvertToImportMap({ log }, ports) {
2416
2420
  importMap.imports[moduleName] = moduleUrl;
2417
2421
  });
2418
2422
  }
2419
- function addChunkImports(importMap, remoteName, baseUrl, chunkBundles) {
2420
- const chunkImports = Array.from(chunkBundles).reduce((imports, bundleName) => {
2423
+ function addChunkImports(importMap, remoteName, remoteEntryScope, chunkBundles) {
2424
+ Array.from(chunkBundles).forEach((bundleName) => {
2421
2425
  ports.sharedChunksRepo.tryGet(remoteName, bundleName).ifPresent((files) => {
2422
2426
  files.forEach((file) => {
2423
- imports[toChunkImport(file)] = join(baseUrl, file);
2427
+ addToScopes(
2428
+ remoteEntryScope,
2429
+ toChunkImport(file),
2430
+ join(remoteEntryScope, file),
2431
+ importMap
2432
+ );
2424
2433
  });
2425
2434
  });
2426
- return imports;
2427
- }, {});
2428
- importMap.imports = { ...importMap.imports, ...chunkImports };
2435
+ });
2429
2436
  return importMap;
2430
2437
  }
2431
2438
  }