nuxtlabs / nuxt-component-meta

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

fix(module): only parse global components #52

Closed farnabaz closed 1 year ago

farnabaz commented 1 year ago

resolves nuxtlabs/nuxt-component-meta#50

farnabaz commented 1 year ago

I don't understand why slots are not detected when I filter global components

codes are exactly same in both cases:

component.fullPath /Users/far/projects/nuxt/nuxt-component-meta/test/fixtures/basic/components/global/TestContent.vue 
slots: [
  {
    name: 'title',
    type: '{}',
    rawType: undefined,
    description: '',
    schema: { kind: 'object', type: '{}', schema: {} }
  },
  {
    name: 'default',
    type: '{}',
    rawType: undefined,
    description: '',
    schema: { kind: 'object', type: '{}', schema: {} }
  }
] 
<template>
  <div>
    <h1><slot name="title" /></h1>
    <slot  />
  </div>
</template>

<script setup>defineProps()</script>

filtered

component.fullPath /Users/far/projects/nuxt/nuxt-component-meta/test/fixtures/basic/components/global/TestContent.vue 
slots: [] 

<template>
  <div>
    <h1><slot name="title" /></h1>
    <slot  />
  </div>
</template>

<script setup>defineProps()</script>

@Tahul do you have an idea about it?

atinux commented 1 year ago

We need to find a solution for this

Tahul commented 1 year ago

Looking into it :)

stafyniaksacha commented 1 year ago

I think this should be configurable

Tahul commented 1 year ago

Issue is fixed and tests are passing; merging this.

I added the feature behind globalsOnly option that can be enabled from the module config.