vite-plugin-dts 3.1.0 → 3.1.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/README.md CHANGED
@@ -8,6 +8,9 @@
8
8
  <a href="https://www.npmjs.com/package/vite-plugin-dts">
9
9
  <img src="https://img.shields.io/npm/v/vite-plugin-dts?color=orange&label=" alt="version" />
10
10
  </a>
11
+ <a href="https://github.com/qmhc/vite-plugin-dts/blob/main/LICENSE">
12
+ <img src="https://img.shields.io/npm/l/vite-plugin-dts" alt="license" />
13
+ </a>
11
14
  </p>
12
15
 
13
16
  **English** | [中文](./README.zh-CN.md)
@@ -40,34 +43,7 @@ export default defineConfig({
40
43
  })
41
44
  ```
42
45
 
43
- In your component:
44
-
45
- ```vue
46
- <template>
47
- <div></div>
48
- </template>
49
-
50
- <script lang="ts">
51
- // using defineComponent for inferring types
52
- import { defineComponent } from 'vue'
53
-
54
- export default defineComponent({
55
- name: 'Component'
56
- })
57
- </script>
58
- ```
59
-
60
- ```vue
61
- <script setup lang="ts">
62
- defineProps<{
63
- color: 'blue' | 'red'
64
- }>()
65
- </script>
66
-
67
- <template>
68
- <div>{{ color }}</div>
69
- </template>
70
- ```
46
+ Starting with `3.0.0`, you can use this plugin with Rollup.
71
47
 
72
48
  ## FAQ
73
49
 
@@ -75,19 +51,19 @@ Here are some FAQ's and solutions.
75
51
 
76
52
  ### Missing some declaration files after build (before `1.7.0`)
77
53
 
78
- By default, the `skipDiagnostics` option is set to `true` which means type diagnostic will be skipped during the build process (some projects may have diagnostic tools such as `vue-tsc`). If there are some files with type errors which interrupt the build process, these files will not be emitted (declaration files won't be generated).
54
+ By default, the `skipDiagnostics` option is set to `true` which means type diagnostics will be skipped during the build process (some projects may have diagnostic tools such as `vue-tsc`). Files with type errors which interrupt the build process will not be emitted (declaration files won't be generated).
79
55
 
80
- If your project doesn't use type diagnostic tools, you can set `skipDiagnostics: false` and `logDiagnostics: true` to turn on diagnostic and logging features of this plugin. It will help you check the type errors during build and log error information to the terminal.
56
+ If your project doesn't use type diagnostic tools, you can set `skipDiagnostics: false` and `logDiagnostics: true` to turn on diagnostic and logging features of this plugin. Type errors during build will be logged to the terminal.
81
57
 
82
58
  ### Type error when using both `script` and `setup-script` in Vue component (before `3.0.0`)
83
59
 
84
- This is usually caused by using the `defineComponent` function in both `script` and `setup-script`. When `vue/compiler-sfc` compiles these files, the default export result from `script` gets merged with the parameter object of `defineComponent` from `setup-script`. This is incompatible with parameters and types returned from `defineComponent`, which results in a type error.
60
+ This is usually caused by using the `defineComponent` function in both `script` and `setup-script`. When `vue/compiler-sfc` compiles these files, the default export result from `script` gets merged with the parameter object of `defineComponent` from `setup-script`. This is incompatible with parameters and types returned from `defineComponent`. This results in a type error.
85
61
 
86
- Here is a simple [example](https://github.com/qmhc/vite-plugin-dts/blob/main/examples/vue/components/BothScripts.vue). You should remove the `defineComponent` which in `script` and export a native object directly.
62
+ Here is a simple [example](https://github.com/qmhc/vite-plugin-dts/blob/main/examples/vue/components/BothScripts.vue). You should remove the `defineComponent` in `script` and export a native object directly.
87
63
 
88
64
  ### Type errors that are unable to infer types from packages in `node_modules`
89
65
 
90
- This is an existing issue when TypeScript infers types from packages located in `node_modules` through soft links (pnpm). Please refer to [this TypeScript issue](https://github.com/microsoft/TypeScript/issues/42873). The current workaround is to add `baseUrl` to your `tsconfig.json` and specify the `paths` for these packages:
66
+ This is an existing [TypeScript issue](https://github.com/microsoft/TypeScript/issues/42873) where TypeScript infers types from packages located in `node_modules` through soft links (pnpm). A workaround is to add `baseUrl` to your `tsconfig.json` and specify the `paths` for these packages:
91
67
 
92
68
  ```json
93
69
  {
@@ -116,11 +92,11 @@ export interface Resolver {
116
92
  */
117
93
  name: string,
118
94
  /**
119
- * Determine whether the resolve supports the file
95
+ * Determine whether the resolver supports the file
120
96
  */
121
97
  supports: (id: string) => void | boolean,
122
98
  /**
123
- * Transform the source file to declaration files
99
+ * Transform source to declaration files
124
100
  */
125
101
  transform: (payload: {
126
102
  id: string,
@@ -136,39 +112,39 @@ export interface PluginOptions {
136
112
  /**
137
113
  * Specify root directory
138
114
  *
139
- * By Default it base on 'root' of your Vite config, or `process.cwd()` if using Rollup
115
+ * Defaults to the 'root' of the Vite config, or `process.cwd()` if using Rollup
140
116
  */
141
117
  root?: string,
142
118
 
143
119
  /**
144
- * Specify declaration files output directory
120
+ * Output directory for declaration files
145
121
  *
146
- * Can be specified a array to output to multiple directories
122
+ * Can be an array to output to multiple directories
147
123
  *
148
- * By Default it base on 'build.outDir' of your Vite config, or `outDir` of tsconfig.json if using Rollup
124
+ * Defaults to 'build.outDir' of the Vite config, or `outDir` of tsconfig.json if using Rollup
149
125
  */
150
126
  outDir?: string | string[],
151
127
 
152
128
  /**
153
- * Manually set the root path of the entry files, useful in monorepo
129
+ * Override root path of entry files (useful in monorepos)
154
130
  *
155
- * The output path of each file will be calculated base on it
131
+ * The output path of each file will be calculated based on the value provided
156
132
  *
157
- * By Default it is the smallest public path for all files
133
+ * The default is the smallest public path for all source files
158
134
  */
159
135
  entryRoot?: string,
160
136
 
161
137
  /**
162
- * Strictly restrict declaration files output inside `outDir`
138
+ * Restrict declaration files output to `outDir`
163
139
  *
164
- * Because if `entryRoot` is specified, declaration files maybe outside `outDir`
140
+ * If true, generated declaration files outside `outDir` will be ignored
165
141
  *
166
142
  * @default true
167
143
  */
168
144
  strictOutput?: boolean,
169
145
 
170
146
  /**
171
- * Specify a CompilerOptions to override
147
+ * Override compilerOptions
172
148
  *
173
149
  * @default null
174
150
  */
@@ -177,9 +153,9 @@ export interface PluginOptions {
177
153
  /**
178
154
  * Specify tsconfig.json path
179
155
  *
180
- * Plugin also resolve include and exclude files from tsconfig.json
156
+ * Plugin resolves `include` and `exclude` globs from tsconfig.json
181
157
  *
182
- * By default plugin will find config form root if not specify
158
+ * If not specified, plugin will find config file from root
183
159
  */
184
160
  tsconfigPath?: string,
185
161
 
@@ -191,68 +167,64 @@ export interface PluginOptions {
191
167
  resolvers?: Resolver[],
192
168
 
193
169
  /**
194
- * Set which paths should exclude when transform aliases
195
- *
196
- * If it's regexp, it will test the original import path directly
170
+ * Set which paths should be excluded when transforming aliases
197
171
  *
198
172
  * @default []
199
173
  */
200
174
  aliasesExclude?: (string | RegExp)[],
201
175
 
202
176
  /**
203
- * Whether transform file name '.vue.d.ts' to '.d.ts'
177
+ * Whether to transform file names ending in '.vue.d.ts' to '.d.ts'
204
178
  *
205
179
  * @default false
206
180
  */
207
181
  cleanVueFileName?: boolean,
208
182
 
209
183
  /**
210
- * Whether transform dynamic import to static
211
- *
212
- * Force `true` when `rollupTypes` is effective
184
+ * Whether to transform dynamic imports to static (eg `import('vue').DefineComponent` to `import { DefineComponent } from 'vue'`)
213
185
  *
214
- * eg. `import('vue').DefineComponent` to `import { DefineComponent } from 'vue'`
186
+ * Value is forced to `true` when `rollupTypes` is `true`
215
187
  *
216
188
  * @default false
217
189
  */
218
190
  staticImport?: boolean,
219
191
 
220
192
  /**
221
- * Manual set include glob
193
+ * Override `include` glob
222
194
  *
223
- * By Default it base on `include` option of the tsconfig.json
195
+ * Defaults to `include` property of tsconfig.json
224
196
  */
225
197
  include?: string | string[],
226
198
 
227
199
  /**
228
- * Manual set exclude glob
200
+ * Override `exclude` glob
229
201
  *
230
- * By Default it base on `exclude` option of the tsconfig.json, be `'node_module/**'` when empty
202
+ * Defaults to `exclude` property of tsconfig.json or `'node_module/**'` if not supplied.
231
203
  */
232
204
  exclude?: string | string[],
233
205
 
234
206
  /**
235
- * Whether remove those `import 'xxx'`
207
+ * Whether to remove `import 'xxx'`
236
208
  *
237
209
  * @default true
238
210
  */
239
211
  clearPureImport?: boolean,
240
212
 
241
213
  /**
242
- * Whether generate types entry file
214
+ * Whether to generate types entry file(s)
243
215
  *
244
- * When `true` will from package.json types field if exists or `${outDir}/index.d.ts`
216
+ * When `true`, uses package.json `types` property if it exists or `${outDir}/index.d.ts`
245
217
  *
246
- * Force `true` when `rollupTypes` is effective
218
+ * Value is forced to `true` when `rollupTypes` is `true`
247
219
  *
248
220
  * @default false
249
221
  */
250
222
  insertTypesEntry?: boolean,
251
223
 
252
224
  /**
253
- * Set whether rollup declaration files after emit
225
+ * Rollup type declaration files after emitting them
254
226
  *
255
- * Power by `@microsoft/api-extractor`, it will start a new program which takes some time
227
+ * Powered by `@microsoft/api-extractor` - time-intensive operation
256
228
  *
257
229
  * @default false
258
230
  */
@@ -267,35 +239,35 @@ export interface PluginOptions {
267
239
  bundledPackages?: string[],
268
240
 
269
241
  /**
270
- * Whether copy .d.ts source files into `outDir`
242
+ * Whether to copy .d.ts source files to `outDir`
271
243
  *
272
244
  * @default false
273
- * @remarks Before 2.0 it defaults to true
245
+ * @remarks Before 2.0, the default was `true`
274
246
  */
275
247
  copyDtsFiles?: boolean,
276
248
 
277
249
  /**
278
- * Specify the log level of plugin
250
+ * Logging level for this plugin
279
251
  *
280
- * By Default it base on 'logLevel' option of your Vite config
252
+ * Defaults to the 'logLevel' property of your Vite config
281
253
  */
282
254
  logLevel?: LogLevel,
283
255
 
284
256
  /**
285
- * Hook after diagnostic emitted
257
+ * Hook called after diagnostic is emitted
286
258
  *
287
- * According to the length to judge whether there is any type error
259
+ * According to the `diagnostics.length`, you can judge whether there is any type error
288
260
  *
289
261
  * @default () => {}
290
262
  */
291
263
  afterDiagnostic?: (diagnostics: readonly ts.Diagnostic[]) => MaybePromise<void>,
292
264
 
293
265
  /**
294
- * Hook before each declaration file is written
266
+ * Hook called prior to writing each declaration file
295
267
  *
296
- * You can transform declaration file's path and content through it
268
+ * This allows you to transform the path or content
297
269
  *
298
- * The file will be skipped when return exact `false`
270
+ * The file will be skipped when the return value `false`
299
271
  *
300
272
  * @default () => {}
301
273
  */
@@ -311,9 +283,7 @@ export interface PluginOptions {
311
283
  },
312
284
 
313
285
  /**
314
- * Hook after built
315
- *
316
- * It wil be called after all declaration files are written
286
+ * Hook called after all declaration files are written
317
287
  *
318
288
  * @default () => {}
319
289
  */
package/README.zh-CN.md CHANGED
@@ -8,6 +8,9 @@
8
8
  <a href="https://www.npmjs.com/package/vite-plugin-dts">
9
9
  <img src="https://img.shields.io/npm/v/vite-plugin-dts?color=orange&label=" alt="version" />
10
10
  </a>
11
+ <a href="https://github.com/qmhc/vite-plugin-dts/blob/main/LICENSE">
12
+ <img src="https://img.shields.io/npm/l/vite-plugin-dts" alt="license" />
13
+ </a>
11
14
  </p>
12
15
 
13
16
  **中文** | [English](./README.md)
@@ -40,34 +43,7 @@ export default defineConfig({
40
43
  })
41
44
  ```
42
45
 
43
- 在你的组件中:
44
-
45
- ```vue
46
- <template>
47
- <div></div>
48
- </template>
49
-
50
- <script lang="ts">
51
- // 使用 defineComponent 来进行类型推断
52
- import { defineComponent } from 'vue'
53
-
54
- export default defineComponent({
55
- name: 'Component'
56
- })
57
- </script>
58
- ```
59
-
60
- ```vue
61
- <script setup lang="ts">
62
- defineProps<{
63
- color: 'blue' | 'red'
64
- }>()
65
- </script>
66
-
67
- <template>
68
- <div>{{ color }}</div>
69
- </template>
70
- ```
46
+ 从 `3.0.0` 开始,你可以在 Rollup 中使用该插件。
71
47
 
72
48
  ## 常见问题
73
49
 
@@ -116,7 +92,7 @@ export interface Resolver {
116
92
  */
117
93
  name: string,
118
94
  /**
119
- * 决定是否要解析文件
95
+ * 判断解析器是否支持该文件
120
96
  */
121
97
  supports: (id: string) => void | boolean,
122
98
  /**
@@ -136,7 +112,7 @@ export interface PluginOptions {
136
112
  /**
137
113
  * 指定根目录
138
114
  *
139
- * 默认基于 Vite 配置的 'root',使用 Rollup 时基于 `process.cwd()`
115
+ * 默认为 Vite 配置的 'root',使用 Rollup `process.cwd()`
140
116
  */
141
117
  root?: string,
142
118
 
@@ -145,30 +121,30 @@ export interface PluginOptions {
145
121
  *
146
122
  * 可以指定一个数组来输出到多个目录中
147
123
  *
148
- * 默认基于 Vite 配置的 'build.outDir',使用 Rollup 时基于 tsconfig.json 的 `outDir`
124
+ * 默认为 Vite 配置的 'build.outDir',使用 Rollup 时为 tsconfig.json 的 `outDir`
149
125
  */
150
126
  outDir?: string | string[],
151
127
 
152
128
  /**
153
- * 用于手动设置入口文件的根路径,通常用在 monorepo
129
+ * 用于手动设置入口文件的根路径(通常用在 monorepo
154
130
  *
155
131
  * 在计算每个文件的输出路径时将基于该路径
156
132
  *
157
- * 默认为所有文件的最小公共路径
133
+ * 默认为所有源文件的最小公共路径
158
134
  */
159
135
  entryRoot?: string,
160
136
 
161
137
  /**
162
- * 严格限制类型文件生产在 `outDir` 内
138
+ * 限制类型文件生成在 `outDir` 内
163
139
  *
164
- * 由于当指定了 `entryRoot` 时,类型文件有可能位于 `outDir` 之外
140
+ * 如果为 `true`,生成在 `outDir` 外的文件将被忽略
165
141
  *
166
142
  * @default true
167
143
  */
168
144
  strictOutput?: boolean,
169
145
 
170
146
  /**
171
- * 指定一个用于覆写的 CompilerOptions
147
+ * 覆写 CompilerOptions
172
148
  *
173
149
  * @default null
174
150
  */
@@ -177,9 +153,9 @@ export interface PluginOptions {
177
153
  /**
178
154
  * 指定 tsconfig.json 的路径
179
155
  *
180
- * 插件也会解析 tsconfig.json 的 include 和 exclude 选项
156
+ * 插件会解析 tsconfig.json 的 include 和 exclude 选项
181
157
  *
182
- * 未指定时插件默认从根目录寻找配置
158
+ * 未指定时插件默认从根目录开始寻找配置文件
183
159
  */
184
160
  tsconfigPath?: string,
185
161
 
@@ -205,12 +181,10 @@ export interface PluginOptions {
205
181
  cleanVueFileName?: boolean,
206
182
 
207
183
  /**
208
- * 是否将动态引入转换为静态
184
+ * 是否将动态引入转换为静态(例如:`import('vue').DefineComponent` 转换为 `import { DefineComponent } from 'vue'`)
209
185
  *
210
186
  * 开启 `rollupTypes` 时强制为 `true`
211
187
  *
212
- * 例如将 `import('vue').DefineComponent` 转换为 `import { DefineComponent } from 'vue'`
213
- *
214
188
  * @default false
215
189
  */
216
190
  staticImport?: boolean,
@@ -230,18 +204,18 @@ export interface PluginOptions {
230
204
  exclude?: string | string[],
231
205
 
232
206
  /**
233
- * 是否移除那些 `import 'xxx'`
207
+ * 是否移除 `import 'xxx'`
234
208
  *
235
209
  * @default true
236
210
  */
237
211
  clearPureImport?: boolean,
238
212
 
239
213
  /**
240
- * 是否生成类型声明入口
214
+ * 是否生成类型入口文件
241
215
  *
242
- * 当为 `true` 时会基于 package.json 的 types 字段生成,或者 `${outDir}/index.d.ts`
216
+ * 当为 `true` 时会基于 package.json 的 `types` 字段生成,或者 `${outDir}/index.d.ts`
243
217
  *
244
- * 当开启打包类型文件时强制为 `true`
218
+ * 当开启 `rollupTypes` 时强制为 `true`
245
219
  *
246
220
  * @default false
247
221
  */
@@ -250,7 +224,7 @@ export interface PluginOptions {
250
224
  /**
251
225
  * 设置是否在发出类型文件后将其打包
252
226
  *
253
- * 基于 `@microsoft/api-extractor`,由于这开启了一个新的进程,将会消耗一些时间
227
+ * 基于 `@microsoft/api-extractor`,过程将会消耗一些时间
254
228
  *
255
229
  * @default false
256
230
  */
@@ -268,7 +242,7 @@ export interface PluginOptions {
268
242
  * 是否将源码里的 .d.ts 文件复制到 `outDir`
269
243
  *
270
244
  * @default false
271
- * @remarks 在 2.0 之前它默认为 true
245
+ * @remarks 在 2.0 之前它默认为 `true`
272
246
  */
273
247
  copyDtsFiles?: boolean,
274
248
 
@@ -282,7 +256,7 @@ export interface PluginOptions {
282
256
  /**
283
257
  * 获取诊断信息后的钩子
284
258
  *
285
- * 可以根据参数 length 来判断有误类型错误
259
+ * 可以根据 `diagnostics.length` 来判断有误类型错误
286
260
  *
287
261
  * @default () => {}
288
262
  */
@@ -309,9 +283,7 @@ export interface PluginOptions {
309
283
  },
310
284
 
311
285
  /**
312
- * 构建后回调钩子
313
- *
314
- * 将会在所有类型文件被写入后调用
286
+ * 在所有类型文件被写入后调用的钩子
315
287
  *
316
288
  * @default () => {}
317
289
  */
package/dist/index.cjs CHANGED
@@ -497,6 +497,7 @@ ${kolorist.cyan(
497
497
  entries = { ...input };
498
498
  }
499
499
  logger = logger || console;
500
+ aliases = aliases || [];
500
501
  libName = "_default";
501
502
  indexName = defaultIndex;
502
503
  bundleDebug("parse options");
package/dist/index.d.ts CHANGED
@@ -11,11 +11,11 @@ interface Resolver {
11
11
  */
12
12
  name: string;
13
13
  /**
14
- * Determine whether the resolve supports the file
14
+ * Determine whether the resolver supports the file
15
15
  */
16
16
  supports: (id: string) => void | boolean;
17
17
  /**
18
- * Transform the source file to declaration files
18
+ * Transform source to declaration files
19
19
  */
20
20
  transform: (payload: {
21
21
  id: string;
@@ -33,35 +33,35 @@ interface PluginOptions {
33
33
  /**
34
34
  * Specify root directory
35
35
  *
36
- * By Default it base on 'root' of your Vite config, or `process.cwd()` if using Rollup
36
+ * Defaults to the 'root' of the Vite config, or `process.cwd()` if using Rollup
37
37
  */
38
38
  root?: string;
39
39
  /**
40
- * Specify declaration files output directory
40
+ * Output directory for declaration files
41
41
  *
42
- * Can be specified a array to output to multiple directories
42
+ * Can be an array to output to multiple directories
43
43
  *
44
- * By Default it base on 'build.outDir' of your Vite config, or `outDir` of tsconfig.json if using Rollup
44
+ * Defaults to 'build.outDir' of the Vite config, or `outDir` of tsconfig.json if using Rollup
45
45
  */
46
46
  outDir?: string | string[];
47
47
  /**
48
- * Manually set the root path of the entry files, useful in monorepo
48
+ * Override root path of entry files (useful in monorepos)
49
49
  *
50
- * The output path of each file will be calculated base on it
50
+ * The output path of each file will be calculated based on the value provided
51
51
  *
52
- * By Default it is the smallest public path for all files
52
+ * The default is the smallest public path for all source files
53
53
  */
54
54
  entryRoot?: string;
55
55
  /**
56
- * Strictly restrict declaration files output inside `outDir`
56
+ * Restrict declaration files output to `outDir`
57
57
  *
58
- * Because if `entryRoot` is specified, declaration files maybe outside `outDir`
58
+ * If true, generated declaration files outside `outDir` will be ignored
59
59
  *
60
60
  * @default true
61
61
  */
62
62
  strictOutput?: boolean;
63
63
  /**
64
- * Specify a CompilerOptions to override
64
+ * Override compilerOptions
65
65
  *
66
66
  * @default null
67
67
  */
@@ -69,9 +69,9 @@ interface PluginOptions {
69
69
  /**
70
70
  * Specify tsconfig.json path
71
71
  *
72
- * Plugin also resolve include and exclude files from tsconfig.json
72
+ * Plugin resolves `include` and `exclude` globs from tsconfig.json
73
73
  *
74
- * By default plugin will find config form root if not specify
74
+ * If not specified, plugin will find config file from root
75
75
  */
76
76
  tsconfigPath?: string;
77
77
  /**
@@ -81,61 +81,57 @@ interface PluginOptions {
81
81
  */
82
82
  resolvers?: Resolver[];
83
83
  /**
84
- * Set which paths should exclude when transform aliases
85
- *
86
- * If it's regexp, it will test the original import path directly
84
+ * Set which paths should be excluded when transforming aliases
87
85
  *
88
86
  * @default []
89
87
  */
90
88
  aliasesExclude?: (string | RegExp)[];
91
89
  /**
92
- * Whether transform file name '.vue.d.ts' to '.d.ts'
90
+ * Whether to transform file names ending in '.vue.d.ts' to '.d.ts'
93
91
  *
94
92
  * @default false
95
93
  */
96
94
  cleanVueFileName?: boolean;
97
95
  /**
98
- * Whether transform dynamic import to static
99
- *
100
- * Force `true` when `rollupTypes` is effective
96
+ * Whether to transform dynamic imports to static (eg `import('vue').DefineComponent` to `import { DefineComponent } from 'vue'`)
101
97
  *
102
- * eg. `import('vue').DefineComponent` to `import { DefineComponent } from 'vue'`
98
+ * Value is forced to `true` when `rollupTypes` is `true`
103
99
  *
104
100
  * @default false
105
101
  */
106
102
  staticImport?: boolean;
107
103
  /**
108
- * Manual set include glob
104
+ * Override `include` glob
109
105
  *
110
- * By Default it base on `include` option of the tsconfig.json
106
+ * Defaults to `include` property of tsconfig.json
111
107
  */
112
108
  include?: string | string[];
113
109
  /**
114
- * Manual set exclude glob
110
+ * Override `exclude` glob
115
111
  *
116
- * By Default it base on `exclude` option of the tsconfig.json, be `'node_module/**'` when empty
112
+ * Defaults to `exclude` property of tsconfig.json or `'node_module/**'` if not supplied.
117
113
  */
118
114
  exclude?: string | string[];
119
115
  /**
120
- * Whether remove those `import 'xxx'`
116
+ * Whether to remove `import 'xxx'`
121
117
  *
122
118
  * @default true
123
119
  */
124
120
  clearPureImport?: boolean;
125
121
  /**
126
- * Whether generate types entry file
122
+ * Whether to generate types entry file(s)
127
123
  *
128
- * When `true` will from package.json types field if exists or `` `${outDir}/index.d.ts` ``
124
+ * When `true`, uses package.json `types` property if it exists or `${outDir}/index.d.ts`
129
125
  *
130
- * Force `true` when `rollupTypes` is effective
126
+ * Value is forced to `true` when `rollupTypes` is `true`
131
127
  *
132
128
  * @default false
133
129
  */
134
130
  insertTypesEntry?: boolean;
135
131
  /**
136
- * Set whether rollup declaration files after emit
132
+ * Rollup type declaration files after emitting them
137
133
  *
138
- * Power by `@microsoft/api-extractor`, it will start a new program which takes some time
134
+ * Powered by `@microsoft/api-extractor` - time-intensive operation
139
135
  *
140
136
  * @default false
141
137
  */
@@ -148,32 +144,32 @@ interface PluginOptions {
148
144
  */
149
145
  bundledPackages?: string[];
150
146
  /**
151
- * Whether copy .d.ts source files into `outDir`
147
+ * Whether to copy .d.ts source files to `outDir`
152
148
  *
153
149
  * @default false
154
- * @remarks Before 2.0 it defaults to true
150
+ * @remarks Before 2.0, the default was `true`
155
151
  */
156
152
  copyDtsFiles?: boolean;
157
153
  /**
158
- * Specify the log level of plugin
154
+ * Logging level for this plugin
159
155
  *
160
- * By Default it base on 'logLevel' option of your Vite config
156
+ * Defaults to the 'logLevel' property of your Vite config
161
157
  */
162
158
  logLevel?: LogLevel;
163
159
  /**
164
- * Hook after diagnostic emitted
160
+ * Hook called after diagnostic is emitted
165
161
  *
166
- * According to the length to judge whether there is any type error
162
+ * According to the `diagnostics.length`, you can judge whether there is any type error
167
163
  *
168
164
  * @default () => {}
169
165
  */
170
166
  afterDiagnostic?: (diagnostics: readonly ts.Diagnostic[]) => MaybePromise<void>;
171
167
  /**
172
- * Hook before each declaration file is written
168
+ * Hook called prior to writing each declaration file
173
169
  *
174
- * You can transform declaration file's path and content through it
170
+ * This allows you to transform the path or content
175
171
  *
176
- * The file will be skipped when return exact `false`
172
+ * The file will be skipped when the return value `false`
177
173
  *
178
174
  * @default () => {}
179
175
  */
@@ -182,9 +178,7 @@ interface PluginOptions {
182
178
  content?: string;
183
179
  };
184
180
  /**
185
- * Hook after built
186
- *
187
- * It wil be called after all declaration files are written
181
+ * Hook called after all declaration files are written
188
182
  *
189
183
  * @default () => {}
190
184
  */
package/dist/index.mjs CHANGED
@@ -497,6 +497,7 @@ ${cyan(
497
497
  entries = { ...input };
498
498
  }
499
499
  logger = logger || console;
500
+ aliases = aliases || [];
500
501
  libName = "_default";
501
502
  indexName = defaultIndex;
502
503
  bundleDebug("parse options");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-dts",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "qmhc",
@@ -77,7 +77,6 @@
77
77
  "@vue/eslint-config-standard": "^8.0.1",
78
78
  "@vue/eslint-config-typescript": "^11.0.3",
79
79
  "conventional-changelog-cli": "^3.0.0",
80
- "cross-env": "^7.0.3",
81
80
  "eslint": "^8.43.0",
82
81
  "execa": "^7.1.1",
83
82
  "husky": "^8.0.3",