vite-plugin-dts 3.0.3 → 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
  {
@@ -106,129 +82,153 @@ This is an existing issue when TypeScript infers types from packages located in
106
82
  import type ts from 'typescript'
107
83
  import type { LogLevel } from 'vite'
108
84
 
109
- interface TransformWriteFile {
110
- filePath?: string
111
- content?: string
85
+ type MaybePromise<T> = T | Promise<T>
86
+
87
+ export interface Resolver {
88
+ /**
89
+ * The name of the resolver
90
+ *
91
+ * The later resolver with the same name will overwrite the earlier
92
+ */
93
+ name: string,
94
+ /**
95
+ * Determine whether the resolver supports the file
96
+ */
97
+ supports: (id: string) => void | boolean,
98
+ /**
99
+ * Transform source to declaration files
100
+ */
101
+ transform: (payload: {
102
+ id: string,
103
+ code: string,
104
+ root: string,
105
+ host: ts.CompilerHost,
106
+ program: ts.Program,
107
+ service: ts.LanguageService
108
+ }) => MaybePromise<{ path: string, content: string }[]>
112
109
  }
113
110
 
114
111
  export interface PluginOptions {
115
112
  /**
116
113
  * Specify root directory
117
114
  *
118
- * 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
119
116
  */
120
- root?: string
117
+ root?: string,
121
118
 
122
119
  /**
123
- * Specify declaration files output directory
120
+ * Output directory for declaration files
124
121
  *
125
- * Can be specified a array to output to multiple directories
122
+ * Can be an array to output to multiple directories
126
123
  *
127
- * 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
128
125
  */
129
- outDir?: string | string[]
126
+ outDir?: string | string[],
130
127
 
131
128
  /**
132
- * Manually set the root path of the entry files, useful in monorepo
129
+ * Override root path of entry files (useful in monorepos)
133
130
  *
134
- * 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
135
132
  *
136
- * By Default it is the smallest public path for all files
133
+ * The default is the smallest public path for all source files
137
134
  */
138
- entryRoot?: string
135
+ entryRoot?: string,
139
136
 
140
137
  /**
141
- * Strictly restrict declaration files output inside `outDir`
138
+ * Restrict declaration files output to `outDir`
142
139
  *
143
- * Because if `entryRoot` is specified, declaration files maybe outside `outDir`
140
+ * If true, generated declaration files outside `outDir` will be ignored
144
141
  *
145
142
  * @default true
146
143
  */
147
- strictOutput?: boolean
144
+ strictOutput?: boolean,
148
145
 
149
146
  /**
150
- * Specify a CompilerOptions to override
147
+ * Override compilerOptions
151
148
  *
152
149
  * @default null
153
150
  */
154
- compilerOptions?: ts.CompilerOptions | null
151
+ compilerOptions?: ts.CompilerOptions | null,
155
152
 
156
153
  /**
157
154
  * Specify tsconfig.json path
158
155
  *
159
- * Plugin also resolve include and exclude files from tsconfig.json
156
+ * Plugin resolves `include` and `exclude` globs from tsconfig.json
160
157
  *
161
- * By default plugin will find config form root if not specify
158
+ * If not specified, plugin will find config file from root
162
159
  */
163
- tsconfigPath?: string
160
+ tsconfigPath?: string,
164
161
 
165
162
  /**
166
- * Set which paths should exclude when transform aliases
163
+ * Specify custom resolvers
167
164
  *
168
- * If it's regexp, it will test the original import path directly
165
+ * @default []
166
+ */
167
+ resolvers?: Resolver[],
168
+
169
+ /**
170
+ * Set which paths should be excluded when transforming aliases
169
171
  *
170
172
  * @default []
171
173
  */
172
- aliasesExclude?: (string | RegExp)[]
174
+ aliasesExclude?: (string | RegExp)[],
173
175
 
174
176
  /**
175
- * Whether transform file name '.vue.d.ts' to '.d.ts'
177
+ * Whether to transform file names ending in '.vue.d.ts' to '.d.ts'
176
178
  *
177
179
  * @default false
178
180
  */
179
- cleanVueFileName?: boolean
181
+ cleanVueFileName?: boolean,
180
182
 
181
183
  /**
182
- * Whether transform dynamic import to static
184
+ * Whether to transform dynamic imports to static (eg `import('vue').DefineComponent` to `import { DefineComponent } from 'vue'`)
183
185
  *
184
- * Force `true` when `rollupTypes` is effective
185
- *
186
- * eg. `import('vue').DefineComponent` to `import { DefineComponent } from 'vue'`
186
+ * Value is forced to `true` when `rollupTypes` is `true`
187
187
  *
188
188
  * @default false
189
189
  */
190
- staticImport?: boolean
190
+ staticImport?: boolean,
191
191
 
192
192
  /**
193
- * Manual set include glob
193
+ * Override `include` glob
194
194
  *
195
- * By Default it base on `include` option of the tsconfig.json
195
+ * Defaults to `include` property of tsconfig.json
196
196
  */
197
- include?: string | string[]
197
+ include?: string | string[],
198
198
 
199
199
  /**
200
- * Manual set exclude glob
200
+ * Override `exclude` glob
201
201
  *
202
- * 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.
203
203
  */
204
- exclude?: string | string[]
204
+ exclude?: string | string[],
205
205
 
206
206
  /**
207
- * Whether remove those `import 'xxx'`
207
+ * Whether to remove `import 'xxx'`
208
208
  *
209
209
  * @default true
210
210
  */
211
- clearPureImport?: boolean
211
+ clearPureImport?: boolean,
212
212
 
213
213
  /**
214
- * Whether generate types entry file
214
+ * Whether to generate types entry file(s)
215
215
  *
216
- * 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`
217
217
  *
218
- * Force `true` when `rollupTypes` is effective
218
+ * Value is forced to `true` when `rollupTypes` is `true`
219
219
  *
220
220
  * @default false
221
221
  */
222
- insertTypesEntry?: boolean
222
+ insertTypesEntry?: boolean,
223
223
 
224
224
  /**
225
- * Set whether rollup declaration files after emit
225
+ * Rollup type declaration files after emitting them
226
226
  *
227
- * Power by `@microsoft/api-extractor`, it will start a new program which takes some time
227
+ * Powered by `@microsoft/api-extractor` - time-intensive operation
228
228
  *
229
229
  * @default false
230
230
  */
231
- rollupTypes?: boolean
231
+ rollupTypes?: boolean,
232
232
 
233
233
  /**
234
234
  * Bundled packages for `@microsoft/api-extractor`
@@ -236,51 +236,58 @@ export interface PluginOptions {
236
236
  * @default []
237
237
  * @see https://api-extractor.com/pages/configs/api-extractor_json/#bundledpackages
238
238
  */
239
- bundledPackages?: string[]
239
+ bundledPackages?: string[],
240
240
 
241
241
  /**
242
- * Whether copy .d.ts source files into `outDir`
242
+ * Whether to copy .d.ts source files to `outDir`
243
243
  *
244
244
  * @default false
245
- * @remarks Before 2.0 it defaults to true
245
+ * @remarks Before 2.0, the default was `true`
246
246
  */
247
- copyDtsFiles?: boolean
247
+ copyDtsFiles?: boolean,
248
248
 
249
249
  /**
250
- * Specify the log level of plugin
250
+ * Logging level for this plugin
251
251
  *
252
- * By Default it base on 'logLevel' option of your Vite config
252
+ * Defaults to the 'logLevel' property of your Vite config
253
253
  */
254
- logLevel?: LogLevel
254
+ logLevel?: LogLevel,
255
255
 
256
256
  /**
257
- * Hook after diagnostic emitted
257
+ * Hook called after diagnostic is emitted
258
258
  *
259
- * 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
260
260
  *
261
261
  * @default () => {}
262
262
  */
263
- afterDiagnostic?: (diagnostics: readonly ts.Diagnostic[]) => void | Promise<void>
263
+ afterDiagnostic?: (diagnostics: readonly ts.Diagnostic[]) => MaybePromise<void>,
264
264
 
265
265
  /**
266
- * Hook before each declaration file is written
266
+ * Hook called prior to writing each declaration file
267
267
  *
268
- * You can transform declaration file's path and content through it
268
+ * This allows you to transform the path or content
269
269
  *
270
- * The file will be skipped when return exact `false`
270
+ * The file will be skipped when the return value `false`
271
271
  *
272
272
  * @default () => {}
273
273
  */
274
- beforeWriteFile?: (filePath: string, content: string) => void | false | TransformWriteFile
274
+ beforeWriteFile?: (
275
+ filePath: string,
276
+ content: string
277
+ ) =>
278
+ | void
279
+ | false
280
+ | {
281
+ filePath?: string,
282
+ content?: string
283
+ },
275
284
 
276
285
  /**
277
- * Hook after built
278
- *
279
- * It wil be called after all declaration files are written
286
+ * Hook called after all declaration files are written
280
287
  *
281
288
  * @default () => {}
282
289
  */
283
- afterBuild?: () => void | Promise<void>
290
+ afterBuild?: () => MaybePromise<void>
284
291
  }
285
292
  ```
286
293
 
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
 
@@ -106,127 +82,153 @@ defineProps<{
106
82
  import type ts from 'typescript'
107
83
  import type { LogLevel } from 'vite'
108
84
 
109
- interface TransformWriteFile {
110
- filePath?: string
111
- content?: string
85
+ type MaybePromise<T> = T | Promise<T>
86
+
87
+ export interface Resolver {
88
+ /**
89
+ * 解析器的名称
90
+ *
91
+ * 靠后的同名解析器将会覆盖靠前的
92
+ */
93
+ name: string,
94
+ /**
95
+ * 判断解析器是否支持该文件
96
+ */
97
+ supports: (id: string) => void | boolean,
98
+ /**
99
+ * 将源文件转换为类型文件
100
+ */
101
+ transform: (payload: {
102
+ id: string,
103
+ code: string,
104
+ root: string,
105
+ host: ts.CompilerHost,
106
+ program: ts.Program,
107
+ service: ts.LanguageService
108
+ }) => MaybePromise<{ path: string, content: string }[]>
112
109
  }
113
110
 
114
111
  export interface PluginOptions {
115
112
  /**
116
113
  * 指定根目录
117
114
  *
118
- * 默认基于 Vite 配置的 'root',使用 Rollup 时基于 `process.cwd()`
115
+ * 默认为 Vite 配置的 'root',使用 Rollup `process.cwd()`
119
116
  */
120
- root?: string
117
+ root?: string,
121
118
 
122
119
  /**
123
120
  * 指定输出目录
124
121
  *
125
122
  * 可以指定一个数组来输出到多个目录中
126
123
  *
127
- * 默认基于 Vite 配置的 'build.outDir',使用 Rollup 时基于 tsconfig.json 的 `outDir`
124
+ * 默认为 Vite 配置的 'build.outDir',使用 Rollup 时为 tsconfig.json 的 `outDir`
128
125
  */
129
- outDir?: string | string[]
126
+ outDir?: string | string[],
130
127
 
131
128
  /**
132
- * 用于手动设置入口文件的根路径,通常用在 monorepo
129
+ * 用于手动设置入口文件的根路径(通常用在 monorepo
133
130
  *
134
131
  * 在计算每个文件的输出路径时将基于该路径
135
132
  *
136
- * 默认为所有文件的最小公共路径
133
+ * 默认为所有源文件的最小公共路径
137
134
  */
138
- entryRoot?: string
135
+ entryRoot?: string,
139
136
 
140
137
  /**
141
- * 严格限制类型文件生产在 `outDir` 内
138
+ * 限制类型文件生成在 `outDir` 内
142
139
  *
143
- * 由于当指定了 `entryRoot` 时,类型文件有可能位于 `outDir` 之外
140
+ * 如果为 `true`,生成在 `outDir` 外的文件将被忽略
144
141
  *
145
142
  * @default true
146
143
  */
147
- strictOutput?: boolean
144
+ strictOutput?: boolean,
148
145
 
149
146
  /**
150
- * 指定一个用于覆写的 CompilerOptions
147
+ * 覆写 CompilerOptions
151
148
  *
152
149
  * @default null
153
150
  */
154
- compilerOptions?: ts.CompilerOptions | null
151
+ compilerOptions?: ts.CompilerOptions | null,
155
152
 
156
153
  /**
157
154
  * 指定 tsconfig.json 的路径
158
155
  *
159
- * 插件也会解析 tsconfig.json 的 include 和 exclude 选项
156
+ * 插件会解析 tsconfig.json 的 include 和 exclude 选项
157
+ *
158
+ * 未指定时插件默认从根目录开始寻找配置文件
159
+ */
160
+ tsconfigPath?: string,
161
+
162
+ /**
163
+ * 指定自定义的解析器
160
164
  *
161
- * 未指定时插件默认从根目录寻找配置
165
+ * @default []
162
166
  */
163
- tsconfigPath?: string
167
+ resolvers?: Resolver[],
164
168
 
165
169
  /**
166
170
  * 设置在转换别名时哪些路径需要排除
167
171
  *
168
172
  * @default []
169
173
  */
170
- aliasesExclude?: (string | RegExp)[]
174
+ aliasesExclude?: (string | RegExp)[],
171
175
 
172
176
  /**
173
177
  * 是否将 '.vue.d.ts' 文件名转换为 '.d.ts'
174
178
  *
175
179
  * @default false
176
180
  */
177
- cleanVueFileName?: boolean
181
+ cleanVueFileName?: boolean,
178
182
 
179
183
  /**
180
- * 是否将动态引入转换为静态
184
+ * 是否将动态引入转换为静态(例如:`import('vue').DefineComponent` 转换为 `import { DefineComponent } from 'vue'`)
181
185
  *
182
186
  * 开启 `rollupTypes` 时强制为 `true`
183
187
  *
184
- * 例如将 `import('vue').DefineComponent` 转换为 `import { DefineComponent } from 'vue'`
185
- *
186
188
  * @default false
187
189
  */
188
- staticImport?: boolean
190
+ staticImport?: boolean,
189
191
 
190
192
  /**
191
193
  * 手动设置包含路径的 glob
192
194
  *
193
195
  * 默认基于 tsconfig.json 的 `include` 选项
194
196
  */
195
- include?: string | string[]
197
+ include?: string | string[],
196
198
 
197
199
  /**
198
200
  * 手动设置排除路径的 glob
199
201
  *
200
202
  * 默认基于 tsconfig.json 的 `exclude` 选线,未设置时为 `'node_module/**'`
201
203
  */
202
- exclude?: string | string[]
204
+ exclude?: string | string[],
203
205
 
204
206
  /**
205
- * 是否移除那些 `import 'xxx'`
207
+ * 是否移除 `import 'xxx'`
206
208
  *
207
209
  * @default true
208
210
  */
209
- clearPureImport?: boolean
211
+ clearPureImport?: boolean,
210
212
 
211
213
  /**
212
- * 是否生成类型声明入口
214
+ * 是否生成类型入口文件
213
215
  *
214
- * 当为 `true` 时会基于 package.json 的 types 字段生成,或者 `${outDir}/index.d.ts`
216
+ * 当为 `true` 时会基于 package.json 的 `types` 字段生成,或者 `${outDir}/index.d.ts`
215
217
  *
216
- * 当开启打包类型文件时强制为 `true`
218
+ * 当开启 `rollupTypes` 时强制为 `true`
217
219
  *
218
220
  * @default false
219
221
  */
220
- insertTypesEntry?: boolean
222
+ insertTypesEntry?: boolean,
221
223
 
222
224
  /**
223
225
  * 设置是否在发出类型文件后将其打包
224
226
  *
225
- * 基于 `@microsoft/api-extractor`,由于这开启了一个新的进程,将会消耗一些时间
227
+ * 基于 `@microsoft/api-extractor`,过程将会消耗一些时间
226
228
  *
227
229
  * @default false
228
230
  */
229
- rollupTypes?: boolean
231
+ rollupTypes?: boolean,
230
232
 
231
233
  /**
232
234
  * 设置 `@microsoft/api-extractor` 的 `bundledPackages` 选项
@@ -234,31 +236,31 @@ export interface PluginOptions {
234
236
  * @default []
235
237
  * @see https://api-extractor.com/pages/configs/api-extractor_json/#bundledpackages
236
238
  */
237
- bundledPackages?: string[]
239
+ bundledPackages?: string[],
238
240
 
239
241
  /**
240
242
  * 是否将源码里的 .d.ts 文件复制到 `outDir`
241
243
  *
242
244
  * @default false
243
- * @remarks 在 2.0 之前它默认为 true
245
+ * @remarks 在 2.0 之前它默认为 `true`
244
246
  */
245
- copyDtsFiles?: boolean
247
+ copyDtsFiles?: boolean,
246
248
 
247
249
  /**
248
250
  * 指定插件的输出等级
249
251
  *
250
252
  * 默认基于 Vite 配置的 'logLevel' 选项
251
253
  */
252
- logLevel?: LogLevel
254
+ logLevel?: LogLevel,
253
255
 
254
256
  /**
255
257
  * 获取诊断信息后的钩子
256
258
  *
257
- * 可以根据参数 length 来判断有误类型错误
259
+ * 可以根据 `diagnostics.length` 来判断有误类型错误
258
260
  *
259
261
  * @default () => {}
260
262
  */
261
- afterDiagnostic?: (diagnostics: Diagnostic[]) => void | Promise<void>
263
+ afterDiagnostic?: (diagnostics: readonly ts.Diagnostic[]) => MaybePromise<void>,
262
264
 
263
265
  /**
264
266
  * 类型声明文件被写入前的钩子
@@ -269,16 +271,23 @@ export interface PluginOptions {
269
271
  *
270
272
  * @default () => {}
271
273
  */
272
- beforeWriteFile?: (filePath: string, content: string) => void | false | TransformWriteFile
274
+ beforeWriteFile?: (
275
+ filePath: string,
276
+ content: string
277
+ ) =>
278
+ | void
279
+ | false
280
+ | {
281
+ filePath?: string,
282
+ content?: string
283
+ },
273
284
 
274
285
  /**
275
- * 构建后回调钩子
276
- *
277
- * 将会在所有类型文件被写入后调用
286
+ * 在所有类型文件被写入后调用的钩子
278
287
  *
279
288
  * @default () => {}
280
289
  */
281
- afterBuild?: () => void | Promise<void>
290
+ afterBuild?: () => MaybePromise<void>
282
291
  }
283
292
  ```
284
293