@tamagui/static 1.0.1-beta.71 → 1.0.1-beta.74
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/extractor/accessSafe.js +0 -2
- package/dist/cjs/extractor/accessSafe.js.map +1 -1
- package/dist/cjs/extractor/babelParse.js +0 -2
- package/dist/cjs/extractor/babelParse.js.map +1 -1
- package/dist/cjs/extractor/buildClassName.js +0 -2
- package/dist/cjs/extractor/buildClassName.js.map +1 -1
- package/dist/cjs/extractor/createEvaluator.js +2 -5
- package/dist/cjs/extractor/createEvaluator.js.map +1 -1
- package/dist/cjs/extractor/createExtractor.js +10 -21
- package/dist/cjs/extractor/createExtractor.js.map +1 -1
- package/dist/cjs/extractor/ensureImportingConcat.js +0 -2
- package/dist/cjs/extractor/ensureImportingConcat.js.map +1 -1
- package/dist/cjs/extractor/evaluateAstNode.js +0 -2
- package/dist/cjs/extractor/evaluateAstNode.js.map +1 -1
- package/dist/cjs/extractor/extractHelpers.js +11 -16
- package/dist/cjs/extractor/extractHelpers.js.map +1 -1
- package/dist/cjs/extractor/extractMediaStyle.js +2 -7
- package/dist/cjs/extractor/extractMediaStyle.js.map +1 -1
- package/dist/cjs/extractor/extractToClassNames.js +4 -7
- package/dist/cjs/extractor/extractToClassNames.js.map +1 -1
- package/dist/cjs/extractor/findTopmostFunction.js +1 -3
- package/dist/cjs/extractor/findTopmostFunction.js.map +1 -1
- package/dist/cjs/extractor/generatedUid.js +0 -2
- package/dist/cjs/extractor/generatedUid.js.map +1 -1
- package/dist/cjs/extractor/getPrefixLogs.js +0 -2
- package/dist/cjs/extractor/getPrefixLogs.js.map +1 -1
- package/dist/cjs/extractor/getPropValueFromAttributes.js +0 -2
- package/dist/cjs/extractor/getPropValueFromAttributes.js.map +1 -1
- package/dist/cjs/extractor/getSourceModule.js +0 -2
- package/dist/cjs/extractor/getSourceModule.js.map +1 -1
- package/dist/cjs/extractor/getStaticBindingsForScope.js +1 -5
- package/dist/cjs/extractor/getStaticBindingsForScope.js.map +1 -1
- package/dist/cjs/extractor/hoistClassNames.js +0 -3
- package/dist/cjs/extractor/hoistClassNames.js.map +1 -1
- package/dist/cjs/extractor/literalToAst.js +0 -4
- package/dist/cjs/extractor/literalToAst.js.map +1 -1
- package/dist/cjs/extractor/loadTamagui.js +0 -2
- package/dist/cjs/extractor/loadTamagui.js.map +1 -1
- package/dist/cjs/extractor/logLines.js +2 -3
- package/dist/cjs/extractor/logLines.js.map +1 -1
- package/dist/cjs/extractor/normalizeTernaries.js +0 -2
- package/dist/cjs/extractor/normalizeTernaries.js.map +1 -1
- package/dist/cjs/extractor/removeUnusedHooks.js +2 -4
- package/dist/cjs/extractor/removeUnusedHooks.js.map +1 -1
- package/dist/cjs/extractor/timer.js +2 -3
- package/dist/cjs/extractor/timer.js.map +1 -1
- package/dist/esm/extractor/accessSafe.js +0 -3
- package/dist/esm/extractor/accessSafe.js.map +1 -1
- package/dist/esm/extractor/babelParse.js +0 -3
- package/dist/esm/extractor/babelParse.js.map +1 -1
- package/dist/esm/extractor/buildClassName.js +0 -3
- package/dist/esm/extractor/buildClassName.js.map +1 -1
- package/dist/esm/extractor/createEvaluator.js +2 -6
- package/dist/esm/extractor/createEvaluator.js.map +1 -1
- package/dist/esm/extractor/createExtractor.js +10 -22
- package/dist/esm/extractor/createExtractor.js.map +1 -1
- package/dist/esm/extractor/ensureImportingConcat.js +0 -3
- package/dist/esm/extractor/ensureImportingConcat.js.map +1 -1
- package/dist/esm/extractor/evaluateAstNode.js +0 -3
- package/dist/esm/extractor/evaluateAstNode.js.map +1 -1
- package/dist/esm/extractor/extractHelpers.js +11 -17
- package/dist/esm/extractor/extractHelpers.js.map +1 -1
- package/dist/esm/extractor/extractMediaStyle.js +2 -8
- package/dist/esm/extractor/extractMediaStyle.js.map +1 -1
- package/dist/esm/extractor/extractToClassNames.js +4 -8
- package/dist/esm/extractor/extractToClassNames.js.map +1 -1
- package/dist/esm/extractor/findTopmostFunction.js +1 -4
- package/dist/esm/extractor/findTopmostFunction.js.map +1 -1
- package/dist/esm/extractor/generatedUid.js +0 -3
- package/dist/esm/extractor/generatedUid.js.map +1 -1
- package/dist/esm/extractor/getPrefixLogs.js +0 -3
- package/dist/esm/extractor/getPrefixLogs.js.map +1 -1
- package/dist/esm/extractor/getPropValueFromAttributes.js +0 -3
- package/dist/esm/extractor/getPropValueFromAttributes.js.map +1 -1
- package/dist/esm/extractor/getSourceModule.js +0 -3
- package/dist/esm/extractor/getSourceModule.js.map +1 -1
- package/dist/esm/extractor/getStaticBindingsForScope.js +1 -6
- package/dist/esm/extractor/getStaticBindingsForScope.js.map +1 -1
- package/dist/esm/extractor/hoistClassNames.js +0 -4
- package/dist/esm/extractor/hoistClassNames.js.map +1 -1
- package/dist/esm/extractor/literalToAst.js +0 -5
- package/dist/esm/extractor/literalToAst.js.map +1 -1
- package/dist/esm/extractor/loadTamagui.js +0 -3
- package/dist/esm/extractor/loadTamagui.js.map +1 -1
- package/dist/esm/extractor/logLines.js +2 -4
- package/dist/esm/extractor/logLines.js.map +1 -1
- package/dist/esm/extractor/normalizeTernaries.js +0 -3
- package/dist/esm/extractor/normalizeTernaries.js.map +1 -1
- package/dist/esm/extractor/removeUnusedHooks.js +2 -5
- package/dist/esm/extractor/removeUnusedHooks.js.map +1 -1
- package/dist/esm/extractor/timer.js +2 -4
- package/dist/esm/extractor/timer.js.map +1 -1
- package/dist/jsx/extractor/accessSafe.js +0 -3
- package/dist/jsx/extractor/babelParse.js +0 -3
- package/dist/jsx/extractor/buildClassName.js +0 -3
- package/dist/jsx/extractor/createEvaluator.js +2 -6
- package/dist/jsx/extractor/createExtractor.js +10 -22
- package/dist/jsx/extractor/ensureImportingConcat.js +0 -3
- package/dist/jsx/extractor/evaluateAstNode.js +0 -3
- package/dist/jsx/extractor/extractHelpers.js +11 -17
- package/dist/jsx/extractor/extractMediaStyle.js +2 -8
- package/dist/jsx/extractor/extractToClassNames.js +4 -8
- package/dist/jsx/extractor/findTopmostFunction.js +1 -4
- package/dist/jsx/extractor/generatedUid.js +0 -3
- package/dist/jsx/extractor/getPrefixLogs.js +0 -3
- package/dist/jsx/extractor/getPropValueFromAttributes.js +0 -3
- package/dist/jsx/extractor/getSourceModule.js +0 -3
- package/dist/jsx/extractor/getStaticBindingsForScope.js +1 -6
- package/dist/jsx/extractor/hoistClassNames.js +0 -4
- package/dist/jsx/extractor/literalToAst.js +0 -5
- package/dist/jsx/extractor/loadTamagui.js +0 -3
- package/dist/jsx/extractor/logLines.js +2 -4
- package/dist/jsx/extractor/normalizeTernaries.js +0 -3
- package/dist/jsx/extractor/removeUnusedHooks.js +2 -5
- package/dist/jsx/extractor/timer.js +2 -4
- package/package.json +9 -8
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import * as babelParser from "@babel/parser";
|
|
4
2
|
const plugins = [
|
|
5
3
|
"asyncGenerators",
|
|
@@ -23,7 +21,6 @@ const parser = babelParser.parse.bind(babelParser);
|
|
|
23
21
|
function babelParse(code) {
|
|
24
22
|
return parser(code.toString(), parserOptions);
|
|
25
23
|
}
|
|
26
|
-
__name(babelParse, "babelParse");
|
|
27
24
|
export {
|
|
28
25
|
babelParse,
|
|
29
26
|
parserOptions
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import * as t from "@babel/types";
|
|
4
2
|
function buildClassName(classNameObjects) {
|
|
5
3
|
return classNameObjects.reduce((acc, val) => {
|
|
@@ -33,7 +31,6 @@ function buildClassName(classNameObjects) {
|
|
|
33
31
|
return t.binaryExpression("+", acc, inner);
|
|
34
32
|
}, null);
|
|
35
33
|
}
|
|
36
|
-
__name(buildClassName, "buildClassName");
|
|
37
34
|
export {
|
|
38
35
|
buildClassName
|
|
39
36
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import vm from "vm";
|
|
4
2
|
import generate from "@babel/generator";
|
|
5
3
|
import * as t from "@babel/types";
|
|
@@ -15,7 +13,7 @@ function createEvaluator({
|
|
|
15
13
|
traversePath,
|
|
16
14
|
shouldPrintDebug
|
|
17
15
|
}) {
|
|
18
|
-
const evalFn =
|
|
16
|
+
const evalFn = (n) => {
|
|
19
17
|
if (t.isMemberExpression(n) && t.isIdentifier(n.property) && traversePath && isValidThemeHook(traversePath, n, sourcePath)) {
|
|
20
18
|
const key = n.property.name;
|
|
21
19
|
if (shouldPrintDebug) {
|
|
@@ -34,12 +32,11 @@ function createEvaluator({
|
|
|
34
32
|
console.log("evaluating", code);
|
|
35
33
|
}
|
|
36
34
|
return vm.runInContext(code, evalContext);
|
|
37
|
-
}
|
|
35
|
+
};
|
|
38
36
|
return (n) => {
|
|
39
37
|
return evaluateAstNode(n, evalFn);
|
|
40
38
|
};
|
|
41
39
|
}
|
|
42
|
-
__name(createEvaluator, "createEvaluator");
|
|
43
40
|
function createSafeEvaluator(attemptEval) {
|
|
44
41
|
return (n) => {
|
|
45
42
|
try {
|
|
@@ -49,7 +46,6 @@ function createSafeEvaluator(attemptEval) {
|
|
|
49
46
|
}
|
|
50
47
|
};
|
|
51
48
|
}
|
|
52
|
-
__name(createSafeEvaluator, "createSafeEvaluator");
|
|
53
49
|
export {
|
|
54
50
|
createEvaluator,
|
|
55
51
|
createSafeEvaluator
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import { relative } from "path";
|
|
4
2
|
import traverse from "@babel/traverse";
|
|
5
3
|
import * as t from "@babel/types";
|
|
@@ -42,12 +40,12 @@ const INLINE_EXTRACTABLE = {
|
|
|
42
40
|
onPressIn: "onMouseDown",
|
|
43
41
|
onPressOut: "onMouseUp"
|
|
44
42
|
};
|
|
45
|
-
const isAttr =
|
|
43
|
+
const isAttr = (x) => x.type === "attr";
|
|
46
44
|
const validHooks = {
|
|
47
45
|
useMedia: true,
|
|
48
46
|
useTheme: true
|
|
49
47
|
};
|
|
50
|
-
const createTernary =
|
|
48
|
+
const createTernary = (x) => x;
|
|
51
49
|
function createExtractor() {
|
|
52
50
|
if (!process.env.TAMAGUI_TARGET) {
|
|
53
51
|
console.log('\u26A0\uFE0F Please set process.env.TAMAGUI_TARGET to either "web" or "native"');
|
|
@@ -60,7 +58,6 @@ function createExtractor() {
|
|
|
60
58
|
var _a;
|
|
61
59
|
return !!(!!((_a = staticConfig.validStyles) == null ? void 0 : _a[name]) || !!pseudos[name] || loadedTamaguiConfig.shorthands[name] || (name[0] === "$" ? !!mediaQueryConfig[name.slice(1)] : false));
|
|
62
60
|
}
|
|
63
|
-
__name(isValidStyleKey, "isValidStyleKey");
|
|
64
61
|
return {
|
|
65
62
|
getTamagui() {
|
|
66
63
|
return loadedTamaguiConfig;
|
|
@@ -117,9 +114,9 @@ function createExtractor() {
|
|
|
117
114
|
}
|
|
118
115
|
});
|
|
119
116
|
const body = fileOrPath.type === "Program" ? fileOrPath.get("body") : fileOrPath.program.body;
|
|
120
|
-
const isInternalImport =
|
|
117
|
+
const isInternalImport = (importStr) => {
|
|
121
118
|
return isInsideTamagui(sourcePath) && importStr[0] === ".";
|
|
122
|
-
}
|
|
119
|
+
};
|
|
123
120
|
const validComponents = Object.keys(components).filter((key) => {
|
|
124
121
|
var _a;
|
|
125
122
|
return key[0].toUpperCase() === key[0] && !!((_a = components[key]) == null ? void 0 : _a.staticConfig);
|
|
@@ -172,9 +169,9 @@ function createExtractor() {
|
|
|
172
169
|
let couldntParse = false;
|
|
173
170
|
const modifiedComponents = /* @__PURE__ */ new Set();
|
|
174
171
|
const bindingCache = {};
|
|
175
|
-
const callTraverse =
|
|
172
|
+
const callTraverse = (a) => {
|
|
176
173
|
return fileOrPath.type === "File" ? traverse(fileOrPath, a) : fileOrPath.traverse(a);
|
|
177
|
-
}
|
|
174
|
+
};
|
|
178
175
|
let programPath;
|
|
179
176
|
const res = {
|
|
180
177
|
styled: 0,
|
|
@@ -405,9 +402,9 @@ function createExtractor() {
|
|
|
405
402
|
return [attribute.value, path.get("value")];
|
|
406
403
|
}
|
|
407
404
|
})();
|
|
408
|
-
const remove =
|
|
405
|
+
const remove = () => {
|
|
409
406
|
Array.isArray(valuePath) ? valuePath.map((p) => p.remove()) : valuePath.remove();
|
|
410
|
-
}
|
|
407
|
+
};
|
|
411
408
|
if (name === "ref") {
|
|
412
409
|
if (shouldPrintDebug) {
|
|
413
410
|
console.log(" ! inlining, ref", name);
|
|
@@ -579,7 +576,6 @@ function createExtractor() {
|
|
|
579
576
|
}
|
|
580
577
|
return null;
|
|
581
578
|
}
|
|
582
|
-
__name(addBinaryConditional, "addBinaryConditional");
|
|
583
579
|
function getStaticConditional(value2) {
|
|
584
580
|
if (t.isConditionalExpression(value2)) {
|
|
585
581
|
try {
|
|
@@ -603,7 +599,6 @@ function createExtractor() {
|
|
|
603
599
|
}
|
|
604
600
|
return null;
|
|
605
601
|
}
|
|
606
|
-
__name(getStaticConditional, "getStaticConditional");
|
|
607
602
|
function getStaticLogical(value2) {
|
|
608
603
|
if (t.isLogicalExpression(value2)) {
|
|
609
604
|
if (value2.operator === "&&") {
|
|
@@ -627,7 +622,6 @@ function createExtractor() {
|
|
|
627
622
|
}
|
|
628
623
|
return null;
|
|
629
624
|
}
|
|
630
|
-
__name(getStaticLogical, "getStaticLogical");
|
|
631
625
|
}, isExtractable = function(obj) {
|
|
632
626
|
return t.isObjectExpression(obj) && obj.properties.every((prop) => {
|
|
633
627
|
if (!t.isObjectProperty(prop)) {
|
|
@@ -738,11 +732,6 @@ function createExtractor() {
|
|
|
738
732
|
}
|
|
739
733
|
}
|
|
740
734
|
};
|
|
741
|
-
__name(evaluateAttribute, "evaluateAttribute");
|
|
742
|
-
__name(isExtractable, "isExtractable");
|
|
743
|
-
__name(createTernariesFromObjectProperties, "createTernariesFromObjectProperties");
|
|
744
|
-
__name(mergeStyles, "mergeStyles");
|
|
745
|
-
__name(omitInvalidStyles, "omitInvalidStyles");
|
|
746
735
|
node.attributes.find((n) => t.isJSXAttribute(n) && t.isJSXIdentifier(n.name) && n.name.name === "debug" && n.value === null);
|
|
747
736
|
if (shouldPrintDebug) {
|
|
748
737
|
console.log("\n");
|
|
@@ -1158,7 +1147,7 @@ function createExtractor() {
|
|
|
1158
1147
|
console.log(" - foundStaticProps: \n", logLines(objToStr(foundStaticProps)));
|
|
1159
1148
|
console.log(" - completeProps: \n", logLines(objToStr(completeProps)));
|
|
1160
1149
|
}
|
|
1161
|
-
const getStyles =
|
|
1150
|
+
const getStyles = (props2, debugName = "") => {
|
|
1162
1151
|
if (!props2 || !Object.keys(props2).length) {
|
|
1163
1152
|
if (shouldPrintDebug)
|
|
1164
1153
|
console.log(" getStyles() no props");
|
|
@@ -1187,7 +1176,7 @@ function createExtractor() {
|
|
|
1187
1176
|
console.log("error", err.message, err.stack);
|
|
1188
1177
|
return {};
|
|
1189
1178
|
}
|
|
1190
|
-
}
|
|
1179
|
+
};
|
|
1191
1180
|
const completeStyles = getStyles(completeProps, "completeStyles");
|
|
1192
1181
|
if (!completeStyles) {
|
|
1193
1182
|
throw new Error(`Impossible, no styles`);
|
|
@@ -1343,7 +1332,6 @@ function createExtractor() {
|
|
|
1343
1332
|
}
|
|
1344
1333
|
};
|
|
1345
1334
|
}
|
|
1346
|
-
__name(createExtractor, "createExtractor");
|
|
1347
1335
|
export {
|
|
1348
1336
|
createExtractor
|
|
1349
1337
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import * as t from "@babel/types";
|
|
4
2
|
import { CONCAT_CLASSNAME_IMPORT } from "../constants";
|
|
5
3
|
const importConcatPkg = "@tamagui/helpers";
|
|
@@ -17,7 +15,6 @@ function ensureImportingConcat(path) {
|
|
|
17
15
|
specifiers.push(t.importSpecifier(t.identifier(CONCAT_CLASSNAME_IMPORT), t.identifier(CONCAT_CLASSNAME_IMPORT)));
|
|
18
16
|
}
|
|
19
17
|
}
|
|
20
|
-
__name(ensureImportingConcat, "ensureImportingConcat");
|
|
21
18
|
export {
|
|
22
19
|
ensureImportingConcat
|
|
23
20
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import * as t from "@babel/types";
|
|
4
2
|
function evaluateAstNode(exprNode, evalFn, shouldPrintDebug) {
|
|
5
3
|
if (exprNode === void 0) {
|
|
@@ -87,7 +85,6 @@ function evaluateAstNode(exprNode, evalFn, shouldPrintDebug) {
|
|
|
87
85
|
}
|
|
88
86
|
return evalFn(exprNode);
|
|
89
87
|
}
|
|
90
|
-
__name(evaluateAstNode, "evaluateAstNode");
|
|
91
88
|
export {
|
|
92
89
|
evaluateAstNode
|
|
93
90
|
};
|
|
@@ -1,31 +1,27 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import generate from "@babel/generator";
|
|
4
2
|
import * as t from "@babel/types";
|
|
5
3
|
function isPresent(input) {
|
|
6
4
|
return input != null;
|
|
7
5
|
}
|
|
8
|
-
__name(isPresent, "isPresent");
|
|
9
6
|
function isSimpleSpread(node) {
|
|
10
7
|
return t.isIdentifier(node.argument) || t.isMemberExpression(node.argument);
|
|
11
8
|
}
|
|
12
|
-
|
|
13
|
-
const attrStr = /* @__PURE__ */ __name((attr) => {
|
|
9
|
+
const attrStr = (attr) => {
|
|
14
10
|
return !attr ? "" : attr.type === "attr" ? getNameAttr(attr.value) : attr.type === "ternary" ? `...${ternaryStr(attr.value)}` : `${attr.type}(${objToStr(attr.value)})`;
|
|
15
|
-
}
|
|
16
|
-
const objToStr =
|
|
11
|
+
};
|
|
12
|
+
const objToStr = (obj, spacer = ", ") => {
|
|
17
13
|
if (!obj) {
|
|
18
14
|
return `${obj}`;
|
|
19
15
|
}
|
|
20
16
|
return `{${Object.entries(obj).map(([k, v]) => `${k}:${Array.isArray(v) ? `[...]` : v && typeof v === "object" ? `${objToStr(v, ",")}` : JSON.stringify(v)}`).join(spacer)}}`;
|
|
21
|
-
}
|
|
22
|
-
const getNameAttr =
|
|
17
|
+
};
|
|
18
|
+
const getNameAttr = (attr) => {
|
|
23
19
|
if (t.isJSXSpreadAttribute(attr)) {
|
|
24
20
|
return `...${attr.argument["name"]}`;
|
|
25
21
|
}
|
|
26
22
|
return "name" in attr ? attr.name.name : `unknown-${attr["type"]}`;
|
|
27
|
-
}
|
|
28
|
-
const ternaryStr =
|
|
23
|
+
};
|
|
24
|
+
const ternaryStr = (x) => {
|
|
29
25
|
const conditional = t.isIdentifier(x.test) ? x.test.name : t.isMemberExpression(x.test) ? [x.test.object["name"], x.test.property["name"]] : generate(x.test).code;
|
|
30
26
|
return [
|
|
31
27
|
"ternary(",
|
|
@@ -34,8 +30,8 @@ const ternaryStr = /* @__PURE__ */ __name((x) => {
|
|
|
34
30
|
isFilledObj(x.alternate) ? ` : ${objToStr(x.alternate)}` : " : \u{1F6AB}",
|
|
35
31
|
")"
|
|
36
32
|
].flat().join("");
|
|
37
|
-
}
|
|
38
|
-
const isFilledObj =
|
|
33
|
+
};
|
|
34
|
+
const isFilledObj = (obj) => obj && Object.keys(obj).length;
|
|
39
35
|
function findComponentName(scope) {
|
|
40
36
|
var _a;
|
|
41
37
|
let componentName = "";
|
|
@@ -58,7 +54,6 @@ function findComponentName(scope) {
|
|
|
58
54
|
}
|
|
59
55
|
return componentName;
|
|
60
56
|
}
|
|
61
|
-
__name(findComponentName, "findComponentName");
|
|
62
57
|
function isValidThemeHook(jsxPath, n, sourcePath) {
|
|
63
58
|
var _a;
|
|
64
59
|
if (!t.isIdentifier(n.object) || !t.isIdentifier(n.property))
|
|
@@ -86,10 +81,9 @@ function isValidThemeHook(jsxPath, n, sourcePath) {
|
|
|
86
81
|
}
|
|
87
82
|
return true;
|
|
88
83
|
}
|
|
89
|
-
|
|
90
|
-
const isInsideTamagui = /* @__PURE__ */ __name((srcName) => {
|
|
84
|
+
const isInsideTamagui = (srcName) => {
|
|
91
85
|
return srcName.includes("/dist/jsx") || srcName.includes("/core/src");
|
|
92
|
-
}
|
|
86
|
+
};
|
|
93
87
|
export {
|
|
94
88
|
attrStr,
|
|
95
89
|
findComponentName,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import * as t from "@babel/types";
|
|
4
2
|
import { getStylesAtomic, mediaObjectToString } from "@tamagui/core-node";
|
|
5
3
|
import { MEDIA_SEP } from "../constants";
|
|
@@ -15,9 +13,9 @@ function extractMediaStyle(ternary, jsxPath, tamaguiConfig, sourcePath, importan
|
|
|
15
13
|
console.error(`Media query "${key}" not found: ${Object.keys(tamaguiConfig.media)}`);
|
|
16
14
|
return null;
|
|
17
15
|
}
|
|
18
|
-
const getStyleObj =
|
|
16
|
+
const getStyleObj = (styleObj, negate = false) => {
|
|
19
17
|
return styleObj ? { styleObj, negate } : null;
|
|
20
|
-
}
|
|
18
|
+
};
|
|
21
19
|
const styleOpts = [
|
|
22
20
|
getStyleObj(ternary.consequent, false),
|
|
23
21
|
getStyleObj(ternary.alternate, true)
|
|
@@ -65,7 +63,6 @@ function extractMediaStyle(ternary, jsxPath, tamaguiConfig, sourcePath, importan
|
|
|
65
63
|
ternary.remove();
|
|
66
64
|
return { mediaStyles, ternaryWithoutMedia: mt.ternaryWithoutMedia };
|
|
67
65
|
}
|
|
68
|
-
__name(extractMediaStyle, "extractMediaStyle");
|
|
69
66
|
function getMediaQueryTernary(ternary, jsxPath, sourcePath) {
|
|
70
67
|
if (t.isLogicalExpression(ternary.test) && ternary.test.operator === "&&") {
|
|
71
68
|
const mediaLeft = getMediaInfoFromExpression(ternary.test.left, jsxPath, sourcePath, ternary.inlineMediaQuery);
|
|
@@ -88,7 +85,6 @@ function getMediaQueryTernary(ternary, jsxPath, sourcePath) {
|
|
|
88
85
|
}
|
|
89
86
|
return null;
|
|
90
87
|
}
|
|
91
|
-
__name(getMediaQueryTernary, "getMediaQueryTernary");
|
|
92
88
|
function getMediaInfoFromExpression(test, jsxPath, sourcePath, inlineMediaQuery) {
|
|
93
89
|
var _a, _b, _c;
|
|
94
90
|
if (inlineMediaQuery) {
|
|
@@ -122,7 +118,6 @@ function getMediaInfoFromExpression(test, jsxPath, sourcePath, inlineMediaQuery)
|
|
|
122
118
|
}
|
|
123
119
|
return null;
|
|
124
120
|
}
|
|
125
|
-
__name(getMediaInfoFromExpression, "getMediaInfoFromExpression");
|
|
126
121
|
function isValidMediaCall(jsxPath, init, sourcePath) {
|
|
127
122
|
if (!t.isCallExpression(init))
|
|
128
123
|
return false;
|
|
@@ -144,7 +139,6 @@ function isValidMediaCall(jsxPath, init, sourcePath) {
|
|
|
144
139
|
}
|
|
145
140
|
return true;
|
|
146
141
|
}
|
|
147
|
-
__name(isValidMediaCall, "isValidMediaCall");
|
|
148
142
|
export {
|
|
149
143
|
extractMediaStyle,
|
|
150
144
|
isValidMediaCall
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import * as path from "path";
|
|
4
2
|
import { basename } from "path";
|
|
5
3
|
import * as util from "util";
|
|
@@ -90,7 +88,7 @@ function extractToClassNames({
|
|
|
90
88
|
};
|
|
91
89
|
}
|
|
92
90
|
}
|
|
93
|
-
const ensureNeededPrevStyle =
|
|
91
|
+
const ensureNeededPrevStyle = (style) => {
|
|
94
92
|
var _a3;
|
|
95
93
|
const keys = Object.keys(style);
|
|
96
94
|
if (!keys.some((key) => mergeStyleGroups[key])) {
|
|
@@ -102,8 +100,8 @@ function extractToClassNames({
|
|
|
102
100
|
}
|
|
103
101
|
}
|
|
104
102
|
return style;
|
|
105
|
-
}
|
|
106
|
-
const addStyles =
|
|
103
|
+
};
|
|
104
|
+
const addStyles = (style) => {
|
|
107
105
|
if (!style)
|
|
108
106
|
return [];
|
|
109
107
|
const styleWithPrev = ensureNeededPrevStyle(style);
|
|
@@ -112,7 +110,7 @@ function extractToClassNames({
|
|
|
112
110
|
finalStyles = [...finalStyles, ...res2];
|
|
113
111
|
}
|
|
114
112
|
return res2;
|
|
115
|
-
}
|
|
113
|
+
};
|
|
116
114
|
let lastMediaImportance = 1;
|
|
117
115
|
for (const attr of attrs) {
|
|
118
116
|
switch (attr.type) {
|
|
@@ -192,7 +190,6 @@ function extractToClassNames({
|
|
|
192
190
|
finalClassNames.push(t.conditionalExpression(ternary.test, t.stringLiteral(" " + cCN), t.stringLiteral(" " + aCN)));
|
|
193
191
|
}
|
|
194
192
|
}
|
|
195
|
-
__name(addTernaryStyle, "addTernaryStyle");
|
|
196
193
|
if (shouldPrintDebug) {
|
|
197
194
|
console.log(" finalClassNames\n", logLines(finalClassNames.map((x) => x["value"]).join(" ")));
|
|
198
195
|
}
|
|
@@ -279,7 +276,6 @@ function extractToClassNames({
|
|
|
279
276
|
map: result.map
|
|
280
277
|
};
|
|
281
278
|
}
|
|
282
|
-
__name(extractToClassNames, "extractToClassNames");
|
|
283
279
|
export {
|
|
284
280
|
extractToClassNames
|
|
285
281
|
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
function findTopmostFunction(jsxPath) {
|
|
4
|
-
const isFunction =
|
|
2
|
+
const isFunction = (path) => path.isArrowFunctionExpression() || path.isFunctionDeclaration() || path.isFunctionExpression();
|
|
5
3
|
let compFn = jsxPath.findParent(isFunction);
|
|
6
4
|
while (compFn) {
|
|
7
5
|
const parent = compFn.findParent(isFunction);
|
|
@@ -16,7 +14,6 @@ function findTopmostFunction(jsxPath) {
|
|
|
16
14
|
}
|
|
17
15
|
return compFn;
|
|
18
16
|
}
|
|
19
|
-
__name(findTopmostFunction, "findTopmostFunction");
|
|
20
17
|
export {
|
|
21
18
|
findTopmostFunction
|
|
22
19
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import * as t from "@babel/types";
|
|
4
2
|
import invariant from "invariant";
|
|
5
3
|
function generateUid(scope, name) {
|
|
@@ -21,7 +19,6 @@ function generateUid(scope, name) {
|
|
|
21
19
|
program.uids[uid] = true;
|
|
22
20
|
return uid;
|
|
23
21
|
}
|
|
24
|
-
__name(generateUid, "generateUid");
|
|
25
22
|
export {
|
|
26
23
|
generateUid
|
|
27
24
|
};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
function getPrefixLogs(options) {
|
|
4
2
|
var _a;
|
|
5
3
|
const { TAMAGUI_TARGET } = process.env;
|
|
6
4
|
return (_a = options == null ? void 0 : options.prefixLogs) != null ? _a : ` ${TAMAGUI_TARGET} | `;
|
|
7
5
|
}
|
|
8
|
-
__name(getPrefixLogs, "getPrefixLogs");
|
|
9
6
|
export {
|
|
10
7
|
getPrefixLogs
|
|
11
8
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import generate from "@babel/generator";
|
|
4
2
|
import * as t from "@babel/types";
|
|
5
3
|
import { accessSafe } from "./accessSafe";
|
|
@@ -42,7 +40,6 @@ function getPropValueFromAttributes(propName, attrs) {
|
|
|
42
40
|
}
|
|
43
41
|
return propValue;
|
|
44
42
|
}
|
|
45
|
-
__name(getPropValueFromAttributes, "getPropValueFromAttributes");
|
|
46
43
|
export {
|
|
47
44
|
getPropValueFromAttributes
|
|
48
45
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import * as t from "@babel/types";
|
|
4
2
|
function getSourceModule(itemName, itemBinding) {
|
|
5
3
|
if (!itemBinding.constant) {
|
|
@@ -62,7 +60,6 @@ function getSourceModule(itemName, itemBinding) {
|
|
|
62
60
|
usesImportSyntax
|
|
63
61
|
};
|
|
64
62
|
}
|
|
65
|
-
__name(getSourceModule, "getSourceModule");
|
|
66
63
|
export {
|
|
67
64
|
getSourceModule
|
|
68
65
|
};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import { dirname, extname, resolve } from "path";
|
|
4
2
|
import * as t from "@babel/types";
|
|
5
3
|
import { existsSync } from "fs-extra";
|
|
6
4
|
import { evaluateAstNode } from "./evaluateAstNode";
|
|
7
5
|
import { getSourceModule } from "./getSourceModule";
|
|
8
|
-
const isLocalImport =
|
|
6
|
+
const isLocalImport = (path) => path.startsWith(".") || path.startsWith("/");
|
|
9
7
|
function resolveImportPath(sourcePath, path) {
|
|
10
8
|
const sourceDir = dirname(sourcePath);
|
|
11
9
|
if (isLocalImport(path)) {
|
|
@@ -16,7 +14,6 @@ function resolveImportPath(sourcePath, path) {
|
|
|
16
14
|
}
|
|
17
15
|
return path;
|
|
18
16
|
}
|
|
19
|
-
__name(resolveImportPath, "resolveImportPath");
|
|
20
17
|
function importModule(path) {
|
|
21
18
|
const filenames = [path.replace(".js", ".tsx"), path.replace(".js", ".ts"), path];
|
|
22
19
|
for (const file of filenames) {
|
|
@@ -35,7 +32,6 @@ function importModule(path) {
|
|
|
35
32
|
}
|
|
36
33
|
return null;
|
|
37
34
|
}
|
|
38
|
-
__name(importModule, "importModule");
|
|
39
35
|
function getStaticBindingsForScope(scope, whitelist = [], sourcePath, bindingCache, shouldPrintDebug) {
|
|
40
36
|
const bindings = scope.getAllBindings();
|
|
41
37
|
const ret = {};
|
|
@@ -130,7 +126,6 @@ function getStaticBindingsForScope(scope, whitelist = [], sourcePath, bindingCac
|
|
|
130
126
|
}
|
|
131
127
|
return ret;
|
|
132
128
|
}
|
|
133
|
-
__name(getStaticBindingsForScope, "getStaticBindingsForScope");
|
|
134
129
|
export {
|
|
135
130
|
getStaticBindingsForScope
|
|
136
131
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import * as t from "@babel/types";
|
|
4
2
|
function hoistClassNames(path, existing, expr) {
|
|
5
3
|
const hoist = hoistClassNames.bind(null, path, existing);
|
|
@@ -35,9 +33,7 @@ function hoistClassNames(path, existing, expr) {
|
|
|
35
33
|
parent.unshiftContainer("body", variable);
|
|
36
34
|
return uid;
|
|
37
35
|
}
|
|
38
|
-
__name(replaceStringWithVariable, "replaceStringWithVariable");
|
|
39
36
|
}
|
|
40
|
-
__name(hoistClassNames, "hoistClassNames");
|
|
41
37
|
export {
|
|
42
38
|
hoistClassNames
|
|
43
39
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import * as t from "@babel/types";
|
|
4
2
|
function literalToAst(literal) {
|
|
5
3
|
if (literal === null) {
|
|
@@ -27,7 +25,6 @@ function literalToAst(literal) {
|
|
|
27
25
|
}));
|
|
28
26
|
}
|
|
29
27
|
}
|
|
30
|
-
__name(literalToAst, "literalToAst");
|
|
31
28
|
const easyPeasies = ["BooleanLiteral", "StringLiteral", "NumericLiteral"];
|
|
32
29
|
function astToLiteral(node) {
|
|
33
30
|
if (!node) {
|
|
@@ -52,7 +49,6 @@ function astToLiteral(node) {
|
|
|
52
49
|
], []);
|
|
53
50
|
}
|
|
54
51
|
}
|
|
55
|
-
__name(astToLiteral, "astToLiteral");
|
|
56
52
|
function computeProps(props) {
|
|
57
53
|
return props.reduce((acc, prop) => {
|
|
58
54
|
if (prop.type === "SpreadElement") {
|
|
@@ -72,7 +68,6 @@ function computeProps(props) {
|
|
|
72
68
|
return acc;
|
|
73
69
|
}, {});
|
|
74
70
|
}
|
|
75
|
-
__name(computeProps, "computeProps");
|
|
76
71
|
export {
|
|
77
72
|
astToLiteral,
|
|
78
73
|
literalToAst
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import { join } from "path";
|
|
4
2
|
import { createTamagui } from "@tamagui/core-node";
|
|
5
3
|
let loadedTamagui = null;
|
|
@@ -76,7 +74,6 @@ function loadTamagui(props) {
|
|
|
76
74
|
unregister();
|
|
77
75
|
}
|
|
78
76
|
}
|
|
79
|
-
__name(loadTamagui, "loadTamagui");
|
|
80
77
|
export {
|
|
81
78
|
loadTamagui
|
|
82
79
|
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
const prefix = " ";
|
|
4
|
-
const logLines =
|
|
2
|
+
const logLines = (str, singleLine = false) => {
|
|
5
3
|
if (singleLine) {
|
|
6
4
|
return prefix + str.split(" ").join(`
|
|
7
5
|
${prefix}`);
|
|
@@ -15,7 +13,7 @@ ${prefix}`);
|
|
|
15
13
|
lines[lines.length - 1] += item + " ";
|
|
16
14
|
}
|
|
17
15
|
return lines.map((line, i) => prefix + (i == 0 ? "" : " ") + line.trim()).join("\n");
|
|
18
|
-
}
|
|
16
|
+
};
|
|
19
17
|
export {
|
|
20
18
|
logLines
|
|
21
19
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import generate from "@babel/generator";
|
|
4
2
|
import * as t from "@babel/types";
|
|
5
3
|
import invariant from "invariant";
|
|
@@ -46,7 +44,6 @@ function normalizeTernaries(ternaries) {
|
|
|
46
44
|
});
|
|
47
45
|
return ternaryExpression;
|
|
48
46
|
}
|
|
49
|
-
__name(normalizeTernaries, "normalizeTernaries");
|
|
50
47
|
export {
|
|
51
48
|
normalizeTernaries
|
|
52
49
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import * as t from "@babel/types";
|
|
4
2
|
const hooks = {
|
|
5
3
|
useMedia: true,
|
|
@@ -32,10 +30,10 @@ function removeUnusedHooks(compFn, shouldPrintDebug) {
|
|
|
32
30
|
if (!Array.isArray(declarations)) {
|
|
33
31
|
continue;
|
|
34
32
|
}
|
|
35
|
-
const isBindingReferenced =
|
|
33
|
+
const isBindingReferenced = (name) => {
|
|
36
34
|
var _a2;
|
|
37
35
|
return !!((_a2 = statement.scope.getBinding(name)) == null ? void 0 : _a2.referenced);
|
|
38
|
-
}
|
|
36
|
+
};
|
|
39
37
|
for (const declarator of declarations) {
|
|
40
38
|
const id = declarator.get("id");
|
|
41
39
|
const init = declarator.node.init;
|
|
@@ -73,7 +71,6 @@ function removeUnusedHooks(compFn, shouldPrintDebug) {
|
|
|
73
71
|
}
|
|
74
72
|
}
|
|
75
73
|
}
|
|
76
|
-
__name(removeUnusedHooks, "removeUnusedHooks");
|
|
77
74
|
export {
|
|
78
75
|
removeUnusedHooks
|
|
79
76
|
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
const timer = /* @__PURE__ */ __name(() => {
|
|
1
|
+
const timer = () => {
|
|
4
2
|
const start = Date.now();
|
|
5
3
|
let last = start;
|
|
6
4
|
return {
|
|
@@ -17,7 +15,7 @@ const timer = /* @__PURE__ */ __name(() => {
|
|
|
17
15
|
}
|
|
18
16
|
}
|
|
19
17
|
};
|
|
20
|
-
}
|
|
18
|
+
};
|
|
21
19
|
export {
|
|
22
20
|
timer
|
|
23
21
|
};
|