1use async_trait::async_trait;
2
3use crate::context::{
4 BuildContext, ContentContext, GraphContext, InitContext, OutputContext, RenderContext,
5 ValidationContext, WatchContext,
6};
7
8#[async_trait]
12pub trait Plugin: Send + Sync {
13 fn name(&self) -> &str;
15
16 async fn on_init(
18 &self,
19 _ctx: &mut InitContext<'_>,
20 ) -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
21 Ok(())
22 }
23
24 async fn on_build_start(
26 &self,
27 _ctx: &mut BuildContext<'_>,
28 ) -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
29 Ok(())
30 }
31
32 async fn on_content_parsed(
34 &self,
35 _ctx: &mut ContentContext<'_>,
36 ) -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
37 Ok(())
38 }
39
40 async fn on_graph_updated(
42 &self,
43 _ctx: &mut GraphContext<'_>,
44 ) -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
45 Ok(())
46 }
47
48 async fn on_validation_complete(
50 &self,
51 _ctx: &mut ValidationContext<'_>,
52 ) -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
53 Ok(())
54 }
55
56 async fn on_page_render(
58 &self,
59 _ctx: &mut RenderContext<'_>,
60 ) -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
61 Ok(())
62 }
63
64 async fn on_build_complete(
66 &self,
67 _ctx: &mut OutputContext<'_>,
68 ) -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
69 Ok(())
70 }
71
72 async fn on_file_changed(
74 &self,
75 _ctx: &mut WatchContext<'_>,
76 ) -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
77 Ok(())
78 }
79}