@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/README.md CHANGED
@@ -70,7 +70,7 @@ Get up and running in under 2 minutes:
70
70
  </script>
71
71
 
72
72
  <!-- Include the orchestrator runtime -->
73
- <script src="https://unpkg.com/@softarc/native-federation-orchestrator@4.4.0/quickstart.mjs"></script>
73
+ <script src="https://unpkg.com/@softarc/native-federation-orchestrator@4.4.1/quickstart.mjs"></script>
74
74
  </head>
75
75
  <body>
76
76
  <!-- Use your loaded components -->
@@ -88,7 +88,7 @@ Your micro frontends are now loaded and ready to use. The runtime handles the wh
88
88
 
89
89
  ```html
90
90
  <!-- Development and quick testing -->
91
- <script src="https://unpkg.com/@softarc/native-federation-orchestrator@4.4.0/quickstart.mjs"></script>
91
+ <script src="https://unpkg.com/@softarc/native-federation-orchestrator@4.4.1/quickstart.mjs"></script>
92
92
  ```
93
93
 
94
94
  ## Advanced Usage
@@ -1335,16 +1335,25 @@ function createGetRemoteEntries(config, ports) {
1335
1335
  };
1336
1336
  function addHostRemoteEntry(manifest) {
1337
1337
  if (!config.hostRemoteEntry) return manifest;
1338
- const { name, url, cacheTag, integrity } = config.hostRemoteEntry;
1339
- const urlWithCache = cacheTag ? `${url}?cacheTag=${cacheTag}` : url;
1338
+ const { name, url, integrity } = config.hostRemoteEntry;
1340
1339
  return {
1341
1340
  ...manifest,
1342
- [name]: integrity ? { url: urlWithCache, integrity } : urlWithCache
1341
+ [name]: integrity ? { url, integrity } : url
1343
1342
  };
1344
1343
  }
1345
1344
  function normalizeEntry(descriptor) {
1346
1345
  return typeof descriptor === "string" ? { url: descriptor } : descriptor;
1347
1346
  }
1347
+ function withCacheTag(url, cacheTag) {
1348
+ if (!cacheTag) return url;
1349
+ return `${url}${url.includes("?") ? "&" : "?"}cacheTag=${cacheTag}`;
1350
+ }
1351
+ function resolveCacheTag(remoteName) {
1352
+ if (config.hostRemoteEntry && remoteName === config.hostRemoteEntry.name && config.hostRemoteEntry.cacheTag) {
1353
+ return config.hostRemoteEntry.cacheTag;
1354
+ }
1355
+ return config.profile.cacheTag;
1356
+ }
1348
1357
  async function fetchRemoteEntries(manifest) {
1349
1358
  const fetchPromises = Object.entries(manifest).map(
1350
1359
  ([remoteName, descriptor]) => fetchRemoteEntry(remoteName, descriptor)
@@ -1365,8 +1374,9 @@ function createGetRemoteEntries(config, ports) {
1365
1374
  }
1366
1375
  });
1367
1376
  if (skip) return false;
1377
+ const fetchUrl = withCacheTag(remoteEntryUrl, resolveCacheTag(remoteName));
1368
1378
  try {
1369
- const remoteEntry = integrity ? await ports.remoteEntryProvider.provide(remoteEntryUrl, { integrity }) : await ports.remoteEntryProvider.provide(remoteEntryUrl);
1379
+ const remoteEntry = integrity ? await ports.remoteEntryProvider.provide(fetchUrl, { integrity }) : await ports.remoteEntryProvider.provide(fetchUrl);
1370
1380
  config.log.debug(
1371
1381
  1,
1372
1382
  `Fetched '${remoteEntry.name}' from '${remoteEntry.url}', exposing: ${JSON.stringify(remoteEntry.exposes)}`