@module-federation/dts-plugin 0.14.3 → 0.15.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,16 @@
1
1
  # @module-federation/dts-plugin
2
2
 
3
+ ## 0.15.0
4
+
5
+ ### Patch Changes
6
+
7
+ - c343589: fix(dts-plugin): only inject ipv4 str in dev mode
8
+ - b5e1640: chore(dts-plugin): check types archive url and optimize the error msg
9
+ - @module-federation/sdk@0.15.0
10
+ - @module-federation/managers@0.15.0
11
+ - @module-federation/third-party-dts-extractor@0.15.0
12
+ - @module-federation/error-codes@0.15.0
13
+
3
14
  ## 0.14.3
4
15
 
5
16
  ### Patch Changes
package/dist/core.js CHANGED
@@ -1165,7 +1165,7 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
1165
1165
  const destinationPath = retrieveTypesArchiveDestinationPath(hostOptions, destinationFolder);
1166
1166
  while (retries++ < hostOptions.maxRetries) {
1167
1167
  try {
1168
- const url = fileToDownload;
1168
+ const url = new URL(fileToDownload).href;
1169
1169
  const response = yield axiosGet(url, {
1170
1170
  responseType: "arraybuffer",
1171
1171
  timeout: hostOptions.timeout
@@ -1193,7 +1193,7 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
1193
1193
  } catch (error2) {
1194
1194
  fileLog(`Error during types archive download: ${(error2 == null ? void 0 : error2.message) || "unknown error"}`, "downloadTypesArchive", "error");
1195
1195
  if (retries >= hostOptions.maxRetries) {
1196
- logger.error(`Failed to download ${fileToDownload}, you can set FEDERATION_DEBUG=true to see detail message.`);
1196
+ logger.error(`Failed to download types archive from "${fileToDownload}". Set FEDERATION_DEBUG=true for details.`);
1197
1197
  if (hostOptions.abortOnError !== false) {
1198
1198
  throw error2;
1199
1199
  }
@@ -1399,7 +1399,7 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
1399
1399
  const destinationPath = retrieveTypesArchiveDestinationPath(hostOptions, destinationFolder);
1400
1400
  while (retries++ < hostOptions.maxRetries) {
1401
1401
  try {
1402
- const url = fileToDownload;
1402
+ const url = new URL(fileToDownload).href;
1403
1403
  const response = yield axiosGet(url, {
1404
1404
  responseType: "arraybuffer",
1405
1405
  timeout: hostOptions.timeout
@@ -1427,7 +1427,7 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
1427
1427
  } catch (error) {
1428
1428
  fileLog(`Error during types archive download: ${(error == null ? void 0 : error.message) || "unknown error"}`, "downloadTypesArchive", "error");
1429
1429
  if (retries >= hostOptions.maxRetries) {
1430
- logger.error(`Failed to download ${fileToDownload}, you can set FEDERATION_DEBUG=true to see detail message.`);
1430
+ logger.error(`Failed to download types archive from "${fileToDownload}". Set FEDERATION_DEBUG=true for details.`);
1431
1431
  if (hostOptions.abortOnError !== false) {
1432
1432
  throw error;
1433
1433
  }
@@ -4,7 +4,7 @@ import {
4
4
  exposeRpc,
5
5
  getDTSManagerConstructor,
6
6
  isDebugMode
7
- } from "./chunk-FTPSFGB4.js";
7
+ } from "./chunk-4LAJMII5.js";
8
8
  import {
9
9
  __async,
10
10
  __export,
package/dist/esm/core.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  consumeTypes,
4
4
  generateTypesInChildProcess,
5
5
  rpc_exports
6
- } from "./chunk-N3QR25YA.js";
6
+ } from "./chunk-YVBDT2VM.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-FTPSFGB4.js";
22
+ } from "./chunk-4LAJMII5.js";
23
23
  import "./chunk-WWV5RWOP.js";
24
24
  import "./chunk-647HGGGS.js";
25
25
  export {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  rpc_exports
3
- } from "./chunk-N3QR25YA.js";
3
+ } from "./chunk-YVBDT2VM.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-FTPSFGB4.js";
12
+ } from "./chunk-4LAJMII5.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-FTPSFGB4.js";
5
+ } from "./chunk-4LAJMII5.js";
6
6
  import "./chunk-WWV5RWOP.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-N3QR25YA.js";
5
+ } from "./chunk-YVBDT2VM.js";
6
6
  import {
7
7
  cloneDeepOptions,
8
8
  generateTypes,
9
9
  isTSProject,
10
10
  retrieveTypesAssetsInfo,
11
11
  validateOptions
12
- } from "./chunk-FTPSFGB4.js";
12
+ } from "./chunk-4LAJMII5.js";
13
13
  import {
14
14
  getIPV4,
15
15
  logger
@@ -178,9 +178,6 @@ var _DevPlugin = class _DevPlugin {
178
178
  apply(compiler) {
179
179
  var _a;
180
180
  const { _options: { name, dev, dts } } = this;
181
- new compiler.webpack.DefinePlugin({
182
- FEDERATION_IPV4: JSON.stringify(getIPV4())
183
- }).apply(compiler);
184
181
  const normalizedDev = normalizeOptions(true, {
185
182
  disableLiveReload: true,
186
183
  disableHotTypesReload: false,
@@ -189,6 +186,9 @@ var _DevPlugin = class _DevPlugin {
189
186
  if (!isDev() || normalizedDev === false) {
190
187
  return;
191
188
  }
189
+ new compiler.webpack.DefinePlugin({
190
+ FEDERATION_IPV4: JSON.stringify(getIPV4())
191
+ }).apply(compiler);
192
192
  if (normalizedDev.disableHotTypesReload && normalizedDev.disableLiveReload && normalizedDev.disableDynamicRemoteTypeHints) {
193
193
  return;
194
194
  }
@@ -572,6 +572,16 @@ var normalizeDtsOptions = /* @__PURE__ */ __name((options, context, defaultOptio
572
572
  displayErrorInTerminal: true
573
573
  }, "mfOptions.dts")(options.dts);
574
574
  }, "normalizeDtsOptions");
575
+ var excludeDts = /* @__PURE__ */ __name((filepath) => {
576
+ if (typeof filepath !== "string") {
577
+ return false;
578
+ }
579
+ const [_p, query] = filepath.split("?");
580
+ if (query && query.startsWith("exclude-mf-dts")) {
581
+ return true;
582
+ }
583
+ return false;
584
+ }, "excludeDts");
575
585
  var _DtsPlugin = class _DtsPlugin {
576
586
  constructor(options) {
577
587
  __publicField(this, "options");
@@ -585,8 +595,15 @@ var _DtsPlugin = class _DtsPlugin {
585
595
  const cleanedExposes = {};
586
596
  Object.entries(options.exposes).forEach(([key, value]) => {
587
597
  if (typeof value === "string") {
588
- cleanedExposes[key] = value.split("?")[0];
598
+ const [filepath, _query] = value.split("?");
599
+ if (excludeDts(value)) {
600
+ return;
601
+ }
602
+ cleanedExposes[key] = filepath;
589
603
  } else {
604
+ if (typeof value === "object" && Array.isArray(value.import) && value.import.some((v) => excludeDts(v))) {
605
+ return;
606
+ }
590
607
  cleanedExposes[key] = value;
591
608
  }
592
609
  });
@@ -1685,7 +1685,7 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
1685
1685
  const destinationPath = retrieveTypesArchiveDestinationPath(hostOptions, destinationFolder);
1686
1686
  while (retries++ < hostOptions.maxRetries) {
1687
1687
  try {
1688
- const url = fileToDownload;
1688
+ const url = new URL(fileToDownload).href;
1689
1689
  const response = yield axiosGet(url, {
1690
1690
  responseType: "arraybuffer",
1691
1691
  timeout: hostOptions.timeout
@@ -1713,7 +1713,7 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
1713
1713
  } catch (error2) {
1714
1714
  fileLog(`Error during types archive download: ${(error2 == null ? void 0 : error2.message) || "unknown error"}`, "downloadTypesArchive", "error");
1715
1715
  if (retries >= hostOptions.maxRetries) {
1716
- logger.error(`Failed to download ${fileToDownload}, you can set FEDERATION_DEBUG=true to see detail message.`);
1716
+ logger.error(`Failed to download types archive from "${fileToDownload}". Set FEDERATION_DEBUG=true for details.`);
1717
1717
  if (hostOptions.abortOnError !== false) {
1718
1718
  throw error2;
1719
1719
  }
@@ -1332,7 +1332,7 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
1332
1332
  const destinationPath = retrieveTypesArchiveDestinationPath(hostOptions, destinationFolder);
1333
1333
  while (retries++ < hostOptions.maxRetries) {
1334
1334
  try {
1335
- const url = fileToDownload;
1335
+ const url = new URL(fileToDownload).href;
1336
1336
  const response = yield axiosGet(url, {
1337
1337
  responseType: "arraybuffer",
1338
1338
  timeout: hostOptions.timeout
@@ -1360,7 +1360,7 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
1360
1360
  } catch (error2) {
1361
1361
  fileLog(`Error during types archive download: ${(error2 == null ? void 0 : error2.message) || "unknown error"}`, "downloadTypesArchive", "error");
1362
1362
  if (retries >= hostOptions.maxRetries) {
1363
- logger.error(`Failed to download ${fileToDownload}, you can set FEDERATION_DEBUG=true to see detail message.`);
1363
+ logger.error(`Failed to download types archive from "${fileToDownload}". Set FEDERATION_DEBUG=true for details.`);
1364
1364
  if (hostOptions.abortOnError !== false) {
1365
1365
  throw error2;
1366
1366
  }
package/dist/index.js CHANGED
@@ -1194,7 +1194,7 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
1194
1194
  const destinationPath = retrieveTypesArchiveDestinationPath(hostOptions, destinationFolder);
1195
1195
  while (retries++ < hostOptions.maxRetries) {
1196
1196
  try {
1197
- const url = fileToDownload;
1197
+ const url = new URL(fileToDownload).href;
1198
1198
  const response = yield axiosGet(url, {
1199
1199
  responseType: "arraybuffer",
1200
1200
  timeout: hostOptions.timeout
@@ -1222,7 +1222,7 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
1222
1222
  } catch (error2) {
1223
1223
  fileLog(`Error during types archive download: ${(error2 == null ? void 0 : error2.message) || "unknown error"}`, "downloadTypesArchive", "error");
1224
1224
  if (retries >= hostOptions.maxRetries) {
1225
- logger.error(`Failed to download ${fileToDownload}, you can set FEDERATION_DEBUG=true to see detail message.`);
1225
+ logger.error(`Failed to download types archive from "${fileToDownload}". Set FEDERATION_DEBUG=true for details.`);
1226
1226
  if (hostOptions.abortOnError !== false) {
1227
1227
  throw error2;
1228
1228
  }
@@ -2493,9 +2493,6 @@ var _DevPlugin = class _DevPlugin {
2493
2493
  apply(compiler) {
2494
2494
  var _a3;
2495
2495
  const { _options: { name, dev, dts } } = this;
2496
- new compiler.webpack.DefinePlugin({
2497
- FEDERATION_IPV4: JSON.stringify(getIPV4())
2498
- }).apply(compiler);
2499
2496
  const normalizedDev = (0, import_sdk7.normalizeOptions)(true, {
2500
2497
  disableLiveReload: true,
2501
2498
  disableHotTypesReload: false,
@@ -2504,6 +2501,9 @@ var _DevPlugin = class _DevPlugin {
2504
2501
  if (!isDev() || normalizedDev === false) {
2505
2502
  return;
2506
2503
  }
2504
+ new compiler.webpack.DefinePlugin({
2505
+ FEDERATION_IPV4: JSON.stringify(getIPV4())
2506
+ }).apply(compiler);
2507
2507
  if (normalizedDev.disableHotTypesReload && normalizedDev.disableLiveReload && normalizedDev.disableDynamicRemoteTypeHints) {
2508
2508
  return;
2509
2509
  }
@@ -2887,6 +2887,16 @@ var normalizeDtsOptions = /* @__PURE__ */ __name((options, context, defaultOptio
2887
2887
  displayErrorInTerminal: true
2888
2888
  }, "mfOptions.dts")(options.dts);
2889
2889
  }, "normalizeDtsOptions");
2890
+ var excludeDts = /* @__PURE__ */ __name((filepath) => {
2891
+ if (typeof filepath !== "string") {
2892
+ return false;
2893
+ }
2894
+ const [_p, query] = filepath.split("?");
2895
+ if (query && query.startsWith("exclude-mf-dts")) {
2896
+ return true;
2897
+ }
2898
+ return false;
2899
+ }, "excludeDts");
2890
2900
  var _DtsPlugin = class _DtsPlugin {
2891
2901
  constructor(options) {
2892
2902
  __publicField(this, "options");
@@ -2900,8 +2910,15 @@ var _DtsPlugin = class _DtsPlugin {
2900
2910
  const cleanedExposes = {};
2901
2911
  Object.entries(options.exposes).forEach(([key, value]) => {
2902
2912
  if (typeof value === "string") {
2903
- cleanedExposes[key] = value.split("?")[0];
2913
+ const [filepath, _query] = value.split("?");
2914
+ if (excludeDts(value)) {
2915
+ return;
2916
+ }
2917
+ cleanedExposes[key] = filepath;
2904
2918
  } else {
2919
+ if (typeof value === "object" && Array.isArray(value.import) && value.import.some((v) => excludeDts(v))) {
2920
+ return;
2921
+ }
2905
2922
  cleanedExposes[key] = value;
2906
2923
  }
2907
2924
  });
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/dts-plugin",
3
- "version": "0.14.3",
3
+ "version": "0.15.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.14.3",
3
+ "version": "0.15.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.14.3",
64
- "@module-federation/managers": "0.14.3",
65
- "@module-federation/third-party-dts-extractor": "0.14.3",
66
- "@module-federation/error-codes": "0.14.3"
63
+ "@module-federation/sdk": "0.15.0",
64
+ "@module-federation/managers": "0.15.0",
65
+ "@module-federation/third-party-dts-extractor": "0.15.0",
66
+ "@module-federation/error-codes": "0.15.0"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@types/ws": "8.5.12",
@@ -73,7 +73,7 @@
73
73
  "@vue/tsconfig": "^0.7.0",
74
74
  "vue-tsc": "^2.2.10",
75
75
  "rimraf": "~6.0.1",
76
- "@module-federation/runtime": "0.14.3"
76
+ "@module-federation/runtime": "0.15.0"
77
77
  },
78
78
  "peerDependencies": {
79
79
  "typescript": "^4.9.0 || ^5.0.0",