@softarc/native-federation-orchestrator 4.4.0 → 4.4.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.
package/fesm2022/node.mjs CHANGED
@@ -1918,16 +1918,25 @@ function createGetRemoteEntries(config, ports) {
1918
1918
  };
1919
1919
  function addHostRemoteEntry(manifest) {
1920
1920
  if (!config.hostRemoteEntry) return manifest;
1921
- const { name, url, cacheTag, integrity } = config.hostRemoteEntry;
1922
- const urlWithCache = cacheTag ? `${url}?cacheTag=${cacheTag}` : url;
1921
+ const { name, url, integrity } = config.hostRemoteEntry;
1923
1922
  return {
1924
1923
  ...manifest,
1925
- [name]: integrity ? { url: urlWithCache, integrity } : urlWithCache
1924
+ [name]: integrity ? { url, integrity } : url
1926
1925
  };
1927
1926
  }
1928
1927
  function normalizeEntry(descriptor) {
1929
1928
  return typeof descriptor === "string" ? { url: descriptor } : descriptor;
1930
1929
  }
1930
+ function withCacheTag(url, cacheTag) {
1931
+ if (!cacheTag) return url;
1932
+ return `${url}${url.includes("?") ? "&" : "?"}cacheTag=${cacheTag}`;
1933
+ }
1934
+ function resolveCacheTag(remoteName) {
1935
+ if (config.hostRemoteEntry && remoteName === config.hostRemoteEntry.name && config.hostRemoteEntry.cacheTag) {
1936
+ return config.hostRemoteEntry.cacheTag;
1937
+ }
1938
+ return config.profile.cacheTag;
1939
+ }
1931
1940
  async function fetchRemoteEntries(manifest) {
1932
1941
  const fetchPromises = Object.entries(manifest).map(
1933
1942
  ([remoteName, descriptor]) => fetchRemoteEntry(remoteName, descriptor)
@@ -1948,8 +1957,9 @@ function createGetRemoteEntries(config, ports) {
1948
1957
  }
1949
1958
  });
1950
1959
  if (skip) return false;
1960
+ const fetchUrl = withCacheTag(remoteEntryUrl, resolveCacheTag(remoteName));
1951
1961
  try {
1952
- const remoteEntry = integrity ? await ports.remoteEntryProvider.provide(remoteEntryUrl, { integrity }) : await ports.remoteEntryProvider.provide(remoteEntryUrl);
1962
+ const remoteEntry = integrity ? await ports.remoteEntryProvider.provide(fetchUrl, { integrity }) : await ports.remoteEntryProvider.provide(fetchUrl);
1953
1963
  config.log.debug(
1954
1964
  1,
1955
1965
  `Fetched '${remoteEntry.name}' from '${remoteEntry.url}', exposing: ${JSON.stringify(remoteEntry.exposes)}`