Uh oh!
There was an error while loading. Please reload this page.
Add language service API to get the compile and runtime dependencies of a source file - #3687
Add language service API to get the compile and runtime dependencies of a source file#3687Dirk Bäumer (dbaeumer) wants to merge 3 commits into
Conversation
Dirk Bäumer (dbaeumer)
commented
Jun 30, 2015
I will look into the failures. I wasn't aware that the test harness implements ILanguageService. |
Dirk Bäumer (dbaeumer)
commented
Jul 1, 2015
Here is how the current dependency info looks like: { So the fine name is the full path of the source file. This helps to related the dependency information back to the original source file. The compile and runtime dependencies are basically the external module reference strings. I looked into providing the full path to the resolved ts/d.ts file however this information isn't available for amd dependencies like /// But I am open to change the format to something that includes the full path to the resolved source file if it is available. |
There was a problem hiding this comment.
initially i thought that compileTime is a subset of runtime, but then looking at the code, that did not turn out to be the case. i think we need better names here. maybe "compileTimeOnly", or "non-js dependencies.."
Mohamed Hegazy (mhegazy)
commented
Jul 13, 2015
Sorry Dirk Bäumer (@dbaeumer) for the delay. i have a general question, do you really need to know what reference is emitted and what is not? I understand that this is an accurate representation of the compiler behavior, but i wounder if this would allow for significant improvements compared to the complexity added in querying the information (i.e. needing the file to be fully type checked to get this information correctly, where as the other one can be done syntactically, just a simple tree walk). |
Dirk Bäumer (dbaeumer)
commented
Jul 16, 2015
Mohamed Hegazy (@mhegazy) no problem. I was busy with VSCode anyway. I would really like to have the information whether the reference is compile time only or run time. The reason is that we want to use that for packaging. Currently we rely on some JS tools for packaging and these toosl change whether we compile to AMD or CommonJS. The nice thing about TS is that it is module system independent. So a tool that analyses runtime dependencies can be independent of the module system as well. This is even more helpful when SystemJS becomes adopted. It would mean we don't have to change our packaging story when we compile to ES6. I like the proposal to make the list more expressive. However to not make it to confusing with the names and easier maintainable in the future the list should contain object literal and not strings only. That way we can have only two top level properties for now. The literal would look like this: enum ImportKind { interface ImportInformation { Something like The import kind of amd dependencies would always be Code. We could also add an additional flag to the getDependencies function to indicate if the import kind should be computed. If not requested then a syntax walk would be sufficient. I wasn't aware of the work Vladimir Matveev (@vladima) is doing with module resolution. I will definitely have a look at it (I think his work is still on a branch) and adopt the getDependencies feature. I will also add code to force the type check. Thanks for pointing this out to me. |
Karan Sikka (ksikka)
commented
Apr 3, 2016
What are the next steps here? |
Mohamed Hegazy (mhegazy)
commented
Dec 30, 2016
This has been superseded with the builder work. closing. |
This PR adds API to the language service to provide the compile and runtime dependencies of a TS file. This information is useful for a package that works independent of the module system and can be used for an incremental compiler that compiles upwards dependencies.