vite-plugin-dts 3.6.0 → 3.6.1

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
@@ -603,6 +603,9 @@ ${logPrefix} ${kolorist.yellow(
603
603
  configPath = tsconfigPath ? ensureAbsolute(tsconfigPath, root) : ts__default.findConfigFile(root, ts__default.sys.fileExists);
604
604
  const content = configPath ? languageCore.createParsedCommandLine(ts__default, ts__default.sys, configPath) : void 0;
605
605
  compilerOptions = {
606
+ // (#277) If user don't specify `moduleResolution` in top config file,
607
+ // declaration of Vue files will be inferred to `any` type.
608
+ moduleResolution: ts__default.ModuleResolutionKind.Node10,
606
609
  ...content?.options || {},
607
610
  ...options.compilerOptions || {},
608
611
  ...fixedCompilerOptions,
@@ -640,9 +643,18 @@ ${logPrefix} ${kolorist.yellow(
640
643
  include = computeGlobs(options.include, content?.raw.include, "**/*");
641
644
  exclude = computeGlobs(options.exclude, content?.raw.exclude, "node_modules/**");
642
645
  filter = pluginutils.createFilter(include, exclude);
643
- const rootNames = Object.values(entries).map((entry) => ensureAbsolute(entry, root)).concat(content?.fileNames.filter(filter) || []).map(normalizePath);
644
- host = ts__default.createCompilerHost(compilerOptions, true);
645
- program = vueTsc.createProgram({ host, rootNames, options: compilerOptions });
646
+ const rootNames = [
647
+ ...new Set(
648
+ Object.values(entries).map((entry) => ensureAbsolute(entry, root)).concat(content?.fileNames.filter(filter) || []).map(normalizePath)
649
+ )
650
+ ];
651
+ host = ts__default.createCompilerHost(compilerOptions);
652
+ program = vueTsc.createProgram({
653
+ host,
654
+ rootNames,
655
+ projectReferences: content?.projectReferences,
656
+ options: compilerOptions
657
+ });
646
658
  libName = toCapitalCase(libName || "_default");
647
659
  indexName = indexName || defaultIndex;
648
660
  const maybeEmitted = (sourceFile) => {
@@ -777,6 +789,7 @@ ${logPrefix} Start generate declaration files...`));
777
789
  }
778
790
  bundleDebug("emit output patch");
779
791
  const currentDir = host.getCurrentDirectory();
792
+ const vuePathRE = /['"](.+)\.vue['"]/g;
780
793
  await runParallel(
781
794
  node_os.cpus().length,
782
795
  Array.from(outputFiles.entries()),
@@ -792,7 +805,7 @@ ${logPrefix} Start generate declaration files...`));
792
805
  outDir,
793
806
  node_path.relative(entryRoot, cleanVueFileName ? path.replace(".vue.d.ts", ".d.ts") : path)
794
807
  );
795
- content = cleanVueFileName ? content.replace(/['"](.+)\.vue['"]/g, '"$1"') : content;
808
+ content = cleanVueFileName ? content.replace(vuePathRE, '"$1"') : content;
796
809
  if (isMapFile) {
797
810
  try {
798
811
  const sourceMap = JSON.parse(content);
@@ -823,7 +836,10 @@ ${logPrefix} Start generate declaration files...`));
823
836
  const entryNames = Object.keys(entries);
824
837
  const types = fileTypesPath(pkg.publishConfig, pkg);
825
838
  const multiple = entryNames.length > 1;
826
- let typesPath = types ? resolve(root, types) : resolve(outDir, indexName);
839
+ const cleanPath = (path) => {
840
+ return cleanVueFileName ? path.replace(".vue.d.ts", ".d.ts") : path;
841
+ };
842
+ let typesPath = cleanPath(types ? resolve(root, types) : resolve(outDir, indexName));
827
843
  if (!multiple && !dtsRE.test(typesPath)) {
828
844
  logger.warn(
829
845
  `
@@ -835,12 +851,11 @@ ${logPrefix} ${kolorist.yellow(
835
851
  typesPath = `${typesPath.replace(tjsRE, "")}.d.${extPrefix(typesPath)}ts`;
836
852
  }
837
853
  for (const name of entryNames) {
838
- const path = multiple ? resolve(outDir, `${name.replace(tsRE, "")}.d.ts`) : typesPath;
854
+ const path = multiple ? cleanPath(resolve(outDir, `${name.replace(tsRE, "")}.d.ts`)) : typesPath;
839
855
  if (node_fs.existsSync(path))
840
856
  continue;
841
- const index = resolve(
842
- outDir,
843
- node_path.relative(entryRoot, `${entries[name].replace(tsRE, "")}.d.ts`)
857
+ const index = cleanPath(
858
+ resolve(outDir, node_path.relative(entryRoot, `${entries[name].replace(tsRE, "")}.d.ts`))
844
859
  );
845
860
  let fromPath = normalizePath(node_path.relative(node_path.dirname(path), index));
846
861
  fromPath = fromPath.replace(dtsRE, "");
@@ -855,7 +870,7 @@ export default ${libName}
855
870
  `;
856
871
  }
857
872
  }
858
- await writeOutput(path, content, outDir);
873
+ await writeOutput(cleanPath(path), content, outDir);
859
874
  }
860
875
  bundleDebug("insert index");
861
876
  if (rollupTypes) {
@@ -872,7 +887,7 @@ export default ${libName}
872
887
  const rollupFiles = /* @__PURE__ */ new Set();
873
888
  if (multiple) {
874
889
  for (const name of entryNames) {
875
- const path = resolve(outDir, `${name.replace(tsRE, "")}.d.ts`);
890
+ const path = cleanPath(resolve(outDir, `${name.replace(tsRE, "")}.d.ts`));
876
891
  rollupDeclarationFiles({
877
892
  root,
878
893
  configPath,
@@ -0,0 +1,226 @@
1
+ import * as vite from 'vite';
2
+ import { LogLevel } from 'vite';
3
+ import ts from 'typescript';
4
+ import { IExtractorInvokeOptions, IExtractorConfigPrepareOptions } from '@microsoft/api-extractor';
5
+
6
+ type MaybePromise<T> = T | Promise<T>;
7
+ type RollupConfig = Omit<IExtractorConfigPrepareOptions['configObject'], 'projectFolder' | 'mainEntryPointFilePath' | 'compiler' | 'dtsRollup'>;
8
+ interface Resolver {
9
+ /**
10
+ * The name of the resolver
11
+ *
12
+ * The later resolver with the same name will overwrite the earlier
13
+ */
14
+ name: string;
15
+ /**
16
+ * Determine whether the resolver supports the file
17
+ */
18
+ supports: (id: string) => void | boolean;
19
+ /**
20
+ * Transform source to declaration files
21
+ *
22
+ * Note that the path of the returns should base on `outDir`, or relative path to `root`
23
+ */
24
+ transform: (payload: {
25
+ id: string;
26
+ code: string;
27
+ root: string;
28
+ outDir: string;
29
+ host: ts.CompilerHost;
30
+ program: ts.Program;
31
+ service: ts.LanguageService;
32
+ }) => MaybePromise<{
33
+ path: string;
34
+ content: string;
35
+ }[]>;
36
+ }
37
+ interface PluginOptions {
38
+ /**
39
+ * Specify root directory
40
+ *
41
+ * Defaults to the 'root' of the Vite config, or `process.cwd()` if using Rollup
42
+ */
43
+ root?: string;
44
+ /**
45
+ * Output directory for declaration files
46
+ *
47
+ * Can be an array to output to multiple directories
48
+ *
49
+ * Defaults to 'build.outDir' of the Vite config, or `outDir` of tsconfig.json if using Rollup
50
+ */
51
+ outDir?: string | string[];
52
+ /**
53
+ * Override root path of entry files (useful in monorepos)
54
+ *
55
+ * The output path of each file will be calculated based on the value provided
56
+ *
57
+ * The default is the smallest public path for all source files
58
+ */
59
+ entryRoot?: string;
60
+ /**
61
+ * Restrict declaration files output to `outDir`
62
+ *
63
+ * If true, generated declaration files outside `outDir` will be ignored
64
+ *
65
+ * @default true
66
+ */
67
+ strictOutput?: boolean;
68
+ /**
69
+ * Override compilerOptions
70
+ *
71
+ * @default null
72
+ */
73
+ compilerOptions?: ts.CompilerOptions | null;
74
+ /**
75
+ * Specify tsconfig.json path
76
+ *
77
+ * Plugin resolves `include` and `exclude` globs from tsconfig.json
78
+ *
79
+ * If not specified, plugin will find config file from root
80
+ */
81
+ tsconfigPath?: string;
82
+ /**
83
+ * Specify custom resolvers
84
+ *
85
+ * @default []
86
+ */
87
+ resolvers?: Resolver[];
88
+ /**
89
+ * Parsing `paths` of tsconfig.json to aliases
90
+ *
91
+ * Note that these aliases only use for declaration files
92
+ *
93
+ * @default true
94
+ * @remarks Only use first replacement of each path
95
+ */
96
+ pathsToAliases?: boolean;
97
+ /**
98
+ * Set which paths should be excluded when transforming aliases
99
+ *
100
+ * @default []
101
+ */
102
+ aliasesExclude?: (string | RegExp)[];
103
+ /**
104
+ * Whether to transform file names ending in '.vue.d.ts' to '.d.ts'
105
+ *
106
+ * @default false
107
+ */
108
+ cleanVueFileName?: boolean;
109
+ /**
110
+ * Whether to transform dynamic imports to static (eg `import('vue').DefineComponent` to `import { DefineComponent } from 'vue'`)
111
+ *
112
+ * Value is forced to `true` when `rollupTypes` is `true`
113
+ *
114
+ * @default false
115
+ */
116
+ staticImport?: boolean;
117
+ /**
118
+ * Override `include` glob (relative to root)
119
+ *
120
+ * Defaults to `include` property of tsconfig.json (relative to tsconfig.json located)
121
+ */
122
+ include?: string | string[];
123
+ /**
124
+ * Override `exclude` glob
125
+ *
126
+ * Defaults to `exclude` property of tsconfig.json or `'node_modules/**'` if not supplied.
127
+ */
128
+ exclude?: string | string[];
129
+ /**
130
+ * Whether to remove `import 'xxx'`
131
+ *
132
+ * @default true
133
+ */
134
+ clearPureImport?: boolean;
135
+ /**
136
+ * Whether to generate types entry file(s)
137
+ *
138
+ * When `true`, uses package.json `types` property if it exists or `${outDir}/index.d.ts`
139
+ *
140
+ * Value is forced to `true` when `rollupTypes` is `true`
141
+ *
142
+ * @default false
143
+ */
144
+ insertTypesEntry?: boolean;
145
+ /**
146
+ * Rollup type declaration files after emitting them
147
+ *
148
+ * Powered by `@microsoft/api-extractor` - time-intensive operation
149
+ *
150
+ * @default false
151
+ */
152
+ rollupTypes?: boolean;
153
+ /**
154
+ * Bundled packages for `@microsoft/api-extractor`
155
+ *
156
+ * @default []
157
+ * @see https://api-extractor.com/pages/configs/api-extractor_json/#bundledpackages
158
+ */
159
+ bundledPackages?: string[];
160
+ /**
161
+ * Override the config of `@microsoft/api-extractor`
162
+ *
163
+ * @default null
164
+ * @see https://api-extractor.com/pages/setup/configure_api_report/
165
+ */
166
+ rollupConfig?: RollupConfig;
167
+ /**
168
+ * Override the invoke options of `@microsoft/api-extractor`
169
+ *
170
+ * @default null
171
+ * @see https://api-extractor.com/pages/setup/invoking/#invoking-from-a-build-script
172
+ */
173
+ rollupOptions?: IExtractorInvokeOptions;
174
+ /**
175
+ * Whether to copy .d.ts source files to `outDir`
176
+ *
177
+ * @default false
178
+ * @remarks Before 2.0, the default was `true`
179
+ */
180
+ copyDtsFiles?: boolean;
181
+ /**
182
+ * Whether to emit declaration files only
183
+ *
184
+ * When `true`, all the original outputs of vite (rollup) will be force removed
185
+ *
186
+ * @default false
187
+ */
188
+ declarationOnly?: boolean;
189
+ /**
190
+ * Logging level for this plugin
191
+ *
192
+ * Defaults to the 'logLevel' property of your Vite config
193
+ */
194
+ logLevel?: LogLevel;
195
+ /**
196
+ * Hook called after diagnostic is emitted
197
+ *
198
+ * According to the `diagnostics.length`, you can judge whether there is any type error
199
+ *
200
+ * @default () => {}
201
+ */
202
+ afterDiagnostic?: (diagnostics: readonly ts.Diagnostic[]) => MaybePromise<void>;
203
+ /**
204
+ * Hook called prior to writing each declaration file
205
+ *
206
+ * This allows you to transform the path or content
207
+ *
208
+ * The file will be skipped when the return value `false` or `Promise<false>`
209
+ *
210
+ * @default () => {}
211
+ */
212
+ beforeWriteFile?: (filePath: string, content: string) => MaybePromise<void | false | {
213
+ filePath?: string;
214
+ content?: string;
215
+ }>;
216
+ /**
217
+ * Hook called after all declaration files are written
218
+ *
219
+ * @default () => {}
220
+ */
221
+ afterBuild?: () => MaybePromise<void>;
222
+ }
223
+
224
+ declare function dtsPlugin(options?: PluginOptions): vite.Plugin;
225
+
226
+ export { type PluginOptions, dtsPlugin as default };
@@ -0,0 +1,226 @@
1
+ import * as vite from 'vite';
2
+ import { LogLevel } from 'vite';
3
+ import ts from 'typescript';
4
+ import { IExtractorInvokeOptions, IExtractorConfigPrepareOptions } from '@microsoft/api-extractor';
5
+
6
+ type MaybePromise<T> = T | Promise<T>;
7
+ type RollupConfig = Omit<IExtractorConfigPrepareOptions['configObject'], 'projectFolder' | 'mainEntryPointFilePath' | 'compiler' | 'dtsRollup'>;
8
+ interface Resolver {
9
+ /**
10
+ * The name of the resolver
11
+ *
12
+ * The later resolver with the same name will overwrite the earlier
13
+ */
14
+ name: string;
15
+ /**
16
+ * Determine whether the resolver supports the file
17
+ */
18
+ supports: (id: string) => void | boolean;
19
+ /**
20
+ * Transform source to declaration files
21
+ *
22
+ * Note that the path of the returns should base on `outDir`, or relative path to `root`
23
+ */
24
+ transform: (payload: {
25
+ id: string;
26
+ code: string;
27
+ root: string;
28
+ outDir: string;
29
+ host: ts.CompilerHost;
30
+ program: ts.Program;
31
+ service: ts.LanguageService;
32
+ }) => MaybePromise<{
33
+ path: string;
34
+ content: string;
35
+ }[]>;
36
+ }
37
+ interface PluginOptions {
38
+ /**
39
+ * Specify root directory
40
+ *
41
+ * Defaults to the 'root' of the Vite config, or `process.cwd()` if using Rollup
42
+ */
43
+ root?: string;
44
+ /**
45
+ * Output directory for declaration files
46
+ *
47
+ * Can be an array to output to multiple directories
48
+ *
49
+ * Defaults to 'build.outDir' of the Vite config, or `outDir` of tsconfig.json if using Rollup
50
+ */
51
+ outDir?: string | string[];
52
+ /**
53
+ * Override root path of entry files (useful in monorepos)
54
+ *
55
+ * The output path of each file will be calculated based on the value provided
56
+ *
57
+ * The default is the smallest public path for all source files
58
+ */
59
+ entryRoot?: string;
60
+ /**
61
+ * Restrict declaration files output to `outDir`
62
+ *
63
+ * If true, generated declaration files outside `outDir` will be ignored
64
+ *
65
+ * @default true
66
+ */
67
+ strictOutput?: boolean;
68
+ /**
69
+ * Override compilerOptions
70
+ *
71
+ * @default null
72
+ */
73
+ compilerOptions?: ts.CompilerOptions | null;
74
+ /**
75
+ * Specify tsconfig.json path
76
+ *
77
+ * Plugin resolves `include` and `exclude` globs from tsconfig.json
78
+ *
79
+ * If not specified, plugin will find config file from root
80
+ */
81
+ tsconfigPath?: string;
82
+ /**
83
+ * Specify custom resolvers
84
+ *
85
+ * @default []
86
+ */
87
+ resolvers?: Resolver[];
88
+ /**
89
+ * Parsing `paths` of tsconfig.json to aliases
90
+ *
91
+ * Note that these aliases only use for declaration files
92
+ *
93
+ * @default true
94
+ * @remarks Only use first replacement of each path
95
+ */
96
+ pathsToAliases?: boolean;
97
+ /**
98
+ * Set which paths should be excluded when transforming aliases
99
+ *
100
+ * @default []
101
+ */
102
+ aliasesExclude?: (string | RegExp)[];
103
+ /**
104
+ * Whether to transform file names ending in '.vue.d.ts' to '.d.ts'
105
+ *
106
+ * @default false
107
+ */
108
+ cleanVueFileName?: boolean;
109
+ /**
110
+ * Whether to transform dynamic imports to static (eg `import('vue').DefineComponent` to `import { DefineComponent } from 'vue'`)
111
+ *
112
+ * Value is forced to `true` when `rollupTypes` is `true`
113
+ *
114
+ * @default false
115
+ */
116
+ staticImport?: boolean;
117
+ /**
118
+ * Override `include` glob (relative to root)
119
+ *
120
+ * Defaults to `include` property of tsconfig.json (relative to tsconfig.json located)
121
+ */
122
+ include?: string | string[];
123
+ /**
124
+ * Override `exclude` glob
125
+ *
126
+ * Defaults to `exclude` property of tsconfig.json or `'node_modules/**'` if not supplied.
127
+ */
128
+ exclude?: string | string[];
129
+ /**
130
+ * Whether to remove `import 'xxx'`
131
+ *
132
+ * @default true
133
+ */
134
+ clearPureImport?: boolean;
135
+ /**
136
+ * Whether to generate types entry file(s)
137
+ *
138
+ * When `true`, uses package.json `types` property if it exists or `${outDir}/index.d.ts`
139
+ *
140
+ * Value is forced to `true` when `rollupTypes` is `true`
141
+ *
142
+ * @default false
143
+ */
144
+ insertTypesEntry?: boolean;
145
+ /**
146
+ * Rollup type declaration files after emitting them
147
+ *
148
+ * Powered by `@microsoft/api-extractor` - time-intensive operation
149
+ *
150
+ * @default false
151
+ */
152
+ rollupTypes?: boolean;
153
+ /**
154
+ * Bundled packages for `@microsoft/api-extractor`
155
+ *
156
+ * @default []
157
+ * @see https://api-extractor.com/pages/configs/api-extractor_json/#bundledpackages
158
+ */
159
+ bundledPackages?: string[];
160
+ /**
161
+ * Override the config of `@microsoft/api-extractor`
162
+ *
163
+ * @default null
164
+ * @see https://api-extractor.com/pages/setup/configure_api_report/
165
+ */
166
+ rollupConfig?: RollupConfig;
167
+ /**
168
+ * Override the invoke options of `@microsoft/api-extractor`
169
+ *
170
+ * @default null
171
+ * @see https://api-extractor.com/pages/setup/invoking/#invoking-from-a-build-script
172
+ */
173
+ rollupOptions?: IExtractorInvokeOptions;
174
+ /**
175
+ * Whether to copy .d.ts source files to `outDir`
176
+ *
177
+ * @default false
178
+ * @remarks Before 2.0, the default was `true`
179
+ */
180
+ copyDtsFiles?: boolean;
181
+ /**
182
+ * Whether to emit declaration files only
183
+ *
184
+ * When `true`, all the original outputs of vite (rollup) will be force removed
185
+ *
186
+ * @default false
187
+ */
188
+ declarationOnly?: boolean;
189
+ /**
190
+ * Logging level for this plugin
191
+ *
192
+ * Defaults to the 'logLevel' property of your Vite config
193
+ */
194
+ logLevel?: LogLevel;
195
+ /**
196
+ * Hook called after diagnostic is emitted
197
+ *
198
+ * According to the `diagnostics.length`, you can judge whether there is any type error
199
+ *
200
+ * @default () => {}
201
+ */
202
+ afterDiagnostic?: (diagnostics: readonly ts.Diagnostic[]) => MaybePromise<void>;
203
+ /**
204
+ * Hook called prior to writing each declaration file
205
+ *
206
+ * This allows you to transform the path or content
207
+ *
208
+ * The file will be skipped when the return value `false` or `Promise<false>`
209
+ *
210
+ * @default () => {}
211
+ */
212
+ beforeWriteFile?: (filePath: string, content: string) => MaybePromise<void | false | {
213
+ filePath?: string;
214
+ content?: string;
215
+ }>;
216
+ /**
217
+ * Hook called after all declaration files are written
218
+ *
219
+ * @default () => {}
220
+ */
221
+ afterBuild?: () => MaybePromise<void>;
222
+ }
223
+
224
+ declare function dtsPlugin(options?: PluginOptions): vite.Plugin;
225
+
226
+ export { type PluginOptions, dtsPlugin as default };
package/dist/index.d.ts CHANGED
@@ -223,4 +223,4 @@ interface PluginOptions {
223
223
 
224
224
  declare function dtsPlugin(options?: PluginOptions): vite.Plugin;
225
225
 
226
- export { PluginOptions, dtsPlugin as default };
226
+ export { type PluginOptions, dtsPlugin as default };
package/dist/index.mjs CHANGED
@@ -603,6 +603,9 @@ ${logPrefix} ${yellow(
603
603
  configPath = tsconfigPath ? ensureAbsolute(tsconfigPath, root) : ts.findConfigFile(root, ts.sys.fileExists);
604
604
  const content = configPath ? createParsedCommandLine(ts, ts.sys, configPath) : void 0;
605
605
  compilerOptions = {
606
+ // (#277) If user don't specify `moduleResolution` in top config file,
607
+ // declaration of Vue files will be inferred to `any` type.
608
+ moduleResolution: ts.ModuleResolutionKind.Node10,
606
609
  ...content?.options || {},
607
610
  ...options.compilerOptions || {},
608
611
  ...fixedCompilerOptions,
@@ -640,9 +643,18 @@ ${logPrefix} ${yellow(
640
643
  include = computeGlobs(options.include, content?.raw.include, "**/*");
641
644
  exclude = computeGlobs(options.exclude, content?.raw.exclude, "node_modules/**");
642
645
  filter = createFilter(include, exclude);
643
- const rootNames = Object.values(entries).map((entry) => ensureAbsolute(entry, root)).concat(content?.fileNames.filter(filter) || []).map(normalizePath);
644
- host = ts.createCompilerHost(compilerOptions, true);
645
- program = createProgram({ host, rootNames, options: compilerOptions });
646
+ const rootNames = [
647
+ ...new Set(
648
+ Object.values(entries).map((entry) => ensureAbsolute(entry, root)).concat(content?.fileNames.filter(filter) || []).map(normalizePath)
649
+ )
650
+ ];
651
+ host = ts.createCompilerHost(compilerOptions);
652
+ program = createProgram({
653
+ host,
654
+ rootNames,
655
+ projectReferences: content?.projectReferences,
656
+ options: compilerOptions
657
+ });
646
658
  libName = toCapitalCase(libName || "_default");
647
659
  indexName = indexName || defaultIndex;
648
660
  const maybeEmitted = (sourceFile) => {
@@ -777,6 +789,7 @@ ${logPrefix} Start generate declaration files...`));
777
789
  }
778
790
  bundleDebug("emit output patch");
779
791
  const currentDir = host.getCurrentDirectory();
792
+ const vuePathRE = /['"](.+)\.vue['"]/g;
780
793
  await runParallel(
781
794
  cpus().length,
782
795
  Array.from(outputFiles.entries()),
@@ -792,7 +805,7 @@ ${logPrefix} Start generate declaration files...`));
792
805
  outDir,
793
806
  relative(entryRoot, cleanVueFileName ? path.replace(".vue.d.ts", ".d.ts") : path)
794
807
  );
795
- content = cleanVueFileName ? content.replace(/['"](.+)\.vue['"]/g, '"$1"') : content;
808
+ content = cleanVueFileName ? content.replace(vuePathRE, '"$1"') : content;
796
809
  if (isMapFile) {
797
810
  try {
798
811
  const sourceMap = JSON.parse(content);
@@ -823,7 +836,10 @@ ${logPrefix} Start generate declaration files...`));
823
836
  const entryNames = Object.keys(entries);
824
837
  const types = fileTypesPath(pkg.publishConfig, pkg);
825
838
  const multiple = entryNames.length > 1;
826
- let typesPath = types ? resolve(root, types) : resolve(outDir, indexName);
839
+ const cleanPath = (path) => {
840
+ return cleanVueFileName ? path.replace(".vue.d.ts", ".d.ts") : path;
841
+ };
842
+ let typesPath = cleanPath(types ? resolve(root, types) : resolve(outDir, indexName));
827
843
  if (!multiple && !dtsRE.test(typesPath)) {
828
844
  logger.warn(
829
845
  `
@@ -835,12 +851,11 @@ ${logPrefix} ${yellow(
835
851
  typesPath = `${typesPath.replace(tjsRE, "")}.d.${extPrefix(typesPath)}ts`;
836
852
  }
837
853
  for (const name of entryNames) {
838
- const path = multiple ? resolve(outDir, `${name.replace(tsRE, "")}.d.ts`) : typesPath;
854
+ const path = multiple ? cleanPath(resolve(outDir, `${name.replace(tsRE, "")}.d.ts`)) : typesPath;
839
855
  if (existsSync(path))
840
856
  continue;
841
- const index = resolve(
842
- outDir,
843
- relative(entryRoot, `${entries[name].replace(tsRE, "")}.d.ts`)
857
+ const index = cleanPath(
858
+ resolve(outDir, relative(entryRoot, `${entries[name].replace(tsRE, "")}.d.ts`))
844
859
  );
845
860
  let fromPath = normalizePath(relative(dirname(path), index));
846
861
  fromPath = fromPath.replace(dtsRE, "");
@@ -855,7 +870,7 @@ export default ${libName}
855
870
  `;
856
871
  }
857
872
  }
858
- await writeOutput(path, content, outDir);
873
+ await writeOutput(cleanPath(path), content, outDir);
859
874
  }
860
875
  bundleDebug("insert index");
861
876
  if (rollupTypes) {
@@ -872,7 +887,7 @@ export default ${libName}
872
887
  const rollupFiles = /* @__PURE__ */ new Set();
873
888
  if (multiple) {
874
889
  for (const name of entryNames) {
875
- const path = resolve(outDir, `${name.replace(tsRE, "")}.d.ts`);
890
+ const path = cleanPath(resolve(outDir, `${name.replace(tsRE, "")}.d.ts`));
876
891
  rollupDeclarationFiles({
877
892
  root,
878
893
  configPath,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-dts",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "qmhc",
@@ -50,46 +50,50 @@
50
50
  "vite-plugin",
51
51
  "ts",
52
52
  "dts",
53
- "typescript"
53
+ "typescript",
54
+ "vue",
55
+ "tsc",
56
+ "vue-tsc",
57
+ "volar"
54
58
  ],
55
59
  "dependencies": {
56
- "@microsoft/api-extractor": "^7.36.4",
57
- "@rollup/pluginutils": "^5.0.2",
58
- "@vue/language-core": "^1.8.8",
60
+ "@microsoft/api-extractor": "^7.38.0",
61
+ "@rollup/pluginutils": "^5.0.5",
62
+ "@vue/language-core": "^1.8.20",
59
63
  "debug": "^4.3.4",
60
64
  "kolorist": "^1.8.0",
61
- "vue-tsc": "^1.8.8"
65
+ "vue-tsc": "^1.8.20"
62
66
  },
63
67
  "devDependencies": {
64
- "@commitlint/cli": "^17.7.1",
65
- "@types/debug": "^4.1.8",
66
- "@types/minimist": "^1.2.2",
67
- "@types/node": "^20.4.10",
68
- "@types/prompts": "^2.4.4",
69
- "@types/semver": "^7.5.0",
68
+ "@commitlint/cli": "^18.0.0",
69
+ "@types/debug": "^4.1.10",
70
+ "@types/minimist": "^1.2.4",
71
+ "@types/node": "^20.8.8",
72
+ "@types/prompts": "^2.4.7",
73
+ "@types/semver": "^7.5.4",
70
74
  "@vexip-ui/commitlint-config": "^0.2.0",
71
75
  "@vexip-ui/eslint-config": "^0.8.1",
72
76
  "@vexip-ui/prettier-config": "^0.2.0",
73
77
  "@vue/eslint-config-standard": "^8.0.1",
74
- "@vue/eslint-config-typescript": "^11.0.3",
75
- "conventional-changelog-cli": "^3.0.0",
76
- "eslint": "^8.47.0",
77
- "execa": "^7.2.0",
78
+ "@vue/eslint-config-typescript": "^12.0.0",
79
+ "conventional-changelog-cli": "^4.1.0",
80
+ "eslint": "^8.52.0",
81
+ "execa": "^8.0.1",
78
82
  "husky": "^8.0.3",
79
83
  "is-ci": "^3.0.1",
80
- "lint-staged": "^13.2.3",
84
+ "lint-staged": "^15.0.2",
81
85
  "minimist": "^1.2.8",
82
86
  "pinst": "^3.0.0",
83
- "prettier": "^2.8.8",
87
+ "prettier": "^3.0.3",
84
88
  "pretty-quick": "^3.1.3",
85
89
  "prompts": "^2.4.2",
86
- "rimraf": "^5.0.1",
90
+ "rimraf": "^5.0.5",
87
91
  "semver": "^7.5.4",
88
- "tsx": "^3.12.7",
89
- "typescript": "5.1.6",
90
- "unbuild": "^1.2.1",
91
- "vite": "^4.4.9",
92
- "vitest": "^0.34.1"
92
+ "tsx": "^3.14.0",
93
+ "typescript": "5.2.2",
94
+ "unbuild": "^2.0.0",
95
+ "vite": "^4.5.0",
96
+ "vitest": "^0.34.6"
93
97
  },
94
98
  "peerDependencies": {
95
99
  "typescript": "*",
@@ -102,7 +106,7 @@
102
106
  },
103
107
  "pnpm": {
104
108
  "patchedDependencies": {
105
- "@microsoft/api-extractor@7.36.4": "patches/@microsoft__api-extractor@7.36.4.patch"
109
+ "@microsoft/api-extractor@7.38.0": "patches/@microsoft__api-extractor@7.38.0.patch"
106
110
  }
107
111
  }
108
112
  }