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

Add support for es6 import specifier details #51

Open
Riley19280 opened this issue May 18, 2023 · 0 comments
Open

Add support for es6 import specifier details #51

Riley19280 opened this issue May 18, 2023 · 0 comments

Comments

@Riley19280
Copy link

Riley19280 commented May 18, 2023

Currently, given an import such as import { Foo, Bar } from './utilities', the returned dependencies will only give ['utilities'], and no other details about what specifically was imported.

For example, the previous import in the page.ts file:

// Directory Structure
├── page.ts
└── utilities
    ├── index.ts
    ├── foo.ts
    ├── bar.ts
    └── baz.ts

// utilities/index.ts
export * from './foo'
export * from './bar'
export * from './baz'

These details would be incredibly useful in other places such as dependency-tree so that the specific imports could be traced.

Currently when getting the dependencies for page.ts it would be utilities/index.ts, and utilities/index.ts would depend on foo, bar, and baz. This gives the appearance that page.ts depends on foo, bar, and baz, even though it only imports Foo and Bar.

I would be happy to PR this improvement to this package if this is an acceptable addition. When implementing it, I would add an opt-in config option to retrieve the extra import declaration data, and then pass it to the onAfterFile callback for use in other locations.

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

No branches or pull requests

1 participant