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