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.

Structs

The name of an attribute, i.e: lang in <script lang="ts">.

The value of an attribute, i.e: ts in <script lang="ts">.

A block as defined in the SFC specifications.

The name of a block, i.e: script in <script lang="ts">.

Error returned when an unexpected char is present.

Enums

A parsing error.

A Vue SFC section.

Functions

Parse the given input as a Vue SFC.

Type Definitions

Convenience type alias.