@tamagui/static 1.135.4 → 1.135.5

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 (181) hide show
  1. package/dist/check-dep-versions.mjs +268 -0
  2. package/dist/check-dep-versions.mjs.map +1 -0
  3. package/dist/checkDeps.mjs +33 -0
  4. package/dist/checkDeps.mjs.map +1 -0
  5. package/dist/constants.mjs +50 -0
  6. package/dist/constants.mjs.map +1 -0
  7. package/dist/exports.mjs +42 -0
  8. package/dist/exports.mjs.map +1 -0
  9. package/dist/extractor/accessSafe.mjs +47 -0
  10. package/dist/extractor/accessSafe.mjs.map +1 -0
  11. package/dist/extractor/babelParse.mjs +55 -0
  12. package/dist/extractor/babelParse.mjs.map +1 -0
  13. package/dist/extractor/bundle.mjs +149 -0
  14. package/dist/extractor/bundle.mjs.map +1 -0
  15. package/dist/extractor/bundleConfig.mjs +331 -0
  16. package/dist/extractor/bundleConfig.mjs.map +1 -0
  17. package/dist/extractor/concatClassName.mjs +79 -0
  18. package/dist/extractor/concatClassName.mjs.map +1 -0
  19. package/dist/extractor/createEvaluator.mjs +76 -0
  20. package/dist/extractor/createEvaluator.mjs.map +1 -0
  21. package/dist/extractor/createExtractor.mjs +976 -0
  22. package/dist/extractor/createExtractor.mjs.map +1 -0
  23. package/dist/extractor/createLogger.mjs +46 -0
  24. package/dist/extractor/createLogger.mjs.map +1 -0
  25. package/dist/extractor/errors.mjs +27 -0
  26. package/dist/extractor/errors.mjs.map +1 -0
  27. package/dist/extractor/esbuildAliasPlugin.mjs +45 -0
  28. package/dist/extractor/esbuildAliasPlugin.mjs.map +1 -0
  29. package/dist/extractor/esbuildTsconfigPaths.mjs +85 -0
  30. package/dist/extractor/esbuildTsconfigPaths.mjs.map +1 -0
  31. package/dist/extractor/evaluateAstNode.mjs +84 -0
  32. package/dist/extractor/evaluateAstNode.mjs.map +1 -0
  33. package/dist/extractor/extractHelpers.mjs +121 -0
  34. package/dist/extractor/extractHelpers.mjs.map +1 -0
  35. package/dist/extractor/extractMediaStyle.mjs +129 -0
  36. package/dist/extractor/extractMediaStyle.mjs.map +1 -0
  37. package/dist/extractor/extractToClassNames.mjs +304 -0
  38. package/dist/extractor/extractToClassNames.mjs.map +1 -0
  39. package/dist/extractor/extractToNative.mjs +262 -0
  40. package/dist/extractor/extractToNative.mjs.map +1 -0
  41. package/dist/extractor/findTopmostFunction.mjs +35 -0
  42. package/dist/extractor/findTopmostFunction.mjs.map +1 -0
  43. package/dist/extractor/{generatedUid.native.js → generatedUid.mjs} +26 -23
  44. package/dist/extractor/generatedUid.mjs.map +1 -0
  45. package/dist/extractor/getPrefixLogs.mjs +30 -0
  46. package/dist/extractor/getPrefixLogs.mjs.map +1 -0
  47. package/dist/extractor/getPropValueFromAttributes.mjs +68 -0
  48. package/dist/extractor/getPropValueFromAttributes.mjs.map +1 -0
  49. package/dist/extractor/getSourceModule.mjs +65 -0
  50. package/dist/extractor/getSourceModule.mjs.map +1 -0
  51. package/dist/extractor/getStaticBindingsForScope.mjs +149 -0
  52. package/dist/extractor/getStaticBindingsForScope.mjs.map +1 -0
  53. package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.mjs +36 -0
  54. package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.mjs.map +1 -0
  55. package/dist/extractor/literalToAst.mjs +85 -0
  56. package/dist/extractor/literalToAst.mjs.map +1 -0
  57. package/dist/extractor/loadFile.mjs +12 -0
  58. package/dist/extractor/loadFile.mjs.map +1 -0
  59. package/dist/extractor/loadTamagui.mjs +296 -0
  60. package/dist/extractor/loadTamagui.mjs.map +1 -0
  61. package/dist/extractor/logLines.mjs +36 -0
  62. package/dist/extractor/logLines.mjs.map +1 -0
  63. package/dist/extractor/{normalizeTernaries.native.js → normalizeTernaries.mjs} +45 -31
  64. package/dist/extractor/normalizeTernaries.mjs.map +1 -0
  65. package/dist/extractor/propsToFontFamilyCache.mjs +39 -0
  66. package/dist/extractor/propsToFontFamilyCache.mjs.map +1 -0
  67. package/dist/extractor/regenerateConfig.mjs +145 -0
  68. package/dist/extractor/regenerateConfig.mjs.map +1 -0
  69. package/dist/extractor/removeUnusedHooks.mjs +77 -0
  70. package/dist/extractor/removeUnusedHooks.mjs.map +1 -0
  71. package/dist/extractor/timer.mjs +44 -0
  72. package/dist/extractor/timer.mjs.map +1 -0
  73. package/dist/extractor/{validHTMLAttributes.native.js → validHTMLAttributes.mjs} +17 -16
  74. package/dist/extractor/validHTMLAttributes.mjs.map +1 -0
  75. package/dist/extractor/watchTamaguiConfig.mjs +59 -0
  76. package/dist/extractor/watchTamaguiConfig.mjs.map +1 -0
  77. package/dist/getPragmaOptions.mjs +55 -0
  78. package/dist/getPragmaOptions.mjs.map +1 -0
  79. package/dist/helpers/memoize.mjs +38 -0
  80. package/dist/helpers/memoize.mjs.map +1 -0
  81. package/dist/helpers/requireTamaguiCore.mjs +34 -0
  82. package/dist/helpers/requireTamaguiCore.mjs.map +1 -0
  83. package/dist/index.mjs +41 -0
  84. package/dist/index.mjs.map +1 -0
  85. package/dist/registerRequire.mjs +107 -0
  86. package/dist/registerRequire.mjs.map +1 -0
  87. package/dist/server.mjs +76 -0
  88. package/dist/server.mjs.map +1 -0
  89. package/dist/setup.mjs +2 -0
  90. package/dist/setup.mjs.map +1 -0
  91. package/dist/{types.native.js → types.mjs} +8 -6
  92. package/dist/types.mjs.map +1 -0
  93. package/package.json +19 -21
  94. package/dist/check-dep-versions.native.js +0 -602
  95. package/dist/check-dep-versions.native.js.map +0 -6
  96. package/dist/checkDeps.native.js +0 -34
  97. package/dist/checkDeps.native.js.map +0 -6
  98. package/dist/constants.native.js +0 -45
  99. package/dist/constants.native.js.map +0 -6
  100. package/dist/exports.native.js +0 -52
  101. package/dist/exports.native.js.map +0 -6
  102. package/dist/extractor/accessSafe.native.js +0 -48
  103. package/dist/extractor/accessSafe.native.js.map +0 -6
  104. package/dist/extractor/babelParse.native.js +0 -62
  105. package/dist/extractor/babelParse.native.js.map +0 -6
  106. package/dist/extractor/bundle.native.js +0 -168
  107. package/dist/extractor/bundle.native.js.map +0 -6
  108. package/dist/extractor/bundleConfig.native.js +0 -394
  109. package/dist/extractor/bundleConfig.native.js.map +0 -6
  110. package/dist/extractor/concatClassName.native.js +0 -69
  111. package/dist/extractor/concatClassName.native.js.map +0 -6
  112. package/dist/extractor/createEvaluator.native.js +0 -63
  113. package/dist/extractor/createEvaluator.native.js.map +0 -6
  114. package/dist/extractor/createExtractor.native.js +0 -1229
  115. package/dist/extractor/createExtractor.native.js.map +0 -6
  116. package/dist/extractor/createLogger.native.js +0 -35
  117. package/dist/extractor/createLogger.native.js.map +0 -6
  118. package/dist/extractor/errors.native.js +0 -119
  119. package/dist/extractor/errors.native.js.map +0 -6
  120. package/dist/extractor/esbuildAliasPlugin.native.js +0 -52
  121. package/dist/extractor/esbuildAliasPlugin.native.js.map +0 -6
  122. package/dist/extractor/esbuildTsconfigPaths.native.js +0 -79
  123. package/dist/extractor/esbuildTsconfigPaths.native.js.map +0 -6
  124. package/dist/extractor/evaluateAstNode.native.js +0 -98
  125. package/dist/extractor/evaluateAstNode.native.js.map +0 -6
  126. package/dist/extractor/extractHelpers.native.js +0 -183
  127. package/dist/extractor/extractHelpers.native.js.map +0 -6
  128. package/dist/extractor/extractMediaStyle.native.js +0 -138
  129. package/dist/extractor/extractMediaStyle.native.js.map +0 -6
  130. package/dist/extractor/extractToClassNames.native.js +0 -332
  131. package/dist/extractor/extractToClassNames.native.js.map +0 -6
  132. package/dist/extractor/extractToNative.native.js +0 -276
  133. package/dist/extractor/extractToNative.native.js.map +0 -6
  134. package/dist/extractor/findTopmostFunction.native.js +0 -37
  135. package/dist/extractor/findTopmostFunction.native.js.map +0 -6
  136. package/dist/extractor/generatedUid.native.js.map +0 -6
  137. package/dist/extractor/getPrefixLogs.native.js +0 -30
  138. package/dist/extractor/getPrefixLogs.native.js.map +0 -6
  139. package/dist/extractor/getPropValueFromAttributes.native.js +0 -68
  140. package/dist/extractor/getPropValueFromAttributes.native.js.map +0 -6
  141. package/dist/extractor/getSourceModule.native.js +0 -80
  142. package/dist/extractor/getSourceModule.native.js.map +0 -6
  143. package/dist/extractor/getStaticBindingsForScope.native.js +0 -183
  144. package/dist/extractor/getStaticBindingsForScope.native.js.map +0 -6
  145. package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.native.js +0 -37
  146. package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.native.js.map +0 -6
  147. package/dist/extractor/literalToAst.native.js +0 -106
  148. package/dist/extractor/literalToAst.native.js.map +0 -6
  149. package/dist/extractor/loadFile.native.js +0 -21
  150. package/dist/extractor/loadFile.native.js.map +0 -6
  151. package/dist/extractor/loadTamagui.native.js +0 -314
  152. package/dist/extractor/loadTamagui.native.js.map +0 -6
  153. package/dist/extractor/logLines.native.js +0 -53
  154. package/dist/extractor/logLines.native.js.map +0 -6
  155. package/dist/extractor/normalizeTernaries.native.js.map +0 -6
  156. package/dist/extractor/propsToFontFamilyCache.native.js +0 -40
  157. package/dist/extractor/propsToFontFamilyCache.native.js.map +0 -6
  158. package/dist/extractor/regenerateConfig.native.js +0 -148
  159. package/dist/extractor/regenerateConfig.native.js.map +0 -6
  160. package/dist/extractor/removeUnusedHooks.native.js +0 -111
  161. package/dist/extractor/removeUnusedHooks.native.js.map +0 -6
  162. package/dist/extractor/timer.native.js +0 -44
  163. package/dist/extractor/timer.native.js.map +0 -6
  164. package/dist/extractor/validHTMLAttributes.native.js.map +0 -6
  165. package/dist/extractor/watchTamaguiConfig.native.js +0 -60
  166. package/dist/extractor/watchTamaguiConfig.native.js.map +0 -6
  167. package/dist/getPragmaOptions.native.js +0 -62
  168. package/dist/getPragmaOptions.native.js.map +0 -6
  169. package/dist/helpers/memoize.native.js +0 -40
  170. package/dist/helpers/memoize.native.js.map +0 -6
  171. package/dist/helpers/requireTamaguiCore.native.js +0 -34
  172. package/dist/helpers/requireTamaguiCore.native.js.map +0 -6
  173. package/dist/index.native.js +0 -35
  174. package/dist/index.native.js.map +0 -6
  175. package/dist/registerRequire.native.js +0 -124
  176. package/dist/registerRequire.native.js.map +0 -6
  177. package/dist/server.native.js +0 -70
  178. package/dist/server.native.js.map +0 -6
  179. package/dist/setup.native.js +0 -2
  180. package/dist/setup.native.js.map +0 -6
  181. package/dist/types.native.js.map +0 -6
@@ -0,0 +1,262 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
32
+ var extractToNative_exports = {};
33
+ __export(extractToNative_exports, {
34
+ extractToNative: () => extractToNative,
35
+ getBabelParseDefinition: () => getBabelParseDefinition,
36
+ getBabelPlugin: () => getBabelPlugin
37
+ });
38
+ module.exports = __toCommonJS(extractToNative_exports);
39
+ var import_core = require("@babel/core"),
40
+ import_generator = __toESM(require("@babel/generator")),
41
+ import_helper_plugin_utils = require("@babel/helper-plugin-utils"),
42
+ import_parser = require("@babel/parser"),
43
+ import_template = __toESM(require("@babel/template")),
44
+ t = __toESM(require("@babel/types")),
45
+ import_node_path = require("node:path"),
46
+ import_getPragmaOptions = require("../getPragmaOptions.mjs"),
47
+ import_createExtractor = require("./createExtractor.mjs"),
48
+ import_createLogger = require("./createLogger.mjs"),
49
+ import_extractHelpers = require("./extractHelpers.mjs"),
50
+ import_literalToAst = require("./literalToAst.mjs"),
51
+ import_loadTamagui = require("./loadTamagui.mjs");
52
+ const importNativeView = (0, import_template.default)(`
53
+ const __ReactNativeView = require('react-native').View;
54
+ const __ReactNativeText = require('react-native').Text;
55
+ `),
56
+ importStyleSheet = (0, import_template.default)(`
57
+ const __ReactNativeStyleSheet = require('react-native').StyleSheet;
58
+ `),
59
+ importWithStyle = (0, import_template.default)(`
60
+ const __withStableStyle = require('@tamagui/core')._withStableStyle;
61
+ `),
62
+ importReactUseMemo = (0, import_template.default)(`
63
+ const __ReactUseMemo = require('react').useMemo;
64
+ `),
65
+ extractor = (0, import_createExtractor.createExtractor)({
66
+ platform: "native"
67
+ });
68
+ let tamaguiBuildOptionsLoaded;
69
+ function extractToNative(sourceFileName, sourceCode, options) {
70
+ const ast = (0, import_parser.parse)(sourceCode, {
71
+ sourceType: "module",
72
+ plugins: ["jsx", "typescript"]
73
+ }),
74
+ babelPlugin = getBabelPlugin(),
75
+ out = (0, import_core.transformFromAstSync)(ast, sourceCode, {
76
+ plugins: [[babelPlugin, options]],
77
+ configFile: !1,
78
+ sourceFileName,
79
+ filename: sourceFileName
80
+ });
81
+ if (!out) throw new Error("No output returned");
82
+ return out;
83
+ }
84
+ function getBabelPlugin() {
85
+ return (0, import_helper_plugin_utils.declare)((api, options) => (api.assertVersion(7), getBabelParseDefinition(options)));
86
+ }
87
+ function getBabelParseDefinition(options) {
88
+ return {
89
+ name: "tamagui",
90
+ visitor: {
91
+ Program: {
92
+ enter(root) {
93
+ let sourcePath = this.file.opts.filename;
94
+ if (sourcePath?.includes("node_modules") || !sourcePath?.endsWith(".jsx") && !sourcePath?.endsWith(".tsx")) return;
95
+ process.env.SOURCE_ROOT?.endsWith("ios") && (sourcePath = sourcePath.replace("/ios", ""));
96
+ let hasImportedView = !1,
97
+ hasImportedViewWrapper = !1;
98
+ const sheetStyles = {},
99
+ sheetIdentifier = root.scope.generateUidIdentifier("sheet"),
100
+ firstCommentContents =
101
+ // join because you can join together multiple pragmas
102
+ root.node.body[0]?.leadingComments?.map(comment => comment?.value || " ").join(" ") ?? "",
103
+ firstComment = firstCommentContents ? `//${firstCommentContents}` : "",
104
+ {
105
+ shouldPrintDebug,
106
+ shouldDisable
107
+ } = (0, import_getPragmaOptions.getPragmaOptions)({
108
+ source: firstComment,
109
+ path: sourcePath
110
+ });
111
+ if (shouldDisable) return;
112
+ !options.config && !options.components && (tamaguiBuildOptionsLoaded ||= (0, import_loadTamagui.loadTamaguiBuildConfigSync)({}));
113
+ const finalOptions = {
114
+ // @ts-ignore just in case they leave it out
115
+ platform: "native",
116
+ ...tamaguiBuildOptionsLoaded,
117
+ ...options
118
+ },
119
+ printLog = (0, import_createLogger.createLogger)(sourcePath, finalOptions);
120
+ function addSheetStyle(style, node) {
121
+ let key = `${`${Object.keys(sheetStyles).length}`}`;
122
+ if (process.env.NODE_ENV === "development") {
123
+ const lineNumbers = node.loc ? node.loc.start.line + (node.loc.start.line !== node.loc.end.line ? `-${node.loc.end.line}` : "") : "";
124
+ key += `:${(0, import_node_path.basename)(sourcePath)}:${lineNumbers}`;
125
+ }
126
+ return sheetStyles[key] = style, readStyleExpr(key);
127
+ }
128
+ function readStyleExpr(key) {
129
+ return (0, import_template.default)("SHEET['KEY']")({
130
+ SHEET: sheetIdentifier.name,
131
+ KEY: key
132
+ }).expression;
133
+ }
134
+ let res;
135
+ try {
136
+ res = extractor.parseSync(root, {
137
+ importsWhitelist: ["constants.js", "colors.js"],
138
+ extractStyledDefinitions: options.forceExtractStyleDefinitions,
139
+ excludeProps: /* @__PURE__ */new Set(["className", "userSelect", "whiteSpace", "textOverflow", "cursor", "contain"]),
140
+ shouldPrintDebug,
141
+ ...finalOptions,
142
+ // disable extracting variables as no native concept of them (only theme values)
143
+ disableExtractVariables: options.experimentalFlattenThemesOnNative ? !1 : "theme",
144
+ sourcePath,
145
+ // disabling flattening for now
146
+ // it's flattening a plain <Paragraph>hello</Paragraph> which breaks things because themes
147
+ // thinking it's not really worth the effort to do much compilation on native
148
+ // for now just disable flatten as it can only run in narrow places on native
149
+ // disableFlattening: 'styled',
150
+ getFlattenedNode({
151
+ isTextView
152
+ }) {
153
+ return hasImportedView || (hasImportedView = !0, root.unshiftContainer("body", importNativeView())), isTextView ? "__ReactNativeText" : "__ReactNativeView";
154
+ },
155
+ onExtractTag(props) {
156
+ assertValidTag(props.node);
157
+ const stylesExpr = t.arrayExpression([]),
158
+ hocStylesExpr = t.arrayExpression([]),
159
+ expressions = [],
160
+ finalAttrs = [],
161
+ themeKeysUsed = /* @__PURE__ */new Set();
162
+ function getStyleExpression(style) {
163
+ if (!style) return;
164
+ const {
165
+ plain,
166
+ themed
167
+ } = splitThemeStyles(style);
168
+ let themeExpr = null;
169
+ if (themed && options.experimentalFlattenThemesOnNative) {
170
+ for (const key in themed) themeKeysUsed.add(themed[key].split("$")[1]);
171
+ themeExpr = getThemedStyleExpression(themed);
172
+ }
173
+ const ident = addSheetStyle(plain, props.node);
174
+ return themeExpr ? (addStyleExpression(ident), addStyleExpression(ident, !0), themeExpr) : ident;
175
+ }
176
+ function addStyleExpression(expr, HOC = !1) {
177
+ Array.isArray(expr) ? (HOC ? hocStylesExpr : stylesExpr).elements.push(...expr) : (HOC ? hocStylesExpr : stylesExpr).elements.push(expr);
178
+ }
179
+ function getThemedStyleExpression(styles) {
180
+ const themedStylesAst = (0, import_literalToAst.literalToAst)(styles);
181
+ return themedStylesAst.properties.forEach(_ => {
182
+ const prop = _;
183
+ prop.value.type === "StringLiteral" && (prop.value = t.memberExpression(t.identifier("theme"), t.identifier(prop.value.value.slice(1) + ".get()")));
184
+ }), themedStylesAst;
185
+ }
186
+ let hasDynamicStyle = !1;
187
+ for (const attr of props.attrs) switch (attr.type) {
188
+ case "style":
189
+ {
190
+ let styleExpr = getStyleExpression(attr.value);
191
+ addStyleExpression(styleExpr), options.experimentalFlattenThemesOnNative && addStyleExpression(styleExpr, !0);
192
+ break;
193
+ }
194
+ case "ternary":
195
+ {
196
+ const {
197
+ consequent,
198
+ alternate
199
+ } = attr.value,
200
+ consExpr = getStyleExpression(consequent),
201
+ altExpr = getStyleExpression(alternate);
202
+ options.experimentalFlattenThemesOnNative && (expressions.push(attr.value.test), addStyleExpression(t.conditionalExpression(t.identifier(`_expressions[${expressions.length - 1}]`), consExpr || t.nullLiteral(), altExpr || t.nullLiteral()), !0));
203
+ const styleExpr = t.conditionalExpression(attr.value.test, consExpr || t.nullLiteral(), altExpr || t.nullLiteral());
204
+ addStyleExpression(styleExpr);
205
+ break;
206
+ }
207
+ case "attr":
208
+ {
209
+ t.isJSXSpreadAttribute(attr.value) && (0, import_extractHelpers.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);
210
+ break;
211
+ }
212
+ }
213
+ if (props.node.attributes = finalAttrs, options.experimentalFlattenThemesOnNative && (themeKeysUsed.size || hocStylesExpr.elements.length > 1 || hasDynamicStyle)) {
214
+ hasImportedViewWrapper || (root.unshiftContainer("body", importWithStyle()), root.unshiftContainer("body", importReactUseMemo()), hasImportedViewWrapper = !0);
215
+ const name = props.flatNodeName || props.node.name.name,
216
+ WrapperIdentifier = root.scope.generateUidIdentifier(name + "Wrapper");
217
+ root.pushContainer("body", t.variableDeclaration("const", [t.variableDeclarator(WrapperIdentifier, t.callExpression(t.identifier("__withStableStyle"), [t.identifier(name), t.arrowFunctionExpression([t.identifier("theme"), t.identifier("_expressions")], t.blockStatement([t.returnStatement(t.callExpression(t.identifier("__ReactUseMemo"), [t.arrowFunctionExpression([], t.blockStatement([t.returnStatement(t.arrayExpression([...hocStylesExpr.elements]))])), t.arrayExpression([t.spreadElement(t.identifier("_expressions"))])]))]))]))])), 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))));
218
+ } else props.node.attributes.push(t.jsxAttribute(t.jsxIdentifier("style"), t.jsxExpressionContainer(stylesExpr.elements.length === 1 ? stylesExpr.elements[0] : stylesExpr)));
219
+ }
220
+ });
221
+ } catch (err) {
222
+ if (err instanceof Error) {
223
+ let message = `${shouldPrintDebug === "verbose" ? err : err.message}`;
224
+ 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);
225
+ return;
226
+ }
227
+ }
228
+ if (!Object.keys(sheetStyles).length) {
229
+ shouldPrintDebug && console.info("END no styles"), res && printLog(res);
230
+ return;
231
+ }
232
+ const sheetObject = (0, import_literalToAst.literalToAst)(sheetStyles),
233
+ sheetOuter = (0, import_template.default)("const SHEET = __ReactNativeStyleSheet.create(null)")({
234
+ SHEET: sheetIdentifier.name
235
+ });
236
+ sheetOuter.declarations[0].init.arguments[0] = sheetObject, root.unshiftContainer("body", sheetOuter), root.unshiftContainer("body", importStyleSheet()), shouldPrintDebug && (console.info(`
237
+ -------- output code -------
238
+ `), console.info((0, import_generator.default)(root.parent).code.split(`
239
+ `).filter(x => !x.startsWith("//")).join(`
240
+ `))), res && printLog(res);
241
+ }
242
+ }
243
+ }
244
+ };
245
+ }
246
+ function assertValidTag(node) {
247
+ node.attributes.find(x => x.type === "JSXAttribute" && x.name.name === "style") && process.env.DEBUG?.startsWith("tamagui") && console.warn("\u26A0\uFE0F Cannot pass style attribute to extracted style");
248
+ }
249
+ function splitThemeStyles(style) {
250
+ const themed = {},
251
+ plain = {};
252
+ let noTheme = !0;
253
+ for (const key in style) {
254
+ const val = style[key];
255
+ val && val[0] === "$" ? (themed[key] = val, noTheme = !1) : plain[key] = val;
256
+ }
257
+ return {
258
+ themed: noTheme ? null : themed,
259
+ plain
260
+ };
261
+ }
262
+ //# sourceMappingURL=extractToNative.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["extractToNative_exports","__export","extractToNative","getBabelParseDefinition","getBabelPlugin","module","exports","__toCommonJS","import_core","require","import_generator","__toESM","import_helper_plugin_utils","import_parser","import_template","t","import_node_path","import_getPragmaOptions","import_createExtractor","import_createLogger","import_extractHelpers","import_literalToAst","import_loadTamagui","importNativeView","default","importStyleSheet","importWithStyle","importReactUseMemo","extractor","createExtractor","platform","tamaguiBuildOptionsLoaded","sourceFileName","sourceCode","options","ast","parse","sourceType","plugins","babelPlugin","out","transformFromAstSync","configFile","filename","Error","declare","api","assertVersion","name","visitor","Program","enter","root","sourcePath","file","opts","includes","endsWith","process","env","SOURCE_ROOT","replace","hasImportedView","hasImportedViewWrapper","sheetStyles","sheetIdentifier","scope","generateUidIdentifier","firstCommentContents","node","body","leadingComments","map","comment","value","join","firstComment","shouldPrintDebug","shouldDisable","getPragmaOptions","source","path","config","components","loadTamaguiBuildConfigSync","finalOptions","printLog","createLogger","addSheetStyle","style","key","Object","keys","length","NODE_ENV","lineNumbers","loc","start","line","end","basename","readStyleExpr","SHEET","KEY","expression","res","parseSync","importsWhitelist","extractStyledDefinitions","forceExtractStyleDefinitions","excludeProps","Set","disableExtractVariables","experimentalFlattenThemesOnNative","getFlattenedNode","isTextView","unshiftContainer","onExtractTag","props","assertValidTag","stylesExpr","arrayExpression","hocStylesExpr","expressions","finalAttrs","themeKeysUsed","getStyleExpression","plain","themed","splitThemeStyles","themeExpr","add","split","getThemedStyleExpression","ident","addStyleExpression","expr","HOC","Array","isArray","elements","push","styles","themedStylesAst","literalToAst","properties","forEach","_","prop","type","memberExpression","identifier","slice","hasDynamicStyle","attr","attrs","styleExpr","consequent","alternate","consExpr","altExpr","test","conditionalExpression","nullLiteral","isJSXSpreadAttribute","isSimpleSpread","argument","attributes","size","flatNodeName","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"],"sources":["../../src/extractor/extractToNative.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,uBAAA;AAAAC,QAAA,CAAAD,uBAAA;EAAAE,eAAA,EAAAA,CAAA,KAAAA,eAAA;EAAAC,uBAAA,EAAAA,CAAA,KAAAA,uBAAA;EAAAC,cAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAP,uBAAA;AAAA,IAAAQ,WAAA,GAA2DC,OAAA;EAC3DC,gBAAA,GAAsBC,OAAA,CAAAF,OAAA;EACtBG,0BAAA,GAAwBH,OAAA;EACxBI,aAAA,GAAsBJ,OAAA;EACtBK,eAAA,GAAqBH,OAAA,CAAAF,OAAA;EACrBM,CAAA,GAAmBJ,OAAA,CAAAF,OAAA;EACnBO,gBAAA,GAAyBP,OAAA;EACzBQ,uBAAA,GAAiCR,OAAA;EAEjCS,sBAAA,GAAgCT,OAAA;EAChCU,mBAAA,GAA6BV,OAAA;EAC7BW,qBAAA,GAA+BX,OAAA;EAC/BY,mBAAA,GAA6BZ,OAAA;EAC7Ba,kBAAA,GAA2Cb,OAAA;AAE3C,MAAMc,gBAAA,OAAmBT,eAAA,CAAAU,OAAA,EAAS;AAAA;AAAA;AAAA,CAGjC;EAEKC,gBAAA,OAA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AU,MAEV3E,KAAA,CAAMrC,GAAG,IAAIiH,GAAA;EAEjB;EACA,OAAO;IAAE3E,MAAA,EAAQ0E,OAAA,GAAU,OAAO1E,MAAA;IAAQD;EAAM;AAClD","ignoreList":[]}
@@ -0,0 +1,35 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var findTopmostFunction_exports = {};
22
+ __export(findTopmostFunction_exports, {
23
+ findTopmostFunction: () => findTopmostFunction
24
+ });
25
+ module.exports = __toCommonJS(findTopmostFunction_exports);
26
+ function findTopmostFunction(jsxPath) {
27
+ const isFunction = path => path.isArrowFunctionExpression() || path.isFunctionDeclaration() || path.isFunctionExpression();
28
+ let compFn = jsxPath.findParent(isFunction);
29
+ for (; compFn;) {
30
+ const parent = compFn.findParent(isFunction);
31
+ if (parent) compFn = parent;else break;
32
+ }
33
+ return compFn || null;
34
+ }
35
+ //# sourceMappingURL=findTopmostFunction.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["findTopmostFunction_exports","__export","findTopmostFunction","module","exports","__toCommonJS","jsxPath","isFunction","path","isArrowFunctionExpression","isFunctionDeclaration","isFunctionExpression","compFn","findParent","parent"],"sources":["../../src/extractor/findTopmostFunction.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,2BAAA;AAAAC,QAAA,CAAAD,2BAAA;EAAAE,mBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAL,2BAAA;AAGO,SAASE,oBAAoBI,OAAA,EAAiC;EAEnE,MAAMC,UAAA,GAAcC,IAAA,IAClBA,IAAA,CAAKC,yBAAA,CAA0B,KAC/BD,IAAA,CAAKE,qBAAA,CAAsB,KAC3BF,IAAA,CAAKG,oBAAA,CAAqB;EAC5B,IAAIC,MAAA,GAA+BN,OAAA,CAAQO,UAAA,CAAWN,UAAU;EAChE,OAAOK,MAAA,GAAQ;IACb,MAAME,MAAA,GAASF,MAAA,CAAOC,UAAA,CAAWN,UAAU;IAC3C,IAAIO,MAAA,EACFF,MAAA,GAASE,MAAA,MAET;EAEJ;EACA,OAAKF,MAAA,IAEI;AAGX","ignoreList":[]}
@@ -1,26 +1,34 @@
1
- "use strict";
2
1
  var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: !0 });
10
- }, __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from == "object" || typeof from == "function")
12
- for (let key of __getOwnPropNames(from))
13
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- return to;
15
- };
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
16
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
21
  // If the importer is in node compatibility mode or this is not an ESM
18
22
  // file that has been converted to a CommonJS file using a Babel-
19
23
  // compatible transform (i.e. "__esModule" has not been set), then set
20
24
  // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
22
- mod
23
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
24
32
  var generatedUid_exports = {};
25
33
  __export(generatedUid_exports, {
26
34
  generateUid: () => generateUid
@@ -31,15 +39,10 @@ function generateUid(scope, name) {
31
39
  if (typeof scope != "object") throw "generateUid expects a scope object as its first parameter";
32
40
  if (!(typeof name == "string" && name !== "")) throw "generateUid expects a valid name as its second parameter";
33
41
  name = t.toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, "");
34
- var uid, i = 0;
35
- do
36
- i > 1 ? uid = name + i : uid = name, i++;
37
- while (scope.hasLabel(uid) || scope.hasBinding(uid) || scope.hasGlobal(uid) || scope.hasReference(uid));
38
- var program = scope.getProgramParent();
42
+ let uid,
43
+ i = 0;
44
+ do i > 1 ? uid = name + i : uid = name, i++; while (scope.hasLabel(uid) || scope.hasBinding(uid) || scope.hasGlobal(uid) || scope.hasReference(uid));
45
+ const program = scope.getProgramParent();
39
46
  return program.references[uid] = !0, program.uids[uid] = !0, uid;
40
47
  }
41
- // Annotate the CommonJS export names for ESM import in node:
42
- 0 && (module.exports = {
43
- generateUid
44
- });
45
- //# sourceMappingURL=generatedUid.js.map
48
+ //# sourceMappingURL=generatedUid.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["generatedUid_exports","__export","generateUid","module","exports","__toCommonJS","t","__toESM","require","scope","name","toIdentifier","replace","uid","i","hasLabel","hasBinding","hasGlobal","hasReference","program","getProgramParent","references","uids"],"sources":["../../src/extractor/generatedUid.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,oBAAA;AAAAC,QAAA,CAAAD,oBAAA;EAAAE,WAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAL,oBAAA;AAAA,IAAAM,CAAA,GAAmBC,OAAA,CAAAC,OAAA;AAQZ,SAASN,YAAYO,KAAA,EAAYC,IAAA,EAAsB;EAC5D,IAAM,OAAOD,KAAA,IAAU,UACrB,MAAM;EACR,IAAI,EAAE,OAAOC,IAAA,IAAS,YAAYA,IAAA,KAAS,KACzC,MAAM;EAERA,IAAA,GAAOJ,CAAA,CACJK,YAAA,CAAaD,IAAI,EACjBE,OAAA,CAAQ,OAAO,EAAE,EACjBA,OAAA,CAAQ,YAAY,EAAE;EAEzB,IAAIC,GAAA;IACAC,CAAA,GAAI;EACR,GACMA,CAAA,GAAI,IACND,GAAA,GAAMH,IAAA,GAAOI,CAAA,GAEbD,GAAA,GAAMH,IAAA,EAERI,CAAA,WAEAL,KAAA,CAAMM,QAAA,CAASF,GAAG,KAClBJ,KAAA,CAAMO,UAAA,CAAWH,GAAG,KACpBJ,KAAA,CAAMQ,SAAA,CAAUJ,GAAG,KACnBJ,KAAA,CAAMS,YAAA,CAAaL,GAAG;EAGxB,MAAMM,OAAA,GAAUV,KAAA,CAAMW,gBAAA,CAAiB;EACvC,OAAAD,OAAA,CAAQE,UAAA,CAAWR,GAAG,IAAI,IAC1BM,OAAA,CAAQG,IAAA,CAAKT,GAAG,IAAI,IAEbA,GAAA;AACT","ignoreList":[]}
@@ -0,0 +1,30 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var getPrefixLogs_exports = {};
22
+ __export(getPrefixLogs_exports, {
23
+ getPrefixLogs: () => getPrefixLogs
24
+ });
25
+ module.exports = __toCommonJS(getPrefixLogs_exports);
26
+ var import_cli_color = require("@tamagui/cli-color");
27
+ function getPrefixLogs(options) {
28
+ return options?.prefixLogs ?? ` \u{1F425} [tamagui] ${(0, import_cli_color.colorString)(import_cli_color.Color.FgYellow, options?.platform || "web")}`;
29
+ }
30
+ //# sourceMappingURL=getPrefixLogs.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getPrefixLogs_exports","__export","getPrefixLogs","module","exports","__toCommonJS","import_cli_color","require","options","prefixLogs","colorString","Color","FgYellow","platform"],"sources":["../../src/extractor/getPrefixLogs.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,qBAAA;AAAAC,QAAA,CAAAD,qBAAA;EAAAE,aAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAL,qBAAA;AAAA,IAAAM,gBAAA,GAAmCC,OAAA;AAG5B,SAASL,cAAcM,OAAA,EAA0B;EACtD,OACEA,OAAA,EAASC,UAAA,IACT,6BAAkBH,gBAAA,CAAAI,WAAA,EAAYJ,gBAAA,CAAAK,KAAA,CAAMC,QAAA,EAAUJ,OAAA,EAASK,QAAA,IAAY,KAAK,CAAC;AAE7E","ignoreList":[]}
@@ -0,0 +1,68 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
32
+ var getPropValueFromAttributes_exports = {};
33
+ __export(getPropValueFromAttributes_exports, {
34
+ getPropValueFromAttributes: () => getPropValueFromAttributes
35
+ });
36
+ module.exports = __toCommonJS(getPropValueFromAttributes_exports);
37
+ var import_generator = __toESM(require("@babel/generator")),
38
+ t = __toESM(require("@babel/types")),
39
+ import_accessSafe = require("./accessSafe.mjs");
40
+ function getPropValueFromAttributes(propName, attrs) {
41
+ let propIndex = -1,
42
+ jsxAttr = null;
43
+ for (let idx = -1, len = attrs.length; ++idx < len;) {
44
+ const attr = attrs[idx];
45
+ if (t.isJSXAttribute(attr) && attr.name && attr.name.name === propName) {
46
+ propIndex = idx, jsxAttr = attr;
47
+ break;
48
+ }
49
+ }
50
+ if (!jsxAttr || jsxAttr.value == null) return null;
51
+ let propValue = jsxAttr.value;
52
+ if (t.isJSXExpressionContainer(propValue) && (propValue = propValue.expression), t.isJSXEmptyExpression(propValue)) return console.error("encountered JSXEmptyExpression"), null;
53
+ const applicableSpreads = attrs.filter(
54
+ // 1. idx is greater than propValue prop index
55
+ // 2. attr is a spread operator
56
+ (attr, idx) => {
57
+ if (t.isJSXSpreadAttribute(attr)) {
58
+ if (t.isIdentifier(attr.argument) || t.isMemberExpression(attr.argument)) return idx > propIndex;
59
+ if (t.isLogicalExpression(attr.argument)) return !1;
60
+ throw new Error(`unsupported spread of type "${attr.argument.type}": ${
61
+ // @ts-ignore
62
+ (0, import_generator.default)(attr).code}`);
63
+ }
64
+ return !1;
65
+ }).map(attr => attr.argument);
66
+ return applicableSpreads.length > 0 && (propValue = applicableSpreads.reduce((acc, val) => t.logicalExpression("||", (0, import_accessSafe.accessSafe)(val, propName), acc), propValue)), propValue;
67
+ }
68
+ //# sourceMappingURL=getPropValueFromAttributes.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getPropValueFromAttributes_exports","__export","getPropValueFromAttributes","module","exports","__toCommonJS","import_generator","__toESM","require","t","import_accessSafe","propName","attrs","propIndex","jsxAttr","idx","len","length","attr","isJSXAttribute","name","value","propValue","isJSXExpressionContainer","expression","isJSXEmptyExpression","console","error","applicableSpreads","filter","isJSXSpreadAttribute","isIdentifier","argument","isMemberExpression","isLogicalExpression","Error","type","default","code","map","reduce","acc","val","logicalExpression","accessSafe"],"sources":["../../src/extractor/getPropValueFromAttributes.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,kCAAA;AAAAC,QAAA,CAAAD,kCAAA;EAAAE,0BAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAL,kCAAA;AAAA,IAAAM,gBAAA,GAAqBC,OAAA,CAAAC,OAAA;EACrBC,CAAA,GAAmBF,OAAA,CAAAC,OAAA;EAEnBE,iBAAA,GAA2BF,OAAA;AAkBpB,SAASN,2BACdS,QAAA,EACAC,KAAA,EACqB;EACrB,IAAIC,SAAA,GAAY;IACZC,OAAA,GAAiC;EACrC,SAASC,GAAA,GAAM,IAAIC,GAAA,GAAMJ,KAAA,CAAMK,MAAA,EAAQ,EAAEF,GAAA,GAAMC,GAAA,GAAO;IACpD,MAAME,IAAA,GAAON,KAAA,CAAMG,GAAG;IACtB,IAAIN,CAAA,CAAEU,cAAA,CAAeD,IAAI,KAAKA,IAAA,CAAKE,IAAA,IAAQF,IAAA,CAAKE,IAAA,CAAKA,IAAA,KAAST,QAAA,EAAU;MACtEE,SAAA,GAAYE,GAAA,EACZD,OAAA,GAAUI,IAAA;MACV;IACF;EACF;EAEA,IAAI,CAACJ,OAAA,IAAWA,OAAA,CAAQO,KAAA,IAAS,MAC/B,OAAO;EAGT,IAAIC,SAAA,GAMeR,OAAA,CAAQO,KAAA;EAO3B,IALIZ,CAAA,CAAEc,wBAAA,CAAyBD,SAAS,MACtCA,SAAA,GAAYA,SAAA,CAAUE,UAAA,GAIpBf,CAAA,CAAEgB,oBAAA,CAAqBH,SAAS,GAClC,OAAAI,OAAA,CAAQC,KAAA,CAAM,gCAAgC,GACvC;EAIT,MAAMC,iBAAA,GAAoBhB,KAAA,CACvBiB,MAAA;EAAA;EAAA;EAGC,CAACX,IAAA,EAAMH,GAAA,KAAsC;IAC3C,IAAIN,CAAA,CAAEqB,oBAAA,CAAqBZ,IAAI,GAAG;MAChC,IAAIT,CAAA,CAAEsB,YAAA,CAAab,IAAA,CAAKc,QAAQ,KAAKvB,CAAA,CAAEwB,kBAAA,CAAmBf,IAAA,CAAKc,QAAQ,GACrE,OAAOjB,GAAA,GAAMF,SAAA;MAEf,IAAIJ,CAAA,CAAEyB,mBAAA,CAAoBhB,IAAA,CAAKc,QAAQ,GACrC,OAAO;MAET,MAAM,IAAIG,KAAA,CACR,+BAA+BjB,IAAA,CAAKc,QAAA,CAASI,IAAI;MAAA;MAAA,IAE/C9B,gBAAA,CAAA+B,OAAA,EAASnB,IAAW,EAAEoB,IACxB,EACF;IACF;IACA,OAAO;EACT,CACF,EACCC,GAAA,CAAKrB,IAAA,IAASA,IAAA,CAAKc,QAAQ;EAK9B,OAAIJ,iBAAA,CAAkBX,MAAA,GAAS,MAC7BK,SAAA,GAAYM,iBAAA,CAAkBY,MAAA,CAC5B,CAACC,GAAA,EAAKC,GAAA,KAAQjC,CAAA,CAAEkC,iBAAA,CAAkB,UAAMjC,iBAAA,CAAAkC,UAAA,EAAWF,GAAA,EAAK/B,QAAQ,GAAG8B,GAAG,GACtEnB,SACF,IAGKA,SAAA;AACT","ignoreList":[]}
@@ -0,0 +1,65 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
32
+ var getSourceModule_exports = {};
33
+ __export(getSourceModule_exports, {
34
+ getSourceModule: () => getSourceModule
35
+ });
36
+ module.exports = __toCommonJS(getSourceModule_exports);
37
+ var t = __toESM(require("@babel/types"));
38
+ function getSourceModule(itemName, itemBinding) {
39
+ if (!itemBinding.constant) return null;
40
+ let sourceModule,
41
+ imported,
42
+ local,
43
+ destructured,
44
+ usesImportSyntax = !1;
45
+ const itemNode = itemBinding.path.node;
46
+ if (t.isImportDefaultSpecifier(itemNode) || t.isImportSpecifier(itemNode)) t.isImportDeclaration(itemBinding.path.parent) && (sourceModule = itemBinding.path.parent.source.value, local = itemNode.local.name, usesImportSyntax = !0, t.isImportSpecifier(itemNode) ? (imported = itemNode.imported.name, destructured = !0) : (imported = itemNode.local.name, destructured = !1));else if (t.isVariableDeclarator(itemNode) && itemNode.init != null && t.isCallExpression(itemNode.init) && t.isIdentifier(itemNode.init.callee) && itemNode.init.callee.name === "require" && itemNode.init.arguments.length === 1) {
47
+ const firstArg = itemNode.init.arguments[0];
48
+ if (!t.isStringLiteral(firstArg)) return null;
49
+ if (sourceModule = firstArg.value, t.isIdentifier(itemNode.id)) local = itemNode.id.name, imported = itemNode.id.name, destructured = !1;else if (t.isObjectPattern(itemNode.id)) {
50
+ for (const objProp of itemNode.id.properties) if (t.isObjectProperty(objProp) && t.isIdentifier(objProp.value) && objProp.value.name === itemName) {
51
+ local = objProp.value.name, imported = objProp.key.name, destructured = !0;
52
+ break;
53
+ }
54
+ if (!local || !imported) return console.error("could not find prop with value `%s`", itemName), null;
55
+ } else return console.error("Unhandled id type: %s", itemNode.id.type), null;
56
+ } else return null;
57
+ return {
58
+ destructured,
59
+ imported,
60
+ local,
61
+ sourceModule,
62
+ usesImportSyntax
63
+ };
64
+ }
65
+ //# sourceMappingURL=getSourceModule.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getSourceModule_exports","__export","getSourceModule","module","exports","__toCommonJS","t","__toESM","require","itemName","itemBinding","constant","sourceModule","imported","local","destructured","usesImportSyntax","itemNode","path","node","isImportDefaultSpecifier","isImportSpecifier","isImportDeclaration","parent","source","value","name","isVariableDeclarator","init","isCallExpression","isIdentifier","callee","arguments","length","firstArg","isStringLiteral","id","isObjectPattern","objProp","properties","isObjectProperty","key","console","error","type"],"sources":["../../src/extractor/getSourceModule.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,uBAAA;AAAAC,QAAA,CAAAD,uBAAA;EAAAE,eAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAL,uBAAA;AAAA,IAAAM,CAAA,GAAmBC,OAAA,CAAAC,OAAA;AAUZ,SAASN,gBACdO,QAAA,EACAC,WAAA,EAIqB;EAErB,IAAI,CAACA,WAAA,CAAYC,QAAA,EACf,OAAO;EAGT,IAAIC,YAAA;IACAC,QAAA;IACAC,KAAA;IACAC,YAAA;IACAC,gBAAA,GAAmB;EAEvB,MAAMC,QAAA,GAAWP,WAAA,CAAYQ,IAAA,CAAKC,IAAA;EAElC,IAAIb,CAAA,CAAEc,wBAAA,CAAyBH,QAAQ,KAAKX,CAAA,CAAEe,iBAAA,CAAkBJ,QAAQ,GAClEX,CAAA,CAAE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