build: add ts support in core modules#62146
build: add ts support in core modules#62146marco-ippolito wants to merge 7 commits intonodejs:mainfrom
Conversation
|
Review requested:
|
7a1197a to
f42cbf2
Compare
|
@marco-ippolito do you know what steps are needed to run and expose Rust code just like C++? |
its already done in this PR, see d9ee95f basically add the crate in the deps/crates cargo.toml, create a header file if doesnt come with the crate and add it to the node gyp |
|
Will this type strip at runtime? Or will it do it at build time? |
Build time |
|
How does this interact with the --node-builtin-modules-path flag? will it still type strip at runtime in that case? |
| ../../common.gypi | ||
| ../../configure | ||
| ../../configure.py | ||
| ../../deps/crates/crates.gyp |
There was a problem hiding this comment.
Not that this will have been deleted by
Line 1220 in 3725bd2
There was a problem hiding this comment.
Yeah I still figure out the shared build with nix. I have never touched this part so I dont really know how it works
Yes, I tested it, it works fine. it plugs in the js2c module |
|
I'm relatively concerned about adding 1 million and 300 hundred thousand lines of code, even if they are just dependencies. Is there a solution that does not require this much? |
|
I dont think so since we are vendoring dependencies. I think the only solution is to have an automation generate them but its kinda impossible to review anyways. (The temporal PR from @legendecas had the same problem) |
|
I think the question should be is it necessary to have every swc dependencies to be included? I listed the newly added dependencies, and the followings are the biggest deps that I doubt if they are required: Additionally, crates like I think technically many of these deps can be stripped down. |
|
Can I just like delete them and see if it builds? |
Let's try again.
This PR allows Node.js source code to be written in TS.
This is semver major because the build now always requires rust to be installed.
This adds swc as a rust crate dependency and it's only use during build time.
Technically we could replace amaro wasm with this for type stripping but it's not the goal of this PR and in needs other considerations.
I moved an internal from .js and .ts to showcase
Also added a flag so that the transpiled code can be writte on the fs for debugging.
A lot of the addition are vendored crates sorry for the massive PR
I used AI to help me out with things I dont know (rust) so please review carefully
I had to bump the rustc from 1.82 to 1.85, obviously this cannot land if we dont update that on the CI machines