-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
feat(js): introduce rust-based typescript dependency processor #17976
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 04e3b48. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
de2417d
to
1cc5905
Compare
74ab4f5
to
9421569
Compare
145e7b9
to
09427aa
Compare
59a26cf
to
a7d502e
Compare
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
Nx uses the
typescript
npm package to analyze dependencies between files.Expected Behavior
Nx uses the
swc
Rust crates to analyze dependencies between files.The new dependency analysis is faster and also handles more cases. Most notably,
require.resolve('dep')
will now also result in a dependency while it did not before. Some dependencies which were Static, might now be Dynamic or the other way around, but the new way should be more accurate.This new dependency is enabled via
NX_NATIVE_TS_DEPS
environment variable:typescript
right now. This will change to the new one in the near future.NX_NATIVE_TS_DEPS=true
will use the new native code.NX_NATIVE_TS_DEPS=debug
will use the new native code, but also analyze the files using thetypescript
files so the 2 can be compared.The new dependency analysis uses the
Lexer
to create our own parser. It's compared in unit tests to the results fromswc_ecma_dep_graph::analyze_dependencies(&module, &comments);
to ensure parity with SWC.Testing
nx
Boiled down to just workspace projects:
Most of these differences are from
require.resolve
being handled now.The only problematic one is:
+ nx -> angular (packages/nx/src/adapter/angular-json.ts)
which is accurate but now introduces a circular dependency. This one is now ignored.nx-examples
Absolutely no difference in dependencies
ocean
(Internal Repo)Only difference in dependencies is due to a
require.resolve
Related Issue(s)
Fixes #