styled-components-to-stylex-codemod 0.0.30 → 0.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/transform.mjs +12 -5
- package/package.json +1 -1
package/dist/transform.mjs
CHANGED
|
@@ -3637,8 +3637,10 @@ function normalizeStylisAstToIR(stylisAst, slots, options = {}) {
|
|
|
3637
3637
|
const propsArr = Array.isArray(node.props) ? node.props : null;
|
|
3638
3638
|
const rule = ensureRule((() => {
|
|
3639
3639
|
if (!stripFormFeedInSelectors || !selectorValue.includes("\f") || !propsArr?.length) return selectorRaw;
|
|
3640
|
-
const
|
|
3641
|
-
|
|
3640
|
+
const resolved = propsArr.filter((p) => typeof p === "string").map((p) => `&${p}`).join(",");
|
|
3641
|
+
const hasSiblingCombinator = (s) => /[+~]/.test(s.replace(/\[[^\]]*\]/g, ""));
|
|
3642
|
+
if (hasSiblingCombinator(selectorRaw) || hasSiblingCombinator(resolved)) return selectorRaw;
|
|
3643
|
+
if (resolved.length > selectorRaw.length) return resolved;
|
|
3642
3644
|
return selectorRaw;
|
|
3643
3645
|
})(), atRuleStack);
|
|
3644
3646
|
const children = node.children;
|
|
@@ -14547,13 +14549,18 @@ function parseSingleSelector(selector) {
|
|
|
14547
14549
|
kind: "unsupported",
|
|
14548
14550
|
reason: "attribute selector"
|
|
14549
14551
|
};
|
|
14550
|
-
if (
|
|
14552
|
+
if (pseudoElements.length > 0) return {
|
|
14551
14553
|
kind: "unsupported",
|
|
14552
|
-
reason: "attribute selector with pseudo"
|
|
14554
|
+
reason: "attribute selector with pseudo-element"
|
|
14555
|
+
};
|
|
14556
|
+
const attrStr = attributes.map((a) => a.toString()).join("");
|
|
14557
|
+
if (pseudoClasses.length > 0) return {
|
|
14558
|
+
kind: "pseudo",
|
|
14559
|
+
pseudos: [`${buildPseudoString(pseudoClasses)}:is(${attrStr})`]
|
|
14553
14560
|
};
|
|
14554
14561
|
return {
|
|
14555
14562
|
kind: "pseudo",
|
|
14556
|
-
pseudos: [`:is(${
|
|
14563
|
+
pseudos: [`:is(${attrStr})`]
|
|
14557
14564
|
};
|
|
14558
14565
|
}
|
|
14559
14566
|
if (!hasNesting && (pseudoClasses.length > 0 || pseudoElements.length > 0)) {}
|