Skip to content

fix: pnpm support when @marko/compiler is a transitive dependency - #431

Merged
LuLaValva merged 2 commits into
mainfrom
pnpm-compiler-fallback
Jan 15, 2026
Merged

fix: pnpm support when @marko/compiler is a transitive dependency#431
LuLaValva merged 2 commits into
mainfrom
pnpm-compiler-fallback

Conversation

@LuLaValva

Copy link
Copy Markdown
Member

The language server works by looking for @marko/compiler in node_modules. Since pnpm has its fancy .pnpm directory with @marko+compiler@x.x.x instead for transitive dependencies, when the compiler wasn't a direct dependency it wasn't being discovered. Here, when a compiler isn't found we fall back to resolving the compiler from the version of marko that is installed.

@changeset-bot

changeset-bot Bot commented Jan 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1849e6b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@marko/language-tools Patch
@marko/language-server Patch
@marko/type-check Patch
marko-vscode Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Jan 15, 2026

Copy link
Copy Markdown

Walkthrough

This change adds a patch release across four packages with updates for pnpm support when @marko/compiler is a transitive dependency. The main code modification is in the project utility module, which replaces a direct require.resolve() call for the compiler config with a resolver that includes a fallback mechanism. If the initial resolution fails, the code attempts to resolve the config path relative to the resolved marko package location, addressing different package layout scenarios.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding pnpm support for transitive @marko/compiler dependencies.
Description check ✅ Passed The description clearly explains the problem with pnpm's node_modules structure and the implemented fallback solution.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5467747 and 1849e6b.

📒 Files selected for processing (2)
  • .changeset/blue-eggs-doubt.md
  • packages/language-tools/src/util/project.ts
🔇 Additional comments (2)
.changeset/blue-eggs-doubt.md (1)

1-8: LGTM!

The changeset correctly identifies all affected packages with appropriate patch version bumps for this bug fix. The description accurately captures the nature of the change.

packages/language-tools/src/util/project.ts (1)

244-252: LGTM! Solid fallback mechanism for pnpm transitive dependency resolution.

The approach correctly handles the pnpm case where @marko/compiler is a transitive dependency of marko rather than a direct dependency. Resolving from marko/package.json's location ensures the compiler is found in pnpm's nested .pnpm structure.

Minor note: if the fallback also fails, the thrown error will reference @marko/compiler/config rather than indicating a fallback was attempted. Consider adding a comment explaining the pnpm fallback strategy for future maintainers, as the error handling is already appropriate for this edge case.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@LuLaValva
LuLaValva merged commit b47d633 into main Jan 15, 2026
5 checks passed
@LuLaValva
LuLaValva deleted the pnpm-compiler-fallback branch January 15, 2026 21:50
@github-actions github-actions Bot mentioned this pull request Jan 15, 2026
@github-project-automation github-project-automation Bot moved this to Done in Roadmap Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants