Skip to content

feat(type-compiler): inline external library imports #517

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

Closed
wants to merge 27 commits into from

Conversation

marcus-sa
Copy link
Contributor

@marcus-sa marcus-sa commented Nov 30, 2023

Summary of changes

This introduces a new configuration for the type compiler in tsconfig.json.

{
  "compilerOptions": {
    // ...
  },
  "deepkitTypeCompilerOptions": {
    "reflection": true,
    "inlineExternalLibraryImports": {
      "rxjs": true, // mark all imports to be inlined
      // or
      "rxjs": ["Observable", "Subject"] // mark selected imports to be inlined
    }
  }
}

Relinquishment of Rights

Please mark following checkbox to confirm that you relinquish all rights of your changes:

  • I waive and relinquish all rights regarding this changes (including code, text, and images) to Deepkit UG (limited), Germany. This changes (including code, text, and images) are under MIT license without name attribution, copyright notice, and permission notice requirement.

@marcus-sa marcus-sa force-pushed the feat/inline-external-types branch from b44a361 to 1aa4a2b Compare November 30, 2023 16:12
@marcus-sa marcus-sa force-pushed the feat/inline-external-types branch from 1aa4a2b to 98cafff Compare November 30, 2023 16:15
@marcus-sa marcus-sa changed the title feat(type-compiler): inline external types feat(type-compiler): inline external imports Nov 30, 2023
@marcus-sa marcus-sa force-pushed the feat/inline-external-types branch from 037a7d9 to 5cdcfff Compare December 5, 2023 09:34
@marcus-sa marcus-sa force-pushed the feat/inline-external-types branch from 5cdcfff to de8b473 Compare December 5, 2023 09:34
@marcus-sa marcus-sa force-pushed the feat/inline-external-types branch 2 times, most recently from 6c026f3 to 5cf7b32 Compare December 5, 2023 16:19
@marcus-sa marcus-sa force-pushed the feat/inline-external-types branch from 5cf7b32 to 54b14d4 Compare December 5, 2023 16:21
@marcus-sa marcus-sa changed the title feat(type-compiler): inline external imports feat(type-compiler): inline external library imports Dec 5, 2023
@marcus-sa marcus-sa force-pushed the feat/inline-external-types branch from 3029152 to f1d0993 Compare December 5, 2023 16:26
matches with typescript's definition of it
@marcus-sa marcus-sa force-pushed the feat/inline-external-types branch from f1d0993 to d0ac269 Compare December 5, 2023 16:29
@marcus-sa marcus-sa force-pushed the feat/inline-external-types branch 8 times, most recently from 58b1a8b to b4d32ab Compare December 6, 2023 09:55
so that external type names don't clash with user defined type names when inlined
@marcus-sa marcus-sa force-pushed the feat/inline-external-types branch from b4d32ab to 8d869b3 Compare December 6, 2023 09:56
so that external type names don't clash with user defined type names when inlined
@marcus-sa marcus-sa force-pushed the feat/inline-external-types branch from b24e6b4 to f8b1505 Compare December 7, 2023 17:23
@marcus-sa marcus-sa force-pushed the feat/inline-external-types branch from bbc2d19 to e239161 Compare December 8, 2023 11:15
@marcus-sa marcus-sa force-pushed the feat/inline-external-types branch from e239161 to b980dcb Compare December 8, 2023 11:17
@marcus-sa marcus-sa force-pushed the feat/inline-external-types branch from a5a6ff3 to 8bd0027 Compare December 8, 2023 15:48
@codecov-commenter
Copy link

codecov-commenter commented Dec 8, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (f67cf73) 83.91% compared to head (debd1d8) 77.38%.

❗ Current head debd1d8 differs from pull request most recent head c926db5. Consider uploading reports for the commit c926db5 to get more accurate results

Files Patch % Lines
packages/injector/src/injector.ts 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #517      +/-   ##
==========================================
- Coverage   83.91%   77.38%   -6.54%     
==========================================
  Files          51      147      +96     
  Lines        3084    18155   +15071     
  Branches      667     4821    +4154     
==========================================
+ Hits         2588    14049   +11461     
- Misses        496     4106    +3610     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marcus-sa marcus-sa marked this pull request as ready for review December 8, 2023 16:03
@marcus-sa marcus-sa force-pushed the feat/inline-external-types branch from 82dba33 to f1c0eff Compare December 12, 2023 09:48
@marcus-sa marcus-sa force-pushed the feat/inline-external-types branch from f1c0eff to 6ed8d2b Compare December 12, 2023 09:50
marcus-sa referenced this pull request Jan 12, 2024
…ster on average use case.

 previously the cost of passing the type via type arguments (e.g. cast<User>, is<User>, ...) was too high and involved the usage of the full type virtual machine in order to interpret `Op.inline`. Adding this fast path to directly forwards to referenced type making it a lot faster and bypassing the type virtual machine entirely if the referenced type was already computed.
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