feat(findExports): extract name of default exports #179
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi!
I am using
unplugin-auto-import
which rely onunimport
which using this packagefindExports
method. And found an edge case when it extractexport default
. Theunplugin-auto-import
can prevent using filename except when we useexport default
. In that case it will always looking for the file name and use it, but for example I use named default export like this:exampleStore.ts
:In the current version the
findExports
method it will always return the filename (exampleStore). In my case I want to get the name from the default (useExampleStore).For this
ESMExport
interface with a newnamedDefault
in type.EXPORT_DEFAULT_RE
. I update the basic one to prevent duplication in the final exports. (I am not the best with regex so I think it can be written better but it works with every test without duplication).findExports
method and add it to theexports
array