I have been tasked with developing a custom builder for a web application. The challenge now is to automatically detect imports in the code so that the right modules can be imported.
My current solution involves traversing the AST of the scripts, keeping track of declared identifiers in the current scope, and then identifying unresolved identifiers. However, this approach requires extensive handling of different types of AST-elements.
Given that both tsc and the TypeScript background server have built-in capabilities for this, I am curious to know how they achieve it, or where in the codebase this feature is implemented. Unfortunately, I have not been able to locate the specific piece of code responsible for this.
Any insights would be greatly appreciated.
Thank you,
Luca