diff --git a/src/core/resolvers/bootstrap-vue-3.ts b/src/core/resolvers/bootstrap-vue-3.ts deleted file mode 100644 index 7c486723..00000000 --- a/src/core/resolvers/bootstrap-vue-3.ts +++ /dev/null @@ -1,38 +0,0 @@ -import type { ComponentResolver } from '../../types' - -export interface BootstrapVue3ResolverOptions { - /** - * Auto import for directives. - * - * @default true - */ - directives?: boolean -} - -/** - * Resolver for BootstrapVue - * - * @link https://github.com/cdmoro/bootstrap-vue-3 - */ -export const BootstrapVue3Resolver = (_options: BootstrapVue3ResolverOptions = {}): Array => { - const options = { directives: true, ..._options } - const resolvers: Array = [{ - type: 'component', - resolve: (name) => { - if (name.match(/^B[A-Z]/)) - return { name, from: 'bootstrap-vue-3' } - }, - }] - - if (options.directives) { - resolvers.push({ - type: 'directive', - resolve: (name) => { - if (name.match(/^B[A-Z]/)) - return { name: `V${name}`, from: 'bootstrap-vue-3' } - }, - }) - } - - return resolvers -} diff --git a/src/core/resolvers/bootstrap-vue.ts b/src/core/resolvers/bootstrap-vue.ts index 3aea7a5d..befb4434 100644 --- a/src/core/resolvers/bootstrap-vue.ts +++ b/src/core/resolvers/bootstrap-vue.ts @@ -54,7 +54,7 @@ const COMPONENT_ALIASES: Record = { * * @link https://github.com/bootstrap-vue/bootstrap-vue */ -export function BootstrapVueResolver(_options: BootstrapVueResolverOptions = {}): ComponentResolver[] { +export const BootstrapVueResolver = (_options: BootstrapVueResolverOptions = {}): ComponentResolver[] => { const options = { directives: true, ..._options } const resolvers: ComponentResolver[] = [{ type: 'component', @@ -84,3 +84,60 @@ export function BootstrapVueResolver(_options: BootstrapVueResolverOptions = {}) return resolvers } + +/** + * Resolver for BootstrapVueNext + * + * @link https://github.com/bootstrap-vue/bootstrap-vue-next + */ +export const BootstrapVueNextResolver = (_options: BootstrapVueResolverOptions = {}): Array => { + const options = { directives: true, ..._options } + const resolvers: Array = [{ + type: 'component', + resolve: (name) => { + if (name.match(/^B[A-Z]/)) + return { name, from: 'bootstrap-vue-next' } + }, + }] + + if (options.directives) { + resolvers.push({ + type: 'directive', + resolve: (name) => { + if (name.match(/^B[A-Z]/)) + return { name: `v${name}`, from: 'bootstrap-vue-next' } + }, + }) + } + + return resolvers +} + +/** + * Resolver for legacy BootstrapVue3 apps + * + * @deprecated use BootstrapVueNextResolver with https://github.com/bootstrap-vue/bootstrap-vue-next + * @link https://www.npmjs.com/package/bootstrap-vue-3 + */ +export const BootstrapVue3Resolver = (_options: BootstrapVueResolverOptions = {}): Array => { + const options = { directives: true, ..._options } + const resolvers: Array = [{ + type: 'component', + resolve: (name) => { + if (name.match(/^B[A-Z]/)) + return { name, from: 'bootstrap-vue-3' } + }, + }] + + if (options.directives) { + resolvers.push({ + type: 'directive', + resolve: (name) => { + if (name.match(/^B[A-Z]/)) + return { name: `V${name}`, from: 'bootstrap-vue-3' } + }, + }) + } + + return resolvers +} diff --git a/src/core/resolvers/index.ts b/src/core/resolvers/index.ts index 07b5a740..ea5c4220 100644 --- a/src/core/resolvers/index.ts +++ b/src/core/resolvers/index.ts @@ -19,5 +19,4 @@ export * from './arco' export * from './tdesign' export * from './layui-vue' export * from './bootstrap-vue' -export * from './bootstrap-vue-3' export * from './ionic'