fix(nuxt): improve types within plugin templates (#22998)

This commit is contained in:
Daniel Roe 2023-09-04 16:44:23 +01:00 committed by GitHub
parent 5f176b1a96
commit 8ced37bc8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -114,11 +114,11 @@ export default defineNuxtModule<ComponentsOptions>({
})
// components.d.ts
addTemplate({ ...componentsTypeTemplate })
addTemplate(componentsTypeTemplate)
// components.plugin.mjs
addPluginTemplate({ ...componentsPluginTemplate } as any)
addPluginTemplate(componentsPluginTemplate)
// component-names.mjs
addTemplate({ ...componentNamesTemplate, options: { mode: 'all' } })
addTemplate(componentNamesTemplate)
// components.islands.mjs
if (nuxt.options.experimental.componentIslands) {
addTemplate({ ...componentsIslandsTemplate, filename: 'components.islands.mjs' })

View File

@ -33,7 +33,7 @@ export default defineNuxtPlugin({
})
`
export const componentsPluginTemplate: NuxtPluginTemplate<ComponentsTemplateContext> = {
export const componentsPluginTemplate: NuxtPluginTemplate = {
filename: 'components.plugin.mjs',
getContents ({ app }) {
const lazyGlobalComponents = new Set<string>()
@ -70,7 +70,7 @@ export default defineNuxtPlugin({
}
}
export const componentNamesTemplate: NuxtPluginTemplate<ComponentsTemplateContext> = {
export const componentNamesTemplate: NuxtTemplate<ComponentsTemplateContext> = {
filename: 'component-names.mjs',
getContents ({ app }) {
return `export const componentNames = ${JSON.stringify(app.components.filter(c => !c.island).map(c => c.pascalName))}`