@module-federation/dts-plugin 0.9.1 → 0.10.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,17 @@
1
1
  # @module-federation/dts-plugin
2
2
 
3
+ ## 0.10.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 22fcccd: perf(dts-plugin): add fetch timeout and add log
8
+ - Updated dependencies [0f71cbc]
9
+ - Updated dependencies [22fcccd]
10
+ - @module-federation/sdk@0.10.0
11
+ - @module-federation/managers@0.10.0
12
+ - @module-federation/third-party-dts-extractor@0.10.0
13
+ - @module-federation/error-codes@0.10.0
14
+
3
15
  ## 0.9.1
4
16
 
5
17
  ### Patch Changes
@@ -39,9 +39,9 @@ declare class DTSManager {
39
39
  generateAPITypes(mapComponentsToExpose: Record<string, string>): string;
40
40
  extractRemoteTypes(options: ReturnType<typeof retrieveRemoteConfig>): Promise<void>;
41
41
  generateTypes(): Promise<void>;
42
- requestRemoteManifest(remoteInfo: RemoteInfo): Promise<Required<RemoteInfo>>;
42
+ requestRemoteManifest(remoteInfo: RemoteInfo, hostOptions: Required<HostOptions>): Promise<Required<RemoteInfo>>;
43
43
  consumeTargetRemotes(hostOptions: Required<HostOptions>, remoteInfo: Required<RemoteInfo>): Promise<[string, string]>;
44
- downloadAPITypes(remoteInfo: Required<RemoteInfo>, destinationPath: string): Promise<boolean>;
44
+ downloadAPITypes(remoteInfo: Required<RemoteInfo>, destinationPath: string, hostOptions: Required<HostOptions>): Promise<boolean>;
45
45
  consumeAPITypes(hostOptions: Required<HostOptions>): void;
46
46
  consumeArchiveTypes(options: HostOptions): Promise<{
47
47
  hostOptions: Required<HostOptions>;
package/dist/core.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { D as DTSManager, T as TsConfigJson, R as RpcRemoteMethod, a as RpcCallMessage, b as RpcGMCallTypes, c as RpcMessage, d as RpcMethod, e as RpcRejectMessage, f as RpcResolveMessage, g as RpcWorker, h as createRpcWorker, i as getRpcWorkerData } from './DtsWorker-edc3f145.js';
2
- export { j as DtsWorker, r as retrieveRemoteConfig } from './DtsWorker-edc3f145.js';
1
+ import { D as DTSManager, T as TsConfigJson, R as RpcRemoteMethod, a as RpcCallMessage, b as RpcGMCallTypes, c as RpcMessage, d as RpcMethod, e as RpcRejectMessage, f as RpcResolveMessage, g as RpcWorker, h as createRpcWorker, i as getRpcWorkerData } from './DtsWorker-bfe21fe7.js';
2
+ export { j as DtsWorker, r as retrieveRemoteConfig } from './DtsWorker-bfe21fe7.js';
3
3
  import { H as HostOptions, R as RemoteInfo, a as RemoteOptions, D as DTSManagerOptions } from './DTSManagerOptions-c74c59ed.js';
4
4
  import { moduleFederationPlugin } from '@module-federation/sdk';
5
5
  import { ChildProcess } from 'child_process';
package/dist/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { D as DTSManager, T as TsConfigJson, R as RpcRemoteMethod, a as RpcCallMessage, b as RpcGMCallTypes, c as RpcMessage, d as RpcMethod, e as RpcRejectMessage, f as RpcResolveMessage, g as RpcWorker, h as createRpcWorker, i as getRpcWorkerData } from './DtsWorker-edc3f145.js';
2
- export { j as DtsWorker, r as retrieveRemoteConfig } from './DtsWorker-edc3f145.js';
1
+ import { D as DTSManager, T as TsConfigJson, R as RpcRemoteMethod, a as RpcCallMessage, b as RpcGMCallTypes, c as RpcMessage, d as RpcMethod, e as RpcRejectMessage, f as RpcResolveMessage, g as RpcWorker, h as createRpcWorker, i as getRpcWorkerData } from './DtsWorker-bfe21fe7.js';
2
+ export { j as DtsWorker, r as retrieveRemoteConfig } from './DtsWorker-bfe21fe7.js';
3
3
  import { H as HostOptions, R as RemoteInfo, a as RemoteOptions, D as DTSManagerOptions } from './DTSManagerOptions-c74c59ed.js';
4
4
  import { moduleFederationPlugin } from '@module-federation/sdk';
5
5
  import { ChildProcess } from 'child_process';
package/dist/core.js CHANGED
@@ -1157,7 +1157,8 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
1157
1157
  try {
1158
1158
  const url = fileToDownload;
1159
1159
  const response = yield axiosGet(url, {
1160
- responseType: "arraybuffer"
1160
+ responseType: "arraybuffer",
1161
+ timeout: hostOptions.timeout
1161
1162
  }).catch(downloadErrorLogger(destinationFolder, url));
1162
1163
  if (typeof ((_a3 = response.headers) == null ? void 0 : _a3["content-type"]) === "string" && response.headers["content-type"].includes("text/html")) {
1163
1164
  throw new Error(`${url} receives invalid content-type: ${response.headers["content-type"]}`);
@@ -1205,7 +1206,8 @@ var defaultOptions = {
1205
1206
  abortOnError: true,
1206
1207
  consumeAPITypes: false,
1207
1208
  runtimePkgs: [],
1208
- remoteTypeUrls: {}
1209
+ remoteTypeUrls: {},
1210
+ timeout: 6e4
1209
1211
  };
1210
1212
  var buildZipUrl = /* @__PURE__ */ __name((hostOptions, url) => {
1211
1213
  const remoteUrl = new URL(url, "file:");
@@ -1420,7 +1422,7 @@ var DTSManager = (_a = class {
1420
1422
  }
1421
1423
  });
1422
1424
  }
1423
- requestRemoteManifest(remoteInfo) {
1425
+ requestRemoteManifest(remoteInfo, hostOptions) {
1424
1426
  return __async(this, null, function* () {
1425
1427
  try {
1426
1428
  if (!remoteInfo.url.includes(import_sdk5.MANIFEST_EXT)) {
@@ -1430,7 +1432,9 @@ var DTSManager = (_a = class {
1430
1432
  return remoteInfo;
1431
1433
  }
1432
1434
  const url = remoteInfo.url;
1433
- const res = yield axiosGet(url);
1435
+ const res = yield axiosGet(url, {
1436
+ timeout: hostOptions.timeout
1437
+ });
1434
1438
  const manifestJson = res.data;
1435
1439
  if (!manifestJson.metaData.types.zip) {
1436
1440
  throw new Error(`Can not get ${remoteInfo.name}'s types archive url!`);
@@ -1481,7 +1485,7 @@ var DTSManager = (_a = class {
1481
1485
  ]);
1482
1486
  });
1483
1487
  }
1484
- downloadAPITypes(remoteInfo, destinationPath) {
1488
+ downloadAPITypes(remoteInfo, destinationPath, hostOptions) {
1485
1489
  return __async(this, null, function* () {
1486
1490
  const { apiTypeUrl } = remoteInfo;
1487
1491
  if (!apiTypeUrl) {
@@ -1489,7 +1493,9 @@ var DTSManager = (_a = class {
1489
1493
  }
1490
1494
  try {
1491
1495
  const url = apiTypeUrl;
1492
- const res = yield axiosGet(url);
1496
+ const res = yield axiosGet(url, {
1497
+ timeout: hostOptions.timeout
1498
+ });
1493
1499
  let apiTypeFile = res.data;
1494
1500
  apiTypeFile = apiTypeFile.replaceAll(REMOTE_ALIAS_IDENTIFIER, remoteInfo.alias);
1495
1501
  const filePath = import_path3.default.join(destinationPath, REMOTE_API_TYPES_FILE_NAME);
@@ -1561,7 +1567,7 @@ var DTSManager = (_a = class {
1561
1567
  const downloadPromises = Object.entries(mapRemotesToDownload).map((item) => __async(this, null, function* () {
1562
1568
  const remoteInfo = item[1];
1563
1569
  if (!this.remoteAliasMap[remoteInfo.alias]) {
1564
- const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo);
1570
+ const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo, hostOptions);
1565
1571
  this.remoteAliasMap[remoteInfo.alias] = requiredRemoteInfo;
1566
1572
  }
1567
1573
  return this.consumeTargetRemotes(hostOptions, this.remoteAliasMap[remoteInfo.alias]);
@@ -1596,7 +1602,7 @@ var DTSManager = (_a = class {
1596
1602
  if (!remoteInfo) {
1597
1603
  return;
1598
1604
  }
1599
- yield this.downloadAPITypes(remoteInfo, destinationPath);
1605
+ yield this.downloadAPITypes(remoteInfo, destinationPath, hostOptions);
1600
1606
  })));
1601
1607
  this.consumeAPITypes(hostOptions);
1602
1608
  }
@@ -1639,7 +1645,7 @@ hostName: ${hostName}`, "updateTypes", "info");
1639
1645
  // use remoteTarPath first
1640
1646
  zipUrl: remoteTarPath || requiredRemoteInfo.zipUrl
1641
1647
  }));
1642
- const addNew = yield this.downloadAPITypes(requiredRemoteInfo, destinationPath);
1648
+ const addNew = yield this.downloadAPITypes(requiredRemoteInfo, destinationPath, hostOptions);
1643
1649
  if (addNew) {
1644
1650
  this.consumeAPITypes(hostOptions);
1645
1651
  }
@@ -1653,7 +1659,7 @@ hostName: ${hostName}`, "updateTypes", "info");
1653
1659
  fileLog(`remoteInfo: ${JSON.stringify(remoteInfo, null, 2)}`, "updateTypes", "info");
1654
1660
  if (remoteInfo) {
1655
1661
  if (!this.remoteAliasMap[remoteInfo.alias]) {
1656
- const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo);
1662
+ const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo, hostOptions);
1657
1663
  this.remoteAliasMap[remoteInfo.alias] = requiredRemoteInfo;
1658
1664
  }
1659
1665
  yield consumeTypes2(this.remoteAliasMap[remoteInfo.alias]);
@@ -1668,7 +1674,7 @@ hostName: ${hostName}`, "updateTypes", "info");
1668
1674
  remote: updatedRemoteInfo.url
1669
1675
  });
1670
1676
  fileLog(`start request manifest`, "consumeTypes", "info");
1671
- this.updatedRemoteInfos[updatedRemoteInfo.name] = yield this.requestRemoteManifest(parsedRemoteInfo);
1677
+ this.updatedRemoteInfos[updatedRemoteInfo.name] = yield this.requestRemoteManifest(parsedRemoteInfo, hostOptions);
1672
1678
  fileLog(`end request manifest, this.updatedRemoteInfos[updatedRemoteInfo.name]: ${JSON.stringify(this.updatedRemoteInfos[updatedRemoteInfo.name], null, 2)}`, "updateTypes", "info");
1673
1679
  yield consumeDynamicRemoteTypes();
1674
1680
  }
@@ -1799,12 +1805,14 @@ function axiosGet(url, config) {
1799
1805
  const httpsAgent = new import_https.default.Agent({
1800
1806
  family: 4
1801
1807
  });
1802
- return import_axios.default.get(url, __spreadValues(__spreadValues({
1808
+ return import_axios.default.get(url, __spreadProps(__spreadValues(__spreadValues({
1803
1809
  httpAgent,
1804
1810
  httpsAgent
1805
1811
  }, {
1806
1812
  headers: getEnvHeaders()
1807
- }), config));
1813
+ }), config), {
1814
+ timeout: (config == null ? void 0 : config.timeout) || 6e4
1815
+ }));
1808
1816
  });
1809
1817
  }
1810
1818
  __name(axiosGet, "axiosGet");
@@ -4,7 +4,7 @@ import {
4
4
  exposeRpc,
5
5
  getDTSManagerConstructor,
6
6
  isDebugMode
7
- } from "./chunk-ZU4UW7EP.js";
7
+ } from "./chunk-TKO3UU5B.js";
8
8
  import {
9
9
  __async,
10
10
  __export,
@@ -723,7 +723,8 @@ var defaultOptions2 = {
723
723
  abortOnError: true,
724
724
  consumeAPITypes: false,
725
725
  runtimePkgs: [],
726
- remoteTypeUrls: {}
726
+ remoteTypeUrls: {},
727
+ timeout: 6e4
727
728
  };
728
729
  var buildZipUrl = /* @__PURE__ */ __name((hostOptions, url) => {
729
730
  const remoteUrl = new URL(url, "file:");
@@ -938,7 +939,7 @@ var DTSManager = (_a = class {
938
939
  }
939
940
  });
940
941
  }
941
- requestRemoteManifest(remoteInfo) {
942
+ requestRemoteManifest(remoteInfo, hostOptions) {
942
943
  return __async(this, null, function* () {
943
944
  try {
944
945
  if (!remoteInfo.url.includes(MANIFEST_EXT)) {
@@ -948,7 +949,9 @@ var DTSManager = (_a = class {
948
949
  return remoteInfo;
949
950
  }
950
951
  const url = remoteInfo.url;
951
- const res = yield axiosGet(url);
952
+ const res = yield axiosGet(url, {
953
+ timeout: hostOptions.timeout
954
+ });
952
955
  const manifestJson = res.data;
953
956
  if (!manifestJson.metaData.types.zip) {
954
957
  throw new Error(`Can not get ${remoteInfo.name}'s types archive url!`);
@@ -999,7 +1002,7 @@ var DTSManager = (_a = class {
999
1002
  ]);
1000
1003
  });
1001
1004
  }
1002
- downloadAPITypes(remoteInfo, destinationPath) {
1005
+ downloadAPITypes(remoteInfo, destinationPath, hostOptions) {
1003
1006
  return __async(this, null, function* () {
1004
1007
  const { apiTypeUrl } = remoteInfo;
1005
1008
  if (!apiTypeUrl) {
@@ -1007,7 +1010,9 @@ var DTSManager = (_a = class {
1007
1010
  }
1008
1011
  try {
1009
1012
  const url = apiTypeUrl;
1010
- const res = yield axiosGet(url);
1013
+ const res = yield axiosGet(url, {
1014
+ timeout: hostOptions.timeout
1015
+ });
1011
1016
  let apiTypeFile = res.data;
1012
1017
  apiTypeFile = apiTypeFile.replaceAll(REMOTE_ALIAS_IDENTIFIER, remoteInfo.alias);
1013
1018
  const filePath = path2.join(destinationPath, REMOTE_API_TYPES_FILE_NAME);
@@ -1079,7 +1084,7 @@ var DTSManager = (_a = class {
1079
1084
  const downloadPromises = Object.entries(mapRemotesToDownload).map((item) => __async(this, null, function* () {
1080
1085
  const remoteInfo = item[1];
1081
1086
  if (!this.remoteAliasMap[remoteInfo.alias]) {
1082
- const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo);
1087
+ const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo, hostOptions);
1083
1088
  this.remoteAliasMap[remoteInfo.alias] = requiredRemoteInfo;
1084
1089
  }
1085
1090
  return this.consumeTargetRemotes(hostOptions, this.remoteAliasMap[remoteInfo.alias]);
@@ -1114,7 +1119,7 @@ var DTSManager = (_a = class {
1114
1119
  if (!remoteInfo) {
1115
1120
  return;
1116
1121
  }
1117
- yield this.downloadAPITypes(remoteInfo, destinationPath);
1122
+ yield this.downloadAPITypes(remoteInfo, destinationPath, hostOptions);
1118
1123
  })));
1119
1124
  this.consumeAPITypes(hostOptions);
1120
1125
  }
@@ -1157,7 +1162,7 @@ hostName: ${hostName}`, "updateTypes", "info");
1157
1162
  // use remoteTarPath first
1158
1163
  zipUrl: remoteTarPath || requiredRemoteInfo.zipUrl
1159
1164
  }));
1160
- const addNew = yield this.downloadAPITypes(requiredRemoteInfo, destinationPath);
1165
+ const addNew = yield this.downloadAPITypes(requiredRemoteInfo, destinationPath, hostOptions);
1161
1166
  if (addNew) {
1162
1167
  this.consumeAPITypes(hostOptions);
1163
1168
  }
@@ -1171,7 +1176,7 @@ hostName: ${hostName}`, "updateTypes", "info");
1171
1176
  fileLog(`remoteInfo: ${JSON.stringify(remoteInfo, null, 2)}`, "updateTypes", "info");
1172
1177
  if (remoteInfo) {
1173
1178
  if (!this.remoteAliasMap[remoteInfo.alias]) {
1174
- const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo);
1179
+ const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo, hostOptions);
1175
1180
  this.remoteAliasMap[remoteInfo.alias] = requiredRemoteInfo;
1176
1181
  }
1177
1182
  yield consumeTypes(this.remoteAliasMap[remoteInfo.alias]);
@@ -1186,7 +1191,7 @@ hostName: ${hostName}`, "updateTypes", "info");
1186
1191
  remote: updatedRemoteInfo.url
1187
1192
  });
1188
1193
  fileLog(`start request manifest`, "consumeTypes", "info");
1189
- this.updatedRemoteInfos[updatedRemoteInfo.name] = yield this.requestRemoteManifest(parsedRemoteInfo);
1194
+ this.updatedRemoteInfos[updatedRemoteInfo.name] = yield this.requestRemoteManifest(parsedRemoteInfo, hostOptions);
1190
1195
  fileLog(`end request manifest, this.updatedRemoteInfos[updatedRemoteInfo.name]: ${JSON.stringify(this.updatedRemoteInfos[updatedRemoteInfo.name], null, 2)}`, "updateTypes", "info");
1191
1196
  yield consumeDynamicRemoteTypes();
1192
1197
  }
@@ -1317,12 +1322,14 @@ function axiosGet(url, config) {
1317
1322
  const httpsAgent = new https.Agent({
1318
1323
  family: 4
1319
1324
  });
1320
- return axios.get(url, __spreadValues(__spreadValues({
1325
+ return axios.get(url, __spreadProps(__spreadValues(__spreadValues({
1321
1326
  httpAgent,
1322
1327
  httpsAgent
1323
1328
  }, {
1324
1329
  headers: getEnvHeaders()
1325
- }), config));
1330
+ }), config), {
1331
+ timeout: (config == null ? void 0 : config.timeout) || 6e4
1332
+ }));
1326
1333
  });
1327
1334
  }
1328
1335
  __name(axiosGet, "axiosGet");
@@ -1352,7 +1359,8 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
1352
1359
  try {
1353
1360
  const url = fileToDownload;
1354
1361
  const response = yield axiosGet(url, {
1355
- responseType: "arraybuffer"
1362
+ responseType: "arraybuffer",
1363
+ timeout: hostOptions.timeout
1356
1364
  }).catch(downloadErrorLogger(destinationFolder, url));
1357
1365
  if (typeof ((_a2 = response.headers) == null ? void 0 : _a2["content-type"]) === "string" && response.headers["content-type"].includes("text/html")) {
1358
1366
  throw new Error(`${url} receives invalid content-type: ${response.headers["content-type"]}`);
package/dist/esm/core.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  consumeTypes,
4
4
  generateTypesInChildProcess,
5
5
  rpc_exports
6
- } from "./chunk-LHN7ASHT.js";
6
+ } from "./chunk-IPO3NMOQ.js";
7
7
  import {
8
8
  DTSManager,
9
9
  HOST_API_TYPES_FILE_NAME,
@@ -19,7 +19,7 @@ import {
19
19
  retrieveTypesAssetsInfo,
20
20
  retrieveTypesZipPath,
21
21
  validateOptions
22
- } from "./chunk-ZU4UW7EP.js";
22
+ } from "./chunk-TKO3UU5B.js";
23
23
  import "./chunk-KCWHOFI6.js";
24
24
  import "./chunk-4CSLH7II.js";
25
25
  export {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  rpc_exports
3
- } from "./chunk-LHN7ASHT.js";
3
+ } from "./chunk-IPO3NMOQ.js";
4
4
  import {
5
5
  ModuleFederationDevServer,
6
6
  createKoaServer,
@@ -9,7 +9,7 @@ import {
9
9
  retrieveMfTypesPath,
10
10
  retrieveRemoteConfig,
11
11
  retrieveTypesZipPath
12
- } from "./chunk-ZU4UW7EP.js";
12
+ } from "./chunk-TKO3UU5B.js";
13
13
  import {
14
14
  fileLog,
15
15
  getIPV4
@@ -2,7 +2,7 @@ import {
2
2
  RpcGMCallTypes,
3
3
  exposeRpc,
4
4
  generateTypes
5
- } from "./chunk-ZU4UW7EP.js";
5
+ } from "./chunk-TKO3UU5B.js";
6
6
  import "./chunk-KCWHOFI6.js";
7
7
  import {
8
8
  __async,
package/dist/esm/index.js CHANGED
@@ -2,14 +2,14 @@ import {
2
2
  consumeTypes,
3
3
  generateTypesInChildProcess,
4
4
  rpc_exports
5
- } from "./chunk-LHN7ASHT.js";
5
+ } from "./chunk-IPO3NMOQ.js";
6
6
  import {
7
7
  cloneDeepOptions,
8
8
  generateTypes,
9
9
  isTSProject,
10
10
  retrieveTypesAssetsInfo,
11
11
  validateOptions
12
- } from "./chunk-ZU4UW7EP.js";
12
+ } from "./chunk-TKO3UU5B.js";
13
13
  import {
14
14
  getIPV4,
15
15
  logger
@@ -281,6 +281,7 @@ var DevPlugin = _DevPlugin;
281
281
  import { normalizeOptions as normalizeOptions4 } from "@module-federation/sdk";
282
282
 
283
283
  // packages/dts-plugin/src/plugins/ConsumeTypesPlugin.ts
284
+ import { logger as logger2 } from "@module-federation/sdk";
284
285
  import { normalizeOptions as normalizeOptions2 } from "@module-federation/sdk";
285
286
  var _ConsumeTypesPlugin = class _ConsumeTypesPlugin {
286
287
  constructor(pluginOptions, dtsOptions, defaultOptions, fetchRemoteTypeUrlsResolve) {
@@ -316,6 +317,7 @@ var _ConsumeTypesPlugin = class _ConsumeTypesPlugin {
316
317
  };
317
318
  validateOptions(finalOptions.host);
318
319
  const fetchRemoteTypeUrlsPromise = typeof normalizedConsumeTypes.remoteTypeUrls === "function" ? normalizedConsumeTypes.remoteTypeUrls() : Promise.resolve(normalizedConsumeTypes.remoteTypeUrls);
320
+ logger2.debug("start fetching remote types...");
319
321
  const promise = fetchRemoteTypeUrlsPromise.then((remoteTypeUrls) => {
320
322
  consumeTypes(__spreadProps(__spreadValues({}, finalOptions), {
321
323
  host: __spreadProps(__spreadValues({}, finalOptions.host), {
@@ -336,6 +338,7 @@ var _ConsumeTypesPlugin = class _ConsumeTypesPlugin {
336
338
  )
337
339
  }, () => __async(this, null, function* () {
338
340
  yield promise;
341
+ logger2.debug("fetch remote types success!");
339
342
  }));
340
343
  });
341
344
  }
@@ -346,7 +349,7 @@ var ConsumeTypesPlugin = _ConsumeTypesPlugin;
346
349
  // packages/dts-plugin/src/plugins/GenerateTypesPlugin.ts
347
350
  import fs2 from "fs";
348
351
  import path5 from "path";
349
- import { normalizeOptions as normalizeOptions3 } from "@module-federation/sdk";
352
+ import { logger as logger3, normalizeOptions as normalizeOptions3 } from "@module-federation/sdk";
350
353
  var _GenerateTypesPlugin = class _GenerateTypesPlugin {
351
354
  constructor(pluginOptions, dtsOptions, defaultOptions, fetchRemoteTypeUrlsPromise, callback) {
352
355
  __publicField(this, "pluginOptions");
@@ -407,7 +410,9 @@ var _GenerateTypesPlugin = class _GenerateTypesPlugin {
407
410
  callback();
408
411
  return;
409
412
  }
413
+ logger3.debug("start generating types...");
410
414
  yield generateTypesFn(finalOptions);
415
+ logger3.debug("generate types success!");
411
416
  const config = finalOptions.remote.moduleFederationConfig;
412
417
  let zipPrefix = "";
413
418
  if (typeof config.manifest === "object" && config.manifest.filePath) {
@@ -476,6 +481,7 @@ var _GenerateTypesPlugin = class _GenerateTypesPlugin {
476
481
  if (finalOptions.displayErrorInTerminal) {
477
482
  console.error("Error in mf:generateTypes processAssets hook:", err);
478
483
  }
484
+ logger3.debug("generate types fail!");
479
485
  }
480
486
  }), "emitTypesFiles");
481
487
  compiler.hooks.thisCompilation.tap("mf:generateTypes", (compilation) => {
@@ -1677,7 +1677,8 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
1677
1677
  try {
1678
1678
  const url = fileToDownload;
1679
1679
  const response = yield axiosGet(url, {
1680
- responseType: "arraybuffer"
1680
+ responseType: "arraybuffer",
1681
+ timeout: hostOptions.timeout
1681
1682
  }).catch(downloadErrorLogger(destinationFolder, url));
1682
1683
  if (typeof ((_a3 = response.headers) == null ? void 0 : _a3["content-type"]) === "string" && response.headers["content-type"].includes("text/html")) {
1683
1684
  throw new Error(`${url} receives invalid content-type: ${response.headers["content-type"]}`);
@@ -1725,7 +1726,8 @@ var defaultOptions = {
1725
1726
  abortOnError: true,
1726
1727
  consumeAPITypes: false,
1727
1728
  runtimePkgs: [],
1728
- remoteTypeUrls: {}
1729
+ remoteTypeUrls: {},
1730
+ timeout: 6e4
1729
1731
  };
1730
1732
  var buildZipUrl = /* @__PURE__ */ __name((hostOptions, url) => {
1731
1733
  const remoteUrl = new URL(url, "file:");
@@ -1940,7 +1942,7 @@ var DTSManager = (_a = class {
1940
1942
  }
1941
1943
  });
1942
1944
  }
1943
- requestRemoteManifest(remoteInfo) {
1945
+ requestRemoteManifest(remoteInfo, hostOptions) {
1944
1946
  return __async(this, null, function* () {
1945
1947
  try {
1946
1948
  if (!remoteInfo.url.includes(import_sdk5.MANIFEST_EXT)) {
@@ -1950,7 +1952,9 @@ var DTSManager = (_a = class {
1950
1952
  return remoteInfo;
1951
1953
  }
1952
1954
  const url = remoteInfo.url;
1953
- const res = yield axiosGet(url);
1955
+ const res = yield axiosGet(url, {
1956
+ timeout: hostOptions.timeout
1957
+ });
1954
1958
  const manifestJson = res.data;
1955
1959
  if (!manifestJson.metaData.types.zip) {
1956
1960
  throw new Error(`Can not get ${remoteInfo.name}'s types archive url!`);
@@ -2001,7 +2005,7 @@ var DTSManager = (_a = class {
2001
2005
  ]);
2002
2006
  });
2003
2007
  }
2004
- downloadAPITypes(remoteInfo, destinationPath) {
2008
+ downloadAPITypes(remoteInfo, destinationPath, hostOptions) {
2005
2009
  return __async(this, null, function* () {
2006
2010
  const { apiTypeUrl } = remoteInfo;
2007
2011
  if (!apiTypeUrl) {
@@ -2009,7 +2013,9 @@ var DTSManager = (_a = class {
2009
2013
  }
2010
2014
  try {
2011
2015
  const url = apiTypeUrl;
2012
- const res = yield axiosGet(url);
2016
+ const res = yield axiosGet(url, {
2017
+ timeout: hostOptions.timeout
2018
+ });
2013
2019
  let apiTypeFile = res.data;
2014
2020
  apiTypeFile = apiTypeFile.replaceAll(REMOTE_ALIAS_IDENTIFIER, remoteInfo.alias);
2015
2021
  const filePath = import_path4.default.join(destinationPath, REMOTE_API_TYPES_FILE_NAME);
@@ -2081,7 +2087,7 @@ var DTSManager = (_a = class {
2081
2087
  const downloadPromises = Object.entries(mapRemotesToDownload).map((item) => __async(this, null, function* () {
2082
2088
  const remoteInfo = item[1];
2083
2089
  if (!this.remoteAliasMap[remoteInfo.alias]) {
2084
- const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo);
2090
+ const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo, hostOptions);
2085
2091
  this.remoteAliasMap[remoteInfo.alias] = requiredRemoteInfo;
2086
2092
  }
2087
2093
  return this.consumeTargetRemotes(hostOptions, this.remoteAliasMap[remoteInfo.alias]);
@@ -2116,7 +2122,7 @@ var DTSManager = (_a = class {
2116
2122
  if (!remoteInfo) {
2117
2123
  return;
2118
2124
  }
2119
- yield this.downloadAPITypes(remoteInfo, destinationPath);
2125
+ yield this.downloadAPITypes(remoteInfo, destinationPath, hostOptions);
2120
2126
  })));
2121
2127
  this.consumeAPITypes(hostOptions);
2122
2128
  }
@@ -2159,7 +2165,7 @@ hostName: ${hostName}`, "updateTypes", "info");
2159
2165
  // use remoteTarPath first
2160
2166
  zipUrl: remoteTarPath || requiredRemoteInfo.zipUrl
2161
2167
  }));
2162
- const addNew = yield this.downloadAPITypes(requiredRemoteInfo, destinationPath);
2168
+ const addNew = yield this.downloadAPITypes(requiredRemoteInfo, destinationPath, hostOptions);
2163
2169
  if (addNew) {
2164
2170
  this.consumeAPITypes(hostOptions);
2165
2171
  }
@@ -2173,7 +2179,7 @@ hostName: ${hostName}`, "updateTypes", "info");
2173
2179
  fileLog(`remoteInfo: ${JSON.stringify(remoteInfo, null, 2)}`, "updateTypes", "info");
2174
2180
  if (remoteInfo) {
2175
2181
  if (!this.remoteAliasMap[remoteInfo.alias]) {
2176
- const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo);
2182
+ const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo, hostOptions);
2177
2183
  this.remoteAliasMap[remoteInfo.alias] = requiredRemoteInfo;
2178
2184
  }
2179
2185
  yield consumeTypes2(this.remoteAliasMap[remoteInfo.alias]);
@@ -2188,7 +2194,7 @@ hostName: ${hostName}`, "updateTypes", "info");
2188
2194
  remote: updatedRemoteInfo.url
2189
2195
  });
2190
2196
  fileLog(`start request manifest`, "consumeTypes", "info");
2191
- this.updatedRemoteInfos[updatedRemoteInfo.name] = yield this.requestRemoteManifest(parsedRemoteInfo);
2197
+ this.updatedRemoteInfos[updatedRemoteInfo.name] = yield this.requestRemoteManifest(parsedRemoteInfo, hostOptions);
2192
2198
  fileLog(`end request manifest, this.updatedRemoteInfos[updatedRemoteInfo.name]: ${JSON.stringify(this.updatedRemoteInfos[updatedRemoteInfo.name], null, 2)}`, "updateTypes", "info");
2193
2199
  yield consumeDynamicRemoteTypes();
2194
2200
  }
@@ -2253,12 +2259,14 @@ function axiosGet(url, config) {
2253
2259
  const httpsAgent = new import_https.default.Agent({
2254
2260
  family: 4
2255
2261
  });
2256
- return import_axios.default.get(url, __spreadValues(__spreadValues({
2262
+ return import_axios.default.get(url, __spreadProps(__spreadValues(__spreadValues({
2257
2263
  httpAgent,
2258
2264
  httpsAgent
2259
2265
  }, {
2260
2266
  headers: getEnvHeaders()
2261
- }), config));
2267
+ }), config), {
2268
+ timeout: (config == null ? void 0 : config.timeout) || 6e4
2269
+ }));
2262
2270
  });
2263
2271
  }
2264
2272
  __name(axiosGet, "axiosGet");
@@ -1,4 +1,4 @@
1
- import { k as DtsWorkerOptions } from './DtsWorker-edc3f145.js';
1
+ import { k as DtsWorkerOptions } from './DtsWorker-bfe21fe7.js';
2
2
  import 'child_process';
3
3
  import './DTSManagerOptions-c74c59ed.js';
4
4
  import '@module-federation/sdk';
@@ -1,4 +1,4 @@
1
- import { k as DtsWorkerOptions } from './DtsWorker-edc3f145.js';
1
+ import { k as DtsWorkerOptions } from './DtsWorker-bfe21fe7.js';
2
2
  import 'child_process';
3
3
  import './DTSManagerOptions-c74c59ed.js';
4
4
  import '@module-federation/sdk';
@@ -1323,7 +1323,8 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
1323
1323
  try {
1324
1324
  const url = fileToDownload;
1325
1325
  const response = yield axiosGet(url, {
1326
- responseType: "arraybuffer"
1326
+ responseType: "arraybuffer",
1327
+ timeout: hostOptions.timeout
1327
1328
  }).catch(downloadErrorLogger(destinationFolder, url));
1328
1329
  if (typeof ((_a2 = response.headers) == null ? void 0 : _a2["content-type"]) === "string" && response.headers["content-type"].includes("text/html")) {
1329
1330
  throw new Error(`${url} receives invalid content-type: ${response.headers["content-type"]}`);
@@ -1371,7 +1372,8 @@ var defaultOptions2 = {
1371
1372
  abortOnError: true,
1372
1373
  consumeAPITypes: false,
1373
1374
  runtimePkgs: [],
1374
- remoteTypeUrls: {}
1375
+ remoteTypeUrls: {},
1376
+ timeout: 6e4
1375
1377
  };
1376
1378
  var buildZipUrl = /* @__PURE__ */ __name((hostOptions, url) => {
1377
1379
  const remoteUrl = new URL(url, "file:");
@@ -1586,7 +1588,7 @@ var DTSManager = (_a = class {
1586
1588
  }
1587
1589
  });
1588
1590
  }
1589
- requestRemoteManifest(remoteInfo) {
1591
+ requestRemoteManifest(remoteInfo, hostOptions) {
1590
1592
  return __async(this, null, function* () {
1591
1593
  try {
1592
1594
  if (!remoteInfo.url.includes(import_sdk5.MANIFEST_EXT)) {
@@ -1596,7 +1598,9 @@ var DTSManager = (_a = class {
1596
1598
  return remoteInfo;
1597
1599
  }
1598
1600
  const url = remoteInfo.url;
1599
- const res = yield axiosGet(url);
1601
+ const res = yield axiosGet(url, {
1602
+ timeout: hostOptions.timeout
1603
+ });
1600
1604
  const manifestJson = res.data;
1601
1605
  if (!manifestJson.metaData.types.zip) {
1602
1606
  throw new Error(`Can not get ${remoteInfo.name}'s types archive url!`);
@@ -1647,7 +1651,7 @@ var DTSManager = (_a = class {
1647
1651
  ]);
1648
1652
  });
1649
1653
  }
1650
- downloadAPITypes(remoteInfo, destinationPath) {
1654
+ downloadAPITypes(remoteInfo, destinationPath, hostOptions) {
1651
1655
  return __async(this, null, function* () {
1652
1656
  const { apiTypeUrl } = remoteInfo;
1653
1657
  if (!apiTypeUrl) {
@@ -1655,7 +1659,9 @@ var DTSManager = (_a = class {
1655
1659
  }
1656
1660
  try {
1657
1661
  const url = apiTypeUrl;
1658
- const res = yield axiosGet(url);
1662
+ const res = yield axiosGet(url, {
1663
+ timeout: hostOptions.timeout
1664
+ });
1659
1665
  let apiTypeFile = res.data;
1660
1666
  apiTypeFile = apiTypeFile.replaceAll(REMOTE_ALIAS_IDENTIFIER, remoteInfo.alias);
1661
1667
  const filePath = import_path4.default.join(destinationPath, REMOTE_API_TYPES_FILE_NAME);
@@ -1727,7 +1733,7 @@ var DTSManager = (_a = class {
1727
1733
  const downloadPromises = Object.entries(mapRemotesToDownload).map((item) => __async(this, null, function* () {
1728
1734
  const remoteInfo = item[1];
1729
1735
  if (!this.remoteAliasMap[remoteInfo.alias]) {
1730
- const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo);
1736
+ const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo, hostOptions);
1731
1737
  this.remoteAliasMap[remoteInfo.alias] = requiredRemoteInfo;
1732
1738
  }
1733
1739
  return this.consumeTargetRemotes(hostOptions, this.remoteAliasMap[remoteInfo.alias]);
@@ -1762,7 +1768,7 @@ var DTSManager = (_a = class {
1762
1768
  if (!remoteInfo) {
1763
1769
  return;
1764
1770
  }
1765
- yield this.downloadAPITypes(remoteInfo, destinationPath);
1771
+ yield this.downloadAPITypes(remoteInfo, destinationPath, hostOptions);
1766
1772
  })));
1767
1773
  this.consumeAPITypes(hostOptions);
1768
1774
  }
@@ -1805,7 +1811,7 @@ hostName: ${hostName}`, "updateTypes", "info");
1805
1811
  // use remoteTarPath first
1806
1812
  zipUrl: remoteTarPath || requiredRemoteInfo.zipUrl
1807
1813
  }));
1808
- const addNew = yield this.downloadAPITypes(requiredRemoteInfo, destinationPath);
1814
+ const addNew = yield this.downloadAPITypes(requiredRemoteInfo, destinationPath, hostOptions);
1809
1815
  if (addNew) {
1810
1816
  this.consumeAPITypes(hostOptions);
1811
1817
  }
@@ -1819,7 +1825,7 @@ hostName: ${hostName}`, "updateTypes", "info");
1819
1825
  fileLog(`remoteInfo: ${JSON.stringify(remoteInfo, null, 2)}`, "updateTypes", "info");
1820
1826
  if (remoteInfo) {
1821
1827
  if (!this.remoteAliasMap[remoteInfo.alias]) {
1822
- const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo);
1828
+ const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo, hostOptions);
1823
1829
  this.remoteAliasMap[remoteInfo.alias] = requiredRemoteInfo;
1824
1830
  }
1825
1831
  yield consumeTypes(this.remoteAliasMap[remoteInfo.alias]);
@@ -1834,7 +1840,7 @@ hostName: ${hostName}`, "updateTypes", "info");
1834
1840
  remote: updatedRemoteInfo.url
1835
1841
  });
1836
1842
  fileLog(`start request manifest`, "consumeTypes", "info");
1837
- this.updatedRemoteInfos[updatedRemoteInfo.name] = yield this.requestRemoteManifest(parsedRemoteInfo);
1843
+ this.updatedRemoteInfos[updatedRemoteInfo.name] = yield this.requestRemoteManifest(parsedRemoteInfo, hostOptions);
1838
1844
  fileLog(`end request manifest, this.updatedRemoteInfos[updatedRemoteInfo.name]: ${JSON.stringify(this.updatedRemoteInfos[updatedRemoteInfo.name], null, 2)}`, "updateTypes", "info");
1839
1845
  yield consumeDynamicRemoteTypes();
1840
1846
  }
@@ -1899,12 +1905,14 @@ function axiosGet(url, config) {
1899
1905
  const httpsAgent = new import_https.default.Agent({
1900
1906
  family: 4
1901
1907
  });
1902
- return import_axios.default.get(url, __spreadValues(__spreadValues({
1908
+ return import_axios.default.get(url, __spreadProps(__spreadValues(__spreadValues({
1903
1909
  httpAgent,
1904
1910
  httpsAgent
1905
1911
  }, {
1906
1912
  headers: getEnvHeaders()
1907
- }), config));
1913
+ }), config), {
1914
+ timeout: (config == null ? void 0 : config.timeout) || 6e4
1915
+ }));
1908
1916
  });
1909
1917
  }
1910
1918
  __name(axiosGet, "axiosGet");
package/dist/index.js CHANGED
@@ -1180,7 +1180,8 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
1180
1180
  try {
1181
1181
  const url = fileToDownload;
1182
1182
  const response = yield axiosGet(url, {
1183
- responseType: "arraybuffer"
1183
+ responseType: "arraybuffer",
1184
+ timeout: hostOptions.timeout
1184
1185
  }).catch(downloadErrorLogger(destinationFolder, url));
1185
1186
  if (typeof ((_a3 = response.headers) == null ? void 0 : _a3["content-type"]) === "string" && response.headers["content-type"].includes("text/html")) {
1186
1187
  throw new Error(`${url} receives invalid content-type: ${response.headers["content-type"]}`);
@@ -1228,7 +1229,8 @@ var defaultOptions = {
1228
1229
  abortOnError: true,
1229
1230
  consumeAPITypes: false,
1230
1231
  runtimePkgs: [],
1231
- remoteTypeUrls: {}
1232
+ remoteTypeUrls: {},
1233
+ timeout: 6e4
1232
1234
  };
1233
1235
  var buildZipUrl = /* @__PURE__ */ __name((hostOptions, url) => {
1234
1236
  const remoteUrl = new URL(url, "file:");
@@ -1443,7 +1445,7 @@ var DTSManager = (_a = class {
1443
1445
  }
1444
1446
  });
1445
1447
  }
1446
- requestRemoteManifest(remoteInfo) {
1448
+ requestRemoteManifest(remoteInfo, hostOptions) {
1447
1449
  return __async(this, null, function* () {
1448
1450
  try {
1449
1451
  if (!remoteInfo.url.includes(import_sdk5.MANIFEST_EXT)) {
@@ -1453,7 +1455,9 @@ var DTSManager = (_a = class {
1453
1455
  return remoteInfo;
1454
1456
  }
1455
1457
  const url = remoteInfo.url;
1456
- const res = yield axiosGet(url);
1458
+ const res = yield axiosGet(url, {
1459
+ timeout: hostOptions.timeout
1460
+ });
1457
1461
  const manifestJson = res.data;
1458
1462
  if (!manifestJson.metaData.types.zip) {
1459
1463
  throw new Error(`Can not get ${remoteInfo.name}'s types archive url!`);
@@ -1504,7 +1508,7 @@ var DTSManager = (_a = class {
1504
1508
  ]);
1505
1509
  });
1506
1510
  }
1507
- downloadAPITypes(remoteInfo, destinationPath) {
1511
+ downloadAPITypes(remoteInfo, destinationPath, hostOptions) {
1508
1512
  return __async(this, null, function* () {
1509
1513
  const { apiTypeUrl } = remoteInfo;
1510
1514
  if (!apiTypeUrl) {
@@ -1512,7 +1516,9 @@ var DTSManager = (_a = class {
1512
1516
  }
1513
1517
  try {
1514
1518
  const url = apiTypeUrl;
1515
- const res = yield axiosGet(url);
1519
+ const res = yield axiosGet(url, {
1520
+ timeout: hostOptions.timeout
1521
+ });
1516
1522
  let apiTypeFile = res.data;
1517
1523
  apiTypeFile = apiTypeFile.replaceAll(REMOTE_ALIAS_IDENTIFIER, remoteInfo.alias);
1518
1524
  const filePath = import_path3.default.join(destinationPath, REMOTE_API_TYPES_FILE_NAME);
@@ -1584,7 +1590,7 @@ var DTSManager = (_a = class {
1584
1590
  const downloadPromises = Object.entries(mapRemotesToDownload).map((item) => __async(this, null, function* () {
1585
1591
  const remoteInfo = item[1];
1586
1592
  if (!this.remoteAliasMap[remoteInfo.alias]) {
1587
- const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo);
1593
+ const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo, hostOptions);
1588
1594
  this.remoteAliasMap[remoteInfo.alias] = requiredRemoteInfo;
1589
1595
  }
1590
1596
  return this.consumeTargetRemotes(hostOptions, this.remoteAliasMap[remoteInfo.alias]);
@@ -1619,7 +1625,7 @@ var DTSManager = (_a = class {
1619
1625
  if (!remoteInfo) {
1620
1626
  return;
1621
1627
  }
1622
- yield this.downloadAPITypes(remoteInfo, destinationPath);
1628
+ yield this.downloadAPITypes(remoteInfo, destinationPath, hostOptions);
1623
1629
  })));
1624
1630
  this.consumeAPITypes(hostOptions);
1625
1631
  }
@@ -1662,7 +1668,7 @@ hostName: ${hostName}`, "updateTypes", "info");
1662
1668
  // use remoteTarPath first
1663
1669
  zipUrl: remoteTarPath || requiredRemoteInfo.zipUrl
1664
1670
  }));
1665
- const addNew = yield this.downloadAPITypes(requiredRemoteInfo, destinationPath);
1671
+ const addNew = yield this.downloadAPITypes(requiredRemoteInfo, destinationPath, hostOptions);
1666
1672
  if (addNew) {
1667
1673
  this.consumeAPITypes(hostOptions);
1668
1674
  }
@@ -1676,7 +1682,7 @@ hostName: ${hostName}`, "updateTypes", "info");
1676
1682
  fileLog(`remoteInfo: ${JSON.stringify(remoteInfo, null, 2)}`, "updateTypes", "info");
1677
1683
  if (remoteInfo) {
1678
1684
  if (!this.remoteAliasMap[remoteInfo.alias]) {
1679
- const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo);
1685
+ const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo, hostOptions);
1680
1686
  this.remoteAliasMap[remoteInfo.alias] = requiredRemoteInfo;
1681
1687
  }
1682
1688
  yield consumeTypes2(this.remoteAliasMap[remoteInfo.alias]);
@@ -1691,7 +1697,7 @@ hostName: ${hostName}`, "updateTypes", "info");
1691
1697
  remote: updatedRemoteInfo.url
1692
1698
  });
1693
1699
  fileLog(`start request manifest`, "consumeTypes", "info");
1694
- this.updatedRemoteInfos[updatedRemoteInfo.name] = yield this.requestRemoteManifest(parsedRemoteInfo);
1700
+ this.updatedRemoteInfos[updatedRemoteInfo.name] = yield this.requestRemoteManifest(parsedRemoteInfo, hostOptions);
1695
1701
  fileLog(`end request manifest, this.updatedRemoteInfos[updatedRemoteInfo.name]: ${JSON.stringify(this.updatedRemoteInfos[updatedRemoteInfo.name], null, 2)}`, "updateTypes", "info");
1696
1702
  yield consumeDynamicRemoteTypes();
1697
1703
  }
@@ -1822,12 +1828,14 @@ function axiosGet(url, config) {
1822
1828
  const httpsAgent = new import_https.default.Agent({
1823
1829
  family: 4
1824
1830
  });
1825
- return import_axios.default.get(url, __spreadValues(__spreadValues({
1831
+ return import_axios.default.get(url, __spreadProps(__spreadValues(__spreadValues({
1826
1832
  httpAgent,
1827
1833
  httpsAgent
1828
1834
  }, {
1829
1835
  headers: getEnvHeaders()
1830
- }), config));
1836
+ }), config), {
1837
+ timeout: (config == null ? void 0 : config.timeout) || 6e4
1838
+ }));
1831
1839
  });
1832
1840
  }
1833
1841
  __name(axiosGet, "axiosGet");
@@ -2536,10 +2544,11 @@ __name(_DevPlugin, "DevPlugin");
2536
2544
  var DevPlugin = _DevPlugin;
2537
2545
 
2538
2546
  // packages/dts-plugin/src/plugins/DtsPlugin.ts
2539
- var import_sdk10 = require("@module-federation/sdk");
2547
+ var import_sdk11 = require("@module-federation/sdk");
2540
2548
 
2541
2549
  // packages/dts-plugin/src/plugins/ConsumeTypesPlugin.ts
2542
2550
  var import_sdk8 = require("@module-federation/sdk");
2551
+ var import_sdk9 = require("@module-federation/sdk");
2543
2552
  var _ConsumeTypesPlugin = class _ConsumeTypesPlugin {
2544
2553
  constructor(pluginOptions, dtsOptions, defaultOptions3, fetchRemoteTypeUrlsResolve) {
2545
2554
  __publicField(this, "pluginOptions");
@@ -2558,7 +2567,7 @@ var _ConsumeTypesPlugin = class _ConsumeTypesPlugin {
2558
2567
  fetchRemoteTypeUrlsResolve(void 0);
2559
2568
  return;
2560
2569
  }
2561
- const normalizedConsumeTypes = (0, import_sdk8.normalizeOptions)(true, defaultOptions3, "mfOptions.dts.consumeTypes")(dtsOptions.consumeTypes);
2570
+ const normalizedConsumeTypes = (0, import_sdk9.normalizeOptions)(true, defaultOptions3, "mfOptions.dts.consumeTypes")(dtsOptions.consumeTypes);
2562
2571
  if (!normalizedConsumeTypes) {
2563
2572
  fetchRemoteTypeUrlsResolve(void 0);
2564
2573
  return;
@@ -2574,6 +2583,7 @@ var _ConsumeTypesPlugin = class _ConsumeTypesPlugin {
2574
2583
  };
2575
2584
  validateOptions(finalOptions.host);
2576
2585
  const fetchRemoteTypeUrlsPromise = typeof normalizedConsumeTypes.remoteTypeUrls === "function" ? normalizedConsumeTypes.remoteTypeUrls() : Promise.resolve(normalizedConsumeTypes.remoteTypeUrls);
2586
+ import_sdk8.logger.debug("start fetching remote types...");
2577
2587
  const promise = fetchRemoteTypeUrlsPromise.then((remoteTypeUrls) => {
2578
2588
  consumeTypes(__spreadProps(__spreadValues({}, finalOptions), {
2579
2589
  host: __spreadProps(__spreadValues({}, finalOptions.host), {
@@ -2594,6 +2604,7 @@ var _ConsumeTypesPlugin = class _ConsumeTypesPlugin {
2594
2604
  )
2595
2605
  }, () => __async(this, null, function* () {
2596
2606
  yield promise;
2607
+ import_sdk8.logger.debug("fetch remote types success!");
2597
2608
  }));
2598
2609
  });
2599
2610
  }
@@ -2604,7 +2615,7 @@ var ConsumeTypesPlugin = _ConsumeTypesPlugin;
2604
2615
  // packages/dts-plugin/src/plugins/GenerateTypesPlugin.ts
2605
2616
  var import_fs4 = __toESM(require("fs"));
2606
2617
  var import_path10 = __toESM(require("path"));
2607
- var import_sdk9 = require("@module-federation/sdk");
2618
+ var import_sdk10 = require("@module-federation/sdk");
2608
2619
  var _GenerateTypesPlugin = class _GenerateTypesPlugin {
2609
2620
  constructor(pluginOptions, dtsOptions, defaultOptions3, fetchRemoteTypeUrlsPromise, callback) {
2610
2621
  __publicField(this, "pluginOptions");
@@ -2620,12 +2631,12 @@ var _GenerateTypesPlugin = class _GenerateTypesPlugin {
2620
2631
  }
2621
2632
  apply(compiler) {
2622
2633
  const { dtsOptions, defaultOptions: defaultOptions3, pluginOptions, fetchRemoteTypeUrlsPromise, callback } = this;
2623
- const normalizedGenerateTypes = (0, import_sdk9.normalizeOptions)(true, defaultOptions3, "mfOptions.dts.generateTypes")(dtsOptions.generateTypes);
2634
+ const normalizedGenerateTypes = (0, import_sdk10.normalizeOptions)(true, defaultOptions3, "mfOptions.dts.generateTypes")(dtsOptions.generateTypes);
2624
2635
  if (!normalizedGenerateTypes) {
2625
2636
  callback();
2626
2637
  return;
2627
2638
  }
2628
- const normalizedConsumeTypes = (0, import_sdk9.normalizeOptions)(true, defaultOptions3, "mfOptions.dts.consumeTypes")(dtsOptions.consumeTypes);
2639
+ const normalizedConsumeTypes = (0, import_sdk10.normalizeOptions)(true, defaultOptions3, "mfOptions.dts.consumeTypes")(dtsOptions.consumeTypes);
2629
2640
  const finalOptions = {
2630
2641
  remote: __spreadValues({
2631
2642
  implementation: dtsOptions.implementation,
@@ -2665,7 +2676,9 @@ var _GenerateTypesPlugin = class _GenerateTypesPlugin {
2665
2676
  callback();
2666
2677
  return;
2667
2678
  }
2679
+ import_sdk10.logger.debug("start generating types...");
2668
2680
  yield generateTypesFn(finalOptions);
2681
+ import_sdk10.logger.debug("generate types success!");
2669
2682
  const config = finalOptions.remote.moduleFederationConfig;
2670
2683
  let zipPrefix = "";
2671
2684
  if (typeof config.manifest === "object" && config.manifest.filePath) {
@@ -2734,6 +2747,7 @@ var _GenerateTypesPlugin = class _GenerateTypesPlugin {
2734
2747
  if (finalOptions.displayErrorInTerminal) {
2735
2748
  console.error("Error in mf:generateTypes processAssets hook:", err);
2736
2749
  }
2750
+ import_sdk10.logger.debug("generate types fail!");
2737
2751
  }
2738
2752
  }), "emitTypesFiles");
2739
2753
  compiler.hooks.thisCompilation.tap("mf:generateTypes", (compilation) => {
@@ -2775,7 +2789,7 @@ var _DtsPlugin = class _DtsPlugin {
2775
2789
  abortOnError: false,
2776
2790
  consumeAPITypes: true
2777
2791
  };
2778
- const normalizedDtsOptions = (0, import_sdk10.normalizeOptions)(isTSProject(options.dts, compiler.context), {
2792
+ const normalizedDtsOptions = (0, import_sdk11.normalizeOptions)(isTSProject(options.dts, compiler.context), {
2779
2793
  generateTypes: defaultGenerateTypes,
2780
2794
  consumeTypes: defaultConsumeTypes,
2781
2795
  extraOptions: {},
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/dts-plugin",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "author": "hanric <hanric.zhang@gmail.com>",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/dts-plugin",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "author": "hanric <hanric.zhang@gmail.com>",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -60,10 +60,10 @@
60
60
  "log4js": "6.9.1",
61
61
  "node-schedule": "2.1.1",
62
62
  "ws": "8.18.0",
63
- "@module-federation/sdk": "0.9.1",
64
- "@module-federation/managers": "0.9.1",
65
- "@module-federation/third-party-dts-extractor": "0.9.1",
66
- "@module-federation/error-codes": "0.9.1"
63
+ "@module-federation/sdk": "0.10.0",
64
+ "@module-federation/managers": "0.10.0",
65
+ "@module-federation/third-party-dts-extractor": "0.10.0",
66
+ "@module-federation/error-codes": "0.10.0"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@types/ws": "8.5.12",
@@ -73,7 +73,7 @@
73
73
  "@vue/tsconfig": "^0.5.1",
74
74
  "vue-tsc": "^2.0.26",
75
75
  "rimraf": "~3.0.2",
76
- "@module-federation/runtime": "0.9.1"
76
+ "@module-federation/runtime": "0.10.0"
77
77
  },
78
78
  "peerDependencies": {
79
79
  "typescript": "^4.9.0 || ^5.0.0",