Started plugin interface crate
This commit is contained in:
parent
6dc49bc068
commit
b34afb3e98
6 changed files with 3092 additions and 0 deletions
3017
Cargo.lock
generated
3017
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -5,4 +5,5 @@ resolver = "3"
|
||||||
members = [
|
members = [
|
||||||
"zssg",
|
"zssg",
|
||||||
"zssg-plugin",
|
"zssg-plugin",
|
||||||
|
"zssg-plugin-interface",
|
||||||
]
|
]
|
||||||
|
|
|
||||||
8
zssg-plugin-interface/Cargo.toml
Normal file
8
zssg-plugin-interface/Cargo.toml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "zssg-plugin-interface"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
facet = "0.27.0"
|
||||||
|
toml = "0.8.22"
|
||||||
29
zssg-plugin-interface/src/description.rs
Normal file
29
zssg-plugin-interface/src/description.rs
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
|
||||||
|
pub struct PluginDescription {
|
||||||
|
pub name: String,
|
||||||
|
pub template_engines: Vec<TemplateEngineDescription>,
|
||||||
|
pub markup_engines: Vec<MarkupEngineDescription>,
|
||||||
|
pub page_data_sources: Vec<PageDataSource>,
|
||||||
|
pub rendered_page_sources: Vec<RenderedArtefactSource>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct TemplateEngineDescription {
|
||||||
|
pub name: String,
|
||||||
|
pub filename_patterns: Vec<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct MarkupEngineDescription {
|
||||||
|
pub name: String,
|
||||||
|
pub filename_patterns: Vec<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct PageDataSource {
|
||||||
|
pub name: String,
|
||||||
|
pub order: Option<u32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct RenderedArtefactSource {
|
||||||
|
pub name: String,
|
||||||
|
pub order: Option<u32>,
|
||||||
|
}
|
||||||
|
|
||||||
21
zssg-plugin-interface/src/lib.rs
Normal file
21
zssg-plugin-interface/src/lib.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
pub mod description;
|
||||||
|
pub mod template_engine;
|
||||||
|
|
||||||
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
|
pub enum ConfigValue {
|
||||||
|
String(String),
|
||||||
|
Integer(i64),
|
||||||
|
Float(f64),
|
||||||
|
Boolean(bool),
|
||||||
|
Array(Array),
|
||||||
|
Table(Table),
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type Array = Vec<ConfigValue>;
|
||||||
|
pub type Table = BTreeMap<String, ConfigValue>;
|
||||||
|
|
||||||
|
pub struct PluginConfig {
|
||||||
|
pub wasi_enabled: bool,
|
||||||
|
pub config: toml::Table,
|
||||||
|
}
|
||||||
16
zssg-plugin-interface/src/template_engine.rs
Normal file
16
zssg-plugin-interface/src/template_engine.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
pub struct TemplateRenderRequest {
|
||||||
|
pub source: String,
|
||||||
|
pub path: PathBuf,
|
||||||
|
pub front_matter: (),
|
||||||
|
}
|
||||||
|
|
||||||
|
pub enum TemplateRenderResponse {
|
||||||
|
Success {
|
||||||
|
rendered: String
|
||||||
|
},
|
||||||
|
Failure {
|
||||||
|
error: String,
|
||||||
|
},
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue