Skip to content

Fix rewatch transitive local workspace detection#8411

Merged
fhammerschmidt merged 2 commits into
rescript-lang:masterfrom
fhammerschmidt:fix-rewatch-transitive-local-workspaces
May 6, 2026
Merged

Fix rewatch transitive local workspace detection#8411
fhammerschmidt merged 2 commits into
rescript-lang:masterfrom
fhammerschmidt:fix-rewatch-transitive-local-workspaces

Conversation

@fhammerschmidt

Copy link
Copy Markdown
Member

Summary

Fix rewatch's local workspace detection for monorepo roots so transitive workspace dependencies are treated as local packages.

Previously, when building from a monorepo root, rewatch only marked dependencies as local if their package names appeared directly in the root rescript.json dependencies or dev-dependencies. This missed local workspace packages that were only reached transitively, even though they resolve to paths inside the workspace.

The new logic classifies monorepo-root dependencies by their resolved canonical path, matching the existing monorepo-package behavior: packages inside the workspace root and outside node_modules are local.

Why

This affects root-level monorepo builds and analysis workflows. Transitive local workspaces should be:

  • watched by rewatch
  • built with local package warning/dev-source behavior
  • included in the root .sourcedirs.json cmt_scan plan consumed by reanalyze

Without this, root-level rescript-tools reanalyze can miss CMT files for transitive local workspaces in monorepos.

Signed-off-by: Florian Hammerschmidt <florianh89@gmail.com>
@fhammerschmidt fhammerschmidt requested a review from jfrolich May 6, 2026 08:34
Signed-off-by: Florian Hammerschmidt <florianh89@gmail.com>
@pkg-pr-new

pkg-pr-new Bot commented May 6, 2026

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@8411

@rescript/darwin-arm64

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

@rescript/darwin-x64

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

@rescript/linux-arm64

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

@rescript/linux-x64

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

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@8411

@rescript/win32-x64

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

commit: 033cb5c

@fhammerschmidt fhammerschmidt merged commit 992c1a5 into rescript-lang:master May 6, 2026
26 checks passed
@fhammerschmidt fhammerschmidt deleted the fix-rewatch-transitive-local-workspaces branch May 6, 2026 09:29
cknitt pushed a commit that referenced this pull request May 6, 2026
* Fix rewatch transitive local workspace detection

Signed-off-by: Florian Hammerschmidt <florianh89@gmail.com>

* Add changelog entry for rewatch workspace fix

Signed-off-by: Florian Hammerschmidt <florianh89@gmail.com>

---------

Signed-off-by: Florian Hammerschmidt <florianh89@gmail.com>
# Conflicts:
#	CHANGELOG.md
#	rewatch/src/build/packages.rs
cknitt pushed a commit that referenced this pull request May 16, 2026
* Fix rewatch transitive local workspace detection

Signed-off-by: Florian Hammerschmidt <florianh89@gmail.com>

* Add changelog entry for rewatch workspace fix

Signed-off-by: Florian Hammerschmidt <florianh89@gmail.com>

---------

Signed-off-by: Florian Hammerschmidt <florianh89@gmail.com>
# Conflicts:
#	CHANGELOG.md
#	rewatch/src/build/packages.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants