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: allow specifying imports to be ignored during the DTS file generation #412

Merged
merged 5 commits into from Jan 24, 2024

Conversation

minenwerfer
Copy link
Contributor

@minenwerfer minenwerfer commented Jul 27, 2023

Description

This PR adds the feature to specify imports to be ignored during DTS file generation via the ignoreDts option. This feature solves a problem I'm having in production (#408) by enabling some imports to be auto-imported while preventing them to be put in the generated DTS file. This way I can declare them myself as needed without running on conflincts.

It also solves a little bug I found. Despite ignore (and now ignoreDts) being declared as (string|RegExp)[]|undefined in the Options they were being compared using a strict equal only, so regexes would always fail. I solved this by creating a small helper function. If it was the expected behavior in the first place please let me know.

The API is as following:

const options: Options = {
  // ...
  ignoreDts: [
    'ignoreThis'
  ]
}

@minenwerfer minenwerfer changed the title Allow specifying imports to be ignored during the DTS file generation feat: allow specifying imports to be ignored during the DTS file generation Jul 27, 2023
@minenwerfer
Copy link
Contributor Author

Hey @antfu , can you have a look at this PR?

@antfu antfu merged commit 35eb66f into unplugin:main Jan 24, 2024
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.

None yet

2 participants