@plumeria/codemod 21.2.1 → 21.2.2

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.
@@ -885,9 +885,11 @@ exports.releaseStyles = {
885
885
  takeProp();
886
886
  return;
887
887
  }
888
- const texts = elements.map(resolveText);
889
- if (texts.some((text) => text === undefined))
888
+ const resolved = elements.map(resolveText);
889
+ if (!complete && resolved.every((text) => text === undefined))
890
890
  return;
891
+ const unnamed = resolved.includes(undefined);
892
+ const texts = resolved.map((text, at) => text ?? sourceCode.getText(elements[at]));
891
893
  const ranked = elements.map((element) => element.type === 'LogicalExpression'
892
894
  ? styleKey(element.right)
893
895
  : styleKey(element));
@@ -909,7 +911,7 @@ exports.releaseStyles = {
909
911
  }
910
912
  }
911
913
  const declarations = elements.flatMap(declarationsOf);
912
- const replacement = elements.some(needsFilter)
914
+ const replacement = unnamed || elements.some(needsFilter)
913
915
  ? `[${texts.join(', ')}].filter(Boolean).join(' ')`
914
916
  : `[${texts.join(', ')}].join(' ')`;
915
917
  if (declarations.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/codemod",
3
- "version": "21.2.1",
3
+ "version": "21.2.2",
4
4
  "description": "Codemods for Plumeria: migrate a CSS Modules codebase in, export it back out, and rename the styling prop or an API",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",