@tamagui/static 1.100.6 → 1.101.1

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.
Files changed (63) hide show
  1. package/dist/cjs/extractor/createExtractor.js +21 -12
  2. package/dist/cjs/extractor/createExtractor.js.map +1 -1
  3. package/dist/cjs/extractor/createExtractor.native.js +18 -12
  4. package/dist/cjs/extractor/createExtractor.native.js.map +2 -2
  5. package/dist/cjs/extractor/extractMediaStyle.js +2 -2
  6. package/dist/cjs/extractor/extractMediaStyle.js.map +1 -1
  7. package/dist/cjs/extractor/extractMediaStyle.native.js +2 -2
  8. package/dist/cjs/extractor/extractMediaStyle.native.js.map +2 -2
  9. package/dist/cjs/extractor/extractToClassNames.js +17 -15
  10. package/dist/cjs/extractor/extractToClassNames.js.map +1 -1
  11. package/dist/cjs/extractor/extractToClassNames.native.js +12 -14
  12. package/dist/cjs/extractor/extractToClassNames.native.js.map +2 -2
  13. package/dist/cjs/extractor/extractToNative.js +319 -0
  14. package/dist/cjs/extractor/extractToNative.js.map +6 -0
  15. package/dist/cjs/extractor/extractToNative.native.js +353 -0
  16. package/dist/cjs/extractor/extractToNative.native.js.map +6 -0
  17. package/dist/cjs/index.js +1 -0
  18. package/dist/cjs/index.js.map +1 -1
  19. package/dist/cjs/index.native.js +2 -0
  20. package/dist/cjs/index.native.js.map +1 -1
  21. package/dist/esm/extractor/createExtractor.js +24 -11
  22. package/dist/esm/extractor/createExtractor.js.map +1 -1
  23. package/dist/esm/extractor/createExtractor.mjs +16 -12
  24. package/dist/esm/extractor/createExtractor.native.js +18 -11
  25. package/dist/esm/extractor/createExtractor.native.js.map +2 -2
  26. package/dist/esm/extractor/extractMediaStyle.js +2 -2
  27. package/dist/esm/extractor/extractMediaStyle.js.map +1 -1
  28. package/dist/esm/extractor/extractMediaStyle.mjs +2 -2
  29. package/dist/esm/extractor/extractMediaStyle.native.js +2 -2
  30. package/dist/esm/extractor/extractMediaStyle.native.js.map +2 -2
  31. package/dist/esm/extractor/extractToClassNames.js +16 -15
  32. package/dist/esm/extractor/extractToClassNames.js.map +1 -1
  33. package/dist/esm/extractor/extractToClassNames.mjs +14 -16
  34. package/dist/esm/extractor/extractToClassNames.native.js +11 -14
  35. package/dist/esm/extractor/extractToClassNames.native.js.map +2 -2
  36. package/dist/esm/extractor/extractToNative.js +309 -0
  37. package/dist/esm/extractor/extractToNative.js.map +6 -0
  38. package/dist/esm/extractor/extractToNative.mjs +232 -0
  39. package/dist/esm/extractor/extractToNative.native.js +329 -0
  40. package/dist/esm/extractor/extractToNative.native.js.map +6 -0
  41. package/dist/esm/index.js +1 -0
  42. package/dist/esm/index.js.map +1 -1
  43. package/dist/esm/index.mjs +1 -0
  44. package/dist/esm/index.native.js +1 -0
  45. package/dist/esm/index.native.js.map +1 -1
  46. package/package.json +16 -15
  47. package/src/extractor/createExtractor.ts +23 -22
  48. package/src/extractor/extractMediaStyle.ts +2 -2
  49. package/src/extractor/extractToClassNames.ts +30 -16
  50. package/src/extractor/extractToNative.ts +504 -0
  51. package/src/index.ts +1 -0
  52. package/types/extractor/babelParse.d.ts +0 -1
  53. package/types/extractor/babelParse.d.ts.map +1 -1
  54. package/types/extractor/createEvaluator.d.ts.map +1 -1
  55. package/types/extractor/createExtractor.d.ts.map +1 -1
  56. package/types/extractor/extractToClassNames.d.ts +0 -1
  57. package/types/extractor/extractToClassNames.d.ts.map +1 -1
  58. package/types/extractor/extractToNative.d.ts +13 -0
  59. package/types/extractor/extractToNative.d.ts.map +1 -0
  60. package/types/extractor/getStaticBindingsForScope.d.ts.map +1 -1
  61. package/types/extractor/loadTamagui.d.ts.map +1 -1
  62. package/types/index.d.ts +1 -0
  63. package/types/index.d.ts.map +1 -1
@@ -0,0 +1,329 @@
1
+ import { basename } from "node:path";
2
+ import { transformFromAstSync } from "@babel/core";
3
+ import generator from "@babel/generator";
4
+ import { declare } from "@babel/helper-plugin-utils";
5
+ import { parse } from "@babel/parser";
6
+ import template from "@babel/template";
7
+ import * as t from "@babel/types";
8
+ import { createExtractor, createLogger, getPragmaOptions, isSimpleSpread, literalToAst, loadTamaguiBuildConfigSync } from "@tamagui/static";
9
+ function _array_like_to_array(arr, len) {
10
+ (len == null || len > arr.length) && (len = arr.length);
11
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
12
+ return arr2;
13
+ }
14
+ function _array_without_holes(arr) {
15
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
16
+ }
17
+ function _define_property(obj, key, value) {
18
+ return key in obj ? Object.defineProperty(obj, key, {
19
+ value,
20
+ enumerable: !0,
21
+ configurable: !0,
22
+ writable: !0
23
+ }) : obj[key] = value, obj;
24
+ }
25
+ function _instanceof(left, right) {
26
+ return right != null && typeof Symbol < "u" && right[Symbol.hasInstance] ? !!right[Symbol.hasInstance](left) : left instanceof right;
27
+ }
28
+ function _iterable_to_array(iter) {
29
+ if (typeof Symbol < "u" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
30
+ }
31
+ function _non_iterable_spread() {
32
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
33
+ }
34
+ function _object_spread(target) {
35
+ for (var i = 1; i < arguments.length; i++) {
36
+ var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
37
+ typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
38
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
39
+ }))), ownKeys2.forEach(function(key) {
40
+ _define_property(target, key, source[key]);
41
+ });
42
+ }
43
+ return target;
44
+ }
45
+ function ownKeys(object, enumerableOnly) {
46
+ var keys = Object.keys(object);
47
+ if (Object.getOwnPropertySymbols) {
48
+ var symbols = Object.getOwnPropertySymbols(object);
49
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
50
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
51
+ })), keys.push.apply(keys, symbols);
52
+ }
53
+ return keys;
54
+ }
55
+ function _object_spread_props(target, source) {
56
+ return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
57
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
58
+ }), target;
59
+ }
60
+ function _to_consumable_array(arr) {
61
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
62
+ }
63
+ function _unsupported_iterable_to_array(o, minLen) {
64
+ if (o) {
65
+ if (typeof o == "string") return _array_like_to_array(o, minLen);
66
+ var n = Object.prototype.toString.call(o).slice(8, -1);
67
+ if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(n);
68
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
69
+ }
70
+ }
71
+ var importNativeView = template(`
72
+ const __ReactNativeView = require('react-native').View;
73
+ const __ReactNativeText = require('react-native').Text;
74
+ `), importStyleSheet = template(`
75
+ const __ReactNativeStyleSheet = require('react-native').StyleSheet;
76
+ `), importWithStyle = template(`
77
+ const __withStableStyle = require('@tamagui/core')._withStableStyle;
78
+ `), extractor = createExtractor({
79
+ platform: "native"
80
+ }), tamaguiBuildOptionsLoaded;
81
+ function extractToNative(sourceFileName, sourceCode, options) {
82
+ var ast = parse(sourceCode, {
83
+ sourceType: "module",
84
+ plugins: [
85
+ "jsx",
86
+ "typescript"
87
+ ]
88
+ }), babelPlugin = getBabelPlugin(), out = transformFromAstSync(ast, sourceCode, {
89
+ plugins: [
90
+ [
91
+ babelPlugin,
92
+ options
93
+ ]
94
+ ],
95
+ configFile: !1,
96
+ sourceFileName,
97
+ filename: sourceFileName
98
+ });
99
+ if (!out)
100
+ throw new Error("No output returned");
101
+ return out;
102
+ }
103
+ function getBabelPlugin() {
104
+ return declare(function(api, options) {
105
+ return api.assertVersion(7), getBabelParseDefinition(options);
106
+ });
107
+ }
108
+ function getBabelParseDefinition(options) {
109
+ return {
110
+ name: "tamagui",
111
+ visitor: {
112
+ Program: {
113
+ enter: function(root) {
114
+ var _process_env_SOURCE_ROOT, _root_node_body__leadingComments, _root_node_body_, sourcePath = this.file.opts.filename;
115
+ if (sourcePath != null && sourcePath.includes("node_modules") || !(sourcePath != null && sourcePath.endsWith(".jsx")) && !(sourcePath != null && sourcePath.endsWith(".tsx")))
116
+ return;
117
+ !((_process_env_SOURCE_ROOT = process.env.SOURCE_ROOT) === null || _process_env_SOURCE_ROOT === void 0) && _process_env_SOURCE_ROOT.endsWith("ios") && (sourcePath = sourcePath.replace("/ios", ""));
118
+ var hasImportedView = !1, hasImportedViewWrapper = !1, sheetStyles = {}, sheetIdentifier = root.scope.generateUidIdentifier("sheet"), _root_node_body__leadingComments_map_join, firstCommentContents = (_root_node_body__leadingComments_map_join = (_root_node_body_ = root.node.body[0]) === null || _root_node_body_ === void 0 || (_root_node_body__leadingComments = _root_node_body_.leadingComments) === null || _root_node_body__leadingComments === void 0 ? void 0 : _root_node_body__leadingComments.map(function(comment) {
119
+ return (comment == null ? void 0 : comment.value) || " ";
120
+ }).join(" ")) !== null && _root_node_body__leadingComments_map_join !== void 0 ? _root_node_body__leadingComments_map_join : "", firstComment = firstCommentContents ? "//".concat(firstCommentContents) : "", _getPragmaOptions = getPragmaOptions({
121
+ source: firstComment,
122
+ path: sourcePath
123
+ }), shouldPrintDebug = _getPragmaOptions.shouldPrintDebug, shouldDisable = _getPragmaOptions.shouldDisable;
124
+ if (shouldDisable)
125
+ return;
126
+ !options.config && !options.components && (tamaguiBuildOptionsLoaded || (tamaguiBuildOptionsLoaded = loadTamaguiBuildConfigSync({})));
127
+ var finalOptions = _object_spread({
128
+ // @ts-ignore just in case they leave it out
129
+ platform: "native"
130
+ }, tamaguiBuildOptionsLoaded, options), printLog = createLogger(sourcePath, finalOptions);
131
+ function addSheetStyle(style, node) {
132
+ var styleIndex = "".concat(Object.keys(sheetStyles).length), key = "".concat(styleIndex);
133
+ if (process.env.NODE_ENV === "development") {
134
+ var lineNumbers = node.loc ? node.loc.start.line + (node.loc.start.line !== node.loc.end.line ? "-".concat(node.loc.end.line) : "") : "";
135
+ key += ":".concat(basename(sourcePath), ":").concat(lineNumbers);
136
+ }
137
+ return sheetStyles[key] = style, readStyleExpr(key);
138
+ }
139
+ function readStyleExpr(key) {
140
+ return template("SHEET['KEY']")({
141
+ SHEET: sheetIdentifier.name,
142
+ KEY: key
143
+ }).expression;
144
+ }
145
+ var res;
146
+ try {
147
+ res = extractor.parseSync(root, _object_spread_props(_object_spread({
148
+ importsWhitelist: [
149
+ "constants.js",
150
+ "colors.js"
151
+ ],
152
+ extractStyledDefinitions: options.forceExtractStyleDefinitions,
153
+ excludeProps: /* @__PURE__ */ new Set([
154
+ "className",
155
+ "userSelect",
156
+ "whiteSpace",
157
+ "textOverflow",
158
+ "cursor",
159
+ "contain"
160
+ ]),
161
+ shouldPrintDebug
162
+ }, finalOptions), {
163
+ // disable this extraction for now at least, need to figure out merging theme vs non-theme
164
+ // because theme need to stay in render(), whereas non-theme can be extracted
165
+ // for now just turn it off entirely at a small perf loss
166
+ disableExtractInlineMedia: !0,
167
+ // disable extracting variables as no native concept of them (only theme values)
168
+ disableExtractVariables: options.experimentalFlattenThemesOnNative ? !1 : "theme",
169
+ sourcePath,
170
+ // disabling flattening for now
171
+ // it's flattening a plain <Paragraph>hello</Paragraph> which breaks things because themes
172
+ // thinking it's not really worth the effort to do much compilation on native
173
+ // for now just disable flatten as it can only run in narrow places on native
174
+ // disableFlattening: 'styled',
175
+ getFlattenedNode: function(param) {
176
+ var isTextView = param.isTextView;
177
+ return hasImportedView || (hasImportedView = !0, root.unshiftContainer("body", importNativeView())), isTextView ? "__ReactNativeText" : "__ReactNativeView";
178
+ },
179
+ onExtractTag: function(props) {
180
+ var isFlattened = props.isFlattened;
181
+ if (!isFlattened)
182
+ return;
183
+ assertValidTag(props.node);
184
+ var stylesExpr = t.arrayExpression([]), hocStylesExpr = t.arrayExpression([]), expressions = [], finalAttrs = [], themeKeysUsed = /* @__PURE__ */ new Set();
185
+ function getStyleExpression(style) {
186
+ if (style) {
187
+ var _splitThemeStyles = splitThemeStyles(style), plain = _splitThemeStyles.plain, themed = _splitThemeStyles.themed, themeExpr = null;
188
+ if (themed && options.experimentalFlattenThemesOnNative) {
189
+ for (var key in themed)
190
+ themeKeysUsed.add(themed[key].split("$")[1]);
191
+ themeExpr = getThemedStyleExpression(themed);
192
+ }
193
+ var ident = addSheetStyle(plain, props.node);
194
+ return themeExpr ? (addStyleExpression(ident), addStyleExpression(ident, !0), themeExpr) : ident;
195
+ }
196
+ }
197
+ function addStyleExpression(expr) {
198
+ var HOC = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
199
+ if (Array.isArray(expr)) {
200
+ var _elements;
201
+ (_elements = (HOC ? hocStylesExpr : stylesExpr).elements).push.apply(_elements, _to_consumable_array(expr));
202
+ } else
203
+ (HOC ? hocStylesExpr : stylesExpr).elements.push(expr);
204
+ }
205
+ function getThemedStyleExpression(styles) {
206
+ var themedStylesAst = literalToAst(styles);
207
+ return themedStylesAst.properties.forEach(function(_) {
208
+ var prop = _;
209
+ prop.value.type === "StringLiteral" && (prop.value = t.memberExpression(t.identifier("theme"), t.identifier(prop.value.value.slice(1) + ".get()")));
210
+ }), themedStylesAst;
211
+ }
212
+ var hasDynamicStyle = !1, _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
213
+ try {
214
+ for (var _iterator = props.attrs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
215
+ var attr = _step.value;
216
+ switch (attr.type) {
217
+ case "style": {
218
+ var styleExpr = getStyleExpression(attr.value);
219
+ addStyleExpression(styleExpr), options.experimentalFlattenThemesOnNative && addStyleExpression(styleExpr, !0);
220
+ break;
221
+ }
222
+ case "ternary": {
223
+ var _attr_value = attr.value, consequent = _attr_value.consequent, alternate = _attr_value.alternate, consExpr = getStyleExpression(consequent), altExpr = getStyleExpression(alternate);
224
+ options.experimentalFlattenThemesOnNative && (expressions.push(attr.value.test), addStyleExpression(t.conditionalExpression(t.identifier("_expressions[".concat(expressions.length - 1, "]")), consExpr || t.nullLiteral(), altExpr || t.nullLiteral()), !0));
225
+ var styleExpr1 = t.conditionalExpression(attr.value.test, consExpr || t.nullLiteral(), altExpr || t.nullLiteral());
226
+ addStyleExpression(styleExpr1);
227
+ break;
228
+ }
229
+ case "dynamic-style": {
230
+ hasDynamicStyle = !0, expressions.push(attr.value), options.experimentalFlattenDynamicValues ? addStyleExpression(t.objectExpression([
231
+ t.objectProperty(t.identifier(attr.name), t.identifier("_expressions[".concat(expressions.length - 1, "]")))
232
+ ]), !0) : addStyleExpression(t.objectExpression([
233
+ t.objectProperty(t.identifier(attr.name), attr.value)
234
+ ]));
235
+ break;
236
+ }
237
+ case "attr": {
238
+ t.isJSXSpreadAttribute(attr.value) && isSimpleSpread(attr.value) && (stylesExpr.elements.push(t.memberExpression(attr.value.argument, t.identifier("style"))), options.experimentalFlattenThemesOnNative && hocStylesExpr.elements.push(t.memberExpression(attr.value.argument, t.identifier("style")))), finalAttrs.push(attr.value);
239
+ break;
240
+ }
241
+ }
242
+ }
243
+ } catch (err) {
244
+ _didIteratorError = !0, _iteratorError = err;
245
+ } finally {
246
+ try {
247
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
248
+ } finally {
249
+ if (_didIteratorError)
250
+ throw _iteratorError;
251
+ }
252
+ }
253
+ if (props.node.attributes = finalAttrs, props.isFlattened)
254
+ if (options.experimentalFlattenThemesOnNative && (themeKeysUsed.size || hocStylesExpr.elements.length > 1 || hasDynamicStyle)) {
255
+ hasImportedViewWrapper || (root.unshiftContainer("body", importWithStyle()), hasImportedViewWrapper = !0);
256
+ var name = props.node.name.name, WrapperIdentifier = root.scope.generateUidIdentifier(name + "Wrapper");
257
+ root.pushContainer("body", t.variableDeclaration("const", [
258
+ t.variableDeclarator(WrapperIdentifier, t.callExpression(t.identifier("__withStableStyle"), [
259
+ t.identifier(name),
260
+ t.arrowFunctionExpression([
261
+ t.identifier("theme"),
262
+ t.identifier("_expressions")
263
+ ], t.blockStatement([
264
+ t.returnStatement(t.callExpression(t.memberExpression(t.identifier("React"), t.identifier("useMemo")), [
265
+ t.arrowFunctionExpression([], t.blockStatement([
266
+ t.returnStatement(t.arrayExpression(_to_consumable_array(hocStylesExpr.elements)))
267
+ ])),
268
+ t.arrayExpression([
269
+ t.spreadElement(t.identifier("_expressions"))
270
+ ])
271
+ ]))
272
+ ]))
273
+ ]))
274
+ ])), props.node.name = WrapperIdentifier, props.jsxPath.node.closingElement && (props.jsxPath.node.closingElement.name = WrapperIdentifier), expressions.length && props.node.attributes.push(t.jsxAttribute(t.jsxIdentifier("expressions"), t.jsxExpressionContainer(t.arrayExpression(expressions))));
275
+ } else
276
+ props.node.attributes.push(t.jsxAttribute(t.jsxIdentifier("style"), t.jsxExpressionContainer(stylesExpr.elements.length === 1 ? stylesExpr.elements[0] : stylesExpr)));
277
+ }
278
+ }));
279
+ } catch (err) {
280
+ if (_instanceof(err, Error)) {
281
+ var message = "".concat(shouldPrintDebug === "verbose" ? err : err.message);
282
+ message.includes("Unexpected return value from visitor method") && (message = "Unexpected return value from visitor method"), console.warn("Error in Tamagui parse, skipping", message, err.stack);
283
+ return;
284
+ }
285
+ }
286
+ if (!Object.keys(sheetStyles).length) {
287
+ shouldPrintDebug && console.info("END no styles"), res && printLog(res);
288
+ return;
289
+ }
290
+ var sheetObject = literalToAst(sheetStyles), sheetOuter = template("const SHEET = __ReactNativeStyleSheet.create(null)")({
291
+ SHEET: sheetIdentifier.name
292
+ });
293
+ sheetOuter.declarations[0].init.arguments[0] = sheetObject, root.unshiftContainer("body", sheetOuter), root.unshiftContainer("body", importStyleSheet()), shouldPrintDebug && (console.info(`
294
+ -------- output code -------
295
+ `), console.info(generator(root.parent).code.split(`
296
+ `).filter(function(x) {
297
+ return !x.startsWith("//");
298
+ }).join(`
299
+ `))), res && printLog(res);
300
+ }
301
+ }
302
+ }
303
+ };
304
+ }
305
+ function assertValidTag(node) {
306
+ if (node.attributes.find(function(x) {
307
+ return x.type === "JSXAttribute" && x.name.name === "style";
308
+ })) {
309
+ var _process_env_DEBUG;
310
+ !((_process_env_DEBUG = process.env.DEBUG) === null || _process_env_DEBUG === void 0) && _process_env_DEBUG.startsWith("tamagui") && console.warn("\u26A0\uFE0F Cannot pass style attribute to extracted style");
311
+ }
312
+ }
313
+ function splitThemeStyles(style) {
314
+ var themed = {}, plain = {}, noTheme = !0;
315
+ for (var key in style) {
316
+ var val = style[key];
317
+ val && val[0] === "$" ? (themed[key] = val, noTheme = !1) : plain[key] = val;
318
+ }
319
+ return {
320
+ themed: noTheme ? null : themed,
321
+ plain
322
+ };
323
+ }
324
+ export {
325
+ extractToNative,
326
+ getBabelParseDefinition,
327
+ getBabelPlugin
328
+ };
329
+ //# sourceMappingURL=extractToNative.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/extractor/Users/n8/tamagui/packages/static/src/extractor/extractToNative.ts"],
4
+ "mappings": "AAAA,SAASA,gBAAgB;AAEzB,SAA+BC,4BAA4B;AAC3D,OAAOC,eAAe;AACtB,SAASC,eAAe;AACxB,SAASC,aAAa;AACtB,OAAOC,cAAc;AACrB,YAAYC,OAAO;AAEnB,SACEC,iBACAC,cACAC,kBACAC,gBACAC,cACAC,kCACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEP,IAAMC,mBAAmBR,SAAU;;;CAAA,GAK7BS,mBAAmBT,SAAU;;CAAA,GAI7BU,kBAAkBV,SAAU;;CAAA,GAI5BW,YAAYT,gBAAgB;EAAEU,UAAU;AAAS,CAAA,GAEnDC;AAEG,SAASC,gBACd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WAAWgC,KAAK,SAACF,GAAAA;WAAMA,EAAElD,SAAS,kBAAkBkD,EAAEpJ,KAAKA,SAAS;MAAU;QAGjFK;AAAJ,IAAIA,wBAAAA,QAAQM,IAAI4I,WAAK,QAAjBlJ,uBAAAA,WAAAA,mBAAmBgJ,WAAW,SAAA,KAChCb,QAAQC,KAAK,6DAAA;EAEjB;AACF;AAEA,SAAS5D,iBAAiBvC,OAAa;AACrC,MAAMyC,SAAiB,CAAC,GAClBD,QAAgB,CAAC,GACnB0E,UAAU;AACd,WAAW7G,OAAOL,OAAO;AACvB,QAAMmH,MAAMnH,MAAMK,GAAAA;AAClB,IAAI8G,OAAOA,IAAI,CAAA,MAAO,OACpB1E,OAAOpC,GAAAA,IAAO8G,KACdD,UAAU,MAEV1E,MAAMnC,GAAAA,IAAO8G;EAEjB;AACA,SAAO;IAAE1E,QAAQyE,UAAU,OAAOzE;IAAQD;EAAM;AAClD;",
5
+ "names": ["basename", "transformFromAstSync", "generator", "declare", "parse", "template", "t", "createExtractor", "createLogger", "getPragmaOptions", "isSimpleSpread", "literalToAst", "loadTamaguiBuildConfigSync", "importNativeView", "importStyleSheet", "importWithStyle", "extractor", "platform", "tamaguiBuildOptionsLoaded", "extractToNative", "sourceFileName", "sourceCode", "options", "ast", "sourceType", "plugins", "babelPlugin", "getBabelPlugin", "out", "configFile", "filename", "Error", "api", "assertVersion", "getBabelParseDefinition", "name", "visitor", "Program", "enter", "root", "process", "sourcePath", "file", "opts", "includes", "endsWith", "env", "SOURCE_ROOT", "replace", "hasImportedView", "hasImportedViewWrapper", "sheetStyles", "sheetIdentifier", "scope", "generateUidIdentifier", "firstCommentContents", "node", "body", "leadingComments", "map", "comment", "value", "join", "firstComment", "source", "path", "shouldPrintDebug", "shouldDisable", "config", "components", "finalOptions", "printLog", "addSheetStyle", "style", "styleIndex", "Object", "keys", "length", "key", "NODE_ENV", "lineNumbers", "loc", "start", "line", "end", "readStyleExpr", "SHEET", "KEY", "res", "parseSync", "importsWhitelist", "extractStyledDefinitions", "forceExtractStyleDefinitions", "excludeProps", "Set", "disableExtractInlineMedia", "disableExtractVariables", "experimentalFlattenThemesOnNative", "getFlattenedNode", "isTextView", "unshiftContainer", "onExtractTag", "props", "isFlattened", "assertValidTag", "stylesExpr", "arrayExpression", "hocStylesExpr", "expressions", "finalAttrs", "themeKeysUsed", "getStyleExpression", "splitThemeStyles", "plain", "themed", "themeExpr", "add", "split", "getThemedStyleExpression", "ident", "addStyleExpression", "expr", "HOC", "Array", "isArray", "elements", "push", "styles", "themedStylesAst", "properties", "forEach", "_", "prop", "type", "memberExpression", "identifier", "slice", "hasDynamicStyle", "attrs", "attr", "styleExpr", "consequent", "alternate", "consExpr", "altExpr", "test", "conditionalExpression", "nullLiteral", "experimentalFlattenDynamicValues", "objectExpression", "objectProperty", "isJSXSpreadAttribute", "argument", "attributes", "size", "WrapperIdentifier", "pushContainer", "variableDeclaration", "variableDeclarator", "callExpression", "arrowFunctionExpression", "blockStatement", "returnStatement", "spreadElement", "jsxPath", "closingElement", "jsxAttribute", "jsxIdentifier", "jsxExpressionContainer", "err", "message", "console", "warn", "stack", "info", "sheetObject", "sheetOuter", "declarations", "init", "arguments", "parent", "code", "filter", "x", "startsWith", "find", "DEBUG", "noTheme", "val"]
6
+ }
package/dist/esm/index.js CHANGED
@@ -6,6 +6,7 @@ import { createExtractor } from "./extractor/createExtractor";
6
6
  import { literalToAst } from "./extractor/literalToAst";
7
7
  export * from "./constants";
8
8
  export * from "./extractor/extractToClassNames";
9
+ export * from "./extractor/extractToNative";
9
10
  export * from "./extractor/extractHelpers";
10
11
  export * from "./extractor/loadTamagui";
11
12
  export * from "./extractor/watchTamaguiConfig";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "mappings": "AAAA,OAAO;AACP,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAC7B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
4
+ "mappings": "AAAA,OAAO;AACP,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAC7B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
5
5
  "names": []
6
6
  }
@@ -6,6 +6,7 @@ import { createExtractor } from "./extractor/createExtractor.mjs";
6
6
  import { literalToAst } from "./extractor/literalToAst.mjs";
7
7
  export * from "./constants.mjs";
8
8
  export * from "./extractor/extractToClassNames.mjs";
9
+ export * from "./extractor/extractToNative.mjs";
9
10
  export * from "./extractor/extractHelpers.mjs";
10
11
  export * from "./extractor/loadTamagui.mjs";
11
12
  export * from "./extractor/watchTamaguiConfig.mjs";
@@ -6,6 +6,7 @@ import { createExtractor } from "./extractor/createExtractor";
6
6
  import { literalToAst } from "./extractor/literalToAst";
7
7
  export * from "./constants";
8
8
  export * from "./extractor/extractToClassNames";
9
+ export * from "./extractor/extractToNative";
9
10
  export * from "./extractor/extractHelpers";
10
11
  export * from "./extractor/loadTamagui";
11
12
  export * from "./extractor/watchTamaguiConfig";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Users/n8/tamagui/packages/static/src/index.ts"],
4
- "mappings": "AAAA,OAAO;AACP,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAASA,uBAAuB;AAChC,SAASC,oBAAoB;AAC7B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
4
+ "mappings": "AAAA,OAAO;AACP,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAASA,uBAAuB;AAChC,SAASC,oBAAoB;AAC7B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
5
5
  "names": ["createExtractor", "literalToAst"]
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/static",
3
- "version": "1.100.6",
3
+ "version": "1.101.1",
4
4
  "source": "src/index.ts",
5
5
  "types": "./types/index.d.ts",
6
6
  "main": "dist/cjs/index.js",
@@ -43,17 +43,17 @@
43
43
  "@babel/runtime": "^7.23.2",
44
44
  "@babel/traverse": "^7.23.3",
45
45
  "@babel/types": "^7.23.3",
46
- "@tamagui/build": "1.100.6",
47
- "@tamagui/cli-color": "1.100.6",
48
- "@tamagui/config-default": "1.100.6",
49
- "@tamagui/core": "1.100.6",
50
- "@tamagui/fake-react-native": "1.100.6",
51
- "@tamagui/generate-themes": "1.100.6",
52
- "@tamagui/helpers": "1.100.6",
53
- "@tamagui/helpers-node": "1.100.6",
54
- "@tamagui/proxy-worm": "1.100.6",
55
- "@tamagui/shorthands": "1.100.6",
56
- "@tamagui/types": "1.100.6",
46
+ "@tamagui/build": "1.101.1",
47
+ "@tamagui/cli-color": "1.101.1",
48
+ "@tamagui/config-default": "1.101.1",
49
+ "@tamagui/core": "1.101.1",
50
+ "@tamagui/fake-react-native": "1.101.1",
51
+ "@tamagui/generate-themes": "1.101.1",
52
+ "@tamagui/helpers": "1.101.1",
53
+ "@tamagui/helpers-node": "1.101.1",
54
+ "@tamagui/proxy-worm": "1.101.1",
55
+ "@tamagui/shorthands": "1.101.1",
56
+ "@tamagui/types": "1.101.1",
57
57
  "babel-literal-to-ast": "^2.1.0",
58
58
  "browserslist": "^4.22.2",
59
59
  "check-dependency-version-consistency": "^4.1.0",
@@ -66,12 +66,13 @@
66
66
  "lodash": "^4.17.21",
67
67
  "react-dom": "^18.2.0",
68
68
  "react-native-web": "^0.19.12",
69
- "react-native-web-internals": "1.100.6",
70
- "react-native-web-lite": "1.100.6"
69
+ "react-native-web-internals": "1.101.1",
70
+ "react-native-web-lite": "1.101.1"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@babel/plugin-syntax-typescript": "^7.23.3",
74
74
  "@expo/match-media": "^0.4.0",
75
+ "@types/babel__core": "^7.20.5",
75
76
  "@types/find-root": "^1.1.2",
76
77
  "@types/node": "^16.11.9",
77
78
  "@types/webpack": "^4.41.26",
@@ -79,7 +80,7 @@
79
80
  "esbuild-loader": "^3.0.1",
80
81
  "null-loader": "^4.0.1",
81
82
  "react": "^18.2.0",
82
- "typescript": "^5.4.5"
83
+ "typescript": "^5.5.2"
83
84
  },
84
85
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14"
85
86
  }
@@ -5,12 +5,14 @@ import type { NodePath, TraverseOptions } from '@babel/traverse'
5
5
  import traverse from '@babel/traverse'
6
6
  import * as t from '@babel/types'
7
7
  import { Color, colorLog } from '@tamagui/cli-color'
8
- import type {
9
- GetStyleState,
10
- PseudoStyles,
11
- SplitStyleProps,
12
- StaticConfig,
13
- TamaguiComponentState,
8
+ import {
9
+ StyleObjectIdentifier,
10
+ StyleObjectRules,
11
+ type GetStyleState,
12
+ type PseudoStyles,
13
+ type SplitStyleProps,
14
+ type StaticConfig,
15
+ type TamaguiComponentState,
14
16
  } from '@tamagui/web'
15
17
  import type { ViewStyle } from 'react-native'
16
18
  import * as reactNativeWebInternals from 'react-native-web-internals'
@@ -299,10 +301,10 @@ export function createExtractor(
299
301
  const firstTheme = tamaguiConfig?.themes[firstThemeName] || {}
300
302
 
301
303
  if (!firstTheme || typeof firstTheme !== 'object') {
302
- console.error(`Missing theme, an error occurred when importing your config`)
303
- console.info(`Got config:`, tamaguiConfig)
304
+ const err = `Missing theme ${firstThemeName}, an error occurred when importing your config`
305
+ console.info(err, `Got config:`, tamaguiConfig)
304
306
  console.info(`Looking for theme:`, firstThemeName)
305
- process.exit(0)
307
+ throw new Error(err)
306
308
  }
307
309
 
308
310
  const proxiedTheme = proxyThemeVariables(firstTheme)
@@ -649,7 +651,9 @@ export function createExtractor(
649
651
  '\n classNames:',
650
652
  JSON.stringify(classNames, null, 2),
651
653
  '\n rulesToInsert:',
652
- out.rulesToInsert.flatMap((rule) => rule.rules).join('\n'),
654
+ out.rulesToInsert
655
+ .flatMap((styleObject) => styleObject[StyleObjectRules])
656
+ .join('\n'),
653
657
  ].join(' ')
654
658
  )
655
659
  }
@@ -673,8 +677,11 @@ export function createExtractor(
673
677
  })
674
678
 
675
679
  if (out.rulesToInsert) {
676
- for (const { identifier, rules } of out.rulesToInsert) {
677
- onStyleRule?.(identifier, rules)
680
+ for (const styleObject of out.rulesToInsert) {
681
+ onStyleRule?.(
682
+ styleObject[StyleObjectIdentifier],
683
+ styleObject[StyleObjectRules]
684
+ )
678
685
  }
679
686
  }
680
687
 
@@ -693,10 +700,6 @@ export function createExtractor(
693
700
  const componentName = findComponentName(traversePath.scope)
694
701
  const closingElement = traversePath.node.closingElement
695
702
 
696
- if (shouldPrintDebug) {
697
- logger.info(` start ${node.name}`)
698
- }
699
-
700
703
  // skip non-identifier opening elements (member expressions, etc.)
701
704
  if (
702
705
  (closingElement && t.isJSXMemberExpression(closingElement?.name)) ||
@@ -719,7 +722,7 @@ export function createExtractor(
719
722
  if (!isValidImport(propsWithFileInfo, moduleName, binding.identifier.name)) {
720
723
  if (shouldPrintDebug) {
721
724
  logger.info(
722
- ` - Binding for ${componentName} not internal import or from components ${binding.identifier.name} in ${moduleName}`
725
+ ` - Binding in component ${componentName} not valid import: "${binding.identifier.name}" isn't in ${moduleName}\n`
723
726
  )
724
727
  }
725
728
  return
@@ -730,7 +733,7 @@ export function createExtractor(
730
733
  const component = getValidComponent(propsWithFileInfo, moduleName, node.name.name)
731
734
  if (!component || !component.staticConfig) {
732
735
  if (shouldPrintDebug) {
733
- logger.info(` - No Tamagui conf on this: ${node.name.name}`)
736
+ logger.info(`\n - No Tamagui conf for: ${node.name.name}\n`)
734
737
  }
735
738
  return
736
739
  }
@@ -766,10 +769,8 @@ export function createExtractor(
766
769
  }
767
770
 
768
771
  if (shouldPrintDebug) {
769
- logger.info('\n')
770
772
  logger.info(
771
- `\x1b[33m%s\x1b[0m ` +
772
- `${componentName} | ${codePosition} -------------------`
773
+ `\x1b[33m\x1b[0m ` + `${componentName} | ${codePosition} -------------------`
773
774
  )
774
775
  // prettier-ignore
775
776
  logger.info(
@@ -804,7 +805,7 @@ export function createExtractor(
804
805
 
805
806
  if (shouldDisableExtraction) {
806
807
  if (shouldPrintDebug === 'verbose') {
807
- console.info(` Extraction disabled`)
808
+ logger.info(` Extraction disabled: ${JSON.stringify(disableExtraction)}\n`)
808
809
  }
809
810
  return
810
811
  }
@@ -61,7 +61,7 @@ export function extractMediaStyle(
61
61
  true,
62
62
  negate
63
63
  )
64
- const className = `.${mediaStyle.identifier}`
64
+ const className = `.${mediaStyle[core.StyleObjectIdentifier]}`
65
65
  return {
66
66
  ...mediaStyle,
67
67
  className,
@@ -73,7 +73,7 @@ export function extractMediaStyle(
73
73
  ' media styles:',
74
74
  importance,
75
75
  styleObj,
76
- singleMediaStyles.map((x) => x.identifier).join(', ')
76
+ singleMediaStyles.map((x) => x[core.StyleObjectIdentifier]).join(', ')
77
77
  )
78
78
  }
79
79
  // add to output