diff --git a/src/core/declaration.ts b/src/core/declaration.ts index 2d96dc78..c286197b 100644 --- a/src/core/declaration.ts +++ b/src/core/declaration.ts @@ -114,28 +114,41 @@ export function getDeclaration(ctx: Context, filepath: string, originalImports?: directive: stringifyDeclarationImports({ ...originalImports?.directive, ...imports.directive }), } - let code = `/* eslint-disable */ -// @ts-nocheck -// Generated by unplugin-vue-components -// Read more: https://github.com/vuejs/core/pull/3399 -export {} - -/* prettier-ignore */ -declare module 'vue' {` - + let items = '' if (Object.keys(declarations.component).length > 0) { - code += ` + items += ` export interface GlobalComponents { ${declarations.component.join('\n ')} }` } + if (Object.keys(declarations.directive).length > 0) { - code += ` + items += ` export interface ComponentCustomProperties { ${declarations.directive.join('\n ')} }` } + + let code = `/* eslint-disable */ +// @ts-nocheck +// Generated by unplugin-vue-components +// Read more: https://github.com/vuejs/core/pull/3399 +export {} + +/* prettier-ignore */ +declare module 'vue' {` + if (items) + code += items code += '\n}\n' + + if (ctx.options.runtime) + code += ` +/* prettier-ignore */ +declare module '@vue/runtime-core' {` + if (items) + code += items + code += '\n}\n' + return code } diff --git a/src/core/options.ts b/src/core/options.ts index 4b44e914..356232a1 100644 --- a/src/core/options.ts +++ b/src/core/options.ts @@ -19,6 +19,8 @@ export const defaultOptions: Omit, 'include' | 'exclude' | 'ex importPathTransform: v => v, allowOverrides: false, + + runtime: false, } function normalizeResolvers(resolvers: (ComponentResolver | ComponentResolver[])[]): ComponentResolverObject[] { diff --git a/src/types.ts b/src/types.ts index 967d9486..9d7f2b8e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -181,6 +181,11 @@ export interface Options { * Vue version of project. It will detect automatically if not specified. */ version?: 2 | 2.7 | 3 + + /** + * Whether runtime is needed + */ + runtime?: boolean } export type ResolvedOptions = Omit< pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy