@module-federation/dts-plugin 0.2.1 → 0.2.3

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,24 @@
1
1
  # @module-federation/dts-plugin
2
2
 
3
+ ## 0.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [32f26af]
8
+ - Updated dependencies [32f26af]
9
+ - @module-federation/sdk@0.2.3
10
+ - @module-federation/managers@0.2.3
11
+ - @module-federation/third-party-dts-extractor@0.2.3
12
+
13
+ ## 0.2.2
14
+
15
+ ### Patch Changes
16
+
17
+ - 7d09ed8: Emit DTS relative to remote entry location
18
+ - @module-federation/sdk@0.2.2
19
+ - @module-federation/managers@0.2.2
20
+ - @module-federation/third-party-dts-extractor@0.2.2
21
+
3
22
  ## 0.2.1
4
23
 
5
24
  ### Patch Changes
package/dist/core.d.mts CHANGED
@@ -18,7 +18,7 @@ declare function retrieveTypesAssetsInfo(options: RemoteOptions): {
18
18
  zipName: string;
19
19
  apiFileName: string;
20
20
  };
21
- declare const isTSProject: (dtsOptions: moduleFederationPlugin.ModuleFederationPluginOptions['dts'], context?: string) => boolean;
21
+ declare const isTSProject: (dtsOptions: moduleFederationPlugin.ModuleFederationPluginOptions["dts"], context?: string) => boolean;
22
22
 
23
23
  declare const retrieveMfTypesPath: (tsConfig: typescript.CompilerOptions, remoteOptions: Required<RemoteOptions>) => string;
24
24
  declare const retrieveOriginalOutDir: (tsConfig: typescript.CompilerOptions, remoteOptions: Required<RemoteOptions>) => string;
package/dist/core.d.ts CHANGED
@@ -18,7 +18,7 @@ declare function retrieveTypesAssetsInfo(options: RemoteOptions): {
18
18
  zipName: string;
19
19
  apiFileName: string;
20
20
  };
21
- declare const isTSProject: (dtsOptions: moduleFederationPlugin.ModuleFederationPluginOptions['dts'], context?: string) => boolean;
21
+ declare const isTSProject: (dtsOptions: moduleFederationPlugin.ModuleFederationPluginOptions["dts"], context?: string) => boolean;
22
22
 
23
23
  declare const retrieveMfTypesPath: (tsConfig: typescript.CompilerOptions, remoteOptions: Required<RemoteOptions>) => string;
24
24
  declare const retrieveOriginalOutDir: (tsConfig: typescript.CompilerOptions, remoteOptions: Required<RemoteOptions>) => string;
package/dist/esm/index.js CHANGED
@@ -283,6 +283,7 @@ var ConsumeTypesPlugin = _ConsumeTypesPlugin;
283
283
  // packages/dts-plugin/src/plugins/GenerateTypesPlugin.ts
284
284
  import fs2 from "fs";
285
285
  import { normalizeOptions as normalizeOptions3 } from "@module-federation/sdk";
286
+ import path4 from "path";
286
287
  var _GenerateTypesPlugin = class _GenerateTypesPlugin {
287
288
  constructor(pluginOptions, dtsOptions, defaultOptions) {
288
289
  __publicField(this, "pluginOptions");
@@ -338,11 +339,21 @@ var _GenerateTypesPlugin = class _GenerateTypesPlugin {
338
339
  return;
339
340
  }
340
341
  yield generateTypesFn(finalOptions);
342
+ const config = finalOptions.remote.moduleFederationConfig;
343
+ let zipPrefix = "";
344
+ const isManifestObject = typeof config.manifest === "object";
345
+ if (isManifestObject && config.manifest.filePath) {
346
+ zipPrefix = config.manifest.filePath;
347
+ } else if (isManifestObject && config.manifest.fileName) {
348
+ zipPrefix = path4.dirname(config.manifest.fileName);
349
+ } else if (config.filename) {
350
+ zipPrefix = path4.dirname(config.filename);
351
+ }
341
352
  if (zipTypesPath) {
342
- compilation.emitAsset(zipName, new compiler.webpack.sources.RawSource(fs2.readFileSync(zipTypesPath), false));
353
+ compilation.emitAsset(path4.join(zipPrefix, zipName), new compiler.webpack.sources.RawSource(fs2.readFileSync(zipTypesPath), false));
343
354
  }
344
355
  if (apiTypesPath) {
345
- compilation.emitAsset(apiFileName, new compiler.webpack.sources.RawSource(fs2.readFileSync(apiTypesPath), false));
356
+ compilation.emitAsset(path4.join(zipPrefix, apiFileName), new compiler.webpack.sources.RawSource(fs2.readFileSync(apiTypesPath), false));
346
357
  }
347
358
  } catch (err) {
348
359
  console.error(err);
package/dist/index.js CHANGED
@@ -2329,6 +2329,7 @@ var ConsumeTypesPlugin = _ConsumeTypesPlugin;
2329
2329
  // packages/dts-plugin/src/plugins/GenerateTypesPlugin.ts
2330
2330
  var import_fs4 = __toESM(require("fs"));
2331
2331
  var import_sdk7 = require("@module-federation/sdk");
2332
+ var import_path9 = __toESM(require("path"));
2332
2333
  var _GenerateTypesPlugin = class _GenerateTypesPlugin {
2333
2334
  constructor(pluginOptions, dtsOptions, defaultOptions3) {
2334
2335
  __publicField(this, "pluginOptions");
@@ -2384,11 +2385,21 @@ var _GenerateTypesPlugin = class _GenerateTypesPlugin {
2384
2385
  return;
2385
2386
  }
2386
2387
  yield generateTypesFn(finalOptions);
2388
+ const config = finalOptions.remote.moduleFederationConfig;
2389
+ let zipPrefix = "";
2390
+ const isManifestObject = typeof config.manifest === "object";
2391
+ if (isManifestObject && config.manifest.filePath) {
2392
+ zipPrefix = config.manifest.filePath;
2393
+ } else if (isManifestObject && config.manifest.fileName) {
2394
+ zipPrefix = import_path9.default.dirname(config.manifest.fileName);
2395
+ } else if (config.filename) {
2396
+ zipPrefix = import_path9.default.dirname(config.filename);
2397
+ }
2387
2398
  if (zipTypesPath) {
2388
- compilation.emitAsset(zipName, new compiler.webpack.sources.RawSource(import_fs4.default.readFileSync(zipTypesPath), false));
2399
+ compilation.emitAsset(import_path9.default.join(zipPrefix, zipName), new compiler.webpack.sources.RawSource(import_fs4.default.readFileSync(zipTypesPath), false));
2389
2400
  }
2390
2401
  if (apiTypesPath) {
2391
- compilation.emitAsset(apiFileName, new compiler.webpack.sources.RawSource(import_fs4.default.readFileSync(apiTypesPath), false));
2402
+ compilation.emitAsset(import_path9.default.join(zipPrefix, apiFileName), new compiler.webpack.sources.RawSource(import_fs4.default.readFileSync(apiTypesPath), false));
2392
2403
  }
2393
2404
  } catch (err) {
2394
2405
  console.error(err);
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/dts-plugin",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
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.2.1",
3
+ "version": "0.2.3",
4
4
  "author": "hanric <hanric.zhang@gmail.com>",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -55,15 +55,15 @@
55
55
  "log4js": "6.9.1",
56
56
  "node-schedule": "2.1.1",
57
57
  "ws": "8.17.1",
58
- "@module-federation/sdk": "0.2.1",
59
- "@module-federation/managers": "0.2.1",
60
- "@module-federation/third-party-dts-extractor": "0.2.1"
58
+ "@module-federation/sdk": "0.2.3",
59
+ "@module-federation/managers": "0.2.3",
60
+ "@module-federation/third-party-dts-extractor": "0.2.3"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/ws": "8.5.10",
64
64
  "@types/koa": "2.11.2",
65
65
  "@types/node-schedule": "2.1.7",
66
- "@module-federation/runtime": "0.2.1"
66
+ "@module-federation/runtime": "0.2.3"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "typescript": "^4.9.0 || ^5.0.0",