@module-federation/third-party-dts-extractor 0.11.3 → 0.12.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,13 @@
1
1
  # @module-federation/third-party-dts-extractor
2
2
 
3
+ ## 0.12.0
4
+
5
+ ### Patch Changes
6
+
7
+ - ef96c4d: feat(dts-plugin): support exclude extract specify third party dts
8
+
9
+ ## 0.11.4
10
+
3
11
  ## 0.11.3
4
12
 
5
13
  ## 0.11.2
package/dist/index.d.mts CHANGED
@@ -1,9 +1,15 @@
1
+ type ThirdPartyExtractorOptions = {
2
+ destDir: string;
3
+ context?: string;
4
+ exclude?: Array<string | RegExp>;
5
+ };
1
6
  declare class ThirdPartyExtractor {
2
7
  pkgs: Record<string, string>;
3
8
  pattern: RegExp;
4
9
  context: string;
5
10
  destDir: string;
6
- constructor(destDir: string, context?: string);
11
+ exclude: Array<string | RegExp>;
12
+ constructor({ destDir, context, exclude, }: ThirdPartyExtractorOptions);
7
13
  addPkgs(pkgName: string, dirName: string): void;
8
14
  inferPkgDir(importPath: string): string | void;
9
15
  collectTypeImports(str: string): string[];
package/dist/index.d.ts CHANGED
@@ -1,9 +1,15 @@
1
+ type ThirdPartyExtractorOptions = {
2
+ destDir: string;
3
+ context?: string;
4
+ exclude?: Array<string | RegExp>;
5
+ };
1
6
  declare class ThirdPartyExtractor {
2
7
  pkgs: Record<string, string>;
3
8
  pattern: RegExp;
4
9
  context: string;
5
10
  destDir: string;
6
- constructor(destDir: string, context?: string);
11
+ exclude: Array<string | RegExp>;
12
+ constructor({ destDir, context, exclude, }: ThirdPartyExtractorOptions);
7
13
  addPkgs(pkgName: string, dirName: string): void;
8
14
  inferPkgDir(importPath: string): string | void;
9
15
  collectTypeImports(str: string): string[];
package/dist/index.js CHANGED
@@ -23,16 +23,30 @@ var isNodeUtils = (pkgJsonPath, importPath) => {
23
23
  return pkgJsonPath === importPath;
24
24
  };
25
25
  var ThirdPartyExtractor = class {
26
- constructor(destDir, context = process.cwd()) {
26
+ constructor({
27
+ destDir,
28
+ context = process.cwd(),
29
+ exclude = []
30
+ }) {
27
31
  this.destDir = destDir;
28
32
  this.context = context;
29
33
  this.pkgs = {};
30
34
  this.pattern = /(from|import\()\s*['"]([^'"]+)['"]/g;
35
+ this.exclude = exclude;
31
36
  }
32
37
  addPkgs(pkgName, dirName) {
33
38
  if (ignoredPkgs.includes(pkgName)) {
34
39
  return;
35
40
  }
41
+ if (this.exclude.some((pattern) => {
42
+ if (typeof pattern === "string") {
43
+ return new RegExp(pattern).test(pkgName);
44
+ } else {
45
+ return pattern.test(pkgName);
46
+ }
47
+ })) {
48
+ return;
49
+ }
36
50
  this.pkgs[pkgName] = dirName;
37
51
  }
38
52
  inferPkgDir(importPath) {
package/dist/index.mjs CHANGED
@@ -23,16 +23,30 @@ var isNodeUtils = (pkgJsonPath, importPath) => {
23
23
  return pkgJsonPath === importPath;
24
24
  };
25
25
  var ThirdPartyExtractor = class {
26
- constructor(destDir, context = process.cwd()) {
26
+ constructor({
27
+ destDir,
28
+ context = process.cwd(),
29
+ exclude = []
30
+ }) {
27
31
  this.destDir = destDir;
28
32
  this.context = context;
29
33
  this.pkgs = {};
30
34
  this.pattern = /(from|import\()\s*['"]([^'"]+)['"]/g;
35
+ this.exclude = exclude;
31
36
  }
32
37
  addPkgs(pkgName, dirName) {
33
38
  if (ignoredPkgs.includes(pkgName)) {
34
39
  return;
35
40
  }
41
+ if (this.exclude.some((pattern) => {
42
+ if (typeof pattern === "string") {
43
+ return new RegExp(pattern).test(pkgName);
44
+ } else {
45
+ return pattern.test(pkgName);
46
+ }
47
+ })) {
48
+ return;
49
+ }
36
50
  this.pkgs[pkgName] = dirName;
37
51
  }
38
52
  inferPkgDir(importPath) {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/third-party-dts-extractor",
3
- "version": "0.11.3",
3
+ "version": "0.12.0",
4
4
  "files": [
5
5
  "dist/",
6
6
  "README.md"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/third-party-dts-extractor",
3
- "version": "0.11.3",
3
+ "version": "0.12.0",
4
4
  "files": [
5
5
  "dist/",
6
6
  "README.md"