You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since we already depend on SWC I think it might be good idea to try and leverage it's speed.
processImports from cli/js/compiler_imports.ts is used to preprocess TS files and get import specifiers, then specifiers are used to download source files. If I'm not mistaken this step requires to parse AST of each file, which means there could potentially be great speed improvement by using SWC.
I imagine that by doing that in Rust we could feed all of source files to TS compiler in a single op instead of doing 2 ops for each processed file (resolve, fetch)
If I'm not mistaken this step requires to parse AST of each file
It doesn't, it only does effectively a pattern match for import like statements. Ergo why it is preprocess, and quicker.
In my mind the earlier steps were to produce the AST for deno ast/Deno.ast() and see how that goes. Doing the dependency analysis would be the logical next step.
Some thoughts I shared with Ry:
Thinking out loud. Looked at swc. The parser is based off of Babel and so the AST is Babel like. The types are parsed and are part of the AST, but transforming it into TS AST for type checking would be tough. But from a transform, emit perspective it has everything we need.
It does in theory make tree shaking possible, as the Babel AST is estree like.
I still think it would be good to start by exposing the parser and maybe the transformer in the runtime.
If I'm not mistaken this step requires to parse AST of each file
It doesn't, it only does effectively a pattern match for import like statements. Ergo why it is preprocess, and quicker.
That makes sense, thanks for explanation.
In my mind the earlier steps were to produce the AST for deno ast/Deno.ast() and see how that goes. Doing the dependency analysis would be the logical next step.
Since we already depend on SWC I think it might be good idea to try and leverage it's speed.
processImports
fromcli/js/compiler_imports.ts
is used to preprocess TS files and get import specifiers, then specifiers are used to download source files. If I'm not mistaken this step requires to parse AST of each file, which means there could potentially be great speed improvement by using SWC.I imagine that by doing that in Rust we could feed all of source files to TS compiler in a single op instead of doing 2 ops for each processed file (
resolve
,fetch
)CC @kitsonk
The text was updated successfully, but these errors were encountered: