Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Implement instrumentation as a TypeScript Compiler Transformer #41

Closed
urish opened this issue Mar 24, 2018 · 2 comments
Closed

Implement instrumentation as a TypeScript Compiler Transformer #41

urish opened this issue Mar 24, 2018 · 2 comments
Assignees
Labels
discussion For direction and implementation discussions enhancement New feature or request

Comments

@urish
Copy link
Collaborator

urish commented Mar 24, 2018

Compiler transformers introduced in microsoft/TypeScript#13764, and they seem to allow modifying the AST directly rather than updating the source code. This should improve performance, though, it seems like we will have to rewrite the instrumentor to support that.

Seems like both awesome-typescript-loader and ts-loader have support for custom transformers.

Here are a few example of what a custom transformer looks like (source):

https://github.com/longlho/ts-transform-system-import
https://github.com/longlho/ts-transform-img
https://github.com/longlho/ts-transform-react-intl
https://github.com/longlho/ts-transform-css-modules-transform

@urish urish added enhancement New feature or request discussion For direction and implementation discussions help wanted Extra attention is needed labels Mar 24, 2018
@MadaraUchiha
Copy link
Contributor

I thought applying string processing on the files directly was faster? Or am I missing something?

@urish
Copy link
Collaborator Author

urish commented Mar 25, 2018

It is certainly faster for applying the types (you don't have to parse the source code again, etc). But for the instrumentation, if you have a setup where you already use the TypeScript compiler (and it parses all your source files anyway), we can avoid double parsing by modifying the AST directly after the compiler reads the file but before it processes it.

@urish urish added this to the Post 1.0.0 milestone Apr 16, 2018
@urish urish removed the help wanted Extra attention is needed label Jun 20, 2018
urish added a commit that referenced this issue Jun 20, 2018
urish added a commit that referenced this issue Jun 20, 2018
urish added a commit that referenced this issue Jun 20, 2018
urish added a commit that referenced this issue Jun 21, 2018
@urish urish self-assigned this Jun 21, 2018
@urish urish closed this as completed in 87f243a Jun 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
discussion For direction and implementation discussions enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants