@tamagui/static 1.0.0-alpha.0 → 1.0.0-alpha.4

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.0",
3
+ "version": "1.0.0-alpha.4",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -25,48 +25,48 @@
25
25
  },
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "@babel/core": "^7.15.5",
29
- "@babel/generator": "^7.15.4",
30
- "@babel/helper-plugin-utils": "^7.14.5",
31
- "@babel/parser": "^7.15.7",
32
28
  "@babel/plugin-syntax-typescript": "^7.14.5",
33
- "@babel/traverse": "^7.15.4",
34
29
  "@babel/types": "^7.15.6",
35
- "@dish/babel-preset": "^0.0.6",
36
- "@expo/match-media": "^0.1.0",
37
- "@tamagui/build": "^1.0.0-alpha.0",
38
- "@tamagui/core": "^1.0.0-alpha.0",
39
30
  "@testing-library/react": "13.0.0-alpha.4",
40
31
  "@types/jest": "*",
41
32
  "@types/node": "^16.11.9",
42
33
  "@types/react-native": "^0.64.2",
43
34
  "@types/webpack": "^4.41.26",
44
- "babel-literal-to-ast": "^2.1.0",
45
35
  "babel-loader": "^8.2.2",
46
36
  "css-loader": "^5.2.4",
47
- "esbuild": "^0.13.12",
48
- "find-cache-dir": "^3.3.1",
49
- "fs-extra": "^9.0.0",
50
- "invariant": "^2.2.4",
51
37
  "jest": "^27.3.1",
52
38
  "loader-utils": "^2.0.0",
53
- "lodash": "^4.17.20",
54
39
  "react": "*",
55
40
  "react-dom": "*",
56
41
  "react-test-renderer": "18.0.0-beta-149b420f6-20211119",
57
42
  "style-loader": "^3.3.0",
58
- "tamagui": "^1.0.0-alpha.0",
59
43
  "typescript": "^4.4.4",
60
44
  "webpack": "^5.58.1"
61
45
  },
62
46
  "dependencies": {
63
- "@tamagui/core-node": "^1.0.0-alpha.0",
64
- "@tamagui/fake-react-native": "^1.0.0-alpha.0",
65
- "@tamagui/helpers": "^1.0.0-alpha.0",
66
- "esbuild-register": "^3.1.2"
47
+ "@babel/core": "^7.15.5",
48
+ "@babel/generator": "^7.15.4",
49
+ "@babel/helper-plugin-utils": "^7.14.5",
50
+ "@babel/parser": "^7.15.7",
51
+ "@babel/traverse": "^7.15.4",
52
+ "@dish/babel-preset": "^0.0.6",
53
+ "@expo/match-media": "^0.1.0",
54
+ "@tamagui/build": "^1.0.0-alpha.2",
55
+ "@tamagui/core": "^1.0.0-alpha.4",
56
+ "@tamagui/core-node": "^1.0.0-alpha.2",
57
+ "@tamagui/fake-react-native": "^1.0.0-alpha.2",
58
+ "@tamagui/helpers": "^1.0.0-alpha.2",
59
+ "babel-literal-to-ast": "^2.1.0",
60
+ "esbuild": "^0.13.12",
61
+ "esbuild-register": "^3.1.2",
62
+ "find-cache-dir": "^3.3.1",
63
+ "fs-extra": "^9.0.0",
64
+ "invariant": "^2.2.4",
65
+ "lodash": "^4.17.20",
66
+ "tamagui": "^1.0.0-alpha.4"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "react-native-web": "*"
70
70
  },
71
- "gitHead": "a41c5a5b08be5518d138515137122c248e3f7c71"
71
+ "gitHead": "3e3b5401f9daea70cf9a99782d325f58357ca681"
72
72
  }
@@ -100,6 +100,7 @@ export function createExtractor() {
100
100
  */
101
101
  const isInternalImport = (importStr: string) =>
102
102
  isInsideTamagui(sourcePath) && importStr[0] === '.'
103
+
103
104
  const validComponents: { [key: string]: any } = Object.keys(components)
104
105
  .filter((key) => !!components[key]?.staticConfig)
105
106
  .reduce((obj, name) => {
@@ -399,9 +400,9 @@ export function createExtractor() {
399
400
  }
400
401
  const propName = prop.key['name']
401
402
  if (!isStaticAttributeName(propName) && propName !== 'tag') {
402
- // if (shouldPrintDebug) {
403
- console.log(' not a valid style prop!', propName)
404
- // }
403
+ if (shouldPrintDebug) {
404
+ console.log(' not a valid style prop!', propName)
405
+ }
405
406
  return false
406
407
  }
407
408
  return true
@@ -489,7 +490,9 @@ export function createExtractor() {
489
490
  const [test, alt, cons] = conditional
490
491
  if (!test) throw new Error(`no test`)
491
492
  if ([alt, cons].some((side) => side && !isExtractable(side))) {
492
- console.log('not extractable', alt, cons)
493
+ if (shouldPrintDebug) {
494
+ console.log('not extractable', alt, cons)
495
+ }
493
496
  return attr
494
497
  }
495
498
  // split into individual ternaries per object property
@@ -21,7 +21,10 @@ export const attrStr = (attr: ExtractedAttr) => {
21
21
 
22
22
  export const objToStr = (obj: any) => {
23
23
  return Object.entries(obj)
24
- .map(([k, v]) => `${k}:${Array.isArray(v) ? `[...]` : v && typeof v === 'object' ? `{${objToStr(v)}}` : v}`)
24
+ .map(
25
+ ([k, v]) =>
26
+ `${k}:${Array.isArray(v) ? `[...]` : v && typeof v === 'object' ? `{${objToStr(v)}}` : v}`
27
+ )
25
28
  .join(', ')
26
29
  }
27
30
 
@@ -69,7 +72,11 @@ export function findComponentName(scope) {
69
72
  return componentName
70
73
  }
71
74
 
72
- export function isValidThemeHook(jsxPath: NodePath<t.JSXElement>, n: t.MemberExpression, sourcePath: string) {
75
+ export function isValidThemeHook(
76
+ jsxPath: NodePath<t.JSXElement>,
77
+ n: t.MemberExpression,
78
+ sourcePath: string
79
+ ) {
73
80
  if (!t.isIdentifier(n.object) || !t.isIdentifier(n.property)) return false
74
81
  const bindings = jsxPath.scope.getAllBindings()
75
82
  const binding = bindings[n.object.name]
@@ -90,4 +97,6 @@ export function isValidThemeHook(jsxPath: NodePath<t.JSXElement>, n: t.MemberExp
90
97
  return true
91
98
  }
92
99
 
93
- export const isInsideTamagui = (srcName: string) => srcName.includes('/tamagui/')
100
+ export const isInsideTamagui = (srcName: string) => {
101
+ return srcName.includes('/tamagui/_jsx') || srcName.includes('/core/src')
102
+ }