@codemirror/legacy-modes

A collection of over 100 ported legacy stream-parser language modes for CodeMirror 6

Library
npm
v6.5.4
107 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
40 /100 Fair
Development Activity 8
Maintenance 0
Community 72
Maturity 60
Momentum 20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
65 /100 Good
Architecture 70
Code Quality 62
Innovation 55
Learning Curve 72

@codemirror/legacy-modes packages up the older, stream-based language modes originally written for CodeMirror 5 so they can be used with CodeMirror 6’s newer, more structured language system. Each mode is shipped as its own file under mode/<name>.js and exports a StreamParser that plugs into @codemirror/language’s StreamLanguage.define(), giving CodeMirror 6 editors syntax highlighting for languages that don’t yet have a dedicated Lezer grammar.

Because CodeMirror 6’s core distribution only ships first-class Lezer-based grammars for a handful of mainstream languages, this package fills the long tail: everything from APL and COBOL to Lua, Toml, and dozens of other syntaxes are available as drop-in stream parsers with no separate installation beyond this one package.

What You Get

  • Over 100 individual language mode files, each importable independently as @codemirror/legacy-modes/mode/<name>
  • Each mode exported as a StreamParser compatible with @codemirror/language’s StreamLanguage.define()
  • Coverage of legacy and niche languages (APL, COBOL, ASN.1, Asterisk dialplan, and many more) with no dedicated Lezer grammar in CodeMirror 6 core
  • Both ESM and CommonJS builds via dual import/require export conditions
  • TypeScript type declarations (.d.ts) shipped alongside every mode

Common Use Cases

  • Adding syntax highlighting to a CodeMirror 6 editor for a language that only has a CodeMirror 5-era mode, not a modern Lezer grammar
  • Building general-purpose code editors or admin tools that need broad, long-tail language coverage rather than a curated few languages
  • Migrating a CodeMirror 5 integration to CodeMirror 6 while preserving highlighting for less common languages already relied upon
  • Embedding config-file or infrastructure-as-code editors (e.g. for formats like TOML, Dockerfile, or Nginx config) where a Lezer grammar doesn’t yet exist

Under The Hood

Architecture: The package has no shared runtime logic of its own beyond a thin per-mode wrapper — each mode/<name>.js file defines a CodeMirror 5-style stream parser (a state machine with a token() function reading one token at a time from a StringStream) and exposes it as a StreamParser object matching the shape @codemirror/language’s StreamLanguage.define() expects. There’s deliberately no central registry or barrel export; consumers import exactly the modes they need (@codemirror/legacy-modes/mode/lua), keeping bundle size proportional to usage. Tech Stack: Plain JavaScript (ESM, type: module) built with Rollup into dual ESM/CJS outputs, TypeScript used only for authoring .d.ts declaration files, with @codemirror/language as the sole runtime dependency providing the StreamParser interface being implemented. Code Quality: Tests run through cm-runtests, a shared CodeMirror test runner rather than an in-repo suite, so correctness is validated against upstream CodeMirror project conventions; individual mode files vary in sophistication (some are compact regex-driven tokenizers, others like clike.js implement more elaborate configurable state machines shared across several C-family languages) but follow a consistent token-function convention throughout, a legacy of their shared CodeMirror 5 origin. API Design: The per-language, per-file export convention is the package’s defining ergonomic choice — there is exactly one way to consume any given mode (import {lua} from "@codemirror/legacy-modes/mode/lua" then StreamLanguage.define(lua)), which keeps the API surface predictable across all 100+ modes at the cost of needing to know the exact file/export name for each language in advance.

Used by 23 apps in this directory

Go
73%
GPL 3.0

1Panel

Devops · Hosting Control Panel · Monitoring

37,044

The only open-source VPS control panel with native AI agent runtime — deploy websites, Docker stacks, and local LLMs from one web interface.

View details
91
Repo Health
76
Technical
67
Dependency
Built with
Go 73%
Vue 27%
Updated 1 weeks ago
Python
55%
Other

authentik

Authentication · Security

25,758

The self-hosted Identity Provider that replaces Okta, Auth0, and Entra ID with a unified SSO platform supporting SAML, OAuth2/OIDC, LDAP, RADIUS, and WebAuthn.

View details
92
Repo Health
81
Technical
66
Dependency
Built with
Python 55%
TypeScript 36%
Updated 1 weeks ago
TypeScript
98%
Other

Dokploy

Devops · Hosting Control Panel · Security

37,543

Self-hosted PaaS that deploys apps and databases on your own VPS using Docker, Traefik, and multi-build-system orchestration

View details
88
Repo Health
76
Technical
64
Dependency
Built with
TypeScript 98%
Updated 2 weeks ago
Rust
65%
Other

GitButler

AI Development · Developer Tools · Devops

21,726

Git, but better — a modern version control client with stacked branches, parallel workflows, unlimited undo, and first-class support for AI-powered development.

View details
89
Repo Health
84
Technical
66
Dependency
Built with
Rust 65%
TypeScript 22%
Svelte 10%
Updated 1 weeks ago
Go
83%
MIT

Gitea

Developer Tools · Devops · Project Management

58,194

Self-hosted DevOps in a single Go binary — Git hosting, GitHub Actions-compatible CI/CD, and 30+ package registries without any SaaS dependency.

View details
93
Repo Health
79
Technical
64
Dependency
Built with
Go 83%
Updated 1 weeks ago
Rust
37%
Other

Hook0

Devops

1,491

Open-source Webhooks-as-a-Service: deliver events to your users with auto-retry, signed payloads, and a real-time subscriber dashboard — all without building the infrastructure yourself.

View details
82
Repo Health
82
Technical
69
Dependency
Built with
Rust 37%
TypeScript 12%
Updated 2 weeks ago
Go
64%
MIT

hoop

Monitoring · Security

823

A wire-protocol gateway that enforces data masking, command blocking, approval workflows, and full session recording for engineers and AI agents accessing production infrastructure.

View details
85
Repo Health
80
Technical
64
Dependency
Built with
Go 64%
Clojure 17%
JavaScript 11%
Updated 2 weeks ago
TypeScript
67%
MIT

Hoppscotch

Developer Tools

80,529

A lightweight, offline-capable API development ecosystem for testing HTTP, GraphQL, WebSocket, MQTT, and SSE endpoints across web, desktop, and CLI.

View details
91
Repo Health
83
Technical
65
Dependency
Built with
TypeScript 67%
Vue 25%
Updated 1 weeks ago
TypeScript
77%
Other

Joplin

Note Taking

56,513

The privacy-first, open-source note-taking app with end-to-end encrypted sync, AI assistance, and a powerful plugin ecosystem across every platform.

View details
93
Repo Health
87
Technical
60
Dependency
Built with
TypeScript 77%
JavaScript 14%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers