@tamagui/static 1.0.1-beta.155 → 1.0.1-beta.156
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.
|
@@ -218,7 +218,7 @@ function createExtractor({ logger = console } = { logger: console }) {
|
|
|
218
218
|
const callTraverse = (a) => {
|
|
219
219
|
return fileOrPath.type === "File" ? (0, import_traverse.default)(fileOrPath, a) : fileOrPath.traverse(a);
|
|
220
220
|
};
|
|
221
|
-
let programPath;
|
|
221
|
+
let programPath = null;
|
|
222
222
|
const res = {
|
|
223
223
|
styled: 0,
|
|
224
224
|
flattened: 0,
|
|
@@ -424,7 +424,7 @@ function createExtractor({ logger = console } = { logger: console }) {
|
|
|
424
424
|
const [test, alt, cons] = conditional;
|
|
425
425
|
if (!test)
|
|
426
426
|
throw new Error(`no test`);
|
|
427
|
-
if ([alt, cons].some((side) => side && !
|
|
427
|
+
if ([alt, cons].some((side) => side && !isStaticObject2(side))) {
|
|
428
428
|
if (shouldPrintDebug) {
|
|
429
429
|
logger.info(`not extractable ${alt} ${cons}`);
|
|
430
430
|
}
|
|
@@ -740,7 +740,7 @@ function createExtractor({ logger = console } = { logger: console }) {
|
|
|
740
740
|
}
|
|
741
741
|
return null;
|
|
742
742
|
}
|
|
743
|
-
},
|
|
743
|
+
}, isStaticObject2 = function(obj) {
|
|
744
744
|
return t.isObjectExpression(obj) && obj.properties.every((prop) => {
|
|
745
745
|
if (!t.isObjectProperty(prop)) {
|
|
746
746
|
logger.info(["not object prop", prop].join(" "));
|
|
@@ -759,7 +759,7 @@ function createExtractor({ logger = console } = { logger: console }) {
|
|
|
759
759
|
if (!side) {
|
|
760
760
|
return null;
|
|
761
761
|
}
|
|
762
|
-
if (!
|
|
762
|
+
if (!isStaticObject2(side)) {
|
|
763
763
|
throw new Error("not extractable");
|
|
764
764
|
}
|
|
765
765
|
return side.properties.flatMap((property) => {
|
|
@@ -869,7 +869,7 @@ function createExtractor({ logger = console } = { logger: console }) {
|
|
|
869
869
|
}
|
|
870
870
|
}
|
|
871
871
|
};
|
|
872
|
-
var evaluateAttribute = evaluateAttribute2,
|
|
872
|
+
var evaluateAttribute = evaluateAttribute2, isStaticObject = isStaticObject2, createTernariesFromObjectProperties = createTernariesFromObjectProperties2, splitVariants = splitVariants2, expandStylesWithoutVariants = expandStylesWithoutVariants2, mergeStyles = mergeStyles2;
|
|
873
873
|
const { staticConfig } = component;
|
|
874
874
|
const variants = staticConfig.variants || {};
|
|
875
875
|
const isTextView = staticConfig.isText || false;
|
|
@@ -1049,8 +1049,8 @@ function createExtractor({ logger = console } = { logger: console }) {
|
|
|
1049
1049
|
const themeVal = inlined.get("theme");
|
|
1050
1050
|
inlined.delete("theme");
|
|
1051
1051
|
for (const [key] of [...inlined]) {
|
|
1052
|
-
const
|
|
1053
|
-
if (INLINE_EXTRACTABLE[key] ||
|
|
1052
|
+
const isStaticObjectVariant = ((_a = staticConfig.variants) == null ? void 0 : _a[key]) && variantValues.has(key);
|
|
1053
|
+
if (INLINE_EXTRACTABLE[key] || isStaticObjectVariant) {
|
|
1054
1054
|
inlined.delete(key);
|
|
1055
1055
|
}
|
|
1056
1056
|
}
|
|
@@ -1069,30 +1069,36 @@ function createExtractor({ logger = console } = { logger: console }) {
|
|
|
1069
1069
|
logger.info([" - flatten?", (0, import_extractHelpers.objToStr)({ hasSpread, shouldDeopt, shouldFlatten, canFlattenProps, shouldWrapTheme, hasOnlyStringChildren }), "inlined", [...inlined]].join(" "));
|
|
1070
1070
|
}
|
|
1071
1071
|
if (shouldFlatten && shouldWrapTheme) {
|
|
1072
|
-
if (
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
t.
|
|
1082
|
-
|
|
1083
|
-
|
|
1072
|
+
if (!programPath) {
|
|
1073
|
+
console.warn(
|
|
1074
|
+
`No program path found, avoiding importing flattening / importing theme in ${sourcePath}`
|
|
1075
|
+
);
|
|
1076
|
+
} else {
|
|
1077
|
+
if (shouldPrintDebug) {
|
|
1078
|
+
logger.info([" - wrapping theme", themeVal].join(" "));
|
|
1079
|
+
}
|
|
1080
|
+
attrs = attrs.filter(
|
|
1081
|
+
(x) => x.type === "attr" && t.isJSXAttribute(x.value) && x.value.name.name === "theme" ? false : true
|
|
1082
|
+
);
|
|
1083
|
+
if (!hasImportedTheme) {
|
|
1084
|
+
hasImportedTheme = true;
|
|
1085
|
+
programPath.node.body.push(
|
|
1086
|
+
t.importDeclaration(
|
|
1087
|
+
[t.importSpecifier(t.identifier("_TamaguiTheme"), t.identifier("Theme"))],
|
|
1088
|
+
t.stringLiteral("@tamagui/core")
|
|
1089
|
+
)
|
|
1090
|
+
);
|
|
1091
|
+
}
|
|
1092
|
+
traversePath.replaceWith(
|
|
1093
|
+
t.jsxElement(
|
|
1094
|
+
t.jsxOpeningElement(t.jsxIdentifier("_TamaguiTheme"), [
|
|
1095
|
+
t.jsxAttribute(t.jsxIdentifier("name"), themeVal.value)
|
|
1096
|
+
]),
|
|
1097
|
+
t.jsxClosingElement(t.jsxIdentifier("_TamaguiTheme")),
|
|
1098
|
+
[traversePath.node]
|
|
1084
1099
|
)
|
|
1085
1100
|
);
|
|
1086
1101
|
}
|
|
1087
|
-
traversePath.replaceWith(
|
|
1088
|
-
t.jsxElement(
|
|
1089
|
-
t.jsxOpeningElement(t.jsxIdentifier("_TamaguiTheme"), [
|
|
1090
|
-
t.jsxAttribute(t.jsxIdentifier("name"), themeVal.value)
|
|
1091
|
-
]),
|
|
1092
|
-
t.jsxClosingElement(t.jsxIdentifier("_TamaguiTheme")),
|
|
1093
|
-
[traversePath.node]
|
|
1094
|
-
)
|
|
1095
|
-
);
|
|
1096
1102
|
}
|
|
1097
1103
|
if (shouldFlatten) {
|
|
1098
1104
|
const defaultStyleAttrs = Object.keys(staticConfig.defaultProps).flatMap((key) => {
|
|
@@ -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 { 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 {\n config = 'tamagui.config.ts',\n importsWhitelist = ['constants.js'],\n evaluateVars = true,\n shouldPrintDebug = false,\n sourcePath = '',\n onExtractTag,\n onStyleRule,\n getFlattenedNode,\n disable,\n disableExtraction,\n disableExtractInlineMedia,\n disableExtractVariables,\n disableDebugAttr,\n extractStyledDefinitions = false,\n prefixLogs,\n excludeProps,\n target,\n ...props\n }: ExtractorParseProps\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 (key[0] === '$') {\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 (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 isValidComponent = node.specifiers.some((specifier) => {\n const name = specifier.local.name\n return !!(validComponents[name] || validHooks[name])\n })\n if (shouldPrintDebug === 'verbose') {\n logger.info(`import from ${from} isValidComponent ${isValidComponent}`)\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>\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 (shouldPrintDebug) {\n logger.info(\n `Didn't recognize styled(${name}), ${name} isn't in design system provided to tamagui.config.ts. Will attempt to build isolated and analyze.. ${programPath}`\n )\n }\n\n const out = loadTamaguiSync({\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 }\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 // turn parsed styles into CSS\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]\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(['Error extracting attribute', err.message, err.stack].join(' '))\n logger.info(`node ${path.node}`)\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 && !isExtractable(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 isExtractable(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 (!isExtractable(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 isExtractableVariant = staticConfig.variants?.[key] && variantValues.has(key)\n if (INLINE_EXTRACTABLE[key] || isExtractableVariant) {\n inlined.delete(key)\n }\n }\n\n const canFlattenProps = inlined.size === 0\n\n let shouldFlatten =\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 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 // prettier-ignore\n logger.info([' - flatten?', objToStr({ hasSpread, shouldDeopt, shouldFlatten, canFlattenProps, shouldWrapTheme, hasOnlyStringChildren }), 'inlined', [...inlined]].join(' '))\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 (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 // 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 props['debug']\n )\n\n // logger.info('outout', out)\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,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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K,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
|
-
"names": ["projectInfo", "target", "traverse", "out", "evaluateAttribute", "
|
|
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 { 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 {\n config = 'tamagui.config.ts',\n importsWhitelist = ['constants.js'],\n evaluateVars = true,\n shouldPrintDebug = false,\n sourcePath = '',\n onExtractTag,\n onStyleRule,\n getFlattenedNode,\n disable,\n disableExtraction,\n disableExtractInlineMedia,\n disableExtractVariables,\n disableDebugAttr,\n extractStyledDefinitions = false,\n prefixLogs,\n excludeProps,\n target,\n ...props\n }: ExtractorParseProps\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 (key[0] === '$') {\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 (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 isValidComponent = node.specifiers.some((specifier) => {\n const name = specifier.local.name\n return !!(validComponents[name] || validHooks[name])\n })\n if (shouldPrintDebug === 'verbose') {\n logger.info(`import from ${from} isValidComponent ${isValidComponent}`)\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 (shouldPrintDebug) {\n logger.info(\n `Didn't recognize styled(${name}), ${name} isn't in design system provided to tamagui.config.ts. Will attempt to build isolated and analyze.. ${programPath}`\n )\n }\n\n const out = loadTamaguiSync({\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 }\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 // turn parsed styles into CSS\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]\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(['Error extracting attribute', err.message, err.stack].join(' '))\n logger.info(`node ${path.node}`)\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 !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 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 // prettier-ignore\n logger.info([' - flatten?', objToStr({ hasSpread, shouldDeopt, shouldFlatten, canFlattenProps, shouldWrapTheme, hasOnlyStringChildren }), 'inlined', [...inlined]].join(' '))\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 props['debug']\n )\n\n // logger.info('outout', out)\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,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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YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,SAAS;AAAA,YACT;AAAA,YACA,aAAa;AAAA,YACb;AAAA,YACA;AAAA,YACA;AAAA,UACF,CAAC;AAAA,QACH,UAAE;AACA,cAAI,gBAAgB;AAClB,+BAAmB;AAAA,UACrB;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAED,OAAG,KAAK,YAAY,CAAC,CAAC,gBAAgB;AAKtC,QAAI,mBAAmB,MAAM;AAC3B,YAAM,MAAM,MAAM,KAAK,kBAAkB;AACzC,UAAI,kBAAkB;AACpB,eAAO,KAAK,4BAAqB,IAAI,QAAQ;AAAA,MAC/C;AACA,iBAAW,QAAQ,KAAK;AACtB,wDAAkB,MAAM,gBAAgB;AAAA,MAC1C;AAAA,IACF;AAEA,OAAG,KAAK,qBAAqB,SAAS;AAEtC,WAAO;AAAA,EACT;AACF;",
|
|
6
|
+
"names": ["projectInfo", "target", "traverse", "out", "evaluateAttribute", "isStaticObject", "createTernariesFromObjectProperties", "ternaries", "value", "splitVariants", "_a", "variants", "expandStylesWithoutVariants", "mergeStyles", "prev", "res", "key", "props"]
|
|
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.156",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"main": "dist",
|
|
@@ -37,16 +37,16 @@
|
|
|
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/patch-rnw": "^1.0.1-beta.
|
|
47
|
-
"@tamagui/proxy-worm": "^1.0.1-beta.
|
|
48
|
-
"@tamagui/react-native-svg": "^1.0.1-beta.
|
|
49
|
-
"@tamagui/shorthands": "^1.0.1-beta.
|
|
40
|
+
"@tamagui/build": "^1.0.1-beta.156",
|
|
41
|
+
"@tamagui/cli-color": "^1.0.1-beta.156",
|
|
42
|
+
"@tamagui/config-default-node": "^1.0.1-beta.156",
|
|
43
|
+
"@tamagui/core-node": "^1.0.1-beta.156",
|
|
44
|
+
"@tamagui/fake-react-native": "^1.0.1-beta.156",
|
|
45
|
+
"@tamagui/helpers": "^1.0.1-beta.156",
|
|
46
|
+
"@tamagui/patch-rnw": "^1.0.1-beta.156",
|
|
47
|
+
"@tamagui/proxy-worm": "^1.0.1-beta.156",
|
|
48
|
+
"@tamagui/react-native-svg": "^1.0.1-beta.156",
|
|
49
|
+
"@tamagui/shorthands": "^1.0.1-beta.156",
|
|
50
50
|
"babel-literal-to-ast": "^2.1.0",
|
|
51
51
|
"esbuild": "^0.14.49",
|
|
52
52
|
"esbuild-register": "^3.3.3",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"fs-extra": "^10.1.0",
|
|
55
55
|
"invariant": "^2.2.4",
|
|
56
56
|
"lodash": "^4.17.21",
|
|
57
|
-
"react-native-web-lite": "^1.0.1-beta.
|
|
58
|
-
"tamagui": "^1.0.1-beta.
|
|
57
|
+
"react-native-web-lite": "^1.0.1-beta.156",
|
|
58
|
+
"tamagui": "^1.0.1-beta.156"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@babel/plugin-syntax-typescript": "^7.18.6",
|
|
@@ -287,7 +287,7 @@ export function createExtractor({ logger = console }: ExtractorOptions = { logge
|
|
|
287
287
|
/**
|
|
288
288
|
* Step 2: Statically extract from JSX < /> nodes
|
|
289
289
|
*/
|
|
290
|
-
let programPath: NodePath<t.Program>
|
|
290
|
+
let programPath: NodePath<t.Program> | null = null
|
|
291
291
|
|
|
292
292
|
const res = {
|
|
293
293
|
styled: 0,
|
|
@@ -774,7 +774,7 @@ export function createExtractor({ logger = console }: ExtractorOptions = { logge
|
|
|
774
774
|
if (conditional) {
|
|
775
775
|
const [test, alt, cons] = conditional
|
|
776
776
|
if (!test) throw new Error(`no test`)
|
|
777
|
-
if ([alt, cons].some((side) => side && !
|
|
777
|
+
if ([alt, cons].some((side) => side && !isStaticObject(side))) {
|
|
778
778
|
if (shouldPrintDebug) {
|
|
779
779
|
logger.info(`not extractable ${alt} ${cons}`)
|
|
780
780
|
}
|
|
@@ -1170,7 +1170,7 @@ export function createExtractor({ logger = console }: ExtractorOptions = { logge
|
|
|
1170
1170
|
}
|
|
1171
1171
|
} // END function evaluateAttribute
|
|
1172
1172
|
|
|
1173
|
-
function
|
|
1173
|
+
function isStaticObject(obj: t.Node): obj is t.ObjectExpression {
|
|
1174
1174
|
return (
|
|
1175
1175
|
t.isObjectExpression(obj) &&
|
|
1176
1176
|
obj.properties.every((prop) => {
|
|
@@ -1207,7 +1207,7 @@ export function createExtractor({ logger = console }: ExtractorOptions = { logge
|
|
|
1207
1207
|
if (!side) {
|
|
1208
1208
|
return null
|
|
1209
1209
|
}
|
|
1210
|
-
if (!
|
|
1210
|
+
if (!isStaticObject(side)) {
|
|
1211
1211
|
throw new Error('not extractable')
|
|
1212
1212
|
}
|
|
1213
1213
|
return side.properties.flatMap((property) => {
|
|
@@ -1355,8 +1355,8 @@ export function createExtractor({ logger = console }: ExtractorOptions = { logge
|
|
|
1355
1355
|
inlined.delete('theme')
|
|
1356
1356
|
|
|
1357
1357
|
for (const [key] of [...inlined]) {
|
|
1358
|
-
const
|
|
1359
|
-
if (INLINE_EXTRACTABLE[key] ||
|
|
1358
|
+
const isStaticObjectVariant = staticConfig.variants?.[key] && variantValues.has(key)
|
|
1359
|
+
if (INLINE_EXTRACTABLE[key] || isStaticObjectVariant) {
|
|
1360
1360
|
inlined.delete(key)
|
|
1361
1361
|
}
|
|
1362
1362
|
}
|
|
@@ -1390,37 +1390,43 @@ export function createExtractor({ logger = console }: ExtractorOptions = { logge
|
|
|
1390
1390
|
// TODO move this to bottom and re-check shouldFlatten
|
|
1391
1391
|
// account for shouldFlatten could change w the above block "if (disableExtractVariables)"
|
|
1392
1392
|
if (shouldFlatten && shouldWrapTheme) {
|
|
1393
|
-
if (
|
|
1394
|
-
|
|
1395
|
-
|
|
1393
|
+
if (!programPath) {
|
|
1394
|
+
console.warn(
|
|
1395
|
+
`No program path found, avoiding importing flattening / importing theme in ${sourcePath}`
|
|
1396
|
+
)
|
|
1397
|
+
} else {
|
|
1398
|
+
if (shouldPrintDebug) {
|
|
1399
|
+
logger.info([' - wrapping theme', themeVal].join(' '))
|
|
1400
|
+
}
|
|
1396
1401
|
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1402
|
+
// remove theme attribute from flattened node
|
|
1403
|
+
attrs = attrs.filter((x) =>
|
|
1404
|
+
x.type === 'attr' && t.isJSXAttribute(x.value) && x.value.name.name === 'theme'
|
|
1405
|
+
? false
|
|
1406
|
+
: true
|
|
1407
|
+
)
|
|
1403
1408
|
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1409
|
+
// add import
|
|
1410
|
+
if (!hasImportedTheme) {
|
|
1411
|
+
hasImportedTheme = true
|
|
1412
|
+
programPath.node.body.push(
|
|
1413
|
+
t.importDeclaration(
|
|
1414
|
+
[t.importSpecifier(t.identifier('_TamaguiTheme'), t.identifier('Theme'))],
|
|
1415
|
+
t.stringLiteral('@tamagui/core')
|
|
1416
|
+
)
|
|
1411
1417
|
)
|
|
1412
|
-
|
|
1413
|
-
}
|
|
1418
|
+
}
|
|
1414
1419
|
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1420
|
+
traversePath.replaceWith(
|
|
1421
|
+
t.jsxElement(
|
|
1422
|
+
t.jsxOpeningElement(t.jsxIdentifier('_TamaguiTheme'), [
|
|
1423
|
+
t.jsxAttribute(t.jsxIdentifier('name'), themeVal.value),
|
|
1424
|
+
]),
|
|
1425
|
+
t.jsxClosingElement(t.jsxIdentifier('_TamaguiTheme')),
|
|
1426
|
+
[traversePath.node]
|
|
1427
|
+
)
|
|
1422
1428
|
)
|
|
1423
|
-
|
|
1429
|
+
}
|
|
1424
1430
|
}
|
|
1425
1431
|
|
|
1426
1432
|
// only if we flatten, ensure the default styles are there
|