vite-plugin-dts 3.5.2 → 3.5.4

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.cjs CHANGED
@@ -175,6 +175,16 @@ function toCapitalCase(value) {
175
175
  ""
176
176
  );
177
177
  }
178
+ function fileTypesPath(...pkgs) {
179
+ let path;
180
+ for (const pkg of pkgs) {
181
+ if (typeof pkg !== "object")
182
+ continue;
183
+ path = pkg.types || pkg.typings || pkg.exports?.["."]?.types || pkg.exports?.["./"]?.types;
184
+ if (path)
185
+ return path;
186
+ }
187
+ }
178
188
 
179
189
  const dtsRE$1 = /\.d\.tsx?$/;
180
190
  function rollupDeclarationFiles({
@@ -616,11 +626,17 @@ ${logPrefix} ${kolorist.yellow(
616
626
  });
617
627
  }
618
628
  }
619
- include = ensureArray(options.include ?? content?.raw.include ?? "**/*").map(normalizeGlob);
620
- exclude = ensureArray(options.exclude ?? content?.raw.exclude ?? "node_modules/**").map(
621
- normalizeGlob
622
- );
623
- filter = pluginutils.createFilter(include, exclude, { resolve: root });
629
+ const computeGlobs = (rootGlobs, tsGlobs, defaultGlob) => {
630
+ if (rootGlobs?.length) {
631
+ return ensureArray(rootGlobs).map((glob) => normalizeGlob(ensureAbsolute(glob, root)));
632
+ }
633
+ return ensureArray(tsGlobs?.length ? tsGlobs : defaultGlob).map(
634
+ (glob) => normalizeGlob(ensureAbsolute(glob, configPath ? node_path.dirname(configPath) : root))
635
+ );
636
+ };
637
+ include = computeGlobs(options.include, content?.raw.include, "**/*");
638
+ exclude = computeGlobs(options.exclude, content?.raw.exclude, "node_modules/**");
639
+ filter = pluginutils.createFilter(include, exclude);
624
640
  const rootNames = Object.values(entries).map((entry) => ensureAbsolute(entry, root)).concat(content?.fileNames.filter(filter) || []).map(normalizePath);
625
641
  host = ts__default.createCompilerHost(compilerOptions, true);
626
642
  program = vueTsc.createProgram({ host, rootNames, options: compilerOptions });
@@ -802,7 +818,7 @@ ${logPrefix} Start generate declaration files...`));
802
818
  } catch (e) {
803
819
  }
804
820
  const entryNames = Object.keys(entries);
805
- const types = pkg.types || pkg.typings || pkg.publishConfig?.types || pkg.publishConfig?.typings || (pkg.exports?.["."] || pkg.exports?.["./"])?.types;
821
+ const types = fileTypesPath(pkg.publishConfig, pkg);
806
822
  const multiple = entryNames.length > 1;
807
823
  let typesPath = types ? resolve(root, types) : resolve(outDir, indexName);
808
824
  if (!multiple && !dtsRE.test(typesPath)) {
package/dist/index.d.ts CHANGED
@@ -115,15 +115,15 @@ interface PluginOptions {
115
115
  */
116
116
  staticImport?: boolean;
117
117
  /**
118
- * Override `include` glob
118
+ * Override `include` glob (relative to root)
119
119
  *
120
- * Defaults to `include` property of tsconfig.json
120
+ * Defaults to `include` property of tsconfig.json (relative to tsconfig.json located)
121
121
  */
122
122
  include?: string | string[];
123
123
  /**
124
124
  * Override `exclude` glob
125
125
  *
126
- * Defaults to `exclude` property of tsconfig.json or `'node_module/**'` if not supplied.
126
+ * Defaults to `exclude` property of tsconfig.json or `'node_modules/**'` if not supplied.
127
127
  */
128
128
  exclude?: string | string[];
129
129
  /**
package/dist/index.mjs CHANGED
@@ -175,6 +175,16 @@ function toCapitalCase(value) {
175
175
  ""
176
176
  );
177
177
  }
178
+ function fileTypesPath(...pkgs) {
179
+ let path;
180
+ for (const pkg of pkgs) {
181
+ if (typeof pkg !== "object")
182
+ continue;
183
+ path = pkg.types || pkg.typings || pkg.exports?.["."]?.types || pkg.exports?.["./"]?.types;
184
+ if (path)
185
+ return path;
186
+ }
187
+ }
178
188
 
179
189
  const dtsRE$1 = /\.d\.tsx?$/;
180
190
  function rollupDeclarationFiles({
@@ -616,11 +626,17 @@ ${logPrefix} ${yellow(
616
626
  });
617
627
  }
618
628
  }
619
- include = ensureArray(options.include ?? content?.raw.include ?? "**/*").map(normalizeGlob);
620
- exclude = ensureArray(options.exclude ?? content?.raw.exclude ?? "node_modules/**").map(
621
- normalizeGlob
622
- );
623
- filter = createFilter(include, exclude, { resolve: root });
629
+ const computeGlobs = (rootGlobs, tsGlobs, defaultGlob) => {
630
+ if (rootGlobs?.length) {
631
+ return ensureArray(rootGlobs).map((glob) => normalizeGlob(ensureAbsolute(glob, root)));
632
+ }
633
+ return ensureArray(tsGlobs?.length ? tsGlobs : defaultGlob).map(
634
+ (glob) => normalizeGlob(ensureAbsolute(glob, configPath ? dirname(configPath) : root))
635
+ );
636
+ };
637
+ include = computeGlobs(options.include, content?.raw.include, "**/*");
638
+ exclude = computeGlobs(options.exclude, content?.raw.exclude, "node_modules/**");
639
+ filter = createFilter(include, exclude);
624
640
  const rootNames = Object.values(entries).map((entry) => ensureAbsolute(entry, root)).concat(content?.fileNames.filter(filter) || []).map(normalizePath);
625
641
  host = ts.createCompilerHost(compilerOptions, true);
626
642
  program = createProgram({ host, rootNames, options: compilerOptions });
@@ -802,7 +818,7 @@ ${logPrefix} Start generate declaration files...`));
802
818
  } catch (e) {
803
819
  }
804
820
  const entryNames = Object.keys(entries);
805
- const types = pkg.types || pkg.typings || pkg.publishConfig?.types || pkg.publishConfig?.typings || (pkg.exports?.["."] || pkg.exports?.["./"])?.types;
821
+ const types = fileTypesPath(pkg.publishConfig, pkg);
806
822
  const multiple = entryNames.length > 1;
807
823
  let typesPath = types ? resolve(root, types) : resolve(outDir, indexName);
808
824
  if (!multiple && !dtsRE.test(typesPath)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-dts",
3
- "version": "3.5.2",
3
+ "version": "3.5.4",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "qmhc",
@@ -53,7 +53,7 @@
53
53
  "typescript"
54
54
  ],
55
55
  "dependencies": {
56
- "@microsoft/api-extractor": "^7.36.3",
56
+ "@microsoft/api-extractor": "^7.36.4",
57
57
  "@rollup/pluginutils": "^5.0.2",
58
58
  "@vue/language-core": "^1.8.8",
59
59
  "debug": "^4.3.4",
@@ -61,10 +61,10 @@
61
61
  "vue-tsc": "^1.8.8"
62
62
  },
63
63
  "devDependencies": {
64
- "@commitlint/cli": "^17.6.7",
64
+ "@commitlint/cli": "^17.7.1",
65
65
  "@types/debug": "^4.1.8",
66
66
  "@types/minimist": "^1.2.2",
67
- "@types/node": "^20.4.5",
67
+ "@types/node": "^20.4.10",
68
68
  "@types/prompts": "^2.4.4",
69
69
  "@types/semver": "^7.5.0",
70
70
  "@vexip-ui/commitlint-config": "^0.2.0",
@@ -73,7 +73,7 @@
73
73
  "@vue/eslint-config-standard": "^8.0.1",
74
74
  "@vue/eslint-config-typescript": "^11.0.3",
75
75
  "conventional-changelog-cli": "^3.0.0",
76
- "eslint": "^8.46.0",
76
+ "eslint": "^8.47.0",
77
77
  "execa": "^7.2.0",
78
78
  "husky": "^8.0.3",
79
79
  "is-ci": "^3.0.1",
@@ -86,10 +86,10 @@
86
86
  "rimraf": "^5.0.1",
87
87
  "semver": "^7.5.4",
88
88
  "tsx": "^3.12.7",
89
- "typescript": "5.0.4",
89
+ "typescript": "5.1.6",
90
90
  "unbuild": "^1.2.1",
91
- "vite": "^4.4.7",
92
- "vitest": "^0.33.0"
91
+ "vite": "^4.4.9",
92
+ "vitest": "^0.34.1"
93
93
  },
94
94
  "peerDependencies": {
95
95
  "typescript": "*",
@@ -99,5 +99,10 @@
99
99
  "vite": {
100
100
  "optional": true
101
101
  }
102
+ },
103
+ "pnpm": {
104
+ "patchedDependencies": {
105
+ "@microsoft/api-extractor@7.36.4": "patches/@microsoft__api-extractor@7.36.4.patch"
106
+ }
102
107
  }
103
108
  }