Skip to main content

CompilerPlugins

Trait CompilerPlugins 

Source
pub trait CompilerPlugins: Send + Sync {
    // Required methods
    fn transform_markup(
        &self,
        src: String,
        entry: &Path,
    ) -> Result<String, String>;
    fn transform_css(
        &self,
        src: String,
        entry: &Path,
        file: &Path,
    ) -> Result<String, String>;
    fn transform_ir(
        &self,
        ir: &mut LayoutIR,
        entry: &Path,
    ) -> Result<(), String>;
    fn finish(&self, ir: &LayoutIR, entry: &Path) -> Result<Vec<String>, String>;
}
Expand description

The loaded compiler-plugin chain of one app. Implemented in lumenc over the lumenc-plugin loader; every hook runs the declared plugins in lumen.toml order.

Required Methods§

Source

fn transform_markup(&self, src: String, entry: &Path) -> Result<String, String>

Rewrite the entry markup text, before <include> splicing.

Source

fn transform_css( &self, src: String, entry: &Path, file: &Path, ) -> Result<String, String>

Rewrite the entry stylesheet text, before @import splicing.

Source

fn transform_ir(&self, ir: &mut LayoutIR, entry: &Path) -> Result<(), String>

Transform the assembled tree, before asset resolution and the cascade.

Source

fn finish(&self, ir: &LayoutIR, entry: &Path) -> Result<Vec<String>, String>

Lint the cascaded tree and write emit outputs. Returns rendered diagnostic lines for the caller to print beside the built-in lint findings.

Implementors§