Bump @lezer/common dependency from ^1.3.0 to ^1.5.0 #21

Closed
falko-apheris wants to merge 1 commit from fix/bump-lezer-common-to-1-5 into main
falko-apheris commented 2026-03-10 14:07:30 +01:00 (Migrated from github.com)

Problem

@codemirror/language@6.12.2 already requires @lezer/common ^1.5.0. Because @lezer/highlight only declares ^1.3.0, package managers (especially those that don't aggressively deduplicate) install both 1.4.x and 1.5.x side-by-side in the same project.

NodeProp IDs are assigned from a module-level counter in @lezer/common. When two instances exist, IDs from instance A collide with IDs from instance B. This causes node.type.prop(ruleNodeProp) inside getStyleTags() to return an unrelated object (one with no .tags property) instead of a Rule, crashing the editor with:

CodeMirror plugin crashed: TypeError: tags is not iterable
  at HighlightStyle.style  (@lezer/highlight dist/index.js:284)
  at highlightTags
  at HighlightBuilder.highlightRange
  at highlightTree
  at TreeHighlighter.buildDeco / update

This is the root cause behind issues #14 and #19.

Fix

Align the @lezer/common minimum version with @codemirror/language (^1.5.0). The 1.5.0 release only added an IterMode.EnterBracketed feature and a bracketed flag for nested trees — neither of which @lezer/highlight uses — so this is a non-breaking bump.

With a single version of @lezer/common in the tree, all NodeProp IDs are consistent and the crash cannot occur.

## Problem `@codemirror/language@6.12.2` already requires `@lezer/common ^1.5.0`. Because `@lezer/highlight` only declares `^1.3.0`, package managers (especially those that don't aggressively deduplicate) install **both** `1.4.x` and `1.5.x` side-by-side in the same project. `NodeProp` IDs are assigned from a **module-level counter** in `@lezer/common`. When two instances exist, IDs from instance A collide with IDs from instance B. This causes `node.type.prop(ruleNodeProp)` inside `getStyleTags()` to return an **unrelated object** (one with no `.tags` property) instead of a `Rule`, crashing the editor with: ``` CodeMirror plugin crashed: TypeError: tags is not iterable at HighlightStyle.style (@lezer/highlight dist/index.js:284) at highlightTags at HighlightBuilder.highlightRange at highlightTree at TreeHighlighter.buildDeco / update ``` This is the root cause behind issues #14 and #19. ## Fix Align the `@lezer/common` minimum version with `@codemirror/language` (`^1.5.0`). The 1.5.0 release only added an `IterMode.EnterBracketed` feature and a `bracketed` flag for nested trees — neither of which `@lezer/highlight` uses — so this is a non-breaking bump. With a single version of `@lezer/common` in the tree, all `NodeProp` IDs are consistent and the crash cannot occur.
marijnh commented 2026-03-10 14:13:31 +01:00 (Migrated from github.com)

Stop sending me AI pull requests. I'm not interested in wasting my time with those.

This is not how semantic versioning works. ^1.3.0 matches 1.5.0. If your package manager is unable to properly deduplicate, use another package manager. I'm not going to re-release all packages that depend on package X whenever a new version of X is tagged.

Stop sending me AI pull requests. I'm not interested in wasting my time with those. This is not how semantic versioning works. `^1.3.0` matches `1.5.0`. If your package manager is unable to properly deduplicate, use another package manager. I'm not going to re-release all packages that depend on package X whenever a new version of X is tagged.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lezer/highlight!21
No description provided.