Repository navigation
fix(parser): pin langium to 4.2.1 to keep chevrotain v11 and Node 20 support - #8028
Conversation
…support langium 4.2.2+ switched to chevrotain v12, which declares engines node >=22 and calls Object.groupBy (a Node 21+ API) during grammar validation. Since chevrotain is bundled into the published @mermaid-js/parser, this shipped Node 22-only code to consumers and broke `langium generate` for contributors on Node 20. - Pin langium to 4.2.1 (last release on chevrotain ~11.1.1) in the parser package and via a pnpm override, so langium-cli's internal langium (range ~4.2.0) can't resolve to 4.2.4 either - Pin langium-cli to ~4.2.1 - Disable renovate updates for langium/langium-cli/chevrotain/ @chevrotain/types so the pin isn't silently re-broken (this drift was introduced by a renovate patch-bump of langium ^4.0.3 -> ^4.2.4) Verified on Node 20.12.0: pnpm install + full build, langium:generate, parser unit tests (691/691), and parsing via the built mermaid-parser.core.mjs bundle (zero Object.groupBy in dist). Resolves #8027 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 639938b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe pull request pins Langium and Langium CLI to version 4.2.1, adds a pnpm override, disables Renovate updates for related packages, and adds patch-release metadata for ChangesLangium version pinning
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@mermaid-js/examples
mermaid
@mermaid-js/layout-elk
@mermaid-js/layout-tidy-tree
@mermaid-js/mermaid-zenuml
@mermaid-js/parser
@mermaid-js/tiny
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #8028 +/- ##
===========================================
- Coverage 77.66% 77.60% -0.06%
===========================================
Files 567 567
Lines 74906 74906
Branches 12657 12657
===========================================
- Hits 58172 58132 -40
- Misses 15739 15779 +40
Partials 995 995
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
aloisklink
left a comment
There was a problem hiding this comment.
LGTM! My only comment is that the .changeset is very very verbose and will use up too much space in the CHANGELOG.md/release notes.
If a user does want to see more details, there will be a link to this PR so that they can read more about this.
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
Co-authored-by: Alois Klink <alois@aloisklink.com>
Resolves #8027
The problem
langium 4.2.2+ switched from chevrotain v11 to chevrotain v12, which:
engines: { node: ">=22.0.0" }Object.groupBy— a Node 21+ API — inlib/src/parse/grammar/checks.jsduring grammar validationSince #7907 chevrotain is bundled into the published
@mermaid-js/parser, so after the renovate patch-bump of langium^4.0.3 → ^4.2.4(#7916 era), the published parser bundle contained Node 22-only code. Consumers running mermaid on Node 20 could hitTypeError: Object.groupBy is not a function, andlangium generatecrashed for contributors on Node 20 with the same error.The langium/chevrotain version map:
>=22.0.0, usesObject.groupByThe fix
langiumto 4.2.1 (the last release on chevrotain v11) inpackages/parser, and via a pnpm override — the override is required becauselangium-cli's own dependency range (~4.2.0) would otherwise still resolve its internal langium to 4.2.4 → chevrotain 12, keepinglangium generatebroken on Node 20langium-clito~4.2.1(4.3.0 tracks langium 4.3 / chevrotain 12)packageRulesentry disabling updates forlangium,langium-cli,chevrotain, and@chevrotain/types, with a description documenting when to lift the pin — this drift was originally introduced by an automated renovate bump, so without this rule the pin would be silently re-broken on the next patch sweepTrade-off
Staying on chevrotain v11 keeps its pinned
lodash-es@4.17.23(the CVE-flagged version that motivated bundling in #7907). Exposure is limited since it's bundled rather than a published dependency, but lockfile scanners may still flag it. To be revisited when Node 20 support is dropped — the renovate rule description marks the spot.Verification (all on Node 20.12.0)
pnpm install+ fullpnpm build(previously failed inprepare)pnpm --filter parser langium:generate(previously:TypeError: Object.groupBy is not a function)tsc --emitDeclarationOnlyon the parser packagemermaid-parser.core.mjsimports and parses a pie diagram on Node 20;grep Object.groupByacross all dist chunks: zero hitsrenovate-config-validatorpasses (same command as the config-lint workflow)prepack) — run on Node 22, asscripts/prepack.tsitself requires--experimental-strip-types(publish-time-only path)🤖 Generated with Claude Code
Summary
langiumandlangium-clito 4.2.1 for Chevrotain 11 and Node 20 compatibility.@chevrotain/types.@mermaid-js/parser.