@tamagui/static 1.0.0-alpha.8 → 1.0.0-alpha.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/static",
3
- "version": "1.0.0-alpha.8",
3
+ "version": "1.0.0-alpha.9",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -54,7 +54,7 @@
54
54
  "@dish/babel-preset": "^0.0.6",
55
55
  "@expo/match-media": "^0.1.0",
56
56
  "@tamagui/build": "^1.0.0-alpha.8",
57
- "@tamagui/core": "^1.0.0-alpha.8",
57
+ "@tamagui/core": "^1.0.0-alpha.9",
58
58
  "@tamagui/core-node": "^1.0.0-alpha.8",
59
59
  "@tamagui/fake-react-native": "^1.0.0-alpha.2",
60
60
  "@tamagui/helpers": "^1.0.0-alpha.8",
@@ -65,10 +65,10 @@
65
65
  "fs-extra": "^9.0.0",
66
66
  "invariant": "^2.2.4",
67
67
  "lodash": "^4.17.20",
68
- "tamagui": "^1.0.0-alpha.8"
68
+ "tamagui": "^1.0.0-alpha.9"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "react-native-web": "*"
72
72
  },
73
- "gitHead": "ecb0afe6782276b1f2ece90320fd2748f2f05c93"
73
+ "gitHead": "48ab0be0ca0b8d7e9a1470ee18d46348bc316cdd"
74
74
  }
@@ -13,6 +13,7 @@ import { findTopmostFunction } from './findTopmostFunction'
13
13
  import { getStaticBindingsForScope } from './getStaticBindingsForScope'
14
14
  import { literalToAst } from './literalToAst'
15
15
  import { loadTamagui } from './loadTamagui'
16
+ import { logLines } from './logLines'
16
17
  import { normalizeTernaries } from './normalizeTernaries'
17
18
  import { removeUnusedHooks } from './removeUnusedHooks'
18
19
 
@@ -95,8 +96,9 @@ export function createExtractor() {
95
96
  /**
96
97
  * Step 1: Determine if importing any statically extractable components
97
98
  */
98
- const isInternalImport = (importStr: string) =>
99
- isInsideTamagui(sourcePath) && importStr[0] === '.'
99
+ const isInternalImport = (importStr: string) => {
100
+ return isInsideTamagui(sourcePath) && importStr[0] === '.'
101
+ }
100
102
 
101
103
  const validComponents: { [key: string]: any } = Object.keys(components)
102
104
  // check if uppercase to avoid hitting media query proxy before init
@@ -797,7 +799,7 @@ export function createExtractor() {
797
799
 
798
800
  // see if we can filter them
799
801
  if (shouldPrintDebug) {
800
- console.log(' - attrs (before): ', attrs.map(attrStr).join(', '))
802
+ console.log(' - attrs (before):\n', logLines(attrs.map(attrStr).join(', ')))
801
803
  }
802
804
 
803
805
  // now update to new values
@@ -936,7 +938,7 @@ export function createExtractor() {
936
938
  }
937
939
 
938
940
  if (shouldPrintDebug) {
939
- console.log(' - attrs (flattened): ', attrs.map(attrStr).join(', '))
941
+ console.log(' - attrs (flattened): \n', logLines(attrs.map(attrStr).join(', ')))
940
942
  }
941
943
 
942
944
  // evaluate away purely style props
@@ -962,7 +964,7 @@ export function createExtractor() {
962
964
  }, [])
963
965
 
964
966
  if (shouldPrintDebug) {
965
- console.log(' - attrs (evaluated styles): ', attrs.map(attrStr).join(', '))
967
+ console.log(' - attrs (evaluated styles): \n', logLines(attrs.map(attrStr).join(', ')))
966
968
  }
967
969
 
968
970
  // combine styles, leave undefined values
@@ -980,7 +982,7 @@ export function createExtractor() {
980
982
  }, [])
981
983
 
982
984
  if (shouldPrintDebug) {
983
- console.log(' - attrs (combined 🔀): ', attrs.map(attrStr).join(', '))
985
+ console.log(' - attrs (combined 🔀): \n', logLines(attrs.map(attrStr).join(', ')))
984
986
  }
985
987
 
986
988
  // post process
@@ -995,9 +997,10 @@ export function createExtractor() {
995
997
  const out = postProcessStyles(props, staticConfig, defaultTheme)
996
998
  const next = out?.style ?? props
997
999
  if (shouldPrintDebug) {
998
- console.log(' >> getStyles: ', objToStr(props), '==>>', objToStr(next))
999
- console.log(' >> style: ', objToStr(out.style))
1000
- console.log(' >> viewp: ', objToStr(out.viewProps))
1000
+ console.log(' getStyles props >>\n', logLines(objToStr(props)))
1001
+ console.log(' getStyles next >>\n', logLines(objToStr(next)))
1002
+ console.log(' getStyles style >>\n', logLines(objToStr(out.style)))
1003
+ console.log(' getStyles viewp >>\n', logLines(objToStr(out.viewProps)))
1001
1004
  }
1002
1005
  if (staticConfig.validStyles) {
1003
1006
  for (const key in next) {
@@ -1009,10 +1012,6 @@ export function createExtractor() {
1009
1012
  return next
1010
1013
  }
1011
1014
 
1012
- if (shouldPrintDebug) {
1013
- console.log(' staticConfig.defaultProps', staticConfig.defaultProps)
1014
- }
1015
-
1016
1015
  // used to ensure we pass the entire prop bundle to getStyles
1017
1016
  const completeStylesProcessed = getStyles({
1018
1017
  ...staticConfig.defaultProps,
@@ -1041,9 +1040,9 @@ export function createExtractor() {
1041
1040
 
1042
1041
  if (shouldPrintDebug) {
1043
1042
  // prettier-ignore
1044
- console.log(' completeStaticProps', objToStr(completeStaticProps))
1043
+ console.log(' completeStaticProps\n', logLines(objToStr(completeStaticProps)))
1045
1044
  // prettier-ignore
1046
- console.log(' completeStylesProcessed', objToStr(completeStylesProcessed))
1045
+ console.log(' completeStylesProcessed\n', logLines(objToStr(completeStylesProcessed)))
1047
1046
  }
1048
1047
 
1049
1048
  for (const attr of attrs) {
@@ -1082,7 +1081,7 @@ export function createExtractor() {
1082
1081
  }
1083
1082
 
1084
1083
  if (shouldPrintDebug) {
1085
- console.log(' - attrs (after): ', attrs.map(attrStr).join(', '))
1084
+ console.log(' - attrs (after):\n', logLines(attrs.map(attrStr).join(', ')))
1086
1085
  }
1087
1086
 
1088
1087
  if (shouldFlatten) {
@@ -1101,7 +1100,7 @@ export function createExtractor() {
1101
1100
  if (shouldPrintDebug) {
1102
1101
  // prettier-ignore
1103
1102
  console.log(' [❊] inline props ', inlinePropCount, shouldDeopt ? ' deopted' : '', hasSpread ? ' spread' : '', '!flatten', staticConfig.neverFlatten)
1104
- console.log(' - attrs (end): ', attrs.map(attrStr).join(', '))
1103
+ console.log(' - attrs (end):\n', logLines(attrs.map(attrStr).join(', ')))
1105
1104
  }
1106
1105
 
1107
1106
  res.optimized++
@@ -18,6 +18,7 @@ import { ensureImportingConcat } from './ensureImportingConcat'
18
18
  import { isSimpleSpread } from './extractHelpers'
19
19
  import { extractMediaStyle } from './extractMediaStyle'
20
20
  import { hoistClassNames } from './hoistClassNames'
21
+ import { logLines } from './logLines'
21
22
 
22
23
  export const CONCAT_CLASSNAME_IMPORT = 'concatClassName'
23
24
 
@@ -136,10 +137,6 @@ export function extractToClassNames({
136
137
  case 'style':
137
138
  const styles = addStyles(attr.value)
138
139
  const newClassNames = concatClassName(styles.map((x) => x.identifier).join(' '))
139
- if (shouldPrintDebug) {
140
- // console.log(' style', attr.value)
141
- console.log(' classnames', newClassNames, finalClassNames)
142
- }
143
140
  // prettier-ignore
144
141
  const existing = finalClassNames.find((x) => x.type == 'StringLiteral') as t.StringLiteral | null
145
142
  if (existing) {
@@ -149,7 +146,7 @@ export function extractToClassNames({
149
146
  }
150
147
  if (shouldPrintDebug) {
151
148
  // prettier-ignore
152
- console.log(' classnames (after)', finalClassNames.map(x => x['value']).join(' '))
149
+ console.log(' classnames (after)\n', logLines(finalClassNames.map(x => x['value']).join(' ')))
153
150
  }
154
151
  break
155
152
  case 'attr':
@@ -0,0 +1,11 @@
1
+ export const logLines = (str: string) => {
2
+ let lines: string[] = ['']
3
+ const items = str.split(' ')
4
+ for (const item of items) {
5
+ if (item.length + lines[lines.length - 1].length > 100) {
6
+ lines.push('')
7
+ }
8
+ lines[lines.length - 1] += item + ' '
9
+ }
10
+ return lines.map((line, i) => ' ' + (i == 0 ? '' : ' ') + line.trim()).join('\n')
11
+ }