1use std::path::Path;
4
5use fallow_config::{ExternalPluginDef, PackageJson};
6
7use crate::core_backend;
8
9pub use crate::core_backend::{
11 CheckWarning, ManifestResult, RuleReport, WarningKind, check_manifest_entries,
12 is_external_plugin_active, workspace_activation_dependencies,
13};
14
15pub mod registry {
17 use crate::core_backend;
18
19 #[must_use]
25 pub fn builtin_plugin_names() -> Vec<&'static str> {
26 core_backend::builtin_plugin_names()
27 }
28
29 #[must_use]
33 pub fn builtin_config_lookup(
34 plugin_name: &str,
35 ) -> Option<(&'static [&'static str], &'static [&'static str])> {
36 core_backend::builtin_config_lookup(plugin_name)
37 }
38}
39
40#[derive(Debug, Clone, Default)]
42pub struct AggregatedPluginResult {
43 inner: core_backend::BackendAggregatedPluginResult,
44}
45
46impl AggregatedPluginResult {
47 #[must_use]
49 pub fn active_plugins(&self) -> &[String] {
50 self.inner.active_plugins()
51 }
52
53 #[must_use]
56 pub fn plugin_diagnostics(&self, root: &Path) -> Vec<fallow_config::WorkspaceDiagnostic> {
57 self.inner.plugin_diagnostics(root)
58 }
59
60 pub(crate) fn backend(&self) -> &core_backend::BackendAggregatedPluginResult {
61 &self.inner
62 }
63}
64
65impl From<core_backend::BackendAggregatedPluginResult> for AggregatedPluginResult {
66 fn from(inner: core_backend::BackendAggregatedPluginResult) -> Self {
67 Self { inner }
68 }
69}
70
71pub struct PluginRegistry {
73 inner: core_backend::BackendPluginRegistry,
74}
75
76impl PluginRegistry {
77 #[must_use]
79 pub(crate) fn new(external: Vec<ExternalPluginDef>) -> Self {
80 Self {
81 inner: core_backend::BackendPluginRegistry::new(external),
82 }
83 }
84
85 #[must_use]
87 pub(crate) fn discovery_hidden_dirs(&self, pkg: &PackageJson, root: &Path) -> Vec<String> {
88 self.inner.discovery_hidden_dirs(pkg, root)
89 }
90}
91
92impl Default for PluginRegistry {
93 fn default() -> Self {
94 Self::new(vec![])
95 }
96}
97
98#[cfg(test)]
99mod roster_tests {
100 #[test]
108 fn roster_carries_every_registered_plugin() {
109 let names = super::registry::builtin_plugin_names();
110 assert!(
111 names.contains(&"deno"),
112 "deno is registered in core and must reach the roster"
113 );
114 assert!(
115 names.len() > 100,
116 "roster looks truncated: {} names",
117 names.len()
118 );
119 }
120}