@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.
@@ -1 +1 @@
1
- {"version":3,"file":"provenance.js","names":[],"sources":["provenance.js"],"sourcesContent":["import {\n Node,\n SyntaxKind\n} from \"ts-morph\";\nconst tamaguiModule = /^(tamagui|@tamagui\\/)/;\nfunction rootIdentifier(node) {\n let current = node;\n while (Node.isPropertyAccessExpression(current)) current = current.getExpression();\n return Node.isIdentifier(current) ? current : null;\n}\nfunction createProvenance() {\n const resolved = /* @__PURE__ */ new Map();\n const active = /* @__PURE__ */ new Set();\n const fromDeclaration = (declaration) => {\n const cached = resolved.get(declaration);\n if (cached !== void 0) return cached;\n if (active.has(declaration)) return false;\n active.add(declaration);\n const answer = computeDeclaration(declaration);\n active.delete(declaration);\n resolved.set(declaration, answer);\n return answer;\n };\n const fromModule = (specifier, source, name) => {\n if (tamaguiModule.test(specifier)) return true;\n if (source === void 0) return false;\n return exportedBinding(source, name);\n };\n const bindings = /* @__PURE__ */ new Map();\n const openBindings = /* @__PURE__ */ new Set();\n const exportedBinding = (source, name) => {\n const key = `${source.getFilePath()}#${name}`;\n const cached = bindings.get(key);\n if (cached !== void 0) return cached;\n if (openBindings.has(key)) return false;\n openBindings.add(key);\n const answer = computeBinding(source, name);\n openBindings.delete(key);\n bindings.set(key, answer);\n return answer;\n };\n const computeBinding = (source, name) => {\n for (const declaration of source.getExportDeclarations()) {\n const specifier = declaration.getModuleSpecifierValue();\n const named = declaration.getNamedExports();\n if (specifier === void 0) {\n for (const element of named) {\n if ((element.getAliasNode() ?? element.getNameNode()).getText() !== name) {\n continue;\n }\n if (fromDeclaration(element)) return true;\n }\n continue;\n }\n if (!named.length && !declaration.getNamespaceExport()) {\n if (fromModule(specifier, declaration.getModuleSpecifierSourceFile(), name)) {\n return true;\n }\n continue;\n }\n for (const element of named) {\n if ((element.getAliasNode() ?? element.getNameNode()).getText() !== name) continue;\n if (fromModule(\n specifier,\n declaration.getModuleSpecifierSourceFile(),\n element.getName()\n )) {\n return true;\n }\n }\n }\n for (const [exportName, declarations] of source.getExportedDeclarations()) {\n if (exportName !== name) continue;\n for (const declaration of declarations) {\n if (fromDeclaration(declaration)) return true;\n }\n }\n return false;\n };\n const computeDeclaration = (declaration) => {\n if (Node.isImportSpecifier(declaration)) {\n const importDeclaration = declaration.getImportDeclaration();\n return fromModule(\n importDeclaration.getModuleSpecifierValue(),\n importDeclaration.getModuleSpecifierSourceFile(),\n declaration.getName()\n );\n }\n if (Node.isImportClause(declaration) || Node.isNamespaceImport(declaration)) {\n const importDeclaration = declaration.getFirstAncestorByKindOrThrow(\n SyntaxKind.ImportDeclaration\n );\n return tamaguiModule.test(importDeclaration.getModuleSpecifierValue());\n }\n if (Node.isExportSpecifier(declaration)) {\n const exportDeclaration = declaration.getExportDeclaration();\n const specifier = exportDeclaration.getModuleSpecifierValue();\n if (specifier !== void 0) {\n return fromModule(\n specifier,\n exportDeclaration.getModuleSpecifierSourceFile(),\n declaration.getName()\n );\n }\n for (const local of declaration.getLocalTargetDeclarations()) {\n if (fromDeclaration(local)) return true;\n }\n return false;\n }\n if (Node.isVariableDeclaration(declaration)) {\n const initializer = declaration.getInitializer();\n return initializer !== void 0 && isTamaguiValue(initializer);\n }\n return false;\n };\n const fromIdentifier = (identifier) => {\n const symbol = identifier.getSymbol();\n if (symbol === void 0) return false;\n for (const declaration of symbol.getDeclarations()) {\n if (fromDeclaration(declaration)) return true;\n }\n const aliased = symbol.getAliasedSymbol();\n if (aliased === void 0) return false;\n for (const declaration of aliased.getDeclarations()) {\n if (fromDeclaration(declaration)) return true;\n }\n return false;\n };\n const isTamaguiStyledCall = (call) => {\n const callee = rootIdentifier(call.getExpression());\n if (callee === null || callee.getText() !== \"styled\") return false;\n return fromIdentifier(callee);\n };\n function isTamaguiValue(expression) {\n let current = expression;\n while (Node.isParenthesizedExpression(current) || Node.isAsExpression(current) || Node.isNonNullExpression(current)) {\n current = current.getExpression();\n }\n const identifier = rootIdentifier(\n Node.isCallExpression(current) ? current.getExpression() : current\n );\n return identifier !== null && fromIdentifier(identifier);\n }\n return {\n isTamaguiElement: (opening) => {\n const tag = rootIdentifier(opening.getTagNameNode());\n if (tag === null || !/^[A-Z_$]/.test(tag.getText())) return false;\n return fromIdentifier(tag);\n },\n isTamaguiStyledCall\n };\n}\nexport {\n createProvenance\n};\n//# sourceMappingURL=provenance.js.map\n"],"mappings":";;;AAIA,MAAM,gBAAgB;AACtB,SAAS,eAAe,MAAM;CAC5B,IAAI,UAAU;CACd,OAAO,KAAK,2BAA2B,OAAO,GAAG,UAAU,QAAQ,cAAc;CACjF,OAAO,KAAK,aAAa,OAAO,IAAI,UAAU;AAChD;AACA,SAAS,mBAAmB;CAC1B,MAAM,2BAA2B,IAAI,IAAI;CACzC,MAAM,yBAAyB,IAAI,IAAI;CACvC,MAAM,mBAAmB,gBAAgB;EACvC,MAAM,SAAS,SAAS,IAAI,WAAW;EACvC,IAAI,WAAW,KAAK,GAAG,OAAO;EAC9B,IAAI,OAAO,IAAI,WAAW,GAAG,OAAO;EACpC,OAAO,IAAI,WAAW;EACtB,MAAM,SAAS,mBAAmB,WAAW;EAC7C,OAAO,OAAO,WAAW;EACzB,SAAS,IAAI,aAAa,MAAM;EAChC,OAAO;CACT;CACA,MAAM,cAAc,WAAW,QAAQ,SAAS;EAC9C,IAAI,cAAc,KAAK,SAAS,GAAG,OAAO;EAC1C,IAAI,WAAW,KAAK,GAAG,OAAO;EAC9B,OAAO,gBAAgB,QAAQ,IAAI;CACrC;CACA,MAAM,2BAA2B,IAAI,IAAI;CACzC,MAAM,+BAA+B,IAAI,IAAI;CAC7C,MAAM,mBAAmB,QAAQ,SAAS;EACxC,MAAM,MAAM,GAAG,OAAO,YAAY,EAAE,GAAG;EACvC,MAAM,SAAS,SAAS,IAAI,GAAG;EAC/B,IAAI,WAAW,KAAK,GAAG,OAAO;EAC9B,IAA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,OAAO,GAAG;GACnH,UAAU,QAAQ,cAAc;EAClC;EACA,MAAM,aAAa,eACjB,KAAK,iBAAiB,OAAO,IAAI,QAAQ,cAAc,IAAI,OAC7D;EACA,OAAO,eAAe,QAAQ,eAAe,UAAU;CACzD;CACA,OAAO;EACL,mBAAmB,YAAY;GAC7B,MAAM,MAAM,eAAe,QAAQ,eAAe,CAAC;GACnD,IAAI,QAAQ,QAAQ,CAAC,WAAW,KAAK,IAAI,QAAQ,CAAC,GAAG,OAAO;GAC5D,OAAO,eAAe,GAAG;EAC3B;EACA;CACF;AACF"}
1
+ {"version":3,"file":"provenance.js","names":[],"sources":["provenance.js"],"sourcesContent":["import {\n Node,\n SyntaxKind\n} from \"ts-morph\";\nconst tamaguiModule = /^(tamagui|@tamagui\\/)/;\nfunction rootIdentifier(node) {\n let current = node;\n while (Node.isPropertyAccessExpression(current)) current = current.getExpression();\n return Node.isIdentifier(current) ? current : null;\n}\nfunction createProvenance() {\n const resolved = /* @__PURE__ */ new Map();\n const active = /* @__PURE__ */ new Set();\n const fromDeclaration = (declaration) => {\n const cached = resolved.get(declaration);\n if (cached !== void 0) return cached;\n if (active.has(declaration)) return false;\n active.add(declaration);\n const answer = computeDeclaration(declaration);\n active.delete(declaration);\n resolved.set(declaration, answer);\n return answer;\n };\n const fromModule = (specifier, source, name) => {\n if (tamaguiModule.test(specifier)) return true;\n if (source === void 0) return false;\n return exportedBinding(source, name);\n };\n const bindings = /* @__PURE__ */ new Map();\n const openBindings = /* @__PURE__ */ new Set();\n const exportedBinding = (source, name) => {\n const key = `${source.getFilePath()}#${name}`;\n const cached = bindings.get(key);\n if (cached !== void 0) return cached;\n if (openBindings.has(key)) return false;\n openBindings.add(key);\n const answer = computeBinding(source, name);\n openBindings.delete(key);\n bindings.set(key, answer);\n return answer;\n };\n const computeBinding = (source, name) => {\n for (const declaration of source.getExportDeclarations()) {\n const specifier = declaration.getModuleSpecifierValue();\n const named = declaration.getNamedExports();\n if (specifier === void 0) {\n for (const element of named) {\n if ((element.getAliasNode() ?? element.getNameNode()).getText() !== name) {\n continue;\n }\n if (fromDeclaration(element)) return true;\n }\n continue;\n }\n if (!named.length && !declaration.getNamespaceExport()) {\n if (fromModule(specifier, declaration.getModuleSpecifierSourceFile(), name)) {\n return true;\n }\n continue;\n }\n for (const element of named) {\n if ((element.getAliasNode() ?? element.getNameNode()).getText() !== name) continue;\n if (fromModule(\n specifier,\n declaration.getModuleSpecifierSourceFile(),\n element.getName()\n )) {\n return true;\n }\n }\n }\n for (const [exportName, declarations] of source.getExportedDeclarations()) {\n if (exportName !== name) continue;\n for (const declaration of declarations) {\n if (fromDeclaration(declaration)) return true;\n }\n }\n return false;\n };\n const computeDeclaration = (declaration) => {\n if (Node.isImportSpecifier(declaration)) {\n const importDeclaration = declaration.getImportDeclaration();\n return fromModule(\n importDeclaration.getModuleSpecifierValue(),\n importDeclaration.getModuleSpecifierSourceFile(),\n declaration.getName()\n );\n }\n if (Node.isImportClause(declaration) || Node.isNamespaceImport(declaration)) {\n const importDeclaration = declaration.getFirstAncestorByKindOrThrow(\n SyntaxKind.ImportDeclaration\n );\n return tamaguiModule.test(importDeclaration.getModuleSpecifierValue());\n }\n if (Node.isExportSpecifier(declaration)) {\n const exportDeclaration = declaration.getExportDeclaration();\n const specifier = exportDeclaration.getModuleSpecifierValue();\n if (specifier !== void 0) {\n return fromModule(\n specifier,\n exportDeclaration.getModuleSpecifierSourceFile(),\n declaration.getName()\n );\n }\n for (const local of declaration.getLocalTargetDeclarations()) {\n if (fromDeclaration(local)) return true;\n }\n return false;\n }\n if (Node.isVariableDeclaration(declaration)) {\n const initializer = declaration.getInitializer();\n return initializer !== void 0 && isTamaguiValue(initializer);\n }\n return false;\n };\n const fromIdentifier = (identifier) => {\n const symbol = identifier.getSymbol();\n if (symbol === void 0) return false;\n for (const declaration of symbol.getDeclarations()) {\n if (fromDeclaration(declaration)) return true;\n }\n const aliased = symbol.getAliasedSymbol();\n if (aliased === void 0) return false;\n for (const declaration of aliased.getDeclarations()) {\n if (fromDeclaration(declaration)) return true;\n }\n return false;\n };\n const isTamaguiStyledCall = (call) => {\n const callee = rootIdentifier(call.getExpression());\n if (callee === null || callee.getText() !== \"styled\") return false;\n return fromIdentifier(callee);\n };\n const isTamaguiStyleCall = (call) => {\n const callee = call.getExpression();\n if (!Node.isPropertyAccessExpression(callee)) return false;\n const method = callee.getName();\n if (method !== \"style\" && method !== \"resolve\" && method !== \"dynamic\") return false;\n const owner = rootIdentifier(callee.getExpression());\n return owner !== null && fromIdentifier(owner);\n };\n function isTamaguiValue(expression) {\n let current = expression;\n while (Node.isParenthesizedExpression(current) || Node.isAsExpression(current) || Node.isNonNullExpression(current)) {\n current = current.getExpression();\n }\n const identifier = rootIdentifier(\n Node.isCallExpression(current) ? current.getExpression() : current\n );\n return identifier !== null && fromIdentifier(identifier);\n }\n return {\n isTamaguiElement: (opening) => {\n const tag = rootIdentifier(opening.getTagNameNode());\n if (tag === null || !/^[A-Z_$]/.test(tag.getText())) return false;\n return fromIdentifier(tag);\n },\n isTamaguiStyledCall,\n isTamaguiStyleCall\n };\n}\nexport {\n createProvenance\n};\n//# sourceMappingURL=provenance.js.map\n"],"mappings":";;;AAIA,MAAM,gBAAgB;AACtB,SAAS,eAAe,MAAM;CAC5B,IAAI,UAAU;CACd,OAAO,KAAK,2BAA2B,OAAO,GAAG,UAAU,QAAQ,cAAc;CACjF,OAAO,KAAK,aAAa,OAAO,IAAI,UAAU;AAChD;AACA,SAAS,mBAAmB;CAC1B,MAAM,2BAA2B,IAAI,IAAI;CACzC,MAAM,yBAAyB,IAAI,IAAI;CACvC,MAAM,mBAAmB,gBAAgB;EACvC,MAAM,SAAS,SAAS,IAAI,WAAW;EACvC,IAAI,WAAW,KAAK,GAAG,OAAO;EAC9B,IAAI,OAAO,IAAI,WAAW,GAAG,OAAO;EACpC,OAAO,IAAI,WAAW;EACtB,MAAM,SAAS,mBAAmB,WAAW;EAC7C,OAAO,OAAO,WAAW;EACzB,SAAS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iBAAiB;EACxC,IAAI,YAAY,KAAK,GAAG,OAAO;EAC/B,KAAK,MAAM,eAAe,QAAQ,gBAAgB,GAAG;GACnD,IAAI,gBAAgB,WAAW,GAAG,OAAO;EAC3C;EACA,OAAO;CACT;CACA,MAAM,uBAAuB,SAAS;EACpC,MAAM,SAAS,eAAe,KAAK,cAAc,CAAC;EAClD,IAAI,WAAW,QAAQ,OAAO,QAAQ,MAAM,UAAU,OAAO;EAC7D,OAAO,eAAe,MAAM;CAC9B;CACA,MAAM,sBAAsB,SAAS;EACnC,MAAM,SAAS,KAAK,cAAc;EAClC,IAAI,CAAC,KAAK,2BAA2B,MAAM,GAAG,OAAO;EACrD,MAAM,SAAS,OAAO,QAAQ;EAC9B,IAAI,WAAW,WAAW,WAAW,aAAa,WAAW,WAAW,OAAO;EAC/E,MAAM,QAAQ,eAAe,OAAO,cAAc,CAAC;EACnD,OAAO,UAAU,QAAQ,eAAe,KAAK;CAC/C;CACA,SAAS,eAAe,YAAY;EAClC,IAAI,UAAU;EACd,OAAO,KAAK,0BAA0B,OAAO,KAAK,KAAK,eAAe,OAAO,KAAK,KAAK,oBAAoB,OAAO,GAAG;GACnH,UAAU,QAAQ,cAAc;EAClC;EACA,MAAM,aAAa,eACjB,KAAK,iBAAiB,OAAO,IAAI,QAAQ,cAAc,IAAI,OAC7D;EACA,OAAO,eAAe,QAAQ,eAAe,UAAU;CACzD;CACA,OAAO;EACL,mBAAmB,YAAY;GAC7B,MAAM,MAAM,eAAe,QAAQ,eAAe,CAAC;GACnD,IAAI,QAAQ,QAAQ,CAAC,WAAW,KAAK,IAAI,QAAQ,CAAC,GAAG,OAAO;GAC5D,OAAO,eAAe,GAAG;EAC3B;EACA;EACA;CACF;AACF"}
package/dist/report.mjs CHANGED
@@ -8,6 +8,8 @@ function renderReport(files, corpus, registryDiagnostics, ignoredFiles = 0, writ
8
8
  const functionalVariants = files.flatMap((file) => file.functionalVariants);
9
9
  const sheetFrames = files.flatMap((file) => file.sheetFrames);
10
10
  const flaggedSheetFrames = sheetFrames.filter((site) => site.flags.length > 0);
11
+ const transitions = files.flatMap((file) => file.transitions);
12
+ const flaggedTransitions = transitions.filter((site) => site.flags.length > 0);
11
13
  const convertedFunctionalVariants = functionalVariants.filter((site) => site.converted);
12
14
  const flaggedFunctionalVariants = functionalVariants.filter((site) => !site.converted);
13
15
  const clean = sites.filter((site) => site.flags.length === 0 && site.warnings.length === 0 && site.assessmentVerdict === "clean");
@@ -21,8 +23,8 @@ function renderReport(files, corpus, registryDiagnostics, ignoredFiles = 0, writ
21
23
  const styled = sites.filter((site) => site.kind === "styled");
22
24
  const cleanJsx = jsx.filter((site) => site.flags.length === 0 && site.warnings.length === 0 && site.assessmentVerdict === "clean").length;
23
25
  const cleanStyled = styled.filter((site) => site.flags.length === 0 && site.warnings.length === 0 && site.assessmentVerdict === "clean").length;
24
- const touched = (file) => file.sites.length > 0 || file.functionalVariants.length > 0 || file.sheetFrames.length > 0;
25
- const blocked = (file) => file.sites.some((site) => site.legacyLeft > 0) || file.functionalVariants.some((site) => !site.converted) || file.sheetFrames.some((site) => site.flags.length > 0);
26
+ const touched = (file) => file.sites.length > 0 || file.functionalVariants.length > 0 || file.sheetFrames.length > 0 || file.transitions.length > 0;
27
+ const blocked = (file) => file.sites.some((site) => site.legacyLeft > 0) || file.functionalVariants.some((site) => !site.converted) || file.sheetFrames.some((site) => site.flags.length > 0) || file.transitions.some((site) => site.flags.length > 0);
26
28
  const readyFiles = files.filter((file) => touched(file) && !blocked(file));
27
29
  const filesWithSites = files.filter(touched).length;
28
30
  const blockedFiles = files.filter(blocked).map((file) => file.file);
@@ -52,6 +54,8 @@ function renderReport(files, corpus, registryDiagnostics, ignoredFiles = 0, writ
52
54
  `- ${flaggedFunctionalVariants.length} functional variants need manual migration`,
53
55
  `- ${sheetFrames.length} Sheet.Frame sites rewritten to Sheet.Container plus Sheet.Background`,
54
56
  `- ${flaggedSheetFrames.length} Sheet.Frame sites need a human to place a spread or a styled target`,
57
+ `- ${transitions.length} v2 transition values rewritten to the v3 spelling`,
58
+ `- ${flaggedTransitions.length} v2 transition values need a hand migration`,
55
59
  "",
56
60
  "### Functional variant flag reasons",
57
61
  "",
@@ -85,6 +89,13 @@ function renderReport(files, corpus, registryDiagnostics, ignoredFiles = 0, writ
85
89
  for (const file of files) {
86
90
  if (!touched(file)) continue;
87
91
  lines.push("", `## \`${file.file}\``, "");
92
+ for (const site of file.transitions) {
93
+ lines.push(`### ${site.label} at line ${site.line} (${site.flags.length ? "review" : "automatic"})`, "", "Before:", "", "```tsx", site.before, "```", "", "Automatic rewrite:", "", "```tsx", site.after, "```");
94
+ if (site.flags.length) {
95
+ lines.push("", "Flags:", "");
96
+ for (const flag of site.flags) lines.push(`- **${flag.code}**: ${flag.detail}`);
97
+ }
98
+ }
88
99
  for (const site of file.sheetFrames) {
89
100
  lines.push(`### ${site.label} at line ${site.line} (${site.flags.length ? "review" : "automatic"})`, "", "Before:", "", "```tsx", site.before, "```", "", "Automatic rewrite:", "", "```tsx", site.after, "```");
90
101
  if (site.flags.length) {
@@ -166,7 +177,9 @@ function renderReport(files, corpus, registryDiagnostics, ignoredFiles = 0, writ
166
177
  functionalVariantFlagged: flaggedFunctionalVariants.length,
167
178
  functionalVariantFlags: Object.fromEntries(functionalFlagCounts),
168
179
  sheetFrames: sheetFrames.length,
169
- sheetFramesFlagged: flaggedSheetFrames.length
180
+ sheetFramesFlagged: flaggedSheetFrames.length,
181
+ transitions: transitions.length,
182
+ transitionsFlagged: flaggedTransitions.length
170
183
  }
171
184
  };
172
185
  }
@@ -1 +1 @@
1
- {"version":3,"file":"report.js","names":[],"sources":["report.js"],"sourcesContent":["function countCodes(flags) {\n const counts = /* @__PURE__ */ new Map();\n for (const flag of flags) counts.set(flag.code, (counts.get(flag.code) ?? 0) + 1);\n return [...counts].sort(\n ([leftCode, leftCount], [rightCode, rightCount]) => rightCount - leftCount || leftCode.localeCompare(rightCode)\n );\n}\nfunction renderReport(files, corpus, registryDiagnostics, ignoredFiles = 0, write = false) {\n const sites = files.flatMap((file) => file.sites);\n const functionalVariants = files.flatMap((file) => file.functionalVariants);\n const sheetFrames = files.flatMap((file) => file.sheetFrames);\n const flaggedSheetFrames = sheetFrames.filter((site) => site.flags.length > 0);\n const convertedFunctionalVariants = functionalVariants.filter((site) => site.converted);\n const flaggedFunctionalVariants = functionalVariants.filter((site) => !site.converted);\n const clean = sites.filter(\n (site) => site.flags.length === 0 && site.warnings.length === 0 && site.assessmentVerdict === \"clean\"\n );\n const flagged = sites.filter((site) => site.flags.length > 0);\n const warnings = sites.filter((site) => site.warnings.length > 0);\n const needsRelocation = sites.filter(\n (site) => site.assessmentVerdict === \"needs-relocation\"\n );\n const unknownHost = sites.filter((site) => site.assessmentVerdict === \"unknown-host\");\n const ineligible = sites.filter((site) => site.assessmentVerdict === \"ineligible\");\n const waiting = clean.filter((site) => site.programs.length === 0);\n const jsx = sites.filter((site) => site.kind === \"jsx\");\n const styled = sites.filter((site) => site.kind === \"styled\");\n const cleanJsx = jsx.filter(\n (site) => site.flags.length === 0 && site.warnings.length === 0 && site.assessmentVerdict === \"clean\"\n ).length;\n const cleanStyled = styled.filter(\n (site) => site.flags.length === 0 && site.warnings.length === 0 && site.assessmentVerdict === \"clean\"\n ).length;\n const touched = (file) => file.sites.length > 0 || file.functionalVariants.length > 0 || file.sheetFrames.length > 0;\n const blocked = (file) => file.sites.some((site) => site.legacyLeft > 0) || file.functionalVariants.some((site) => !site.converted) || file.sheetFrames.some((site) => site.flags.length > 0);\n const readyFiles = files.filter((file) => touched(file) && !blocked(file));\n const filesWithSites = files.filter(touched).length;\n const blockedFiles = files.filter(blocked).map((file) => file.file);\n const functionalFlagCounts = countCodes(\n flaggedFunctionalVariants.flatMap((site) => [\n ...new Map(site.flags.map((flag) => [flag.code, flag])).values()\n ])\n );\n const lines = [\n \"# Flat-values codemod dry-run\",\n \"\",\n `Corpus: ${corpus.map((entry) => `\\`${entry}\\``).join(\", \")}.`,\n \"\",\n write ? \"Statically safe conversions were written in place. Flagged legacy syntax remains for manual migration.\" : \"Dry run only: no source files were written. Pass `--write` to apply statically safe conversions.\",\n \"\",\n \"## Summary\",\n \"\",\n `- ${sites.length} conversion sites found`,\n `- ${clean.length - waiting.length} converted with no open questions`,\n `- ${needsRelocation.length} need relocation because the authored target or host cannot evaluate the conversion`,\n `- ${unknownHost.length} have an unverified host type`,\n `- ${ineligible.length} use properties that cannot carry flat clauses`,\n `- ${waiting.length} have nothing to convert until the runtime catches up (see below)`,\n `- ${flagged.length} have syntax or ordering flags for manual work`,\n `- ${warnings.length} have configuration warnings for manual review`,\n `- ${ignoredFiles} source files skipped by \\`.tamagui-flat-values-ignore\\` markers`,\n `- ${jsx.length} JSX sites: ${cleanJsx} clean, ${jsx.length - cleanJsx} need review`,\n `- ${styled.length} styled config sites: ${cleanStyled} clean, ${styled.length - cleanStyled} need review`,\n `- ${functionalVariants.length} functional variant sites found`,\n `- ${convertedFunctionalVariants.length} functional variants have automatic styled.dynamic rewrites`,\n `- ${flaggedFunctionalVariants.length} functional variants need manual migration`,\n `- ${sheetFrames.length} Sheet.Frame sites rewritten to Sheet.Container plus Sheet.Background`,\n `- ${flaggedSheetFrames.length} Sheet.Frame sites need a human to place a spread or a styled target`,\n \"\",\n \"### Functional variant flag reasons\",\n \"\",\n ...functionalFlagCounts.length ? functionalFlagCounts.map(([code, count]) => `- ${code}: ${count}`) : [\"- none\"],\n \"\",\n \"### Remaining manual migration\",\n \"\",\n `${readyFiles.length} of ${filesWithSites} files have no legacy condition object, flagged functional variant, or flagged Sheet.Frame left after`,\n \"conversion. V3 has no compatibility setting; finish the remaining files directly:\",\n blockedFiles.length ? blockedFiles.map((file) => `\\`${file}\\``).join(\", \") : \"every file in this corpus is fully migrated.\",\n \"\",\n \"### Flag reasons\",\n \"\"\n ];\n const flagCounts = countCodes(flagged.flatMap((site) => site.flags));\n lines.push(\n ...flagCounts.length ? flagCounts.map(([code, count]) => `- ${code}: ${count}`) : [\"- none\"]\n );\n const warningCounts = countCodes(warnings.flatMap((site) => site.warnings));\n lines.push(\n \"\",\n \"### Configuration warning reasons\",\n \"\",\n ...warningCounts.length ? warningCounts.map(([code, count]) => `- ${code}: ${count}`) : [\"- none\"]\n );\n const inventoryCounts = countCodes(sites.flatMap((site) => site.inventory));\n if (inventoryCounts.length) {\n lines.push(\n \"\",\n \"### Values left authored for another migration\",\n \"\",\n \"These are not flat-value migration work. The conversion keeps them exactly as\",\n \"authored and records them so their follow-up migrations have a corpus inventory.\",\n \"\",\n ...inventoryCounts.map(([code, count]) => `- ${code}: ${count}`)\n );\n }\n const pendingCounts = countCodes(sites.flatMap((site) => site.pending));\n if (pendingCounts.length) {\n lines.push(\n \"\",\n \"### Waiting on runtime support\",\n \"\",\n \"The conversion is known but not offered, because the runtime cannot read it yet.\",\n \"Each pending reason below names the exact host or merge contract that must land\",\n \"before the suggested source is safe to apply.\",\n \"\",\n ...pendingCounts.map(([code, count]) => `- ${code}: ${count}`)\n );\n }\n if (registryDiagnostics.length) {\n lines.push(\"\", \"### Modifier registry diagnostics\", \"\");\n for (const diagnostic of registryDiagnostics) lines.push(`- ${diagnostic}`);\n }\n for (const file of files) {\n if (!touched(file)) continue;\n lines.push(\"\", `## \\`${file.file}\\``, \"\");\n for (const site of file.sheetFrames) {\n lines.push(\n `### ${site.label} at line ${site.line} (${site.flags.length ? \"review\" : \"automatic\"})`,\n \"\",\n \"Before:\",\n \"\",\n \"```tsx\",\n site.before,\n \"```\",\n \"\",\n \"Automatic rewrite:\",\n \"\",\n \"```tsx\",\n site.after,\n \"```\"\n );\n if (site.flags.length) {\n lines.push(\"\", \"Flags:\", \"\");\n for (const flag of site.flags) lines.push(`- **${flag.code}**: ${flag.detail}`);\n }\n lines.push(\"\");\n }\n for (const site of file.functionalVariants) {\n lines.push(\n `### ${site.label} functional variant at line ${site.line} (${site.converted ? \"automatic\" : \"manual\"})`,\n \"\",\n \"Before:\",\n \"\",\n \"```tsx\",\n site.before,\n \"```\",\n \"\",\n site.converted ? \"Automatic rewrite:\" : \"Left authored:\",\n \"\",\n \"```tsx\",\n site.after,\n \"```\"\n );\n if (site.flags.length) {\n lines.push(\"\", \"Flags:\", \"\");\n for (const flag of site.flags) lines.push(`- **${flag.code}**: ${flag.detail}`);\n }\n if (site.draft) {\n lines.push(\"\", \"Generated `.resolve` draft:\", \"\", \"```tsx\", site.draft, \"```\");\n }\n if (site.notes.length) {\n lines.push(\"\", \"Notes:\", \"\");\n for (const note of site.notes) lines.push(`- ${note}`);\n }\n lines.push(\"\");\n }\n for (const site of file.sites) {\n const status = [\n site.assessmentVerdict === \"clean\" ? null : site.assessmentVerdict,\n site.flags.length ? \"syntax-blocked\" : null,\n site.warnings.length ? \"configuration-warning\" : null\n ].filter(Boolean).join(\", \");\n lines.push(\n `### ${site.label} at line ${site.line} (${status || \"clean\"})`,\n \"\",\n \"Before:\",\n \"\",\n \"```tsx\",\n site.before,\n \"```\",\n \"\",\n \"After:\",\n \"\",\n \"```tsx\",\n site.after,\n \"```\"\n );\n if (site.flags.length) {\n lines.push(\"\", \"Flags:\", \"\");\n for (const flag of site.flags) lines.push(`- **${flag.code}**: ${flag.detail}`);\n }\n if (site.warnings.length) {\n lines.push(\"\", \"Configuration warnings:\", \"\");\n for (const warning of site.warnings) {\n lines.push(`- **${warning.code}**: ${warning.detail}`);\n }\n }\n if (site.assessments.length) {\n lines.push(\"\", \"Conversion assessment:\", \"\");\n for (const assessment of site.assessments) {\n for (const reason of assessment.reasons) {\n lines.push(\n `- **${assessment.verdict}: ${assessment.property}**: ${reason.message}. Remedy: ${reason.remedy}.`\n );\n }\n }\n }\n if (site.inventory.length) {\n lines.push(\"\", \"Left authored:\", \"\");\n for (const flag of site.inventory)\n lines.push(`- **${flag.code}**: ${flag.detail}`);\n }\n if (site.pending.length) {\n lines.push(\"\", \"Waiting on runtime support:\", \"\");\n for (const flag of site.pending) lines.push(`- **${flag.code}**: ${flag.detail}`);\n }\n if (site.notes.length) {\n lines.push(\"\", \"Notes:\", \"\");\n for (const note of site.notes) lines.push(`- ${note}`);\n }\n lines.push(\"\");\n }\n }\n return {\n text: `${lines.join(\"\\n\")}\n`,\n summary: {\n sites: sites.length,\n clean: clean.length,\n needsRelocation: needsRelocation.length,\n unknownHost: unknownHost.length,\n ineligible: ineligible.length,\n flagged: flagged.length,\n warnings: warnings.length,\n waiting: waiting.length,\n ignoredFiles,\n functionalVariantSites: functionalVariants.length,\n functionalVariantConverted: convertedFunctionalVariants.length,\n functionalVariantFlagged: flaggedFunctionalVariants.length,\n functionalVariantFlags: Object.fromEntries(functionalFlagCounts),\n sheetFrames: sheetFrames.length,\n sheetFramesFlagged: flaggedSheetFrames.length\n }\n };\n}\nexport {\n renderReport\n};\n//# sourceMappingURL=report.js.map\n"],"mappings":";AAAA,SAAS,WAAW,OAAO;CACzB,MAAM,yBAAyB,IAAI,IAAI;CACvC,KAAK,MAAM,QAAQ,OAAO,OAAO,IAAI,KAAK,OAAO,OAAO,IAAI,KAAK,IAAI,KAAK,KAAK,CAAC;CAChF,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC,MAChB,CAAC,UAAU,YAAY,CAAC,WAAW,gBAAgB,aAAa,aAAa,SAAS,cAAc,SAAS,CAChH;AACF;AACA,SAAS,aAAa,OAAO,QAAQ,qBAAqB,eAAe,GAAG,QAAQ,OAAO;CACzF,MAAM,QAAQ,MAAM,SAAS,SAAS,KAAK,KAAK;CAChD,MAAM,qBAAqB,MAAM,SAAS,SAAS,KAAK,kBAAkB;CAC1E,MAAM,cAAc,MAAM,SAAS,SAAS,KAAK,WAAW;CAC5D,MAAM,qBAAqB,YAAY,QAAQ,SAAS,KAAK,MAAM,SAAS,CAAC;CAC7E,MAAM,8BAA8B,mBAAmB,QAAQ,SAAS,KAAK,SAAS;CACtF,MAAM,4BAA4B,mBAAmB,QAAQ,SAAS,CAAC,KAAK,SAAS;CACrF,MAAM,QAAQ,MAAM,QACjB,SAAS,KAAK,MAAM,WAAW,KAAK,KAAK,SAAS,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AY;GACzB,oBAAoB,mBAAmB;EACzC;CACF;AACF"}
1
+ {"version":3,"file":"report.js","names":[],"sources":["report.js"],"sourcesContent":["function countCodes(flags) {\n const counts = /* @__PURE__ */ new Map();\n for (const flag of flags) counts.set(flag.code, (counts.get(flag.code) ?? 0) + 1);\n return [...counts].sort(\n ([leftCode, leftCount], [rightCode, rightCount]) => rightCount - leftCount || leftCode.localeCompare(rightCode)\n );\n}\nfunction renderReport(files, corpus, registryDiagnostics, ignoredFiles = 0, write = false) {\n const sites = files.flatMap((file) => file.sites);\n const functionalVariants = files.flatMap((file) => file.functionalVariants);\n const sheetFrames = files.flatMap((file) => file.sheetFrames);\n const flaggedSheetFrames = sheetFrames.filter((site) => site.flags.length > 0);\n const transitions = files.flatMap((file) => file.transitions);\n const flaggedTransitions = transitions.filter((site) => site.flags.length > 0);\n const convertedFunctionalVariants = functionalVariants.filter((site) => site.converted);\n const flaggedFunctionalVariants = functionalVariants.filter((site) => !site.converted);\n const clean = sites.filter(\n (site) => site.flags.length === 0 && site.warnings.length === 0 && site.assessmentVerdict === \"clean\"\n );\n const flagged = sites.filter((site) => site.flags.length > 0);\n const warnings = sites.filter((site) => site.warnings.length > 0);\n const needsRelocation = sites.filter(\n (site) => site.assessmentVerdict === \"needs-relocation\"\n );\n const unknownHost = sites.filter((site) => site.assessmentVerdict === \"unknown-host\");\n const ineligible = sites.filter((site) => site.assessmentVerdict === \"ineligible\");\n const waiting = clean.filter((site) => site.programs.length === 0);\n const jsx = sites.filter((site) => site.kind === \"jsx\");\n const styled = sites.filter((site) => site.kind === \"styled\");\n const cleanJsx = jsx.filter(\n (site) => site.flags.length === 0 && site.warnings.length === 0 && site.assessmentVerdict === \"clean\"\n ).length;\n const cleanStyled = styled.filter(\n (site) => site.flags.length === 0 && site.warnings.length === 0 && site.assessmentVerdict === \"clean\"\n ).length;\n const touched = (file) => file.sites.length > 0 || file.functionalVariants.length > 0 || file.sheetFrames.length > 0 || file.transitions.length > 0;\n const blocked = (file) => file.sites.some((site) => site.legacyLeft > 0) || file.functionalVariants.some((site) => !site.converted) || file.sheetFrames.some((site) => site.flags.length > 0) || file.transitions.some((site) => site.flags.length > 0);\n const readyFiles = files.filter((file) => touched(file) && !blocked(file));\n const filesWithSites = files.filter(touched).length;\n const blockedFiles = files.filter(blocked).map((file) => file.file);\n const functionalFlagCounts = countCodes(\n flaggedFunctionalVariants.flatMap((site) => [\n ...new Map(site.flags.map((flag) => [flag.code, flag])).values()\n ])\n );\n const lines = [\n \"# Flat-values codemod dry-run\",\n \"\",\n `Corpus: ${corpus.map((entry) => `\\`${entry}\\``).join(\", \")}.`,\n \"\",\n write ? \"Statically safe conversions were written in place. Flagged legacy syntax remains for manual migration.\" : \"Dry run only: no source files were written. Pass `--write` to apply statically safe conversions.\",\n \"\",\n \"## Summary\",\n \"\",\n `- ${sites.length} conversion sites found`,\n `- ${clean.length - waiting.length} converted with no open questions`,\n `- ${needsRelocation.length} need relocation because the authored target or host cannot evaluate the conversion`,\n `- ${unknownHost.length} have an unverified host type`,\n `- ${ineligible.length} use properties that cannot carry flat clauses`,\n `- ${waiting.length} have nothing to convert until the runtime catches up (see below)`,\n `- ${flagged.length} have syntax or ordering flags for manual work`,\n `- ${warnings.length} have configuration warnings for manual review`,\n `- ${ignoredFiles} source files skipped by \\`.tamagui-flat-values-ignore\\` markers`,\n `- ${jsx.length} JSX sites: ${cleanJsx} clean, ${jsx.length - cleanJsx} need review`,\n `- ${styled.length} styled config sites: ${cleanStyled} clean, ${styled.length - cleanStyled} need review`,\n `- ${functionalVariants.length} functional variant sites found`,\n `- ${convertedFunctionalVariants.length} functional variants have automatic styled.dynamic rewrites`,\n `- ${flaggedFunctionalVariants.length} functional variants need manual migration`,\n `- ${sheetFrames.length} Sheet.Frame sites rewritten to Sheet.Container plus Sheet.Background`,\n `- ${flaggedSheetFrames.length} Sheet.Frame sites need a human to place a spread or a styled target`,\n `- ${transitions.length} v2 transition values rewritten to the v3 spelling`,\n `- ${flaggedTransitions.length} v2 transition values need a hand migration`,\n \"\",\n \"### Functional variant flag reasons\",\n \"\",\n ...functionalFlagCounts.length ? functionalFlagCounts.map(([code, count]) => `- ${code}: ${count}`) : [\"- none\"],\n \"\",\n \"### Remaining manual migration\",\n \"\",\n `${readyFiles.length} of ${filesWithSites} files have no legacy condition object, flagged functional variant, or flagged Sheet.Frame left after`,\n \"conversion. V3 has no compatibility setting; finish the remaining files directly:\",\n blockedFiles.length ? blockedFiles.map((file) => `\\`${file}\\``).join(\", \") : \"every file in this corpus is fully migrated.\",\n \"\",\n \"### Flag reasons\",\n \"\"\n ];\n const flagCounts = countCodes(flagged.flatMap((site) => site.flags));\n lines.push(\n ...flagCounts.length ? flagCounts.map(([code, count]) => `- ${code}: ${count}`) : [\"- none\"]\n );\n const warningCounts = countCodes(warnings.flatMap((site) => site.warnings));\n lines.push(\n \"\",\n \"### Configuration warning reasons\",\n \"\",\n ...warningCounts.length ? warningCounts.map(([code, count]) => `- ${code}: ${count}`) : [\"- none\"]\n );\n const inventoryCounts = countCodes(sites.flatMap((site) => site.inventory));\n if (inventoryCounts.length) {\n lines.push(\n \"\",\n \"### Values left authored for another migration\",\n \"\",\n \"These are not flat-value migration work. The conversion keeps them exactly as\",\n \"authored and records them so their follow-up migrations have a corpus inventory.\",\n \"\",\n ...inventoryCounts.map(([code, count]) => `- ${code}: ${count}`)\n );\n }\n const pendingCounts = countCodes(sites.flatMap((site) => site.pending));\n if (pendingCounts.length) {\n lines.push(\n \"\",\n \"### Waiting on runtime support\",\n \"\",\n \"The conversion is known but not offered, because the runtime cannot read it yet.\",\n \"Each pending reason below names the exact host or merge contract that must land\",\n \"before the suggested source is safe to apply.\",\n \"\",\n ...pendingCounts.map(([code, count]) => `- ${code}: ${count}`)\n );\n }\n if (registryDiagnostics.length) {\n lines.push(\"\", \"### Modifier registry diagnostics\", \"\");\n for (const diagnostic of registryDiagnostics) lines.push(`- ${diagnostic}`);\n }\n for (const file of files) {\n if (!touched(file)) continue;\n lines.push(\"\", `## \\`${file.file}\\``, \"\");\n for (const site of file.transitions) {\n lines.push(\n `### ${site.label} at line ${site.line} (${site.flags.length ? \"review\" : \"automatic\"})`,\n \"\",\n \"Before:\",\n \"\",\n \"```tsx\",\n site.before,\n \"```\",\n \"\",\n \"Automatic rewrite:\",\n \"\",\n \"```tsx\",\n site.after,\n \"```\"\n );\n if (site.flags.length) {\n lines.push(\"\", \"Flags:\", \"\");\n for (const flag of site.flags) lines.push(`- **${flag.code}**: ${flag.detail}`);\n }\n }\n for (const site of file.sheetFrames) {\n lines.push(\n `### ${site.label} at line ${site.line} (${site.flags.length ? \"review\" : \"automatic\"})`,\n \"\",\n \"Before:\",\n \"\",\n \"```tsx\",\n site.before,\n \"```\",\n \"\",\n \"Automatic rewrite:\",\n \"\",\n \"```tsx\",\n site.after,\n \"```\"\n );\n if (site.flags.length) {\n lines.push(\"\", \"Flags:\", \"\");\n for (const flag of site.flags) lines.push(`- **${flag.code}**: ${flag.detail}`);\n }\n lines.push(\"\");\n }\n for (const site of file.functionalVariants) {\n lines.push(\n `### ${site.label} functional variant at line ${site.line} (${site.converted ? \"automatic\" : \"manual\"})`,\n \"\",\n \"Before:\",\n \"\",\n \"```tsx\",\n site.before,\n \"```\",\n \"\",\n site.converted ? \"Automatic rewrite:\" : \"Left authored:\",\n \"\",\n \"```tsx\",\n site.after,\n \"```\"\n );\n if (site.flags.length) {\n lines.push(\"\", \"Flags:\", \"\");\n for (const flag of site.flags) lines.push(`- **${flag.code}**: ${flag.detail}`);\n }\n if (site.draft) {\n lines.push(\"\", \"Generated `.resolve` draft:\", \"\", \"```tsx\", site.draft, \"```\");\n }\n if (site.notes.length) {\n lines.push(\"\", \"Notes:\", \"\");\n for (const note of site.notes) lines.push(`- ${note}`);\n }\n lines.push(\"\");\n }\n for (const site of file.sites) {\n const status = [\n site.assessmentVerdict === \"clean\" ? null : site.assessmentVerdict,\n site.flags.length ? \"syntax-blocked\" : null,\n site.warnings.length ? \"configuration-warning\" : null\n ].filter(Boolean).join(\", \");\n lines.push(\n `### ${site.label} at line ${site.line} (${status || \"clean\"})`,\n \"\",\n \"Before:\",\n \"\",\n \"```tsx\",\n site.before,\n \"```\",\n \"\",\n \"After:\",\n \"\",\n \"```tsx\",\n site.after,\n \"```\"\n );\n if (site.flags.length) {\n lines.push(\"\", \"Flags:\", \"\");\n for (const flag of site.flags) lines.push(`- **${flag.code}**: ${flag.detail}`);\n }\n if (site.warnings.length) {\n lines.push(\"\", \"Configuration warnings:\", \"\");\n for (const warning of site.warnings) {\n lines.push(`- **${warning.code}**: ${warning.detail}`);\n }\n }\n if (site.assessments.length) {\n lines.push(\"\", \"Conversion assessment:\", \"\");\n for (const assessment of site.assessments) {\n for (const reason of assessment.reasons) {\n lines.push(\n `- **${assessment.verdict}: ${assessment.property}**: ${reason.message}. Remedy: ${reason.remedy}.`\n );\n }\n }\n }\n if (site.inventory.length) {\n lines.push(\"\", \"Left authored:\", \"\");\n for (const flag of site.inventory)\n lines.push(`- **${flag.code}**: ${flag.detail}`);\n }\n if (site.pending.length) {\n lines.push(\"\", \"Waiting on runtime support:\", \"\");\n for (const flag of site.pending) lines.push(`- **${flag.code}**: ${flag.detail}`);\n }\n if (site.notes.length) {\n lines.push(\"\", \"Notes:\", \"\");\n for (const note of site.notes) lines.push(`- ${note}`);\n }\n lines.push(\"\");\n }\n }\n return {\n text: `${lines.join(\"\\n\")}\n`,\n summary: {\n sites: sites.length,\n clean: clean.length,\n needsRelocation: needsRelocation.length,\n unknownHost: unknownHost.length,\n ineligible: ineligible.length,\n flagged: flagged.length,\n warnings: warnings.length,\n waiting: waiting.length,\n ignoredFiles,\n functionalVariantSites: functionalVariants.length,\n functionalVariantConverted: convertedFunctionalVariants.length,\n functionalVariantFlagged: flaggedFunctionalVariants.length,\n functionalVariantFlags: Object.fromEntries(functionalFlagCounts),\n sheetFrames: sheetFrames.length,\n sheetFramesFlagged: flaggedSheetFrames.length,\n transitions: transitions.length,\n transitionsFlagged: flaggedTransitions.length\n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Y,WAAW;GACvB,SAAS,QAAQ;GACjB,UAAU,SAAS;GACnB,SAAS,QAAQ;GACjB;GACA,wBAAwB,mBAAmB;GAC3C,4BAA4B,4BAA4B;GACxD,0BAA0B,0BAA0B;GACpD,wBAAwB,OAAO,YAAY,oBAAoB;GAC/D,aAAa,YAAY;GACzB,oBAAoB,mBAAmB;GACvC,aAAa,YAAY;GACzB,oBAAoB,mBAAmB;EACzC;CACF;AACF"}
@@ -0,0 +1,257 @@
1
+ import { Node, SyntaxKind } from "ts-morph";
2
+ import { TRANSITION_RESERVED_KEYS, migrateLegacyTransition, printMigratedTransition } from "@tamagui/style-grammar/tooling";
3
+ import { staticLeafValue, unwrapExpression } from "./expressions.mjs";
4
+
5
+ const legacySpringKeys = /* @__PURE__ */ new Set([
6
+ "stiffness",
7
+ "damping",
8
+ "mass",
9
+ "velocity",
10
+ "overshootClamping",
11
+ "restDisplacementThreshold",
12
+ "restSpeedThreshold",
13
+ "tension",
14
+ "friction",
15
+ "bounciness",
16
+ "speed"
17
+ ]);
18
+ const identifierPattern = /^[A-Za-z_$][A-Za-z0-9_$-]*$/;
19
+ function staticValue(expression) {
20
+ const current = unwrapExpression(expression);
21
+ const leaf = staticLeafValue(current);
22
+ if (leaf) return { value: leaf.value };
23
+ if (Node.isArrayLiteralExpression(current)) {
24
+ const values = [];
25
+ for (const element of current.getElements()) {
26
+ const item = staticValue(element);
27
+ if (!item) return null;
28
+ values.push(item.value);
29
+ }
30
+ return { value: values };
31
+ }
32
+ if (Node.isObjectLiteralExpression(current)) {
33
+ const value = {};
34
+ for (const property of current.getProperties()) {
35
+ if (!Node.isPropertyAssignment(property)) return null;
36
+ const nameNode = property.getNameNode();
37
+ if (Node.isComputedPropertyName(nameNode)) return null;
38
+ const name = Node.isIdentifier(nameNode) ? nameNode.getText() : Node.isStringLiteral(nameNode) ? nameNode.getLiteralValue() : null;
39
+ if (name === null) return null;
40
+ const item = staticValue(property.getInitializerOrThrow());
41
+ if (!item) return null;
42
+ value[name] = item.value;
43
+ }
44
+ return { value };
45
+ }
46
+ return null;
47
+ }
48
+ function animateOnlyList(expression) {
49
+ const evaluated = staticValue(expression);
50
+ if (!evaluated || !Array.isArray(evaluated.value)) return null;
51
+ const list = [];
52
+ for (const item of evaluated.value) {
53
+ if (typeof item !== "string") return null;
54
+ list.push(item);
55
+ }
56
+ return list;
57
+ }
58
+ function isLegacyTransition(value) {
59
+ if (Array.isArray(value)) return true;
60
+ if (!value || typeof value !== "object") return false;
61
+ const object = value;
62
+ if (object.default !== void 0) return true;
63
+ for (const key in object) {
64
+ if (legacySpringKeys.has(key)) return true;
65
+ if (TRANSITION_RESERVED_KEYS.has(key)) continue;
66
+ const entry = object[key];
67
+ if (!entry || typeof entry !== "object") continue;
68
+ const config = entry;
69
+ if (config.type !== void 0) return true;
70
+ for (const nested in config) {
71
+ if (legacySpringKeys.has(nested)) return true;
72
+ }
73
+ }
74
+ return false;
75
+ }
76
+ function presetNamesIn(value, names) {
77
+ if (typeof value === "string") {
78
+ if (identifierPattern.test(value)) names.add(value);
79
+ return;
80
+ }
81
+ if (Array.isArray(value)) {
82
+ for (const item of value) presetNamesIn(item, names);
83
+ return;
84
+ }
85
+ if (!value || typeof value !== "object") return;
86
+ for (const key in value) {
87
+ presetNamesIn(value[key], names);
88
+ }
89
+ }
90
+ function migrateTransitionValue(expression, animateOnly) {
91
+ if (expression === null) return null;
92
+ const evaluated = staticValue(expression);
93
+ if (!evaluated) {
94
+ if (animateOnly) {
95
+ return {
96
+ text: null,
97
+ isString: false,
98
+ error: "the removed `animateOnly` narrows a computed transition, so it needs a hand migration to `properties`"
99
+ };
100
+ }
101
+ return Node.isArrayLiteralExpression(unwrapExpression(expression)) ? {
102
+ text: null,
103
+ isString: false,
104
+ error: "the v2 transition array form holds a computed value, so it needs a hand migration to `{ preset }`"
105
+ } : null;
106
+ }
107
+ if (!animateOnly && !isLegacyTransition(evaluated.value)) return null;
108
+ const names = /* @__PURE__ */ new Set();
109
+ presetNamesIn(evaluated.value, names);
110
+ const migrated = migrateLegacyTransition(evaluated.value, names, animateOnly);
111
+ if (!migrated.ok) {
112
+ return {
113
+ text: null,
114
+ isString: false,
115
+ error: migrated.diagnostics.map((one) => one.message).join("; ")
116
+ };
117
+ }
118
+ return {
119
+ text: printMigratedTransition(migrated.value),
120
+ isString: typeof migrated.value === "string",
121
+ error: null
122
+ };
123
+ }
124
+ function convertTransitions(sourceFile, provenance, write) {
125
+ const found = [];
126
+ const readAnimateOnly = (node) => {
127
+ if (!node) return { list: void 0 };
128
+ const initializer = Node.isJsxAttribute(node) ? node.getInitializer() : Node.isPropertyAssignment(node) ? node.getInitializer() : void 0;
129
+ const expression = initializer && Node.isJsxExpression(initializer) ? initializer.getExpression() : initializer;
130
+ return { list: (expression && animateOnlyList(expression)) ?? void 0 };
131
+ };
132
+ for (const opening of [...sourceFile.getDescendantsOfKind(SyntaxKind.JsxOpeningElement), ...sourceFile.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement)]) {
133
+ if (!provenance.isTamaguiElement(opening)) continue;
134
+ let transitionNode = null;
135
+ let animateOnlyNode = null;
136
+ for (const attribute of opening.getAttributes()) {
137
+ if (!Node.isJsxAttribute(attribute)) continue;
138
+ const name = attribute.getNameNode().getText();
139
+ if (name === "transition") transitionNode = attribute;
140
+ else if (name === "animateOnly") animateOnlyNode = attribute;
141
+ }
142
+ const initializer = transitionNode?.getInitializer();
143
+ const expression = Node.isJsxExpression(initializer) ? initializer.getExpression() ?? null : Node.isStringLiteral(initializer) ? initializer : null;
144
+ const { list: animateOnly } = readAnimateOnly(animateOnlyNode);
145
+ const tag = opening.getTagNameNode().getText();
146
+ if (animateOnlyNode && (!transitionNode || !animateOnly)) {
147
+ found.push({
148
+ label: `<${tag} animateOnly>`,
149
+ node: animateOnlyNode,
150
+ value: null,
151
+ animateOnly: void 0,
152
+ animateOnlyNode: null,
153
+ blocked: transitionNode ? "the removed `animateOnly` holds a computed list; spell it as `properties` inside the transition" : "the removed `animateOnly` has no `transition` next to it; spell it as `properties` wherever the transition is authored",
154
+ replace: () => {}
155
+ });
156
+ continue;
157
+ }
158
+ if (!transitionNode) continue;
159
+ found.push({
160
+ label: `<${tag} transition>`,
161
+ node: transitionNode,
162
+ value: expression,
163
+ animateOnly,
164
+ animateOnlyNode,
165
+ blocked: null,
166
+ replace: (text) => transitionNode.replaceWithText(text.startsWith("\"") ? `transition=${text}` : `transition={${text}}`)
167
+ });
168
+ }
169
+ for (const call of sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression)) {
170
+ if (!provenance.isTamaguiStyledCall(call)) continue;
171
+ for (const literal of call.getDescendantsOfKind(SyntaxKind.ObjectLiteralExpression)) {
172
+ let transitionNode;
173
+ let animateOnlyNode;
174
+ for (const property of literal.getProperties()) {
175
+ if (!Node.isPropertyAssignment(property)) continue;
176
+ const nameNode = property.getNameNode();
177
+ const name = Node.isIdentifier(nameNode) ? nameNode.getText() : Node.isStringLiteral(nameNode) ? nameNode.getLiteralValue() : null;
178
+ if (name === "transition") transitionNode = property;
179
+ else if (name === "animateOnly") animateOnlyNode = property;
180
+ }
181
+ const { list: animateOnly } = readAnimateOnly(animateOnlyNode ?? null);
182
+ if (animateOnlyNode && (!transitionNode || !animateOnly)) {
183
+ found.push({
184
+ label: `styled(\u2026) animateOnly`,
185
+ node: animateOnlyNode,
186
+ value: null,
187
+ animateOnly: void 0,
188
+ animateOnlyNode: null,
189
+ blocked: transitionNode ? "the removed `animateOnly` holds a computed list; spell it as `properties` inside the transition" : "the removed `animateOnly` has no `transition` next to it; spell it as `properties` wherever the transition is authored",
190
+ replace: () => {}
191
+ });
192
+ continue;
193
+ }
194
+ if (!transitionNode || !Node.isPropertyAssignment(transitionNode)) continue;
195
+ const assignment = transitionNode;
196
+ found.push({
197
+ label: `styled(\u2026) transition`,
198
+ node: assignment,
199
+ value: assignment.getInitializerOrThrow(),
200
+ animateOnly,
201
+ animateOnlyNode: animateOnlyNode ?? null,
202
+ blocked: null,
203
+ replace: (text) => assignment.replaceWithText(`transition: ${text}`)
204
+ });
205
+ }
206
+ }
207
+ const reports = [];
208
+ const edits = [];
209
+ for (const candidate of found) {
210
+ const migrated = candidate.blocked ? {
211
+ text: null,
212
+ isString: false,
213
+ error: candidate.blocked
214
+ } : migrateTransitionValue(candidate.value, candidate.animateOnly);
215
+ if (migrated === null) continue;
216
+ const report = {
217
+ label: candidate.label,
218
+ line: candidate.node.getStartLineNumber(),
219
+ before: candidate.node.getText(),
220
+ after: candidate.node.getText(),
221
+ flags: []
222
+ };
223
+ if (migrated.text === null) {
224
+ report.flags.push({
225
+ code: "unsupported-legacy-value",
226
+ detail: migrated.error ?? ""
227
+ });
228
+ } else {
229
+ const text = migrated.isString && Node.isJsxAttribute(candidate.node) ? `"${migrated.text.slice(1, -1).replace(/"/g, "&quot;")}"` : migrated.text;
230
+ report.after = Node.isJsxAttribute(candidate.node) ? migrated.isString ? `transition=${text}` : `transition={${text}}` : `transition: ${text}`;
231
+ edits.push({
232
+ start: candidate.node.getStart(),
233
+ apply: () => candidate.replace(text)
234
+ });
235
+ const removed = candidate.animateOnlyNode;
236
+ if (removed) {
237
+ edits.push({
238
+ start: removed.getStart(),
239
+ apply: () => {
240
+ if (Node.isJsxAttribute(removed)) removed.remove();
241
+ else if (Node.isPropertyAssignment(removed)) removed.remove();
242
+ }
243
+ });
244
+ }
245
+ }
246
+ reports.push(report);
247
+ }
248
+ if (write) {
249
+ edits.sort((left, right) => right.start - left.start);
250
+ for (const edit of edits) edit.apply();
251
+ }
252
+ reports.sort((left, right) => left.line - right.line);
253
+ return reports;
254
+ }
255
+
256
+ export { convertTransitions };
257
+ //# sourceMappingURL=transition.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transition.js","names":[],"sources":["transition.js"],"sourcesContent":["import { Node, SyntaxKind } from \"ts-morph\";\nimport {\n migrateLegacyTransition,\n printMigratedTransition,\n TRANSITION_RESERVED_KEYS\n} from \"@tamagui/style-grammar/tooling\";\nimport { staticLeafValue, unwrapExpression } from \"./expressions\";\nconst legacySpringKeys = /* @__PURE__ */ new Set([\n \"stiffness\",\n \"damping\",\n \"mass\",\n \"velocity\",\n \"overshootClamping\",\n \"restDisplacementThreshold\",\n \"restSpeedThreshold\",\n \"tension\",\n \"friction\",\n \"bounciness\",\n \"speed\"\n]);\nconst identifierPattern = /^[A-Za-z_$][A-Za-z0-9_$-]*$/;\nfunction staticValue(expression) {\n const current = unwrapExpression(expression);\n const leaf = staticLeafValue(current);\n if (leaf) return { value: leaf.value };\n if (Node.isArrayLiteralExpression(current)) {\n const values = [];\n for (const element of current.getElements()) {\n const item = staticValue(element);\n if (!item) return null;\n values.push(item.value);\n }\n return { value: values };\n }\n if (Node.isObjectLiteralExpression(current)) {\n const value = {};\n for (const property of current.getProperties()) {\n if (!Node.isPropertyAssignment(property)) return null;\n const nameNode = property.getNameNode();\n if (Node.isComputedPropertyName(nameNode)) return null;\n const name = Node.isIdentifier(nameNode) ? nameNode.getText() : Node.isStringLiteral(nameNode) ? nameNode.getLiteralValue() : null;\n if (name === null) return null;\n const item = staticValue(property.getInitializerOrThrow());\n if (!item) return null;\n value[name] = item.value;\n }\n return { value };\n }\n return null;\n}\nfunction animateOnlyList(expression) {\n const evaluated = staticValue(expression);\n if (!evaluated || !Array.isArray(evaluated.value)) return null;\n const list = [];\n for (const item of evaluated.value) {\n if (typeof item !== \"string\") return null;\n list.push(item);\n }\n return list;\n}\nfunction isLegacyTransition(value) {\n if (Array.isArray(value)) return true;\n if (!value || typeof value !== \"object\") return false;\n const object = value;\n if (object.default !== void 0) return true;\n for (const key in object) {\n if (legacySpringKeys.has(key)) return true;\n if (TRANSITION_RESERVED_KEYS.has(key)) continue;\n const entry = object[key];\n if (!entry || typeof entry !== \"object\") continue;\n const config = entry;\n if (config.type !== void 0) return true;\n for (const nested in config) {\n if (legacySpringKeys.has(nested)) return true;\n }\n }\n return false;\n}\nfunction presetNamesIn(value, names) {\n if (typeof value === \"string\") {\n if (identifierPattern.test(value)) names.add(value);\n return;\n }\n if (Array.isArray(value)) {\n for (const item of value) presetNamesIn(item, names);\n return;\n }\n if (!value || typeof value !== \"object\") return;\n for (const key in value) {\n presetNamesIn(value[key], names);\n }\n}\nfunction migrateTransitionValue(expression, animateOnly) {\n if (expression === null) return null;\n const evaluated = staticValue(expression);\n if (!evaluated) {\n if (animateOnly) {\n return {\n text: null,\n isString: false,\n error: \"the removed `animateOnly` narrows a computed transition, so it needs a hand migration to `properties`\"\n };\n }\n return Node.isArrayLiteralExpression(unwrapExpression(expression)) ? {\n text: null,\n isString: false,\n error: \"the v2 transition array form holds a computed value, so it needs a hand migration to `{ preset }`\"\n } : null;\n }\n if (!animateOnly && !isLegacyTransition(evaluated.value)) return null;\n const names = /* @__PURE__ */ new Set();\n presetNamesIn(evaluated.value, names);\n const migrated = migrateLegacyTransition(\n evaluated.value,\n names,\n animateOnly\n );\n if (!migrated.ok) {\n return {\n text: null,\n isString: false,\n error: migrated.diagnostics.map((one) => one.message).join(\"; \")\n };\n }\n return {\n text: printMigratedTransition(migrated.value),\n isString: typeof migrated.value === \"string\",\n error: null\n };\n}\nfunction convertTransitions(sourceFile, provenance, write) {\n const found = [];\n const readAnimateOnly = (node) => {\n if (!node) return { list: void 0 };\n const initializer = Node.isJsxAttribute(node) ? node.getInitializer() : Node.isPropertyAssignment(node) ? node.getInitializer() : void 0;\n const expression = initializer && Node.isJsxExpression(initializer) ? initializer.getExpression() : initializer;\n return { list: (expression && animateOnlyList(expression)) ?? void 0 };\n };\n for (const opening of [\n ...sourceFile.getDescendantsOfKind(SyntaxKind.JsxOpeningElement),\n ...sourceFile.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement)\n ]) {\n if (!provenance.isTamaguiElement(opening)) continue;\n let transitionNode = null;\n let animateOnlyNode = null;\n for (const attribute of opening.getAttributes()) {\n if (!Node.isJsxAttribute(attribute)) continue;\n const name = attribute.getNameNode().getText();\n if (name === \"transition\") transitionNode = attribute;\n else if (name === \"animateOnly\") animateOnlyNode = attribute;\n }\n const initializer = transitionNode?.getInitializer();\n const expression = Node.isJsxExpression(initializer) ? initializer.getExpression() ?? null : Node.isStringLiteral(initializer) ? initializer : null;\n const { list: animateOnly } = readAnimateOnly(animateOnlyNode);\n const tag = opening.getTagNameNode().getText();\n if (animateOnlyNode && (!transitionNode || !animateOnly)) {\n found.push({\n label: `<${tag} animateOnly>`,\n node: animateOnlyNode,\n value: null,\n animateOnly: void 0,\n animateOnlyNode: null,\n blocked: transitionNode ? \"the removed `animateOnly` holds a computed list; spell it as `properties` inside the transition\" : \"the removed `animateOnly` has no `transition` next to it; spell it as `properties` wherever the transition is authored\",\n replace: () => {\n }\n });\n continue;\n }\n if (!transitionNode) continue;\n found.push({\n label: `<${tag} transition>`,\n node: transitionNode,\n value: expression,\n animateOnly,\n animateOnlyNode,\n blocked: null,\n replace: (text) => transitionNode.replaceWithText(\n text.startsWith('\"') ? `transition=${text}` : `transition={${text}}`\n )\n });\n }\n for (const call of sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression)) {\n if (!provenance.isTamaguiStyledCall(call)) continue;\n for (const literal of call.getDescendantsOfKind(SyntaxKind.ObjectLiteralExpression)) {\n let transitionNode;\n let animateOnlyNode;\n for (const property of literal.getProperties()) {\n if (!Node.isPropertyAssignment(property)) continue;\n const nameNode = property.getNameNode();\n const name = Node.isIdentifier(nameNode) ? nameNode.getText() : Node.isStringLiteral(nameNode) ? nameNode.getLiteralValue() : null;\n if (name === \"transition\") transitionNode = property;\n else if (name === \"animateOnly\") animateOnlyNode = property;\n }\n const { list: animateOnly } = readAnimateOnly(animateOnlyNode ?? null);\n if (animateOnlyNode && (!transitionNode || !animateOnly)) {\n found.push({\n label: `styled(\\u2026) animateOnly`,\n node: animateOnlyNode,\n value: null,\n animateOnly: void 0,\n animateOnlyNode: null,\n blocked: transitionNode ? \"the removed `animateOnly` holds a computed list; spell it as `properties` inside the transition\" : \"the removed `animateOnly` has no `transition` next to it; spell it as `properties` wherever the transition is authored\",\n replace: () => {\n }\n });\n continue;\n }\n if (!transitionNode || !Node.isPropertyAssignment(transitionNode)) continue;\n const assignment = transitionNode;\n found.push({\n label: `styled(\\u2026) transition`,\n node: assignment,\n value: assignment.getInitializerOrThrow(),\n animateOnly,\n animateOnlyNode: animateOnlyNode ?? null,\n blocked: null,\n replace: (text) => assignment.replaceWithText(`transition: ${text}`)\n });\n }\n }\n const reports = [];\n const edits = [];\n for (const candidate of found) {\n const migrated = candidate.blocked ? { text: null, isString: false, error: candidate.blocked } : migrateTransitionValue(candidate.value, candidate.animateOnly);\n if (migrated === null) continue;\n const report = {\n label: candidate.label,\n line: candidate.node.getStartLineNumber(),\n before: candidate.node.getText(),\n after: candidate.node.getText(),\n flags: []\n };\n if (migrated.text === null) {\n report.flags.push({\n code: \"unsupported-legacy-value\",\n detail: migrated.error ?? \"\"\n });\n } else {\n const text = migrated.isString && Node.isJsxAttribute(candidate.node) ? `\"${migrated.text.slice(1, -1).replace(/\"/g, \"&quot;\")}\"` : migrated.text;\n report.after = Node.isJsxAttribute(candidate.node) ? migrated.isString ? `transition=${text}` : `transition={${text}}` : `transition: ${text}`;\n edits.push({\n start: candidate.node.getStart(),\n apply: () => candidate.replace(text)\n });\n const removed = candidate.animateOnlyNode;\n if (removed) {\n edits.push({\n start: removed.getStart(),\n apply: () => {\n if (Node.isJsxAttribute(removed)) removed.remove();\n else if (Node.isPropertyAssignment(removed)) removed.remove();\n }\n });\n }\n }\n reports.push(report);\n }\n if (write) {\n edits.sort((left, right) => right.start - left.start);\n for (const edit of edits) edit.apply();\n }\n reports.sort((left, right) => left.line - right.line);\n return reports;\n}\nexport {\n convertTransitions\n};\n//# sourceMappingURL=transition.js.map\n"],"mappings":";;;;;AAOA,MAAM,mCAAmC,IAAI,IAAI;CAC/C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,MAAM,oBAAoB;AAC1B,SAAS,YAAY,YAAY;CAC/B,MAAM,UAAU,iBAAiB,UAAU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ACF;EACA,QAAQ,KAAK,MAAM;CACrB;CACA,IAAI,OAAO;EACT,MAAM,MAAM,MAAM,UAAU,MAAM,QAAQ,KAAK,KAAK;EACpD,KAAK,MAAM,QAAQ,OAAO,KAAK,MAAM;CACvC;CACA,QAAQ,MAAM,MAAM,UAAU,KAAK,OAAO,MAAM,IAAI;CACpD,OAAO;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/codemod-flat-values",
3
- "version": "3.0.0-beta.924.1",
3
+ "version": "3.0.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "bin": {
@@ -26,19 +26,19 @@
26
26
  "typecheck": "tsc --noEmit"
27
27
  },
28
28
  "dependencies": {
29
- "@tamagui/helpers": "3.0.0-beta.924.1",
30
- "@tamagui/language-service": "3.0.0-beta.924.1",
31
- "@tamagui/shorthands": "3.0.0-beta.924.1",
32
- "@tamagui/style-grammar": "3.0.0-beta.924.1",
29
+ "@tamagui/helpers": "3.0.1",
30
+ "@tamagui/shorthands": "3.0.1",
31
+ "@tamagui/style-grammar": "3.0.1",
33
32
  "ts-morph": "^28.0.0"
34
33
  },
35
34
  "devDependencies": {
36
- "@tamagui/build": "3.0.0-beta.924.1",
37
- "typescript": "~6.0.3"
35
+ "@tamagui/build": "3.0.1",
36
+ "typescript": "7.0.2"
38
37
  },
39
38
  "repository": {
40
39
  "type": "git",
41
40
  "url": "git+https://github.com/tamagui/tamagui.git",
42
41
  "directory": "code/core/codemod-flat-values"
43
- }
42
+ },
43
+ "releaseSourceCommit": "c156b7cc55e5a6cc5883ebc8189720850ac32dbd"
44
44
  }
package/src/convert.ts CHANGED
@@ -391,7 +391,7 @@ function legacyTokenWarnings(prop: string, values: readonly string[]): Flag[] {
391
391
  .join(', ')
392
392
  warnings.push({
393
393
  code: 'legacy-palette-token',
394
- detail: `${prop} preserves ${formatted}, which @tamagui/config/v6 does not define; choose an absolute palette token or an adaptive colorN value`,
394
+ detail: `${prop} preserves ${formatted}, which @tamagui/config/v6 does not define; choose an absolute palette token or an adaptive color-N value`,
395
395
  })
396
396
  return warnings
397
397
  }
@@ -200,7 +200,7 @@ export function runtimeType(expression: Expression): RuntimeType {
200
200
  literals.push(String(part.getLiteralValue()))
201
201
  continue
202
202
  }
203
- if (part.isString()) {
203
+ if (part.isString() || part.isTemplateLiteral()) {
204
204
  strings++
205
205
  continue
206
206
  }
package/src/grammar.ts CHANGED
@@ -58,14 +58,21 @@ export type {
58
58
 
59
59
  export { shorthands }
60
60
 
61
- function renameBuiltInTokens(value: unknown): unknown {
61
+ function normalizeV3Payload(value: unknown, prop = ''): unknown {
62
+ if (
63
+ typeof value === 'number' &&
64
+ Number.isFinite(value) &&
65
+ (prop === 'lineHeight' || prop === 'lh')
66
+ ) {
67
+ return String(value)
68
+ }
62
69
  if (typeof value === 'string') return replaceV6BuiltInTokens(value)
63
- if (Array.isArray(value)) return value.map(renameBuiltInTokens)
70
+ if (Array.isArray(value)) return value.map((item) => normalizeV3Payload(item, prop))
64
71
  if (value === null || typeof value !== 'object') return value
65
72
 
66
73
  const renamed: Record<string, unknown> = {}
67
74
  for (const key in value) {
68
- renamed[key] = renameBuiltInTokens((value as Record<string, unknown>)[key])
75
+ renamed[key] = normalizeV3Payload((value as Record<string, unknown>)[key], key)
69
76
  }
70
77
  return renamed
71
78
  }
@@ -75,7 +82,7 @@ export function convertLegacyConditionProp(
75
82
  value: unknown,
76
83
  options: ConvertLegacyConditionOptions
77
84
  ): LegacyConditionResult | null {
78
- return convertLegacyConditionPropLocal(propName, renameBuiltInTokens(value), options)
85
+ return convertLegacyConditionPropLocal(propName, normalizeV3Payload(value), options)
79
86
  }
80
87
 
81
88
  /** every prop spelling the codemod treats as carrying a style value */