Skip to content

Commit 7f53b3c

Browse files
authored
feat(quasar): add quasar resolver (#143)
1 parent aa48c05 commit 7f53b3c

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ Supported Resolvers:
177177
- [View UI](https://github.com/antfu/unplugin-vue-components/blob/main/src/resolvers/view-ui.ts)
178178
- [Vuetify](https://github.com/antfu/unplugin-vue-components/blob/main/src/core/resolvers/vuetify.ts)
179179
- [VueUse Components](https://github.com/antfu/unplugin-vue-components/blob/main/src/core/resolvers/vueuse.ts)
180+
- [Quasar](https://github.com/antfu/unplugin-vue-components/blob/main/src/core/resolvers/quasar.ts)
180181

181182
```ts
182183
// vite.config.js

src/core/resolvers/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ export * from './veui'
1111
export * from './view-ui'
1212
export * from './vuetify'
1313
export * from './vueuse'
14+
export * from './quasar'

src/core/resolvers/quasar.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
import { ComponentResolver } from '../../types'
3+
4+
/**
5+
* Resolver for Quasar
6+
*
7+
* @link https://github.com/quasarframework/quasar
8+
*/
9+
export function QuasarResolver(): ComponentResolver {
10+
return (name: string) => {
11+
let components = [];
12+
13+
try {
14+
/* eslint-disable @typescript-eslint/no-var-requires */
15+
components = require('quasar/dist/transforms/api-list.json')
16+
} catch (e) {
17+
}
18+
19+
if (components.includes(name)) {
20+
return { importName: name, path: 'quasar' }
21+
}
22+
}
23+
}

0 commit comments

Comments
 (0)