Class VanCompiler

java.lang.Object
dev.vanengine.core.VanCompiler
All Implemented Interfaces:
AutoCloseable

public class VanCompiler extends Object implements AutoCloseable
Manages a long-lived van-compiler-wasi daemon subprocess and provides .van file compilation with mtime-based caching.

Lifecycle: call init() to start the daemon, close() to stop it.

  • Constructor Details

    • VanCompiler

      public VanCompiler()
  • Method Details

    • setGlobalName

      public void setGlobalName(String globalName)
    • getGlobalName

      public String getGlobalName()
    • init

      public void init() throws Exception
      Throws:
      Exception
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • compile

      public VanCompiler.CompiledResult compile(Path vanFile, Path basePath) throws IOException
      Compile a .van file, returning cached results when the file hasn't changed.
      Parameters:
      vanFile - path to the .van entry file
      basePath - base directory for resolving relative imports
      Returns:
      compiled HTML string
      Throws:
      IOException
    • compile

      public VanCompiler.CompiledResult compile(String entryPath, Map<String,String> files) throws IOException
      Compile with an explicit files map (for classpath resources).
      Throws:
      IOException
    • parseImportPaths

      public static List<String> parseImportPaths(String content)
      Extract component import paths from .van file content. Matches: import XxxYyy from './path.van' or "../path.van"