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: include directives in injectionUsage metadata #381

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

Conversation

userquin
Copy link
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

Copy link

codecov bot commented Sep 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.65%. Comparing base (a4a5e0a) to head (b2a9fb2).
Report is 46 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #381      +/-   ##
==========================================
- Coverage   98.73%   97.65%   -1.09%     
==========================================
  Files          14       15       +1     
  Lines        1817     1449     -368     
  Branches      374      459      +85     
==========================================
- Hits         1794     1415     -379     
- Misses         23       34      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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