Skip to content

Commit 980b1d0

Browse files
committed
feat: rename dumpUnimportComponents to dumpComponentsInfo
1 parent ac5be69 commit 980b1d0

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

examples/vite-vue2/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const config: UserConfig = {
88
Components({
99
transformer: 'vue2',
1010
dts: 'src/components.d.ts',
11-
dumpUnimportComponents: true,
11+
dumpComponentsInfo: true,
1212
}),
1313
],
1414
build: {

examples/vite-vue3/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const config: UserConfig = {
3737
componentPrefix: 'i',
3838
}),
3939
],
40-
dumpUnimportComponents: true,
40+
dumpComponentsInfo: true,
4141
}),
4242
],
4343
build: {

src/core/context.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class Context {
3434
root = process.cwd()
3535
sourcemap: string | boolean = true
3636
alias: Record<string, string> = {}
37-
dumpUnimportComponentsPath: string | undefined
37+
dumpComponentsInfoPath: string | undefined
3838

3939
constructor(
4040
private rawOptions: Options,
@@ -43,12 +43,12 @@ export class Context {
4343
this.sourcemap = rawOptions.sourcemap ?? true
4444
this.generateDeclaration = throttle(500, this._generateDeclaration.bind(this), { noLeading: false })
4545

46-
if (this.options.dumpUnimportComponents) {
47-
const dumpUnimportComponents = this.options.dumpUnimportComponents === true
46+
if (this.options.dumpComponentsInfo) {
47+
const dumpComponentsInfo = this.options.dumpComponentsInfo === true
4848
? './.unimport-components.json'
49-
: this.options.dumpUnimportComponents ?? false
49+
: this.options.dumpComponentsInfo ?? false
5050

51-
this.dumpUnimportComponentsPath = dumpUnimportComponents
51+
this.dumpComponentsInfoPath = dumpComponentsInfo
5252
this.generateComponentsJson = throttle(500, this._generateComponentsJson.bind(this), { noLeading: false })
5353
}
5454

src/core/declaration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export async function writeDeclaration(ctx: Context, filepath: string, removeUnu
158158
}
159159

160160
export async function writeComponentsJson(ctx: Context, _removeUnused = false) {
161-
if (!ctx.dumpUnimportComponentsPath)
161+
if (!ctx.dumpComponentsInfoPath)
162162
return
163163

164164
const components = [
@@ -173,5 +173,5 @@ export async function writeComponentsJson(ctx: Context, _removeUnused = false) {
173173
...resolveTypeImports(ctx.options.types),
174174
]
175175

176-
await writeFile(ctx.dumpUnimportComponentsPath, JSON.stringify(components, null, 2))
176+
await writeFile(ctx.dumpComponentsInfoPath, JSON.stringify(components, null, 2))
177177
}

src/core/unplugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ export default createUnplugin<Options>((options = {}) => {
7070
ctx.generateDeclaration()
7171
}
7272

73-
if (ctx.options.dumpUnimportComponents && ctx.dumpUnimportComponentsPath) {
74-
if (!existsSync(ctx.dumpUnimportComponentsPath))
73+
if (ctx.options.dumpComponentsInfo && ctx.dumpComponentsInfoPath) {
74+
if (!existsSync(ctx.dumpComponentsInfoPath))
7575
ctx.generateComponentsJson()
7676
}
7777

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export interface Options {
214214
*
215215
* @default false
216216
*/
217-
dumpUnimportComponents?: boolean | string
217+
dumpComponentsInfo?: boolean | string
218218
}
219219

220220
export type ResolvedOptions = Omit<

0 commit comments

Comments
 (0)