nuxtlabs / nuxt-component-meta

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

feat: parse normal scripts with `defineComponent` #28

Closed farnabaz closed 2 years ago

farnabaz commented 2 years ago

input

export default defineComponent({
  props: {
    src: {
      type: [String, Object] as PropType<NuxtImg>,
      default: null
    },
    alt: {
      type: String,
      default: ''
    },
    width: {
      type: [String, Number],
      default: undefined
    },
    height: {
      type: [String, Number],
      default: undefined
    }
  },
})

output

{
    "name": "NuxtImg",
    "global": true,
    "props": [
      {
        "name": "src",
        "type": {
          "type": [
            "String",
            "Object"
          ],
          "as": "NuxtImg"
        }
      },
      {
        "name": "alt",
        "type": "String",
        "default": ""
      },
      {
        "name": "width",
        "type": [
          "String",
          "Number"
        ]
      },
      {
        "name": "height",
        "type": [
          "String",
          "Number"
        ]
      }
    ],
    "slots": []
  }