@tamagui/static 1.0.1-beta.193 → 1.0.1-beta.194

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/extractor/babelParse.js.map +2 -2
  2. package/dist/extractor/bundle.js +117 -0
  3. package/dist/extractor/bundle.js.map +7 -0
  4. package/dist/extractor/createExtractor.js +147 -79
  5. package/dist/extractor/createExtractor.js.map +3 -3
  6. package/dist/extractor/extractHelpers.js +41 -6
  7. package/dist/extractor/extractHelpers.js.map +2 -2
  8. package/dist/extractor/extractToClassNames.js +2 -1
  9. package/dist/extractor/extractToClassNames.js.map +2 -2
  10. package/dist/extractor/getPropValueFromAttributes.js.map +2 -2
  11. package/dist/extractor/loadTamagui.js +219 -117
  12. package/dist/extractor/loadTamagui.js.map +3 -3
  13. package/dist/extractor/normalizeTernaries.js.map +2 -2
  14. package/dist/getPragmaOptions.js +1 -1
  15. package/dist/getPragmaOptions.js.map +2 -2
  16. package/dist/index.js +0 -1
  17. package/dist/index.js.map +2 -2
  18. package/dist/require.js +13 -7
  19. package/dist/require.js.map +2 -2
  20. package/dist/tamagui-node/tamagui.config.js +6781 -0
  21. package/dist/tamagui-node/tamaguicore-components.config.js +0 -0
  22. package/dist/tamagui-node/tamaguitestdesignsystem-components.config.js +31 -0
  23. package/dist/types.js.map +1 -1
  24. package/package.json +20 -17
  25. package/src/extractor/babelParse.ts +3 -2
  26. package/src/extractor/bundle.ts +110 -0
  27. package/src/extractor/createExtractor.ts +167 -69
  28. package/src/extractor/extractHelpers.ts +57 -10
  29. package/src/extractor/extractToClassNames.ts +12 -9
  30. package/src/extractor/getPropValueFromAttributes.ts +1 -1
  31. package/src/extractor/loadTamagui.ts +256 -145
  32. package/src/extractor/normalizeTernaries.ts +1 -1
  33. package/src/getPragmaOptions.ts +2 -1
  34. package/src/index.ts +0 -1
  35. package/src/require.ts +16 -8
  36. package/src/types.ts +5 -1
  37. package/types/extractor/babelParse.d.ts +2 -1
  38. package/types/extractor/bundle.d.ts +13 -0
  39. package/types/extractor/extractHelpers.d.ts +13 -3
  40. package/types/extractor/extractToClassNames.d.ts +3 -2
  41. package/types/extractor/findTopmostFunction.d.ts +1 -1
  42. package/types/extractor/loadTamagui.d.ts +9 -2
  43. package/types/index.d.ts +0 -1
  44. package/types/types.d.ts +4 -1
@@ -31,6 +31,7 @@ var import_path = require("path");
31
31
  var import_traverse = __toESM(require("@babel/traverse"));
32
32
  var t = __toESM(require("@babel/types"));
33
33
  var import_core_node = require("@tamagui/core-node");
34
+ var import_rnw = require("@tamagui/rnw");
34
35
  var import_constants = require("../constants.js");
35
36
  var import_createEvaluator = require("./createEvaluator.js");
36
37
  var import_evaluateAstNode = require("./evaluateAstNode.js");
@@ -67,6 +68,7 @@ const validHooks = {
67
68
  };
68
69
  const isAttr = (x) => x.type === "attr";
69
70
  const createTernary = (x) => x;
71
+ let hasLoggedBaseInfo = false;
70
72
  function createExtractor({ logger = console } = { logger: console }) {
71
73
  if (!process.env.TAMAGUI_TARGET) {
72
74
  console.log('\u26A0\uFE0F Please set process.env.TAMAGUI_TARGET to either "web" or "native"');
@@ -113,6 +115,7 @@ function createExtractor({ logger = console } = { logger: console }) {
113
115
  return !!(!!((_a = staticConfig.validStyles) == null ? void 0 : _a[name]) || !!import_core_node.pseudoDescriptors[name] || ((_b = staticConfig.variants) == null ? void 0 : _b[name]) || (projectInfo == null ? void 0 : projectInfo.tamaguiConfig.shorthands[name]) || (name[0] === "$" ? !!import_core_node.mediaQueryConfig[name.slice(1)] : false));
114
116
  }
115
117
  function parseWithConfig({ components, tamaguiConfig }, fileOrPath, options) {
118
+ var _a;
116
119
  const {
117
120
  config = "tamagui.config.ts",
118
121
  importsWhitelist = ["constants.js"],
@@ -127,6 +130,7 @@ function createExtractor({ logger = console } = { logger: console }) {
127
130
  disableExtractVariables,
128
131
  disableDebugAttr,
129
132
  disableExtractFoundComponents,
133
+ includeExtensions = [".tsx", ".jsx"],
130
134
  extractStyledDefinitions = false,
131
135
  prefixLogs,
132
136
  excludeProps,
@@ -134,7 +138,7 @@ function createExtractor({ logger = console } = { logger: console }) {
134
138
  ...restProps
135
139
  } = options;
136
140
  let shouldPrintDebug = options.shouldPrintDebug || false;
137
- if (disable) {
141
+ if (disable === true || Array.isArray(disable) && disable.includes(sourcePath)) {
138
142
  return null;
139
143
  }
140
144
  if (sourcePath === "") {
@@ -143,22 +147,51 @@ function createExtractor({ logger = console } = { logger: console }) {
143
147
  if (!components) {
144
148
  throw new Error(`Must provide components`);
145
149
  }
150
+ if (includeExtensions && !includeExtensions.some((ext) => sourcePath.endsWith(ext))) {
151
+ if (shouldPrintDebug) {
152
+ logger.info(
153
+ `Ignoring file due to includeExtensions: ${sourcePath}, includeExtensions: ${includeExtensions.join(
154
+ ", "
155
+ )}`
156
+ );
157
+ }
158
+ return null;
159
+ }
146
160
  const isTargetingHTML = target === "html";
147
161
  const ogDebug = shouldPrintDebug;
148
162
  const tm = (0, import_timer.timer)();
149
163
  const propsWithFileInfo = {
150
164
  ...options,
151
- sourcePath
165
+ sourcePath,
166
+ allLoadedComponents: [...components]
152
167
  };
153
- if (shouldPrintDebug === "verbose") {
154
- console.log("tamagui.config.ts:", { components, config });
168
+ if (!hasLoggedBaseInfo) {
169
+ hasLoggedBaseInfo = true;
170
+ if (shouldPrintDebug) {
171
+ logger.info(
172
+ [
173
+ "loaded components:",
174
+ propsWithFileInfo.allLoadedComponents.map((comp) => Object.keys(comp.nameToInfo).join(", ")).join(", ")
175
+ ].join(" ")
176
+ );
177
+ }
178
+ if ((_a = process.env.DEBUG) == null ? void 0 : _a.startsWith("tamagui")) {
179
+ const next = [...propsWithFileInfo.allLoadedComponents].map((info) => {
180
+ const nameToInfo = { ...info.nameToInfo };
181
+ for (const key in nameToInfo) {
182
+ delete nameToInfo[key].staticConfig.validStyles;
183
+ }
184
+ return { ...info, nameToInfo };
185
+ });
186
+ logger.info(["loaded:", JSON.stringify(next, null, 2)].join("\n"));
187
+ }
155
188
  }
156
189
  tm.mark("load-tamagui", !!shouldPrintDebug);
157
190
  const firstThemeName = Object.keys(tamaguiConfig.themes)[0];
158
191
  const firstTheme = tamaguiConfig.themes[firstThemeName];
159
192
  if (!firstTheme || typeof firstTheme !== "object") {
160
193
  console.error(`Missing theme, an error occurred when importing your config`);
161
- console.log(`Got themes:`, tamaguiConfig.themes);
194
+ console.log(`Got config:`, tamaguiConfig);
162
195
  console.log(`Looking for theme:`, firstThemeName);
163
196
  process.exit(0);
164
197
  }
@@ -173,35 +206,32 @@ function createExtractor({ logger = console } = { logger: console }) {
173
206
  }
174
207
  });
175
208
  const body = fileOrPath.type === "Program" ? fileOrPath.get("body") : fileOrPath.program.body;
176
- const validComponents = Object.keys(components).filter((key) => {
177
- var _a;
178
- return key[0].toUpperCase() === key[0] && !!((_a = components[key]) == null ? void 0 : _a.staticConfig);
179
- }).reduce((obj, name) => {
180
- obj[name] = components[name];
181
- return obj;
182
- }, {});
183
- if (Object.keys(validComponents).length === 0) {
209
+ if (Object.keys(components).length === 0) {
184
210
  console.warn(`Warning: Tamagui didn't find any valid components (DEBUG=tamagui for more)`);
185
211
  if (process.env.DEBUG === "tamagui") {
186
212
  console.log(`components`, Object.keys(components), components);
187
213
  }
188
214
  }
189
215
  if (shouldPrintDebug === "verbose") {
190
- logger.info(`validComponents ${Object.keys(validComponents).join(", ")}`);
216
+ logger.info(
217
+ `allLoadedComponent modules ${propsWithFileInfo.allLoadedComponents.map((k) => k.moduleName).join(", ")}`
218
+ );
191
219
  }
192
220
  let doesUseValidImport = false;
193
221
  let hasImportedTheme = false;
222
+ const importDeclarations = [];
194
223
  for (const bodyPath of body) {
195
224
  if (bodyPath.type !== "ImportDeclaration")
196
225
  continue;
197
226
  const node = "node" in bodyPath ? bodyPath.node : bodyPath;
198
- const from = node.source.value;
199
- const valid = (0, import_extractHelpers.isValidImport)(propsWithFileInfo, from);
227
+ const moduleName = node.source.value;
228
+ const valid = (0, import_extractHelpers.isValidImport)(propsWithFileInfo, moduleName);
229
+ if (valid) {
230
+ importDeclarations.push(node);
231
+ }
200
232
  if (extractStyledDefinitions) {
201
233
  if (valid) {
202
- if (node.specifiers.some((specifier) => {
203
- return specifier.local.name === "styled";
204
- })) {
234
+ if (node.specifiers.some((specifier) => specifier.local.name === "styled")) {
205
235
  doesUseValidImport = true;
206
236
  break;
207
237
  }
@@ -209,10 +239,12 @@ function createExtractor({ logger = console } = { logger: console }) {
209
239
  }
210
240
  if (valid) {
211
241
  const names = node.specifiers.map((specifier) => specifier.local.name);
212
- const isValidComponent = names.some((name) => !!(validComponents[name] || validHooks[name]));
242
+ const isValidComponent = names.some(
243
+ (name) => Boolean((0, import_extractHelpers.isValidImport)(propsWithFileInfo, moduleName, name) || validHooks[name])
244
+ );
213
245
  if (shouldPrintDebug === "verbose") {
214
246
  logger.info(
215
- `import ${names.join(", ")} from ${from} isValidComponent ${isValidComponent}`
247
+ `import ${names.join(", ")} from ${moduleName} isValidComponent ${isValidComponent}`
216
248
  );
217
249
  }
218
250
  if (isValidComponent) {
@@ -222,11 +254,20 @@ function createExtractor({ logger = console } = { logger: console }) {
222
254
  }
223
255
  }
224
256
  if (shouldPrintDebug) {
225
- logger.info(`source: ${sourcePath} doesUseValidImport ${doesUseValidImport}`);
257
+ logger.info(`file: ${sourcePath} ${JSON.stringify({ doesUseValidImport, hasImportedTheme })}`);
226
258
  }
227
259
  if (!doesUseValidImport) {
228
260
  return null;
229
261
  }
262
+ function getValidImportedComponent(componentName) {
263
+ const importDeclaration = importDeclarations.find(
264
+ (dec) => dec.specifiers.some((spec) => spec.local.name === componentName)
265
+ );
266
+ if (!importDeclaration) {
267
+ return null;
268
+ }
269
+ return (0, import_extractHelpers.getValidImport)(propsWithFileInfo, importDeclaration.source.value, componentName);
270
+ }
230
271
  tm.mark("import-check", !!shouldPrintDebug);
231
272
  let couldntParse = false;
232
273
  const modifiedComponents = /* @__PURE__ */ new Set();
@@ -234,6 +275,7 @@ function createExtractor({ logger = console } = { logger: console }) {
234
275
  const callTraverse = (a) => {
235
276
  return fileOrPath.type === "File" ? (0, import_traverse.default)(fileOrPath, a) : fileOrPath.traverse(a);
236
277
  };
278
+ const shouldDisableExtraction = disableExtraction === true || Array.isArray(disableExtraction) && disableExtraction.includes(sourcePath);
237
279
  let programPath = null;
238
280
  const res = {
239
281
  styled: 0,
@@ -244,40 +286,53 @@ function createExtractor({ logger = console } = { logger: console }) {
244
286
  };
245
287
  callTraverse({
246
288
  Program: {
247
- enter(path2) {
248
- programPath = path2;
289
+ enter(path) {
290
+ programPath = path;
249
291
  }
250
292
  },
251
- CallExpression(path2) {
252
- var _a, _b;
253
- if (disable || disableExtraction || extractStyledDefinitions === false) {
293
+ CallExpression(path) {
294
+ var _a2;
295
+ if (disable || shouldDisableExtraction || extractStyledDefinitions === false) {
254
296
  return;
255
297
  }
256
- if (!t.isIdentifier(path2.node.callee) || path2.node.callee.name !== "styled") {
298
+ if (!t.isIdentifier(path.node.callee) || path.node.callee.name !== "styled") {
257
299
  return;
258
300
  }
259
- const name = t.isVariableDeclarator(path2.parent) && t.isIdentifier(path2.parent.id) ? path2.parent.id.name : "unknown";
260
- const definition = path2.node.arguments[1];
301
+ const name = t.isVariableDeclarator(path.parent) && t.isIdentifier(path.parent.id) ? path.parent.id.name : "unknown";
302
+ const definition = path.node.arguments[1];
261
303
  if (!name || !definition || !t.isObjectExpression(definition)) {
262
304
  return;
263
305
  }
264
- let Component = validComponents[name];
306
+ let Component = getValidImportedComponent(name);
265
307
  if (!Component) {
266
- if (disableExtractFoundComponents) {
308
+ if (disableExtractFoundComponents === true) {
309
+ return;
310
+ }
311
+ if (Array.isArray(disableExtractFoundComponents) && disableExtractFoundComponents.includes(name)) {
267
312
  return;
268
313
  }
269
314
  try {
315
+ if (shouldPrintDebug) {
316
+ logger.info(`Unknown component ${name}, attempting dynamic load: ${sourcePath}`);
317
+ }
270
318
  const out2 = (0, import_loadTamagui.loadTamaguiSync)({
271
319
  forceExports: true,
272
320
  bubbleErrors: true,
273
321
  components: [sourcePath]
274
322
  });
275
- if ((_a = out2.components) == null ? void 0 : _a[name]) {
276
- Object.assign(validComponents, out2.components);
323
+ if (!(out2 == null ? void 0 : out2.components)) {
324
+ if (shouldPrintDebug) {
325
+ logger.info(`Couldn't load, got ${out2}`);
326
+ }
327
+ return;
277
328
  }
278
- Component = validComponents[name];
329
+ propsWithFileInfo.allLoadedComponents = [
330
+ ...propsWithFileInfo.allLoadedComponents,
331
+ ...out2.components
332
+ ];
333
+ Component = out2.components.flatMap((x) => x.nameToInfo[name] ?? [])[0];
279
334
  if (shouldPrintDebug) {
280
- logger.info([`Loaded`, Object.keys(out2.components).join(", "), !!Component].join(" "));
335
+ logger.info([`Tamagui Loaded`, JSON.stringify(out2.components), !!Component].join(" "));
281
336
  }
282
337
  } catch (err) {
283
338
  if (shouldPrintDebug) {
@@ -311,21 +366,21 @@ function createExtractor({ logger = console } = { logger: console }) {
311
366
  const skipped = [];
312
367
  const styles = {};
313
368
  const staticNamespace = (0, import_getStaticBindingsForScope.getStaticBindingsForScope)(
314
- path2.scope,
369
+ path.scope,
315
370
  importsWhitelist,
316
371
  sourcePath,
317
372
  bindingCache,
318
373
  shouldPrintDebug
319
374
  );
320
375
  const attemptEval = !evaluateVars ? import_evaluateAstNode.evaluateAstNode : (0, import_createEvaluator.createEvaluator)({
321
- props: options,
376
+ props: propsWithFileInfo,
322
377
  staticNamespace,
323
378
  sourcePath,
324
379
  shouldPrintDebug
325
380
  });
326
381
  const attemptEvalSafe = (0, import_createEvaluator.createSafeEvaluator)(attemptEval);
327
382
  for (const property of definition.properties) {
328
- if (!t.isObjectProperty(property) || !t.isIdentifier(property.key) || !isValidStyleKey(property.key.name, Component.staticConfig) || ((_b = Component.staticConfig.variants) == null ? void 0 : _b[property.key.name]) || componentSkipProps.has(property.key.name)) {
383
+ if (!t.isObjectProperty(property) || !t.isIdentifier(property.key) || !isValidStyleKey(property.key.name, Component.staticConfig) || ((_a2 = Component.staticConfig.variants) == null ? void 0 : _a2[property.key.name]) || componentSkipProps.has(property.key.name)) {
329
384
  skipped.push(property);
330
385
  continue;
331
386
  }
@@ -376,7 +431,10 @@ function createExtractor({ logger = console } = { logger: console }) {
376
431
  }
377
432
  },
378
433
  JSXElement(traversePath) {
379
- var _a, _b, _c;
434
+ var _a2, _b, _c;
435
+ if (shouldDisableExtraction) {
436
+ return;
437
+ }
380
438
  tm.mark("jsx-element", !!shouldPrintDebug);
381
439
  const node = traversePath.node.openingElement;
382
440
  const ogAttributes = node.attributes;
@@ -386,6 +444,7 @@ function createExtractor({ logger = console } = { logger: console }) {
386
444
  return;
387
445
  }
388
446
  const binding = traversePath.scope.getBinding(node.name.name);
447
+ let modulePath = "";
389
448
  if (binding) {
390
449
  if (!t.isImportDeclaration(binding.path.parent)) {
391
450
  if (shouldPrintDebug) {
@@ -393,23 +452,15 @@ function createExtractor({ logger = console } = { logger: console }) {
393
452
  }
394
453
  return;
395
454
  }
396
- const source = binding.path.parent.source;
397
- if (!(0, import_extractHelpers.isValidImport)(propsWithFileInfo, source.value)) {
455
+ modulePath = binding.path.parent.source.value;
456
+ if (!(0, import_extractHelpers.isValidImport)(propsWithFileInfo, modulePath, binding.identifier.name)) {
398
457
  if (shouldPrintDebug) {
399
- logger.info(` - Binding not internal import or from components ${source.value}`);
400
- }
401
- return;
402
- }
403
- if (!validComponents[binding.identifier.name]) {
404
- if (shouldPrintDebug) {
405
- logger.info(
406
- ` - Binding not valid component (binding.identifier.name) ${binding.identifier.name}`
407
- );
458
+ logger.info(` - Binding not internal import or from components ${modulePath}`);
408
459
  }
409
460
  return;
410
461
  }
411
462
  }
412
- const component = validComponents[node.name.name];
463
+ const component = (0, import_extractHelpers.getValidComponent)(propsWithFileInfo, modulePath, node.name.name);
413
464
  if (!component || !component.staticConfig) {
414
465
  if (shouldPrintDebug) {
415
466
  logger.info(` - No Tamagui conf on this: ${node.name.name}`);
@@ -461,8 +512,8 @@ function createExtractor({ logger = console } = { logger: console }) {
461
512
  return;
462
513
  }
463
514
  try {
464
- let evaluateAttribute2 = function(path2) {
465
- const attribute = path2.node;
515
+ let evaluateAttribute2 = function(path) {
516
+ const attribute = path.node;
466
517
  const attr = { type: "attr", value: attribute };
467
518
  if (t.isJSXSpreadAttribute(attribute)) {
468
519
  const arg = attribute.argument;
@@ -551,9 +602,9 @@ function createExtractor({ logger = console } = { logger: console }) {
551
602
  }
552
603
  const [value, valuePath] = (() => {
553
604
  if (t.isJSXExpressionContainer(attribute == null ? void 0 : attribute.value)) {
554
- return [attribute.value.expression, path2.get("value")];
605
+ return [attribute.value.expression, path.get("value")];
555
606
  } else {
556
- return [attribute.value, path2.get("value")];
607
+ return [attribute.value, path.get("value")];
557
608
  }
558
609
  })();
559
610
  const remove = () => {
@@ -569,7 +620,7 @@ function createExtractor({ logger = console } = { logger: console }) {
569
620
  if (name === "tag") {
570
621
  return {
571
622
  type: "attr",
572
- value: path2.node
623
+ value: path.node
573
624
  };
574
625
  }
575
626
  if (disableExtractVariables === true) {
@@ -615,7 +666,7 @@ function createExtractor({ logger = console } = { logger: console }) {
615
666
  }
616
667
  if (out) {
617
668
  if (isTargetingHTML) {
618
- out = (0, import_core_node.createDOMProps)(isTextView ? "span" : "div", out);
669
+ out = (0, import_rnw.createDOMProps)(isTextView ? "span" : "div", out);
619
670
  delete out.className;
620
671
  }
621
672
  keys = Object.keys(out);
@@ -628,7 +679,7 @@ function createExtractor({ logger = console } = { logger: console }) {
628
679
  type: "style",
629
680
  value: { [key]: styleValue },
630
681
  name: key,
631
- attr: path2.node
682
+ attr: path.node
632
683
  };
633
684
  }
634
685
  if (import_validHTMLAttributes.validHTMLAttributes[key] || key.startsWith("aria-") || key.startsWith("data-") || key === "__source" || key === "__self") {
@@ -667,7 +718,7 @@ function createExtractor({ logger = console } = { logger: console }) {
667
718
  type: "style",
668
719
  value: { [name]: styleValue },
669
720
  name,
670
- attr: path2.node
721
+ attr: path.node
671
722
  };
672
723
  } else {
673
724
  if (variants[name]) {
@@ -880,11 +931,11 @@ function createExtractor({ logger = console } = { logger: console }) {
880
931
  });
881
932
  });
882
933
  }, splitVariants2 = function(style) {
883
- var _a2;
934
+ var _a3;
884
935
  const variants2 = {};
885
936
  const styles = {};
886
937
  for (const key in style) {
887
- if ((_a2 = staticConfig.variants) == null ? void 0 : _a2[key]) {
938
+ if ((_a3 = staticConfig.variants) == null ? void 0 : _a3[key]) {
888
939
  variants2[key] = style[key];
889
940
  } else {
890
941
  styles[key] = style[key];
@@ -922,8 +973,8 @@ function createExtractor({ logger = console } = { logger: console }) {
922
973
  const isTextView = staticConfig.isText || false;
923
974
  const validStyles = (staticConfig == null ? void 0 : staticConfig.validStyles) ?? {};
924
975
  let tagName = staticConfig.defaultProps.tag ?? (isTextView ? "span" : "div");
925
- traversePath.get("openingElement").get("attributes").forEach((path2) => {
926
- const attr = path2.node;
976
+ traversePath.get("openingElement").get("attributes").forEach((path) => {
977
+ const attr = path.node;
927
978
  if (t.isJSXSpreadAttribute(attr))
928
979
  return;
929
980
  if (attr.name.name !== "tag")
@@ -952,7 +1003,7 @@ function createExtractor({ logger = console } = { logger: console }) {
952
1003
  shouldPrintDebug
953
1004
  );
954
1005
  const attemptEval = !evaluateVars ? import_evaluateAstNode.evaluateAstNode : (0, import_createEvaluator.createEvaluator)({
955
- props: options,
1006
+ props: propsWithFileInfo,
956
1007
  staticNamespace,
957
1008
  sourcePath,
958
1009
  traversePath,
@@ -963,8 +1014,8 @@ function createExtractor({ logger = console } = { logger: console }) {
963
1014
  logger.info(` staticNamespace ${Object.keys(staticNamespace).join(", ")}`);
964
1015
  }
965
1016
  const flattenedAttrs = [];
966
- traversePath.get("openingElement").get("attributes").forEach((path2) => {
967
- const attr = path2.node;
1017
+ traversePath.get("openingElement").get("attributes").forEach((path) => {
1018
+ const attr = path.node;
968
1019
  if (!t.isJSXSpreadAttribute(attr)) {
969
1020
  flattenedAttrs.push(attr);
970
1021
  return;
@@ -1018,13 +1069,13 @@ function createExtractor({ logger = console } = { logger: console }) {
1018
1069
  const variantValues = /* @__PURE__ */ new Map();
1019
1070
  let hasSetOptimized = false;
1020
1071
  const inlineWhenUnflattenedOGVals = {};
1021
- attrs = traversePath.get("openingElement").get("attributes").flatMap((path2) => {
1022
- var _a2;
1072
+ attrs = traversePath.get("openingElement").get("attributes").flatMap((path) => {
1073
+ var _a3;
1023
1074
  try {
1024
- const res2 = evaluateAttribute2(path2);
1075
+ const res2 = evaluateAttribute2(path);
1025
1076
  tm.mark("jsx-element-evaluate-attr", !!shouldPrintDebug);
1026
1077
  if (!res2) {
1027
- path2.remove();
1078
+ path.remove();
1028
1079
  }
1029
1080
  return res2;
1030
1081
  } catch (err) {
@@ -1037,13 +1088,13 @@ function createExtractor({ logger = console } = { logger: console }) {
1037
1088
  ].join(" ")
1038
1089
  );
1039
1090
  if (shouldPrintDebug === "verbose") {
1040
- logger.info(`node ${(_a2 = path2.node) == null ? void 0 : _a2.type}`);
1091
+ logger.info(`node ${(_a3 = path.node) == null ? void 0 : _a3.type}`);
1041
1092
  }
1042
1093
  }
1043
1094
  inlined.set(`${Math.random()}`, "spread");
1044
1095
  return {
1045
1096
  type: "attr",
1046
- value: path2.node
1097
+ value: path.node
1047
1098
  };
1048
1099
  }
1049
1100
  }).flat(4).filter(import_extractHelpers.isPresent);
@@ -1103,22 +1154,26 @@ function createExtractor({ logger = console } = { logger: console }) {
1103
1154
  const hasSpread = node.attributes.some((x) => t.isJSXSpreadAttribute(x));
1104
1155
  const hasOnlyStringChildren = !hasSpread && (node.selfClosing || traversePath.node.children && traversePath.node.children.every((x) => x.type === "JSXText"));
1105
1156
  const themeVal = inlined.get("theme");
1106
- inlined.delete("theme");
1157
+ if (target !== "native") {
1158
+ inlined.delete("theme");
1159
+ }
1107
1160
  for (const [key] of [...inlined]) {
1108
- const isStaticObjectVariant = ((_a = staticConfig.variants) == null ? void 0 : _a[key]) && variantValues.has(key);
1161
+ const isStaticObjectVariant = ((_a2 = staticConfig.variants) == null ? void 0 : _a2[key]) && variantValues.has(key);
1109
1162
  if (INLINE_EXTRACTABLE[key] || isStaticObjectVariant) {
1110
1163
  inlined.delete(key);
1111
1164
  }
1112
1165
  }
1113
1166
  const canFlattenProps = inlined.size === 0;
1114
- let shouldFlatten = flatNode && !shouldDeopt && canFlattenProps && !hasSpread && staticConfig.neverFlatten !== true && (staticConfig.neverFlatten === "jsx" ? hasOnlyStringChildren : true);
1167
+ let shouldFlatten = Boolean(
1168
+ flatNode && !shouldDeopt && canFlattenProps && !hasSpread && staticConfig.neverFlatten !== true && (staticConfig.neverFlatten === "jsx" ? hasOnlyStringChildren : true)
1169
+ );
1115
1170
  const shouldWrapTheme = shouldFlatten && themeVal;
1116
1171
  const usedThemeKeys = /* @__PURE__ */ new Set();
1117
1172
  if (disableExtractVariables) {
1118
1173
  themeAccessListeners.add((key) => {
1119
1174
  shouldFlatten = false;
1120
1175
  usedThemeKeys.add(key);
1121
- if (shouldPrintDebug) {
1176
+ if (shouldPrintDebug === "verbose") {
1122
1177
  logger.info([" ! accessing theme key, avoid flatten", key].join(" "));
1123
1178
  }
1124
1179
  });
@@ -1185,6 +1240,9 @@ function createExtractor({ logger = console } = { logger: console }) {
1185
1240
  }
1186
1241
  }
1187
1242
  if (shouldDeopt) {
1243
+ if (shouldPrintDebug) {
1244
+ logger.info(`Deopting`);
1245
+ }
1188
1246
  node.attributes = ogAttributes;
1189
1247
  return;
1190
1248
  }
@@ -1284,7 +1342,7 @@ function createExtractor({ logger = console } = { logger: console }) {
1284
1342
  );
1285
1343
  if (out && isTargetingHTML) {
1286
1344
  const cn = out.className;
1287
- out = (0, import_core_node.createDOMProps)(isTextView ? "span" : "div", out);
1345
+ out = (0, import_rnw.createDOMProps)(isTextView ? "span" : "div", out);
1288
1346
  out.className = cn;
1289
1347
  }
1290
1348
  if (shouldPrintDebug) {
@@ -1424,6 +1482,7 @@ function createExtractor({ logger = console } = { logger: console }) {
1424
1482
  },
1425
1483
  void 0,
1426
1484
  void 0,
1485
+ void 0,
1427
1486
  debugPropValue
1428
1487
  );
1429
1488
  const outStyle = {
@@ -1440,6 +1499,14 @@ function createExtractor({ logger = console } = { logger: console }) {
1440
1499
  if (!completeStyles) {
1441
1500
  throw new Error(`Impossible, no styles`);
1442
1501
  }
1502
+ const isNativeNotFlat = !shouldFlatten && target === "native";
1503
+ if (isNativeNotFlat) {
1504
+ if (shouldPrintDebug) {
1505
+ logger.info(`Disabled flattening except for simple cases on native for now`);
1506
+ node.attributes = ogAttributes;
1507
+ return null;
1508
+ }
1509
+ }
1443
1510
  let getStyleError = null;
1444
1511
  for (const attr of attrs) {
1445
1512
  try {
@@ -1478,7 +1545,7 @@ function createExtractor({ logger = console } = { logger: console }) {
1478
1545
  if (getStyleError) {
1479
1546
  logger.info([" \u26A0\uFE0F postprocessing error, deopt", getStyleError].join(" "));
1480
1547
  node.attributes = ogAttributes;
1481
- return node;
1548
+ return null;
1482
1549
  }
1483
1550
  const existingStyleKeys = /* @__PURE__ */ new Set();
1484
1551
  for (let i = attrs.length - 1; i >= 0; i--) {
@@ -1543,6 +1610,7 @@ function createExtractor({ logger = console } = { logger: console }) {
1543
1610
  ${(0, import_logLines.logLines)(attrs.map(import_extractHelpers.attrStr).join(", "))}`);
1544
1611
  }
1545
1612
  onExtractTag({
1613
+ parserProps: propsWithFileInfo,
1546
1614
  attrs,
1547
1615
  node,
1548
1616
  lineNumbers,