@tamagui/codemod-flat-values 3.0.0-beta.924.1 → 3.0.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.
package/dist/index.mjs CHANGED
@@ -1,18 +1,298 @@
1
1
  #!/usr/bin/env node
2
2
  import { existsSync, mkdirSync, writeFileSync } from "node:fs";
3
3
  import { dirname, relative, resolve } from "node:path";
4
- import { resolveTamaguiHost } from "@tamagui/language-service/host";
5
4
  import { stylePropsTextOnly } from "@tamagui/helpers";
6
5
  import { IndentationText, ModuleKind, ModuleResolutionKind, Node, Project, ScriptTarget, SyntaxKind, ts } from "ts-morph";
7
6
  import { planContainers } from "./containers.mjs";
8
7
  import { convertJsxSite, convertStyleObject } from "./convert.mjs";
9
- import { compact, unwrapExpression } from "./expressions.mjs";
8
+ import { compact, numericValue, runtimeType, unwrapExpression } from "./expressions.mjs";
10
9
  import { addFunctionalVariantTypeImports, convertFunctionalVariants } from "./functionalVariants.mjs";
11
10
  import { codemodMediaNames, createModifierRegistry, grammarPlatformNames, shorthands } from "./grammar.mjs";
12
11
  import { createProvenance } from "./provenance.mjs";
13
12
  import { renderReport } from "./report.mjs";
14
13
  import { convertSheetFrames } from "./sheetAnatomy.mjs";
14
+ import { convertTransitions } from "./transition.mjs";
15
+ import { isLegacyConditionName } from "./legacyNames.mjs";
15
16
 
17
+ function propertyName(node) {
18
+ if (Node.isIdentifier(node) || Node.isStringLiteral(node) || Node.isNumericLiteral(node)) {
19
+ return node.getText().replace(/^['"]|['"]$/g, "");
20
+ }
21
+ return null;
22
+ }
23
+ function isLineHeightName(name) {
24
+ return name === "lineHeight" || name === "lh";
25
+ }
26
+ function extractedTokenValue(expression) {
27
+ const nodes = [expression, ...expression.getDescendants()];
28
+ return nodes.some((node) => Node.isPropertyAccessExpression(node) && node.getName() === "val" || Node.isCallExpression(node) && Node.isIdentifier(node.getExpression()) && node.getExpression().getText() === "getVariableValue");
29
+ }
30
+ function pixelReplacement(expression) {
31
+ const current = unwrapExpression(expression);
32
+ const number = numericValue(current);
33
+ if (number !== null) return {
34
+ text: JSON.stringify(`${number}px`),
35
+ dynamic: false
36
+ };
37
+ const type = runtimeType(current);
38
+ if (type.kind === "string") return null;
39
+ if (extractedTokenValue(current)) {
40
+ return { flag: {
41
+ code: "ambiguous-line-height-token-value",
42
+ detail: `lineHeight value "${compact(current.getText())}" extracts a token value whose units are no longer visible; replace it with an explicit ratio or px length by hand`
43
+ } };
44
+ }
45
+ if (type.kind === "number") {
46
+ return {
47
+ text: `\`\${${current.getText()}}px\``,
48
+ dynamic: true
49
+ };
50
+ }
51
+ return { flag: {
52
+ code: "ambiguous-line-height-expression",
53
+ detail: `lineHeight value "${compact(current.getText())}" has no provable numeric type; replace old pixel semantics with an explicit px length by hand`
54
+ } };
55
+ }
56
+ function declarationContainsNumericLineHeight(expression) {
57
+ const symbol = expression.getSymbol();
58
+ if (!symbol) return false;
59
+ for (const declaration of symbol.getDeclarations()) {
60
+ for (const property of [...Node.isPropertyAssignment(declaration) ? [declaration] : [], ...declaration.getDescendantsOfKind(SyntaxKind.PropertyAssignment)]) {
61
+ if (!isLineHeightName(propertyName(property.getNameNode()))) continue;
62
+ const initializer = property.getInitializer();
63
+ if (!initializer) continue;
64
+ const value = unwrapExpression(initializer);
65
+ if (numericValue(value) !== null || runtimeType(value).kind === "number") return true;
66
+ }
67
+ }
68
+ return false;
69
+ }
70
+ function lineHeightValueIsUnmigrated(expression) {
71
+ const current = unwrapExpression(expression);
72
+ if (Node.isObjectLiteralExpression(current)) {
73
+ return current.getProperties().some((property) => {
74
+ if (!Node.isPropertyAssignment(property)) return false;
75
+ const initializer = property.getInitializer();
76
+ return initializer !== void 0 && lineHeightValueIsUnmigrated(initializer);
77
+ });
78
+ }
79
+ if (Node.isConditionalExpression(current)) {
80
+ return lineHeightValueIsUnmigrated(current.getWhenTrue()) || lineHeightValueIsUnmigrated(current.getWhenFalse());
81
+ }
82
+ return pixelReplacement(current) !== null;
83
+ }
84
+ function replaceWithin(source, sourceStart, edits) {
85
+ let output = source;
86
+ for (const edit of [...edits].sort((left, right) => right.start - left.start)) {
87
+ output = output.slice(0, edit.start - sourceStart) + edit.text + output.slice(edit.end - sourceStart);
88
+ }
89
+ return output;
90
+ }
91
+ function migrateLegacyLineHeights(sourceFile, provenance2) {
92
+ const edits = [];
93
+ const claimed = /* @__PURE__ */ new Set();
94
+ const reports = [];
95
+ const scanLineHeightExpression = (expression, contextEdits, flags) => {
96
+ const current = unwrapExpression(expression);
97
+ if (Node.isObjectLiteralExpression(current)) {
98
+ for (const property of current.getProperties()) {
99
+ if (!Node.isPropertyAssignment(property)) continue;
100
+ const initializer = property.getInitializer();
101
+ if (initializer) scanLineHeightExpression(initializer, contextEdits, flags);
102
+ }
103
+ return;
104
+ }
105
+ if (Node.isConditionalExpression(current)) {
106
+ scanLineHeightExpression(current.getWhenTrue(), contextEdits, flags);
107
+ scanLineHeightExpression(current.getWhenFalse(), contextEdits, flags);
108
+ return;
109
+ }
110
+ if (claimed.has(current.getStart())) return;
111
+ const replacement = pixelReplacement(current);
112
+ if (!replacement) return;
113
+ claimed.add(current.getStart());
114
+ if ("flag" in replacement) {
115
+ flags.push(replacement.flag);
116
+ return;
117
+ }
118
+ const edit = {
119
+ start: current.getStart(),
120
+ end: current.getEnd(),
121
+ text: replacement.text,
122
+ dynamic: replacement.dynamic
123
+ };
124
+ edits.push(edit);
125
+ contextEdits.push(edit);
126
+ };
127
+ const scanProperty = (property, contextEdits, flags) => {
128
+ if (!isLineHeightName(propertyName(property.getNameNode()))) return;
129
+ const initializer = property.getInitializer();
130
+ if (initializer) scanLineHeightExpression(initializer, contextEdits, flags);
131
+ };
132
+ const scanObject = (object, contextEdits, flags) => {
133
+ for (const property of object.getDescendantsOfKind(SyntaxKind.PropertyAssignment)) {
134
+ scanProperty(property, contextEdits, flags);
135
+ }
136
+ for (const property of object.getProperties()) {
137
+ if (Node.isPropertyAssignment(property)) scanProperty(property, contextEdits, flags);
138
+ }
139
+ };
140
+ const addReport = (node, kind, label, contextEdits, flags) => {
141
+ if (!contextEdits.length && !flags.length) return;
142
+ const before = compact(node.getText());
143
+ reports.push({
144
+ kind,
145
+ label,
146
+ line: sourceFile.getLineAndColumnAtPos(node.getStart()).line,
147
+ before,
148
+ after: compact(replaceWithin(node.getText(), node.getStart(), contextEdits)),
149
+ programs: contextEdits.map((edit) => ({
150
+ name: "lineHeight",
151
+ value: edit.text,
152
+ dynamic: edit.dynamic
153
+ })),
154
+ assessments: [],
155
+ assessmentVerdict: "clean",
156
+ warnings: [],
157
+ flags,
158
+ inventory: [],
159
+ pending: [],
160
+ notes: [contextEdits.length ? "numeric lineHeight used V2 pixel semantics and now carries an explicit px unit" : "lineHeight was left authored for a manual unit decision"],
161
+ legacyLeft: flags.length
162
+ });
163
+ };
164
+ const scanJsx = (opening) => {
165
+ const contextEdits = [];
166
+ const flags = [];
167
+ for (const attribute of opening.getAttributes()) {
168
+ if (Node.isJsxSpreadAttribute(attribute)) {
169
+ const expression2 = unwrapExpression(attribute.getExpression());
170
+ if (Node.isObjectLiteralExpression(expression2)) {
171
+ scanObject(expression2, contextEdits, flags);
172
+ } else if (declarationContainsNumericLineHeight(expression2)) {
173
+ flags.push({
174
+ code: "ambiguous-shared-line-height-style",
175
+ detail: `spread "${compact(expression2.getText())}" contains numeric lineHeight and may also be consumed outside Tamagui; migrate it at this Tamagui boundary by hand`
176
+ });
177
+ }
178
+ continue;
179
+ }
180
+ if (!Node.isJsxAttribute(attribute)) continue;
181
+ const nameNode = attribute.getNameNode();
182
+ const name = Node.isIdentifier(nameNode) ? nameNode.getText() : null;
183
+ const initializer = attribute.getInitializer();
184
+ if (isLineHeightName(name)) {
185
+ if (!Node.isJsxExpression(initializer)) continue;
186
+ const expression2 = initializer.getExpression();
187
+ if (!expression2) continue;
188
+ const current2 = unwrapExpression(expression2);
189
+ const number = numericValue(current2);
190
+ if (number !== null && !claimed.has(current2.getStart())) {
191
+ claimed.add(current2.getStart());
192
+ const edit = {
193
+ start: initializer.getStart(),
194
+ end: initializer.getEnd(),
195
+ text: JSON.stringify(`${number}px`),
196
+ dynamic: false
197
+ };
198
+ edits.push(edit);
199
+ contextEdits.push(edit);
200
+ } else {
201
+ scanLineHeightExpression(current2, contextEdits, flags);
202
+ }
203
+ continue;
204
+ }
205
+ if (isLegacyConditionName(name || "") && Node.isJsxExpression(initializer)) {
206
+ const expression2 = initializer.getExpression();
207
+ if (expression2) {
208
+ const current2 = unwrapExpression(expression2);
209
+ for (const object of [...Node.isObjectLiteralExpression(current2) ? [current2] : [], ...current2.getDescendantsOfKind(SyntaxKind.ObjectLiteralExpression)]) {
210
+ scanObject(object, contextEdits, flags);
211
+ }
212
+ }
213
+ continue;
214
+ }
215
+ if (name !== "style" || !Node.isJsxExpression(initializer)) continue;
216
+ const expression = initializer.getExpression();
217
+ if (!expression) continue;
218
+ const current = unwrapExpression(expression);
219
+ const objects = [...Node.isObjectLiteralExpression(current) ? [current] : [], ...current.getDescendantsOfKind(SyntaxKind.ObjectLiteralExpression)];
220
+ if (objects.length) {
221
+ for (const object of objects) scanObject(object, contextEdits, flags);
222
+ } else if (declarationContainsNumericLineHeight(current)) {
223
+ flags.push({
224
+ code: "ambiguous-shared-line-height-style",
225
+ detail: `style "${compact(current.getText())}" contains numeric lineHeight and may also be consumed by React Native or Restyle; migrate it at this Tamagui boundary by hand`
226
+ });
227
+ }
228
+ }
229
+ addReport(opening, "jsx", `<${opening.getTagNameNode().getText()}> lineHeight`, contextEdits, flags);
230
+ };
231
+ const scanCall = (call, label) => {
232
+ const contextEdits = [];
233
+ const flags = [];
234
+ for (const argument of call.getArguments()) {
235
+ for (const object of [...Node.isObjectLiteralExpression(argument) ? [argument] : [], ...argument.getDescendantsOfKind(SyntaxKind.ObjectLiteralExpression)]) {
236
+ scanObject(object, contextEdits, flags);
237
+ }
238
+ }
239
+ addReport(call, "styled", label, contextEdits, flags);
240
+ };
241
+ const wrapperCache = /* @__PURE__ */ new Map();
242
+ for (const opening of [...sourceFile.getDescendantsOfKind(SyntaxKind.JsxOpeningElement), ...sourceFile.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement)]) {
243
+ if (provenance2.isTamaguiElement(opening)) {
244
+ scanJsx(opening);
245
+ continue;
246
+ }
247
+ const hasLegacyValue = opening.getAttributes().some((attribute) => {
248
+ if (!Node.isJsxAttribute(attribute)) return false;
249
+ const name = propertyName(attribute.getNameNode());
250
+ const initializer = attribute.getInitializer();
251
+ if (!initializer || !Node.isJsxExpression(initializer)) return false;
252
+ const expression = initializer.getExpression();
253
+ if (!expression) return false;
254
+ if (isLineHeightName(name)) return lineHeightValueIsUnmigrated(expression);
255
+ if (name !== "style") return false;
256
+ const current = unwrapExpression(expression);
257
+ const properties = current.getDescendantsOfKind(SyntaxKind.PropertyAssignment);
258
+ return properties.length ? properties.some((property) => {
259
+ const value = property.getInitializer();
260
+ return isLineHeightName(propertyName(property.getNameNode())) && value !== void 0 && lineHeightValueIsUnmigrated(value);
261
+ }) : declarationContainsNumericLineHeight(current);
262
+ });
263
+ if (!hasLegacyValue) continue;
264
+ const tag = opening.getTagNameNode();
265
+ const symbol = tag.getSymbol();
266
+ if (!symbol) continue;
267
+ const declarations = (symbol.getAliasedSymbol() ?? symbol).getDeclarations();
268
+ const isLocalWrapper = declarations.some((declaration) => {
269
+ const cached = wrapperCache.get(declaration);
270
+ if (cached !== void 0) return cached;
271
+ const file = declaration.getSourceFile();
272
+ const filePath = file.getFilePath();
273
+ const local = !file.isDeclarationFile() && !filePath.includes("/node_modules/") && !relative(projectRoot, filePath).startsWith("..");
274
+ const wrapsTamagui = local && [...declaration.getDescendantsOfKind(SyntaxKind.JsxOpeningElement), ...declaration.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement)].some((child) => provenance2.isTamaguiElement(child));
275
+ wrapperCache.set(declaration, wrapsTamagui);
276
+ return wrapsTamagui;
277
+ });
278
+ if (!isLocalWrapper) continue;
279
+ addReport(opening, "jsx", `<${tag.getText()}> lineHeight`, [], [{
280
+ code: "ambiguous-wrapper-line-height",
281
+ detail: `local wrapper <${tag.getText()}> renders Tamagui JSX, so numeric lineHeight may still be V2 pixels, but the wrapper may transform units; migrate this call site by hand`
282
+ }]);
283
+ }
284
+ for (const call of sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression)) {
285
+ if (provenance2.isTamaguiStyledCall(call)) {
286
+ scanCall(call, `styled(${compact(call.getArguments()[0]?.getText() ?? "unknown")}, \u2026) lineHeight`);
287
+ } else if (provenance2.isTamaguiStyleCall(call)) {
288
+ scanCall(call, `${compact(call.getExpression().getText())}(\u2026) lineHeight`);
289
+ }
290
+ }
291
+ if (edits.length) {
292
+ sourceFile.replaceWithText(replaceWithin(sourceFile.getFullText(), 0, edits));
293
+ }
294
+ return reports;
295
+ }
16
296
  const projectRoot = process.cwd();
17
297
  const defaultReportPath = resolve(projectRoot, "tamagui-flat-values-report.md");
18
298
  const ignoreMarker = ".tamagui-flat-values-ignore";
@@ -54,7 +334,7 @@ function collectFiles(inputs2) {
54
334
  jsx: 4,
55
335
  target: ScriptTarget.ES2020,
56
336
  module: ModuleKind.ESNext,
57
- moduleResolution: ModuleResolutionKind.NodeJs,
337
+ moduleResolution: ModuleResolutionKind.Bundler,
58
338
  skipLibCheck: true,
59
339
  strictNullChecks: true,
60
340
  baseUrl: projectRoot
@@ -201,9 +481,15 @@ for (const [shorthand, longhand] of Object.entries(shorthands)) {
201
481
  else shorthandSpellings.set(longhand, [shorthand]);
202
482
  }
203
483
  function typeAwareHost(node) {
204
- const checker = node.getProject().getTypeChecker().compilerObject;
205
- const host = resolveTamaguiHost(checker, node.compilerNode);
206
- if (!host) return host;
484
+ const checker = node.getProject().getTypeChecker();
485
+ const componentType = checker.getTypeAtLocation(node);
486
+ if (!componentType.getProperty("staticConfig")) return void 0;
487
+ const propsTypes = componentType.getCallSignatures().flatMap((signature) => signature.getParameters().slice(0, 1)).map((props) => checker.getTypeOfSymbolAtLocation(props, node));
488
+ if (propsTypes.length === 0) return void 0;
489
+ const host = {
490
+ displayName: node.getText(),
491
+ accepts: (property) => propsTypes.some((propsType) => propsType.getApparentType().getProperty(property) !== void 0)
492
+ };
207
493
  const accepts = (property) => host.accepts(property) || (shorthandSpellings.get(property)?.some((spelling) => host.accepts(spelling)) ?? false);
208
494
  if (node.getText() !== "View") return {
209
495
  ...host,
@@ -214,11 +500,22 @@ function typeAwareHost(node) {
214
500
  accepts: (property) => !(property in stylePropsTextOnly) && accepts(property)
215
501
  };
216
502
  }
217
- function inspectFile(sourceFile, registry, provenance2, write2) {
503
+ function inspectFile(sourceFile, registry, provenance2, sourceSemantics2, lineHeightOnly2, write2) {
504
+ const lineHeightSites = sourceSemantics2 === "v2-pixels" ? migrateLegacyLineHeights(sourceFile, provenance2) : [];
505
+ if (lineHeightOnly2) {
506
+ return {
507
+ file: relative(projectRoot, sourceFile.getFilePath()),
508
+ sites: lineHeightSites,
509
+ functionalVariants: [],
510
+ sheetFrames: [],
511
+ transitions: []
512
+ };
513
+ }
218
514
  const sheetFrames = convertSheetFrames(sourceFile, provenance2, write2);
515
+ const transitions = convertTransitions(sourceFile, provenance2, write2);
219
516
  const containers = planContainers(sourceFile, registry);
220
517
  const targets = conversionTargets(sourceFile.getFilePath());
221
- const sites = [];
518
+ const sites = [...lineHeightSites];
222
519
  const functionalVariants = [];
223
520
  const requiredTypeImports = [];
224
521
  const styledCalls = sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression).filter((call) => provenance2.isTamaguiStyledCall(call)).sort((left, right) => right.getStart() - left.getStart());
@@ -247,7 +544,8 @@ function inspectFile(sourceFile, registry, provenance2, write2) {
247
544
  file: relative(projectRoot, sourceFile.getFilePath()),
248
545
  sites,
249
546
  functionalVariants,
250
- sheetFrames
547
+ sheetFrames,
548
+ transitions
251
549
  };
252
550
  }
253
551
  const usage = `Converts Tamagui style syntax to V3 flat property values and reports what it cannot convert.
@@ -257,6 +555,10 @@ const usage = `Converts Tamagui style syntax to V3 flat property values and repo
257
555
  --report <path> where to write the Markdown report (default: ${relative(projectRoot, defaultReportPath)})
258
556
  --json <path> also write the machine-readable report
259
557
  --write rewrite every statically safe conversion in place
558
+ --source-semantics <v2-pixels|v3-ratios>
559
+ interpret numeric Tamagui lineHeight from that source contract
560
+ (default: v3-ratios)
561
+ --line-height-only apply and report only the selected lineHeight source migration
260
562
  --help print this
261
563
 
262
564
  Run it from your project root, which is where paths and the tsconfig resolve from.
@@ -266,6 +568,8 @@ function parseArguments(argv) {
266
568
  let reportPath2 = defaultReportPath;
267
569
  let jsonPath2 = null;
268
570
  let write2 = false;
571
+ let sourceSemantics2 = "v3-ratios";
572
+ let lineHeightOnly2 = false;
269
573
  for (let index = 0; index < argv.length; index++) {
270
574
  const argument = argv[index];
271
575
  if (argument === "--help" || argument === "-h") {
@@ -276,6 +580,22 @@ function parseArguments(argv) {
276
580
  write2 = true;
277
581
  continue;
278
582
  }
583
+ if (argument === "--line-height-only") {
584
+ lineHeightOnly2 = true;
585
+ continue;
586
+ }
587
+ if (argument === "--source-semantics") {
588
+ const next = argv[index + 1];
589
+ if (next !== "v2-pixels" && next !== "v3-ratios") {
590
+ console.error(`${argument} requires v2-pixels or v3-ratios
591
+
592
+ ${usage}`);
593
+ process.exit(2);
594
+ }
595
+ sourceSemantics2 = next;
596
+ index++;
597
+ continue;
598
+ }
279
599
  if (argument === "--report" || argument === "--json") {
280
600
  const next = argv[index + 1];
281
601
  if (!next) {
@@ -307,10 +627,12 @@ ${usage}`);
307
627
  reportPath: reportPath2,
308
628
  jsonPath: jsonPath2,
309
629
  inputs: inputs2,
310
- write: write2
630
+ write: write2,
631
+ sourceSemantics: sourceSemantics2,
632
+ lineHeightOnly: lineHeightOnly2
311
633
  };
312
634
  }
313
- const { reportPath, jsonPath, inputs, write } = parseArguments(process.argv.slice(2));
635
+ const { reportPath, jsonPath, inputs, write, sourceSemantics, lineHeightOnly } = parseArguments(process.argv.slice(2));
314
636
  const { sourceFiles, ignoredFiles } = collectFiles(inputs);
315
637
  for (const sourceFile of sourceFiles) {
316
638
  const diagnostics = sourceFile.compilerNode.parseDiagnostics;
@@ -325,7 +647,7 @@ const modifierRegistry = createModifierRegistry({
325
647
  themeNames: themeNames(sourceFiles)
326
648
  });
327
649
  const provenance = createProvenance();
328
- const files = sourceFiles.map((sourceFile) => inspectFile(sourceFile, modifierRegistry.registry, provenance, write));
650
+ const files = sourceFiles.map((sourceFile) => inspectFile(sourceFile, modifierRegistry.registry, provenance, sourceSemantics, lineHeightOnly, write));
329
651
  if (write) {
330
652
  for (const sourceFile of sourceFiles) {
331
653
  const filePath = sourceFile.getFilePath();
@@ -366,6 +688,6 @@ if (write) {
366
688
  }
367
689
  console.log(`wrote ${reportPath}`);
368
690
  if (write) console.log(`rewrote ${written} source files`);
369
- console.log(`${summary.sites} style sites: ${summary.clean - summary.waiting} clean, ${summary.needsRelocation} need relocation, ${summary.unknownHost} unknown host, ${summary.ineligible} ineligible, ${summary.waiting} waiting on runtime support, ${summary.flagged} syntax-flagged; ${summary.functionalVariantSites} functional variants: ${summary.functionalVariantConverted} automatic, ${summary.functionalVariantFlagged} flagged; ${summary.sheetFrames} Sheet.Frame sites: ${summary.sheetFramesFlagged} need review; ${summary.ignoredFiles} source files ignored`);
691
+ console.log(`${summary.sites} style sites: ${summary.clean - summary.waiting} clean, ${summary.needsRelocation} need relocation, ${summary.unknownHost} unknown host, ${summary.ineligible} ineligible, ${summary.waiting} waiting on runtime support, ${summary.flagged} syntax-flagged; ${summary.functionalVariantSites} functional variants: ${summary.functionalVariantConverted} automatic, ${summary.functionalVariantFlagged} flagged; ${summary.sheetFrames} Sheet.Frame sites: ${summary.sheetFramesFlagged} need review; ${summary.transitions} v2 transitions: ${summary.transitionsFlagged} need review; ${summary.ignoredFiles} source files ignored`);
370
692
 
371
693
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["index.js"],"sourcesContent":["#!/usr/bin/env node\nimport { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, relative, resolve } from \"node:path\";\nimport { resolveTamaguiHost } from \"@tamagui/language-service/host\";\nimport { stylePropsTextOnly } from \"@tamagui/helpers\";\nimport {\n IndentationText,\n ModuleKind,\n ModuleResolutionKind,\n Node,\n Project,\n ScriptTarget,\n SyntaxKind,\n ts\n} from \"ts-morph\";\nimport { planContainers } from \"./containers\";\nimport { convertJsxSite, convertStyleObject } from \"./convert\";\nimport { compact, unwrapExpression } from \"./expressions\";\nimport {\n addFunctionalVariantTypeImports,\n convertFunctionalVariants\n} from \"./functionalVariants\";\nimport {\n codemodMediaNames,\n createModifierRegistry,\n grammarPlatformNames,\n shorthands\n} from \"./grammar\";\nimport { createProvenance } from \"./provenance\";\nimport { renderReport } from \"./report\";\nimport { convertSheetFrames } from \"./sheetAnatomy\";\nconst projectRoot = process.cwd();\nconst defaultReportPath = resolve(projectRoot, \"tamagui-flat-values-report.md\");\nconst ignoreMarker = \".tamagui-flat-values-ignore\";\nconst ignoredDirectories = /* @__PURE__ */ new Map();\nfunction isIgnored(filePath) {\n let directory = dirname(filePath);\n const visited = [];\n while (directory === projectRoot || !relative(projectRoot, directory).startsWith(\"..\")) {\n const cached = ignoredDirectories.get(directory);\n if (cached !== void 0) {\n for (const seen of visited) ignoredDirectories.set(seen, cached);\n return cached;\n }\n visited.push(directory);\n if (existsSync(resolve(directory, ignoreMarker))) {\n for (const seen of visited) ignoredDirectories.set(seen, true);\n return true;\n }\n if (directory === projectRoot) break;\n const parent = dirname(directory);\n if (parent === directory) break;\n directory = parent;\n }\n for (const seen of visited) ignoredDirectories.set(seen, false);\n return false;\n}\nfunction collectFiles(inputs2) {\n const tsConfigFilePath = resolve(projectRoot, \"tsconfig.json\");\n if (!existsSync(tsConfigFilePath)) {\n console.error(\n `no tsconfig.json in ${projectRoot}; run the codemod from your project root`\n );\n process.exit(2);\n }\n const project = new Project({\n tsConfigFilePath,\n skipAddingFilesFromTsConfig: true,\n // ts-morph re-indents every multi-line replacement from the indentation it\n // computes for the node with this unit. The default four-space unit puts a\n // JSX child two columns past where two-space source authored it, and every\n // attribute line of a rewritten element staggered with it\n manipulationSettings: { indentationText: IndentationText.TwoSpaces },\n compilerOptions: {\n allowJs: false,\n jsx: 4,\n target: ScriptTarget.ES2020,\n module: ModuleKind.ESNext,\n moduleResolution: ModuleResolutionKind.NodeJs,\n skipLibCheck: true,\n strictNullChecks: true,\n baseUrl: projectRoot\n }\n });\n const files2 = /* @__PURE__ */ new Map();\n const ignored = /* @__PURE__ */ new Set();\n const missing = [];\n for (const input of inputs2) {\n const path = resolve(projectRoot, input);\n if (!existsSync(path)) {\n missing.push(input);\n continue;\n }\n const pattern = /\\.[cm]?[jt]sx?$/.test(path) ? path : `${path}/**/*.{ts,tsx}`;\n const matched = project.addSourceFilesAtPaths(pattern);\n if (!matched.length) missing.push(input);\n for (const file of matched) {\n const filePath = file.getFilePath();\n if (isIgnored(filePath)) ignored.add(filePath);\n else files2.set(filePath, file);\n }\n }\n if (missing.length) {\n console.error(\n `no source file matched ${missing.map((input) => `\"${input}\"`).join(\", \")}`\n );\n process.exit(2);\n }\n if (files2.size === 0 && ignored.size > 0) {\n console.error(\n `all ${ignored.size} matched source ${ignored.size === 1 ? \"file was\" : \"files were\"} skipped by ${ignoreMarker}; no migration report was written`\n );\n process.exit(2);\n }\n return {\n sourceFiles: [...files2.values()].sort(\n (left, right) => left.getFilePath().localeCompare(right.getFilePath())\n ),\n ignoredFiles: ignored.size\n };\n}\nfunction themeNames(sourceFiles2) {\n const names = /* @__PURE__ */ new Set([\"light\", \"dark\"]);\n for (const sourceFile of sourceFiles2) {\n for (const name of conditionNames(sourceFile)) {\n if (name.startsWith(\"$theme-\")) names.add(name.slice(\"$theme-\".length));\n }\n }\n return names;\n}\nfunction mediaNames(sourceFiles2) {\n const names = new Set(codemodMediaNames);\n for (const sourceFile of sourceFiles2) {\n for (const name of conditionNames(sourceFile)) {\n if (!name.startsWith(\"$\")) continue;\n if (name.startsWith(\"$theme-\") || name.startsWith(\"$platform-\") || name.startsWith(\"$group-\") || grammarPlatformNames.has(name.slice(1))) {\n continue;\n }\n names.add(name.slice(1));\n }\n }\n return names;\n}\nfunction conditionNames(sourceFile) {\n const names = [];\n for (const attribute of sourceFile.getDescendantsOfKind(SyntaxKind.JsxAttribute)) {\n const name = attribute.getNameNode();\n if (Node.isIdentifier(name)) names.push(name.getText());\n }\n for (const property of sourceFile.getDescendantsOfKind(SyntaxKind.PropertyAssignment)) {\n const name = property.getNameNode();\n if (Node.isComputedPropertyName(name)) continue;\n names.push(name.getText().replace(/^['\"]|['\"]$/g, \"\"));\n }\n return names;\n}\nfunction variantStyleObjects(value) {\n const current = unwrapExpression(value);\n if (Node.isObjectLiteralExpression(current)) return [current];\n if (Node.isConditionalExpression(current)) {\n return [\n ...variantStyleObjects(current.getWhenTrue()),\n ...variantStyleObjects(current.getWhenFalse())\n ];\n }\n if (Node.isArrowFunction(current) || Node.isFunctionExpression(current)) {\n const body = current.getBody();\n if (Node.isBlock(body)) {\n return body.getDescendantsOfKind(SyntaxKind.ReturnStatement).flatMap((statement) => {\n const returned = statement.getExpression();\n return returned ? variantStyleObjects(returned) : [];\n });\n }\n return variantStyleObjects(body);\n }\n return [];\n}\nfunction variantSites(config, label, registry, containers, targets, host, write2) {\n const sites = [];\n const defaults = config.getProperty(\"defaultVariants\");\n if (Node.isPropertyAssignment(defaults)) {\n const object = unwrapExpression(defaults.getInitializerOrThrow());\n if (Node.isObjectLiteralExpression(object)) {\n const site = convertStyleObject(\n object,\n \"styled\",\n `${label} defaultVariants`,\n registry,\n containers,\n targets,\n host,\n write2\n );\n if (site) sites.push(site);\n }\n }\n const variants = config.getProperty(\"variants\");\n if (Node.isPropertyAssignment(variants)) {\n const object = unwrapExpression(variants.getInitializerOrThrow());\n if (Node.isObjectLiteralExpression(object)) {\n for (const variant of object.getProperties()) {\n if (!Node.isPropertyAssignment(variant)) continue;\n const variantName = compact(variant.getNameNode().getText());\n const branches = unwrapExpression(variant.getInitializerOrThrow());\n if (Node.isCallExpression(branches)) {\n const callee = branches.getExpression();\n if (Node.isPropertyAccessExpression(callee) && callee.getName() === \"dynamic\") {\n const body = branches.getArguments()[0];\n if (body && Node.isExpression(body)) {\n for (const style of variantStyleObjects(body)) {\n const site = convertStyleObject(\n style,\n \"styled\",\n `${label} variants.${variantName}`,\n registry,\n containers,\n targets,\n host,\n write2\n );\n if (site) sites.push(site);\n }\n }\n }\n continue;\n }\n if (!Node.isObjectLiteralExpression(branches)) continue;\n for (const branch of branches.getProperties()) {\n if (!Node.isPropertyAssignment(branch)) continue;\n const branchName = compact(branch.getNameNode().getText());\n for (const style of variantStyleObjects(branch.getInitializerOrThrow())) {\n const site = convertStyleObject(\n style,\n \"styled\",\n `${label} variants.${variantName}.${branchName}`,\n registry,\n containers,\n targets,\n host,\n write2\n );\n if (site) sites.push(site);\n }\n }\n }\n }\n }\n return sites;\n}\nfunction conversionTargets(filePath) {\n if (/\\.web\\.[cm]?[jt]sx?$/.test(filePath)) return \"web\";\n if (/\\.native\\.[cm]?[jt]sx?$/.test(filePath)) return \"native\";\n return \"shared\";\n}\nconst shorthandSpellings = /* @__PURE__ */ new Map();\nfor (const [shorthand, longhand] of Object.entries(shorthands)) {\n const spellings = shorthandSpellings.get(longhand);\n if (spellings) spellings.push(shorthand);\n else shorthandSpellings.set(longhand, [shorthand]);\n}\nfunction typeAwareHost(node) {\n const checker = node.getProject().getTypeChecker().compilerObject;\n const host = resolveTamaguiHost(\n checker,\n node.compilerNode\n );\n if (!host) return host;\n const accepts = (property) => host.accepts(property) || (shorthandSpellings.get(property)?.some((spelling) => host.accepts(spelling)) ?? false);\n if (node.getText() !== \"View\") return { ...host, accepts };\n return {\n ...host,\n accepts: (property) => !(property in stylePropsTextOnly) && accepts(property)\n };\n}\nfunction inspectFile(sourceFile, registry, provenance2, write2) {\n const sheetFrames = convertSheetFrames(sourceFile, provenance2, write2);\n const containers = planContainers(sourceFile, registry);\n const targets = conversionTargets(sourceFile.getFilePath());\n const sites = [];\n const functionalVariants = [];\n const requiredTypeImports = [];\n const styledCalls = sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression).filter((call) => provenance2.isTamaguiStyledCall(call)).sort((left, right) => right.getStart() - left.getStart());\n const jsxOpenings = [\n ...sourceFile.getDescendantsOfKind(SyntaxKind.JsxOpeningElement),\n ...sourceFile.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement)\n ].filter((opening) => provenance2.isTamaguiElement(opening)).sort((left, right) => right.getStart() - left.getStart());\n for (const opening of jsxOpenings) {\n const site = convertJsxSite(\n opening,\n registry,\n containers,\n targets,\n typeAwareHost(opening.getTagNameNode()),\n write2\n );\n if (site) sites.push(site);\n }\n for (const call of styledCalls) {\n const component = call.getArguments()[0];\n const host = component ? typeAwareHost(component) : void 0;\n const config = unwrapExpression(\n call.getArguments()[1] ?? call\n );\n if (!Node.isObjectLiteralExpression(config)) continue;\n const label = `styled(${compact(call.getArguments()[0]?.getText() ?? \"unknown\")}, \\u2026)`;\n sites.push(...variantSites(config, label, registry, containers, targets, host, write2));\n const functional = convertFunctionalVariants(config, label, write2);\n functionalVariants.push(...functional.sites);\n requiredTypeImports.push(...functional.requiredTypeImports);\n const site = convertStyleObject(\n config,\n \"styled\",\n label,\n registry,\n containers,\n targets,\n host,\n write2\n );\n if (site) sites.push(site);\n }\n sites.sort(\n (left, right) => left.line - right.line || left.label.localeCompare(right.label)\n );\n functionalVariants.sort(\n (left, right) => left.line - right.line || left.label.localeCompare(right.label)\n );\n if (write2) addFunctionalVariantTypeImports(sourceFile, requiredTypeImports);\n return {\n file: relative(projectRoot, sourceFile.getFilePath()),\n sites,\n functionalVariants,\n sheetFrames\n };\n}\nconst usage = `Converts Tamagui style syntax to V3 flat property values and reports what it cannot convert.\n\n npx @tamagui/codemod-flat-values [options] <files or directories...>\n\n --report <path> where to write the Markdown report (default: ${relative(\n projectRoot,\n defaultReportPath\n)})\n --json <path> also write the machine-readable report\n --write rewrite every statically safe conversion in place\n --help print this\n\nRun it from your project root, which is where paths and the tsconfig resolve from.\nSource files are only written with --write.`;\nfunction parseArguments(argv) {\n const inputs2 = [];\n let reportPath2 = defaultReportPath;\n let jsonPath2 = null;\n let write2 = false;\n for (let index = 0; index < argv.length; index++) {\n const argument = argv[index];\n if (argument === \"--help\" || argument === \"-h\") {\n console.log(usage);\n process.exit(0);\n }\n if (argument === \"--write\") {\n write2 = true;\n continue;\n }\n if (argument === \"--report\" || argument === \"--json\") {\n const next = argv[index + 1];\n if (!next) {\n console.error(`${argument} requires a path\n\n${usage}`);\n process.exit(2);\n }\n if (argument === \"--report\") reportPath2 = resolve(next);\n else jsonPath2 = resolve(next);\n index++;\n continue;\n }\n if (argument.startsWith(\"-\")) {\n console.error(`unknown option \"${argument}\"\n\n${usage}`);\n process.exit(2);\n }\n inputs2.push(argument);\n }\n if (!inputs2.length) {\n console.error(`no files or directories given\n\n${usage}`);\n process.exit(2);\n }\n return { reportPath: reportPath2, jsonPath: jsonPath2, inputs: inputs2, write: write2 };\n}\nconst { reportPath, jsonPath, inputs, write } = parseArguments(process.argv.slice(2));\nconst { sourceFiles, ignoredFiles } = collectFiles(inputs);\nfor (const sourceFile of sourceFiles) {\n const diagnostics = sourceFile.compilerNode.parseDiagnostics;\n if (diagnostics?.length) {\n console.error(\n `${relative(projectRoot, sourceFile.getFilePath())}: source has parse errors; no files were written`\n );\n process.exit(2);\n }\n}\nconst originals = new Map(\n sourceFiles.map((sourceFile) => [sourceFile.getFilePath(), sourceFile.getFullText()])\n);\nconst modifierRegistry = createModifierRegistry({\n mediaNames: mediaNames(sourceFiles),\n themeNames: themeNames(sourceFiles)\n});\nconst provenance = createProvenance();\nconst files = sourceFiles.map(\n (sourceFile) => inspectFile(sourceFile, modifierRegistry.registry, provenance, write)\n);\nif (write) {\n for (const sourceFile of sourceFiles) {\n const filePath = sourceFile.getFilePath();\n const parsed = ts.createSourceFile(\n filePath,\n sourceFile.getFullText(),\n ScriptTarget.Latest,\n true,\n filePath.endsWith(\"x\") ? ts.ScriptKind.TSX : ts.ScriptKind.TS\n );\n if (parsed.parseDiagnostics?.length) {\n const details = parsed.parseDiagnostics.map((diagnostic) => {\n const start = diagnostic.start ?? 0;\n const position = parsed.getLineAndCharacterOfPosition(start);\n const line = parsed.text.split(/\\r?\\n/)[position.line] ?? \"\";\n return `${position.line + 1}:${position.character + 1} ${ts.flattenDiagnosticMessageText(\n diagnostic.messageText,\n \"\\n\"\n )}\n ${line.trim()}`;\n }).join(\"\\n\");\n console.error(\n `${relative(projectRoot, filePath)}: rewrite produced parse errors; no files were written\n${details}`\n );\n process.exit(2);\n }\n }\n}\nconst { text, summary } = renderReport(\n files,\n inputs.map((input) => relative(projectRoot, resolve(projectRoot, input))),\n modifierRegistry.diagnostics,\n ignoredFiles,\n write\n);\nmkdirSync(dirname(reportPath), { recursive: true });\nwriteFileSync(reportPath, text);\nif (jsonPath !== null) {\n mkdirSync(dirname(jsonPath), { recursive: true });\n writeFileSync(jsonPath, `${JSON.stringify({ files, summary }, null, 2)}\n`);\n}\nlet written = 0;\nif (write) {\n for (const sourceFile of sourceFiles) {\n const next = sourceFile.getFullText();\n if (next === originals.get(sourceFile.getFilePath())) continue;\n writeFileSync(sourceFile.getFilePath(), next);\n written++;\n }\n}\nconsole.log(`wrote ${reportPath}`);\nif (write) console.log(`rewrote ${written} source files`);\nconsole.log(\n `${summary.sites} style sites: ${summary.clean - summary.waiting} clean, ${summary.needsRelocation} need relocation, ${summary.unknownHost} unknown host, ${summary.ineligible} ineligible, ${summary.waiting} waiting on runtime support, ${summary.flagged} syntax-flagged; ${summary.functionalVariantSites} functional variants: ${summary.functionalVariantConverted} automatic, ${summary.functionalVariantFlagged} flagged; ${summary.sheetFrames} Sheet.Frame sites: ${summary.sheetFramesFlagged} need review; ${summary.ignoredFiles} source files ignored`\n);\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;;;;;;;;;;;;;AA+BA,MAAM,cAAc,QAAQ,IAAI;AAChC,MAAM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sB,QAAQ,mBAAmB,gBAAgB,QAAQ,aAAa,sBACjhB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["index.js"],"sourcesContent":["#!/usr/bin/env node\nimport { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, relative, resolve } from \"node:path\";\nimport { stylePropsTextOnly } from \"@tamagui/helpers\";\nimport {\n IndentationText,\n ModuleKind,\n ModuleResolutionKind,\n Node,\n Project,\n ScriptTarget,\n SyntaxKind,\n ts\n} from \"ts-morph\";\nimport { planContainers } from \"./containers\";\nimport { convertJsxSite, convertStyleObject } from \"./convert\";\nimport { compact, numericValue, runtimeType, unwrapExpression } from \"./expressions\";\nimport {\n addFunctionalVariantTypeImports,\n convertFunctionalVariants\n} from \"./functionalVariants\";\nimport {\n codemodMediaNames,\n createModifierRegistry,\n grammarPlatformNames,\n shorthands\n} from \"./grammar\";\nimport { createProvenance } from \"./provenance\";\nimport { renderReport } from \"./report\";\nimport { convertSheetFrames } from \"./sheetAnatomy\";\nimport { convertTransitions } from \"./transition\";\nimport { isLegacyConditionName } from \"./legacyNames\";\nfunction propertyName(node) {\n if (Node.isIdentifier(node) || Node.isStringLiteral(node) || Node.isNumericLiteral(node)) {\n return node.getText().replace(/^['\"]|['\"]$/g, \"\");\n }\n return null;\n}\nfunction isLineHeightName(name) {\n return name === \"lineHeight\" || name === \"lh\";\n}\nfunction extractedTokenValue(expression) {\n const nodes = [expression, ...expression.getDescendants()];\n return nodes.some(\n (node) => Node.isPropertyAccessExpression(node) && node.getName() === \"val\" || Node.isCallExpression(node) && Node.isIdentifier(node.getExpression()) && node.getExpression().getText() === \"getVariableValue\"\n );\n}\nfunction pixelReplacement(expression) {\n const current = unwrapExpression(expression);\n const number = numericValue(current);\n if (number !== null) return { text: JSON.stringify(`${number}px`), dynamic: false };\n const type = runtimeType(current);\n if (type.kind === \"string\") return null;\n if (extractedTokenValue(current)) {\n return {\n flag: {\n code: \"ambiguous-line-height-token-value\",\n detail: `lineHeight value \"${compact(current.getText())}\" extracts a token value whose units are no longer visible; replace it with an explicit ratio or px length by hand`\n }\n };\n }\n if (type.kind === \"number\") {\n return { text: `\\`\\${${current.getText()}}px\\``, dynamic: true };\n }\n return {\n flag: {\n code: \"ambiguous-line-height-expression\",\n detail: `lineHeight value \"${compact(current.getText())}\" has no provable numeric type; replace old pixel semantics with an explicit px length by hand`\n }\n };\n}\nfunction declarationContainsNumericLineHeight(expression) {\n const symbol = expression.getSymbol();\n if (!symbol) return false;\n for (const declaration of symbol.getDeclarations()) {\n for (const property of [\n ...Node.isPropertyAssignment(declaration) ? [declaration] : [],\n ...declaration.getDescendantsOfKind(SyntaxKind.PropertyAssignment)\n ]) {\n if (!isLineHeightName(propertyName(property.getNameNode()))) continue;\n const initializer = property.getInitializer();\n if (!initializer) continue;\n const value = unwrapExpression(initializer);\n if (numericValue(value) !== null || runtimeType(value).kind === \"number\")\n return true;\n }\n }\n return false;\n}\nfunction lineHeightValueIsUnmigrated(expression) {\n const current = unwrapExpression(expression);\n if (Node.isObjectLiteralExpression(current)) {\n return current.getProperties().some((property) => {\n if (!Node.isPropertyAssignment(property)) return false;\n const initializer = property.getInitializer();\n return initializer !== void 0 && lineHeightValueIsUnmigrated(initializer);\n });\n }\n if (Node.isConditionalExpression(current)) {\n return lineHeightValueIsUnmigrated(current.getWhenTrue()) || lineHeightValueIsUnmigrated(current.getWhenFalse());\n }\n return pixelReplacement(current) !== null;\n}\nfunction replaceWithin(source, sourceStart, edits) {\n let output = source;\n for (const edit of [...edits].sort((left, right) => right.start - left.start)) {\n output = output.slice(0, edit.start - sourceStart) + edit.text + output.slice(edit.end - sourceStart);\n }\n return output;\n}\nfunction migrateLegacyLineHeights(sourceFile, provenance2) {\n const edits = [];\n const claimed = /* @__PURE__ */ new Set();\n const reports = [];\n const scanLineHeightExpression = (expression, contextEdits, flags) => {\n const current = unwrapExpression(expression);\n if (Node.isObjectLiteralExpression(current)) {\n for (const property of current.getProperties()) {\n if (!Node.isPropertyAssignment(property)) continue;\n const initializer = property.getInitializer();\n if (initializer) scanLineHeightExpression(initializer, contextEdits, flags);\n }\n return;\n }\n if (Node.isConditionalExpression(current)) {\n scanLineHeightExpression(current.getWhenTrue(), contextEdits, flags);\n scanLineHeightExpression(current.getWhenFalse(), contextEdits, flags);\n return;\n }\n if (claimed.has(current.getStart())) return;\n const replacement = pixelReplacement(current);\n if (!replacement) return;\n claimed.add(current.getStart());\n if (\"flag\" in replacement) {\n flags.push(replacement.flag);\n return;\n }\n const edit = {\n start: current.getStart(),\n end: current.getEnd(),\n text: replacement.text,\n dynamic: replacement.dynamic\n };\n edits.push(edit);\n contextEdits.push(edit);\n };\n const scanProperty = (property, contextEdits, flags) => {\n if (!isLineHeightName(propertyName(property.getNameNode()))) return;\n const initializer = property.getInitializer();\n if (initializer) scanLineHeightExpression(initializer, contextEdits, flags);\n };\n const scanObject = (object, contextEdits, flags) => {\n for (const property of object.getDescendantsOfKind(SyntaxKind.PropertyAssignment)) {\n scanProperty(property, contextEdits, flags);\n }\n for (const property of object.getProperties()) {\n if (Node.isPropertyAssignment(property)) scanProperty(property, contextEdits, flags);\n }\n };\n const addReport = (node, kind, label, contextEdits, flags) => {\n if (!contextEdits.length && !flags.length) return;\n const before = compact(node.getText());\n reports.push({\n kind,\n label,\n line: sourceFile.getLineAndColumnAtPos(node.getStart()).line,\n before,\n after: compact(replaceWithin(node.getText(), node.getStart(), contextEdits)),\n programs: contextEdits.map((edit) => ({\n name: \"lineHeight\",\n value: edit.text,\n dynamic: edit.dynamic\n })),\n assessments: [],\n assessmentVerdict: \"clean\",\n warnings: [],\n flags,\n inventory: [],\n pending: [],\n notes: [\n contextEdits.length ? \"numeric lineHeight used V2 pixel semantics and now carries an explicit px unit\" : \"lineHeight was left authored for a manual unit decision\"\n ],\n legacyLeft: flags.length\n });\n };\n const scanJsx = (opening) => {\n const contextEdits = [];\n const flags = [];\n for (const attribute of opening.getAttributes()) {\n if (Node.isJsxSpreadAttribute(attribute)) {\n const expression2 = unwrapExpression(attribute.getExpression());\n if (Node.isObjectLiteralExpression(expression2)) {\n scanObject(expression2, contextEdits, flags);\n } else if (declarationContainsNumericLineHeight(expression2)) {\n flags.push({\n code: \"ambiguous-shared-line-height-style\",\n detail: `spread \"${compact(expression2.getText())}\" contains numeric lineHeight and may also be consumed outside Tamagui; migrate it at this Tamagui boundary by hand`\n });\n }\n continue;\n }\n if (!Node.isJsxAttribute(attribute)) continue;\n const nameNode = attribute.getNameNode();\n const name = Node.isIdentifier(nameNode) ? nameNode.getText() : null;\n const initializer = attribute.getInitializer();\n if (isLineHeightName(name)) {\n if (!Node.isJsxExpression(initializer)) continue;\n const expression2 = initializer.getExpression();\n if (!expression2) continue;\n const current2 = unwrapExpression(expression2);\n const number = numericValue(current2);\n if (number !== null && !claimed.has(current2.getStart())) {\n claimed.add(current2.getStart());\n const edit = {\n start: initializer.getStart(),\n end: initializer.getEnd(),\n text: JSON.stringify(`${number}px`),\n dynamic: false\n };\n edits.push(edit);\n contextEdits.push(edit);\n } else {\n scanLineHeightExpression(current2, contextEdits, flags);\n }\n continue;\n }\n if (isLegacyConditionName(name || \"\") && Node.isJsxExpression(initializer)) {\n const expression2 = initializer.getExpression();\n if (expression2) {\n const current2 = unwrapExpression(expression2);\n for (const object of [\n ...Node.isObjectLiteralExpression(current2) ? [current2] : [],\n ...current2.getDescendantsOfKind(SyntaxKind.ObjectLiteralExpression)\n ]) {\n scanObject(object, contextEdits, flags);\n }\n }\n continue;\n }\n if (name !== \"style\" || !Node.isJsxExpression(initializer)) continue;\n const expression = initializer.getExpression();\n if (!expression) continue;\n const current = unwrapExpression(expression);\n const objects = [\n ...Node.isObjectLiteralExpression(current) ? [current] : [],\n ...current.getDescendantsOfKind(SyntaxKind.ObjectLiteralExpression)\n ];\n if (objects.length) {\n for (const object of objects) scanObject(object, contextEdits, flags);\n } else if (declarationContainsNumericLineHeight(current)) {\n flags.push({\n code: \"ambiguous-shared-line-height-style\",\n detail: `style \"${compact(current.getText())}\" contains numeric lineHeight and may also be consumed by React Native or Restyle; migrate it at this Tamagui boundary by hand`\n });\n }\n }\n addReport(\n opening,\n \"jsx\",\n `<${opening.getTagNameNode().getText()}> lineHeight`,\n contextEdits,\n flags\n );\n };\n const scanCall = (call, label) => {\n const contextEdits = [];\n const flags = [];\n for (const argument of call.getArguments()) {\n for (const object of [\n ...Node.isObjectLiteralExpression(argument) ? [argument] : [],\n ...argument.getDescendantsOfKind(SyntaxKind.ObjectLiteralExpression)\n ]) {\n scanObject(object, contextEdits, flags);\n }\n }\n addReport(call, \"styled\", label, contextEdits, flags);\n };\n const wrapperCache = /* @__PURE__ */ new Map();\n for (const opening of [\n ...sourceFile.getDescendantsOfKind(SyntaxKind.JsxOpeningElement),\n ...sourceFile.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement)\n ]) {\n if (provenance2.isTamaguiElement(opening)) {\n scanJsx(opening);\n continue;\n }\n const hasLegacyValue = opening.getAttributes().some((attribute) => {\n if (!Node.isJsxAttribute(attribute)) return false;\n const name = propertyName(attribute.getNameNode());\n const initializer = attribute.getInitializer();\n if (!initializer || !Node.isJsxExpression(initializer)) return false;\n const expression = initializer.getExpression();\n if (!expression) return false;\n if (isLineHeightName(name)) return lineHeightValueIsUnmigrated(expression);\n if (name !== \"style\") return false;\n const current = unwrapExpression(expression);\n const properties = current.getDescendantsOfKind(SyntaxKind.PropertyAssignment);\n return properties.length ? properties.some((property) => {\n const value = property.getInitializer();\n return isLineHeightName(propertyName(property.getNameNode())) && value !== void 0 && lineHeightValueIsUnmigrated(value);\n }) : declarationContainsNumericLineHeight(current);\n });\n if (!hasLegacyValue) continue;\n const tag = opening.getTagNameNode();\n const symbol = tag.getSymbol();\n if (!symbol) continue;\n const declarations = (symbol.getAliasedSymbol() ?? symbol).getDeclarations();\n const isLocalWrapper = declarations.some((declaration) => {\n const cached = wrapperCache.get(declaration);\n if (cached !== void 0) return cached;\n const file = declaration.getSourceFile();\n const filePath = file.getFilePath();\n const local = !file.isDeclarationFile() && !filePath.includes(\"/node_modules/\") && !relative(projectRoot, filePath).startsWith(\"..\");\n const wrapsTamagui = local && [\n ...declaration.getDescendantsOfKind(SyntaxKind.JsxOpeningElement),\n ...declaration.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement)\n ].some((child) => provenance2.isTamaguiElement(child));\n wrapperCache.set(declaration, wrapsTamagui);\n return wrapsTamagui;\n });\n if (!isLocalWrapper) continue;\n addReport(\n opening,\n \"jsx\",\n `<${tag.getText()}> lineHeight`,\n [],\n [\n {\n code: \"ambiguous-wrapper-line-height\",\n detail: `local wrapper <${tag.getText()}> renders Tamagui JSX, so numeric lineHeight may still be V2 pixels, but the wrapper may transform units; migrate this call site by hand`\n }\n ]\n );\n }\n for (const call of sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression)) {\n if (provenance2.isTamaguiStyledCall(call)) {\n scanCall(\n call,\n `styled(${compact(call.getArguments()[0]?.getText() ?? \"unknown\")}, \\u2026) lineHeight`\n );\n } else if (provenance2.isTamaguiStyleCall(call)) {\n scanCall(call, `${compact(call.getExpression().getText())}(\\u2026) lineHeight`);\n }\n }\n if (edits.length) {\n sourceFile.replaceWithText(replaceWithin(sourceFile.getFullText(), 0, edits));\n }\n return reports;\n}\nconst projectRoot = process.cwd();\nconst defaultReportPath = resolve(projectRoot, \"tamagui-flat-values-report.md\");\nconst ignoreMarker = \".tamagui-flat-values-ignore\";\nconst ignoredDirectories = /* @__PURE__ */ new Map();\nfunction isIgnored(filePath) {\n let directory = dirname(filePath);\n const visited = [];\n while (directory === projectRoot || !relative(projectRoot, directory).startsWith(\"..\")) {\n const cached = ignoredDirectories.get(directory);\n if (cached !== void 0) {\n for (const seen of visited) ignoredDirectories.set(seen, cached);\n return cached;\n }\n visited.push(directory);\n if (existsSync(resolve(directory, ignoreMarker))) {\n for (const seen of visited) ignoredDirectories.set(seen, true);\n return true;\n }\n if (directory === projectRoot) break;\n const parent = dirname(directory);\n if (parent === directory) break;\n directory = parent;\n }\n for (const seen of visited) ignoredDirectories.set(seen, false);\n return false;\n}\nfunction collectFiles(inputs2) {\n const tsConfigFilePath = resolve(projectRoot, \"tsconfig.json\");\n if (!existsSync(tsConfigFilePath)) {\n console.error(\n `no tsconfig.json in ${projectRoot}; run the codemod from your project root`\n );\n process.exit(2);\n }\n const project = new Project({\n tsConfigFilePath,\n skipAddingFilesFromTsConfig: true,\n // ts-morph re-indents every multi-line replacement from the indentation it\n // computes for the node with this unit. The default four-space unit puts a\n // JSX child two columns past where two-space source authored it, and every\n // attribute line of a rewritten element staggered with it\n manipulationSettings: { indentationText: IndentationText.TwoSpaces },\n compilerOptions: {\n allowJs: false,\n jsx: 4,\n target: ScriptTarget.ES2020,\n module: ModuleKind.ESNext,\n moduleResolution: ModuleResolutionKind.Bundler,\n skipLibCheck: true,\n strictNullChecks: true,\n baseUrl: projectRoot\n }\n });\n const files2 = /* @__PURE__ */ new Map();\n const ignored = /* @__PURE__ */ new Set();\n const missing = [];\n for (const input of inputs2) {\n const path = resolve(projectRoot, input);\n if (!existsSync(path)) {\n missing.push(input);\n continue;\n }\n const pattern = /\\.[cm]?[jt]sx?$/.test(path) ? path : `${path}/**/*.{ts,tsx}`;\n const matched = project.addSourceFilesAtPaths(pattern);\n if (!matched.length) missing.push(input);\n for (const file of matched) {\n const filePath = file.getFilePath();\n if (isIgnored(filePath)) ignored.add(filePath);\n else files2.set(filePath, file);\n }\n }\n if (missing.length) {\n console.error(\n `no source file matched ${missing.map((input) => `\"${input}\"`).join(\", \")}`\n );\n process.exit(2);\n }\n if (files2.size === 0 && ignored.size > 0) {\n console.error(\n `all ${ignored.size} matched source ${ignored.size === 1 ? \"file was\" : \"files were\"} skipped by ${ignoreMarker}; no migration report was written`\n );\n process.exit(2);\n }\n return {\n sourceFiles: [...files2.values()].sort(\n (left, right) => left.getFilePath().localeCompare(right.getFilePath())\n ),\n ignoredFiles: ignored.size\n };\n}\nfunction themeNames(sourceFiles2) {\n const names = /* @__PURE__ */ new Set([\"light\", \"dark\"]);\n for (const sourceFile of sourceFiles2) {\n for (const name of conditionNames(sourceFile)) {\n if (name.startsWith(\"$theme-\")) names.add(name.slice(\"$theme-\".length));\n }\n }\n return names;\n}\nfunction mediaNames(sourceFiles2) {\n const names = new Set(codemodMediaNames);\n for (const sourceFile of sourceFiles2) {\n for (const name of conditionNames(sourceFile)) {\n if (!name.startsWith(\"$\")) continue;\n if (name.startsWith(\"$theme-\") || name.startsWith(\"$platform-\") || name.startsWith(\"$group-\") || grammarPlatformNames.has(name.slice(1))) {\n continue;\n }\n names.add(name.slice(1));\n }\n }\n return names;\n}\nfunction conditionNames(sourceFile) {\n const names = [];\n for (const attribute of sourceFile.getDescendantsOfKind(SyntaxKind.JsxAttribute)) {\n const name = attribute.getNameNode();\n if (Node.isIdentifier(name)) names.push(name.getText());\n }\n for (const property of sourceFile.getDescendantsOfKind(SyntaxKind.PropertyAssignment)) {\n const name = property.getNameNode();\n if (Node.isComputedPropertyName(name)) continue;\n names.push(name.getText().replace(/^['\"]|['\"]$/g, \"\"));\n }\n return names;\n}\nfunction variantStyleObjects(value) {\n const current = unwrapExpression(value);\n if (Node.isObjectLiteralExpression(current)) return [current];\n if (Node.isConditionalExpression(current)) {\n return [\n ...variantStyleObjects(current.getWhenTrue()),\n ...variantStyleObjects(current.getWhenFalse())\n ];\n }\n if (Node.isArrowFunction(current) || Node.isFunctionExpression(current)) {\n const body = current.getBody();\n if (Node.isBlock(body)) {\n return body.getDescendantsOfKind(SyntaxKind.ReturnStatement).flatMap((statement) => {\n const returned = statement.getExpression();\n return returned ? variantStyleObjects(returned) : [];\n });\n }\n return variantStyleObjects(body);\n }\n return [];\n}\nfunction variantSites(config, label, registry, containers, targets, host, write2) {\n const sites = [];\n const defaults = config.getProperty(\"defaultVariants\");\n if (Node.isPropertyAssignment(defaults)) {\n const object = unwrapExpression(defaults.getInitializerOrThrow());\n if (Node.isObjectLiteralExpression(object)) {\n const site = convertStyleObject(\n object,\n \"styled\",\n `${label} defaultVariants`,\n registry,\n containers,\n targets,\n host,\n write2\n );\n if (site) sites.push(site);\n }\n }\n const variants = config.getProperty(\"variants\");\n if (Node.isPropertyAssignment(variants)) {\n const object = unwrapExpression(variants.getInitializerOrThrow());\n if (Node.isObjectLiteralExpression(object)) {\n for (const variant of object.getProperties()) {\n if (!Node.isPropertyAssignment(variant)) continue;\n const variantName = compact(variant.getNameNode().getText());\n const branches = unwrapExpression(variant.getInitializerOrThrow());\n if (Node.isCallExpression(branches)) {\n const callee = branches.getExpression();\n if (Node.isPropertyAccessExpression(callee) && callee.getName() === \"dynamic\") {\n const body = branches.getArguments()[0];\n if (body && Node.isExpression(body)) {\n for (const style of variantStyleObjects(body)) {\n const site = convertStyleObject(\n style,\n \"styled\",\n `${label} variants.${variantName}`,\n registry,\n containers,\n targets,\n host,\n write2\n );\n if (site) sites.push(site);\n }\n }\n }\n continue;\n }\n if (!Node.isObjectLiteralExpression(branches)) continue;\n for (const branch of branches.getProperties()) {\n if (!Node.isPropertyAssignment(branch)) continue;\n const branchName = compact(branch.getNameNode().getText());\n for (const style of variantStyleObjects(branch.getInitializerOrThrow())) {\n const site = convertStyleObject(\n style,\n \"styled\",\n `${label} variants.${variantName}.${branchName}`,\n registry,\n containers,\n targets,\n host,\n write2\n );\n if (site) sites.push(site);\n }\n }\n }\n }\n }\n return sites;\n}\nfunction conversionTargets(filePath) {\n if (/\\.web\\.[cm]?[jt]sx?$/.test(filePath)) return \"web\";\n if (/\\.native\\.[cm]?[jt]sx?$/.test(filePath)) return \"native\";\n return \"shared\";\n}\nconst shorthandSpellings = /* @__PURE__ */ new Map();\nfor (const [shorthand, longhand] of Object.entries(shorthands)) {\n const spellings = shorthandSpellings.get(longhand);\n if (spellings) spellings.push(shorthand);\n else shorthandSpellings.set(longhand, [shorthand]);\n}\nfunction typeAwareHost(node) {\n const checker = node.getProject().getTypeChecker();\n const componentType = checker.getTypeAtLocation(node);\n if (!componentType.getProperty(\"staticConfig\")) return void 0;\n const propsTypes = componentType.getCallSignatures().flatMap((signature) => signature.getParameters().slice(0, 1)).map((props) => checker.getTypeOfSymbolAtLocation(props, node));\n if (propsTypes.length === 0) return void 0;\n const host = {\n displayName: node.getText(),\n accepts: (property) => propsTypes.some(\n (propsType) => propsType.getApparentType().getProperty(property) !== void 0\n )\n };\n const accepts = (property) => host.accepts(property) || (shorthandSpellings.get(property)?.some((spelling) => host.accepts(spelling)) ?? false);\n if (node.getText() !== \"View\") return { ...host, accepts };\n return {\n ...host,\n accepts: (property) => !(property in stylePropsTextOnly) && accepts(property)\n };\n}\nfunction inspectFile(sourceFile, registry, provenance2, sourceSemantics2, lineHeightOnly2, write2) {\n const lineHeightSites = sourceSemantics2 === \"v2-pixels\" ? migrateLegacyLineHeights(sourceFile, provenance2) : [];\n if (lineHeightOnly2) {\n return {\n file: relative(projectRoot, sourceFile.getFilePath()),\n sites: lineHeightSites,\n functionalVariants: [],\n sheetFrames: [],\n transitions: []\n };\n }\n const sheetFrames = convertSheetFrames(sourceFile, provenance2, write2);\n const transitions = convertTransitions(sourceFile, provenance2, write2);\n const containers = planContainers(sourceFile, registry);\n const targets = conversionTargets(sourceFile.getFilePath());\n const sites = [...lineHeightSites];\n const functionalVariants = [];\n const requiredTypeImports = [];\n const styledCalls = sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression).filter((call) => provenance2.isTamaguiStyledCall(call)).sort((left, right) => right.getStart() - left.getStart());\n const jsxOpenings = [\n ...sourceFile.getDescendantsOfKind(SyntaxKind.JsxOpeningElement),\n ...sourceFile.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement)\n ].filter((opening) => provenance2.isTamaguiElement(opening)).sort((left, right) => right.getStart() - left.getStart());\n for (const opening of jsxOpenings) {\n const site = convertJsxSite(\n opening,\n registry,\n containers,\n targets,\n typeAwareHost(opening.getTagNameNode()),\n write2\n );\n if (site) sites.push(site);\n }\n for (const call of styledCalls) {\n const component = call.getArguments()[0];\n const host = component ? typeAwareHost(component) : void 0;\n const config = unwrapExpression(\n call.getArguments()[1] ?? call\n );\n if (!Node.isObjectLiteralExpression(config)) continue;\n const label = `styled(${compact(call.getArguments()[0]?.getText() ?? \"unknown\")}, \\u2026)`;\n sites.push(...variantSites(config, label, registry, containers, targets, host, write2));\n const functional = convertFunctionalVariants(config, label, write2);\n functionalVariants.push(...functional.sites);\n requiredTypeImports.push(...functional.requiredTypeImports);\n const site = convertStyleObject(\n config,\n \"styled\",\n label,\n registry,\n containers,\n targets,\n host,\n write2\n );\n if (site) sites.push(site);\n }\n sites.sort(\n (left, right) => left.line - right.line || left.label.localeCompare(right.label)\n );\n functionalVariants.sort(\n (left, right) => left.line - right.line || left.label.localeCompare(right.label)\n );\n if (write2) addFunctionalVariantTypeImports(sourceFile, requiredTypeImports);\n return {\n file: relative(projectRoot, sourceFile.getFilePath()),\n sites,\n functionalVariants,\n sheetFrames,\n transitions\n };\n}\nconst usage = `Converts Tamagui style syntax to V3 flat property values and reports what it cannot convert.\n\n npx @tamagui/codemod-flat-values [options] <files or directories...>\n\n --report <path> where to write the Markdown report (default: ${relative(\n projectRoot,\n defaultReportPath\n)})\n --json <path> also write the machine-readable report\n --write rewrite every statically safe conversion in place\n --source-semantics <v2-pixels|v3-ratios>\n interpret numeric Tamagui lineHeight from that source contract\n (default: v3-ratios)\n --line-height-only apply and report only the selected lineHeight source migration\n --help print this\n\nRun it from your project root, which is where paths and the tsconfig resolve from.\nSource files are only written with --write.`;\nfunction parseArguments(argv) {\n const inputs2 = [];\n let reportPath2 = defaultReportPath;\n let jsonPath2 = null;\n let write2 = false;\n let sourceSemantics2 = \"v3-ratios\";\n let lineHeightOnly2 = false;\n for (let index = 0; index < argv.length; index++) {\n const argument = argv[index];\n if (argument === \"--help\" || argument === \"-h\") {\n console.log(usage);\n process.exit(0);\n }\n if (argument === \"--write\") {\n write2 = true;\n continue;\n }\n if (argument === \"--line-height-only\") {\n lineHeightOnly2 = true;\n continue;\n }\n if (argument === \"--source-semantics\") {\n const next = argv[index + 1];\n if (next !== \"v2-pixels\" && next !== \"v3-ratios\") {\n console.error(`${argument} requires v2-pixels or v3-ratios\n\n${usage}`);\n process.exit(2);\n }\n sourceSemantics2 = next;\n index++;\n continue;\n }\n if (argument === \"--report\" || argument === \"--json\") {\n const next = argv[index + 1];\n if (!next) {\n console.error(`${argument} requires a path\n\n${usage}`);\n process.exit(2);\n }\n if (argument === \"--report\") reportPath2 = resolve(next);\n else jsonPath2 = resolve(next);\n index++;\n continue;\n }\n if (argument.startsWith(\"-\")) {\n console.error(`unknown option \"${argument}\"\n\n${usage}`);\n process.exit(2);\n }\n inputs2.push(argument);\n }\n if (!inputs2.length) {\n console.error(`no files or directories given\n\n${usage}`);\n process.exit(2);\n }\n return { reportPath: reportPath2, jsonPath: jsonPath2, inputs: inputs2, write: write2, sourceSemantics: sourceSemantics2, lineHeightOnly: lineHeightOnly2 };\n}\nconst { reportPath, jsonPath, inputs, write, sourceSemantics, lineHeightOnly } = parseArguments(process.argv.slice(2));\nconst { sourceFiles, ignoredFiles } = collectFiles(inputs);\nfor (const sourceFile of sourceFiles) {\n const diagnostics = sourceFile.compilerNode.parseDiagnostics;\n if (diagnostics?.length) {\n console.error(\n `${relative(projectRoot, sourceFile.getFilePath())}: source has parse errors; no files were written`\n );\n process.exit(2);\n }\n}\nconst originals = new Map(\n sourceFiles.map((sourceFile) => [sourceFile.getFilePath(), sourceFile.getFullText()])\n);\nconst modifierRegistry = createModifierRegistry({\n mediaNames: mediaNames(sourceFiles),\n themeNames: themeNames(sourceFiles)\n});\nconst provenance = createProvenance();\nconst files = sourceFiles.map(\n (sourceFile) => inspectFile(\n sourceFile,\n modifierRegistry.registry,\n provenance,\n sourceSemantics,\n lineHeightOnly,\n write\n )\n);\nif (write) {\n for (const sourceFile of sourceFiles) {\n const filePath = sourceFile.getFilePath();\n const parsed = ts.createSourceFile(\n filePath,\n sourceFile.getFullText(),\n ScriptTarget.Latest,\n true,\n filePath.endsWith(\"x\") ? ts.ScriptKind.TSX : ts.ScriptKind.TS\n );\n if (parsed.parseDiagnostics?.length) {\n const details = parsed.parseDiagnostics.map((diagnostic) => {\n const start = diagnostic.start ?? 0;\n const position = parsed.getLineAndCharacterOfPosition(start);\n const line = parsed.text.split(/\\r?\\n/)[position.line] ?? \"\";\n return `${position.line + 1}:${position.character + 1} ${ts.flattenDiagnosticMessageText(\n diagnostic.messageText,\n \"\\n\"\n )}\n ${line.trim()}`;\n }).join(\"\\n\");\n console.error(\n `${relative(projectRoot, filePath)}: rewrite produced parse errors; no files were written\n${details}`\n );\n process.exit(2);\n }\n }\n}\nconst { text, summary } = renderReport(\n files,\n inputs.map((input) => relative(projectRoot, resolve(projectRoot, input))),\n modifierRegistry.diagnostics,\n ignoredFiles,\n write\n);\nmkdirSync(dirname(reportPath), { recursive: true });\nwriteFileSync(reportPath, text);\nif (jsonPath !== null) {\n mkdirSync(dirname(jsonPath), { recursive: true });\n writeFileSync(jsonPath, `${JSON.stringify({ files, summary }, null, 2)}\n`);\n}\nlet written = 0;\nif (write) {\n for (const sourceFile of sourceFiles) {\n const next = sourceFile.getFullText();\n if (next === originals.get(sourceFile.getFilePath())) continue;\n writeFileSync(sourceFile.getFilePath(), next);\n written++;\n }\n}\nconsole.log(`wrote ${reportPath}`);\nif (write) console.log(`rewrote ${written} source files`);\nconsole.log(\n `${summary.sites} style sites: ${summary.clean - summary.waiting} clean, ${summary.needsRelocation} need relocation, ${summary.unknownHost} unknown host, ${summary.ineligible} ineligible, ${summary.waiting} waiting on runtime support, ${summary.flagged} syntax-flagged; ${summary.functionalVariantSites} functional variants: ${summary.functionalVariantConverted} automatic, ${summary.functionalVariantFlagged} flagged; ${summary.sheetFrames} Sheet.Frame sites: ${summary.sheetFramesFlagged} need review; ${summary.transitions} v2 transitions: ${summary.transitionsFlagged} need review; ${summary.ignoredFiles} source files ignored`\n);\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;;;;;;;;;;;;;;AAgCA,SAAS,aAAa,MAAM;CAC1B,IAAI,KAAK,aAAa,IAAI,K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Q,yBAAyB,YAAY,QAAQ,YAAY,sBAAsB,QAAQ,mBAAmB,gBAAgB,QAAQ,YAAY,mBAAmB,QAAQ,mBAAmB,gBAAgB,QAAQ,aAAa,sBACnmB"}
@@ -115,6 +115,14 @@ function createProvenance() {
115
115
  if (callee === null || callee.getText() !== "styled") return false;
116
116
  return fromIdentifier(callee);
117
117
  };
118
+ const isTamaguiStyleCall = (call) => {
119
+ const callee = call.getExpression();
120
+ if (!Node.isPropertyAccessExpression(callee)) return false;
121
+ const method = callee.getName();
122
+ if (method !== "style" && method !== "resolve" && method !== "dynamic") return false;
123
+ const owner = rootIdentifier(callee.getExpression());
124
+ return owner !== null && fromIdentifier(owner);
125
+ };
118
126
  function isTamaguiValue(expression) {
119
127
  let current = expression;
120
128
  while (Node.isParenthesizedExpression(current) || Node.isAsExpression(current) || Node.isNonNullExpression(current)) {
@@ -129,7 +137,8 @@ function createProvenance() {
129
137
  if (tag === null || !/^[A-Z_$]/.test(tag.getText())) return false;
130
138
  return fromIdentifier(tag);
131
139
  },
132
- isTamaguiStyledCall
140
+ isTamaguiStyledCall,
141
+ isTamaguiStyleCall
133
142
  };
134
143
  }
135
144