Skip to content

fea: introduce component parser utility #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

farnabaz
Copy link
Collaborator

This PR introduces two utilities to parse and worked with components:

  • import { getComponentMeta } from 'nuxt-component-meta/parser': receives a component(path), parse it and return component meta data
  • import { propsToJsonSchema } from 'nuxt-component-meta/utils': receives props metadata of a component, which is generated by getComponentMeta, and converts metadata to JSON Schema.

Copy link

pkg-pr-new bot commented Jul 10, 2025

npm i https://pkg.pr.new/nuxt-component-meta@84

commit: 51c492e

@farnabaz
Copy link
Collaborator Author

@Mw3y feel free to test them

@Mw3y
Copy link

Mw3y commented Jul 10, 2025

Thanks!

@Mw3y
Copy link

Mw3y commented Jul 10, 2025

Hey @farnabaz,

I'm currently trying to use it inside the components:extend hook to generate my LaTeX xparse definitions. Overall this works great but in my case the component param is the fullPath. The cachePath will therefore be wrong. Also, rootDir should be optional (to be able to only pass cache: true).

Also, the NuxtWelcome component is not being found because for some reason its filePath doesn't include a .vue file extension.

Is there an easier way to use your changes inside components:extend?

@farnabaz
Copy link
Collaborator Author

@Mw3y Thanks for the feedback, I'm working on cache and performance. Also good to know bout NuxtWelcome I'll dig.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants