Class VanParser

java.lang.Object
dev.vanengine.core.compile.VanParser

public final class VanParser extends Object
Parser for .van files (Vue SFC syntax). Extracts template, script, style blocks and parses imports, props, and scoped styles.
  • Method Details

    • parseImports

      public static List<VanParser.VanImport> parseImports(String scriptSetup)
      Parse import X from './path.van' statements from a script setup block.
    • parseScriptImports

      public static List<VanParser.ScriptImport> parseScriptImports(String scriptSetup)
      Parse non-.van imports from a script setup block. Returns imports from .ts, .js, .tsx, .jsx files.
    • pascalToKebab

      public static String pascalToKebab(String s)
      Convert PascalCase to kebab-case: DefaultLayout -> default-layout.
    • parseBlocks

      public static VanParser.VanBlock parseBlocks(String source)
      Extract blocks from a .van source file.
    • parseDefineProps

      public static List<VanParser.PropDef> parseDefineProps(String script)
      Parse defineProps({ ... }) from a script setup block.
    • scopeId

      public static String scopeId(String content)
      Generate a deterministic 8-hex-char scope ID from content. Uses a simple hash to ensure same content always produces same ID.
    • addScopeClass

      public static String addScopeClass(String html, String id)
      Add a scope class to every opening HTML tag in the fragment. Skips closing tags, comments, and structural tags.
    • scopeCss

      public static String scopeCss(String css, String id)
      Scope CSS by inserting .{id} on selectors. Handles nested at-rules (@media, @supports, @container, @layer) via recursive descent, and passes @keyframes/@font-face through unmodified.