@module-federation/dts-plugin 0.1.20 → 0.2.0

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 CHANGED
@@ -1,5 +1,30 @@
1
1
  # @module-federation/dts-plugin
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 804cc3b: fix: check pid is undefined before kill it
8
+ - 52bb94c: fix(dts-plugin): ensure kill fork child process when the task is finished
9
+ - f7a6d3f: fix: download api types when types refresh
10
+ - @module-federation/sdk@0.2.0
11
+ - @module-federation/managers@0.2.0
12
+ - @module-federation/third-party-dts-extractor@0.2.0
13
+
14
+ ## 0.1.21
15
+
16
+ ### Patch Changes
17
+
18
+ - a50c459: fix: use ipv4 first while load local remote
19
+ - 88900ad: fix: support decode encode remote name
20
+ - 4cddb8a: fix: no delete exist types if fetch new types failed
21
+ - 6ee10aa: fix: replace sourceEntry with index if the value is '.'
22
+ - 1e93c5e: fix: use userOptions.typesFolder first
23
+ - Updated dependencies [88900ad]
24
+ - @module-federation/sdk@0.1.21
25
+ - @module-federation/managers@0.1.21
26
+ - @module-federation/third-party-dts-extractor@0.1.21
27
+
3
28
  ## 0.1.20
4
29
 
5
30
  ### Patch Changes
package/dist/core.js CHANGED
@@ -100,12 +100,17 @@ var import_managers2 = require("@module-federation/managers");
100
100
  var import_typescript2 = __toESM(require("typescript"));
101
101
 
102
102
  // packages/dts-plugin/src/core/lib/utils.ts
103
+ var import_fs2 = __toESM(require("fs"));
103
104
  var import_path4 = __toESM(require("path"));
105
+ var import_axios = __toESM(require("axios"));
106
+ var import_http2 = __toESM(require("http"));
107
+ var import_https = __toESM(require("https"));
108
+ var import_ansi_colors3 = __toESM(require("ansi-colors"));
104
109
 
105
110
  // packages/dts-plugin/src/core/lib/DTSManager.ts
106
111
  var import_ansi_colors2 = __toESM(require("ansi-colors"));
107
112
  var import_path3 = __toESM(require("path"));
108
- var import_promises = require("fs/promises");
113
+ var import_promises2 = require("fs/promises");
109
114
  var import_fs = __toESM(require("fs"));
110
115
  var import_sdk4 = require("@module-federation/sdk");
111
116
  var import_lodash = __toESM(require("lodash.clonedeepwith"));
@@ -113,8 +118,8 @@ var import_third_party_dts_extractor2 = require("@module-federation/third-party-
113
118
 
114
119
  // packages/dts-plugin/src/core/lib/archiveHandler.ts
115
120
  var import_adm_zip = __toESM(require("adm-zip"));
116
- var import_axios = __toESM(require("axios"));
117
121
  var import_path2 = require("path");
122
+ var import_promises = require("fs/promises");
118
123
 
119
124
  // packages/dts-plugin/src/core/lib/typeScriptCompiler.ts
120
125
  var import_ansi_colors = __toESM(require("ansi-colors"));
@@ -142,7 +147,10 @@ var createHost = /* @__PURE__ */ __name((mapComponentsToExpose, tsConfig, remote
142
147
  host.writeFile = (filepath, text, writeOrderByteMark, onError, sourceFiles, data) => {
143
148
  originalWriteFile(filepath, text, writeOrderByteMark, onError, sourceFiles, data);
144
149
  for (const sourceFile of sourceFiles || []) {
145
- const sourceEntry = mapExposeToEntry[(0, import_path.normalize)(sourceFile.fileName)];
150
+ let sourceEntry = mapExposeToEntry[(0, import_path.normalize)(sourceFile.fileName)];
151
+ if (sourceEntry === ".") {
152
+ sourceEntry = "index";
153
+ }
146
154
  if (sourceEntry) {
147
155
  const mfeTypeEntry = (0, import_path.join)(mfTypePath, `${sourceEntry}${DEFINITION_FILE_EXTENSION}`);
148
156
  const mfeTypeEntryDirectory = (0, import_path.dirname)(mfeTypeEntry);
@@ -1093,9 +1101,19 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
1093
1101
  while (retries++ < hostOptions.maxRetries) {
1094
1102
  try {
1095
1103
  const url = fileToDownload;
1096
- const response = yield import_axios.default.get(url, {
1104
+ const response = yield axiosGet(url, {
1097
1105
  responseType: "arraybuffer"
1098
1106
  }).catch(downloadErrorLogger(destinationFolder, url));
1107
+ try {
1108
+ if (hostOptions.deleteTypesFolder) {
1109
+ yield (0, import_promises.rm)(destinationPath, {
1110
+ recursive: true,
1111
+ force: true
1112
+ });
1113
+ }
1114
+ } catch (error2) {
1115
+ fileLog(`Unable to remove types folder, ${error2}`, "downloadTypesArchive", "error");
1116
+ }
1099
1117
  const zip = new import_adm_zip.default(Buffer.from(response.data));
1100
1118
  zip.extractAllTo(destinationPath, true);
1101
1119
  return [
@@ -1142,8 +1160,12 @@ var buildApiTypeUrl = /* @__PURE__ */ __name((zipUrl) => {
1142
1160
  }, "buildApiTypeUrl");
1143
1161
  var retrieveRemoteInfo = /* @__PURE__ */ __name((options) => {
1144
1162
  const { hostOptions, remoteAlias, remote } = options;
1145
- const parsedInfo = (0, import_sdk3.parseEntry)(remote, void 0, "@");
1146
- const url = "entry" in parsedInfo ? parsedInfo.entry : parsedInfo.name === remote ? remote : "";
1163
+ let decodedRemote = remote;
1164
+ if (decodedRemote.startsWith(import_sdk3.ENCODE_NAME_PREFIX)) {
1165
+ decodedRemote = (0, import_sdk3.decodeName)(decodedRemote, import_sdk3.ENCODE_NAME_PREFIX);
1166
+ }
1167
+ const parsedInfo = (0, import_sdk3.parseEntry)(decodedRemote, void 0, "@");
1168
+ const url = "entry" in parsedInfo ? parsedInfo.entry : parsedInfo.name === decodedRemote ? decodedRemote : "";
1147
1169
  const zipUrl = url ? buildZipUrl(hostOptions, url) : "";
1148
1170
  return {
1149
1171
  name: parsedInfo.name || remoteAlias,
@@ -1182,7 +1204,6 @@ var retrieveHostConfig = /* @__PURE__ */ __name((options) => {
1182
1204
  }, "retrieveHostConfig");
1183
1205
 
1184
1206
  // packages/dts-plugin/src/core/lib/DTSManager.ts
1185
- var import_axios2 = __toESM(require("axios"));
1186
1207
  var _a;
1187
1208
  var DTSManager = (_a = class {
1188
1209
  constructor(options) {
@@ -1278,11 +1299,17 @@ var DTSManager = (_a = class {
1278
1299
  apiTypesPath = retrieveMfAPITypesPath(tsConfig, remoteOptions);
1279
1300
  import_fs.default.writeFileSync(apiTypesPath, apiTypes);
1280
1301
  }
1281
- if (remoteOptions.deleteTypesFolder) {
1282
- yield (0, import_promises.rm)(retrieveMfTypesPath(tsConfig, remoteOptions), {
1283
- recursive: true,
1284
- force: true
1285
- });
1302
+ try {
1303
+ if (remoteOptions.deleteTypesFolder) {
1304
+ yield (0, import_promises2.rm)(retrieveMfTypesPath(tsConfig, remoteOptions), {
1305
+ recursive: true,
1306
+ force: true
1307
+ });
1308
+ }
1309
+ } catch (err) {
1310
+ if (isDebugMode()) {
1311
+ console.error(err);
1312
+ }
1286
1313
  }
1287
1314
  console.log(import_ansi_colors2.default.green("Federated types created correctly"));
1288
1315
  } catch (error2) {
@@ -1301,10 +1328,7 @@ var DTSManager = (_a = class {
1301
1328
  return remoteInfo;
1302
1329
  }
1303
1330
  const url = remoteInfo.url;
1304
- const res = yield (0, import_axios2.default)({
1305
- method: "get",
1306
- url
1307
- });
1331
+ const res = yield axiosGet(url);
1308
1332
  const manifestJson = res.data;
1309
1333
  if (!manifestJson.metaData.types.zip) {
1310
1334
  throw new Error(`Can not get ${remoteInfo.name}'s types archive url!`);
@@ -1353,7 +1377,7 @@ var DTSManager = (_a = class {
1353
1377
  }
1354
1378
  try {
1355
1379
  const url = apiTypeUrl;
1356
- const res = yield import_axios2.default.get(url);
1380
+ const res = yield axiosGet(url);
1357
1381
  let apiTypeFile = res.data;
1358
1382
  apiTypeFile = apiTypeFile.replaceAll(REMOTE_ALIAS_IDENTIFIER, remoteInfo.alias);
1359
1383
  const filePath = import_path3.default.join(destinationPath, REMOTE_API_TYPES_FILE_NAME);
@@ -1410,12 +1434,6 @@ var DTSManager = (_a = class {
1410
1434
  consumeArchiveTypes(options) {
1411
1435
  return __async(this, null, function* () {
1412
1436
  const { hostOptions, mapRemotesToDownload } = retrieveHostConfig(options);
1413
- if (hostOptions.deleteTypesFolder) {
1414
- yield (0, import_promises.rm)(hostOptions.typesFolder, {
1415
- recursive: true,
1416
- force: true
1417
- }).catch((error2) => fileLog(`Unable to remove types folder, ${error2}`, "consumeArchiveTypes", "error"));
1418
- }
1419
1437
  const downloadPromises = Object.entries(mapRemotesToDownload).map((item) => __async(this, null, function* () {
1420
1438
  const remoteInfo = item[1];
1421
1439
  if (!this.remoteAliasMap[remoteInfo.alias]) {
@@ -1487,6 +1505,10 @@ var DTSManager = (_a = class {
1487
1505
  }
1488
1506
  const { hostOptions, mapRemotesToDownload } = retrieveHostConfig(this.options.host);
1489
1507
  const loadedRemoteInfo = Object.values(remoteAliasMap).find((i) => i.name === remoteName);
1508
+ const consumeTypes2 = /* @__PURE__ */ __name((requiredRemoteInfo) => __async(this, null, function* () {
1509
+ const [_alias, destinationPath] = yield this.consumeTargetRemotes(hostOptions, requiredRemoteInfo);
1510
+ yield this.downloadAPITypes(requiredRemoteInfo, destinationPath);
1511
+ }), "consumeTypes");
1490
1512
  if (!loadedRemoteInfo) {
1491
1513
  const remoteInfo = Object.values(mapRemotesToDownload).find((item) => {
1492
1514
  return item.name === remoteName;
@@ -1496,11 +1518,10 @@ var DTSManager = (_a = class {
1496
1518
  const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo);
1497
1519
  this.remoteAliasMap[remoteInfo.alias] = requiredRemoteInfo;
1498
1520
  }
1499
- yield this.consumeTargetRemotes(hostOptions, this.remoteAliasMap[remoteInfo.alias]);
1521
+ yield consumeTypes2(this.remoteAliasMap[remoteInfo.alias]);
1500
1522
  } else if (updatedRemoteInfo) {
1501
1523
  const consumeDynamicRemoteTypes = /* @__PURE__ */ __name(() => __async(this, null, function* () {
1502
- const [_destinationFolder, destinationPath] = yield this.consumeTargetRemotes(hostOptions, this.updatedRemoteInfos[updatedRemoteInfo.name]);
1503
- yield this.downloadAPITypes(this.updatedRemoteInfos[updatedRemoteInfo.name], destinationPath);
1524
+ yield consumeTypes2(this.updatedRemoteInfos[updatedRemoteInfo.name]);
1504
1525
  this.consumeAPITypes(hostOptions);
1505
1526
  }), "consumeDynamicRemoteTypes");
1506
1527
  if (!this.updatedRemoteInfos[updatedRemoteInfo.name]) {
@@ -1519,7 +1540,7 @@ var DTSManager = (_a = class {
1519
1540
  }
1520
1541
  }
1521
1542
  } else {
1522
- yield this.consumeTargetRemotes(hostOptions, loadedRemoteInfo);
1543
+ yield consumeTypes2(loadedRemoteInfo);
1523
1544
  }
1524
1545
  }
1525
1546
  } catch (err) {
@@ -1530,8 +1551,6 @@ var DTSManager = (_a = class {
1530
1551
  }, __name(_a, "DTSManager"), _a);
1531
1552
 
1532
1553
  // packages/dts-plugin/src/core/lib/utils.ts
1533
- var import_fs2 = __toESM(require("fs"));
1534
- var import_ansi_colors3 = __toESM(require("ansi-colors"));
1535
1554
  function getDTSManagerConstructor(implementation) {
1536
1555
  if (implementation) {
1537
1556
  const NewConstructor = require(implementation);
@@ -1580,6 +1599,10 @@ function retrieveTypesAssetsInfo(options) {
1580
1599
  }
1581
1600
  }
1582
1601
  __name(retrieveTypesAssetsInfo, "retrieveTypesAssetsInfo");
1602
+ function isDebugMode() {
1603
+ return Boolean(process.env["FEDERATION_DEBUG"]) || process.env["NODE_ENV"] === "test";
1604
+ }
1605
+ __name(isDebugMode, "isDebugMode");
1583
1606
  var isTSProject = /* @__PURE__ */ __name((dtsOptions, context = process.cwd()) => {
1584
1607
  if (dtsOptions === false) {
1585
1608
  return false;
@@ -1599,6 +1622,21 @@ var isTSProject = /* @__PURE__ */ __name((dtsOptions, context = process.cwd()) =
1599
1622
  return false;
1600
1623
  }
1601
1624
  }, "isTSProject");
1625
+ function axiosGet(url, config) {
1626
+ return __async(this, null, function* () {
1627
+ const httpAgent = new import_http2.default.Agent({
1628
+ family: 4
1629
+ });
1630
+ const httpsAgent = new import_https.default.Agent({
1631
+ family: 4
1632
+ });
1633
+ return import_axios.default.get(url, __spreadValues({
1634
+ httpAgent,
1635
+ httpsAgent
1636
+ }, config));
1637
+ });
1638
+ }
1639
+ __name(axiosGet, "axiosGet");
1602
1640
 
1603
1641
  // packages/dts-plugin/src/core/configurations/remotePlugin.ts
1604
1642
  var defaultOptions2 = {
@@ -1950,8 +1988,28 @@ var _DtsWorker = class _DtsWorker {
1950
1988
  }
1951
1989
  }
1952
1990
  get controlledPromise() {
1991
+ const ensureChildProcessExit = /* @__PURE__ */ __name(() => {
1992
+ var _a3;
1993
+ try {
1994
+ const pid = (_a3 = this.rpcWorker.process) == null ? void 0 : _a3.pid;
1995
+ const rootPid = process.pid;
1996
+ if (pid && rootPid !== pid) {
1997
+ process.kill(pid, 0);
1998
+ }
1999
+ } catch (error2) {
2000
+ if (isDebugMode()) {
2001
+ console.error(error2);
2002
+ }
2003
+ }
2004
+ }, "ensureChildProcessExit");
1953
2005
  return Promise.resolve(this._res).then(() => {
1954
2006
  this.exit();
2007
+ ensureChildProcessExit();
2008
+ }).catch((err) => {
2009
+ if (isDebugMode()) {
2010
+ console.error(err);
2011
+ }
2012
+ ensureChildProcessExit();
1955
2013
  });
1956
2014
  }
1957
2015
  exit() {
@@ -32,12 +32,17 @@ import { utils as utils2 } from "@module-federation/managers";
32
32
  import typescript2 from "typescript";
33
33
 
34
34
  // packages/dts-plugin/src/core/lib/utils.ts
35
+ import fs3 from "fs";
35
36
  import path3 from "path";
37
+ import axios from "axios";
38
+ import http from "http";
39
+ import https from "https";
40
+ import ansiColors3 from "ansi-colors";
36
41
 
37
42
  // packages/dts-plugin/src/core/lib/DTSManager.ts
38
43
  import ansiColors2 from "ansi-colors";
39
44
  import path2 from "path";
40
- import { rm } from "fs/promises";
45
+ import { rm as rm2 } from "fs/promises";
41
46
  import fs2 from "fs";
42
47
  import { MANIFEST_EXT, inferAutoPublicPath } from "@module-federation/sdk";
43
48
  import cloneDeepWith from "lodash.clonedeepwith";
@@ -45,8 +50,8 @@ import { ThirdPartyExtractor as ThirdPartyExtractor2 } from "@module-federation/
45
50
 
46
51
  // packages/dts-plugin/src/core/lib/archiveHandler.ts
47
52
  import AdmZip from "adm-zip";
48
- import axios from "axios";
49
53
  import { resolve as resolve2, join as join2 } from "path";
54
+ import { rm } from "fs/promises";
50
55
 
51
56
  // packages/dts-plugin/src/core/lib/typeScriptCompiler.ts
52
57
  import ansiColors from "ansi-colors";
@@ -74,7 +79,10 @@ var createHost = /* @__PURE__ */ __name((mapComponentsToExpose, tsConfig, remote
74
79
  host.writeFile = (filepath, text, writeOrderByteMark, onError, sourceFiles, data) => {
75
80
  originalWriteFile(filepath, text, writeOrderByteMark, onError, sourceFiles, data);
76
81
  for (const sourceFile of sourceFiles || []) {
77
- const sourceEntry = mapExposeToEntry[normalize(sourceFile.fileName)];
82
+ let sourceEntry = mapExposeToEntry[normalize(sourceFile.fileName)];
83
+ if (sourceEntry === ".") {
84
+ sourceEntry = "index";
85
+ }
78
86
  if (sourceEntry) {
79
87
  const mfeTypeEntry = join(mfTypePath, `${sourceEntry}${DEFINITION_FILE_EXTENSION}`);
80
88
  const mfeTypeEntryDirectory = dirname(mfeTypeEntry);
@@ -1422,9 +1430,19 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
1422
1430
  while (retries++ < hostOptions.maxRetries) {
1423
1431
  try {
1424
1432
  const url = fileToDownload;
1425
- const response = yield axios.get(url, {
1433
+ const response = yield axiosGet(url, {
1426
1434
  responseType: "arraybuffer"
1427
1435
  }).catch(downloadErrorLogger(destinationFolder, url));
1436
+ try {
1437
+ if (hostOptions.deleteTypesFolder) {
1438
+ yield rm(destinationPath, {
1439
+ recursive: true,
1440
+ force: true
1441
+ });
1442
+ }
1443
+ } catch (error2) {
1444
+ fileLog(`Unable to remove types folder, ${error2}`, "downloadTypesArchive", "error");
1445
+ }
1428
1446
  const zip = new AdmZip(Buffer.from(response.data));
1429
1447
  zip.extractAllTo(destinationPath, true);
1430
1448
  return [
@@ -1445,7 +1463,7 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
1445
1463
  }, "downloadTypesArchive");
1446
1464
 
1447
1465
  // packages/dts-plugin/src/core/configurations/hostPlugin.ts
1448
- import { parseEntry } from "@module-federation/sdk";
1466
+ import { parseEntry, ENCODE_NAME_PREFIX, decodeName } from "@module-federation/sdk";
1449
1467
  import { utils } from "@module-federation/managers";
1450
1468
  var defaultOptions = {
1451
1469
  typesFolder: "@mf-types",
@@ -1471,8 +1489,12 @@ var buildApiTypeUrl = /* @__PURE__ */ __name((zipUrl) => {
1471
1489
  }, "buildApiTypeUrl");
1472
1490
  var retrieveRemoteInfo = /* @__PURE__ */ __name((options) => {
1473
1491
  const { hostOptions, remoteAlias, remote } = options;
1474
- const parsedInfo = parseEntry(remote, void 0, "@");
1475
- const url = "entry" in parsedInfo ? parsedInfo.entry : parsedInfo.name === remote ? remote : "";
1492
+ let decodedRemote = remote;
1493
+ if (decodedRemote.startsWith(ENCODE_NAME_PREFIX)) {
1494
+ decodedRemote = decodeName(decodedRemote, ENCODE_NAME_PREFIX);
1495
+ }
1496
+ const parsedInfo = parseEntry(decodedRemote, void 0, "@");
1497
+ const url = "entry" in parsedInfo ? parsedInfo.entry : parsedInfo.name === decodedRemote ? decodedRemote : "";
1476
1498
  const zipUrl = url ? buildZipUrl(hostOptions, url) : "";
1477
1499
  return {
1478
1500
  name: parsedInfo.name || remoteAlias,
@@ -1511,7 +1533,6 @@ var retrieveHostConfig = /* @__PURE__ */ __name((options) => {
1511
1533
  }, "retrieveHostConfig");
1512
1534
 
1513
1535
  // packages/dts-plugin/src/core/lib/DTSManager.ts
1514
- import axios2 from "axios";
1515
1536
  var _a;
1516
1537
  var DTSManager = (_a = class {
1517
1538
  constructor(options) {
@@ -1607,11 +1628,17 @@ var DTSManager = (_a = class {
1607
1628
  apiTypesPath = retrieveMfAPITypesPath(tsConfig, remoteOptions);
1608
1629
  fs2.writeFileSync(apiTypesPath, apiTypes);
1609
1630
  }
1610
- if (remoteOptions.deleteTypesFolder) {
1611
- yield rm(retrieveMfTypesPath(tsConfig, remoteOptions), {
1612
- recursive: true,
1613
- force: true
1614
- });
1631
+ try {
1632
+ if (remoteOptions.deleteTypesFolder) {
1633
+ yield rm2(retrieveMfTypesPath(tsConfig, remoteOptions), {
1634
+ recursive: true,
1635
+ force: true
1636
+ });
1637
+ }
1638
+ } catch (err) {
1639
+ if (isDebugMode()) {
1640
+ console.error(err);
1641
+ }
1615
1642
  }
1616
1643
  console.log(ansiColors2.green("Federated types created correctly"));
1617
1644
  } catch (error2) {
@@ -1630,10 +1657,7 @@ var DTSManager = (_a = class {
1630
1657
  return remoteInfo;
1631
1658
  }
1632
1659
  const url = remoteInfo.url;
1633
- const res = yield axios2({
1634
- method: "get",
1635
- url
1636
- });
1660
+ const res = yield axiosGet(url);
1637
1661
  const manifestJson = res.data;
1638
1662
  if (!manifestJson.metaData.types.zip) {
1639
1663
  throw new Error(`Can not get ${remoteInfo.name}'s types archive url!`);
@@ -1682,7 +1706,7 @@ var DTSManager = (_a = class {
1682
1706
  }
1683
1707
  try {
1684
1708
  const url = apiTypeUrl;
1685
- const res = yield axios2.get(url);
1709
+ const res = yield axiosGet(url);
1686
1710
  let apiTypeFile = res.data;
1687
1711
  apiTypeFile = apiTypeFile.replaceAll(REMOTE_ALIAS_IDENTIFIER, remoteInfo.alias);
1688
1712
  const filePath = path2.join(destinationPath, REMOTE_API_TYPES_FILE_NAME);
@@ -1739,12 +1763,6 @@ var DTSManager = (_a = class {
1739
1763
  consumeArchiveTypes(options) {
1740
1764
  return __async(this, null, function* () {
1741
1765
  const { hostOptions, mapRemotesToDownload } = retrieveHostConfig(options);
1742
- if (hostOptions.deleteTypesFolder) {
1743
- yield rm(hostOptions.typesFolder, {
1744
- recursive: true,
1745
- force: true
1746
- }).catch((error2) => fileLog(`Unable to remove types folder, ${error2}`, "consumeArchiveTypes", "error"));
1747
- }
1748
1766
  const downloadPromises = Object.entries(mapRemotesToDownload).map((item) => __async(this, null, function* () {
1749
1767
  const remoteInfo = item[1];
1750
1768
  if (!this.remoteAliasMap[remoteInfo.alias]) {
@@ -1816,6 +1834,10 @@ var DTSManager = (_a = class {
1816
1834
  }
1817
1835
  const { hostOptions, mapRemotesToDownload } = retrieveHostConfig(this.options.host);
1818
1836
  const loadedRemoteInfo = Object.values(remoteAliasMap).find((i) => i.name === remoteName);
1837
+ const consumeTypes2 = /* @__PURE__ */ __name((requiredRemoteInfo) => __async(this, null, function* () {
1838
+ const [_alias, destinationPath] = yield this.consumeTargetRemotes(hostOptions, requiredRemoteInfo);
1839
+ yield this.downloadAPITypes(requiredRemoteInfo, destinationPath);
1840
+ }), "consumeTypes");
1819
1841
  if (!loadedRemoteInfo) {
1820
1842
  const remoteInfo = Object.values(mapRemotesToDownload).find((item) => {
1821
1843
  return item.name === remoteName;
@@ -1825,11 +1847,10 @@ var DTSManager = (_a = class {
1825
1847
  const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo);
1826
1848
  this.remoteAliasMap[remoteInfo.alias] = requiredRemoteInfo;
1827
1849
  }
1828
- yield this.consumeTargetRemotes(hostOptions, this.remoteAliasMap[remoteInfo.alias]);
1850
+ yield consumeTypes2(this.remoteAliasMap[remoteInfo.alias]);
1829
1851
  } else if (updatedRemoteInfo) {
1830
1852
  const consumeDynamicRemoteTypes = /* @__PURE__ */ __name(() => __async(this, null, function* () {
1831
- const [_destinationFolder, destinationPath] = yield this.consumeTargetRemotes(hostOptions, this.updatedRemoteInfos[updatedRemoteInfo.name]);
1832
- yield this.downloadAPITypes(this.updatedRemoteInfos[updatedRemoteInfo.name], destinationPath);
1853
+ yield consumeTypes2(this.updatedRemoteInfos[updatedRemoteInfo.name]);
1833
1854
  this.consumeAPITypes(hostOptions);
1834
1855
  }), "consumeDynamicRemoteTypes");
1835
1856
  if (!this.updatedRemoteInfos[updatedRemoteInfo.name]) {
@@ -1848,7 +1869,7 @@ var DTSManager = (_a = class {
1848
1869
  }
1849
1870
  }
1850
1871
  } else {
1851
- yield this.consumeTargetRemotes(hostOptions, loadedRemoteInfo);
1872
+ yield consumeTypes2(loadedRemoteInfo);
1852
1873
  }
1853
1874
  }
1854
1875
  } catch (err) {
@@ -1859,8 +1880,6 @@ var DTSManager = (_a = class {
1859
1880
  }, __name(_a, "DTSManager"), _a);
1860
1881
 
1861
1882
  // packages/dts-plugin/src/core/lib/utils.ts
1862
- import fs3 from "fs";
1863
- import ansiColors3 from "ansi-colors";
1864
1883
  function getDTSManagerConstructor(implementation) {
1865
1884
  if (implementation) {
1866
1885
  const NewConstructor = __require(implementation);
@@ -1909,6 +1928,10 @@ function retrieveTypesAssetsInfo(options) {
1909
1928
  }
1910
1929
  }
1911
1930
  __name(retrieveTypesAssetsInfo, "retrieveTypesAssetsInfo");
1931
+ function isDebugMode() {
1932
+ return Boolean(process.env["FEDERATION_DEBUG"]) || process.env["NODE_ENV"] === "test";
1933
+ }
1934
+ __name(isDebugMode, "isDebugMode");
1912
1935
  var isTSProject = /* @__PURE__ */ __name((dtsOptions, context = process.cwd()) => {
1913
1936
  if (dtsOptions === false) {
1914
1937
  return false;
@@ -1928,6 +1951,21 @@ var isTSProject = /* @__PURE__ */ __name((dtsOptions, context = process.cwd()) =
1928
1951
  return false;
1929
1952
  }
1930
1953
  }, "isTSProject");
1954
+ function axiosGet(url, config) {
1955
+ return __async(this, null, function* () {
1956
+ const httpAgent = new http.Agent({
1957
+ family: 4
1958
+ });
1959
+ const httpsAgent = new https.Agent({
1960
+ family: 4
1961
+ });
1962
+ return axios.get(url, __spreadValues({
1963
+ httpAgent,
1964
+ httpsAgent
1965
+ }, config));
1966
+ });
1967
+ }
1968
+ __name(axiosGet, "axiosGet");
1931
1969
 
1932
1970
  // packages/dts-plugin/src/core/configurations/remotePlugin.ts
1933
1971
  var defaultOptions2 = {
@@ -2279,8 +2317,28 @@ var _DtsWorker = class _DtsWorker {
2279
2317
  }
2280
2318
  }
2281
2319
  get controlledPromise() {
2320
+ const ensureChildProcessExit = /* @__PURE__ */ __name(() => {
2321
+ var _a3;
2322
+ try {
2323
+ const pid = (_a3 = this.rpcWorker.process) == null ? void 0 : _a3.pid;
2324
+ const rootPid = process.pid;
2325
+ if (pid && rootPid !== pid) {
2326
+ process.kill(pid, 0);
2327
+ }
2328
+ } catch (error2) {
2329
+ if (isDebugMode()) {
2330
+ console.error(error2);
2331
+ }
2332
+ }
2333
+ }, "ensureChildProcessExit");
2282
2334
  return Promise.resolve(this._res).then(() => {
2283
2335
  this.exit();
2336
+ ensureChildProcessExit();
2337
+ }).catch((err) => {
2338
+ if (isDebugMode()) {
2339
+ console.error(err);
2340
+ }
2341
+ ensureChildProcessExit();
2284
2342
  });
2285
2343
  }
2286
2344
  exit() {
package/dist/esm/core.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  retrieveTypesZipPath,
15
15
  rpc_exports,
16
16
  validateOptions
17
- } from "./chunk-AJO6KMSF.js";
17
+ } from "./chunk-DQ2CDTSN.js";
18
18
  import {
19
19
  HOST_API_TYPES_FILE_NAME,
20
20
  REMOTE_ALIAS_IDENTIFIER,
@@ -9,7 +9,7 @@ import {
9
9
  retrieveRemoteConfig,
10
10
  retrieveTypesZipPath,
11
11
  rpc_exports
12
- } from "./chunk-AJO6KMSF.js";
12
+ } from "./chunk-DQ2CDTSN.js";
13
13
  import {
14
14
  getIpFromEntry
15
15
  } from "./chunk-G7ONFBMA.js";
@@ -2,7 +2,7 @@ import {
2
2
  RpcGMCallTypes,
3
3
  exposeRpc,
4
4
  generateTypes
5
- } from "./chunk-AJO6KMSF.js";
5
+ } from "./chunk-DQ2CDTSN.js";
6
6
  import {
7
7
  __async,
8
8
  __name
package/dist/esm/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  retrieveTypesAssetsInfo,
8
8
  rpc_exports,
9
9
  validateOptions
10
- } from "./chunk-AJO6KMSF.js";
10
+ } from "./chunk-DQ2CDTSN.js";
11
11
  import {
12
12
  WEB_CLIENT_OPTIONS_IDENTIFIER,
13
13
  __async,
@@ -219,7 +219,7 @@ var _DevPlugin = class _DevPlugin {
219
219
  implementation: normalizedDtsOptions === false ? void 0 : normalizedDtsOptions.implementation,
220
220
  context: compiler.context,
221
221
  moduleFederationConfig: this._options,
222
- typesFolder: "@mf-types",
222
+ typesFolder: normalizedConsumeTypes.typesFolder || "@mf-types",
223
223
  abortOnError: false
224
224
  }, normalizedConsumeTypes);
225
225
  const extraOptions = normalizedDtsOptions ? normalizedDtsOptions.extraOptions || {} : {};
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Broker,
3
3
  fileLog
4
- } from "./chunk-AJO6KMSF.js";
4
+ } from "./chunk-DQ2CDTSN.js";
5
5
  import {
6
6
  __async,
7
7
  __name