@tamagui/static 1.0.1-rc.1.2 → 1.0.1-rc.1.4

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.
@@ -37,7 +37,6 @@ var import_createEvaluator = require("./createEvaluator.js");
37
37
  var import_evaluateAstNode = require("./evaluateAstNode.js");
38
38
  var import_extractHelpers = require("./extractHelpers.js");
39
39
  var import_findTopmostFunction = require("./findTopmostFunction.js");
40
- var import_getPrefixLogs = require("./getPrefixLogs.js");
41
40
  var import_getStaticBindingsForScope = require("./getStaticBindingsForScope.js");
42
41
  var import_literalToAst = require("./literalToAst.js");
43
42
  var import_loadTamagui = require("./loadTamagui.js");
@@ -301,58 +300,17 @@ function createExtractor({ logger = console } = { logger: console }) {
301
300
  if (!t.isIdentifier(path.node.callee) || path.node.callee.name !== "styled") {
302
301
  return;
303
302
  }
304
- const name = t.isVariableDeclarator(path.parent) && t.isIdentifier(path.parent.id) ? path.parent.id.name : "unknown";
305
- const definition = path.node.arguments[1];
306
- if (!name || !definition || !t.isObjectExpression(definition)) {
303
+ const variableName = t.isVariableDeclarator(path.parent) && t.isIdentifier(path.parent.id) ? path.parent.id.name : "unknown";
304
+ const parentNode = path.node.arguments[0];
305
+ if (!t.isIdentifier(parentNode)) {
307
306
  return;
308
307
  }
309
- let Component = getValidImportedComponent(name);
310
- if (!Component) {
311
- if (disableExtractFoundComponents === true) {
312
- return;
313
- }
314
- if (Array.isArray(disableExtractFoundComponents) && disableExtractFoundComponents.includes(name)) {
315
- return;
316
- }
317
- try {
318
- if (shouldPrintDebug) {
319
- logger.info(`Unknown component ${name}, attempting dynamic load: ${sourcePath}`);
320
- }
321
- const out2 = (0, import_loadTamagui.loadTamaguiSync)({
322
- forceExports: true,
323
- components: [sourcePath]
324
- });
325
- if (!(out2 == null ? void 0 : out2.components)) {
326
- if (shouldPrintDebug) {
327
- logger.info(`Couldn't load, got ${out2}`);
328
- }
329
- return;
330
- }
331
- propsWithFileInfo.allLoadedComponents = [
332
- ...propsWithFileInfo.allLoadedComponents,
333
- ...out2.components
334
- ];
335
- Component = out2.components.flatMap((x) => x.nameToInfo[name] ?? [])[0];
336
- if (shouldPrintDebug === "verbose") {
337
- logger.info([`Tamagui Loaded`, JSON.stringify(out2.components), !!Component].join(" "));
338
- }
339
- } catch (err) {
340
- if (shouldPrintDebug) {
341
- logger.info(
342
- `${(0, import_getPrefixLogs.getPrefixLogs)(
343
- options
344
- )} skip optimize styled(${name}), unable to pre-process (DEBUG=tamagui for more)`
345
- );
346
- }
347
- if (process.env.DEBUG === "tamagui") {
348
- logger.info(
349
- ` Disable this with "disableExtractFoundComponents" in your build-time configuration.
350
-
351
- ${err.message} ${err.stack}`
352
- );
353
- }
354
- }
308
+ const parentName = parentNode.name;
309
+ const definition = path.node.arguments[1];
310
+ if (!parentName || !definition || !t.isObjectExpression(definition)) {
311
+ return;
355
312
  }
313
+ const Component = getValidImportedComponent(parentName);
356
314
  if (!Component) {
357
315
  return;
358
316
  }
@@ -393,20 +351,29 @@ function createExtractor({ logger = console } = { logger: console }) {
393
351
  styles[property.key.name] = out2;
394
352
  }
395
353
  }
396
- const out = (0, import_core_node.getSplitStyles)(styles, Component.staticConfig, defaultTheme, {
397
- focus: false,
398
- hover: false,
399
- unmounted: true,
400
- press: false,
401
- pressIn: false,
402
- resolveVariablesAs: "variable",
403
- noClassNames: false
404
- });
354
+ const out = (0, import_core_node.getSplitStyles)(
355
+ styles,
356
+ Component.staticConfig,
357
+ defaultTheme,
358
+ {
359
+ focus: false,
360
+ hover: false,
361
+ unmounted: true,
362
+ press: false,
363
+ pressIn: false,
364
+ resolveVariablesAs: "variable",
365
+ noClassNames: false
366
+ },
367
+ void 0,
368
+ void 0,
369
+ void 0,
370
+ shouldPrintDebug
371
+ );
405
372
  const classNames = {
406
373
  ...out.classNames
407
374
  };
408
375
  if (shouldPrintDebug) {
409
- logger.info([`Extracted styled(${name})
376
+ logger.info([`Extracted styled(${variableName})
410
377
  `, JSON.stringify(styles, null, 2), "\n rulesToInsert:", out.rulesToInsert.flatMap((rule) => rule.rules).join("\n")].join(" "));
411
378
  }
412
379
  definition.properties = skipped;
@@ -424,7 +391,7 @@ function createExtractor({ logger = console } = { logger: console }) {
424
391
  }
425
392
  res.styled++;
426
393
  if (shouldPrintDebug) {
427
- logger.info(`Extracted styled(${name})`);
394
+ logger.info(`Extracted styled(${variableName})`);
428
395
  }
429
396
  },
430
397
  JSXElement(traversePath) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/extractor/createExtractor.ts"],
4
- "sourcesContent": ["/* eslint-disable no-console */\nimport { basename, relative } from 'path'\n\nimport traverse, { NodePath, TraverseOptions } from '@babel/traverse'\nimport * as t from '@babel/types'\nimport {\n PseudoStyles,\n StaticConfigParsed,\n expandStyles,\n getSplitStyles,\n getStylesAtomic,\n mediaQueryConfig,\n proxyThemeVariables,\n pseudoDescriptors,\n} from '@tamagui/core-node'\nimport type { ViewStyle } from 'react-native'\nimport { createDOMProps } from 'react-native-web-internals'\n\nimport { FAILED_EVAL } from '../constants.js'\nimport type {\n ExtractedAttr,\n ExtractedAttrAttr,\n ExtractedAttrStyle,\n ExtractorOptions,\n ExtractorParseProps,\n TamaguiOptions,\n TamaguiOptionsWithFileInfo,\n Ternary,\n} from '../types.js'\nimport { createEvaluator, createSafeEvaluator } from './createEvaluator.js'\nimport { evaluateAstNode } from './evaluateAstNode.js'\nimport {\n attrStr,\n findComponentName,\n getValidComponent,\n getValidImport,\n isPresent,\n isValidImport,\n objToStr,\n} from './extractHelpers.js'\nimport { findTopmostFunction } from './findTopmostFunction.js'\nimport { getPrefixLogs } from './getPrefixLogs.js'\nimport { cleanupBeforeExit, getStaticBindingsForScope } from './getStaticBindingsForScope.js'\nimport { literalToAst } from './literalToAst.js'\nimport { TamaguiProjectInfo, loadTamagui, loadTamaguiSync } from './loadTamagui.js'\nimport { logLines } from './logLines.js'\nimport { normalizeTernaries } from './normalizeTernaries.js'\nimport { removeUnusedHooks } from './removeUnusedHooks.js'\nimport { timer } from './timer.js'\nimport { validHTMLAttributes } from './validHTMLAttributes.js'\n\nconst UNTOUCHED_PROPS = {\n key: true,\n style: true,\n className: true,\n}\n\nconst INLINE_EXTRACTABLE = {\n ref: 'ref',\n key: 'key',\n ...(process.env.TAMAGUI_TARGET === 'web' && {\n onPress: 'onClick',\n onHoverIn: 'onMouseEnter',\n onHoverOut: 'onMouseLeave',\n onPressIn: 'onMouseDown',\n onPressOut: 'onMouseUp',\n }),\n}\n\nconst validHooks = {\n useMedia: true,\n useTheme: true,\n}\n\nconst isAttr = (x: ExtractedAttr): x is ExtractedAttrAttr => x.type === 'attr'\nconst createTernary = (x: Ternary) => x\n\nexport type Extractor = ReturnType<typeof createExtractor>\n\ntype FileOrPath = NodePath<t.Program> | t.File\n\nlet hasLoggedBaseInfo = false\n\nexport function createExtractor({ logger = console }: ExtractorOptions = { logger: console }) {\n if (!process.env.TAMAGUI_TARGET) {\n console.log('\u26A0\uFE0F Please set process.env.TAMAGUI_TARGET to either \"web\" or \"native\"')\n process.exit(1)\n }\n\n const shouldAddDebugProp =\n // really basic disable this for next.js because it messes with ssr\n !process.env.npm_package_dependencies_next &&\n process.env.TAMAGUI_TARGET !== 'native' &&\n process.env.IDENTIFY_TAGS !== 'false' &&\n (process.env.NODE_ENV === 'development' || process.env.DEBUG || process.env.IDENTIFY_TAGS)\n\n let projectInfo: TamaguiProjectInfo | null = null\n\n // we load tamagui delayed because we need to set some global/env stuff before importing\n // otherwise we'd import `rnw` and cause it to evaluate react-native-web which causes errors\n\n function loadSync(props: TamaguiOptions) {\n return (projectInfo ||= loadTamaguiSync({\n config: props.config || 'tamagui.config.ts',\n components: props.components || ['tamagui'],\n }))\n }\n\n async function load(props: TamaguiOptions) {\n return (projectInfo ||= await loadTamagui({\n config: props.config || 'tamagui.config.ts',\n components: props.components || ['tamagui'],\n }))\n }\n\n return {\n options: {\n logger,\n },\n cleanupBeforeExit,\n loadTamagui: load,\n loadTamaguiSync: loadSync,\n getTamagui() {\n return projectInfo?.tamaguiConfig\n },\n parseSync: (f: FileOrPath, props: ExtractorParseProps) => {\n const projectInfo = loadSync(props)\n return parseWithConfig(projectInfo, f, props)\n },\n parse: async (f: FileOrPath, props: ExtractorParseProps) => {\n const projectInfo = await load(props)\n return parseWithConfig(projectInfo, f, props)\n },\n }\n\n function parseWithConfig(\n { components, tamaguiConfig }: TamaguiProjectInfo,\n fileOrPath: FileOrPath,\n options: ExtractorParseProps\n ) {\n const {\n config = 'tamagui.config.ts',\n importsWhitelist = ['constants.js'],\n evaluateVars = true,\n sourcePath = '',\n onExtractTag,\n onStyleRule,\n getFlattenedNode,\n disable,\n disableExtraction,\n disableExtractInlineMedia,\n disableExtractVariables,\n disableDebugAttr,\n disableExtractFoundComponents,\n includeExtensions = ['.tsx', '.jsx', '.js'],\n extractStyledDefinitions = false,\n prefixLogs,\n excludeProps,\n target,\n ...restProps\n } = options\n\n let shouldPrintDebug = options.shouldPrintDebug || false\n\n if (disable === true || (Array.isArray(disable) && disable.includes(sourcePath))) {\n return null\n }\n if (sourcePath === '') {\n throw new Error(`Must provide a source file name`)\n }\n if (!components) {\n throw new Error(`Must provide components`)\n }\n if (includeExtensions && !includeExtensions.some((ext) => sourcePath.endsWith(ext))) {\n if (shouldPrintDebug) {\n logger.info(\n `Ignoring file due to includeExtensions: ${sourcePath}, includeExtensions: ${includeExtensions.join(\n ', '\n )}`\n )\n }\n return null\n }\n\n function isValidStyleKey(name: string, staticConfig: StaticConfigParsed) {\n if (!projectInfo) {\n throw new Error(`Tamagui extractor not loaded yet`)\n }\n if (target === 'native' && name[0] === '$' && mediaQueryConfig[name.slice(1)]) {\n return false\n }\n return !!(\n !!staticConfig.validStyles?.[name] ||\n !!pseudoDescriptors[name] ||\n // dont disable variants or else you lose many things flattening\n staticConfig.variants?.[name] ||\n projectInfo?.tamaguiConfig.shorthands[name] ||\n (name[0] === '$' ? !!mediaQueryConfig[name.slice(1)] : false)\n )\n }\n\n /**\n * Step 1: Determine if importing any statically extractable components\n */\n\n const isTargetingHTML = target === 'html'\n const ogDebug = shouldPrintDebug\n const tm = timer()\n const propsWithFileInfo: TamaguiOptionsWithFileInfo = {\n ...options,\n sourcePath,\n allLoadedComponents: [...components],\n }\n\n if (!hasLoggedBaseInfo) {\n hasLoggedBaseInfo = true\n if (shouldPrintDebug) {\n logger.info(\n [\n 'loaded components:',\n propsWithFileInfo.allLoadedComponents\n .map((comp) => Object.keys(comp.nameToInfo).join(', '))\n .join(', '),\n ].join(' ')\n )\n }\n if (process.env.DEBUG?.startsWith('tamagui')) {\n const next = [...propsWithFileInfo.allLoadedComponents].map((info) => {\n const nameToInfo = { ...info.nameToInfo }\n for (const key in nameToInfo) {\n delete nameToInfo[key].staticConfig.validStyles\n }\n return { ...info, nameToInfo }\n })\n logger.info(['loaded:', JSON.stringify(next, null, 2)].join('\\n'))\n }\n }\n\n tm.mark('load-tamagui', !!shouldPrintDebug)\n\n const firstThemeName = Object.keys(tamaguiConfig.themes)[0]\n const firstTheme = tamaguiConfig.themes[firstThemeName]\n\n if (!firstTheme || typeof firstTheme !== 'object') {\n console.error(`Missing theme, an error occurred when importing your config`)\n console.log(`Got config:`, tamaguiConfig)\n console.log(`Looking for theme:`, firstThemeName)\n process.exit(0)\n }\n\n const proxiedTheme = proxyThemeVariables(firstTheme)\n type AccessListener = (key: string) => void\n const themeAccessListeners = new Set<AccessListener>()\n const defaultTheme = new Proxy(proxiedTheme, {\n get(target, key) {\n if (Reflect.has(target, key)) {\n themeAccessListeners.forEach((cb) => cb(String(key)))\n }\n return Reflect.get(target, key)\n },\n })\n\n // @ts-ignore\n const body = fileOrPath.type === 'Program' ? fileOrPath.get('body') : fileOrPath.program.body\n\n if (Object.keys(components).length === 0) {\n console.warn(`Warning: Tamagui didn't find any valid components (DEBUG=tamagui for more)`)\n if (process.env.DEBUG === 'tamagui') {\n console.log(`components`, Object.keys(components), components)\n }\n }\n\n if (shouldPrintDebug === 'verbose') {\n logger.info(\n `allLoadedComponent modules ${propsWithFileInfo.allLoadedComponents\n .map((k) => k.moduleName)\n .join(', ')}`\n )\n }\n\n let doesUseValidImport = false\n let hasImportedTheme = false\n\n const importDeclarations: t.ImportDeclaration[] = []\n\n for (const bodyPath of body) {\n if (bodyPath.type !== 'ImportDeclaration') continue\n const node = ('node' in bodyPath ? bodyPath.node : bodyPath) as t.ImportDeclaration\n const moduleName = node.source.value\n\n // if importing valid module\n const valid = isValidImport(propsWithFileInfo, moduleName)\n\n if (valid) {\n importDeclarations.push(node)\n }\n\n if (extractStyledDefinitions) {\n if (valid) {\n if (node.specifiers.some((specifier) => specifier.local.name === 'styled')) {\n doesUseValidImport = true\n break\n }\n }\n }\n\n if (valid) {\n const names = node.specifiers.map((specifier) => specifier.local.name)\n const isValidComponent = names.some((name) =>\n Boolean(isValidImport(propsWithFileInfo, moduleName, name) || validHooks[name])\n )\n if (shouldPrintDebug === 'verbose') {\n logger.info(\n `import ${names.join(', ')} from ${moduleName} isValidComponent ${isValidComponent}`\n )\n }\n if (isValidComponent) {\n doesUseValidImport = true\n break\n }\n }\n }\n\n if (shouldPrintDebug) {\n logger.info(`file: ${sourcePath} ${JSON.stringify({ doesUseValidImport, hasImportedTheme })}`)\n }\n\n if (!doesUseValidImport) {\n return null\n }\n\n function getValidImportedComponent(componentName: string) {\n const importDeclaration = importDeclarations.find((dec) =>\n dec.specifiers.some((spec) => spec.local.name === componentName)\n )\n if (!importDeclaration) {\n return null\n }\n return getValidImport(propsWithFileInfo, importDeclaration.source.value, componentName)\n }\n\n tm.mark('import-check', !!shouldPrintDebug)\n\n let couldntParse = false\n const modifiedComponents = new Set<NodePath<any>>()\n\n // only keeping a cache around per-file, reset it if it changes\n const bindingCache: Record<string, string | null> = {}\n\n const callTraverse = (a: TraverseOptions<any>) => {\n return fileOrPath.type === 'File' ? traverse(fileOrPath, a) : fileOrPath.traverse(a)\n }\n\n const shouldDisableExtraction =\n disableExtraction === true ||\n (Array.isArray(disableExtraction) && disableExtraction.includes(sourcePath))\n\n /**\n * Step 2: Statically extract from JSX < /> nodes\n */\n let programPath: NodePath<t.Program> | null = null\n\n const res = {\n styled: 0,\n flattened: 0,\n optimized: 0,\n modified: 0,\n found: 0,\n }\n\n callTraverse({\n // @ts-ignore\n Program: {\n enter(path) {\n programPath = path\n },\n },\n\n // styled() calls\n CallExpression(path) {\n if (disable || shouldDisableExtraction || extractStyledDefinitions === false) {\n return\n }\n\n if (!t.isIdentifier(path.node.callee) || path.node.callee.name !== 'styled') {\n return\n }\n\n const name =\n t.isVariableDeclarator(path.parent) && t.isIdentifier(path.parent.id)\n ? path.parent.id.name\n : 'unknown'\n\n const definition = path.node.arguments[1]\n\n if (!name || !definition || !t.isObjectExpression(definition)) {\n return\n }\n\n let Component = getValidImportedComponent(name)\n\n if (!Component) {\n if (disableExtractFoundComponents === true) {\n return\n }\n if (\n Array.isArray(disableExtractFoundComponents) &&\n disableExtractFoundComponents.includes(name)\n ) {\n return\n }\n\n try {\n if (shouldPrintDebug) {\n logger.info(`Unknown component ${name}, attempting dynamic load: ${sourcePath}`)\n }\n\n const out = loadTamaguiSync({\n forceExports: true,\n components: [sourcePath],\n })\n\n if (!out?.components) {\n if (shouldPrintDebug) {\n logger.info(`Couldn't load, got ${out}`)\n }\n return\n }\n\n propsWithFileInfo.allLoadedComponents = [\n ...propsWithFileInfo.allLoadedComponents,\n ...out.components,\n ]\n\n Component = out.components.flatMap((x) => x.nameToInfo[name] ?? [])[0]\n\n if (shouldPrintDebug === 'verbose') {\n logger.info([`Tamagui Loaded`, JSON.stringify(out.components), !!Component].join(' '))\n }\n } catch (err: any) {\n if (shouldPrintDebug) {\n logger.info(\n `${getPrefixLogs(\n options\n )} skip optimize styled(${name}), unable to pre-process (DEBUG=tamagui for more)`\n )\n }\n if (process.env.DEBUG === 'tamagui') {\n logger.info(\n ` Disable this with \"disableExtractFoundComponents\" in your build-time configuration. \\n\\n ${err.message} ${err.stack}`\n )\n }\n }\n }\n\n if (!Component) {\n return\n }\n\n const componentSkipProps = new Set([\n ...(Component.staticConfig.inlineWhenUnflattened || []),\n ...(Component.staticConfig.inlineProps || []),\n ...(Component.staticConfig.deoptProps || []),\n // for now skip variants, will return to them\n 'variants',\n 'defaultVariants',\n // skip fontFamily its basically a \"variant\", important for theme use to be value always\n 'fontFamily',\n 'name',\n ])\n\n // for now dont parse variants, spreads, etc\n const skipped: (t.ObjectProperty | t.SpreadElement | t.ObjectMethod)[] = []\n const styles = {}\n\n // Generate scope object at this level\n const staticNamespace = getStaticBindingsForScope(\n path.scope,\n importsWhitelist,\n sourcePath,\n bindingCache,\n shouldPrintDebug\n )\n\n const attemptEval = !evaluateVars\n ? evaluateAstNode\n : createEvaluator({\n props: propsWithFileInfo,\n staticNamespace,\n sourcePath,\n shouldPrintDebug,\n })\n const attemptEvalSafe = createSafeEvaluator(attemptEval)\n\n for (const property of definition.properties) {\n if (\n !t.isObjectProperty(property) ||\n !t.isIdentifier(property.key) ||\n !isValidStyleKey(property.key.name, Component.staticConfig) ||\n // skip variants\n Component.staticConfig.variants?.[property.key.name] ||\n componentSkipProps.has(property.key.name)\n ) {\n skipped.push(property)\n continue\n }\n // attempt eval\n const out = attemptEvalSafe(property.value)\n if (out === FAILED_EVAL) {\n skipped.push(property)\n } else {\n styles[property.key.name] = out\n }\n }\n\n const out = getSplitStyles(styles, Component.staticConfig, defaultTheme, {\n focus: false,\n hover: false,\n unmounted: true,\n press: false,\n pressIn: false,\n resolveVariablesAs: 'variable',\n noClassNames: false,\n })\n\n const classNames = {\n ...out.classNames,\n }\n\n // // add in the style object as classnames\n // const atomics = getStylesAtomic(out.style)\n // for (const atomic of atomics) {\n // out.rulesToInsert = out.rulesToInsert || []\n // out.rulesToInsert.push(atomic)\n // classNames[atomic.property] = atomic.identifier\n // }\n\n if (shouldPrintDebug) {\n // prettier-ignore\n logger.info([`Extracted styled(${name})\\n`, JSON.stringify(styles, null, 2), '\\n rulesToInsert:', out.rulesToInsert.flatMap((rule) => rule.rules).join('\\n')].join(' '))\n }\n\n // leave only un-parsed props...\n definition.properties = skipped\n\n // ... + key: className\n for (const cn in classNames) {\n if (componentSkipProps.has(cn)) {\n continue\n }\n const val = classNames[cn]\n definition.properties.push(t.objectProperty(t.stringLiteral(cn), t.stringLiteral(val)))\n }\n\n if (out.rulesToInsert) {\n for (const { identifier, rules } of out.rulesToInsert) {\n onStyleRule?.(identifier, rules)\n }\n }\n\n res.styled++\n\n if (shouldPrintDebug) {\n logger.info(`Extracted styled(${name})`)\n }\n },\n\n JSXElement(traversePath) {\n tm.mark('jsx-element', !!shouldPrintDebug)\n\n const node = traversePath.node.openingElement\n const ogAttributes = node.attributes.map((attr) => ({ ...attr }))\n const componentName = findComponentName(traversePath.scope)\n const closingElement = traversePath.node.closingElement\n\n // skip non-identifier opening elements (member expressions, etc.)\n if (t.isJSXMemberExpression(closingElement?.name) || !t.isJSXIdentifier(node.name)) {\n return\n }\n\n // validate its a proper import from tamagui (or internally inside tamagui)\n const binding = traversePath.scope.getBinding(node.name.name)\n let modulePath = ''\n\n if (binding) {\n if (!t.isImportDeclaration(binding.path.parent)) {\n if (shouldPrintDebug) {\n logger.info(` - Binding not import declaration, skip`)\n }\n return\n }\n modulePath = binding.path.parent.source.value\n if (!isValidImport(propsWithFileInfo, modulePath, binding.identifier.name)) {\n if (shouldPrintDebug) {\n logger.info(` - Binding not internal import or from components ${modulePath}`)\n }\n return\n }\n }\n\n const component = getValidComponent(propsWithFileInfo, modulePath, node.name.name)\n if (!component || !component.staticConfig) {\n if (shouldPrintDebug) {\n logger.info(` - No Tamagui conf on this: ${node.name.name}`)\n }\n return\n }\n\n const originalNodeName = node.name.name\n\n // found a valid tag\n res.found++\n\n const filePath = `./${relative(process.cwd(), sourcePath)}`\n const lineNumbers = node.loc\n ? node.loc.start.line +\n (node.loc.start.line !== node.loc.end.line ? `-${node.loc.end.line}` : '')\n : ''\n\n const codePosition = `${filePath}:${lineNumbers}`\n\n // debug just one\n const debugPropValue = node.attributes\n .filter(\n (n) => t.isJSXAttribute(n) && t.isJSXIdentifier(n.name) && n.name.name === 'debug'\n )\n // @ts-ignore\n .map((n: t.JSXAttribute) => {\n if (n.value === null) return true\n if (t.isStringLiteral(n.value)) return n.value.value as 'verbose'\n return false\n })[0] as boolean | 'verbose' | undefined\n\n if (debugPropValue) {\n shouldPrintDebug = debugPropValue\n }\n\n if (shouldPrintDebug) {\n logger.info('\\n')\n logger.info(\n `\\x1b[33m%s\\x1b[0m ` + `${componentName} | ${codePosition} -------------------`\n )\n // prettier-ignore\n logger.info(['\\x1b[1m', '\\x1b[32m', `<${originalNodeName} />`, disableDebugAttr ? '' : '\uD83D\uDC1B'].join(' '))\n }\n\n // add data-* debug attributes\n if (shouldAddDebugProp && !disableDebugAttr) {\n res.modified++\n node.attributes.unshift(\n t.jsxAttribute(t.jsxIdentifier('data-is'), t.stringLiteral(node.name.name))\n )\n if (componentName) {\n node.attributes.unshift(\n t.jsxAttribute(t.jsxIdentifier('data-in'), t.stringLiteral(componentName))\n )\n }\n\n node.attributes.unshift(\n t.jsxAttribute(\n t.jsxIdentifier('data-at'),\n t.stringLiteral(`${basename(filePath)}:${lineNumbers}`)\n )\n )\n }\n\n if (shouldDisableExtraction) {\n return\n }\n\n try {\n const { staticConfig } = component\n const variants = staticConfig.variants || {}\n const isTextView = staticConfig.isText || false\n const validStyles = staticConfig?.validStyles ?? {}\n\n // find tag=\"a\" tag=\"main\" etc dom indicators\n let tagName = staticConfig.defaultProps.tag ?? (isTextView ? 'span' : 'div')\n traversePath\n .get('openingElement')\n .get('attributes')\n .forEach((path) => {\n const attr = path.node\n if (t.isJSXSpreadAttribute(attr)) return\n if (attr.name.name !== 'tag') return\n const val = attr.value\n if (!t.isStringLiteral(val)) return\n tagName = val.value\n })\n\n const flatNode = getFlattenedNode?.({ isTextView, tag: tagName })\n\n const inlineProps = new Set([\n ...(restProps.inlineProps || []),\n ...(staticConfig.inlineProps || []),\n ])\n\n const deoptProps = new Set([\n // always de-opt animation\n 'animation',\n ...(restProps.deoptProps || []),\n ...(staticConfig.deoptProps || []),\n ])\n\n const inlineWhenUnflattened = new Set([...(staticConfig.inlineWhenUnflattened || [])])\n\n // Generate scope object at this level\n const staticNamespace = getStaticBindingsForScope(\n traversePath.scope,\n importsWhitelist,\n sourcePath,\n bindingCache,\n shouldPrintDebug\n )\n\n const attemptEval = !evaluateVars\n ? evaluateAstNode\n : createEvaluator({\n props: propsWithFileInfo,\n staticNamespace,\n sourcePath,\n traversePath,\n shouldPrintDebug,\n })\n const attemptEvalSafe = createSafeEvaluator(attemptEval)\n\n if (shouldPrintDebug) {\n logger.info(` staticNamespace ${Object.keys(staticNamespace).join(', ')}`)\n }\n\n //\n // SPREADS SETUP\n //\n\n // TODO restore\n // const hasDeopt = (obj: Object) => {\n // return Object.keys(obj).some(isDeoptedProp)\n // }\n\n // flatten any easily evaluatable spreads\n const flattenedAttrs: (t.JSXAttribute | t.JSXSpreadAttribute)[] = []\n traversePath\n .get('openingElement')\n .get('attributes')\n .forEach((path) => {\n const attr = path.node\n if (!t.isJSXSpreadAttribute(attr)) {\n flattenedAttrs.push(attr)\n return\n }\n let arg: any\n try {\n arg = attemptEval(attr.argument)\n } catch (e: any) {\n if (shouldPrintDebug) {\n logger.info([' couldnt parse spread', e.message].join(' '))\n }\n flattenedAttrs.push(attr)\n return\n }\n if (arg !== undefined) {\n try {\n if (typeof arg !== 'object' || arg == null) {\n if (shouldPrintDebug) {\n logger.info([' non object or null arg', arg].join(' '))\n }\n flattenedAttrs.push(attr)\n } else {\n for (const k in arg) {\n const value = arg[k]\n // this is a null prop:\n if (!value && typeof value === 'object') {\n logger.error(['Unhandled null prop', k, value, arg].join(' '))\n continue\n }\n flattenedAttrs.push(\n t.jsxAttribute(\n t.jsxIdentifier(k),\n t.jsxExpressionContainer(literalToAst(value))\n )\n )\n }\n }\n } catch (err) {\n logger.warn(`cant parse spread, caught err ${err}`)\n couldntParse = true\n }\n }\n })\n\n if (couldntParse) {\n return\n }\n\n tm.mark('jsx-element-flattened', !!shouldPrintDebug)\n\n // set flattened\n node.attributes = flattenedAttrs\n\n let attrs: ExtractedAttr[] = []\n let shouldDeopt = false\n const inlined = new Map<string, any>()\n const variantValues = new Map<string, any>()\n let hasSetOptimized = false\n const inlineWhenUnflattenedOGVals = {}\n\n // RUN first pass\n\n // normalize all conditionals so we can evaluate away easier later\n // at the same time lets normalize shorthand media queries into spreads:\n // that way we can parse them with the same logic later on\n //\n // {...media.sm && { color: x ? 'red' : 'blue' }}\n // => {...media.sm && x && { color: 'red' }}\n // => {...media.sm && !x && { color: 'blue' }}\n //\n // $sm={{ color: 'red' }}\n // => {...media.sm && { color: 'red' }}\n //\n // $sm={{ color: x ? 'red' : 'blue' }}\n // => {...media.sm && x && { color: 'red' }}\n // => {...media.sm && !x && { color: 'blue' }}\n\n attrs = traversePath\n .get('openingElement')\n .get('attributes')\n .flatMap((path) => {\n try {\n const res = evaluateAttribute(path)\n tm.mark('jsx-element-evaluate-attr', !!shouldPrintDebug)\n if (!res) {\n path.remove()\n }\n return res\n } catch (err: any) {\n if (shouldPrintDebug) {\n logger.info(\n [\n 'Recoverable error extracting attribute',\n err.message,\n shouldPrintDebug === 'verbose' ? err.stack : '',\n ].join(' ')\n )\n if (shouldPrintDebug === 'verbose') {\n logger.info(`node ${path.node?.type}`)\n }\n }\n // dont flatten if we run into error\n inlined.set(`${Math.random()}`, 'spread')\n return {\n type: 'attr',\n value: path.node,\n } as const\n }\n })\n .flat(4)\n .filter(isPresent)\n\n if (shouldPrintDebug) {\n logger.info(\n [' - attrs (before):\\n', logLines(attrs.map(attrStr).join(', '))].join(' ')\n )\n }\n\n // START function evaluateAttribute\n function evaluateAttribute(\n path: NodePath<t.JSXAttribute | t.JSXSpreadAttribute>\n ): ExtractedAttr | ExtractedAttr[] | null {\n const attribute = path.node\n const attr: ExtractedAttr = { type: 'attr', value: attribute }\n // ...spreads\n if (t.isJSXSpreadAttribute(attribute)) {\n const arg = attribute.argument\n const conditional = t.isConditionalExpression(arg)\n ? // <YStack {...isSmall ? { color: 'red } : { color: 'blue }}\n ([arg.test, arg.consequent, arg.alternate] as const)\n : t.isLogicalExpression(arg) && arg.operator === '&&'\n ? // <YStack {...isSmall && { color: 'red }}\n ([arg.left, arg.right, null] as const)\n : null\n\n if (conditional) {\n const [test, alt, cons] = conditional\n if (!test) throw new Error(`no test`)\n if ([alt, cons].some((side) => side && !isStaticObject(side))) {\n if (shouldPrintDebug) {\n logger.info(`not extractable ${alt} ${cons}`)\n }\n return attr\n }\n // split into individual ternaries per object property\n return [\n ...(createTernariesFromObjectProperties(test, alt) || []),\n ...((cons &&\n createTernariesFromObjectProperties(t.unaryExpression('!', test), cons)) ||\n []),\n ].map((ternary) => ({\n type: 'ternary',\n value: ternary,\n }))\n }\n }\n // END ...spreads\n\n // directly keep these\n // couldn't evaluate spread, undefined name, or name is not string\n if (\n t.isJSXSpreadAttribute(attribute) ||\n !attribute.name ||\n typeof attribute.name.name !== 'string'\n ) {\n if (shouldPrintDebug) {\n logger.info(' ! inlining, spread attr')\n }\n inlined.set(`${Math.random()}`, 'spread')\n return attr\n }\n\n const name = attribute.name.name\n\n if (excludeProps?.has(name)) {\n if (shouldPrintDebug) {\n logger.info([' excluding prop', name].join(' '))\n }\n return null\n }\n\n if (inlineProps.has(name)) {\n inlined.set(name, name)\n if (shouldPrintDebug) {\n logger.info([' ! inlining, inline prop', name].join(' '))\n }\n return attr\n }\n\n // can still optimize the object... see hoverStyle on native\n if (deoptProps.has(name)) {\n shouldDeopt = true\n inlined.set(name, name)\n if (shouldPrintDebug) {\n logger.info([' ! inlining, deopted prop', name].join(' '))\n }\n return attr\n }\n\n // pass className, key, and style props through untouched\n if (UNTOUCHED_PROPS[name]) {\n return attr\n }\n\n if (INLINE_EXTRACTABLE[name]) {\n inlined.set(name, INLINE_EXTRACTABLE[name])\n return attr\n }\n\n if (name.startsWith('data-')) {\n return attr\n }\n\n // shorthand media queries\n if (name[0] === '$' && t.isJSXExpressionContainer(attribute?.value)) {\n const shortname = name.slice(1)\n if (mediaQueryConfig[shortname]) {\n if (target === 'native') {\n shouldDeopt = true\n }\n\n // allow disabling this extraction\n if (disableExtractInlineMedia) {\n return attr\n }\n\n const expression = attribute.value.expression\n if (!t.isJSXEmptyExpression(expression)) {\n const ternaries = createTernariesFromObjectProperties(\n t.stringLiteral(shortname),\n expression,\n {\n inlineMediaQuery: shortname,\n }\n )\n if (ternaries) {\n return ternaries.map((value) => ({\n type: 'ternary',\n value,\n }))\n }\n }\n }\n }\n\n const [value, valuePath] = (() => {\n if (t.isJSXExpressionContainer(attribute?.value)) {\n return [attribute.value.expression!, path.get('value')!] as const\n } else {\n return [attribute.value!, path.get('value')!] as const\n }\n })()\n\n const remove = () => {\n Array.isArray(valuePath) ? valuePath.map((p) => p.remove()) : valuePath.remove()\n }\n\n if (name === 'ref') {\n if (shouldPrintDebug) {\n logger.info([' ! inlining, ref', name].join(' '))\n }\n inlined.set('ref', 'ref')\n return attr\n }\n\n if (name === 'tag') {\n return {\n type: 'attr',\n value: path.node,\n }\n }\n\n // native shouldn't extract variables\n if (disableExtractVariables === true) {\n if (value) {\n if (value.type === 'StringLiteral' && value.value[0] === '$') {\n if (shouldPrintDebug) {\n logger.info(\n [` ! inlining, native disable extract: ${name} =`, value.value].join(' ')\n )\n }\n inlined.set(name, true)\n return attr\n }\n }\n }\n\n if (name === 'theme') {\n inlined.set('theme', attr.value)\n return attr\n }\n\n // if value can be evaluated, extract it and filter it out\n const styleValue = attemptEvalSafe(value)\n\n // never flatten if a prop isn't a valid static attribute\n // only post prop-mapping\n if (!variants[name] && !isValidStyleKey(name, staticConfig)) {\n let keys = [name]\n let out: any = null\n\n // for now passing empty props {}, a bit odd, need to at least document\n // for now we don't expose custom components so just noting behavior\n out = staticConfig.propMapper(\n name,\n styleValue,\n defaultTheme,\n staticConfig.defaultProps,\n { resolveVariablesAs: 'auto' },\n undefined,\n undefined,\n shouldPrintDebug\n )\n\n if (out) {\n if (!Array.isArray(out)) {\n logger.warn(`Error expected array but got`, out)\n couldntParse = true\n shouldDeopt = true\n } else {\n out = Object.fromEntries(out)\n keys = Object.keys(out)\n }\n }\n if (out) {\n if (isTargetingHTML) {\n // translate to DOM-compat\n out = createDOMProps(isTextView ? 'span' : 'div', out)\n // remove className - we dont use rnw styling\n delete out.className\n }\n\n keys = Object.keys(out)\n }\n\n let didInline = false\n const attributes = keys.map((key) => {\n const val = out[key]\n if (isValidStyleKey(key, staticConfig)) {\n return {\n type: 'style',\n value: { [key]: styleValue },\n name: key,\n attr: path.node,\n } as const\n }\n if (\n validHTMLAttributes[key] ||\n key.startsWith('aria-') ||\n key.startsWith('data-') ||\n // this is debug stuff added by vite / new jsx transform\n key === '__source' ||\n key === '__self'\n ) {\n return attr\n }\n if (shouldPrintDebug) {\n logger.info(' ! inlining, non-static ' + key)\n }\n didInline = true\n inlined.set(key, val)\n return val\n })\n\n // weird logic whats going on here\n if (didInline) {\n if (shouldPrintDebug) {\n logger.info(` bailing flattening due to attributes ${attributes}`)\n }\n // bail\n return attr\n }\n\n // return evaluated attributes\n return attributes\n }\n\n // FAILED = dynamic or ternary, keep going\n if (styleValue !== FAILED_EVAL) {\n if (inlineWhenUnflattened.has(name)) {\n // preserve original value for restoration\n inlineWhenUnflattenedOGVals[name] = { styleValue, attr }\n }\n\n if (isValidStyleKey(name, staticConfig)) {\n if (shouldPrintDebug) {\n logger.info(` style: ${name} = ${styleValue}`)\n }\n if (!(name in staticConfig.defaultProps)) {\n if (!hasSetOptimized) {\n res.optimized++\n hasSetOptimized = true\n }\n }\n return {\n type: 'style',\n value: { [name]: styleValue },\n name,\n attr: path.node,\n }\n } else {\n if (variants[name]) {\n variantValues.set(name, styleValue)\n }\n inlined.set(name, true)\n return attr\n }\n }\n\n // ternaries!\n\n // binary ternary, we can eventually make this smarter but step 1\n // basically for the common use case of:\n // opacity={(conditional ? 0 : 1) * scale}\n if (t.isBinaryExpression(value)) {\n if (shouldPrintDebug) {\n logger.info(` binary expression ${name} = ${value}`)\n }\n const { operator, left, right } = value\n // if one side is a ternary, and the other side is evaluatable, we can maybe extract\n const lVal = attemptEvalSafe(left)\n const rVal = attemptEvalSafe(right)\n if (shouldPrintDebug) {\n logger.info(` evalBinaryExpression lVal ${String(lVal)}, rVal ${String(rVal)}`)\n }\n if (lVal !== FAILED_EVAL && t.isConditionalExpression(right)) {\n const ternary = addBinaryConditional(operator, left, right)\n if (ternary) return ternary\n }\n if (rVal !== FAILED_EVAL && t.isConditionalExpression(left)) {\n const ternary = addBinaryConditional(operator, right, left)\n if (ternary) return ternary\n }\n if (shouldPrintDebug) {\n logger.info(` evalBinaryExpression cant extract`)\n }\n inlined.set(name, true)\n return attr\n }\n\n const staticConditional = getStaticConditional(value)\n if (staticConditional) {\n if (shouldPrintDebug === 'verbose') {\n logger.info(` static conditional ${name} ${value}`)\n }\n return { type: 'ternary', value: staticConditional }\n }\n\n const staticLogical = getStaticLogical(value)\n if (staticLogical) {\n if (shouldPrintDebug === 'verbose') {\n logger.info(` static ternary ${name} = ${value}`)\n }\n return { type: 'ternary', value: staticLogical }\n }\n\n // if we've made it this far, the prop stays inline\n inlined.set(name, true)\n if (shouldPrintDebug) {\n logger.info(` ! inline no match ${name} ${value}`)\n }\n\n //\n // RETURN ATTR\n //\n return attr\n\n // attr helpers:\n function addBinaryConditional(\n operator: any,\n staticExpr: any,\n cond: t.ConditionalExpression\n ): ExtractedAttr | null {\n if (getStaticConditional(cond)) {\n const alt = attemptEval(t.binaryExpression(operator, staticExpr, cond.alternate))\n const cons = attemptEval(t.binaryExpression(operator, staticExpr, cond.consequent))\n if (shouldPrintDebug) {\n logger.info([' binaryConditional', cond.test, cons, alt].join(' '))\n }\n return {\n type: 'ternary',\n value: {\n test: cond.test,\n remove,\n alternate: { [name]: alt },\n consequent: { [name]: cons },\n },\n }\n }\n return null\n }\n\n function getStaticConditional(value: t.Node): Ternary | null {\n if (t.isConditionalExpression(value)) {\n try {\n const aVal = attemptEval(value.alternate)\n const cVal = attemptEval(value.consequent)\n if (shouldPrintDebug) {\n const type = value.test.type\n logger.info([' static ternary', type, cVal, aVal].join(' '))\n }\n return {\n test: value.test,\n remove,\n consequent: { [name]: cVal },\n alternate: { [name]: aVal },\n }\n } catch (err: any) {\n if (shouldPrintDebug) {\n logger.info([' cant eval ternary', err.message].join(' '))\n }\n }\n }\n return null\n }\n\n function getStaticLogical(value: t.Node): Ternary | null {\n if (t.isLogicalExpression(value)) {\n if (value.operator === '&&') {\n try {\n const val = attemptEval(value.right)\n if (shouldPrintDebug) {\n logger.info([' staticLogical', value.left, name, val].join(' '))\n }\n return {\n test: value.left,\n remove,\n consequent: { [name]: val },\n alternate: null,\n }\n } catch (err) {\n if (shouldPrintDebug) {\n logger.info([' cant static eval logical', err].join(' '))\n }\n }\n }\n }\n return null\n }\n } // END function evaluateAttribute\n\n function isStaticObject(obj: t.Node): obj is t.ObjectExpression {\n return (\n t.isObjectExpression(obj) &&\n obj.properties.every((prop) => {\n if (!t.isObjectProperty(prop)) {\n logger.info(['not object prop', prop].join(' '))\n return false\n }\n const propName = prop.key['name']\n if (!isValidStyleKey(propName, staticConfig) && propName !== 'tag') {\n if (shouldPrintDebug) {\n logger.info([' not a valid style prop!', propName].join(' '))\n }\n return false\n }\n return true\n })\n )\n }\n\n // side = {\n // color: 'red',\n // background: x ? 'red' : 'green',\n // $gtSm: { color: 'green' }\n // }\n // => Ternary<test, { color: 'red' }, null>\n // => Ternary<test && x, { background: 'red' }, null>\n // => Ternary<test && !x, { background: 'green' }, null>\n // => Ternary<test && '$gtSm', { color: 'green' }, null>\n function createTernariesFromObjectProperties(\n test: t.Expression,\n side: t.Expression | null,\n ternaryPartial: Partial<Ternary> = {}\n ): null | Ternary[] {\n if (!side) {\n return null\n }\n if (!isStaticObject(side)) {\n throw new Error('not extractable')\n }\n return side.properties.flatMap((property) => {\n if (!t.isObjectProperty(property)) {\n throw new Error('expected object property')\n }\n // handle media queries inside spread/conditional objects\n if (t.isIdentifier(property.key)) {\n const key = property.key.name\n const mediaQueryKey = key.slice(1)\n const isMediaQuery = key[0] === '$' && mediaQueryConfig[mediaQueryKey]\n if (isMediaQuery) {\n if (t.isExpression(property.value)) {\n const ternaries = createTernariesFromObjectProperties(\n t.stringLiteral(mediaQueryKey),\n property.value,\n {\n inlineMediaQuery: mediaQueryKey,\n }\n )\n if (ternaries) {\n return ternaries.map((value) => ({\n ...ternaryPartial,\n ...value,\n // ensure media query test stays on left side (see getMediaQueryTernary)\n test: t.logicalExpression('&&', value.test, test),\n }))\n } else {\n logger.info(['\u26A0\uFE0F no ternaries?', property].join(' '))\n }\n } else {\n logger.info(['\u26A0\uFE0F not expression', property].join(' '))\n }\n }\n }\n // this could be a recurse here if we want to get fancy\n if (t.isConditionalExpression(property.value)) {\n // merge up into the parent conditional, split into two\n const [truthy, falsy] = [\n t.objectExpression([t.objectProperty(property.key, property.value.consequent)]),\n t.objectExpression([t.objectProperty(property.key, property.value.alternate)]),\n ].map((x) => attemptEval(x))\n return [\n createTernary({\n remove() {},\n ...ternaryPartial,\n test: t.logicalExpression('&&', test, property.value.test),\n consequent: truthy,\n alternate: null,\n }),\n createTernary({\n ...ternaryPartial,\n test: t.logicalExpression(\n '&&',\n test,\n t.unaryExpression('!', property.value.test)\n ),\n consequent: falsy,\n alternate: null,\n remove() {},\n }),\n ]\n }\n const obj = t.objectExpression([t.objectProperty(property.key, property.value)])\n const consequent = attemptEval(obj)\n return createTernary({\n remove() {},\n ...ternaryPartial,\n test,\n consequent,\n alternate: null,\n })\n })\n }\n\n if (couldntParse || shouldDeopt) {\n if (shouldPrintDebug) {\n logger.info([` avoid optimizing:`, { couldntParse, shouldDeopt }].join(' '))\n }\n node.attributes = ogAttributes\n return\n }\n\n // now update to new values\n node.attributes = attrs.filter(isAttr).map((x) => x.value)\n\n // before deopt, can still optimize\n const parentFn = findTopmostFunction(traversePath)\n if (parentFn) {\n modifiedComponents.add(parentFn)\n }\n\n // combine ternaries\n let ternaries: Ternary[] = []\n attrs = attrs\n .reduce<(ExtractedAttr | ExtractedAttr[])[]>((out, cur) => {\n const next = attrs[attrs.indexOf(cur) + 1]\n if (cur.type === 'ternary') {\n ternaries.push(cur.value)\n }\n if ((!next || next.type !== 'ternary') && ternaries.length) {\n // finish, process\n const normalized = normalizeTernaries(ternaries).map(\n ({ alternate, consequent, ...rest }) => {\n return {\n type: 'ternary' as const,\n value: {\n ...rest,\n alternate: alternate || null,\n consequent: consequent || null,\n },\n }\n }\n )\n try {\n return [...out, ...normalized]\n } finally {\n if (shouldPrintDebug) {\n logger.info(\n ` normalizeTernaries (${ternaries.length} => ${normalized.length})`\n )\n }\n ternaries = []\n }\n }\n if (cur.type === 'ternary') {\n return out\n }\n out.push(cur)\n return out\n }, [])\n .flat()\n\n // flatten logic!\n // fairly simple check to see if all children are text\n const hasSpread = node.attributes.some((x) => t.isJSXSpreadAttribute(x))\n\n const hasOnlyStringChildren =\n !hasSpread &&\n (node.selfClosing ||\n (traversePath.node.children &&\n traversePath.node.children.every((x) => x.type === 'JSXText')))\n\n const themeVal = inlined.get('theme')\n\n // on native we can't flatten when theme prop is set\n if (target !== 'native') {\n inlined.delete('theme')\n }\n\n for (const [key] of [...inlined]) {\n const isStaticObjectVariant = staticConfig.variants?.[key] && variantValues.has(key)\n if (INLINE_EXTRACTABLE[key] || isStaticObjectVariant) {\n inlined.delete(key)\n }\n }\n\n const canFlattenProps = inlined.size === 0\n\n let shouldFlatten = Boolean(\n flatNode &&\n !shouldDeopt &&\n canFlattenProps &&\n !hasSpread &&\n staticConfig.neverFlatten !== true &&\n (staticConfig.neverFlatten === 'jsx' ? hasOnlyStringChildren : true)\n )\n\n const shouldWrapTheme = shouldFlatten && themeVal\n const usedThemeKeys = new Set<string>()\n\n if (disableExtractVariables) {\n // if it accesses any theme values during evaluation\n themeAccessListeners.add((key) => {\n shouldFlatten = false\n usedThemeKeys.add(key)\n if (shouldPrintDebug === 'verbose') {\n logger.info([' ! accessing theme key, avoid flatten', key].join(' '))\n }\n })\n }\n\n if (shouldPrintDebug) {\n try {\n // prettier-ignore\n logger.info([' flatten?', objToStr({ hasSpread, shouldDeopt, shouldFlatten, canFlattenProps, shouldWrapTheme, hasOnlyStringChildren }), 'inlined', [...inlined]].join(' '))\n } catch {\n // ok\n }\n }\n\n // wrap theme around children on flatten\n // TODO move this to bottom and re-check shouldFlatten\n // account for shouldFlatten could change w the above block \"if (disableExtractVariables)\"\n if (shouldFlatten && shouldWrapTheme) {\n if (!programPath) {\n console.warn(\n `No program path found, avoiding importing flattening / importing theme in ${sourcePath}`\n )\n } else {\n if (shouldPrintDebug) {\n logger.info([' - wrapping theme', themeVal].join(' '))\n }\n\n // remove theme attribute from flattened node\n attrs = attrs.filter((x) =>\n x.type === 'attr' && t.isJSXAttribute(x.value) && x.value.name.name === 'theme'\n ? false\n : true\n )\n\n // add import\n if (!hasImportedTheme) {\n hasImportedTheme = true\n programPath.node.body.push(\n t.importDeclaration(\n [t.importSpecifier(t.identifier('_TamaguiTheme'), t.identifier('Theme'))],\n t.stringLiteral('@tamagui/core')\n )\n )\n }\n\n traversePath.replaceWith(\n t.jsxElement(\n t.jsxOpeningElement(t.jsxIdentifier('_TamaguiTheme'), [\n t.jsxAttribute(t.jsxIdentifier('name'), themeVal.value),\n ]),\n t.jsxClosingElement(t.jsxIdentifier('_TamaguiTheme')),\n [traversePath.node]\n )\n )\n }\n }\n\n // only if we flatten, ensure the default styles are there\n if (shouldFlatten) {\n const defaultStyleAttrs = Object.keys(staticConfig.defaultProps).flatMap((key) => {\n if (!isValidStyleKey(key, staticConfig)) {\n return []\n }\n const value = staticConfig.defaultProps[key]\n const name = tamaguiConfig.shorthands[key] || key\n if (value === undefined) {\n logger.warn(`\u26A0\uFE0F Error evaluating default style for component, prop ${key} ${value}`)\n shouldDeopt = true\n return\n }\n const attr: ExtractedAttrStyle = {\n type: 'style',\n name,\n value: { [name]: value },\n }\n return attr\n }) as ExtractedAttr[]\n\n if (defaultStyleAttrs.length) {\n attrs = [...defaultStyleAttrs, ...attrs]\n }\n }\n\n if (shouldDeopt || !shouldFlatten) {\n if (shouldPrintDebug) {\n logger.info(`Deopting`)\n }\n node.attributes = ogAttributes\n return\n }\n\n if (shouldPrintDebug) {\n logger.info(\n [' - attrs (flattened): \\n', logLines(attrs.map(attrStr).join(', '))].join(' ')\n )\n }\n\n const state = {\n noClassNames: false,\n focus: false,\n hover: false,\n unmounted: false, // TODO match logic in createComponent\n press: false,\n pressIn: false,\n }\n\n // evaluates all static attributes into a simple object\n let foundStaticProps = {}\n for (const key in attrs) {\n const cur = attrs[key]\n if (cur.type === 'style') {\n // remove variants because they are processed later, and can lead to invalid values here\n // see <Spacer flex /> where flex looks like a valid style, but is a variant\n foundStaticProps = {\n ...foundStaticProps,\n ...expandStylesWithoutVariants(cur.value),\n }\n continue\n }\n if (cur.type === 'attr') {\n if (t.isJSXSpreadAttribute(cur.value)) {\n continue\n }\n if (!t.isJSXIdentifier(cur.value.name)) {\n continue\n }\n const key = cur.value.name.name\n // undefined = boolean true\n const value = attemptEvalSafe(cur.value.value || t.booleanLiteral(true))\n if (value !== FAILED_EVAL) {\n foundStaticProps = {\n ...foundStaticProps,\n [key]: value,\n }\n }\n }\n }\n\n // must preserve exact order\n const completeProps = {}\n for (const key in staticConfig.defaultProps) {\n if (!(key in foundStaticProps)) {\n completeProps[key] = staticConfig.defaultProps[key]\n }\n }\n for (const key in foundStaticProps) {\n completeProps[key] = foundStaticProps[key]\n }\n\n // expand shorthands, de-opt variables\n attrs = attrs.reduce<ExtractedAttr[]>((acc, cur) => {\n if (!cur) return acc\n if (cur.type === 'attr' && !t.isJSXSpreadAttribute(cur.value)) {\n if (shouldFlatten) {\n const name = cur.value.name.name\n if (typeof name === 'string') {\n if (name === 'tag') {\n // remove tag=\"\"\n return acc\n }\n\n // if flattening, expand variants\n if (variants[name] && variantValues.has(name)) {\n let out = Object.fromEntries(\n staticConfig.propMapper(\n name,\n variantValues.get(name),\n defaultTheme,\n completeProps,\n { ...state, resolveVariablesAs: 'auto' },\n undefined,\n undefined,\n shouldPrintDebug\n ) || []\n )\n if (out && isTargetingHTML) {\n const cn = out.className\n // translate to DOM-compat\n out = createDOMProps(isTextView ? 'span' : 'div', out)\n // remove rnw className use ours\n out.className = cn\n }\n if (shouldPrintDebug) {\n logger.info([' - expanded variant', name, out].join(' '))\n }\n for (const key in out) {\n const value = out[key]\n if (isValidStyleKey(key, staticConfig)) {\n acc.push({\n type: 'style',\n value: { [key]: value },\n name: key,\n attr: cur.value,\n } as const)\n } else {\n acc.push({\n type: 'attr',\n value: t.jsxAttribute(\n t.jsxIdentifier(key),\n t.jsxExpressionContainer(\n typeof value === 'string'\n ? t.stringLiteral(value)\n : literalToAst(value)\n )\n ),\n })\n }\n }\n }\n }\n }\n }\n\n if (cur.type !== 'style') {\n acc.push(cur)\n return acc\n }\n\n let key = Object.keys(cur.value)[0]\n const value = cur.value[key]\n const fullKey = tamaguiConfig.shorthands[key]\n // expand shorthands\n if (fullKey) {\n cur.value = { [fullKey]: value }\n key = fullKey\n }\n\n // finally we have all styles + expansions, lets see if we need to skip\n // any and keep them as attrs\n if (disableExtractVariables) {\n if (value[0] === '$' && (usedThemeKeys.has(key) || usedThemeKeys.has(fullKey))) {\n if (shouldPrintDebug) {\n logger.info([` keeping variable inline: ${key} =`, value].join(' '))\n }\n acc.push({\n type: 'attr',\n value: t.jsxAttribute(\n t.jsxIdentifier(key),\n t.jsxExpressionContainer(t.stringLiteral(value))\n ),\n })\n return acc\n }\n }\n\n acc.push(cur)\n return acc\n }, [])\n\n tm.mark('jsx-element-expanded', !!shouldPrintDebug)\n if (shouldPrintDebug) {\n logger.info(\n [' - attrs (expanded): \\n', logLines(attrs.map(attrStr).join(', '))].join(' ')\n )\n }\n\n // merge styles, leave undefined values\n let prev: ExtractedAttr | null = null\n\n function splitVariants(style: any) {\n const variants = {}\n const styles = {}\n for (const key in style) {\n if (staticConfig.variants?.[key]) {\n variants[key] = style[key]\n } else {\n styles[key] = style[key]\n }\n }\n return {\n variants,\n styles,\n }\n }\n\n function expandStylesWithoutVariants(style: any) {\n const { variants, styles } = splitVariants(style)\n return {\n ...expandStyles(styles),\n ...variants,\n }\n }\n\n function mergeStyles(prev: ViewStyle & PseudoStyles, nextIn: ViewStyle & PseudoStyles) {\n const next = expandStylesWithoutVariants(nextIn)\n for (const key in next) {\n // merge pseudos\n if (pseudoDescriptors[key]) {\n prev[key] = prev[key] || {}\n if (shouldPrintDebug) {\n if (!next[key] || !prev[key]) {\n logger.info(['warn: missing', key, prev, next].join(' '))\n }\n }\n Object.assign(prev[key], next[key])\n } else {\n prev[key] = next[key]\n }\n }\n }\n\n attrs = attrs.reduce<ExtractedAttr[]>((acc, cur) => {\n if (cur.type === 'style') {\n const key = Object.keys(cur.value)[0]\n const value = cur.value[key]\n\n const shouldKeepOriginalAttr =\n // !isStyleAndAttr[key] &&\n !shouldFlatten &&\n // de-opt if non-style\n !validStyles[key] &&\n !pseudoDescriptors[key] &&\n !key.startsWith('data-')\n\n if (shouldKeepOriginalAttr) {\n if (shouldPrintDebug) {\n logger.info([' - keeping as non-style', key].join(' '))\n }\n prev = cur\n acc.push({\n type: 'attr',\n value: t.jsxAttribute(\n t.jsxIdentifier(key),\n t.jsxExpressionContainer(\n typeof value === 'string' ? t.stringLiteral(value) : literalToAst(value)\n )\n ),\n })\n acc.push(cur)\n return acc\n }\n\n if (prev?.type === 'style') {\n mergeStyles(prev.value, cur.value)\n return acc\n }\n }\n\n prev = cur\n acc.push(cur)\n return acc\n }, [])\n\n if (shouldPrintDebug) {\n logger.info(\n [' - attrs (combined \uD83D\uDD00): \\n', logLines(attrs.map(attrStr).join(', '))].join(' ')\n )\n logger.info(\n [' - defaultProps: \\n', logLines(objToStr(staticConfig.defaultProps))].join(' ')\n )\n // prettier-ignore\n logger.info([' - foundStaticProps: \\n', logLines(objToStr(foundStaticProps))].join(' '))\n logger.info([' - completeProps: \\n', logLines(objToStr(completeProps))].join(' '))\n }\n\n // post process\n const getStyles = (props: Object | null, debugName = '') => {\n if (!props || !Object.keys(props).length) {\n if (shouldPrintDebug) logger.info([' getStyles() no props'].join(' '))\n return {}\n }\n if (excludeProps && !!excludeProps.size) {\n for (const key in props) {\n if (excludeProps.has(key)) {\n if (shouldPrintDebug) logger.info([' delete excluded', key].join(' '))\n delete props[key]\n }\n }\n }\n try {\n const out = getSplitStyles(\n props,\n staticConfig,\n defaultTheme,\n {\n ...state,\n fallbackProps: completeProps,\n },\n undefined,\n undefined,\n undefined,\n debugPropValue\n )\n\n const outStyle = {\n ...out.style,\n ...out.pseudos,\n }\n // omitInvalidStyles(outStyle)\n // if (shouldPrintDebug) {\n // // prettier-ignore\n // logger.info(` getStyles ${debugName} (props):\\n`, logLines(objToStr(props)))\n // // prettier-ignore\n // logger.info(` getStyles ${debugName} (out.viewProps):\\n`, logLines(objToStr(out.viewProps)))\n // // prettier-ignore\n // logger.info(` getStyles ${debugName} (out.style):\\n`, logLines(objToStr(outStyle || {}), true))\n // }\n return outStyle\n } catch (err: any) {\n logger.info(['error', err.message, err.stack].join(' '))\n return {}\n }\n }\n\n // used to ensure we pass the entire prop bundle to getStyles\n const completeStyles = getStyles(completeProps, 'completeStyles')\n\n if (!completeStyles) {\n throw new Error(`Impossible, no styles`)\n }\n\n const isNativeNotFlat = !shouldFlatten && target === 'native'\n if (isNativeNotFlat) {\n if (shouldPrintDebug) {\n logger.info(`Disabled flattening except for simple cases on native for now`)\n }\n node.attributes = ogAttributes\n return null\n }\n\n let getStyleError: any = null\n\n // fix up ternaries, combine final style values\n for (const attr of attrs) {\n try {\n switch (attr.type) {\n case 'ternary': {\n const a = getStyles(attr.value.alternate, 'ternary.alternate')\n const c = getStyles(attr.value.consequent, 'ternary.consequent')\n if (a) attr.value.alternate = a\n if (c) attr.value.consequent = c\n if (shouldPrintDebug) logger.info([' => tern ', attrStr(attr)].join(' '))\n continue\n }\n case 'style': {\n // expand variants and such\n const styles = getStyles(attr.value, 'style')\n if (styles) {\n attr.value = styles\n }\n // prettier-ignore\n if (shouldPrintDebug) logger.info([' * styles (in)', logLines(objToStr(attr.value))].join(' '))\n // prettier-ignore\n if (shouldPrintDebug) logger.info([' * styles (out)', logLines(objToStr(styles))].join(' '))\n continue\n }\n }\n } catch (err) {\n // any error de-opt\n getStyleError = err\n }\n }\n\n if (shouldPrintDebug) {\n // prettier-ignore\n logger.info([' - attrs (ternaries/combined):\\n', logLines(attrs.map(attrStr).join(', '))].join(' '))\n }\n\n tm.mark('jsx-element-styles', !!shouldPrintDebug)\n\n if (getStyleError) {\n logger.info([' \u26A0\uFE0F postprocessing error, deopt', getStyleError].join(' '))\n node.attributes = ogAttributes\n return null\n }\n\n // final lazy extra loop:\n const existingStyleKeys = new Set()\n for (let i = attrs.length - 1; i >= 0; i--) {\n const attr = attrs[i]\n\n // if flattening map inline props to proper flattened names\n if (shouldFlatten) {\n if (attr.type === 'attr') {\n if (t.isJSXAttribute(attr.value)) {\n if (t.isJSXIdentifier(attr.value.name)) {\n const name = attr.value.name.name\n if (INLINE_EXTRACTABLE[name]) {\n // map to HTML only name\n attr.value.name.name = INLINE_EXTRACTABLE[name]\n }\n }\n }\n }\n }\n\n // remove duplicate styles\n // so if you have:\n // style({ color: 'red' }), ...someProps, style({ color: 'green' })\n // this will mutate:\n // style({}), ...someProps, style({ color: 'green' })\n if (attr.type === 'style') {\n for (const key in attr.value) {\n if (existingStyleKeys.has(key)) {\n if (shouldPrintDebug) {\n logger.info([` >> delete existing ${key}`].join(' '))\n }\n delete attr.value[key]\n } else {\n existingStyleKeys.add(key)\n }\n }\n }\n }\n\n // inlineWhenUnflattened\n if (!shouldFlatten) {\n if (inlineWhenUnflattened.size) {\n for (const [index, attr] of attrs.entries()) {\n if (attr.type === 'style') {\n for (const key in attr.value) {\n if (!inlineWhenUnflattened.has(key)) continue\n const val = inlineWhenUnflattenedOGVals[key]\n if (val) {\n // delete the style\n delete attr.value[key]\n\n // and insert it before\n attrs.splice(index - 1, 0, val.attr)\n } else {\n // just delete it, it was added during expansion but should be left inline\n delete attr.value[key]\n }\n }\n }\n }\n }\n }\n\n if (shouldFlatten) {\n // DO FLATTEN\n if (shouldPrintDebug) {\n logger.info([' [\u2705] flattening', originalNodeName, flatNode].join(' '))\n }\n // @ts-ignore\n node.name.name = flatNode\n res.flattened++\n if (closingElement) {\n // @ts-ignore\n closingElement.name.name = flatNode\n }\n }\n\n if (shouldPrintDebug) {\n // prettier-ignore\n logger.info([` \u274A\u274A inline props (${inlined.size}):`, shouldDeopt ? ' deopted' : '', hasSpread ? ' has spread' : '', staticConfig.neverFlatten ? 'neverFlatten' : ''].join(' '))\n logger.info(` - attrs (end):\\n ${logLines(attrs.map(attrStr).join(', '))}`)\n }\n\n onExtractTag({\n parserProps: propsWithFileInfo,\n attrs,\n node,\n lineNumbers,\n filePath,\n attemptEval,\n jsxPath: traversePath,\n originalNodeName,\n isFlattened: shouldFlatten,\n programPath: programPath!,\n completeProps,\n staticConfig,\n })\n } finally {\n if (debugPropValue) {\n shouldPrintDebug = ogDebug\n }\n }\n },\n })\n\n tm.mark('jsx-done', !!shouldPrintDebug)\n\n /**\n * Step 3: Remove dead code from removed media query / theme hooks\n */\n if (modifiedComponents.size) {\n const all = Array.from(modifiedComponents)\n if (shouldPrintDebug) {\n logger.info(` [\uD83E\uDE9D] hook check ${all.length}`)\n }\n for (const comp of all) {\n removeUnusedHooks(comp, shouldPrintDebug)\n }\n }\n\n tm.done(shouldPrintDebug === 'verbose')\n\n return res\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAmC;AAEnC,sBAAoD;AACpD,QAAmB;AACnB,uBASO;AAEP,wCAA+B;AAE/B,uBAA4B;AAW5B,6BAAqD;AACrD,6BAAgC;AAChC,4BAQO;AACP,iCAAoC;AACpC,2BAA8B;AAC9B,uCAA6D;AAC7D,0BAA6B;AAC7B,yBAAiE;AACjE,sBAAyB;AACzB,gCAAmC;AACnC,+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UACF;AAEA,cAAI,kBAAkB;AAEpB,mBAAO,KAAK,CAAC,+BAAqB,QAAQ,UAAU,cAAc,aAAa,IAAI,YAAY,gBAAgB,IAAI,aAAa,eAAe,iBAAiB,EAAE,EAAE,KAAK,GAAG,CAAC;AAC7K,mBAAO,KAAK;AAAA,OAAsB,0BAAS,MAAM,IAAI,6BAAO,EAAE,KAAK,IAAI,CAAC,GAAG;AAAA,UAC7E;AAEA,uBAAa;AAAA,YACX,aAAa;AAAA,YACb;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,SAAS;AAAA,YACT;AAAA,YACA,aAAa;AAAA,YACb;AAAA,YACA;AAAA,YACA;AAAA,UACF,CAAC;AAAA,QACH,UAAE;AACA,cAAI,gBAAgB;AAClB,+BAAmB;AAAA,UACrB;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAED,OAAG,KAAK,YAAY,CAAC,CAAC,gBAAgB;AAKtC,QAAI,mBAAmB,MAAM;AAC3B,YAAM,MAAM,MAAM,KAAK,kBAAkB;AACzC,UAAI,kBAAkB;AACpB,eAAO,KAAK,4BAAqB,IAAI,QAAQ;AAAA,MAC/C;AACA,iBAAW,QAAQ,KAAK;AACtB,wDAAkB,MAAM,gBAAgB;AAAA,MAC1C;AAAA,IACF;AAEA,OAAG,KAAK,qBAAqB,SAAS;AAEtC,WAAO;AAAA,EACT;AACF;",
4
+ "sourcesContent": ["/* eslint-disable no-console */\nimport { basename, relative } from 'path'\n\nimport traverse, { NodePath, TraverseOptions } from '@babel/traverse'\nimport * as t from '@babel/types'\nimport {\n PseudoStyles,\n StaticConfigParsed,\n expandStyles,\n getSplitStyles,\n getStylesAtomic,\n mediaQueryConfig,\n proxyThemeVariables,\n pseudoDescriptors,\n} from '@tamagui/core-node'\nimport type { ViewStyle } from 'react-native'\nimport { createDOMProps } from 'react-native-web-internals'\n\nimport { FAILED_EVAL } from '../constants.js'\nimport type {\n ExtractedAttr,\n ExtractedAttrAttr,\n ExtractedAttrStyle,\n ExtractorOptions,\n ExtractorParseProps,\n TamaguiOptions,\n TamaguiOptionsWithFileInfo,\n Ternary,\n} from '../types.js'\nimport { createEvaluator, createSafeEvaluator } from './createEvaluator.js'\nimport { evaluateAstNode } from './evaluateAstNode.js'\nimport {\n attrStr,\n findComponentName,\n getValidComponent,\n getValidImport,\n isPresent,\n isValidImport,\n objToStr,\n} from './extractHelpers.js'\nimport { findTopmostFunction } from './findTopmostFunction.js'\nimport { getPrefixLogs } from './getPrefixLogs.js'\nimport { cleanupBeforeExit, getStaticBindingsForScope } from './getStaticBindingsForScope.js'\nimport { literalToAst } from './literalToAst.js'\nimport { TamaguiProjectInfo, loadTamagui, loadTamaguiSync } from './loadTamagui.js'\nimport { logLines } from './logLines.js'\nimport { normalizeTernaries } from './normalizeTernaries.js'\nimport { removeUnusedHooks } from './removeUnusedHooks.js'\nimport { timer } from './timer.js'\nimport { validHTMLAttributes } from './validHTMLAttributes.js'\n\nconst UNTOUCHED_PROPS = {\n key: true,\n style: true,\n className: true,\n}\n\nconst INLINE_EXTRACTABLE = {\n ref: 'ref',\n key: 'key',\n ...(process.env.TAMAGUI_TARGET === 'web' && {\n onPress: 'onClick',\n onHoverIn: 'onMouseEnter',\n onHoverOut: 'onMouseLeave',\n onPressIn: 'onMouseDown',\n onPressOut: 'onMouseUp',\n }),\n}\n\nconst validHooks = {\n useMedia: true,\n useTheme: true,\n}\n\nconst isAttr = (x: ExtractedAttr): x is ExtractedAttrAttr => x.type === 'attr'\nconst createTernary = (x: Ternary) => x\n\nexport type Extractor = ReturnType<typeof createExtractor>\n\ntype FileOrPath = NodePath<t.Program> | t.File\n\nlet hasLoggedBaseInfo = false\n\nexport function createExtractor({ logger = console }: ExtractorOptions = { logger: console }) {\n if (!process.env.TAMAGUI_TARGET) {\n console.log('\u26A0\uFE0F Please set process.env.TAMAGUI_TARGET to either \"web\" or \"native\"')\n process.exit(1)\n }\n\n const shouldAddDebugProp =\n // really basic disable this for next.js because it messes with ssr\n !process.env.npm_package_dependencies_next &&\n process.env.TAMAGUI_TARGET !== 'native' &&\n process.env.IDENTIFY_TAGS !== 'false' &&\n (process.env.NODE_ENV === 'development' || process.env.DEBUG || process.env.IDENTIFY_TAGS)\n\n let projectInfo: TamaguiProjectInfo | null = null\n\n // we load tamagui delayed because we need to set some global/env stuff before importing\n // otherwise we'd import `rnw` and cause it to evaluate react-native-web which causes errors\n\n function loadSync(props: TamaguiOptions) {\n return (projectInfo ||= loadTamaguiSync({\n config: props.config || 'tamagui.config.ts',\n components: props.components || ['tamagui'],\n }))\n }\n\n async function load(props: TamaguiOptions) {\n return (projectInfo ||= await loadTamagui({\n config: props.config || 'tamagui.config.ts',\n components: props.components || ['tamagui'],\n }))\n }\n\n return {\n options: {\n logger,\n },\n cleanupBeforeExit,\n loadTamagui: load,\n loadTamaguiSync: loadSync,\n getTamagui() {\n return projectInfo?.tamaguiConfig\n },\n parseSync: (f: FileOrPath, props: ExtractorParseProps) => {\n const projectInfo = loadSync(props)\n return parseWithConfig(projectInfo, f, props)\n },\n parse: async (f: FileOrPath, props: ExtractorParseProps) => {\n const projectInfo = await load(props)\n return parseWithConfig(projectInfo, f, props)\n },\n }\n\n function parseWithConfig(\n { components, tamaguiConfig }: TamaguiProjectInfo,\n fileOrPath: FileOrPath,\n options: ExtractorParseProps\n ) {\n const {\n config = 'tamagui.config.ts',\n importsWhitelist = ['constants.js'],\n evaluateVars = true,\n sourcePath = '',\n onExtractTag,\n onStyleRule,\n getFlattenedNode,\n disable,\n disableExtraction,\n disableExtractInlineMedia,\n disableExtractVariables,\n disableDebugAttr,\n disableExtractFoundComponents,\n includeExtensions = ['.tsx', '.jsx', '.js'],\n extractStyledDefinitions = false,\n prefixLogs,\n excludeProps,\n target,\n ...restProps\n } = options\n\n let shouldPrintDebug = options.shouldPrintDebug || false\n\n if (disable === true || (Array.isArray(disable) && disable.includes(sourcePath))) {\n return null\n }\n if (sourcePath === '') {\n throw new Error(`Must provide a source file name`)\n }\n if (!components) {\n throw new Error(`Must provide components`)\n }\n if (includeExtensions && !includeExtensions.some((ext) => sourcePath.endsWith(ext))) {\n if (shouldPrintDebug) {\n logger.info(\n `Ignoring file due to includeExtensions: ${sourcePath}, includeExtensions: ${includeExtensions.join(\n ', '\n )}`\n )\n }\n return null\n }\n\n function isValidStyleKey(name: string, staticConfig: StaticConfigParsed) {\n if (!projectInfo) {\n throw new Error(`Tamagui extractor not loaded yet`)\n }\n if (target === 'native' && name[0] === '$' && mediaQueryConfig[name.slice(1)]) {\n return false\n }\n return !!(\n !!staticConfig.validStyles?.[name] ||\n !!pseudoDescriptors[name] ||\n // dont disable variants or else you lose many things flattening\n staticConfig.variants?.[name] ||\n projectInfo?.tamaguiConfig.shorthands[name] ||\n (name[0] === '$' ? !!mediaQueryConfig[name.slice(1)] : false)\n )\n }\n\n /**\n * Step 1: Determine if importing any statically extractable components\n */\n\n const isTargetingHTML = target === 'html'\n const ogDebug = shouldPrintDebug\n const tm = timer()\n const propsWithFileInfo: TamaguiOptionsWithFileInfo = {\n ...options,\n sourcePath,\n allLoadedComponents: [...components],\n }\n\n if (!hasLoggedBaseInfo) {\n hasLoggedBaseInfo = true\n if (shouldPrintDebug) {\n logger.info(\n [\n 'loaded components:',\n propsWithFileInfo.allLoadedComponents\n .map((comp) => Object.keys(comp.nameToInfo).join(', '))\n .join(', '),\n ].join(' ')\n )\n }\n if (process.env.DEBUG?.startsWith('tamagui')) {\n const next = [...propsWithFileInfo.allLoadedComponents].map((info) => {\n const nameToInfo = { ...info.nameToInfo }\n for (const key in nameToInfo) {\n delete nameToInfo[key].staticConfig.validStyles\n }\n return { ...info, nameToInfo }\n })\n logger.info(['loaded:', JSON.stringify(next, null, 2)].join('\\n'))\n }\n }\n\n tm.mark('load-tamagui', !!shouldPrintDebug)\n\n const firstThemeName = Object.keys(tamaguiConfig.themes)[0]\n const firstTheme = tamaguiConfig.themes[firstThemeName]\n\n if (!firstTheme || typeof firstTheme !== 'object') {\n console.error(`Missing theme, an error occurred when importing your config`)\n console.log(`Got config:`, tamaguiConfig)\n console.log(`Looking for theme:`, firstThemeName)\n process.exit(0)\n }\n\n const proxiedTheme = proxyThemeVariables(firstTheme)\n type AccessListener = (key: string) => void\n const themeAccessListeners = new Set<AccessListener>()\n const defaultTheme = new Proxy(proxiedTheme, {\n get(target, key) {\n if (Reflect.has(target, key)) {\n themeAccessListeners.forEach((cb) => cb(String(key)))\n }\n return Reflect.get(target, key)\n },\n })\n\n // @ts-ignore\n const body = fileOrPath.type === 'Program' ? fileOrPath.get('body') : fileOrPath.program.body\n\n if (Object.keys(components).length === 0) {\n console.warn(`Warning: Tamagui didn't find any valid components (DEBUG=tamagui for more)`)\n if (process.env.DEBUG === 'tamagui') {\n console.log(`components`, Object.keys(components), components)\n }\n }\n\n if (shouldPrintDebug === 'verbose') {\n logger.info(\n `allLoadedComponent modules ${propsWithFileInfo.allLoadedComponents\n .map((k) => k.moduleName)\n .join(', ')}`\n )\n }\n\n let doesUseValidImport = false\n let hasImportedTheme = false\n\n const importDeclarations: t.ImportDeclaration[] = []\n\n for (const bodyPath of body) {\n if (bodyPath.type !== 'ImportDeclaration') continue\n const node = ('node' in bodyPath ? bodyPath.node : bodyPath) as t.ImportDeclaration\n const moduleName = node.source.value\n\n // if importing valid module\n const valid = isValidImport(propsWithFileInfo, moduleName)\n\n if (valid) {\n importDeclarations.push(node)\n }\n\n if (extractStyledDefinitions) {\n if (valid) {\n if (node.specifiers.some((specifier) => specifier.local.name === 'styled')) {\n doesUseValidImport = true\n break\n }\n }\n }\n\n if (valid) {\n const names = node.specifiers.map((specifier) => specifier.local.name)\n const isValidComponent = names.some((name) =>\n Boolean(isValidImport(propsWithFileInfo, moduleName, name) || validHooks[name])\n )\n if (shouldPrintDebug === 'verbose') {\n logger.info(\n `import ${names.join(', ')} from ${moduleName} isValidComponent ${isValidComponent}`\n )\n }\n if (isValidComponent) {\n doesUseValidImport = true\n break\n }\n }\n }\n\n if (shouldPrintDebug) {\n logger.info(`file: ${sourcePath} ${JSON.stringify({ doesUseValidImport, hasImportedTheme })}`)\n }\n\n if (!doesUseValidImport) {\n return null\n }\n\n function getValidImportedComponent(componentName: string) {\n const importDeclaration = importDeclarations.find((dec) =>\n dec.specifiers.some((spec) => spec.local.name === componentName)\n )\n if (!importDeclaration) {\n return null\n }\n return getValidImport(propsWithFileInfo, importDeclaration.source.value, componentName)\n }\n\n tm.mark('import-check', !!shouldPrintDebug)\n\n let couldntParse = false\n const modifiedComponents = new Set<NodePath<any>>()\n\n // only keeping a cache around per-file, reset it if it changes\n const bindingCache: Record<string, string | null> = {}\n\n const callTraverse = (a: TraverseOptions<any>) => {\n return fileOrPath.type === 'File' ? traverse(fileOrPath, a) : fileOrPath.traverse(a)\n }\n\n const shouldDisableExtraction =\n disableExtraction === true ||\n (Array.isArray(disableExtraction) && disableExtraction.includes(sourcePath))\n\n /**\n * Step 2: Statically extract from JSX < /> nodes\n */\n let programPath: NodePath<t.Program> | null = null\n\n const res = {\n styled: 0,\n flattened: 0,\n optimized: 0,\n modified: 0,\n found: 0,\n }\n\n callTraverse({\n // @ts-ignore\n Program: {\n enter(path) {\n programPath = path\n },\n },\n\n // styled() calls\n CallExpression(path) {\n if (disable || shouldDisableExtraction || extractStyledDefinitions === false) {\n return\n }\n\n if (!t.isIdentifier(path.node.callee) || path.node.callee.name !== 'styled') {\n return\n }\n\n const variableName =\n t.isVariableDeclarator(path.parent) && t.isIdentifier(path.parent.id)\n ? path.parent.id.name\n : 'unknown'\n\n const parentNode = path.node.arguments[0]\n if (!t.isIdentifier(parentNode)) {\n return\n }\n const parentName = parentNode.name\n const definition = path.node.arguments[1]\n\n if (!parentName || !definition || !t.isObjectExpression(definition)) {\n return\n }\n\n const Component = getValidImportedComponent(parentName)\n\n // if (!Component) {\n // if (disableExtractFoundComponents === true) {\n // return\n // }\n // if (\n // Array.isArray(disableExtractFoundComponents) &&\n // disableExtractFoundComponents.includes(parentName)\n // ) {\n // return\n // }\n\n // try {\n // if (shouldPrintDebug) {\n // logger.info(\n // `Unknown component ${parentName}, attempting dynamic load: ${sourcePath}`\n // )\n // }\n\n // const out = loadTamaguiSync({\n // forceExports: true,\n // components: [sourcePath],\n // })\n\n // if (!out?.components) {\n // if (shouldPrintDebug) {\n // logger.info(`Couldn't load, got ${out}`)\n // }\n // return\n // }\n\n // propsWithFileInfo.allLoadedComponents = [\n // ...propsWithFileInfo.allLoadedComponents,\n // ...out.components,\n // ]\n\n // Component = out.components.flatMap((x) => x.nameToInfo[variableName] ?? [])[0]\n\n // if (shouldPrintDebug === 'verbose') {\n // logger.info([`Tamagui Loaded`, JSON.stringify(out.components), !!Component].join(' '))\n // }\n // } catch (err: any) {\n // if (shouldPrintDebug) {\n // logger.info(\n // `${getPrefixLogs(\n // options\n // )} skip optimize styled(${variableName}), unable to pre-process (DEBUG=tamagui for more)`\n // )\n // }\n // if (process.env.DEBUG === 'tamagui') {\n // logger.info(\n // ` Disable this with \"disableExtractFoundComponents\" in your build-time configuration. \\n\\n ${err.message} ${err.stack}`\n // )\n // }\n // }\n // }\n\n if (!Component) {\n return\n }\n\n const componentSkipProps = new Set([\n ...(Component.staticConfig.inlineWhenUnflattened || []),\n ...(Component.staticConfig.inlineProps || []),\n ...(Component.staticConfig.deoptProps || []),\n // for now skip variants, will return to them\n 'variants',\n 'defaultVariants',\n // skip fontFamily its basically a \"variant\", important for theme use to be value always\n 'fontFamily',\n 'name',\n ])\n\n // for now dont parse variants, spreads, etc\n const skipped: (t.ObjectProperty | t.SpreadElement | t.ObjectMethod)[] = []\n const styles = {}\n\n // Generate scope object at this level\n const staticNamespace = getStaticBindingsForScope(\n path.scope,\n importsWhitelist,\n sourcePath,\n bindingCache,\n shouldPrintDebug\n )\n\n const attemptEval = !evaluateVars\n ? evaluateAstNode\n : createEvaluator({\n props: propsWithFileInfo,\n staticNamespace,\n sourcePath,\n shouldPrintDebug,\n })\n const attemptEvalSafe = createSafeEvaluator(attemptEval)\n\n for (const property of definition.properties) {\n if (\n !t.isObjectProperty(property) ||\n !t.isIdentifier(property.key) ||\n !isValidStyleKey(property.key.name, Component.staticConfig) ||\n // skip variants\n Component.staticConfig.variants?.[property.key.name] ||\n componentSkipProps.has(property.key.name)\n ) {\n skipped.push(property)\n continue\n }\n // attempt eval\n const out = attemptEvalSafe(property.value)\n if (out === FAILED_EVAL) {\n skipped.push(property)\n } else {\n styles[property.key.name] = out\n }\n }\n\n const out = getSplitStyles(\n styles,\n Component.staticConfig,\n defaultTheme,\n {\n focus: false,\n hover: false,\n unmounted: true,\n press: false,\n pressIn: false,\n resolveVariablesAs: 'variable',\n noClassNames: false,\n },\n undefined,\n undefined,\n undefined,\n shouldPrintDebug\n )\n\n const classNames = {\n ...out.classNames,\n }\n\n // // add in the style object as classnames\n // const atomics = getStylesAtomic(out.style)\n // for (const atomic of atomics) {\n // out.rulesToInsert = out.rulesToInsert || []\n // out.rulesToInsert.push(atomic)\n // classNames[atomic.property] = atomic.identifier\n // }\n\n if (shouldPrintDebug) {\n // prettier-ignore\n logger.info([`Extracted styled(${variableName})\\n`, JSON.stringify(styles, null, 2), '\\n rulesToInsert:', out.rulesToInsert.flatMap((rule) => rule.rules).join('\\n')].join(' '))\n }\n\n // leave only un-parsed props...\n definition.properties = skipped\n\n // ... + key: className\n for (const cn in classNames) {\n if (componentSkipProps.has(cn)) {\n continue\n }\n const val = classNames[cn]\n definition.properties.push(t.objectProperty(t.stringLiteral(cn), t.stringLiteral(val)))\n }\n\n if (out.rulesToInsert) {\n for (const { identifier, rules } of out.rulesToInsert) {\n onStyleRule?.(identifier, rules)\n }\n }\n\n res.styled++\n\n if (shouldPrintDebug) {\n logger.info(`Extracted styled(${variableName})`)\n }\n },\n\n JSXElement(traversePath) {\n tm.mark('jsx-element', !!shouldPrintDebug)\n\n const node = traversePath.node.openingElement\n const ogAttributes = node.attributes.map((attr) => ({ ...attr }))\n const componentName = findComponentName(traversePath.scope)\n const closingElement = traversePath.node.closingElement\n\n // skip non-identifier opening elements (member expressions, etc.)\n if (t.isJSXMemberExpression(closingElement?.name) || !t.isJSXIdentifier(node.name)) {\n return\n }\n\n // validate its a proper import from tamagui (or internally inside tamagui)\n const binding = traversePath.scope.getBinding(node.name.name)\n let modulePath = ''\n\n if (binding) {\n if (!t.isImportDeclaration(binding.path.parent)) {\n if (shouldPrintDebug) {\n logger.info(` - Binding not import declaration, skip`)\n }\n return\n }\n modulePath = binding.path.parent.source.value\n if (!isValidImport(propsWithFileInfo, modulePath, binding.identifier.name)) {\n if (shouldPrintDebug) {\n logger.info(` - Binding not internal import or from components ${modulePath}`)\n }\n return\n }\n }\n\n const component = getValidComponent(propsWithFileInfo, modulePath, node.name.name)\n if (!component || !component.staticConfig) {\n if (shouldPrintDebug) {\n logger.info(` - No Tamagui conf on this: ${node.name.name}`)\n }\n return\n }\n\n const originalNodeName = node.name.name\n\n // found a valid tag\n res.found++\n\n const filePath = `./${relative(process.cwd(), sourcePath)}`\n const lineNumbers = node.loc\n ? node.loc.start.line +\n (node.loc.start.line !== node.loc.end.line ? `-${node.loc.end.line}` : '')\n : ''\n\n const codePosition = `${filePath}:${lineNumbers}`\n\n // debug just one\n const debugPropValue = node.attributes\n .filter(\n (n) => t.isJSXAttribute(n) && t.isJSXIdentifier(n.name) && n.name.name === 'debug'\n )\n // @ts-ignore\n .map((n: t.JSXAttribute) => {\n if (n.value === null) return true\n if (t.isStringLiteral(n.value)) return n.value.value as 'verbose'\n return false\n })[0] as boolean | 'verbose' | undefined\n\n if (debugPropValue) {\n shouldPrintDebug = debugPropValue\n }\n\n if (shouldPrintDebug) {\n logger.info('\\n')\n logger.info(\n `\\x1b[33m%s\\x1b[0m ` + `${componentName} | ${codePosition} -------------------`\n )\n // prettier-ignore\n logger.info(['\\x1b[1m', '\\x1b[32m', `<${originalNodeName} />`, disableDebugAttr ? '' : '\uD83D\uDC1B'].join(' '))\n }\n\n // add data-* debug attributes\n if (shouldAddDebugProp && !disableDebugAttr) {\n res.modified++\n node.attributes.unshift(\n t.jsxAttribute(t.jsxIdentifier('data-is'), t.stringLiteral(node.name.name))\n )\n if (componentName) {\n node.attributes.unshift(\n t.jsxAttribute(t.jsxIdentifier('data-in'), t.stringLiteral(componentName))\n )\n }\n\n node.attributes.unshift(\n t.jsxAttribute(\n t.jsxIdentifier('data-at'),\n t.stringLiteral(`${basename(filePath)}:${lineNumbers}`)\n )\n )\n }\n\n if (shouldDisableExtraction) {\n return\n }\n\n try {\n const { staticConfig } = component\n const variants = staticConfig.variants || {}\n const isTextView = staticConfig.isText || false\n const validStyles = staticConfig?.validStyles ?? {}\n\n // find tag=\"a\" tag=\"main\" etc dom indicators\n let tagName = staticConfig.defaultProps.tag ?? (isTextView ? 'span' : 'div')\n traversePath\n .get('openingElement')\n .get('attributes')\n .forEach((path) => {\n const attr = path.node\n if (t.isJSXSpreadAttribute(attr)) return\n if (attr.name.name !== 'tag') return\n const val = attr.value\n if (!t.isStringLiteral(val)) return\n tagName = val.value\n })\n\n const flatNode = getFlattenedNode?.({ isTextView, tag: tagName })\n\n const inlineProps = new Set([\n ...(restProps.inlineProps || []),\n ...(staticConfig.inlineProps || []),\n ])\n\n const deoptProps = new Set([\n // always de-opt animation\n 'animation',\n ...(restProps.deoptProps || []),\n ...(staticConfig.deoptProps || []),\n ])\n\n const inlineWhenUnflattened = new Set([...(staticConfig.inlineWhenUnflattened || [])])\n\n // Generate scope object at this level\n const staticNamespace = getStaticBindingsForScope(\n traversePath.scope,\n importsWhitelist,\n sourcePath,\n bindingCache,\n shouldPrintDebug\n )\n\n const attemptEval = !evaluateVars\n ? evaluateAstNode\n : createEvaluator({\n props: propsWithFileInfo,\n staticNamespace,\n sourcePath,\n traversePath,\n shouldPrintDebug,\n })\n const attemptEvalSafe = createSafeEvaluator(attemptEval)\n\n if (shouldPrintDebug) {\n logger.info(` staticNamespace ${Object.keys(staticNamespace).join(', ')}`)\n }\n\n //\n // SPREADS SETUP\n //\n\n // TODO restore\n // const hasDeopt = (obj: Object) => {\n // return Object.keys(obj).some(isDeoptedProp)\n // }\n\n // flatten any easily evaluatable spreads\n const flattenedAttrs: (t.JSXAttribute | t.JSXSpreadAttribute)[] = []\n traversePath\n .get('openingElement')\n .get('attributes')\n .forEach((path) => {\n const attr = path.node\n if (!t.isJSXSpreadAttribute(attr)) {\n flattenedAttrs.push(attr)\n return\n }\n let arg: any\n try {\n arg = attemptEval(attr.argument)\n } catch (e: any) {\n if (shouldPrintDebug) {\n logger.info([' couldnt parse spread', e.message].join(' '))\n }\n flattenedAttrs.push(attr)\n return\n }\n if (arg !== undefined) {\n try {\n if (typeof arg !== 'object' || arg == null) {\n if (shouldPrintDebug) {\n logger.info([' non object or null arg', arg].join(' '))\n }\n flattenedAttrs.push(attr)\n } else {\n for (const k in arg) {\n const value = arg[k]\n // this is a null prop:\n if (!value && typeof value === 'object') {\n logger.error(['Unhandled null prop', k, value, arg].join(' '))\n continue\n }\n flattenedAttrs.push(\n t.jsxAttribute(\n t.jsxIdentifier(k),\n t.jsxExpressionContainer(literalToAst(value))\n )\n )\n }\n }\n } catch (err) {\n logger.warn(`cant parse spread, caught err ${err}`)\n couldntParse = true\n }\n }\n })\n\n if (couldntParse) {\n return\n }\n\n tm.mark('jsx-element-flattened', !!shouldPrintDebug)\n\n // set flattened\n node.attributes = flattenedAttrs\n\n let attrs: ExtractedAttr[] = []\n let shouldDeopt = false\n const inlined = new Map<string, any>()\n const variantValues = new Map<string, any>()\n let hasSetOptimized = false\n const inlineWhenUnflattenedOGVals = {}\n\n // RUN first pass\n\n // normalize all conditionals so we can evaluate away easier later\n // at the same time lets normalize shorthand media queries into spreads:\n // that way we can parse them with the same logic later on\n //\n // {...media.sm && { color: x ? 'red' : 'blue' }}\n // => {...media.sm && x && { color: 'red' }}\n // => {...media.sm && !x && { color: 'blue' }}\n //\n // $sm={{ color: 'red' }}\n // => {...media.sm && { color: 'red' }}\n //\n // $sm={{ color: x ? 'red' : 'blue' }}\n // => {...media.sm && x && { color: 'red' }}\n // => {...media.sm && !x && { color: 'blue' }}\n\n attrs = traversePath\n .get('openingElement')\n .get('attributes')\n .flatMap((path) => {\n try {\n const res = evaluateAttribute(path)\n tm.mark('jsx-element-evaluate-attr', !!shouldPrintDebug)\n if (!res) {\n path.remove()\n }\n return res\n } catch (err: any) {\n if (shouldPrintDebug) {\n logger.info(\n [\n 'Recoverable error extracting attribute',\n err.message,\n shouldPrintDebug === 'verbose' ? err.stack : '',\n ].join(' ')\n )\n if (shouldPrintDebug === 'verbose') {\n logger.info(`node ${path.node?.type}`)\n }\n }\n // dont flatten if we run into error\n inlined.set(`${Math.random()}`, 'spread')\n return {\n type: 'attr',\n value: path.node,\n } as const\n }\n })\n .flat(4)\n .filter(isPresent)\n\n if (shouldPrintDebug) {\n logger.info(\n [' - attrs (before):\\n', logLines(attrs.map(attrStr).join(', '))].join(' ')\n )\n }\n\n // START function evaluateAttribute\n function evaluateAttribute(\n path: NodePath<t.JSXAttribute | t.JSXSpreadAttribute>\n ): ExtractedAttr | ExtractedAttr[] | null {\n const attribute = path.node\n const attr: ExtractedAttr = { type: 'attr', value: attribute }\n // ...spreads\n if (t.isJSXSpreadAttribute(attribute)) {\n const arg = attribute.argument\n const conditional = t.isConditionalExpression(arg)\n ? // <YStack {...isSmall ? { color: 'red } : { color: 'blue }}\n ([arg.test, arg.consequent, arg.alternate] as const)\n : t.isLogicalExpression(arg) && arg.operator === '&&'\n ? // <YStack {...isSmall && { color: 'red }}\n ([arg.left, arg.right, null] as const)\n : null\n\n if (conditional) {\n const [test, alt, cons] = conditional\n if (!test) throw new Error(`no test`)\n if ([alt, cons].some((side) => side && !isStaticObject(side))) {\n if (shouldPrintDebug) {\n logger.info(`not extractable ${alt} ${cons}`)\n }\n return attr\n }\n // split into individual ternaries per object property\n return [\n ...(createTernariesFromObjectProperties(test, alt) || []),\n ...((cons &&\n createTernariesFromObjectProperties(t.unaryExpression('!', test), cons)) ||\n []),\n ].map((ternary) => ({\n type: 'ternary',\n value: ternary,\n }))\n }\n }\n // END ...spreads\n\n // directly keep these\n // couldn't evaluate spread, undefined name, or name is not string\n if (\n t.isJSXSpreadAttribute(attribute) ||\n !attribute.name ||\n typeof attribute.name.name !== 'string'\n ) {\n if (shouldPrintDebug) {\n logger.info(' ! inlining, spread attr')\n }\n inlined.set(`${Math.random()}`, 'spread')\n return attr\n }\n\n const name = attribute.name.name\n\n if (excludeProps?.has(name)) {\n if (shouldPrintDebug) {\n logger.info([' excluding prop', name].join(' '))\n }\n return null\n }\n\n if (inlineProps.has(name)) {\n inlined.set(name, name)\n if (shouldPrintDebug) {\n logger.info([' ! inlining, inline prop', name].join(' '))\n }\n return attr\n }\n\n // can still optimize the object... see hoverStyle on native\n if (deoptProps.has(name)) {\n shouldDeopt = true\n inlined.set(name, name)\n if (shouldPrintDebug) {\n logger.info([' ! inlining, deopted prop', name].join(' '))\n }\n return attr\n }\n\n // pass className, key, and style props through untouched\n if (UNTOUCHED_PROPS[name]) {\n return attr\n }\n\n if (INLINE_EXTRACTABLE[name]) {\n inlined.set(name, INLINE_EXTRACTABLE[name])\n return attr\n }\n\n if (name.startsWith('data-')) {\n return attr\n }\n\n // shorthand media queries\n if (name[0] === '$' && t.isJSXExpressionContainer(attribute?.value)) {\n const shortname = name.slice(1)\n if (mediaQueryConfig[shortname]) {\n if (target === 'native') {\n shouldDeopt = true\n }\n\n // allow disabling this extraction\n if (disableExtractInlineMedia) {\n return attr\n }\n\n const expression = attribute.value.expression\n if (!t.isJSXEmptyExpression(expression)) {\n const ternaries = createTernariesFromObjectProperties(\n t.stringLiteral(shortname),\n expression,\n {\n inlineMediaQuery: shortname,\n }\n )\n if (ternaries) {\n return ternaries.map((value) => ({\n type: 'ternary',\n value,\n }))\n }\n }\n }\n }\n\n const [value, valuePath] = (() => {\n if (t.isJSXExpressionContainer(attribute?.value)) {\n return [attribute.value.expression!, path.get('value')!] as const\n } else {\n return [attribute.value!, path.get('value')!] as const\n }\n })()\n\n const remove = () => {\n Array.isArray(valuePath) ? valuePath.map((p) => p.remove()) : valuePath.remove()\n }\n\n if (name === 'ref') {\n if (shouldPrintDebug) {\n logger.info([' ! inlining, ref', name].join(' '))\n }\n inlined.set('ref', 'ref')\n return attr\n }\n\n if (name === 'tag') {\n return {\n type: 'attr',\n value: path.node,\n }\n }\n\n // native shouldn't extract variables\n if (disableExtractVariables === true) {\n if (value) {\n if (value.type === 'StringLiteral' && value.value[0] === '$') {\n if (shouldPrintDebug) {\n logger.info(\n [` ! inlining, native disable extract: ${name} =`, value.value].join(' ')\n )\n }\n inlined.set(name, true)\n return attr\n }\n }\n }\n\n if (name === 'theme') {\n inlined.set('theme', attr.value)\n return attr\n }\n\n // if value can be evaluated, extract it and filter it out\n const styleValue = attemptEvalSafe(value)\n\n // never flatten if a prop isn't a valid static attribute\n // only post prop-mapping\n if (!variants[name] && !isValidStyleKey(name, staticConfig)) {\n let keys = [name]\n let out: any = null\n\n // for now passing empty props {}, a bit odd, need to at least document\n // for now we don't expose custom components so just noting behavior\n out = staticConfig.propMapper(\n name,\n styleValue,\n defaultTheme,\n staticConfig.defaultProps,\n { resolveVariablesAs: 'auto' },\n undefined,\n undefined,\n shouldPrintDebug\n )\n\n if (out) {\n if (!Array.isArray(out)) {\n logger.warn(`Error expected array but got`, out)\n couldntParse = true\n shouldDeopt = true\n } else {\n out = Object.fromEntries(out)\n keys = Object.keys(out)\n }\n }\n if (out) {\n if (isTargetingHTML) {\n // translate to DOM-compat\n out = createDOMProps(isTextView ? 'span' : 'div', out)\n // remove className - we dont use rnw styling\n delete out.className\n }\n\n keys = Object.keys(out)\n }\n\n let didInline = false\n const attributes = keys.map((key) => {\n const val = out[key]\n if (isValidStyleKey(key, staticConfig)) {\n return {\n type: 'style',\n value: { [key]: styleValue },\n name: key,\n attr: path.node,\n } as const\n }\n if (\n validHTMLAttributes[key] ||\n key.startsWith('aria-') ||\n key.startsWith('data-') ||\n // this is debug stuff added by vite / new jsx transform\n key === '__source' ||\n key === '__self'\n ) {\n return attr\n }\n if (shouldPrintDebug) {\n logger.info(' ! inlining, non-static ' + key)\n }\n didInline = true\n inlined.set(key, val)\n return val\n })\n\n // weird logic whats going on here\n if (didInline) {\n if (shouldPrintDebug) {\n logger.info(` bailing flattening due to attributes ${attributes}`)\n }\n // bail\n return attr\n }\n\n // return evaluated attributes\n return attributes\n }\n\n // FAILED = dynamic or ternary, keep going\n if (styleValue !== FAILED_EVAL) {\n if (inlineWhenUnflattened.has(name)) {\n // preserve original value for restoration\n inlineWhenUnflattenedOGVals[name] = { styleValue, attr }\n }\n\n if (isValidStyleKey(name, staticConfig)) {\n if (shouldPrintDebug) {\n logger.info(` style: ${name} = ${styleValue}`)\n }\n if (!(name in staticConfig.defaultProps)) {\n if (!hasSetOptimized) {\n res.optimized++\n hasSetOptimized = true\n }\n }\n return {\n type: 'style',\n value: { [name]: styleValue },\n name,\n attr: path.node,\n }\n } else {\n if (variants[name]) {\n variantValues.set(name, styleValue)\n }\n inlined.set(name, true)\n return attr\n }\n }\n\n // ternaries!\n\n // binary ternary, we can eventually make this smarter but step 1\n // basically for the common use case of:\n // opacity={(conditional ? 0 : 1) * scale}\n if (t.isBinaryExpression(value)) {\n if (shouldPrintDebug) {\n logger.info(` binary expression ${name} = ${value}`)\n }\n const { operator, left, right } = value\n // if one side is a ternary, and the other side is evaluatable, we can maybe extract\n const lVal = attemptEvalSafe(left)\n const rVal = attemptEvalSafe(right)\n if (shouldPrintDebug) {\n logger.info(` evalBinaryExpression lVal ${String(lVal)}, rVal ${String(rVal)}`)\n }\n if (lVal !== FAILED_EVAL && t.isConditionalExpression(right)) {\n const ternary = addBinaryConditional(operator, left, right)\n if (ternary) return ternary\n }\n if (rVal !== FAILED_EVAL && t.isConditionalExpression(left)) {\n const ternary = addBinaryConditional(operator, right, left)\n if (ternary) return ternary\n }\n if (shouldPrintDebug) {\n logger.info(` evalBinaryExpression cant extract`)\n }\n inlined.set(name, true)\n return attr\n }\n\n const staticConditional = getStaticConditional(value)\n if (staticConditional) {\n if (shouldPrintDebug === 'verbose') {\n logger.info(` static conditional ${name} ${value}`)\n }\n return { type: 'ternary', value: staticConditional }\n }\n\n const staticLogical = getStaticLogical(value)\n if (staticLogical) {\n if (shouldPrintDebug === 'verbose') {\n logger.info(` static ternary ${name} = ${value}`)\n }\n return { type: 'ternary', value: staticLogical }\n }\n\n // if we've made it this far, the prop stays inline\n inlined.set(name, true)\n if (shouldPrintDebug) {\n logger.info(` ! inline no match ${name} ${value}`)\n }\n\n //\n // RETURN ATTR\n //\n return attr\n\n // attr helpers:\n function addBinaryConditional(\n operator: any,\n staticExpr: any,\n cond: t.ConditionalExpression\n ): ExtractedAttr | null {\n if (getStaticConditional(cond)) {\n const alt = attemptEval(t.binaryExpression(operator, staticExpr, cond.alternate))\n const cons = attemptEval(t.binaryExpression(operator, staticExpr, cond.consequent))\n if (shouldPrintDebug) {\n logger.info([' binaryConditional', cond.test, cons, alt].join(' '))\n }\n return {\n type: 'ternary',\n value: {\n test: cond.test,\n remove,\n alternate: { [name]: alt },\n consequent: { [name]: cons },\n },\n }\n }\n return null\n }\n\n function getStaticConditional(value: t.Node): Ternary | null {\n if (t.isConditionalExpression(value)) {\n try {\n const aVal = attemptEval(value.alternate)\n const cVal = attemptEval(value.consequent)\n if (shouldPrintDebug) {\n const type = value.test.type\n logger.info([' static ternary', type, cVal, aVal].join(' '))\n }\n return {\n test: value.test,\n remove,\n consequent: { [name]: cVal },\n alternate: { [name]: aVal },\n }\n } catch (err: any) {\n if (shouldPrintDebug) {\n logger.info([' cant eval ternary', err.message].join(' '))\n }\n }\n }\n return null\n }\n\n function getStaticLogical(value: t.Node): Ternary | null {\n if (t.isLogicalExpression(value)) {\n if (value.operator === '&&') {\n try {\n const val = attemptEval(value.right)\n if (shouldPrintDebug) {\n logger.info([' staticLogical', value.left, name, val].join(' '))\n }\n return {\n test: value.left,\n remove,\n consequent: { [name]: val },\n alternate: null,\n }\n } catch (err) {\n if (shouldPrintDebug) {\n logger.info([' cant static eval logical', err].join(' '))\n }\n }\n }\n }\n return null\n }\n } // END function evaluateAttribute\n\n function isStaticObject(obj: t.Node): obj is t.ObjectExpression {\n return (\n t.isObjectExpression(obj) &&\n obj.properties.every((prop) => {\n if (!t.isObjectProperty(prop)) {\n logger.info(['not object prop', prop].join(' '))\n return false\n }\n const propName = prop.key['name']\n if (!isValidStyleKey(propName, staticConfig) && propName !== 'tag') {\n if (shouldPrintDebug) {\n logger.info([' not a valid style prop!', propName].join(' '))\n }\n return false\n }\n return true\n })\n )\n }\n\n // side = {\n // color: 'red',\n // background: x ? 'red' : 'green',\n // $gtSm: { color: 'green' }\n // }\n // => Ternary<test, { color: 'red' }, null>\n // => Ternary<test && x, { background: 'red' }, null>\n // => Ternary<test && !x, { background: 'green' }, null>\n // => Ternary<test && '$gtSm', { color: 'green' }, null>\n function createTernariesFromObjectProperties(\n test: t.Expression,\n side: t.Expression | null,\n ternaryPartial: Partial<Ternary> = {}\n ): null | Ternary[] {\n if (!side) {\n return null\n }\n if (!isStaticObject(side)) {\n throw new Error('not extractable')\n }\n return side.properties.flatMap((property) => {\n if (!t.isObjectProperty(property)) {\n throw new Error('expected object property')\n }\n // handle media queries inside spread/conditional objects\n if (t.isIdentifier(property.key)) {\n const key = property.key.name\n const mediaQueryKey = key.slice(1)\n const isMediaQuery = key[0] === '$' && mediaQueryConfig[mediaQueryKey]\n if (isMediaQuery) {\n if (t.isExpression(property.value)) {\n const ternaries = createTernariesFromObjectProperties(\n t.stringLiteral(mediaQueryKey),\n property.value,\n {\n inlineMediaQuery: mediaQueryKey,\n }\n )\n if (ternaries) {\n return ternaries.map((value) => ({\n ...ternaryPartial,\n ...value,\n // ensure media query test stays on left side (see getMediaQueryTernary)\n test: t.logicalExpression('&&', value.test, test),\n }))\n } else {\n logger.info(['\u26A0\uFE0F no ternaries?', property].join(' '))\n }\n } else {\n logger.info(['\u26A0\uFE0F not expression', property].join(' '))\n }\n }\n }\n // this could be a recurse here if we want to get fancy\n if (t.isConditionalExpression(property.value)) {\n // merge up into the parent conditional, split into two\n const [truthy, falsy] = [\n t.objectExpression([t.objectProperty(property.key, property.value.consequent)]),\n t.objectExpression([t.objectProperty(property.key, property.value.alternate)]),\n ].map((x) => attemptEval(x))\n return [\n createTernary({\n remove() {},\n ...ternaryPartial,\n test: t.logicalExpression('&&', test, property.value.test),\n consequent: truthy,\n alternate: null,\n }),\n createTernary({\n ...ternaryPartial,\n test: t.logicalExpression(\n '&&',\n test,\n t.unaryExpression('!', property.value.test)\n ),\n consequent: falsy,\n alternate: null,\n remove() {},\n }),\n ]\n }\n const obj = t.objectExpression([t.objectProperty(property.key, property.value)])\n const consequent = attemptEval(obj)\n return createTernary({\n remove() {},\n ...ternaryPartial,\n test,\n consequent,\n alternate: null,\n })\n })\n }\n\n if (couldntParse || shouldDeopt) {\n if (shouldPrintDebug) {\n logger.info([` avoid optimizing:`, { couldntParse, shouldDeopt }].join(' '))\n }\n node.attributes = ogAttributes\n return\n }\n\n // now update to new values\n node.attributes = attrs.filter(isAttr).map((x) => x.value)\n\n // before deopt, can still optimize\n const parentFn = findTopmostFunction(traversePath)\n if (parentFn) {\n modifiedComponents.add(parentFn)\n }\n\n // combine ternaries\n let ternaries: Ternary[] = []\n attrs = attrs\n .reduce<(ExtractedAttr | ExtractedAttr[])[]>((out, cur) => {\n const next = attrs[attrs.indexOf(cur) + 1]\n if (cur.type === 'ternary') {\n ternaries.push(cur.value)\n }\n if ((!next || next.type !== 'ternary') && ternaries.length) {\n // finish, process\n const normalized = normalizeTernaries(ternaries).map(\n ({ alternate, consequent, ...rest }) => {\n return {\n type: 'ternary' as const,\n value: {\n ...rest,\n alternate: alternate || null,\n consequent: consequent || null,\n },\n }\n }\n )\n try {\n return [...out, ...normalized]\n } finally {\n if (shouldPrintDebug) {\n logger.info(\n ` normalizeTernaries (${ternaries.length} => ${normalized.length})`\n )\n }\n ternaries = []\n }\n }\n if (cur.type === 'ternary') {\n return out\n }\n out.push(cur)\n return out\n }, [])\n .flat()\n\n // flatten logic!\n // fairly simple check to see if all children are text\n const hasSpread = node.attributes.some((x) => t.isJSXSpreadAttribute(x))\n\n const hasOnlyStringChildren =\n !hasSpread &&\n (node.selfClosing ||\n (traversePath.node.children &&\n traversePath.node.children.every((x) => x.type === 'JSXText')))\n\n const themeVal = inlined.get('theme')\n\n // on native we can't flatten when theme prop is set\n if (target !== 'native') {\n inlined.delete('theme')\n }\n\n for (const [key] of [...inlined]) {\n const isStaticObjectVariant = staticConfig.variants?.[key] && variantValues.has(key)\n if (INLINE_EXTRACTABLE[key] || isStaticObjectVariant) {\n inlined.delete(key)\n }\n }\n\n const canFlattenProps = inlined.size === 0\n\n let shouldFlatten = Boolean(\n flatNode &&\n !shouldDeopt &&\n canFlattenProps &&\n !hasSpread &&\n staticConfig.neverFlatten !== true &&\n (staticConfig.neverFlatten === 'jsx' ? hasOnlyStringChildren : true)\n )\n\n const shouldWrapTheme = shouldFlatten && themeVal\n const usedThemeKeys = new Set<string>()\n\n if (disableExtractVariables) {\n // if it accesses any theme values during evaluation\n themeAccessListeners.add((key) => {\n shouldFlatten = false\n usedThemeKeys.add(key)\n if (shouldPrintDebug === 'verbose') {\n logger.info([' ! accessing theme key, avoid flatten', key].join(' '))\n }\n })\n }\n\n if (shouldPrintDebug) {\n try {\n // prettier-ignore\n logger.info([' flatten?', objToStr({ hasSpread, shouldDeopt, shouldFlatten, canFlattenProps, shouldWrapTheme, hasOnlyStringChildren }), 'inlined', [...inlined]].join(' '))\n } catch {\n // ok\n }\n }\n\n // wrap theme around children on flatten\n // TODO move this to bottom and re-check shouldFlatten\n // account for shouldFlatten could change w the above block \"if (disableExtractVariables)\"\n if (shouldFlatten && shouldWrapTheme) {\n if (!programPath) {\n console.warn(\n `No program path found, avoiding importing flattening / importing theme in ${sourcePath}`\n )\n } else {\n if (shouldPrintDebug) {\n logger.info([' - wrapping theme', themeVal].join(' '))\n }\n\n // remove theme attribute from flattened node\n attrs = attrs.filter((x) =>\n x.type === 'attr' && t.isJSXAttribute(x.value) && x.value.name.name === 'theme'\n ? false\n : true\n )\n\n // add import\n if (!hasImportedTheme) {\n hasImportedTheme = true\n programPath.node.body.push(\n t.importDeclaration(\n [t.importSpecifier(t.identifier('_TamaguiTheme'), t.identifier('Theme'))],\n t.stringLiteral('@tamagui/core')\n )\n )\n }\n\n traversePath.replaceWith(\n t.jsxElement(\n t.jsxOpeningElement(t.jsxIdentifier('_TamaguiTheme'), [\n t.jsxAttribute(t.jsxIdentifier('name'), themeVal.value),\n ]),\n t.jsxClosingElement(t.jsxIdentifier('_TamaguiTheme')),\n [traversePath.node]\n )\n )\n }\n }\n\n // only if we flatten, ensure the default styles are there\n if (shouldFlatten) {\n const defaultStyleAttrs = Object.keys(staticConfig.defaultProps).flatMap((key) => {\n if (!isValidStyleKey(key, staticConfig)) {\n return []\n }\n const value = staticConfig.defaultProps[key]\n const name = tamaguiConfig.shorthands[key] || key\n if (value === undefined) {\n logger.warn(`\u26A0\uFE0F Error evaluating default style for component, prop ${key} ${value}`)\n shouldDeopt = true\n return\n }\n const attr: ExtractedAttrStyle = {\n type: 'style',\n name,\n value: { [name]: value },\n }\n return attr\n }) as ExtractedAttr[]\n\n if (defaultStyleAttrs.length) {\n attrs = [...defaultStyleAttrs, ...attrs]\n }\n }\n\n if (shouldDeopt || !shouldFlatten) {\n if (shouldPrintDebug) {\n logger.info(`Deopting`)\n }\n node.attributes = ogAttributes\n return\n }\n\n if (shouldPrintDebug) {\n logger.info(\n [' - attrs (flattened): \\n', logLines(attrs.map(attrStr).join(', '))].join(' ')\n )\n }\n\n const state = {\n noClassNames: false,\n focus: false,\n hover: false,\n unmounted: false, // TODO match logic in createComponent\n press: false,\n pressIn: false,\n }\n\n // evaluates all static attributes into a simple object\n let foundStaticProps = {}\n for (const key in attrs) {\n const cur = attrs[key]\n if (cur.type === 'style') {\n // remove variants because they are processed later, and can lead to invalid values here\n // see <Spacer flex /> where flex looks like a valid style, but is a variant\n foundStaticProps = {\n ...foundStaticProps,\n ...expandStylesWithoutVariants(cur.value),\n }\n continue\n }\n if (cur.type === 'attr') {\n if (t.isJSXSpreadAttribute(cur.value)) {\n continue\n }\n if (!t.isJSXIdentifier(cur.value.name)) {\n continue\n }\n const key = cur.value.name.name\n // undefined = boolean true\n const value = attemptEvalSafe(cur.value.value || t.booleanLiteral(true))\n if (value !== FAILED_EVAL) {\n foundStaticProps = {\n ...foundStaticProps,\n [key]: value,\n }\n }\n }\n }\n\n // must preserve exact order\n const completeProps = {}\n for (const key in staticConfig.defaultProps) {\n if (!(key in foundStaticProps)) {\n completeProps[key] = staticConfig.defaultProps[key]\n }\n }\n for (const key in foundStaticProps) {\n completeProps[key] = foundStaticProps[key]\n }\n\n // expand shorthands, de-opt variables\n attrs = attrs.reduce<ExtractedAttr[]>((acc, cur) => {\n if (!cur) return acc\n if (cur.type === 'attr' && !t.isJSXSpreadAttribute(cur.value)) {\n if (shouldFlatten) {\n const name = cur.value.name.name\n if (typeof name === 'string') {\n if (name === 'tag') {\n // remove tag=\"\"\n return acc\n }\n\n // if flattening, expand variants\n if (variants[name] && variantValues.has(name)) {\n let out = Object.fromEntries(\n staticConfig.propMapper(\n name,\n variantValues.get(name),\n defaultTheme,\n completeProps,\n { ...state, resolveVariablesAs: 'auto' },\n undefined,\n undefined,\n shouldPrintDebug\n ) || []\n )\n if (out && isTargetingHTML) {\n const cn = out.className\n // translate to DOM-compat\n out = createDOMProps(isTextView ? 'span' : 'div', out)\n // remove rnw className use ours\n out.className = cn\n }\n if (shouldPrintDebug) {\n logger.info([' - expanded variant', name, out].join(' '))\n }\n for (const key in out) {\n const value = out[key]\n if (isValidStyleKey(key, staticConfig)) {\n acc.push({\n type: 'style',\n value: { [key]: value },\n name: key,\n attr: cur.value,\n } as const)\n } else {\n acc.push({\n type: 'attr',\n value: t.jsxAttribute(\n t.jsxIdentifier(key),\n t.jsxExpressionContainer(\n typeof value === 'string'\n ? t.stringLiteral(value)\n : literalToAst(value)\n )\n ),\n })\n }\n }\n }\n }\n }\n }\n\n if (cur.type !== 'style') {\n acc.push(cur)\n return acc\n }\n\n let key = Object.keys(cur.value)[0]\n const value = cur.value[key]\n const fullKey = tamaguiConfig.shorthands[key]\n // expand shorthands\n if (fullKey) {\n cur.value = { [fullKey]: value }\n key = fullKey\n }\n\n // finally we have all styles + expansions, lets see if we need to skip\n // any and keep them as attrs\n if (disableExtractVariables) {\n if (value[0] === '$' && (usedThemeKeys.has(key) || usedThemeKeys.has(fullKey))) {\n if (shouldPrintDebug) {\n logger.info([` keeping variable inline: ${key} =`, value].join(' '))\n }\n acc.push({\n type: 'attr',\n value: t.jsxAttribute(\n t.jsxIdentifier(key),\n t.jsxExpressionContainer(t.stringLiteral(value))\n ),\n })\n return acc\n }\n }\n\n acc.push(cur)\n return acc\n }, [])\n\n tm.mark('jsx-element-expanded', !!shouldPrintDebug)\n if (shouldPrintDebug) {\n logger.info(\n [' - attrs (expanded): \\n', logLines(attrs.map(attrStr).join(', '))].join(' ')\n )\n }\n\n // merge styles, leave undefined values\n let prev: ExtractedAttr | null = null\n\n function splitVariants(style: any) {\n const variants = {}\n const styles = {}\n for (const key in style) {\n if (staticConfig.variants?.[key]) {\n variants[key] = style[key]\n } else {\n styles[key] = style[key]\n }\n }\n return {\n variants,\n styles,\n }\n }\n\n function expandStylesWithoutVariants(style: any) {\n const { variants, styles } = splitVariants(style)\n return {\n ...expandStyles(styles),\n ...variants,\n }\n }\n\n function mergeStyles(prev: ViewStyle & PseudoStyles, nextIn: ViewStyle & PseudoStyles) {\n const next = expandStylesWithoutVariants(nextIn)\n for (const key in next) {\n // merge pseudos\n if (pseudoDescriptors[key]) {\n prev[key] = prev[key] || {}\n if (shouldPrintDebug) {\n if (!next[key] || !prev[key]) {\n logger.info(['warn: missing', key, prev, next].join(' '))\n }\n }\n Object.assign(prev[key], next[key])\n } else {\n prev[key] = next[key]\n }\n }\n }\n\n attrs = attrs.reduce<ExtractedAttr[]>((acc, cur) => {\n if (cur.type === 'style') {\n const key = Object.keys(cur.value)[0]\n const value = cur.value[key]\n\n const shouldKeepOriginalAttr =\n // !isStyleAndAttr[key] &&\n !shouldFlatten &&\n // de-opt if non-style\n !validStyles[key] &&\n !pseudoDescriptors[key] &&\n !key.startsWith('data-')\n\n if (shouldKeepOriginalAttr) {\n if (shouldPrintDebug) {\n logger.info([' - keeping as non-style', key].join(' '))\n }\n prev = cur\n acc.push({\n type: 'attr',\n value: t.jsxAttribute(\n t.jsxIdentifier(key),\n t.jsxExpressionContainer(\n typeof value === 'string' ? t.stringLiteral(value) : literalToAst(value)\n )\n ),\n })\n acc.push(cur)\n return acc\n }\n\n if (prev?.type === 'style') {\n mergeStyles(prev.value, cur.value)\n return acc\n }\n }\n\n prev = cur\n acc.push(cur)\n return acc\n }, [])\n\n if (shouldPrintDebug) {\n logger.info(\n [' - attrs (combined \uD83D\uDD00): \\n', logLines(attrs.map(attrStr).join(', '))].join(' ')\n )\n logger.info(\n [' - defaultProps: \\n', logLines(objToStr(staticConfig.defaultProps))].join(' ')\n )\n // prettier-ignore\n logger.info([' - foundStaticProps: \\n', logLines(objToStr(foundStaticProps))].join(' '))\n logger.info([' - completeProps: \\n', logLines(objToStr(completeProps))].join(' '))\n }\n\n // post process\n const getStyles = (props: Object | null, debugName = '') => {\n if (!props || !Object.keys(props).length) {\n if (shouldPrintDebug) logger.info([' getStyles() no props'].join(' '))\n return {}\n }\n if (excludeProps && !!excludeProps.size) {\n for (const key in props) {\n if (excludeProps.has(key)) {\n if (shouldPrintDebug) logger.info([' delete excluded', key].join(' '))\n delete props[key]\n }\n }\n }\n try {\n const out = getSplitStyles(\n props,\n staticConfig,\n defaultTheme,\n {\n ...state,\n fallbackProps: completeProps,\n },\n undefined,\n undefined,\n undefined,\n debugPropValue\n )\n\n const outStyle = {\n ...out.style,\n ...out.pseudos,\n }\n // omitInvalidStyles(outStyle)\n // if (shouldPrintDebug) {\n // // prettier-ignore\n // logger.info(` getStyles ${debugName} (props):\\n`, logLines(objToStr(props)))\n // // prettier-ignore\n // logger.info(` getStyles ${debugName} (out.viewProps):\\n`, logLines(objToStr(out.viewProps)))\n // // prettier-ignore\n // logger.info(` getStyles ${debugName} (out.style):\\n`, logLines(objToStr(outStyle || {}), true))\n // }\n return outStyle\n } catch (err: any) {\n logger.info(['error', err.message, err.stack].join(' '))\n return {}\n }\n }\n\n // used to ensure we pass the entire prop bundle to getStyles\n const completeStyles = getStyles(completeProps, 'completeStyles')\n\n if (!completeStyles) {\n throw new Error(`Impossible, no styles`)\n }\n\n const isNativeNotFlat = !shouldFlatten && target === 'native'\n if (isNativeNotFlat) {\n if (shouldPrintDebug) {\n logger.info(`Disabled flattening except for simple cases on native for now`)\n }\n node.attributes = ogAttributes\n return null\n }\n\n let getStyleError: any = null\n\n // fix up ternaries, combine final style values\n for (const attr of attrs) {\n try {\n switch (attr.type) {\n case 'ternary': {\n const a = getStyles(attr.value.alternate, 'ternary.alternate')\n const c = getStyles(attr.value.consequent, 'ternary.consequent')\n if (a) attr.value.alternate = a\n if (c) attr.value.consequent = c\n if (shouldPrintDebug) logger.info([' => tern ', attrStr(attr)].join(' '))\n continue\n }\n case 'style': {\n // expand variants and such\n const styles = getStyles(attr.value, 'style')\n if (styles) {\n attr.value = styles\n }\n // prettier-ignore\n if (shouldPrintDebug) logger.info([' * styles (in)', logLines(objToStr(attr.value))].join(' '))\n // prettier-ignore\n if (shouldPrintDebug) logger.info([' * styles (out)', logLines(objToStr(styles))].join(' '))\n continue\n }\n }\n } catch (err) {\n // any error de-opt\n getStyleError = err\n }\n }\n\n if (shouldPrintDebug) {\n // prettier-ignore\n logger.info([' - attrs (ternaries/combined):\\n', logLines(attrs.map(attrStr).join(', '))].join(' '))\n }\n\n tm.mark('jsx-element-styles', !!shouldPrintDebug)\n\n if (getStyleError) {\n logger.info([' \u26A0\uFE0F postprocessing error, deopt', getStyleError].join(' '))\n node.attributes = ogAttributes\n return null\n }\n\n // final lazy extra loop:\n const existingStyleKeys = new Set()\n for (let i = attrs.length - 1; i >= 0; i--) {\n const attr = attrs[i]\n\n // if flattening map inline props to proper flattened names\n if (shouldFlatten) {\n if (attr.type === 'attr') {\n if (t.isJSXAttribute(attr.value)) {\n if (t.isJSXIdentifier(attr.value.name)) {\n const name = attr.value.name.name\n if (INLINE_EXTRACTABLE[name]) {\n // map to HTML only name\n attr.value.name.name = INLINE_EXTRACTABLE[name]\n }\n }\n }\n }\n }\n\n // remove duplicate styles\n // so if you have:\n // style({ color: 'red' }), ...someProps, style({ color: 'green' })\n // this will mutate:\n // style({}), ...someProps, style({ color: 'green' })\n if (attr.type === 'style') {\n for (const key in attr.value) {\n if (existingStyleKeys.has(key)) {\n if (shouldPrintDebug) {\n logger.info([` >> delete existing ${key}`].join(' '))\n }\n delete attr.value[key]\n } else {\n existingStyleKeys.add(key)\n }\n }\n }\n }\n\n // inlineWhenUnflattened\n if (!shouldFlatten) {\n if (inlineWhenUnflattened.size) {\n for (const [index, attr] of attrs.entries()) {\n if (attr.type === 'style') {\n for (const key in attr.value) {\n if (!inlineWhenUnflattened.has(key)) continue\n const val = inlineWhenUnflattenedOGVals[key]\n if (val) {\n // delete the style\n delete attr.value[key]\n\n // and insert it before\n attrs.splice(index - 1, 0, val.attr)\n } else {\n // just delete it, it was added during expansion but should be left inline\n delete attr.value[key]\n }\n }\n }\n }\n }\n }\n\n if (shouldFlatten) {\n // DO FLATTEN\n if (shouldPrintDebug) {\n logger.info([' [\u2705] flattening', originalNodeName, flatNode].join(' '))\n }\n // @ts-ignore\n node.name.name = flatNode\n res.flattened++\n if (closingElement) {\n // @ts-ignore\n closingElement.name.name = flatNode\n }\n }\n\n if (shouldPrintDebug) {\n // prettier-ignore\n logger.info([` \u274A\u274A inline props (${inlined.size}):`, shouldDeopt ? ' deopted' : '', hasSpread ? ' has spread' : '', staticConfig.neverFlatten ? 'neverFlatten' : ''].join(' '))\n logger.info(` - attrs (end):\\n ${logLines(attrs.map(attrStr).join(', '))}`)\n }\n\n onExtractTag({\n parserProps: propsWithFileInfo,\n attrs,\n node,\n lineNumbers,\n filePath,\n attemptEval,\n jsxPath: traversePath,\n originalNodeName,\n isFlattened: shouldFlatten,\n programPath: programPath!,\n completeProps,\n staticConfig,\n })\n } finally {\n if (debugPropValue) {\n shouldPrintDebug = ogDebug\n }\n }\n },\n })\n\n tm.mark('jsx-done', !!shouldPrintDebug)\n\n /**\n * Step 3: Remove dead code from removed media query / theme hooks\n */\n if (modifiedComponents.size) {\n const all = Array.from(modifiedComponents)\n if (shouldPrintDebug) {\n logger.info(` [\uD83E\uDE9D] hook check ${all.length}`)\n }\n for (const comp of all) {\n removeUnusedHooks(comp, shouldPrintDebug)\n }\n }\n\n tm.done(shouldPrintDebug === 'verbose')\n\n return res\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAmC;AAEnC,sBAAoD;AACpD,QAAmB;AACnB,uBASO;AAEP,wCAA+B;AAE/B,uBAA4B;AAW5B,6BAAqD;AACrD,6BAAgC;AAChC,4BAQO;AACP,iCAAoC;AAEpC,uCAA6D;AAC7D,0BAA6B;AAC7B,yBAAiE;AACjE,sBAAyB;AACzB,gCAAmC;AACnC,+BAAkC;AAClC,mBAAsB;AACtB,iCAAoC;AAEpC,MAAM,kBAAkB;AAAA,EACtB,KAAK;AAAA,EACL,OAAO;AAAA,EACP,WAAW;AACb;AAEA,MAAM,qBAAqB;AAAA,EACzB,KAAK;AAAA,EACL,KAAK;AAAA,EACL,GAAI,QAAQ,IAAI,mBAAmB,SAAS;AAAA,IAC1C,SAAS;AAAA,IACT,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,YAAY;AAAA,EACd;AACF;AAEA,MAAM,aAAa;AAAA,EACjB,UAAU;AAAA,EACV,UAAU;AACZ;AAEA,MAAM,SAAS,CAAC,MAA6C,EAAE,SAAS;AACxE,MAAM,gBAAgB,CAAC,MAAe;AAMtC,IAAI,oBAAoB;AAEjB,SAAS,gBAAgB,EAAE,SAAS,QAAQ,IAAsB,EAAE,QAAQ,Q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AAO,KAAK;AAAA,OAAsB,0BAAS,MAAM,IAAI,6BAAO,EAAE,KAAK,IAAI,CAAC,GAAG;AAAA,UAC7E;AAEA,uBAAa;AAAA,YACX,aAAa;AAAA,YACb;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,SAAS;AAAA,YACT;AAAA,YACA,aAAa;AAAA,YACb;AAAA,YACA;AAAA,YACA;AAAA,UACF,CAAC;AAAA,QACH,UAAE;AACA,cAAI,gBAAgB;AAClB,+BAAmB;AAAA,UACrB;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAED,OAAG,KAAK,YAAY,CAAC,CAAC,gBAAgB;AAKtC,QAAI,mBAAmB,MAAM;AAC3B,YAAM,MAAM,MAAM,KAAK,kBAAkB;AACzC,UAAI,kBAAkB;AACpB,eAAO,KAAK,4BAAqB,IAAI,QAAQ;AAAA,MAC/C;AACA,iBAAW,QAAQ,KAAK;AACtB,wDAAkB,MAAM,gBAAgB;AAAA,MAC1C;AAAA,IACF;AAEA,OAAG,KAAK,qBAAqB,SAAS;AAEtC,WAAO;AAAA,EACT;AACF;",
6
6
  "names": ["projectInfo", "_a", "target", "traverse", "out", "evaluateAttribute", "isStaticObject", "createTernariesFromObjectProperties", "ternaries", "value", "splitVariants", "variants", "expandStylesWithoutVariants", "mergeStyles", "prev", "res", "key"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/static",
3
- "version": "1.0.1-rc.1.2",
3
+ "version": "1.0.1-rc.1.4",
4
4
  "source": "src/index.ts",
5
5
  "types": "./types/index.d.ts",
6
6
  "main": "dist",
@@ -36,15 +36,15 @@
36
36
  "@babel/runtime": "^7.19.4",
37
37
  "@babel/traverse": "^7.19.6",
38
38
  "@expo/match-media": "^0.3.0",
39
- "@tamagui/build": "^1.0.1-rc.1.2",
40
- "@tamagui/cli-color": "^1.0.1-rc.1.2",
41
- "@tamagui/config-default-node": "^1.0.1-rc.1.2",
42
- "@tamagui/core-node": "^1.0.1-rc.1.2",
43
- "@tamagui/fake-react-native": "^1.0.1-rc.1.2",
44
- "@tamagui/helpers": "^1.0.1-rc.1.2",
45
- "@tamagui/helpers-node": "^1.0.1-rc.1.2",
46
- "@tamagui/proxy-worm": "^1.0.1-rc.1.2",
47
- "@tamagui/shorthands": "^1.0.1-rc.1.2",
39
+ "@tamagui/build": "^1.0.1-rc.1.4",
40
+ "@tamagui/cli-color": "^1.0.1-rc.1.4",
41
+ "@tamagui/config-default-node": "^1.0.1-rc.1.4",
42
+ "@tamagui/core-node": "^1.0.1-rc.1.4",
43
+ "@tamagui/fake-react-native": "^1.0.1-rc.1.4",
44
+ "@tamagui/helpers": "^1.0.1-rc.1.4",
45
+ "@tamagui/helpers-node": "^1.0.1-rc.1.4",
46
+ "@tamagui/proxy-worm": "^1.0.1-rc.1.4",
47
+ "@tamagui/shorthands": "^1.0.1-rc.1.4",
48
48
  "babel-literal-to-ast": "^2.1.0",
49
49
  "esbuild": "^0.15.11",
50
50
  "esbuild-register": "^3.3.3",
@@ -53,14 +53,14 @@
53
53
  "fs-extra": "^10.1.0",
54
54
  "invariant": "^2.2.4",
55
55
  "lodash": "^4.17.21",
56
- "react-native-web-internals": "^1.0.1-rc.1.2",
57
- "react-native-web-lite": "^1.0.1-rc.1.2"
56
+ "react-native-web-internals": "^1.0.1-rc.1.4",
57
+ "react-native-web-lite": "^1.0.1-rc.1.4"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@babel/plugin-syntax-typescript": "^7.18.6",
61
61
  "@babel/types": "^7.19.4",
62
62
  "@dish/babel-preset": "^0.0.6",
63
- "@tamagui/test-design-system": "^1.0.1-rc.1.2",
63
+ "@tamagui/test-design-system": "^1.0.1-rc.1.4",
64
64
  "@testing-library/react": "^13.4.0",
65
65
  "@types/babel__generator": "^7.6.4",
66
66
  "@types/babel__traverse": "^7.18.2",
@@ -386,72 +386,79 @@ export function createExtractor({ logger = console }: ExtractorOptions = { logge
386
386
  return
387
387
  }
388
388
 
389
- const name =
389
+ const variableName =
390
390
  t.isVariableDeclarator(path.parent) && t.isIdentifier(path.parent.id)
391
391
  ? path.parent.id.name
392
392
  : 'unknown'
393
393
 
394
+ const parentNode = path.node.arguments[0]
395
+ if (!t.isIdentifier(parentNode)) {
396
+ return
397
+ }
398
+ const parentName = parentNode.name
394
399
  const definition = path.node.arguments[1]
395
400
 
396
- if (!name || !definition || !t.isObjectExpression(definition)) {
401
+ if (!parentName || !definition || !t.isObjectExpression(definition)) {
397
402
  return
398
403
  }
399
404
 
400
- let Component = getValidImportedComponent(name)
401
-
402
- if (!Component) {
403
- if (disableExtractFoundComponents === true) {
404
- return
405
- }
406
- if (
407
- Array.isArray(disableExtractFoundComponents) &&
408
- disableExtractFoundComponents.includes(name)
409
- ) {
410
- return
411
- }
412
-
413
- try {
414
- if (shouldPrintDebug) {
415
- logger.info(`Unknown component ${name}, attempting dynamic load: ${sourcePath}`)
416
- }
417
-
418
- const out = loadTamaguiSync({
419
- forceExports: true,
420
- components: [sourcePath],
421
- })
422
-
423
- if (!out?.components) {
424
- if (shouldPrintDebug) {
425
- logger.info(`Couldn't load, got ${out}`)
426
- }
427
- return
428
- }
429
-
430
- propsWithFileInfo.allLoadedComponents = [
431
- ...propsWithFileInfo.allLoadedComponents,
432
- ...out.components,
433
- ]
434
-
435
- Component = out.components.flatMap((x) => x.nameToInfo[name] ?? [])[0]
436
-
437
- if (shouldPrintDebug === 'verbose') {
438
- logger.info([`Tamagui Loaded`, JSON.stringify(out.components), !!Component].join(' '))
439
- }
440
- } catch (err: any) {
441
- if (shouldPrintDebug) {
442
- logger.info(
443
- `${getPrefixLogs(
444
- options
445
- )} skip optimize styled(${name}), unable to pre-process (DEBUG=tamagui for more)`
446
- )
447
- }
448
- if (process.env.DEBUG === 'tamagui') {
449
- logger.info(
450
- ` Disable this with "disableExtractFoundComponents" in your build-time configuration. \n\n ${err.message} ${err.stack}`
451
- )
452
- }
453
- }
454
- }
405
+ const Component = getValidImportedComponent(parentName)
406
+
407
+ // if (!Component) {
408
+ // if (disableExtractFoundComponents === true) {
409
+ // return
410
+ // }
411
+ // if (
412
+ // Array.isArray(disableExtractFoundComponents) &&
413
+ // disableExtractFoundComponents.includes(parentName)
414
+ // ) {
415
+ // return
416
+ // }
417
+
418
+ // try {
419
+ // if (shouldPrintDebug) {
420
+ // logger.info(
421
+ // `Unknown component ${parentName}, attempting dynamic load: ${sourcePath}`
422
+ // )
423
+ // }
424
+
425
+ // const out = loadTamaguiSync({
426
+ // forceExports: true,
427
+ // components: [sourcePath],
428
+ // })
429
+
430
+ // if (!out?.components) {
431
+ // if (shouldPrintDebug) {
432
+ // logger.info(`Couldn't load, got ${out}`)
433
+ // }
434
+ // return
435
+ // }
436
+
437
+ // propsWithFileInfo.allLoadedComponents = [
438
+ // ...propsWithFileInfo.allLoadedComponents,
439
+ // ...out.components,
440
+ // ]
441
+
442
+ // Component = out.components.flatMap((x) => x.nameToInfo[variableName] ?? [])[0]
443
+
444
+ // if (shouldPrintDebug === 'verbose') {
445
+ // logger.info([`Tamagui Loaded`, JSON.stringify(out.components), !!Component].join(' '))
446
+ // }
447
+ // } catch (err: any) {
448
+ // if (shouldPrintDebug) {
449
+ // logger.info(
450
+ // `${getPrefixLogs(
451
+ // options
452
+ // )} skip optimize styled(${variableName}), unable to pre-process (DEBUG=tamagui for more)`
453
+ // )
454
+ // }
455
+ // if (process.env.DEBUG === 'tamagui') {
456
+ // logger.info(
457
+ // ` Disable this with "disableExtractFoundComponents" in your build-time configuration. \n\n ${err.message} ${err.stack}`
458
+ // )
459
+ // }
460
+ // }
461
+ // }
455
462
 
456
463
  if (!Component) {
457
464
  return
@@ -513,15 +520,24 @@ export function createExtractor({ logger = console }: ExtractorOptions = { logge
513
520
  }
514
521
  }
515
522
 
516
- const out = getSplitStyles(styles, Component.staticConfig, defaultTheme, {
517
- focus: false,
518
- hover: false,
519
- unmounted: true,
520
- press: false,
521
- pressIn: false,
522
- resolveVariablesAs: 'variable',
523
- noClassNames: false,
524
- })
523
+ const out = getSplitStyles(
524
+ styles,
525
+ Component.staticConfig,
526
+ defaultTheme,
527
+ {
528
+ focus: false,
529
+ hover: false,
530
+ unmounted: true,
531
+ press: false,
532
+ pressIn: false,
533
+ resolveVariablesAs: 'variable',
534
+ noClassNames: false,
535
+ },
536
+ undefined,
537
+ undefined,
538
+ undefined,
539
+ shouldPrintDebug
540
+ )
525
541
 
526
542
  const classNames = {
527
543
  ...out.classNames,
@@ -537,7 +553,7 @@ export function createExtractor({ logger = console }: ExtractorOptions = { logge
537
553
 
538
554
  if (shouldPrintDebug) {
539
555
  // prettier-ignore
540
- logger.info([`Extracted styled(${name})\n`, JSON.stringify(styles, null, 2), '\n rulesToInsert:', out.rulesToInsert.flatMap((rule) => rule.rules).join('\n')].join(' '))
556
+ logger.info([`Extracted styled(${variableName})\n`, JSON.stringify(styles, null, 2), '\n rulesToInsert:', out.rulesToInsert.flatMap((rule) => rule.rules).join('\n')].join(' '))
541
557
  }
542
558
 
543
559
  // leave only un-parsed props...
@@ -561,7 +577,7 @@ export function createExtractor({ logger = console }: ExtractorOptions = { logge
561
577
  res.styled++
562
578
 
563
579
  if (shouldPrintDebug) {
564
- logger.info(`Extracted styled(${name})`)
580
+ logger.info(`Extracted styled(${variableName})`)
565
581
  }
566
582
  },
567
583
 
@@ -1,6 +1,6 @@
1
1
  import * as t from '@babel/types';
2
2
  import type { ClassNameObject } from '../types.js';
3
- declare type Builder = (objects: ClassNameObject[], extras?: string) => t.Expression | t.StringLiteral | null;
3
+ type Builder = (objects: ClassNameObject[], extras?: string) => t.Expression | t.StringLiteral | null;
4
4
  export declare const buildClassName: Builder;
5
5
  export declare const buildClassNameLogic: Builder;
6
6
  export {};
@@ -2,7 +2,7 @@ import esbuild from 'esbuild';
2
2
  /**
3
3
  * For internal loading of new files
4
4
  */
5
- declare type Props = Omit<Partial<esbuild.BuildOptions>, 'entryPoints'> & {
5
+ type Props = Omit<Partial<esbuild.BuildOptions>, 'entryPoints'> & {
6
6
  outfile: string;
7
7
  entryPoints: string[];
8
8
  resolvePlatformSpecificEntries?: boolean;
@@ -3,8 +3,8 @@ import * as t from '@babel/types';
3
3
  import type { ExtractorOptions, ExtractorParseProps, TamaguiOptions } from '../types.js';
4
4
  import { cleanupBeforeExit } from './getStaticBindingsForScope.js';
5
5
  import { TamaguiProjectInfo } from './loadTamagui.js';
6
- export declare type Extractor = ReturnType<typeof createExtractor>;
7
- declare type FileOrPath = NodePath<t.Program> | t.File;
6
+ export type Extractor = ReturnType<typeof createExtractor>;
7
+ type FileOrPath = NodePath<t.Program> | t.File;
8
8
  export declare function createExtractor({ logger }?: ExtractorOptions): {
9
9
  options: {
10
10
  logger: import("../types.js").Logger;
@@ -2,14 +2,14 @@
2
2
  import * as t from '@babel/types';
3
3
  import type { TamaguiOptions } from '../types.js';
4
4
  import { Extractor } from './createExtractor.js';
5
- export declare type ExtractedResponse = {
5
+ export type ExtractedResponse = {
6
6
  js: string | Buffer;
7
7
  styles: string;
8
8
  stylesPath?: string;
9
9
  ast: t.File;
10
10
  map: any;
11
11
  };
12
- export declare type ExtractToClassNamesProps = {
12
+ export type ExtractToClassNamesProps = {
13
13
  extractor: Extractor;
14
14
  source: string | Buffer;
15
15
  sourcePath: string;
@@ -1,19 +1,19 @@
1
1
  import type { StaticConfigParsed, TamaguiInternalConfig } from '@tamagui/core-node';
2
- declare type NameToPaths = {
2
+ type NameToPaths = {
3
3
  [key: string]: Set<string>;
4
4
  };
5
- export declare type LoadedComponents = {
5
+ export type LoadedComponents = {
6
6
  moduleName: string;
7
7
  nameToInfo: Record<string, {
8
8
  staticConfig: StaticConfigParsed;
9
9
  }>;
10
10
  };
11
- export declare type TamaguiProjectInfo = {
11
+ export type TamaguiProjectInfo = {
12
12
  components: LoadedComponents[];
13
13
  tamaguiConfig: TamaguiInternalConfig;
14
14
  nameToPaths: NameToPaths;
15
15
  };
16
- declare type Props = {
16
+ type Props = {
17
17
  components: string[];
18
18
  config?: string;
19
19
  forceExports?: boolean;
package/types/types.d.ts CHANGED
@@ -7,7 +7,7 @@ import type { ViewStyle } from 'react-native';
7
7
  import { LoadedComponents } from './index';
8
8
  export type { TamaguiOptions } from '@tamagui/helpers-node';
9
9
  export type { StyleObject } from '@tamagui/helpers';
10
- export declare type ClassNameObject = t.StringLiteral | t.Expression;
10
+ export type ClassNameObject = t.StringLiteral | t.Expression;
11
11
  export interface CacheObject {
12
12
  [key: string]: any;
13
13
  }
@@ -21,24 +21,24 @@ export interface Logger {
21
21
  warn(msg: string, options?: LogOptions): void;
22
22
  error(msg: string, options?: LogOptions): void;
23
23
  }
24
- export declare type ExtractorOptions = {
24
+ export type ExtractorOptions = {
25
25
  logger?: Logger;
26
26
  };
27
- export declare type ExtractedAttrAttr = {
27
+ export type ExtractedAttrAttr = {
28
28
  type: 'attr';
29
29
  value: t.JSXAttribute | t.JSXSpreadAttribute;
30
30
  };
31
- export declare type ExtractedAttrStyle = {
31
+ export type ExtractedAttrStyle = {
32
32
  type: 'style';
33
33
  value: ViewStyle & PseudoStyles;
34
34
  attr?: t.JSXAttribute | t.JSXSpreadAttribute;
35
35
  name?: string;
36
36
  };
37
- export declare type ExtractedAttr = ExtractedAttrAttr | {
37
+ export type ExtractedAttr = ExtractedAttrAttr | {
38
38
  type: 'ternary';
39
39
  value: Ternary;
40
40
  } | ExtractedAttrStyle;
41
- export declare type ExtractTagProps = {
41
+ export type ExtractTagProps = {
42
42
  parserProps: TamaguiOptionsWithFileInfo;
43
43
  attrs: ExtractedAttr[];
44
44
  node: t.JSXOpeningElement;
@@ -52,11 +52,11 @@ export declare type ExtractTagProps = {
52
52
  completeProps: Record<string, any>;
53
53
  staticConfig: StaticConfig;
54
54
  };
55
- export declare type TamaguiOptionsWithFileInfo = TamaguiOptions & {
55
+ export type TamaguiOptionsWithFileInfo = TamaguiOptions & {
56
56
  sourcePath: string;
57
57
  allLoadedComponents: LoadedComponents[];
58
58
  };
59
- export declare type ExtractorParseProps = Omit<TamaguiOptionsWithFileInfo, 'allLoadedComponents'> & {
59
+ export type ExtractorParseProps = Omit<TamaguiOptionsWithFileInfo, 'allLoadedComponents'> & {
60
60
  target: 'native' | 'html';
61
61
  shouldPrintDebug?: boolean | 'verbose';
62
62
  onExtractTag: (props: ExtractTagProps) => void;
@@ -74,7 +74,7 @@ export interface Ternary {
74
74
  consequent: Object | null;
75
75
  alternate: Object | null;
76
76
  }
77
- export declare type ClassNameToStyleObj = {
77
+ export type ClassNameToStyleObj = {
78
78
  [key: string]: StyleObject;
79
79
  };
80
80
  export interface PluginContext {