Repository navigation
feat!: faster style-object types; sound pruning of unused options - #429
Merged
Merged
Conversation
…y count PropertyValues instantiated PropertyTypes with a generic argument, so every variance probe of the builder types built a fresh union of every property's value type. It now instantiates PropertyTypes only with fixed arguments, and asClass returns BuilderClassResolver so its object constraint is met by the declaration. Under TypeScript 7 the type-budget fixtures check in about 100 ms instead of 390, and 860 extra properties add 9 ms instead of 400. TypeScript 5.9 improves by about a third. Every fixture passes unchanged. addConditions rejects an alias without the _ prefix in core, react and effect-ui; such aliases were never matched. The type-budget baseline is re-recorded. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…s; no-unused-variant Variants without a defaultVariant were left out of usage tracking and never pruned, and a component whose renders set no state kept every state. Production builds now prune a variant option no render selects and a state no render sets, under the conditions already applied elsewhere: dynamic values, spreads, escapes, forwarded components, incomplete analysis and development mode keep everything. Each elimination record carries the component's file, the prop, and the position of the eliminated option, state or compound. Builds with lintFiles write .animus/unused.json, and animus/no-unused-variant reports each at its definition while every analysed file still matches the build. The parity baselines are refreshed under intent prune-unselected-options-20261128: removals only, in eleven production units. The packed fixture renders a disabled button so its states layer is still exercised. Verified at this commit: vp run verify:full (55 of 55 tasks). verify:bench reports every row invalid, because output now differs from release 0.2.0 by design; scripts/bench/accepted-differences.json is not updated here. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This was referenced Nov 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two changes, one commit each, on top of #428.
Style-object check time no longer grows with the property count
PropertyValuespassed a generic argument intoPropertyTypes, so each variance probe built a fresh union of every property's value type, at roughly quadratic cost in the number of properties.PropertyValuesnow instantiatesPropertyTypesonly with fixed arguments, so every probe shares one cached lookup.asClassreturns the newBuilderClassResolver<B>, whoseobjectconstraint is met by the declaration.Median check time under TypeScript 7:
Under TypeScript 5.9 check time falls by about a third and still grows with the property count, at roughly half the old rate.
Every fixture passes unchanged on both compilers, with and without
exactOptionalPropertyTypes; hover types and declaration output are the same apart from the changes above.scripts/type-budget/baseline.jsonis re-recorded.addConditionsrejects an alias without the_prefix in core, react and effect-ui. The extractor only looks up condition aliases that start with_, so an unprefixed one was registered and never matched.Pruning, located eliminations,
no-unused-variantTwo gaps in production pruning:
defaultVariantwas left out of usage tracking and never pruned, so<Button size="sm">kept the CSS for every other size.Both are now pruned when no render selects them. Everything kept deliberately is still kept: dynamic values, spreads, escaping or forwarded components, incomplete analysis, and development mode.
e2e/vite-appCSS goes from 11,903 to 11,576 bytes.report.eliminated_detailsgainsfile,prop,at(the position of the option's key, the state's key, or the compound call) andkept_elsewhere.lintFileswrite.animus/unused.json.animus/no-unused-variantreports each unused option, state and compound at its definition, and is silent once any analysed file differs from the build, since a use elsewhere can change the answer.e2e/rollup-applint assertion now covers the unused option.e2e/packed-apprenders a disabled button, so itsanm-stateslayer is still emitted and checked.Release notes
addConditionsrejects an alias name without the_prefix. New exported typesBuilderClassResolverandUnprefixedConditionAlias.defaultVariantthat no render selects, states no render sets, and compounds that need only such options. An app that applied those class names by hand loses the CSS.report.eliminated_detailsrecords gainfile,prop,atandkept_elsewhere.animus/no-unused-variantand artifact.animus/unused.json.Verification
vp run verify:fullpasses at52b73238: 55 of 55 tasks.prune-unselected-options-20261128: removals only, in eleven production units, each checked against its renders. Code and diagnostics did not move.verify:benchreports every row INVALID: the Vite app's CSS now differs from release 0.2.0, as do the loader and analysis outputs recorded on feat!: structured diagnostics, tighter types, CI hardening #427.scripts/bench/accepted-differences.jsonis not updated in this PR, so the gate measures nothing until it is.🤖 Generated with Claude Code