use async_trait::async_trait;
use crate::context::{
BuildContext, ContentContext, GraphContext, InitContext, OutputContext, RenderContext,
ValidationContext, WatchContext,
};
#[async_trait]
pub trait Plugin: Send + Sync {
fn name(&self) -> &str;
async fn on_init(
&self,
_ctx: &mut InitContext<'_>,
) -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
Ok(())
}
async fn on_build_start(
&self,
_ctx: &mut BuildContext<'_>,
) -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
Ok(())
}
async fn on_content_parsed(
&self,
_ctx: &mut ContentContext<'_>,
) -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
Ok(())
}
async fn on_graph_updated(
&self,
_ctx: &mut GraphContext<'_>,
) -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
Ok(())
}
async fn on_validation_complete(
&self,
_ctx: &mut ValidationContext<'_>,
) -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
Ok(())
}
async fn on_page_render(
&self,
_ctx: &mut RenderContext<'_>,
) -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
Ok(())
}
async fn on_build_complete(
&self,
_ctx: &mut OutputContext<'_>,
) -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
Ok(())
}
async fn on_file_changed(
&self,
_ctx: &mut WatchContext<'_>,
) -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
Ok(())
}
}