-
Notifications
You must be signed in to change notification settings - Fork 12.8k
[transform API]: Allow passing getEmitResolver
into TransformationContext
and expose getEmitResolver
from Program
#46793
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
Comments
@rbuckton for thoughts? |
At Google we would also benefit from having the To improve edit/refresh performance during development we would like to transpile TS to JS without type checking. Ideally we would do that using
@rbuckton, would you consider making |
Having exposed program's FYI @andrewbranch @rbuckton do you have any concerns re exposing it to public? |
|
@rbuckton this makes sense, thanks! For this particular use-case, can I create a PR with opening this API? |
Suggestion
π Search Terms
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
transform
API is quite nice and convenient because using this API doesn't need to invokeProgram
to compilets
tojs
to use custom AST transformers. However, it doesn't allow the case which requires to access toEmitResolver
. It would be nice iftransform
API can allow users to passgetEmitResolver
into theTransformationContext
.Currently,
getEmitResolver
isn't exposed for bothTransformationContext
as well asProgram
interfaces.π Motivating Example
An ideal example would be like this
π» Use Cases
I am trying to experiment the idea:
Use
transform
API to process AST of TypeScript source codes with some custom AST transformers.Use
swc
oresbuild
to compilets
tojs
with the newly transformed source.As far as I can tell, process AST with
transform
API is pretty fast. If I can process AST without usingProgram
to do the full compilation step but useswc
oresbuild
to compile, that would help me to achieve the goal that: fast compilation + source is processed in such a way I want (Jest hoisting, Angular downlevel constructor etc...)The text was updated successfully, but these errors were encountered: