Skip to main content

fallow_core/plugins/
mod.rs

1//! Plugin system for framework-aware codebase analysis.
2//!
3//! Plugins read JS, TS and JSON config files with the Oxc parser and walk the
4//! AST. They never run JavaScript. Each plugin implements the [`Plugin`] trait
5//! with static defaults (entry patterns, config file patterns, used exports)
6//! and reads config files for entries, dependencies and setup files.
7
8use std::path::{Path, PathBuf};
9
10use fallow_config::{
11    AutoImportRule, EntryPointRole, JsxImportSourceRule, PackageJson, UsedClassMemberRule,
12};
13use fallow_types::semantic::SemanticFrameworkContract;
14use regex::Regex;
15
16use entry_point_roles::builtin_entry_point_role;
17#[cfg(test)]
18use entry_point_roles::{
19    RUNTIME_ENTRY_POINT_PLUGINS, SUPPORT_ENTRY_POINT_PLUGINS, TEST_ENTRY_POINT_PLUGINS,
20};
21
22/// Whether an entry rule of `result` matches the project-relative `path`, as
23/// entry point discovery compiles and matches the rules.
24#[cfg(test)]
25fn entry_rules_match(result: &PluginResult, path: &str) -> bool {
26    result
27        .entry_patterns
28        .iter()
29        .filter_map(|rule| CompiledPathRule::for_entry_rule(rule, "entry pattern"))
30        .any(|rule| rule.matches(path))
31}
32
33/// Which workspace diagnostic kind a plugin-stage advisory becomes.
34#[derive(Debug, Clone, Copy, PartialEq, Eq)]
35pub enum PluginConfigEffect {
36    /// The plugin could not read the key in full, so part of what it declares
37    /// never reached the analysis.
38    Unreadable,
39    /// The plugin read the key and does not model its effect, so a modeled
40    /// default the run would otherwise have applied stood down.
41    NotModeled,
42}
43
44/// One advisory about a config file a plugin read, before it becomes a
45/// [`fallow_config::WorkspaceDiagnostic`].
46///
47/// A plugin knows the fact (which config file, which key, why) but not the root
48/// the message renders against: in a workspace run its own `root` is the package
49/// root, while the diagnostic's path and message are project-root-relative. The
50/// conversion therefore happens once, where every plugin result has converged on
51/// the project root, and `config_path` is kept ABSOLUTE until then so the
52/// registry's canonical dedupe and the serialized root-relative form both work
53/// from one value (issue #2736).
54#[derive(Debug, Clone, PartialEq, Eq)]
55pub struct PluginConfigDiagnostic {
56    /// Absolute path of the config file that was read.
57    pub config_path: PathBuf,
58    /// The plugin that read it, as it labels itself. Module Federation options
59    /// reach four bundler plugins inline, and each names itself rather than the
60    /// reader, because the config file the user must edit is the bundler's.
61    pub plugin: String,
62    /// The config key the advisory is about (`exposes`, `remotes`,
63    /// `components`, `imports`).
64    pub key: String,
65    /// Why, as a kebab-case token from the resulting kind's open set.
66    pub reason: String,
67    /// Which workspace diagnostic kind this becomes.
68    pub effect: PluginConfigEffect,
69}
70
71impl PluginConfigDiagnostic {
72    /// Build an advisory about a key a plugin could not read in full.
73    pub(super) fn unreadable(
74        config_path: &Path,
75        plugin: &str,
76        key: &str,
77        reason: &'static str,
78    ) -> Self {
79        Self {
80            config_path: config_path.to_path_buf(),
81            plugin: plugin.to_owned(),
82            key: key.to_owned(),
83            reason: reason.to_owned(),
84            effect: PluginConfigEffect::Unreadable,
85        }
86    }
87
88    /// Build an advisory about a key whose effect the plugin does not model.
89    pub(crate) fn not_modeled(
90        config_path: &Path,
91        plugin: &str,
92        key: &str,
93        reason: &'static str,
94    ) -> Self {
95        Self {
96            config_path: config_path.to_path_buf(),
97            plugin: plugin.to_owned(),
98            key: key.to_owned(),
99            reason: reason.to_owned(),
100            effect: PluginConfigEffect::NotModeled,
101        }
102    }
103
104    /// Render this advisory against the PROJECT root, which is the root every
105    /// consumer's paths are relative to.
106    #[must_use]
107    pub fn into_workspace_diagnostic(self, root: &Path) -> fallow_config::WorkspaceDiagnostic {
108        let Self {
109            config_path,
110            plugin,
111            key,
112            reason,
113            effect,
114        } = self;
115        let kind = match effect {
116            PluginConfigEffect::Unreadable => {
117                fallow_config::WorkspaceDiagnosticKind::PluginConfigUnreadable {
118                    plugin,
119                    key,
120                    reason,
121                }
122            }
123            PluginConfigEffect::NotModeled => {
124                fallow_config::WorkspaceDiagnosticKind::PluginEffectNotModeled {
125                    plugin,
126                    key,
127                    reason,
128                }
129            }
130        };
131        fallow_config::WorkspaceDiagnostic::new(root, config_path, kind)
132    }
133}
134
135/// Result of resolving a plugin's config file.
136#[derive(Debug, Default)]
137pub struct PluginResult {
138    /// Additional entry point glob patterns discovered from config.
139    entry_patterns: Vec<PathRule>,
140    /// When true, `entry_patterns` from config replace the plugin's static
141    /// `entry_patterns()` defaults instead of adding to them. Tools like Vitest
142    /// and Jest treat their config's include/testMatch as a replacement for built-in
143    /// defaults, so when the config is explicit the static patterns must be dropped.
144    replace_entry_patterns: bool,
145    /// When true, a replacing config removes only the static defaults, and the
146    /// replacing configs of one plugin run add their patterns together. When
147    /// false, the last replacing config of the plugin wins.
148    accumulate_config_entry_patterns: bool,
149    /// When true, `used_exports` from config replace the plugin's static
150    /// `used_export_rules()` defaults instead of adding to them.
151    replace_used_export_rules: bool,
152    /// Additional export-usage rules discovered from config.
153    used_exports: Vec<UsedExportRule>,
154    /// Exports that the tool reads from the files a config names. These rules
155    /// join the config-file export credit, so they count only under
156    /// `includeEntryExports`. Unlike `used_exports`, they never make an entry
157    /// point reportable when `includeEntryExports` is off.
158    entry_export_credits: Vec<UsedExportRule>,
159    /// Class member rules that should never be flagged as unused. Contributed
160    /// by plugins that know their framework invokes these methods at runtime
161    /// and may scope suppression via `extends` / `implements` constraints when
162    /// the method name is too common to allowlist globally.
163    used_class_members: Vec<UsedClassMemberRule>,
164    /// Dependencies referenced in config files (should not be flagged as unused).
165    referenced_dependencies: Vec<String>,
166    /// Dependencies a config credits only to the package that owns it, keyed
167    /// by the path of that package's `package.json`.
168    package_referenced_dependencies: Vec<(PathBuf, String)>,
169    /// Packages that a config needs installed. See [`RequiredDependency`].
170    required_dependencies: Vec<RequiredDependency>,
171    /// Additional files that are always considered used.
172    always_used_files: Vec<String>,
173    /// Path alias mappings discovered from config (prefix -> replacement directory).
174    path_aliases: Vec<(String, String)>,
175    /// The prefixes of the `path_aliases` that point at a directory that the
176    /// config names. An unresolved import under one of these prefixes reports,
177    /// also when a virtual module prefix of the plugin matches it.
178    checked_alias_prefixes: Vec<String>,
179    /// Setup/helper files referenced from config.
180    setup_files: Vec<PathBuf>,
181    /// Test fixture glob patterns discovered from config.
182    fixture_patterns: Vec<String>,
183    /// Absolute directories to include when resolving SCSS/Sass `@import` and
184    /// `@use` specifiers. Contributed by framework plugins that read their
185    /// tool's equivalent of `includePaths` (e.g. Angular's
186    /// `stylePreprocessorOptions.includePaths` from `angular.json` /
187    /// `project.json`). Bare SCSS specifiers that fail to resolve relative to
188    /// the importing file retry against each include path using the SCSS
189    /// partial / directory-index conventions.
190    scss_include_paths: Vec<PathBuf>,
191    /// URL-to-filesystem static directory mappings discovered from tool config.
192    /// Each tuple is `(absolute_source_dir, normalized_url_mount)`.
193    static_dir_mappings: Vec<(PathBuf, String)>,
194    framework_static_dir_mappings: Vec<(PathBuf, String)>,
195    /// File-scoped dependency providers. Matching imports are considered
196    /// available from the framework runtime and are not unlisted dependencies.
197    provided_dependencies: Vec<ProvidedDependencyRule>,
198    /// Advisories about the config file this result was read from. A plugin
199    /// records the fact here instead of printing it, so it reaches the report
200    /// and every consumer rather than only a stderr line.
201    config_diagnostics: Vec<PluginConfigDiagnostic>,
202    /// Where a Module Federation config exposes a file or declares a remote
203    /// alias, kept so a trace can name the config (issue #2796).
204    federation_sources: Vec<FederationSource>,
205    /// JSX import sources that the config sets for the files it transforms.
206    /// The resolver adds the runtime edge to each matching file without a
207    /// JSX pragma.
208    jsx_import_sources: Vec<JsxImportSourceRule>,
209    /// Runtime packages that the JSX transform of a config imports when the
210    /// config sets no import source. The analysis credits a package only when
211    /// a matching file has JSX and no pragma. These rules never add a graph
212    /// edge.
213    jsx_package_credits: Vec<JsxImportSourceRule>,
214    /// The directories of the tsconfig files that set the JSX runtime of
215    /// TypeScript files, each with the runtime that the tsconfig selects.
216    /// Vite then does not use its own default runtime for the TypeScript
217    /// files below these directories.
218    tsconfig_jsx_dirs: Vec<registry::TsconfigJsxDir>,
219    /// The directories of the apps that an end-to-end runner starts as its
220    /// web server. See [`web_server_app`].
221    web_server_app_dirs: Vec<PathBuf>,
222}
223
224/// Match the Module Federation sources of one analysis against the discovered
225/// files, for the trace output.
226///
227/// Only a project with a Federation config pays for the match, and it runs
228/// once per analysis, so a trace reads plain data. A remote that a literal
229/// runtime call (`registerRemotes`, `loadRemote`, `init`, `createInstance`) names traces to the source
230/// file, with the function name as the key.
231#[must_use]
232fn federation_trace_provenance(
233    root: &Path,
234    files: &[crate::discover::DiscoveredFile],
235    sources: &[FederationSource],
236    modules: &[crate::extract::ModuleInfo],
237) -> fallow_types::trace::TraceProvenance {
238    let mut provenance = fallow_types::trace::TraceProvenance::default();
239    push_runtime_remote_sources(&mut provenance, root, files, modules);
240    if sources.is_empty() {
241        return provenance;
242    }
243    let mut exposed = Vec::new();
244    for source in sources {
245        let config = source
246            .config_path
247            .strip_prefix(root)
248            .unwrap_or(&source.config_path)
249            .to_path_buf();
250        let trace_source = fallow_types::trace::TraceSource {
251            kind: "module-federation".to_owned(),
252            plugin: source.plugin.clone(),
253            config,
254            key: source.key.to_owned(),
255        };
256        match &source.target {
257            FederationSourceTarget::Exposed(rule) => {
258                if let Some(compiled) =
259                    CompiledPathRule::for_entry_rule(rule, "Module Federation exposes target")
260                {
261                    exposed.push((compiled, trace_source));
262                }
263            }
264            FederationSourceTarget::Remote(alias) => {
265                provenance.push_dependency(alias.clone(), trace_source);
266            }
267        }
268    }
269    if exposed.is_empty() {
270        return provenance;
271    }
272    for file in files {
273        let Ok(relative) = file.path.strip_prefix(root) else {
274            continue;
275        };
276        let relative_str = relative.to_string_lossy().replace('\\', "/");
277        for (rule, source) in &exposed {
278            if rule.matches(&relative_str) {
279                provenance.push_file(relative.to_path_buf(), source.clone());
280            }
281        }
282    }
283    provenance
284}
285
286/// Export names that frameworks read as configuration, not as code.
287///
288/// A plugin `used_exports` rule can list these names next to real handlers
289/// (Next.js lists `dynamic` next to `GET` and `default`). Only a listed name
290/// with a literal value counts as configuration, so the review brief does not
291/// ask for a test of it. Extend this set when a new plugin adds a
292/// configuration-only export. Never add a name that holds behavior, such as
293/// `generateMetadata`, `loader` or a route handler.
294const CONFIG_ONLY_EXPORT_NAMES: &[&str] = &[
295    "dynamic",
296    "dynamicParams",
297    "revalidate",
298    "fetchCache",
299    "runtime",
300    "preferredRegion",
301    "maxDuration",
302    "prerender",
303    "config",
304    "metadata",
305    "viewport",
306];
307
308/// Record why the unused devDependency check credits each plugin tooling
309/// dependency, so `--trace-dependency` explains the credit instead of calling
310/// the dependency unused.
311fn push_tooling_trace_credits(
312    provenance: &mut fallow_types::trace::TraceProvenance,
313    root: &Path,
314    workspaces: &[fallow_config::WorkspaceInfo],
315    plugin_result: &AggregatedPluginResult,
316) {
317    for entry in &plugin_result.plugin_tooling {
318        let Some(evidence) = entry.evidence(&plugin_result.script_used_packages) else {
319            continue;
320        };
321        let credit = match evidence {
322            PluginToolingEvidence::OwnConfig(config) => fallow_types::trace::ToolingCredit {
323                reason: "plugin-config".to_owned(),
324                plugin: Some(entry.plugin.clone()),
325                config: Some(config.strip_prefix(root).unwrap_or(config).to_path_buf()),
326                reference: None,
327            },
328            PluginToolingEvidence::Reference(name) => fallow_types::trace::ToolingCredit {
329                reason: "plugin-reference".to_owned(),
330                plugin: Some(entry.plugin.clone()),
331                config: None,
332                reference: Some(name.to_owned()),
333            },
334        };
335        for dependency in &entry.dependencies {
336            provenance.push_tooling_credit(dependency.clone(), credit.clone());
337        }
338    }
339    push_types_trace_credits(provenance, plugin_result);
340    push_catalogue_trace_credits(provenance, root, workspaces, plugin_result);
341}
342
343/// Record why the unused devDependency check credits each catalogue entry in
344/// `devDependencies` that the trace would otherwise call unused: a library
345/// entry by name, a command-line tool by its own config file or its
346/// package.json key, and any entry that the same manifest lists in
347/// `peerDependencies`.
348///
349/// The check reads each declaring manifest on its own, so a credit here comes
350/// from a manifest that declares the name. A config in a sibling workspace
351/// gives no credit.
352fn push_catalogue_trace_credits(
353    provenance: &mut fallow_types::trace::TraceProvenance,
354    root: &Path,
355    workspaces: &[fallow_config::WorkspaceInfo],
356    plugin_result: &AggregatedPluginResult,
357) {
358    let manifests = read_trace_manifests(root, workspaces);
359    let mut names: Vec<&String> = plugin_result.dev_dependency_names.iter().collect();
360    names.sort_unstable();
361    for name in names {
362        let declaring: Vec<&(PathBuf, serde_json::Value)> = manifests
363            .iter()
364            .filter(|(_, manifest)| manifest_lists(manifest, "devDependencies", name))
365            .collect();
366        if let Some(credit) = catalogue_credit(name, root, &declaring) {
367            provenance.push_tooling_credit(name.clone(), credit);
368        }
369        if let Some((path, _)) = declaring
370            .iter()
371            .find(|(_, manifest)| manifest_lists(manifest, "peerDependencies", name))
372        {
373            provenance.push_tooling_credit(
374                name.clone(),
375                fallow_types::trace::ToolingCredit {
376                    reason: "own-peer".to_owned(),
377                    plugin: None,
378                    config: Some(path.strip_prefix(root).unwrap_or(path).to_path_buf()),
379                    reference: None,
380                },
381            );
382        }
383    }
384}
385
386/// The root manifest and each workspace manifest, parsed, root first.
387fn read_trace_manifests(
388    root: &Path,
389    workspaces: &[fallow_config::WorkspaceInfo],
390) -> Vec<(PathBuf, serde_json::Value)> {
391    std::iter::once(root)
392        .chain(
393            workspaces
394                .iter()
395                .map(|ws| ws.root.as_path())
396                .filter(|ws_root| *ws_root != root),
397        )
398        .filter_map(|package_root| {
399            let path = package_root.join("package.json");
400            let content = crate::discover::project_read::read_project_file(root, &path)?;
401            serde_json::from_str(&content)
402                .ok()
403                .map(|value| (path, value))
404        })
405        .collect()
406}
407
408fn manifest_lists(manifest: &serde_json::Value, section: &str, name: &str) -> bool {
409    manifest
410        .get(section)
411        .and_then(serde_json::Value::as_object)
412        .is_some_and(|deps| deps.contains_key(name))
413}
414
415/// The catalogue credit of `name` from the first declaring manifest that the
416/// unused devDependency check credits.
417fn catalogue_credit(
418    name: &str,
419    root: &Path,
420    declaring: &[&(PathBuf, serde_json::Value)],
421) -> Option<fallow_types::trace::ToolingCredit> {
422    if is_ambient_types_package(name) || types_package_target(name).is_some() {
423        return None;
424    }
425    let Some(patterns) = cli_tooling_config_patterns(name) else {
426        return is_known_tooling_dependency(name).then(|| fallow_types::trace::ToolingCredit {
427            reason: "known-tooling".to_owned(),
428            plugin: None,
429            config: None,
430            reference: None,
431        });
432    };
433    let config = declaring.iter().find_map(|(path, manifest)| {
434        crate::analyze::cli_tool_own_config(name, patterns, root, path, Some(manifest))
435    })?;
436    Some(fallow_types::trace::ToolingCredit {
437        reason: "known-tooling-config".to_owned(),
438        plugin: None,
439        config: Some(config.strip_prefix(root).unwrap_or(&config).to_path_buf()),
440        reference: None,
441    })
442}
443
444/// Record why the unused devDependency check credits each type package in
445/// `devDependencies`: ambient globals, a declared target package, or a
446/// tsconfig `types` entry. A target that the code imports is credited by the trace
447/// itself, which reads the module graph.
448fn push_types_trace_credits(
449    provenance: &mut fallow_types::trace::TraceProvenance,
450    plugin_result: &AggregatedPluginResult,
451) {
452    let declared = plugin_result.dependency_binaries.declared_packages();
453    let mut names: Vec<&String> = plugin_result.dev_dependency_names.iter().collect();
454    names.sort_unstable();
455    for name in names {
456        let credit = if is_ambient_types_package(name) {
457            fallow_types::trace::ToolingCredit {
458                reason: "ambient-types".to_owned(),
459                plugin: None,
460                config: None,
461                reference: None,
462            }
463        } else if let Some(target) = types_package_target(name) {
464            if declared.contains(&target) {
465                fallow_types::trace::ToolingCredit {
466                    reason: "types-target".to_owned(),
467                    plugin: None,
468                    config: None,
469                    reference: Some(target),
470                }
471            } else if plugin_result.referenced_dependencies.contains(name) {
472                fallow_types::trace::ToolingCredit {
473                    reason: "types-config".to_owned(),
474                    plugin: None,
475                    config: None,
476                    reference: None,
477                }
478            } else {
479                continue;
480            }
481        } else {
482            continue;
483        };
484        provenance.push_tooling_credit(name.clone(), credit);
485    }
486}
487
488/// Add a trace source for each remote that a literal runtime call names.
489fn push_runtime_remote_sources(
490    provenance: &mut fallow_types::trace::TraceProvenance,
491    root: &Path,
492    files: &[crate::discover::DiscoveredFile],
493    modules: &[crate::extract::ModuleInfo],
494) {
495    for module in modules {
496        let mut file = None;
497        for fact in module.semantic_facts.iter() {
498            let fallow_types::extract::SemanticFact::FederationRuntimeRemote(fact) = fact else {
499                continue;
500            };
501            let Some(remote) = &fact.remote else {
502                continue;
503            };
504            let Some(path) = file.get_or_insert_with(|| {
505                files.get(module.file_id.0 as usize).map(|file| {
506                    file.path
507                        .strip_prefix(root)
508                        .unwrap_or(&file.path)
509                        .to_path_buf()
510                })
511            }) else {
512                break;
513            };
514            provenance.push_dependency(
515                remote.clone(),
516                fallow_types::trace::TraceSource {
517                    kind: "module-federation".to_owned(),
518                    plugin: "module-federation".to_owned(),
519                    config: path.clone(),
520                    key: fact.call.name().to_owned(),
521                },
522            );
523        }
524    }
525}
526
527impl PluginResult {
528    /// Register `entry` values that a bundler reads relative to the directory
529    /// of its config file. The project root run and the workspace run can read
530    /// the same config, so each value is anchored at the config directory. A
531    /// value with a leading `!` excludes its matches from every other value.
532    fn extend_config_dir_entry_patterns(
533        &mut self,
534        values: Vec<String>,
535        config_path: &Path,
536        root: &Path,
537    ) {
538        let (negated, positive): (Vec<String>, Vec<String>) =
539            values.into_iter().partition(|value| value.starts_with('!'));
540        let excluded: Vec<String> = negated
541            .iter()
542            .filter_map(|value| value.strip_prefix('!'))
543            .filter_map(|value| config_parser::normalize_config_path(value, config_path, root))
544            .collect();
545        self.entry_patterns.extend(
546            positive
547                .iter()
548                .filter_map(|value| config_parser::normalize_config_path(value, config_path, root))
549                .map(|pattern| {
550                    PathRule::new(pattern).with_excluded_globs(excluded.iter().cloned())
551                }),
552        );
553    }
554
555    /// Register an entry pattern whose leading `../` segments are relative to
556    /// the plugin root. The workspace prefix resolves them.
557    fn push_parent_relative_entry_pattern(&mut self, pattern: String) {
558        let mut rule = PathRule::new(pattern);
559        rule.parent_relative = true;
560        self.entry_patterns.push(rule);
561    }
562
563    fn push_entry_pattern(&mut self, pattern: impl Into<String>) {
564        self.entry_patterns
565            .push(PathRule::new(normalize_entry_pattern(pattern.into())));
566    }
567
568    fn extend_entry_patterns<I, S>(&mut self, patterns: I)
569    where
570        I: IntoIterator<Item = S>,
571        S: Into<String>,
572    {
573        self.entry_patterns.extend(
574            patterns
575                .into_iter()
576                .map(|pat| PathRule::new(normalize_entry_pattern(pat.into()))),
577        );
578    }
579
580    /// Route each config value to the surface that can use it: a value naming a
581    /// module request credits its package, every other value becomes an entry
582    /// pattern.
583    ///
584    /// A bundler `entry` accepts a project file and a bare module request such as
585    /// `react-hot-loader/patch` in the same list. A module request names no file,
586    /// so a glob built from it matches nothing while the package still needs
587    /// dependency credit. Module Federation `exposes` targets already split the
588    /// two this way (issue #2706); bundler entries now do too (issue #2739).
589    ///
590    /// `resolve_path` maps a path value to its project-relative form, for
591    /// example against a `context` directory. It runs after the value is
592    /// classified, because a joined path such as `app/main` no longer carries
593    /// the `./` that marks it as a path.
594    fn extend_entry_patterns_or_dependencies<I, S>(
595        &mut self,
596        values: I,
597        resolve_path: impl Fn(String) -> String,
598    ) where
599        I: IntoIterator<Item = S>,
600        S: Into<String>,
601    {
602        for value in values {
603            let value = value.into();
604            if let Some(request) = module_request(&value) {
605                self.referenced_dependencies
606                    .push(crate::resolve::extract_package_name(request));
607                continue;
608            }
609            self.push_entry_path(resolve_path(value));
610        }
611    }
612
613    /// Route each value of a rollup-style `input` to both surfaces when it is
614    /// ambiguous.
615    ///
616    /// Rollup, rolldown and vite resolve an `input` value with no importer: a
617    /// resolve plugin can read it as a module request, and without one it is a
618    /// path relative to the working directory. A value without `./`, `../` or
619    /// `/`, without a source extension and without glob syntax can therefore
620    /// name either one. It keeps the entry pattern, and it credits the package
621    /// unless the value names a file under `root`. A value that names a
622    /// project file is a path, so it must not hide an unused package that has
623    /// the same first segment (issue #2753).
624    fn extend_entry_patterns_and_dependencies<I, S>(&mut self, values: I, root: &Path)
625    where
626        I: IntoIterator<Item = S>,
627        S: Into<String>,
628    {
629        for value in values {
630            let value = value.into();
631            if let Some(request) = module_request(&value)
632                && !names_project_file(root, request)
633            {
634                self.referenced_dependencies
635                    .push(crate::resolve::extract_package_name(request));
636            }
637            self.push_entry_path(value);
638        }
639    }
640
641    /// Register each value as a bundler entry path.
642    fn extend_entry_paths<I, S>(&mut self, values: I)
643    where
644        I: IntoIterator<Item = S>,
645        S: Into<String>,
646    {
647        for value in values {
648            self.push_entry_path(value.into());
649        }
650    }
651
652    /// Register a bundler entry path.
653    ///
654    /// A bundler resolves an entry without a source extension the way it
655    /// resolves an import: first as a file with each extension, then as a
656    /// directory through its index file. `./lib` therefore names
657    /// `lib/index.ts`, and `./src/app` names `src/app.ts`. The value as written
658    /// stays a pattern too, so a file without an extension still matches.
659    fn push_entry_path(&mut self, value: String) {
660        if has_glob_syntax(&value) || has_source_extension(&value) {
661            self.push_entry_pattern(value);
662            return;
663        }
664        let base = value.trim_end_matches('/').to_owned();
665        self.push_entry_pattern(value);
666        self.push_entry_pattern(format!("{base}.{REQUEST_EXTENSIONS}"));
667        self.push_entry_pattern(format!("{base}/index.{REQUEST_EXTENSIONS}"));
668    }
669
670    /// Add a path alias to a directory that the config names. A missing target
671    /// under the alias is an unresolved import, also when a virtual module
672    /// prefix of the plugin matches the specifier.
673    fn push_checked_path_alias(&mut self, prefix: String, replacement: String) {
674        self.checked_alias_prefixes.push(prefix.clone());
675        self.path_aliases.push((prefix, replacement));
676    }
677
678    /// Whether this result contributes nothing, which lets the registry skip a
679    /// config file entirely.
680    ///
681    /// A config that yields only a diagnostic is NOT empty: an unreadable
682    /// `exposes` in a config that declares nothing else is exactly the case the
683    /// advisory exists for, and skipping the result would drop it.
684    #[must_use]
685    const fn is_empty(&self) -> bool {
686        self.config_diagnostics.is_empty() && self.has_no_credits() && self.has_no_paths()
687    }
688
689    /// Whether the result adds no entry, export or dependency credit.
690    const fn has_no_credits(&self) -> bool {
691        self.entry_patterns.is_empty()
692            && self.used_exports.is_empty()
693            && self.entry_export_credits.is_empty()
694            && self.used_class_members.is_empty()
695            && self.referenced_dependencies.is_empty()
696            && self.package_referenced_dependencies.is_empty()
697            && self.required_dependencies.is_empty()
698            && self.provided_dependencies.is_empty()
699            && self.jsx_import_sources.is_empty()
700            && self.jsx_package_credits.is_empty()
701    }
702
703    /// Whether the result adds no file, folder or path mapping.
704    const fn has_no_paths(&self) -> bool {
705        self.always_used_files.is_empty()
706            && self.path_aliases.is_empty()
707            && self.setup_files.is_empty()
708            && self.fixture_patterns.is_empty()
709            && self.scss_include_paths.is_empty()
710            && self.static_dir_mappings.is_empty()
711            && self.framework_static_dir_mappings.is_empty()
712            && self.federation_sources.is_empty()
713            && self.tsconfig_jsx_dirs.is_empty()
714            && self.web_server_app_dirs.is_empty()
715    }
716}
717
718/// Brace list of the extensions a bundler tries for a request that names no
719/// extension. Entry patterns are plain globs with no extension expansion, so a
720/// bare `src/Button` would match no file.
721const REQUEST_EXTENSIONS: &str = "{ts,tsx,mts,cts,gts,js,jsx,mjs,cjs,gjs,vue,svelte,astro,mdx}";
722
723fn normalize_entry_pattern(pattern: String) -> String {
724    pattern
725        .strip_prefix("./")
726        .map(str::to_owned)
727        .unwrap_or(pattern)
728}
729
730/// A file-pattern rule with optional exclusion globs plus path-level or
731/// segment-level regex filters.
732///
733/// Exclusion regexes are matched against the project-relative path and should be
734/// anchored when generated dynamically so they can be safely workspace-prefixed.
735#[derive(Debug, Clone, Default, PartialEq, Eq, Hash)]
736pub struct PathRule {
737    pub pattern: String,
738    pub exclude_globs: Vec<String>,
739    pub exclude_regexes: Vec<String>,
740    /// Regexes matched against individual path segments. These are not prefixed
741    /// for workspaces because they intentionally operate on segment names rather
742    /// than the full project-relative path.
743    pub exclude_segment_regexes: Vec<String>,
744    /// Whether the leading `../` segments of `pattern` are relative to the
745    /// plugin root, so the workspace prefix resolves them. Only the Module
746    /// Federation reader sets it, for an `exposes` target in a sibling
747    /// workspace. Other plugins emit patterns relative to a config directory,
748    /// such as the Storybook `../src/**`, which must not climb out of the
749    /// workspace.
750    pub parent_relative: bool,
751    /// Whether `pattern` is always relative to the plugin root. The workspace
752    /// prefix then applies also to a pattern that starts with the prefix text,
753    /// such as `docs/js/x.js` in a workspace package named `docs`.
754    pub package_relative: bool,
755}
756
757impl PathRule {
758    #[must_use]
759    pub(crate) fn new(pattern: impl Into<String>) -> Self {
760        Self {
761            pattern: pattern.into(),
762            exclude_globs: Vec::new(),
763            exclude_regexes: Vec::new(),
764            exclude_segment_regexes: Vec::new(),
765            parent_relative: false,
766            package_relative: false,
767        }
768    }
769
770    #[must_use]
771    fn from_static(pattern: &'static str) -> Self {
772        Self::new(pattern)
773    }
774
775    /// A rule for a tool glob with extglob groups, such as `!(*.spec)`. The
776    /// rule matches at least the paths that the tool matches. Each negated
777    /// group becomes an excluded glob.
778    #[must_use]
779    fn from_extglob(pattern: &str) -> Self {
780        let rewritten = fallow_config::extglob::rewrite_include(pattern);
781        Self::new(rewritten.include).with_excluded_globs(rewritten.excludes)
782    }
783
784    /// Exclude the paths of tool globs with extglob groups. An excluded glob
785    /// never removes more paths than the tool does, so a glob with a negated
786    /// group excludes nothing.
787    #[must_use]
788    fn with_excluded_extglobs<I, S>(self, patterns: I) -> Self
789    where
790        I: IntoIterator<Item = S>,
791        S: AsRef<str>,
792    {
793        let excluded: Vec<String> = patterns
794            .into_iter()
795            .filter_map(|pattern| fallow_config::extglob::rewrite_exclude(pattern.as_ref()))
796            .collect();
797        self.with_excluded_globs(excluded)
798    }
799
800    #[must_use]
801    pub(crate) fn with_excluded_globs<I, S>(mut self, patterns: I) -> Self
802    where
803        I: IntoIterator<Item = S>,
804        S: Into<String>,
805    {
806        self.exclude_globs
807            .extend(patterns.into_iter().map(Into::into));
808        self
809    }
810
811    #[must_use]
812    fn with_excluded_regexes<I, S>(mut self, patterns: I) -> Self
813    where
814        I: IntoIterator<Item = S>,
815        S: Into<String>,
816    {
817        self.exclude_regexes
818            .extend(patterns.into_iter().map(Into::into));
819        self
820    }
821
822    #[must_use]
823    fn with_excluded_segment_regexes<I, S>(mut self, patterns: I) -> Self
824    where
825        I: IntoIterator<Item = S>,
826        S: Into<String>,
827    {
828        self.exclude_segment_regexes
829            .extend(patterns.into_iter().map(Into::into));
830        self
831    }
832
833    #[must_use]
834    fn prefixed(&self, ws_prefix: &str) -> Self {
835        let prefix = |pattern: &str| {
836            if self.parent_relative && pattern.starts_with("../") {
837                resolve_parent_relative_pattern(pattern, ws_prefix)
838            } else if self.package_relative {
839                format!("{ws_prefix}/{pattern}")
840            } else {
841                prefix_workspace_pattern(pattern, ws_prefix)
842            }
843        };
844        Self {
845            pattern: prefix(&self.pattern),
846            exclude_globs: self
847                .exclude_globs
848                .iter()
849                .map(|pattern| prefix(pattern))
850                .collect(),
851            exclude_regexes: self
852                .exclude_regexes
853                .iter()
854                .map(|pattern| prefix_workspace_regex(pattern, ws_prefix))
855                .collect(),
856            exclude_segment_regexes: self.exclude_segment_regexes.clone(),
857            parent_relative: false,
858            package_relative: false,
859        }
860    }
861}
862
863/// A file-scoped dependency provider rule contributed by a framework plugin.
864#[derive(Debug, Clone, Default, PartialEq, Eq)]
865pub struct ProvidedDependencyRule {
866    pub(crate) path: PathRule,
867    exact_specifiers: Vec<String>,
868    specifier_prefixes: Vec<String>,
869}
870
871impl ProvidedDependencyRule {
872    #[must_use]
873    fn new(
874        pattern: impl Into<String>,
875        exact_specifiers: impl IntoIterator<Item = impl Into<String>>,
876        specifier_prefixes: impl IntoIterator<Item = impl Into<String>>,
877    ) -> Self {
878        Self {
879            path: PathRule::new(pattern),
880            exact_specifiers: exact_specifiers.into_iter().map(Into::into).collect(),
881            specifier_prefixes: specifier_prefixes.into_iter().map(Into::into).collect(),
882        }
883    }
884
885    #[must_use]
886    fn prefixed(&self, ws_prefix: &str) -> Self {
887        Self {
888            path: self.path.prefixed(ws_prefix),
889            exact_specifiers: self.exact_specifiers.clone(),
890            specifier_prefixes: self.specifier_prefixes.clone(),
891        }
892    }
893
894    #[must_use]
895    pub(crate) fn may_cover_package(&self, package_name: &str) -> bool {
896        self.exact_specifiers
897            .iter()
898            .chain(self.specifier_prefixes.iter())
899            .any(|specifier| crate::resolve::extract_package_name(specifier) == package_name)
900    }
901
902    #[must_use]
903    pub(crate) fn covers_specifier(&self, specifier: &str) -> bool {
904        self.exact_specifiers
905            .iter()
906            .any(|allowed| allowed == specifier)
907            || self
908                .specifier_prefixes
909                .iter()
910                .any(|prefix| specifier.starts_with(prefix))
911    }
912}
913
914/// Compile the include glob of an entry rule. Its `*` stays in one path
915/// segment, and it accepts an empty alternative, such as `{,m}js`, because
916/// the rewrite of an extglob `?(m)` group gives one.
917pub(crate) fn entry_rule_glob(pattern: &str) -> Result<globset::Glob, globset::Error> {
918    globset::GlobBuilder::new(pattern)
919        .literal_separator(true)
920        .empty_alternates(true)
921        .build()
922}
923
924/// A compiled path rule matcher shared by entry-point and used-export matching.
925///
926/// Every glob accepts an empty alternative, such as `{,m}js`, because the
927/// rewrite of an extglob `?(m)` group gives one.
928#[derive(Debug, Clone)]
929pub(crate) struct CompiledPathRule {
930    include: globset::GlobMatcher,
931    exclude_globs: Vec<globset::GlobMatcher>,
932    exclude_regexes: Vec<Regex>,
933    exclude_segment_regexes: Vec<Regex>,
934}
935
936impl CompiledPathRule {
937    pub(crate) fn for_entry_rule(rule: &PathRule, rule_kind: &str) -> Option<Self> {
938        let include = match entry_rule_glob(&rule.pattern) {
939            Ok(glob) => glob.compile_matcher(),
940            Err(err) => {
941                tracing::warn!("invalid {rule_kind} '{}': {err}", rule.pattern);
942                return None;
943            }
944        };
945        Some(Self {
946            include,
947            exclude_globs: compile_excluded_globs(&rule.exclude_globs, rule_kind, &rule.pattern),
948            exclude_regexes: compile_excluded_regexes(
949                &rule.exclude_regexes,
950                rule_kind,
951                &rule.pattern,
952            ),
953            exclude_segment_regexes: compile_excluded_segment_regexes(
954                &rule.exclude_segment_regexes,
955                rule_kind,
956                &rule.pattern,
957            ),
958        })
959    }
960
961    pub(crate) fn for_used_export_rule(rule: &PathRule, rule_kind: &str) -> Option<Self> {
962        Self::for_entry_rule(rule, rule_kind)
963    }
964
965    #[must_use]
966    pub(crate) fn matches(&self, path: &str) -> bool {
967        self.include.is_match(path)
968            && !self.exclude_globs.iter().any(|glob| glob.is_match(path))
969            && !self
970                .exclude_regexes
971                .iter()
972                .any(|regex| regex.is_match(path))
973            && !matches_segment_regex(path, &self.exclude_segment_regexes)
974    }
975}
976
977fn prefix_workspace_pattern(pattern: &str, ws_prefix: &str) -> String {
978    if pattern.starts_with(ws_prefix) || pattern.starts_with('/') {
979        pattern.to_string()
980    } else {
981        format!("{ws_prefix}/{pattern}")
982    }
983}
984
985/// Resolve the leading `../` segments of a parent-relative pattern against the
986/// workspace prefix, so a pattern that names a file in a sibling workspace
987/// matches from the project root. A pattern that climbs past the project root,
988/// or a prefix that is not project-relative, keeps the pattern as written,
989/// which matches no project file.
990fn resolve_parent_relative_pattern(pattern: &str, ws_prefix: &str) -> String {
991    if ws_prefix.starts_with('/') || Path::new(ws_prefix).is_absolute() {
992        return pattern.to_string();
993    }
994    // The workspace prefix comes from a native path, so on Windows its
995    // segments are separated by backslashes.
996    let mut base: Vec<&str> = ws_prefix
997        .split(['/', '\\'])
998        .filter(|segment| !segment.is_empty())
999        .collect();
1000    let mut rest = pattern;
1001    while let Some(stripped) = rest.strip_prefix("../") {
1002        if base.pop().is_none() {
1003            return pattern.to_string();
1004        }
1005        rest = stripped;
1006    }
1007    if base.is_empty() {
1008        rest.to_string()
1009    } else {
1010        format!("{}/{rest}", base.join("/"))
1011    }
1012}
1013
1014fn prefix_workspace_regex(pattern: &str, ws_prefix: &str) -> String {
1015    if let Some(pattern) = pattern.strip_prefix('^') {
1016        format!("^{}/{}", regex::escape(ws_prefix), pattern)
1017    } else {
1018        format!("^{}/(?:{})", regex::escape(ws_prefix), pattern)
1019    }
1020}
1021
1022fn compile_excluded_globs(
1023    patterns: &[String],
1024    rule_kind: &str,
1025    rule_pattern: &str,
1026) -> Vec<globset::GlobMatcher> {
1027    patterns
1028        .iter()
1029        .filter_map(|pattern| {
1030            match globset::GlobBuilder::new(pattern)
1031                .literal_separator(true)
1032                .empty_alternates(true)
1033                .build()
1034            {
1035                Ok(glob) => Some(glob.compile_matcher()),
1036                Err(err) => {
1037                    tracing::warn!(
1038                        "skipping invalid excluded glob '{}' for {} '{}': {err}",
1039                        pattern,
1040                        rule_kind,
1041                        rule_pattern
1042                    );
1043                    None
1044                }
1045            }
1046        })
1047        .collect()
1048}
1049
1050fn compile_excluded_regexes(
1051    patterns: &[String],
1052    rule_kind: &str,
1053    rule_pattern: &str,
1054) -> Vec<Regex> {
1055    patterns
1056        .iter()
1057        .filter_map(|pattern| match Regex::new(pattern) {
1058            Ok(regex) => Some(regex),
1059            Err(err) => {
1060                tracing::warn!(
1061                    "skipping invalid excluded regex '{}' for {} '{}': {err}",
1062                    pattern,
1063                    rule_kind,
1064                    rule_pattern
1065                );
1066                None
1067            }
1068        })
1069        .collect()
1070}
1071
1072fn compile_excluded_segment_regexes(
1073    patterns: &[String],
1074    rule_kind: &str,
1075    rule_pattern: &str,
1076) -> Vec<Regex> {
1077    patterns
1078        .iter()
1079        .filter_map(|pattern| match Regex::new(pattern) {
1080            Ok(regex) => Some(regex),
1081            Err(err) => {
1082                tracing::warn!(
1083                    "skipping invalid excluded segment regex '{}' for {} '{}': {err}",
1084                    pattern,
1085                    rule_kind,
1086                    rule_pattern
1087                );
1088                None
1089            }
1090        })
1091        .collect()
1092}
1093
1094/// Whether a segment of `path` matches one of `regexes`. The path can use the
1095/// native separator: on Windows a caller can pass `src\pages\x.tsx`.
1096fn matches_segment_regex(path: &str, regexes: &[Regex]) -> bool {
1097    path.split(std::path::is_separator)
1098        .any(|segment| regexes.iter().any(|regex| regex.is_match(segment)))
1099}
1100
1101impl From<String> for PathRule {
1102    fn from(pattern: String) -> Self {
1103        Self::new(pattern)
1104    }
1105}
1106
1107impl From<&str> for PathRule {
1108    fn from(pattern: &str) -> Self {
1109        Self::new(pattern)
1110    }
1111}
1112
1113impl std::ops::Deref for PathRule {
1114    type Target = str;
1115
1116    fn deref(&self) -> &Self::Target {
1117        &self.pattern
1118    }
1119}
1120
1121impl PartialEq<&str> for PathRule {
1122    fn eq(&self, other: &&str) -> bool {
1123        self.pattern == *other
1124    }
1125}
1126
1127impl PartialEq<str> for PathRule {
1128    fn eq(&self, other: &str) -> bool {
1129        self.pattern == other
1130    }
1131}
1132
1133impl PartialEq<String> for PathRule {
1134    fn eq(&self, other: &String) -> bool {
1135        &self.pattern == other
1136    }
1137}
1138
1139/// A framework/tool plugin that contributes to dead code analysis.
1140pub trait Plugin: Send + Sync {
1141    /// Human-readable plugin name.
1142    fn name(&self) -> &'static str;
1143
1144    /// Package names that activate this plugin when found in package.json.
1145    /// Supports exact matches and prefix patterns (ending with `/`).
1146    fn enablers(&self) -> &'static [&'static str] {
1147        &[]
1148    }
1149
1150    /// Calls `is_enabled_with_deps`. The registry does not call this method, so do not override it.
1151    fn is_enabled(&self, pkg: &PackageJson, root: &Path) -> bool {
1152        let deps = pkg.all_dependency_names();
1153        self.is_enabled_with_deps(&deps, root)
1154    }
1155
1156    /// Fast variant of `is_enabled` that accepts a pre-computed deps list.
1157    /// Avoids repeated `all_dependency_names()` allocation when checking many plugins.
1158    fn is_enabled_with_deps(&self, deps: &[String], _root: &Path) -> bool {
1159        let enablers = self.enablers();
1160        if enablers.is_empty() {
1161            return false;
1162        }
1163        enablers.iter().any(|enabler| {
1164            if enabler.ends_with('/') {
1165                // Prefix match (e.g., "@storybook/" matches "@storybook/react")
1166                deps.iter().any(|d| d.starts_with(enabler))
1167            } else {
1168                deps.iter().any(|d| d == enabler)
1169            }
1170        })
1171    }
1172
1173    /// Check whether this plugin should be active with source discovery available.
1174    ///
1175    /// Most plugins only need dependency/config activation. Convention-only tools
1176    /// can override this to activate from discovered source filenames without
1177    /// forcing a separate filesystem walk.
1178    ///
1179    /// `candidate_index` is the discovery walk's in-memory listing of source +
1180    /// non-source config-candidate files (`Some` outside production mode, `None`
1181    /// in production). A plugin that activates on a non-source sentinel file
1182    /// (`manifest.json`, `.env.schema`) can consult it to avoid a per-directory
1183    /// filesystem probe; when it is `None`, the plugin falls back to the
1184    /// filesystem.
1185    fn is_enabled_with_files(
1186        &self,
1187        deps: &[String],
1188        root: &Path,
1189        _discovered_files: &[PathBuf],
1190        _candidate_index: Option<&registry::ConfigCandidateIndex>,
1191    ) -> bool {
1192        self.is_enabled_with_deps(deps, root)
1193    }
1194
1195    /// Package-script binary/package names that can activate this plugin.
1196    fn script_enablers(&self) -> &'static [&'static str] {
1197        &[]
1198    }
1199
1200    /// Check whether this plugin should be active from package.json scripts.
1201    fn is_enabled_with_scripts(
1202        &self,
1203        script_packages: &rustc_hash::FxHashSet<String>,
1204        _root: &Path,
1205    ) -> bool {
1206        let enablers = self.script_enablers();
1207        if enablers.is_empty() {
1208            return false;
1209        }
1210        enablers.iter().any(|enabler| {
1211            if enabler.ends_with('/') {
1212                script_packages
1213                    .iter()
1214                    .any(|package| package.starts_with(enabler))
1215            } else {
1216                script_packages.contains(*enabler)
1217            }
1218        })
1219    }
1220
1221    /// Default glob patterns for entry point files.
1222    fn entry_patterns(&self) -> &'static [&'static str] {
1223        &[]
1224    }
1225
1226    /// Entry point rules with optional exclusions.
1227    fn entry_pattern_rules(&self) -> Vec<PathRule> {
1228        self.entry_patterns()
1229            .iter()
1230            .map(|pattern| PathRule::from_static(pattern))
1231            .collect()
1232    }
1233
1234    /// How this plugin's entry patterns should contribute to coverage reachability.
1235    ///
1236    /// `Support` roots keep files alive for dead-code analysis but do not count
1237    /// as runtime or test reachability for static coverage gaps.
1238    fn entry_point_role(&self) -> EntryPointRole {
1239        builtin_entry_point_role(self.name())
1240    }
1241
1242    /// Glob patterns for config files this plugin can parse.
1243    fn config_patterns(&self) -> &'static [&'static str] {
1244        &[]
1245    }
1246
1247    /// Config patterns whose files do not get the `default` export credit.
1248    ///
1249    /// Under `includeEntryExports`, the `default` export of a file that one of
1250    /// [`Self::config_patterns`] matches counts as used, because the tool loads
1251    /// the config file and reads its default export. List a pattern here when
1252    /// the tool reads named exports instead, or when the pattern also matches
1253    /// ordinary source files. Each entry must be identical to an entry of
1254    /// [`Self::config_patterns`].
1255    fn config_default_export_opt_out(&self) -> &'static [&'static str] {
1256        &[]
1257    }
1258
1259    /// Tool config files and the export names that the tool reads from them.
1260    ///
1261    /// Under `includeEntryExports`, these exports of a matching file count as
1262    /// used. `"*"` credits every export. Use this for a config file that is not
1263    /// in [`Self::config_patterns`], or for a tool that reads named exports.
1264    /// Each pattern is anchored: it gets the workspace prefix but no `**/`
1265    /// prefix, so it matches only at the project or workspace package root.
1266    /// This credit never changes the output without `includeEntryExports`.
1267    fn config_file_exports(&self) -> &'static [(&'static str, &'static [&'static str])] {
1268        &[]
1269    }
1270
1271    /// Files that are always considered "used" when this plugin is active.
1272    fn always_used(&self) -> &'static [&'static str] {
1273        &[]
1274    }
1275
1276    /// Exports that are always considered used for matching file patterns.
1277    fn used_exports(&self) -> Vec<(&'static str, &'static [&'static str])> {
1278        vec![]
1279    }
1280
1281    /// Used-export rules with optional exclusions.
1282    fn used_export_rules(&self) -> Vec<UsedExportRule> {
1283        self.used_exports()
1284            .into_iter()
1285            .map(|(pattern, exports)| UsedExportRule::from_static(pattern, exports))
1286            .collect()
1287    }
1288
1289    /// Class member names the framework invokes at runtime. Matching members
1290    /// are skipped during `unused-class-members` analysis. Intended for
1291    /// interface/contract patterns where the library calls methods on consumer
1292    /// classes (e.g. ag-Grid's `agInit`, Web Components' `connectedCallback`).
1293    fn used_class_members(&self) -> &'static [&'static str] {
1294        &[]
1295    }
1296
1297    /// Heritage-scoped class member rules. Each rule applies only to classes
1298    /// matching its `extends` and/or `implements` clause. Used for frameworks
1299    /// where lifecycle members are runtime-invoked only on classes that extend
1300    /// a known base (e.g. Lit's `render`/`updated` on classes extending
1301    /// `LitElement`, native Web Components' `connectedCallback` on classes
1302    /// extending `HTMLElement`). Default: empty. Plugins override when they
1303    /// need scoping; flat names should still come from `used_class_members`.
1304    fn used_class_member_rules(&self) -> Vec<UsedClassMemberRule> {
1305        Vec::new()
1306    }
1307
1308    /// Exact package-backed framework contracts that type-aware analysis may
1309    /// verify for latent class-member candidates.
1310    fn framework_class_member_contracts(&self) -> Vec<SemanticFrameworkContract> {
1311        Vec::new()
1312    }
1313
1314    /// Glob patterns for test fixture files consumed by this framework.
1315    /// These files are implicitly used by the test runner and should not be
1316    /// flagged as unused. Unlike `always_used()`, this carries semantic intent
1317    /// for reporting purposes.
1318    fn fixture_glob_patterns(&self) -> &'static [&'static str] {
1319        &[]
1320    }
1321
1322    /// Hidden directory names that should be traversed when this plugin is active.
1323    ///
1324    /// These are consulted before normal plugin execution because source discovery
1325    /// runs first. Keep entries static and package-convention scoped.
1326    fn discovery_hidden_dirs(&self) -> &'static [&'static str] {
1327        &[]
1328    }
1329
1330    /// Dependencies that are tooling (used via CLI/config, not source imports).
1331    /// These should not be flagged as unused devDependencies.
1332    fn tooling_dependencies(&self) -> &'static [&'static str] {
1333        &[]
1334    }
1335
1336    /// Import prefixes that are virtual modules provided by this framework at build time.
1337    /// Imports matching these prefixes should not be flagged as unlisted dependencies.
1338    /// Each entry is matched as a prefix against the extracted package name
1339    /// (e.g., `"@theme/"` matches `@theme/Layout`).
1340    fn virtual_module_prefixes(&self) -> &'static [&'static str] {
1341        &[]
1342    }
1343
1344    /// Package name suffixes that are virtual modules provided by this framework
1345    /// at build time (e.g., test runner mock conventions).
1346    /// Imports matching these suffixes should not be flagged as unlisted dependencies.
1347    /// Each entry is matched as a suffix against the extracted package name
1348    /// (e.g., `"/__mocks__"` matches `@aws-sdk/__mocks__` and `some-pkg/__mocks__`).
1349    fn virtual_package_suffixes(&self) -> &'static [&'static str] {
1350        &[]
1351    }
1352
1353    /// Import suffixes for build-time generated relative imports.
1354    ///
1355    /// Unresolved relative imports whose specifier ends with one of these suffixes
1356    /// will not be flagged as unresolved. For example, SvelteKit generates
1357    /// `./$types` imports in route files, returning `"/$types"` suppresses those.
1358    fn generated_import_patterns(&self) -> &'static [&'static str] {
1359        &[]
1360    }
1361
1362    /// Import prefixes for generated type-only relative imports.
1363    ///
1364    /// Unresolved type-only imports whose specifier starts with one of these prefixes
1365    /// will not be flagged as unresolved. Runtime imports are still reported.
1366    fn generated_type_import_prefixes(&self) -> &'static [&'static str] {
1367        &[]
1368    }
1369
1370    /// The package that provides this framework's virtual and generated
1371    /// modules, credited as used when a source file imports one.
1372    ///
1373    /// A framework can serve imports that name no npm package (SvelteKit's
1374    /// `$app/state`, `./$types`). The package behind those specifiers would
1375    /// look unused in a project where the plugin found no tooling evidence
1376    /// (its own config file, or a script, CI workflow or git hook calling its
1377    /// tool). Return the providing package name: an import matching
1378    /// [`Self::virtual_module_prefixes`] or [`Self::generated_import_patterns`]
1379    /// in the package where this plugin is active then credits it.
1380    fn virtual_module_package(&self) -> Option<&'static str> {
1381        None
1382    }
1383
1384    /// Path alias mappings provided by this framework at build time.
1385    ///
1386    /// Returns a list of `(prefix, replacement_dir)` tuples. When an import starting
1387    /// with `prefix` fails to resolve, the resolver will substitute the prefix with
1388    /// `replacement_dir` (relative to the project root) and retry.
1389    ///
1390    /// Called once when plugins are activated. The project `root` is provided so
1391    /// plugins can inspect the filesystem (e.g., Nuxt checks whether `app/` exists
1392    /// to determine the `srcDir`).
1393    fn path_aliases(&self, _root: &Path) -> Vec<(&'static str, String)> {
1394        vec![]
1395    }
1396
1397    /// Directories this framework serves at a URL mount by convention, so a
1398    /// root-absolute reference in ANY HTML document in the project names a file
1399    /// inside one.
1400    ///
1401    /// Called once when plugins are activated, with the project `root`, so a
1402    /// plugin can require the directory to exist before claiming it.
1403    ///
1404    /// Distinct from the config-file mounts a tool declares from
1405    /// `resolve_config` (Storybook `staticDirs`), which stay scoped to that
1406    /// tool's own documents. A convention here describes how the whole project
1407    /// is served, so it is not scoped that way.
1408    fn static_dir_mappings(&self, _root: &Path) -> Vec<(std::path::PathBuf, String)> {
1409        vec![]
1410    }
1411
1412    /// Convention-based auto-imports provided by this framework.
1413    ///
1414    /// Returns the names this framework exposes to user code by filesystem
1415    /// convention with no explicit `import` statement (e.g. Nuxt `components/`
1416    /// resolved by `<Card001 />` template tags), each mapped to the source file
1417    /// providing the export. When a file references one of these names without an
1418    /// import, the resolver synthesizes a graph edge to `source`.
1419    ///
1420    /// Called once when plugins are activated. The project `root` is provided so
1421    /// plugins can scan the convention directories on the filesystem. The table is
1422    /// a function of which files exist on disk, so it is rebuilt every run and is
1423    /// never folded into per-file extraction caching. See issue #704.
1424    ///
1425    /// A rule with an empty `scope` is visible to the files under `root` only.
1426    /// A plugin can set `scope` itself to make a rule visible to more roots.
1427    /// After the plugin runs, a shared step links a Nuxt app and each layer
1428    /// outside it in both directions. See issue #2752.
1429    fn auto_imports(&self, _root: &Path) -> Vec<AutoImportRule> {
1430        Vec::new()
1431    }
1432
1433    /// File-scoped dependency providers contributed by this framework.
1434    fn provided_dependencies(&self) -> Vec<ProvidedDependencyRule> {
1435        Vec::new()
1436    }
1437
1438    /// Check whether parsed package.json metadata activates this plugin.
1439    fn is_enabled_with_package_json(&self, _pkg: &PackageJson, _root: &Path) -> bool {
1440        false
1441    }
1442
1443    /// Resolve parsed package.json metadata into dynamic plugin facts.
1444    fn resolve_package_json(&self, _pkg: &PackageJson, _root: &Path) -> PluginResult {
1445        PluginResult::default()
1446    }
1447
1448    /// Dependencies referenced by the package's own package.json metadata.
1449    ///
1450    /// Unlike config-derived dependencies, these credits apply only to the
1451    /// package.json that produced them.
1452    fn package_json_referenced_dependencies(
1453        &self,
1454        _pkg: &PackageJson,
1455        _root: &Path,
1456    ) -> Vec<String> {
1457        Vec::new()
1458    }
1459
1460    /// Parse a config file's AST to discover additional entries, dependencies, etc.
1461    ///
1462    /// Called for each config file matching `config_patterns()`. The source code
1463    /// and parsed AST are provided, use [`config_parser`] utilities to extract values.
1464    fn resolve_config(&self, _config_path: &Path, _source: &str, _root: &Path) -> PluginResult {
1465        PluginResult::default()
1466    }
1467
1468    /// Parse a config file with the project root known.
1469    ///
1470    /// `root` is the package root that [`Plugin::resolve_config`] receives. In
1471    /// a workspace run it is the workspace package directory. `project_root`
1472    /// is the analysis root. A plugin that reads more files from paths that
1473    /// the config names must keep each read inside `project_root`, because the
1474    /// config comes from the analyzed repository. The default ignores
1475    /// `project_root`.
1476    fn resolve_config_in_project(
1477        &self,
1478        config_path: &Path,
1479        source: &str,
1480        root: &Path,
1481        _project_root: &Path,
1482    ) -> PluginResult {
1483        self.resolve_config(config_path, source, root)
1484    }
1485
1486    /// Parse a config file that a package script passes with `--config` or
1487    /// `-c`. The script runs the tool in `root`, also for a config in a
1488    /// subdirectory. The default is [`Plugin::resolve_config_in_project`].
1489    fn resolve_script_config(
1490        &self,
1491        config_path: &Path,
1492        source: &str,
1493        root: &Path,
1494        project_root: &Path,
1495    ) -> PluginResult {
1496        self.resolve_config_in_project(config_path, source, root, project_root)
1497    }
1498
1499    /// Binaries whose `--config` / `-c` argument in a package script names a
1500    /// config file of this plugin.
1501    ///
1502    /// A script such as `vitest run --config vitest.e2e.config.ts` points the
1503    /// tool at a file that no `config_patterns()` entry matches. The plugin
1504    /// system sends that file to `resolve_config` and credits its default
1505    /// export as used.
1506    fn script_config_binaries(&self) -> &'static [&'static str] {
1507        &[]
1508    }
1509
1510    /// The package.json key that holds the inline config of this tool, such as
1511    /// `"jest"`, and that [`fallow_config::INLINE_TOOL_CONFIG_KEYS`] lists. When a
1512    /// package has no config file of the tool, `resolve_config_in_project` gets it.
1513    fn package_json_config_key(&self) -> Option<&'static str> {
1514        None
1515    }
1516}
1517
1518/// Macro to eliminate boilerplate in plugin implementations.
1519///
1520/// Generates a struct and a `Plugin` trait impl with the standard static methods
1521/// (`name`, `enablers`, `entry_patterns`, `config_patterns`, `always_used`, `tooling_dependencies`,
1522/// `fixture_glob_patterns`, `virtual_module_prefixes`, `virtual_package_suffixes`,
1523/// `generated_type_import_prefixes`, `used_exports`).
1524///
1525/// For plugins that need custom `resolve_config()` or `is_enabled()`, keep those as
1526/// manual `impl Plugin for ...` blocks instead of using this macro.
1527///
1528/// # Usage
1529///
1530/// ```ignore
1531/// // Simple plugin (most common):
1532/// define_plugin! {
1533///     struct VitePlugin => "vite",
1534///     enablers: ENABLERS,
1535///     entry_patterns: ENTRY_PATTERNS,
1536///     config_patterns: CONFIG_PATTERNS,
1537///     always_used: ALWAYS_USED,
1538///     tooling_dependencies: TOOLING_DEPENDENCIES,
1539/// }
1540///
1541/// // Plugin with used_exports:
1542/// define_plugin! {
1543///     struct RemixPlugin => "remix",
1544///     enablers: ENABLERS,
1545///     entry_patterns: ENTRY_PATTERNS,
1546///     always_used: ALWAYS_USED,
1547///     tooling_dependencies: TOOLING_DEPENDENCIES,
1548///     used_exports: [("app/routes/**/*.{ts,tsx}", ROUTE_EXPORTS)],
1549/// }
1550///
1551/// // Plugin with imports-only resolve_config (extracts imports from config as deps):
1552/// define_plugin! {
1553///     struct CypressPlugin => "cypress",
1554///     enablers: ENABLERS,
1555///     entry_patterns: ENTRY_PATTERNS,
1556///     config_patterns: CONFIG_PATTERNS,
1557///     always_used: ALWAYS_USED,
1558///     tooling_dependencies: TOOLING_DEPENDENCIES,
1559///     resolve_config: imports_only,
1560/// }
1561///
1562/// // Plugin with custom resolve_config body:
1563/// define_plugin! {
1564///     struct RollupPlugin => "rollup",
1565///     enablers: ENABLERS,
1566///     config_patterns: CONFIG_PATTERNS,
1567///     always_used: ALWAYS_USED,
1568///     tooling_dependencies: TOOLING_DEPENDENCIES,
1569///     resolve_config(config_path, source, _root) {
1570///         let mut result = PluginResult::default();
1571///         // custom config parsing...
1572///         result
1573///     }
1574/// }
1575/// ```
1576///
1577/// All fields except `struct` and `enablers` are optional and default to `&[]` / `vec![]`.
1578macro_rules! define_plugin {
1579    (
1580        struct $name:ident => $display:expr,
1581        enablers: $enablers:expr
1582        $(, entry_patterns: $entry:expr)?
1583        $(, config_patterns: $config:expr)?
1584        $(, config_default_export_opt_out: $config_opt_out:expr)?
1585        $(, config_file_exports: $config_exports:expr)?
1586        $(, always_used: $always:expr)?
1587        $(, tooling_dependencies: $tooling:expr)?
1588        $(, fixture_glob_patterns: $fixtures:expr)?
1589        $(, discovery_hidden_dirs: $hidden_dirs:expr)?
1590        $(, virtual_module_prefixes: $virtual:expr)?
1591        $(, virtual_package_suffixes: $virtual_suffixes:expr)?
1592        $(, generated_type_import_prefixes: $generated_type_prefixes:expr)?
1593        $(, provided_dependencies: $provided_dependencies:expr)?
1594        $(, used_exports: [$( ($pat:expr, $exports:expr) ),* $(,)?])?
1595        , resolve_config: imports_only
1596        $(,)?
1597    ) => {
1598        pub struct $name;
1599
1600        impl Plugin for $name {
1601            fn name(&self) -> &'static str {
1602                $display
1603            }
1604
1605            fn enablers(&self) -> &'static [&'static str] {
1606                $enablers
1607            }
1608
1609            $( fn entry_patterns(&self) -> &'static [&'static str] { $entry } )?
1610            $( fn config_patterns(&self) -> &'static [&'static str] { $config } )?
1611            $( fn config_default_export_opt_out(&self) -> &'static [&'static str] { $config_opt_out } )?
1612            $( fn config_file_exports(&self) -> &'static [(&'static str, &'static [&'static str])] { $config_exports } )?
1613            $( fn always_used(&self) -> &'static [&'static str] { $always } )?
1614            $( fn tooling_dependencies(&self) -> &'static [&'static str] { $tooling } )?
1615            $( fn fixture_glob_patterns(&self) -> &'static [&'static str] { $fixtures } )?
1616            $( fn discovery_hidden_dirs(&self) -> &'static [&'static str] { $hidden_dirs } )?
1617            $( fn virtual_module_prefixes(&self) -> &'static [&'static str] { $virtual } )?
1618            $( fn virtual_package_suffixes(&self) -> &'static [&'static str] { $virtual_suffixes } )?
1619            $( fn generated_type_import_prefixes(&self) -> &'static [&'static str] { $generated_type_prefixes } )?
1620            $( fn provided_dependencies(&self) -> Vec<ProvidedDependencyRule> { $provided_dependencies } )?
1621
1622            $(
1623                fn used_exports(&self) -> Vec<(&'static str, &'static [&'static str])> {
1624                    vec![$( ($pat, $exports) ),*]
1625                }
1626            )?
1627
1628            fn resolve_config(
1629                &self,
1630                config_path: &std::path::Path,
1631                source: &str,
1632                _root: &std::path::Path,
1633            ) -> PluginResult {
1634                let mut result = PluginResult::default();
1635                crate::plugins::add_import_referenced_dependencies(
1636                    &mut result,
1637                    source,
1638                    config_path,
1639                );
1640                result
1641            }
1642        }
1643    };
1644
1645    (
1646        struct $name:ident => $display:expr,
1647        enablers: $enablers:expr
1648        $(, entry_patterns: $entry:expr)?
1649        $(, config_patterns: $config:expr)?
1650        $(, config_default_export_opt_out: $config_opt_out:expr)?
1651        $(, config_file_exports: $config_exports:expr)?
1652        $(, always_used: $always:expr)?
1653        $(, tooling_dependencies: $tooling:expr)?
1654        $(, fixture_glob_patterns: $fixtures:expr)?
1655        $(, discovery_hidden_dirs: $hidden_dirs:expr)?
1656        $(, virtual_module_prefixes: $virtual:expr)?
1657        $(, virtual_package_suffixes: $virtual_suffixes:expr)?
1658        $(, generated_type_import_prefixes: $generated_type_prefixes:expr)?
1659        $(, provided_dependencies: $provided_dependencies:expr)?
1660        $(, package_json_config_key: $pkg_key:expr)?
1661        $(, script_config_binaries: $script_binaries:expr)?
1662        $(, used_exports: [$( ($pat:expr, $exports:expr) ),* $(,)?])?
1663        , resolve_config($cp:ident, $src:ident, $root:ident) $body:block
1664        $(, resolve_config_in_project($pcp:ident, $psrc:ident, $proot:ident, $pproj:ident) $pbody:block)?
1665        $(,)?
1666    ) => {
1667        pub struct $name;
1668
1669        impl Plugin for $name {
1670            fn name(&self) -> &'static str {
1671                $display
1672            }
1673
1674            fn enablers(&self) -> &'static [&'static str] {
1675                $enablers
1676            }
1677
1678            $( fn entry_patterns(&self) -> &'static [&'static str] { $entry } )?
1679            $( fn config_patterns(&self) -> &'static [&'static str] { $config } )?
1680            $( fn config_default_export_opt_out(&self) -> &'static [&'static str] { $config_opt_out } )?
1681            $( fn config_file_exports(&self) -> &'static [(&'static str, &'static [&'static str])] { $config_exports } )?
1682            $( fn always_used(&self) -> &'static [&'static str] { $always } )?
1683            $( fn tooling_dependencies(&self) -> &'static [&'static str] { $tooling } )?
1684            $( fn fixture_glob_patterns(&self) -> &'static [&'static str] { $fixtures } )?
1685            $( fn discovery_hidden_dirs(&self) -> &'static [&'static str] { $hidden_dirs } )?
1686            $( fn virtual_module_prefixes(&self) -> &'static [&'static str] { $virtual } )?
1687            $( fn virtual_package_suffixes(&self) -> &'static [&'static str] { $virtual_suffixes } )?
1688            $( fn generated_type_import_prefixes(&self) -> &'static [&'static str] { $generated_type_prefixes } )?
1689            $( fn provided_dependencies(&self) -> Vec<ProvidedDependencyRule> { $provided_dependencies } )?
1690
1691            $(
1692                fn package_json_config_key(&self) -> Option<&'static str> {
1693                    Some($pkg_key)
1694                }
1695            )?
1696
1697            $(
1698                fn used_exports(&self) -> Vec<(&'static str, &'static [&'static str])> {
1699                    vec![$( ($pat, $exports) ),*]
1700                }
1701            )?
1702
1703            $( fn script_config_binaries(&self) -> &'static [&'static str] { $script_binaries } )?
1704
1705            fn resolve_config(
1706                &self,
1707                $cp: &std::path::Path,
1708                $src: &str,
1709                $root: &std::path::Path,
1710            ) -> PluginResult
1711            $body
1712
1713            $(
1714                fn resolve_config_in_project(
1715                    &self,
1716                    $pcp: &std::path::Path,
1717                    $psrc: &str,
1718                    $proot: &std::path::Path,
1719                    $pproj: &std::path::Path,
1720                ) -> PluginResult
1721                $pbody
1722            )?
1723        }
1724    };
1725
1726    (
1727        struct $name:ident => $display:expr,
1728        enablers: $enablers:expr
1729        $(, entry_patterns: $entry:expr)?
1730        $(, config_patterns: $config:expr)?
1731        $(, config_default_export_opt_out: $config_opt_out:expr)?
1732        $(, config_file_exports: $config_exports:expr)?
1733        $(, always_used: $always:expr)?
1734        $(, tooling_dependencies: $tooling:expr)?
1735        $(, fixture_glob_patterns: $fixtures:expr)?
1736        $(, discovery_hidden_dirs: $hidden_dirs:expr)?
1737        $(, virtual_module_prefixes: $virtual:expr)?
1738        $(, virtual_package_suffixes: $virtual_suffixes:expr)?
1739        $(, generated_type_import_prefixes: $generated_type_prefixes:expr)?
1740        $(, provided_dependencies: $provided_dependencies:expr)?
1741        $(, package_json_config_key: $pkg_key:expr)?
1742        $(, used_exports: [$( ($pat:expr, $exports:expr) ),* $(,)?])?
1743        $(,)?
1744    ) => {
1745        pub struct $name;
1746
1747        impl Plugin for $name {
1748            fn name(&self) -> &'static str {
1749                $display
1750            }
1751
1752            fn enablers(&self) -> &'static [&'static str] {
1753                $enablers
1754            }
1755
1756            $( fn entry_patterns(&self) -> &'static [&'static str] { $entry } )?
1757            $( fn config_patterns(&self) -> &'static [&'static str] { $config } )?
1758            $( fn config_default_export_opt_out(&self) -> &'static [&'static str] { $config_opt_out } )?
1759            $( fn config_file_exports(&self) -> &'static [(&'static str, &'static [&'static str])] { $config_exports } )?
1760            $( fn always_used(&self) -> &'static [&'static str] { $always } )?
1761            $( fn tooling_dependencies(&self) -> &'static [&'static str] { $tooling } )?
1762            $( fn fixture_glob_patterns(&self) -> &'static [&'static str] { $fixtures } )?
1763            $( fn discovery_hidden_dirs(&self) -> &'static [&'static str] { $hidden_dirs } )?
1764            $( fn virtual_module_prefixes(&self) -> &'static [&'static str] { $virtual } )?
1765            $( fn virtual_package_suffixes(&self) -> &'static [&'static str] { $virtual_suffixes } )?
1766            $( fn generated_type_import_prefixes(&self) -> &'static [&'static str] { $generated_type_prefixes } )?
1767            $( fn provided_dependencies(&self) -> Vec<ProvidedDependencyRule> { $provided_dependencies } )?
1768
1769            $(
1770                fn package_json_config_key(&self) -> Option<&'static str> {
1771                    Some($pkg_key)
1772                }
1773            )?
1774
1775            $(
1776                fn used_exports(&self) -> Vec<(&'static str, &'static [&'static str])> {
1777                    vec![$( ($pat, $exports) ),*]
1778                }
1779            )?
1780        }
1781    };
1782}
1783
1784mod config_dependencies;
1785pub mod config_parser;
1786mod config_parser_array_pushes;
1787mod config_value_credits;
1788mod federation_source;
1789use config_value_credits::{
1790    canonical_test_environment, credit_config_value, credit_environment_optional_peers,
1791};
1792mod flue;
1793mod jasmine;
1794mod manifest;
1795mod module_request;
1796use module_request::{has_glob_syntax, has_source_extension, module_request, names_project_file};
1797pub mod manifest_entries;
1798mod mise;
1799mod osls;
1800mod path_rule_index;
1801mod project_glob;
1802mod railway;
1803pub mod registry;
1804mod rstest;
1805mod serverless_framework;
1806mod textlint;
1807mod tooling;
1808pub(crate) mod trace_provenance;
1809mod used_export_names;
1810mod used_export_rule;
1811mod web_server_app;
1812
1813pub use config_dependencies::RequiredDependency;
1814use config_dependencies::add_import_referenced_dependencies;
1815pub use federation_source::{FederationSource, FederationSourceTarget};
1816pub(crate) use module_federation::runtime_remotes;
1817pub(crate) use path_rule_index::PathRuleIndex;
1818pub(crate) use registry::module_specifiers;
1819pub use registry::{
1820    AggregatedPluginResult, CheckedAliasPrefix, PluginRegistry, PluginToolingDependencies,
1821    PluginToolingEvidence, VirtualModuleMatch, VirtualModuleProviderRule,
1822};
1823pub use tooling::types_package_target;
1824pub(crate) use tooling::{
1825    cli_tooling_config_patterns, is_ambient_types_package, is_known_tooling_dependency,
1826};
1827pub use trace_provenance::ExportCredits;
1828pub use used_export_names::UsedExportNames;
1829pub(crate) use used_export_rule::{ConfigExportCredit, is_export_ignored};
1830pub use used_export_rule::{PluginUsedExportRule, UsedExportRule};
1831
1832mod adonis;
1833mod ag_ui;
1834mod alchemy;
1835mod alias_replacement;
1836mod angular;
1837mod astro;
1838mod ava;
1839mod babel;
1840mod biome;
1841mod browser_extension;
1842mod bun;
1843mod c8;
1844mod capacitor;
1845mod changesets;
1846mod coderabbit;
1847mod commit_and_tag_version;
1848mod commitizen;
1849mod commitlint;
1850mod content_collections;
1851mod contentlayer;
1852mod convex;
1853mod cspell;
1854mod cucumber;
1855mod cypress;
1856mod danger;
1857mod deno;
1858mod dependency_cruiser;
1859mod docusaurus;
1860mod dotenv;
1861mod drizzle;
1862mod dumi;
1863mod egg;
1864mod electron;
1865mod ember;
1866mod entry_point_roles;
1867mod eslint;
1868mod eve;
1869mod expo;
1870mod expo_packages;
1871mod expo_router;
1872mod extends_walk;
1873mod firebase;
1874mod fumadocs;
1875mod gatsby;
1876mod github_action;
1877mod gnome_shell_extension;
1878mod graphql_codegen;
1879mod graphql_config;
1880mod gulp;
1881mod hardhat;
1882mod husky;
1883mod i18next;
1884mod ionic;
1885mod jest;
1886mod k6;
1887mod karma;
1888mod kibana;
1889mod knex;
1890mod kysely;
1891mod lefthook;
1892mod lexical;
1893mod lint_staged;
1894mod lit;
1895mod markdownlint;
1896mod mintlify;
1897mod mkdocs;
1898mod mocha;
1899mod module_federation;
1900mod msw;
1901mod n8n;
1902mod napi_rs;
1903mod nest_commander;
1904mod nestjs;
1905mod nestjs_trpc;
1906mod next_intl;
1907mod nextjs;
1908mod nitro;
1909mod nodemon;
1910pub(crate) mod nuxt;
1911mod nx;
1912mod nyc;
1913mod obsidian;
1914mod openapi_ts;
1915mod opencode;
1916mod opennext_cloudflare;
1917mod opentelemetry;
1918mod oxfmt;
1919mod oxlint;
1920mod pandacss;
1921mod parcel;
1922mod pinia;
1923mod pkg_utils;
1924mod playwright;
1925mod plop;
1926mod pm2;
1927mod pnpm;
1928mod postcss;
1929mod prettier;
1930mod prisma;
1931mod qwik;
1932mod react_compiler;
1933mod react_native;
1934pub(crate) mod react_router;
1935mod redwoodsdk;
1936mod relay;
1937mod release_it;
1938mod remark;
1939mod remix;
1940mod rolldown;
1941mod rollup;
1942mod rsbuild;
1943mod rspack;
1944mod rspress;
1945mod sanity;
1946mod semantic_release;
1947mod sentry;
1948mod simple_git_hooks;
1949mod size_limit;
1950mod solid_start;
1951mod storybook;
1952mod stryker;
1953mod stylelint;
1954mod supabase;
1955mod sveltekit;
1956mod svgo;
1957mod svgr;
1958mod swc;
1959mod syncpack;
1960mod tailwind;
1961mod tanstack_router;
1962mod tap;
1963mod test_alias;
1964#[cfg(test)]
1965mod tests;
1966mod tsd;
1967mod tsdown;
1968mod tsup;
1969mod turborepo;
1970mod typedoc;
1971mod typeorm;
1972mod typescript;
1973mod typescript_content_mapper;
1974mod unocss;
1975pub(crate) mod unplugin_icons;
1976mod varlock;
1977mod velite;
1978mod vercel;
1979mod vite;
1980mod vite_plugin_pages;
1981pub(crate) mod vite_plus;
1982mod vite_pwa_assets_generator;
1983mod vitepress;
1984mod vitest;
1985mod vscode;
1986mod waku;
1987mod webdriverio;
1988mod webpack;
1989mod wrangler;
1990mod wuchale;
1991mod wxt;