@tamagui/static 1.0.1-beta.175 → 1.0.1-beta.177
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.
- package/dist/extractor/createExtractor.js +7 -3
- package/dist/extractor/createExtractor.js.map +2 -2
- package/dist/extractor/getStaticBindingsForScope.js +5 -4
- package/dist/extractor/getStaticBindingsForScope.js.map +2 -2
- package/package.json +14 -14
- package/src/extractor/createExtractor.ts +7 -3
- package/src/extractor/getStaticBindingsForScope.ts +6 -5
|
@@ -156,7 +156,9 @@ function createExtractor({ logger = console } = { logger: console }) {
|
|
|
156
156
|
const themeAccessListeners = /* @__PURE__ */ new Set();
|
|
157
157
|
const defaultTheme = new Proxy(proxiedTheme, {
|
|
158
158
|
get(target2, key) {
|
|
159
|
-
|
|
159
|
+
if (Reflect.has(target2, key)) {
|
|
160
|
+
themeAccessListeners.forEach((cb) => cb(String(key)));
|
|
161
|
+
}
|
|
160
162
|
return Reflect.get(target2, key);
|
|
161
163
|
}
|
|
162
164
|
});
|
|
@@ -547,7 +549,7 @@ function createExtractor({ logger = console } = { logger: console }) {
|
|
|
547
549
|
value: path.node
|
|
548
550
|
};
|
|
549
551
|
}
|
|
550
|
-
if (disableExtractVariables) {
|
|
552
|
+
if (disableExtractVariables === true) {
|
|
551
553
|
if (value) {
|
|
552
554
|
if (value.type === "StringLiteral" && value.value[0] === "$") {
|
|
553
555
|
if (shouldPrintDebug) {
|
|
@@ -1088,9 +1090,11 @@ function createExtractor({ logger = console } = { logger: console }) {
|
|
|
1088
1090
|
const canFlattenProps = inlined.size === 0;
|
|
1089
1091
|
let shouldFlatten = flatNode && !shouldDeopt && canFlattenProps && !hasSpread && staticConfig.neverFlatten !== true && (staticConfig.neverFlatten === "jsx" ? hasOnlyStringChildren : true);
|
|
1090
1092
|
const shouldWrapTheme = shouldFlatten && themeVal;
|
|
1093
|
+
const usedThemeKeys = /* @__PURE__ */ new Set();
|
|
1091
1094
|
if (disableExtractVariables) {
|
|
1092
1095
|
themeAccessListeners.add((key) => {
|
|
1093
1096
|
shouldFlatten = false;
|
|
1097
|
+
usedThemeKeys.add(key);
|
|
1094
1098
|
if (shouldPrintDebug) {
|
|
1095
1099
|
logger.info([" ! accessing theme key, avoid flatten", key].join(" "));
|
|
1096
1100
|
}
|
|
@@ -1300,7 +1304,7 @@ function createExtractor({ logger = console } = { logger: console }) {
|
|
|
1300
1304
|
key = fullKey;
|
|
1301
1305
|
}
|
|
1302
1306
|
if (disableExtractVariables) {
|
|
1303
|
-
if (value[0] === "$") {
|
|
1307
|
+
if (value[0] === "$" && (usedThemeKeys.has(key) || usedThemeKeys.has(fullKey))) {
|
|
1304
1308
|
if (shouldPrintDebug) {
|
|
1305
1309
|
logger.info([` keeping variable inline: ${key} =`, value].join(" "));
|
|
1306
1310
|
}
|
|
@@ -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, Visitor } from '@babel/traverse'\nimport * as t from '@babel/types'\nimport {\n PseudoStyles,\n StaticConfigParsed,\n createDOMProps,\n expandStyles,\n getSplitStyles,\n getStylesAtomic,\n mediaQueryConfig,\n proxyThemeVariables,\n pseudoDescriptors,\n} from '@tamagui/core-node'\nimport type { ViewStyle } from 'react-native'\n\nimport { FAILED_EVAL } from '../constants.js'\nimport type {\n ExtractedAttr,\n ExtractedAttrAttr,\n ExtractedAttrStyle,\n ExtractorOptions,\n ExtractorParseProps,\n TamaguiOptions,\n Ternary,\n} from '../types.js'\nimport { createEvaluator, createSafeEvaluator } from './createEvaluator.js'\nimport { evaluateAstNode } from './evaluateAstNode.js'\nimport {\n attrStr,\n findComponentName,\n isInsideTamagui,\n isPresent,\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\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 isValidStyleKey(name: string, staticConfig: StaticConfigParsed) {\n if (!projectInfo) {\n throw new Error(`Tamagui extractor not loaded yet`)\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 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 extractStyledDefinitions = false,\n prefixLogs,\n excludeProps,\n target,\n ...props\n } = options\n\n let shouldPrintDebug = options.shouldPrintDebug || false\n\n if (disable) {\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\n const isTargetingHTML = target === 'html'\n const ogDebug = shouldPrintDebug\n const tm = timer()\n\n if (shouldPrintDebug === 'verbose') {\n console.log('tamagui.config.ts:', { components, config })\n }\n\n tm.mark('load-tamagui', !!shouldPrintDebug)\n\n const proxiedTheme = proxyThemeVariables(\n tamaguiConfig.themes[Object.keys(tamaguiConfig.themes)[0]]\n )\n\n type AccessListener = (key: string) => void\n const themeAccessListeners = new Set<AccessListener>()\n const defaultTheme = new Proxy(proxiedTheme, {\n get(target, key) {\n themeAccessListeners.forEach((cb) => cb(String(key)))\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 /**\n * Step 1: Determine if importing any statically extractable components\n */\n const isInternalImport = (importStr: string) => {\n return isInsideTamagui(sourcePath) && importStr[0] === '.'\n }\n\n const validComponents: { [key: string]: any } = Object.keys(components)\n // check if uppercase to avoid hitting media query proxy before init\n .filter((key) => key[0].toUpperCase() === key[0] && !!components[key]?.staticConfig)\n .reduce((obj, name) => {\n obj[name] = components[name]\n return obj\n }, {})\n\n if (Object.keys(validComponents).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(`validComponents ${Object.keys(validComponents).join(', ')}`)\n }\n\n let doesUseValidImport = false\n let hasImportedTheme = false\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 from = node.source.value\n // if importing styled()\n const isValidImport =\n props.components.includes(from) ||\n isInternalImport(from) ||\n from === '@tamagui/core' ||\n from === 'tamagui'\n\n if (extractStyledDefinitions) {\n if (isValidImport) {\n if (\n node.specifiers.some((specifier) => {\n return specifier.local.name === 'styled'\n })\n ) {\n doesUseValidImport = true\n break\n }\n }\n }\n\n if (isValidImport) {\n const names = node.specifiers.map((specifier) => specifier.local.name)\n const isValidComponent = names.some((name) => !!(validComponents[name] || validHooks[name]))\n if (shouldPrintDebug === 'verbose') {\n logger.info(\n `import ${names.join(', ')} from ${from} isValidComponent ${isValidComponent}`\n )\n }\n if (isValidComponent) {\n doesUseValidImport = true\n break\n }\n }\n }\n\n if (shouldPrintDebug) {\n logger.info(`source: ${sourcePath} doesUseValidImport ${doesUseValidImport}`)\n }\n\n if (!doesUseValidImport) {\n return null\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: Visitor<{}>) => {\n return fileOrPath.type === 'File' ? traverse(fileOrPath, a) : fileOrPath.traverse(a)\n }\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 Program: {\n enter(path) {\n programPath = path\n },\n },\n\n // styled() calls\n CallExpression(path) {\n if (disable || disableExtraction || 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 const definition = path.node.arguments[1]\n\n if (!name || !definition || !t.isObjectExpression(definition)) {\n return\n }\n\n let Component = validComponents[name] as { staticConfig: StaticConfigParsed } | undefined\n\n if (!Component) {\n if (disableExtractFoundComponents) {\n return\n }\n\n try {\n const out = loadTamaguiSync({\n // TODO would extract more, is NO-OP for now..\n forceExports: true,\n bubbleErrors: true,\n components: [sourcePath],\n })\n\n if (out.components?.[name]) {\n // add new components\n // TODO dont Clobber, do by file\n Object.assign(validComponents, out.components)\n }\n\n Component = validComponents[name]\n\n if (shouldPrintDebug) {\n logger.info([`Loaded`, Object.keys(out.components).join(', '), !!Component].join(' '))\n }\n } catch (err: any) {\n logger.info(\n `${getPrefixLogs(\n options\n )} skip optimize styled(${name}), unable to pre-process (DEBUG=tamagui for more)`\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 tamaguiConfig,\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 mounted: false,\n press: false,\n pressIn: false,\n resolveVariablesAs: 'variable',\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\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=>\\n', 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\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\n if (binding) {\n if (!t.isImportDeclaration(binding.path.parent)) {\n return\n }\n const source = binding.path.parent.source\n if (!props.components.includes(source.value) && !isInternalImport(source.value)) {\n return\n }\n if (!validComponents[binding.identifier.name]) {\n return\n }\n }\n\n const component = validComponents[node.name.name] as { staticConfig?: StaticConfigParsed }\n if (!component || !component.staticConfig) {\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 .map((n) => {\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 // disable as it gets messy\n // const shouldLog = !hasLogged\n // if (shouldLog) {\n // logger.info(` 1\uFE0F\u20E3 Inline optimized 2\uFE0F\u20E3 Inline flattened 3\uFE0F\u20E3 styled() extracted`)\n // const prefix = ' |'\n // // prettier-ignore\n // logger.info([prefixLogs || prefix, ' total \u00B7 1\uFE0F\u20E3 \u00B7 2\uFE0F\u20E3 \u00B7 3\uFE0F\u20E3'].join(' '))\n // hasLogged = true\n // }\n\n if (disableExtraction) {\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 ...(props.inlineProps || []),\n ...(staticConfig.inlineProps || []),\n ])\n\n const deoptProps = new Set([\n // always de-opt animation\n 'animation',\n ...(props.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 tamaguiConfig,\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 // allow disabling this extraction\n if (disableExtractInlineMedia) {\n return attr\n }\n\n const shortname = name.slice(1)\n if (mediaQueryConfig[shortname]) {\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) {\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 ) {\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 // now update to new values\n node.attributes = attrs.filter(isAttr).map((x) => x.value)\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 // 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 inlined.delete('theme')\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 =\n flatNode &&\n !shouldDeopt &&\n canFlattenProps &&\n !hasSpread &&\n staticConfig.neverFlatten !== true &&\n (staticConfig.neverFlatten === 'jsx' ? hasOnlyStringChildren : true)\n\n const shouldWrapTheme = shouldFlatten && themeVal\n\n if (disableExtractVariables) {\n // if it accesses any theme values during evaluation\n themeAccessListeners.add((key) => {\n shouldFlatten = false\n if (shouldPrintDebug) {\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) {\n node.attributes = ogAttributes\n return\n }\n\n // insert overrides - this inserts null props for things that are set in classNames\n // only when not flattening, so the downstream component can skip applying those styles\n const ensureOverridden = {}\n if (!shouldFlatten) {\n for (const cur of attrs) {\n if (cur.type === 'style') {\n // TODO need to loop over initial props not just style props\n for (const key in cur.value) {\n const shouldEnsureOverridden = !!staticConfig.ensureOverriddenProp?.[key]\n const isSetInAttrsAlready = attrs.some(\n (x) =>\n x.type === 'attr' &&\n x.value.type === 'JSXAttribute' &&\n x.value.name.name === key\n )\n\n if (!isSetInAttrsAlready) {\n const isVariant = !!staticConfig.variants?.[cur.name || '']\n if (isVariant || shouldEnsureOverridden) {\n ensureOverridden[key] = true\n }\n }\n }\n }\n }\n }\n\n if (shouldPrintDebug) {\n logger.info(\n [' - attrs (flattened): \\n', logLines(attrs.map(attrStr).join(', '))].join(' ')\n )\n logger.info(\n [' - ensureOverriden:', Object.keys(ensureOverridden).join(', ')].join(' ')\n )\n }\n\n const state = {\n noClassNames: false,\n focus: false,\n hover: false,\n mounted: true, // 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] === '$') {\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 transform styles so it merges properly if not flattened\n // we handle this later on\n // (stylePropsTransform[key] ||\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 (ensureOverridden[key]) {\n acc.push({\n type: 'attr',\n value:\n cur.attr ||\n t.jsxAttribute(t.jsxIdentifier(key), t.jsxExpressionContainer(t.nullLiteral())),\n })\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 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 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 node\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 node.name.name = flatNode\n res.flattened++\n if (closingElement) {\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 attrs,\n node,\n lineNumbers,\n filePath,\n attemptEval,\n jsxPath: traversePath,\n originalNodeName,\n isFlattened: shouldFlatten,\n 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,sBAA4C;AAC5C,QAAmB;AACnB,uBAUO;AAGP,uBAA4B;AAU5B,6BAAqD;AACrD,6BAAgC;AAChC,4BAMO;AACP,iCAAoC;AACpC,2BAA8B;AAC9B,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;AAM/B,SAAS,gBAAgB,EAAE,SAAS,QAAQ,IAAsB,EAAE,QAAQ,QAAQ,GAAG;AAC5F,MAAI,CAAC,QAAQ,IAAI,gBAAgB;AAC/B,YAAQ,IAAI,gFAAsE;AAClF,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,QAAM,qBAEJ,CAAC,QAAQ,IAAI,iCACb,QAAQ,IAAI,mBAAmB,YAC/B,QAAQ,IAAI,kBAAkB,YAC7B,QAAQ,IAAI,aAAa,iBAAiB,QAAQ,IAAI,SAAS,QAAQ,IAAI;AAE9E,MAAI,c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AO;AAAA,YAC7B;AAAA,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,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, Visitor } from '@babel/traverse'\nimport * as t from '@babel/types'\nimport {\n PseudoStyles,\n StaticConfigParsed,\n createDOMProps,\n expandStyles,\n getSplitStyles,\n getStylesAtomic,\n mediaQueryConfig,\n proxyThemeVariables,\n pseudoDescriptors,\n} from '@tamagui/core-node'\nimport type { ViewStyle } from 'react-native'\n\nimport { FAILED_EVAL } from '../constants.js'\nimport type {\n ExtractedAttr,\n ExtractedAttrAttr,\n ExtractedAttrStyle,\n ExtractorOptions,\n ExtractorParseProps,\n TamaguiOptions,\n Ternary,\n} from '../types.js'\nimport { createEvaluator, createSafeEvaluator } from './createEvaluator.js'\nimport { evaluateAstNode } from './evaluateAstNode.js'\nimport {\n attrStr,\n findComponentName,\n isInsideTamagui,\n isPresent,\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\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 isValidStyleKey(name: string, staticConfig: StaticConfigParsed) {\n if (!projectInfo) {\n throw new Error(`Tamagui extractor not loaded yet`)\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 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 extractStyledDefinitions = false,\n prefixLogs,\n excludeProps,\n target,\n ...props\n } = options\n\n let shouldPrintDebug = options.shouldPrintDebug || false\n\n if (disable) {\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\n const isTargetingHTML = target === 'html'\n const ogDebug = shouldPrintDebug\n const tm = timer()\n\n if (shouldPrintDebug === 'verbose') {\n console.log('tamagui.config.ts:', { components, config })\n }\n\n tm.mark('load-tamagui', !!shouldPrintDebug)\n\n const proxiedTheme = proxyThemeVariables(\n tamaguiConfig.themes[Object.keys(tamaguiConfig.themes)[0]]\n )\n\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 /**\n * Step 1: Determine if importing any statically extractable components\n */\n const isInternalImport = (importStr: string) => {\n return isInsideTamagui(sourcePath) && importStr[0] === '.'\n }\n\n const validComponents: { [key: string]: any } = Object.keys(components)\n // check if uppercase to avoid hitting media query proxy before init\n .filter((key) => key[0].toUpperCase() === key[0] && !!components[key]?.staticConfig)\n .reduce((obj, name) => {\n obj[name] = components[name]\n return obj\n }, {})\n\n if (Object.keys(validComponents).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(`validComponents ${Object.keys(validComponents).join(', ')}`)\n }\n\n let doesUseValidImport = false\n let hasImportedTheme = false\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 from = node.source.value\n // if importing styled()\n const isValidImport =\n props.components.includes(from) ||\n isInternalImport(from) ||\n from === '@tamagui/core' ||\n from === 'tamagui'\n\n if (extractStyledDefinitions) {\n if (isValidImport) {\n if (\n node.specifiers.some((specifier) => {\n return specifier.local.name === 'styled'\n })\n ) {\n doesUseValidImport = true\n break\n }\n }\n }\n\n if (isValidImport) {\n const names = node.specifiers.map((specifier) => specifier.local.name)\n const isValidComponent = names.some((name) => !!(validComponents[name] || validHooks[name]))\n if (shouldPrintDebug === 'verbose') {\n logger.info(\n `import ${names.join(', ')} from ${from} isValidComponent ${isValidComponent}`\n )\n }\n if (isValidComponent) {\n doesUseValidImport = true\n break\n }\n }\n }\n\n if (shouldPrintDebug) {\n logger.info(`source: ${sourcePath} doesUseValidImport ${doesUseValidImport}`)\n }\n\n if (!doesUseValidImport) {\n return null\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: Visitor<{}>) => {\n return fileOrPath.type === 'File' ? traverse(fileOrPath, a) : fileOrPath.traverse(a)\n }\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 Program: {\n enter(path) {\n programPath = path\n },\n },\n\n // styled() calls\n CallExpression(path) {\n if (disable || disableExtraction || 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 const definition = path.node.arguments[1]\n\n if (!name || !definition || !t.isObjectExpression(definition)) {\n return\n }\n\n let Component = validComponents[name] as { staticConfig: StaticConfigParsed } | undefined\n\n if (!Component) {\n if (disableExtractFoundComponents) {\n return\n }\n\n try {\n const out = loadTamaguiSync({\n // TODO would extract more, is NO-OP for now..\n forceExports: true,\n bubbleErrors: true,\n components: [sourcePath],\n })\n\n if (out.components?.[name]) {\n // add new components\n // TODO dont Clobber, do by file\n Object.assign(validComponents, out.components)\n }\n\n Component = validComponents[name]\n\n if (shouldPrintDebug) {\n logger.info([`Loaded`, Object.keys(out.components).join(', '), !!Component].join(' '))\n }\n } catch (err: any) {\n logger.info(\n `${getPrefixLogs(\n options\n )} skip optimize styled(${name}), unable to pre-process (DEBUG=tamagui for more)`\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 tamaguiConfig,\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 mounted: false,\n press: false,\n pressIn: false,\n resolveVariablesAs: 'variable',\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\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=>\\n', 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\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\n if (binding) {\n if (!t.isImportDeclaration(binding.path.parent)) {\n return\n }\n const source = binding.path.parent.source\n if (!props.components.includes(source.value) && !isInternalImport(source.value)) {\n return\n }\n if (!validComponents[binding.identifier.name]) {\n return\n }\n }\n\n const component = validComponents[node.name.name] as { staticConfig?: StaticConfigParsed }\n if (!component || !component.staticConfig) {\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 .map((n) => {\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 // disable as it gets messy\n // const shouldLog = !hasLogged\n // if (shouldLog) {\n // logger.info(` 1\uFE0F\u20E3 Inline optimized 2\uFE0F\u20E3 Inline flattened 3\uFE0F\u20E3 styled() extracted`)\n // const prefix = ' |'\n // // prettier-ignore\n // logger.info([prefixLogs || prefix, ' total \u00B7 1\uFE0F\u20E3 \u00B7 2\uFE0F\u20E3 \u00B7 3\uFE0F\u20E3'].join(' '))\n // hasLogged = true\n // }\n\n if (disableExtraction) {\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 ...(props.inlineProps || []),\n ...(staticConfig.inlineProps || []),\n ])\n\n const deoptProps = new Set([\n // always de-opt animation\n 'animation',\n ...(props.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 tamaguiConfig,\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 // allow disabling this extraction\n if (disableExtractInlineMedia) {\n return attr\n }\n\n const shortname = name.slice(1)\n if (mediaQueryConfig[shortname]) {\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 ) {\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 // now update to new values\n node.attributes = attrs.filter(isAttr).map((x) => x.value)\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 // 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 inlined.delete('theme')\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 =\n flatNode &&\n !shouldDeopt &&\n canFlattenProps &&\n !hasSpread &&\n staticConfig.neverFlatten !== true &&\n (staticConfig.neverFlatten === 'jsx' ? hasOnlyStringChildren : true)\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) {\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) {\n node.attributes = ogAttributes\n return\n }\n\n // insert overrides - this inserts null props for things that are set in classNames\n // only when not flattening, so the downstream component can skip applying those styles\n const ensureOverridden = {}\n if (!shouldFlatten) {\n for (const cur of attrs) {\n if (cur.type === 'style') {\n // TODO need to loop over initial props not just style props\n for (const key in cur.value) {\n const shouldEnsureOverridden = !!staticConfig.ensureOverriddenProp?.[key]\n const isSetInAttrsAlready = attrs.some(\n (x) =>\n x.type === 'attr' &&\n x.value.type === 'JSXAttribute' &&\n x.value.name.name === key\n )\n\n if (!isSetInAttrsAlready) {\n const isVariant = !!staticConfig.variants?.[cur.name || '']\n if (isVariant || shouldEnsureOverridden) {\n ensureOverridden[key] = true\n }\n }\n }\n }\n }\n }\n\n if (shouldPrintDebug) {\n logger.info(\n [' - attrs (flattened): \\n', logLines(attrs.map(attrStr).join(', '))].join(' ')\n )\n logger.info(\n [' - ensureOverriden:', Object.keys(ensureOverridden).join(', ')].join(' ')\n )\n }\n\n const state = {\n noClassNames: false,\n focus: false,\n hover: false,\n mounted: true, // 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 transform styles so it merges properly if not flattened\n // we handle this later on\n // (stylePropsTransform[key] ||\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 (ensureOverridden[key]) {\n acc.push({\n type: 'attr',\n value:\n cur.attr ||\n t.jsxAttribute(t.jsxIdentifier(key), t.jsxExpressionContainer(t.nullLiteral())),\n })\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 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 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 node\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 node.name.name = flatNode\n res.flattened++\n if (closingElement) {\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 attrs,\n node,\n lineNumbers,\n filePath,\n attemptEval,\n jsxPath: traversePath,\n originalNodeName,\n isFlattened: shouldFlatten,\n 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,sBAA4C;AAC5C,QAAmB;AACnB,uBAUO;AAGP,uBAA4B;AAU5B,6BAAqD;AACrD,6BAAgC;AAChC,4BAMO;AACP,iCAAoC;AACpC,2BAA8B;AAC9B,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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O,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", "target", "traverse", "out", "evaluateAttribute", "isStaticObject", "createTernariesFromObjectProperties", "ternaries", "value", "splitVariants", "_a", "variants", "expandStylesWithoutVariants", "mergeStyles", "prev", "res", "key", "props"]
|
|
7
7
|
}
|
|
@@ -130,11 +130,12 @@ async function getStaticBindingsForScope(scope, whitelist = [], sourcePath, bind
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
} catch (err) {
|
|
133
|
-
console.warn(
|
|
134
|
-
` | Skipping evaluating module: ${moduleName} ${err.message} (DEBUG=tamagui for stack)`
|
|
135
|
-
);
|
|
136
133
|
if ((_a = process.env.DEBUG) == null ? void 0 : _a.startsWith("tamagui")) {
|
|
137
|
-
console.log(err.stack);
|
|
134
|
+
console.log(`Error in partial evaluation`, err.message, err.stack);
|
|
135
|
+
} else {
|
|
136
|
+
console.warn(
|
|
137
|
+
` | Skipping partial evaluation of constant file: ${moduleName} (DEBUG=tamagui for more)`
|
|
138
|
+
);
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
141
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/extractor/getStaticBindingsForScope.ts"],
|
|
4
|
-
"sourcesContent": ["import { fork } from 'child_process'\nimport { dirname, extname, join, resolve } from 'path'\n\nimport { Binding, NodePath } from '@babel/traverse'\nimport * as t from '@babel/types'\n\nimport { evaluateAstNode } from './evaluateAstNode.js'\nimport { getSourceModule } from './getSourceModule.js'\n\nconst isLocalImport = (path: string) => path.startsWith('.') || path.startsWith('/')\n\nfunction resolveImportPath(sourcePath: string, path: string) {\n const sourceDir = dirname(sourcePath)\n if (isLocalImport(path)) {\n if (extname(path) === '') {\n path += '.js'\n }\n return resolve(sourceDir, path)\n }\n return path\n}\n\nconst cache = new Map()\nconst pending = new Map<string, Promise<any>>()\nsetInterval(() => {\n if (cache.size) {\n cache.clear()\n }\n}, 10)\n\nconst loadCmd = `${join(__dirname, 'loadFile.js')}`\n\nlet exited = false\nconst child = fork(loadCmd, [], {\n execArgv: ['-r', 'esbuild-register'],\n detached: true,\n stdio: 'ignore',\n})\n\nexport function cleanupBeforeExit() {\n if (exited) return\n child.removeAllListeners()\n child.unref()\n child.disconnect()\n child.kill()\n exited = true\n}\n\nprocess.once('SIGTERM', cleanupBeforeExit)\nprocess.once('SIGINT', cleanupBeforeExit)\nprocess.once('beforeExit', cleanupBeforeExit)\n\nfunction importModule(path: string) {\n if (pending.has(path)) {\n return pending.get(path)\n }\n const promise = new Promise((res, rej) => {\n if (cache.has(path)) {\n return cache.get(path)\n }\n const listener = (msg: any) => {\n if (!msg) return\n if (typeof msg !== 'string') return\n if (msg[0] === '-') {\n rej(new Error(msg.slice(1)))\n return\n }\n child.removeListener('message', listener)\n const val = JSON.parse(msg)\n cache.set(path, val)\n res(val)\n }\n child.once('message', listener)\n child.send(`${path.replace('.js', '')}`)\n })\n pending.set(path, promise)\n return promise\n}\n\nexport async function getStaticBindingsForScope(\n scope: NodePath<t.JSXElement>['scope'],\n whitelist: string[] = [],\n sourcePath: string,\n bindingCache: Record<string, string | null>,\n shouldPrintDebug: boolean | 'verbose'\n): Promise<Record<string, any>> {\n const bindings: Record<string, Binding> = scope.getAllBindings() as any\n const ret: Record<string, any> = {}\n\n if (\n shouldPrintDebug\n ) {\n // prettier-ignore\n // console.log(' ', Object.keys(bindings).length, 'variables in scope')\n // .map(x => bindings[x].identifier?.name).join(', ')\n }\n\n // on react native at least it doesnt find some bindings? not sure why\n // lets add in whitelisted imports if they exist\n const program = scope.getProgramParent().block as t.Program\n for (const node of program.body) {\n if (t.isImportDeclaration(node)) {\n const importPath = node.source.value\n if (!node.specifiers.length) continue\n if (!isLocalImport(importPath)) {\n continue\n }\n const moduleName = resolveImportPath(sourcePath, importPath)\n const isOnWhitelist = whitelist.some((test) => moduleName.endsWith(test))\n if (!isOnWhitelist) continue\n try {\n const src = await importModule(moduleName)\n if (!src) continue\n for (const specifier of node.specifiers) {\n if (t.isImportSpecifier(specifier) && t.isIdentifier(specifier.imported)) {\n if (typeof src[specifier.imported.name] !== 'undefined') {\n const val = src[specifier.local.name]\n ret[specifier.local.name] = val\n }\n }\n }\n } catch (err: any) {\n // eslint-disable-next-line no-console\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAqB;AACrB,kBAAgD;AAGhD,QAAmB;AAEnB,6BAAgC;AAChC,6BAAgC;AAEhC,MAAM,gBAAgB,CAAC,SAAiB,KAAK,WAAW,GAAG,KAAK,KAAK,WAAW,GAAG;AAEnF,SAAS,kBAAkB,YAAoB,MAAc;AAC3D,QAAM,gBAAY,qBAAQ,UAAU;AACpC,MAAI,cAAc,IAAI,GAAG;AACvB,YAAI,qBAAQ,IAAI,MAAM,IAAI;AACxB,cAAQ;AAAA,IACV;AACA,eAAO,qBAAQ,WAAW,IAAI;AAAA,EAChC;AACA,SAAO;AACT;AAEA,MAAM,QAAQ,oBAAI,IAAI;AACtB,MAAM,UAAU,oBAAI,IAA0B;AAC9C,YAAY,MAAM;AAChB,MAAI,MAAM,MAAM;AACd,UAAM,MAAM;AAAA,EACd;AACF,GAAG,EAAE;AAEL,MAAM,UAAU,OAAG,kBAAK,WAAW,aAAa;AAEhD,IAAI,SAAS;AACb,MAAM,YAAQ,2BAAK,SAAS,CAAC,GAAG;AAAA,EAC9B,UAAU,CAAC,MAAM,kBAAkB;AAAA,EACnC,UAAU;AAAA,EACV,OAAO;AACT,CAAC;AAEM,SAAS,oBAAoB;AAClC,MAAI;AAAQ;AACZ,QAAM,mBAAmB;AACzB,QAAM,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;AAC9B;AAAA,MACF;AACA,YAAM,aAAa,kBAAkB,YAAY,UAAU;AAC3D,YAAM,gBAAgB,UAAU,KAAK,CAAC,SAAS,WAAW,SAAS,IAAI,CAAC;AACxE,UAAI,CAAC;AAAe;AACpB,UAAI;AACF,cAAM,MAAM,MAAM,aAAa,UAAU;AACzC,YAAI,CAAC;AAAK;AACV,mBAAW,aAAa,KAAK,YAAY;AACvC,cAAI,EAAE,kBAAkB,SAAS,KAAK,EAAE,aAAa,UAAU,QAAQ,GAAG;AACxE,gBAAI,OAAO,IAAI,UAAU,SAAS,UAAU,aAAa;AACvD,oBAAM,MAAM,IAAI,UAAU,MAAM;AAChC,kBAAI,UAAU,MAAM,QAAQ;AAAA,YAC9B;AAAA,UACF;AAAA,QACF;AAAA,MACF,SAAS,KAAP;
|
|
4
|
+
"sourcesContent": ["import { fork } from 'child_process'\nimport { dirname, extname, join, resolve } from 'path'\n\nimport { Binding, NodePath } from '@babel/traverse'\nimport * as t from '@babel/types'\n\nimport { evaluateAstNode } from './evaluateAstNode.js'\nimport { getSourceModule } from './getSourceModule.js'\n\nconst isLocalImport = (path: string) => path.startsWith('.') || path.startsWith('/')\n\nfunction resolveImportPath(sourcePath: string, path: string) {\n const sourceDir = dirname(sourcePath)\n if (isLocalImport(path)) {\n if (extname(path) === '') {\n path += '.js'\n }\n return resolve(sourceDir, path)\n }\n return path\n}\n\nconst cache = new Map()\nconst pending = new Map<string, Promise<any>>()\nsetInterval(() => {\n if (cache.size) {\n cache.clear()\n }\n}, 10)\n\nconst loadCmd = `${join(__dirname, 'loadFile.js')}`\n\nlet exited = false\nconst child = fork(loadCmd, [], {\n execArgv: ['-r', 'esbuild-register'],\n detached: true,\n stdio: 'ignore',\n})\n\nexport function cleanupBeforeExit() {\n if (exited) return\n child.removeAllListeners()\n child.unref()\n child.disconnect()\n child.kill()\n exited = true\n}\n\nprocess.once('SIGTERM', cleanupBeforeExit)\nprocess.once('SIGINT', cleanupBeforeExit)\nprocess.once('beforeExit', cleanupBeforeExit)\n\nfunction importModule(path: string) {\n if (pending.has(path)) {\n return pending.get(path)\n }\n const promise = new Promise((res, rej) => {\n if (cache.has(path)) {\n return cache.get(path)\n }\n const listener = (msg: any) => {\n if (!msg) return\n if (typeof msg !== 'string') return\n if (msg[0] === '-') {\n rej(new Error(msg.slice(1)))\n return\n }\n child.removeListener('message', listener)\n const val = JSON.parse(msg)\n cache.set(path, val)\n res(val)\n }\n child.once('message', listener)\n child.send(`${path.replace('.js', '')}`)\n })\n pending.set(path, promise)\n return promise\n}\n\nexport async function getStaticBindingsForScope(\n scope: NodePath<t.JSXElement>['scope'],\n whitelist: string[] = [],\n sourcePath: string,\n bindingCache: Record<string, string | null>,\n shouldPrintDebug: boolean | 'verbose'\n): Promise<Record<string, any>> {\n const bindings: Record<string, Binding> = scope.getAllBindings() as any\n const ret: Record<string, any> = {}\n\n if (\n shouldPrintDebug\n ) {\n // prettier-ignore\n // console.log(' ', Object.keys(bindings).length, 'variables in scope')\n // .map(x => bindings[x].identifier?.name).join(', ')\n }\n\n // on react native at least it doesnt find some bindings? not sure why\n // lets add in whitelisted imports if they exist\n const program = scope.getProgramParent().block as t.Program\n for (const node of program.body) {\n if (t.isImportDeclaration(node)) {\n const importPath = node.source.value\n if (!node.specifiers.length) continue\n if (!isLocalImport(importPath)) {\n continue\n }\n const moduleName = resolveImportPath(sourcePath, importPath)\n const isOnWhitelist = whitelist.some((test) => moduleName.endsWith(test))\n if (!isOnWhitelist) continue\n try {\n const src = await importModule(moduleName)\n if (!src) continue\n for (const specifier of node.specifiers) {\n if (t.isImportSpecifier(specifier) && t.isIdentifier(specifier.imported)) {\n if (typeof src[specifier.imported.name] !== 'undefined') {\n const val = src[specifier.local.name]\n ret[specifier.local.name] = val\n }\n }\n }\n } catch (err: any) {\n if (process.env.DEBUG?.startsWith('tamagui')) {\n // eslint-disable-next-line no-console\n console.log(`Error in partial evaluation`, err.message, err.stack)\n } else {\n // eslint-disable-next-line no-console\n console.warn(\n ` | Skipping partial evaluation of constant file: ${moduleName} (DEBUG=tamagui for more)`\n )\n }\n }\n }\n }\n\n if (!bindingCache) {\n throw new Error('BindingCache is a required param')\n }\n\n for (const k in bindings) {\n const binding = bindings[k]\n\n // check to see if the item is a module\n const sourceModule = getSourceModule(k, binding)\n if (sourceModule) {\n if (!sourceModule.sourceModule) {\n continue\n }\n\n const moduleName = resolveImportPath(sourcePath, sourceModule.sourceModule)\n const isOnWhitelist = whitelist.some((test) => moduleName.endsWith(test))\n\n // TODO we could cache this at the file level.. and check if its been touched since\n\n if (isOnWhitelist) {\n const src = importModule(moduleName)\n if (!src) {\n // eslint-disable-next-line no-console\n console.log(\n ` | \u26A0\uFE0F Missing file ${moduleName} via ${sourcePath} import ${sourceModule.sourceModule}?`\n )\n return {}\n }\n if (sourceModule.destructured) {\n if (sourceModule.imported) {\n ret[k] = src[sourceModule.imported]\n }\n } else {\n ret[k] = src\n }\n }\n continue\n }\n\n const { parent } = binding.path\n\n if (!t.isVariableDeclaration(parent) || parent.kind !== 'const') {\n continue\n }\n\n // pick out the right variable declarator\n const dec = parent.declarations.find((d) => t.isIdentifier(d.id) && d.id.name === k)\n\n // if init is not set, there's nothing to evaluate\n // TODO: handle spread syntax\n if (!dec || !dec.init) {\n continue\n }\n\n // missing start/end will break caching\n if (typeof dec.id.start !== 'number' || typeof dec.id.end !== 'number') {\n // eslint-disable-next-line no-console\n console.error('dec.id.start/end is not a number')\n continue\n }\n\n if (!t.isIdentifier(dec.id)) {\n // eslint-disable-next-line no-console\n console.error('dec is not an identifier')\n continue\n }\n\n const cacheKey = `${dec.id.name}_${dec.id.start}-${dec.id.end}`\n\n // retrieve value from cache\n if (bindingCache.hasOwnProperty(cacheKey)) {\n ret[k] = bindingCache[cacheKey]\n continue\n }\n // retrieve value from cache\n if (bindingCache.hasOwnProperty(cacheKey)) {\n ret[k] = bindingCache[cacheKey]\n continue\n }\n\n // evaluate\n try {\n ret[k] = evaluateAstNode(dec.init, undefined, shouldPrintDeb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OAAO,aAAa,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC;AAInF,QAAI,CAAC,OAAO,CAAC,IAAI,MAAM;AACrB;AAAA,IACF;AAGA,QAAI,OAAO,IAAI,GAAG,UAAU,YAAY,OAAO,IAAI,GAAG,QAAQ,UAAU;AAEtE,cAAQ,MAAM,kCAAkC;AAChD;AAAA,IACF;AAEA,QAAI,CAAC,EAAE,aAAa,IAAI,EAAE,GAAG;AAE3B,cAAQ,MAAM,0BAA0B;AACxC;AAAA,IACF;AAEA,UAAM,WAAW,GAAG,IAAI,GAAG,QAAQ,IAAI,GAAG,SAAS,IAAI,GAAG;AAG1D,QAAI,aAAa,eAAe,QAAQ,GAAG;AACzC,UAAI,KAAK,aAAa;AACtB;AAAA,IACF;AAEA,QAAI,aAAa,eAAe,QAAQ,GAAG;AACzC,UAAI,KAAK,aAAa;AACtB;AAAA,IACF;AAGA,QAAI;AACF,UAAI,SAAK,wCAAgB,IAAI,MAAM,QAAW,gBAAgB;AAC9D,mBAAa,YAAY,IAAI;AAC7B;AAAA,IACF,QAAE;AAAA,IAEF;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/static",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.177",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"main": "dist",
|
|
@@ -37,17 +37,17 @@
|
|
|
37
37
|
"@babel/runtime": "^7.18.9",
|
|
38
38
|
"@babel/traverse": "^7.18.11",
|
|
39
39
|
"@expo/match-media": "^0.3.0",
|
|
40
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
41
|
-
"@tamagui/cli-color": "^1.0.1-beta.
|
|
42
|
-
"@tamagui/config-default-node": "^1.0.1-beta.
|
|
43
|
-
"@tamagui/core-node": "^1.0.1-beta.
|
|
44
|
-
"@tamagui/fake-react-native": "^1.0.1-beta.
|
|
45
|
-
"@tamagui/helpers": "^1.0.1-beta.
|
|
46
|
-
"@tamagui/helpers-node": "^1.0.1-beta.
|
|
47
|
-
"@tamagui/patch-rnw": "^1.0.1-beta.
|
|
48
|
-
"@tamagui/proxy-worm": "^1.0.1-beta.
|
|
49
|
-
"@tamagui/react-native-svg": "^1.0.1-beta.
|
|
50
|
-
"@tamagui/shorthands": "^1.0.1-beta.
|
|
40
|
+
"@tamagui/build": "^1.0.1-beta.177",
|
|
41
|
+
"@tamagui/cli-color": "^1.0.1-beta.177",
|
|
42
|
+
"@tamagui/config-default-node": "^1.0.1-beta.177",
|
|
43
|
+
"@tamagui/core-node": "^1.0.1-beta.177",
|
|
44
|
+
"@tamagui/fake-react-native": "^1.0.1-beta.177",
|
|
45
|
+
"@tamagui/helpers": "^1.0.1-beta.177",
|
|
46
|
+
"@tamagui/helpers-node": "^1.0.1-beta.177",
|
|
47
|
+
"@tamagui/patch-rnw": "^1.0.1-beta.177",
|
|
48
|
+
"@tamagui/proxy-worm": "^1.0.1-beta.177",
|
|
49
|
+
"@tamagui/react-native-svg": "^1.0.1-beta.177",
|
|
50
|
+
"@tamagui/shorthands": "^1.0.1-beta.177",
|
|
51
51
|
"babel-literal-to-ast": "^2.1.0",
|
|
52
52
|
"esbuild": "^0.15.6",
|
|
53
53
|
"esbuild-register": "^3.3.3",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"fs-extra": "^10.1.0",
|
|
56
56
|
"invariant": "^2.2.4",
|
|
57
57
|
"lodash": "^4.17.21",
|
|
58
|
-
"react-native-web-lite": "^1.0.1-beta.
|
|
59
|
-
"tamagui": "^1.0.1-beta.
|
|
58
|
+
"react-native-web-lite": "^1.0.1-beta.177",
|
|
59
|
+
"tamagui": "^1.0.1-beta.177"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@babel/plugin-syntax-typescript": "^7.18.6",
|
|
@@ -198,7 +198,9 @@ export function createExtractor({ logger = console }: ExtractorOptions = { logge
|
|
|
198
198
|
const themeAccessListeners = new Set<AccessListener>()
|
|
199
199
|
const defaultTheme = new Proxy(proxiedTheme, {
|
|
200
200
|
get(target, key) {
|
|
201
|
-
|
|
201
|
+
if (Reflect.has(target, key)) {
|
|
202
|
+
themeAccessListeners.forEach((cb) => cb(String(key)))
|
|
203
|
+
}
|
|
202
204
|
return Reflect.get(target, key)
|
|
203
205
|
},
|
|
204
206
|
})
|
|
@@ -936,7 +938,7 @@ export function createExtractor({ logger = console }: ExtractorOptions = { logge
|
|
|
936
938
|
}
|
|
937
939
|
|
|
938
940
|
// native shouldn't extract variables
|
|
939
|
-
if (disableExtractVariables) {
|
|
941
|
+
if (disableExtractVariables === true) {
|
|
940
942
|
if (value) {
|
|
941
943
|
if (value.type === 'StringLiteral' && value.value[0] === '$') {
|
|
942
944
|
if (shouldPrintDebug) {
|
|
@@ -1403,11 +1405,13 @@ export function createExtractor({ logger = console }: ExtractorOptions = { logge
|
|
|
1403
1405
|
(staticConfig.neverFlatten === 'jsx' ? hasOnlyStringChildren : true)
|
|
1404
1406
|
|
|
1405
1407
|
const shouldWrapTheme = shouldFlatten && themeVal
|
|
1408
|
+
const usedThemeKeys = new Set<string>()
|
|
1406
1409
|
|
|
1407
1410
|
if (disableExtractVariables) {
|
|
1408
1411
|
// if it accesses any theme values during evaluation
|
|
1409
1412
|
themeAccessListeners.add((key) => {
|
|
1410
1413
|
shouldFlatten = false
|
|
1414
|
+
usedThemeKeys.add(key)
|
|
1411
1415
|
if (shouldPrintDebug) {
|
|
1412
1416
|
logger.info([' ! accessing theme key, avoid flatten', key].join(' '))
|
|
1413
1417
|
}
|
|
@@ -1666,7 +1670,7 @@ export function createExtractor({ logger = console }: ExtractorOptions = { logge
|
|
|
1666
1670
|
// finally we have all styles + expansions, lets see if we need to skip
|
|
1667
1671
|
// any and keep them as attrs
|
|
1668
1672
|
if (disableExtractVariables) {
|
|
1669
|
-
if (value[0] === '$') {
|
|
1673
|
+
if (value[0] === '$' && (usedThemeKeys.has(key) || usedThemeKeys.has(fullKey))) {
|
|
1670
1674
|
if (shouldPrintDebug) {
|
|
1671
1675
|
logger.info([` keeping variable inline: ${key} =`, value].join(' '))
|
|
1672
1676
|
}
|
|
@@ -120,13 +120,14 @@ export async function getStaticBindingsForScope(
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
} catch (err: any) {
|
|
123
|
-
// eslint-disable-next-line no-console
|
|
124
|
-
console.warn(
|
|
125
|
-
` | Skipping evaluating module: ${moduleName} ${err.message} (DEBUG=tamagui for stack)`
|
|
126
|
-
)
|
|
127
123
|
if (process.env.DEBUG?.startsWith('tamagui')) {
|
|
128
124
|
// eslint-disable-next-line no-console
|
|
129
|
-
console.log(err.stack)
|
|
125
|
+
console.log(`Error in partial evaluation`, err.message, err.stack)
|
|
126
|
+
} else {
|
|
127
|
+
// eslint-disable-next-line no-console
|
|
128
|
+
console.warn(
|
|
129
|
+
` | Skipping partial evaluation of constant file: ${moduleName} (DEBUG=tamagui for more)`
|
|
130
|
+
)
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
133
|
}
|