@module-federation/dts-plugin 0.8.12 → 0.9.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/index.js CHANGED
@@ -88,12 +88,12 @@ __export(src_exports, {
88
88
  module.exports = __toCommonJS(src_exports);
89
89
 
90
90
  // packages/dts-plugin/src/plugins/DevPlugin.ts
91
- var import_fs_extra3 = __toESM(require("fs-extra"));
91
+ var import_fs_extra4 = __toESM(require("fs-extra"));
92
92
  var import_path9 = __toESM(require("path"));
93
93
 
94
94
  // packages/dts-plugin/src/dev-worker/createDevWorker.ts
95
95
  var path5 = __toESM(require("path"));
96
- var fse = __toESM(require("fs-extra"));
96
+ var fse2 = __toESM(require("fs-extra"));
97
97
 
98
98
  // packages/dts-plugin/src/dev-worker/DevWorker.ts
99
99
  var import_path7 = __toESM(require("path"));
@@ -117,6 +117,7 @@ var import_ansi_colors = __toESM(require("ansi-colors"));
117
117
  var import_path3 = __toESM(require("path"));
118
118
  var import_promises3 = require("fs/promises");
119
119
  var import_fs = __toESM(require("fs"));
120
+ var import_fs_extra3 = __toESM(require("fs-extra"));
120
121
  var import_sdk5 = require("@module-federation/sdk");
121
122
  var import_third_party_dts_extractor2 = require("@module-federation/third-party-dts-extractor");
122
123
 
@@ -1226,7 +1227,8 @@ var defaultOptions = {
1226
1227
  context: process.cwd(),
1227
1228
  abortOnError: true,
1228
1229
  consumeAPITypes: false,
1229
- runtimePkgs: []
1230
+ runtimePkgs: [],
1231
+ remoteTypeUrls: {}
1230
1232
  };
1231
1233
  var buildZipUrl = /* @__PURE__ */ __name((hostOptions, url) => {
1232
1234
  const remoteUrl = new URL(url, "file:");
@@ -1242,18 +1244,31 @@ var buildApiTypeUrl = /* @__PURE__ */ __name((zipUrl) => {
1242
1244
  }, "buildApiTypeUrl");
1243
1245
  var retrieveRemoteInfo = /* @__PURE__ */ __name((options) => {
1244
1246
  const { hostOptions, remoteAlias, remote } = options;
1247
+ const { remoteTypeUrls } = hostOptions;
1245
1248
  let decodedRemote = remote;
1246
1249
  if (decodedRemote.startsWith(import_sdk4.ENCODE_NAME_PREFIX)) {
1247
1250
  decodedRemote = (0, import_sdk4.decodeName)(decodedRemote, import_sdk4.ENCODE_NAME_PREFIX);
1248
1251
  }
1249
1252
  const parsedInfo = (0, import_sdk4.parseEntry)(decodedRemote, void 0, "@");
1250
1253
  const url = "entry" in parsedInfo ? parsedInfo.entry : parsedInfo.name === decodedRemote ? decodedRemote : "";
1251
- const zipUrl = url ? buildZipUrl(hostOptions, url) : "";
1254
+ let zipUrl = "";
1255
+ let apiTypeUrl = "";
1256
+ const name = parsedInfo.name || remoteAlias;
1257
+ if (typeof remoteTypeUrls === "object" && remoteTypeUrls[name]) {
1258
+ zipUrl = remoteTypeUrls[name].zip;
1259
+ apiTypeUrl = remoteTypeUrls[name].api;
1260
+ }
1261
+ if (!zipUrl && url) {
1262
+ zipUrl = buildZipUrl(hostOptions, url);
1263
+ }
1264
+ if (!apiTypeUrl && zipUrl) {
1265
+ apiTypeUrl = buildApiTypeUrl(zipUrl);
1266
+ }
1252
1267
  return {
1253
- name: parsedInfo.name || remoteAlias,
1268
+ name,
1254
1269
  url,
1255
1270
  zipUrl,
1256
- apiTypeUrl: buildApiTypeUrl(zipUrl),
1271
+ apiTypeUrl,
1257
1272
  alias: remoteAlias
1258
1273
  };
1259
1274
  }, "retrieveRemoteInfo");
@@ -1329,6 +1344,7 @@ var DTSManager = (_a = class {
1329
1344
  }
1330
1345
  extractRemoteTypes(options) {
1331
1346
  return __async(this, null, function* () {
1347
+ var _a3;
1332
1348
  const { remoteOptions, tsConfig } = options;
1333
1349
  if (!remoteOptions.extractRemoteTypes) {
1334
1350
  return;
@@ -1343,20 +1359,29 @@ var DTSManager = (_a = class {
1343
1359
  }
1344
1360
  }
1345
1361
  const mfTypesPath = retrieveMfTypesPath(tsConfig, remoteOptions);
1346
- if (hasRemotes) {
1347
- const tempHostOptions = {
1348
- moduleFederationConfig: remoteOptions.moduleFederationConfig,
1349
- typesFolder: import_path3.default.join(mfTypesPath, "node_modules"),
1350
- remoteTypesFolder: (remoteOptions == null ? void 0 : remoteOptions.hostRemoteTypesFolder) || remoteOptions.typesFolder,
1351
- deleteTypesFolder: true,
1352
- context: remoteOptions.context,
1353
- implementation: remoteOptions.implementation,
1354
- abortOnError: false
1355
- };
1356
- yield this.consumeArchiveTypes(tempHostOptions);
1362
+ if (hasRemotes && this.options.host) {
1363
+ try {
1364
+ const { hostOptions } = retrieveHostConfig(this.options.host);
1365
+ const remoteTypesFolder = import_path3.default.resolve(hostOptions.context, hostOptions.typesFolder);
1366
+ const targetDir = import_path3.default.join(mfTypesPath, "node_modules");
1367
+ if (import_fs.default.existsSync(remoteTypesFolder)) {
1368
+ const targetFolder = import_path3.default.resolve(remoteOptions.context, targetDir);
1369
+ yield import_fs_extra3.default.ensureDir(targetFolder);
1370
+ yield import_fs_extra3.default.copy(remoteTypesFolder, targetFolder, {
1371
+ overwrite: true
1372
+ });
1373
+ }
1374
+ } catch (err) {
1375
+ if (((_a3 = this.options.host) == null ? void 0 : _a3.abortOnError) === false) {
1376
+ fileLog(`Unable to copy remote types, ${err}`, "extractRemoteTypes", "error");
1377
+ } else {
1378
+ throw err;
1379
+ }
1380
+ }
1357
1381
  }
1358
1382
  });
1359
1383
  }
1384
+ // it must execute after consumeTypes
1360
1385
  generateTypes() {
1361
1386
  return __async(this, null, function* () {
1362
1387
  var _a3;
@@ -1369,6 +1394,18 @@ var DTSManager = (_a = class {
1369
1394
  if (!Object.keys(mapComponentsToExpose).length) {
1370
1395
  return;
1371
1396
  }
1397
+ if (tsConfig.compilerOptions.tsBuildInfoFile) {
1398
+ try {
1399
+ const tsBuildInfoFile = import_path3.default.resolve(remoteOptions.context, tsConfig.compilerOptions.tsBuildInfoFile);
1400
+ const mfTypesPath = retrieveMfTypesPath(tsConfig, remoteOptions);
1401
+ if (!import_fs.default.existsSync(mfTypesPath)) {
1402
+ import_fs.default.rmSync(tsBuildInfoFile, {
1403
+ force: true
1404
+ });
1405
+ }
1406
+ } catch (e) {
1407
+ }
1408
+ }
1372
1409
  yield this.extractRemoteTypes({
1373
1410
  remoteOptions,
1374
1411
  tsConfig,
@@ -1398,7 +1435,7 @@ var DTSManager = (_a = class {
1398
1435
  } catch (error2) {
1399
1436
  if (((_a3 = this.options.remote) == null ? void 0 : _a3.abortOnError) === false) {
1400
1437
  if (this.options.displayErrorInTerminal) {
1401
- logger.error(`Unable to compile federated types${error2}`);
1438
+ logger.error(`Unable to compile federated types ${error2}`);
1402
1439
  }
1403
1440
  } else {
1404
1441
  throw error2;
@@ -1412,6 +1449,9 @@ var DTSManager = (_a = class {
1412
1449
  if (!remoteInfo.url.includes(import_sdk5.MANIFEST_EXT)) {
1413
1450
  return remoteInfo;
1414
1451
  }
1452
+ if (remoteInfo.zipUrl) {
1453
+ return remoteInfo;
1454
+ }
1415
1455
  const url = remoteInfo.url;
1416
1456
  const res = yield axiosGet(url);
1417
1457
  const manifestJson = res.data;
@@ -1477,8 +1517,10 @@ var DTSManager = (_a = class {
1477
1517
  apiTypeFile = apiTypeFile.replaceAll(REMOTE_ALIAS_IDENTIFIER, remoteInfo.alias);
1478
1518
  const filePath = import_path3.default.join(destinationPath, REMOTE_API_TYPES_FILE_NAME);
1479
1519
  import_fs.default.writeFileSync(filePath, apiTypeFile);
1520
+ const existed = this.loadedRemoteAPIAlias.has(remoteInfo.alias);
1480
1521
  this.loadedRemoteAPIAlias.add(remoteInfo.alias);
1481
1522
  fileLog(`success`, "downloadAPITypes", "info");
1523
+ return existed;
1482
1524
  } catch (err) {
1483
1525
  fileLog(`Unable to download "${remoteInfo.name}" api types, ${err}`, "downloadAPITypes", "error");
1484
1526
  }
@@ -1620,7 +1662,10 @@ hostName: ${hostName}`, "updateTypes", "info");
1620
1662
  // use remoteTarPath first
1621
1663
  zipUrl: remoteTarPath || requiredRemoteInfo.zipUrl
1622
1664
  }));
1623
- yield this.downloadAPITypes(requiredRemoteInfo, destinationPath);
1665
+ const addNew = yield this.downloadAPITypes(requiredRemoteInfo, destinationPath);
1666
+ if (addNew) {
1667
+ this.consumeAPITypes(hostOptions);
1668
+ }
1624
1669
  fileLog(`consumeTypes end`, "updateTypes", "info");
1625
1670
  }), "consumeTypes");
1626
1671
  fileLog(`loadedRemoteInfo: ${JSON.stringify(loadedRemoteInfo, null, 2)}`, "updateTypes", "info");
@@ -1638,7 +1683,6 @@ hostName: ${hostName}`, "updateTypes", "info");
1638
1683
  } else if (updatedRemoteInfo) {
1639
1684
  const consumeDynamicRemoteTypes = /* @__PURE__ */ __name(() => __async(this, null, function* () {
1640
1685
  yield consumeTypes2(this.updatedRemoteInfos[updatedRemoteInfo.name]);
1641
- this.consumeAPITypes(hostOptions);
1642
1686
  }), "consumeDynamicRemoteTypes");
1643
1687
  if (!this.updatedRemoteInfos[updatedRemoteInfo.name]) {
1644
1688
  const parsedRemoteInfo = retrieveRemoteInfo({
@@ -1756,10 +1800,13 @@ function cloneDeepOptions(options) {
1756
1800
  "manifest",
1757
1801
  "async"
1758
1802
  ];
1759
- return (0, import_lodash.default)(options, (_value, key) => {
1803
+ return (0, import_lodash.default)(options, (value, key) => {
1760
1804
  if (typeof key === "string" && excludeKeys.includes(key)) {
1761
1805
  return false;
1762
1806
  }
1807
+ if (typeof value === "function") {
1808
+ return false;
1809
+ }
1763
1810
  });
1764
1811
  }
1765
1812
  __name(cloneDeepOptions, "cloneDeepOptions");
@@ -1821,7 +1868,7 @@ function getEffectiveRootDir(parsedCommandLine) {
1821
1868
  throw new Error("Can not get effective rootDir, please set compilerOptions.rootDir !");
1822
1869
  }
1823
1870
  __name(getEffectiveRootDir, "getEffectiveRootDir");
1824
- var readTsConfig = /* @__PURE__ */ __name(({ tsConfigPath, typesFolder, compiledTypesFolder, context, additionalFilesToCompile, outputDir }, mapComponentsToExpose) => {
1871
+ var readTsConfig = /* @__PURE__ */ __name(({ tsConfigPath, typesFolder, compiledTypesFolder, context, additionalFilesToCompile, outputDir, moduleFederationConfig }, mapComponentsToExpose) => {
1825
1872
  const resolvedTsConfigPath = (0, import_path5.resolve)(context, tsConfigPath);
1826
1873
  const readResult = import_typescript.default.readConfigFile(resolvedTsConfigPath, import_typescript.default.sys.readFile);
1827
1874
  if (readResult.error) {
@@ -1839,7 +1886,10 @@ var readTsConfig = /* @__PURE__ */ __name(({ tsConfigPath, typesFolder, compiled
1839
1886
  outDir
1840
1887
  };
1841
1888
  rawTsConfigJson.compilerOptions = rawTsConfigJson.compilerOptions || {};
1842
- rawTsConfigJson.compilerOptions = __spreadValues(__spreadValues({}, rawTsConfigJson.compilerOptions), defaultCompilerOptions);
1889
+ rawTsConfigJson.compilerOptions = __spreadValues(__spreadValues({
1890
+ incremental: true,
1891
+ tsBuildInfoFile: (0, import_path5.resolve)(context, "node_modules/.cache/mf-types/.tsbuildinfo")
1892
+ }, rawTsConfigJson.compilerOptions), defaultCompilerOptions);
1843
1893
  const _a3 = rawTsConfigJson.compilerOptions || {}, { paths, baseUrl } = _a3, restCompilerOptions = __objRest(_a3, ["paths", "baseUrl"]);
1844
1894
  rawTsConfigJson.compilerOptions = restCompilerOptions;
1845
1895
  const filesToCompile = [
@@ -1891,6 +1941,9 @@ var retrieveRemoteConfig = /* @__PURE__ */ __name((options) => {
1891
1941
  const remoteOptions = __spreadValues(__spreadValues({}, defaultOptions2), options);
1892
1942
  const mapComponentsToExpose = resolveExposes(remoteOptions);
1893
1943
  const tsConfig = readTsConfig(remoteOptions, mapComponentsToExpose);
1944
+ if (tsConfig.compilerOptions.incremental && tsConfig.compilerOptions.tsBuildInfoFile && options.deleteTypesFolder !== true) {
1945
+ remoteOptions.deleteTypesFolder = false;
1946
+ }
1894
1947
  return {
1895
1948
  tsConfig,
1896
1949
  mapComponentsToExpose,
@@ -2281,7 +2334,7 @@ function removeLogFile() {
2281
2334
  return __async(this, null, function* () {
2282
2335
  try {
2283
2336
  const logDir = path5.resolve(process.cwd(), ".mf/typesGenerate.log");
2284
- yield fse.remove(logDir);
2337
+ yield fse2.remove(logDir);
2285
2338
  } catch (err) {
2286
2339
  console.error("removeLogFile error", "forkDevWorker", err);
2287
2340
  }
@@ -2325,27 +2378,29 @@ var PROCESS_EXIT_CODE;
2325
2378
  function ensureTempDir(filePath) {
2326
2379
  try {
2327
2380
  const dir = import_path9.default.dirname(filePath);
2328
- import_fs_extra3.default.ensureDirSync(dir);
2381
+ import_fs_extra4.default.ensureDirSync(dir);
2329
2382
  } catch (_err) {
2330
2383
  }
2331
2384
  }
2332
2385
  __name(ensureTempDir, "ensureTempDir");
2333
2386
  var _DevPlugin = class _DevPlugin {
2334
- constructor(options, dtsOptions, fetchTypesPromise) {
2387
+ constructor(options, dtsOptions, generateTypesPromise, fetchRemoteTypeUrlsPromise) {
2335
2388
  __publicField(this, "name", "MFDevPlugin");
2336
2389
  __publicField(this, "_options");
2337
2390
  __publicField(this, "_devWorker");
2338
2391
  __publicField(this, "dtsOptions");
2339
- __publicField(this, "fetchTypesPromise");
2392
+ __publicField(this, "generateTypesPromise");
2393
+ __publicField(this, "fetchRemoteTypeUrlsPromise");
2340
2394
  this._options = options;
2341
- this.fetchTypesPromise = fetchTypesPromise;
2395
+ this.generateTypesPromise = generateTypesPromise;
2342
2396
  this.dtsOptions = dtsOptions;
2397
+ this.fetchRemoteTypeUrlsPromise = fetchRemoteTypeUrlsPromise;
2343
2398
  }
2344
2399
  static ensureLiveReloadEntry(options, filePath) {
2345
2400
  ensureTempDir(filePath);
2346
- const liveReloadEntry = import_fs_extra3.default.readFileSync(import_path9.default.join(__dirname, "./iife/launch-web-client.js")).toString("utf-8");
2401
+ const liveReloadEntry = import_fs_extra4.default.readFileSync(import_path9.default.join(__dirname, "./iife/launch-web-client.js")).toString("utf-8");
2347
2402
  const liveReloadEntryWithOptions = liveReloadEntry.replace(WEB_CLIENT_OPTIONS_IDENTIFIER, JSON.stringify(options));
2348
- import_fs_extra3.default.writeFileSync(filePath, liveReloadEntryWithOptions);
2403
+ import_fs_extra4.default.writeFileSync(filePath, liveReloadEntryWithOptions);
2349
2404
  }
2350
2405
  _stopWhenSIGTERMOrSIGINT() {
2351
2406
  process.on("SIGTERM", () => {
@@ -2457,11 +2512,16 @@ var _DevPlugin = class _DevPlugin {
2457
2512
  if (remote && !(remote == null ? void 0 : remote.tsConfigPath) && typeof normalizedDtsOptions === "object" && normalizedDtsOptions.tsConfigPath) {
2458
2513
  remote.tsConfigPath = normalizedDtsOptions.tsConfigPath;
2459
2514
  }
2460
- this.fetchTypesPromise.then(() => {
2515
+ Promise.all([
2516
+ this.generateTypesPromise,
2517
+ this.fetchRemoteTypeUrlsPromise
2518
+ ]).then(([_, remoteTypeUrls]) => {
2461
2519
  this._devWorker = createDevWorker({
2462
2520
  name,
2463
2521
  remote,
2464
- host,
2522
+ host: __spreadProps(__spreadValues({}, host), {
2523
+ remoteTypeUrls
2524
+ }),
2465
2525
  extraOptions,
2466
2526
  disableLiveReload: normalizedDev.disableHotTypesReload,
2467
2527
  disableHotTypesReload: normalizedDev.disableHotTypesReload
@@ -2481,25 +2541,26 @@ var import_sdk10 = require("@module-federation/sdk");
2481
2541
  // packages/dts-plugin/src/plugins/ConsumeTypesPlugin.ts
2482
2542
  var import_sdk8 = require("@module-federation/sdk");
2483
2543
  var _ConsumeTypesPlugin = class _ConsumeTypesPlugin {
2484
- constructor(pluginOptions, dtsOptions, defaultOptions3, callback) {
2544
+ constructor(pluginOptions, dtsOptions, defaultOptions3, fetchRemoteTypeUrlsResolve) {
2485
2545
  __publicField(this, "pluginOptions");
2486
2546
  __publicField(this, "dtsOptions");
2487
2547
  __publicField(this, "defaultOptions");
2488
2548
  __publicField(this, "callback");
2549
+ __publicField(this, "fetchRemoteTypeUrlsResolve");
2489
2550
  this.pluginOptions = pluginOptions;
2490
2551
  this.dtsOptions = dtsOptions;
2491
2552
  this.defaultOptions = defaultOptions3;
2492
- this.callback = callback;
2553
+ this.fetchRemoteTypeUrlsResolve = fetchRemoteTypeUrlsResolve;
2493
2554
  }
2494
2555
  apply(compiler) {
2495
- const { dtsOptions, defaultOptions: defaultOptions3, pluginOptions, callback } = this;
2556
+ const { dtsOptions, defaultOptions: defaultOptions3, pluginOptions, fetchRemoteTypeUrlsResolve } = this;
2496
2557
  if (isPrd()) {
2497
- callback();
2558
+ fetchRemoteTypeUrlsResolve(void 0);
2498
2559
  return;
2499
2560
  }
2500
2561
  const normalizedConsumeTypes = (0, import_sdk8.normalizeOptions)(true, defaultOptions3, "mfOptions.dts.consumeTypes")(dtsOptions.consumeTypes);
2501
2562
  if (!normalizedConsumeTypes) {
2502
- callback();
2563
+ fetchRemoteTypeUrlsResolve(void 0);
2503
2564
  return;
2504
2565
  }
2505
2566
  const finalOptions = {
@@ -2512,10 +2573,17 @@ var _ConsumeTypesPlugin = class _ConsumeTypesPlugin {
2512
2573
  displayErrorInTerminal: dtsOptions.displayErrorInTerminal
2513
2574
  };
2514
2575
  validateOptions(finalOptions.host);
2515
- const promise = consumeTypes(finalOptions).then(() => {
2516
- callback();
2517
- }).catch(() => {
2518
- callback();
2576
+ const fetchRemoteTypeUrlsPromise = typeof normalizedConsumeTypes.remoteTypeUrls === "function" ? normalizedConsumeTypes.remoteTypeUrls() : Promise.resolve(normalizedConsumeTypes.remoteTypeUrls);
2577
+ const promise = fetchRemoteTypeUrlsPromise.then((remoteTypeUrls) => {
2578
+ consumeTypes(__spreadProps(__spreadValues({}, finalOptions), {
2579
+ host: __spreadProps(__spreadValues({}, finalOptions.host), {
2580
+ remoteTypeUrls
2581
+ })
2582
+ })).then(() => {
2583
+ fetchRemoteTypeUrlsResolve(remoteTypeUrls);
2584
+ }).catch(() => {
2585
+ fetchRemoteTypeUrlsResolve(remoteTypeUrls);
2586
+ });
2519
2587
  });
2520
2588
  compiler.hooks.thisCompilation.tap("mf:generateTypes", (compilation) => {
2521
2589
  compilation.hooks.processAssets.tapPromise({
@@ -2538,25 +2606,26 @@ var import_fs4 = __toESM(require("fs"));
2538
2606
  var import_path10 = __toESM(require("path"));
2539
2607
  var import_sdk9 = require("@module-federation/sdk");
2540
2608
  var _GenerateTypesPlugin = class _GenerateTypesPlugin {
2541
- constructor(pluginOptions, dtsOptions, defaultOptions3, consumeTypesPromise, callback) {
2609
+ constructor(pluginOptions, dtsOptions, defaultOptions3, fetchRemoteTypeUrlsPromise, callback) {
2542
2610
  __publicField(this, "pluginOptions");
2543
2611
  __publicField(this, "dtsOptions");
2544
2612
  __publicField(this, "defaultOptions");
2545
- __publicField(this, "consumeTypesPromise");
2613
+ __publicField(this, "fetchRemoteTypeUrlsPromise");
2546
2614
  __publicField(this, "callback");
2547
2615
  this.pluginOptions = pluginOptions;
2548
2616
  this.dtsOptions = dtsOptions;
2549
2617
  this.defaultOptions = defaultOptions3;
2550
- this.consumeTypesPromise = consumeTypesPromise;
2618
+ this.fetchRemoteTypeUrlsPromise = fetchRemoteTypeUrlsPromise;
2551
2619
  this.callback = callback;
2552
2620
  }
2553
2621
  apply(compiler) {
2554
- const { dtsOptions, defaultOptions: defaultOptions3, pluginOptions, consumeTypesPromise, callback } = this;
2622
+ const { dtsOptions, defaultOptions: defaultOptions3, pluginOptions, fetchRemoteTypeUrlsPromise, callback } = this;
2555
2623
  const normalizedGenerateTypes = (0, import_sdk9.normalizeOptions)(true, defaultOptions3, "mfOptions.dts.generateTypes")(dtsOptions.generateTypes);
2556
2624
  if (!normalizedGenerateTypes) {
2557
2625
  callback();
2558
2626
  return;
2559
2627
  }
2628
+ const normalizedConsumeTypes = (0, import_sdk9.normalizeOptions)(true, defaultOptions3, "mfOptions.dts.consumeTypes")(dtsOptions.consumeTypes);
2560
2629
  const finalOptions = {
2561
2630
  remote: __spreadValues({
2562
2631
  implementation: dtsOptions.implementation,
@@ -2564,6 +2633,10 @@ var _GenerateTypesPlugin = class _GenerateTypesPlugin {
2564
2633
  outputDir: getCompilerOutputDir(compiler),
2565
2634
  moduleFederationConfig: pluginOptions
2566
2635
  }, normalizedGenerateTypes),
2636
+ host: normalizedConsumeTypes === false ? void 0 : __spreadValues({
2637
+ context: compiler.context,
2638
+ moduleFederationConfig: pluginOptions
2639
+ }, normalizedGenerateTypes),
2567
2640
  extraOptions: dtsOptions.extraOptions || {},
2568
2641
  displayErrorInTerminal: dtsOptions.displayErrorInTerminal
2569
2642
  };
@@ -2671,7 +2744,7 @@ var _GenerateTypesPlugin = class _GenerateTypesPlugin {
2671
2744
  compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
2672
2745
  )
2673
2746
  }, () => __async(this, null, function* () {
2674
- yield consumeTypesPromise;
2747
+ yield fetchRemoteTypeUrlsPromise;
2675
2748
  const emitTypesFilesPromise = emitTypesFiles(compilation);
2676
2749
  if (isProd) {
2677
2750
  yield emitTypesFilesPromise;
@@ -2695,8 +2768,8 @@ var _DtsPlugin = class _DtsPlugin {
2695
2768
  generateAPITypes: true,
2696
2769
  compileInChildProcess: true,
2697
2770
  abortOnError: false,
2698
- extractThirdParty: true,
2699
- extractRemoteTypes: true
2771
+ extractThirdParty: false,
2772
+ extractRemoteTypes: false
2700
2773
  };
2701
2774
  const defaultConsumeTypes = {
2702
2775
  abortOnError: false,
@@ -2711,17 +2784,17 @@ var _DtsPlugin = class _DtsPlugin {
2711
2784
  if (typeof normalizedDtsOptions !== "object") {
2712
2785
  return;
2713
2786
  }
2714
- let consumeTypesPromiseResolve;
2715
- const consumeTypesPromise = new Promise((resolve5) => {
2716
- consumeTypesPromiseResolve = resolve5;
2787
+ let fetchRemoteTypeUrlsResolve;
2788
+ const fetchRemoteTypeUrlsPromise = new Promise((resolve5) => {
2789
+ fetchRemoteTypeUrlsResolve = resolve5;
2717
2790
  });
2718
2791
  let generateTypesPromiseResolve;
2719
2792
  const generateTypesPromise = new Promise((resolve5) => {
2720
2793
  generateTypesPromiseResolve = resolve5;
2721
2794
  });
2722
- new DevPlugin(options, normalizedDtsOptions, generateTypesPromise).apply(compiler);
2723
- new GenerateTypesPlugin(options, normalizedDtsOptions, defaultGenerateTypes, consumeTypesPromise, generateTypesPromiseResolve).apply(compiler);
2724
- new ConsumeTypesPlugin(options, normalizedDtsOptions, defaultConsumeTypes, consumeTypesPromiseResolve).apply(compiler);
2795
+ new DevPlugin(options, normalizedDtsOptions, generateTypesPromise, fetchRemoteTypeUrlsPromise).apply(compiler);
2796
+ new GenerateTypesPlugin(options, normalizedDtsOptions, defaultGenerateTypes, fetchRemoteTypeUrlsPromise, generateTypesPromiseResolve).apply(compiler);
2797
+ new ConsumeTypesPlugin(options, normalizedDtsOptions, defaultConsumeTypes, fetchRemoteTypeUrlsResolve).apply(compiler);
2725
2798
  }
2726
2799
  };
2727
2800
  __name(_DtsPlugin, "DtsPlugin");
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/dts-plugin",
3
- "version": "0.8.12",
3
+ "version": "0.9.1",
4
4
  "author": "hanric <hanric.zhang@gmail.com>",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -60,7 +60,7 @@
60
60
  "chalk": "3.0.0",
61
61
  "fs-extra": "9.1.0",
62
62
  "isomorphic-ws": "5.0.0",
63
- "koa": "2.15.3",
63
+ "koa": "2.15.4",
64
64
  "log4js": "6.9.1",
65
65
  "node-schedule": "2.1.1",
66
66
  "ws": "8.18.0"
@@ -72,7 +72,8 @@
72
72
  "@module-federation/runtime": "workspace:*",
73
73
  "vue": "^3.4.29",
74
74
  "@vue/tsconfig": "^0.5.1",
75
- "vue-tsc": "^2.0.26"
75
+ "vue-tsc": "^2.0.26",
76
+ "rimraf": "~3.0.2"
76
77
  },
77
78
  "peerDependencies": {
78
79
  "typescript": "^4.9.0 || ^5.0.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/dts-plugin",
3
- "version": "0.8.12",
3
+ "version": "0.9.1",
4
4
  "author": "hanric <hanric.zhang@gmail.com>",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -56,14 +56,14 @@
56
56
  "chalk": "3.0.0",
57
57
  "fs-extra": "9.1.0",
58
58
  "isomorphic-ws": "5.0.0",
59
- "koa": "2.15.3",
59
+ "koa": "2.15.4",
60
60
  "log4js": "6.9.1",
61
61
  "node-schedule": "2.1.1",
62
62
  "ws": "8.18.0",
63
- "@module-federation/sdk": "0.8.12",
64
- "@module-federation/managers": "0.8.12",
65
- "@module-federation/third-party-dts-extractor": "0.8.12",
66
- "@module-federation/error-codes": "0.8.12"
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"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@types/ws": "8.5.12",
@@ -72,7 +72,8 @@
72
72
  "vue": "^3.4.29",
73
73
  "@vue/tsconfig": "^0.5.1",
74
74
  "vue-tsc": "^2.0.26",
75
- "@module-federation/runtime": "0.8.12"
75
+ "rimraf": "~3.0.2",
76
+ "@module-federation/runtime": "0.9.1"
76
77
  },
77
78
  "peerDependencies": {
78
79
  "typescript": "^4.9.0 || ^5.0.0",