@softarc/native-federation-orchestrator 4.5.0 → 4.5.2
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 +2 -2
- package/fesm2022/@softarc/native-federation-orchestrator.mjs +211 -171
- package/fesm2022/@softarc/native-federation-orchestrator.mjs.map +4 -4
- package/fesm2022/node.mjs +137 -108
- package/fesm2022/node.mjs.map +3 -3
- package/fesm2022/sdk.mjs +1 -63
- package/fesm2022/sdk.mjs.map +3 -3
- package/package.json +1 -1
- package/quickstart.mjs +15 -13
- package/types/lib/core/1.domain/remote-entry/remote-entry.contract.d.ts +1 -3
- package/types/lib/core/2.app/config/mode.contract.d.ts +1 -0
- package/types/lib/core/2.app/steps/pooling/pool.types.d.ts +1 -20
- package/types/lib/core/2.app/steps/pooling/pool.util.d.ts +1 -2
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.5.
|
|
73
|
+
<script src="https://unpkg.com/@softarc/native-federation-orchestrator@4.5.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.5.
|
|
91
|
+
<script src="https://unpkg.com/@softarc/native-federation-orchestrator@4.5.1/quickstart.mjs"></script>
|
|
92
92
|
```
|
|
93
93
|
|
|
94
94
|
## Advanced Usage
|
|
@@ -1578,66 +1578,6 @@ function createProcessRemoteEntries(config, ports) {
|
|
|
1578
1578
|
var GLOBAL_SCOPE = "__GLOBAL__";
|
|
1579
1579
|
var STRICT_SCOPE = "strict";
|
|
1580
1580
|
|
|
1581
|
-
// src/lib/core/1.domain/remote-entry/remote-entry.contract.ts
|
|
1582
|
-
var CHUNK_PREFIX = "@nf-internal";
|
|
1583
|
-
function toDenseSharedInfoFormat(shared) {
|
|
1584
|
-
return shared.map((external) => {
|
|
1585
|
-
if ("entries" in external) return external;
|
|
1586
|
-
const { outFileName, ...baseSharedInfoProps } = external;
|
|
1587
|
-
return {
|
|
1588
|
-
...baseSharedInfoProps,
|
|
1589
|
-
entries: { [external.packageName]: outFileName }
|
|
1590
|
-
};
|
|
1591
|
-
});
|
|
1592
|
-
}
|
|
1593
|
-
function inferPackageFromSecondary(secondary) {
|
|
1594
|
-
const parts = secondary.split("/");
|
|
1595
|
-
if (secondary.startsWith("@") && parts.length >= 2) {
|
|
1596
|
-
return parts[0] + "/" + parts[1];
|
|
1597
|
-
}
|
|
1598
|
-
return parts[0] ?? secondary;
|
|
1599
|
-
}
|
|
1600
|
-
function densifyExternals(shared) {
|
|
1601
|
-
const result = [];
|
|
1602
|
-
const groupIndex = /* @__PURE__ */ new Map();
|
|
1603
|
-
for (const entry of shared) {
|
|
1604
|
-
const isDense = "entries" in entry;
|
|
1605
|
-
const isChunk = entry.packageName.startsWith(CHUNK_PREFIX + "/");
|
|
1606
|
-
if (isDense || isChunk) {
|
|
1607
|
-
result.push(entry);
|
|
1608
|
-
continue;
|
|
1609
|
-
}
|
|
1610
|
-
const parent = inferPackageFromSecondary(entry.packageName);
|
|
1611
|
-
const sig = JSON.stringify({
|
|
1612
|
-
singleton: entry.singleton,
|
|
1613
|
-
strictVersion: entry.strictVersion,
|
|
1614
|
-
requiredVersion: entry.requiredVersion,
|
|
1615
|
-
version: entry.version,
|
|
1616
|
-
shareScope: entry.shareScope
|
|
1617
|
-
});
|
|
1618
|
-
const key = parent + " " + sig;
|
|
1619
|
-
const existing = groupIndex.get(key);
|
|
1620
|
-
if (existing === void 0) {
|
|
1621
|
-
const dense = {
|
|
1622
|
-
singleton: entry.singleton,
|
|
1623
|
-
strictVersion: entry.strictVersion,
|
|
1624
|
-
requiredVersion: entry.requiredVersion,
|
|
1625
|
-
packageName: parent,
|
|
1626
|
-
entries: { [entry.packageName]: entry.outFileName }
|
|
1627
|
-
};
|
|
1628
|
-
if (entry.version !== void 0) dense.version = entry.version;
|
|
1629
|
-
if (entry.shareScope !== void 0) dense.shareScope = entry.shareScope;
|
|
1630
|
-
if (entry.bundle !== void 0) dense.bundle = entry.bundle;
|
|
1631
|
-
if (entry.dev !== void 0) dense.dev = entry.dev;
|
|
1632
|
-
groupIndex.set(key, result.length);
|
|
1633
|
-
result.push(dense);
|
|
1634
|
-
} else {
|
|
1635
|
-
result[existing].entries[entry.packageName] = entry.outFileName;
|
|
1636
|
-
}
|
|
1637
|
-
}
|
|
1638
|
-
return result;
|
|
1639
|
-
}
|
|
1640
|
-
|
|
1641
1581
|
// src/lib/core/2.app/steps/determine-shared-externals.ts
|
|
1642
1582
|
function createDetermineSharedExternals(config, ports) {
|
|
1643
1583
|
return () => {
|
|
@@ -1670,6 +1610,14 @@ function createDetermineSharedExternals(config, ports) {
|
|
|
1670
1610
|
}
|
|
1671
1611
|
return Promise.resolve();
|
|
1672
1612
|
};
|
|
1613
|
+
function uncoveredTears(external, winner) {
|
|
1614
|
+
const basis = winner.remotes[0].entries;
|
|
1615
|
+
return external.versions.reduce((sum, v) => {
|
|
1616
|
+
if (v === winner) return sum;
|
|
1617
|
+
if (!ports.versionCheck.isCompatible(winner.tag, v.remotes[0].requiredVersion)) return sum;
|
|
1618
|
+
return sum + v.remotes.reduce((n, r) => n + Object.keys(r.entries).filter((e) => !(e in basis)).length, 0);
|
|
1619
|
+
}, 0);
|
|
1620
|
+
}
|
|
1673
1621
|
function setVersionActions(externalName, external) {
|
|
1674
1622
|
if (external.versions.length === 1) {
|
|
1675
1623
|
external.versions[0].action = "share";
|
|
@@ -1682,12 +1630,15 @@ function createDetermineSharedExternals(config, ports) {
|
|
|
1682
1630
|
}
|
|
1683
1631
|
if (!sharedVersion) {
|
|
1684
1632
|
let leastExtraDownloads = Number.MAX_VALUE;
|
|
1633
|
+
let leastTears = Number.MAX_VALUE;
|
|
1685
1634
|
external.versions.forEach((vA) => {
|
|
1686
1635
|
const extraDownloads = external.versions.filter(
|
|
1687
1636
|
(vB) => !vB.remotes[0].cached && vB.remotes[0].strictVersion && !ports.versionCheck.isCompatible(vA.tag, vB.remotes[0].requiredVersion)
|
|
1688
1637
|
).length;
|
|
1689
|
-
|
|
1638
|
+
const tears = uncoveredTears(external, vA);
|
|
1639
|
+
if (extraDownloads < leastExtraDownloads || extraDownloads === leastExtraDownloads && tears < leastTears) {
|
|
1690
1640
|
leastExtraDownloads = extraDownloads;
|
|
1641
|
+
leastTears = tears;
|
|
1691
1642
|
sharedVersion = vA;
|
|
1692
1643
|
}
|
|
1693
1644
|
});
|
|
@@ -1710,6 +1661,22 @@ function createDetermineSharedExternals(config, ports) {
|
|
|
1710
1661
|
v.action = v.remotes[0].strictVersion ? "scope" : "skip";
|
|
1711
1662
|
});
|
|
1712
1663
|
sharedVersion.action = "share";
|
|
1664
|
+
if (config.strict.strictEntryPointCoverage) {
|
|
1665
|
+
const basis = sharedVersion.remotes[0].entries;
|
|
1666
|
+
external.versions.forEach((v) => {
|
|
1667
|
+
if (v.action !== "skip") return;
|
|
1668
|
+
const uncovered = v.remotes.some(
|
|
1669
|
+
(r) => Object.keys(r.entries).some((entrypoint) => !(entrypoint in basis))
|
|
1670
|
+
);
|
|
1671
|
+
if (uncovered) {
|
|
1672
|
+
v.action = "scope";
|
|
1673
|
+
config.log.debug(
|
|
1674
|
+
3,
|
|
1675
|
+
`[${externalName}@${v.tag}] Scoped: entrypoints not covered by shared ${externalName}@${sharedVersion.tag}.`
|
|
1676
|
+
);
|
|
1677
|
+
}
|
|
1678
|
+
});
|
|
1679
|
+
}
|
|
1713
1680
|
external.dirty = false;
|
|
1714
1681
|
return external;
|
|
1715
1682
|
}
|
|
@@ -1817,9 +1784,6 @@ function buildPools(sharedExternals, useAutoExternalPooling, log) {
|
|
|
1817
1784
|
}
|
|
1818
1785
|
|
|
1819
1786
|
// src/lib/core/2.app/steps/pooling/pool.util.ts
|
|
1820
|
-
function versionForRemote(member, remote) {
|
|
1821
|
-
return member.external.versions.find((v) => v.remotes.some((r) => r.name === remote));
|
|
1822
|
-
}
|
|
1823
1787
|
function remotesInPool(members) {
|
|
1824
1788
|
return [
|
|
1825
1789
|
...new Set(members.flatMap((m) => m.external.versions.flatMap((v) => v.remotes.map((r) => r.name))))
|
|
@@ -1827,57 +1791,12 @@ function remotesInPool(members) {
|
|
|
1827
1791
|
}
|
|
1828
1792
|
|
|
1829
1793
|
// src/lib/core/2.app/steps/pooling/pool-shared-externals.ts
|
|
1830
|
-
function
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
providers: new Set((share?.remotes ?? []).map((r) => r.name))
|
|
1837
|
-
};
|
|
1838
|
-
});
|
|
1839
|
-
}
|
|
1840
|
-
function selectCoverageAnchor(winners) {
|
|
1841
|
-
const coverage = /* @__PURE__ */ new Map();
|
|
1842
|
-
for (const winner of winners)
|
|
1843
|
-
for (const remote of winner.providers) coverage.set(remote, (coverage.get(remote) ?? 0) + 1);
|
|
1844
|
-
if (coverage.size === 0) return void 0;
|
|
1845
|
-
const anchorRemote = [...coverage.keys()].sort(
|
|
1846
|
-
(a, b) => coverage.get(b) - coverage.get(a) || a.localeCompare(b)
|
|
1847
|
-
)[0];
|
|
1848
|
-
return {
|
|
1849
|
-
anchorRemote,
|
|
1850
|
-
tagPerMember: Object.fromEntries(
|
|
1851
|
-
winners.filter((w) => w.providers.has(anchorRemote)).map((w) => [w.member.name, w.tag])
|
|
1852
|
-
)
|
|
1853
|
-
};
|
|
1854
|
-
}
|
|
1855
|
-
function classifyPoolConservative(members, anchor) {
|
|
1856
|
-
const classification = /* @__PURE__ */ new Map();
|
|
1857
|
-
for (const remote of remotesInPool(members)) {
|
|
1858
|
-
let coverageForced = false;
|
|
1859
|
-
let verdict = "follow";
|
|
1860
|
-
for (const member of members) {
|
|
1861
|
-
const version = versionForRemote(member, remote);
|
|
1862
|
-
if (!version) continue;
|
|
1863
|
-
const anchorTag = anchor.tagPerMember[member.name];
|
|
1864
|
-
if (!anchorTag) {
|
|
1865
|
-
coverageForced = true;
|
|
1866
|
-
continue;
|
|
1867
|
-
}
|
|
1868
|
-
if (version.tag === anchorTag) continue;
|
|
1869
|
-
if (version.action === "scope") {
|
|
1870
|
-
verdict = "scope-incompat";
|
|
1871
|
-
break;
|
|
1872
|
-
}
|
|
1873
|
-
}
|
|
1874
|
-
classification.set(
|
|
1875
|
-
remote,
|
|
1876
|
-
verdict === "scope-incompat" ? "scope-incompat" : coverageForced ? "scope-coverage" : "follow"
|
|
1877
|
-
);
|
|
1878
|
-
}
|
|
1879
|
-
classification.set(anchor.anchorRemote, "follow");
|
|
1880
|
-
return classification;
|
|
1794
|
+
function islandedRemotes(members) {
|
|
1795
|
+
const islanded = /* @__PURE__ */ new Set();
|
|
1796
|
+
for (const member of members)
|
|
1797
|
+
for (const version of member.external.versions)
|
|
1798
|
+
if (version.action === "scope") for (const remote of version.remotes) islanded.add(remote.name);
|
|
1799
|
+
return islanded;
|
|
1881
1800
|
}
|
|
1882
1801
|
function createPoolSharedExternals(config, ports) {
|
|
1883
1802
|
return () => {
|
|
@@ -1913,73 +1832,57 @@ function createPoolSharedExternals(config, ports) {
|
|
|
1913
1832
|
if (members.length < 2) return;
|
|
1914
1833
|
const allRemotes = remotesInPool(members);
|
|
1915
1834
|
if (allRemotes.length < 2) return;
|
|
1916
|
-
const
|
|
1917
|
-
if (!anchor) return;
|
|
1918
|
-
const classification = classifyPoolConservative(members, anchor);
|
|
1835
|
+
const islanded = islandedRemotes(members);
|
|
1919
1836
|
config.log.debug(
|
|
1920
1837
|
3,
|
|
1921
|
-
`[${scope}][pool:${poolName}]
|
|
1838
|
+
`[${scope}][pool:${poolName}] ${members.length} members across ${allRemotes.length} remotes, islanded={${[...islanded].join(", ") || "\u2205"}}
|
|
1839
|
+
` + members.map((m) => ` - ${m.name}`).join("\n")
|
|
1922
1840
|
);
|
|
1923
|
-
|
|
1924
|
-
if (incompatForced && config.strict.strictExternalCompatibility) {
|
|
1841
|
+
if (islanded.size > 0 && config.strict.strictExternalCompatibility) {
|
|
1925
1842
|
config.log.error(
|
|
1926
1843
|
3,
|
|
1927
|
-
`[${scope}][pool:${poolName}]
|
|
1844
|
+
`[${scope}][pool:${poolName}] version-incompatible remotes cannot be pooled: {${[...islanded].join(", ")}}.`
|
|
1928
1845
|
);
|
|
1929
1846
|
throw new NFError(`Could not pool '${poolName}' in scope ${scope}.`);
|
|
1930
1847
|
}
|
|
1931
1848
|
for (const member of members) {
|
|
1932
|
-
const rebuilt = rebuildMember(member,
|
|
1849
|
+
const rebuilt = rebuildMember(member, islanded);
|
|
1933
1850
|
warnIfScopedOnly(poolName, member.name, rebuilt, scope);
|
|
1934
1851
|
ports.sharedExternalsRepo.addOrUpdate(member.name, rebuilt, scope);
|
|
1935
1852
|
}
|
|
1936
1853
|
}
|
|
1937
1854
|
function warnIfScopedOnly(poolName, memberName, rebuilt, scope) {
|
|
1938
1855
|
if (rebuilt.versions.some((v) => v.action === "share")) return;
|
|
1939
|
-
const
|
|
1856
|
+
const consumers = new Set(rebuilt.versions.flatMap((v) => v.remotes.map((r) => r.name))).size;
|
|
1857
|
+
if (consumers < 2) return;
|
|
1940
1858
|
config.log.warn(
|
|
1941
1859
|
3,
|
|
1942
|
-
`[${scope}][pool:${poolName}] '${memberName}' is scoped-only \u2014 no coherent shared build provides it; ${
|
|
1860
|
+
`[${scope}][pool:${poolName}] '${memberName}' is scoped-only \u2014 no coherent shared build provides it; ${consumers} remotes download their own copy.`
|
|
1943
1861
|
);
|
|
1944
1862
|
}
|
|
1945
|
-
function rebuildMember(member,
|
|
1946
|
-
const anchorTag = anchor.tagPerMember[member.name];
|
|
1863
|
+
function rebuildMember(member, islanded) {
|
|
1947
1864
|
const entries = member.external.versions.flatMap(
|
|
1948
|
-
(v) => v.remotes.map((meta) => ({ remote: meta.name, tag: v.tag, host: v.host, meta }))
|
|
1865
|
+
(v) => v.remotes.map((meta) => ({ remote: meta.name, tag: v.tag, host: v.host, action: v.action, meta }))
|
|
1949
1866
|
);
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
const anchorHost = member.external.versions.find((v) => v.tag === anchorTag)?.host ?? false;
|
|
1967
|
-
const scopes = (e) => {
|
|
1968
|
-
const cls = classification.get(e.remote);
|
|
1969
|
-
return cls === "scope-incompat" || cls === "scope-coverage" && e.tag !== anchorTag;
|
|
1970
|
-
};
|
|
1971
|
-
const shareOnAnchor = entries.filter(
|
|
1972
|
-
(e) => e.remote !== anchor.anchorRemote && e.tag === anchorTag && !scopes(e)
|
|
1973
|
-
);
|
|
1974
|
-
const shareVersion = {
|
|
1975
|
-
tag: anchorTag,
|
|
1976
|
-
host: anchorHost,
|
|
1977
|
-
action: "share",
|
|
1978
|
-
remotes: [anchorMeta, ...shareOnAnchor.map((e) => e.meta)]
|
|
1979
|
-
};
|
|
1867
|
+
const isScoped = (e) => islanded.has(e.remote) || e.action === "scope";
|
|
1868
|
+
let scoped = entries.filter(isScoped);
|
|
1869
|
+
let clean = entries.filter((e) => !isScoped(e));
|
|
1870
|
+
if (!clean.some((e) => e.action === "share")) {
|
|
1871
|
+
scoped = [...scoped, ...clean];
|
|
1872
|
+
clean = [];
|
|
1873
|
+
}
|
|
1874
|
+
const shareEntries = clean.filter((e) => e.action === "share");
|
|
1875
|
+
const shareVersion = shareEntries.length > 0 ? [
|
|
1876
|
+
{
|
|
1877
|
+
tag: shareEntries[0].tag,
|
|
1878
|
+
host: shareEntries[0].host,
|
|
1879
|
+
action: "share",
|
|
1880
|
+
remotes: shareEntries.map((e) => e.meta)
|
|
1881
|
+
}
|
|
1882
|
+
] : [];
|
|
1980
1883
|
const skipByTag = /* @__PURE__ */ new Map();
|
|
1981
|
-
for (const e of
|
|
1982
|
-
if (e.
|
|
1884
|
+
for (const e of clean) {
|
|
1885
|
+
if (e.action !== "skip") continue;
|
|
1983
1886
|
const version = skipByTag.get(e.tag) ?? {
|
|
1984
1887
|
tag: e.tag,
|
|
1985
1888
|
host: e.host,
|
|
@@ -1989,16 +1892,25 @@ function createPoolSharedExternals(config, ports) {
|
|
|
1989
1892
|
version.remotes.push(e.meta);
|
|
1990
1893
|
skipByTag.set(e.tag, version);
|
|
1991
1894
|
}
|
|
1992
|
-
const
|
|
1993
|
-
const
|
|
1895
|
+
const scopeByTag = /* @__PURE__ */ new Map();
|
|
1896
|
+
for (const e of scoped) {
|
|
1897
|
+
const version = scopeByTag.get(e.tag) ?? {
|
|
1898
|
+
tag: e.tag,
|
|
1899
|
+
host: false,
|
|
1900
|
+
action: "scope",
|
|
1901
|
+
remotes: []
|
|
1902
|
+
};
|
|
1903
|
+
version.remotes.push(e.meta);
|
|
1904
|
+
scopeByTag.set(e.tag, version);
|
|
1905
|
+
}
|
|
1994
1906
|
return {
|
|
1995
1907
|
dirty: false,
|
|
1996
|
-
versions: [shareVersion, ...skipByTag.values(), ...
|
|
1908
|
+
versions: [...shareVersion, ...skipByTag.values(), ...scopeByTag.values()]
|
|
1997
1909
|
};
|
|
1998
1910
|
}
|
|
1999
1911
|
}
|
|
2000
1912
|
|
|
2001
|
-
// node_modules/.pnpm/@softarc+native-federation@4.3.
|
|
1913
|
+
// node_modules/.pnpm/@softarc+native-federation@4.3.2_typescript@6.0.3/node_modules/@softarc/native-federation/dist/lib/domain/core/build-notification-options.contract.js
|
|
2002
1914
|
var BuildNotificationType = /* @__PURE__ */ ((BuildNotificationType2) => {
|
|
2003
1915
|
BuildNotificationType2["COMPLETED"] = "federation-rebuild-complete";
|
|
2004
1916
|
BuildNotificationType2["ERROR"] = "federation-rebuild-error";
|
|
@@ -2006,14 +1918,14 @@ var BuildNotificationType = /* @__PURE__ */ ((BuildNotificationType2) => {
|
|
|
2006
1918
|
return BuildNotificationType2;
|
|
2007
1919
|
})(BuildNotificationType || {});
|
|
2008
1920
|
|
|
2009
|
-
// node_modules/.pnpm/@softarc+native-federation@4.3.
|
|
2010
|
-
var
|
|
1921
|
+
// node_modules/.pnpm/@softarc+native-federation@4.3.2_typescript@6.0.3/node_modules/@softarc/native-federation/dist/lib/domain/core/chunk.js
|
|
1922
|
+
var CHUNK_PREFIX = "@nf-internal";
|
|
2011
1923
|
function toChunkImport(fileName) {
|
|
2012
1924
|
if (fileName.startsWith("./")) {
|
|
2013
1925
|
fileName = fileName.slice(2);
|
|
2014
1926
|
}
|
|
2015
1927
|
const packageName = fileName.replace(/.(m|c)?js$/, "");
|
|
2016
|
-
return
|
|
1928
|
+
return CHUNK_PREFIX + "/" + packageName;
|
|
2017
1929
|
}
|
|
2018
1930
|
|
|
2019
1931
|
// src/lib/core/2.app/steps/generate-import-map.ts
|
|
@@ -2113,6 +2025,17 @@ function createGenerateImportMap(config, ports) {
|
|
|
2113
2025
|
for (const m of mappings) {
|
|
2114
2026
|
addToScope(importMap, rScope, { [m.packageName]: m.url });
|
|
2115
2027
|
}
|
|
2028
|
+
for (const [packageName, file] of Object.entries(r.entries)) {
|
|
2029
|
+
if (packageName in source.entries) continue;
|
|
2030
|
+
if (config.strict.strictEntryPointCoverage) {
|
|
2031
|
+
warnUncoveredEntrypoint(shareScope, externalName, r.name, packageName);
|
|
2032
|
+
continue;
|
|
2033
|
+
}
|
|
2034
|
+
const url = join(rScope, file);
|
|
2035
|
+
addToScope(importMap, rScope, { [packageName]: url });
|
|
2036
|
+
addIntegrity(importMap, url, r.name, file);
|
|
2037
|
+
r.cached = true;
|
|
2038
|
+
}
|
|
2116
2039
|
});
|
|
2117
2040
|
for (const m of mappings) {
|
|
2118
2041
|
addIntegrity(importMap, m.url, m.name, m.file);
|
|
@@ -2180,10 +2103,35 @@ function createGenerateImportMap(config, ports) {
|
|
|
2180
2103
|
registerBundleChunks(chunkBundles, version.remotes[0].name, version.remotes[0].bundle);
|
|
2181
2104
|
version.remotes[0].cached = true;
|
|
2182
2105
|
}
|
|
2106
|
+
for (const version of external.versions) {
|
|
2107
|
+
if (version.action !== "skip") continue;
|
|
2108
|
+
const remote = version.remotes[0];
|
|
2109
|
+
for (const [packageName, file] of Object.entries(remote.entries)) {
|
|
2110
|
+
if (importMap.imports[packageName]) continue;
|
|
2111
|
+
if (config.strict.strictEntryPointCoverage) {
|
|
2112
|
+
warnUncoveredEntrypoint(GLOBAL_SCOPE, externalName, remote.name, packageName);
|
|
2113
|
+
continue;
|
|
2114
|
+
}
|
|
2115
|
+
const scope = getScope2(GLOBAL_SCOPE, remote.name, externalName);
|
|
2116
|
+
const url = join(scope, file);
|
|
2117
|
+
addToGlobal(importMap, { [packageName]: url });
|
|
2118
|
+
addIntegrity(importMap, url, remote.name, file);
|
|
2119
|
+
registerBundleChunks(chunkBundles, remote.name, remote.bundle);
|
|
2120
|
+
remote.cached = true;
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2183
2123
|
ports.sharedExternalsRepo.addOrUpdate(externalName, external);
|
|
2184
2124
|
}
|
|
2185
2125
|
return importMap;
|
|
2186
2126
|
}
|
|
2127
|
+
function warnUncoveredEntrypoint(scope, externalName, remoteName, packageName) {
|
|
2128
|
+
const msg = `[${scope}][${externalName}][${remoteName}] Entrypoint '${packageName}' is not covered by the shared version.`;
|
|
2129
|
+
if (config.strict.strictImportMap) {
|
|
2130
|
+
config.log.error(4, msg);
|
|
2131
|
+
throw new NFError("Could not create ImportMap.");
|
|
2132
|
+
}
|
|
2133
|
+
config.log.warn(4, msg);
|
|
2134
|
+
}
|
|
2187
2135
|
function notifyDuplicateGlobalExternal(externalName) {
|
|
2188
2136
|
if (config.strict.strictImportMap) {
|
|
2189
2137
|
config.log.error(4, `[${externalName}] Shared external has multiple shared versions.`);
|
|
@@ -2445,6 +2393,9 @@ function createUpdateCache(config, ports) {
|
|
|
2445
2393
|
}
|
|
2446
2394
|
config.log.warn(8, errorMsg);
|
|
2447
2395
|
}
|
|
2396
|
+
if (action === "skip" && config.strict.strictEntryPointCoverage && sharedVersion && Object.keys(remote.entries).some((e) => !(e in sharedVersion.remotes[0].entries))) {
|
|
2397
|
+
action = "scope";
|
|
2398
|
+
}
|
|
2448
2399
|
const matchingVersion = cached.versions.find((cached2) => cached2.tag === tag);
|
|
2449
2400
|
if (matchingVersion) {
|
|
2450
2401
|
assertSameVersionCompatibility(matchingVersion);
|
|
@@ -2509,8 +2460,6 @@ function createPoolDynamicExternals(config) {
|
|
|
2509
2460
|
const memberActions = members.map((name) => actions[name].action);
|
|
2510
2461
|
if (memberActions.includes("scope")) {
|
|
2511
2462
|
members.forEach(scope);
|
|
2512
|
-
} else if (memberActions.includes("share") && memberActions.includes("skip")) {
|
|
2513
|
-
members.filter((name) => actions[name].action === "share").forEach(scope);
|
|
2514
2463
|
}
|
|
2515
2464
|
}
|
|
2516
2465
|
}
|
|
@@ -2559,6 +2508,16 @@ function createConvertToImportMap(config, ports) {
|
|
|
2559
2508
|
Object.entries(override).forEach(([packageName, url]) => {
|
|
2560
2509
|
addToScopes(remoteEntryScope, packageName, url, importMap);
|
|
2561
2510
|
});
|
|
2511
|
+
Object.entries(external.entries).forEach(([packageName, fileName]) => {
|
|
2512
|
+
if (packageName in override) return;
|
|
2513
|
+
if (config.strict.strictEntryPointCoverage) {
|
|
2514
|
+
warnUncoveredEntrypoint(remoteEntry.name, external.packageName, packageName);
|
|
2515
|
+
return;
|
|
2516
|
+
}
|
|
2517
|
+
const url = join(remoteEntryScope, fileName);
|
|
2518
|
+
addToScopes(remoteEntryScope, packageName, url, importMap);
|
|
2519
|
+
addIntegrity(importMap, url, integrityMap, fileName);
|
|
2520
|
+
});
|
|
2562
2521
|
return;
|
|
2563
2522
|
}
|
|
2564
2523
|
log.error(
|
|
@@ -2625,6 +2584,14 @@ function createConvertToImportMap(config, ports) {
|
|
|
2625
2584
|
});
|
|
2626
2585
|
return importMap;
|
|
2627
2586
|
}
|
|
2587
|
+
function warnUncoveredEntrypoint(remoteName, externalName, packageName) {
|
|
2588
|
+
const msg = `[${remoteName}][${externalName}] Entrypoint '${packageName}' is not covered by the override.`;
|
|
2589
|
+
if (config.strict.strictImportMap) {
|
|
2590
|
+
log.error(9, msg);
|
|
2591
|
+
throw new NFError("Could not create ImportMap.");
|
|
2592
|
+
}
|
|
2593
|
+
log.warn(9, msg);
|
|
2594
|
+
}
|
|
2628
2595
|
function addIntegrity(importMap, url, integrityMap, file) {
|
|
2629
2596
|
const hash = integrityMap?.[file];
|
|
2630
2597
|
if (!hash) return;
|
|
@@ -2758,6 +2725,77 @@ var createManifestProvider = () => {
|
|
|
2758
2725
|
};
|
|
2759
2726
|
};
|
|
2760
2727
|
|
|
2728
|
+
// node_modules/.pnpm/@softarc+native-federation@4.3.2_typescript@6.0.3/node_modules/@softarc/native-federation/dist/lib/utils/normalize.js
|
|
2729
|
+
function inferPackageFromSecondary(secondary) {
|
|
2730
|
+
const parts = secondary.split("/");
|
|
2731
|
+
if (secondary.startsWith("@") && parts.length >= 2) {
|
|
2732
|
+
return parts[0] + "/" + parts[1];
|
|
2733
|
+
}
|
|
2734
|
+
return parts[0];
|
|
2735
|
+
}
|
|
2736
|
+
|
|
2737
|
+
// node_modules/.pnpm/@softarc+native-federation@4.3.2_typescript@6.0.3/node_modules/@softarc/native-federation/dist/lib/core/output/densify-externals.js
|
|
2738
|
+
function isDense(entry) {
|
|
2739
|
+
return "entries" in entry;
|
|
2740
|
+
}
|
|
2741
|
+
function isFlatChunk(entry) {
|
|
2742
|
+
return entry.packageName.startsWith(CHUNK_PREFIX);
|
|
2743
|
+
}
|
|
2744
|
+
function densifyExternals(shared) {
|
|
2745
|
+
const result = [];
|
|
2746
|
+
const groupIndex = /* @__PURE__ */ new Map();
|
|
2747
|
+
for (const entry of shared) {
|
|
2748
|
+
if (isDense(entry)) {
|
|
2749
|
+
result.push(entry);
|
|
2750
|
+
continue;
|
|
2751
|
+
}
|
|
2752
|
+
if (isFlatChunk(entry)) {
|
|
2753
|
+
const { outFileName, ...rest } = entry;
|
|
2754
|
+
result.push({ ...rest, entries: { [entry.packageName]: outFileName } });
|
|
2755
|
+
continue;
|
|
2756
|
+
}
|
|
2757
|
+
const parent = inferPackageFromSecondary(entry.packageName);
|
|
2758
|
+
const sig = JSON.stringify({
|
|
2759
|
+
singleton: entry.singleton,
|
|
2760
|
+
strictVersion: entry.strictVersion,
|
|
2761
|
+
requiredVersion: entry.requiredVersion,
|
|
2762
|
+
version: entry.version,
|
|
2763
|
+
shareScope: entry.shareScope
|
|
2764
|
+
});
|
|
2765
|
+
const key = parent + " " + sig;
|
|
2766
|
+
const existing = groupIndex.get(key);
|
|
2767
|
+
if (existing === void 0) {
|
|
2768
|
+
const dense = {
|
|
2769
|
+
singleton: entry.singleton,
|
|
2770
|
+
strictVersion: entry.strictVersion,
|
|
2771
|
+
requiredVersion: entry.requiredVersion,
|
|
2772
|
+
packageName: parent,
|
|
2773
|
+
entries: { [entry.packageName]: entry.outFileName }
|
|
2774
|
+
};
|
|
2775
|
+
if (entry.version !== void 0) dense.version = entry.version;
|
|
2776
|
+
if (entry.shareScope !== void 0) dense.shareScope = entry.shareScope;
|
|
2777
|
+
if (entry.bundle !== void 0) dense.bundle = entry.bundle;
|
|
2778
|
+
if (entry.pool !== void 0) dense.pool = entry.pool;
|
|
2779
|
+
if (entry.dev !== void 0) dense.dev = entry.dev;
|
|
2780
|
+
groupIndex.set(key, result.length);
|
|
2781
|
+
result.push(dense);
|
|
2782
|
+
} else {
|
|
2783
|
+
result[existing].entries[entry.packageName] = entry.outFileName;
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
return result;
|
|
2787
|
+
}
|
|
2788
|
+
function toDenseSharedInfoFormat(shared) {
|
|
2789
|
+
return shared.map((external) => {
|
|
2790
|
+
if ("entries" in external) return external;
|
|
2791
|
+
const { outFileName, ...baseSharedInfoProps } = external;
|
|
2792
|
+
return {
|
|
2793
|
+
...baseSharedInfoProps,
|
|
2794
|
+
entries: { [external.packageName]: outFileName }
|
|
2795
|
+
};
|
|
2796
|
+
});
|
|
2797
|
+
}
|
|
2798
|
+
|
|
2761
2799
|
// src/lib/core/3.adapters/http/remote-entry-provider.ts
|
|
2762
2800
|
var createRemoteEntryProvider = (config) => {
|
|
2763
2801
|
const ensureOk = (response) => {
|
|
@@ -3213,13 +3251,15 @@ var createModeConfig = (override) => {
|
|
|
3213
3251
|
strictExternalCompatibility: override.strict,
|
|
3214
3252
|
strictExternalSameVersionCompatibility: override.strict,
|
|
3215
3253
|
strictExternalVersion: override.strict,
|
|
3216
|
-
strictImportMap: override.strict
|
|
3254
|
+
strictImportMap: override.strict,
|
|
3255
|
+
strictEntryPointCoverage: override.strict
|
|
3217
3256
|
} : {
|
|
3218
3257
|
strictRemoteEntry: override.strict?.strictRemoteEntry ?? false,
|
|
3219
3258
|
strictExternalCompatibility: override.strict?.strictExternalCompatibility ?? false,
|
|
3220
3259
|
strictExternalSameVersionCompatibility: override.strict?.strictExternalSameVersionCompatibility ?? false,
|
|
3221
3260
|
strictExternalVersion: override.strict?.strictExternalVersion ?? false,
|
|
3222
|
-
strictImportMap: override.strict?.strictImportMap ?? false
|
|
3261
|
+
strictImportMap: override.strict?.strictImportMap ?? false,
|
|
3262
|
+
strictEntryPointCoverage: override.strict?.strictEntryPointCoverage ?? false
|
|
3223
3263
|
};
|
|
3224
3264
|
return {
|
|
3225
3265
|
strict: strictnessConfig,
|