MCPcopy Index your code
hub / github.com/HerringtonDarkholme/vue-compiler

github.com/HerringtonDarkholme/vue-compiler @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
931 symbols 2,443 edges 93 files 103 documented · 11%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Vue Compiler in Rust

WebAssembly ferris Vue

Try it out in the wasm playground!

CI Playground codecov

Evan says:

Maybe in the long run we want the whole transform (and even the Vue compiler!) to be implemented in native Go/Rust so performance would no longer be a concern ;)

Future is now!

Project Docs

Intended Usage

  • Rust library
  • CLI binary
  • napi based nodejs library
  • wasm based npm package: a fallback if napi fails to work and a toy for browser.
  • No Browser build No support since most features in full build are additional except for browser based expression checking or HTML escaping. Browser build removed them for size. But template compiler in browser is already for toy project. For browser specific summary see this google sheet.

Reference

  • vuejs/core: ご本家様
  • html spec is the definitive guide for parsing HTML-like files.
  • Vue Template Explorer gives instant results for code generation and error reporting.
  • Nu html checker is the official html validator from W3C. This is the canonical error reporter for html parsing, when there is a discrepancy between the framework and the spec.
  • AST explorer can inspect AST nodes interactively.

Extension points exported contracts — how you extend this code

ErrorHandler (Interface)
This trait handles error occured in the compilation. NB: clone bound is needed since scan/parse/ir/code gen all requires [4 …
crates/compiler/src/error.rs
CorePass (Interface)
(no doc) [9 implementers]
crates/compiler/src/transformer/pass.rs
CorePassExt (Interface)
(no doc) [4 implementers]
crates/compiler/src/transformer/pass.rs
FlagCDataNs (Interface)
A scanner needs to implement this trait to know if it is_in_html_namespace. A parser tells scanner the current namespace [1 …
crates/compiler/src/scanner.rs
Locatable (Interface)
This trait produces a compiler's current position and selects a range. [1 implementers]
crates/compiler/src/scanner.rs

Core symbols most depended-on inside this repo

write_str
called by 161
crates/compiler/src/codegen/code_writer.rs
is_empty
called by 77
crates/compiler/src/flags.rs
collect
called by 60
crates/compiler/src/flags.rs
contains
called by 43
crates/compiler/src/flags.rs
move_by
called by 37
crates/compiler/src/scanner.rs
find
called by 37
crates/compiler/src/util.rs
into_iter
called by 34
crates/compiler/src/flags.rs
with_location
called by 28
crates/compiler/src/error.rs

Shape

Function 407
Method 369
Class 107
Enum 30
Interface 18

Languages

Rust100%
TypeScript1%

Modules by API surface

crates/compiler/src/codegen/code_writer.rs86 symbols
crates/compiler/src/parser.rs68 symbols
crates/compiler/src/scanner.rs63 symbols
crates/compiler/src/util.rs47 symbols
crates/compiler/src/util/v_str.rs45 symbols
crates/compiler/src/converter/mod.rs39 symbols
crates/compiler/src/util/rslint.rs36 symbols
crates/compiler/src/transformer/process_expression.rs34 symbols
crates/compiler/src/ir.rs33 symbols
crates/sfc/src/parse_sfc.rs24 symbols
crates/compiler/src/transformer/mod.rs21 symbols
crates/compiler/src/error.rs19 symbols

For agents

$ claude mcp add vue-compiler \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page