feat: extend TD pipeline to analyze @patternfly/react-styles utility class modules #5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
@patternfly/react-styles exports CSS utility class mappings via deep import paths (e.g., @patternfly/react-styles/css/utilities/Alignment/alignment). These are JS objects that map property names to CSS class names:
// v5
declare const _default: {
textAlignRight: string;
textAlignLeft: string;
textAlignCenter: string;
};
In PFv6, several property names changed (e.g., textAlignRight → textAlignEnd for CSS logical properties). The semver-analyzer does not detect these changes because @patternfly/react-styles is not in the analyzed package set.
Consumer code using these utilities breaks silently at runtime — alignment.textAlignRight returns undefined instead of a CSS class name.
Why TD Pipeline
This is a TypeScript API surface change — exported object shapes in .d.ts files changed between versions. The TD pipeline (structural API diff) is the architecturally correct place to detect renamed/removed/added properties on these exported objects.
Challenges
Three compounding issues make this harder than adding a normal package to the analysis:
Proposed Approach
Option A: Add deep-import discovery for react-styles
Extend the entry-point reachability filter to also discover css/**/*.d.ts modules within react-styles. This would work if the .d.ts files exist in the repo at the analyzed refs (they may be committed or gitignored).
Steps:
Option B: Dedicated react-styles extractor
Build a lighter-weight extractor specifically for react-styles CSS module .d.ts files:
This is simpler but less general.
Impact
Context
Discovered during tackle2-ui migration analysis. The issue was initially classified as "analysis-scope gap" in the diagnostic session. The SD pipeline already recognizes react-styles imports for BEM block extraction but doesn't diff the utility class shapes.
Related: hack/integration/patternfly-token-mappings.yaml handles a similar case for @patternfly/react-tokens via a curated mapping file. A similar approach could be used as an interim solution before the full TD pipeline extension.