@tamagui/static 1.110.4 → 1.111.0

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 (223) hide show
  1. package/dist/cjs/checkDeps.native.js +3 -131
  2. package/dist/cjs/checkDeps.native.js.map +1 -1
  3. package/dist/cjs/extractor/babelParse.native.js +3 -3
  4. package/dist/cjs/extractor/babelParse.native.js.map +1 -1
  5. package/dist/cjs/extractor/buildClassName.native.js +5 -5
  6. package/dist/cjs/extractor/buildClassName.native.js.map +1 -1
  7. package/dist/cjs/extractor/bundle.native.js +35 -260
  8. package/dist/cjs/extractor/bundle.native.js.map +2 -2
  9. package/dist/cjs/extractor/bundleConfig.native.js +153 -429
  10. package/dist/cjs/extractor/bundleConfig.native.js.map +2 -2
  11. package/dist/cjs/extractor/createEvaluator.native.js +2 -2
  12. package/dist/cjs/extractor/createEvaluator.native.js.map +1 -1
  13. package/dist/cjs/extractor/createExtractor.native.js +488 -730
  14. package/dist/cjs/extractor/createExtractor.native.js.map +2 -2
  15. package/dist/cjs/extractor/createLogger.native.js +2 -2
  16. package/dist/cjs/extractor/createLogger.native.js.map +1 -1
  17. package/dist/cjs/extractor/esbuildAliasPlugin.native.js +3 -3
  18. package/dist/cjs/extractor/esbuildAliasPlugin.native.js.map +1 -1
  19. package/dist/cjs/extractor/extractHelpers.native.js +17 -71
  20. package/dist/cjs/extractor/extractHelpers.native.js.map +2 -2
  21. package/dist/cjs/extractor/extractMediaStyle.native.js +21 -73
  22. package/dist/cjs/extractor/extractMediaStyle.native.js.map +2 -2
  23. package/dist/cjs/extractor/extractToClassNames.native.js +243 -423
  24. package/dist/cjs/extractor/extractToClassNames.native.js.map +2 -2
  25. package/dist/cjs/extractor/extractToNative.native.js +30 -93
  26. package/dist/cjs/extractor/extractToNative.native.js.map +2 -2
  27. package/dist/cjs/extractor/generateTamaguiStudioConfig.native.js +43 -365
  28. package/dist/cjs/extractor/generateTamaguiStudioConfig.native.js.map +2 -2
  29. package/dist/cjs/extractor/generatedUid.native.js +1 -5
  30. package/dist/cjs/extractor/generatedUid.native.js.map +1 -1
  31. package/dist/cjs/extractor/getPrefixLogs.native.js +1 -1
  32. package/dist/cjs/extractor/getPrefixLogs.native.js.map +1 -1
  33. package/dist/cjs/extractor/getPropValueFromAttributes.native.js +2 -1
  34. package/dist/cjs/extractor/getPropValueFromAttributes.native.js.map +2 -2
  35. package/dist/cjs/extractor/getStaticBindingsForScope.native.js +91 -292
  36. package/dist/cjs/extractor/getStaticBindingsForScope.native.js.map +2 -2
  37. package/dist/cjs/extractor/hoistClassNames.native.js +1 -1
  38. package/dist/cjs/extractor/hoistClassNames.native.js.map +1 -1
  39. package/dist/cjs/extractor/literalToAst.native.js +15 -69
  40. package/dist/cjs/extractor/literalToAst.native.js.map +1 -1
  41. package/dist/cjs/extractor/loadFile.native.js +5 -8
  42. package/dist/cjs/extractor/loadFile.native.js.map +1 -1
  43. package/dist/cjs/extractor/loadTamagui.native.js +155 -574
  44. package/dist/cjs/extractor/loadTamagui.native.js.map +2 -2
  45. package/dist/cjs/extractor/logLines.native.js +1 -1
  46. package/dist/cjs/extractor/logLines.native.js.map +1 -1
  47. package/dist/cjs/extractor/normalizeTernaries.native.js +4 -59
  48. package/dist/cjs/extractor/normalizeTernaries.native.js.map +1 -1
  49. package/dist/cjs/extractor/propsToFontFamilyCache.native.js +1 -1
  50. package/dist/cjs/extractor/propsToFontFamilyCache.native.js.map +1 -1
  51. package/dist/cjs/extractor/removeUnusedHooks.native.js +1 -1
  52. package/dist/cjs/extractor/removeUnusedHooks.native.js.map +1 -1
  53. package/dist/cjs/extractor/timer.native.js +2 -2
  54. package/dist/cjs/extractor/timer.native.js.map +1 -1
  55. package/dist/cjs/extractor/watchTamaguiConfig.native.js +25 -166
  56. package/dist/cjs/extractor/watchTamaguiConfig.native.js.map +2 -2
  57. package/dist/cjs/getPragmaOptions.native.js +1 -1
  58. package/dist/cjs/getPragmaOptions.native.js.map +1 -1
  59. package/dist/cjs/helpers/requireTamaguiCore.native.js.map +1 -1
  60. package/dist/cjs/minifyCSS.native.js +1 -1
  61. package/dist/cjs/minifyCSS.native.js.map +2 -2
  62. package/dist/cjs/registerRequire.native.js +18 -37
  63. package/dist/cjs/registerRequire.native.js.map +1 -1
  64. package/dist/cjs/server.native.js +21 -163
  65. package/dist/cjs/server.native.js.map +2 -2
  66. package/dist/esm/checkDeps.native.js +3 -131
  67. package/dist/esm/checkDeps.native.js.map +1 -1
  68. package/dist/esm/checkDeps.native.mjs +10 -0
  69. package/dist/esm/checkDeps.native.mjs.map +1 -0
  70. package/dist/esm/constants.native.mjs +12 -0
  71. package/dist/esm/constants.native.mjs.map +1 -0
  72. package/dist/esm/exports.native.mjs +16 -0
  73. package/dist/esm/exports.native.mjs.map +1 -0
  74. package/dist/esm/extractor/accessSafe.native.mjs +12 -0
  75. package/dist/esm/extractor/accessSafe.native.mjs.map +1 -0
  76. package/dist/esm/extractor/babelParse.native.js +3 -3
  77. package/dist/esm/extractor/babelParse.native.js.map +1 -1
  78. package/dist/esm/extractor/babelParse.native.mjs +19 -0
  79. package/dist/esm/extractor/babelParse.native.mjs.map +1 -0
  80. package/dist/esm/extractor/buildClassName.native.js +5 -5
  81. package/dist/esm/extractor/buildClassName.native.js.map +1 -1
  82. package/dist/esm/extractor/buildClassName.native.mjs +30 -0
  83. package/dist/esm/extractor/buildClassName.native.mjs.map +1 -0
  84. package/dist/esm/extractor/bundle.native.js +34 -258
  85. package/dist/esm/extractor/bundle.native.js.map +2 -2
  86. package/dist/esm/extractor/bundle.native.mjs +132 -0
  87. package/dist/esm/extractor/bundle.native.mjs.map +1 -0
  88. package/dist/esm/extractor/bundleConfig.native.js +154 -429
  89. package/dist/esm/extractor/bundleConfig.native.js.map +2 -2
  90. package/dist/esm/extractor/bundleConfig.native.mjs +322 -0
  91. package/dist/esm/extractor/bundleConfig.native.mjs.map +1 -0
  92. package/dist/esm/extractor/createEvaluator.native.js +2 -2
  93. package/dist/esm/extractor/createEvaluator.native.js.map +1 -1
  94. package/dist/esm/extractor/createEvaluator.native.mjs +38 -0
  95. package/dist/esm/extractor/createEvaluator.native.mjs.map +1 -0
  96. package/dist/esm/extractor/createExtractor.native.js +498 -739
  97. package/dist/esm/extractor/createExtractor.native.js.map +2 -2
  98. package/dist/esm/extractor/createExtractor.native.mjs +1140 -0
  99. package/dist/esm/extractor/createExtractor.native.mjs.map +1 -0
  100. package/dist/esm/extractor/createLogger.native.js +2 -2
  101. package/dist/esm/extractor/createLogger.native.js.map +1 -1
  102. package/dist/esm/extractor/createLogger.native.mjs +25 -0
  103. package/dist/esm/extractor/createLogger.native.mjs.map +1 -0
  104. package/dist/esm/extractor/ensureImportingConcat.native.mjs +20 -0
  105. package/dist/esm/extractor/ensureImportingConcat.native.mjs.map +1 -0
  106. package/dist/esm/extractor/esbuildAliasPlugin.native.js +3 -3
  107. package/dist/esm/extractor/esbuildAliasPlugin.native.js.map +1 -1
  108. package/dist/esm/extractor/esbuildAliasPlugin.native.mjs +29 -0
  109. package/dist/esm/extractor/esbuildAliasPlugin.native.mjs.map +1 -0
  110. package/dist/esm/extractor/evaluateAstNode.native.mjs +49 -0
  111. package/dist/esm/extractor/evaluateAstNode.native.mjs.map +1 -0
  112. package/dist/esm/extractor/extractHelpers.native.js +18 -72
  113. package/dist/esm/extractor/extractHelpers.native.js.map +2 -2
  114. package/dist/esm/extractor/extractHelpers.native.mjs +122 -0
  115. package/dist/esm/extractor/extractHelpers.native.mjs.map +1 -0
  116. package/dist/esm/extractor/extractMediaStyle.native.js +21 -73
  117. package/dist/esm/extractor/extractMediaStyle.native.js.map +1 -1
  118. package/dist/esm/extractor/extractMediaStyle.native.mjs +125 -0
  119. package/dist/esm/extractor/extractMediaStyle.native.mjs.map +1 -0
  120. package/dist/esm/extractor/extractToClassNames.native.js +242 -421
  121. package/dist/esm/extractor/extractToClassNames.native.js.map +2 -2
  122. package/dist/esm/extractor/extractToClassNames.native.mjs +315 -0
  123. package/dist/esm/extractor/extractToClassNames.native.mjs.map +1 -0
  124. package/dist/esm/extractor/extractToNative.native.js +31 -93
  125. package/dist/esm/extractor/extractToNative.native.js.map +2 -2
  126. package/dist/esm/extractor/extractToNative.native.mjs +268 -0
  127. package/dist/esm/extractor/extractToNative.native.mjs.map +1 -0
  128. package/dist/esm/extractor/findTopmostFunction.native.mjs +11 -0
  129. package/dist/esm/extractor/findTopmostFunction.native.mjs.map +1 -0
  130. package/dist/esm/extractor/generateTamaguiStudioConfig.native.js +43 -364
  131. package/dist/esm/extractor/generateTamaguiStudioConfig.native.js.map +2 -2
  132. package/dist/esm/extractor/generateTamaguiStudioConfig.native.mjs +139 -0
  133. package/dist/esm/extractor/generateTamaguiStudioConfig.native.mjs.map +1 -0
  134. package/dist/esm/extractor/generatedUid.native.js +1 -5
  135. package/dist/esm/extractor/generatedUid.native.js.map +1 -1
  136. package/dist/esm/extractor/generatedUid.native.mjs +13 -0
  137. package/dist/esm/extractor/generatedUid.native.mjs.map +1 -0
  138. package/dist/esm/extractor/getPrefixLogs.native.js +1 -1
  139. package/dist/esm/extractor/getPrefixLogs.native.js.map +1 -1
  140. package/dist/esm/extractor/getPrefixLogs.native.mjs +6 -0
  141. package/dist/esm/extractor/getPrefixLogs.native.mjs.map +1 -0
  142. package/dist/esm/extractor/getPropValueFromAttributes.native.js +2 -1
  143. package/dist/esm/extractor/getPropValueFromAttributes.native.js.map +1 -1
  144. package/dist/esm/extractor/getPropValueFromAttributes.native.mjs +35 -0
  145. package/dist/esm/extractor/getPropValueFromAttributes.native.mjs.map +1 -0
  146. package/dist/esm/extractor/getSourceModule.native.mjs +50 -0
  147. package/dist/esm/extractor/getSourceModule.native.mjs.map +1 -0
  148. package/dist/esm/extractor/getStaticBindingsForScope.native.js +91 -292
  149. package/dist/esm/extractor/getStaticBindingsForScope.native.js.map +2 -2
  150. package/dist/esm/extractor/getStaticBindingsForScope.native.mjs +159 -0
  151. package/dist/esm/extractor/getStaticBindingsForScope.native.mjs.map +1 -0
  152. package/dist/esm/extractor/getTamaguiConfigPathFromOptionsConfig.native.mjs +6 -0
  153. package/dist/esm/extractor/getTamaguiConfigPathFromOptionsConfig.native.mjs.map +1 -0
  154. package/dist/esm/extractor/hoistClassNames.native.js +1 -1
  155. package/dist/esm/extractor/hoistClassNames.native.js.map +1 -1
  156. package/dist/esm/extractor/hoistClassNames.native.mjs +30 -0
  157. package/dist/esm/extractor/hoistClassNames.native.mjs.map +1 -0
  158. package/dist/esm/extractor/literalToAst.native.js +15 -69
  159. package/dist/esm/extractor/literalToAst.native.js.map +1 -1
  160. package/dist/esm/extractor/literalToAst.native.mjs +55 -0
  161. package/dist/esm/extractor/literalToAst.native.mjs.map +1 -0
  162. package/dist/esm/extractor/loadFile.native.js +5 -8
  163. package/dist/esm/extractor/loadFile.native.js.map +1 -1
  164. package/dist/esm/extractor/loadFile.native.mjs +20 -0
  165. package/dist/esm/extractor/loadFile.native.mjs.map +1 -0
  166. package/dist/esm/extractor/loadTamagui.native.js +155 -573
  167. package/dist/esm/extractor/loadTamagui.native.js.map +2 -2
  168. package/dist/esm/extractor/loadTamagui.native.mjs +284 -0
  169. package/dist/esm/extractor/loadTamagui.native.mjs.map +1 -0
  170. package/dist/esm/extractor/logLines.native.js +1 -1
  171. package/dist/esm/extractor/logLines.native.js.map +1 -1
  172. package/dist/esm/extractor/logLines.native.mjs +31 -0
  173. package/dist/esm/extractor/logLines.native.mjs.map +1 -0
  174. package/dist/esm/extractor/normalizeTernaries.native.js +4 -59
  175. package/dist/esm/extractor/normalizeTernaries.native.js.map +1 -1
  176. package/dist/esm/extractor/normalizeTernaries.native.mjs +38 -0
  177. package/dist/esm/extractor/normalizeTernaries.native.mjs.map +1 -0
  178. package/dist/esm/extractor/propsToFontFamilyCache.native.js +1 -1
  179. package/dist/esm/extractor/propsToFontFamilyCache.native.js.map +1 -1
  180. package/dist/esm/extractor/propsToFontFamilyCache.native.mjs +13 -0
  181. package/dist/esm/extractor/propsToFontFamilyCache.native.mjs.map +1 -0
  182. package/dist/esm/extractor/removeUnusedHooks.native.js +2 -2
  183. package/dist/esm/extractor/removeUnusedHooks.native.js.map +1 -1
  184. package/dist/esm/extractor/removeUnusedHooks.native.mjs +83 -0
  185. package/dist/esm/extractor/removeUnusedHooks.native.mjs.map +1 -0
  186. package/dist/esm/extractor/timer.native.js +2 -2
  187. package/dist/esm/extractor/timer.native.js.map +1 -1
  188. package/dist/esm/extractor/timer.native.mjs +22 -0
  189. package/dist/esm/extractor/timer.native.mjs.map +1 -0
  190. package/dist/esm/extractor/validHTMLAttributes.native.mjs +50 -0
  191. package/dist/esm/extractor/validHTMLAttributes.native.mjs.map +1 -0
  192. package/dist/esm/extractor/watchTamaguiConfig.native.js +25 -166
  193. package/dist/esm/extractor/watchTamaguiConfig.native.js.map +2 -2
  194. package/dist/esm/extractor/watchTamaguiConfig.native.mjs +33 -0
  195. package/dist/esm/extractor/watchTamaguiConfig.native.mjs.map +1 -0
  196. package/dist/esm/getPragmaOptions.native.js +1 -1
  197. package/dist/esm/getPragmaOptions.native.js.map +1 -1
  198. package/dist/esm/getPragmaOptions.native.mjs +51 -0
  199. package/dist/esm/getPragmaOptions.native.mjs.map +1 -0
  200. package/dist/esm/helpers/memoize.native.mjs +15 -0
  201. package/dist/esm/helpers/memoize.native.mjs.map +1 -0
  202. package/dist/esm/helpers/requireTamaguiCore.native.js.map +1 -1
  203. package/dist/esm/helpers/requireTamaguiCore.native.mjs +13 -0
  204. package/dist/esm/helpers/requireTamaguiCore.native.mjs.map +1 -0
  205. package/dist/esm/index.native.mjs +5 -0
  206. package/dist/esm/index.native.mjs.map +1 -0
  207. package/dist/esm/minifyCSS.native.js +1 -1
  208. package/dist/esm/minifyCSS.native.js.map +2 -2
  209. package/dist/esm/minifyCSS.native.mjs +16 -0
  210. package/dist/esm/minifyCSS.native.mjs.map +1 -0
  211. package/dist/esm/registerRequire.native.js +17 -35
  212. package/dist/esm/registerRequire.native.js.map +1 -1
  213. package/dist/esm/registerRequire.native.mjs +86 -0
  214. package/dist/esm/registerRequire.native.mjs.map +1 -0
  215. package/dist/esm/server.native.js +21 -163
  216. package/dist/esm/server.native.js.map +2 -2
  217. package/dist/esm/server.native.mjs +44 -0
  218. package/dist/esm/server.native.mjs.map +1 -0
  219. package/dist/esm/setup.native.mjs +2 -0
  220. package/dist/esm/setup.native.mjs.map +1 -0
  221. package/dist/esm/types.native.mjs +2 -0
  222. package/dist/esm/types.native.mjs.map +1 -0
  223. package/package.json +14 -14
@@ -26,226 +26,7 @@ __export(createExtractor_exports, {
26
26
  createExtractor: () => createExtractor
27
27
  });
28
28
  module.exports = __toCommonJS(createExtractor_exports);
29
- var import_traverse = __toESM(require("@babel/traverse")), t = __toESM(require("@babel/types")), import_cli_color = require("@tamagui/cli-color"), import_web = require("@tamagui/web"), import_node_path = require("node:path"), reactNativeWebInternals = __toESM(require("react-native-web-internals")), import_constants = require("../constants"), import_requireTamaguiCore = require("../helpers/requireTamaguiCore"), import_createEvaluator = require("./createEvaluator"), import_evaluateAstNode = require("./evaluateAstNode"), import_extractHelpers = require("./extractHelpers"), import_findTopmostFunction = require("./findTopmostFunction"), import_getStaticBindingsForScope = require("./getStaticBindingsForScope"), import_literalToAst = require("./literalToAst"), import_loadTamagui = require("./loadTamagui"), import_logLines = require("./logLines"), import_normalizeTernaries = require("./normalizeTernaries"), import_propsToFontFamilyCache = require("./propsToFontFamilyCache"), import_removeUnusedHooks = require("./removeUnusedHooks"), import_timer = require("./timer"), import_validHTMLAttributes = require("./validHTMLAttributes");
30
- function _array_like_to_array(arr, len) {
31
- (len == null || len > arr.length) && (len = arr.length);
32
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
33
- return arr2;
34
- }
35
- function _array_with_holes(arr) {
36
- if (Array.isArray(arr)) return arr;
37
- }
38
- function _array_without_holes(arr) {
39
- if (Array.isArray(arr)) return _array_like_to_array(arr);
40
- }
41
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
42
- try {
43
- var info = gen[key](arg), value = info.value;
44
- } catch (error) {
45
- reject(error);
46
- return;
47
- }
48
- info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw);
49
- }
50
- function _async_to_generator(fn) {
51
- return function() {
52
- var self = this, args = arguments;
53
- return new Promise(function(resolve, reject) {
54
- var gen = fn.apply(self, args);
55
- function _next(value) {
56
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
57
- }
58
- function _throw(err) {
59
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
60
- }
61
- _next(void 0);
62
- });
63
- };
64
- }
65
- function _define_property(obj, key, value) {
66
- return key in obj ? Object.defineProperty(obj, key, {
67
- value,
68
- enumerable: !0,
69
- configurable: !0,
70
- writable: !0
71
- }) : obj[key] = value, obj;
72
- }
73
- function _iterable_to_array(iter) {
74
- if (typeof Symbol < "u" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
75
- }
76
- function _iterable_to_array_limit(arr, i) {
77
- var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
78
- if (_i != null) {
79
- var _arr = [], _n = !0, _d = !1, _s, _e;
80
- try {
81
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
82
- ;
83
- } catch (err) {
84
- _d = !0, _e = err;
85
- } finally {
86
- try {
87
- !_n && _i.return != null && _i.return();
88
- } finally {
89
- if (_d) throw _e;
90
- }
91
- }
92
- return _arr;
93
- }
94
- }
95
- function _non_iterable_rest() {
96
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
97
- }
98
- function _non_iterable_spread() {
99
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
100
- }
101
- function _object_spread(target) {
102
- for (var i = 1; i < arguments.length; i++) {
103
- var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
104
- typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
105
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
106
- }))), ownKeys2.forEach(function(key) {
107
- _define_property(target, key, source[key]);
108
- });
109
- }
110
- return target;
111
- }
112
- function ownKeys(object, enumerableOnly) {
113
- var keys = Object.keys(object);
114
- if (Object.getOwnPropertySymbols) {
115
- var symbols = Object.getOwnPropertySymbols(object);
116
- enumerableOnly && (symbols = symbols.filter(function(sym) {
117
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
118
- })), keys.push.apply(keys, symbols);
119
- }
120
- return keys;
121
- }
122
- function _object_spread_props(target, source) {
123
- return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
124
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
125
- }), target;
126
- }
127
- function _object_without_properties(source, excluded) {
128
- if (source == null) return {};
129
- var target = _object_without_properties_loose(source, excluded), key, i;
130
- if (Object.getOwnPropertySymbols) {
131
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
132
- for (i = 0; i < sourceSymbolKeys.length; i++)
133
- key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
134
- }
135
- return target;
136
- }
137
- function _object_without_properties_loose(source, excluded) {
138
- if (source == null) return {};
139
- var target = {}, sourceKeys = Object.keys(source), key, i;
140
- for (i = 0; i < sourceKeys.length; i++)
141
- key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
142
- return target;
143
- }
144
- function _sliced_to_array(arr, i) {
145
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
146
- }
147
- function _to_consumable_array(arr) {
148
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
149
- }
150
- function _type_of(obj) {
151
- "@swc/helpers - typeof";
152
- return obj && typeof Symbol < "u" && obj.constructor === Symbol ? "symbol" : typeof obj;
153
- }
154
- function _unsupported_iterable_to_array(o, minLen) {
155
- if (o) {
156
- if (typeof o == "string") return _array_like_to_array(o, minLen);
157
- var n = Object.prototype.toString.call(o).slice(8, -1);
158
- if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(n);
159
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
160
- }
161
- }
162
- function _ts_generator(thisArg, body) {
163
- var f, y, t2, g, _ = {
164
- label: 0,
165
- sent: function() {
166
- if (t2[0] & 1) throw t2[1];
167
- return t2[1];
168
- },
169
- trys: [],
170
- ops: []
171
- };
172
- return g = {
173
- next: verb(0),
174
- throw: verb(1),
175
- return: verb(2)
176
- }, typeof Symbol == "function" && (g[Symbol.iterator] = function() {
177
- return this;
178
- }), g;
179
- function verb(n) {
180
- return function(v) {
181
- return step([
182
- n,
183
- v
184
- ]);
185
- };
186
- }
187
- function step(op) {
188
- if (f) throw new TypeError("Generator is already executing.");
189
- for (; _; ) try {
190
- if (f = 1, y && (t2 = op[0] & 2 ? y.return : op[0] ? y.throw || ((t2 = y.return) && t2.call(y), 0) : y.next) && !(t2 = t2.call(y, op[1])).done) return t2;
191
- switch (y = 0, t2 && (op = [
192
- op[0] & 2,
193
- t2.value
194
- ]), op[0]) {
195
- case 0:
196
- case 1:
197
- t2 = op;
198
- break;
199
- case 4:
200
- return _.label++, {
201
- value: op[1],
202
- done: !1
203
- };
204
- case 5:
205
- _.label++, y = op[1], op = [
206
- 0
207
- ];
208
- continue;
209
- case 7:
210
- op = _.ops.pop(), _.trys.pop();
211
- continue;
212
- default:
213
- if (t2 = _.trys, !(t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) {
214
- _ = 0;
215
- continue;
216
- }
217
- if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) {
218
- _.label = op[1];
219
- break;
220
- }
221
- if (op[0] === 6 && _.label < t2[1]) {
222
- _.label = t2[1], t2 = op;
223
- break;
224
- }
225
- if (t2 && _.label < t2[2]) {
226
- _.label = t2[2], _.ops.push(op);
227
- break;
228
- }
229
- t2[2] && _.ops.pop(), _.trys.pop();
230
- continue;
231
- }
232
- op = body.call(thisArg, _);
233
- } catch (e) {
234
- op = [
235
- 6,
236
- e
237
- ], y = 0;
238
- } finally {
239
- f = t2 = 0;
240
- }
241
- if (op[0] & 5) throw op[1];
242
- return {
243
- value: op[0] ? op[1] : void 0,
244
- done: !0
245
- };
246
- }
247
- }
248
- var UNTOUCHED_PROPS = {
29
+ var import_traverse = __toESM(require("@babel/traverse")), t = __toESM(require("@babel/types")), import_cli_color = require("@tamagui/cli-color"), import_web = require("@tamagui/web"), import_node_path = require("node:path"), reactNativeWebInternals = __toESM(require("react-native-web-internals")), import_constants = require("../constants"), import_requireTamaguiCore = require("../helpers/requireTamaguiCore"), import_createEvaluator = require("./createEvaluator"), import_evaluateAstNode = require("./evaluateAstNode"), import_extractHelpers = require("./extractHelpers"), import_findTopmostFunction = require("./findTopmostFunction"), import_getStaticBindingsForScope = require("./getStaticBindingsForScope"), import_literalToAst = require("./literalToAst"), import_loadTamagui = require("./loadTamagui"), import_logLines = require("./logLines"), import_normalizeTernaries = require("./normalizeTernaries"), import_propsToFontFamilyCache = require("./propsToFontFamilyCache"), import_removeUnusedHooks = require("./removeUnusedHooks"), import_timer = require("./timer"), import_validHTMLAttributes = require("./validHTMLAttributes"), UNTOUCHED_PROPS = {
249
30
  key: !0,
250
31
  style: !0,
251
32
  className: !0
@@ -256,18 +37,19 @@ function isFullyDisabled(props) {
256
37
  return props.disableExtraction && props.disableDebugAttr;
257
38
  }
258
39
  function createExtractor() {
259
- var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
40
+ var { logger = console, platform = "web" } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
260
41
  logger: console
261
- }, _ref_logger = _ref.logger, logger = _ref_logger === void 0 ? console : _ref_logger, _ref_platform = _ref.platform, platform = _ref_platform === void 0 ? "web" : _ref_platform, INLINE_EXTRACTABLE = _object_spread({
42
+ }, INLINE_EXTRACTABLE = {
262
43
  ref: "ref",
263
- key: "key"
264
- }, platform === "web" && {
265
- onPress: "onClick",
266
- onHoverIn: "onMouseEnter",
267
- onHoverOut: "onMouseLeave",
268
- onPressIn: "onMouseDown",
269
- onPressOut: "onMouseUp"
270
- }), componentState = {
44
+ key: "key",
45
+ ...platform === "web" && {
46
+ onPress: "onClick",
47
+ onHoverIn: "onMouseEnter",
48
+ onHoverOut: "onMouseLeave",
49
+ onPressIn: "onMouseDown",
50
+ onPressOut: "onMouseUp"
51
+ }
52
+ }, componentState = {
271
53
  focus: !1,
272
54
  focusVisible: !1,
273
55
  hover: !1,
@@ -286,35 +68,8 @@ function createExtractor() {
286
68
  function loadSync(props) {
287
69
  return isFullyDisabled(props) ? null : projectInfo || (projectInfo = (0, import_loadTamagui.loadTamaguiSync)(props));
288
70
  }
289
- function load(props) {
290
- return _load.apply(this, arguments);
291
- }
292
- function _load() {
293
- return _load = _async_to_generator(function(props) {
294
- var _tmp;
295
- return _ts_generator(this, function(_state) {
296
- switch (_state.label) {
297
- case 0:
298
- return isFullyDisabled(props) ? [
299
- 2,
300
- null
301
- ] : (_tmp = projectInfo, _tmp ? [
302
- 3,
303
- 2
304
- ] : [
305
- 4,
306
- (0, import_loadTamagui.loadTamagui)(props)
307
- ]);
308
- case 1:
309
- _tmp = projectInfo = _state.sent(), _state.label = 2;
310
- case 2:
311
- return [
312
- 2,
313
- _tmp
314
- ];
315
- }
316
- });
317
- }), _load.apply(this, arguments);
71
+ async function load(props) {
72
+ return isFullyDisabled(props) ? null : projectInfo || (projectInfo = await (0, import_loadTamagui.loadTamagui)(props));
318
73
  }
319
74
  return {
320
75
  options: {
@@ -323,70 +78,32 @@ function createExtractor() {
323
78
  cleanupBeforeExit: import_getStaticBindingsForScope.cleanupBeforeExit,
324
79
  loadTamagui: load,
325
80
  loadTamaguiSync: loadSync,
326
- getTamagui: function() {
81
+ getTamagui() {
327
82
  return projectInfo == null ? void 0 : projectInfo.tamaguiConfig;
328
83
  },
329
84
  parseSync: function(f, props) {
330
85
  var projectInfo2 = loadSync(props);
331
86
  return parseWithConfig(projectInfo2 || {}, f, props);
332
87
  },
333
- parse: /* @__PURE__ */ function() {
334
- var _ref2 = _async_to_generator(function(f, props) {
335
- var projectInfo2;
336
- return _ts_generator(this, function(_state) {
337
- switch (_state.label) {
338
- case 0:
339
- return [
340
- 4,
341
- load(props)
342
- ];
343
- case 1:
344
- return projectInfo2 = _state.sent(), [
345
- 2,
346
- parseWithConfig(projectInfo2 || {}, f, props)
347
- ];
348
- }
349
- });
350
- });
351
- return function(f, props) {
352
- return _ref2.apply(this, arguments);
353
- };
354
- }()
88
+ parse: async function(f, props) {
89
+ var projectInfo2 = await load(props);
90
+ return parseWithConfig(projectInfo2 || {}, f, props);
91
+ }
355
92
  };
356
93
  function parseWithConfig(param, fileOrPath, options) {
357
- var components = param.components, tamaguiConfig = param.tamaguiConfig, _options_config = options.config, config = _options_config === void 0 ? "tamagui.config.ts" : _options_config, _options_importsWhitelist = options.importsWhitelist, importsWhitelist = _options_importsWhitelist === void 0 ? [
94
+ var { components, tamaguiConfig } = param, { config = "tamagui.config.ts", importsWhitelist = [
358
95
  "constants.js"
359
- ] : _options_importsWhitelist, _options_evaluateVars = options.evaluateVars, evaluateVars = _options_evaluateVars === void 0 ? !0 : _options_evaluateVars, _options_sourcePath = options.sourcePath, sourcePath = _options_sourcePath === void 0 ? "" : _options_sourcePath, onExtractTag = options.onExtractTag, onStyleRule = options.onStyleRule, getFlattenedNode = options.getFlattenedNode, disable = options.disable, disableExtraction = options.disableExtraction, disableExtractInlineMedia = options.disableExtractInlineMedia, disableExtractVariables = options.disableExtractVariables, disableDebugAttr = options.disableDebugAttr, _options_enableDynamicEvaluation = options.enableDynamicEvaluation, enableDynamicEvaluation = _options_enableDynamicEvaluation === void 0 ? !1 : _options_enableDynamicEvaluation, disableOptimizeHooks = options.disableOptimizeHooks, _options_includeExtensions = options.includeExtensions, includeExtensions = _options_includeExtensions === void 0 ? [
96
+ ], evaluateVars = !0, sourcePath = "", onExtractTag, onStyleRule, getFlattenedNode, disable, disableExtraction, disableExtractInlineMedia, disableExtractVariables, disableDebugAttr, enableDynamicEvaluation = !1, disableOptimizeHooks, includeExtensions = [
360
97
  ".ts",
361
98
  ".tsx",
362
99
  ".jsx"
363
- ] : _options_includeExtensions, _options_extractStyledDefinitions = options.extractStyledDefinitions, extractStyledDefinitions = _options_extractStyledDefinitions === void 0 ? !1 : _options_extractStyledDefinitions, prefixLogs = options.prefixLogs, excludeProps = options.excludeProps, platform2 = options.platform, restProps = _object_without_properties(options, [
364
- "config",
365
- "importsWhitelist",
366
- "evaluateVars",
367
- "sourcePath",
368
- "onExtractTag",
369
- "onStyleRule",
370
- "getFlattenedNode",
371
- "disable",
372
- "disableExtraction",
373
- "disableExtractInlineMedia",
374
- "disableExtractVariables",
375
- "disableDebugAttr",
376
- "enableDynamicEvaluation",
377
- "disableOptimizeHooks",
378
- "includeExtensions",
379
- "extractStyledDefinitions",
380
- "prefixLogs",
381
- "excludeProps",
382
- "platform"
383
- ]), validHooks = disableOptimizeHooks ? {} : {
100
+ ], extractStyledDefinitions = !1, prefixLogs, excludeProps, platform: platform2, ...restProps } = options, validHooks = disableOptimizeHooks ? {} : {
384
101
  useMedia: !0,
385
102
  useTheme: !0
386
103
  };
387
104
  if (sourcePath.includes(".tamagui-dynamic-eval"))
388
105
  return null;
389
- var _requireTamaguiCore = (0, import_requireTamaguiCore.requireTamaguiCore)(platform2), normalizeStyle = _requireTamaguiCore.normalizeStyle, getSplitStyles = _requireTamaguiCore.getSplitStyles, mediaQueryConfig = _requireTamaguiCore.mediaQueryConfig, propMapper = _requireTamaguiCore.propMapper, proxyThemeVariables = _requireTamaguiCore.proxyThemeVariables, pseudoDescriptors = _requireTamaguiCore.pseudoDescriptors, shouldPrintDebug = options.shouldPrintDebug || !1;
106
+ var { normalizeStyle, getSplitStyles, mediaQueryConfig, propMapper, proxyThemeVariables, pseudoDescriptors } = (0, import_requireTamaguiCore.requireTamaguiCore)(platform2), shouldPrintDebug = options.shouldPrintDebug || !1;
390
107
  if (disable === !0 || Array.isArray(disable) && disable.includes(sourcePath))
391
108
  return null;
392
109
  if (!isFullyDisabled(options) && !components)
@@ -394,17 +111,20 @@ function createExtractor() {
394
111
  if (sourcePath && includeExtensions && !includeExtensions.some(function(ext) {
395
112
  return sourcePath.endsWith(ext);
396
113
  }))
397
- return shouldPrintDebug && logger.info("Ignoring file due to includeExtensions: ".concat(sourcePath, ", includeExtensions: ").concat(includeExtensions.join(", "))), null;
114
+ return shouldPrintDebug && logger.info(`Ignoring file due to includeExtensions: ${sourcePath}, includeExtensions: ${includeExtensions.join(", ")}`), null;
398
115
  function isValidStyleKey(name, staticConfig) {
399
116
  var _staticConfig_validStyles, _staticConfig_variants, _projectInfo_tamaguiConfig;
400
117
  if (!projectInfo)
401
118
  throw new Error("Tamagui extractor not loaded yet");
402
119
  return platform2 === "native" && name[0] === "$" && mediaQueryConfig[name.slice(1)] ? !1 : !!(!((_staticConfig_validStyles = staticConfig.validStyles) === null || _staticConfig_validStyles === void 0) && _staticConfig_validStyles[name] || pseudoDescriptors[name] || !((_staticConfig_variants = staticConfig.variants) === null || _staticConfig_variants === void 0) && _staticConfig_variants[name] || !(projectInfo == null || (_projectInfo_tamaguiConfig = projectInfo.tamaguiConfig) === null || _projectInfo_tamaguiConfig === void 0) && _projectInfo_tamaguiConfig.shorthands[name] || name[0] === "$" && mediaQueryConfig[name.slice(1)]);
403
120
  }
404
- var isTargetingHTML = platform2 === "web", ogDebug = shouldPrintDebug, tm = (0, import_timer.timer)(), propsWithFileInfo = _object_spread_props(_object_spread({}, options), {
121
+ var isTargetingHTML = platform2 === "web", ogDebug = shouldPrintDebug, tm = (0, import_timer.timer)(), propsWithFileInfo = {
122
+ ...options,
405
123
  sourcePath,
406
- allLoadedComponents: components ? _to_consumable_array(components) : []
407
- });
124
+ allLoadedComponents: components ? [
125
+ ...components
126
+ ] : []
127
+ };
408
128
  if (!hasLoggedBaseInfo) {
409
129
  var _process_env_DEBUG;
410
130
  hasLoggedBaseInfo = !0, shouldPrintDebug && logger.info([
@@ -431,27 +151,27 @@ function createExtractor() {
431
151
  - or search your lockfile for mis-matches.
432
152
  `), console.info(" Got config:", tamaguiConfig), process.exit(0));
433
153
  var firstThemeName = Object.keys((tamaguiConfig == null ? void 0 : tamaguiConfig.themes) || {})[0], firstTheme = (tamaguiConfig == null ? void 0 : tamaguiConfig.themes[firstThemeName]) || {};
434
- if (!firstTheme || (typeof firstTheme > "u" ? "undefined" : _type_of(firstTheme)) !== "object") {
435
- var _$err = "Missing theme ".concat(firstThemeName, ", an error occurred when importing your config");
154
+ if (!firstTheme || typeof firstTheme != "object") {
155
+ var _$err = `Missing theme ${firstThemeName}, an error occurred when importing your config`;
436
156
  throw console.info(_$err, "Got config:", tamaguiConfig), console.info("Looking for theme:", firstThemeName), new Error(_$err);
437
157
  }
438
158
  var proxiedTheme = proxyThemeVariables(firstTheme), themeAccessListeners = /* @__PURE__ */ new Set(), defaultTheme = new Proxy(proxiedTheme, {
439
- get: function(target, key) {
159
+ get(target, key) {
440
160
  return Reflect.has(target, key) && themeAccessListeners.forEach(function(cb) {
441
161
  return cb(String(key));
442
162
  }), Reflect.get(target, key);
443
163
  }
444
164
  }), body = fileOrPath.type === "Program" ? fileOrPath.get("body") : fileOrPath.program.body;
445
- isFullyDisabled(options) || Object.keys(components || []).length === 0 && (console.warn("Warning: Tamagui didn't find any valid components (DEBUG=tamagui for more)"), process.env.DEBUG === "tamagui" && console.info("components", Object.keys(components || []), components)), shouldPrintDebug === "verbose" && (logger.info("allLoadedComponent modules ".concat(propsWithFileInfo.allLoadedComponents.map(function(k) {
165
+ isFullyDisabled(options) || Object.keys(components || []).length === 0 && (console.warn("Warning: Tamagui didn't find any valid components (DEBUG=tamagui for more)"), process.env.DEBUG === "tamagui" && console.info("components", Object.keys(components || []), components)), shouldPrintDebug === "verbose" && (logger.info(`allLoadedComponent modules ${propsWithFileInfo.allLoadedComponents.map(function(k) {
446
166
  return k.moduleName;
447
- }).join(", "))), logger.info("valid import paths: ".concat(JSON.stringify((0, import_extractHelpers.getValidComponentsPaths)(propsWithFileInfo)))));
167
+ }).join(", ")}`), logger.info(`valid import paths: ${JSON.stringify((0, import_extractHelpers.getValidComponentsPaths)(propsWithFileInfo))}`));
448
168
  var doesUseValidImport = !1, hasImportedTheme = !1, importDeclarations = [], _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
449
169
  try {
450
170
  for (var _loop = function() {
451
171
  var bodyPath = _step.value;
452
172
  if (bodyPath.type !== "ImportDeclaration") return "continue";
453
173
  var node = "node" in bodyPath ? bodyPath.node : bodyPath, moduleName = node.source.value, valid = (0, import_extractHelpers.isValidImport)(propsWithFileInfo, moduleName);
454
- if (valid && importDeclarations.push(node), shouldPrintDebug === "verbose" && logger.info(" - import ".concat(moduleName, " ").concat(valid)), extractStyledDefinitions && valid && node.specifiers.some(function(specifier) {
174
+ if (valid && importDeclarations.push(node), shouldPrintDebug === "verbose" && logger.info(` - import ${moduleName} ${valid}`), extractStyledDefinitions && valid && node.specifiers.some(function(specifier) {
455
175
  return specifier.local.name === "styled";
456
176
  }))
457
177
  return doesUseValidImport = !0, "break";
@@ -461,7 +181,7 @@ function createExtractor() {
461
181
  }), isValidComponent = names.some(function(name) {
462
182
  return !!((0, import_extractHelpers.isValidImport)(propsWithFileInfo, moduleName, name) || validHooks[name]);
463
183
  });
464
- if (shouldPrintDebug === "verbose" && logger.info(" - import ".concat(isValidComponent ? "\u2705" : "\u21E3", " - ").concat(names.join(", "), " from '").concat(moduleName, "' - (valid: ").concat(JSON.stringify((0, import_extractHelpers.getValidComponentsPaths)(propsWithFileInfo)), ")")), isValidComponent)
184
+ if (shouldPrintDebug === "verbose" && logger.info(` - import ${isValidComponent ? "\u2705" : "\u21E3"} - ${names.join(", ")} from '${moduleName}' - (valid: ${JSON.stringify((0, import_extractHelpers.getValidComponentsPaths)(propsWithFileInfo))})`), isValidComponent)
465
185
  return doesUseValidImport = !0, "break";
466
186
  }
467
187
  }, _iterator = body[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
@@ -478,11 +198,11 @@ function createExtractor() {
478
198
  throw _iteratorError;
479
199
  }
480
200
  }
481
- if (shouldPrintDebug && logger.info("".concat(JSON.stringify({
201
+ if (shouldPrintDebug && logger.info(`${JSON.stringify({
482
202
  doesUseValidImport,
483
203
  hasImportedTheme
484
- }, null, 2), `
485
- `)), !doesUseValidImport)
204
+ }, null, 2)}
205
+ `), !doesUseValidImport)
486
206
  return null;
487
207
  function getValidImportedComponent(componentName) {
488
208
  var importDeclaration = importDeclarations.find(function(dec) {
@@ -501,16 +221,16 @@ function createExtractor() {
501
221
  optimized: 0,
502
222
  modified: 0,
503
223
  found: 0
504
- }, version = "".concat(Math.random());
224
+ }, version = `${Math.random()}`;
505
225
  if (callTraverse({
506
226
  // @ts-ignore
507
227
  Program: {
508
- enter: function(path) {
228
+ enter(path) {
509
229
  programPath = path;
510
230
  }
511
231
  },
512
232
  // styled() calls
513
- CallExpression: function(path) {
233
+ CallExpression(path) {
514
234
  if (!(disable || shouldDisableExtraction || extractStyledDefinitions === !1) && !(!t.isIdentifier(path.node.callee) || path.node.callee.name !== "styled")) {
515
235
  var variableName = t.isVariableDeclarator(path.parent) && t.isIdentifier(path.parent.id) ? path.parent.id.name : "unknown", parentNode = path.node.arguments[0];
516
236
  if (t.isIdentifier(parentNode)) {
@@ -521,7 +241,7 @@ function createExtractor() {
521
241
  if (enableDynamicEvaluation !== !0)
522
242
  return;
523
243
  try {
524
- shouldPrintDebug && logger.info("Unknown component: ".concat(variableName, " = styled(").concat(parentName, ") attempting dynamic load: ").concat(sourcePath));
244
+ shouldPrintDebug && logger.info(`Unknown component: ${variableName} = styled(${parentName}) attempting dynamic load: ${sourcePath}`);
525
245
  var out = (0, import_loadTamagui.loadTamaguiSync)({
526
246
  forceExports: !0,
527
247
  components: [
@@ -530,27 +250,32 @@ function createExtractor() {
530
250
  cacheKey: version
531
251
  });
532
252
  if (!(out != null && out.components)) {
533
- shouldPrintDebug && logger.info("Couldn't load, got ".concat(out));
253
+ shouldPrintDebug && logger.info(`Couldn't load, got ${out}`);
534
254
  return;
535
255
  }
536
- if (propsWithFileInfo.allLoadedComponents = _to_consumable_array(propsWithFileInfo.allLoadedComponents).concat(_to_consumable_array(out.components)), Component = out.components.flatMap(function(x) {
256
+ if (propsWithFileInfo.allLoadedComponents = [
257
+ ...propsWithFileInfo.allLoadedComponents,
258
+ ...out.components
259
+ ], Component = out.components.flatMap(function(x) {
537
260
  var _x_nameToInfo_variableName;
538
261
  return (_x_nameToInfo_variableName = x.nameToInfo[variableName]) !== null && _x_nameToInfo_variableName !== void 0 ? _x_nameToInfo_variableName : [];
539
262
  })[0], !out.cached) {
540
263
  var _out_components, foundNames = (_out_components = out.components) === null || _out_components === void 0 ? void 0 : _out_components.map(function(x) {
541
264
  return Object.keys(x.nameToInfo).join(", ");
542
265
  }).join(", ").trim();
543
- foundNames && (0, import_cli_color.colorLog)(import_cli_color.Color.FgYellow, " | Tamagui found dynamic components: ".concat(foundNames));
266
+ foundNames && (0, import_cli_color.colorLog)(import_cli_color.Color.FgYellow, ` | Tamagui found dynamic components: ${foundNames}`);
544
267
  }
545
268
  } catch {
546
- shouldPrintDebug && logger.info("skip optimize styled(".concat(variableName, "), unable to pre-process (DEBUG=tamagui for more)"));
269
+ shouldPrintDebug && logger.info(`skip optimize styled(${variableName}), unable to pre-process (DEBUG=tamagui for more)`);
547
270
  }
548
271
  }
549
272
  if (!Component) {
550
273
  shouldPrintDebug && logger.info(" No component found");
551
274
  return;
552
275
  }
553
- var componentSkipProps = new Set(_to_consumable_array(Component.staticConfig.inlineWhenUnflattened || []).concat(_to_consumable_array(Component.staticConfig.inlineProps || []), [
276
+ var componentSkipProps = /* @__PURE__ */ new Set([
277
+ ...Component.staticConfig.inlineWhenUnflattened || [],
278
+ ...Component.staticConfig.inlineProps || [],
554
279
  // for now skip variants, will return to them
555
280
  "variants",
556
281
  "defaultVariants",
@@ -562,7 +287,7 @@ function createExtractor() {
562
287
  "disabledStyle",
563
288
  "hoverStyle",
564
289
  "pressStyle"
565
- ])), skipped = /* @__PURE__ */ new Set(), styles = {}, staticNamespace = (0, import_getStaticBindingsForScope.getStaticBindingsForScope)(path.scope, importsWhitelist, sourcePath, bindingCache, shouldPrintDebug), attemptEval = evaluateVars ? (0, import_createEvaluator.createEvaluator)({
290
+ ]), skipped = /* @__PURE__ */ new Set(), styles = {}, staticNamespace = (0, import_getStaticBindingsForScope.getStaticBindingsForScope)(path.scope, importsWhitelist, sourcePath, bindingCache, shouldPrintDebug), attemptEval = evaluateVars ? (0, import_createEvaluator.createEvaluator)({
566
291
  props: propsWithFileInfo,
567
292
  staticNamespace,
568
293
  sourcePath,
@@ -590,10 +315,12 @@ function createExtractor() {
590
315
  throw _iteratorError2;
591
316
  }
592
317
  }
593
- var out2 = getSplitStyles(styles, Component.staticConfig, defaultTheme, "", componentState, styleProps, void 0, void 0, void 0, shouldPrintDebug), classNames = _object_spread({}, out2.classNames);
318
+ var out2 = getSplitStyles(styles, Component.staticConfig, defaultTheme, "", componentState, styleProps, void 0, void 0, void 0, shouldPrintDebug), classNames = {
319
+ ...out2.classNames
320
+ };
594
321
  if (shouldPrintDebug && logger.info([
595
- "Extracted styled(".concat(variableName, `)
596
- `),
322
+ `Extracted styled(${variableName})
323
+ `,
597
324
  JSON.stringify(styles, null, 2),
598
325
  `
599
326
  classNames:`,
@@ -611,15 +338,17 @@ function createExtractor() {
611
338
  var styleObject = out2.rulesToInsert[key];
612
339
  onStyleRule == null || onStyleRule(styleObject[import_web.StyleObjectIdentifier], styleObject[import_web.StyleObjectRules]);
613
340
  }
614
- res.styled++, shouldPrintDebug && logger.info("Extracted styled(".concat(variableName, ")"));
341
+ res.styled++, shouldPrintDebug && logger.info(`Extracted styled(${variableName})`);
615
342
  }
616
343
  }
617
344
  }
618
345
  },
619
- JSXElement: function(traversePath) {
346
+ JSXElement(traversePath) {
620
347
  tm.mark("jsx-element", !!shouldPrintDebug);
621
348
  var node = traversePath.node.openingElement, ogAttributes = node.attributes.map(function(attr3) {
622
- return _object_spread({}, attr3);
349
+ return {
350
+ ...attr3
351
+ };
623
352
  }), componentName = (0, import_extractHelpers.findComponentName)(traversePath.scope), closingElement = traversePath.node.closingElement;
624
353
  if (closingElement && t.isJSXMemberExpression(closingElement == null ? void 0 : closingElement.name) || !t.isJSXIdentifier(node.name)) {
625
354
  shouldPrintDebug && logger.info(" skip non-identifier element");
@@ -627,40 +356,310 @@ function createExtractor() {
627
356
  }
628
357
  var binding = traversePath.scope.getBinding(node.name.name), moduleName = "";
629
358
  if (binding && t.isImportDeclaration(binding.path.parent) && (moduleName = binding.path.parent.source.value, !(0, import_extractHelpers.isValidImport)(propsWithFileInfo, moduleName, binding.identifier.name))) {
630
- shouldPrintDebug && logger.info(" - Binding in component ".concat(componentName, ' not valid import: "').concat(binding.identifier.name, `" isn't in `).concat(moduleName, `
631
- `));
359
+ shouldPrintDebug && logger.info(` - Binding in component ${componentName} not valid import: "${binding.identifier.name}" isn't in ${moduleName}
360
+ `);
632
361
  return;
633
362
  }
634
363
  var component = (0, import_extractHelpers.getValidComponent)(propsWithFileInfo, moduleName, node.name.name);
635
364
  if (!component || !component.staticConfig) {
636
365
  shouldPrintDebug && logger.info(`
637
- - No Tamagui conf for: `.concat(node.name.name, `
638
- `));
366
+ - No Tamagui conf for: ${node.name.name}
367
+ `);
639
368
  return;
640
369
  }
641
370
  var originalNodeName = node.name.name;
642
371
  res.found++;
643
- var filePath = "./".concat((0, import_node_path.relative)(process.cwd(), sourcePath)), lineNumbers = node.loc ? node.loc.start.line + (node.loc.start.line !== node.loc.end.line ? "-".concat(node.loc.end.line) : "") : "", codePosition = "".concat(filePath, ":").concat(lineNumbers), debugPropValue = node.attributes.filter(function(n) {
372
+ var filePath = `./${(0, import_node_path.relative)(process.cwd(), sourcePath)}`, lineNumbers = node.loc ? node.loc.start.line + (node.loc.start.line !== node.loc.end.line ? `-${node.loc.end.line}` : "") : "", codePosition = `${filePath}:${lineNumbers}`, debugPropValue = node.attributes.filter(function(n) {
644
373
  return t.isJSXAttribute(n) && t.isJSXIdentifier(n.name) && n.name.name === "debug";
645
374
  }).map(function(n) {
646
375
  return n.value === null ? !0 : t.isStringLiteral(n.value) ? n.value.value : !1;
647
376
  })[0];
648
- if (debugPropValue && (shouldPrintDebug = debugPropValue), shouldPrintDebug && (logger.info("\x1B[33m\x1B[0m " + "".concat(componentName, " | ").concat(codePosition, " -------------------")), logger.info([
377
+ if (debugPropValue && (shouldPrintDebug = debugPropValue), shouldPrintDebug && (logger.info(`\x1B[33m\x1B[0m ${componentName} | ${codePosition} -------------------`), logger.info([
649
378
  "\x1B[1m",
650
379
  "\x1B[32m",
651
- "<".concat(originalNodeName, " />"),
380
+ `<${originalNodeName} />`,
652
381
  disableDebugAttr ? "" : "\u{1F41B}"
653
- ].join(" "))), shouldAddDebugProp && !disableDebugAttr && (res.modified++, node.attributes.unshift(t.jsxAttribute(t.jsxIdentifier("data-is"), t.stringLiteral(node.name.name))), componentName && node.attributes.unshift(t.jsxAttribute(t.jsxIdentifier("data-in"), t.stringLiteral(componentName))), node.attributes.unshift(t.jsxAttribute(t.jsxIdentifier("data-at"), t.stringLiteral("".concat((0, import_node_path.basename)(filePath), ":").concat(lineNumbers))))), shouldDisableExtraction) {
654
- shouldPrintDebug === "verbose" && logger.info(" \u274C Extraction disabled: ".concat(JSON.stringify(disableExtraction), `
655
- `));
382
+ ].join(" "))), shouldAddDebugProp && !disableDebugAttr && (res.modified++, node.attributes.unshift(t.jsxAttribute(t.jsxIdentifier("data-is"), t.stringLiteral(node.name.name))), componentName && node.attributes.unshift(t.jsxAttribute(t.jsxIdentifier("data-in"), t.stringLiteral(componentName))), node.attributes.unshift(t.jsxAttribute(t.jsxIdentifier("data-at"), t.stringLiteral(`${(0, import_node_path.basename)(filePath)}:${lineNumbers}`)))), shouldDisableExtraction) {
383
+ shouldPrintDebug === "verbose" && logger.info(` \u274C Extraction disabled: ${JSON.stringify(disableExtraction)}
384
+ `);
656
385
  return;
657
386
  }
658
387
  try {
659
- let createTernariesFromObjectProperties2 = function(test, side) {
388
+ let evaluateAttribute2 = function(path) {
389
+ var attribute = path.node, attr3 = {
390
+ type: "attr",
391
+ value: attribute
392
+ };
393
+ if (t.isJSXSpreadAttribute(attribute)) {
394
+ var arg = attribute.argument, conditional = t.isConditionalExpression(arg) ? (
395
+ // <YStack {...isSmall ? { color: 'red } : { color: 'blue }}
396
+ [
397
+ arg.test,
398
+ arg.consequent,
399
+ arg.alternate
400
+ ]
401
+ ) : t.isLogicalExpression(arg) && arg.operator === "&&" ? (
402
+ // <YStack {...isSmall && { color: 'red }}
403
+ [
404
+ arg.left,
405
+ arg.right,
406
+ null
407
+ ]
408
+ ) : null;
409
+ if (conditional) {
410
+ var [test, alt, cons] = conditional;
411
+ if (!test) throw new Error("no test");
412
+ return [
413
+ alt,
414
+ cons
415
+ ].some(function(side) {
416
+ return side && !isStaticObject2(side);
417
+ }) ? (shouldPrintDebug && logger.info(`not extractable ${alt} ${cons}`), attr3) : [
418
+ ...createTernariesFromObjectProperties2(test, alt) || [],
419
+ ...cons && createTernariesFromObjectProperties2(t.unaryExpression("!", test), cons) || []
420
+ ].map(function(ternary2) {
421
+ return {
422
+ type: "ternary",
423
+ value: ternary2
424
+ };
425
+ });
426
+ }
427
+ }
428
+ if (t.isJSXSpreadAttribute(attribute) || !attribute.name || typeof attribute.name.name != "string")
429
+ return shouldPrintDebug && logger.info(" ! inlining, spread attr"), inlined.set(`${Math.random()}`, "spread"), attr3;
430
+ var name2 = attribute.name.name;
431
+ if (excludeProps != null && excludeProps.has(name2))
432
+ return shouldPrintDebug && logger.info([
433
+ " excluding prop",
434
+ name2
435
+ ].join(" ")), null;
436
+ if (inlineProps.has(name2))
437
+ return inlined.set(name2, name2), shouldPrintDebug && logger.info([
438
+ " ! inlining, inline prop",
439
+ name2
440
+ ].join(" ")), attr3;
441
+ if (UNTOUCHED_PROPS[name2])
442
+ return attr3;
443
+ if (INLINE_EXTRACTABLE[name2])
444
+ return inlined.set(name2, INLINE_EXTRACTABLE[name2]), attr3;
445
+ if (name2.startsWith("data-"))
446
+ return attr3;
447
+ if ((name2 === "enterStyle" || name2 === "exitStyle") && t.isJSXExpressionContainer(attribute == null ? void 0 : attribute.value))
448
+ return shouldDeopt = !0, attr3;
449
+ if (name2[0] === "$" && t.isJSXExpressionContainer(attribute == null ? void 0 : attribute.value)) {
450
+ var shortname = name2.slice(1);
451
+ if (mediaQueryConfig[shortname]) {
452
+ if (platform2 === "native" && (shouldDeopt = !0), disableExtractInlineMedia)
453
+ return attr3;
454
+ var expression = attribute.value.expression;
455
+ if (!t.isJSXEmptyExpression(expression)) {
456
+ var ternaries2 = createTernariesFromObjectProperties2(t.stringLiteral(shortname), expression, {
457
+ inlineMediaQuery: shortname
458
+ });
459
+ if (ternaries2)
460
+ return ternaries2.map(function(value3) {
461
+ return {
462
+ type: "ternary",
463
+ value: value3
464
+ };
465
+ });
466
+ }
467
+ }
468
+ }
469
+ var [value2, valuePath] = function() {
470
+ return t.isJSXExpressionContainer(attribute == null ? void 0 : attribute.value) ? [
471
+ attribute.value.expression,
472
+ path.get("value")
473
+ ] : [
474
+ attribute.value,
475
+ path.get("value")
476
+ ];
477
+ }(), remove = function() {
478
+ Array.isArray(valuePath) ? valuePath.map(function(p) {
479
+ return p.remove();
480
+ }) : valuePath.remove();
481
+ };
482
+ if (name2 === "ref")
483
+ return shouldPrintDebug && logger.info([
484
+ " ! inlining, ref",
485
+ name2
486
+ ].join(" ")), inlined.set("ref", "ref"), attr3;
487
+ if (name2 === "tag")
488
+ return {
489
+ type: "attr",
490
+ value: path.node
491
+ };
492
+ if (disableExtractVariables === !0 && value2 && value2.type === "StringLiteral" && value2.value[0] === "$")
493
+ return shouldPrintDebug && logger.info([
494
+ ` ! inlining, native disable extract: ${name2} =`,
495
+ value2.value
496
+ ].join(" ")), inlined.set(name2, !0), attr3;
497
+ if (name2 === "theme")
498
+ return inlined.set("theme", attr3.value), attr3;
499
+ var styleValue = attemptEvalSafe(value2);
500
+ if (!variants[name2] && !isValidStyleKey(name2, staticConfig)) {
501
+ var keys = [
502
+ name2
503
+ ], out = null;
504
+ out = propMapper(name2, styleValue, propMapperStyleState), out && (Array.isArray(out) ? (out = Object.fromEntries(out), keys = Object.keys(out)) : (logger.warn("Error expected array but got", out), couldntParse = !0, shouldDeopt = !0)), out && (isTargetingHTML && (out = reactNativeWebInternals.createDOMProps(isTextView ? "span" : "div", out), delete out.className), keys = Object.keys(out));
505
+ var didInline = !1, attributes = keys.map(function(key9) {
506
+ var val2 = out[key9], isStyle = isValidStyleKey(key9, staticConfig);
507
+ return isStyle ? {
508
+ type: "style",
509
+ value: {
510
+ [key9]: styleValue
511
+ },
512
+ name: key9,
513
+ attr: path.node
514
+ } : import_validHTMLAttributes.validHTMLAttributes[key9] || key9.startsWith("aria-") || key9.startsWith("data-") || // this is debug stuff added by vite / new jsx transform
515
+ key9 === "__source" || key9 === "__self" ? attr3 : (shouldPrintDebug && logger.info(" ! inlining, non-static " + key9), didInline = !0, inlined.set(key9, val2), val2);
516
+ });
517
+ return didInline ? (shouldPrintDebug && logger.info(` bailing flattening due to attributes ${attributes.map(function(x) {
518
+ return x.toString();
519
+ })}`), attr3) : attributes;
520
+ }
521
+ if (styleValue !== import_constants.FAILED_EVAL)
522
+ return inlineWhenUnflattened.has(name2) && (inlineWhenUnflattenedOGVals[name2] = {
523
+ styleValue,
524
+ attr: attr3
525
+ }), isValidStyleKey(name2, staticConfig) ? (shouldPrintDebug && logger.info(` style: ${name2} = ${styleValue}`), name2 in defaultProps || hasSetOptimized || (res.optimized++, hasSetOptimized = !0), {
526
+ type: "style",
527
+ value: {
528
+ [name2]: styleValue
529
+ },
530
+ name: name2,
531
+ attr: path.node
532
+ }) : (variants[name2] && variantValues.set(name2, styleValue), inlined.set(name2, !0), attr3);
533
+ if (t.isBinaryExpression(value2)) {
534
+ shouldPrintDebug && logger.info(` binary expression ${name2} = ${value2}`);
535
+ var { operator, left, right } = value2, lVal = attemptEvalSafe(left), rVal = attemptEvalSafe(right);
536
+ if (shouldPrintDebug && logger.info(` evalBinaryExpression lVal ${String(lVal)}, rVal ${String(rVal)}`), lVal !== import_constants.FAILED_EVAL && t.isConditionalExpression(right)) {
537
+ var ternary = addBinaryConditional(operator, left, right);
538
+ if (ternary) return ternary;
539
+ }
540
+ if (rVal !== import_constants.FAILED_EVAL && t.isConditionalExpression(left)) {
541
+ var ternary1 = addBinaryConditional(operator, right, left);
542
+ if (ternary1) return ternary1;
543
+ }
544
+ return shouldPrintDebug && logger.info(" evalBinaryExpression cant extract"), inlined.set(name2, !0), attr3;
545
+ }
546
+ var staticConditional = getStaticConditional(value2);
547
+ if (staticConditional)
548
+ return shouldPrintDebug === "verbose" && logger.info(` static conditional ${name2} ${value2}`), {
549
+ type: "ternary",
550
+ value: staticConditional
551
+ };
552
+ var staticLogical = getStaticLogical(value2);
553
+ if (staticLogical)
554
+ return shouldPrintDebug === "verbose" && logger.info(` static ternary ${name2} = ${value2}`), {
555
+ type: "ternary",
556
+ value: staticLogical
557
+ };
558
+ if (options.experimentalFlattenDynamicValues && isValidStyleKey(name2, staticConfig))
559
+ return {
560
+ type: "dynamic-style",
561
+ value: value2,
562
+ name: (tamaguiConfig == null ? void 0 : tamaguiConfig.shorthands[name2]) || name2
563
+ };
564
+ return inlined.set(name2, !0), shouldPrintDebug && logger.info(` ! inline no match ${name2} ${value2}`), attr3;
565
+ function addBinaryConditional(operator2, staticExpr, cond) {
566
+ if (getStaticConditional(cond)) {
567
+ var alt2 = attemptEval(t.binaryExpression(operator2, staticExpr, cond.alternate)), cons2 = attemptEval(t.binaryExpression(operator2, staticExpr, cond.consequent));
568
+ return shouldPrintDebug && logger.info([
569
+ " binaryConditional",
570
+ cond.test,
571
+ cons2,
572
+ alt2
573
+ ].join(" ")), {
574
+ type: "ternary",
575
+ value: {
576
+ test: cond.test,
577
+ remove,
578
+ alternate: {
579
+ [name2]: alt2
580
+ },
581
+ consequent: {
582
+ [name2]: cons2
583
+ }
584
+ }
585
+ };
586
+ }
587
+ return null;
588
+ }
589
+ function getStaticConditional(value3) {
590
+ if (t.isConditionalExpression(value3))
591
+ try {
592
+ var aVal = attemptEval(value3.alternate), cVal = attemptEval(value3.consequent);
593
+ if (shouldPrintDebug) {
594
+ var type = value3.test.type;
595
+ logger.info([
596
+ " static ternary",
597
+ type,
598
+ cVal,
599
+ aVal
600
+ ].join(" "));
601
+ }
602
+ return {
603
+ test: value3.test,
604
+ remove,
605
+ consequent: {
606
+ [name2]: cVal
607
+ },
608
+ alternate: {
609
+ [name2]: aVal
610
+ }
611
+ };
612
+ } catch (err) {
613
+ shouldPrintDebug && logger.info([
614
+ " cant eval ternary",
615
+ err.message
616
+ ].join(" "));
617
+ }
618
+ return null;
619
+ }
620
+ function getStaticLogical(value3) {
621
+ if (t.isLogicalExpression(value3) && value3.operator === "&&")
622
+ try {
623
+ var val2 = attemptEval(value3.right);
624
+ return shouldPrintDebug && logger.info([
625
+ " staticLogical",
626
+ value3.left,
627
+ name2,
628
+ val2
629
+ ].join(" ")), {
630
+ test: value3.left,
631
+ remove,
632
+ consequent: {
633
+ [name2]: val2
634
+ },
635
+ alternate: null
636
+ };
637
+ } catch (err) {
638
+ shouldPrintDebug && logger.info([
639
+ " cant static eval logical",
640
+ err
641
+ ].join(" "));
642
+ }
643
+ return null;
644
+ }
645
+ }, isStaticObject2 = function(obj) {
646
+ return t.isObjectExpression(obj) && obj.properties.every(function(prop) {
647
+ if (!t.isObjectProperty(prop))
648
+ return logger.info([
649
+ "not object prop",
650
+ prop
651
+ ].join(" ")), !1;
652
+ var propName = prop.key.name;
653
+ return !isValidStyleKey(propName, staticConfig) && propName !== "tag" ? (shouldPrintDebug && logger.info([
654
+ " not a valid style prop!",
655
+ propName
656
+ ].join(" ")), !1) : !0;
657
+ });
658
+ }, createTernariesFromObjectProperties2 = function(test, side) {
660
659
  var ternaryPartial = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
661
660
  if (!side)
662
661
  return null;
663
- if (!isStaticObject(side))
662
+ if (!isStaticObject2(side))
664
663
  throw new Error("not extractable");
665
664
  return side.properties.flatMap(function(property) {
666
665
  if (!t.isObjectProperty(property))
@@ -674,10 +673,12 @@ function createExtractor() {
674
673
  });
675
674
  if (ternaries2)
676
675
  return ternaries2.map(function(value2) {
677
- return _object_spread_props(_object_spread({}, ternaryPartial, value2), {
676
+ return {
677
+ ...ternaryPartial,
678
+ ...value2,
678
679
  // ensure media query test stays on left side (see getMediaQueryTernary)
679
680
  test: t.logicalExpression("&&", value2.test, test)
680
- });
681
+ };
681
682
  });
682
683
  logger.info([
683
684
  "\u26A0\uFE0F no ternaries?",
@@ -690,7 +691,7 @@ function createExtractor() {
690
691
  ].join(" "));
691
692
  }
692
693
  if (t.isConditionalExpression(property.value)) {
693
- var _map = _sliced_to_array([
694
+ var [truthy, falsy] = [
694
695
  t.objectExpression([
695
696
  t.objectProperty(property.key, property.value.consequent)
696
697
  ]),
@@ -699,356 +700,102 @@ function createExtractor() {
699
700
  ])
700
701
  ].map(function(x) {
701
702
  return attemptEval(x);
702
- }), 2), truthy = _map[0], falsy = _map[1];
703
+ });
703
704
  return [
704
- createTernary(_object_spread_props(_object_spread({
705
- remove: function() {
706
- }
707
- }, ternaryPartial), {
705
+ createTernary({
706
+ remove() {
707
+ },
708
+ ...ternaryPartial,
708
709
  test: t.logicalExpression("&&", test, property.value.test),
709
710
  consequent: truthy,
710
711
  alternate: null
711
- })),
712
- createTernary(_object_spread_props(_object_spread({}, ternaryPartial), {
712
+ }),
713
+ createTernary({
714
+ ...ternaryPartial,
713
715
  test: t.logicalExpression("&&", test, t.unaryExpression("!", property.value.test)),
714
716
  consequent: falsy,
715
717
  alternate: null,
716
- remove: function() {
718
+ remove() {
717
719
  }
718
- }))
720
+ })
719
721
  ];
720
722
  }
721
723
  var obj = t.objectExpression([
722
724
  t.objectProperty(property.key, property.value)
723
725
  ]), consequent = attemptEval(obj);
724
- return createTernary(_object_spread_props(_object_spread({
725
- remove: function() {
726
- }
727
- }, ternaryPartial), {
726
+ return createTernary({
727
+ remove() {
728
+ },
729
+ ...ternaryPartial,
728
730
  test,
729
731
  consequent,
730
732
  alternate: null
731
- }));
732
- });
733
- };
734
- var createTernariesFromObjectProperties = createTernariesFromObjectProperties2, evaluateAttribute = (
735
- // START function evaluateAttribute
736
- function(path) {
737
- var attribute = path.node, attr3 = {
738
- type: "attr",
739
- value: attribute
740
- };
741
- if (t.isJSXSpreadAttribute(attribute)) {
742
- var arg = attribute.argument, conditional = t.isConditionalExpression(arg) ? (
743
- // <YStack {...isSmall ? { color: 'red } : { color: 'blue }}
744
- [
745
- arg.test,
746
- arg.consequent,
747
- arg.alternate
748
- ]
749
- ) : t.isLogicalExpression(arg) && arg.operator === "&&" ? (
750
- // <YStack {...isSmall && { color: 'red }}
751
- [
752
- arg.left,
753
- arg.right,
754
- null
755
- ]
756
- ) : null;
757
- if (conditional) {
758
- var _conditional = _sliced_to_array(conditional, 3), test = _conditional[0], alt = _conditional[1], cons = _conditional[2];
759
- if (!test) throw new Error("no test");
760
- return [
761
- alt,
762
- cons
763
- ].some(function(side) {
764
- return side && !isStaticObject(side);
765
- }) ? (shouldPrintDebug && logger.info("not extractable ".concat(alt, " ").concat(cons)), attr3) : _to_consumable_array(createTernariesFromObjectProperties2(test, alt) || []).concat(_to_consumable_array(cons && createTernariesFromObjectProperties2(t.unaryExpression("!", test), cons) || [])).map(function(ternary2) {
766
- return {
767
- type: "ternary",
768
- value: ternary2
769
- };
770
- });
771
- }
772
- }
773
- if (t.isJSXSpreadAttribute(attribute) || !attribute.name || typeof attribute.name.name != "string")
774
- return shouldPrintDebug && logger.info(" ! inlining, spread attr"), inlined.set("".concat(Math.random()), "spread"), attr3;
775
- var name2 = attribute.name.name;
776
- if (excludeProps != null && excludeProps.has(name2))
777
- return shouldPrintDebug && logger.info([
778
- " excluding prop",
779
- name2
780
- ].join(" ")), null;
781
- if (inlineProps.has(name2))
782
- return inlined.set(name2, name2), shouldPrintDebug && logger.info([
783
- " ! inlining, inline prop",
784
- name2
785
- ].join(" ")), attr3;
786
- if (UNTOUCHED_PROPS[name2])
787
- return attr3;
788
- if (INLINE_EXTRACTABLE[name2])
789
- return inlined.set(name2, INLINE_EXTRACTABLE[name2]), attr3;
790
- if (name2.startsWith("data-"))
791
- return attr3;
792
- if ((name2 === "enterStyle" || name2 === "exitStyle") && t.isJSXExpressionContainer(attribute == null ? void 0 : attribute.value))
793
- return shouldDeopt = !0, attr3;
794
- if (name2[0] === "$" && t.isJSXExpressionContainer(attribute == null ? void 0 : attribute.value)) {
795
- var shortname = name2.slice(1);
796
- if (mediaQueryConfig[shortname]) {
797
- if (platform2 === "native" && (shouldDeopt = !0), disableExtractInlineMedia)
798
- return attr3;
799
- var expression = attribute.value.expression;
800
- if (!t.isJSXEmptyExpression(expression)) {
801
- var ternaries2 = createTernariesFromObjectProperties2(t.stringLiteral(shortname), expression, {
802
- inlineMediaQuery: shortname
803
- });
804
- if (ternaries2)
805
- return ternaries2.map(function(value3) {
806
- return {
807
- type: "ternary",
808
- value: value3
809
- };
810
- });
811
- }
812
- }
813
- }
814
- var _ref2 = _sliced_to_array(function() {
815
- return t.isJSXExpressionContainer(attribute == null ? void 0 : attribute.value) ? [
816
- attribute.value.expression,
817
- path.get("value")
818
- ] : [
819
- attribute.value,
820
- path.get("value")
821
- ];
822
- }(), 2), value2 = _ref2[0], valuePath = _ref2[1], remove = function() {
823
- Array.isArray(valuePath) ? valuePath.map(function(p) {
824
- return p.remove();
825
- }) : valuePath.remove();
826
- };
827
- if (name2 === "ref")
828
- return shouldPrintDebug && logger.info([
829
- " ! inlining, ref",
830
- name2
831
- ].join(" ")), inlined.set("ref", "ref"), attr3;
832
- if (name2 === "tag")
833
- return {
834
- type: "attr",
835
- value: path.node
836
- };
837
- if (disableExtractVariables === !0 && value2 && value2.type === "StringLiteral" && value2.value[0] === "$")
838
- return shouldPrintDebug && logger.info([
839
- " ! inlining, native disable extract: ".concat(name2, " ="),
840
- value2.value
841
- ].join(" ")), inlined.set(name2, !0), attr3;
842
- if (name2 === "theme")
843
- return inlined.set("theme", attr3.value), attr3;
844
- var styleValue = attemptEvalSafe(value2);
845
- if (!variants[name2] && !isValidStyleKey(name2, staticConfig)) {
846
- var keys = [
847
- name2
848
- ], out = null;
849
- out = propMapper(name2, styleValue, propMapperStyleState), out && (Array.isArray(out) ? (out = Object.fromEntries(out), keys = Object.keys(out)) : (logger.warn("Error expected array but got", out), couldntParse = !0, shouldDeopt = !0)), out && (isTargetingHTML && (out = reactNativeWebInternals.createDOMProps(isTextView ? "span" : "div", out), delete out.className), keys = Object.keys(out));
850
- var didInline = !1, attributes = keys.map(function(key9) {
851
- var val2 = out[key9], isStyle = isValidStyleKey(key9, staticConfig);
852
- return isStyle ? {
853
- type: "style",
854
- value: _define_property({}, key9, styleValue),
855
- name: key9,
856
- attr: path.node
857
- } : import_validHTMLAttributes.validHTMLAttributes[key9] || key9.startsWith("aria-") || key9.startsWith("data-") || // this is debug stuff added by vite / new jsx transform
858
- key9 === "__source" || key9 === "__self" ? attr3 : (shouldPrintDebug && logger.info(" ! inlining, non-static " + key9), didInline = !0, inlined.set(key9, val2), val2);
859
- });
860
- return didInline ? (shouldPrintDebug && logger.info(" bailing flattening due to attributes ".concat(attributes.map(function(x) {
861
- return x.toString();
862
- }))), attr3) : attributes;
863
- }
864
- if (styleValue !== import_constants.FAILED_EVAL)
865
- return inlineWhenUnflattened.has(name2) && (inlineWhenUnflattenedOGVals[name2] = {
866
- styleValue,
867
- attr: attr3
868
- }), isValidStyleKey(name2, staticConfig) ? (shouldPrintDebug && logger.info(" style: ".concat(name2, " = ").concat(styleValue)), name2 in defaultProps || hasSetOptimized || (res.optimized++, hasSetOptimized = !0), {
869
- type: "style",
870
- value: _define_property({}, name2, styleValue),
871
- name: name2,
872
- attr: path.node
873
- }) : (variants[name2] && variantValues.set(name2, styleValue), inlined.set(name2, !0), attr3);
874
- if (t.isBinaryExpression(value2)) {
875
- shouldPrintDebug && logger.info(" binary expression ".concat(name2, " = ").concat(value2));
876
- var operator = value2.operator, left = value2.left, right = value2.right, lVal = attemptEvalSafe(left), rVal = attemptEvalSafe(right);
877
- if (shouldPrintDebug && logger.info(" evalBinaryExpression lVal ".concat(String(lVal), ", rVal ").concat(String(rVal))), lVal !== import_constants.FAILED_EVAL && t.isConditionalExpression(right)) {
878
- var ternary = addBinaryConditional(operator, left, right);
879
- if (ternary) return ternary;
880
- }
881
- if (rVal !== import_constants.FAILED_EVAL && t.isConditionalExpression(left)) {
882
- var ternary1 = addBinaryConditional(operator, right, left);
883
- if (ternary1) return ternary1;
884
- }
885
- return shouldPrintDebug && logger.info(" evalBinaryExpression cant extract"), inlined.set(name2, !0), attr3;
886
- }
887
- var staticConditional = getStaticConditional(value2);
888
- if (staticConditional)
889
- return shouldPrintDebug === "verbose" && logger.info(" static conditional ".concat(name2, " ").concat(value2)), {
890
- type: "ternary",
891
- value: staticConditional
892
- };
893
- var staticLogical = getStaticLogical(value2);
894
- if (staticLogical)
895
- return shouldPrintDebug === "verbose" && logger.info(" static ternary ".concat(name2, " = ").concat(value2)), {
896
- type: "ternary",
897
- value: staticLogical
898
- };
899
- if (options.experimentalFlattenDynamicValues && isValidStyleKey(name2, staticConfig))
900
- return {
901
- type: "dynamic-style",
902
- value: value2,
903
- name: (tamaguiConfig == null ? void 0 : tamaguiConfig.shorthands[name2]) || name2
904
- };
905
- return inlined.set(name2, !0), shouldPrintDebug && logger.info(" ! inline no match ".concat(name2, " ").concat(value2)), attr3;
906
- function addBinaryConditional(operator2, staticExpr, cond) {
907
- if (getStaticConditional(cond)) {
908
- var alt2 = attemptEval(t.binaryExpression(operator2, staticExpr, cond.alternate)), cons2 = attemptEval(t.binaryExpression(operator2, staticExpr, cond.consequent));
909
- return shouldPrintDebug && logger.info([
910
- " binaryConditional",
911
- cond.test,
912
- cons2,
913
- alt2
914
- ].join(" ")), {
915
- type: "ternary",
916
- value: {
917
- test: cond.test,
918
- remove,
919
- alternate: _define_property({}, name2, alt2),
920
- consequent: _define_property({}, name2, cons2)
921
- }
922
- };
923
- }
924
- return null;
925
- }
926
- function getStaticConditional(value3) {
927
- if (t.isConditionalExpression(value3))
928
- try {
929
- var aVal = attemptEval(value3.alternate), cVal = attemptEval(value3.consequent);
930
- if (shouldPrintDebug) {
931
- var type = value3.test.type;
932
- logger.info([
933
- " static ternary",
934
- type,
935
- cVal,
936
- aVal
937
- ].join(" "));
938
- }
939
- return {
940
- test: value3.test,
941
- remove,
942
- consequent: _define_property({}, name2, cVal),
943
- alternate: _define_property({}, name2, aVal)
944
- };
945
- } catch (err) {
946
- shouldPrintDebug && logger.info([
947
- " cant eval ternary",
948
- err.message
949
- ].join(" "));
950
- }
951
- return null;
952
- }
953
- function getStaticLogical(value3) {
954
- if (t.isLogicalExpression(value3) && value3.operator === "&&")
955
- try {
956
- var val2 = attemptEval(value3.right);
957
- return shouldPrintDebug && logger.info([
958
- " staticLogical",
959
- value3.left,
960
- name2,
961
- val2
962
- ].join(" ")), {
963
- test: value3.left,
964
- remove,
965
- consequent: _define_property({}, name2, val2),
966
- alternate: null
967
- };
968
- } catch (err) {
969
- shouldPrintDebug && logger.info([
970
- " cant static eval logical",
971
- err
972
- ].join(" "));
973
- }
974
- return null;
975
- }
976
- }
977
- ), isStaticObject = (
978
- // END function evaluateAttribute
979
- function(obj) {
980
- return t.isObjectExpression(obj) && obj.properties.every(function(prop) {
981
- if (!t.isObjectProperty(prop))
982
- return logger.info([
983
- "not object prop",
984
- prop
985
- ].join(" ")), !1;
986
- var propName = prop.key.name;
987
- return !isValidStyleKey(propName, staticConfig) && propName !== "tag" ? (shouldPrintDebug && logger.info([
988
- " not a valid style prop!",
989
- propName
990
- ].join(" ")), !1) : !0;
991
733
  });
992
- }
993
- ), mergeToEnd = function(obj, key9, val2) {
734
+ });
735
+ }, mergeToEnd2 = function(obj, key9, val2) {
994
736
  key9 in obj && delete obj[key9], obj[key9] = val2;
995
- }, normalizeStyleWithoutVariants = (
996
- // preserves order
997
- function(style) {
998
- var res2 = {};
999
- for (var key9 in style)
1000
- if (staticConfig.variants && key9 in staticConfig.variants)
1001
- mergeToEnd(res2, key9, style[key9]);
1002
- else {
1003
- var expanded2 = normalizeStyle(_define_property({}, key9, style[key9]), !0);
1004
- for (var key12 in expanded2)
1005
- mergeToEnd(res2, key12, expanded2[key12]);
1006
- }
1007
- return res2;
1008
- }
1009
- ), mergeStyles = function(prev2, next) {
737
+ }, normalizeStyleWithoutVariants2 = function(style) {
738
+ var res2 = {};
739
+ for (var key9 in style)
740
+ if (staticConfig.variants && key9 in staticConfig.variants)
741
+ mergeToEnd2(res2, key9, style[key9]);
742
+ else {
743
+ var expanded2 = normalizeStyle({
744
+ [key9]: style[key9]
745
+ }, !0);
746
+ for (var key12 in expanded2)
747
+ mergeToEnd2(res2, key12, expanded2[key12]);
748
+ }
749
+ return res2;
750
+ }, mergeStyles2 = function(prev2, next) {
1010
751
  for (var key9 in next)
1011
- pseudoDescriptors[key9] ? (prev2[key9] = prev2[key9] || {}, Object.assign(prev2[key9], next[key9])) : mergeToEnd(prev2, key9, next[key9]);
1012
- }, staticConfig = component.staticConfig, defaultProps = _object_spread({}, staticConfig.defaultProps || {}), variants = staticConfig.variants || {}, isTextView = staticConfig.isText || !1, _staticConfig_validStyles, validStyles = (_staticConfig_validStyles = staticConfig == null ? void 0 : staticConfig.validStyles) !== null && _staticConfig_validStyles !== void 0 ? _staticConfig_validStyles : {}, _defaultProps_tag, tagName = (_defaultProps_tag = defaultProps.tag) !== null && _defaultProps_tag !== void 0 ? _defaultProps_tag : isTextView ? "span" : "div";
752
+ pseudoDescriptors[key9] ? (prev2[key9] = prev2[key9] || {}, Object.assign(prev2[key9], next[key9])) : mergeToEnd2(prev2, key9, next[key9]);
753
+ };
754
+ var evaluateAttribute = evaluateAttribute2, isStaticObject = isStaticObject2, createTernariesFromObjectProperties = createTernariesFromObjectProperties2, mergeToEnd = mergeToEnd2, normalizeStyleWithoutVariants = normalizeStyleWithoutVariants2, mergeStyles = mergeStyles2, { staticConfig } = component, defaultProps = {
755
+ ...staticConfig.defaultProps || {}
756
+ }, variants = staticConfig.variants || {}, isTextView = staticConfig.isText || !1, _staticConfig_validStyles, validStyles = (_staticConfig_validStyles = staticConfig == null ? void 0 : staticConfig.validStyles) !== null && _staticConfig_validStyles !== void 0 ? _staticConfig_validStyles : {}, _defaultProps_tag, tagName = (_defaultProps_tag = defaultProps.tag) !== null && _defaultProps_tag !== void 0 ? _defaultProps_tag : isTextView ? "span" : "div";
1013
757
  traversePath.get("openingElement").get("attributes").forEach(function(path) {
1014
758
  var attr3 = path.node;
1015
759
  if (!t.isJSXSpreadAttribute(attr3) && attr3.name.name === "tag") {
1016
760
  var val2 = attr3.value;
1017
761
  t.isStringLiteral(val2) && (tagName = val2.value);
1018
762
  }
1019
- }), shouldPrintDebug === "verbose" && console.info(" Start tag ".concat(tagName));
763
+ }), shouldPrintDebug === "verbose" && console.info(` Start tag ${tagName}`);
1020
764
  var flatNode = getFlattenedNode == null ? void 0 : getFlattenedNode({
1021
765
  isTextView,
1022
766
  tag: tagName
1023
- }), inlineProps = new Set([
767
+ }), inlineProps = /* @__PURE__ */ new Set([
1024
768
  // adding some always inline props
1025
- "dataSet"
1026
- ].concat(_to_consumable_array(restProps.inlineProps || []), _to_consumable_array(staticConfig.inlineProps || []))), deoptProps = new Set([
769
+ "dataSet",
770
+ ...restProps.inlineProps || [],
771
+ ...staticConfig.inlineProps || []
772
+ ]), deoptProps = /* @__PURE__ */ new Set([
1027
773
  // always de-opt animation these
1028
774
  "animation",
1029
775
  "animateOnly",
1030
776
  "animatePresence",
1031
- "disableOptimization"
1032
- ].concat(
1033
- _to_consumable_array(isTargetingHTML ? [] : [
777
+ "disableOptimization",
778
+ ...isTargetingHTML ? [] : [
1034
779
  "pressStyle",
1035
780
  "focusStyle",
1036
781
  "focusVisibleStyle",
1037
782
  "disabledStyle"
1038
- ]),
783
+ ],
1039
784
  // when using a non-CSS driver, de-opt on enterStyle/exitStyle
1040
- _to_consumable_array(tamaguiConfig != null && tamaguiConfig.animations.isReactNative ? [
785
+ ...tamaguiConfig != null && tamaguiConfig.animations.isReactNative ? [
1041
786
  "enterStyle",
1042
787
  "exitStyle"
1043
- ] : [])
1044
- )), inlineWhenUnflattened = new Set(_to_consumable_array(staticConfig.inlineWhenUnflattened || [])), staticNamespace = (0, import_getStaticBindingsForScope.getStaticBindingsForScope)(traversePath.scope, importsWhitelist, sourcePath, bindingCache, shouldPrintDebug), attemptEval = evaluateVars ? (0, import_createEvaluator.createEvaluator)({
788
+ ] : []
789
+ ]), inlineWhenUnflattened = /* @__PURE__ */ new Set([
790
+ ...staticConfig.inlineWhenUnflattened || []
791
+ ]), staticNamespace = (0, import_getStaticBindingsForScope.getStaticBindingsForScope)(traversePath.scope, importsWhitelist, sourcePath, bindingCache, shouldPrintDebug), attemptEval = evaluateVars ? (0, import_createEvaluator.createEvaluator)({
1045
792
  props: propsWithFileInfo,
1046
793
  staticNamespace,
1047
794
  sourcePath,
1048
795
  traversePath,
1049
796
  shouldPrintDebug
1050
797
  }) : import_evaluateAstNode.evaluateAstNode, attemptEvalSafe = (0, import_createEvaluator.createSafeEvaluator)(attemptEval);
1051
- if (shouldPrintDebug && logger.info(" staticNamespace ".concat(Object.keys(staticNamespace).join(", "))), couldntParse)
798
+ if (shouldPrintDebug && logger.info(` staticNamespace ${Object.keys(staticNamespace).join(", ")}`), couldntParse)
1052
799
  return;
1053
800
  tm.mark("jsx-element-flattened", !!shouldPrintDebug);
1054
801
  var attrs = [], shouldDeopt = !1, inlined = /* @__PURE__ */ new Map(), variantValues = /* @__PURE__ */ new Map(), hasSetOptimized = !1, inlineWhenUnflattenedOGVals = {}, propMapperStyleState = {
@@ -1061,14 +808,15 @@ function createExtractor() {
1061
808
  conf: tamaguiConfig,
1062
809
  props: defaultProps,
1063
810
  componentState,
1064
- styleProps: _object_spread_props(_object_spread({}, styleProps), {
811
+ styleProps: {
812
+ ...styleProps,
1065
813
  resolveValues: "auto"
1066
- }),
814
+ },
1067
815
  debug: shouldPrintDebug
1068
816
  };
1069
817
  if (attrs = traversePath.get("openingElement").get("attributes").flatMap(function(path) {
1070
818
  try {
1071
- var res2 = evaluateAttribute(path);
819
+ var res2 = evaluateAttribute2(path);
1072
820
  return tm.mark("jsx-element-evaluate-attr", !!shouldPrintDebug), res2 || path.remove(), res2;
1073
821
  } catch (err) {
1074
822
  if (shouldPrintDebug && (logger.info([
@@ -1077,9 +825,9 @@ function createExtractor() {
1077
825
  shouldPrintDebug === "verbose" ? err.stack : ""
1078
826
  ].join(" ")), shouldPrintDebug === "verbose")) {
1079
827
  var _path_node;
1080
- logger.info("node ".concat((_path_node = path.node) === null || _path_node === void 0 ? void 0 : _path_node.type));
828
+ logger.info(`node ${(_path_node = path.node) === null || _path_node === void 0 ? void 0 : _path_node.type}`);
1081
829
  }
1082
- return inlined.set("".concat(Math.random()), "spread"), {
830
+ return inlined.set(`${Math.random()}`, "spread"), {
1083
831
  type: "attr",
1084
832
  value: path.node
1085
833
  };
@@ -1106,21 +854,11 @@ function createExtractor() {
1106
854
  return x.type === "JSXText";
1107
855
  })), themeVal = inlined.get("theme");
1108
856
  platform2 !== "native" && inlined.delete("theme");
1109
- var _iteratorNormalCompletion2 = !0, _didIteratorError2 = !1, _iteratorError2 = void 0;
1110
- try {
1111
- for (var _iterator2 = _to_consumable_array(inlined)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0) {
1112
- var _step_value = _sliced_to_array(_step2.value, 1), key = _step_value[0], _staticConfig_variants, isStaticObjectVariant = ((_staticConfig_variants = staticConfig.variants) === null || _staticConfig_variants === void 0 ? void 0 : _staticConfig_variants[key]) && variantValues.has(key);
1113
- (INLINE_EXTRACTABLE[key] || isStaticObjectVariant) && inlined.delete(key);
1114
- }
1115
- } catch (err) {
1116
- _didIteratorError2 = !0, _iteratorError2 = err;
1117
- } finally {
1118
- try {
1119
- !_iteratorNormalCompletion2 && _iterator2.return != null && _iterator2.return();
1120
- } finally {
1121
- if (_didIteratorError2)
1122
- throw _iteratorError2;
1123
- }
857
+ for (var _i = 0, _iter = [
858
+ ...inlined
859
+ ]; _i < _iter.length; _i++) {
860
+ var [key] = _iter[_i], _staticConfig_variants, isStaticObjectVariant = ((_staticConfig_variants = staticConfig.variants) === null || _staticConfig_variants === void 0 ? void 0 : _staticConfig_variants[key]) && variantValues.has(key);
861
+ (INLINE_EXTRACTABLE[key] || isStaticObjectVariant) && inlined.delete(key);
1124
862
  }
1125
863
  var canFlattenProps = inlined.size === 0, shouldFlatten = !!(flatNode && !shouldDeopt && canFlattenProps && !hasSpread && !staticConfig.isStyledHOC && !staticConfig.isHOC && !staticConfig.isReactNative && staticConfig.neverFlatten !== !0 && (staticConfig.neverFlatten !== "jsx" || hasOnlyStringChildren)), usedThemeKeys = /* @__PURE__ */ new Set();
1126
864
  if (themeAccessListeners.add(function(key9) {
@@ -1142,11 +880,11 @@ function createExtractor() {
1142
880
  return [];
1143
881
  var name2 = (tamaguiConfig == null ? void 0 : tamaguiConfig.shorthands[key9]) || key9;
1144
882
  if (value2 === void 0) {
1145
- logger.warn("\u26A0\uFE0F Error evaluating default style for component, prop ".concat(key9, " ").concat(value2)), shouldDeopt = !0;
883
+ logger.warn(`\u26A0\uFE0F Error evaluating default style for component, prop ${key9} ${value2}`), shouldDeopt = !0;
1146
884
  return;
1147
885
  }
1148
886
  if (name2[0] === "$" && mediaQueryConfig[name2.slice(1)])
1149
- return defaultProps[key9] = void 0, evaluateAttribute({
887
+ return defaultProps[key9] = void 0, evaluateAttribute2({
1150
888
  node: t.jsxAttribute(t.jsxIdentifier(name2), t.jsxExpressionContainer(t.objectExpression(Object.keys(value2).filter(function(k) {
1151
889
  return typeof value2[k] < "u";
1152
890
  }).map(function(k) {
@@ -1156,33 +894,39 @@ function createExtractor() {
1156
894
  var attr3 = {
1157
895
  type: "style",
1158
896
  name: name2,
1159
- value: _define_property({}, name2, value2)
897
+ value: {
898
+ [name2]: value2
899
+ }
1160
900
  };
1161
901
  return attr3;
1162
902
  });
1163
- skipMap || defaultStyleAttrs.length && (attrs = _to_consumable_array(defaultStyleAttrs).concat(_to_consumable_array(attrs)));
903
+ skipMap || defaultStyleAttrs.length && (attrs = [
904
+ ...defaultStyleAttrs,
905
+ ...attrs
906
+ ]);
1164
907
  }
1165
908
  var ternaries = [];
1166
909
  attrs = attrs.reduce(function(out, cur2) {
1167
910
  var next = attrs[attrs.indexOf(cur2) + 1];
1168
911
  if (cur2.type === "ternary" && ternaries.push(cur2.value), (!next || next.type !== "ternary") && ternaries.length) {
1169
- var normalized = (0, import_normalizeTernaries.normalizeTernaries)(ternaries).map(function(_param) {
1170
- var alternate = _param.alternate, consequent = _param.consequent, rest = _object_without_properties(_param, [
1171
- "alternate",
1172
- "consequent"
1173
- ]);
912
+ var normalized = (0, import_normalizeTernaries.normalizeTernaries)(ternaries).map(function(param2) {
913
+ var { alternate, consequent, ...rest } = param2;
1174
914
  return {
1175
915
  type: "ternary",
1176
- value: _object_spread_props(_object_spread({}, rest), {
916
+ value: {
917
+ ...rest,
1177
918
  alternate: alternate || null,
1178
919
  consequent: consequent || null
1179
- })
920
+ }
1180
921
  };
1181
922
  });
1182
923
  try {
1183
- return _to_consumable_array(out).concat(_to_consumable_array(normalized));
924
+ return [
925
+ ...out,
926
+ ...normalized
927
+ ];
1184
928
  } finally {
1185
- shouldPrintDebug && logger.info(" normalizeTernaries (".concat(ternaries.length, " => ").concat(normalized.length, ")")), ternaries = [];
929
+ shouldPrintDebug && logger.info(` normalizeTernaries (${ternaries.length} => ${normalized.length})`), ternaries = [];
1186
930
  }
1187
931
  }
1188
932
  return cur2.type === "ternary" || out.push(cur2), out;
@@ -1199,7 +943,7 @@ function createExtractor() {
1199
943
  t.jsxAttribute(t.jsxIdentifier("name"), themeVal.value)
1200
944
  ]), t.jsxClosingElement(t.jsxIdentifier("_TamaguiTheme")), [
1201
945
  traversePath.node
1202
- ]))) : console.warn("No program path found, avoiding importing flattening / importing theme in ".concat(sourcePath))), shouldPrintDebug)
946
+ ]))) : console.warn(`No program path found, avoiding importing flattening / importing theme in ${sourcePath}`)), shouldPrintDebug)
1203
947
  try {
1204
948
  logger.info([
1205
949
  " flatten?",
@@ -1213,12 +957,14 @@ function createExtractor() {
1213
957
  }),
1214
958
  "inlined",
1215
959
  inlined.size,
1216
- _to_consumable_array(inlined)
960
+ [
961
+ ...inlined
962
+ ]
1217
963
  ].join(" "));
1218
964
  } catch {
1219
965
  }
1220
966
  if (shouldDeopt || !shouldFlatten) {
1221
- shouldPrintDebug && logger.info("Deopting ".concat(shouldDeopt, " ").concat(shouldFlatten)), node.attributes = ogAttributes;
967
+ shouldPrintDebug && logger.info(`Deopting ${shouldDeopt} ${shouldFlatten}`), node.attributes = ogAttributes;
1222
968
  return;
1223
969
  }
1224
970
  shouldPrintDebug && logger.info([
@@ -1230,16 +976,16 @@ function createExtractor() {
1230
976
  for (var key1 in attrs) {
1231
977
  var cur = attrs[key1];
1232
978
  if (cur.type === "style") {
1233
- var expanded = normalizeStyleWithoutVariants(cur.value);
979
+ var expanded = normalizeStyleWithoutVariants2(cur.value);
1234
980
  for (var key2 in expanded)
1235
- mergeToEnd(foundStaticProps, key2, expanded[key2]);
981
+ mergeToEnd2(foundStaticProps, key2, expanded[key2]);
1236
982
  continue;
1237
983
  }
1238
984
  if (cur.type === "attr") {
1239
985
  if (t.isJSXSpreadAttribute(cur.value) || !t.isJSXIdentifier(cur.value.name))
1240
986
  continue;
1241
987
  var key3 = cur.value.name.name, value = attemptEvalSafe(cur.value.value || t.booleanLiteral(!0));
1242
- value !== import_constants.FAILED_EVAL && mergeToEnd(foundStaticProps, key3, value);
988
+ value !== import_constants.FAILED_EVAL && mergeToEnd2(foundStaticProps, key3, value);
1243
989
  }
1244
990
  }
1245
991
  var completeProps = {};
@@ -1255,9 +1001,10 @@ function createExtractor() {
1255
1001
  if (name2 === "tag")
1256
1002
  return acc;
1257
1003
  if (variants[name2] && variantValues.has(name2)) {
1258
- var styleState = _object_spread_props(_object_spread({}, propMapperStyleState), {
1004
+ var styleState = {
1005
+ ...propMapperStyleState,
1259
1006
  props: completeProps
1260
- }), out = Object.fromEntries(propMapper(name2, variantValues.get(name2), styleState) || []);
1007
+ }, out = Object.fromEntries(propMapper(name2, variantValues.get(name2), styleState) || []);
1261
1008
  if (out && isTargetingHTML) {
1262
1009
  var cn = out.className;
1263
1010
  out = reactNativeWebInternals.createDOMProps(isTextView ? "span" : "div", out), out.className = cn;
@@ -1271,7 +1018,9 @@ function createExtractor() {
1271
1018
  var value2 = out[key9];
1272
1019
  isValidStyleKey(key9, staticConfig) ? acc.push({
1273
1020
  type: "style",
1274
- value: _define_property({}, key9, value2),
1021
+ value: {
1022
+ [key9]: value2
1023
+ },
1275
1024
  name: key9,
1276
1025
  attr: cur2.value
1277
1026
  }) : acc.push({
@@ -1285,8 +1034,10 @@ function createExtractor() {
1285
1034
  if (cur2.type !== "style")
1286
1035
  return acc.push(cur2), acc;
1287
1036
  var key12 = Object.keys(cur2.value)[0], value12 = cur2.value[key12], fullKey = tamaguiConfig == null ? void 0 : tamaguiConfig.shorthands[key12];
1288
- return fullKey && (cur2.value = _define_property({}, fullKey, value12), key12 = fullKey), disableExtractVariables && value12[0] === "$" && (usedThemeKeys.has(key12) || usedThemeKeys.has(fullKey)) ? (shouldPrintDebug && logger.info([
1289
- " keeping variable inline: ".concat(key12, " ="),
1037
+ return fullKey && (cur2.value = {
1038
+ [fullKey]: value12
1039
+ }, key12 = fullKey), disableExtractVariables && value12[0] === "$" && (usedThemeKeys.has(key12) || usedThemeKeys.has(fullKey)) ? (shouldPrintDebug && logger.info([
1040
+ ` keeping variable inline: ${key12} =`,
1290
1041
  value12
1291
1042
  ].join(" ")), acc.push({
1292
1043
  type: "attr",
@@ -1310,16 +1061,21 @@ function createExtractor() {
1310
1061
  key9
1311
1062
  ].join(" ")), delete props[key9]);
1312
1063
  try {
1313
- var out = getSplitStyles(props, staticConfig, defaultTheme, "", componentState, _object_spread_props(_object_spread({}, styleProps), {
1064
+ var out = getSplitStyles(props, staticConfig, defaultTheme, "", componentState, {
1065
+ ...styleProps,
1314
1066
  noClassNames: !0,
1315
1067
  fallbackProps: completeProps
1316
- }), void 0, void 0, void 0, debugPropValue || shouldPrintDebug, options.experimentalFlattenThemesOnNative), outProps2 = _object_spread({}, includeProps ? out.viewProps : {}, out.style, out.pseudos);
1068
+ }, void 0, void 0, void 0, debugPropValue || shouldPrintDebug, options.experimentalFlattenThemesOnNative), outProps2 = {
1069
+ ...includeProps ? out.viewProps : {},
1070
+ ...out.style,
1071
+ ...out.pseudos
1072
+ };
1317
1073
  for (var key12 in outProps2)
1318
1074
  deoptProps.has(key12) && (shouldFlatten = !1);
1319
- return shouldPrintDebug && (logger.info("(".concat(debugName, ")")), logger.info(`
1320
- getProps (props in): `.concat((0, import_logLines.logLines)((0, import_extractHelpers.objToStr)(props)))), logger.info(`
1321
- getProps (outProps): `.concat((0, import_logLines.logLines)((0, import_extractHelpers.objToStr)(outProps2))))), out.fontFamily && ((0, import_propsToFontFamilyCache.setPropsToFontFamily)(outProps2, out.fontFamily), shouldPrintDebug && logger.info(`
1322
- \u{1F4AC} new font fam: `.concat(out.fontFamily))), outProps2;
1075
+ return shouldPrintDebug && (logger.info(`(${debugName})`), logger.info(`
1076
+ getProps (props in): ${(0, import_logLines.logLines)((0, import_extractHelpers.objToStr)(props))}`), logger.info(`
1077
+ getProps (outProps): ${(0, import_logLines.logLines)((0, import_extractHelpers.objToStr)(outProps2))}`)), out.fontFamily && ((0, import_propsToFontFamilyCache.setPropsToFontFamily)(outProps2, out.fontFamily), shouldPrintDebug && logger.info(`
1078
+ \u{1F4AC} new font fam: ${out.fontFamily}`)), outProps2;
1323
1079
  } catch (err) {
1324
1080
  return logger.info([
1325
1081
  "error",
@@ -1347,7 +1103,7 @@ function createExtractor() {
1347
1103
  value: t.jsxAttribute(t.jsxIdentifier(key9), t.jsxExpressionContainer(typeof value2 == "string" ? t.stringLiteral(value2) : (0, import_literalToAst.literalToAst)(value2)))
1348
1104
  }), acc.push(cur2), acc;
1349
1105
  if ((prev == null ? void 0 : prev.type) === "style")
1350
- return mergeStyles(prev.value, cur2.value), acc;
1106
+ return mergeStyles2(prev.value, cur2.value), acc;
1351
1107
  }
1352
1108
  return cur2.type === "style" && (prev = cur2), acc.push(cur2), acc;
1353
1109
  }, []), shouldPrintDebug && logger.info([
@@ -1355,12 +1111,12 @@ function createExtractor() {
1355
1111
  `,
1356
1112
  (0, import_logLines.logLines)(attrs.map(import_extractHelpers.attrStr).join(", "))
1357
1113
  ].join(" "));
1358
- var getStyleError = null, _iteratorNormalCompletion12 = !0, _didIteratorError12 = !1, _iteratorError12 = void 0;
1114
+ var getStyleError = null, _iteratorNormalCompletion2 = !0, _didIteratorError2 = !1, _iteratorError2 = void 0;
1359
1115
  try {
1360
- for (var _iterator12 = attrs[Symbol.iterator](), _step12; !(_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done); _iteratorNormalCompletion12 = !0) {
1361
- var attr = _step12.value;
1116
+ for (var _iterator2 = attrs[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0) {
1117
+ var attr = _step2.value;
1362
1118
  try {
1363
- switch (shouldPrintDebug && console.info(" Processing ".concat(attr.type, ":")), attr.type) {
1119
+ switch (shouldPrintDebug && console.info(` Processing ${attr.type}:`), attr.type) {
1364
1120
  case "ternary": {
1365
1121
  var a = getProps(attr.value.alternate, !1, "ternary.alternate"), c = getProps(attr.value.consequent, !1, "ternary.consequent");
1366
1122
  a && (attr.value.alternate = a), c && (attr.value.consequent = c), shouldPrintDebug && logger.info([
@@ -1387,7 +1143,9 @@ function createExtractor() {
1387
1143
  continue;
1388
1144
  var value1 = attemptEvalSafe(attr.value.value || t.booleanLiteral(!0));
1389
1145
  if (value1 !== import_constants.FAILED_EVAL) {
1390
- var outProps = getProps(_define_property({}, key6, value1), !0, "attr.".concat(key6)), outKey = Object.keys(outProps)[0];
1146
+ var outProps = getProps({
1147
+ [key6]: value1
1148
+ }, !0, `attr.${key6}`), outKey = Object.keys(outProps)[0];
1391
1149
  if (outKey) {
1392
1150
  var outVal = outProps[outKey];
1393
1151
  attr.value = t.jsxAttribute(t.jsxIdentifier(outKey), t.jsxExpressionContainer(typeof outVal == "string" ? t.stringLiteral(outVal) : (0, import_literalToAst.literalToAst)(outVal)));
@@ -1400,13 +1158,13 @@ function createExtractor() {
1400
1158
  }
1401
1159
  }
1402
1160
  } catch (err) {
1403
- _didIteratorError12 = !0, _iteratorError12 = err;
1161
+ _didIteratorError2 = !0, _iteratorError2 = err;
1404
1162
  } finally {
1405
1163
  try {
1406
- !_iteratorNormalCompletion12 && _iterator12.return != null && _iterator12.return();
1164
+ !_iteratorNormalCompletion2 && _iterator2.return != null && _iterator2.return();
1407
1165
  } finally {
1408
- if (_didIteratorError12)
1409
- throw _iteratorError12;
1166
+ if (_didIteratorError2)
1167
+ throw _iteratorError2;
1410
1168
  }
1411
1169
  }
1412
1170
  if (shouldPrintDebug && logger.info([
@@ -1427,15 +1185,15 @@ function createExtractor() {
1427
1185
  if (attr1.type === "style")
1428
1186
  for (var key7 in attr1.value)
1429
1187
  existingStyleKeys.has(key7) ? (shouldPrintDebug && logger.info([
1430
- " >> delete existing ".concat(key7)
1188
+ ` >> delete existing ${key7}`
1431
1189
  ].join(" ")), delete attr1.value[key7]) : existingStyleKeys.add(key7);
1432
1190
  attr1.type === "dynamic-style" && (existingStyleKeys.has(attr1.name) ? attrs[i] = void 0 : existingStyleKeys.add(attr1.name));
1433
1191
  }
1434
1192
  if (options.experimentalFlattenThemesOnNative && (attrs = attrs.filter(Boolean)), !shouldFlatten && inlineWhenUnflattened.size) {
1435
- var _iteratorNormalCompletion22 = !0, _didIteratorError22 = !1, _iteratorError22 = void 0;
1193
+ var _iteratorNormalCompletion12 = !0, _didIteratorError12 = !1, _iteratorError12 = void 0;
1436
1194
  try {
1437
- for (var _iterator22 = attrs.entries()[Symbol.iterator](), _step22; !(_iteratorNormalCompletion22 = (_step22 = _iterator22.next()).done); _iteratorNormalCompletion22 = !0) {
1438
- var _step_value1 = _sliced_to_array(_step22.value, 2), index = _step_value1[0], attr2 = _step_value1[1];
1195
+ for (var _iterator12 = attrs.entries()[Symbol.iterator](), _step12; !(_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done); _iteratorNormalCompletion12 = !0) {
1196
+ var [index, attr2] = _step12.value;
1439
1197
  if (attr2.type === "style") {
1440
1198
  for (var key8 in attr2.value)
1441
1199
  if (inlineWhenUnflattened.has(key8)) {
@@ -1445,13 +1203,13 @@ function createExtractor() {
1445
1203
  }
1446
1204
  }
1447
1205
  } catch (err) {
1448
- _didIteratorError22 = !0, _iteratorError22 = err;
1206
+ _didIteratorError12 = !0, _iteratorError12 = err;
1449
1207
  } finally {
1450
1208
  try {
1451
- !_iteratorNormalCompletion22 && _iterator22.return != null && _iterator22.return();
1209
+ !_iteratorNormalCompletion12 && _iterator12.return != null && _iterator12.return();
1452
1210
  } finally {
1453
- if (_didIteratorError22)
1454
- throw _iteratorError22;
1211
+ if (_didIteratorError12)
1212
+ throw _iteratorError12;
1455
1213
  }
1456
1214
  }
1457
1215
  }
@@ -1464,7 +1222,7 @@ function createExtractor() {
1464
1222
  ].join(" ")), node.name.name = flatNode, res.flattened++, closingElement && (closingElement.name.name = flatNode));
1465
1223
  var isNativeNotFlat = !shouldFlatten && platform2 === "native";
1466
1224
  if (isNativeNotFlat)
1467
- return shouldPrintDebug && logger.info("Disabled flattening except for simple cases on native for now: ".concat(JSON.stringify({
1225
+ return shouldPrintDebug && logger.info(`Disabled flattening except for simple cases on native for now: ${JSON.stringify({
1468
1226
  flatNode,
1469
1227
  shouldDeopt,
1470
1228
  canFlattenProps,
@@ -1473,14 +1231,14 @@ function createExtractor() {
1473
1231
  "!staticConfig.isHOC": !staticConfig.isHOC,
1474
1232
  "staticConfig.isReactNative": staticConfig.isReactNative,
1475
1233
  "staticConfig.neverFlatten": staticConfig.neverFlatten
1476
- }, null, 2))), node.attributes = ogAttributes, null;
1234
+ }, null, 2)}`), node.attributes = ogAttributes, null;
1477
1235
  shouldPrintDebug && (logger.info([
1478
- " - inlined props (".concat(inlined.size, "):"),
1236
+ ` - inlined props (${inlined.size}):`,
1479
1237
  shouldDeopt ? " deopted" : "",
1480
1238
  hasSpread ? " has spread" : "",
1481
1239
  staticConfig.neverFlatten ? "neverFlatten" : ""
1482
- ].join(" ")), logger.info(" - shouldFlatten/isFlattened: ".concat(shouldFlatten)), logger.info(` - attrs (end):
1483
- `.concat((0, import_logLines.logLines)(attrs.map(import_extractHelpers.attrStr).join(", "))))), onExtractTag({
1240
+ ].join(" ")), logger.info(` - shouldFlatten/isFlattened: ${shouldFlatten}`), logger.info(` - attrs (end):
1241
+ ${(0, import_logLines.logLines)(attrs.map(import_extractHelpers.attrStr).join(", "))}`)), onExtractTag({
1484
1242
  parserProps: propsWithFileInfo,
1485
1243
  attrs,
1486
1244
  node,
@@ -1496,14 +1254,14 @@ function createExtractor() {
1496
1254
  staticConfig
1497
1255
  });
1498
1256
  } catch (err) {
1499
- node.attributes = ogAttributes, console.error("@tamagui/static error, reverting optimization. In ".concat(filePath, " ").concat(lineNumbers, " on ").concat(originalNodeName, ": ").concat(err.message, ". For stack trace set environment TAMAGUI_DEBUG=1")), process.env.TAMAGUI_DEBUG === "1" && console.error(err.stack);
1257
+ node.attributes = ogAttributes, console.error(`@tamagui/static error, reverting optimization. In ${filePath} ${lineNumbers} on ${originalNodeName}: ${err.message}. For stack trace set environment TAMAGUI_DEBUG=1`), process.env.TAMAGUI_DEBUG === "1" && console.error(err.stack);
1500
1258
  } finally {
1501
1259
  debugPropValue && (shouldPrintDebug = ogDebug);
1502
1260
  }
1503
1261
  }
1504
1262
  }), tm.mark("jsx-done", !!shouldPrintDebug), modifiedComponents.size) {
1505
1263
  var all = Array.from(modifiedComponents);
1506
- shouldPrintDebug && logger.info(" [\u{1FA9D}] hook check ".concat(all.length));
1264
+ shouldPrintDebug && logger.info(` [\u{1FA9D}] hook check ${all.length}`);
1507
1265
  var _iteratorNormalCompletion1 = !0, _didIteratorError1 = !1, _iteratorError1 = void 0;
1508
1266
  try {
1509
1267
  for (var _iterator1 = all[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = !0) {