3 releases (breaking)

0.2.0 Jul 7, 2024
0.1.0 Nov 27, 2023
0.0.1 Aug 7, 2023

#995 in Development tools

Download history 42/week @ 2024-07-27 1/week @ 2024-08-03 3/week @ 2024-08-17 14/week @ 2024-08-24 28/week @ 2024-08-31 20/week @ 2024-09-07 28/week @ 2024-09-14 43/week @ 2024-09-21 20/week @ 2024-09-28 4/week @ 2024-10-05 12/week @ 2024-10-12 28/week @ 2024-10-19 22/week @ 2024-10-26 13/week @ 2024-11-02 3/week @ 2024-11-09

66 downloads per month
Used in 4 crates (3 directly)

Apache-2.0

375KB
8K 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(...);
      • defineProps<...>();
      • defineEmits(...);
      • 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

~15MB
~290K SLoC