Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Traverse upwards for single context projects#7896

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nojaf merged 15 commits intorescript-lang:masterfromnojaf:recurse-upwards
Sep 26, 2025

Conversation

@nojaf
Copy link
Member

This resolves the upwards traversal as discussed in#7117 (comment)

chatgpt-codex-connector[bot] reacted with thumbs up emoji
@pkg-pr-new
Copy link

pkg-pr-newbot commentedSep 17, 2025
edited
Loading

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@7896

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@7896

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@7896

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@7896

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@7896

@rescript/runtime

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/runtime@7896

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@7896

commit:bdac509

@nojafnojaf marked this pull request as ready for reviewSeptember 17, 2025 12:58
@nojafnojaf requested a review fromCopilotSeptember 18, 2025 13:25
Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements upward directory traversal for package resolution in single context projects, allowing ReScript to find dependencies in parent node_modules directories when building standalone packages in workspace setups.

Key changes include:

  • Added upward traversal logic that searches parent directories for node_modules when dependencies aren't found locally
  • Implemented caching mechanism to optimize repeated path existence checks during traversal
  • Added comprehensive test coverage for standalone package builds

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
rewatch/src/helpers.rsCore implementation of upward traversal logic with caching for package resolution
rewatch/tests/compile.shAdded test case for standalone package building via rescript command
rewatch/testrepo/packages/standalone/*Test fixtures for standalone package with dependency on @testrepo/dep01
rewatch/testrepo/package.jsonAdded standalone package to workspace and updated scripts to use rescript instead of rewatch
CHANGELOG.mdDocumented the new upward traversal feature

Tip: Customize your code reviews with copilot-instructions.md.Create the file orlearn how to get started.

@nojafnojaf added the build labelSep 26, 2025
Copy link
Member

@cknittcknitt left a comment

Choose a reason for hiding this comment

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

👍 LGTM, but would be great if someone else could review, too.

@cknitt
Copy link
Member

@codex review

@chatgpt-codex-connector

Codex Review: Didn't find any major issues. Keep them coming!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.


// Cache existence checks for candidate node_modules paths during upward traversal.
// Keyed by the absolute candidate path; value is the existence boolean.
staticNODE_MODULES_EXIST_CACHE:LazyLock<RwLock<ahash::AHashMap<PathBuf,bool>>> =
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we not put this in the build state instead of a static value?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

It is used beforeBuildState is created,packages::make already needs it.
I was able to move it to ProjectContext:

  • Key point:ProjectContext exists beforeBuildState. We resolve packages (e.g.helpers::try_package_path) during config/dependency reading, which happens pre-BuildState, and those call sites already have a&ProjectContext.

  • Correct scope/lifetime: The cache models workspace layout (node_modules existence), not per-build artifacts.BuildState may be recreated in watch cycles;ProjectContext persists, so the cache isn’t thrown away.

  • Concurrency and isolation: A per-ProjectContextRwLock allows concurrent reads and avoids process-wide statics and cross-project cache bleed.

  • Lower coupling/less churn: Callers already passProjectContext; using it avoids threadingBuildState throughconfig.rs andbuild/packages.rs and reduces borrow/contention with the highly mutableBuildState.

Copy link
Collaborator

@jfrolichjfrolich left a comment

Choose a reason for hiding this comment

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

Great!

@nojafnojafenabled auto-merge (squash)September 26, 2025 11:14
@nojafnojaf requested a review fromCopilotSeptember 26, 2025 11:59
@nojaf
Copy link
MemberAuthor

I'm also incorporating the changes of#7890 as it is a similar cache.

Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md.Create the file orlearn how to get started.

@nojafnojafenabled auto-merge (squash)September 26, 2025 12:15
@nojafnojaf merged commit84e45c5 intorescript-lang:masterSep 26, 2025
25 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

@jfrolichjfrolichjfrolich approved these changes

@cknittcknittcknitt approved these changes

@rolandpeelenrolandpeelenAwaiting requested review from rolandpeelen

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@nojaf@cknitt@jfrolich

[8]ページ先頭

©2009-2025 Movatter.jp