Files
paseo/packages/highlight/src/nix/terms.ts
T
Mohamed Boudra 1f1289641d fix(highlight): vendor pure-Lezer Nix and C# parsers
The Nix grammar package imports @codemirror/autocomplete at the top level
for its keyword snippets, but only declares it as a peer dependency.
electron-builder packs node_modules by walking declared production
dependencies, so it omitted the package from app.asar and the desktop
daemon died on startup with ERR_MODULE_NOT_FOUND. Dev and CI never saw it
because the workspace hoists everything.

This is the same failure that just shipped for Svelte, and the previous
fix removed @codemirror/autocomplete on the assumption Svelte was its only
consumer. Vendoring both remaining grammars removes the class of bug
rather than the current instance: these packages are interactive editor
extensions, so importing one drags a DOM editor runtime into a headless
token highlighter.

The vendored language modules keep upstream's indent and fold props. The
web file editor consumes getLanguageForFile().extension, so dropping them
would have silently degraded editing for .nix and .cs.

The new dependency-closure test replicates electron-builder's traversal
statically and would have failed both PRs. It is scoped to
@getpaseo/highlight because that tree is small and pure; the same walk
over the server tree is dominated by false positives from optional
dependencies loaded behind try/catch.
2026-08-19 10:16:32 +02:00

14 lines
607 B
TypeScript

// Generated by lezer-generator, taken from @replit/codemirror-lang-nix@6.0.1.
// Vendored so the daemon never loads the editor-only runtime those packages
// pull in at import time (@codemirror/autocomplete, view, state). Only pure
// Lezer primitives are used here. See packages/highlight/src/svelte for the
// same treatment applied to Svelte.
export const strContent = 63;
export const strDollarBrace = 64;
export const strEnd = 65;
export const escapeSequence = 66;
export const indStrContent = 67;
export const indStrDollarBrace = 68;
export const indStrEnd = 69;
export const indEscapeSequence = 70;