Skip to content

Conversation

nojaf
Copy link
Member

@nojaf nojaf commented Sep 17, 2025

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

Copy link

pkg-pr-new bot commented Sep 17, 2025

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: e2b7400

@nojaf nojaf marked this pull request as ready for review September 17, 2025 12:58
@nojaf nojaf requested a review from Copilot September 18, 2025 13:25
Copy link
Contributor

@Copilot Copilot AI 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
File Description
rewatch/src/helpers.rs Core implementation of upward traversal logic with caching for package resolution
rewatch/tests/compile.sh Added 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.json Added standalone package to workspace and updated scripts to use rescript instead of rewatch
CHANGELOG.md Documented the new upward traversal feature

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant