@tamagui/static 1.0.0-alpha.8 → 1.0.0-beta.179
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/README.md +3 -19
- package/dist/cjs/constants.js +36 -0
- package/dist/cjs/constants.js.map +7 -0
- package/dist/cjs/extractor/accessSafe.js +32 -0
- package/dist/cjs/extractor/accessSafe.js.map +7 -0
- package/dist/cjs/extractor/babelParse.js +51 -0
- package/dist/cjs/extractor/babelParse.js.map +7 -0
- package/dist/cjs/extractor/buildClassName.js +61 -0
- package/dist/cjs/extractor/buildClassName.js.map +7 -0
- package/dist/cjs/extractor/createEvaluator.js +73 -0
- package/dist/cjs/extractor/createEvaluator.js.map +7 -0
- package/dist/cjs/extractor/createExtractor.js +1091 -0
- package/dist/cjs/extractor/createExtractor.js.map +7 -0
- package/dist/cjs/extractor/ensureImportingConcat.js +45 -0
- package/dist/cjs/extractor/ensureImportingConcat.js.map +7 -0
- package/dist/cjs/extractor/evaluateAstNode.js +115 -0
- package/dist/cjs/extractor/evaluateAstNode.js.map +7 -0
- package/dist/cjs/extractor/extractHelpers.js +124 -0
- package/dist/cjs/extractor/extractHelpers.js.map +7 -0
- package/dist/cjs/extractor/extractMediaStyle.js +186 -0
- package/dist/cjs/extractor/extractMediaStyle.js.map +7 -0
- package/dist/cjs/extractor/extractToClassNames.js +324 -0
- package/dist/cjs/extractor/extractToClassNames.js.map +7 -0
- package/dist/cjs/extractor/findTopmostFunction.js +41 -0
- package/dist/cjs/extractor/findTopmostFunction.js.map +7 -0
- package/dist/cjs/extractor/generatedUid.js +49 -0
- package/dist/cjs/extractor/generatedUid.js.map +7 -0
- package/dist/cjs/extractor/getPrefixLogs.js +29 -0
- package/dist/cjs/extractor/getPrefixLogs.js.map +7 -0
- package/dist/cjs/extractor/getPropValueFromAttributes.js +70 -0
- package/dist/cjs/extractor/getPropValueFromAttributes.js.map +7 -0
- package/dist/cjs/extractor/getSourceModule.js +90 -0
- package/dist/cjs/extractor/getSourceModule.js.map +7 -0
- package/dist/cjs/extractor/getStaticBindingsForScope.js +149 -0
- package/dist/cjs/extractor/getStaticBindingsForScope.js.map +7 -0
- package/dist/cjs/extractor/hoistClassNames.js +65 -0
- package/dist/cjs/extractor/hoistClassNames.js.map +7 -0
- package/dist/cjs/extractor/literalToAst.js +114 -0
- package/dist/cjs/extractor/literalToAst.js.map +7 -0
- package/dist/cjs/extractor/loadTamagui.js +83 -0
- package/dist/cjs/extractor/loadTamagui.js.map +7 -0
- package/dist/cjs/extractor/logLines.js +40 -0
- package/dist/cjs/extractor/logLines.js.map +7 -0
- package/dist/cjs/extractor/normalizeTernaries.js +101 -0
- package/dist/cjs/extractor/normalizeTernaries.js.map +7 -0
- package/dist/cjs/extractor/removeUnusedHooks.js +100 -0
- package/dist/cjs/extractor/removeUnusedHooks.js.map +7 -0
- package/dist/cjs/extractor/validHTMLAttributes.js +71 -0
- package/dist/cjs/extractor/validHTMLAttributes.js.map +7 -0
- package/dist/cjs/index.js +34 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/patchReactNativeWeb.js +151 -0
- package/dist/cjs/patchReactNativeWeb.js.map +7 -0
- package/dist/cjs/types.js +16 -0
- package/dist/cjs/types.js.map +7 -0
- package/dist/{constants.js → esm/constants.js} +4 -0
- package/dist/{constants.js.map → esm/constants.js.map} +3 -3
- package/dist/{extractor → esm/extractor}/accessSafe.js +0 -0
- package/dist/{extractor → esm/extractor}/accessSafe.js.map +2 -2
- package/dist/{extractor → esm/extractor}/babelParse.js +0 -0
- package/dist/{extractor → esm/extractor}/babelParse.js.map +2 -2
- package/dist/{extractor → esm/extractor}/buildClassName.js +0 -0
- package/dist/{extractor → esm/extractor}/buildClassName.js.map +2 -2
- package/dist/{extractor → esm/extractor}/createEvaluator.js +3 -2
- package/dist/esm/extractor/createEvaluator.js.map +7 -0
- package/dist/{extractor → esm/extractor}/createExtractor.js +411 -196
- package/dist/esm/extractor/createExtractor.js.map +7 -0
- package/dist/{extractor → esm/extractor}/ensureImportingConcat.js +1 -1
- package/dist/esm/extractor/ensureImportingConcat.js.map +7 -0
- package/dist/{extractor → esm/extractor}/evaluateAstNode.js +0 -0
- package/dist/esm/extractor/evaluateAstNode.js.map +7 -0
- package/dist/{extractor → esm/extractor}/extractHelpers.js +20 -11
- package/dist/esm/extractor/extractHelpers.js.map +7 -0
- package/dist/{extractor → esm/extractor}/extractMediaStyle.js +3 -2
- package/dist/esm/extractor/extractMediaStyle.js.map +7 -0
- package/dist/{extractor → esm/extractor}/extractToClassNames.js +100 -47
- package/dist/esm/extractor/extractToClassNames.js.map +7 -0
- package/dist/{extractor → esm/extractor}/findTopmostFunction.js +0 -0
- package/dist/{extractor → esm/extractor}/findTopmostFunction.js.map +2 -2
- package/dist/{extractor → esm/extractor}/generatedUid.js +0 -0
- package/dist/{extractor → esm/extractor}/generatedUid.js.map +2 -2
- package/dist/esm/extractor/getPrefixLogs.js +12 -0
- package/dist/esm/extractor/getPrefixLogs.js.map +7 -0
- package/dist/{extractor → esm/extractor}/getPropValueFromAttributes.js +0 -0
- package/dist/{extractor → esm/extractor}/getPropValueFromAttributes.js.map +2 -2
- package/dist/{extractor → esm/extractor}/getSourceModule.js +0 -0
- package/dist/{extractor → esm/extractor}/getSourceModule.js.map +2 -2
- package/dist/{extractor → esm/extractor}/getStaticBindingsForScope.js +0 -0
- package/dist/esm/extractor/getStaticBindingsForScope.js.map +7 -0
- package/dist/{extractor → esm/extractor}/hoistClassNames.js +0 -0
- package/dist/{extractor → esm/extractor}/hoistClassNames.js.map +2 -2
- package/dist/esm/extractor/literalToAst.js +80 -0
- package/dist/esm/extractor/literalToAst.js.map +7 -0
- package/dist/{extractor → esm/extractor}/loadTamagui.js +27 -3
- package/dist/esm/extractor/loadTamagui.js.map +7 -0
- package/dist/esm/extractor/logLines.js +22 -0
- package/dist/esm/extractor/logLines.js.map +7 -0
- package/dist/{extractor → esm/extractor}/normalizeTernaries.js +3 -2
- package/dist/esm/extractor/normalizeTernaries.js.map +7 -0
- package/dist/{extractor → esm/extractor}/removeUnusedHooks.js +5 -3
- package/dist/esm/extractor/removeUnusedHooks.js.map +7 -0
- package/dist/esm/extractor/validHTMLAttributes.js +52 -0
- package/dist/esm/extractor/validHTMLAttributes.js.map +7 -0
- package/dist/{index.js → esm/index.js} +0 -0
- package/dist/{index.js.map → esm/index.js.map} +1 -1
- package/dist/{patchReactNativeWeb.js → esm/patchReactNativeWeb.js} +37 -14
- package/dist/esm/patchReactNativeWeb.js.map +7 -0
- package/dist/{types.js → esm/types.js} +0 -0
- package/dist/{types.js.map → esm/types.js.map} +0 -0
- package/dist/jsx/constants.js +13 -0
- package/dist/jsx/extractor/accessSafe.js +10 -0
- package/dist/jsx/extractor/babelParse.js +29 -0
- package/dist/jsx/extractor/buildClassName.js +39 -0
- package/dist/jsx/extractor/createEvaluator.js +51 -0
- package/dist/jsx/extractor/createExtractor.js +1041 -0
- package/dist/jsx/extractor/ensureImportingConcat.js +23 -0
- package/dist/jsx/extractor/evaluateAstNode.js +93 -0
- package/dist/jsx/extractor/extractHelpers.js +102 -0
- package/dist/jsx/extractor/extractMediaStyle.js +151 -0
- package/dist/jsx/extractor/extractToClassNames.js +287 -0
- package/dist/jsx/extractor/findTopmostFunction.js +22 -0
- package/dist/jsx/extractor/generatedUid.js +27 -0
- package/dist/jsx/extractor/getPrefixLogs.js +11 -0
- package/dist/jsx/extractor/getPropValueFromAttributes.js +48 -0
- package/dist/jsx/extractor/getSourceModule.js +68 -0
- package/dist/jsx/extractor/getStaticBindingsForScope.js +127 -0
- package/dist/jsx/extractor/hoistClassNames.js +43 -0
- package/dist/jsx/extractor/literalToAst.js +79 -0
- package/dist/jsx/extractor/loadTamagui.js +64 -0
- package/dist/jsx/extractor/logLines.js +21 -0
- package/dist/jsx/extractor/normalizeTernaries.js +52 -0
- package/dist/jsx/extractor/removeUnusedHooks.js +79 -0
- package/dist/jsx/extractor/validHTMLAttributes.js +51 -0
- package/dist/jsx/index.js +13 -0
- package/{src/patchReactNativeWeb.ts → dist/jsx/patchReactNativeWeb.js} +65 -59
- package/dist/jsx/types.js +0 -0
- package/package.json +26 -23
- package/types/constants.d.ts +6 -0
- package/types/constants.d.ts.map +1 -0
- package/types/extractor/accessSafe.d.ts +3 -0
- package/types/extractor/accessSafe.d.ts.map +1 -0
- package/types/extractor/babelParse.d.ts +5 -0
- package/types/extractor/babelParse.d.ts.map +1 -0
- package/types/extractor/buildClassName.d.ts +4 -0
- package/types/extractor/buildClassName.d.ts.map +1 -0
- package/types/extractor/createEvaluator.d.ts +12 -0
- package/types/extractor/createEvaluator.d.ts.map +1 -0
- package/types/extractor/createExtractor.d.ts +27 -0
- package/types/extractor/createExtractor.d.ts.map +1 -0
- package/types/extractor/ensureImportingConcat.d.ts +4 -0
- package/types/extractor/ensureImportingConcat.d.ts.map +1 -0
- package/types/extractor/evaluateAstNode.d.ts +3 -0
- package/types/extractor/evaluateAstNode.d.ts.map +1 -0
- package/types/extractor/extractHelpers.d.ts +12 -0
- package/types/extractor/extractHelpers.d.ts.map +1 -0
- package/types/extractor/extractMediaStyle.d.ts +10 -0
- package/types/extractor/extractMediaStyle.d.ts.map +1 -0
- package/types/extractor/extractToClassNames.d.ts +23 -0
- package/types/extractor/extractToClassNames.d.ts.map +1 -0
- package/types/extractor/findTopmostFunction.d.ts +4 -0
- package/types/extractor/findTopmostFunction.d.ts.map +1 -0
- package/types/extractor/generatedUid.d.ts +5 -0
- package/types/extractor/generatedUid.d.ts.map +1 -0
- package/types/extractor/getPrefixLogs.d.ts +3 -0
- package/types/extractor/getPrefixLogs.d.ts.map +1 -0
- package/types/extractor/getPropValueFromAttributes.d.ts +3 -0
- package/types/extractor/getPropValueFromAttributes.d.ts.map +1 -0
- package/types/extractor/getSourceModule.d.ts +16 -0
- package/types/extractor/getSourceModule.d.ts.map +1 -0
- package/types/extractor/getStaticBindingsForScope.d.ts +4 -0
- package/types/extractor/getStaticBindingsForScope.d.ts.map +1 -0
- package/types/extractor/hoistClassNames.d.ts +6 -0
- package/types/extractor/hoistClassNames.d.ts.map +1 -0
- package/types/extractor/literalToAst.d.ts +4 -0
- package/types/extractor/literalToAst.d.ts.map +1 -0
- package/types/extractor/loadTamagui.d.ts +9 -0
- package/types/extractor/loadTamagui.d.ts.map +1 -0
- package/types/extractor/logLines.d.ts +2 -0
- package/types/extractor/logLines.d.ts.map +1 -0
- package/types/extractor/normalizeTernaries.d.ts +3 -0
- package/types/extractor/normalizeTernaries.d.ts.map +1 -0
- package/types/extractor/removeUnusedHooks.d.ts +3 -0
- package/types/extractor/removeUnusedHooks.d.ts.map +1 -0
- package/types/extractor/validHTMLAttributes.d.ts +49 -0
- package/types/extractor/validHTMLAttributes.d.ts.map +1 -0
- package/types/index.d.ts +8 -0
- package/types/index.d.ts.map +1 -0
- package/types/patchReactNativeWeb.d.ts +2 -0
- package/types/patchReactNativeWeb.d.ts.map +1 -0
- package/types/types.d.ts +85 -0
- package/types/types.d.ts.map +1 -0
- package/dist/extractor/createEvaluator.js.map +0 -7
- package/dist/extractor/createExtractor.js.map +0 -7
- package/dist/extractor/ensureImportingConcat.js.map +0 -7
- package/dist/extractor/evaluateAstNode.js.map +0 -7
- package/dist/extractor/extractHelpers.js.map +0 -7
- package/dist/extractor/extractMediaStyle.js.map +0 -7
- package/dist/extractor/extractToClassNames.js.map +0 -7
- package/dist/extractor/getStaticBindingsForScope.js.map +0 -7
- package/dist/extractor/literalToAst.js +0 -34
- package/dist/extractor/literalToAst.js.map +0 -7
- package/dist/extractor/loadTamagui.js.map +0 -7
- package/dist/extractor/normalizeTernaries.js.map +0 -7
- package/dist/extractor/removeUnusedHooks.js.map +0 -7
- package/dist/index.cjs +0 -2116
- package/dist/index.cjs.map +0 -7
- package/dist/patchReactNativeWeb.js.map +0 -7
- package/src/constants.ts +0 -10
- package/src/extractor/accessSafe.ts +0 -18
- package/src/extractor/babelParse.ts +0 -27
- package/src/extractor/buildClassName.ts +0 -61
- package/src/extractor/createEvaluator.ts +0 -68
- package/src/extractor/createExtractor.ts +0 -1139
- package/src/extractor/ensureImportingConcat.ts +0 -33
- package/src/extractor/evaluateAstNode.ts +0 -121
- package/src/extractor/extractHelpers.ts +0 -102
- package/src/extractor/extractMediaStyle.ts +0 -191
- package/src/extractor/extractToClassNames.ts +0 -326
- package/src/extractor/findTopmostFunction.ts +0 -22
- package/src/extractor/generatedUid.ts +0 -43
- package/src/extractor/getPropValueFromAttributes.ts +0 -92
- package/src/extractor/getSourceModule.ts +0 -101
- package/src/extractor/getStaticBindingsForScope.ts +0 -173
- package/src/extractor/hoistClassNames.ts +0 -45
- package/src/extractor/literalToAst.ts +0 -32
- package/src/extractor/loadTamagui.ts +0 -61
- package/src/extractor/normalizeTernaries.ts +0 -60
- package/src/extractor/removeUnusedHooks.ts +0 -76
- package/src/index.ts +0 -9
- package/src/types.ts +0 -89
- package/types.d.ts +0 -219
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import * as t from "@babel/types";
|
|
4
|
+
import invariant from "invariant";
|
|
5
|
+
function generateUid(scope, name) {
|
|
6
|
+
invariant(typeof scope === "object", "generateUid expects a scope object as its first parameter");
|
|
7
|
+
invariant(typeof name === "string" && name !== "", "generateUid expects a valid name as its second parameter");
|
|
8
|
+
name = t.toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, "");
|
|
9
|
+
let uid;
|
|
10
|
+
let i = 0;
|
|
11
|
+
do {
|
|
12
|
+
if (i > 1) {
|
|
13
|
+
uid = name + i;
|
|
14
|
+
} else {
|
|
15
|
+
uid = name;
|
|
16
|
+
}
|
|
17
|
+
i++;
|
|
18
|
+
} while (scope.hasLabel(uid) || scope.hasBinding(uid) || scope.hasGlobal(uid) || scope.hasReference(uid));
|
|
19
|
+
const program = scope.getProgramParent();
|
|
20
|
+
program.references[uid] = true;
|
|
21
|
+
program.uids[uid] = true;
|
|
22
|
+
return uid;
|
|
23
|
+
}
|
|
24
|
+
__name(generateUid, "generateUid");
|
|
25
|
+
export {
|
|
26
|
+
generateUid
|
|
27
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
function getPrefixLogs(options) {
|
|
4
|
+
var _a;
|
|
5
|
+
const { TAMAGUI_TARGET } = process.env;
|
|
6
|
+
return (_a = options == null ? void 0 : options.prefixLogs) != null ? _a : ` ${TAMAGUI_TARGET} | `;
|
|
7
|
+
}
|
|
8
|
+
__name(getPrefixLogs, "getPrefixLogs");
|
|
9
|
+
export {
|
|
10
|
+
getPrefixLogs
|
|
11
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import generate from "@babel/generator";
|
|
4
|
+
import * as t from "@babel/types";
|
|
5
|
+
import { accessSafe } from "./accessSafe";
|
|
6
|
+
function getPropValueFromAttributes(propName, attrs) {
|
|
7
|
+
let propIndex = -1;
|
|
8
|
+
let jsxAttr = null;
|
|
9
|
+
for (let idx = -1, len = attrs.length; ++idx < len; ) {
|
|
10
|
+
const attr = attrs[idx];
|
|
11
|
+
if (t.isJSXAttribute(attr) && attr.name && attr.name.name === propName) {
|
|
12
|
+
propIndex = idx;
|
|
13
|
+
jsxAttr = attr;
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (!jsxAttr || jsxAttr.value == null) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
let propValue = jsxAttr.value;
|
|
21
|
+
if (t.isJSXExpressionContainer(propValue)) {
|
|
22
|
+
propValue = propValue.expression;
|
|
23
|
+
}
|
|
24
|
+
if (t.isJSXEmptyExpression(propValue)) {
|
|
25
|
+
console.error("encountered JSXEmptyExpression");
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const applicableSpreads = attrs.filter((attr, idx) => {
|
|
29
|
+
if (t.isJSXSpreadAttribute(attr)) {
|
|
30
|
+
if (t.isIdentifier(attr.argument) || t.isMemberExpression(attr.argument)) {
|
|
31
|
+
return idx > propIndex;
|
|
32
|
+
}
|
|
33
|
+
if (t.isLogicalExpression(attr.argument)) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
throw new Error(`unsupported spread of type "${attr.argument.type}": ${generate(attr).code}`);
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
}).map((attr) => attr.argument);
|
|
40
|
+
if (applicableSpreads.length > 0) {
|
|
41
|
+
propValue = applicableSpreads.reduce((acc, val) => t.logicalExpression("||", accessSafe(val, propName), acc), propValue);
|
|
42
|
+
}
|
|
43
|
+
return propValue;
|
|
44
|
+
}
|
|
45
|
+
__name(getPropValueFromAttributes, "getPropValueFromAttributes");
|
|
46
|
+
export {
|
|
47
|
+
getPropValueFromAttributes
|
|
48
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import * as t from "@babel/types";
|
|
4
|
+
function getSourceModule(itemName, itemBinding) {
|
|
5
|
+
if (!itemBinding.constant) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
let sourceModule;
|
|
9
|
+
let imported;
|
|
10
|
+
let local;
|
|
11
|
+
let destructured;
|
|
12
|
+
let usesImportSyntax = false;
|
|
13
|
+
const itemNode = itemBinding.path.node;
|
|
14
|
+
if (t.isImportDefaultSpecifier(itemNode) || t.isImportSpecifier(itemNode)) {
|
|
15
|
+
if (t.isImportDeclaration(itemBinding.path.parent)) {
|
|
16
|
+
sourceModule = itemBinding.path.parent.source.value;
|
|
17
|
+
local = itemNode.local.name;
|
|
18
|
+
usesImportSyntax = true;
|
|
19
|
+
if (t.isImportSpecifier(itemNode)) {
|
|
20
|
+
imported = itemNode.imported["name"];
|
|
21
|
+
destructured = true;
|
|
22
|
+
} else {
|
|
23
|
+
imported = itemNode.local.name;
|
|
24
|
+
destructured = false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
} else if (t.isVariableDeclarator(itemNode) && itemNode.init != null && t.isCallExpression(itemNode.init) && t.isIdentifier(itemNode.init.callee) && itemNode.init.callee.name === "require" && itemNode.init.arguments.length === 1) {
|
|
28
|
+
const firstArg = itemNode.init.arguments[0];
|
|
29
|
+
if (!t.isStringLiteral(firstArg)) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
sourceModule = firstArg.value;
|
|
33
|
+
if (t.isIdentifier(itemNode.id)) {
|
|
34
|
+
local = itemNode.id.name;
|
|
35
|
+
imported = itemNode.id.name;
|
|
36
|
+
destructured = false;
|
|
37
|
+
} else if (t.isObjectPattern(itemNode.id)) {
|
|
38
|
+
for (const objProp of itemNode.id.properties) {
|
|
39
|
+
if (t.isObjectProperty(objProp) && t.isIdentifier(objProp.value) && objProp.value.name === itemName) {
|
|
40
|
+
local = objProp.value.name;
|
|
41
|
+
imported = objProp.key.name;
|
|
42
|
+
destructured = true;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (!local || !imported) {
|
|
47
|
+
console.error("could not find prop with value `%s`", itemName);
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
console.error("Unhandled id type: %s", itemNode.id.type);
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
destructured,
|
|
59
|
+
imported,
|
|
60
|
+
local,
|
|
61
|
+
sourceModule,
|
|
62
|
+
usesImportSyntax
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
__name(getSourceModule, "getSourceModule");
|
|
66
|
+
export {
|
|
67
|
+
getSourceModule
|
|
68
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { dirname, extname, resolve } from "path";
|
|
4
|
+
import * as t from "@babel/types";
|
|
5
|
+
import { existsSync } from "fs-extra";
|
|
6
|
+
import { evaluateAstNode } from "./evaluateAstNode";
|
|
7
|
+
import { getSourceModule } from "./getSourceModule";
|
|
8
|
+
const isLocalImport = /* @__PURE__ */ __name((path) => path.startsWith(".") || path.startsWith("/"), "isLocalImport");
|
|
9
|
+
function resolveImportPath(sourcePath, path) {
|
|
10
|
+
const sourceDir = dirname(sourcePath);
|
|
11
|
+
if (isLocalImport(path)) {
|
|
12
|
+
if (extname(path) === "") {
|
|
13
|
+
path += ".js";
|
|
14
|
+
}
|
|
15
|
+
return resolve(sourceDir, path);
|
|
16
|
+
}
|
|
17
|
+
return path;
|
|
18
|
+
}
|
|
19
|
+
__name(resolveImportPath, "resolveImportPath");
|
|
20
|
+
function importModule(path) {
|
|
21
|
+
const filenames = [path.replace(".js", ".tsx"), path.replace(".js", ".ts"), path];
|
|
22
|
+
for (const file of filenames) {
|
|
23
|
+
if (existsSync(file)) {
|
|
24
|
+
return require(file);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
__name(importModule, "importModule");
|
|
30
|
+
function getStaticBindingsForScope(scope, whitelist = [], sourcePath, bindingCache, shouldPrintDebug) {
|
|
31
|
+
const bindings = scope.getAllBindings();
|
|
32
|
+
const ret = {};
|
|
33
|
+
if (shouldPrintDebug) {
|
|
34
|
+
console.log(" ", Object.keys(bindings).length, "variables in scope");
|
|
35
|
+
}
|
|
36
|
+
const program = scope.getProgramParent().block;
|
|
37
|
+
for (const node of program.body) {
|
|
38
|
+
if (t.isImportDeclaration(node)) {
|
|
39
|
+
const importPath = node.source.value;
|
|
40
|
+
if (!node.specifiers.length)
|
|
41
|
+
continue;
|
|
42
|
+
if (!isLocalImport(importPath)) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const moduleName = resolveImportPath(sourcePath, importPath);
|
|
46
|
+
const isOnWhitelist = whitelist.some((test) => moduleName.endsWith(test));
|
|
47
|
+
if (!isOnWhitelist)
|
|
48
|
+
continue;
|
|
49
|
+
const src = importModule(moduleName);
|
|
50
|
+
if (!src)
|
|
51
|
+
continue;
|
|
52
|
+
for (const specifier of node.specifiers) {
|
|
53
|
+
if (t.isImportSpecifier(specifier) && t.isIdentifier(specifier.imported)) {
|
|
54
|
+
if (typeof src[specifier.imported.name] !== "undefined") {
|
|
55
|
+
const val = src[specifier.local.name];
|
|
56
|
+
ret[specifier.local.name] = val;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (!bindingCache) {
|
|
63
|
+
throw new Error("bindingCache is a required param");
|
|
64
|
+
}
|
|
65
|
+
for (const k in bindings) {
|
|
66
|
+
const binding = bindings[k];
|
|
67
|
+
const sourceModule = getSourceModule(k, binding);
|
|
68
|
+
if (sourceModule) {
|
|
69
|
+
if (!sourceModule.sourceModule) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
const moduleName = resolveImportPath(sourcePath, sourceModule.sourceModule);
|
|
73
|
+
const isOnWhitelist = whitelist.some((test) => moduleName.endsWith(test));
|
|
74
|
+
if (isOnWhitelist) {
|
|
75
|
+
const src = importModule(moduleName);
|
|
76
|
+
if (!src) {
|
|
77
|
+
console.log(`\u26A0\uFE0F missing file ${moduleName} via ${sourcePath} import ${sourceModule.sourceModule}?`);
|
|
78
|
+
return {};
|
|
79
|
+
}
|
|
80
|
+
if (sourceModule.destructured) {
|
|
81
|
+
if (sourceModule.imported) {
|
|
82
|
+
ret[k] = src[sourceModule.imported];
|
|
83
|
+
}
|
|
84
|
+
} else {
|
|
85
|
+
ret[k] = src;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const { parent, parentPath } = binding.path;
|
|
91
|
+
if (!t.isVariableDeclaration(parent) || parent.kind !== "const") {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
const dec = parent.declarations.find((d) => t.isIdentifier(d.id) && d.id.name === k);
|
|
95
|
+
if (!dec || !dec.init) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
if (typeof dec.id.start !== "number" || typeof dec.id.end !== "number") {
|
|
99
|
+
console.error("dec.id.start/end is not a number");
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (!t.isIdentifier(dec.id)) {
|
|
103
|
+
console.error("dec is not an identifier");
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
const cacheKey = `${dec.id.name}_${dec.id.start}-${dec.id.end}`;
|
|
107
|
+
if (bindingCache.hasOwnProperty(cacheKey)) {
|
|
108
|
+
ret[k] = bindingCache[cacheKey];
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (bindingCache.hasOwnProperty(cacheKey)) {
|
|
112
|
+
ret[k] = bindingCache[cacheKey];
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
ret[k] = evaluateAstNode(dec.init, void 0, shouldPrintDebug);
|
|
117
|
+
bindingCache[cacheKey] = ret[k];
|
|
118
|
+
continue;
|
|
119
|
+
} catch (e) {
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return ret;
|
|
123
|
+
}
|
|
124
|
+
__name(getStaticBindingsForScope, "getStaticBindingsForScope");
|
|
125
|
+
export {
|
|
126
|
+
getStaticBindingsForScope
|
|
127
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import * as t from "@babel/types";
|
|
4
|
+
function hoistClassNames(path, existing, expr) {
|
|
5
|
+
const hoist = hoistClassNames.bind(null, path, existing);
|
|
6
|
+
if (t.isStringLiteral(expr)) {
|
|
7
|
+
if (expr.value.trim() === "") {
|
|
8
|
+
return expr;
|
|
9
|
+
}
|
|
10
|
+
if (existing[expr.value]) {
|
|
11
|
+
return existing[expr.value];
|
|
12
|
+
}
|
|
13
|
+
const identifier = replaceStringWithVariable(expr);
|
|
14
|
+
existing[expr.value] = identifier;
|
|
15
|
+
return identifier;
|
|
16
|
+
}
|
|
17
|
+
if (t.isBinaryExpression(expr)) {
|
|
18
|
+
return t.binaryExpression(expr.operator, hoist(expr.left), hoist(expr.right));
|
|
19
|
+
}
|
|
20
|
+
if (t.isLogicalExpression(expr)) {
|
|
21
|
+
return t.logicalExpression(expr.operator, hoist(expr.left), hoist(expr.right));
|
|
22
|
+
}
|
|
23
|
+
if (t.isConditionalExpression(expr)) {
|
|
24
|
+
return t.conditionalExpression(expr.test, hoist(expr.consequent), hoist(expr.alternate));
|
|
25
|
+
}
|
|
26
|
+
return expr;
|
|
27
|
+
function replaceStringWithVariable(str) {
|
|
28
|
+
const uid = path.scope.generateUidIdentifier("cn");
|
|
29
|
+
const parent = path.findParent((path2) => path2.isProgram());
|
|
30
|
+
if (!parent)
|
|
31
|
+
throw new Error(`no program?`);
|
|
32
|
+
const variable = t.variableDeclaration("const", [
|
|
33
|
+
t.variableDeclarator(uid, t.stringLiteral(` ${str.value}`))
|
|
34
|
+
]);
|
|
35
|
+
parent.unshiftContainer("body", variable);
|
|
36
|
+
return uid;
|
|
37
|
+
}
|
|
38
|
+
__name(replaceStringWithVariable, "replaceStringWithVariable");
|
|
39
|
+
}
|
|
40
|
+
__name(hoistClassNames, "hoistClassNames");
|
|
41
|
+
export {
|
|
42
|
+
hoistClassNames
|
|
43
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import * as t from "@babel/types";
|
|
4
|
+
function literalToAst(literal) {
|
|
5
|
+
if (literal === null) {
|
|
6
|
+
return t.nullLiteral();
|
|
7
|
+
}
|
|
8
|
+
switch (typeof literal) {
|
|
9
|
+
case "function":
|
|
10
|
+
throw new Error("Unsupported");
|
|
11
|
+
case "number":
|
|
12
|
+
return t.numericLiteral(literal);
|
|
13
|
+
case "string":
|
|
14
|
+
return t.stringLiteral(literal);
|
|
15
|
+
case "boolean":
|
|
16
|
+
return t.booleanLiteral(literal);
|
|
17
|
+
case "undefined":
|
|
18
|
+
return t.unaryExpression("void", t.numericLiteral(0), true);
|
|
19
|
+
default:
|
|
20
|
+
if (Array.isArray(literal)) {
|
|
21
|
+
return t.arrayExpression(literal.map(literalToAst));
|
|
22
|
+
}
|
|
23
|
+
return t.objectExpression(Object.keys(literal).filter((k) => {
|
|
24
|
+
return typeof literal[k] !== "undefined";
|
|
25
|
+
}).map((k) => {
|
|
26
|
+
return t.objectProperty(t.stringLiteral(k), literalToAst(literal[k]));
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
__name(literalToAst, "literalToAst");
|
|
31
|
+
const easyPeasies = ["BooleanLiteral", "StringLiteral", "NumericLiteral"];
|
|
32
|
+
function astToLiteral(node) {
|
|
33
|
+
if (!node) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (easyPeasies.includes(node.type)) {
|
|
37
|
+
return node.value;
|
|
38
|
+
}
|
|
39
|
+
if (node.name === "undefined" && !node.value) {
|
|
40
|
+
return void 0;
|
|
41
|
+
}
|
|
42
|
+
if (t.isNullLiteral(node)) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
if (t.isObjectExpression(node)) {
|
|
46
|
+
return computeProps(node.properties);
|
|
47
|
+
}
|
|
48
|
+
if (t.isArrayExpression(node)) {
|
|
49
|
+
return node.elements.reduce((acc, element) => [
|
|
50
|
+
...acc,
|
|
51
|
+
...(element == null ? void 0 : element.type) === "SpreadElement" ? astToLiteral(element.argument) : [astToLiteral(element)]
|
|
52
|
+
], []);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
__name(astToLiteral, "astToLiteral");
|
|
56
|
+
function computeProps(props) {
|
|
57
|
+
return props.reduce((acc, prop) => {
|
|
58
|
+
if (prop.type === "SpreadElement") {
|
|
59
|
+
return {
|
|
60
|
+
...acc,
|
|
61
|
+
...astToLiteral(prop.argument)
|
|
62
|
+
};
|
|
63
|
+
} else if (prop.type !== "ObjectMethod") {
|
|
64
|
+
const val = astToLiteral(prop.value);
|
|
65
|
+
if (val !== void 0) {
|
|
66
|
+
return {
|
|
67
|
+
...acc,
|
|
68
|
+
[prop.key.name]: val
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return acc;
|
|
73
|
+
}, {});
|
|
74
|
+
}
|
|
75
|
+
__name(computeProps, "computeProps");
|
|
76
|
+
export {
|
|
77
|
+
astToLiteral,
|
|
78
|
+
literalToAst
|
|
79
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
import { createTamagui } from "@tamagui/core-node";
|
|
5
|
+
let loadedTamagui = null;
|
|
6
|
+
function loadTamagui(props) {
|
|
7
|
+
if (loadedTamagui) {
|
|
8
|
+
return loadedTamagui;
|
|
9
|
+
}
|
|
10
|
+
process.env.IS_STATIC = "is_static";
|
|
11
|
+
const proxyWorm = require("@tamagui/proxy-worm");
|
|
12
|
+
const rnw = require("react-native-web");
|
|
13
|
+
const Mod = require("module");
|
|
14
|
+
const og = Mod.prototype.require;
|
|
15
|
+
Mod.prototype.require = function(path) {
|
|
16
|
+
if (path.endsWith(".css")) {
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
if (path === "@gorhom/bottom-sheet" || path.startsWith("react-native-reanimated")) {
|
|
20
|
+
return proxyWorm;
|
|
21
|
+
}
|
|
22
|
+
if (path.startsWith("react-native") && !path.startsWith("react-native-web/dist/cjs/exports")) {
|
|
23
|
+
return rnw;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
return og.apply(this, arguments);
|
|
27
|
+
} catch (err) {
|
|
28
|
+
console.error("Tamagui error loading file:\n");
|
|
29
|
+
console.log(" ", path, "\n");
|
|
30
|
+
console.log(err.message);
|
|
31
|
+
console.log(err.stack);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const configPath = join(process.cwd(), props.config);
|
|
36
|
+
const tamaguiConfigExport = require(configPath);
|
|
37
|
+
const tamaguiConfig = tamaguiConfigExport["default"] || tamaguiConfigExport;
|
|
38
|
+
if (!tamaguiConfig || !tamaguiConfig.parsed) {
|
|
39
|
+
try {
|
|
40
|
+
const confPath = require.resolve(configPath);
|
|
41
|
+
console.log(`Received:`, tamaguiConfigExport);
|
|
42
|
+
throw new Error(`Can't find valid config in ${confPath}`);
|
|
43
|
+
} catch (err) {
|
|
44
|
+
throw err;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const components = {};
|
|
48
|
+
for (const module of props.components) {
|
|
49
|
+
const exported = require(module);
|
|
50
|
+
Object.assign(components, exported);
|
|
51
|
+
}
|
|
52
|
+
process.env.IS_STATIC = void 0;
|
|
53
|
+
Mod.prototype.require = og;
|
|
54
|
+
createTamagui(tamaguiConfig);
|
|
55
|
+
loadedTamagui = {
|
|
56
|
+
components,
|
|
57
|
+
tamaguiConfig
|
|
58
|
+
};
|
|
59
|
+
return loadedTamagui;
|
|
60
|
+
}
|
|
61
|
+
__name(loadTamagui, "loadTamagui");
|
|
62
|
+
export {
|
|
63
|
+
loadTamagui
|
|
64
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
const prefix = " ";
|
|
4
|
+
const logLines = /* @__PURE__ */ __name((str, singleLine = false) => {
|
|
5
|
+
if (singleLine) {
|
|
6
|
+
return prefix + str.split(" ").join(`
|
|
7
|
+
${prefix}`);
|
|
8
|
+
}
|
|
9
|
+
let lines = [""];
|
|
10
|
+
const items = str.split(" ");
|
|
11
|
+
for (const item of items) {
|
|
12
|
+
if (item.length + lines[lines.length - 1].length > 85) {
|
|
13
|
+
lines.push("");
|
|
14
|
+
}
|
|
15
|
+
lines[lines.length - 1] += item + " ";
|
|
16
|
+
}
|
|
17
|
+
return lines.map((line, i) => prefix + (i == 0 ? "" : " ") + line.trim()).join("\n");
|
|
18
|
+
}, "logLines");
|
|
19
|
+
export {
|
|
20
|
+
logLines
|
|
21
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import generate from "@babel/generator";
|
|
4
|
+
import * as t from "@babel/types";
|
|
5
|
+
import invariant from "invariant";
|
|
6
|
+
function normalizeTernaries(ternaries) {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
invariant(Array.isArray(ternaries), "extractStaticTernaries expects param 1 to be an array of ternaries");
|
|
9
|
+
if (ternaries.length === 0) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
const ternariesByKey = {};
|
|
13
|
+
for (let idx = -1, len = ternaries.length; ++idx < len; ) {
|
|
14
|
+
const { test, consequent, alternate, remove, ...rest } = ternaries[idx];
|
|
15
|
+
let ternaryTest = test;
|
|
16
|
+
if (t.isExpressionStatement(test)) {
|
|
17
|
+
ternaryTest = test.expression;
|
|
18
|
+
}
|
|
19
|
+
let shouldSwap = false;
|
|
20
|
+
if (t.isUnaryExpression(test) && test.operator === "!") {
|
|
21
|
+
ternaryTest = test.argument;
|
|
22
|
+
shouldSwap = true;
|
|
23
|
+
} else if (t.isBinaryExpression(test)) {
|
|
24
|
+
if (test.operator === "!==" || test.operator === "!=") {
|
|
25
|
+
ternaryTest = t.binaryExpression(test.operator, test.left, test.right);
|
|
26
|
+
shouldSwap = true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const key = generate(ternaryTest).code;
|
|
30
|
+
if (!ternariesByKey[key]) {
|
|
31
|
+
ternariesByKey[key] = {
|
|
32
|
+
...rest,
|
|
33
|
+
alternate: {},
|
|
34
|
+
consequent: {},
|
|
35
|
+
test: ternaryTest,
|
|
36
|
+
remove
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const altStyle = (_a = shouldSwap ? consequent : alternate) != null ? _a : {};
|
|
40
|
+
const consStyle = (_b = shouldSwap ? alternate : consequent) != null ? _b : {};
|
|
41
|
+
Object.assign(ternariesByKey[key].alternate, altStyle);
|
|
42
|
+
Object.assign(ternariesByKey[key].consequent, consStyle);
|
|
43
|
+
}
|
|
44
|
+
const ternaryExpression = Object.keys(ternariesByKey).map((key) => {
|
|
45
|
+
return ternariesByKey[key];
|
|
46
|
+
});
|
|
47
|
+
return ternaryExpression;
|
|
48
|
+
}
|
|
49
|
+
__name(normalizeTernaries, "normalizeTernaries");
|
|
50
|
+
export {
|
|
51
|
+
normalizeTernaries
|
|
52
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import * as t from "@babel/types";
|
|
4
|
+
const hooks = {
|
|
5
|
+
useMedia: true,
|
|
6
|
+
useTheme: true
|
|
7
|
+
};
|
|
8
|
+
function removeUnusedHooks(compFn, shouldPrintDebug) {
|
|
9
|
+
var _a;
|
|
10
|
+
compFn.scope.crawl();
|
|
11
|
+
let bodyStatements = compFn == null ? void 0 : compFn.get("body");
|
|
12
|
+
if (!bodyStatements) {
|
|
13
|
+
console.log("no body statemnts?", compFn);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (!Array.isArray(bodyStatements)) {
|
|
17
|
+
if (bodyStatements.isFunctionExpression()) {
|
|
18
|
+
bodyStatements = bodyStatements.scope.path.get("body");
|
|
19
|
+
} else {
|
|
20
|
+
bodyStatements = bodyStatements.get("body");
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (!bodyStatements || !Array.isArray(bodyStatements)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const statements = bodyStatements;
|
|
27
|
+
for (const statement of statements) {
|
|
28
|
+
if (!statement.isVariableDeclaration()) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const declarations = statement.get("declarations");
|
|
32
|
+
if (!Array.isArray(declarations)) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const isBindingReferenced = /* @__PURE__ */ __name((name) => {
|
|
36
|
+
var _a2;
|
|
37
|
+
return !!((_a2 = statement.scope.getBinding(name)) == null ? void 0 : _a2.referenced);
|
|
38
|
+
}, "isBindingReferenced");
|
|
39
|
+
for (const declarator of declarations) {
|
|
40
|
+
const id = declarator.get("id");
|
|
41
|
+
const init = declarator.node.init;
|
|
42
|
+
if (Array.isArray(id) || Array.isArray(init)) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const shouldRemove = (() => {
|
|
46
|
+
const isHook = t.isCallExpression(init) && t.isIdentifier(init.callee) && hooks[init.callee.name];
|
|
47
|
+
if (!isHook) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
if (t.isIdentifier(id.node)) {
|
|
51
|
+
const name = id.node.name;
|
|
52
|
+
return !isBindingReferenced(name);
|
|
53
|
+
} else if (t.isObjectPattern(id.node)) {
|
|
54
|
+
const propPaths = id.get("properties");
|
|
55
|
+
return propPaths.every((prop) => {
|
|
56
|
+
if (!prop.isObjectProperty())
|
|
57
|
+
return false;
|
|
58
|
+
const value = prop.get("value");
|
|
59
|
+
if (Array.isArray(value) || !value.isIdentifier())
|
|
60
|
+
return false;
|
|
61
|
+
const name = value.node.name;
|
|
62
|
+
return !isBindingReferenced(name);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
})();
|
|
67
|
+
if (shouldRemove) {
|
|
68
|
+
declarator.remove();
|
|
69
|
+
if (shouldPrintDebug) {
|
|
70
|
+
console.log(` [\u{1FA9D}] removed ${(_a = id.node["name"]) != null ? _a : ""}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
__name(removeUnusedHooks, "removeUnusedHooks");
|
|
77
|
+
export {
|
|
78
|
+
removeUnusedHooks
|
|
79
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const validHTMLAttributes = {
|
|
2
|
+
autocomplete: true,
|
|
3
|
+
border: true,
|
|
4
|
+
contenteditable: true,
|
|
5
|
+
crossorigin: true,
|
|
6
|
+
dir: true,
|
|
7
|
+
draggable: true,
|
|
8
|
+
enctype: true,
|
|
9
|
+
formenctype: true,
|
|
10
|
+
formmethod: true,
|
|
11
|
+
formtarget: true,
|
|
12
|
+
inputmode: true,
|
|
13
|
+
kind: true,
|
|
14
|
+
link: true,
|
|
15
|
+
method: true,
|
|
16
|
+
preload: true,
|
|
17
|
+
referrerpolicy: true,
|
|
18
|
+
rel: true,
|
|
19
|
+
rev: true,
|
|
20
|
+
role: true,
|
|
21
|
+
sandbox: true,
|
|
22
|
+
shape: true,
|
|
23
|
+
spellcheck: true,
|
|
24
|
+
target: true,
|
|
25
|
+
translate: true,
|
|
26
|
+
type: true,
|
|
27
|
+
wrap: true,
|
|
28
|
+
"aria-autocomplete": true,
|
|
29
|
+
"aria-busy": true,
|
|
30
|
+
"aria-checked": true,
|
|
31
|
+
"aria-current": true,
|
|
32
|
+
"aria-disabled": true,
|
|
33
|
+
"aria-expanded": true,
|
|
34
|
+
"aria-haspopup": true,
|
|
35
|
+
"aria-hidden": true,
|
|
36
|
+
"aria-invalid": true,
|
|
37
|
+
"aria-polite": true,
|
|
38
|
+
"aria-modal": true,
|
|
39
|
+
"aria-multiline": true,
|
|
40
|
+
"aria-multiselectable": true,
|
|
41
|
+
"aria-orientation": true,
|
|
42
|
+
"aria-pressed": true,
|
|
43
|
+
"aria-readonly": true,
|
|
44
|
+
"aria-relevant": true,
|
|
45
|
+
"aria-required": true,
|
|
46
|
+
"aria-selected": true,
|
|
47
|
+
"aria-sort": true
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
validHTMLAttributes
|
|
51
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
process.env.TAMAGUI_COMPILE_PROCESS = "1";
|
|
2
|
+
import { TamaguiOptions } from "./types";
|
|
3
|
+
import { createExtractor } from "./extractor/createExtractor";
|
|
4
|
+
import { literalToAst } from "./extractor/literalToAst";
|
|
5
|
+
export * from "./constants";
|
|
6
|
+
export * from "./extractor/extractToClassNames";
|
|
7
|
+
export * from "./extractor/extractHelpers";
|
|
8
|
+
export * from "./patchReactNativeWeb";
|
|
9
|
+
export {
|
|
10
|
+
TamaguiOptions,
|
|
11
|
+
createExtractor,
|
|
12
|
+
literalToAst
|
|
13
|
+
};
|