pub struct ExternalPluginDef {Show 13 fields
pub schema: Option<String>,
pub name: String,
pub detection: Option<PluginDetection>,
pub enablers: Vec<String>,
pub entry_points: Vec<String>,
pub entry_point_role: Option<EntryPointRole>,
pub manifest_entries: Vec<ManifestEntryRule>,
pub config_patterns: Vec<String>,
pub config_default_export_opt_out: Vec<String>,
pub always_used: Vec<String>,
pub tooling_dependencies: Vec<String>,
pub used_exports: Vec<ExternalUsedExport>,
pub used_class_members: Vec<UsedClassMemberRule>,
}Expand description
A declarative plugin definition loaded from a standalone file or inline config.
External plugins provide the same static pattern capabilities as built-in plugins (entry points, always-used files, used exports, tooling dependencies), but are defined in standalone files or inline in the fallow config rather than compiled Rust code.
They cannot do AST-based config parsing (resolve_config()), but cover the
vast majority of framework integration use cases.
Supports JSONC, JSON, and TOML formats. All use camelCase field names.
{
"$schema": "https://raw.githubusercontent.com/fallow-rs/fallow/main/plugin-schema.json",
"name": "my-framework",
"enablers": ["my-framework", "@my-framework/core"],
"entryPoints": ["src/routes/**/*.{ts,tsx}"],
"configPatterns": ["my-framework.config.{ts,js}"],
"alwaysUsed": ["src/setup.ts"],
"toolingDependencies": ["my-framework-cli"],
"usedExports": [
{ "pattern": "src/routes/**/*.{ts,tsx}", "exports": ["default", "loader", "action"] }
]
}Fields§
§schema: Option<String>JSON Schema reference (ignored during deserialization).
name: StringUnique name for this plugin.
detection: Option<PluginDetection>Rich detection logic (dependency checks, file existence, boolean combinators).
Takes priority over enablers when set.
enablers: Vec<String>Package names that activate this plugin when found in package.json.
Supports exact matches and prefix patterns (ending with /).
Only used when detection is not set. A plugin with neither detection
nor enablers never activates, and config load warns.
entry_points: Vec<String>Glob patterns for entry point files.
entry_point_role: Option<EntryPointRole>Coverage role for entryPoints.
Defaults to support. Set to runtime for application entry points
or test for test framework entry points. In production mode, a file
that only entries with an explicit support role match takes no part
in dead-code analysis.
manifest_entries: Vec<ManifestEntryRule>Entry points derived from framework manifest files.
Unlike entryPoints (static globs), each rule finds manifest files by a
recursive glob, parses them, and seeds sibling entries resolved relative
to each manifest’s directory, gated on the manifest’s own fields. Seeded
entries use this plugin’s entryPointRole.
config_patterns: Vec<String>Glob patterns for config files (marked as always-used when active).
config_default_export_opt_out: Vec<String>Entries of configPatterns whose files do not get the default
export credit under includeEntryExports. Use it when the tool reads
named exports, or when the pattern also matches ordinary source files.
Write each entry exactly as in configPatterns. Other entries have
no effect.
always_used: Vec<String>Files that are always considered “used” when this plugin is active.
tooling_dependencies: Vec<String>Dependencies that are tooling (used via CLI/config, not source imports). These should not be flagged as unused devDependencies.
used_exports: Vec<ExternalUsedExport>Exports that are always considered used for matching file patterns.
used_class_members: Vec<UsedClassMemberRule>Class member method/property rules the framework invokes at runtime.
Supports plain member names for global suppression and scoped objects
with extends / implements constraints when the method name is too
common to suppress across the whole workspace.
Implementations§
Source§impl ExternalPluginDef
impl ExternalPluginDef
Sourcepub const NEVER_ACTIVATES_REASON: &str = "no detection or enablers declared, so the plugin can never activate"
pub const NEVER_ACTIVATES_REASON: &str = "no detection or enablers declared, so the plugin can never activate"
The reason for a plugin with no activation condition. Config load and
fallow plugin-check both use it, so one state has one phrase.
Sourcepub fn effective_entry_point_role(&self) -> EntryPointRole
pub fn effective_entry_point_role(&self) -> EntryPointRole
The role of entryPoints: the configured role, else support.
Sourcepub fn has_explicit_support_role(&self) -> bool
pub fn has_explicit_support_role(&self) -> bool
Whether the config sets "entryPointRole": "support" explicitly.
Production mode leaves out only these support entries.
Sourcepub fn has_activation_condition(&self) -> bool
pub fn has_activation_condition(&self) -> bool
Whether the plugin declares something that can activate it. An empty
enablers list counts as no condition.
Sourcepub fn json_schema() -> Value
pub fn json_schema() -> Value
Generate JSON Schema for the external plugin format.
Sourcepub fn validate_user_globs(&self) -> Result<(), Vec<GlobValidationError>>
pub fn validate_user_globs(&self) -> Result<(), Vec<GlobValidationError>>
Validate all user-supplied glob patterns on this plugin definition,
including patterns nested inside detection combinators (all / any).
Pattern names use the same framework[].<field> notation used by
inline plugin definitions in FallowConfig::validate_user_globs so the
user sees consistent field paths whether the plugin is inline or
loaded from .fallow/plugins/ / fallow-plugin-*.{toml,json,jsonc}.
§Errors
Returns a non-empty Vec of
GlobValidationError
when any pattern is rejected.
Trait Implementations§
Source§impl Clone for ExternalPluginDef
impl Clone for ExternalPluginDef
Source§impl Debug for ExternalPluginDef
impl Debug for ExternalPluginDef
Source§impl<'de> Deserialize<'de> for ExternalPluginDef
impl<'de> Deserialize<'de> for ExternalPluginDef
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for ExternalPluginDef
impl JsonSchema for ExternalPluginDef
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more