Skip to main content

Crate verter_core

Crate verter_core 

Source
Expand description

§verter_core — Vue SFC compiler

Core Rust crate for the Verter Vue compiler. Handles the full compilation pipeline from Vue Single File Components (SFCs) to compiled output:

Vue SFC source
    ↓ tokenizer   — byte-level SFC tokenization
    ↓ parser      — builds arena-based template AST + extracts script/style blocks
    ↓ script      — macro processing, binding extraction, component wrapper
    ↓ template    — render function codegen (VDOM or Vapor backends)
    ↓ style/css   — scoped CSS, CSS Modules, v-bind() replacement
    ↓ compile     — orchestrates the above, applies CodeTransform, emits output

§Crate boundaries

  • Rust (this crate): tokenization → parsing → AST → template/script/style codegen
  • TypeScript (@verter/core): SFC-to-TSX transformation for IDE type checking
  • NAPI (verter_napi): bridges this crate to Node.js for build-time use (unplugin)
  • WASM (verter_wasm): bridges this crate to the browser for the playground

§Visibility

Modules used only by verter_bench (ast, code_transform, script, style, template) are feature-gated behind the bench feature. They are pub(crate) by default and become pub when features = ["bench"] is enabled.

Modules§

common
Shared span and position types used across the compiler pipeline.
compile
Orchestrator for the AST-based compilation pipeline.
css
CSS style processor using lightningcss.
cursor
Position tracking and script language detection for the tokenizer.
diagnostics
Compiler diagnostic types and error codes.
parser
Tokenizer event dispatcher and SFC parser.
strip_types
Standalone TypeScript stripping for .ts/.tsx files.
tokenizer
SFC tokenizer — produces a flat event stream from Vue source text.
tsc
TSC codegen — generates minimal TypeScript declaration files for Vue SFCs.
types
Shared low-level types for the AST-based parser.
utils
Utility wrappers for OXC parsing and Vue-specific tag/attribute helpers.

Constants§

VERTER_TYPES_AMBIENT_MODULE
Ambient module declaration for @verter/types.
VERTER_TYPES_STANDALONE_DTS
Standalone @verter/types type declarations as a .d.ts file.