Skip to content
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: turbo-trace #9134

Merged
merged 12 commits into from
Sep 19, 2024
Merged

feat: turbo-trace #9134

merged 12 commits into from
Sep 19, 2024

Conversation

NicholasLYang
Copy link
Contributor

@NicholasLYang NicholasLYang commented Sep 10, 2024

Description

A long long time ago we had a node-file-trace implementation in the repository. Unfortunately this was tied to turbopack and the turbo-tasks code. Since that's now in a different repository, we're gonna implement our own version, because that's easier than coordinating multi-repo dependencies.

This implementation uses oxc_resolver and swc to resolve dependencies and parse files.

This PR hooks it up to turbo query but we'll probably have other uses later.

Testing Instructions

Adds some tests in turbo-trace.t using query

Copy link

vercel bot commented Sep 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 19, 2024 9:34pm
8 Skipped Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview Sep 19, 2024 9:34pm
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Sep 19, 2024 9:34pm
examples-gatsby-web ⬜️ Ignored (Inspect) Visit Preview Sep 19, 2024 9:34pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Sep 19, 2024 9:34pm
examples-native-web ⬜️ Ignored (Inspect) Visit Preview Sep 19, 2024 9:34pm
examples-svelte-web ⬜️ Ignored (Inspect) Visit Preview Sep 19, 2024 9:34pm
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Sep 19, 2024 9:34pm
examples-vite-web ⬜️ Ignored (Inspect) Visit Preview Sep 19, 2024 9:34pm

Copy link
Member

@chris-olszewski chris-olszewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Just two minor comments

// Convert found imports/requires to absolute paths and add them to files to
// visit
for (import, span) in finder.imports() {
let file_dir = file_path.parent().unwrap_or(&self.cwd);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an expect might be more appropriate than .unwrap_or here since None would mean that we're currently process the root dir.

}

impl File {
pub fn new(run: Arc<Run>, path: AbsoluteSystemPathBuf) -> Self {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not blocking, but would it make sense to just pass in repo_root instead of the entire Run object? It would make writing unit tests a lot easier.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually I want to be able to map from a file to affected packages, so that will require the whole run object

@NicholasLYang NicholasLYang merged commit 481212e into main Sep 19, 2024
39 checks passed
@NicholasLYang NicholasLYang deleted the nicholasyang/turbo-trace branch September 19, 2024 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants