Repository navigation
feat(cli): add rebrand-xds-css-namespace codemod (P2) - #2883
Merged
Merged
Conversation
Second XDS-prefix migration codemod (P2380608025). Rebrands consumer override CSS and markup from the legacy `xds` DOM namespace to `astryx`: .xds-button -> .astryx-button [data-xds-theme=...] -> [data-astryx-theme=...] data-xds-media="dark" -> data-astryx-media="dark" (JSX/markup) className="xds-card" -> className="astryx-card" During compat the library dual-emits both class names and the theme/media data attributes, so a consumer can flip selectors to the astryx form at any time and they keep matching. Deliberately leaves untouched (per P0): - @layer xds-base / xds-theme — a CSS layer cannot be aliased/dual-emitted, so layer names stay xds-* through the whole compat window and only rebrand at final cutover; rewriting them would desync the consumer from the librarys emitted layer. - --xds-* custom properties — they use the inverted read fallback and need per-case human review (stale vs intentional), handled separately. String-based transform (CSS is not JS-parseable), mirroring the existing migrate-theme-selectors-to-data-attrs codemod. Registered in v0.0.15 as optional; run via: xds upgrade --codemod rebrand-xds-css-namespace --codemod-only --apply Test plan: 10 tests — class selectors, data-attr selectors, JSX attrs, getAttribute string args, className tokens, a realistic override block, and the safety cases (layer names + --xds-* vars preserved). 26 tests pass across both P2 codemods + the upgrade suite. Stacked on #2879 (drop-xds-prefix-imports) — shares the v0.0.15 manifest.
ejhammond
requested review from
cixzhang,
imdreamrunner,
josephfarina,
marie-lucas,
nynexman4464 and
thedjpetersen
as code owners
June 17, 2026 03:45
|
@ejhammond must be a member of the Meta Open Source team on Vercel to deploy. Learn more about collaboration on Vercel and other options here. |
This branch had an error being deployed
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
Second P2 (codemods) transform for the XDS → Astryx prefix migration (paste P2380608025). Rebrands consumer override CSS and markup from the legacy
xdsDOM namespace toastryx:Pairs with the JS-identifier codemod (#2879) — together they cover the consumer-side rewrites P9 runs per app.
Safety boundaries (per P0)
During compat the library dual-emits both class names and the theme/media data attributes, so flipping selectors to
astryxis always safe. The codemod deliberately leaves untouched:@layer xds-base/@layer xds-theme— a CSS layer can't be aliased or dual-emitted, so layer names stayxds-*through the whole compat window and only rebrand at final cutover. Rewriting them would desync the consumer from the library's emitted layer (the split-brain hazard).--xds-*custom properties — these use the inverted read fallback (feat(core): rebrand component padding vars with inverted-fallback compat (P3c, part 4 — final) #2882) and need per-case human review (stale vs intentional override), handled separately in P9.Implementation
String-based transform (CSS isn't JS-parseable), mirroring the existing
migrate-theme-selectors-to-data-attrscodemod. Three patterns:data-xds-*attributes,.xds-*class selectors, and barexds-*class tokens inclassNamestrings (with aLAYER_NAMESguard preservingxds-base/xds-theme).Registered in v0.0.15 as
optional; run via:Test plan
getAttributestring args,classNametokens, a realistic override block, and the safety cases (layer names +--xds-*vars preserved).