@tamagui/static 2.0.0-rc.32 → 2.0.0-rc.33

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.
@@ -219,9 +219,12 @@ function getBabelParseDefinition(options) {
219
219
  WrapperIdentifier = t.identifier(wrapperName),
220
220
  WrapperJSXIdentifier = t.jsxIdentifier(wrapperName),
221
221
  hasThemeKeysFlag = themeKeysUsed.size > 0;
222
- root.pushContainer("body", t.variableDeclaration("const", [t.variableDeclarator(WrapperIdentifier, t.callExpression(t.identifier("_withStableStyle"), [t.identifier(name), t.arrowFunctionExpression([t.identifier("theme"), t.identifier("_expressions")],
222
+ if (root.pushContainer("body", t.variableDeclaration("const", [t.variableDeclarator(WrapperIdentifier, t.callExpression(t.identifier("_withStableStyle"), [t.identifier(name), t.arrowFunctionExpression([t.identifier("theme"), t.identifier("_expressions")],
223
223
  // return styles directly - no useMemo, theme changes must trigger style recalc
224
- t.arrayExpression([...hocStylesExpr.elements])), t.booleanLiteral(hasThemeKeysFlag), t.booleanLiteral(hasMediaKeys)]))])), props.node.name = WrapperJSXIdentifier, props.jsxPath.node.openingElement.name = WrapperJSXIdentifier, props.jsxPath.node.closingElement && (props.jsxPath.node.closingElement.name = t.jsxIdentifier(wrapperName)), expressions.length && props.node.attributes.push(t.jsxAttribute(t.jsxIdentifier("_expressions"), t.jsxExpressionContainer(t.arrayExpression(expressions))));
224
+ t.arrayExpression([...hocStylesExpr.elements])), t.booleanLiteral(hasThemeKeysFlag), t.booleanLiteral(hasMediaKeys)]))])), props.node.name = WrapperJSXIdentifier, props.jsxPath.node.openingElement.name = WrapperJSXIdentifier, props.jsxPath.node.closingElement && (props.jsxPath.node.closingElement.name = t.jsxIdentifier(wrapperName)), expressions.length) {
225
+ const safeExpressions = expressions.map(expr => t.isStringLiteral(expr) ? expr : t.unaryExpression("!", t.unaryExpression("!", expr)));
226
+ props.node.attributes.push(t.jsxAttribute(t.jsxIdentifier("_expressions"), t.jsxExpressionContainer(t.arrayExpression(safeExpressions))));
227
+ }
225
228
  } else props.node.attributes.push(t.jsxAttribute(t.jsxIdentifier("style"), t.jsxExpressionContainer(stylesExpr.elements.length === 1 ? stylesExpr.elements[0] : stylesExpr)));
226
229
  }
227
230
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/static",
3
- "version": "2.0.0-rc.32",
3
+ "version": "2.0.0-rc.33",
4
4
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
5
  "license": "MIT",
6
6
  "source": "src/index.ts",
@@ -50,19 +50,19 @@
50
50
  "@babel/template": "^7.25.0",
51
51
  "@babel/traverse": "^7.25.4",
52
52
  "@babel/types": "^7.25.4",
53
- "@tamagui/cli-color": "2.0.0-rc.32",
54
- "@tamagui/config-default": "2.0.0-rc.32",
55
- "@tamagui/core": "2.0.0-rc.32",
56
- "@tamagui/fake-react-native": "2.0.0-rc.32",
57
- "@tamagui/generate-themes": "2.0.0-rc.32",
58
- "@tamagui/helpers": "2.0.0-rc.32",
59
- "@tamagui/helpers-node": "2.0.0-rc.32",
60
- "@tamagui/proxy-worm": "2.0.0-rc.32",
61
- "@tamagui/react-native-web-internals": "2.0.0-rc.32",
62
- "@tamagui/react-native-web-lite": "2.0.0-rc.32",
63
- "@tamagui/shorthands": "2.0.0-rc.32",
64
- "@tamagui/types": "2.0.0-rc.32",
65
- "@tamagui/web": "2.0.0-rc.32",
53
+ "@tamagui/cli-color": "2.0.0-rc.33",
54
+ "@tamagui/config-default": "2.0.0-rc.33",
55
+ "@tamagui/core": "2.0.0-rc.33",
56
+ "@tamagui/fake-react-native": "2.0.0-rc.33",
57
+ "@tamagui/generate-themes": "2.0.0-rc.33",
58
+ "@tamagui/helpers": "2.0.0-rc.33",
59
+ "@tamagui/helpers-node": "2.0.0-rc.33",
60
+ "@tamagui/proxy-worm": "2.0.0-rc.33",
61
+ "@tamagui/react-native-web-internals": "2.0.0-rc.33",
62
+ "@tamagui/react-native-web-lite": "2.0.0-rc.33",
63
+ "@tamagui/shorthands": "2.0.0-rc.33",
64
+ "@tamagui/types": "2.0.0-rc.33",
65
+ "@tamagui/web": "2.0.0-rc.33",
66
66
  "babel-literal-to-ast": "^2.1.0",
67
67
  "browserslist": "^4.28.1",
68
68
  "check-dependency-version-consistency": "^4.1.0",
@@ -79,7 +79,7 @@
79
79
  },
80
80
  "devDependencies": {
81
81
  "@babel/plugin-syntax-typescript": "^7.25.4",
82
- "@tamagui/build": "2.0.0-rc.32",
82
+ "@tamagui/build": "2.0.0-rc.33",
83
83
  "@types/babel__core": "^7.20.5",
84
84
  "@types/find-root": "^1.1.2",
85
85
  "@types/node": "^22.1.0",
@@ -384,10 +384,17 @@ export function getBabelParseDefinition(options: TamaguiOptions) {
384
384
  }
385
385
 
386
386
  if (expressions.length) {
387
+ // coerce runtime expressions to boolean so they can't be
388
+ // confused with string media keys at runtime
389
+ const safeExpressions = expressions.map((expr) =>
390
+ t.isStringLiteral(expr)
391
+ ? expr
392
+ : t.unaryExpression('!', t.unaryExpression('!', expr))
393
+ )
387
394
  props.node.attributes.push(
388
395
  t.jsxAttribute(
389
396
  t.jsxIdentifier('_expressions'),
390
- t.jsxExpressionContainer(t.arrayExpression(expressions))
397
+ t.jsxExpressionContainer(t.arrayExpression(safeExpressions))
391
398
  )
392
399
  )
393
400
  }
@@ -1 +1 @@
1
- {"version":3,"file":"extractToNative.d.ts","sourceRoot":"","sources":["../../src/extractor/extractToNative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,aAAa,CAAA;AAQxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAsB9C,wBAAgB,eAAe,CAC7B,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,GACtB,eAAe,CAoBjB;AAED,wBAAgB,cAAc,QAK7B;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,cAAc;;;;wBAM3C,GAAG;;;EAkYtB"}
1
+ {"version":3,"file":"extractToNative.d.ts","sourceRoot":"","sources":["../../src/extractor/extractToNative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,aAAa,CAAA;AAQxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAsB9C,wBAAgB,eAAe,CAC7B,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,GACtB,eAAe,CAoBjB;AAED,wBAAgB,cAAc,QAK7B;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,cAAc;;;;wBAM3C,GAAG;;;EAyYtB"}