Expand description
CSS-in-JS analytics front-ends (CSS program Phases 3b / 3c / 3d).
Three front-ends feed the shared styling-analytics pipeline, converging on the
same virtual-stylesheet output that compute_css_analytics consumes:
template: the Phase 3b lexical lifter forstyled.div`...`tagged templates.object: the Phase 3c AST object-to-CSS serializer (style({...}),stylex.create({...}), …).tokens: the Phase 3d design-token definition extraction + cross-module consumer scan (StyleXdefineVars, vanilla-extractcreateTheme).
shared holds the small invariants the front-ends agree on (the synthetic
wrapper selector, the newline counter).
Structs§
- CssIn
JsObject Sheets - The three virtual stylesheets lifted from a source’s object-notation
CSS-in-JS, each blank-line-padded so CSS metric line numbers map back onto the
real source. Each is
Nonewhen the source has no object CSS-in-JS of that class (so callers skip it; nofiles_analyzedinflation). See the module docs for the per-sheet engine policy. - CssIn
JsToken - A single defined design token: its dotted LEAF path relative to the access
binding (
color.primary, or flatprimaryColorfor StyleX), the 1-based source line of its key, and the static value when the literal is recoverable. - CssIn
JsToken Def - A CSS-in-JS token-definition site: the exported access binding consumers read
through (e.g.
vars) and the flattened leaf tokens it defines. - Token
Consumer Hit - One located consumer of a CSS-in-JS token: the defined LEAF token path it
reads (relative to the binding, e.g.
color.primary) and the 1-based line of the member-access site.
Enums§
- CssIn
JsToken Origin - The CSS-in-JS token system that produced a token definition.
Functions§
- css_
in_ js_ object_ sheets - Lift the object-notation CSS-in-JS in a JS/TS source into the structural /
structural-partial / atomic virtual stylesheets. Parses with oxc (source type
inferred from
path), maps import bindings to recognized libraries, walks for style calls, serializes each bucket, and pads each to its source line. All sheets areNonewhen the source has no recognized object CSS-in-JS import. - css_
in_ js_ theme_ consumers - Walk a consuming JS/TS source for styled-components / Emotion theme reads such
as
theme.colors.brandandprops.theme.colors.brand. - css_
in_ js_ theme_ token_ defs - Walk a JS/TS source for statically-authored theme object definitions used by
styled-components and Emotion. A
themeor*Themevariable with an object literal initializer becomes a token surface, with nested scalar leaves exposed as dotted paths. - css_
in_ js_ token_ consumers - Walk a consuming JS/TS source for cross-module reads of a token binding,
returning the located reads that resolve to a DEFINED leaf token path. The
caller supplies the local
aliasthe consuming file imported the token binding under (so aliased imports work) and the set of defined leaf paths. A member access<alias>.a.bis a hit whena.bis exactly a defined leaf path; intermediate groups (<alias>.awhere onlya.bis defined) and accesses on other bindings are not hits, so there is no double-count and no false match. - css_
in_ js_ token_ defs - Walk a JS/TS source for CSS-in-JS design-token DEFINITIONS, returning each access binding and its flattened leaf token paths. Empty when the source has no recognized token-library import (provenance gate closed).
- css_
in_ js_ virtual_ stylesheet - Build a virtual stylesheet from the CSS-in-JS tagged templates in a JS/TS
source. Each template body is placed at its real line in the source via
blank-line padding, so CSS metric line numbers from
crate::compute_css_analyticsmap straight back onto the source. Every${...}interpolation is masked to a CSS-valid placeholder (newline count preserved so lines after a multi-line interpolation stay aligned). ReturnsNonewhen the source has no CSS-in-JS tagged template, so callers skip the file entirely (nofiles_analyzedinflation). - panda_
style_ value_ consumers - Walk a consuming JS/TS source for common PandaCSS style calls whose object literal values statically name token paths.
- panda_
token_ call_ consumers - Walk a consuming JS/TS source for PandaCSS
token('path.to.token')calls. The caller supplies the local alias imported from Panda’s generatedstyled-systemtoken module and the set of defined leaf paths.