@tamagui/static 1.111.13 → 1.112.0-1727286694781
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{cjs/checkDeps.js.map → checkDeps.js.map} +1 -1
- package/dist/{cjs/checkDeps.native.js.map → checkDeps.native.js.map} +1 -1
- package/dist/{cjs/constants.js.map → constants.js.map} +1 -1
- package/dist/{cjs/constants.native.js.map → constants.native.js.map} +1 -1
- package/dist/{cjs/exports.js.map → exports.js.map} +1 -1
- package/dist/{cjs/exports.native.js.map → exports.native.js.map} +1 -1
- package/dist/{cjs/extractor → extractor}/accessSafe.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/accessSafe.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/babelParse.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/babelParse.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/buildClassName.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/buildClassName.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/bundle.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/bundle.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/bundleConfig.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/bundleConfig.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/createEvaluator.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/createEvaluator.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/createExtractor.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/createExtractor.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/createLogger.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/createLogger.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/ensureImportingConcat.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/ensureImportingConcat.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/esbuildAliasPlugin.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/esbuildAliasPlugin.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/evaluateAstNode.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/evaluateAstNode.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/extractHelpers.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/extractHelpers.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/extractMediaStyle.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/extractMediaStyle.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/extractToClassNames.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/extractToClassNames.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/extractToNative.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/extractToNative.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/findTopmostFunction.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/findTopmostFunction.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/generateTamaguiStudioConfig.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/generateTamaguiStudioConfig.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/generatedUid.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/generatedUid.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/getPrefixLogs.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/getPrefixLogs.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/getPropValueFromAttributes.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/getPropValueFromAttributes.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/getSourceModule.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/getSourceModule.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/getStaticBindingsForScope.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/getStaticBindingsForScope.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/getTamaguiConfigPathFromOptionsConfig.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/getTamaguiConfigPathFromOptionsConfig.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/hoistClassNames.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/hoistClassNames.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/literalToAst.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/literalToAst.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/loadFile.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/loadFile.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/loadTamagui.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/loadTamagui.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/logLines.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/logLines.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/normalizeTernaries.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/normalizeTernaries.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/propsToFontFamilyCache.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/propsToFontFamilyCache.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/removeUnusedHooks.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/removeUnusedHooks.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/timer.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/timer.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/validHTMLAttributes.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/validHTMLAttributes.native.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/watchTamaguiConfig.js.map +1 -1
- package/dist/{cjs/extractor → extractor}/watchTamaguiConfig.native.js.map +1 -1
- package/dist/{cjs/getPragmaOptions.js.map → getPragmaOptions.js.map} +1 -1
- package/dist/{cjs/getPragmaOptions.native.js.map → getPragmaOptions.native.js.map} +1 -1
- package/dist/{cjs/helpers → helpers}/memoize.js.map +1 -1
- package/dist/{cjs/helpers → helpers}/memoize.native.js.map +1 -1
- package/dist/{cjs/helpers → helpers}/requireTamaguiCore.js.map +1 -1
- package/dist/{cjs/helpers → helpers}/requireTamaguiCore.native.js.map +1 -1
- package/dist/{cjs/index.js.map → index.js.map} +1 -1
- package/dist/{cjs/index.native.js.map → index.native.js.map} +1 -1
- package/dist/{cjs/minifyCSS.js.map → minifyCSS.js.map} +1 -1
- package/dist/{cjs/minifyCSS.native.js.map → minifyCSS.native.js.map} +1 -1
- package/dist/{cjs/registerRequire.js.map → registerRequire.js.map} +1 -1
- package/dist/{cjs/registerRequire.native.js.map → registerRequire.native.js.map} +1 -1
- package/dist/{cjs/server.js.map → server.js.map} +1 -1
- package/dist/{cjs/server.native.js.map → server.native.js.map} +1 -1
- package/dist/{cjs/types.js.map → types.js.map} +1 -1
- package/dist/types.native.js.map +6 -0
- package/package.json +18 -20
- package/dist/cjs/types.native.js.map +0 -6
- package/dist/esm/checkDeps.js +0 -10
- package/dist/esm/checkDeps.js.map +0 -6
- package/dist/esm/checkDeps.mjs +0 -7
- package/dist/esm/checkDeps.mjs.map +0 -1
- package/dist/esm/checkDeps.native.js +0 -10
- package/dist/esm/checkDeps.native.js.map +0 -1
- package/dist/esm/constants.js +0 -10
- package/dist/esm/constants.js.map +0 -6
- package/dist/esm/constants.mjs +0 -11
- package/dist/esm/constants.mjs.map +0 -1
- package/dist/esm/constants.native.js +0 -12
- package/dist/esm/constants.native.js.map +0 -1
- package/dist/esm/exports.js +0 -19
- package/dist/esm/exports.js.map +0 -6
- package/dist/esm/exports.mjs +0 -16
- package/dist/esm/exports.mjs.map +0 -1
- package/dist/esm/exports.native.js +0 -16
- package/dist/esm/exports.native.js.map +0 -1
- package/dist/esm/extractor/accessSafe.js +0 -23
- package/dist/esm/extractor/accessSafe.js.map +0 -6
- package/dist/esm/extractor/accessSafe.mjs +0 -12
- package/dist/esm/extractor/accessSafe.mjs.map +0 -1
- package/dist/esm/extractor/accessSafe.native.js +0 -12
- package/dist/esm/extractor/accessSafe.native.js.map +0 -1
- package/dist/esm/extractor/babelParse.js +0 -35
- package/dist/esm/extractor/babelParse.js.map +0 -6
- package/dist/esm/extractor/babelParse.mjs +0 -19
- package/dist/esm/extractor/babelParse.mjs.map +0 -1
- package/dist/esm/extractor/babelParse.native.js +0 -19
- package/dist/esm/extractor/babelParse.native.js.map +0 -1
- package/dist/esm/extractor/buildClassName.js +0 -48
- package/dist/esm/extractor/buildClassName.js.map +0 -6
- package/dist/esm/extractor/buildClassName.mjs +0 -27
- package/dist/esm/extractor/buildClassName.mjs.map +0 -1
- package/dist/esm/extractor/buildClassName.native.js +0 -30
- package/dist/esm/extractor/buildClassName.native.js.map +0 -1
- package/dist/esm/extractor/bundle.js +0 -113
- package/dist/esm/extractor/bundle.js.map +0 -6
- package/dist/esm/extractor/bundle.mjs +0 -110
- package/dist/esm/extractor/bundle.mjs.map +0 -1
- package/dist/esm/extractor/bundle.native.js +0 -132
- package/dist/esm/extractor/bundle.native.js.map +0 -1
- package/dist/esm/extractor/bundleConfig.js +0 -310
- package/dist/esm/extractor/bundleConfig.js.map +0 -6
- package/dist/esm/extractor/bundleConfig.mjs +0 -259
- package/dist/esm/extractor/bundleConfig.mjs.map +0 -1
- package/dist/esm/extractor/bundleConfig.native.js +0 -322
- package/dist/esm/extractor/bundleConfig.native.js.map +0 -1
- package/dist/esm/extractor/createEvaluator.js +0 -35
- package/dist/esm/extractor/createEvaluator.js.map +0 -6
- package/dist/esm/extractor/createEvaluator.mjs +0 -35
- package/dist/esm/extractor/createEvaluator.mjs.map +0 -1
- package/dist/esm/extractor/createEvaluator.native.js +0 -38
- package/dist/esm/extractor/createEvaluator.native.js.map +0 -1
- package/dist/esm/extractor/createExtractor.js +0 -1225
- package/dist/esm/extractor/createExtractor.js.map +0 -6
- package/dist/esm/extractor/createExtractor.mjs +0 -972
- package/dist/esm/extractor/createExtractor.mjs.map +0 -1
- package/dist/esm/extractor/createExtractor.native.js +0 -1144
- package/dist/esm/extractor/createExtractor.native.js.map +0 -1
- package/dist/esm/extractor/createLogger.js +0 -17
- package/dist/esm/extractor/createLogger.js.map +0 -6
- package/dist/esm/extractor/createLogger.mjs +0 -22
- package/dist/esm/extractor/createLogger.mjs.map +0 -1
- package/dist/esm/extractor/createLogger.native.js +0 -25
- package/dist/esm/extractor/createLogger.native.js.map +0 -1
- package/dist/esm/extractor/ensureImportingConcat.js +0 -26
- package/dist/esm/extractor/ensureImportingConcat.js.map +0 -6
- package/dist/esm/extractor/ensureImportingConcat.mjs +0 -14
- package/dist/esm/extractor/ensureImportingConcat.mjs.map +0 -1
- package/dist/esm/extractor/ensureImportingConcat.native.js +0 -20
- package/dist/esm/extractor/ensureImportingConcat.native.js.map +0 -1
- package/dist/esm/extractor/esbuildAliasPlugin.js +0 -20
- package/dist/esm/extractor/esbuildAliasPlugin.js.map +0 -6
- package/dist/esm/extractor/esbuildAliasPlugin.mjs +0 -21
- package/dist/esm/extractor/esbuildAliasPlugin.mjs.map +0 -1
- package/dist/esm/extractor/esbuildAliasPlugin.native.js +0 -29
- package/dist/esm/extractor/esbuildAliasPlugin.native.js.map +0 -1
- package/dist/esm/extractor/evaluateAstNode.js +0 -75
- package/dist/esm/extractor/evaluateAstNode.js.map +0 -6
- package/dist/esm/extractor/evaluateAstNode.mjs +0 -49
- package/dist/esm/extractor/evaluateAstNode.mjs.map +0 -1
- package/dist/esm/extractor/evaluateAstNode.native.js +0 -49
- package/dist/esm/extractor/evaluateAstNode.native.js.map +0 -1
- package/dist/esm/extractor/extractHelpers.js +0 -89
- package/dist/esm/extractor/extractHelpers.js.map +0 -6
- package/dist/esm/extractor/extractHelpers.mjs +0 -73
- package/dist/esm/extractor/extractHelpers.mjs.map +0 -1
- package/dist/esm/extractor/extractHelpers.native.js +0 -122
- package/dist/esm/extractor/extractHelpers.native.js.map +0 -1
- package/dist/esm/extractor/extractMediaStyle.js +0 -102
- package/dist/esm/extractor/extractMediaStyle.js.map +0 -6
- package/dist/esm/extractor/extractMediaStyle.mjs +0 -94
- package/dist/esm/extractor/extractMediaStyle.mjs.map +0 -1
- package/dist/esm/extractor/extractMediaStyle.native.js +0 -125
- package/dist/esm/extractor/extractMediaStyle.native.js.map +0 -1
- package/dist/esm/extractor/extractToClassNames.js +0 -281
- package/dist/esm/extractor/extractToClassNames.js.map +0 -6
- package/dist/esm/extractor/extractToClassNames.mjs +0 -220
- package/dist/esm/extractor/extractToClassNames.mjs.map +0 -1
- package/dist/esm/extractor/extractToClassNames.native.js +0 -315
- package/dist/esm/extractor/extractToClassNames.native.js.map +0 -1
- package/dist/esm/extractor/extractToNative.js +0 -307
- package/dist/esm/extractor/extractToNative.js.map +0 -6
- package/dist/esm/extractor/extractToNative.mjs +0 -238
- package/dist/esm/extractor/extractToNative.mjs.map +0 -1
- package/dist/esm/extractor/extractToNative.native.js +0 -268
- package/dist/esm/extractor/extractToNative.native.js.map +0 -1
- package/dist/esm/extractor/findTopmostFunction.js +0 -16
- package/dist/esm/extractor/findTopmostFunction.js.map +0 -6
- package/dist/esm/extractor/findTopmostFunction.mjs +0 -11
- package/dist/esm/extractor/findTopmostFunction.mjs.map +0 -1
- package/dist/esm/extractor/findTopmostFunction.native.js +0 -11
- package/dist/esm/extractor/findTopmostFunction.native.js.map +0 -1
- package/dist/esm/extractor/generateTamaguiStudioConfig.js +0 -94
- package/dist/esm/extractor/generateTamaguiStudioConfig.js.map +0 -6
- package/dist/esm/extractor/generateTamaguiStudioConfig.mjs +0 -109
- package/dist/esm/extractor/generateTamaguiStudioConfig.mjs.map +0 -1
- package/dist/esm/extractor/generateTamaguiStudioConfig.native.js +0 -139
- package/dist/esm/extractor/generateTamaguiStudioConfig.native.js.map +0 -1
- package/dist/esm/extractor/generatedUid.js +0 -18
- package/dist/esm/extractor/generatedUid.js.map +0 -6
- package/dist/esm/extractor/generatedUid.mjs +0 -13
- package/dist/esm/extractor/generatedUid.mjs.map +0 -1
- package/dist/esm/extractor/generatedUid.native.js +0 -13
- package/dist/esm/extractor/generatedUid.native.js.map +0 -1
- package/dist/esm/extractor/getPrefixLogs.js +0 -7
- package/dist/esm/extractor/getPrefixLogs.js.map +0 -6
- package/dist/esm/extractor/getPrefixLogs.mjs +0 -5
- package/dist/esm/extractor/getPrefixLogs.mjs.map +0 -1
- package/dist/esm/extractor/getPrefixLogs.native.js +0 -6
- package/dist/esm/extractor/getPrefixLogs.native.js.map +0 -1
- package/dist/esm/extractor/getPropValueFromAttributes.js +0 -43
- package/dist/esm/extractor/getPropValueFromAttributes.js.map +0 -6
- package/dist/esm/extractor/getPropValueFromAttributes.mjs +0 -33
- package/dist/esm/extractor/getPropValueFromAttributes.mjs.map +0 -1
- package/dist/esm/extractor/getPropValueFromAttributes.native.js +0 -35
- package/dist/esm/extractor/getPropValueFromAttributes.native.js.map +0 -1
- package/dist/esm/extractor/getSourceModule.js +0 -42
- package/dist/esm/extractor/getSourceModule.js.map +0 -6
- package/dist/esm/extractor/getSourceModule.mjs +0 -34
- package/dist/esm/extractor/getSourceModule.mjs.map +0 -1
- package/dist/esm/extractor/getSourceModule.native.js +0 -50
- package/dist/esm/extractor/getSourceModule.native.js.map +0 -1
- package/dist/esm/extractor/getStaticBindingsForScope.js +0 -123
- package/dist/esm/extractor/getStaticBindingsForScope.js.map +0 -6
- package/dist/esm/extractor/getStaticBindingsForScope.mjs +0 -113
- package/dist/esm/extractor/getStaticBindingsForScope.mjs.map +0 -1
- package/dist/esm/extractor/getStaticBindingsForScope.native.js +0 -159
- package/dist/esm/extractor/getStaticBindingsForScope.native.js.map +0 -1
- package/dist/esm/extractor/getTamaguiConfigPathFromOptionsConfig.js +0 -8
- package/dist/esm/extractor/getTamaguiConfigPathFromOptionsConfig.js.map +0 -6
- package/dist/esm/extractor/getTamaguiConfigPathFromOptionsConfig.mjs +0 -6
- package/dist/esm/extractor/getTamaguiConfigPathFromOptionsConfig.mjs.map +0 -1
- package/dist/esm/extractor/getTamaguiConfigPathFromOptionsConfig.native.js +0 -6
- package/dist/esm/extractor/getTamaguiConfigPathFromOptionsConfig.native.js.map +0 -1
- package/dist/esm/extractor/hoistClassNames.js +0 -39
- package/dist/esm/extractor/hoistClassNames.js.map +0 -6
- package/dist/esm/extractor/hoistClassNames.mjs +0 -28
- package/dist/esm/extractor/hoistClassNames.mjs.map +0 -1
- package/dist/esm/extractor/hoistClassNames.native.js +0 -30
- package/dist/esm/extractor/hoistClassNames.native.js.map +0 -1
- package/dist/esm/extractor/literalToAst.js +0 -66
- package/dist/esm/extractor/literalToAst.js.map +0 -6
- package/dist/esm/extractor/literalToAst.mjs +0 -49
- package/dist/esm/extractor/literalToAst.mjs.map +0 -1
- package/dist/esm/extractor/literalToAst.native.js +0 -55
- package/dist/esm/extractor/literalToAst.native.js.map +0 -1
- package/dist/esm/extractor/loadFile.js +0 -14
- package/dist/esm/extractor/loadFile.js.map +0 -6
- package/dist/esm/extractor/loadFile.mjs +0 -12
- package/dist/esm/extractor/loadFile.mjs.map +0 -1
- package/dist/esm/extractor/loadFile.native.js +0 -20
- package/dist/esm/extractor/loadFile.native.js.map +0 -1
- package/dist/esm/extractor/loadTamagui.js +0 -262
- package/dist/esm/extractor/loadTamagui.js.map +0 -6
- package/dist/esm/extractor/loadTamagui.mjs +0 -251
- package/dist/esm/extractor/loadTamagui.mjs.map +0 -1
- package/dist/esm/extractor/loadTamagui.native.js +0 -284
- package/dist/esm/extractor/loadTamagui.native.js.map +0 -1
- package/dist/esm/extractor/logLines.js +0 -14
- package/dist/esm/extractor/logLines.js.map +0 -6
- package/dist/esm/extractor/logLines.mjs +0 -12
- package/dist/esm/extractor/logLines.mjs.map +0 -1
- package/dist/esm/extractor/logLines.native.js +0 -31
- package/dist/esm/extractor/logLines.native.js.map +0 -1
- package/dist/esm/extractor/normalizeTernaries.js +0 -37
- package/dist/esm/extractor/normalizeTernaries.js.map +0 -6
- package/dist/esm/extractor/normalizeTernaries.mjs +0 -34
- package/dist/esm/extractor/normalizeTernaries.mjs.map +0 -1
- package/dist/esm/extractor/normalizeTernaries.native.js +0 -38
- package/dist/esm/extractor/normalizeTernaries.native.js.map +0 -1
- package/dist/esm/extractor/propsToFontFamilyCache.js +0 -18
- package/dist/esm/extractor/propsToFontFamilyCache.js.map +0 -6
- package/dist/esm/extractor/propsToFontFamilyCache.mjs +0 -13
- package/dist/esm/extractor/propsToFontFamilyCache.mjs.map +0 -1
- package/dist/esm/extractor/propsToFontFamilyCache.native.js +0 -13
- package/dist/esm/extractor/propsToFontFamilyCache.native.js.map +0 -1
- package/dist/esm/extractor/removeUnusedHooks.js +0 -48
- package/dist/esm/extractor/removeUnusedHooks.js.map +0 -6
- package/dist/esm/extractor/removeUnusedHooks.mjs +0 -42
- package/dist/esm/extractor/removeUnusedHooks.mjs.map +0 -1
- package/dist/esm/extractor/removeUnusedHooks.native.js +0 -83
- package/dist/esm/extractor/removeUnusedHooks.native.js.map +0 -1
- package/dist/esm/extractor/timer.js +0 -22
- package/dist/esm/extractor/timer.js.map +0 -6
- package/dist/esm/extractor/timer.mjs +0 -20
- package/dist/esm/extractor/timer.mjs.map +0 -1
- package/dist/esm/extractor/timer.native.js +0 -22
- package/dist/esm/extractor/timer.native.js.map +0 -1
- package/dist/esm/extractor/validHTMLAttributes.js +0 -52
- package/dist/esm/extractor/validHTMLAttributes.js.map +0 -6
- package/dist/esm/extractor/validHTMLAttributes.mjs +0 -50
- package/dist/esm/extractor/validHTMLAttributes.mjs.map +0 -1
- package/dist/esm/extractor/validHTMLAttributes.native.js +0 -50
- package/dist/esm/extractor/validHTMLAttributes.native.js.map +0 -1
- package/dist/esm/extractor/watchTamaguiConfig.js +0 -38
- package/dist/esm/extractor/watchTamaguiConfig.js.map +0 -6
- package/dist/esm/extractor/watchTamaguiConfig.mjs +0 -32
- package/dist/esm/extractor/watchTamaguiConfig.mjs.map +0 -1
- package/dist/esm/extractor/watchTamaguiConfig.native.js +0 -33
- package/dist/esm/extractor/watchTamaguiConfig.native.js.map +0 -1
- package/dist/esm/getPragmaOptions.js +0 -33
- package/dist/esm/getPragmaOptions.js.map +0 -6
- package/dist/esm/getPragmaOptions.mjs +0 -31
- package/dist/esm/getPragmaOptions.mjs.map +0 -1
- package/dist/esm/getPragmaOptions.native.js +0 -51
- package/dist/esm/getPragmaOptions.native.js.map +0 -1
- package/dist/esm/helpers/memoize.js +0 -17
- package/dist/esm/helpers/memoize.js.map +0 -6
- package/dist/esm/helpers/memoize.mjs +0 -14
- package/dist/esm/helpers/memoize.mjs.map +0 -1
- package/dist/esm/helpers/memoize.native.js +0 -15
- package/dist/esm/helpers/memoize.native.js.map +0 -1
- package/dist/esm/helpers/requireTamaguiCore.js +0 -14
- package/dist/esm/helpers/requireTamaguiCore.js.map +0 -6
- package/dist/esm/helpers/requireTamaguiCore.mjs +0 -10
- package/dist/esm/helpers/requireTamaguiCore.mjs.map +0 -1
- package/dist/esm/helpers/requireTamaguiCore.native.js +0 -13
- package/dist/esm/helpers/requireTamaguiCore.native.js.map +0 -1
- package/dist/esm/index.js +0 -7
- package/dist/esm/index.js.map +0 -6
- package/dist/esm/index.mjs +0 -5
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js +0 -5
- package/dist/esm/index.native.js.map +0 -1
- package/dist/esm/minifyCSS.js +0 -15
- package/dist/esm/minifyCSS.js.map +0 -6
- package/dist/esm/minifyCSS.mjs +0 -16
- package/dist/esm/minifyCSS.mjs.map +0 -1
- package/dist/esm/minifyCSS.native.js +0 -16
- package/dist/esm/minifyCSS.native.js.map +0 -1
- package/dist/esm/registerRequire.js +0 -80
- package/dist/esm/registerRequire.js.map +0 -6
- package/dist/esm/registerRequire.mjs +0 -76
- package/dist/esm/registerRequire.mjs.map +0 -1
- package/dist/esm/registerRequire.native.js +0 -86
- package/dist/esm/registerRequire.native.js.map +0 -1
- package/dist/esm/server.js +0 -34
- package/dist/esm/server.js.map +0 -6
- package/dist/esm/server.mjs +0 -41
- package/dist/esm/server.mjs.map +0 -1
- package/dist/esm/server.native.js +0 -44
- package/dist/esm/server.native.js.map +0 -1
- package/dist/esm/setup.js +0 -1
- package/dist/esm/setup.js.map +0 -6
- package/dist/esm/setup.mjs +0 -2
- package/dist/esm/setup.mjs.map +0 -1
- package/dist/esm/setup.native.js +0 -2
- package/dist/esm/setup.native.js.map +0 -1
- package/dist/esm/types.js +0 -1
- package/dist/esm/types.js.map +0 -6
- package/dist/esm/types.mjs +0 -2
- package/dist/esm/types.mjs.map +0 -1
- package/dist/esm/types.native.js +0 -2
- package/dist/esm/types.native.js.map +0 -1
- /package/dist/{cjs/checkDeps.js → checkDeps.js} +0 -0
- /package/dist/{cjs/checkDeps.native.js → checkDeps.native.js} +0 -0
- /package/dist/{cjs/constants.js → constants.js} +0 -0
- /package/dist/{cjs/constants.native.js → constants.native.js} +0 -0
- /package/dist/{cjs/exports.js → exports.js} +0 -0
- /package/dist/{cjs/exports.native.js → exports.native.js} +0 -0
- /package/dist/{cjs/extractor → extractor}/accessSafe.js +0 -0
- /package/dist/{cjs/extractor → extractor}/accessSafe.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/babelParse.js +0 -0
- /package/dist/{cjs/extractor → extractor}/babelParse.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/buildClassName.js +0 -0
- /package/dist/{cjs/extractor → extractor}/buildClassName.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/bundle.js +0 -0
- /package/dist/{cjs/extractor → extractor}/bundle.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/bundleConfig.js +0 -0
- /package/dist/{cjs/extractor → extractor}/bundleConfig.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/createEvaluator.js +0 -0
- /package/dist/{cjs/extractor → extractor}/createEvaluator.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/createExtractor.js +0 -0
- /package/dist/{cjs/extractor → extractor}/createExtractor.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/createLogger.js +0 -0
- /package/dist/{cjs/extractor → extractor}/createLogger.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/ensureImportingConcat.js +0 -0
- /package/dist/{cjs/extractor → extractor}/ensureImportingConcat.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/esbuildAliasPlugin.js +0 -0
- /package/dist/{cjs/extractor → extractor}/esbuildAliasPlugin.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/evaluateAstNode.js +0 -0
- /package/dist/{cjs/extractor → extractor}/evaluateAstNode.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/extractHelpers.js +0 -0
- /package/dist/{cjs/extractor → extractor}/extractHelpers.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/extractMediaStyle.js +0 -0
- /package/dist/{cjs/extractor → extractor}/extractMediaStyle.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/extractToClassNames.js +0 -0
- /package/dist/{cjs/extractor → extractor}/extractToClassNames.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/extractToNative.js +0 -0
- /package/dist/{cjs/extractor → extractor}/extractToNative.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/findTopmostFunction.js +0 -0
- /package/dist/{cjs/extractor → extractor}/findTopmostFunction.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/generateTamaguiStudioConfig.js +0 -0
- /package/dist/{cjs/extractor → extractor}/generateTamaguiStudioConfig.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/generatedUid.js +0 -0
- /package/dist/{cjs/extractor → extractor}/generatedUid.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/getPrefixLogs.js +0 -0
- /package/dist/{cjs/extractor → extractor}/getPrefixLogs.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/getPropValueFromAttributes.js +0 -0
- /package/dist/{cjs/extractor → extractor}/getPropValueFromAttributes.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/getSourceModule.js +0 -0
- /package/dist/{cjs/extractor → extractor}/getSourceModule.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/getStaticBindingsForScope.js +0 -0
- /package/dist/{cjs/extractor → extractor}/getStaticBindingsForScope.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/getTamaguiConfigPathFromOptionsConfig.js +0 -0
- /package/dist/{cjs/extractor → extractor}/getTamaguiConfigPathFromOptionsConfig.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/hoistClassNames.js +0 -0
- /package/dist/{cjs/extractor → extractor}/hoistClassNames.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/literalToAst.js +0 -0
- /package/dist/{cjs/extractor → extractor}/literalToAst.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/loadFile.js +0 -0
- /package/dist/{cjs/extractor → extractor}/loadFile.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/loadTamagui.js +0 -0
- /package/dist/{cjs/extractor → extractor}/loadTamagui.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/logLines.js +0 -0
- /package/dist/{cjs/extractor → extractor}/logLines.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/normalizeTernaries.js +0 -0
- /package/dist/{cjs/extractor → extractor}/normalizeTernaries.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/propsToFontFamilyCache.js +0 -0
- /package/dist/{cjs/extractor → extractor}/propsToFontFamilyCache.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/removeUnusedHooks.js +0 -0
- /package/dist/{cjs/extractor → extractor}/removeUnusedHooks.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/timer.js +0 -0
- /package/dist/{cjs/extractor → extractor}/timer.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/validHTMLAttributes.js +0 -0
- /package/dist/{cjs/extractor → extractor}/validHTMLAttributes.native.js +0 -0
- /package/dist/{cjs/extractor → extractor}/watchTamaguiConfig.js +0 -0
- /package/dist/{cjs/extractor → extractor}/watchTamaguiConfig.native.js +0 -0
- /package/dist/{cjs/getPragmaOptions.js → getPragmaOptions.js} +0 -0
- /package/dist/{cjs/getPragmaOptions.native.js → getPragmaOptions.native.js} +0 -0
- /package/dist/{cjs/helpers → helpers}/memoize.js +0 -0
- /package/dist/{cjs/helpers → helpers}/memoize.native.js +0 -0
- /package/dist/{cjs/helpers → helpers}/requireTamaguiCore.js +0 -0
- /package/dist/{cjs/helpers → helpers}/requireTamaguiCore.native.js +0 -0
- /package/dist/{cjs/index.js → index.js} +0 -0
- /package/dist/{cjs/index.native.js → index.native.js} +0 -0
- /package/dist/{cjs/minifyCSS.js → minifyCSS.js} +0 -0
- /package/dist/{cjs/minifyCSS.native.js → minifyCSS.native.js} +0 -0
- /package/dist/{cjs/registerRequire.js → registerRequire.js} +0 -0
- /package/dist/{cjs/registerRequire.native.js → registerRequire.native.js} +0 -0
- /package/dist/{cjs/server.js → server.js} +0 -0
- /package/dist/{cjs/server.native.js → server.native.js} +0 -0
- /package/dist/{cjs/setup.js → setup.js} +0 -0
- /package/dist/{cjs/setup.js.map → setup.js.map} +0 -0
- /package/dist/{cjs/setup.native.js → setup.native.js} +0 -0
- /package/dist/{cjs/setup.native.js.map → setup.native.js.map} +0 -0
- /package/dist/{cjs/types.js → types.js} +0 -0
- /package/dist/{cjs/types.native.js → types.native.js} +0 -0
@@ -1,972 +0,0 @@
|
|
1
|
-
import traverse from "@babel/traverse";
|
2
|
-
import * as t from "@babel/types";
|
3
|
-
import { Color, colorLog } from "@tamagui/cli-color";
|
4
|
-
import { StyleObjectIdentifier, StyleObjectRules } from "@tamagui/web";
|
5
|
-
import { basename, relative } from "node:path";
|
6
|
-
import * as reactNativeWebInternals from "react-native-web-internals";
|
7
|
-
import { FAILED_EVAL } from "../constants.mjs";
|
8
|
-
import { requireTamaguiCore } from "../helpers/requireTamaguiCore.mjs";
|
9
|
-
import { createEvaluator, createSafeEvaluator } from "./createEvaluator.mjs";
|
10
|
-
import { evaluateAstNode } from "./evaluateAstNode.mjs";
|
11
|
-
import { attrStr, findComponentName, getValidComponent, getValidComponentsPaths, getValidImport, isPresent, isValidImport, objToStr } from "./extractHelpers.mjs";
|
12
|
-
import { findTopmostFunction } from "./findTopmostFunction.mjs";
|
13
|
-
import { cleanupBeforeExit, getStaticBindingsForScope } from "./getStaticBindingsForScope.mjs";
|
14
|
-
import { literalToAst } from "./literalToAst.mjs";
|
15
|
-
import { loadTamagui, loadTamaguiSync } from "./loadTamagui.mjs";
|
16
|
-
import { logLines } from "./logLines.mjs";
|
17
|
-
import { normalizeTernaries } from "./normalizeTernaries.mjs";
|
18
|
-
import { setPropsToFontFamily } from "./propsToFontFamilyCache.mjs";
|
19
|
-
import { removeUnusedHooks } from "./removeUnusedHooks.mjs";
|
20
|
-
import { timer } from "./timer.mjs";
|
21
|
-
import { validHTMLAttributes } from "./validHTMLAttributes.mjs";
|
22
|
-
const UNTOUCHED_PROPS = {
|
23
|
-
key: !0,
|
24
|
-
style: !0,
|
25
|
-
className: !0
|
26
|
-
},
|
27
|
-
createTernary = x => x;
|
28
|
-
let hasLoggedBaseInfo = !1;
|
29
|
-
function isFullyDisabled(props) {
|
30
|
-
return props.disableExtraction && props.disableDebugAttr;
|
31
|
-
}
|
32
|
-
function createExtractor({
|
33
|
-
logger = console,
|
34
|
-
platform = "web"
|
35
|
-
} = {
|
36
|
-
logger: console
|
37
|
-
}) {
|
38
|
-
const INLINE_EXTRACTABLE = {
|
39
|
-
ref: "ref",
|
40
|
-
key: "key",
|
41
|
-
...(platform === "web" && {
|
42
|
-
onPress: "onClick",
|
43
|
-
onHoverIn: "onMouseEnter",
|
44
|
-
onHoverOut: "onMouseLeave",
|
45
|
-
onPressIn: "onMouseDown",
|
46
|
-
onPressOut: "onMouseUp"
|
47
|
-
})
|
48
|
-
},
|
49
|
-
componentState = {
|
50
|
-
focus: !1,
|
51
|
-
focusVisible: !1,
|
52
|
-
hover: !1,
|
53
|
-
unmounted: !0,
|
54
|
-
press: !1,
|
55
|
-
pressIn: !1,
|
56
|
-
disabled: !1
|
57
|
-
},
|
58
|
-
styleProps = {
|
59
|
-
resolveValues: "variable",
|
60
|
-
noClassNames: !1,
|
61
|
-
isAnimated: !1
|
62
|
-
},
|
63
|
-
shouldAddDebugProp =
|
64
|
-
// really basic disable this for next.js because it messes with ssr
|
65
|
-
!process.env.npm_package_dependencies_next && !0 && process.env.IDENTIFY_TAGS !== "false" && (process.env.NODE_ENV === "development" || process.env.DEBUG || process.env.IDENTIFY_TAGS);
|
66
|
-
let projectInfo = null;
|
67
|
-
function loadSync(props) {
|
68
|
-
return isFullyDisabled(props) ? null : projectInfo ||= loadTamaguiSync(props);
|
69
|
-
}
|
70
|
-
async function load(props) {
|
71
|
-
return isFullyDisabled(props) ? null : projectInfo ||= await loadTamagui(props);
|
72
|
-
}
|
73
|
-
return {
|
74
|
-
options: {
|
75
|
-
logger
|
76
|
-
},
|
77
|
-
cleanupBeforeExit,
|
78
|
-
loadTamagui: load,
|
79
|
-
loadTamaguiSync: loadSync,
|
80
|
-
getTamagui() {
|
81
|
-
return projectInfo?.tamaguiConfig;
|
82
|
-
},
|
83
|
-
parseSync: (f, props) => {
|
84
|
-
const projectInfo2 = loadSync(props);
|
85
|
-
return parseWithConfig(projectInfo2 || {}, f, props);
|
86
|
-
},
|
87
|
-
parse: async (f, props) => {
|
88
|
-
const projectInfo2 = await load(props);
|
89
|
-
return parseWithConfig(projectInfo2 || {}, f, props);
|
90
|
-
}
|
91
|
-
};
|
92
|
-
function parseWithConfig({
|
93
|
-
components,
|
94
|
-
tamaguiConfig
|
95
|
-
}, fileOrPath, options) {
|
96
|
-
const {
|
97
|
-
config = "tamagui.config.ts",
|
98
|
-
importsWhitelist = ["constants.js"],
|
99
|
-
evaluateVars = !0,
|
100
|
-
sourcePath = "",
|
101
|
-
onExtractTag,
|
102
|
-
onStyleRule,
|
103
|
-
getFlattenedNode,
|
104
|
-
disable,
|
105
|
-
disableExtraction,
|
106
|
-
disableExtractInlineMedia,
|
107
|
-
disableExtractVariables,
|
108
|
-
disableDebugAttr,
|
109
|
-
enableDynamicEvaluation = !1,
|
110
|
-
disableOptimizeHooks,
|
111
|
-
includeExtensions = [".ts", ".tsx", ".jsx"],
|
112
|
-
extractStyledDefinitions = !1,
|
113
|
-
prefixLogs,
|
114
|
-
excludeProps,
|
115
|
-
platform: platform2,
|
116
|
-
...restProps
|
117
|
-
} = options,
|
118
|
-
validHooks = disableOptimizeHooks ? {} : {
|
119
|
-
useMedia: !0,
|
120
|
-
useTheme: !0
|
121
|
-
};
|
122
|
-
if (sourcePath.includes(".tamagui-dynamic-eval")) return null;
|
123
|
-
const {
|
124
|
-
normalizeStyle,
|
125
|
-
getSplitStyles,
|
126
|
-
mediaQueryConfig,
|
127
|
-
propMapper,
|
128
|
-
proxyThemeVariables,
|
129
|
-
pseudoDescriptors
|
130
|
-
} = requireTamaguiCore(platform2);
|
131
|
-
let shouldPrintDebug = options.shouldPrintDebug || !1;
|
132
|
-
if (disable === !0 || Array.isArray(disable) && disable.includes(sourcePath)) return null;
|
133
|
-
if (!isFullyDisabled(options) && !components) throw new Error("Must provide components");
|
134
|
-
if (sourcePath && includeExtensions && !includeExtensions.some(ext => sourcePath.endsWith(ext))) return shouldPrintDebug && logger.info(`Ignoring file due to includeExtensions: ${sourcePath}, includeExtensions: ${includeExtensions.join(", ")}`), null;
|
135
|
-
function isValidStyleKey(name, staticConfig) {
|
136
|
-
if (!projectInfo) throw new Error("Tamagui extractor not loaded yet");
|
137
|
-
return platform2 === "native" && name[0] === "$" && mediaQueryConfig[name.slice(1)] ? !1 : !!(staticConfig.validStyles?.[name] || pseudoDescriptors[name] ||
|
138
|
-
// don't disable variants or else you lose many things flattening
|
139
|
-
staticConfig.variants?.[name] || projectInfo?.tamaguiConfig?.shorthands[name] || name[0] === "$" && mediaQueryConfig[name.slice(1)]);
|
140
|
-
}
|
141
|
-
const isTargetingHTML = platform2 === "web",
|
142
|
-
ogDebug = shouldPrintDebug,
|
143
|
-
tm = timer(),
|
144
|
-
propsWithFileInfo = {
|
145
|
-
...options,
|
146
|
-
sourcePath,
|
147
|
-
allLoadedComponents: components ? [...components] : []
|
148
|
-
};
|
149
|
-
hasLoggedBaseInfo || (hasLoggedBaseInfo = !0, shouldPrintDebug && logger.info(["loaded components:", propsWithFileInfo.allLoadedComponents.map(comp => Object.keys(comp.nameToInfo).join(", ")).join(", ")].join(" ")), process.env.DEBUG?.startsWith("tamagui") && logger.info(["loaded:", propsWithFileInfo.allLoadedComponents.map(x => x.moduleName)].join(`
|
150
|
-
`))), tm.mark("load-tamagui", !!shouldPrintDebug), isFullyDisabled(options) || tamaguiConfig?.themes || (console.error(`\u26D4\uFE0F Error: Missing "themes" in your tamagui.config file:
|
151
|
-
|
152
|
-
You may not need the compiler! Remember you can run Tamagui with no configuration at all.
|
153
|
-
|
154
|
-
You may have not "export default" your config (you can also "export const config").
|
155
|
-
|
156
|
-
Or this may be due to duplicated dependency versions:
|
157
|
-
- try out https://github.com/bmish/check-dependency-version-consistency to see if there are mis-matches.
|
158
|
-
- or search your lockfile for mis-matches.
|
159
|
-
`), console.info(" Got config:", tamaguiConfig), process.exit(0));
|
160
|
-
const firstThemeName = Object.keys(tamaguiConfig?.themes || {})[0],
|
161
|
-
firstTheme = tamaguiConfig?.themes[firstThemeName] || {};
|
162
|
-
if (!firstTheme || typeof firstTheme != "object") {
|
163
|
-
const err = `Missing theme ${firstThemeName}, an error occurred when importing your config`;
|
164
|
-
throw console.info(err, "Got config:", tamaguiConfig), console.info("Looking for theme:", firstThemeName), new Error(err);
|
165
|
-
}
|
166
|
-
const proxiedTheme = proxyThemeVariables(firstTheme),
|
167
|
-
themeAccessListeners = /* @__PURE__ */new Set(),
|
168
|
-
defaultTheme = new Proxy(proxiedTheme, {
|
169
|
-
get(target, key) {
|
170
|
-
return Reflect.has(target, key) && themeAccessListeners.forEach(cb => cb(String(key))), Reflect.get(target, key);
|
171
|
-
}
|
172
|
-
}),
|
173
|
-
body = fileOrPath.type === "Program" ? fileOrPath.get("body") : fileOrPath.program.body;
|
174
|
-
isFullyDisabled(options) || Object.keys(components || []).length === 0 && (console.warn("Warning: Tamagui didn't find any valid components (DEBUG=tamagui for more)"), process.env.DEBUG === "tamagui" && console.info("components", Object.keys(components || []), components)), shouldPrintDebug === "verbose" && (logger.info(`allLoadedComponent modules ${propsWithFileInfo.allLoadedComponents.map(k => k.moduleName).join(", ")}`), logger.info(`valid import paths: ${JSON.stringify(getValidComponentsPaths(propsWithFileInfo))}`));
|
175
|
-
let doesUseValidImport = !1,
|
176
|
-
hasImportedTheme = !1;
|
177
|
-
const importDeclarations = [];
|
178
|
-
for (const bodyPath of body) {
|
179
|
-
if (bodyPath.type !== "ImportDeclaration") continue;
|
180
|
-
const node = "node" in bodyPath ? bodyPath.node : bodyPath,
|
181
|
-
moduleName = node.source.value,
|
182
|
-
valid = isValidImport(propsWithFileInfo, moduleName);
|
183
|
-
if (valid && importDeclarations.push(node), shouldPrintDebug === "verbose" && logger.info(` - import ${moduleName} ${valid}`), extractStyledDefinitions && valid && node.specifiers.some(specifier => specifier.local.name === "styled")) {
|
184
|
-
doesUseValidImport = !0;
|
185
|
-
break;
|
186
|
-
}
|
187
|
-
if (valid) {
|
188
|
-
const names = node.specifiers.map(specifier => specifier.local.name),
|
189
|
-
isValidComponent = names.some(name => !!(isValidImport(propsWithFileInfo, moduleName, name) || validHooks[name]));
|
190
|
-
if (shouldPrintDebug === "verbose" && logger.info(` - import ${isValidComponent ? "\u2705" : "\u21E3"} - ${names.join(", ")} from '${moduleName}' - (valid: ${JSON.stringify(getValidComponentsPaths(propsWithFileInfo))})`), isValidComponent) {
|
191
|
-
doesUseValidImport = !0;
|
192
|
-
break;
|
193
|
-
}
|
194
|
-
}
|
195
|
-
}
|
196
|
-
if (shouldPrintDebug && logger.info(`${JSON.stringify({
|
197
|
-
doesUseValidImport,
|
198
|
-
hasImportedTheme
|
199
|
-
}, null, 2)}
|
200
|
-
`), !doesUseValidImport) return null;
|
201
|
-
function getValidImportedComponent(componentName) {
|
202
|
-
const importDeclaration = importDeclarations.find(dec => dec.specifiers.some(spec => spec.local.name === componentName));
|
203
|
-
return importDeclaration ? getValidImport(propsWithFileInfo, importDeclaration.source.value, componentName) : null;
|
204
|
-
}
|
205
|
-
tm.mark("import-check", !!shouldPrintDebug);
|
206
|
-
let couldntParse = !1;
|
207
|
-
const modifiedComponents = /* @__PURE__ */new Set(),
|
208
|
-
bindingCache = {},
|
209
|
-
callTraverse = a => fileOrPath.type === "File" ? traverse(fileOrPath, a) : fileOrPath.traverse(a),
|
210
|
-
shouldDisableExtraction = disableExtraction === !0 || Array.isArray(disableExtraction) && disableExtraction.includes(sourcePath);
|
211
|
-
let programPath = null;
|
212
|
-
const res = {
|
213
|
-
styled: 0,
|
214
|
-
flattened: 0,
|
215
|
-
optimized: 0,
|
216
|
-
modified: 0,
|
217
|
-
found: 0
|
218
|
-
},
|
219
|
-
version = `${Math.random()}`;
|
220
|
-
if (callTraverse({
|
221
|
-
// @ts-ignore
|
222
|
-
Program: {
|
223
|
-
enter(path) {
|
224
|
-
programPath = path;
|
225
|
-
}
|
226
|
-
},
|
227
|
-
// styled() calls
|
228
|
-
CallExpression(path) {
|
229
|
-
if (disable || shouldDisableExtraction || extractStyledDefinitions === !1 || !t.isIdentifier(path.node.callee) || path.node.callee.name !== "styled") return;
|
230
|
-
const variableName = t.isVariableDeclarator(path.parent) && t.isIdentifier(path.parent.id) ? path.parent.id.name : "unknown",
|
231
|
-
parentNode = path.node.arguments[0];
|
232
|
-
if (!t.isIdentifier(parentNode)) return;
|
233
|
-
const parentName = parentNode.name,
|
234
|
-
definition = path.node.arguments[1];
|
235
|
-
if (!parentName || !definition || !t.isObjectExpression(definition)) return;
|
236
|
-
let Component = getValidImportedComponent(variableName);
|
237
|
-
if (!Component) {
|
238
|
-
if (enableDynamicEvaluation !== !0) return;
|
239
|
-
try {
|
240
|
-
shouldPrintDebug && logger.info(`Unknown component: ${variableName} = styled(${parentName}) attempting dynamic load: ${sourcePath}`);
|
241
|
-
const out2 = loadTamaguiSync({
|
242
|
-
forceExports: !0,
|
243
|
-
components: [sourcePath],
|
244
|
-
cacheKey: version
|
245
|
-
});
|
246
|
-
if (!out2?.components) {
|
247
|
-
shouldPrintDebug && logger.info(`Couldn't load, got ${out2}`);
|
248
|
-
return;
|
249
|
-
}
|
250
|
-
if (propsWithFileInfo.allLoadedComponents = [...propsWithFileInfo.allLoadedComponents, ...out2.components], Component = out2.components.flatMap(x => x.nameToInfo[variableName] ?? [])[0], !out2.cached) {
|
251
|
-
const foundNames = out2.components?.map(x => Object.keys(x.nameToInfo).join(", ")).join(", ").trim();
|
252
|
-
foundNames && colorLog(Color.FgYellow, ` | Tamagui found dynamic components: ${foundNames}`);
|
253
|
-
}
|
254
|
-
} catch {
|
255
|
-
shouldPrintDebug && logger.info(`skip optimize styled(${variableName}), unable to pre-process (DEBUG=tamagui for more)`);
|
256
|
-
}
|
257
|
-
}
|
258
|
-
if (!Component) {
|
259
|
-
shouldPrintDebug && logger.info(" No component found");
|
260
|
-
return;
|
261
|
-
}
|
262
|
-
const componentSkipProps = /* @__PURE__ */new Set([...(Component.staticConfig.inlineWhenUnflattened || []), ...(Component.staticConfig.inlineProps || []),
|
263
|
-
// for now skip variants, will return to them
|
264
|
-
"variants", "defaultVariants",
|
265
|
-
// skip fontFamily its basically a "variant", important for theme use to be value always
|
266
|
-
"fontFamily", "name", "focusStyle", "focusVisibleStyle", "disabledStyle", "hoverStyle", "pressStyle"]),
|
267
|
-
skipped = /* @__PURE__ */new Set(),
|
268
|
-
styles = {},
|
269
|
-
staticNamespace = getStaticBindingsForScope(path.scope, importsWhitelist, sourcePath, bindingCache, shouldPrintDebug),
|
270
|
-
attemptEval = evaluateVars ? createEvaluator({
|
271
|
-
props: propsWithFileInfo,
|
272
|
-
staticNamespace,
|
273
|
-
sourcePath,
|
274
|
-
shouldPrintDebug
|
275
|
-
}) : evaluateAstNode,
|
276
|
-
attemptEvalSafe = createSafeEvaluator(attemptEval);
|
277
|
-
for (const property of definition.properties) {
|
278
|
-
if (!t.isObjectProperty(property) || !t.isIdentifier(property.key) || !isValidStyleKey(property.key.name, Component.staticConfig) ||
|
279
|
-
// TODO make pseudos and variants work
|
280
|
-
// skip pseudos
|
281
|
-
pseudoDescriptors[property.key.name] ||
|
282
|
-
// skip variants
|
283
|
-
Component.staticConfig.variants?.[property.key.name] || componentSkipProps.has(property.key.name)) {
|
284
|
-
skipped.add(property);
|
285
|
-
continue;
|
286
|
-
}
|
287
|
-
const out2 = attemptEvalSafe(property.value);
|
288
|
-
out2 === FAILED_EVAL ? skipped.add(property) : styles[property.key.name] = out2;
|
289
|
-
}
|
290
|
-
const out = getSplitStyles(styles, Component.staticConfig, defaultTheme, "", componentState, styleProps, void 0, void 0, void 0, shouldPrintDebug),
|
291
|
-
classNames = {
|
292
|
-
...out.classNames
|
293
|
-
};
|
294
|
-
if (shouldPrintDebug && logger.info([`Extracted styled(${variableName})
|
295
|
-
`, JSON.stringify(styles, null, 2), `
|
296
|
-
classNames:`, JSON.stringify(classNames, null, 2), `
|
297
|
-
rulesToInsert:`, out.rulesToInsert].join(" ")), definition.properties = definition.properties.map(prop => {
|
298
|
-
if (skipped.has(prop) || !t.isObjectProperty(prop) || !t.isIdentifier(prop.key)) return prop;
|
299
|
-
const key = prop.key.name,
|
300
|
-
value = classNames[key];
|
301
|
-
return value ? t.objectProperty(t.stringLiteral(key), t.stringLiteral(value)) : prop;
|
302
|
-
}), out.rulesToInsert) for (const key in out.rulesToInsert) {
|
303
|
-
const styleObject = out.rulesToInsert[key];
|
304
|
-
onStyleRule?.(styleObject[StyleObjectIdentifier], styleObject[StyleObjectRules]);
|
305
|
-
}
|
306
|
-
res.styled++, shouldPrintDebug && logger.info(`Extracted styled(${variableName})`);
|
307
|
-
},
|
308
|
-
JSXElement(traversePath) {
|
309
|
-
tm.mark("jsx-element", !!shouldPrintDebug);
|
310
|
-
const node = traversePath.node.openingElement,
|
311
|
-
ogAttributes = node.attributes.map(attr => ({
|
312
|
-
...attr
|
313
|
-
})),
|
314
|
-
componentName = findComponentName(traversePath.scope),
|
315
|
-
closingElement = traversePath.node.closingElement;
|
316
|
-
if (closingElement && t.isJSXMemberExpression(closingElement?.name) || !t.isJSXIdentifier(node.name)) {
|
317
|
-
shouldPrintDebug && logger.info(" skip non-identifier element");
|
318
|
-
return;
|
319
|
-
}
|
320
|
-
const binding = traversePath.scope.getBinding(node.name.name);
|
321
|
-
let moduleName = "";
|
322
|
-
if (binding && t.isImportDeclaration(binding.path.parent) && (moduleName = binding.path.parent.source.value, !isValidImport(propsWithFileInfo, moduleName, binding.identifier.name))) {
|
323
|
-
shouldPrintDebug && logger.info(` - Binding in component ${componentName} not valid import: "${binding.identifier.name}" isn't in ${moduleName}
|
324
|
-
`);
|
325
|
-
return;
|
326
|
-
}
|
327
|
-
const component = getValidComponent(propsWithFileInfo, moduleName, node.name.name);
|
328
|
-
if (!component || !component.staticConfig) {
|
329
|
-
shouldPrintDebug && logger.info(`
|
330
|
-
- No Tamagui conf for: ${node.name.name}
|
331
|
-
`);
|
332
|
-
return;
|
333
|
-
}
|
334
|
-
const originalNodeName = node.name.name;
|
335
|
-
res.found++;
|
336
|
-
const filePath = `./${relative(process.cwd(), sourcePath)}`,
|
337
|
-
lineNumbers = node.loc ? node.loc.start.line + (node.loc.start.line !== node.loc.end.line ? `-${node.loc.end.line}` : "") : "",
|
338
|
-
codePosition = `${filePath}:${lineNumbers}`,
|
339
|
-
debugPropValue = node.attributes.filter(n => t.isJSXAttribute(n) && t.isJSXIdentifier(n.name) && n.name.name === "debug").map(n => n.value === null ? !0 : t.isStringLiteral(n.value) ? n.value.value : !1)[0];
|
340
|
-
if (debugPropValue && (shouldPrintDebug = debugPropValue), shouldPrintDebug && (logger.info(`\x1B[33m\x1B[0m ${componentName} | ${codePosition} -------------------`), logger.info(["\x1B[1m", "\x1B[32m", `<${originalNodeName} />`, disableDebugAttr ? "" : "\u{1F41B}"].join(" "))), shouldAddDebugProp && !disableDebugAttr && (res.modified++, node.attributes.unshift(t.jsxAttribute(t.jsxIdentifier("data-is"), t.stringLiteral(node.name.name))), componentName && node.attributes.unshift(t.jsxAttribute(t.jsxIdentifier("data-in"), t.stringLiteral(componentName))), node.attributes.unshift(t.jsxAttribute(t.jsxIdentifier("data-at"), t.stringLiteral(`${basename(filePath)}:${lineNumbers}`)))), shouldDisableExtraction) {
|
341
|
-
shouldPrintDebug === "verbose" && logger.info(` \u274C Extraction disabled: ${JSON.stringify(disableExtraction)}
|
342
|
-
`);
|
343
|
-
return;
|
344
|
-
}
|
345
|
-
try {
|
346
|
-
let evaluateAttribute = function (path) {
|
347
|
-
const attribute = path.node,
|
348
|
-
attr = {
|
349
|
-
type: "attr",
|
350
|
-
value: attribute
|
351
|
-
};
|
352
|
-
if (t.isJSXSpreadAttribute(attribute)) {
|
353
|
-
const arg = attribute.argument,
|
354
|
-
conditional = t.isConditionalExpression(arg) ?
|
355
|
-
// <YStack {...isSmall ? { color: 'red } : { color: 'blue }}
|
356
|
-
[arg.test, arg.consequent, arg.alternate] : t.isLogicalExpression(arg) && arg.operator === "&&" ?
|
357
|
-
// <YStack {...isSmall && { color: 'red }}
|
358
|
-
[arg.left, arg.right, null] : null;
|
359
|
-
if (conditional) {
|
360
|
-
const [test, alt, cons] = conditional;
|
361
|
-
if (!test) throw new Error("no test");
|
362
|
-
return [alt, cons].some(side => side && !isStaticObject(side)) ? (shouldPrintDebug && logger.info(`not extractable ${alt} ${cons}`), attr) : [...(createTernariesFromObjectProperties(test, alt) || []), ...(cons && createTernariesFromObjectProperties(t.unaryExpression("!", test), cons) || [])].map(ternary => ({
|
363
|
-
type: "ternary",
|
364
|
-
value: ternary
|
365
|
-
}));
|
366
|
-
}
|
367
|
-
}
|
368
|
-
if (t.isJSXSpreadAttribute(attribute) || !attribute.name || typeof attribute.name.name != "string") return shouldPrintDebug && logger.info(" ! inlining, spread attr"), inlined.set(`${Math.random()}`, "spread"), attr;
|
369
|
-
const name = attribute.name.name;
|
370
|
-
if (excludeProps?.has(name)) return shouldPrintDebug && logger.info([" excluding prop", name].join(" ")), null;
|
371
|
-
if (inlineProps.has(name)) return inlined.set(name, name), shouldPrintDebug && logger.info([" ! inlining, inline prop", name].join(" ")), attr;
|
372
|
-
if (UNTOUCHED_PROPS[name]) return attr;
|
373
|
-
if (INLINE_EXTRACTABLE[name]) return inlined.set(name, INLINE_EXTRACTABLE[name]), attr;
|
374
|
-
if (name.startsWith("data-")) return attr;
|
375
|
-
if ((name === "enterStyle" || name === "exitStyle") && t.isJSXExpressionContainer(attribute?.value)) return shouldDeopt = !0, attr;
|
376
|
-
if (name[0] === "$" && t.isJSXExpressionContainer(attribute?.value)) {
|
377
|
-
const shortname = name.slice(1);
|
378
|
-
if (mediaQueryConfig[shortname]) {
|
379
|
-
if (platform2 === "native" && (shouldDeopt = !0), disableExtractInlineMedia) return attr;
|
380
|
-
const expression = attribute.value.expression;
|
381
|
-
if (!t.isJSXEmptyExpression(expression)) {
|
382
|
-
const ternaries2 = createTernariesFromObjectProperties(t.stringLiteral(shortname), expression, {
|
383
|
-
inlineMediaQuery: shortname
|
384
|
-
});
|
385
|
-
if (ternaries2) return ternaries2.map(value2 => ({
|
386
|
-
type: "ternary",
|
387
|
-
value: value2
|
388
|
-
}));
|
389
|
-
}
|
390
|
-
}
|
391
|
-
}
|
392
|
-
const [value, valuePath] = t.isJSXExpressionContainer(attribute?.value) ? [attribute.value.expression, path.get("value")] : [attribute.value, path.get("value")],
|
393
|
-
remove = () => {
|
394
|
-
Array.isArray(valuePath) ? valuePath.map(p => p.remove()) : valuePath.remove();
|
395
|
-
};
|
396
|
-
if (name === "ref") return shouldPrintDebug && logger.info([" ! inlining, ref", name].join(" ")), inlined.set("ref", "ref"), attr;
|
397
|
-
if (name === "tag") return {
|
398
|
-
type: "attr",
|
399
|
-
value: path.node
|
400
|
-
};
|
401
|
-
if (disableExtractVariables === !0 && value && value.type === "StringLiteral" && value.value[0] === "$") return shouldPrintDebug && logger.info([` ! inlining, native disable extract: ${name} =`, value.value].join(" ")), inlined.set(name, !0), attr;
|
402
|
-
if (name === "theme") return inlined.set("theme", attr.value), attr;
|
403
|
-
const styleValue = attemptEvalSafe(value);
|
404
|
-
if (!variants[name] && !isValidStyleKey(name, staticConfig)) {
|
405
|
-
let keys = [name],
|
406
|
-
out = null;
|
407
|
-
out = propMapper(name, styleValue, propMapperStyleState), out && (Array.isArray(out) ? (out = Object.fromEntries(out), keys = Object.keys(out)) : (logger.warn("Error expected array but got", out), couldntParse = !0, shouldDeopt = !0)), out && (isTargetingHTML && (out = reactNativeWebInternals.createDOMProps(isTextView ? "span" : "div", out), delete out.className), keys = Object.keys(out));
|
408
|
-
let didInline = !1;
|
409
|
-
const attributes = keys.map(key => {
|
410
|
-
const val = out[key];
|
411
|
-
return isValidStyleKey(key, staticConfig) ? {
|
412
|
-
type: "style",
|
413
|
-
value: {
|
414
|
-
[key]: styleValue
|
415
|
-
},
|
416
|
-
name: key,
|
417
|
-
attr: path.node
|
418
|
-
} : validHTMLAttributes[key] || key.startsWith("aria-") || key.startsWith("data-") ||
|
419
|
-
// this is debug stuff added by vite / new jsx transform
|
420
|
-
key === "__source" || key === "__self" ? attr : (shouldPrintDebug && logger.info(" ! inlining, non-static " + key), didInline = !0, inlined.set(key, val), val);
|
421
|
-
});
|
422
|
-
return didInline ? (shouldPrintDebug && logger.info(` bailing flattening due to attributes ${attributes.map(x => x.toString())}`), attr) : attributes;
|
423
|
-
}
|
424
|
-
if (styleValue !== FAILED_EVAL) return inlineWhenUnflattened.has(name) && (inlineWhenUnflattenedOGVals[name] = {
|
425
|
-
styleValue,
|
426
|
-
attr
|
427
|
-
}), isValidStyleKey(name, staticConfig) ? (shouldPrintDebug && logger.info(` style: ${name} = ${JSON.stringify(styleValue)}`), name in defaultProps || hasSetOptimized || (res.optimized++, hasSetOptimized = !0), {
|
428
|
-
type: "style",
|
429
|
-
value: {
|
430
|
-
[name]: styleValue
|
431
|
-
},
|
432
|
-
name,
|
433
|
-
attr: path.node
|
434
|
-
}) : (variants[name] && variantValues.set(name, styleValue), inlined.set(name, !0), attr);
|
435
|
-
if (t.isBinaryExpression(value)) {
|
436
|
-
shouldPrintDebug && logger.info(` binary expression ${name} = ${value}`);
|
437
|
-
const {
|
438
|
-
operator,
|
439
|
-
left,
|
440
|
-
right
|
441
|
-
} = value,
|
442
|
-
lVal = attemptEvalSafe(left),
|
443
|
-
rVal = attemptEvalSafe(right);
|
444
|
-
if (shouldPrintDebug && logger.info(` evalBinaryExpression lVal ${String(lVal)}, rVal ${String(rVal)}`), lVal !== FAILED_EVAL && t.isConditionalExpression(right)) {
|
445
|
-
const ternary = addBinaryConditional(operator, left, right);
|
446
|
-
if (ternary) return ternary;
|
447
|
-
}
|
448
|
-
if (rVal !== FAILED_EVAL && t.isConditionalExpression(left)) {
|
449
|
-
const ternary = addBinaryConditional(operator, right, left);
|
450
|
-
if (ternary) return ternary;
|
451
|
-
}
|
452
|
-
return shouldPrintDebug && logger.info(" evalBinaryExpression cant extract"), inlined.set(name, !0), attr;
|
453
|
-
}
|
454
|
-
const staticConditional = getStaticConditional(value);
|
455
|
-
if (staticConditional) return shouldPrintDebug === "verbose" && logger.info(` static conditional ${name} ${value}`), {
|
456
|
-
type: "ternary",
|
457
|
-
value: staticConditional
|
458
|
-
};
|
459
|
-
const staticLogical = getStaticLogical(value);
|
460
|
-
if (staticLogical) return shouldPrintDebug === "verbose" && logger.info(` static ternary ${name} = ${value}`), {
|
461
|
-
type: "ternary",
|
462
|
-
value: staticLogical
|
463
|
-
};
|
464
|
-
if (options.experimentalFlattenDynamicValues && isValidStyleKey(name, staticConfig)) return {
|
465
|
-
type: "dynamic-style",
|
466
|
-
value,
|
467
|
-
name: tamaguiConfig?.shorthands[name] || name
|
468
|
-
};
|
469
|
-
return inlined.set(name, !0), shouldPrintDebug && logger.info(` ! inline no match ${name} ${value}`), attr;
|
470
|
-
function addBinaryConditional(operator, staticExpr, cond) {
|
471
|
-
if (getStaticConditional(cond)) {
|
472
|
-
const alt = attemptEval(t.binaryExpression(operator, staticExpr, cond.alternate)),
|
473
|
-
cons = attemptEval(t.binaryExpression(operator, staticExpr, cond.consequent));
|
474
|
-
return shouldPrintDebug && logger.info([" binaryConditional", cond.test, cons, alt].join(" ")), {
|
475
|
-
type: "ternary",
|
476
|
-
value: {
|
477
|
-
test: cond.test,
|
478
|
-
remove,
|
479
|
-
alternate: {
|
480
|
-
[name]: alt
|
481
|
-
},
|
482
|
-
consequent: {
|
483
|
-
[name]: cons
|
484
|
-
}
|
485
|
-
}
|
486
|
-
};
|
487
|
-
}
|
488
|
-
return null;
|
489
|
-
}
|
490
|
-
function getStaticConditional(value2) {
|
491
|
-
if (t.isConditionalExpression(value2)) try {
|
492
|
-
const aVal = attemptEval(value2.alternate),
|
493
|
-
cVal = attemptEval(value2.consequent);
|
494
|
-
if (shouldPrintDebug) {
|
495
|
-
const type = value2.test.type;
|
496
|
-
logger.info([" static ternary", type, cVal, aVal].join(" "));
|
497
|
-
}
|
498
|
-
return {
|
499
|
-
test: value2.test,
|
500
|
-
remove,
|
501
|
-
consequent: {
|
502
|
-
[name]: cVal
|
503
|
-
},
|
504
|
-
alternate: {
|
505
|
-
[name]: aVal
|
506
|
-
}
|
507
|
-
};
|
508
|
-
} catch (err) {
|
509
|
-
shouldPrintDebug && logger.info([" cant eval ternary", err.message].join(" "));
|
510
|
-
}
|
511
|
-
return null;
|
512
|
-
}
|
513
|
-
function getStaticLogical(value2) {
|
514
|
-
if (t.isLogicalExpression(value2) && value2.operator === "&&") try {
|
515
|
-
const val = attemptEval(value2.right);
|
516
|
-
return shouldPrintDebug && logger.info([" staticLogical", value2.left, name, val].join(" ")), {
|
517
|
-
test: value2.left,
|
518
|
-
remove,
|
519
|
-
consequent: {
|
520
|
-
[name]: val
|
521
|
-
},
|
522
|
-
alternate: null
|
523
|
-
};
|
524
|
-
} catch (err) {
|
525
|
-
shouldPrintDebug && logger.info([" cant static eval logical", err].join(" "));
|
526
|
-
}
|
527
|
-
return null;
|
528
|
-
}
|
529
|
-
},
|
530
|
-
isStaticObject = function (obj) {
|
531
|
-
return t.isObjectExpression(obj) && obj.properties.every(prop => {
|
532
|
-
if (!t.isObjectProperty(prop)) return logger.info(["not object prop", prop].join(" ")), !1;
|
533
|
-
const propName = prop.key.name;
|
534
|
-
return !isValidStyleKey(propName, staticConfig) && propName !== "tag" ? (shouldPrintDebug && logger.info([" not a valid style prop!", propName].join(" ")), !1) : !0;
|
535
|
-
});
|
536
|
-
},
|
537
|
-
createTernariesFromObjectProperties = function (test, side, ternaryPartial = {}) {
|
538
|
-
if (!side) return null;
|
539
|
-
if (!isStaticObject(side)) throw new Error("not extractable");
|
540
|
-
return side.properties.flatMap(property => {
|
541
|
-
if (!t.isObjectProperty(property)) throw new Error("expected object property");
|
542
|
-
if (t.isIdentifier(property.key)) {
|
543
|
-
const key = property.key.name,
|
544
|
-
mediaQueryKey = key.slice(1);
|
545
|
-
if (key[0] === "$" && mediaQueryConfig[mediaQueryKey]) if (t.isExpression(property.value)) {
|
546
|
-
const ternaries2 = createTernariesFromObjectProperties(t.stringLiteral(mediaQueryKey), property.value, {
|
547
|
-
inlineMediaQuery: mediaQueryKey
|
548
|
-
});
|
549
|
-
if (ternaries2) return ternaries2.map(value => ({
|
550
|
-
...ternaryPartial,
|
551
|
-
...value,
|
552
|
-
// ensure media query test stays on left side (see getMediaQueryTernary)
|
553
|
-
test: t.logicalExpression("&&", value.test, test)
|
554
|
-
}));
|
555
|
-
logger.info(["\u26A0\uFE0F no ternaries?", property].join(" "));
|
556
|
-
} else logger.info(["\u26A0\uFE0F not expression", property].join(" "));
|
557
|
-
}
|
558
|
-
if (t.isConditionalExpression(property.value)) {
|
559
|
-
const [truthy, falsy] = [t.objectExpression([t.objectProperty(property.key, property.value.consequent)]), t.objectExpression([t.objectProperty(property.key, property.value.alternate)])].map(x => attemptEval(x));
|
560
|
-
return [createTernary({
|
561
|
-
remove() {},
|
562
|
-
...ternaryPartial,
|
563
|
-
test: t.logicalExpression("&&", test, property.value.test),
|
564
|
-
consequent: truthy,
|
565
|
-
alternate: null
|
566
|
-
}), createTernary({
|
567
|
-
...ternaryPartial,
|
568
|
-
test: t.logicalExpression("&&", test, t.unaryExpression("!", property.value.test)),
|
569
|
-
consequent: falsy,
|
570
|
-
alternate: null,
|
571
|
-
remove() {}
|
572
|
-
})];
|
573
|
-
}
|
574
|
-
const obj = t.objectExpression([t.objectProperty(property.key, property.value)]),
|
575
|
-
consequent = attemptEval(obj);
|
576
|
-
return createTernary({
|
577
|
-
remove() {},
|
578
|
-
...ternaryPartial,
|
579
|
-
test,
|
580
|
-
consequent,
|
581
|
-
alternate: null
|
582
|
-
});
|
583
|
-
});
|
584
|
-
},
|
585
|
-
mergeToEnd = function (obj, key, val) {
|
586
|
-
key in obj && delete obj[key], obj[key] = val;
|
587
|
-
},
|
588
|
-
normalizeStyleWithoutVariants = function (style) {
|
589
|
-
let res2 = {};
|
590
|
-
for (const key in style) if (staticConfig.variants && key in staticConfig.variants) mergeToEnd(res2, key, style[key]);else {
|
591
|
-
const expanded = normalizeStyle({
|
592
|
-
[key]: style[key]
|
593
|
-
}, !0);
|
594
|
-
for (const key2 in expanded) mergeToEnd(res2, key2, expanded[key2]);
|
595
|
-
}
|
596
|
-
return res2;
|
597
|
-
},
|
598
|
-
mergeStyles = function (prev2, next) {
|
599
|
-
for (const key in next) pseudoDescriptors[key] ? (prev2[key] = prev2[key] || {}, Object.assign(prev2[key], next[key])) : mergeToEnd(prev2, key, next[key]);
|
600
|
-
};
|
601
|
-
const {
|
602
|
-
staticConfig
|
603
|
-
} = component,
|
604
|
-
defaultProps = {
|
605
|
-
...(staticConfig.defaultProps || {})
|
606
|
-
},
|
607
|
-
variants = staticConfig.variants || {},
|
608
|
-
isTextView = staticConfig.isText || !1,
|
609
|
-
validStyles = staticConfig?.validStyles ?? {};
|
610
|
-
let tagName = defaultProps.tag ?? (isTextView ? "span" : "div");
|
611
|
-
traversePath.get("openingElement").get("attributes").forEach(path => {
|
612
|
-
const attr = path.node;
|
613
|
-
if (t.isJSXSpreadAttribute(attr) || attr.name.name !== "tag") return;
|
614
|
-
const val = attr.value;
|
615
|
-
t.isStringLiteral(val) && (tagName = val.value);
|
616
|
-
}), shouldPrintDebug === "verbose" && console.info(` Start tag ${tagName}`);
|
617
|
-
const flatNode = getFlattenedNode?.({
|
618
|
-
isTextView,
|
619
|
-
tag: tagName
|
620
|
-
}),
|
621
|
-
inlineProps = /* @__PURE__ */new Set([
|
622
|
-
// adding some always inline props
|
623
|
-
"dataSet", ...(restProps.inlineProps || []), ...(staticConfig.inlineProps || [])]),
|
624
|
-
deoptProps = /* @__PURE__ */new Set([
|
625
|
-
// always de-opt animation these
|
626
|
-
"animation", "animateOnly", "animatePresence", "disableOptimization", ...(isTargetingHTML ? [] : ["pressStyle", "focusStyle", "focusVisibleStyle", "disabledStyle"]),
|
627
|
-
// when using a non-CSS driver, de-opt on enterStyle/exitStyle
|
628
|
-
...(tamaguiConfig?.animations.isReactNative ? ["enterStyle", "exitStyle"] : [])]),
|
629
|
-
inlineWhenUnflattened = /* @__PURE__ */new Set([...(staticConfig.inlineWhenUnflattened || [])]),
|
630
|
-
staticNamespace = getStaticBindingsForScope(traversePath.scope, importsWhitelist, sourcePath, bindingCache, shouldPrintDebug),
|
631
|
-
attemptEval = evaluateVars ? createEvaluator({
|
632
|
-
props: propsWithFileInfo,
|
633
|
-
staticNamespace,
|
634
|
-
sourcePath,
|
635
|
-
traversePath,
|
636
|
-
shouldPrintDebug
|
637
|
-
}) : evaluateAstNode,
|
638
|
-
attemptEvalSafe = createSafeEvaluator(attemptEval);
|
639
|
-
if (shouldPrintDebug && logger.info(` staticNamespace ${Object.keys(staticNamespace).join(", ")}`), couldntParse) return;
|
640
|
-
tm.mark("jsx-element-flattened", !!shouldPrintDebug);
|
641
|
-
let attrs = [],
|
642
|
-
shouldDeopt = !1;
|
643
|
-
const inlined = /* @__PURE__ */new Map(),
|
644
|
-
variantValues = /* @__PURE__ */new Map();
|
645
|
-
let hasSetOptimized = !1;
|
646
|
-
const inlineWhenUnflattenedOGVals = {},
|
647
|
-
propMapperStyleState = {
|
648
|
-
staticConfig,
|
649
|
-
usedKeys: {},
|
650
|
-
classNames: {},
|
651
|
-
style: {},
|
652
|
-
theme: defaultTheme,
|
653
|
-
viewProps: defaultProps,
|
654
|
-
conf: tamaguiConfig,
|
655
|
-
props: defaultProps,
|
656
|
-
componentState,
|
657
|
-
styleProps: {
|
658
|
-
...styleProps,
|
659
|
-
resolveValues: "auto"
|
660
|
-
},
|
661
|
-
debug: shouldPrintDebug
|
662
|
-
};
|
663
|
-
if (attrs = traversePath.get("openingElement").get("attributes").flatMap(path => {
|
664
|
-
try {
|
665
|
-
const res2 = evaluateAttribute(path);
|
666
|
-
return res2 || path.remove(), res2;
|
667
|
-
} catch (err) {
|
668
|
-
return shouldPrintDebug && (logger.info(["Recoverable error extracting attribute", err.message, shouldPrintDebug === "verbose" ? err.stack : ""].join(" ")), shouldPrintDebug === "verbose" && logger.info(`node ${path.node?.type}`)), inlined.set(`${Math.random()}`, "spread"), {
|
669
|
-
type: "attr",
|
670
|
-
value: path.node
|
671
|
-
};
|
672
|
-
}
|
673
|
-
}).flat(4).filter(isPresent), shouldPrintDebug && logger.info([` - attrs (before):
|
674
|
-
`, logLines(attrs.map(attrStr).join(", "))].join(" ")), couldntParse || shouldDeopt) {
|
675
|
-
shouldPrintDebug && logger.info([" avoid optimizing:", {
|
676
|
-
couldntParse,
|
677
|
-
shouldDeopt
|
678
|
-
}].join(" ")), node.attributes = ogAttributes;
|
679
|
-
return;
|
680
|
-
}
|
681
|
-
const parentFn = findTopmostFunction(traversePath);
|
682
|
-
parentFn && modifiedComponents.add(parentFn);
|
683
|
-
const hasSpread = attrs.some(x => x.type === "attr" && t.isJSXSpreadAttribute(x.value)),
|
684
|
-
hasOnlyStringChildren = !hasSpread && (node.selfClosing || traversePath.node.children && traversePath.node.children.every(x => x.type === "JSXText"));
|
685
|
-
let themeVal = inlined.get("theme");
|
686
|
-
platform2 !== "native" && inlined.delete("theme");
|
687
|
-
for (const [key] of [...inlined]) {
|
688
|
-
const isStaticObjectVariant = staticConfig.variants?.[key] && variantValues.has(key);
|
689
|
-
(INLINE_EXTRACTABLE[key] || isStaticObjectVariant) && inlined.delete(key);
|
690
|
-
}
|
691
|
-
const canFlattenProps = inlined.size === 0;
|
692
|
-
let shouldFlatten = !!(flatNode && !shouldDeopt && canFlattenProps && !hasSpread && !staticConfig.isStyledHOC && !staticConfig.isHOC && !staticConfig.isReactNative && staticConfig.neverFlatten !== !0 && (staticConfig.neverFlatten !== "jsx" || hasOnlyStringChildren));
|
693
|
-
const usedThemeKeys = /* @__PURE__ */new Set();
|
694
|
-
if (themeAccessListeners.add(key => {
|
695
|
-
disableExtractVariables && (usedThemeKeys.add(key), shouldFlatten = !1, shouldPrintDebug === "verbose" && logger.info([" ! accessing theme key, avoid flatten", key].join(" ")));
|
696
|
-
}), shouldFlatten) {
|
697
|
-
let skipMap = !1;
|
698
|
-
const defaultStyleAttrs = Object.keys(defaultProps).flatMap(key => {
|
699
|
-
if (skipMap) return [];
|
700
|
-
const value = defaultProps[key];
|
701
|
-
if (key === "theme" && !themeVal) return platform2 === "native" && (shouldFlatten = !1, skipMap = !0, inlined.set("theme", {
|
702
|
-
value: t.stringLiteral(value)
|
703
|
-
})), themeVal = {
|
704
|
-
value: t.stringLiteral(value)
|
705
|
-
}, [];
|
706
|
-
if (!isValidStyleKey(key, staticConfig)) return [];
|
707
|
-
const name = tamaguiConfig?.shorthands[key] || key;
|
708
|
-
if (value === void 0) {
|
709
|
-
logger.warn(`\u26A0\uFE0F Error evaluating default style for component, prop ${key} ${value}`), shouldDeopt = !0;
|
710
|
-
return;
|
711
|
-
}
|
712
|
-
return name[0] === "$" && mediaQueryConfig[name.slice(1)] ? (defaultProps[key] = void 0, evaluateAttribute({
|
713
|
-
node: t.jsxAttribute(t.jsxIdentifier(name), t.jsxExpressionContainer(t.objectExpression(Object.keys(value).filter(k => typeof value[k] < "u").map(k => t.objectProperty(t.identifier(k), literalToAst(value[k]))))))
|
714
|
-
})) : {
|
715
|
-
type: "style",
|
716
|
-
name,
|
717
|
-
value: {
|
718
|
-
[name]: value
|
719
|
-
}
|
720
|
-
};
|
721
|
-
});
|
722
|
-
skipMap || defaultStyleAttrs.length && (attrs = [...defaultStyleAttrs, ...attrs]);
|
723
|
-
}
|
724
|
-
let ternaries = [];
|
725
|
-
attrs = attrs.reduce((out, cur) => {
|
726
|
-
const next = attrs[attrs.indexOf(cur) + 1];
|
727
|
-
if (cur.type === "ternary" && ternaries.push(cur.value), (!next || next.type !== "ternary") && ternaries.length) {
|
728
|
-
const normalized = normalizeTernaries(ternaries).map(({
|
729
|
-
alternate,
|
730
|
-
consequent,
|
731
|
-
...rest
|
732
|
-
}) => ({
|
733
|
-
type: "ternary",
|
734
|
-
value: {
|
735
|
-
...rest,
|
736
|
-
alternate: alternate || null,
|
737
|
-
consequent: consequent || null
|
738
|
-
}
|
739
|
-
}));
|
740
|
-
try {
|
741
|
-
return [...out, ...normalized];
|
742
|
-
} finally {
|
743
|
-
shouldPrintDebug && logger.info(` normalizeTernaries (${ternaries.length} => ${normalized.length})`), ternaries = [];
|
744
|
-
}
|
745
|
-
}
|
746
|
-
return cur.type === "ternary" || out.push(cur), out;
|
747
|
-
}, []).flat();
|
748
|
-
const shouldWrapTheme = shouldFlatten && themeVal;
|
749
|
-
if (shouldWrapTheme && (programPath ? (shouldPrintDebug && logger.info([" - wrapping theme", themeVal].join(" ")), attrs = attrs.filter(x => !(x.type === "attr" && t.isJSXAttribute(x.value) && x.value.name.name === "theme")), hasImportedTheme || (hasImportedTheme = !0, programPath.node.body.push(t.importDeclaration([t.importSpecifier(t.identifier("_TamaguiTheme"), t.identifier("Theme"))], t.stringLiteral("@tamagui/web")))), traversePath.replaceWith(t.jsxElement(t.jsxOpeningElement(t.jsxIdentifier("_TamaguiTheme"), [t.jsxAttribute(t.jsxIdentifier("name"), themeVal.value)]), t.jsxClosingElement(t.jsxIdentifier("_TamaguiTheme")), [traversePath.node]))) : console.warn(`No program path found, avoiding importing flattening / importing theme in ${sourcePath}`)), shouldPrintDebug) try {
|
750
|
-
logger.info([" flatten?", shouldFlatten, objToStr({
|
751
|
-
hasSpread,
|
752
|
-
shouldDeopt,
|
753
|
-
canFlattenProps,
|
754
|
-
shouldWrapTheme,
|
755
|
-
hasOnlyStringChildren
|
756
|
-
}), "inlined", inlined.size, [...inlined]].join(" "));
|
757
|
-
} catch {}
|
758
|
-
if (shouldDeopt || !shouldFlatten) {
|
759
|
-
shouldPrintDebug && logger.info(`Deopting ${shouldDeopt} ${shouldFlatten}`), node.attributes = ogAttributes;
|
760
|
-
return;
|
761
|
-
}
|
762
|
-
shouldPrintDebug && logger.info([` - attrs (flattened):
|
763
|
-
`, logLines(attrs.map(attrStr).join(", "))].join(" "));
|
764
|
-
let foundStaticProps = {};
|
765
|
-
for (const key in attrs) {
|
766
|
-
const cur = attrs[key];
|
767
|
-
if (cur.type === "style") {
|
768
|
-
const expanded = normalizeStyleWithoutVariants(cur.value);
|
769
|
-
for (const key2 in expanded) mergeToEnd(foundStaticProps, key2, expanded[key2]);
|
770
|
-
continue;
|
771
|
-
}
|
772
|
-
if (cur.type === "attr") {
|
773
|
-
if (t.isJSXSpreadAttribute(cur.value) || !t.isJSXIdentifier(cur.value.name)) continue;
|
774
|
-
const key2 = cur.value.name.name,
|
775
|
-
value = attemptEvalSafe(cur.value.value || t.booleanLiteral(!0));
|
776
|
-
value !== FAILED_EVAL && mergeToEnd(foundStaticProps, key2, value);
|
777
|
-
}
|
778
|
-
}
|
779
|
-
const completeProps = {};
|
780
|
-
for (const key in defaultProps) key in foundStaticProps || (completeProps[key] = defaultProps[key]);
|
781
|
-
for (const key in foundStaticProps) completeProps[key] = foundStaticProps[key];
|
782
|
-
attrs = attrs.reduce((acc, cur) => {
|
783
|
-
if (!cur) return acc;
|
784
|
-
if (cur.type === "attr" && !t.isJSXSpreadAttribute(cur.value) && shouldFlatten) {
|
785
|
-
const name = cur.value.name.name;
|
786
|
-
if (typeof name == "string") {
|
787
|
-
if (name === "tag") return acc;
|
788
|
-
if (variants[name] && variantValues.has(name)) {
|
789
|
-
const styleState = {
|
790
|
-
...propMapperStyleState,
|
791
|
-
props: completeProps
|
792
|
-
};
|
793
|
-
let out = Object.fromEntries(propMapper(name, variantValues.get(name), styleState) || []);
|
794
|
-
if (out && isTargetingHTML) {
|
795
|
-
const cn = out.className;
|
796
|
-
out = reactNativeWebInternals.createDOMProps(isTextView ? "span" : "div", out), out.className = cn;
|
797
|
-
}
|
798
|
-
shouldPrintDebug && logger.info([" - expanded variant", name, out].join(" "));
|
799
|
-
for (const key2 in out) {
|
800
|
-
const value2 = out[key2];
|
801
|
-
isValidStyleKey(key2, staticConfig) ? acc.push({
|
802
|
-
type: "style",
|
803
|
-
value: {
|
804
|
-
[key2]: value2
|
805
|
-
},
|
806
|
-
name: key2,
|
807
|
-
attr: cur.value
|
808
|
-
}) : acc.push({
|
809
|
-
type: "attr",
|
810
|
-
value: t.jsxAttribute(t.jsxIdentifier(key2), t.jsxExpressionContainer(typeof value2 == "string" ? t.stringLiteral(value2) : literalToAst(value2)))
|
811
|
-
});
|
812
|
-
}
|
813
|
-
}
|
814
|
-
}
|
815
|
-
}
|
816
|
-
if (cur.type !== "style") return acc.push(cur), acc;
|
817
|
-
let key = Object.keys(cur.value)[0];
|
818
|
-
const value = cur.value[key],
|
819
|
-
fullKey = tamaguiConfig?.shorthands[key];
|
820
|
-
return fullKey && (cur.value = {
|
821
|
-
[fullKey]: value
|
822
|
-
}, key = fullKey), disableExtractVariables && value[0] === "$" && (usedThemeKeys.has(key) || usedThemeKeys.has(fullKey)) ? (shouldPrintDebug && logger.info([` keeping variable inline: ${key} =`, value].join(" ")), acc.push({
|
823
|
-
type: "attr",
|
824
|
-
value: t.jsxAttribute(t.jsxIdentifier(key), t.jsxExpressionContainer(t.stringLiteral(value)))
|
825
|
-
}), acc) : (acc.push(cur), acc);
|
826
|
-
}, []), tm.mark("jsx-element-expanded", !!shouldPrintDebug), shouldPrintDebug && logger.info([` - attrs (expanded):
|
827
|
-
`, logLines(attrs.map(attrStr).join(", "))].join(" "));
|
828
|
-
let prev = null;
|
829
|
-
const getProps = (props, includeProps = !1, debugName = "") => {
|
830
|
-
if (!props) return shouldPrintDebug && logger.info([" getProps() no props"].join(" ")), {};
|
831
|
-
if (excludeProps?.size) for (const key in props) excludeProps.has(key) && (shouldPrintDebug && logger.info([" delete excluded", key].join(" ")), delete props[key]);
|
832
|
-
const before = process.env.IS_STATIC;
|
833
|
-
process.env.IS_STATIC = "is_static";
|
834
|
-
try {
|
835
|
-
const out = getSplitStyles(props, staticConfig, defaultTheme, "", componentState, {
|
836
|
-
...styleProps,
|
837
|
-
noClassNames: !0,
|
838
|
-
fallbackProps: completeProps
|
839
|
-
}, void 0, void 0, void 0, debugPropValue || shouldPrintDebug, options.experimentalFlattenThemesOnNative);
|
840
|
-
let outProps = {
|
841
|
-
...(includeProps ? out.viewProps : {}),
|
842
|
-
...out.style,
|
843
|
-
...out.pseudos
|
844
|
-
};
|
845
|
-
for (const key in outProps) deoptProps.has(key) && (shouldFlatten = !1);
|
846
|
-
return shouldPrintDebug && (logger.info(`(${debugName})`), logger.info(`
|
847
|
-
getProps (props in): ${logLines(objToStr(props))}`), logger.info(`
|
848
|
-
getProps (outProps): ${logLines(objToStr(outProps))}`)), out.fontFamily && (setPropsToFontFamily(outProps, out.fontFamily), shouldPrintDebug && logger.info(`
|
849
|
-
\u{1F4AC} new font fam: ${out.fontFamily}`)), outProps;
|
850
|
-
} catch (err) {
|
851
|
-
return logger.info(["error", err.message, err.stack].join(" ")), {};
|
852
|
-
} finally {
|
853
|
-
process.env.IS_STATIC = before;
|
854
|
-
}
|
855
|
-
};
|
856
|
-
shouldFlatten && attrs.unshift({
|
857
|
-
type: "style",
|
858
|
-
value: defaultProps
|
859
|
-
}), attrs = attrs.reduce((acc, cur) => {
|
860
|
-
if (cur.type === "style") {
|
861
|
-
const key = Object.keys(cur.value)[0],
|
862
|
-
value = cur.value[key];
|
863
|
-
if (
|
864
|
-
// !isStyleAndAttr[key] &&
|
865
|
-
!shouldFlatten &&
|
866
|
-
// de-opt if non-style
|
867
|
-
!validStyles[key] && !pseudoDescriptors[key] && !(key.startsWith("data-") || key.startsWith("aria-"))) return shouldPrintDebug && logger.info([" - keeping as non-style", key].join(" ")), prev = cur, acc.push({
|
868
|
-
type: "attr",
|
869
|
-
value: t.jsxAttribute(t.jsxIdentifier(key), t.jsxExpressionContainer(typeof value == "string" ? t.stringLiteral(value) : literalToAst(value)))
|
870
|
-
}), acc.push(cur), acc;
|
871
|
-
if (prev?.type === "style") return mergeStyles(prev.value, cur.value), acc;
|
872
|
-
}
|
873
|
-
return cur.type === "style" && (prev = cur), acc.push(cur), acc;
|
874
|
-
}, []), shouldPrintDebug && logger.info([` - attrs (combined \u{1F500}):
|
875
|
-
`, logLines(attrs.map(attrStr).join(", "))].join(" "));
|
876
|
-
let getStyleError = null;
|
877
|
-
for (const attr of attrs) try {
|
878
|
-
switch (shouldPrintDebug && console.info(` Processing ${attr.type}:`), attr.type) {
|
879
|
-
case "ternary":
|
880
|
-
{
|
881
|
-
const a = getProps(attr.value.alternate, !1, "ternary.alternate"),
|
882
|
-
c = getProps(attr.value.consequent, !1, "ternary.consequent");
|
883
|
-
a && (attr.value.alternate = a), c && (attr.value.consequent = c), shouldPrintDebug && logger.info([" => tern ", attrStr(attr)].join(" "));
|
884
|
-
continue;
|
885
|
-
}
|
886
|
-
case "style":
|
887
|
-
{
|
888
|
-
const styles = getProps(attr.value, !1, "style");
|
889
|
-
styles && (attr.value = styles), shouldPrintDebug && logger.info([" * styles (in)", logLines(objToStr(attr.value))].join(" ")), shouldPrintDebug && logger.info([" * styles (out)", logLines(objToStr(styles))].join(" "));
|
890
|
-
continue;
|
891
|
-
}
|
892
|
-
case "attr":
|
893
|
-
if (shouldFlatten && t.isJSXAttribute(attr.value)) {
|
894
|
-
const key = attr.value.name.name;
|
895
|
-
if (key === "style" || key === "className" || key === "tag") continue;
|
896
|
-
const value = attemptEvalSafe(attr.value.value || t.booleanLiteral(!0));
|
897
|
-
if (value !== FAILED_EVAL) {
|
898
|
-
const outProps = getProps({
|
899
|
-
[key]: value
|
900
|
-
}, !0, `attr.${key}`),
|
901
|
-
outKey = Object.keys(outProps)[0];
|
902
|
-
if (outKey) {
|
903
|
-
const outVal = outProps[outKey];
|
904
|
-
attr.value = t.jsxAttribute(t.jsxIdentifier(outKey), t.jsxExpressionContainer(typeof outVal == "string" ? t.stringLiteral(outVal) : literalToAst(outVal)));
|
905
|
-
}
|
906
|
-
}
|
907
|
-
}
|
908
|
-
}
|
909
|
-
} catch (err) {
|
910
|
-
getStyleError = err;
|
911
|
-
}
|
912
|
-
if (shouldPrintDebug && logger.info([` - attrs (ternaries/combined):
|
913
|
-
`, logLines(attrs.map(attrStr).join(", "))].join(" ")), tm.mark("jsx-element-styles", !!shouldPrintDebug), getStyleError) return logger.info([" \u26A0\uFE0F postprocessing error, deopt", getStyleError].join(" ")), node.attributes = ogAttributes, null;
|
914
|
-
const existingStyleKeys = /* @__PURE__ */new Set();
|
915
|
-
for (let i = attrs.length - 1; i >= 0; i--) {
|
916
|
-
const attr = attrs[i];
|
917
|
-
if (shouldFlatten && attr.type === "attr" && t.isJSXAttribute(attr.value) && t.isJSXIdentifier(attr.value.name)) {
|
918
|
-
const name = attr.value.name.name;
|
919
|
-
INLINE_EXTRACTABLE[name] && (attr.value.name.name = INLINE_EXTRACTABLE[name]);
|
920
|
-
}
|
921
|
-
if (attr.type === "style") for (const key in attr.value) existingStyleKeys.has(key) ? (shouldPrintDebug && logger.info([` >> delete existing ${key}`].join(" ")), delete attr.value[key]) : existingStyleKeys.add(key);
|
922
|
-
attr.type === "dynamic-style" && (existingStyleKeys.has(attr.name) ? attrs[i] = void 0 : existingStyleKeys.add(attr.name));
|
923
|
-
}
|
924
|
-
if (options.experimentalFlattenThemesOnNative && (attrs = attrs.filter(Boolean)), !shouldFlatten && inlineWhenUnflattened.size) {
|
925
|
-
for (const [index, attr] of attrs.entries()) if (attr.type === "style") for (const key in attr.value) {
|
926
|
-
if (!inlineWhenUnflattened.has(key)) continue;
|
927
|
-
const val = inlineWhenUnflattenedOGVals[key];
|
928
|
-
val ? (delete attr.value[key], attrs.splice(index - 1, 0, val.attr)) : delete attr.value[key];
|
929
|
-
}
|
930
|
-
}
|
931
|
-
if (attrs = attrs.filter(x => !((x.type === "style" || x.type === "dynamic-style") && Object.keys(x.value).length === 0)), shouldFlatten && (shouldPrintDebug && logger.info([" [\u2705] flattening", originalNodeName, flatNode].join(" ")), node.name.name = flatNode, res.flattened++, closingElement && (closingElement.name.name = flatNode)), !shouldFlatten && platform2 === "native") return shouldPrintDebug && logger.info(`Disabled flattening except for simple cases on native for now: ${JSON.stringify({
|
932
|
-
flatNode,
|
933
|
-
shouldDeopt,
|
934
|
-
canFlattenProps,
|
935
|
-
hasSpread,
|
936
|
-
"staticConfig.isStyledHOC": staticConfig.isStyledHOC,
|
937
|
-
"!staticConfig.isHOC": !staticConfig.isHOC,
|
938
|
-
"staticConfig.isReactNative": staticConfig.isReactNative,
|
939
|
-
"staticConfig.neverFlatten": staticConfig.neverFlatten
|
940
|
-
}, null, 2)}`), node.attributes = ogAttributes, null;
|
941
|
-
shouldPrintDebug && (logger.info([` - inlined props (${inlined.size}):`, shouldDeopt ? " deopted" : "", hasSpread ? " has spread" : "", staticConfig.neverFlatten ? "neverFlatten" : ""].join(" ")), logger.info(` - shouldFlatten/isFlattened: ${shouldFlatten}`), logger.info(` - attrs (end):
|
942
|
-
${logLines(attrs.map(attrStr).join(", "))}`)), onExtractTag({
|
943
|
-
parserProps: propsWithFileInfo,
|
944
|
-
attrs,
|
945
|
-
node,
|
946
|
-
lineNumbers,
|
947
|
-
filePath,
|
948
|
-
config: tamaguiConfig,
|
949
|
-
attemptEval,
|
950
|
-
jsxPath: traversePath,
|
951
|
-
originalNodeName,
|
952
|
-
isFlattened: shouldFlatten,
|
953
|
-
programPath,
|
954
|
-
completeProps,
|
955
|
-
staticConfig
|
956
|
-
});
|
957
|
-
} catch (err) {
|
958
|
-
node.attributes = ogAttributes, console.error(`@tamagui/static error, reverting optimization. In ${filePath} ${lineNumbers} on ${originalNodeName}: ${err.message}. For stack trace set environment TAMAGUI_DEBUG=1`), process.env.TAMAGUI_DEBUG === "1" && console.error(err.stack);
|
959
|
-
} finally {
|
960
|
-
debugPropValue && (shouldPrintDebug = ogDebug);
|
961
|
-
}
|
962
|
-
}
|
963
|
-
}), tm.mark("jsx-done", !!shouldPrintDebug), modifiedComponents.size) {
|
964
|
-
const all = Array.from(modifiedComponents);
|
965
|
-
shouldPrintDebug && logger.info(` [\u{1FA9D}] hook check ${all.length}`);
|
966
|
-
for (const comp of all) removeUnusedHooks(comp, shouldPrintDebug);
|
967
|
-
}
|
968
|
-
return tm.done(shouldPrintDebug === "verbose"), res;
|
969
|
-
}
|
970
|
-
}
|
971
|
-
export { createExtractor };
|
972
|
-
//# sourceMappingURL=createExtractor.mjs.map
|