Skip to content

fix: known-template discovery must not follow symlinks - #297

Merged
DylanPiercey merged 1 commit into
mainfrom
fix-known-templates-glob
Jul 22, 2026
Merged

fix: known-template discovery must not follow symlinks#297
DylanPiercey merged 1 commit into
mainfrom
fix-known-templates-glob

Conversation

@DylanPiercey

Copy link
Copy Markdown
Contributor

getKnownTemplates globs from the project root with **/node_modules/.marko/** in the pattern set — which forces the walker into every package tree — and fast-glob follows symlinks by default. pnpm layouts link node_modules as a cyclic symlink graph, so an optimized build's discovery walk never terminates and exhausts the heap (reproduced on a pnpm app: fatal OOM at 4 GiB and 8 GiB alike; CPU profile was ~95% getdents/open under @nodelib/fs.walk).

With followSymbolicLinks: false the same build completes in 2.6s. Generated templates under node_modules/.marko are still found (that directory is real, not a link); the only newly-missed case is .marko files inside symlinked packages, which previously OOM'd rather than being found anyway.

getKnownTemplates globs from the project root with a pattern that descends
into every node_modules (to find generated `.marko` dirs), and fast-glob
follows symlinks by default. pnpm layouts link node_modules as a cyclic
symlink graph, so an optimized build's discovery walk never terminated and
exhausted the heap (reproduced: infinite OOM at any heap size; 2.6s build
with the fix). Templates generated under node_modules/.marko remain
discoverable — that directory is real, not a link.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_d934036c
@changeset-bot

changeset-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 72a63c0

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

This PR includes changesets to release 1 package
Name Type
@marko/vite 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 Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7e4be032-94a9-46c1-9a83-aeca95b6e1d5

📥 Commits

Reviewing files that changed from the base of the PR and between 9823166 and 72a63c0.

📒 Files selected for processing (2)
  • .changeset/known-templates-symlinks.md
  • src/index.ts

Walkthrough

Known-template discovery during optimized builds now configures globSync not to follow symbolic links. This prevents traversal through cyclic symlink graphs during .marko template scanning. A patch changeset documents the behavior fix for @marko/vite.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Directly summarizes the symlink-following fix in known-template discovery.
Description check ✅ Passed The description clearly explains the fast-glob symlink issue and the pnpm heap exhaustion fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-known-templates-glob

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

@DylanPiercey
DylanPiercey merged commit b73226a into main Jul 22, 2026
7 checks passed
@DylanPiercey
DylanPiercey deleted the fix-known-templates-glob branch July 22, 2026 03:04
@github-actions github-actions Bot mentioned this pull request Jul 22, 2026
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