2 unstable releases

0.1.0 Nov 27, 2023
0.0.1 Aug 7, 2023

#705 in Programming languages

38 downloads per month
Used in 2 crates

Apache-2.0

225KB
4.5K SLoC

fervid_transform

Part of the fervid project, an all-in-one Vue compiler. This crate is responsible for the transformations in the template, such as optimizing the AST or transforming the JS/TS expressions in the AST nodes.

In the future this crate may accommodate the <style> transformations as well, which are currently in its own crate.

script

A set of Rust APIs for processing Vue's <script> and <script setup>.

Roadmap

  • <script> support

    • Top-level declarations and imports;
    • data bindings;
    • props;
    • computed;
    • setup;
    • inject;
    • emits;
    • components;
    • methods;
    • expose;
    • name;
    • directives;
  • <script setup> support

    • Top-level declarations and imports;
    • Binding types (using bit-flags instead of enum);
    • Compiler macros:
      • defineProps(...) and defineProps<...>();
      • defineEmits;
      • defineExpose;
      • defineOptions;
      • defineSlots;
  • TypeScript support

  • Additional features

    • useCssVars;
    • Top-level await;
  • Compilation order

    • Analysis of scripts;
    • Merging scripts into an Options API object
      • Trivial field-by-field merging;
      • Non-trivial merging using { ...legacy, ...setup };
    • Attaching compiled template
      • Adding bindings return in DEV mode, then attaching a render function to the _sfc_ object;
      • Inlining template in PROD mode;
    • Attaching additional information: name, scope, etc.

Dependencies

~5–6.5MB
~155K SLoC