@tamagui/static 1.89.25 → 1.89.27-1708112217600

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