Skip to main content

Crate fallow_extract

Crate fallow_extract 

Source
Expand description

Parsing and extraction engine for fallow codebase intelligence.

This crate handles all file parsing: JS/TS via Oxc, Vue/Svelte SFC extraction, Astro frontmatter, MDX import/export extraction, CSS Module class name extraction, HTML asset reference extraction, and incremental caching of parse results.

User documentation for the supported file types is on fallow.tools:

Re-exports§

pub use astro::extract_astro_frontmatter;
pub use astro::extract_astro_style_regions;
pub use astro::extract_astro_template_regions;
pub use css::StylesheetTokens;
pub use css::ThemeScan;
pub use css::ThemeTokenDef;
pub use css::extract_apply_tokens;
pub use css::extract_apply_tokens_located;
pub use css::extract_css_module_exports;
pub use css::extract_css_var_reads_located;
pub use css::scan_stylesheet_tokens;
pub use css::scan_theme_blocks;
pub use css_classes::MarkupClassScan;
pub use css_classes::MarkupClassToken;
pub use css_classes::is_edit_distance_one;
pub use css_classes::is_typo_edit;
pub use css_classes::scan_markup_class_tokens;
pub use css_in_js::ConsumerQuery;
pub use css_in_js::CssInJsObjectSheets;
pub use css_in_js::CssInJsToken;
pub use css_in_js::CssInJsTokenDef;
pub use css_in_js::CssInJsTokenOrigin;
pub use css_in_js::TokenConsumerHit;
pub use css_in_js::css_in_js_consumer_scan;
pub use css_in_js::css_in_js_object_sheets;
pub use css_in_js::css_in_js_theme_token_defs;
pub use css_in_js::css_in_js_token_defs;
pub use css_in_js::css_in_js_virtual_stylesheet;
pub use css_metrics::compute_css_analytics;
pub use css_metrics::parse_css_color_rgb;
pub use dom_classes::DomClassScan;
pub use dom_classes::scan_dom_class_values;
pub use glimmer::is_glimmer_file;
pub use glimmer::strip_glimmer_templates;
pub use js_text::JsText;
pub use mdx::extract_mdx_statements;
pub use mdx::extract_mdx_statements_mapped;
pub use sfc::SourceRegion;
pub use sfc::extract_sfc_scripts;
pub use sfc::extract_sfc_styles;
pub use sfc::extract_sfc_template_regions;
pub use sfc::is_sfc_file;
pub use sfc::sfc_merged_script_source;
pub use sfc_css::scoped_unused_classes;
pub use sfc_css::sfc_preprocessor_virtual_stylesheet;
pub use sfc_css::sfc_virtual_stylesheet;
pub use similar_code::extract_similar_code_functions;
pub use tailwind::TailwindArbitraryUse;
pub use tailwind::scan_tailwind_arbitrary_values;

Modules§

alchemy
Alchemy resource entries: the main property of a Worker or a function.
astro
Astro component frontmatter extraction.
cache
Incremental parse cache with bitcode serialization.
css
CSS/SCSS file parsing and CSS Module class name extraction.
css_classes
Markup CSS-class reference scanning and class-name similarity.
css_in_js
CSS-in-JS analytics front-ends (CSS program Phases 3b / 3c / 3d).
css_metrics
Structural CSS analytics computed from the parsed CSS syntax tree.
dom_classes
CSS-class references in plain JS/TS DOM code.
effect_facts
Syntactic Effect facts for the Effect dead-code rules.
federation_runtime
Module Federation runtime calls: registerRemotes, loadRemote, init and createInstance.
flags
Feature flag detection via lightweight Oxc AST visitor.
glimmer
Helpers for Glimmer component files (.gts / .gjs).
inventory
Function inventory walker for fallow coverage upload-inventory.
js_text
Conversion of JavaScript string values to Rust text.
mdx
MDX import/export statement extraction.
og_image
Template names of nuxt-og-image calls.
sfc
Vue/Svelte Single File Component (SFC) script and style extraction.
sfc_css
Dead scoped-CSS class detection for Vue/Svelte single-file components.
similar_code
On-demand, bounded JS and TS function extraction for similar-code providers.
suppress
Inline suppression comment parsing.
tailwind
Tailwind CSS arbitrary-value detection. Tailwind CSS arbitrary-value detection.
visitor
Visitor utilities for AST extraction.

Structs§

AngularComponentFieldArrayTypeFact
A typed Angular component field that exposes array elements to templates.
AngularTemplateMemberAccessFact
A member name referenced from an Angular template surface.
AngularThisSpreadFact
Opaque Angular { ...this } forwarding marker.
ClassHeritageInfo
Additional heritage metadata for an exported class.
ClassThisMemberAccessFact
A this-rooted member access with exact enclosing-class provenance.
ClassThisWholeObjectUseFact
A whole-object use of a this-rooted chain with enclosing-class provenance.
ComputedEnumKeyUseFact
A computed property access whose key is a static enum member.
DefaultImportWholeObjectUseFact
A default import binding consumed outside a statically known member access.
DynamicCustomElementRenderFact
Opaque marker for a dynamic custom-element render site.
DynamicImportInfo
A dynamic import() call.
DynamicImportPattern
A dynamic import with a partially resolved pattern.
ExportInfo
An export declaration.
ExportedObjectInstancePropertyFact
A property of an exported object whose value is an instance of a local class.
ExtractionResult
Extracted source plus byte-offset mappings back to the original file.
FactoryCallMemberAccessFact
A member access on a static factory call result.
FactoryFnMemberAccessFact
A member access on a value returned by an imported free-function factory.
FactoryFnWholeObjectFact
A factory-returned value consumed opaquely, so every member of the class it returns must be treated as used.
FactoryReturnExport
An exported free-function factory proven to return one class instance, or one that declares an array of a class as its return type.
FactoryReturnObjectPropertyAccessFact
A member access reached through a property of a value returned by an imported factory that returns an object literal.
FactoryReturnObjectPropertySourceFact
An exported object factory’s deferred property receiver.
FactoryReturnObjectShapeExport
An exported factory function that returns an object literal whose property values are class instances, joined to its public export name.
FlagPatterns
User flag patterns from the flags config section that detection applies during the parse. The default holds the built-in patterns only.
FluentChainMemberAccessFact
A fluent chain rooted at a static factory call, one fact per chain. A step is used when the root method is a factory and each earlier step returns this.
FluentChainNewMemberAccessFact
A fluent chain rooted at a new expression, one fact per chain. A step is used when the first method and each earlier step return this.
ImportInfo
An import declaration.
InstanceExportBindingFact
An exported value whose runtime instance targets a local class or interface.
LocalTypeDeclaration
A module-scope declaration that can be used as a TypeScript type.
MemberAccess
A static member access expression (e.g., Status.Active, MyClass.create()).
MemberInfo
A member of an enum, class, or namespace.
ModuleInfo
Extracted module information from a single file.
ParameterCondition
One condition whose test is a parameter of a module-scope function, or the negation of one: p, !p or !!p as the test of an if, a ?: or a loop. This is the condition that ParamFact::condition_reads counts.
ParseNeeds
The optional facts that a parse run must give for each module.
ParseResult
Result of parsing all files, including incremental cache statistics.
PlaywrightConditionalFixtureDefinitionFact
A Playwright fixture definition from <base>.extend<T>() where base is an imported name. The extractor cannot prove that base holds a Playwright test, so analysis applies the definition only when base resolves to one.
PlaywrightFixtureAliasFact
A Playwright fixture wrapper alias declared by mergeTests or .extend.
PlaywrightFixtureDefinitionFact
A Playwright fixture definition declared by a typed test.extend<T>().
PlaywrightFixtureTypeFact
A nested Playwright fixture binding declared by a fixture type alias.
PlaywrightFixtureUseFact
A member access on a Playwright fixture object inside a test callback.
PlaywrightTestBindingFact
A local name that holds a Playwright test: the result of an .extend() on the @playwright/test test import or of a mergeTests(...) call.
PublicSignatureTypeReference
A reference from an exported symbol’s public signature to a type name.
QualifiedClassMemberAccessFact
A proven class member read through a namespace-qualified constructor or local subclass.
ReExportInfo
A re-export declaration.
RequireCallInfo
A require() call.
RequiredTypeMemberFact
A class member directly required by a named structural type.
ScriptSection
One script section of a container file: the extracted script with its mapping back to the file, and the source type to parse it with.
SourceParseDegradation
A discovered source that was read but did not parse cleanly.
SourceReadFailure
A discovered source that could not be read as UTF-8 text.
StringEnumMemberValueFact
A statically known string value of a TypeScript enum member.
TypeAliasSurfaceTargetFact
One direct contributor to a named type alias’s receiver surface.
TypeMemberTypeEntry
A named-type property whose declared type is a named type reference.
TypedPropertyMemberAccessFact
A member access reached through a typed property hop that the extraction layer could not resolve locally.
VitestModuleMockOperationFact
Ordered Vitest module-mock operation with a static source target.

Enums§

ExportName
Export identifier.
FactoryPropertySource
Deferred class provenance owned by the module declaring an object factory.
ImportedName
How a symbol is imported.
MemberKind
The kind of member.
ModuleLoadMechanism
The runtime mechanism used to load a module.
SemanticFact
A typed extraction fact for cross-layer analysis.
VisibilityTag
Visibility tag from JSDoc/TSDoc comments that suppresses unused-export detection.
VitestModuleMockAction
The action performed by a Vitest module-mock operation.

Constants§

MAX_NESTING_DEPTH
Bracket nesting depth past which a file is not parsed.
TEMPLATE_SINK_CALLEE_PREFIX
The callee path prefix of a sink in template markup (template.innerHTML for Vue v-html, Svelte {@html} and Angular [innerHTML]). The span of such a sink covers its tag or attribute, not the exact sink expression.

Functions§

compute_line_offsets
Compute a table of line-start byte offsets from source text.
embedded_script_sections
The inline script sections of a container file: the <script> blocks of a Vue or Svelte SFC, the frontmatter of an Astro component, or the import and export statements of an MDX document.
is_generated_file
Whether the file at path with the text source is generated code.
parameter_conditions
The conditions of source whose test is a parameter of a module-scope function. A source that does not parse without errors, or that nests deeper than the parse bound, gives none.
parse_all_files
Parse all files, extracting imports and exports.
parse_all_files_cancellable
Parse all files, abandoning the remaining ones once cancellation is set.
parse_all_files_with_mode
Parse files with an explicit optional-fact mode matching the cache identity.
parse_bounded
Run parse, which parses source with Oxc and walks the result, without a stack overflow. Returns None when the bracket nesting of source exceeds MAX_NESTING_DEPTH, its type-argument nesting exceeds MAX_TYPE_ARGUMENT_NESTING (10), or the stack it needs exceeds the cap in stack.rs, so the caller treats the file as a failed parse.
parse_bounded_or_default
Parse source with Oxc and call walk with the result, through parse_bounded. Returns T::default() when the bracket nesting exceeds MAX_NESTING_DEPTH.
parse_from_content
Parse from in-memory content (for LSP, includes complexity).
parse_single_file
Parse a single file and extract module information (without complexity).
parse_source_to_module
Parse source text into a ModuleInfo.
parse_source_to_module_with_flags
Parse source text into a ModuleInfo, with the user flag patterns applied on top of the built-in ones.
parse_suppressions_for_file
Parse the suppressions of a file of any type. A marker inside a string or template literal of the file’s scripts has no effect.
register_thread_stack
Record that the current thread was started with size bytes of stack.
sink_identity_text
The normalized text of the sink expression at bytes start..end of source, the full text of the file at path.