generate_css.ts

Shared CSS-generation pipeline for the Gro generator and the Vite plugin.

Both consumers extract classes from source files their own way (batch via the Gro filer, incrementally via Vite's transform hook), then funnel the aggregated result through this single function so their CSS output stays identical. Callers own banner wrapping and error/warning dispatch (those differ by logger), this owns the generate → resolve → bundle pipeline.

Declarations
#

3 declarations

view source

generate_css
#

GenerateCssOptions
#

generate_css.ts view source

GenerateCssOptions

Inputs to generate_css. The first group mirrors the shape returned by CssClasses.get_all() plus its diagnostics, so callers can forward it directly.

all_classes

All detected class names, already exclude-filtered.

type Set<string>

all_classes_with_locations

Source locations per class, for diagnostics.

type Map<string, Array<SourceLocation> | null>

explicit_classes

Classes from @fuz-classes/additional_classes; unresolved ones error.

type Set<string> | null

all_elements

All detected HTML element names.

type Set<string>

explicit_elements

Elements from @fuz-elements; unresolved ones error.

type Set<string> | null

explicit_variables

Variables from @fuz-variables; unresolved ones error.

type Set<string> | null

extraction_diagnostics

Diagnostics accumulated during extraction.

type Array<Diagnostic>

detected_css_variables

CSS variables referenced in source, already filtered to known theme variables by the caller. @fuz-variables are merged in here automatically.

type Set<string>

class_definitions

type Record<string, CssClassDefinition | undefined>

interpreters

type Array<CssClassDefinitionInterpreter>

css_properties

Valid CSS properties for literal validation, or null to skip.

type Set<string> | null

include_base

type boolean

include_theme

type boolean

resources

Bundled resources, or null for utility-only mode.

type BundledCssResources | null

additional_elements

type Iterable<string> | 'all'

additional_variables

type Iterable<string> | 'all'

exclude_elements

type Iterable<string>

exclude_variables

type Iterable<string>

theme_specificity

type number

log

Optional logger; only used to emit resolution stats when include_stats.

type Logger

include_stats

Whether to compute and log resolution statistics.

type boolean

GenerateCssResult
#

generate_css.ts view source

GenerateCssResult

css

Final CSS without banner comments — callers add their own.

type string

diagnostics

Extraction + generation + resolution diagnostics, unfiltered.

type Array<Diagnostic>

Depends on
#

Imported by
#