@tamagui/static 1.89.26 → 1.89.27-1708113113238
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/constants.native.js +4 -4
- package/dist/cjs/constants.native.js.map +3 -3
- package/dist/cjs/extractor/accessSafe.native.js +1 -5
- package/dist/cjs/extractor/accessSafe.native.js.map +3 -3
- package/dist/cjs/extractor/babelParse.native.js +5 -8
- package/dist/cjs/extractor/babelParse.native.js.map +3 -3
- package/dist/cjs/extractor/buildClassName.native.js +31 -42
- package/dist/cjs/extractor/buildClassName.native.js.map +3 -3
- package/dist/cjs/extractor/bundle.js +6 -4
- package/dist/cjs/extractor/bundle.js.map +1 -1
- package/dist/cjs/extractor/bundle.native.js +321 -56
- package/dist/cjs/extractor/bundle.native.js.map +3 -3
- package/dist/cjs/extractor/bundleConfig.native.js +499 -187
- package/dist/cjs/extractor/bundleConfig.native.js.map +3 -3
- package/dist/cjs/extractor/createEvaluator.native.js +9 -11
- package/dist/cjs/extractor/createEvaluator.native.js.map +3 -3
- package/dist/cjs/extractor/createExtractor.native.js +1240 -906
- package/dist/cjs/extractor/createExtractor.native.js.map +3 -3
- package/dist/cjs/extractor/ensureImportingConcat.native.js +11 -17
- package/dist/cjs/extractor/ensureImportingConcat.native.js.map +3 -3
- package/dist/cjs/extractor/esbuildAliasPlugin.native.js +22 -11
- package/dist/cjs/extractor/esbuildAliasPlugin.native.js.map +3 -3
- package/dist/cjs/extractor/evaluateAstNode.native.js +15 -21
- package/dist/cjs/extractor/evaluateAstNode.native.js.map +3 -3
- package/dist/cjs/extractor/extractHelpers.native.js +146 -38
- package/dist/cjs/extractor/extractHelpers.native.js.map +3 -3
- package/dist/cjs/extractor/extractMediaStyle.native.js +127 -54
- package/dist/cjs/extractor/extractMediaStyle.native.js.map +3 -3
- package/dist/cjs/extractor/extractToClassNames.native.js +449 -252
- package/dist/cjs/extractor/extractToClassNames.native.js.map +3 -3
- package/dist/cjs/extractor/findTopmostFunction.native.js +4 -4
- package/dist/cjs/extractor/findTopmostFunction.native.js.map +3 -3
- package/dist/cjs/extractor/generateTamaguiStudioConfig.native.js +415 -54
- package/dist/cjs/extractor/generateTamaguiStudioConfig.native.js.map +3 -3
- package/dist/cjs/extractor/generatedUid.native.js +2 -2
- package/dist/cjs/extractor/generatedUid.native.js.map +3 -3
- package/dist/cjs/extractor/getPrefixLogs.native.js +2 -1
- package/dist/cjs/extractor/getPrefixLogs.native.js.map +3 -3
- package/dist/cjs/extractor/getPropValueFromAttributes.native.js +16 -19
- package/dist/cjs/extractor/getPropValueFromAttributes.native.js.map +3 -3
- package/dist/cjs/extractor/getSourceModule.native.js +20 -7
- package/dist/cjs/extractor/getSourceModule.native.js.map +3 -3
- package/dist/cjs/extractor/getStaticBindingsForScope.native.js +336 -94
- package/dist/cjs/extractor/getStaticBindingsForScope.native.js.map +3 -3
- package/dist/cjs/extractor/getTamaguiConfigPathFromOptionsConfig.native.js.map +3 -3
- package/dist/cjs/extractor/hoistClassNames.native.js +8 -10
- package/dist/cjs/extractor/hoistClassNames.native.js.map +3 -3
- package/dist/cjs/extractor/literalToAst.native.js +89 -19
- package/dist/cjs/extractor/literalToAst.native.js.map +3 -3
- package/dist/cjs/extractor/loadFile.native.js +16 -8
- package/dist/cjs/extractor/loadFile.native.js.map +3 -3
- package/dist/cjs/extractor/loadTamagui.js +3 -3
- package/dist/cjs/extractor/loadTamagui.js.map +1 -1
- package/dist/cjs/extractor/loadTamagui.native.js +667 -192
- package/dist/cjs/extractor/loadTamagui.native.js.map +3 -3
- package/dist/cjs/extractor/logLines.native.js +24 -6
- package/dist/cjs/extractor/logLines.native.js.map +3 -3
- package/dist/cjs/extractor/normalizeTernaries.native.js +71 -20
- package/dist/cjs/extractor/normalizeTernaries.native.js.map +3 -3
- package/dist/cjs/extractor/propsToFontFamilyCache.native.js +3 -3
- package/dist/cjs/extractor/propsToFontFamilyCache.native.js.map +3 -3
- package/dist/cjs/extractor/removeUnusedHooks.native.js +69 -36
- package/dist/cjs/extractor/removeUnusedHooks.native.js.map +3 -3
- package/dist/cjs/extractor/timer.native.js +10 -9
- package/dist/cjs/extractor/timer.native.js.map +3 -3
- package/dist/cjs/extractor/validHTMLAttributes.native.js +1 -1
- package/dist/cjs/extractor/validHTMLAttributes.native.js.map +3 -3
- package/dist/cjs/getPragmaOptions.native.js +4 -9
- package/dist/cjs/getPragmaOptions.native.js.map +3 -3
- package/dist/cjs/helpers/memoize.native.js +5 -3
- package/dist/cjs/helpers/memoize.native.js.map +3 -3
- package/dist/cjs/helpers/requireTamaguiCore.native.js +2 -1
- package/dist/cjs/helpers/requireTamaguiCore.native.js.map +3 -3
- package/dist/cjs/index.native.js.map +2 -2
- package/dist/cjs/minifyCSS.native.js.map +3 -3
- package/dist/cjs/registerRequire.native.js +56 -28
- package/dist/cjs/registerRequire.native.js.map +3 -3
- package/dist/cjs/server.native.js +175 -21
- package/dist/cjs/server.native.js.map +3 -3
- package/dist/cjs/setup.native.js.map +3 -3
- package/dist/cjs/static.native.js.map +2 -2
- package/dist/cjs/types.native.js.map +2 -2
- package/dist/cjs/webpackPlugin.native.js +26 -5
- package/dist/cjs/webpackPlugin.native.js.map +3 -3
- package/dist/esm/constants.native.js +4 -3
- package/dist/esm/constants.native.js.map +3 -3
- package/dist/esm/extractor/accessSafe.native.js +1 -5
- package/dist/esm/extractor/accessSafe.native.js.map +3 -3
- package/dist/esm/extractor/babelParse.native.js +5 -7
- package/dist/esm/extractor/babelParse.native.js.map +3 -3
- package/dist/esm/extractor/buildClassName.native.js +31 -41
- package/dist/esm/extractor/buildClassName.native.js.map +3 -3
- package/dist/esm/extractor/bundle.js +6 -4
- package/dist/esm/extractor/bundle.js.map +1 -1
- package/dist/esm/extractor/bundle.mjs +7 -5
- package/dist/esm/extractor/bundle.native.js +321 -56
- package/dist/esm/extractor/bundle.native.js.map +3 -3
- package/dist/esm/extractor/bundleConfig.native.js +499 -187
- package/dist/esm/extractor/bundleConfig.native.js.map +3 -3
- package/dist/esm/extractor/createEvaluator.native.js +9 -11
- package/dist/esm/extractor/createEvaluator.native.js.map +3 -3
- package/dist/esm/extractor/createExtractor.native.js +1241 -916
- package/dist/esm/extractor/createExtractor.native.js.map +3 -3
- package/dist/esm/extractor/ensureImportingConcat.native.js +11 -16
- package/dist/esm/extractor/ensureImportingConcat.native.js.map +3 -3
- package/dist/esm/extractor/esbuildAliasPlugin.native.js +22 -11
- package/dist/esm/extractor/esbuildAliasPlugin.native.js.map +3 -3
- package/dist/esm/extractor/evaluateAstNode.native.js +15 -21
- package/dist/esm/extractor/evaluateAstNode.native.js.map +3 -3
- package/dist/esm/extractor/extractHelpers.native.js +146 -38
- package/dist/esm/extractor/extractHelpers.native.js.map +3 -3
- package/dist/esm/extractor/extractMediaStyle.native.js +127 -54
- package/dist/esm/extractor/extractMediaStyle.native.js.map +3 -3
- package/dist/esm/extractor/extractToClassNames.native.js +449 -252
- package/dist/esm/extractor/extractToClassNames.native.js.map +3 -3
- package/dist/esm/extractor/findTopmostFunction.native.js +4 -4
- package/dist/esm/extractor/findTopmostFunction.native.js.map +3 -3
- package/dist/esm/extractor/generateTamaguiStudioConfig.native.js +415 -54
- package/dist/esm/extractor/generateTamaguiStudioConfig.native.js.map +3 -3
- package/dist/esm/extractor/generatedUid.native.js +2 -2
- package/dist/esm/extractor/generatedUid.native.js.map +3 -3
- package/dist/esm/extractor/getPrefixLogs.native.js +2 -1
- package/dist/esm/extractor/getPrefixLogs.native.js.map +3 -3
- package/dist/esm/extractor/getPropValueFromAttributes.native.js +16 -19
- package/dist/esm/extractor/getPropValueFromAttributes.native.js.map +3 -3
- package/dist/esm/extractor/getSourceModule.native.js +20 -7
- package/dist/esm/extractor/getSourceModule.native.js.map +3 -3
- package/dist/esm/extractor/getStaticBindingsForScope.native.js +336 -94
- package/dist/esm/extractor/getStaticBindingsForScope.native.js.map +3 -3
- package/dist/esm/extractor/getTamaguiConfigPathFromOptionsConfig.native.js.map +3 -3
- package/dist/esm/extractor/hoistClassNames.native.js +8 -10
- package/dist/esm/extractor/hoistClassNames.native.js.map +3 -3
- package/dist/esm/extractor/literalToAst.native.js +89 -19
- package/dist/esm/extractor/literalToAst.native.js.map +3 -3
- package/dist/esm/extractor/loadFile.native.js +16 -8
- package/dist/esm/extractor/loadFile.native.js.map +3 -3
- package/dist/esm/extractor/loadTamagui.js +1 -2
- package/dist/esm/extractor/loadTamagui.js.map +1 -1
- package/dist/esm/extractor/loadTamagui.mjs +5 -3
- package/dist/esm/extractor/loadTamagui.native.js +668 -203
- package/dist/esm/extractor/loadTamagui.native.js.map +3 -3
- package/dist/esm/extractor/logLines.native.js +24 -6
- package/dist/esm/extractor/logLines.native.js.map +3 -3
- package/dist/esm/extractor/normalizeTernaries.native.js +71 -20
- package/dist/esm/extractor/normalizeTernaries.native.js.map +3 -3
- package/dist/esm/extractor/propsToFontFamilyCache.native.js +3 -3
- package/dist/esm/extractor/propsToFontFamilyCache.native.js.map +3 -3
- package/dist/esm/extractor/removeUnusedHooks.native.js +69 -35
- package/dist/esm/extractor/removeUnusedHooks.native.js.map +3 -3
- package/dist/esm/extractor/timer.native.js +10 -9
- package/dist/esm/extractor/timer.native.js.map +3 -3
- package/dist/esm/extractor/validHTMLAttributes.native.js +1 -1
- package/dist/esm/extractor/validHTMLAttributes.native.js.map +3 -3
- package/dist/esm/getPragmaOptions.native.js +4 -9
- package/dist/esm/getPragmaOptions.native.js.map +3 -3
- package/dist/esm/helpers/memoize.native.js +5 -3
- package/dist/esm/helpers/memoize.native.js.map +3 -3
- package/dist/esm/helpers/requireTamaguiCore.native.js +2 -1
- package/dist/esm/helpers/requireTamaguiCore.native.js.map +3 -3
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/minifyCSS.native.js.map +3 -3
- package/dist/esm/registerRequire.native.js +56 -28
- package/dist/esm/registerRequire.native.js.map +3 -3
- package/dist/esm/server.native.js +175 -21
- package/dist/esm/server.native.js.map +3 -3
- package/dist/esm/setup.native.js.map +3 -3
- package/dist/esm/static.native.js.map +3 -3
- package/dist/esm/webpackPlugin.native.js +26 -5
- package/dist/esm/webpackPlugin.native.js.map +3 -3
- package/package.json +14 -15
- package/src/extractor/bundle.ts +5 -2
- package/src/extractor/loadTamagui.ts +3 -2
- package/types/extractor/bundle.d.ts.map +1 -1
- package/types/extractor/loadTamagui.d.ts.map +1 -1
- package/tamagui.tsconfig.json +0 -5
@@ -40,79 +40,187 @@ __export(extractHelpers_exports, {
|
|
40
40
|
});
|
41
41
|
module.exports = __toCommonJS(extractHelpers_exports);
|
42
42
|
var import_path = require("path"), import_generator = __toESM(require("@babel/generator")), t = __toESM(require("@babel/types")), import_find_root = __toESM(require("find-root")), import_memoize = require("../helpers/memoize");
|
43
|
+
function _array_like_to_array(arr, len) {
|
44
|
+
(len == null || len > arr.length) && (len = arr.length);
|
45
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
46
|
+
arr2[i] = arr[i];
|
47
|
+
return arr2;
|
48
|
+
}
|
49
|
+
function _array_with_holes(arr) {
|
50
|
+
if (Array.isArray(arr))
|
51
|
+
return arr;
|
52
|
+
}
|
53
|
+
function _array_without_holes(arr) {
|
54
|
+
if (Array.isArray(arr))
|
55
|
+
return _array_like_to_array(arr);
|
56
|
+
}
|
57
|
+
function _iterable_to_array(iter) {
|
58
|
+
if (typeof Symbol < "u" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
59
|
+
return Array.from(iter);
|
60
|
+
}
|
61
|
+
function _iterable_to_array_limit(arr, i) {
|
62
|
+
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
63
|
+
if (_i != null) {
|
64
|
+
var _arr = [], _n = !0, _d = !1, _s, _e;
|
65
|
+
try {
|
66
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
67
|
+
;
|
68
|
+
} catch (err) {
|
69
|
+
_d = !0, _e = err;
|
70
|
+
} finally {
|
71
|
+
try {
|
72
|
+
!_n && _i.return != null && _i.return();
|
73
|
+
} finally {
|
74
|
+
if (_d)
|
75
|
+
throw _e;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
return _arr;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
function _non_iterable_rest() {
|
82
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
83
|
+
}
|
84
|
+
function _non_iterable_spread() {
|
85
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
86
|
+
}
|
87
|
+
function _sliced_to_array(arr, i) {
|
88
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
89
|
+
}
|
90
|
+
function _to_consumable_array(arr) {
|
91
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
92
|
+
}
|
93
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
94
|
+
if (o) {
|
95
|
+
if (typeof o == "string")
|
96
|
+
return _array_like_to_array(o, minLen);
|
97
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
98
|
+
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set")
|
99
|
+
return Array.from(n);
|
100
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
101
|
+
return _array_like_to_array(o, minLen);
|
102
|
+
}
|
103
|
+
}
|
43
104
|
function isPresent(input) {
|
44
105
|
return input != null;
|
45
106
|
}
|
46
107
|
function isSimpleSpread(node) {
|
47
108
|
return t.isIdentifier(node.argument) || t.isMemberExpression(node.argument);
|
48
109
|
}
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
"
|
53
|
-
|
54
|
-
|
55
|
-
(
|
56
|
-
),
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
110
|
+
var attrStr = function(attr) {
|
111
|
+
return attr ? attr.type === "attr" ? getNameAttr(attr.value) : attr.type === "ternary" ? "...".concat(ternaryStr(attr.value)) : "".concat(attr.type, "(").concat(objToStr(attr.value), ")") : "";
|
112
|
+
}, objToStr = function(obj) {
|
113
|
+
var spacer = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ", ";
|
114
|
+
return obj ? "{".concat(Object.entries(obj).map(function(param) {
|
115
|
+
var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
|
116
|
+
return "".concat(k, ":").concat(Array.isArray(v) ? "[...]" : v && typeof v == "object" ? "".concat(objToStr(v, ",")) : JSON.stringify(v));
|
117
|
+
}).join(spacer), "}") : "".concat(obj);
|
118
|
+
}, getNameAttr = function(attr) {
|
119
|
+
return t.isJSXSpreadAttribute(attr) ? "...".concat(attr.argument.name) : "name" in attr ? attr.name.name : "unknown-".concat(attr.type);
|
120
|
+
}, ternaryStr = function(x) {
|
121
|
+
var conditional = t.isIdentifier(x.test) ? x.test.name : t.isMemberExpression(x.test) ? [
|
122
|
+
x.test.object.name,
|
123
|
+
x.test.property.name
|
124
|
+
] : (0, import_generator.default)(x.test).code;
|
125
|
+
return [
|
126
|
+
"ternary(",
|
127
|
+
conditional,
|
128
|
+
isFilledObj(x.consequent) ? " ? ".concat(objToStr(x.consequent)) : " ? \u{1F6AB}",
|
129
|
+
isFilledObj(x.alternate) ? " : ".concat(objToStr(x.alternate)) : " : \u{1F6AB}",
|
130
|
+
")"
|
131
|
+
].flat().join("");
|
132
|
+
}, isFilledObj = function(obj) {
|
133
|
+
return obj && Object.keys(obj).length;
|
134
|
+
};
|
61
135
|
function findComponentName(scope) {
|
62
|
-
var
|
63
|
-
const componentName = "";
|
64
|
-
let cur = scope.path;
|
65
|
-
for (; cur.parentPath && !t.isProgram(cur.parentPath.parent); )
|
136
|
+
for (var componentName = "", cur = scope.path; cur.parentPath && !t.isProgram(cur.parentPath.parent); )
|
66
137
|
cur = cur.parentPath;
|
67
|
-
|
138
|
+
var node = cur.parent;
|
68
139
|
if (t.isExportNamedDeclaration(node) && (node = node.declaration), t.isVariableDeclaration(node)) {
|
69
|
-
|
140
|
+
var _node_declarations = _sliced_to_array(node.declarations, 1), dec = _node_declarations[0];
|
70
141
|
if (t.isVariableDeclarator(dec) && t.isIdentifier(dec.id))
|
71
142
|
return dec.id.name;
|
72
143
|
}
|
73
|
-
|
144
|
+
if (t.isFunctionDeclaration(node)) {
|
145
|
+
var _node_id;
|
146
|
+
return (_node_id = node.id) === null || _node_id === void 0 ? void 0 : _node_id.name;
|
147
|
+
}
|
148
|
+
return componentName;
|
74
149
|
}
|
75
150
|
function isValidThemeHook(props, jsxPath, n, sourcePath) {
|
76
|
-
var
|
151
|
+
var _binding_scope_getBinding;
|
77
152
|
if (!t.isIdentifier(n.object) || !t.isIdentifier(n.property))
|
78
153
|
return !1;
|
79
|
-
|
154
|
+
var bindings = jsxPath.scope.getAllBindings(), binding = bindings[n.object.name];
|
80
155
|
if (!(binding != null && binding.path) || !binding.path.isVariableDeclarator())
|
81
156
|
return !1;
|
82
|
-
|
157
|
+
var init = binding.path.node.init;
|
83
158
|
if (!init || !t.isCallExpression(init) || !t.isIdentifier(init.callee) || init.callee.name !== "useTheme")
|
84
159
|
return !1;
|
85
|
-
|
160
|
+
var importNode = (_binding_scope_getBinding = binding.scope.getBinding("useTheme")) === null || _binding_scope_getBinding === void 0 ? void 0 : _binding_scope_getBinding.path.parent;
|
86
161
|
return !(!t.isImportDeclaration(importNode) || sourcePath && !isValidImport(props, sourcePath));
|
87
162
|
}
|
88
|
-
|
163
|
+
var isInsideComponentPackage = function(props, moduleName) {
|
164
|
+
return getValidComponentsPaths(props).some(function(path) {
|
165
|
+
return moduleName.startsWith(path);
|
166
|
+
});
|
167
|
+
}, isComponentPackage = function(props, srcName) {
|
168
|
+
return getValidComponentsPaths(props).some(function(path) {
|
169
|
+
return srcName.startsWith(path);
|
170
|
+
});
|
171
|
+
};
|
89
172
|
function getValidComponent(props, moduleName, componentName) {
|
90
173
|
if (componentName[0].toUpperCase() !== componentName[0])
|
91
174
|
return !1;
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
175
|
+
var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
176
|
+
try {
|
177
|
+
for (var _iterator = props.allLoadedComponents[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
178
|
+
var loaded = _step.value;
|
179
|
+
if (loaded) {
|
180
|
+
var isInModule = moduleName === "*" || moduleName.startsWith(loaded.moduleName), foundComponent = loaded.nameToInfo[componentName];
|
181
|
+
if (isInModule && foundComponent)
|
182
|
+
return foundComponent;
|
183
|
+
}
|
184
|
+
}
|
185
|
+
} catch (err) {
|
186
|
+
_didIteratorError = !0, _iteratorError = err;
|
187
|
+
} finally {
|
188
|
+
try {
|
189
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
190
|
+
} finally {
|
191
|
+
if (_didIteratorError)
|
192
|
+
throw _iteratorError;
|
193
|
+
}
|
98
194
|
}
|
99
195
|
return null;
|
100
196
|
}
|
101
|
-
|
197
|
+
var isValidModule = function(props, moduleName) {
|
102
198
|
if (typeof moduleName != "string")
|
103
199
|
throw new Error("No module name");
|
104
|
-
|
200
|
+
var isLocal = moduleName.startsWith(".");
|
105
201
|
return {
|
106
202
|
isLocal,
|
107
203
|
isValid: isLocal ? isInsideComponentPackage(props, moduleName) : isComponentPackage(props, moduleName)
|
108
204
|
};
|
109
|
-
}, getValidImport = (props, moduleName, componentName)
|
110
|
-
|
205
|
+
}, getValidImport = function(props, moduleName, componentName) {
|
206
|
+
var _isValidModule = isValidModule(props, moduleName), isValid = _isValidModule.isValid, isLocal = _isValidModule.isLocal;
|
111
207
|
return !isValid || !componentName ? null : getValidComponent(props, isLocal ? "*" : moduleName, componentName) || null;
|
112
|
-
}, isValidImport = (props, moduleName, componentName)
|
113
|
-
|
114
|
-
|
115
|
-
|
208
|
+
}, isValidImport = function(props, moduleName, componentName) {
|
209
|
+
return componentName ? !!getValidImport(props, moduleName, componentName) : isValidModule(props, moduleName).isValid;
|
210
|
+
}, getValidComponentPackages = (0, import_memoize.memoize)(function(props) {
|
211
|
+
return _to_consumable_array(new Set([
|
212
|
+
"@tamagui/core",
|
213
|
+
"tamagui"
|
214
|
+
].concat(_to_consumable_array(props.components))));
|
215
|
+
}), getValidComponentsPaths = (0, import_memoize.memoize)(function(props) {
|
216
|
+
return getValidComponentPackages(props).flatMap(function(pkg) {
|
217
|
+
var root = (0, import_find_root.default)(pkg), based = (0, import_path.basename)(root);
|
218
|
+
return [
|
219
|
+
based,
|
220
|
+
pkg
|
221
|
+
].filter(Boolean);
|
222
|
+
});
|
223
|
+
});
|
116
224
|
// Annotate the CommonJS export names for ESM import in node:
|
117
225
|
0 && (module.exports = {
|
118
226
|
attrStr,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
|
-
"sources": ["../../../src/extractor/extractHelpers.ts"],
|
4
|
-
"mappings": "
|
5
|
-
"names": ["generate", "findRoot"]
|
3
|
+
"sources": ["../../../src/extractor/Users/n8/tamagui/packages/static/src/extractor/extractHelpers.ts"],
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAAyB,iBAEzB,mBAAqB,sCAErB,IAAmB,kCACnB,mBAAqB,+BAErB,iBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKjB,SAASA,UACdC,OAAkC;AAElC,SAAOA,SAAS;AAClB;AAEO,SAASC,eAAeC,MAA0B;AACvD,SAAOC,EAAEC,aAAaF,KAAKG,QAAQ,KAAKF,EAAEG,mBAAmBJ,KAAKG,QAAQ;AAC5E;AAEO,IAAME,UAAU,SAACC,MAAAA;AACtB,SAAQA,OAEJA,KAAKC,SAAS,SACZC,YAAYF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C5B,OAAmCe,YAAAA;AAC/D,MAAI,OAAOA,cAAe;AACxB,UAAM,IAAIc,MAAO,gBAAA;AAEnB,MAAMC,UAAUf,WAAWG,WAAW,GAAA;AACtC,SAAO;IACLY;IACAC,SAASD,UACLhB,yBAAyBd,OAAOe,UAAAA,IAChCI,mBAAmBnB,OAAOe,UAAAA;EAChC;AACF,GAEaiB,iBAAiB,SAC5BhC,OACAe,YACA9B,eAAAA;AAEA,MAA6B2C,iBAAAA,cAAc5B,OAAOe,UAAAA,GAA1CgB,UAAqBH,eAArBG,SAASD,UAAYF,eAAZE;AACjB,SAAI,CAACC,WAAW,CAAC9C,gBACR,OAEFoC,kBAAkBrB,OAAO8B,UAAU,MAAMf,YAAY9B,aAAAA,KAAkB;AAChF,GAEa4B,gBAAgB,SAC3Bb,OACAe,YACA9B,eAAAA;AAEA,SAAKA,gBAGEgD,EAAQD,eAAehC,OAAOe,YAAY9B,aAAAA,IAFxC2C,cAAc5B,OAAOe,UAAAA,EAAYgB;AAG5C,GAEMG,gCAA4BC,wBAAQ,SAACnC,OAAAA;AAEzC,SAAQ,qBAAG,IAAIoC,IAAI;IAAC;IAAiB;IAAlB,OAA6B,qBAAGpC,MAAMqC,UAAU,CAAA,CAAA,CAAA;AACrE,CAAA,GAEarB,8BAA0BmB,wBAAQ,SAACnC,OAAAA;AAC9C,SAAOkC,0BAA0BlC,KAAAA,EAAOsC,QAAQ,SAACC,KAAAA;AAC/C,QAAMC,WAAOC,iBAAAA,SAASF,GAAAA,GAChBG,YAAQC,sBAASH,IAAAA;AACvB,WAAO;MAACE;MAAOH;MAAKK,OAAOX,OAAAA;EAC7B,CAAA;AACF,CAAA;",
|
5
|
+
"names": ["isPresent", "input", "isSimpleSpread", "node", "t", "isIdentifier", "argument", "isMemberExpression", "attrStr", "attr", "type", "getNameAttr", "value", "ternaryStr", "objToStr", "obj", "spacer", "Object", "entries", "map", "k", "v", "Array", "isArray", "JSON", "stringify", "join", "isJSXSpreadAttribute", "name", "x", "conditional", "test", "object", "property", "generate", "code", "isFilledObj", "consequent", "alternate", "flat", "keys", "length", "findComponentName", "scope", "componentName", "cur", "path", "parentPath", "isProgram", "parent", "isExportNamedDeclaration", "declaration", "isVariableDeclaration", "declarations", "dec", "isVariableDeclarator", "id", "isFunctionDeclaration", "isValidThemeHook", "props", "jsxPath", "n", "sourcePath", "binding", "bindings", "getAllBindings", "init", "isCallExpression", "callee", "importNode", "getBinding", "isImportDeclaration", "isValidImport", "isInsideComponentPackage", "moduleName", "getValidComponentsPaths", "some", "startsWith", "isComponentPackage", "srcName", "getValidComponent", "toUpperCase", "allLoadedComponents", "loaded", "isInModule", "foundComponent", "nameToInfo", "isValidModule", "Error", "isLocal", "isValid", "getValidImport", "Boolean", "getValidComponentPackages", "memoize", "Set", "components", "flatMap", "pkg", "root", "findRoot", "based", "basename", "filter"]
|
6
6
|
}
|
@@ -28,95 +28,168 @@ __export(extractMediaStyle_exports, {
|
|
28
28
|
});
|
29
29
|
module.exports = __toCommonJS(extractMediaStyle_exports);
|
30
30
|
var t = __toESM(require("@babel/types")), import_core = require("@tamagui/core"), import_requireTamaguiCore = require("../helpers/requireTamaguiCore"), import_extractHelpers = require("./extractHelpers");
|
31
|
-
function
|
32
|
-
|
31
|
+
function _array_like_to_array(arr, len) {
|
32
|
+
(len == null || len > arr.length) && (len = arr.length);
|
33
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
34
|
+
arr2[i] = arr[i];
|
35
|
+
return arr2;
|
36
|
+
}
|
37
|
+
function _array_without_holes(arr) {
|
38
|
+
if (Array.isArray(arr))
|
39
|
+
return _array_like_to_array(arr);
|
40
|
+
}
|
41
|
+
function _define_property(obj, key, value) {
|
42
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
43
|
+
value,
|
44
|
+
enumerable: !0,
|
45
|
+
configurable: !0,
|
46
|
+
writable: !0
|
47
|
+
}) : obj[key] = value, obj;
|
48
|
+
}
|
49
|
+
function _iterable_to_array(iter) {
|
50
|
+
if (typeof Symbol < "u" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
51
|
+
return Array.from(iter);
|
52
|
+
}
|
53
|
+
function _non_iterable_spread() {
|
54
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
55
|
+
}
|
56
|
+
function _object_spread(target) {
|
57
|
+
for (var i = 1; i < arguments.length; i++) {
|
58
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
59
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
60
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
61
|
+
}))), ownKeys2.forEach(function(key) {
|
62
|
+
_define_property(target, key, source[key]);
|
63
|
+
});
|
64
|
+
}
|
65
|
+
return target;
|
66
|
+
}
|
67
|
+
function ownKeys(object, enumerableOnly) {
|
68
|
+
var keys = Object.keys(object);
|
69
|
+
if (Object.getOwnPropertySymbols) {
|
70
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
71
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
72
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
73
|
+
})), keys.push.apply(keys, symbols);
|
74
|
+
}
|
75
|
+
return keys;
|
76
|
+
}
|
77
|
+
function _object_spread_props(target, source) {
|
78
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
79
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
80
|
+
}), target;
|
81
|
+
}
|
82
|
+
function _to_consumable_array(arr) {
|
83
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
84
|
+
}
|
85
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
86
|
+
if (o) {
|
87
|
+
if (typeof o == "string")
|
88
|
+
return _array_like_to_array(o, minLen);
|
89
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
90
|
+
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set")
|
91
|
+
return Array.from(n);
|
92
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
93
|
+
return _array_like_to_array(o, minLen);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
function extractMediaStyle(props, ternary, jsxPath, tamaguiConfig, sourcePath) {
|
97
|
+
var importance = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0, shouldPrintDebug = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : !1, _requireTamaguiCore = (0, import_requireTamaguiCore.requireTamaguiCore)("web"), getStylesAtomic = _requireTamaguiCore.getStylesAtomic, mediaObjectToString = _requireTamaguiCore.mediaObjectToString, mt = getMediaQueryTernary(props, ternary, jsxPath, sourcePath);
|
33
98
|
if (!mt)
|
34
99
|
return null;
|
35
|
-
|
36
|
-
if (!
|
37
|
-
return console.error(
|
38
|
-
|
100
|
+
var key = mt.key, mq = tamaguiConfig.media[key];
|
101
|
+
if (!mq)
|
102
|
+
return console.error('Media query "'.concat(key, '" not found: ').concat(Object.keys(tamaguiConfig.media))), null;
|
103
|
+
var getStyleObj = function(styleObj) {
|
104
|
+
var negate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
|
105
|
+
return styleObj ? {
|
106
|
+
styleObj,
|
107
|
+
negate
|
108
|
+
} : null;
|
109
|
+
}, styleOpts = [
|
39
110
|
getStyleObj(ternary.consequent, !1),
|
40
111
|
getStyleObj(ternary.alternate, !0)
|
41
112
|
].filter(import_extractHelpers.isPresent);
|
42
113
|
if (shouldPrintDebug && !styleOpts.length)
|
43
114
|
return console.info(" media query, no styles?"), null;
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
" media styles:",
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
115
|
+
var mediaKeys = Object.keys(tamaguiConfig.media), mediaKeyPrecendence = mediaKeys.reduce(function(acc, cur, i) {
|
116
|
+
return acc[cur] = new Array(importance + 1).fill(":root").join(""), acc;
|
117
|
+
}, {}), mediaStyles = [], _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
118
|
+
try {
|
119
|
+
for (var _loop = function() {
|
120
|
+
var _step_value = _step.value, styleObj = _step_value.styleObj, negate = _step_value.negate, styles = getStylesAtomic(styleObj), singleMediaStyles = styles.map(function(style) {
|
121
|
+
var mediaStyle = (0, import_core.createMediaStyle)(style, key, tamaguiConfig.media, !0, negate), className = ".".concat(mediaStyle.identifier);
|
122
|
+
return _object_spread_props(_object_spread({}, mediaStyle), {
|
123
|
+
className
|
124
|
+
});
|
125
|
+
});
|
126
|
+
shouldPrintDebug === "verbose" && console.info(" media styles:", importance, styleObj, singleMediaStyles.map(function(x) {
|
127
|
+
return x.identifier;
|
128
|
+
}).join(", ")), mediaStyles = _to_consumable_array(mediaStyles).concat(_to_consumable_array(singleMediaStyles));
|
129
|
+
}, _iterator = styleOpts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0)
|
130
|
+
_loop();
|
131
|
+
} catch (err) {
|
132
|
+
_didIteratorError = !0, _iteratorError = err;
|
133
|
+
} finally {
|
134
|
+
try {
|
135
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
136
|
+
} finally {
|
137
|
+
if (_didIteratorError)
|
138
|
+
throw _iteratorError;
|
139
|
+
}
|
60
140
|
}
|
61
|
-
return ternary.remove(), {
|
141
|
+
return ternary.remove(), {
|
142
|
+
mediaStyles,
|
143
|
+
ternaryWithoutMedia: mt.ternaryWithoutMedia
|
144
|
+
};
|
62
145
|
}
|
63
146
|
function getMediaQueryTernary(props, ternary, jsxPath, sourcePath) {
|
64
147
|
if (t.isLogicalExpression(ternary.test) && ternary.test.operator === "&&") {
|
65
|
-
|
66
|
-
props,
|
67
|
-
ternary.test.left,
|
68
|
-
jsxPath,
|
69
|
-
sourcePath,
|
70
|
-
ternary.inlineMediaQuery
|
71
|
-
);
|
148
|
+
var mediaLeft = getMediaInfoFromExpression(props, ternary.test.left, jsxPath, sourcePath, ternary.inlineMediaQuery);
|
72
149
|
if (mediaLeft)
|
73
|
-
return {
|
74
|
-
|
75
|
-
ternaryWithoutMedia: {
|
76
|
-
...ternary,
|
150
|
+
return _object_spread_props(_object_spread({}, mediaLeft), {
|
151
|
+
ternaryWithoutMedia: _object_spread_props(_object_spread({}, ternary), {
|
77
152
|
test: ternary.test.right
|
78
|
-
}
|
79
|
-
};
|
153
|
+
})
|
154
|
+
});
|
80
155
|
}
|
81
|
-
|
82
|
-
|
83
|
-
ternary.test,
|
84
|
-
jsxPath,
|
85
|
-
sourcePath,
|
86
|
-
ternary.inlineMediaQuery
|
87
|
-
);
|
88
|
-
return result ? {
|
89
|
-
...result,
|
156
|
+
var result = getMediaInfoFromExpression(props, ternary.test, jsxPath, sourcePath, ternary.inlineMediaQuery);
|
157
|
+
return result ? _object_spread_props(_object_spread({}, result), {
|
90
158
|
ternaryWithoutMedia: null
|
91
|
-
} : null;
|
159
|
+
}) : null;
|
92
160
|
}
|
93
161
|
function getMediaInfoFromExpression(props, test, jsxPath, sourcePath, inlineMediaQuery) {
|
94
|
-
var _a, _b, _c;
|
95
162
|
if (inlineMediaQuery)
|
96
163
|
return {
|
97
164
|
key: inlineMediaQuery,
|
98
165
|
bindingName: inlineMediaQuery
|
99
166
|
};
|
100
167
|
if (t.isMemberExpression(test) && t.isIdentifier(test.object) && t.isIdentifier(test.property)) {
|
101
|
-
|
168
|
+
var _binding_path, name = test.object.name, key = test.property.name, bindings = jsxPath.scope.getAllBindings(), binding = bindings[name];
|
102
169
|
if (!binding)
|
103
170
|
return !1;
|
104
|
-
|
105
|
-
return !t.isVariableDeclarator(bindingNode) || !bindingNode.init || !isValidMediaCall(props, jsxPath, bindingNode.init, sourcePath) ? !1 : {
|
171
|
+
var bindingNode = (_binding_path = binding.path) === null || _binding_path === void 0 ? void 0 : _binding_path.node;
|
172
|
+
return !t.isVariableDeclarator(bindingNode) || !bindingNode.init || !isValidMediaCall(props, jsxPath, bindingNode.init, sourcePath) ? !1 : {
|
173
|
+
key,
|
174
|
+
bindingName: name
|
175
|
+
};
|
106
176
|
}
|
107
177
|
if (t.isIdentifier(test)) {
|
108
|
-
|
109
|
-
return !t.isVariableDeclarator(node) || !node.init || !isValidMediaCall(props, jsxPath, node.init, sourcePath) ? !1 : {
|
178
|
+
var _jsxPath_scope_getBinding_path, _jsxPath_scope_getBinding, key1 = test.name, node = (_jsxPath_scope_getBinding = jsxPath.scope.getBinding(test.name)) === null || _jsxPath_scope_getBinding === void 0 || (_jsxPath_scope_getBinding_path = _jsxPath_scope_getBinding.path) === null || _jsxPath_scope_getBinding_path === void 0 ? void 0 : _jsxPath_scope_getBinding_path.node;
|
179
|
+
return !t.isVariableDeclarator(node) || !node.init || !isValidMediaCall(props, jsxPath, node.init, sourcePath) ? !1 : {
|
180
|
+
key: key1,
|
181
|
+
bindingName: key1
|
182
|
+
};
|
110
183
|
}
|
111
184
|
return null;
|
112
185
|
}
|
113
186
|
function isValidMediaCall(props, jsxPath, init, sourcePath) {
|
114
187
|
if (!init || !t.isCallExpression(init) || !t.isIdentifier(init.callee) || init.callee.name !== "useMedia")
|
115
188
|
return !1;
|
116
|
-
|
189
|
+
var bindings = jsxPath.scope.getAllBindings(), mediaBinding = bindings.useMedia;
|
117
190
|
if (!mediaBinding)
|
118
191
|
return !1;
|
119
|
-
|
192
|
+
var useMediaImport = mediaBinding.path.parent;
|
120
193
|
return !(!t.isImportDeclaration(useMediaImport) || !(0, import_extractHelpers.isValidImport)(props, sourcePath));
|
121
194
|
}
|
122
195
|
// Annotate the CommonJS export names for ESM import in node:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
|
-
"sources": ["../../../src/extractor/extractMediaStyle.ts"],
|
4
|
-
"mappings": "
|
5
|
-
"names": []
|
3
|
+
"sources": ["../../../src/extractor/Users/n8/tamagui/packages/static/src/extractor/extractMediaStyle.ts"],
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,QAAmB,kCAEnB,cAAiC,0BAGjC,4BAAmC,0CAEnC,wBAAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElC,SAASA,kBACdC,OACAC,SACAC,SACAC,eACAC,YAAkB;MAClBC,aAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAAa,GACbC,mBAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAAwC,IAESC,0BAAAA,8CAAmB,KAAA,GAA5DC,kBAAyCD,oBAAzCC,iBAAiBC,sBAAwBF,oBAAxBE,qBACnBC,KAAKC,qBAAqBX,OAAOC,SAASC,SAASE,UAAAA;AACzD,MAAI,CAACM;AACH,WAAO;AAET,MAAQE,MAAQF,GAARE,KACFC,KAAKV,cAAcW,MAAMF,GAAAA;AAC/B,MAAI,CAACC;AACHE,mBAAQC,MAAO,gBAAkCC,OAAnBL,KAAI,eAAA,EAAgD,OAAjCK,OAAOC,KAAKf,cAAcW,KAAK,CAAA,CAAA,GACzE;AAET,MAAMK,cAAc,SAACC,UAAAA;QAA4BC,SAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAAS;AACxD,WAAOD,WAAW;MAAEA;MAAUC;IAAO,IAAI;EAC3C,GACMC,YAAY;IAChBH,YAAYlB,QAAQsB,YAAY,EAAA;IAChCJ,YAAYlB,QAA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IAAAA,GAAO;QAEXlD,gCAAAA,2BADPU,OAAMwC,KAAKc,MACXM,QAAOtE,4BAAAA,QAAQkE,MAAMQ,WAAWxB,KAAKc,IAAI,OAAA,QAAlChE,8BAAAA,WAAAA,iCAAAA,0BAAqCqE,UAAI,QAAzCrE,mCAAAA,SAAAA,SAAAA,+BAA2CsE;AAExD,WADI,CAACtB,EAAEuB,qBAAqBD,IAAAA,KACxB,CAACA,KAAKE,QAAQ,CAACC,iBAAiB3E,OAAOE,SAASsE,KAAKE,MAAMtE,UAAAA,IACtD,KACF;MAAEQ,KAAAA;MAAKgD,aAAahD;IAAI;EACjC;AACA,SAAO;AACT;AAEO,SAAS+D,iBACd3E,OACAE,SACAwE,MACAtE,YAAkB;AAKlB,MAHI,CAACsE,QAAQ,CAACxB,EAAE2B,iBAAiBH,IAAAA,KAC7B,CAACxB,EAAEY,aAAaY,KAAKI,MAAM,KAE3BJ,KAAKI,OAAOZ,SAAS;AAAY,WAAO;AAC5C,MAAMC,WAAWjE,QAAQkE,MAAMC,eAAc,GACvCU,eAAeZ,SAAS;AAC9B,MAAI,CAACY;AAAc,WAAO;AAC1B,MAAMC,iBAAiBD,aAAaR,KAAKU;AAEzC,SADI,GAAC/B,EAAEgC,oBAAoBF,cAAAA,KACvB,KAACG,qCAAcnF,OAAOI,UAAAA;AAI5B;",
|
5
|
+
"names": ["extractMediaStyle", "props", "ternary", "jsxPath", "tamaguiConfig", "sourcePath", "importance", "shouldPrintDebug", "requireTamaguiCore", "getStylesAtomic", "mediaObjectToString", "mt", "getMediaQueryTernary", "key", "mq", "media", "console", "error", "Object", "keys", "getStyleObj", "styleObj", "negate", "styleOpts", "consequent", "alternate", "filter", "isPresent", "length", "info", "mediaKeys", "mediaKeyPrecendence", "reduce", "acc", "cur", "i", "Array", "fill", "join", "mediaStyles", "styles", "singleMediaStyles", "map", "style", "mediaStyle", "createMediaStyle", "className", "identifier", "x", "remove", "ternaryWithoutMedia", "t", "isLogicalExpression", "test", "operator", "mediaLeft", "getMediaInfoFromExpression", "left", "inlineMediaQuery", "right", "result", "bindingName", "isMemberExpression", "isIdentifier", "object", "property", "binding", "name", "bindings", "scope", "getAllBindings", "bindingNode", "path", "node", "isVariableDeclarator", "init", "isValidMediaCall", "getBinding", "isCallExpression", "callee", "mediaBinding", "useMediaImport", "parent", "isImportDeclaration", "isValidImport"]
|
6
6
|
}
|