Expand description

vue-sfc

vue-sfc provides a parser and data structures needed to represent a Vue SFC.

Design

A Vue SFC is represented as a Vec<Section>, a Section can either be:

  • a Block, e.g:
    <template>
      <!-- content -->
    </template>
    <script lang="ts" setup>
      /* --snip-- */
    </script>
  • or something else, stored as a Section::Raw.

Parsing

See parse.

Printing

Block and Section implement std::fmt::Display. Note that, when printing, Section::Raw are end-trimmed.

Re-exports

pub use self::ast::Attribute;
pub use self::ast::AttributeName;
pub use self::ast::AttributeValue;
pub use self::ast::Block;
pub use self::ast::BlockName;
pub use self::ast::Section;
pub use self::parser::parse;

Modules

Structs

A generic error.