@teacss/config
v0.5.2
Published
TeaCSS config loader — discovers the CSS entry and resolves its directives into a config (no teacss.config file).
Readme
@teacss/config
Discovery and parsing for TeaCSS CSS-entry configuration.
TeaCSS has no teacss.config.* file. Entry discovery checks
package.json#teacss.entry, index.css, then src/index.css.
@preset "standard";
@source "./src/**/*.{ts,tsx}";
@custom {
--color-brand-500: #58a6ff;
}
@teacss;The built-in preset names are standard, shortcuts, and icons.
Shortcuts does not enable Standard. Package and local-file preset
specifiers are also supported.
import { createRecoveryConfigLoader } from "@teacss/config";
const loadConfig = createRecoveryConfigLoader();
const { config, sources } = await loadConfig(process.cwd());sources contains the CSS entry, imported and sourced CSS, package preset entry
files, and static local preset dependency graphs. Build integrations watch this
list. Package dependency trees and dynamic imports are excluded. Local preset
entries may use top-level await; transitive
dependencies must stay synchronous and statically discoverable.
The recovery loader keeps the last valid configuration during temporary edit
errors. Recovery state is isolated by entry path or inline-config identity, and
missing dependency candidates remain in sources so file creation can trigger
a retry.
Failed loads also retain imported stylesheets, resolved package entries, and
dependencies found before a later specifier failed to resolve.
Local preset transforms use a bounded content-addressed cache under the nearest
node_modules/.cache/teacss/preset-transform. Set
TEACSS_PRESET_TRANSFORM_CACHE=false to disable it.
Lower-level APIs:
| API | Purpose |
| ------------------------------------- | ------------------------------------------------------------ |
| resolveEntryConfig | Resolves an entry and returns its source graph. |
| entryDiscoveryFiles | Lists files an integration should watch for entry selection. |
| getConfigSourcesFromError | Recovers bounded source candidates from a failed load. |
| parseEntry | Parses a complete CSS entry. |
| scanTopLevelAtRules | Finds top-level TeaCSS directives safely. |
| scanCustomBlocks / diagnoseCustom | Parses and diagnoses @custom blocks. |
This package does not scan application modules, generate CSS, or manage a build tool's lifecycle.
Pre-1.0. Keep behavior aligned across build, CLI, and editor integrations.
