@tamagui/static 1.89.26 → 1.89.27-1708113113238
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/constants.native.js +4 -4
- package/dist/cjs/constants.native.js.map +3 -3
- package/dist/cjs/extractor/accessSafe.native.js +1 -5
- package/dist/cjs/extractor/accessSafe.native.js.map +3 -3
- package/dist/cjs/extractor/babelParse.native.js +5 -8
- package/dist/cjs/extractor/babelParse.native.js.map +3 -3
- package/dist/cjs/extractor/buildClassName.native.js +31 -42
- package/dist/cjs/extractor/buildClassName.native.js.map +3 -3
- package/dist/cjs/extractor/bundle.js +6 -4
- package/dist/cjs/extractor/bundle.js.map +1 -1
- package/dist/cjs/extractor/bundle.native.js +321 -56
- package/dist/cjs/extractor/bundle.native.js.map +3 -3
- package/dist/cjs/extractor/bundleConfig.native.js +499 -187
- package/dist/cjs/extractor/bundleConfig.native.js.map +3 -3
- package/dist/cjs/extractor/createEvaluator.native.js +9 -11
- package/dist/cjs/extractor/createEvaluator.native.js.map +3 -3
- package/dist/cjs/extractor/createExtractor.native.js +1240 -906
- package/dist/cjs/extractor/createExtractor.native.js.map +3 -3
- package/dist/cjs/extractor/ensureImportingConcat.native.js +11 -17
- package/dist/cjs/extractor/ensureImportingConcat.native.js.map +3 -3
- package/dist/cjs/extractor/esbuildAliasPlugin.native.js +22 -11
- package/dist/cjs/extractor/esbuildAliasPlugin.native.js.map +3 -3
- package/dist/cjs/extractor/evaluateAstNode.native.js +15 -21
- package/dist/cjs/extractor/evaluateAstNode.native.js.map +3 -3
- package/dist/cjs/extractor/extractHelpers.native.js +146 -38
- package/dist/cjs/extractor/extractHelpers.native.js.map +3 -3
- package/dist/cjs/extractor/extractMediaStyle.native.js +127 -54
- package/dist/cjs/extractor/extractMediaStyle.native.js.map +3 -3
- package/dist/cjs/extractor/extractToClassNames.native.js +449 -252
- package/dist/cjs/extractor/extractToClassNames.native.js.map +3 -3
- package/dist/cjs/extractor/findTopmostFunction.native.js +4 -4
- package/dist/cjs/extractor/findTopmostFunction.native.js.map +3 -3
- package/dist/cjs/extractor/generateTamaguiStudioConfig.native.js +415 -54
- package/dist/cjs/extractor/generateTamaguiStudioConfig.native.js.map +3 -3
- package/dist/cjs/extractor/generatedUid.native.js +2 -2
- package/dist/cjs/extractor/generatedUid.native.js.map +3 -3
- package/dist/cjs/extractor/getPrefixLogs.native.js +2 -1
- package/dist/cjs/extractor/getPrefixLogs.native.js.map +3 -3
- package/dist/cjs/extractor/getPropValueFromAttributes.native.js +16 -19
- package/dist/cjs/extractor/getPropValueFromAttributes.native.js.map +3 -3
- package/dist/cjs/extractor/getSourceModule.native.js +20 -7
- package/dist/cjs/extractor/getSourceModule.native.js.map +3 -3
- package/dist/cjs/extractor/getStaticBindingsForScope.native.js +336 -94
- package/dist/cjs/extractor/getStaticBindingsForScope.native.js.map +3 -3
- package/dist/cjs/extractor/getTamaguiConfigPathFromOptionsConfig.native.js.map +3 -3
- package/dist/cjs/extractor/hoistClassNames.native.js +8 -10
- package/dist/cjs/extractor/hoistClassNames.native.js.map +3 -3
- package/dist/cjs/extractor/literalToAst.native.js +89 -19
- package/dist/cjs/extractor/literalToAst.native.js.map +3 -3
- package/dist/cjs/extractor/loadFile.native.js +16 -8
- package/dist/cjs/extractor/loadFile.native.js.map +3 -3
- package/dist/cjs/extractor/loadTamagui.js +3 -3
- package/dist/cjs/extractor/loadTamagui.js.map +1 -1
- package/dist/cjs/extractor/loadTamagui.native.js +667 -192
- package/dist/cjs/extractor/loadTamagui.native.js.map +3 -3
- package/dist/cjs/extractor/logLines.native.js +24 -6
- package/dist/cjs/extractor/logLines.native.js.map +3 -3
- package/dist/cjs/extractor/normalizeTernaries.native.js +71 -20
- package/dist/cjs/extractor/normalizeTernaries.native.js.map +3 -3
- package/dist/cjs/extractor/propsToFontFamilyCache.native.js +3 -3
- package/dist/cjs/extractor/propsToFontFamilyCache.native.js.map +3 -3
- package/dist/cjs/extractor/removeUnusedHooks.native.js +69 -36
- package/dist/cjs/extractor/removeUnusedHooks.native.js.map +3 -3
- package/dist/cjs/extractor/timer.native.js +10 -9
- package/dist/cjs/extractor/timer.native.js.map +3 -3
- package/dist/cjs/extractor/validHTMLAttributes.native.js +1 -1
- package/dist/cjs/extractor/validHTMLAttributes.native.js.map +3 -3
- package/dist/cjs/getPragmaOptions.native.js +4 -9
- package/dist/cjs/getPragmaOptions.native.js.map +3 -3
- package/dist/cjs/helpers/memoize.native.js +5 -3
- package/dist/cjs/helpers/memoize.native.js.map +3 -3
- package/dist/cjs/helpers/requireTamaguiCore.native.js +2 -1
- package/dist/cjs/helpers/requireTamaguiCore.native.js.map +3 -3
- package/dist/cjs/index.native.js.map +2 -2
- package/dist/cjs/minifyCSS.native.js.map +3 -3
- package/dist/cjs/registerRequire.native.js +56 -28
- package/dist/cjs/registerRequire.native.js.map +3 -3
- package/dist/cjs/server.native.js +175 -21
- package/dist/cjs/server.native.js.map +3 -3
- package/dist/cjs/setup.native.js.map +3 -3
- package/dist/cjs/static.native.js.map +2 -2
- package/dist/cjs/types.native.js.map +2 -2
- package/dist/cjs/webpackPlugin.native.js +26 -5
- package/dist/cjs/webpackPlugin.native.js.map +3 -3
- package/dist/esm/constants.native.js +4 -3
- package/dist/esm/constants.native.js.map +3 -3
- package/dist/esm/extractor/accessSafe.native.js +1 -5
- package/dist/esm/extractor/accessSafe.native.js.map +3 -3
- package/dist/esm/extractor/babelParse.native.js +5 -7
- package/dist/esm/extractor/babelParse.native.js.map +3 -3
- package/dist/esm/extractor/buildClassName.native.js +31 -41
- package/dist/esm/extractor/buildClassName.native.js.map +3 -3
- package/dist/esm/extractor/bundle.js +6 -4
- package/dist/esm/extractor/bundle.js.map +1 -1
- package/dist/esm/extractor/bundle.mjs +7 -5
- package/dist/esm/extractor/bundle.native.js +321 -56
- package/dist/esm/extractor/bundle.native.js.map +3 -3
- package/dist/esm/extractor/bundleConfig.native.js +499 -187
- package/dist/esm/extractor/bundleConfig.native.js.map +3 -3
- package/dist/esm/extractor/createEvaluator.native.js +9 -11
- package/dist/esm/extractor/createEvaluator.native.js.map +3 -3
- package/dist/esm/extractor/createExtractor.native.js +1241 -916
- package/dist/esm/extractor/createExtractor.native.js.map +3 -3
- package/dist/esm/extractor/ensureImportingConcat.native.js +11 -16
- package/dist/esm/extractor/ensureImportingConcat.native.js.map +3 -3
- package/dist/esm/extractor/esbuildAliasPlugin.native.js +22 -11
- package/dist/esm/extractor/esbuildAliasPlugin.native.js.map +3 -3
- package/dist/esm/extractor/evaluateAstNode.native.js +15 -21
- package/dist/esm/extractor/evaluateAstNode.native.js.map +3 -3
- package/dist/esm/extractor/extractHelpers.native.js +146 -38
- package/dist/esm/extractor/extractHelpers.native.js.map +3 -3
- package/dist/esm/extractor/extractMediaStyle.native.js +127 -54
- package/dist/esm/extractor/extractMediaStyle.native.js.map +3 -3
- package/dist/esm/extractor/extractToClassNames.native.js +449 -252
- package/dist/esm/extractor/extractToClassNames.native.js.map +3 -3
- package/dist/esm/extractor/findTopmostFunction.native.js +4 -4
- package/dist/esm/extractor/findTopmostFunction.native.js.map +3 -3
- package/dist/esm/extractor/generateTamaguiStudioConfig.native.js +415 -54
- package/dist/esm/extractor/generateTamaguiStudioConfig.native.js.map +3 -3
- package/dist/esm/extractor/generatedUid.native.js +2 -2
- package/dist/esm/extractor/generatedUid.native.js.map +3 -3
- package/dist/esm/extractor/getPrefixLogs.native.js +2 -1
- package/dist/esm/extractor/getPrefixLogs.native.js.map +3 -3
- package/dist/esm/extractor/getPropValueFromAttributes.native.js +16 -19
- package/dist/esm/extractor/getPropValueFromAttributes.native.js.map +3 -3
- package/dist/esm/extractor/getSourceModule.native.js +20 -7
- package/dist/esm/extractor/getSourceModule.native.js.map +3 -3
- package/dist/esm/extractor/getStaticBindingsForScope.native.js +336 -94
- package/dist/esm/extractor/getStaticBindingsForScope.native.js.map +3 -3
- package/dist/esm/extractor/getTamaguiConfigPathFromOptionsConfig.native.js.map +3 -3
- package/dist/esm/extractor/hoistClassNames.native.js +8 -10
- package/dist/esm/extractor/hoistClassNames.native.js.map +3 -3
- package/dist/esm/extractor/literalToAst.native.js +89 -19
- package/dist/esm/extractor/literalToAst.native.js.map +3 -3
- package/dist/esm/extractor/loadFile.native.js +16 -8
- package/dist/esm/extractor/loadFile.native.js.map +3 -3
- package/dist/esm/extractor/loadTamagui.js +1 -2
- package/dist/esm/extractor/loadTamagui.js.map +1 -1
- package/dist/esm/extractor/loadTamagui.mjs +5 -3
- package/dist/esm/extractor/loadTamagui.native.js +668 -203
- package/dist/esm/extractor/loadTamagui.native.js.map +3 -3
- package/dist/esm/extractor/logLines.native.js +24 -6
- package/dist/esm/extractor/logLines.native.js.map +3 -3
- package/dist/esm/extractor/normalizeTernaries.native.js +71 -20
- package/dist/esm/extractor/normalizeTernaries.native.js.map +3 -3
- package/dist/esm/extractor/propsToFontFamilyCache.native.js +3 -3
- package/dist/esm/extractor/propsToFontFamilyCache.native.js.map +3 -3
- package/dist/esm/extractor/removeUnusedHooks.native.js +69 -35
- package/dist/esm/extractor/removeUnusedHooks.native.js.map +3 -3
- package/dist/esm/extractor/timer.native.js +10 -9
- package/dist/esm/extractor/timer.native.js.map +3 -3
- package/dist/esm/extractor/validHTMLAttributes.native.js +1 -1
- package/dist/esm/extractor/validHTMLAttributes.native.js.map +3 -3
- package/dist/esm/getPragmaOptions.native.js +4 -9
- package/dist/esm/getPragmaOptions.native.js.map +3 -3
- package/dist/esm/helpers/memoize.native.js +5 -3
- package/dist/esm/helpers/memoize.native.js.map +3 -3
- package/dist/esm/helpers/requireTamaguiCore.native.js +2 -1
- package/dist/esm/helpers/requireTamaguiCore.native.js.map +3 -3
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/minifyCSS.native.js.map +3 -3
- package/dist/esm/registerRequire.native.js +56 -28
- package/dist/esm/registerRequire.native.js.map +3 -3
- package/dist/esm/server.native.js +175 -21
- package/dist/esm/server.native.js.map +3 -3
- package/dist/esm/setup.native.js.map +3 -3
- package/dist/esm/static.native.js.map +3 -3
- package/dist/esm/webpackPlugin.native.js +26 -5
- package/dist/esm/webpackPlugin.native.js.map +3 -3
- package/package.json +14 -15
- package/src/extractor/bundle.ts +5 -2
- package/src/extractor/loadTamagui.ts +3 -2
- package/types/extractor/bundle.d.ts.map +1 -1
- package/types/extractor/loadTamagui.d.ts.map +1 -1
- package/tamagui.tsconfig.json +0 -5
@@ -3,79 +3,187 @@ import generate from "@babel/generator";
|
|
3
3
|
import * as t from "@babel/types";
|
4
4
|
import findRoot from "find-root";
|
5
5
|
import { memoize } from "../helpers/memoize";
|
6
|
+
function _array_like_to_array(arr, len) {
|
7
|
+
(len == null || len > arr.length) && (len = arr.length);
|
8
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
9
|
+
arr2[i] = arr[i];
|
10
|
+
return arr2;
|
11
|
+
}
|
12
|
+
function _array_with_holes(arr) {
|
13
|
+
if (Array.isArray(arr))
|
14
|
+
return arr;
|
15
|
+
}
|
16
|
+
function _array_without_holes(arr) {
|
17
|
+
if (Array.isArray(arr))
|
18
|
+
return _array_like_to_array(arr);
|
19
|
+
}
|
20
|
+
function _iterable_to_array(iter) {
|
21
|
+
if (typeof Symbol < "u" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
22
|
+
return Array.from(iter);
|
23
|
+
}
|
24
|
+
function _iterable_to_array_limit(arr, i) {
|
25
|
+
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
26
|
+
if (_i != null) {
|
27
|
+
var _arr = [], _n = !0, _d = !1, _s, _e;
|
28
|
+
try {
|
29
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
30
|
+
;
|
31
|
+
} catch (err) {
|
32
|
+
_d = !0, _e = err;
|
33
|
+
} finally {
|
34
|
+
try {
|
35
|
+
!_n && _i.return != null && _i.return();
|
36
|
+
} finally {
|
37
|
+
if (_d)
|
38
|
+
throw _e;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
return _arr;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
function _non_iterable_rest() {
|
45
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
46
|
+
}
|
47
|
+
function _non_iterable_spread() {
|
48
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
49
|
+
}
|
50
|
+
function _sliced_to_array(arr, i) {
|
51
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
52
|
+
}
|
53
|
+
function _to_consumable_array(arr) {
|
54
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
55
|
+
}
|
56
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
57
|
+
if (o) {
|
58
|
+
if (typeof o == "string")
|
59
|
+
return _array_like_to_array(o, minLen);
|
60
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
61
|
+
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set")
|
62
|
+
return Array.from(n);
|
63
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
64
|
+
return _array_like_to_array(o, minLen);
|
65
|
+
}
|
66
|
+
}
|
6
67
|
function isPresent(input) {
|
7
68
|
return input != null;
|
8
69
|
}
|
9
70
|
function isSimpleSpread(node) {
|
10
71
|
return t.isIdentifier(node.argument) || t.isMemberExpression(node.argument);
|
11
72
|
}
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
"
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
),
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
73
|
+
var attrStr = function(attr) {
|
74
|
+
return attr ? attr.type === "attr" ? getNameAttr(attr.value) : attr.type === "ternary" ? "...".concat(ternaryStr(attr.value)) : "".concat(attr.type, "(").concat(objToStr(attr.value), ")") : "";
|
75
|
+
}, objToStr = function(obj) {
|
76
|
+
var spacer = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ", ";
|
77
|
+
return obj ? "{".concat(Object.entries(obj).map(function(param) {
|
78
|
+
var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
|
79
|
+
return "".concat(k, ":").concat(Array.isArray(v) ? "[...]" : v && typeof v == "object" ? "".concat(objToStr(v, ",")) : JSON.stringify(v));
|
80
|
+
}).join(spacer), "}") : "".concat(obj);
|
81
|
+
}, getNameAttr = function(attr) {
|
82
|
+
return t.isJSXSpreadAttribute(attr) ? "...".concat(attr.argument.name) : "name" in attr ? attr.name.name : "unknown-".concat(attr.type);
|
83
|
+
}, ternaryStr = function(x) {
|
84
|
+
var conditional = t.isIdentifier(x.test) ? x.test.name : t.isMemberExpression(x.test) ? [
|
85
|
+
x.test.object.name,
|
86
|
+
x.test.property.name
|
87
|
+
] : generate(x.test).code;
|
88
|
+
return [
|
89
|
+
"ternary(",
|
90
|
+
conditional,
|
91
|
+
isFilledObj(x.consequent) ? " ? ".concat(objToStr(x.consequent)) : " ? \u{1F6AB}",
|
92
|
+
isFilledObj(x.alternate) ? " : ".concat(objToStr(x.alternate)) : " : \u{1F6AB}",
|
93
|
+
")"
|
94
|
+
].flat().join("");
|
95
|
+
}, isFilledObj = function(obj) {
|
96
|
+
return obj && Object.keys(obj).length;
|
97
|
+
};
|
24
98
|
function findComponentName(scope) {
|
25
|
-
var
|
26
|
-
const componentName = "";
|
27
|
-
let cur = scope.path;
|
28
|
-
for (; cur.parentPath && !t.isProgram(cur.parentPath.parent); )
|
99
|
+
for (var componentName = "", cur = scope.path; cur.parentPath && !t.isProgram(cur.parentPath.parent); )
|
29
100
|
cur = cur.parentPath;
|
30
|
-
|
101
|
+
var node = cur.parent;
|
31
102
|
if (t.isExportNamedDeclaration(node) && (node = node.declaration), t.isVariableDeclaration(node)) {
|
32
|
-
|
103
|
+
var _node_declarations = _sliced_to_array(node.declarations, 1), dec = _node_declarations[0];
|
33
104
|
if (t.isVariableDeclarator(dec) && t.isIdentifier(dec.id))
|
34
105
|
return dec.id.name;
|
35
106
|
}
|
36
|
-
|
107
|
+
if (t.isFunctionDeclaration(node)) {
|
108
|
+
var _node_id;
|
109
|
+
return (_node_id = node.id) === null || _node_id === void 0 ? void 0 : _node_id.name;
|
110
|
+
}
|
111
|
+
return componentName;
|
37
112
|
}
|
38
113
|
function isValidThemeHook(props, jsxPath, n, sourcePath) {
|
39
|
-
var
|
114
|
+
var _binding_scope_getBinding;
|
40
115
|
if (!t.isIdentifier(n.object) || !t.isIdentifier(n.property))
|
41
116
|
return !1;
|
42
|
-
|
117
|
+
var bindings = jsxPath.scope.getAllBindings(), binding = bindings[n.object.name];
|
43
118
|
if (!(binding != null && binding.path) || !binding.path.isVariableDeclarator())
|
44
119
|
return !1;
|
45
|
-
|
120
|
+
var init = binding.path.node.init;
|
46
121
|
if (!init || !t.isCallExpression(init) || !t.isIdentifier(init.callee) || init.callee.name !== "useTheme")
|
47
122
|
return !1;
|
48
|
-
|
123
|
+
var importNode = (_binding_scope_getBinding = binding.scope.getBinding("useTheme")) === null || _binding_scope_getBinding === void 0 ? void 0 : _binding_scope_getBinding.path.parent;
|
49
124
|
return !(!t.isImportDeclaration(importNode) || sourcePath && !isValidImport(props, sourcePath));
|
50
125
|
}
|
51
|
-
|
126
|
+
var isInsideComponentPackage = function(props, moduleName) {
|
127
|
+
return getValidComponentsPaths(props).some(function(path) {
|
128
|
+
return moduleName.startsWith(path);
|
129
|
+
});
|
130
|
+
}, isComponentPackage = function(props, srcName) {
|
131
|
+
return getValidComponentsPaths(props).some(function(path) {
|
132
|
+
return srcName.startsWith(path);
|
133
|
+
});
|
134
|
+
};
|
52
135
|
function getValidComponent(props, moduleName, componentName) {
|
53
136
|
if (componentName[0].toUpperCase() !== componentName[0])
|
54
137
|
return !1;
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
138
|
+
var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
139
|
+
try {
|
140
|
+
for (var _iterator = props.allLoadedComponents[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
141
|
+
var loaded = _step.value;
|
142
|
+
if (loaded) {
|
143
|
+
var isInModule = moduleName === "*" || moduleName.startsWith(loaded.moduleName), foundComponent = loaded.nameToInfo[componentName];
|
144
|
+
if (isInModule && foundComponent)
|
145
|
+
return foundComponent;
|
146
|
+
}
|
147
|
+
}
|
148
|
+
} catch (err) {
|
149
|
+
_didIteratorError = !0, _iteratorError = err;
|
150
|
+
} finally {
|
151
|
+
try {
|
152
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
153
|
+
} finally {
|
154
|
+
if (_didIteratorError)
|
155
|
+
throw _iteratorError;
|
156
|
+
}
|
61
157
|
}
|
62
158
|
return null;
|
63
159
|
}
|
64
|
-
|
160
|
+
var isValidModule = function(props, moduleName) {
|
65
161
|
if (typeof moduleName != "string")
|
66
162
|
throw new Error("No module name");
|
67
|
-
|
163
|
+
var isLocal = moduleName.startsWith(".");
|
68
164
|
return {
|
69
165
|
isLocal,
|
70
166
|
isValid: isLocal ? isInsideComponentPackage(props, moduleName) : isComponentPackage(props, moduleName)
|
71
167
|
};
|
72
|
-
}, getValidImport = (props, moduleName, componentName)
|
73
|
-
|
168
|
+
}, getValidImport = function(props, moduleName, componentName) {
|
169
|
+
var _isValidModule = isValidModule(props, moduleName), isValid = _isValidModule.isValid, isLocal = _isValidModule.isLocal;
|
74
170
|
return !isValid || !componentName ? null : getValidComponent(props, isLocal ? "*" : moduleName, componentName) || null;
|
75
|
-
}, isValidImport = (props, moduleName, componentName)
|
76
|
-
|
77
|
-
|
78
|
-
|
171
|
+
}, isValidImport = function(props, moduleName, componentName) {
|
172
|
+
return componentName ? !!getValidImport(props, moduleName, componentName) : isValidModule(props, moduleName).isValid;
|
173
|
+
}, getValidComponentPackages = memoize(function(props) {
|
174
|
+
return _to_consumable_array(new Set([
|
175
|
+
"@tamagui/core",
|
176
|
+
"tamagui"
|
177
|
+
].concat(_to_consumable_array(props.components))));
|
178
|
+
}), getValidComponentsPaths = memoize(function(props) {
|
179
|
+
return getValidComponentPackages(props).flatMap(function(pkg) {
|
180
|
+
var root = findRoot(pkg), based = basename(root);
|
181
|
+
return [
|
182
|
+
based,
|
183
|
+
pkg
|
184
|
+
].filter(Boolean);
|
185
|
+
});
|
186
|
+
});
|
79
187
|
export {
|
80
188
|
attrStr,
|
81
189
|
findComponentName,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
|
-
"sources": ["../../../src/extractor/extractHelpers.ts"],
|
4
|
-
"mappings": "AAAA,
|
5
|
-
"names": []
|
3
|
+
"sources": ["../../../src/extractor/Users/n8/tamagui/packages/static/src/extractor/extractHelpers.ts"],
|
4
|
+
"mappings": "AAAA,SAASA,gBAAgB;AAEzB,OAAOC,cAAc;AAErB,YAAYC,OAAO;AACnB,OAAOC,cAAc;AAErB,SAASC,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKjB,SAASC,UACdC,OAAkC;AAElC,SAAOA,SAAS;AAClB;AAEO,SAASC,eAAeC,MAA0B;AACvD,SAAON,EAAEO,aAAaD,KAAKE,QAAQ,KAAKR,EAAES,mBAAmBH,KAAKE,QAAQ;AAC5E;AAEO,IAAME,UAAU,SAACC,MAAAA;AACtB,SAAQA,OAEJA,KAAKC,SAAS,SACZC,YAAYF,KAAKG,KAAK,IACtBH,KAAKC,SAAS,YACX,MAA4B,OAAvBG,WAAWJ,KAAKG,KAAK,CAAA,IAC1B,GAAeE,OAAbL,KAAKC,MAAK,GAAA,EAAwB,OAArBI,SAASL,KAAKG,KAAK,GAAE,GAAA,IALzC;AAMN,GAEaE,WAAW,SAACC,K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AChC;AACF,GAEaiB,iBAAiB,SAC5BhC,OACAe,YACA9B,eAAAA;AAEA,MAA6B2C,iBAAAA,cAAc5B,OAAOe,UAAAA,GAA1CgB,UAAqBH,eAArBG,SAASD,UAAYF,eAAZE;AACjB,SAAI,CAACC,WAAW,CAAC9C,gBACR,OAEFoC,kBAAkBrB,OAAO8B,UAAU,MAAMf,YAAY9B,aAAAA,KAAkB;AAChF,GAEa4B,gBAAgB,SAC3Bb,OACAe,YACA9B,eAAAA;AAEA,SAAKA,gBAGEgD,EAAQD,eAAehC,OAAOe,YAAY9B,aAAAA,IAFxC2C,cAAc5B,OAAOe,UAAAA,EAAYgB;AAG5C,GAEMG,4BAA4B5F,QAAQ,SAAC0D,OAAAA;AAEzC,SAAQ,qBAAG,IAAImC,IAAI;IAAC;IAAiB;IAAlB,OAA6B,qBAAGnC,MAAMoC,UAAU,CAAA,CAAA,CAAA;AACrE,CAAA,GAEapB,0BAA0B1E,QAAQ,SAAC0D,OAAAA;AAC9C,SAAOkC,0BAA0BlC,KAAAA,EAAOqC,QAAQ,SAACC,KAAAA;AAC/C,QAAMC,OAAOlG,SAASiG,GAAAA,GAChBE,QAAQtG,SAASqG,IAAAA;AACvB,WAAO;MAACC;MAAOF;MAAKG,OAAOR,OAAAA;EAC7B,CAAA;AACF,CAAA;",
|
5
|
+
"names": ["basename", "generate", "t", "findRoot", "memoize", "isPresent", "input", "isSimpleSpread", "node", "isIdentifier", "argument", "isMemberExpression", "attrStr", "attr", "type", "getNameAttr", "value", "ternaryStr", "objToStr", "obj", "spacer", "Object", "entries", "map", "k", "v", "Array", "isArray", "JSON", "stringify", "join", "isJSXSpreadAttribute", "name", "x", "conditional", "test", "object", "property", "code", "isFilledObj", "consequent", "alternate", "flat", "keys", "length", "findComponentName", "scope", "componentName", "cur", "path", "parentPath", "isProgram", "parent", "isExportNamedDeclaration", "declaration", "isVariableDeclaration", "declarations", "dec", "isVariableDeclarator", "id", "isFunctionDeclaration", "isValidThemeHook", "props", "jsxPath", "n", "sourcePath", "binding", "bindings", "getAllBindings", "init", "isCallExpression", "callee", "importNode", "getBinding", "isImportDeclaration", "isValidImport", "isInsideComponentPackage", "moduleName", "getValidComponentsPaths", "some", "startsWith", "isComponentPackage", "srcName", "getValidComponent", "toUpperCase", "allLoadedComponents", "loaded", "isInModule", "foundComponent", "nameToInfo", "isValidModule", "Error", "isLocal", "isValid", "getValidImport", "Boolean", "getValidComponentPackages", "Set", "components", "flatMap", "pkg", "root", "based", "filter"]
|
6
6
|
}
|
@@ -2,95 +2,168 @@ import * as t from "@babel/types";
|
|
2
2
|
import { createMediaStyle } from "@tamagui/core";
|
3
3
|
import { requireTamaguiCore } from "../helpers/requireTamaguiCore";
|
4
4
|
import { isPresent, isValidImport } from "./extractHelpers";
|
5
|
-
function
|
6
|
-
|
5
|
+
function _array_like_to_array(arr, len) {
|
6
|
+
(len == null || len > arr.length) && (len = arr.length);
|
7
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
8
|
+
arr2[i] = arr[i];
|
9
|
+
return arr2;
|
10
|
+
}
|
11
|
+
function _array_without_holes(arr) {
|
12
|
+
if (Array.isArray(arr))
|
13
|
+
return _array_like_to_array(arr);
|
14
|
+
}
|
15
|
+
function _define_property(obj, key, value) {
|
16
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
17
|
+
value,
|
18
|
+
enumerable: !0,
|
19
|
+
configurable: !0,
|
20
|
+
writable: !0
|
21
|
+
}) : obj[key] = value, obj;
|
22
|
+
}
|
23
|
+
function _iterable_to_array(iter) {
|
24
|
+
if (typeof Symbol < "u" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
25
|
+
return Array.from(iter);
|
26
|
+
}
|
27
|
+
function _non_iterable_spread() {
|
28
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
29
|
+
}
|
30
|
+
function _object_spread(target) {
|
31
|
+
for (var i = 1; i < arguments.length; i++) {
|
32
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
33
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
34
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
35
|
+
}))), ownKeys2.forEach(function(key) {
|
36
|
+
_define_property(target, key, source[key]);
|
37
|
+
});
|
38
|
+
}
|
39
|
+
return target;
|
40
|
+
}
|
41
|
+
function ownKeys(object, enumerableOnly) {
|
42
|
+
var keys = Object.keys(object);
|
43
|
+
if (Object.getOwnPropertySymbols) {
|
44
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
45
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
46
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
47
|
+
})), keys.push.apply(keys, symbols);
|
48
|
+
}
|
49
|
+
return keys;
|
50
|
+
}
|
51
|
+
function _object_spread_props(target, source) {
|
52
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
53
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
54
|
+
}), target;
|
55
|
+
}
|
56
|
+
function _to_consumable_array(arr) {
|
57
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
58
|
+
}
|
59
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
60
|
+
if (o) {
|
61
|
+
if (typeof o == "string")
|
62
|
+
return _array_like_to_array(o, minLen);
|
63
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
64
|
+
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set")
|
65
|
+
return Array.from(n);
|
66
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
67
|
+
return _array_like_to_array(o, minLen);
|
68
|
+
}
|
69
|
+
}
|
70
|
+
function extractMediaStyle(props, ternary, jsxPath, tamaguiConfig, sourcePath) {
|
71
|
+
var importance = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0, shouldPrintDebug = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : !1, _requireTamaguiCore = requireTamaguiCore("web"), getStylesAtomic = _requireTamaguiCore.getStylesAtomic, mediaObjectToString = _requireTamaguiCore.mediaObjectToString, mt = getMediaQueryTernary(props, ternary, jsxPath, sourcePath);
|
7
72
|
if (!mt)
|
8
73
|
return null;
|
9
|
-
|
10
|
-
if (!
|
11
|
-
return console.error(
|
12
|
-
|
74
|
+
var key = mt.key, mq = tamaguiConfig.media[key];
|
75
|
+
if (!mq)
|
76
|
+
return console.error('Media query "'.concat(key, '" not found: ').concat(Object.keys(tamaguiConfig.media))), null;
|
77
|
+
var getStyleObj = function(styleObj) {
|
78
|
+
var negate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
|
79
|
+
return styleObj ? {
|
80
|
+
styleObj,
|
81
|
+
negate
|
82
|
+
} : null;
|
83
|
+
}, styleOpts = [
|
13
84
|
getStyleObj(ternary.consequent, !1),
|
14
85
|
getStyleObj(ternary.alternate, !0)
|
15
86
|
].filter(isPresent);
|
16
87
|
if (shouldPrintDebug && !styleOpts.length)
|
17
88
|
return console.info(" media query, no styles?"), null;
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
" media styles:",
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
89
|
+
var mediaKeys = Object.keys(tamaguiConfig.media), mediaKeyPrecendence = mediaKeys.reduce(function(acc, cur, i) {
|
90
|
+
return acc[cur] = new Array(importance + 1).fill(":root").join(""), acc;
|
91
|
+
}, {}), mediaStyles = [], _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
92
|
+
try {
|
93
|
+
for (var _loop = function() {
|
94
|
+
var _step_value = _step.value, styleObj = _step_value.styleObj, negate = _step_value.negate, styles = getStylesAtomic(styleObj), singleMediaStyles = styles.map(function(style) {
|
95
|
+
var mediaStyle = createMediaStyle(style, key, tamaguiConfig.media, !0, negate), className = ".".concat(mediaStyle.identifier);
|
96
|
+
return _object_spread_props(_object_spread({}, mediaStyle), {
|
97
|
+
className
|
98
|
+
});
|
99
|
+
});
|
100
|
+
shouldPrintDebug === "verbose" && console.info(" media styles:", importance, styleObj, singleMediaStyles.map(function(x) {
|
101
|
+
return x.identifier;
|
102
|
+
}).join(", ")), mediaStyles = _to_consumable_array(mediaStyles).concat(_to_consumable_array(singleMediaStyles));
|
103
|
+
}, _iterator = styleOpts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0)
|
104
|
+
_loop();
|
105
|
+
} catch (err) {
|
106
|
+
_didIteratorError = !0, _iteratorError = err;
|
107
|
+
} finally {
|
108
|
+
try {
|
109
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
110
|
+
} finally {
|
111
|
+
if (_didIteratorError)
|
112
|
+
throw _iteratorError;
|
113
|
+
}
|
34
114
|
}
|
35
|
-
return ternary.remove(), {
|
115
|
+
return ternary.remove(), {
|
116
|
+
mediaStyles,
|
117
|
+
ternaryWithoutMedia: mt.ternaryWithoutMedia
|
118
|
+
};
|
36
119
|
}
|
37
120
|
function getMediaQueryTernary(props, ternary, jsxPath, sourcePath) {
|
38
121
|
if (t.isLogicalExpression(ternary.test) && ternary.test.operator === "&&") {
|
39
|
-
|
40
|
-
props,
|
41
|
-
ternary.test.left,
|
42
|
-
jsxPath,
|
43
|
-
sourcePath,
|
44
|
-
ternary.inlineMediaQuery
|
45
|
-
);
|
122
|
+
var mediaLeft = getMediaInfoFromExpression(props, ternary.test.left, jsxPath, sourcePath, ternary.inlineMediaQuery);
|
46
123
|
if (mediaLeft)
|
47
|
-
return {
|
48
|
-
|
49
|
-
ternaryWithoutMedia: {
|
50
|
-
...ternary,
|
124
|
+
return _object_spread_props(_object_spread({}, mediaLeft), {
|
125
|
+
ternaryWithoutMedia: _object_spread_props(_object_spread({}, ternary), {
|
51
126
|
test: ternary.test.right
|
52
|
-
}
|
53
|
-
};
|
127
|
+
})
|
128
|
+
});
|
54
129
|
}
|
55
|
-
|
56
|
-
|
57
|
-
ternary.test,
|
58
|
-
jsxPath,
|
59
|
-
sourcePath,
|
60
|
-
ternary.inlineMediaQuery
|
61
|
-
);
|
62
|
-
return result ? {
|
63
|
-
...result,
|
130
|
+
var result = getMediaInfoFromExpression(props, ternary.test, jsxPath, sourcePath, ternary.inlineMediaQuery);
|
131
|
+
return result ? _object_spread_props(_object_spread({}, result), {
|
64
132
|
ternaryWithoutMedia: null
|
65
|
-
} : null;
|
133
|
+
}) : null;
|
66
134
|
}
|
67
135
|
function getMediaInfoFromExpression(props, test, jsxPath, sourcePath, inlineMediaQuery) {
|
68
|
-
var _a, _b, _c;
|
69
136
|
if (inlineMediaQuery)
|
70
137
|
return {
|
71
138
|
key: inlineMediaQuery,
|
72
139
|
bindingName: inlineMediaQuery
|
73
140
|
};
|
74
141
|
if (t.isMemberExpression(test) && t.isIdentifier(test.object) && t.isIdentifier(test.property)) {
|
75
|
-
|
142
|
+
var _binding_path, name = test.object.name, key = test.property.name, bindings = jsxPath.scope.getAllBindings(), binding = bindings[name];
|
76
143
|
if (!binding)
|
77
144
|
return !1;
|
78
|
-
|
79
|
-
return !t.isVariableDeclarator(bindingNode) || !bindingNode.init || !isValidMediaCall(props, jsxPath, bindingNode.init, sourcePath) ? !1 : {
|
145
|
+
var bindingNode = (_binding_path = binding.path) === null || _binding_path === void 0 ? void 0 : _binding_path.node;
|
146
|
+
return !t.isVariableDeclarator(bindingNode) || !bindingNode.init || !isValidMediaCall(props, jsxPath, bindingNode.init, sourcePath) ? !1 : {
|
147
|
+
key,
|
148
|
+
bindingName: name
|
149
|
+
};
|
80
150
|
}
|
81
151
|
if (t.isIdentifier(test)) {
|
82
|
-
|
83
|
-
return !t.isVariableDeclarator(node) || !node.init || !isValidMediaCall(props, jsxPath, node.init, sourcePath) ? !1 : {
|
152
|
+
var _jsxPath_scope_getBinding_path, _jsxPath_scope_getBinding, key1 = test.name, node = (_jsxPath_scope_getBinding = jsxPath.scope.getBinding(test.name)) === null || _jsxPath_scope_getBinding === void 0 || (_jsxPath_scope_getBinding_path = _jsxPath_scope_getBinding.path) === null || _jsxPath_scope_getBinding_path === void 0 ? void 0 : _jsxPath_scope_getBinding_path.node;
|
153
|
+
return !t.isVariableDeclarator(node) || !node.init || !isValidMediaCall(props, jsxPath, node.init, sourcePath) ? !1 : {
|
154
|
+
key: key1,
|
155
|
+
bindingName: key1
|
156
|
+
};
|
84
157
|
}
|
85
158
|
return null;
|
86
159
|
}
|
87
160
|
function isValidMediaCall(props, jsxPath, init, sourcePath) {
|
88
161
|
if (!init || !t.isCallExpression(init) || !t.isIdentifier(init.callee) || init.callee.name !== "useMedia")
|
89
162
|
return !1;
|
90
|
-
|
163
|
+
var bindings = jsxPath.scope.getAllBindings(), mediaBinding = bindings.useMedia;
|
91
164
|
if (!mediaBinding)
|
92
165
|
return !1;
|
93
|
-
|
166
|
+
var useMediaImport = mediaBinding.path.parent;
|
94
167
|
return !(!t.isImportDeclaration(useMediaImport) || !isValidImport(props, sourcePath));
|
95
168
|
}
|
96
169
|
export {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
|
-
"sources": ["../../../src/extractor/extractMediaStyle.ts"],
|
4
|
-
"mappings": "AACA,
|
5
|
-
"names": []
|
3
|
+
"sources": ["../../../src/extractor/Users/n8/tamagui/packages/static/src/extractor/extractMediaStyle.ts"],
|
4
|
+
"mappings": "AACA,YAAYA,OAAO;AAEnB,SAASC,wBAAwB;AAGjC,SAASC,0BAA0B;AAEnC,SAASC,WAAWC,qBAAqB;;;;;;;;;;;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AAA,IACtD,KACF;MAAEO,KAAAA;MAAK6C,aAAa7C;IAAI;EACjC;AACA,SAAO;AACT;AAEO,SAAS4D,iBACdvE,OACAE,SACAoE,MACAlE,YAAkB;AAKlB,MAHI,CAACkE,QAAQ,CAAC5E,EAAE+E,iBAAiBH,IAAAA,KAC7B,CAAC5E,EAAEgE,aAAaY,KAAKI,MAAM,KAE3BJ,KAAKI,OAAOZ,SAAS;AAAY,WAAO;AAC5C,MAAMC,WAAW7D,QAAQ8D,MAAMC,eAAc,GACvCU,eAAeZ,SAAS;AAC9B,MAAI,CAACY;AAAc,WAAO;AAC1B,MAAMC,iBAAiBD,aAAaR,KAAKU;AAEzC,SADI,GAACnF,EAAEoF,oBAAoBF,cAAAA,KACvB,CAAC9E,cAAcE,OAAOI,UAAAA;AAI5B;",
|
5
|
+
"names": ["t", "createMediaStyle", "requireTamaguiCore", "isPresent", "isValidImport", "extractMediaStyle", "props", "ternary", "jsxPath", "tamaguiConfig", "sourcePath", "importance", "shouldPrintDebug", "getStylesAtomic", "mediaObjectToString", "mt", "getMediaQueryTernary", "key", "mq", "media", "console", "error", "Object", "keys", "getStyleObj", "styleObj", "negate", "styleOpts", "consequent", "alternate", "filter", "length", "info", "mediaKeys", "mediaKeyPrecendence", "reduce", "acc", "cur", "i", "Array", "fill", "join", "mediaStyles", "styles", "singleMediaStyles", "map", "style", "mediaStyle", "className", "identifier", "x", "remove", "ternaryWithoutMedia", "isLogicalExpression", "test", "operator", "mediaLeft", "getMediaInfoFromExpression", "left", "inlineMediaQuery", "right", "result", "bindingName", "isMemberExpression", "isIdentifier", "object", "property", "binding", "name", "bindings", "scope", "getAllBindings", "bindingNode", "path", "node", "isVariableDeclarator", "init", "isValidMediaCall", "getBinding", "isCallExpression", "callee", "mediaBinding", "useMediaImport", "parent", "isImportDeclaration"]
|
6
6
|
}
|