@module-federation/dts-plugin 0.21.4 → 0.21.5

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.
@@ -29,160 +29,6 @@ import {
29
29
  __spreadValues
30
30
  } from "./chunk-647HGGGS.js";
31
31
 
32
- // src/core/lib/typeScriptCompiler.ts
33
- import { ensureDirSync, writeFileSync, existsSync } from "fs-extra";
34
- import crypto from "crypto";
35
- import { stat, readdir, writeFile, rm, readFile } from "fs/promises";
36
- import { dirname, join, normalize, relative, resolve, sep, extname, isAbsolute } from "path";
37
- import { getShortErrorMsg, TYPE_001, typeDescMap } from "@module-federation/error-codes";
38
- import { ThirdPartyExtractor } from "@module-federation/third-party-dts-extractor";
39
- import { exec } from "child_process";
40
- import util from "util";
41
- import { TEMP_DIR } from "@module-federation/sdk";
42
- var STARTS_WITH_SLASH = /^\//;
43
- var DEFINITION_FILE_EXTENSION = ".d.ts";
44
- var retrieveMfTypesPath = /* @__PURE__ */ __name((tsConfig, remoteOptions) => normalize(tsConfig.compilerOptions.outDir.replace(remoteOptions.compiledTypesFolder, "")), "retrieveMfTypesPath");
45
- var retrieveOriginalOutDir = /* @__PURE__ */ __name((tsConfig, remoteOptions) => normalize(tsConfig.compilerOptions.outDir.replace(remoteOptions.compiledTypesFolder, "").replace(remoteOptions.typesFolder, "")), "retrieveOriginalOutDir");
46
- var retrieveMfAPITypesPath = /* @__PURE__ */ __name((tsConfig, remoteOptions) => join(retrieveOriginalOutDir(tsConfig, remoteOptions), `${remoteOptions.typesFolder}.d.ts`), "retrieveMfAPITypesPath");
47
- function writeTempTsConfig(tsConfig, context, name, cwd) {
48
- const createHash = /* @__PURE__ */ __name((contents) => {
49
- return crypto.createHash("md5").update(contents).digest("hex");
50
- }, "createHash");
51
- const hash = createHash(`${JSON.stringify(tsConfig)}${name}${Date.now()}`);
52
- const tempTsConfigJsonPath = resolve(cwd != null ? cwd : context, "node_modules", TEMP_DIR, `tsconfig.${hash}.json`);
53
- ensureDirSync(dirname(tempTsConfigJsonPath));
54
- writeFileSync(tempTsConfigJsonPath, JSON.stringify(tsConfig, null, 2));
55
- return tempTsConfigJsonPath;
56
- }
57
- __name(writeTempTsConfig, "writeTempTsConfig");
58
- var removeExt = /* @__PURE__ */ __name((f) => {
59
- const vueExt = ".vue";
60
- const ext = extname(f);
61
- if (ext === vueExt) {
62
- return f;
63
- }
64
- const regexPattern = new RegExp(`\\${ext}$`);
65
- return f.replace(regexPattern, "");
66
- }, "removeExt");
67
- function getExposeKey(options) {
68
- const { filePath, rootDir, outDir, mapExposeToEntry } = options;
69
- const relativeFilePath = relative(outDir, filePath.replace(new RegExp(`\\.d.ts$`), ""));
70
- return mapExposeToEntry[relativeFilePath];
71
- }
72
- __name(getExposeKey, "getExposeKey");
73
- var processTypesFile = /* @__PURE__ */ __name((options) => __async(void 0, null, function* () {
74
- const { outDir, filePath, rootDir, cb, mapExposeToEntry, mfTypePath } = options;
75
- if (!existsSync(filePath)) {
76
- return;
77
- }
78
- const stats = yield stat(filePath);
79
- if (stats.isDirectory()) {
80
- const files = yield readdir(filePath);
81
- yield Promise.all(files.map((file) => processTypesFile(__spreadProps(__spreadValues({}, options), {
82
- filePath: join(filePath, file)
83
- }))));
84
- } else if (filePath.endsWith(".d.ts")) {
85
- const exposeKey = getExposeKey({
86
- filePath,
87
- rootDir,
88
- outDir,
89
- mapExposeToEntry
90
- });
91
- if (exposeKey) {
92
- const sourceEntry = exposeKey === "." ? "index" : exposeKey;
93
- const mfeTypeEntry = join(mfTypePath, `${sourceEntry}${DEFINITION_FILE_EXTENSION}`);
94
- const mfeTypeEntryDirectory = dirname(mfeTypeEntry);
95
- const relativePathToOutput = relative(mfeTypeEntryDirectory, filePath).replace(DEFINITION_FILE_EXTENSION, "").replace(STARTS_WITH_SLASH, "").split(sep).join("/");
96
- ensureDirSync(mfeTypeEntryDirectory);
97
- yield writeFile(mfeTypeEntry, `export * from './${relativePathToOutput}';
98
- export { default } from './${relativePathToOutput}';`);
99
- }
100
- const content = yield readFile(filePath, "utf8");
101
- cb(content);
102
- }
103
- }), "processTypesFile");
104
- var getPMFromUserAgent = /* @__PURE__ */ __name(() => {
105
- const userAgent = process.env["npm_config_user_agent"];
106
- if (userAgent == null) {
107
- return "null";
108
- }
109
- const name = userAgent.split("/")[0];
110
- return name;
111
- }, "getPMFromUserAgent");
112
- var resolvePackageManagerExecutable = /* @__PURE__ */ __name(() => {
113
- const pm = getPMFromUserAgent();
114
- switch (pm) {
115
- case "yarn":
116
- return "yarn";
117
- case "npm":
118
- case "pnpm":
119
- default:
120
- return "npx";
121
- }
122
- }, "resolvePackageManagerExecutable");
123
- var compileTs = /* @__PURE__ */ __name((mapComponentsToExpose, tsConfig, remoteOptions) => __async(void 0, null, function* () {
124
- var _a2, _b, _c, _d;
125
- if (!Object.keys(mapComponentsToExpose).length) {
126
- return;
127
- }
128
- const { compilerOptions } = tsConfig;
129
- const tempTsConfigJsonPath = writeTempTsConfig(tsConfig, remoteOptions.context, remoteOptions.moduleFederationConfig.name || "mf", typeof remoteOptions.moduleFederationConfig.dts !== "boolean" ? (_b = (_a2 = remoteOptions.moduleFederationConfig.dts) == null ? void 0 : _a2.cwd) != null ? _b : void 0 : void 0);
130
- try {
131
- const mfTypePath = retrieveMfTypesPath(tsConfig, remoteOptions);
132
- const thirdPartyExtractor = new ThirdPartyExtractor({
133
- destDir: resolve(mfTypePath, "node_modules"),
134
- context: remoteOptions.context,
135
- exclude: typeof remoteOptions.extractThirdParty === "object" ? remoteOptions.extractThirdParty.exclude : void 0
136
- });
137
- const execPromise = util.promisify(exec);
138
- const pmExecutable = resolvePackageManagerExecutable();
139
- const cmd = `${pmExecutable} ${remoteOptions.compilerInstance} --project '${tempTsConfigJsonPath}'`;
140
- try {
141
- yield execPromise(cmd, {
142
- cwd: typeof remoteOptions.moduleFederationConfig.dts !== "boolean" ? (_d = (_c = remoteOptions.moduleFederationConfig.dts) == null ? void 0 : _c.cwd) != null ? _d : void 0 : void 0
143
- });
144
- } catch (err) {
145
- if (compilerOptions.tsBuildInfoFile) {
146
- try {
147
- yield rm(compilerOptions.tsBuildInfoFile);
148
- } catch (e) {
149
- }
150
- }
151
- throw new Error(getShortErrorMsg(TYPE_001, typeDescMap, {
152
- cmd
153
- }));
154
- }
155
- const mapExposeToEntry = Object.fromEntries(Object.entries(mapComponentsToExpose).map(([exposed, filename]) => {
156
- const normalizedFileName = normalize(filename);
157
- let relativeFileName = "";
158
- if (isAbsolute(normalizedFileName)) {
159
- relativeFileName = relative(tsConfig.compilerOptions.rootDir, normalizedFileName);
160
- } else {
161
- relativeFileName = relative(tsConfig.compilerOptions.rootDir, resolve(remoteOptions.context, normalizedFileName));
162
- }
163
- return [
164
- removeExt(relativeFileName),
165
- exposed
166
- ];
167
- }));
168
- const cb = remoteOptions.extractThirdParty ? thirdPartyExtractor.collectPkgs.bind(thirdPartyExtractor) : () => void 0;
169
- yield processTypesFile({
170
- outDir: compilerOptions.outDir,
171
- filePath: compilerOptions.outDir,
172
- rootDir: compilerOptions.rootDir,
173
- mfTypePath,
174
- cb,
175
- mapExposeToEntry
176
- });
177
- if (remoteOptions.extractThirdParty) {
178
- yield thirdPartyExtractor.copyDts();
179
- }
180
- yield rm(tempTsConfigJsonPath);
181
- } catch (err) {
182
- throw err;
183
- }
184
- }), "compileTs");
185
-
186
32
  // src/server/DevServer.ts
187
33
  import WebSocket from "isomorphic-ws";
188
34
 
@@ -595,6 +441,163 @@ function createKoaServer(options) {
595
441
  }
596
442
  __name(createKoaServer, "createKoaServer");
597
443
 
444
+ // src/core/lib/typeScriptCompiler.ts
445
+ import { ensureDirSync, writeFileSync, existsSync } from "fs-extra";
446
+ import crypto from "crypto";
447
+ import { stat, readdir, writeFile, rm, readFile } from "fs/promises";
448
+ import { dirname, join, normalize, relative, resolve, sep, extname, isAbsolute } from "path";
449
+ import { getShortErrorMsg, TYPE_001, typeDescMap } from "@module-federation/error-codes";
450
+ import { ThirdPartyExtractor } from "@module-federation/third-party-dts-extractor";
451
+ import { exec } from "child_process";
452
+ import util from "util";
453
+ import { TEMP_DIR } from "@module-federation/sdk";
454
+ var STARTS_WITH_SLASH = /^\//;
455
+ var DEFINITION_FILE_EXTENSION = ".d.ts";
456
+ var retrieveMfTypesPath = /* @__PURE__ */ __name((tsConfig, remoteOptions) => normalize(tsConfig.compilerOptions.outDir.replace(remoteOptions.compiledTypesFolder, "")), "retrieveMfTypesPath");
457
+ var retrieveOriginalOutDir = /* @__PURE__ */ __name((tsConfig, remoteOptions) => normalize(tsConfig.compilerOptions.outDir.replace(remoteOptions.compiledTypesFolder, "").replace(remoteOptions.typesFolder, "")), "retrieveOriginalOutDir");
458
+ var retrieveMfAPITypesPath = /* @__PURE__ */ __name((tsConfig, remoteOptions) => join(retrieveOriginalOutDir(tsConfig, remoteOptions), `${remoteOptions.typesFolder}.d.ts`), "retrieveMfAPITypesPath");
459
+ function writeTempTsConfig(tsConfig, context, name, cwd) {
460
+ const createHash = /* @__PURE__ */ __name((contents) => {
461
+ return crypto.createHash("md5").update(contents).digest("hex");
462
+ }, "createHash");
463
+ const hash = createHash(`${JSON.stringify(tsConfig)}${name}${Date.now()}`);
464
+ const tempTsConfigJsonPath = resolve(cwd != null ? cwd : context, "node_modules", TEMP_DIR, `tsconfig.${hash}.json`);
465
+ ensureDirSync(dirname(tempTsConfigJsonPath));
466
+ writeFileSync(tempTsConfigJsonPath, JSON.stringify(tsConfig, null, 2));
467
+ return tempTsConfigJsonPath;
468
+ }
469
+ __name(writeTempTsConfig, "writeTempTsConfig");
470
+ var removeExt = /* @__PURE__ */ __name((f) => {
471
+ const vueExt = ".vue";
472
+ const ext = extname(f);
473
+ if (ext === vueExt) {
474
+ return f;
475
+ }
476
+ const regexPattern = new RegExp(`\\${ext}$`);
477
+ return f.replace(regexPattern, "");
478
+ }, "removeExt");
479
+ function getExposeKey(options) {
480
+ const { filePath, rootDir, outDir, mapExposeToEntry } = options;
481
+ const relativeFilePath = relative(outDir, filePath.replace(new RegExp(`\\.d.ts$`), ""));
482
+ return mapExposeToEntry[relativeFilePath];
483
+ }
484
+ __name(getExposeKey, "getExposeKey");
485
+ var processTypesFile = /* @__PURE__ */ __name((options) => __async(void 0, null, function* () {
486
+ const { outDir, filePath, rootDir, cb, mapExposeToEntry, mfTypePath } = options;
487
+ if (!existsSync(filePath)) {
488
+ return;
489
+ }
490
+ const stats = yield stat(filePath);
491
+ if (stats.isDirectory()) {
492
+ const files = yield readdir(filePath);
493
+ yield Promise.all(files.map((file) => processTypesFile(__spreadProps(__spreadValues({}, options), {
494
+ filePath: join(filePath, file)
495
+ }))));
496
+ } else if (filePath.endsWith(".d.ts")) {
497
+ const exposeKey = getExposeKey({
498
+ filePath,
499
+ rootDir,
500
+ outDir,
501
+ mapExposeToEntry
502
+ });
503
+ if (exposeKey) {
504
+ const sourceEntry = exposeKey === "." ? "index" : exposeKey;
505
+ const mfeTypeEntry = join(mfTypePath, `${sourceEntry}${DEFINITION_FILE_EXTENSION}`);
506
+ const mfeTypeEntryDirectory = dirname(mfeTypeEntry);
507
+ const relativePathToOutput = relative(mfeTypeEntryDirectory, filePath).replace(DEFINITION_FILE_EXTENSION, "").replace(STARTS_WITH_SLASH, "").split(sep).join("/");
508
+ ensureDirSync(mfeTypeEntryDirectory);
509
+ yield writeFile(mfeTypeEntry, `export * from './${relativePathToOutput}';
510
+ export { default } from './${relativePathToOutput}';`);
511
+ }
512
+ const content = yield readFile(filePath, "utf8");
513
+ cb(content);
514
+ }
515
+ }), "processTypesFile");
516
+ var getPMFromUserAgent = /* @__PURE__ */ __name(() => {
517
+ const userAgent = process.env["npm_config_user_agent"];
518
+ if (userAgent == null) {
519
+ return "null";
520
+ }
521
+ const name = userAgent.split("/")[0];
522
+ return name;
523
+ }, "getPMFromUserAgent");
524
+ var resolvePackageManagerExecutable = /* @__PURE__ */ __name(() => {
525
+ const pm = getPMFromUserAgent();
526
+ switch (pm) {
527
+ case "yarn":
528
+ return "yarn";
529
+ case "npm":
530
+ case "pnpm":
531
+ default:
532
+ return "npx";
533
+ }
534
+ }, "resolvePackageManagerExecutable");
535
+ var compileTs = /* @__PURE__ */ __name((mapComponentsToExpose, tsConfig, remoteOptions) => __async(void 0, null, function* () {
536
+ var _a2, _b, _c, _d;
537
+ if (!Object.keys(mapComponentsToExpose).length) {
538
+ return;
539
+ }
540
+ const { compilerOptions } = tsConfig;
541
+ const tempTsConfigJsonPath = writeTempTsConfig(tsConfig, remoteOptions.context, remoteOptions.moduleFederationConfig.name || "mf", typeof remoteOptions.moduleFederationConfig.dts !== "boolean" ? (_b = (_a2 = remoteOptions.moduleFederationConfig.dts) == null ? void 0 : _a2.cwd) != null ? _b : void 0 : void 0);
542
+ logger.debug(`tempTsConfigJsonPath: ${tempTsConfigJsonPath}`);
543
+ try {
544
+ const mfTypePath = retrieveMfTypesPath(tsConfig, remoteOptions);
545
+ const thirdPartyExtractor = new ThirdPartyExtractor({
546
+ destDir: resolve(mfTypePath, "node_modules"),
547
+ context: remoteOptions.context,
548
+ exclude: typeof remoteOptions.extractThirdParty === "object" ? remoteOptions.extractThirdParty.exclude : void 0
549
+ });
550
+ const execPromise = util.promisify(exec);
551
+ const pmExecutable = resolvePackageManagerExecutable();
552
+ const cmd = `${pmExecutable} ${remoteOptions.compilerInstance} --project '${tempTsConfigJsonPath}'`;
553
+ try {
554
+ yield execPromise(cmd, {
555
+ cwd: typeof remoteOptions.moduleFederationConfig.dts !== "boolean" ? (_d = (_c = remoteOptions.moduleFederationConfig.dts) == null ? void 0 : _c.cwd) != null ? _d : void 0 : void 0
556
+ });
557
+ } catch (err) {
558
+ if (compilerOptions.tsBuildInfoFile) {
559
+ try {
560
+ yield rm(compilerOptions.tsBuildInfoFile);
561
+ } catch (e) {
562
+ }
563
+ }
564
+ throw new Error(getShortErrorMsg(TYPE_001, typeDescMap, {
565
+ cmd
566
+ }));
567
+ }
568
+ const mapExposeToEntry = Object.fromEntries(Object.entries(mapComponentsToExpose).map(([exposed, filename]) => {
569
+ const normalizedFileName = normalize(filename);
570
+ let relativeFileName = "";
571
+ if (isAbsolute(normalizedFileName)) {
572
+ relativeFileName = relative(tsConfig.compilerOptions.rootDir, normalizedFileName);
573
+ } else {
574
+ relativeFileName = relative(tsConfig.compilerOptions.rootDir, resolve(remoteOptions.context, normalizedFileName));
575
+ }
576
+ return [
577
+ removeExt(relativeFileName),
578
+ exposed
579
+ ];
580
+ }));
581
+ const cb = remoteOptions.extractThirdParty ? thirdPartyExtractor.collectPkgs.bind(thirdPartyExtractor) : () => void 0;
582
+ yield processTypesFile({
583
+ outDir: compilerOptions.outDir,
584
+ filePath: compilerOptions.outDir,
585
+ rootDir: compilerOptions.rootDir,
586
+ mfTypePath,
587
+ cb,
588
+ mapExposeToEntry
589
+ });
590
+ if (remoteOptions.extractThirdParty) {
591
+ yield thirdPartyExtractor.copyDts();
592
+ }
593
+ if (remoteOptions.deleteTsConfig) {
594
+ yield rm(tempTsConfigJsonPath);
595
+ }
596
+ } catch (err) {
597
+ throw err;
598
+ }
599
+ }), "compileTs");
600
+
598
601
  // src/core/lib/archiveHandler.ts
599
602
  import AdmZip from "adm-zip";
600
603
  import { resolve as resolve3, join as join3 } from "path";
@@ -629,7 +632,8 @@ var defaultOptions = {
629
632
  abortOnError: true,
630
633
  extractRemoteTypes: false,
631
634
  extractThirdParty: false,
632
- outputDir: ""
635
+ outputDir: "",
636
+ deleteTsConfig: true
633
637
  };
634
638
  function getEffectiveRootDir(parsedCommandLine) {
635
639
  const compilerOptions = parsedCommandLine.options;
@@ -699,6 +703,9 @@ var readTsConfig = /* @__PURE__ */ __name(({ tsConfigPath, typesFolder, compiled
699
703
  rawTsConfigJson.exclude = [];
700
704
  "references" in rawTsConfigJson && delete rawTsConfigJson.references;
701
705
  rawTsConfigJson.extends = resolvedTsConfigPath;
706
+ if (rawTsConfigJson.compilerOptions.declarationDir) {
707
+ delete rawTsConfigJson.compilerOptions.declarationDir;
708
+ }
702
709
  return rawTsConfigJson;
703
710
  }, "readTsConfig");
704
711
  var TS_EXTENSIONS = [
@@ -1306,15 +1313,12 @@ var validateOptions = /* @__PURE__ */ __name((options) => {
1306
1313
  }
1307
1314
  }, "validateOptions");
1308
1315
  function retrieveTypesAssetsInfo(options) {
1309
- const { moduleFederationConfig } = options;
1310
1316
  let apiTypesPath = "";
1311
1317
  let zipTypesPath = "";
1312
- let zipPrefix = "";
1313
1318
  try {
1314
1319
  const { tsConfig, remoteOptions, mapComponentsToExpose } = retrieveRemoteConfig(options);
1315
1320
  if (!Object.keys(mapComponentsToExpose).length || !tsConfig.files.length) {
1316
1321
  return {
1317
- zipPrefix,
1318
1322
  apiTypesPath,
1319
1323
  zipTypesPath,
1320
1324
  zipName: "",
@@ -1326,15 +1330,7 @@ function retrieveTypesAssetsInfo(options) {
1326
1330
  if (remoteOptions.generateAPITypes) {
1327
1331
  apiTypesPath = retrieveMfAPITypesPath(tsConfig, remoteOptions);
1328
1332
  }
1329
- if (typeof moduleFederationConfig.manifest === "object" && moduleFederationConfig.manifest.filePath) {
1330
- zipPrefix = moduleFederationConfig.manifest.filePath;
1331
- } else if (typeof moduleFederationConfig.manifest === "object" && moduleFederationConfig.manifest.fileName) {
1332
- zipPrefix = path3.dirname(moduleFederationConfig.manifest.fileName);
1333
- } else if (moduleFederationConfig.filename) {
1334
- zipPrefix = path3.dirname(moduleFederationConfig.filename);
1335
- }
1336
1333
  return {
1337
- zipPrefix,
1338
1334
  apiTypesPath,
1339
1335
  zipTypesPath,
1340
1336
  zipName: path3.basename(zipTypesPath),
@@ -1343,7 +1339,6 @@ function retrieveTypesAssetsInfo(options) {
1343
1339
  } catch (err) {
1344
1340
  console.error(ansiColors.red(`Unable to compile federated types, ${err}`));
1345
1341
  return {
1346
- zipPrefix,
1347
1342
  apiTypesPath: "",
1348
1343
  zipTypesPath: "",
1349
1344
  zipName: "",
@@ -1561,10 +1556,10 @@ function exposeRpc(fn) {
1561
1556
  __name(exposeRpc, "exposeRpc");
1562
1557
 
1563
1558
  export {
1564
- retrieveMfTypesPath,
1565
- retrieveOriginalOutDir,
1566
1559
  ModuleFederationDevServer,
1567
1560
  createKoaServer,
1561
+ retrieveMfTypesPath,
1562
+ retrieveOriginalOutDir,
1568
1563
  retrieveTypesZipPath,
1569
1564
  retrieveHostConfig,
1570
1565
  REMOTE_ALIAS_IDENTIFIER,
package/dist/esm/core.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  consumeTypes,
4
4
  generateTypesInChildProcess,
5
5
  rpc_exports
6
- } from "./chunk-OEN3DGLA.js";
6
+ } from "./chunk-N7GTIQUA.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-JGZ276AJ.js";
22
+ } from "./chunk-RWXNVNFM.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-OEN3DGLA.js";
3
+ } from "./chunk-N7GTIQUA.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-JGZ276AJ.js";
12
+ } from "./chunk-RWXNVNFM.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-JGZ276AJ.js";
5
+ } from "./chunk-RWXNVNFM.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-OEN3DGLA.js";
5
+ } from "./chunk-N7GTIQUA.js";
6
6
  import {
7
7
  cloneDeepOptions,
8
8
  generateTypes,
9
9
  isTSProject,
10
10
  retrieveTypesAssetsInfo,
11
11
  validateOptions
12
- } from "./chunk-JGZ276AJ.js";
12
+ } from "./chunk-RWXNVNFM.js";
13
13
  import {
14
14
  getIPV4,
15
15
  logger
@@ -452,23 +452,12 @@ var _GenerateTypesPlugin = class _GenerateTypesPlugin {
452
452
  dtsManagerOptions
453
453
  });
454
454
  logger3.debug("generate types success!");
455
- const config = dtsManagerOptions.remote.moduleFederationConfig;
456
- let zipPrefix = "";
457
- if (typeof config.manifest === "object" && config.manifest.filePath) {
458
- zipPrefix = config.manifest.filePath;
459
- } else if (typeof config.manifest === "object" && config.manifest.fileName) {
460
- zipPrefix = path5.dirname(config.manifest.fileName);
461
- } else if (config.filename) {
462
- zipPrefix = path5.dirname(config.filename);
463
- }
464
455
  if (isProd) {
465
- const zipAssetName = path5.join(zipPrefix, zipName);
466
- const apiAssetName = path5.join(zipPrefix, apiFileName);
467
- if (zipTypesPath && !compilation.getAsset(zipAssetName) && fs2.existsSync(zipTypesPath)) {
468
- compilation.emitAsset(zipAssetName, new compiler.webpack.sources.RawSource(fs2.readFileSync(zipTypesPath), false));
456
+ if (zipTypesPath && !compilation.getAsset(zipName) && fs2.existsSync(zipTypesPath)) {
457
+ compilation.emitAsset(zipName, new compiler.webpack.sources.RawSource(fs2.readFileSync(zipTypesPath), false));
469
458
  }
470
- if (apiTypesPath && !compilation.getAsset(apiAssetName) && fs2.existsSync(apiTypesPath)) {
471
- compilation.emitAsset(apiAssetName, new compiler.webpack.sources.RawSource(fs2.readFileSync(apiTypesPath), false));
459
+ if (apiTypesPath && !compilation.getAsset(apiFileName) && fs2.existsSync(apiTypesPath)) {
460
+ compilation.emitAsset(apiFileName, new compiler.webpack.sources.RawSource(fs2.readFileSync(apiTypesPath), false));
472
461
  }
473
462
  callback();
474
463
  } else {
@@ -477,7 +466,7 @@ var _GenerateTypesPlugin = class _GenerateTypesPlugin {
477
466
  }, "isEEXIST");
478
467
  if (zipTypesPath && fs2.existsSync(zipTypesPath)) {
479
468
  const zipContent = fs2.readFileSync(zipTypesPath);
480
- const zipOutputPath = path5.join(compiler.outputPath, zipPrefix, zipName);
469
+ const zipOutputPath = path5.join(compiler.outputPath, zipName);
481
470
  yield new Promise((resolve2, reject) => {
482
471
  compiler.outputFileSystem.mkdir(
483
472
  path5.dirname(zipOutputPath),
@@ -508,7 +497,7 @@ var _GenerateTypesPlugin = class _GenerateTypesPlugin {
508
497
  }
509
498
  if (apiTypesPath && fs2.existsSync(apiTypesPath)) {
510
499
  const apiContent = fs2.readFileSync(apiTypesPath);
511
- const apiOutputPath = path5.join(compiler.outputPath, zipPrefix, apiFileName);
500
+ const apiOutputPath = path5.join(compiler.outputPath, apiFileName);
512
501
  yield new Promise((resolve2, reject) => {
513
502
  compiler.outputFileSystem.mkdir(
514
503
  path5.dirname(apiOutputPath),