Repository navigation
fix(extractor): report unsupported StyleX APIs as located errors - #905
Merged
Merged
Conversation
A `@stylexjs/stylex` export outside the compiled set (`when`, `env`, `defaultMarker`, ...) was dropped from the bindings with no diagnostic, so its calls stayed StyleX calls that throw at runtime. Importing it by name, or reading it as a member of the package imported whole, is now a located build error naming the API and listing what Devup UI compiles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
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.
Summary
SX-10 (covers SX-09
whenand SX-11env). Before this change, a@stylexjs/stylexexport outsideSTYLEX_EXPORTSwas skipped invisit_import_declarationand no diagnostic was given. The import stayed on@stylexjs/stylex, so the call ran at runtime and threw because no StyleX compiler had run. A named import likeimport { when } from '@stylexjs/stylex'and a member read on the whole-package import likestylex.when.ancestor(...),stylex.envorstylex.defaultMarker()are now located build errors. Each error names the API and lists what Devup UI compiles (#682).scope::lookup::stylex_memberreads the member name off the namespace. The check runs invisit_expression, so awhenused as a computed key insidestylex.create()is still reported.test_stylex_import_unknown_namedused to snapshot the residue, whereunknownFunctionstayed imported from@stylexjs/stylex. It now asserts the error, and its snapshot is removed.New build error:
`@stylexjs/stylex` `when` is not compiled by Devup UI, so it would stay a StyleX call at runtime, which throws with no StyleX compiler run. Fix: use only `create`, `props`, …Refs #690
Test plan
cargo test -p extractor --lib -- stylex sx(2244 passed)stylex_unsupported_api_is_located_errorreviewed: named, aliased, default namespace,* asnamespace, and computed key insidecreate()cargo clippy -p extractor --all-targets -- -D warnings,cargo fmt --all🤖 Generated with Claude Code