Skip to content

feat(context): analyze addToContext under all import styles #1223

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

Merged
merged 8 commits into from
Jul 22, 2020

Conversation

jasonkuhrt
Copy link
Member

@jasonkuhrt jasonkuhrt commented Jul 13, 2020

closes #1222

TODO

@jasonkuhrt jasonkuhrt requested a review from Weakky July 13, 2020 03:58
@jasonkuhrt
Copy link
Member Author

@Weakky still some work to do but feedback welcome.

src/lib/tsc.ts Outdated
if (sourceFile.getFilePath().includes('node_modules')) continue
let entry: ModulesWithImportSearchResult
for (const importDec of sourceFile.getImportDeclarations()) {
if (importDec.getModuleSpecifier().getText() === `'${id}'`) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bonus of this new approach is that we'll have better perf. We used to analyze all source files, even if they didn't import nexus. Not sure how many real-world cases will see improvement, but for some larger apps I could see this being a not-nothing improvement.

@jasonkuhrt
Copy link
Member Author

Status: debugging this issue dsherret/ts-morph#835

@jasonkuhrt jasonkuhrt marked this pull request as ready for review July 20, 2020 21:13
@jasonkuhrt jasonkuhrt merged commit 7778cc1 into master Jul 22, 2020
@jasonkuhrt jasonkuhrt deleted the feat/all-import-styles-add-to-context branch July 22, 2020 00:38
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.

Support any nexus default import name for addToContext
1 participant