unimport icon indicating copy to clipboard operation
unimport copied to clipboard

feat: include directives in `injectionUsage` metadata

Open userquin opened this issue 1 year ago • 1 comments

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: https://github.com/nuxt/devtools/pull/740#issuecomment-2380609153

/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

userquin avatar Sep 28 '24 15:09 userquin

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 97.65%. Comparing base (a4a5e0a) to head (b2a9fb2). Report is 77 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     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Sep 28 '24 16:09 codecov[bot]