@teacss/runtime
v0.10.11
Published
Build-pipeline runtime for TeaCSS (context, content extraction, transformers, layers).
Readme
@teacss/runtime
Shared stateful runtime for TeaCSS build integrations. It loads a CSS entry
through @teacss/config, tracks source modules, runs transformers, extracts
tokens, and coordinates @teacss/core generation. Applications should use a
concrete build adapter.
Use applyTransformerPipeline for the pre → default → post sequence, or
applyTransformers for one phase. A stateful transformer may implement
onModuleRemoved(id, ctx) to release module-owned registrations. Its idFilter
receives the current module ID with the transformer as this; the pipeline
filter receives the current transformed code and ID.
Reloads are transactional: a candidate configuration replays tracked modules
and settles staged work before publication. Failure preserves the last valid
runtime state while exposing source dependencies for recovery. Overlapping
transforms reconcile to the newest source and context. Stateful transformers
should key registrations by ctx or ctx.generator, and make cleanup
idempotent. onReload and onInvalidate return disposers.
getModuleOutput(ctx, id) reads the latest successful full-pipeline output,
including output from a module currently excluded by global content filtering.
Source generation
Node integrations can share file reading and aggregation through the public subpath:
import {
DEFAULT_SOURCE_IGNORE,
generateSources,
readSourceFile,
} from "@teacss/runtime/source-generation";readSourceFile treats a missing file as empty and preserves other filesystem
errors. generateSources applies configured extractors to supplied file paths
and source content. Pass file paths alone and the runtime reads them through
readSourceFile. If the generator configuration or extraction hooks change
mid-build, it re-extracts those sources before returning a result. A caller's
isInputCurrent check remains authoritative: a failed or false check is not
retried as an internal snapshot change.
This package defines no utility vocabulary or application-facing class API.
