@module-federation/dts-plugin 0.1.21 → 0.2.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/dist/CHANGELOG.md +21 -0
- package/dist/core.js +39 -6
- package/dist/esm/{chunk-55BKSNZ4.js → chunk-CRKFI32N.js} +39 -6
- package/dist/esm/core.js +1 -1
- package/dist/esm/fork-dev-worker.js +1 -1
- package/dist/esm/fork-generate-dts.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/start-broker.js +1 -1
- package/dist/fork-dev-worker.js +19 -6
- package/dist/fork-generate-dts.js +19 -6
- package/dist/iife/launch-web-client.js +1 -1
- package/dist/index.js +39 -6
- package/dist/package.json +2 -2
- package/package.json +6 -6
package/dist/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @module-federation/dts-plugin
|
|
2
2
|
|
|
3
|
+
## 0.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 88445e7: Support getPublicPath in compiler plugins
|
|
8
|
+
- Updated dependencies [88445e7]
|
|
9
|
+
- @module-federation/sdk@0.2.1
|
|
10
|
+
- @module-federation/managers@0.2.1
|
|
11
|
+
- @module-federation/third-party-dts-extractor@0.2.1
|
|
12
|
+
|
|
13
|
+
## 0.2.0
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 804cc3b: fix: check pid is undefined before kill it
|
|
18
|
+
- 52bb94c: fix(dts-plugin): ensure kill fork child process when the task is finished
|
|
19
|
+
- f7a6d3f: fix: download api types when types refresh
|
|
20
|
+
- @module-federation/sdk@0.2.0
|
|
21
|
+
- @module-federation/managers@0.2.0
|
|
22
|
+
- @module-federation/third-party-dts-extractor@0.2.0
|
|
23
|
+
|
|
3
24
|
## 0.1.21
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/dist/core.js
CHANGED
|
@@ -1339,7 +1339,17 @@ var DTSManager = (_a = class {
|
|
|
1339
1339
|
}
|
|
1340
1340
|
return u;
|
|
1341
1341
|
}, "addProtocol");
|
|
1342
|
-
let publicPath
|
|
1342
|
+
let publicPath;
|
|
1343
|
+
if ("publicPath" in manifestJson.metaData) {
|
|
1344
|
+
publicPath = manifestJson.metaData.publicPath;
|
|
1345
|
+
} else {
|
|
1346
|
+
const getPublicPath = new Function(manifestJson.metaData.getPublicPath);
|
|
1347
|
+
if (manifestJson.metaData.getPublicPath.startsWith("function")) {
|
|
1348
|
+
publicPath = getPublicPath()();
|
|
1349
|
+
} else {
|
|
1350
|
+
publicPath = getPublicPath();
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1343
1353
|
if (publicPath === "auto") {
|
|
1344
1354
|
publicPath = (0, import_sdk4.inferAutoPublicPath)(remoteInfo.url);
|
|
1345
1355
|
}
|
|
@@ -1505,6 +1515,10 @@ var DTSManager = (_a = class {
|
|
|
1505
1515
|
}
|
|
1506
1516
|
const { hostOptions, mapRemotesToDownload } = retrieveHostConfig(this.options.host);
|
|
1507
1517
|
const loadedRemoteInfo = Object.values(remoteAliasMap).find((i) => i.name === remoteName);
|
|
1518
|
+
const consumeTypes2 = /* @__PURE__ */ __name((requiredRemoteInfo) => __async(this, null, function* () {
|
|
1519
|
+
const [_alias, destinationPath] = yield this.consumeTargetRemotes(hostOptions, requiredRemoteInfo);
|
|
1520
|
+
yield this.downloadAPITypes(requiredRemoteInfo, destinationPath);
|
|
1521
|
+
}), "consumeTypes");
|
|
1508
1522
|
if (!loadedRemoteInfo) {
|
|
1509
1523
|
const remoteInfo = Object.values(mapRemotesToDownload).find((item) => {
|
|
1510
1524
|
return item.name === remoteName;
|
|
@@ -1514,11 +1528,10 @@ var DTSManager = (_a = class {
|
|
|
1514
1528
|
const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo);
|
|
1515
1529
|
this.remoteAliasMap[remoteInfo.alias] = requiredRemoteInfo;
|
|
1516
1530
|
}
|
|
1517
|
-
yield
|
|
1531
|
+
yield consumeTypes2(this.remoteAliasMap[remoteInfo.alias]);
|
|
1518
1532
|
} else if (updatedRemoteInfo) {
|
|
1519
1533
|
const consumeDynamicRemoteTypes = /* @__PURE__ */ __name(() => __async(this, null, function* () {
|
|
1520
|
-
|
|
1521
|
-
yield this.downloadAPITypes(this.updatedRemoteInfos[updatedRemoteInfo.name], destinationPath);
|
|
1534
|
+
yield consumeTypes2(this.updatedRemoteInfos[updatedRemoteInfo.name]);
|
|
1522
1535
|
this.consumeAPITypes(hostOptions);
|
|
1523
1536
|
}), "consumeDynamicRemoteTypes");
|
|
1524
1537
|
if (!this.updatedRemoteInfos[updatedRemoteInfo.name]) {
|
|
@@ -1537,7 +1550,7 @@ var DTSManager = (_a = class {
|
|
|
1537
1550
|
}
|
|
1538
1551
|
}
|
|
1539
1552
|
} else {
|
|
1540
|
-
yield
|
|
1553
|
+
yield consumeTypes2(loadedRemoteInfo);
|
|
1541
1554
|
}
|
|
1542
1555
|
}
|
|
1543
1556
|
} catch (err) {
|
|
@@ -1597,7 +1610,7 @@ function retrieveTypesAssetsInfo(options) {
|
|
|
1597
1610
|
}
|
|
1598
1611
|
__name(retrieveTypesAssetsInfo, "retrieveTypesAssetsInfo");
|
|
1599
1612
|
function isDebugMode() {
|
|
1600
|
-
return Boolean(process.env["FEDERATION_DEBUG"]);
|
|
1613
|
+
return Boolean(process.env["FEDERATION_DEBUG"]) || process.env["NODE_ENV"] === "test";
|
|
1601
1614
|
}
|
|
1602
1615
|
__name(isDebugMode, "isDebugMode");
|
|
1603
1616
|
var isTSProject = /* @__PURE__ */ __name((dtsOptions, context = process.cwd()) => {
|
|
@@ -1985,8 +1998,28 @@ var _DtsWorker = class _DtsWorker {
|
|
|
1985
1998
|
}
|
|
1986
1999
|
}
|
|
1987
2000
|
get controlledPromise() {
|
|
2001
|
+
const ensureChildProcessExit = /* @__PURE__ */ __name(() => {
|
|
2002
|
+
var _a3;
|
|
2003
|
+
try {
|
|
2004
|
+
const pid = (_a3 = this.rpcWorker.process) == null ? void 0 : _a3.pid;
|
|
2005
|
+
const rootPid = process.pid;
|
|
2006
|
+
if (pid && rootPid !== pid) {
|
|
2007
|
+
process.kill(pid, 0);
|
|
2008
|
+
}
|
|
2009
|
+
} catch (error2) {
|
|
2010
|
+
if (isDebugMode()) {
|
|
2011
|
+
console.error(error2);
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
}, "ensureChildProcessExit");
|
|
1988
2015
|
return Promise.resolve(this._res).then(() => {
|
|
1989
2016
|
this.exit();
|
|
2017
|
+
ensureChildProcessExit();
|
|
2018
|
+
}).catch((err) => {
|
|
2019
|
+
if (isDebugMode()) {
|
|
2020
|
+
console.error(err);
|
|
2021
|
+
}
|
|
2022
|
+
ensureChildProcessExit();
|
|
1990
2023
|
});
|
|
1991
2024
|
}
|
|
1992
2025
|
exit() {
|
|
@@ -1668,7 +1668,17 @@ var DTSManager = (_a = class {
|
|
|
1668
1668
|
}
|
|
1669
1669
|
return u;
|
|
1670
1670
|
}, "addProtocol");
|
|
1671
|
-
let publicPath
|
|
1671
|
+
let publicPath;
|
|
1672
|
+
if ("publicPath" in manifestJson.metaData) {
|
|
1673
|
+
publicPath = manifestJson.metaData.publicPath;
|
|
1674
|
+
} else {
|
|
1675
|
+
const getPublicPath = new Function(manifestJson.metaData.getPublicPath);
|
|
1676
|
+
if (manifestJson.metaData.getPublicPath.startsWith("function")) {
|
|
1677
|
+
publicPath = getPublicPath()();
|
|
1678
|
+
} else {
|
|
1679
|
+
publicPath = getPublicPath();
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1672
1682
|
if (publicPath === "auto") {
|
|
1673
1683
|
publicPath = inferAutoPublicPath(remoteInfo.url);
|
|
1674
1684
|
}
|
|
@@ -1834,6 +1844,10 @@ var DTSManager = (_a = class {
|
|
|
1834
1844
|
}
|
|
1835
1845
|
const { hostOptions, mapRemotesToDownload } = retrieveHostConfig(this.options.host);
|
|
1836
1846
|
const loadedRemoteInfo = Object.values(remoteAliasMap).find((i) => i.name === remoteName);
|
|
1847
|
+
const consumeTypes2 = /* @__PURE__ */ __name((requiredRemoteInfo) => __async(this, null, function* () {
|
|
1848
|
+
const [_alias, destinationPath] = yield this.consumeTargetRemotes(hostOptions, requiredRemoteInfo);
|
|
1849
|
+
yield this.downloadAPITypes(requiredRemoteInfo, destinationPath);
|
|
1850
|
+
}), "consumeTypes");
|
|
1837
1851
|
if (!loadedRemoteInfo) {
|
|
1838
1852
|
const remoteInfo = Object.values(mapRemotesToDownload).find((item) => {
|
|
1839
1853
|
return item.name === remoteName;
|
|
@@ -1843,11 +1857,10 @@ var DTSManager = (_a = class {
|
|
|
1843
1857
|
const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo);
|
|
1844
1858
|
this.remoteAliasMap[remoteInfo.alias] = requiredRemoteInfo;
|
|
1845
1859
|
}
|
|
1846
|
-
yield
|
|
1860
|
+
yield consumeTypes2(this.remoteAliasMap[remoteInfo.alias]);
|
|
1847
1861
|
} else if (updatedRemoteInfo) {
|
|
1848
1862
|
const consumeDynamicRemoteTypes = /* @__PURE__ */ __name(() => __async(this, null, function* () {
|
|
1849
|
-
|
|
1850
|
-
yield this.downloadAPITypes(this.updatedRemoteInfos[updatedRemoteInfo.name], destinationPath);
|
|
1863
|
+
yield consumeTypes2(this.updatedRemoteInfos[updatedRemoteInfo.name]);
|
|
1851
1864
|
this.consumeAPITypes(hostOptions);
|
|
1852
1865
|
}), "consumeDynamicRemoteTypes");
|
|
1853
1866
|
if (!this.updatedRemoteInfos[updatedRemoteInfo.name]) {
|
|
@@ -1866,7 +1879,7 @@ var DTSManager = (_a = class {
|
|
|
1866
1879
|
}
|
|
1867
1880
|
}
|
|
1868
1881
|
} else {
|
|
1869
|
-
yield
|
|
1882
|
+
yield consumeTypes2(loadedRemoteInfo);
|
|
1870
1883
|
}
|
|
1871
1884
|
}
|
|
1872
1885
|
} catch (err) {
|
|
@@ -1926,7 +1939,7 @@ function retrieveTypesAssetsInfo(options) {
|
|
|
1926
1939
|
}
|
|
1927
1940
|
__name(retrieveTypesAssetsInfo, "retrieveTypesAssetsInfo");
|
|
1928
1941
|
function isDebugMode() {
|
|
1929
|
-
return Boolean(process.env["FEDERATION_DEBUG"]);
|
|
1942
|
+
return Boolean(process.env["FEDERATION_DEBUG"]) || process.env["NODE_ENV"] === "test";
|
|
1930
1943
|
}
|
|
1931
1944
|
__name(isDebugMode, "isDebugMode");
|
|
1932
1945
|
var isTSProject = /* @__PURE__ */ __name((dtsOptions, context = process.cwd()) => {
|
|
@@ -2314,8 +2327,28 @@ var _DtsWorker = class _DtsWorker {
|
|
|
2314
2327
|
}
|
|
2315
2328
|
}
|
|
2316
2329
|
get controlledPromise() {
|
|
2330
|
+
const ensureChildProcessExit = /* @__PURE__ */ __name(() => {
|
|
2331
|
+
var _a3;
|
|
2332
|
+
try {
|
|
2333
|
+
const pid = (_a3 = this.rpcWorker.process) == null ? void 0 : _a3.pid;
|
|
2334
|
+
const rootPid = process.pid;
|
|
2335
|
+
if (pid && rootPid !== pid) {
|
|
2336
|
+
process.kill(pid, 0);
|
|
2337
|
+
}
|
|
2338
|
+
} catch (error2) {
|
|
2339
|
+
if (isDebugMode()) {
|
|
2340
|
+
console.error(error2);
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2343
|
+
}, "ensureChildProcessExit");
|
|
2317
2344
|
return Promise.resolve(this._res).then(() => {
|
|
2318
2345
|
this.exit();
|
|
2346
|
+
ensureChildProcessExit();
|
|
2347
|
+
}).catch((err) => {
|
|
2348
|
+
if (isDebugMode()) {
|
|
2349
|
+
console.error(err);
|
|
2350
|
+
}
|
|
2351
|
+
ensureChildProcessExit();
|
|
2319
2352
|
});
|
|
2320
2353
|
}
|
|
2321
2354
|
exit() {
|
package/dist/esm/core.js
CHANGED
package/dist/esm/index.js
CHANGED
package/dist/esm/start-broker.js
CHANGED
package/dist/fork-dev-worker.js
CHANGED
|
@@ -1848,7 +1848,17 @@ var DTSManager = (_a = class {
|
|
|
1848
1848
|
}
|
|
1849
1849
|
return u;
|
|
1850
1850
|
}, "addProtocol");
|
|
1851
|
-
let publicPath
|
|
1851
|
+
let publicPath;
|
|
1852
|
+
if ("publicPath" in manifestJson.metaData) {
|
|
1853
|
+
publicPath = manifestJson.metaData.publicPath;
|
|
1854
|
+
} else {
|
|
1855
|
+
const getPublicPath = new Function(manifestJson.metaData.getPublicPath);
|
|
1856
|
+
if (manifestJson.metaData.getPublicPath.startsWith("function")) {
|
|
1857
|
+
publicPath = getPublicPath()();
|
|
1858
|
+
} else {
|
|
1859
|
+
publicPath = getPublicPath();
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1852
1862
|
if (publicPath === "auto") {
|
|
1853
1863
|
publicPath = (0, import_sdk4.inferAutoPublicPath)(remoteInfo.url);
|
|
1854
1864
|
}
|
|
@@ -2014,6 +2024,10 @@ var DTSManager = (_a = class {
|
|
|
2014
2024
|
}
|
|
2015
2025
|
const { hostOptions, mapRemotesToDownload } = retrieveHostConfig(this.options.host);
|
|
2016
2026
|
const loadedRemoteInfo = Object.values(remoteAliasMap).find((i) => i.name === remoteName);
|
|
2027
|
+
const consumeTypes2 = /* @__PURE__ */ __name((requiredRemoteInfo) => __async(this, null, function* () {
|
|
2028
|
+
const [_alias, destinationPath] = yield this.consumeTargetRemotes(hostOptions, requiredRemoteInfo);
|
|
2029
|
+
yield this.downloadAPITypes(requiredRemoteInfo, destinationPath);
|
|
2030
|
+
}), "consumeTypes");
|
|
2017
2031
|
if (!loadedRemoteInfo) {
|
|
2018
2032
|
const remoteInfo = Object.values(mapRemotesToDownload).find((item) => {
|
|
2019
2033
|
return item.name === remoteName;
|
|
@@ -2023,11 +2037,10 @@ var DTSManager = (_a = class {
|
|
|
2023
2037
|
const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo);
|
|
2024
2038
|
this.remoteAliasMap[remoteInfo.alias] = requiredRemoteInfo;
|
|
2025
2039
|
}
|
|
2026
|
-
yield
|
|
2040
|
+
yield consumeTypes2(this.remoteAliasMap[remoteInfo.alias]);
|
|
2027
2041
|
} else if (updatedRemoteInfo) {
|
|
2028
2042
|
const consumeDynamicRemoteTypes = /* @__PURE__ */ __name(() => __async(this, null, function* () {
|
|
2029
|
-
|
|
2030
|
-
yield this.downloadAPITypes(this.updatedRemoteInfos[updatedRemoteInfo.name], destinationPath);
|
|
2043
|
+
yield consumeTypes2(this.updatedRemoteInfos[updatedRemoteInfo.name]);
|
|
2031
2044
|
this.consumeAPITypes(hostOptions);
|
|
2032
2045
|
}), "consumeDynamicRemoteTypes");
|
|
2033
2046
|
if (!this.updatedRemoteInfos[updatedRemoteInfo.name]) {
|
|
@@ -2046,7 +2059,7 @@ var DTSManager = (_a = class {
|
|
|
2046
2059
|
}
|
|
2047
2060
|
}
|
|
2048
2061
|
} else {
|
|
2049
|
-
yield
|
|
2062
|
+
yield consumeTypes2(loadedRemoteInfo);
|
|
2050
2063
|
}
|
|
2051
2064
|
}
|
|
2052
2065
|
} catch (err) {
|
|
@@ -2071,7 +2084,7 @@ var validateOptions = /* @__PURE__ */ __name((options) => {
|
|
|
2071
2084
|
}
|
|
2072
2085
|
}, "validateOptions");
|
|
2073
2086
|
function isDebugMode() {
|
|
2074
|
-
return Boolean(process.env["FEDERATION_DEBUG"]);
|
|
2087
|
+
return Boolean(process.env["FEDERATION_DEBUG"]) || process.env["NODE_ENV"] === "test";
|
|
2075
2088
|
}
|
|
2076
2089
|
__name(isDebugMode, "isDebugMode");
|
|
2077
2090
|
function axiosGet(url, config) {
|
|
@@ -1630,7 +1630,17 @@ var DTSManager = (_a2 = class {
|
|
|
1630
1630
|
}
|
|
1631
1631
|
return u;
|
|
1632
1632
|
}, "addProtocol");
|
|
1633
|
-
let publicPath
|
|
1633
|
+
let publicPath;
|
|
1634
|
+
if ("publicPath" in manifestJson.metaData) {
|
|
1635
|
+
publicPath = manifestJson.metaData.publicPath;
|
|
1636
|
+
} else {
|
|
1637
|
+
const getPublicPath = new Function(manifestJson.metaData.getPublicPath);
|
|
1638
|
+
if (manifestJson.metaData.getPublicPath.startsWith("function")) {
|
|
1639
|
+
publicPath = getPublicPath()();
|
|
1640
|
+
} else {
|
|
1641
|
+
publicPath = getPublicPath();
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1634
1644
|
if (publicPath === "auto") {
|
|
1635
1645
|
publicPath = (0, import_sdk4.inferAutoPublicPath)(remoteInfo.url);
|
|
1636
1646
|
}
|
|
@@ -1796,6 +1806,10 @@ var DTSManager = (_a2 = class {
|
|
|
1796
1806
|
}
|
|
1797
1807
|
const { hostOptions, mapRemotesToDownload } = retrieveHostConfig(this.options.host);
|
|
1798
1808
|
const loadedRemoteInfo = Object.values(remoteAliasMap).find((i) => i.name === remoteName);
|
|
1809
|
+
const consumeTypes2 = /* @__PURE__ */ __name((requiredRemoteInfo) => __async(this, null, function* () {
|
|
1810
|
+
const [_alias, destinationPath] = yield this.consumeTargetRemotes(hostOptions, requiredRemoteInfo);
|
|
1811
|
+
yield this.downloadAPITypes(requiredRemoteInfo, destinationPath);
|
|
1812
|
+
}), "consumeTypes");
|
|
1799
1813
|
if (!loadedRemoteInfo) {
|
|
1800
1814
|
const remoteInfo = Object.values(mapRemotesToDownload).find((item) => {
|
|
1801
1815
|
return item.name === remoteName;
|
|
@@ -1805,11 +1819,10 @@ var DTSManager = (_a2 = class {
|
|
|
1805
1819
|
const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo);
|
|
1806
1820
|
this.remoteAliasMap[remoteInfo.alias] = requiredRemoteInfo;
|
|
1807
1821
|
}
|
|
1808
|
-
yield
|
|
1822
|
+
yield consumeTypes2(this.remoteAliasMap[remoteInfo.alias]);
|
|
1809
1823
|
} else if (updatedRemoteInfo) {
|
|
1810
1824
|
const consumeDynamicRemoteTypes = /* @__PURE__ */ __name(() => __async(this, null, function* () {
|
|
1811
|
-
|
|
1812
|
-
yield this.downloadAPITypes(this.updatedRemoteInfos[updatedRemoteInfo.name], destinationPath);
|
|
1825
|
+
yield consumeTypes2(this.updatedRemoteInfos[updatedRemoteInfo.name]);
|
|
1813
1826
|
this.consumeAPITypes(hostOptions);
|
|
1814
1827
|
}), "consumeDynamicRemoteTypes");
|
|
1815
1828
|
if (!this.updatedRemoteInfos[updatedRemoteInfo.name]) {
|
|
@@ -1828,7 +1841,7 @@ var DTSManager = (_a2 = class {
|
|
|
1828
1841
|
}
|
|
1829
1842
|
}
|
|
1830
1843
|
} else {
|
|
1831
|
-
yield
|
|
1844
|
+
yield consumeTypes2(loadedRemoteInfo);
|
|
1832
1845
|
}
|
|
1833
1846
|
}
|
|
1834
1847
|
} catch (err) {
|
|
@@ -1853,7 +1866,7 @@ var validateOptions = /* @__PURE__ */ __name((options) => {
|
|
|
1853
1866
|
}
|
|
1854
1867
|
}, "validateOptions");
|
|
1855
1868
|
function isDebugMode() {
|
|
1856
|
-
return Boolean(process.env["FEDERATION_DEBUG"]);
|
|
1869
|
+
return Boolean(process.env["FEDERATION_DEBUG"]) || process.env["NODE_ENV"] === "test";
|
|
1857
1870
|
}
|
|
1858
1871
|
__name(isDebugMode, "isDebugMode");
|
|
1859
1872
|
function axiosGet(url, config) {
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
APIKind2["FETCH_TYPES"] = "FETCH_TYPES";
|
|
84
84
|
})(APIKind || (APIKind = {}));
|
|
85
85
|
|
|
86
|
-
// node_modules/.pnpm/isomorphic-ws@5.0.0_ws@8.17.
|
|
86
|
+
// node_modules/.pnpm/isomorphic-ws@5.0.0_ws@8.17.1/node_modules/isomorphic-ws/browser.js
|
|
87
87
|
var ws = null;
|
|
88
88
|
if (typeof WebSocket !== "undefined") {
|
|
89
89
|
ws = WebSocket;
|
package/dist/index.js
CHANGED
|
@@ -1362,7 +1362,17 @@ var DTSManager = (_a = class {
|
|
|
1362
1362
|
}
|
|
1363
1363
|
return u;
|
|
1364
1364
|
}, "addProtocol");
|
|
1365
|
-
let publicPath
|
|
1365
|
+
let publicPath;
|
|
1366
|
+
if ("publicPath" in manifestJson.metaData) {
|
|
1367
|
+
publicPath = manifestJson.metaData.publicPath;
|
|
1368
|
+
} else {
|
|
1369
|
+
const getPublicPath = new Function(manifestJson.metaData.getPublicPath);
|
|
1370
|
+
if (manifestJson.metaData.getPublicPath.startsWith("function")) {
|
|
1371
|
+
publicPath = getPublicPath()();
|
|
1372
|
+
} else {
|
|
1373
|
+
publicPath = getPublicPath();
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1366
1376
|
if (publicPath === "auto") {
|
|
1367
1377
|
publicPath = (0, import_sdk4.inferAutoPublicPath)(remoteInfo.url);
|
|
1368
1378
|
}
|
|
@@ -1528,6 +1538,10 @@ var DTSManager = (_a = class {
|
|
|
1528
1538
|
}
|
|
1529
1539
|
const { hostOptions, mapRemotesToDownload } = retrieveHostConfig(this.options.host);
|
|
1530
1540
|
const loadedRemoteInfo = Object.values(remoteAliasMap).find((i) => i.name === remoteName);
|
|
1541
|
+
const consumeTypes2 = /* @__PURE__ */ __name((requiredRemoteInfo) => __async(this, null, function* () {
|
|
1542
|
+
const [_alias, destinationPath] = yield this.consumeTargetRemotes(hostOptions, requiredRemoteInfo);
|
|
1543
|
+
yield this.downloadAPITypes(requiredRemoteInfo, destinationPath);
|
|
1544
|
+
}), "consumeTypes");
|
|
1531
1545
|
if (!loadedRemoteInfo) {
|
|
1532
1546
|
const remoteInfo = Object.values(mapRemotesToDownload).find((item) => {
|
|
1533
1547
|
return item.name === remoteName;
|
|
@@ -1537,11 +1551,10 @@ var DTSManager = (_a = class {
|
|
|
1537
1551
|
const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo);
|
|
1538
1552
|
this.remoteAliasMap[remoteInfo.alias] = requiredRemoteInfo;
|
|
1539
1553
|
}
|
|
1540
|
-
yield
|
|
1554
|
+
yield consumeTypes2(this.remoteAliasMap[remoteInfo.alias]);
|
|
1541
1555
|
} else if (updatedRemoteInfo) {
|
|
1542
1556
|
const consumeDynamicRemoteTypes = /* @__PURE__ */ __name(() => __async(this, null, function* () {
|
|
1543
|
-
|
|
1544
|
-
yield this.downloadAPITypes(this.updatedRemoteInfos[updatedRemoteInfo.name], destinationPath);
|
|
1557
|
+
yield consumeTypes2(this.updatedRemoteInfos[updatedRemoteInfo.name]);
|
|
1545
1558
|
this.consumeAPITypes(hostOptions);
|
|
1546
1559
|
}), "consumeDynamicRemoteTypes");
|
|
1547
1560
|
if (!this.updatedRemoteInfos[updatedRemoteInfo.name]) {
|
|
@@ -1560,7 +1573,7 @@ var DTSManager = (_a = class {
|
|
|
1560
1573
|
}
|
|
1561
1574
|
}
|
|
1562
1575
|
} else {
|
|
1563
|
-
yield
|
|
1576
|
+
yield consumeTypes2(loadedRemoteInfo);
|
|
1564
1577
|
}
|
|
1565
1578
|
}
|
|
1566
1579
|
} catch (err) {
|
|
@@ -1620,7 +1633,7 @@ function retrieveTypesAssetsInfo(options) {
|
|
|
1620
1633
|
}
|
|
1621
1634
|
__name(retrieveTypesAssetsInfo, "retrieveTypesAssetsInfo");
|
|
1622
1635
|
function isDebugMode() {
|
|
1623
|
-
return Boolean(process.env["FEDERATION_DEBUG"]);
|
|
1636
|
+
return Boolean(process.env["FEDERATION_DEBUG"]) || process.env["NODE_ENV"] === "test";
|
|
1624
1637
|
}
|
|
1625
1638
|
__name(isDebugMode, "isDebugMode");
|
|
1626
1639
|
var isTSProject = /* @__PURE__ */ __name((dtsOptions, context = process.cwd()) => {
|
|
@@ -2008,8 +2021,28 @@ var _DtsWorker = class _DtsWorker {
|
|
|
2008
2021
|
}
|
|
2009
2022
|
}
|
|
2010
2023
|
get controlledPromise() {
|
|
2024
|
+
const ensureChildProcessExit = /* @__PURE__ */ __name(() => {
|
|
2025
|
+
var _a4;
|
|
2026
|
+
try {
|
|
2027
|
+
const pid = (_a4 = this.rpcWorker.process) == null ? void 0 : _a4.pid;
|
|
2028
|
+
const rootPid = process.pid;
|
|
2029
|
+
if (pid && rootPid !== pid) {
|
|
2030
|
+
process.kill(pid, 0);
|
|
2031
|
+
}
|
|
2032
|
+
} catch (error2) {
|
|
2033
|
+
if (isDebugMode()) {
|
|
2034
|
+
console.error(error2);
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
}, "ensureChildProcessExit");
|
|
2011
2038
|
return Promise.resolve(this._res).then(() => {
|
|
2012
2039
|
this.exit();
|
|
2040
|
+
ensureChildProcessExit();
|
|
2041
|
+
}).catch((err) => {
|
|
2042
|
+
if (isDebugMode()) {
|
|
2043
|
+
console.error(err);
|
|
2044
|
+
}
|
|
2045
|
+
ensureChildProcessExit();
|
|
2013
2046
|
});
|
|
2014
2047
|
}
|
|
2015
2048
|
exit() {
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/dts-plugin",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"author": "hanric <hanric.zhang@gmail.com>",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"koa": "2.11.0",
|
|
58
58
|
"log4js": "6.9.1",
|
|
59
59
|
"node-schedule": "2.1.1",
|
|
60
|
-
"ws": "8.17.
|
|
60
|
+
"ws": "8.17.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/ws": "8.5.10",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/dts-plugin",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"author": "hanric <hanric.zhang@gmail.com>",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -54,16 +54,16 @@
|
|
|
54
54
|
"koa": "2.11.0",
|
|
55
55
|
"log4js": "6.9.1",
|
|
56
56
|
"node-schedule": "2.1.1",
|
|
57
|
-
"ws": "8.17.
|
|
58
|
-
"@module-federation/sdk": "0.1
|
|
59
|
-
"@module-federation/managers": "0.1
|
|
60
|
-
"@module-federation/third-party-dts-extractor": "0.1
|
|
57
|
+
"ws": "8.17.1",
|
|
58
|
+
"@module-federation/sdk": "0.2.1",
|
|
59
|
+
"@module-federation/managers": "0.2.1",
|
|
60
|
+
"@module-federation/third-party-dts-extractor": "0.2.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/ws": "8.5.10",
|
|
64
64
|
"@types/koa": "2.11.2",
|
|
65
65
|
"@types/node-schedule": "2.1.7",
|
|
66
|
-
"@module-federation/runtime": "0.1
|
|
66
|
+
"@module-federation/runtime": "0.2.1"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"typescript": "^4.9.0 || ^5.0.0",
|