@tamagui/static 1.0.0-alpha.37 → 1.0.0-alpha.40
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/constants.js +17 -7
- package/dist/cjs/constants.js.map +2 -2
- package/dist/cjs/extractor/accessSafe.js +13 -7
- package/dist/cjs/extractor/accessSafe.js.map +1 -1
- package/dist/cjs/extractor/babelParse.js +13 -7
- package/dist/cjs/extractor/babelParse.js.map +1 -1
- package/dist/cjs/extractor/buildClassName.js +13 -7
- package/dist/cjs/extractor/buildClassName.js.map +1 -1
- package/dist/cjs/extractor/createEvaluator.js +19 -13
- package/dist/cjs/extractor/createEvaluator.js.map +2 -2
- package/dist/cjs/extractor/createExtractor.js +44 -40
- package/dist/cjs/extractor/createExtractor.js.map +2 -2
- package/dist/cjs/extractor/ensureImportingConcat.js +17 -11
- package/dist/cjs/extractor/ensureImportingConcat.js.map +2 -2
- package/dist/cjs/extractor/evaluateAstNode.js +13 -7
- package/dist/cjs/extractor/evaluateAstNode.js.map +1 -1
- package/dist/cjs/extractor/extractHelpers.js +13 -7
- package/dist/cjs/extractor/extractHelpers.js.map +1 -1
- package/dist/cjs/extractor/extractMediaStyle.js +16 -10
- package/dist/cjs/extractor/extractMediaStyle.js.map +1 -1
- package/dist/cjs/extractor/extractToClassNames.js +31 -26
- package/dist/cjs/extractor/extractToClassNames.js.map +2 -2
- package/dist/cjs/extractor/findTopmostFunction.js +19 -2
- package/dist/cjs/extractor/findTopmostFunction.js.map +1 -1
- package/dist/cjs/extractor/generatedUid.js +14 -8
- package/dist/cjs/extractor/generatedUid.js.map +1 -1
- package/dist/cjs/extractor/getPropValueFromAttributes.js +15 -9
- package/dist/cjs/extractor/getPropValueFromAttributes.js.map +1 -1
- package/dist/cjs/extractor/getSourceModule.js +13 -7
- package/dist/cjs/extractor/getSourceModule.js.map +1 -1
- package/dist/cjs/extractor/getStaticBindingsForScope.js +17 -11
- package/dist/cjs/extractor/getStaticBindingsForScope.js.map +1 -1
- package/dist/cjs/extractor/hoistClassNames.js +13 -7
- package/dist/cjs/extractor/hoistClassNames.js.map +1 -1
- package/dist/cjs/extractor/literalToAst.js +13 -7
- package/dist/cjs/extractor/literalToAst.js.map +1 -1
- package/dist/cjs/extractor/loadTamagui.js +12 -11
- package/dist/cjs/extractor/loadTamagui.js.map +1 -1
- package/dist/cjs/extractor/logLines.js +19 -2
- package/dist/cjs/extractor/logLines.js.map +1 -1
- package/dist/cjs/extractor/normalizeTernaries.js +15 -9
- package/dist/cjs/extractor/normalizeTernaries.js.map +1 -1
- package/dist/cjs/extractor/removeUnusedHooks.js +13 -7
- package/dist/cjs/extractor/removeUnusedHooks.js.map +1 -1
- package/dist/cjs/index.js +17 -16
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/patchReactNativeWeb.js +14 -8
- package/dist/cjs/patchReactNativeWeb.js.map +1 -1
- package/dist/cjs/types.js +18 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/constants.js +4 -0
- package/dist/esm/constants.js.map +2 -2
- package/dist/esm/extractor/createEvaluator.js +1 -1
- package/dist/esm/extractor/createEvaluator.js.map +1 -1
- package/dist/esm/extractor/createExtractor.js +9 -11
- package/dist/esm/extractor/createExtractor.js.map +2 -2
- package/dist/esm/extractor/ensureImportingConcat.js +1 -1
- package/dist/esm/extractor/ensureImportingConcat.js.map +2 -2
- package/dist/esm/extractor/extractToClassNames.js +2 -3
- package/dist/esm/extractor/extractToClassNames.js.map +2 -2
- package/dist/jsx/constants.js +4 -0
- package/dist/jsx/extractor/createEvaluator.js +1 -1
- package/dist/jsx/extractor/createExtractor.js +9 -11
- package/dist/jsx/extractor/ensureImportingConcat.js +1 -1
- package/dist/jsx/extractor/extractToClassNames.js +2 -3
- package/package.json +7 -7
- package/types/constants.d.ts +2 -0
- package/types/constants.d.ts.map +1 -1
- package/types/extractor/createExtractor.d.ts +0 -1
- package/types/extractor/createExtractor.d.ts.map +1 -1
- package/types/extractor/ensureImportingConcat.d.ts.map +1 -1
- package/types/extractor/extractToClassNames.d.ts +0 -1
- package/types/extractor/extractToClassNames.d.ts.map +1 -1
- package/dist/constants.js +0 -10
- package/dist/constants.js.map +0 -7
- package/dist/extractor/accessSafe.js +0 -11
- package/dist/extractor/accessSafe.js.map +0 -7
- package/dist/extractor/babelParse.js +0 -30
- package/dist/extractor/babelParse.js.map +0 -7
- package/dist/extractor/buildClassName.js +0 -40
- package/dist/extractor/buildClassName.js.map +0 -7
- package/dist/extractor/createEvaluator.js +0 -51
- package/dist/extractor/createEvaluator.js.map +0 -7
- package/dist/extractor/createExtractor.js +0 -827
- package/dist/extractor/createExtractor.js.map +0 -7
- package/dist/extractor/ensureImportingConcat.js +0 -24
- package/dist/extractor/ensureImportingConcat.js.map +0 -7
- package/dist/extractor/evaluateAstNode.js +0 -94
- package/dist/extractor/evaluateAstNode.js.map +0 -7
- package/dist/extractor/extractHelpers.js +0 -94
- package/dist/extractor/extractHelpers.js.map +0 -7
- package/dist/extractor/extractMediaStyle.js +0 -151
- package/dist/extractor/extractMediaStyle.js.map +0 -7
- package/dist/extractor/extractToClassNames.js +0 -235
- package/dist/extractor/extractToClassNames.js.map +0 -7
- package/dist/extractor/findTopmostFunction.js +0 -23
- package/dist/extractor/findTopmostFunction.js.map +0 -7
- package/dist/extractor/generatedUid.js +0 -28
- package/dist/extractor/generatedUid.js.map +0 -7
- package/dist/extractor/getPropValueFromAttributes.js +0 -49
- package/dist/extractor/getPropValueFromAttributes.js.map +0 -7
- package/dist/extractor/getSourceModule.js +0 -69
- package/dist/extractor/getSourceModule.js.map +0 -7
- package/dist/extractor/getStaticBindingsForScope.js +0 -128
- package/dist/extractor/getStaticBindingsForScope.js.map +0 -7
- package/dist/extractor/hoistClassNames.js +0 -44
- package/dist/extractor/hoistClassNames.js.map +0 -7
- package/dist/extractor/literalToAst.js +0 -34
- package/dist/extractor/literalToAst.js.map +0 -7
- package/dist/extractor/loadTamagui.js +0 -41
- package/dist/extractor/loadTamagui.js.map +0 -7
- package/dist/extractor/normalizeTernaries.js +0 -52
- package/dist/extractor/normalizeTernaries.js.map +0 -7
- package/dist/extractor/removeUnusedHooks.js +0 -78
- package/dist/extractor/removeUnusedHooks.js.map +0 -7
- package/dist/index.cjs +0 -2116
- package/dist/index.cjs.map +0 -7
- package/dist/index.js +0 -14
- package/dist/index.js.map +0 -7
- package/dist/patchReactNativeWeb.js +0 -107
- package/dist/patchReactNativeWeb.js.map +0 -7
- package/dist/types.js +0 -1
- package/dist/types.js.map +0 -7
|
@@ -7,25 +7,30 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
7
7
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
8
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
9
|
var __export = (target, all) => {
|
|
10
|
-
__markAsModule(target);
|
|
11
10
|
for (var name in all)
|
|
12
11
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
12
|
};
|
|
14
|
-
var __reExport = (target, module2, desc) => {
|
|
13
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
15
14
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
16
15
|
for (let key of __getOwnPropNames(module2))
|
|
17
|
-
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
16
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
18
17
|
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
19
18
|
}
|
|
20
19
|
return target;
|
|
21
20
|
};
|
|
22
|
-
var
|
|
23
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default",
|
|
21
|
+
var __toESM = (module2, isNodeMode) => {
|
|
22
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
24
23
|
};
|
|
25
|
-
|
|
24
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
25
|
+
return (module2, temp) => {
|
|
26
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
27
|
+
};
|
|
28
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
29
|
+
var literalToAst_exports = {};
|
|
30
|
+
__export(literalToAst_exports, {
|
|
26
31
|
literalToAst: () => literalToAst
|
|
27
32
|
});
|
|
28
|
-
var t =
|
|
33
|
+
var t = __toESM(require("@babel/types"));
|
|
29
34
|
function literalToAst(literal) {
|
|
30
35
|
if (literal === null) {
|
|
31
36
|
return t.nullLiteral();
|
|
@@ -53,4 +58,5 @@ function literalToAst(literal) {
|
|
|
53
58
|
}
|
|
54
59
|
}
|
|
55
60
|
__name(literalToAst, "literalToAst");
|
|
61
|
+
module.exports = __toCommonJS(literalToAst_exports);
|
|
56
62
|
//# sourceMappingURL=literalToAst.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/extractor/literalToAst.ts"],
|
|
4
4
|
"sourcesContent": ["import * as t from '@babel/types'\n\nexport function literalToAst(literal: any): t.Expression {\n if (literal === null) {\n return t.nullLiteral()\n }\n switch (typeof literal) {\n case 'function':\n throw new Error('Unsupported')\n case 'number':\n return t.numericLiteral(literal)\n case 'string':\n return t.stringLiteral(literal)\n case 'boolean':\n return t.booleanLiteral(literal)\n case 'undefined':\n return t.unaryExpression('void', t.numericLiteral(0), true)\n default:\n if (Array.isArray(literal)) {\n return t.arrayExpression(literal.map(literalToAst))\n }\n return t.objectExpression(\n Object.keys(literal)\n .filter((k) => {\n return typeof literal[k] !== 'undefined'\n })\n .map((k) => {\n return t.objectProperty(t.stringLiteral(k), literalToAst(literal[k]))\n })\n )\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,QAAmB;AAEZ,sBAAsB,SAA4B;AACvD,MAAI,YAAY,MAAM;AACpB,WAAO,EAAE;AAAA;AAEX,UAAQ,OAAO;AAAA,SACR;AACH,YAAM,IAAI,MAAM;AAAA,SACb;AACH,aAAO,EAAE,eAAe;AAAA,SACrB;AACH,aAAO,EAAE,cAAc;AAAA,SACpB;AACH,aAAO,EAAE,eAAe;AAAA,SACrB;AACH,aAAO,EAAE,gBAAgB,QAAQ,EAAE,eAAe,IAAI;AAAA;AAEtD,UAAI,MAAM,QAAQ,UAAU;AAC1B,eAAO,EAAE,gBAAgB,QAAQ,IAAI;AAAA;AAEvC,aAAO,EAAE,iBACP,OAAO,KAAK,SACT,OAAO,CAAC,MAAM;AACb,eAAO,OAAO,QAAQ,OAAO;AAAA,SAE9B,IAAI,CAAC,MAAM;AACV,eAAO,EAAE,eAAe,EAAE,cAAc,IAAI,aAAa,QAAQ;AAAA;AAAA;AAAA;AAzB7D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
6
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
7
|
var __export = (target, all) => {
|
|
10
|
-
__markAsModule(target);
|
|
11
8
|
for (var name in all)
|
|
12
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
10
|
};
|
|
14
|
-
var __reExport = (target, module2, desc) => {
|
|
11
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
15
12
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
16
13
|
for (let key of __getOwnPropNames(module2))
|
|
17
|
-
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
14
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
18
15
|
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
19
16
|
}
|
|
20
17
|
return target;
|
|
21
18
|
};
|
|
22
|
-
var
|
|
23
|
-
return
|
|
24
|
-
};
|
|
25
|
-
|
|
19
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
20
|
+
return (module2, temp) => {
|
|
21
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
22
|
+
};
|
|
23
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
24
|
+
var loadTamagui_exports = {};
|
|
25
|
+
__export(loadTamagui_exports, {
|
|
26
26
|
loadTamagui: () => loadTamagui
|
|
27
27
|
});
|
|
28
|
-
var import_path =
|
|
29
|
-
var import_core_node =
|
|
28
|
+
var import_path = require("path");
|
|
29
|
+
var import_core_node = require("@tamagui/core-node");
|
|
30
30
|
let loadedTamagui = null;
|
|
31
31
|
function loadTamagui(props) {
|
|
32
32
|
if (loadedTamagui) {
|
|
@@ -60,4 +60,5 @@ function loadTamagui(props) {
|
|
|
60
60
|
return loadedTamagui;
|
|
61
61
|
}
|
|
62
62
|
__name(loadTamagui, "loadTamagui");
|
|
63
|
+
module.exports = __toCommonJS(loadTamagui_exports);
|
|
63
64
|
//# sourceMappingURL=loadTamagui.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/extractor/loadTamagui.ts"],
|
|
4
4
|
"sourcesContent": ["import { join } from 'path'\n\nimport type { StaticComponent, TamaguiInternalConfig } from '@tamagui/core'\nimport { createTamagui } from '@tamagui/core-node'\n\nlet loadedTamagui: any = null\n\nexport function loadTamagui(props: { components: string[]; config: string }): {\n components: Record<string, StaticComponent>\n tamaguiConfig: TamaguiInternalConfig\n} {\n if (loadedTamagui) {\n return loadedTamagui\n }\n\n // lets shim require and avoid importing react-native + react-native-web\n // we just need to read the config around them\n process.env.IS_STATIC = 'is_static'\n const proxyWorm = require('@tamagui/fake-react-native')\n const Mod = require('module')\n const og = Mod.prototype.require\n Mod.prototype.require = function (path: string) {\n if (\n path.startsWith('react-native') &&\n // allow our rnw.tsx imports through\n !path.startsWith('react-native-web/dist/cjs/exports')\n ) {\n return proxyWorm\n }\n return og.apply(this, arguments)\n }\n\n // import config\n const configPath = join(process.cwd(), props.config)\n const tamaguiConfigExport = require(configPath)\n const tamaguiConfig = (tamaguiConfigExport['default'] ||\n tamaguiConfigExport) as TamaguiInternalConfig\n\n // import components\n const components = {}\n for (const module of props.components) {\n const exported = require(module)\n Object.assign(components, exported)\n }\n\n // undo shims\n process.env.IS_STATIC = undefined\n Mod.prototype.require = og\n\n // set up core-node\n createTamagui(tamaguiConfig)\n\n loadedTamagui = {\n components,\n tamaguiConfig,\n }\n\n return loadedTamagui\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAqB;AAGrB,uBAA8B;AAE9B,IAAI,gBAAqB;AAElB,qBAAqB,OAG1B;AACA,MAAI,eAAe;AACjB,WAAO;AAAA;AAKT,UAAQ,IAAI,YAAY;AACxB,QAAM,YAAY,QAAQ;AAC1B,QAAM,MAAM,QAAQ;AACpB,QAAM,KAAK,IAAI,UAAU;AACzB,MAAI,UAAU,UAAU,SAAU,MAAc;AAC9C,QACE,KAAK,WAAW,mBAEhB,CAAC,KAAK,WAAW,sCACjB;AACA,aAAO;AAAA;AAET,WAAO,GAAG,MAAM,MAAM;AAAA;AAIxB,QAAM,aAAa,sBAAK,QAAQ,OAAO,MAAM;AAC7C,QAAM,sBAAsB,QAAQ;AACpC,QAAM,gBAAiB,oBAAoB,cACzC;AAGF,QAAM,aAAa;AACnB,aAAW,WAAU,MAAM,YAAY;AACrC,UAAM,WAAW,QAAQ;AACzB,WAAO,OAAO,YAAY;AAAA;AAI5B,UAAQ,IAAI,YAAY;AACxB,MAAI,UAAU,UAAU;AAGxB,sCAAc;AAEd,kBAAgB;AAAA,IACd;AAAA,IACA;AAAA;AAGF,SAAO;AAAA;AAlDO;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2
5
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
3
6
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
7
|
var __export = (target, all) => {
|
|
5
|
-
__markAsModule(target);
|
|
6
8
|
for (var name in all)
|
|
7
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
10
|
};
|
|
9
|
-
|
|
11
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
12
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(module2))
|
|
14
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
15
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return target;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
20
|
+
return (module2, temp) => {
|
|
21
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
22
|
+
};
|
|
23
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
24
|
+
var logLines_exports = {};
|
|
25
|
+
__export(logLines_exports, {
|
|
10
26
|
logLines: () => logLines
|
|
11
27
|
});
|
|
12
28
|
const logLines = /* @__PURE__ */ __name((str) => {
|
|
@@ -20,4 +36,5 @@ const logLines = /* @__PURE__ */ __name((str) => {
|
|
|
20
36
|
}
|
|
21
37
|
return lines.map((line, i) => " " + (i == 0 ? "" : " ") + line.trim()).join("\n");
|
|
22
38
|
}, "logLines");
|
|
39
|
+
module.exports = __toCommonJS(logLines_exports);
|
|
23
40
|
//# sourceMappingURL=logLines.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/extractor/logLines.ts"],
|
|
4
4
|
"sourcesContent": ["export const logLines = (str: string) => {\n let lines: string[] = ['']\n const items = str.split(' ')\n for (const item of items) {\n if (item.length + lines[lines.length - 1].length > 100) {\n lines.push('')\n }\n lines[lines.length - 1] += item + ' '\n }\n return lines.map((line, i) => ' ' + (i == 0 ? '' : ' ') + line.trim()).join('\\n')\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,WAAW,wBAAC,QAAgB;AACvC,MAAI,QAAkB,CAAC;AACvB,QAAM,QAAQ,IAAI,MAAM;AACxB,aAAW,QAAQ,OAAO;AACxB,QAAI,KAAK,SAAS,MAAM,MAAM,SAAS,GAAG,SAAS,KAAK;AACtD,YAAM,KAAK;AAAA;AAEb,UAAM,MAAM,SAAS,MAAM,OAAO;AAAA;AAEpC,SAAO,MAAM,IAAI,CAAC,MAAM,MAAM,gBAAiB,MAAK,IAAI,KAAK,OAAO,KAAK,QAAQ,KAAK;AAAA,GAThE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -36,27 +36,32 @@ var __objRest = (source, exclude) => {
|
|
|
36
36
|
return target;
|
|
37
37
|
};
|
|
38
38
|
var __export = (target, all) => {
|
|
39
|
-
__markAsModule(target);
|
|
40
39
|
for (var name in all)
|
|
41
40
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
42
41
|
};
|
|
43
|
-
var __reExport = (target, module2, desc) => {
|
|
42
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
44
43
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
45
44
|
for (let key of __getOwnPropNames(module2))
|
|
46
|
-
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
45
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
47
46
|
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
48
47
|
}
|
|
49
48
|
return target;
|
|
50
49
|
};
|
|
51
|
-
var
|
|
52
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default",
|
|
50
|
+
var __toESM = (module2, isNodeMode) => {
|
|
51
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
53
52
|
};
|
|
54
|
-
|
|
53
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
54
|
+
return (module2, temp) => {
|
|
55
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
56
|
+
};
|
|
57
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
58
|
+
var normalizeTernaries_exports = {};
|
|
59
|
+
__export(normalizeTernaries_exports, {
|
|
55
60
|
normalizeTernaries: () => normalizeTernaries
|
|
56
61
|
});
|
|
57
|
-
var import_generator =
|
|
58
|
-
var t =
|
|
59
|
-
var import_invariant =
|
|
62
|
+
var import_generator = __toESM(require("@babel/generator"));
|
|
63
|
+
var t = __toESM(require("@babel/types"));
|
|
64
|
+
var import_invariant = __toESM(require("invariant"));
|
|
60
65
|
function normalizeTernaries(ternaries) {
|
|
61
66
|
(0, import_invariant.default)(Array.isArray(ternaries), "extractStaticTernaries expects param 1 to be an array of ternaries");
|
|
62
67
|
if (ternaries.length === 0) {
|
|
@@ -99,4 +104,5 @@ function normalizeTernaries(ternaries) {
|
|
|
99
104
|
return ternaryExpression;
|
|
100
105
|
}
|
|
101
106
|
__name(normalizeTernaries, "normalizeTernaries");
|
|
107
|
+
module.exports = __toCommonJS(normalizeTernaries_exports);
|
|
102
108
|
//# sourceMappingURL=normalizeTernaries.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/extractor/normalizeTernaries.ts"],
|
|
4
4
|
"sourcesContent": ["import generate from '@babel/generator'\nimport * as t from '@babel/types'\nimport invariant from 'invariant'\n\nimport { Ternary } from '../types'\n\nexport function normalizeTernaries(ternaries: Ternary[]) {\n invariant(Array.isArray(ternaries), 'extractStaticTernaries expects param 1 to be an array of ternaries')\n\n if (ternaries.length === 0) {\n return []\n }\n\n const ternariesByKey: { [key: string]: Ternary } = {}\n\n for (let idx = -1, len = ternaries.length; ++idx < len; ) {\n const { test, consequent, alternate, remove, ...rest } = ternaries[idx]\n\n let ternaryTest = test\n\n // strip parens\n if (t.isExpressionStatement(test)) {\n ternaryTest = (test as any).expression\n }\n\n // convert `!thing` to `thing` with swapped consequent and alternate\n let shouldSwap = false\n if (t.isUnaryExpression(test) && test.operator === '!') {\n ternaryTest = test.argument\n shouldSwap = true\n } else if (t.isBinaryExpression(test)) {\n if (test.operator === '!==' || test.operator === '!=') {\n ternaryTest = t.binaryExpression(test.operator, test.left, test.right)\n shouldSwap = true\n }\n }\n\n const key = generate(ternaryTest).code\n\n if (!ternariesByKey[key]) {\n ternariesByKey[key] = {\n ...rest,\n alternate: {},\n consequent: {},\n test: ternaryTest,\n remove,\n }\n }\n const altStyle = (shouldSwap ? consequent : alternate) ?? {}\n const consStyle = (shouldSwap ? alternate : consequent) ?? {}\n Object.assign(ternariesByKey[key].alternate, altStyle)\n Object.assign(ternariesByKey[key].consequent, consStyle)\n }\n\n const ternaryExpression = Object.keys(ternariesByKey).map((key) => {\n return ternariesByKey[key]\n })\n\n return ternaryExpression\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAqB;AACrB,QAAmB;AACnB,uBAAsB;AAIf,4BAA4B,WAAsB;AACvD,gCAAU,MAAM,QAAQ,YAAY;AAEpC,MAAI,UAAU,WAAW,GAAG;AAC1B,WAAO;AAAA;AAGT,QAAM,iBAA6C;AAEnD,WAAS,MAAM,IAAI,MAAM,UAAU,QAAQ,EAAE,MAAM,OAAO;AACxD,UAAyD,eAAU,MAA3D,QAAM,YAAY,WAAW,WAAoB,IAAT,iBAAS,IAAT,CAAxC,QAAM,cAAY,aAAW;AAErC,QAAI,cAAc;AAGlB,QAAI,EAAE,sBAAsB,OAAO;AACjC,oBAAe,KAAa;AAAA;AAI9B,QAAI,aAAa;AACjB,QAAI,EAAE,kBAAkB,SAAS,KAAK,aAAa,KAAK;AACtD,oBAAc,KAAK;AACnB,mBAAa;AAAA,eACJ,EAAE,mBAAmB,OAAO;AACrC,UAAI,KAAK,aAAa,SAAS,KAAK,aAAa,MAAM;AACrD,sBAAc,EAAE,iBAAiB,KAAK,UAAU,KAAK,MAAM,KAAK;AAChE,qBAAa;AAAA;AAAA;AAIjB,UAAM,MAAM,8BAAS,aAAa;AAElC,QAAI,CAAC,eAAe,MAAM;AACxB,qBAAe,OAAO,iCACjB,OADiB;AAAA,QAEpB,WAAW;AAAA,QACX,YAAY;AAAA,QACZ,MAAM;AAAA,QACN;AAAA;AAAA;AAGJ,UAAM,WAAY,cAAa,aAAa,cAAc;AAC1D,UAAM,YAAa,cAAa,YAAY,eAAe;AAC3D,WAAO,OAAO,eAAe,KAAK,WAAW;AAC7C,WAAO,OAAO,eAAe,KAAK,YAAY;AAAA;AAGhD,QAAM,oBAAoB,OAAO,KAAK,gBAAgB,IAAI,CAAC,QAAQ;AACjE,WAAO,eAAe;AAAA;AAGxB,SAAO;AAAA;AApDO;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -7,25 +7,30 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
7
7
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
8
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
9
|
var __export = (target, all) => {
|
|
10
|
-
__markAsModule(target);
|
|
11
10
|
for (var name in all)
|
|
12
11
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
12
|
};
|
|
14
|
-
var __reExport = (target, module2, desc) => {
|
|
13
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
15
14
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
16
15
|
for (let key of __getOwnPropNames(module2))
|
|
17
|
-
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
16
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
18
17
|
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
19
18
|
}
|
|
20
19
|
return target;
|
|
21
20
|
};
|
|
22
|
-
var
|
|
23
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default",
|
|
21
|
+
var __toESM = (module2, isNodeMode) => {
|
|
22
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
24
23
|
};
|
|
25
|
-
|
|
24
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
25
|
+
return (module2, temp) => {
|
|
26
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
27
|
+
};
|
|
28
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
29
|
+
var removeUnusedHooks_exports = {};
|
|
30
|
+
__export(removeUnusedHooks_exports, {
|
|
26
31
|
removeUnusedHooks: () => removeUnusedHooks
|
|
27
32
|
});
|
|
28
|
-
var t =
|
|
33
|
+
var t = __toESM(require("@babel/types"));
|
|
29
34
|
const hooks = {
|
|
30
35
|
useMedia: true,
|
|
31
36
|
useTheme: true
|
|
@@ -98,4 +103,5 @@ function removeUnusedHooks(compFn, shouldPrintDebug) {
|
|
|
98
103
|
}
|
|
99
104
|
}
|
|
100
105
|
__name(removeUnusedHooks, "removeUnusedHooks");
|
|
106
|
+
module.exports = __toCommonJS(removeUnusedHooks_exports);
|
|
101
107
|
//# sourceMappingURL=removeUnusedHooks.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/extractor/removeUnusedHooks.ts"],
|
|
4
4
|
"sourcesContent": ["import { NodePath } from '@babel/traverse'\nimport * as t from '@babel/types'\n\nconst hooks = {\n useMedia: true,\n useTheme: true,\n}\n\nexport function removeUnusedHooks(compFn: NodePath<any>, shouldPrintDebug: boolean) {\n compFn.scope.crawl()\n // check the top level statements\n let bodyStatements = compFn?.get('body')\n if (!bodyStatements) {\n console.log('no body statemnts?', compFn)\n return\n }\n if (!Array.isArray(bodyStatements)) {\n if (bodyStatements.isFunctionExpression()) {\n bodyStatements = bodyStatements.scope.path.get('body')\n } else {\n bodyStatements = bodyStatements.get('body')\n }\n }\n if (!bodyStatements || !Array.isArray(bodyStatements)) {\n return\n }\n const statements = bodyStatements as NodePath<any>[]\n for (const statement of statements) {\n if (!statement.isVariableDeclaration()) {\n continue\n }\n const declarations = statement.get('declarations')\n if (!Array.isArray(declarations)) {\n continue\n }\n const isBindingReferenced = (name: string) => {\n return !!statement.scope.getBinding(name)?.referenced\n }\n for (const declarator of declarations) {\n const id = declarator.get('id')\n const init = declarator.node.init\n if (Array.isArray(id) || Array.isArray(init)) {\n continue\n }\n const shouldRemove = (() => {\n const isHook =\n t.isCallExpression(init) && t.isIdentifier(init.callee) && hooks[init.callee.name]\n if (!isHook) {\n return false\n }\n if (t.isIdentifier(id.node)) {\n // remove \"const media = useMedia()\"\n const name = id.node.name\n return !isBindingReferenced(name)\n } else if (t.isObjectPattern(id.node)) {\n // remove \"const { sm } = useMedia()\"\n const propPaths = id.get('properties') as NodePath<any>[]\n return propPaths.every((prop) => {\n if (!prop.isObjectProperty()) return false\n const value = prop.get('value')\n if (Array.isArray(value) || !value.isIdentifier()) return false\n const name = value.node.name\n return !isBindingReferenced(name)\n })\n }\n return false\n })()\n if (shouldRemove) {\n declarator.remove()\n if (shouldPrintDebug) {\n console.log(` [\uD83E\uDE9D] removed ${id.node['name'] ?? ''}`)\n }\n }\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AACA,QAAmB;AAEnB,MAAM,QAAQ;AAAA,EACZ,UAAU;AAAA,EACV,UAAU;AAAA;AAGL,2BAA2B,QAAuB,kBAA2B;AAClF,SAAO,MAAM;AAEb,MAAI,iBAAiB,iCAAQ,IAAI;AACjC,MAAI,CAAC,gBAAgB;AACnB,YAAQ,IAAI,sBAAsB;AAClC;AAAA;AAEF,MAAI,CAAC,MAAM,QAAQ,iBAAiB;AAClC,QAAI,eAAe,wBAAwB;AACzC,uBAAiB,eAAe,MAAM,KAAK,IAAI;AAAA,WAC1C;AACL,uBAAiB,eAAe,IAAI;AAAA;AAAA;AAGxC,MAAI,CAAC,kBAAkB,CAAC,MAAM,QAAQ,iBAAiB;AACrD;AAAA;AAEF,QAAM,aAAa;AACnB,aAAW,aAAa,YAAY;AAClC,QAAI,CAAC,UAAU,yBAAyB;AACtC;AAAA;AAEF,UAAM,eAAe,UAAU,IAAI;AACnC,QAAI,CAAC,MAAM,QAAQ,eAAe;AAChC;AAAA;AAEF,UAAM,sBAAsB,wBAAC,SAAiB;AAnClD;AAoCM,aAAO,CAAC,CAAC,iBAAU,MAAM,WAAW,UAA3B,mBAAkC;AAAA,OADjB;AAG5B,eAAW,cAAc,cAAc;AACrC,YAAM,KAAK,WAAW,IAAI;AAC1B,YAAM,OAAO,WAAW,KAAK;AAC7B,UAAI,MAAM,QAAQ,OAAO,MAAM,QAAQ,OAAO;AAC5C;AAAA;AAEF,YAAM,eAAgB,OAAM;AAC1B,cAAM,SACJ,EAAE,iBAAiB,SAAS,EAAE,aAAa,KAAK,WAAW,MAAM,KAAK,OAAO;AAC/E,YAAI,CAAC,QAAQ;AACX,iBAAO;AAAA;AAET,YAAI,EAAE,aAAa,GAAG,OAAO;AAE3B,gBAAM,OAAO,GAAG,KAAK;AACrB,iBAAO,CAAC,oBAAoB;AAAA,mBACnB,EAAE,gBAAgB,GAAG,OAAO;AAErC,gBAAM,YAAY,GAAG,IAAI;AACzB,iBAAO,UAAU,MAAM,CAAC,SAAS;AAC/B,gBAAI,CAAC,KAAK;AAAoB,qBAAO;AACrC,kBAAM,QAAQ,KAAK,IAAI;AACvB,gBAAI,MAAM,QAAQ,UAAU,CAAC,MAAM;AAAgB,qBAAO;AAC1D,kBAAM,OAAO,MAAM,KAAK;AACxB,mBAAO,CAAC,oBAAoB;AAAA;AAAA;AAGhC,eAAO;AAAA;AAET,UAAI,cAAc;AAChB,mBAAW;AACX,YAAI,kBAAkB;AACpB,kBAAQ,IAAI,yBAAkB,GAAG,KAAK,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AA9D3C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
6
|
var __export = (target, all) => {
|
|
9
|
-
__markAsModule(target);
|
|
10
7
|
for (var name in all)
|
|
11
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
9
|
};
|
|
13
|
-
var __reExport = (target, module2, desc) => {
|
|
10
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
14
11
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
12
|
for (let key of __getOwnPropNames(module2))
|
|
16
|
-
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
13
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
17
14
|
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
18
15
|
}
|
|
19
16
|
return target;
|
|
20
17
|
};
|
|
21
|
-
var
|
|
22
|
-
return
|
|
23
|
-
};
|
|
24
|
-
|
|
18
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
19
|
+
return (module2, temp) => {
|
|
20
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
21
|
+
};
|
|
22
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
23
|
+
var src_exports = {};
|
|
24
|
+
__export(src_exports, {
|
|
25
25
|
TamaguiOptions: () => import_types.TamaguiOptions,
|
|
26
26
|
createExtractor: () => import_createExtractor.createExtractor,
|
|
27
27
|
literalToAst: () => import_literalToAst.literalToAst
|
|
28
28
|
});
|
|
29
|
-
var import_types =
|
|
30
|
-
var import_createExtractor =
|
|
31
|
-
var import_literalToAst =
|
|
32
|
-
__reExport(
|
|
33
|
-
__reExport(
|
|
34
|
-
__reExport(
|
|
35
|
-
__reExport(
|
|
29
|
+
var import_types = require("./types");
|
|
30
|
+
var import_createExtractor = require("./extractor/createExtractor");
|
|
31
|
+
var import_literalToAst = require("./extractor/literalToAst");
|
|
32
|
+
__reExport(src_exports, require("./constants"));
|
|
33
|
+
__reExport(src_exports, require("./extractor/extractToClassNames"));
|
|
34
|
+
__reExport(src_exports, require("./extractor/extractHelpers"));
|
|
35
|
+
__reExport(src_exports, require("./patchReactNativeWeb"));
|
|
36
36
|
process.env.TAMAGUI_COMPILE_PROCESS = "1";
|
|
37
|
+
module.exports = __toCommonJS(src_exports);
|
|
37
38
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["process.env.TAMAGUI_COMPILE_PROCESS = '1'\n\nexport { TamaguiOptions } from './types'\nexport { createExtractor } from './extractor/createExtractor'\nexport { literalToAst } from './extractor/literalToAst'\nexport * from './constants'\nexport * from './extractor/extractToClassNames'\nexport * from './extractor/extractHelpers'\nexport * from './patchReactNativeWeb'\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA+B;AAC/B,6BAAgC;AAChC,0BAA6B;AAC7B,wBAAc;AACd,wBAAc;AACd,wBAAc;AACd,wBAAc;AARd,QAAQ,IAAI,0BAA0B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -7,26 +7,31 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
7
7
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
8
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
9
|
var __export = (target, all) => {
|
|
10
|
-
__markAsModule(target);
|
|
11
10
|
for (var name in all)
|
|
12
11
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
12
|
};
|
|
14
|
-
var __reExport = (target, module2, desc) => {
|
|
13
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
15
14
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
16
15
|
for (let key of __getOwnPropNames(module2))
|
|
17
|
-
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
16
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
18
17
|
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
19
18
|
}
|
|
20
19
|
return target;
|
|
21
20
|
};
|
|
22
|
-
var
|
|
23
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default",
|
|
21
|
+
var __toESM = (module2, isNodeMode) => {
|
|
22
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
24
23
|
};
|
|
25
|
-
|
|
24
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
25
|
+
return (module2, temp) => {
|
|
26
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
27
|
+
};
|
|
28
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
29
|
+
var patchReactNativeWeb_exports = {};
|
|
30
|
+
__export(patchReactNativeWeb_exports, {
|
|
26
31
|
patchReactNativeWeb: () => patchReactNativeWeb
|
|
27
32
|
});
|
|
28
|
-
var fs =
|
|
29
|
-
var import_path =
|
|
33
|
+
var fs = __toESM(require("fs"));
|
|
34
|
+
var import_path = __toESM(require("path"));
|
|
30
35
|
function patchReactNativeWeb() {
|
|
31
36
|
const rootDir = require.resolve("react-native-web").replace(/\/dist.*/, "");
|
|
32
37
|
const modulePath = import_path.default.join(rootDir, "dist", "tamagui-exports.js");
|
|
@@ -126,4 +131,5 @@ exports.useResponderEvents = require('./modules/useResponderEvents')
|
|
|
126
131
|
const fwdProps = require('./modules/forwardedProps')
|
|
127
132
|
exports.forwardedProps = ${forwardedPropsObj}
|
|
128
133
|
`;
|
|
134
|
+
module.exports = __toCommonJS(patchReactNativeWeb_exports);
|
|
129
135
|
//# sourceMappingURL=patchReactNativeWeb.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/patchReactNativeWeb.ts"],
|
|
4
4
|
"sourcesContent": ["import * as fs from 'fs'\nimport path from 'path'\n\n// were patching react-native-web so we can use some internal methods\n// we do it this way because we need to rely on webpack or bundler config to determine cjs vs esm\n// so we can't just require it all directly\n// would be nice in the future to be able to eject from react-native-web entirely optionally\n\n// keep it sync\nexport function patchReactNativeWeb() {\n const rootDir = require.resolve('react-native-web').replace(/\\/dist.*/, '')\n const modulePath = path.join(rootDir, 'dist', 'tamagui-exports.js')\n const cjsPath = path.join(rootDir, 'dist', 'cjs', 'tamagui-exports.js')\n\n const isEqual = (() => {\n let res = false\n try {\n res =\n fs.readFileSync(modulePath, 'utf-8') === moduleExports &&\n fs.readFileSync(cjsPath, 'utf-8') == cjsExports\n } catch {\n res = false\n }\n return res\n })()\n\n if (!isEqual) {\n console.log('\uD83E\uDD5A Tamagui patching react-native-web to share atomic styling primitives')\n console.log(' > adding', modulePath)\n console.log(' > adding', cjsPath)\n fs.writeFileSync(modulePath, moduleExports)\n fs.writeFileSync(cjsPath, cjsExports)\n }\n\n // if entry files not patched, patch them:\n const moduleEntry = path.join(rootDir, 'dist', 'index.js')\n const moduleEntrySrc = fs.readFileSync(moduleEntry, 'utf-8')\n if (!moduleEntrySrc.includes('// tamagui-patch-v4')) {\n fs.writeFileSync(\n moduleEntry,\n `${removePatch(moduleEntrySrc)}\n\n// tamagui-patch-v4\nimport * as TExports from './tamagui-exports'\nexport const TamaguiExports = TExports\n// tamagui-patch-end\n`\n )\n }\n const cjsEntry = path.join(rootDir, 'dist', 'cjs', 'index.js')\n const cjsEntrySrc = fs.readFileSync(cjsEntry, 'utf-8')\n if (!cjsEntrySrc.includes('// tamagui-patch-v4')) {\n fs.writeFileSync(\n cjsEntry,\n `${removePatch(cjsEntrySrc)}\n\n// tamagui-patch-v4\nexports.TamaguiExports = _interopRequireDefault(require(\"./tamagui-exports\"));\n// tamagui-patch-end\n`\n )\n }\n}\n\nfunction removePatch(source: string) {\n return source.replace(/\\/\\/ tamagui-patch([.\\s\\S]*)/g, '')\n}\n\n// view exports/View.ts\nconst forwardedPropsObj = `{\n ...fwdProps.defaultProps,\n ...fwdProps.accessibilityProps,\n ...fwdProps.clickProps,\n ...fwdProps.focusProps,\n ...fwdProps.keyboardProps,\n ...fwdProps.mouseProps,\n ...fwdProps.touchProps,\n ...fwdProps.styleProps,\n href: true,\n lang: true,\n onScroll: true,\n onWheel: true,\n pointerEvents: true\n}\n`\n\nconst moduleExports = `\nexport { atomic } from './exports/StyleSheet/compile'\nexport { default as createCompileableStyle } from './exports/StyleSheet/createCompileableStyle'\nexport { default as createReactDOMStyle } from './exports/StyleSheet/createReactDOMStyle'\nexport { default as i18Style } from './exports/StyleSheet/i18nStyle'\nexport { default as createDOMProps } from './modules/createDOMProps'\nexport { default as AccessibilityUtil } from './modules/AccessibilityUtil'\nexport { default as createElement } from './exports/createElement'\nexport { default as css } from './exports/StyleSheet/css'\nexport { default as TextAncestorContext } from './exports/Text/TextAncestorContext'\nexport { default as pick } from './modules/pick'\nexport { default as useElementLayout } from './modules/useElementLayout'\nexport { default as useMergeRefs } from './modules/useMergeRefs'\nexport { default as usePlatformMethods } from './modules/usePlatformMethods'\nexport { default as useResponderEvents } from './modules/useResponderEvents'\nimport * as fwdProps from './modules/forwardedProps'\nexport const forwardedProps = ${forwardedPropsObj}\n`\n\nconst cjsExports = `\nexports.atomic = require('./exports/StyleSheet/compile').atomic\nexports.createCompileableStyle = require('./exports/StyleSheet/createCompileableStyle')\nexports.createReactDOMStyle = require('./exports/StyleSheet/createReactDOMStyle')\nexports.i18Style = require('./exports/StyleSheet/i18nStyle')\nexports.createDOMProps = require('./modules/createDOMProps')\nexports.AccessibilityUtil = require('./modules/AccessibilityUtil')\nexports.createElement = require('./exports/createElement')\nexports.css = require('./exports/StyleSheet/css')\nexports.TextAncestorContext = require('./exports/Text/TextAncestorContext')\nexports.pick = require('./modules/pick')\nexports.useElementLayout = require('./modules/useElementLayout')\nexports.useMergeRefs = require('./modules/useMergeRefs')\nexports.usePlatformMethods = require('./modules/usePlatformMethods')\nexports.useResponderEvents = require('./modules/useResponderEvents')\nconst fwdProps = require('./modules/forwardedProps')\nexports.forwardedProps = ${forwardedPropsObj}\n`\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,SAAoB;AACpB,kBAAiB;AAQV,+BAA+B;AACpC,QAAM,UAAU,AAAgB,oCAAoB,QAAQ,YAAY;AACxE,QAAM,aAAa,oBAAK,KAAK,SAAS,QAAQ;AAC9C,QAAM,UAAU,oBAAK,KAAK,SAAS,QAAQ,OAAO;AAElD,QAAM,UAAW,OAAM;AACrB,QAAI,MAAM;AACV,QAAI;AACF,YACE,GAAG,aAAa,YAAY,aAAa,iBACzC,GAAG,aAAa,SAAS,YAAY;AAAA,YACvC;AACA,YAAM;AAAA;AAER,WAAO;AAAA;AAGT,MAAI,CAAC,SAAS;AACZ,YAAQ,IAAI;AACZ,YAAQ,IAAI,eAAe;AAC3B,YAAQ,IAAI,eAAe;AAC3B,OAAG,cAAc,YAAY;AAC7B,OAAG,cAAc,SAAS;AAAA;AAI5B,QAAM,cAAc,oBAAK,KAAK,SAAS,QAAQ;AAC/C,QAAM,iBAAiB,GAAG,aAAa,aAAa;AACpD,MAAI,CAAC,eAAe,SAAS,wBAAwB;AACnD,OAAG,cACD,aACA,GAAG,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASnB,QAAM,WAAW,oBAAK,KAAK,SAAS,QAAQ,OAAO;AACnD,QAAM,cAAc,GAAG,aAAa,UAAU;AAC9C,MAAI,CAAC,YAAY,SAAS,wBAAwB;AAChD,OAAG,cACD,UACA,GAAG,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA7CL;AAuDhB,qBAAqB,QAAgB;AACnC,SAAO,OAAO,QAAQ,iCAAiC;AAAA;AADhD;AAKT,MAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiB1B,MAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAgBU;AAAA;AAGhC,MAAM,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAgBQ;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/types.js
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2
5
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
3
|
-
|
|
6
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
7
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(module2))
|
|
9
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
10
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return target;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
15
|
+
return (module2, temp) => {
|
|
16
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
17
|
+
};
|
|
18
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
19
|
+
var types_exports = {};
|
|
20
|
+
module.exports = __toCommonJS(types_exports);
|
|
4
21
|
//# sourceMappingURL=types.js.map
|
package/dist/cjs/types.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/types.ts"],
|
|
4
4
|
"sourcesContent": ["import { NodePath } from '@babel/traverse'\nimport * as t from '@babel/types'\n\nexport type ClassNameObject = t.StringLiteral | t.Expression\n\nexport interface CacheObject {\n [key: string]: any\n}\n\nexport interface TamaguiOptions {\n // module paths you want to compile with tamagui (for example ['tamagui'])\n components: string[]\n // your tamagui.config.ts\n config?: string\n evaluateVars?: boolean\n importsWhitelist?: string[]\n disableExtraction?: boolean\n disableDebugAttr?: boolean\n disableExtractInlineMedia?: boolean\n disableExtractVariables?: boolean\n exclude?: RegExp\n logTimings?: boolean\n\n // probably non user options\n cssPath?: string\n cssData?: any\n deoptProps?: Set<string>\n excludeProps?: string[]\n}\n\nexport type ExtractedAttrAttr = {\n type: 'attr'\n value: t.JSXAttribute | t.JSXSpreadAttribute\n}\n\nexport type ExtractedAttrStyle = {\n type: 'style'\n value: Object\n attr?: t.JSXAttribute | t.JSXSpreadAttribute\n name?: string\n}\n\nexport type ExtractedAttr =\n | ExtractedAttrAttr\n | { type: 'ternary'; value: Ternary }\n | ExtractedAttrStyle\n\nexport type ExtractTagProps = {\n attrs: ExtractedAttr[]\n node: t.JSXOpeningElement\n attemptEval: (exprNode: t.Node, evalFn?: ((node: t.Node) => any) | undefined) => any\n jsxPath: NodePath<t.JSXElement>\n programPath: NodePath<t.Program>\n originalNodeName: string\n lineNumbers: string\n filePath: string\n isFlattened: boolean\n}\n\nexport type ExtractorParseProps = TamaguiOptions & {\n sourcePath?: string\n shouldPrintDebug?: boolean\n onExtractTag: (props: ExtractTagProps) => void\n getFlattenedNode: (props: { isTextView: boolean; tag: string }) => string\n}\n\nexport interface Ternary {\n test: t.Expression\n // shorthand props that don't use hooks\n inlineMediaQuery?: string\n remove: Function\n consequent: Object | null\n alternate: Object | null\n}\n\nexport type StyleObject = {\n property: string\n value: string\n className: string\n identifier: string\n rules: string[]\n}\n\nexport type ClassNameToStyleObj = {\n [key: string]: StyleObject\n}\n\nexport interface PluginContext {\n write: (path: string, rules: { [key: string]: string }) => any\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/constants.js
CHANGED
|
@@ -2,8 +2,12 @@ import findCacheDir from "find-cache-dir";
|
|
|
2
2
|
const CSS_FILE_NAME = "__snack.css";
|
|
3
3
|
const MEDIA_SEP = "_";
|
|
4
4
|
const cacheDir = findCacheDir({ name: "tamagui", create: true });
|
|
5
|
+
const FAILED_EVAL = Symbol("failed_style_eval");
|
|
6
|
+
const CONCAT_CLASSNAME_IMPORT = "concatClassName";
|
|
5
7
|
export {
|
|
8
|
+
CONCAT_CLASSNAME_IMPORT,
|
|
6
9
|
CSS_FILE_NAME,
|
|
10
|
+
FAILED_EVAL,
|
|
7
11
|
MEDIA_SEP,
|
|
8
12
|
cacheDir
|
|
9
13
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/constants.ts"],
|
|
4
|
-
"sourcesContent": ["import findCacheDir from 'find-cache-dir'\n\nexport const CSS_FILE_NAME = '__snack.css'\n\n// ENSURE THIS ISNT THE SAME AS THE SEPARATOR USED FOR STYLE KEYS\n// SEE matching one in concatClassName\nexport const MEDIA_SEP = '_'\n\n// ensure cache dir\nexport const cacheDir = findCacheDir({ name: 'tamagui', create: true })\n"],
|
|
5
|
-
"mappings": "AAAA;AAEO,MAAM,gBAAgB;AAItB,MAAM,YAAY;AAGlB,MAAM,WAAW,aAAa,EAAE,MAAM,WAAW,QAAQ;",
|
|
4
|
+
"sourcesContent": ["import findCacheDir from 'find-cache-dir'\n\nexport const CSS_FILE_NAME = '__snack.css'\n\n// ENSURE THIS ISNT THE SAME AS THE SEPARATOR USED FOR STYLE KEYS\n// SEE matching one in concatClassName\nexport const MEDIA_SEP = '_'\n\n// ensure cache dir\nexport const cacheDir = findCacheDir({ name: 'tamagui', create: true })\n\nexport const FAILED_EVAL = Symbol('failed_style_eval')\nexport const CONCAT_CLASSNAME_IMPORT = 'concatClassName'\n"],
|
|
5
|
+
"mappings": "AAAA;AAEO,MAAM,gBAAgB;AAItB,MAAM,YAAY;AAGlB,MAAM,WAAW,aAAa,EAAE,MAAM,WAAW,QAAQ;AAEzD,MAAM,cAAc,OAAO;AAC3B,MAAM,0BAA0B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,7 +3,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3
3
|
import vm from "vm";
|
|
4
4
|
import generate from "@babel/generator";
|
|
5
5
|
import * as t from "@babel/types";
|
|
6
|
-
import { FAILED_EVAL } from "
|
|
6
|
+
import { FAILED_EVAL } from "../constants";
|
|
7
7
|
import { evaluateAstNode } from "./evaluateAstNode";
|
|
8
8
|
import { isValidThemeHook } from "./extractHelpers";
|
|
9
9
|
function createEvaluator({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/extractor/createEvaluator.ts"],
|
|
4
|
-
"sourcesContent": ["import vm from 'vm'\n\nimport generate from '@babel/generator'\nimport { NodePath } from '@babel/traverse'\nimport * as t from '@babel/types'\nimport type { TamaguiConfig } from '@tamagui/core'\n\nimport { FAILED_EVAL } from '
|
|
4
|
+
"sourcesContent": ["import vm from 'vm'\n\nimport generate from '@babel/generator'\nimport { NodePath } from '@babel/traverse'\nimport * as t from '@babel/types'\nimport type { TamaguiConfig } from '@tamagui/core'\n\nimport { FAILED_EVAL } from '../constants'\nimport { evaluateAstNode } from './evaluateAstNode'\nimport { isValidThemeHook } from './extractHelpers'\n\nexport function createEvaluator({\n tamaguiConfig,\n staticNamespace,\n sourcePath,\n traversePath,\n shouldPrintDebug,\n}: {\n tamaguiConfig: TamaguiConfig\n staticNamespace: Record<string, any>\n sourcePath: string\n traversePath: NodePath<t.JSXElement>\n shouldPrintDebug: boolean\n}) {\n // called when evaluateAstNode encounters a dynamic-looking prop\n const evalFn = (n: t.Node) => {\n // themes\n if (\n t.isMemberExpression(n) &&\n t.isIdentifier(n.property) &&\n isValidThemeHook(traversePath, n, sourcePath)\n ) {\n const key = n.property.name\n if (shouldPrintDebug) {\n console.log(' > found theme prop', key)\n }\n console.log('SHOULD FIND THEME (NESTED NOW)', key) // tamaguiConfig.themes)\n // if (!themeKeys.has(key)) {\n // throw new Error(` > accessing non-existent theme key: ${key}`)\n // }\n return `var(--${key})`\n }\n // variable\n if (t.isIdentifier(n) && staticNamespace.hasOwnProperty(n.name)) {\n return staticNamespace[n.name]\n }\n const evalContext = vm.createContext(staticNamespace)\n const code = `(${generate(n as any).code})`\n // if (shouldPrintDebug) {\n // console.log('evaluating', { n, code, evalContext })\n // }\n return vm.runInContext(code, evalContext)\n }\n\n return (n: t.Node) => {\n return evaluateAstNode(n, evalFn)\n }\n}\n\nexport function createSafeEvaluator(attemptEval: (n: t.Node) => any) {\n return (n: t.Node) => {\n try {\n return attemptEval(n)\n } catch (err) {\n return FAILED_EVAL\n }\n }\n}\n"],
|
|
5
5
|
"mappings": ";;AAAA;AAEA;AAEA;AAGA;AACA;AACA;AAEO,yBAAyB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,GAOC;AAED,QAAM,SAAS,wBAAC,MAAc;AAE5B,QACE,EAAE,mBAAmB,MACrB,EAAE,aAAa,EAAE,aACjB,iBAAiB,cAAc,GAAG,aAClC;AACA,YAAM,MAAM,EAAE,SAAS;AACvB,UAAI,kBAAkB;AACpB,gBAAQ,IAAI,0BAA0B;AAAA;AAExC,cAAQ,IAAI,kCAAkC;AAI9C,aAAO,SAAS;AAAA;AAGlB,QAAI,EAAE,aAAa,MAAM,gBAAgB,eAAe,EAAE,OAAO;AAC/D,aAAO,gBAAgB,EAAE;AAAA;AAE3B,UAAM,cAAc,GAAG,cAAc;AACrC,UAAM,OAAO,IAAI,SAAS,GAAU;AAIpC,WAAO,GAAG,aAAa,MAAM;AAAA,KA1BhB;AA6Bf,SAAO,CAAC,MAAc;AACpB,WAAO,gBAAgB,GAAG;AAAA;AAAA;AA5Cd;AAgDT,6BAA6B,aAAiC;AACnE,SAAO,CAAC,MAAc;AACpB,QAAI;AACF,aAAO,YAAY;AAAA,aACZ,KAAP;AACA,aAAO;AAAA;AAAA;AAAA;AALG;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,9 +2,10 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
import traverse from "@babel/traverse";
|
|
4
4
|
import * as t from "@babel/types";
|
|
5
|
-
import
|
|
5
|
+
import { mediaQueryConfig, postProcessStyles, pseudos } from "@tamagui/core-node";
|
|
6
6
|
import { stylePropsTransform } from "@tamagui/helpers";
|
|
7
7
|
import { difference, pick } from "lodash";
|
|
8
|
+
import { FAILED_EVAL } from "../constants";
|
|
8
9
|
import { createEvaluator, createSafeEvaluator } from "./createEvaluator";
|
|
9
10
|
import { evaluateAstNode } from "./evaluateAstNode";
|
|
10
11
|
import { attrStr, findComponentName, isInsideTamagui, isPresent, objToStr } from "./extractHelpers";
|
|
@@ -15,8 +16,6 @@ import { loadTamagui } from "./loadTamagui";
|
|
|
15
16
|
import { logLines } from "./logLines";
|
|
16
17
|
import { normalizeTernaries } from "./normalizeTernaries";
|
|
17
18
|
import { removeUnusedHooks } from "./removeUnusedHooks";
|
|
18
|
-
const { mediaQueryConfig, postProcessStyles, pseudos } = CoreNode;
|
|
19
|
-
const FAILED_EVAL = Symbol("failed_style_eval");
|
|
20
19
|
const UNTOUCHED_PROPS = {
|
|
21
20
|
key: true,
|
|
22
21
|
style: true,
|
|
@@ -100,7 +99,7 @@ function createExtractor() {
|
|
|
100
99
|
return null;
|
|
101
100
|
}
|
|
102
101
|
let couldntParse = false;
|
|
103
|
-
const modifiedComponents = new Set();
|
|
102
|
+
const modifiedComponents = /* @__PURE__ */ new Set();
|
|
104
103
|
const bindingCache = {};
|
|
105
104
|
const callTraverse = /* @__PURE__ */ __name((a) => {
|
|
106
105
|
return fileOrPath.type === "File" ? traverse(fileOrPath, a) : fileOrPath.traverse(a);
|
|
@@ -178,7 +177,7 @@ function createExtractor() {
|
|
|
178
177
|
tagName = val.value;
|
|
179
178
|
});
|
|
180
179
|
const flatNode = getFlattenedNode({ isTextView, tag: tagName });
|
|
181
|
-
const deoptProps = new Set([
|
|
180
|
+
const deoptProps = /* @__PURE__ */ new Set([
|
|
182
181
|
...(_d = props.deoptProps) != null ? _d : [],
|
|
183
182
|
...(_e = staticConfig.deoptProps) != null ? _e : []
|
|
184
183
|
]);
|
|
@@ -281,6 +280,9 @@ function createExtractor() {
|
|
|
281
280
|
};
|
|
282
281
|
}
|
|
283
282
|
}).flat(4).filter(isPresent);
|
|
283
|
+
if (shouldPrintDebug) {
|
|
284
|
+
console.log(" - attrs (before):\n", logLines(attrs.map(attrStr).join(", ")));
|
|
285
|
+
}
|
|
284
286
|
function isStaticAttributeName(name) {
|
|
285
287
|
var _a2, _b2;
|
|
286
288
|
return !!(!!validStyles[name] || ((_a2 = staticConfig.validPropsExtra) == null ? void 0 : _a2[name]) || !!pseudos[name] || ((_b2 = staticConfig.variants) == null ? void 0 : _b2[name]) || tamaguiConfig.shorthands[name] || (name[0] === "$" ? !!mediaQueryConfig[name.slice(1)] : false));
|
|
@@ -582,9 +584,6 @@ function createExtractor() {
|
|
|
582
584
|
__name(getStaticLogical, "getStaticLogical");
|
|
583
585
|
}
|
|
584
586
|
__name(evaluateAttribute, "evaluateAttribute");
|
|
585
|
-
if (shouldPrintDebug) {
|
|
586
|
-
console.log(" - attrs (before):\n", logLines(attrs.map(attrStr).join(", ")));
|
|
587
|
-
}
|
|
588
587
|
node.attributes = attrs.filter(isAttr).map((x) => x.value);
|
|
589
588
|
if (couldntParse) {
|
|
590
589
|
if (shouldPrintDebug) {
|
|
@@ -683,10 +682,10 @@ function createExtractor() {
|
|
|
683
682
|
attrs = attrs.reduce((acc, cur) => {
|
|
684
683
|
if (cur.type !== "attr" || !t.isJSXAttribute(cur.value) || typeof cur.value.name.name !== "string") {
|
|
685
684
|
if (cur.type === "style") {
|
|
686
|
-
|
|
685
|
+
let key = Object.keys(cur.value)[0];
|
|
687
686
|
if (!validStyles[key] && !pseudos[key]) {
|
|
688
687
|
if (shouldPrintDebug) {
|
|
689
|
-
console.log("
|
|
688
|
+
console.log(" - ignoring (expanded already):", key);
|
|
690
689
|
}
|
|
691
690
|
return acc;
|
|
692
691
|
}
|
|
@@ -841,7 +840,6 @@ function createExtractor() {
|
|
|
841
840
|
}
|
|
842
841
|
__name(createExtractor, "createExtractor");
|
|
843
842
|
export {
|
|
844
|
-
FAILED_EVAL,
|
|
845
843
|
createExtractor
|
|
846
844
|
};
|
|
847
845
|
//# sourceMappingURL=createExtractor.js.map
|