Skip to content

Commit

Permalink
fix(nuxt): improve types within plugin templates (#22998)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Sep 4, 2023
1 parent 5f176b1 commit 8ced37b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/nuxt/src/components/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' })
Expand Down
4 changes: 2 additions & 2 deletions packages/nuxt/src/components/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>()
Expand Down Expand Up @@ -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))}`
Expand Down

0 comments on commit 8ced37b

Please sign in to comment.