fervid 0.0.1

Vue SFC compiler written in Rust
Documentation

fervid

Vue SFC compiler written in Rust. Currently in early development, and the closest goal is to reach feature-parity with the current Vue SFC compiler.

Progress till MVP

A minimal target of this project includes:

  • Vue 3 code generation;
  • unplugin integration;
  • Dev/prod mode support;
  • <script setup> support;
  • Example Vue project with configuration;
  • Performance comparison.

Is it fast?

Yes, it is incredibly fast. In fact, below are the parsing/compilation times benchmarked for a test component.

Action Mean time
Parsing 5.58µs
Code generation: CSR + DEV 16.26µs

Note: results are for AMD Ryzen 9 5900HX running on Fedora 37 with kernel version 6.1.6

Micro-benchmarking has been done using Criterion, code for benchmarks can be found in benches directory.

Actual benchmarking is a TODO and has much lower priority compared to feature-completeness and usability in real-world scenarios, so Pull Requests are welcome.

Roadmap

Parser

  • Template parsing
  • W3 Spec compliance

Analyzer

  • Template scope construction
  • Error reporting
  • JS/TS imports analysis (powered by swc_ecma_parser)
  • setup/data/props analysis

Code generator

  • Basic Vue3 code generation

    • Elements
      • createElementVNode
      • Attributes
        • Static + Dynamic
        • style merging
        • class merging
      • Children
    • Components
      • createVNode
      • Slots
    • Context-awareness (_ctx, $data, $setup)
    • Directives
      • v-on
      • v-bind
      • v-if / v-else-if / v-else
      • v-for
      • v-show
      • v-slot
      • v-model
      • Other directives (less priority)
    • Hoisting
  • Processing <style scoped>

  • <script setup> support

  • Vue 2.7 support

  • SSR with inline critical CSS support

  • Eager pre-compilation of Vue imports (avoid unneccessary bundler->compiler calls)

Integrations

  • WASM binary (with/without WASI)
  • NAPI binary
  • unplugin
  • Turbopack plugin (when plugin system is defined)