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

chore(compiler): improve typescript compiler #1417

Merged
merged 9 commits into from
Mar 6, 2020
Merged

chore(compiler): improve typescript compiler #1417

merged 9 commits into from
Mar 6, 2020

Conversation

ahnpnl
Copy link
Collaborator

@ahnpnl ahnpnl commented Mar 5, 2020

Related to #1310, #1146

What has changed

  • A new folder compiler is introduced. This folder contains an entry point instance.ts which takes care of using different typescript apis to compile ts file: either LanguageService, Program or isolatedModule.

  • Each way of using typescript apis has its own respected files.

  • Most of the codes in the old file compiler (for Language Service and transpile module) were kept and moved to their own respected files (language-service.ts or transpile-module.ts)

  • Improve performance when compiling with LanguageService, thanks to great idea from Implement getProjectVersion TypeStrong/ts-node#963 (improvement for RFC: Performance report for each ts-jest version  #1115 and all related issues mentioned there).

  • Remove getTypeInfo since this is not used. Perhaps if someone needs it, we can add it again.

  • Introduce new option in ts-jest config: compilerHost. This option will allow users to use typescript Program or Incremental Program to compile ts files.

What can be done further after this ?

@ahnpnl ahnpnl requested a review from kulshekhar March 5, 2020 09:27
@coveralls
Copy link

Pull Request Test Coverage Report for Build 4087

  • 200 of 207 (96.62%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.09%) to 91.628%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/compiler/instance.ts 71 72 98.61%
src/compiler/language-service.ts 58 59 98.31%
src/compiler/program.ts 60 65 92.31%
Totals Coverage Status
Change from base Build 4085: -0.09%
Covered Lines: 1135
Relevant Lines: 1180

💛 - Coveralls

Copy link
Owner

@kulshekhar kulshekhar left a comment

Choose a reason for hiding this comment

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

This was a big one to review!

Nice PR @ahnpnl 🙂

@ahnpnl ahnpnl merged commit 368298b into kulshekhar:master Mar 6, 2020
@ahnpnl ahnpnl deleted the compiler-experiment branch March 6, 2020 07:09
@ahnpnl
Copy link
Collaborator Author

ahnpnl commented Mar 6, 2020

I haven't updated docs for this PR so there will be another PR for that. Besides, right now IncrementalProgram is used when user enables incremental in tsconfig. However, not all frameworks have supported it yet, e.g. Angular , I think the switch should be a different one.

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.

3 participants