Skip to content
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

feat(kit): provide type support for module options in installModule #26744

Merged
merged 12 commits into from
Jun 10, 2024

Conversation

ineshbose
Copy link
Member

@ineshbose ineshbose commented Apr 11, 2024

🔗 Linked issue

📚 Description

These changes relies and builds on top of #18416 (my first PR on Nuxt 😄); it extracts the options from there after module authors run prepare.

Try this in the repo playground:

import { installModule } from "@nuxt/kit";

installModule('@nuxt/devtools', { customTabs: [] })

Copy link

stackblitz bot commented Apr 11, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@danielroe danielroe changed the title chore(kit): provide type support for module options in installModule feat(kit): provide type support for module options in installModule Apr 12, 2024
@@ -7,6 +7,7 @@ export default defineBuildConfig({
],
externals: [
'@nuxt/schema',
'nuxt/schema',
Copy link
Member

@danielroe danielroe Jun 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to use @nuxt/schema within Kit as there is no nuxt dependency. The end user is the only one who should use nuxt/schema as a type import/augmentation...

(We might need to generate an augmentation against @nuxt/schema as well.)

Copy link
Member Author

@ineshbose ineshbose Jun 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, but the updated NuxtConfig that has the new modules options would be based on the types Nuxt has written for their project right, so they get imported using nuxt/schema is what I've found

(typecheck CI has now failed)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I understand. We need to find a different solution than using nuxt/schema with @nuxt/kit...

@danielroe
Copy link
Member

Nice work! And also debugging the type issue. This will be a nice DX improvement ❤️

@danielroe danielroe merged commit 0d84300 into nuxt:main Jun 10, 2024
60 checks passed
@github-actions github-actions bot mentioned this pull request Jun 10, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants