deepkit / deepkit-framework

A new full-featured and high-performance TypeScript framework
https://deepkit.io/
MIT License
3.14k stars 116 forks source link

type-compiler for SWC #203

Open igl opened 2 years ago

igl commented 2 years ago

Is there a plan for a SWC plugin?

We phased out tsc a long time ago and replaced it with babel. Now we toy with SWC and also migrate to next-12 using swc. Going back to tsc is not really an option nor favourable for large projects.

Cool approach though, reminds me of the good times creating RPCs with flow runtime

marcj commented 2 years ago

We use a few key methods of the TypeScript compiler API (for example to resolve types or module import expressions) to be able to correctly embed type informations as bytecode. I just saw that SWC supports plugins https://swc.rs/docs/usage/plugins, but I'm not sure if it provides all the necessary functions we need to have all type information available.

While I don't necessarily agree that tsc is not an option for large projects anymore (Deepkit is large as well and works well with tsc), I definitely see advantage of having a faster compiler. I guess if demand increases we should find out if we could build a SWC plugin for Deepkit and if its possible we should do it.

RichiCoder1 commented 2 years ago

I would put esbuild in this same boat, especially since it has largely the same problem and is becoming increasing popular.

marcj commented 2 years ago

We have "loader" capability now in master since https://github.com/deepkit/deepkit-framework/commit/30939492b96fd90d027728fc7a3030e8d8d24bf3. We can try to test SWC/esbuild now using https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/src/loader.ts

iceKing74 commented 1 year ago

We have "loader" capability now in master since 3093949. We can try to test SWC/esbuild now using https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/src/loader.ts

how do i use it in esbuild?