feat: include directives in `injectionUsage` metadata by userquin · Pull Request #381 · unjs/unimport · GitHub
Skip to content

feat: include directives in injectionUsage metadata#381

Draft
userquin wants to merge 3 commits intounjs:mainfrom
userquin:feat-include-directives-in-injection-usage
Draft

feat: include directives in injectionUsage metadata#381
userquin wants to merge 3 commits intounjs:mainfrom
userquin:feat-include-directives-in-injection-usage

Conversation

@userquin
Copy link
Copy Markdown
Contributor

@userquin userquin commented Sep 28, 2024

This PR includes a new parameter in Addon:transform function to allow collect directives in injectionUsage metadata.

Right now there is no way to know what directives were used and so we cannot collect the info: we cannot use getImports since it can contains imports from other ids.

This PR is about the pending task here: nuxt/devtools#740 (comment)

/cc @antfu

Can this be done with injectImportsResolved ? If so, I will change this PR to add it to the vue-directives addon.
The problem is Nuxt where we have 2 unimport contexts: imports and directives (we only reuse some configuration from Nuxt imports options). We need to collect the imports from directives context and update them in the imports context.
Another problem is about custom directives injection, since there is no auto import, it is just a transform.

Nuxt PR on my local

imagen

@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 28, 2024

@danielroe danielroe marked this pull request as draft October 22, 2024 14:55
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.

1 participant