Skip to main content

Crate van_parser

Crate van_parser 

Source

Structs§

PropDef
A single prop declaration from defineProps({ ... }).
ScriptImport
A non-component import from <script setup> (.ts/.js files).
VanBlock
Represents the extracted blocks from a .van file.
VanImport
Represents an import from a <script setup> block.

Functions§

add_scope_class
Add a scope class to every opening HTML tag in the fragment.
parse_blocks
Extract blocks from a .van source file using simple tag matching.
parse_define_props
Parse defineProps({ ... }) from a script setup block.
parse_imports
Parse import X from './path.van' statements from a script setup block. Supports both relative paths (./foo.van, ../bar.van) and scoped packages (@scope/pkg/file.van).
parse_script_imports
Parse non-.van imports from a script setup block. Returns imports from .ts, .js, .tsx, .jsx files. Supports both relative paths and scoped packages (@scope/pkg/file.ts). Excludes: .van imports (handled by parse_imports), bare module imports like ‘vue’.
pascal_to_kebab
Convert PascalCase to kebab-case: DefaultLayoutdefault-layout
scope_css
Scope CSS by inserting .{id} before any pseudo-class/pseudo-element on the last simple selector of each rule.
scope_id
Generate a deterministic 8-hex-char scope ID from content (typically CSS).