nuxtlabs / nuxt-component-meta

Gather Nuxt components metadata on build time and make them available on production.
69 stars 6 forks source link

feat: expose component meta into virtual package #32

Closed stafyniaksacha closed 2 years ago

stafyniaksacha commented 2 years ago

This adds virtual:nuxt-component-meta virtual packages which contains extracted meta.

It has named export, so we can use them to document component usage inside the app

// load all meta
import meta from 'virtual:nuxt-component-meta'

// load only meta for <MyComponent>
import { MyComponentMeta } from 'virtual:nuxt-component-meta'

We may also need to register webpack plugin? Do you have some advice?

atinux commented 2 years ago

I would need @farnabaz to review since I think we should not use a Vite plugin but the Nuxt alias instead, see https://github.com/nuxt-community/tailwindcss-module/blob/main/src/module.ts#L136-L149

So exposing with #nuxt-component-meta or even #component-meta