@stylexjs/babel-plugin 0.10.0-beta.1 → 0.10.0-beta.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.
Files changed (2) hide show
  1. package/lib/index.js +7 -4
  2. package/package.json +3 -3
package/lib/index.js CHANGED
@@ -2889,12 +2889,15 @@ function requireTransformValue () {
2889
2889
  const value = typeof rawValue === 'number' ? String(Math.round(rawValue * 10000) / 10000) + getNumberSuffix(key) : rawValue;
2890
2890
  if ((key === 'content' || key === 'hyphenateCharacter' || key === 'hyphenate-character') && typeof value === 'string') {
2891
2891
  const val = value.trim();
2892
- if (val.match(/^attr\([a-zA-Z0-9-]+\)$/)) {
2892
+ const cssContentFunctions = ['attr(', 'counter(', 'counters(', 'url(', 'linear-gradient(', 'image-set('];
2893
+ const cssContentKeywords = new Set(['normal', 'none', 'open-quote', 'close-quote', 'no-open-quote', 'no-close-quote', 'inherit', 'initial', 'revert', 'revert-layer', 'unset']);
2894
+ const isCssFunction = cssContentFunctions.some(func => val.includes(func));
2895
+ const isKeyword = cssContentKeywords.has(val);
2896
+ const hasMatchingQuotes = (val.match(/"/g)?.length ?? 0) >= 2 || (val.match(/'/g)?.length ?? 0) >= 2;
2897
+ if (isCssFunction || isKeyword || hasMatchingQuotes) {
2893
2898
  return val;
2894
2899
  }
2895
- if (!(val.startsWith('"') && val.endsWith('"') || val.startsWith("'") && val.endsWith("'"))) {
2896
- return `"${val}"`;
2897
- }
2900
+ return `"${val}"`;
2898
2901
  }
2899
2902
  return (0, _normalizeValue.default)(value, key, options);
2900
2903
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stylexjs/babel-plugin",
3
- "version": "0.10.0-beta.1",
3
+ "version": "0.10.0-beta.2",
4
4
  "description": "StyleX babel plugin.",
5
5
  "main": "lib/index.js",
6
6
  "repository": "https://github.com/facebook/stylex",
@@ -14,8 +14,8 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@babel/helper-module-imports": "^7.22.15",
17
- "@stylexjs/shared": "0.10.0-beta.1",
18
- "@stylexjs/stylex": "0.10.0-beta.1",
17
+ "@stylexjs/shared": "0.10.0-beta.2",
18
+ "@stylexjs/stylex": "0.10.0-beta.2",
19
19
  "@babel/core": "^7.25.8",
20
20
  "@babel/traverse": "^7.25.7",
21
21
  "@babel/types": "^7.25.8",