@tamagui/codemod-flat-values 3.0.0-beta.901.1 → 3.0.0-beta.917.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/README.md +6 -1
- package/dist/convert.mjs +42 -28
- package/dist/convert.mjs.map +1 -1
- package/dist/index.mjs +14 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/convert.ts +89 -25
- package/src/index.ts +23 -2
package/README.md
CHANGED
|
@@ -127,7 +127,11 @@ component's TypeScript prop type accepts the style.
|
|
|
127
127
|
`boxShadow`, or `textShadow` composite.
|
|
128
128
|
|
|
129
129
|
The type-aware host lookup is shared with `@tamagui/language-service`; the codemod does
|
|
130
|
-
not import or evaluate an app's runtime config.
|
|
130
|
+
not import or evaluate an app's runtime config. Host validity is a question about the
|
|
131
|
+
property rather than its spelling, so a host that types `rounded` accepts `borderRadius`
|
|
132
|
+
too: `onlyAllowShorthands: true` omits every longhand a shorthand covers from the
|
|
133
|
+
component's prop type, and the conversion resolves an authored shorthand to its longhand
|
|
134
|
+
before it asks.
|
|
131
135
|
|
|
132
136
|
Ordering is never traded for a bigger diff. A program merges only when every
|
|
133
137
|
contribution still beats and loses to the same things it did, so an opaque spread or
|
|
@@ -194,6 +198,7 @@ A flag means a human decides. Every code the tool can emit:
|
|
|
194
198
|
| `unregistered-legacy-condition` | a registered shape whose parameter is not registered |
|
|
195
199
|
| `non-style-condition-entry` | a conditional non-style prop (`numberOfLines`) has no flat target |
|
|
196
200
|
| `dynamic-legacy-condition` | the condition object is built at runtime (spread, computed key, non-literal) |
|
|
201
|
+
| `legacy-condition-in-spread` | a spread the conversion cannot open (`{...(wide && { $sm: … })}`) holds v1 condition keys, named in the flag |
|
|
197
202
|
| `unprovable-dynamic-value` | a condition needs the base value, whose type cannot be proven |
|
|
198
203
|
| `dynamic-condition-value` | a value inside the condition object is not statically known |
|
|
199
204
|
| `non-css-style-value` | a condition needs a base that is `true`, `false`, or `null` |
|
package/dist/convert.mjs
CHANGED
|
@@ -55,6 +55,36 @@ function addAssessment(site, property, assessment) {
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
+
function legacyKeysInSpread(expression) {
|
|
59
|
+
const names = /* @__PURE__ */ new Set();
|
|
60
|
+
for (const object of expression.getDescendantsOfKind(SyntaxKind.ObjectLiteralExpression)) {
|
|
61
|
+
for (const property of object.getProperties()) {
|
|
62
|
+
if (!Node.isPropertyAssignment(property)) continue;
|
|
63
|
+
const name = propertyName(property.getNameNode());
|
|
64
|
+
if (name !== null && isLegacyConditionName(name)) names.add(name);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return [...names];
|
|
68
|
+
}
|
|
69
|
+
function pushSpread(site, expression, text) {
|
|
70
|
+
const keys = legacyKeysInSpread(expression);
|
|
71
|
+
if (keys.length) {
|
|
72
|
+
site.legacy = true;
|
|
73
|
+
addFlag(site.flags, "legacy-condition-in-spread", `"${compact(text)}" is not an inline object literal, so its ${keys.map((key) => `"${key}"`).join(", ")} ${keys.length === 1 ? "entry stays" : "entries stay"} authored`);
|
|
74
|
+
}
|
|
75
|
+
site.members.push({
|
|
76
|
+
type: "spread",
|
|
77
|
+
index: site.index++,
|
|
78
|
+
text,
|
|
79
|
+
legacy: keys.length > 0
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function converted(site, report) {
|
|
83
|
+
return report.programs.length > 0 || site.extras.length > 0 || site.members.some((member) => member.type === "authored" && member.activated || member.type === "legacy" && !member.failed);
|
|
84
|
+
}
|
|
85
|
+
function legacyLeft(site) {
|
|
86
|
+
return site.members.filter((member) => member.type === "legacy" && member.failed || member.type === "spread" && member.legacy).length;
|
|
87
|
+
}
|
|
58
88
|
function isConvertedName(name) {
|
|
59
89
|
return name === "group" || styleProps.has(name) || tokenVariantProps.has(name) || isLegacyConditionName(name);
|
|
60
90
|
}
|
|
@@ -511,19 +541,19 @@ function pushLegacy(site, name, text, initializer, node) {
|
|
|
511
541
|
return;
|
|
512
542
|
}
|
|
513
543
|
const { canonical, replaceRoot } = resolution.resolved;
|
|
514
|
-
const
|
|
515
|
-
if (
|
|
544
|
+
const converted2 = convertLegacyConditionProp(canonical, evaluated.value, { registry: site.registry });
|
|
545
|
+
if (converted2 === null) {
|
|
516
546
|
addFlag(site.flags, "unknown-legacy-condition", `"${name}" is not a registered legacy condition spelling`);
|
|
517
547
|
keep(properties);
|
|
518
548
|
return;
|
|
519
549
|
}
|
|
520
|
-
for (const error of
|
|
550
|
+
for (const error of converted2.errors) {
|
|
521
551
|
const path = error.path.startsWith(canonical) ? `${name}${error.path.slice(canonical.length)}` : error.path;
|
|
522
552
|
addFlag(site.flags, error.code, `${path}: ${error.message}`);
|
|
523
553
|
failed = true;
|
|
524
554
|
}
|
|
525
555
|
const contributions = [];
|
|
526
|
-
for (const contribution of
|
|
556
|
+
for (const contribution of converted2.contributions) {
|
|
527
557
|
if (!styleProps.has(contribution.prop)) {
|
|
528
558
|
addFlag(site.flags, "non-style-condition-entry", `${name}.${contribution.prop} is not a style property, so a flat value cannot carry it`);
|
|
529
559
|
failed = true;
|
|
@@ -947,20 +977,12 @@ function convertJsxSite(opening, registry, containers, targets, host, write = fa
|
|
|
947
977
|
continue;
|
|
948
978
|
}
|
|
949
979
|
}
|
|
950
|
-
site.
|
|
951
|
-
type: "spread",
|
|
952
|
-
index: site.index++,
|
|
953
|
-
text: Node.isSpreadAssignment(property) ? `{${property.getText()}}` : `{...{ ${property.getText()} }}`
|
|
954
|
-
});
|
|
980
|
+
pushSpread(site, property, Node.isSpreadAssignment(property) ? `{${property.getText()}}` : `{...{ ${property.getText()} }}`);
|
|
955
981
|
}
|
|
956
982
|
continue;
|
|
957
983
|
}
|
|
958
984
|
before.push(compact(attribute.getText()));
|
|
959
|
-
site.
|
|
960
|
-
type: "spread",
|
|
961
|
-
index: site.index++,
|
|
962
|
-
text: attribute.getText()
|
|
963
|
-
});
|
|
985
|
+
pushSpread(site, expression, attribute.getText());
|
|
964
986
|
continue;
|
|
965
987
|
}
|
|
966
988
|
const name = jsxAttributeName(attribute);
|
|
@@ -1007,9 +1029,9 @@ function convertJsxSite(opening, registry, containers, targets, host, write = fa
|
|
|
1007
1029
|
inventory: site.inventory,
|
|
1008
1030
|
pending: site.pending,
|
|
1009
1031
|
notes: site.notes,
|
|
1010
|
-
legacyLeft: site
|
|
1032
|
+
legacyLeft: legacyLeft(site)
|
|
1011
1033
|
};
|
|
1012
|
-
if (write && !site.flags.some((flag) => flag.code === "emitted-program-mismatch" || flag.code === "emitted-value-invalid")) {
|
|
1034
|
+
if (write && converted(site, report) && !site.flags.some((flag) => flag.code === "emitted-program-mismatch" || flag.code === "emitted-value-invalid")) {
|
|
1013
1035
|
rewriteJsxSite(opening, entries);
|
|
1014
1036
|
}
|
|
1015
1037
|
return report;
|
|
@@ -1117,19 +1139,11 @@ function convertStyleObject(object, kind, label, registry, containers, targets,
|
|
|
1117
1139
|
continue;
|
|
1118
1140
|
}
|
|
1119
1141
|
}
|
|
1120
|
-
site.
|
|
1121
|
-
type: "spread",
|
|
1122
|
-
index: site.index++,
|
|
1123
|
-
text: compact(nested.getText())
|
|
1124
|
-
});
|
|
1142
|
+
pushSpread(site, nested, compact(nested.getText()));
|
|
1125
1143
|
}
|
|
1126
1144
|
continue;
|
|
1127
1145
|
}
|
|
1128
|
-
site.
|
|
1129
|
-
type: "spread",
|
|
1130
|
-
index: site.index++,
|
|
1131
|
-
text: compact(property.getText())
|
|
1132
|
-
});
|
|
1146
|
+
pushSpread(site, expression, compact(property.getText()));
|
|
1133
1147
|
continue;
|
|
1134
1148
|
}
|
|
1135
1149
|
if (!Node.isPropertyAssignment(property)) continue;
|
|
@@ -1161,9 +1175,9 @@ function convertStyleObject(object, kind, label, registry, containers, targets,
|
|
|
1161
1175
|
inventory: site.inventory,
|
|
1162
1176
|
pending: site.pending,
|
|
1163
1177
|
notes: site.notes,
|
|
1164
|
-
legacyLeft: site
|
|
1178
|
+
legacyLeft: legacyLeft(site)
|
|
1165
1179
|
};
|
|
1166
|
-
if (write && !site.flags.some((flag) => flag.code === "emitted-program-mismatch" || flag.code === "emitted-value-invalid")) {
|
|
1180
|
+
if (write && converted(site, report) && !site.flags.some((flag) => flag.code === "emitted-program-mismatch" || flag.code === "emitted-value-invalid")) {
|
|
1167
1181
|
rewriteStyleObject(object, entries);
|
|
1168
1182
|
}
|
|
1169
1183
|
return report;
|
package/dist/convert.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.js","names":[],"sources":["convert.js"],"sourcesContent":["import {\n Node,\n SyntaxKind\n} from \"ts-morph\";\nimport {\n compact,\n literalTree,\n numericValue,\n runtimeType,\n staticLeafValue,\n unwrapExpression\n} from \"./expressions\";\nimport {\n assessFlatConversion,\n convertLegacyConditionProp,\n expandToLonghands,\n flatStringValue,\n mergeProgramValues,\n parseValue,\n printProgram,\n resolveProp,\n sharedPayload,\n shorthands,\n styleProps,\n tokenVariantProps,\n unitSuffix\n} from \"./grammar\";\nimport { isLegacyConditionName, resolveLegacyName } from \"./legacyNames\";\nimport { classifyStructuredNativeValue } from \"./structuredNative\";\nfunction assessmentVerdict(assessments) {\n if (assessments.some((assessment) => assessment.verdict === \"ineligible\")) {\n return \"ineligible\";\n }\n if (assessments.some((assessment) => assessment.verdict === \"needs-relocation\")) {\n return \"needs-relocation\";\n }\n return assessments.length ? \"unknown-host\" : \"clean\";\n}\nfunction createSite(kind, registry, containers, targets, host) {\n return {\n kind,\n registry,\n containers,\n targets,\n host,\n members: [],\n comments: /* @__PURE__ */ new Map(),\n extras: [],\n respelled: [],\n warnings: [],\n flags: [],\n inventory: [],\n pending: [],\n assessments: [],\n notes: [],\n legacy: false,\n index: 0\n };\n}\nfunction assessProgram(site, property, modifiers) {\n const targetProperty = resolveProp(property);\n const assessment = assessFlatConversion(\n {\n property: targetProperty,\n modifiers,\n targets: site.targets,\n host: site.host\n },\n site.registry\n );\n if (assessment.verdict !== \"clean\") addAssessment(site, targetProperty, assessment);\n return assessment.verdict !== \"ineligible\";\n}\nfunction addAssessment(site, property, assessment) {\n if (assessment.verdict === \"clean\") return;\n if (!site.assessments.some(\n (finding) => finding.property === property && finding.verdict === assessment.verdict && JSON.stringify(finding.reasons) === JSON.stringify(assessment.reasons)\n )) {\n site.assessments.push({\n property,\n verdict: assessment.verdict,\n reasons: assessment.reasons\n });\n }\n}\nfunction isConvertedName(name) {\n return name === \"group\" || styleProps.has(name) || tokenVariantProps.has(name) || isLegacyConditionName(name);\n}\nfunction addFlag(list, code, detail) {\n if (!list.some((flag) => flag.code === code && flag.detail === detail)) {\n list.push({ code, detail });\n }\n}\nfunction addNote(site, note) {\n if (!site.notes.includes(note)) site.notes.push(note);\n}\nconst legacyPaletteStepPattern = /(?:^|[^\\w-])\\$?((?:gray|mauve|slate|sage|olive|sand|tomato|red|ruby|crimson|pink|plum|purple|violet|iris|indigo|blue|cyan|teal|jade|green|grass|bronze|gold|brown|orange|amber|yellow|lime|mint|sky)(?:1[0-2]|[1-9]))(?![\\w-])/g;\nconst legacyTrueTokenPattern = /(?:^|[^\\w-])\\$true(?![\\w-])/;\nfunction legacyTokenWarnings(prop, values) {\n const warnings = [];\n if (values.some((value) => legacyTrueTokenPattern.test(value))) {\n warnings.push({\n code: \"legacy-true-token\",\n detail: `${prop} spelled the \\`$true\\` alias, written as \\`4\\` because the default config aliased it there; confirm the app's tokens agree`\n });\n }\n const names = /* @__PURE__ */ new Set();\n for (const value of values) {\n legacyPaletteStepPattern.lastIndex = 0;\n for (const match of value.matchAll(legacyPaletteStepPattern)) names.add(match[1]);\n }\n if (!names.size) return warnings;\n const formatted = [...names].sort().map((name) => `\\`${name}\\``).join(\", \");\n warnings.push({\n code: \"legacy-palette-token\",\n detail: `${prop} preserves ${formatted}, which @tamagui/config/v6 does not define; choose an absolute palette token or an adaptive colorN value`\n });\n return warnings;\n}\nconst empty = {\n payload: null,\n text: null,\n dynamic: false,\n problem: null,\n warnings: [],\n blocked: null,\n inventory: null\n};\nfunction interpolate(prop, text, kind, registry) {\n return `\\${${text}}${kind === \"number\" ? unitSuffix(resolveProp(prop), registry) : \"\"}`;\n}\nfunction classifyStatic(prop, value, registry) {\n const probe = sharedPayload(prop, value, registry);\n const error = probe.errors[0];\n if (error || probe.payload === null) {\n const flag = {\n code: error?.code ?? \"unsupported-legacy-value\",\n detail: `${prop}: ${error?.message ?? `\"${String(value)}\" has no flat spelling`}`\n };\n return { ...empty, problem: flag, blocked: flag };\n }\n return { ...empty, payload: probe.payload };\n}\nfunction reparsesAsBase(value, registry) {\n const parsed = parseValue(value, registry);\n return parsed.ok && parsed.value.clauses.length === 0 && parsed.value.base === value.trim();\n}\nfunction classifyDynamic(prop, expression, registry) {\n const current = unwrapExpression(expression);\n const source = compact(current.getText());\n const structured = classifyStructuredNativeValue(\n resolveProp(prop),\n current,\n source,\n registry\n );\n if (structured) {\n return {\n ...empty,\n payload: structured.payload,\n blocked: structured.blocked\n };\n }\n const tree = literalTree(current, registry);\n if (tree && tree.error) {\n const flag2 = {\n code: tree.error.code,\n detail: `${prop}: ${tree.error.message}`\n };\n return { ...empty, problem: flag2, blocked: flag2 };\n }\n if (tree && tree.kind !== \"nullish\") {\n const rewrittenTokenText = /\\$(?=[\\w-])/.test(source) && tree.text !== source ? tree.text : null;\n return {\n ...empty,\n payload: interpolate(prop, tree.text, tree.kind, registry),\n text: rewrittenTokenText,\n dynamic: true,\n warnings: legacyTokenWarnings(prop, tree.strings)\n };\n }\n if (tree) {\n const flag2 = {\n code: \"empty-style-value\",\n detail: `${prop} value \"${source}\" is always nullish and cannot join a program`\n };\n return { ...empty, blocked: flag2 };\n }\n const runtime = runtimeType(current);\n if (runtime.kind === \"number\") {\n return {\n ...empty,\n payload: interpolate(prop, source, \"number\", registry),\n dynamic: true\n };\n }\n if (runtime.kind === \"string\") {\n const tokens = runtime.literals?.filter((literal) => literal.startsWith(\"$\"));\n if (tokens?.length) {\n const flag2 = {\n code: \"legacy-token-constant\",\n detail: `${prop} value \"${source}\" resolves to legacy token ${tokens.map((token) => `\"${token}\"`).join(\", \")}; migrate the constant it comes from`\n };\n return { ...empty, problem: flag2, blocked: flag2 };\n }\n if (runtime.literals === null) {\n return {\n ...empty,\n payload: interpolate(prop, source, \"string\", registry),\n dynamic: true,\n inventory: {\n code: \"dynamic-string-value\",\n detail: `${prop} value \"${source}\" is an open string; confirm it never holds a legacy \"$token\" spelling`\n }\n };\n }\n return {\n ...empty,\n payload: interpolate(prop, source, \"string\", registry),\n dynamic: true\n };\n }\n const flag = {\n code: \"unprovable-dynamic-value\",\n detail: `${prop} value \"${source}\" has no provable number or string type, so it cannot fold into a program`\n };\n return { ...empty, blocked: flag };\n}\nfunction pushBase(site, prop, text, value, literalString) {\n const index = site.index++;\n if (literalString !== null) {\n for (const warning of legacyTokenWarnings(prop, [literalString])) {\n addFlag(site.warnings, warning.code, warning.detail);\n }\n if (literalString.includes(\"$\")) {\n site.legacy = true;\n const allowed2 = assessProgram(site, prop, []);\n const flat = flatStringValue(literalString, site.registry);\n const problem = flat.text === null ? {\n code: flat.error?.code ?? \"unsupported-legacy-value\",\n detail: `${prop}: ${flat.error?.message ?? `${JSON.stringify(literalString)} has no flat spelling`}`\n } : !reparsesAsBase(flat.text, site.registry) ? {\n code: \"value-reparses-as-program\",\n detail: `${prop} value ${JSON.stringify(flat.text)} does not read back as one flat base value`\n } : null;\n if (problem !== null) addFlag(site.flags, problem.code, problem.detail);\n site.members.push({\n type: \"authored\",\n index,\n prop,\n text,\n payload: allowed2 && problem === null ? flat.text : null,\n dynamic: false,\n blocked: problem,\n token: allowed2,\n activated: false\n });\n return;\n }\n if (!reparsesAsBase(literalString, site.registry)) {\n const flag = {\n code: \"value-reparses-as-program\",\n detail: `${prop} value ${JSON.stringify(literalString)} does not read back as one flat base value`\n };\n addFlag(site.flags, flag.code, flag.detail);\n site.members.push({\n type: \"authored\",\n index,\n prop,\n text,\n payload: null,\n dynamic: false,\n blocked: flag,\n token: false,\n activated: false\n });\n return;\n }\n site.members.push({\n type: \"authored\",\n index,\n prop,\n text,\n payload: literalString,\n dynamic: false,\n blocked: null,\n token: false,\n activated: false\n });\n return;\n }\n const number = value ? numericValue(value) : null;\n if (number !== null) {\n const classified2 = classifyStatic(prop, number, site.registry);\n site.members.push({\n type: \"authored\",\n index,\n prop,\n text,\n payload: classified2.payload,\n dynamic: false,\n blocked: classified2.blocked,\n token: false,\n activated: false\n });\n return;\n }\n const kind = value?.getKind();\n if (value === null || kind === SyntaxKind.TrueKeyword || kind === SyntaxKind.FalseKeyword || kind === SyntaxKind.NullKeyword) {\n site.members.push({\n type: \"authored\",\n index,\n prop,\n text,\n payload: null,\n dynamic: false,\n blocked: {\n code: \"non-css-style-value\",\n detail: `${prop} value \"${compact(text)}\" is not a CSS value and cannot join a program`\n },\n token: false,\n activated: false\n });\n return;\n }\n const classified = classifyDynamic(prop, value, site.registry);\n if (classified.problem) {\n site.legacy = true;\n addFlag(site.flags, classified.problem.code, classified.problem.detail);\n }\n for (const warning of classified.warnings) {\n addFlag(site.warnings, warning.code, warning.detail);\n }\n if (classified.inventory) {\n addFlag(site.inventory, classified.inventory.code, classified.inventory.detail);\n }\n if (classified.text !== null) site.legacy = true;\n const allowed = classified.text === null || assessProgram(site, prop, []);\n site.members.push({\n type: \"authored\",\n index,\n prop,\n text,\n payload: allowed ? classified.payload : null,\n dynamic: classified.dynamic,\n blocked: classified.blocked,\n token: allowed && classified.text !== null,\n activated: false\n });\n}\nconst sentinelMark = \"\u0001\";\nfunction evaluateLegacyObject(object, rootPath) {\n const leaves = [];\n const visit = (current, currentPath) => {\n const value = {};\n for (const property of current.getProperties()) {\n if (Node.isSpreadAssignment(property)) {\n return {\n value: null,\n fatal: `spread \"${compact(property.getText())}\" hides legacy condition entries`\n };\n }\n if (!Node.isPropertyAssignment(property)) {\n return {\n value: null,\n fatal: `property \"${compact(property.getText())}\" is not a static assignment`\n };\n }\n const nameNode = property.getNameNode();\n if (Node.isComputedPropertyName(nameNode)) {\n return {\n value: null,\n fatal: `computed property \"${compact(nameNode.getText())}\" hides the affected style property`\n };\n }\n const name = propertyName(nameNode);\n if (name === null) {\n return {\n value: null,\n fatal: `property name \"${compact(nameNode.getText())}\" is not statically known`\n };\n }\n const path = `${currentPath}.${name}`;\n const initializer = unwrapExpression(property.getInitializerOrThrow());\n if (Node.isObjectLiteralExpression(initializer)) {\n const nested = visit(initializer, path);\n if (nested.fatal) return nested;\n value[name] = nested.value;\n continue;\n }\n const leaf = staticLeafValue(initializer);\n if (leaf) {\n value[name] = leaf.value;\n continue;\n }\n value[name] = `${sentinelMark}${leaves.length}${sentinelMark}`;\n leaves.push({ path, prop: name, expression: initializer });\n }\n return { value, fatal: null };\n };\n const result = visit(object, rootPath);\n return { ...result, leaves };\n}\nfunction conditionProperties(value) {\n const properties = /* @__PURE__ */ new Set();\n const visit = (object) => {\n for (const key in object) {\n const child = object[key];\n if (child !== null && typeof child === \"object\" && isLegacyConditionName(key)) {\n visit(child);\n continue;\n }\n if (!styleProps.has(key)) continue;\n for (const property of expandToLonghands(key, shorthands)) properties.add(property);\n }\n };\n visit(value);\n return properties;\n}\nfunction pushLegacy(site, name, text, initializer, node) {\n const index = site.index++;\n site.legacy = true;\n const keep = (properties2) => {\n site.members.push({\n type: \"legacy\",\n index,\n name,\n text,\n contributions: [],\n properties: properties2,\n failed: true\n });\n };\n if (initializer === null || !Node.isObjectLiteralExpression(initializer)) {\n addFlag(\n site.flags,\n \"dynamic-legacy-condition\",\n `\"${name}\" is not an inline object literal, so its entries are not statically known`\n );\n keep(null);\n return;\n }\n const evaluated = evaluateLegacyObject(initializer, name);\n if (evaluated.fatal || evaluated.value === null) {\n addFlag(site.flags, \"dynamic-legacy-condition\", evaluated.fatal ?? \"unresolved\");\n keep(null);\n return;\n }\n const properties = conditionProperties(evaluated.value);\n const eligibilityStack = [{ object: evaluated.value, path: name }];\n let hasRejectedProperty = false;\n while (eligibilityStack.length > 0) {\n const current = eligibilityStack.pop();\n for (const prop in current.object) {\n const value = current.object[prop];\n const targetProp = resolveProp(prop);\n if (styleProps.has(targetProp) && !isLegacyConditionName(prop)) {\n const assessment = assessFlatConversion(\n {\n property: targetProp,\n targets: site.targets,\n host: site.host\n },\n site.registry\n );\n if (assessment.verdict === \"ineligible\") {\n addAssessment(site, targetProp, assessment);\n hasRejectedProperty = true;\n }\n continue;\n }\n if (value !== null && typeof value === \"object\" && !Array.isArray(value) && isLegacyConditionName(prop)) {\n eligibilityStack.push({\n object: value,\n path: `${current.path}.${prop}`\n });\n }\n }\n }\n if (hasRejectedProperty) {\n keep(properties);\n return;\n }\n const unresolved = site.containers.unresolved.get(node);\n if (unresolved !== void 0) {\n addFlag(site.flags, unresolved.code, unresolved.detail);\n keep(properties);\n return;\n }\n const resolution = resolveLegacyName(name, site.registry);\n if (!resolution.ok) {\n addFlag(site.flags, resolution.code, resolution.message);\n keep(properties);\n return;\n }\n const payloads = /* @__PURE__ */ new Map();\n let failed = false;\n for (let index2 = 0; index2 < evaluated.leaves.length; index2++) {\n const leaf = evaluated.leaves[index2];\n const classified = classifyDynamic(leaf.prop, leaf.expression, site.registry);\n for (const warning of classified.warnings) {\n addFlag(site.warnings, warning.code, `${leaf.path}: ${warning.detail}`);\n }\n if (classified.payload === null) {\n const flag = classified.problem ?? classified.blocked;\n addFlag(\n site.flags,\n flag?.code ?? \"dynamic-condition-value\",\n `${leaf.path}: ${flag?.detail ?? \"the value is not statically known\"}`\n );\n failed = true;\n continue;\n }\n payloads.set(`${sentinelMark}${index2}${sentinelMark}`, classified.payload);\n }\n if (failed) {\n keep(properties);\n return;\n }\n const { canonical, replaceRoot } = resolution.resolved;\n const converted = convertLegacyConditionProp(canonical, evaluated.value, {\n registry: site.registry\n });\n if (converted === null) {\n addFlag(\n site.flags,\n \"unknown-legacy-condition\",\n `\"${name}\" is not a registered legacy condition spelling`\n );\n keep(properties);\n return;\n }\n for (const error of converted.errors) {\n const path = error.path.startsWith(canonical) ? `${name}${error.path.slice(canonical.length)}` : error.path;\n addFlag(site.flags, error.code, `${path}: ${error.message}`);\n failed = true;\n }\n const contributions = [];\n for (const contribution of converted.contributions) {\n if (!styleProps.has(contribution.prop)) {\n addFlag(\n site.flags,\n \"non-style-condition-entry\",\n `${name}.${contribution.prop} is not a style property, so a flat value cannot carry it`\n );\n failed = true;\n continue;\n }\n const modifiers = replaceRoot ? [...replaceRoot, ...contribution.clause.modifiers.slice(1)] : contribution.clause.modifiers;\n const dynamicPayload = payloads.get(contribution.clause.payload);\n contributions.push({\n prop: contribution.prop,\n clause: {\n modifiers,\n payload: dynamicPayload ?? contribution.clause.payload\n },\n dynamic: dynamicPayload !== void 0\n });\n if (!assessProgram(site, contribution.prop, modifiers)) failed = true;\n }\n if (failed) {\n keep(properties);\n return;\n }\n site.members.push({\n type: \"legacy\",\n index,\n name,\n text,\n contributions,\n properties,\n failed: false\n });\n}\nfunction activationName(prop) {\n return resolveProp(prop);\n}\nconst noProperties = /* @__PURE__ */ new Set();\nconst legacyStatePriorities = Object.freeze({\n hover: 2,\n press: 3,\n active: 3,\n focus: 4,\n \"focus-visible\": 4,\n \"focus-within\": 4,\n enter: 4,\n disabled: 5,\n exit: 5\n});\nfunction legacyStatePriority(modifiers) {\n let priority = null;\n for (const modifier of modifiers) {\n const candidate = legacyStatePriorities[modifier];\n if (candidate !== void 0 && (priority === null || candidate > priority)) {\n priority = candidate;\n }\n }\n return priority;\n}\nfunction orderedEntries(site) {\n const ordered = [];\n for (const member of site.members) {\n if (member.type === \"authored\") {\n if (!member.activated || member.payload === null) continue;\n ordered.push({\n prop: member.prop,\n value: { base: member.payload, clauses: [] },\n dynamic: member.dynamic,\n index: member.index,\n base: true,\n from: null,\n legacyStatePriority: null\n });\n continue;\n }\n if (member.type !== \"legacy\" || member.failed) continue;\n for (const contribution of member.contributions) {\n ordered.push({\n prop: contribution.prop,\n value: { base: null, clauses: [contribution.clause] },\n dynamic: contribution.dynamic,\n index: member.index,\n base: false,\n from: member,\n legacyStatePriority: legacyStatePriority(contribution.clause.modifiers)\n });\n }\n }\n const ranked = ordered.filter((entry) => entry.legacyStatePriority !== null).sort(\n (left, right) => left.legacyStatePriority - right.legacyStatePriority || left.index - right.index\n );\n if (ranked.length < 2) return ordered;\n let rankedIndex = 0;\n return ordered.map(\n (entry) => entry.legacyStatePriority === null ? entry : ranked[rankedIndex++]\n );\n}\nfunction buildSlots(ordered) {\n const slots = /* @__PURE__ */ new Map();\n for (const entry of ordered) {\n for (const property of expandToLonghands(entry.prop, shorthands)) {\n const previous = slots.get(property);\n const value = previous ? mergeProgramValues(previous.value, entry.value) : entry.value;\n slots.delete(property);\n slots.set(property, {\n property,\n sourceProp: entry.prop,\n value,\n anchor: previous ? Math.min(previous.anchor, entry.index) : entry.index,\n last: previous ? Math.max(previous.last, entry.index) : entry.index,\n dynamic: (previous?.dynamic ?? false) || entry.dynamic\n });\n }\n }\n return slots;\n}\nfunction barriers(site) {\n const list = [];\n for (const member of site.members) {\n if (member.type === \"spread\") {\n list.push({ index: member.index, source: member.text, bases: null, clauses: null });\n continue;\n }\n if (member.type === \"authored\" && !member.activated) {\n list.push({\n index: member.index,\n source: member.text,\n bases: new Set(expandToLonghands(member.prop, shorthands)),\n clauses: noProperties\n });\n continue;\n }\n if (member.type === \"legacy\" && member.failed) {\n list.push({\n index: member.index,\n source: member.name,\n bases: noProperties,\n clauses: member.properties\n });\n }\n }\n return list;\n}\nfunction resolveBarriers(site, ordered, slots) {\n let changed = false;\n for (const slot of slots.values()) {\n const contributions = ordered.filter(\n (entry) => expandToLonghands(entry.prop, shorthands).includes(slot.property)\n );\n for (const barrier of barriers(site)) {\n if (barrier.index <= slot.anchor || barrier.index >= slot.last) continue;\n if (barrier.clauses === null || barrier.clauses.has(slot.property)) {\n for (const entry of contributions) {\n if (entry.base || entry.index < barrier.index || !entry.from) continue;\n addFlag(\n site.flags,\n \"condition-order-not-preservable\",\n `\"${compact(barrier.source)}\" can set \"${slot.property}\" between the values contributing to it, so \"${entry.from.name}\" stays authored instead of merging`\n );\n entry.from.failed = true;\n changed = true;\n }\n }\n if (barrier.bases === null || barrier.bases.has(slot.property)) {\n for (const entry of contributions) {\n if (!entry.base || entry.index < barrier.index) continue;\n const authored = site.members.find(\n (member) => member.type === \"authored\" && member.index === entry.index && member.activated\n );\n if (authored && authored.type === \"authored\") {\n authored.payload = null;\n authored.blocked = {\n code: \"base-order-not-preservable\",\n detail: `\"${compact(barrier.source)}\" can set \"${slot.property}\" between the values contributing to it, so this base cannot move`\n };\n changed = true;\n continue;\n }\n addFlag(\n site.flags,\n \"base-order-not-preservable\",\n `\"${compact(barrier.source)}\" can set \"${slot.property}\" between the values contributing to it, so the merged base may win where it did not before`\n );\n }\n }\n }\n }\n return changed;\n}\nfunction assemble(site) {\n let slots = /* @__PURE__ */ new Map();\n for (; ; ) {\n let changed = false;\n const contributed = /* @__PURE__ */ new Set();\n for (const member of site.members) {\n if (member.type !== \"legacy\" || member.failed) continue;\n for (const contribution of member.contributions) {\n contributed.add(activationName(contribution.prop));\n }\n }\n for (const member of site.members) {\n if (member.type !== \"authored\") continue;\n const name = activationName(member.prop);\n member.activated = member.token && member.payload !== null || contributed.has(name);\n if (!member.activated || member.payload !== null) continue;\n const blocked = member.blocked;\n addFlag(\n site.flags,\n blocked?.code ?? \"unprovable-dynamic-value\",\n `a legacy condition targets \"${member.prop}\": ${blocked?.detail ?? `its base value \"${compact(member.text)}\" cannot join a program`}`\n );\n member.activated = false;\n for (const other of site.members) {\n if (other.type !== \"legacy\" || other.failed) continue;\n if (other.contributions.some((one) => activationName(one.prop) === name)) {\n other.failed = true;\n changed = true;\n }\n }\n }\n if (changed) continue;\n const ordered = orderedEntries(site);\n slots = buildSlots(ordered);\n if (!resolveBarriers(site, ordered, slots)) break;\n }\n const entries = [];\n for (const member of site.members) {\n if (member.type === \"authored\" && member.activated) continue;\n if (member.type === \"legacy\" && !member.failed) continue;\n entries.push({ index: member.index, text: member.text });\n }\n const printed = printSlots(site, slots);\n entries.push(...printed.output);\n entries.push(...site.extras);\n entries.sort((left, right) => left.index - right.index);\n return { entries, programs: printed.programs };\n}\nfunction printSlots(site, slots) {\n const printed = /* @__PURE__ */ new Set();\n const output = [];\n const programs = [];\n const outputCommentRanges = [];\n for (const [property, slot] of slots) {\n if (printed.has(property)) continue;\n const serialized = printProgram(slot.value);\n const expansion = expandToLonghands(slot.sourceProp, shorthands);\n const collapses = expansion.length > 0 && expansion.every((expanded) => {\n const candidate = slots.get(expanded);\n return candidate !== void 0 && candidate.sourceProp === slot.sourceProp && candidate.anchor === slot.anchor && candidate.dynamic === slot.dynamic && printProgram(candidate.value) === serialized;\n });\n const name = collapses ? slot.sourceProp : property;\n if (collapses) for (const expanded of expansion) printed.add(expanded);\n else printed.add(property);\n const value = slot.dynamic ? `\\`${serialized}\\`` : JSON.stringify(serialized);\n programs.push({ name, value: serialized, dynamic: slot.dynamic });\n const propertyText = site.kind === \"styled\" ? `${name}: ${value}` : `${name}=${slot.dynamic ? `{${value}}` : value}`;\n output.push({\n index: slot.anchor,\n text: propertyText\n });\n outputCommentRanges.push({\n outputIndex: output.length - 1,\n first: slot.anchor,\n last: slot.last\n });\n }\n verify(\n site,\n slots,\n [...output].sort((left, right) => left.index - right.index)\n );\n if (site.kind === \"styled\") {\n const commentedIndexes = /* @__PURE__ */ new Set();\n for (const range of outputCommentRanges) {\n const comments = [];\n for (const [index, texts] of site.comments) {\n if (index < range.first || index > range.last || commentedIndexes.has(index)) {\n continue;\n }\n comments.push(...texts);\n commentedIndexes.add(index);\n }\n if (comments.length) {\n output[range.outputIndex].text = `${comments.join(\"\\n\")}\n${output[range.outputIndex].text}`;\n }\n }\n }\n return { output, programs };\n}\nfunction sanitize(text) {\n let result = \"\";\n for (let index = 0; index < text.length; index++) {\n if (text[index] !== \"$\" || text[index + 1] !== \"{\") {\n result += text[index];\n continue;\n }\n let depth = 0;\n let end = index + 1;\n for (; end < text.length; end++) {\n if (text[end] === \"{\") depth++;\n else if (text[end] === \"}\" && --depth === 0) break;\n }\n result += \"zz\";\n index = end;\n }\n return result;\n}\nfunction verify(site, slots, output) {\n const separator = site.kind === \"styled\" ? \": \" : \"=\";\n const reparsed = /* @__PURE__ */ new Map();\n for (const entry of output) {\n const split = entry.text.indexOf(separator);\n const prop = entry.text.slice(0, split);\n let raw = entry.text.slice(split + separator.length);\n if (raw.startsWith(\"{\")) raw = raw.slice(1, -1);\n const text = sanitize(raw.slice(1, -1));\n const parsed = parseValue(text, site.registry);\n if (!parsed.ok) {\n addFlag(\n site.flags,\n \"emitted-value-invalid\",\n `\"${prop}=${text}\" does not parse: ${parsed.errors.map((error) => error.message).join(\"; \")}`\n );\n return;\n }\n for (const property of expandToLonghands(prop, shorthands)) {\n const previous = reparsed.get(property);\n reparsed.set(\n property,\n previous ? mergeProgramValues(previous, parsed.value) : parsed.value\n );\n }\n }\n for (const [property, slot] of slots) {\n const actual = reparsed.get(property);\n const expected = sanitize(printProgram(slot.value));\n if (actual === void 0 || sanitize(printProgram(actual)) !== expected) {\n addFlag(\n site.flags,\n \"emitted-program-mismatch\",\n `\"${property}\" reads back as \"${actual ? sanitize(printProgram(actual)) : \"(missing)\"}\" instead of \"${expected}\"`\n );\n }\n }\n}\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 jsxAttributeName(attribute) {\n const name = attribute.getNameNode();\n return Node.isIdentifier(name) ? name.getText() : null;\n}\nfunction jsxLiteralString(attribute) {\n const initializer = attribute.getInitializer();\n if (Node.isStringLiteral(initializer)) return initializer.getLiteralValue();\n const expression = jsxExpression(attribute);\n if (expression && (Node.isStringLiteral(expression) || Node.isNoSubstitutionTemplateLiteral(expression))) {\n return expression.getLiteralValue();\n }\n return null;\n}\nfunction jsxExpression(attribute) {\n const initializer = attribute.getInitializer();\n if (!Node.isJsxExpression(initializer)) return null;\n const expression = initializer.getExpression();\n return expression ? unwrapExpression(expression) : null;\n}\nfunction isConvertedJsxAttribute(attribute) {\n if (Node.isJsxSpreadAttribute(attribute)) return true;\n if (!Node.isJsxAttribute(attribute)) return false;\n const name = jsxAttributeName(attribute);\n return !!name && isConvertedName(name);\n}\nfunction rewriteJsxSite(opening, entries) {\n const attributes = opening.getAttributes();\n const rendered = [];\n let inserted = false;\n for (const attribute of attributes) {\n if (isConvertedJsxAttribute(attribute)) {\n if (!inserted) {\n rendered.push(...entries.map((entry) => entry.text));\n inserted = true;\n }\n } else {\n rendered.push(attribute.getText());\n }\n }\n const source = opening.getText();\n const start = opening.getStart();\n const first = attributes[0];\n const last = attributes[attributes.length - 1];\n const prefix = source.slice(0, first.getStart() - start);\n const suffix = source.slice(last.getEnd() - start);\n const authoredMultiline = prefix.includes(\"\\n\") || source.slice(first.getStart() - start, last.getEnd() - start).includes(\"\\n\");\n opening.replaceWithText(\n authoredMultiline ? `${prefix.replace(/[ \\t]+$/, \"\")}${rendered.map((text) => ` ${text}`).join(\"\\n\")}${suffix.replace(/\\n[ \\t]+/, \"\\n\")}` : `${prefix}${rendered.join(\" \")}${suffix}`\n );\n}\nfunction containerExtras(site, declaration, index) {\n const target = site.containers.targets.get(declaration);\n if (target === void 0) return;\n const name = target.named && target.group !== \"\" ? target.group : null;\n const text = site.kind === \"styled\" ? name === null ? \"container: true\" : `container: ${JSON.stringify(name)}` : name === null ? \"container\" : `container=${JSON.stringify(name)}`;\n site.legacy = true;\n site.extras.push({ index, text });\n if (target.flag !== null) addFlag(site.flags, target.flag.code, target.flag.detail);\n addNote(\n site,\n `a descendant uses a legacy container-size condition on this group, so it declares a query container`\n );\n}\nfunction convertJsxSite(opening, registry, containers, targets, host, write = false) {\n const site = createSite(\"jsx\", registry, containers, targets, host);\n const before = [];\n for (const attribute of opening.getAttributes()) {\n if (Node.isJsxSpreadAttribute(attribute)) {\n const expression = unwrapExpression(attribute.getExpression());\n if (Node.isObjectLiteralExpression(expression)) {\n before.push(compact(attribute.getText()));\n for (const property of expression.getProperties()) {\n if (Node.isPropertyAssignment(property)) {\n const name2 = propertyName(property.getNameNode());\n if (name2 !== null) {\n if (isConvertedName(name2)) {\n pushStyledProperty(\n site,\n name2,\n property,\n `${name2}={${property.getInitializerOrThrow().getText()}}`\n );\n } else {\n site.members.push({\n type: \"passthrough\",\n index: site.index++,\n text: `${name2}={${property.getInitializerOrThrow().getText()}}`\n });\n }\n continue;\n }\n }\n site.members.push({\n type: \"spread\",\n index: site.index++,\n text: Node.isSpreadAssignment(property) ? `{${property.getText()}}` : `{...{ ${property.getText()} }}`\n });\n }\n continue;\n }\n before.push(compact(attribute.getText()));\n site.members.push({\n type: \"spread\",\n index: site.index++,\n text: attribute.getText()\n });\n continue;\n }\n const name = jsxAttributeName(attribute);\n if (!name) continue;\n const text = compact(attribute.getText());\n if (name === \"group\") {\n before.push(text);\n containerExtras(site, attribute, site.index);\n site.members.push({ type: \"passthrough\", index: site.index++, text });\n continue;\n }\n if (isLegacyConditionName(name)) {\n before.push(text);\n pushLegacy(site, name, text, jsxExpression(attribute), attribute);\n continue;\n }\n if (tokenVariantProps.has(name)) {\n if (pushTokenVariant(site, name, attribute, text)) before.push(text);\n continue;\n }\n if (!styleProps.has(name)) continue;\n before.push(text);\n const literal = jsxLiteralString(attribute);\n pushBase(\n site,\n name,\n text,\n literal === null ? jsxExpression(attribute) : null,\n literal\n );\n }\n if (!site.legacy) return null;\n const { entries, programs } = assemble(site);\n const sourceFile = opening.getSourceFile();\n const report = {\n kind: \"jsx\",\n label: `<${opening.getTagNameNode().getText()}>`,\n line: sourceFile.getLineAndColumnAtPos(opening.getStart()).line,\n before: before.join(\" \"),\n after: entries.map((entry) => entry.text).join(\" \") || \"(no style props left)\",\n programs: [...programs, ...site.respelled],\n assessments: site.assessments,\n assessmentVerdict: assessmentVerdict(site.assessments),\n warnings: site.warnings,\n flags: site.flags,\n inventory: site.inventory,\n pending: site.pending,\n notes: site.notes,\n legacyLeft: site.members.filter((member) => member.type === \"legacy\" && member.failed).length\n };\n if (write && !site.flags.some(\n (flag) => flag.code === \"emitted-program-mismatch\" || flag.code === \"emitted-value-invalid\"\n )) {\n rewriteJsxSite(opening, entries);\n }\n return report;\n}\nfunction pushStyledProperty(site, name, property, authoredText) {\n const comments = allCommentTexts(property);\n if (comments.length) site.comments.set(site.index, comments);\n const text = authoredText ?? textWithOuterComments(property);\n const initializer = unwrapExpression(property.getInitializerOrThrow());\n if (name === \"group\") {\n containerExtras(site, property, site.index);\n site.members.push({ type: \"passthrough\", index: site.index++, text });\n return;\n }\n if (isLegacyConditionName(name)) {\n pushLegacy(site, name, text, initializer, property);\n return;\n }\n if (tokenVariantProps.has(name)) {\n pushTokenVariant(site, name, property, text);\n return;\n }\n if (!styleProps.has(name)) return;\n const literal = Node.isStringLiteral(initializer) || Node.isNoSubstitutionTemplateLiteral(initializer) ? initializer.getLiteralValue() : null;\n pushBase(site, name, text, literal === null ? initializer : null, literal);\n}\nfunction pushTokenVariant(site, name, node, text) {\n const index = site.index++;\n const initializer = node.getInitializer();\n const value = initializer !== void 0 && Node.isJsxExpression(initializer) ? initializer.getExpression() : initializer;\n const literals = value === void 0 ? [] : [value, ...value.getDescendants()].filter(\n (candidate) => (Node.isStringLiteral(candidate) || Node.isNoSubstitutionTemplateLiteral(candidate)) && candidate.getLiteralValue().startsWith(\"$\")\n );\n if (value === void 0 || literals.length === 0) {\n site.members.push({ type: \"passthrough\", index, text });\n return false;\n }\n const source = value.getText();\n const start = value.getStart();\n let rewritten = \"\";\n let cursor = start;\n for (const literal of literals) {\n let replacement = \"true\";\n if (literal.getLiteralValue() !== \"$true\") {\n const flat = flatStringValue(literal.getLiteralValue(), site.registry);\n if (flat.text === null) {\n site.legacy = true;\n addFlag(\n site.flags,\n flat.error?.code ?? \"unsupported-legacy-value\",\n `${name}: ${flat.error?.message ?? `${literal.getText()} has no flat spelling`}`\n );\n site.members.push({ type: \"passthrough\", index, text });\n return true;\n }\n const quote = literal.getText()[0];\n replacement = `${quote}${flat.text}${quote}`;\n }\n rewritten += source.slice(cursor - start, literal.getStart() - start);\n rewritten += replacement;\n cursor = literal.getEnd();\n }\n rewritten += source.slice(cursor - start);\n site.legacy = true;\n const output = Node.isJsxAttribute(node) ? Node.isStringLiteral(initializer) ? rewritten === \"true\" ? name : `${name}=${rewritten}` : `${name}={${rewritten}}` : site.kind === \"jsx\" ? `${name}={${rewritten}}` : textWithOuterComments(node, `${node.getNameNode().getText()}: ${rewritten}`);\n site.members.push({ type: \"passthrough\", index, text: output });\n site.respelled.push({\n name,\n value: rewritten,\n dynamic: literals.length !== 1 || literals[0] !== value\n });\n return true;\n}\nfunction convertStyleObject(object, kind, label, registry, containers, targets, host, write = false) {\n const site = createSite(kind, registry, containers, targets, host);\n const before = [];\n for (const property of object.getProperties()) {\n if (Node.isSpreadAssignment(property)) {\n const expression = unwrapExpression(property.getExpression());\n before.push(compact(property.getText()));\n if (Node.isObjectLiteralExpression(expression)) {\n for (const nested of expression.getProperties()) {\n if (Node.isPropertyAssignment(nested)) {\n const name2 = propertyName(nested.getNameNode());\n if (name2 !== null) {\n if (isConvertedName(name2)) {\n pushStyledProperty(site, name2, nested);\n } else {\n site.members.push({\n type: \"passthrough\",\n index: site.index++,\n text: compact(nested.getText())\n });\n }\n continue;\n }\n }\n site.members.push({\n type: \"spread\",\n index: site.index++,\n text: compact(nested.getText())\n });\n }\n continue;\n }\n site.members.push({\n type: \"spread\",\n index: site.index++,\n text: compact(property.getText())\n });\n continue;\n }\n if (!Node.isPropertyAssignment(property)) continue;\n const nameNode = property.getNameNode();\n if (Node.isComputedPropertyName(nameNode)) {\n addFlag(\n site.flags,\n \"computed-property\",\n `\"${compact(nameNode.getText())}\" hides the affected style property`\n );\n continue;\n }\n const name = propertyName(nameNode);\n if (name === null) continue;\n if (!isConvertedName(name)) continue;\n before.push(compact(property.getText()));\n pushStyledProperty(site, name, property);\n }\n if (!site.legacy) return null;\n const { entries, programs } = assemble(site);\n const sourceFile = object.getSourceFile();\n const report = {\n kind,\n label,\n line: sourceFile.getLineAndColumnAtPos(object.getStart()).line,\n before: before.join(\", \"),\n after: entries.map((entry) => entry.text).join(\", \") || \"(no style props left)\",\n programs: [...programs, ...site.respelled],\n assessments: site.assessments,\n assessmentVerdict: assessmentVerdict(site.assessments),\n warnings: site.warnings,\n flags: site.flags,\n inventory: site.inventory,\n pending: site.pending,\n notes: site.notes,\n legacyLeft: site.members.filter((member) => member.type === \"legacy\" && member.failed).length\n };\n if (write && !site.flags.some(\n (flag) => flag.code === \"emitted-program-mismatch\" || flag.code === \"emitted-value-invalid\"\n )) {\n rewriteStyleObject(object, entries);\n }\n return report;\n}\nfunction isConvertedStyledProperty(property) {\n if (Node.isSpreadAssignment(property)) return true;\n if (!Node.isPropertyAssignment(property)) return false;\n const nameNode = property.getNameNode();\n if (Node.isComputedPropertyName(nameNode)) return false;\n const name = propertyName(nameNode);\n return !!name && isConvertedName(name);\n}\nfunction allCommentTexts(node) {\n const comments = /* @__PURE__ */ new Map();\n for (const current of [node, ...node.getDescendants()]) {\n for (const range of [\n ...current.getLeadingCommentRanges(),\n ...current.getTrailingCommentRanges()\n ]) {\n comments.set(range.getPos(), range.getText());\n }\n }\n return [...comments.entries()].sort((left, right) => left[0] - right[0]).map((entry) => entry[1]);\n}\nfunction textWithOuterComments(node, text = node.getText()) {\n const comments = /* @__PURE__ */ new Map();\n for (const range of [\n ...node.getLeadingCommentRanges(),\n ...node.getTrailingCommentRanges()\n ]) {\n comments.set(range.getPos(), range.getText());\n }\n const prefix = [...comments.entries()].sort((left, right) => left[0] - right[0]).map((entry) => entry[1]);\n return [...prefix, text].join(\"\\n \");\n}\nfunction rewriteStyleObject(object, entries) {\n const rendered = [];\n let inserted = false;\n for (const property of object.getProperties()) {\n if (isConvertedStyledProperty(property)) {\n if (!inserted) {\n rendered.push(...entries.map((entry) => entry.text));\n inserted = true;\n }\n } else {\n rendered.push(textWithOuterComments(property));\n }\n }\n if (rendered.length === 0) {\n object.replaceWithText(\"{}\");\n return;\n }\n object.replaceWithText(`{\n${rendered.map((text) => ` ${text}`).join(\",\\n\")}\n}`);\n}\nexport {\n convertJsxSite,\n convertStyleObject,\n sanitize\n};\n//# sourceMappingURL=convert.js.map\n"],"mappings":";;;;;;;AA6BA,SAAS,kBAAkB,aAAa;CACtC,IAAI,YAAY,MAAM,eAAe,WAAW,YAAY,YAAY,GAAG;EACzE,OAAO;CACT;CACA,IAAI,YAAY,MAAM,eAAe,WAAW,YAAY,kBAAkB,GAAG;EAC/E,OAAO;CACT;CACA,OAAO,YAAY,SAAS,iBAAiB;AAC/C;AACA,SAAS,WAAW,MAAM,UAAU,YAAY,SAAS,MAAM;CAC7D,OAAO;EACL;EACA;EACA;EACA;EACA;EACA,SAAS,CAAC;EACV,0BAA0B,IAAI,IAAI;EAClC,QAAQ,CAAC;EACT,WAAW,CAAC;EACZ,UAAU,CAAC;EACX,OAAO,CAAC;EACR,WAAW,CAAC;EACZ,SAAS,CAAC;EACV,aAAa,CAAC;EACd,OAAO,CAAC;EACR,QAAQ;EACR,OAAO;CACT;AACF;AACA,SAAS,cAAc,MAAM,UAAU,WAAW;CAChD,MAAM,iBAAiB,YAAY,QAAQ;CAC3C,MAAM,aAAa,qBACjB;EACE,UAAU;EACV;EACA,SAAS,KAAK;EACd,MAAM,KAAK;CACb,GACA,KAAK,QACP;CACA,IAAI,WAAW,YAAY,SAAS,cAAc,MAAM,gBAAgB,UAAU;CAClF,OAAO,WAAW,YAAY;AAChC;AACA,SAAS,cAAc,MAAM,UAAU,YAAY;CACjD,IAAI,WAAW,YAAY,SAAS;CACpC,IAAI,CAAC,KAAK,YAAY,MACnB,YAAY,QAAQ,aAAa,YAAY,QAAQ,YAAY,WAAW,WAAW,KAAK,UAAU,QAAQ,OAAO,MAAM,KAAK,UAAU,WAAW,OAAO,CAC/J,GAAG;EACD,KAAK,YAAY,KAAK;GACpB;GACA,SAAS,WAAW;GACpB,SAAS,WAAW;EACtB,CAAC;CACH;AACF;AACA,SAAS,gBAAgB,M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G,KAAK,yBAAyB,CACnC,GAAG;EACD,SAAS,IAAI,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC;CAC9C;CACA,MAAM,SAAS,CAAC,GAAG,SAAS,QAAQ,CAAC,CAAC,CAAC,MAAM,MAAM,UAAU,KAAK,KAAK,MAAM,EAAE,CAAC,CAAC,KAAK,UAAU,MAAM,EAAE;CACxG,OAAO,CAAC,GAAG,QAAQ,IAAI,CAAC,CAAC,KAAK,MAAM;AACtC;AACA,SAAS,mBAAmB,QAAQ,SAAS;CAC3C,MAAM,WAAW,CAAC;CAClB,IAAI,WAAW;CACf,KAAK,MAAM,YAAY,OAAO,cAAc,GAAG;EAC7C,IAAI,0BAA0B,QAAQ,GAAG;GACvC,IAAI,CAAC,UAAU;IACb,SAAS,KAAK,GAAG,QAAQ,KAAK,UAAU,MAAM,IAAI,CAAC;IACnD,WAAW;GACb;EACF,OAAO;GACL,SAAS,KAAK,sBAAsB,QAAQ,CAAC;EAC/C;CACF;CACA,IAAI,SAAS,WAAW,GAAG;EACzB,OAAO,gBAAgB,IAAI;EAC3B;CACF;CACA,OAAO,gBAAgB;EACvB,SAAS,KAAK,SAAS,KAAK,MAAM,CAAC,CAAC,KAAK,KAAK,EAAE;EAChD;AACF"}
|
|
1
|
+
{"version":3,"file":"convert.js","names":[],"sources":["convert.js"],"sourcesContent":["import {\n Node,\n SyntaxKind\n} from \"ts-morph\";\nimport {\n compact,\n literalTree,\n numericValue,\n runtimeType,\n staticLeafValue,\n unwrapExpression\n} from \"./expressions\";\nimport {\n assessFlatConversion,\n convertLegacyConditionProp,\n expandToLonghands,\n flatStringValue,\n mergeProgramValues,\n parseValue,\n printProgram,\n resolveProp,\n sharedPayload,\n shorthands,\n styleProps,\n tokenVariantProps,\n unitSuffix\n} from \"./grammar\";\nimport { isLegacyConditionName, resolveLegacyName } from \"./legacyNames\";\nimport { classifyStructuredNativeValue } from \"./structuredNative\";\nfunction assessmentVerdict(assessments) {\n if (assessments.some((assessment) => assessment.verdict === \"ineligible\")) {\n return \"ineligible\";\n }\n if (assessments.some((assessment) => assessment.verdict === \"needs-relocation\")) {\n return \"needs-relocation\";\n }\n return assessments.length ? \"unknown-host\" : \"clean\";\n}\nfunction createSite(kind, registry, containers, targets, host) {\n return {\n kind,\n registry,\n containers,\n targets,\n host,\n members: [],\n comments: /* @__PURE__ */ new Map(),\n extras: [],\n respelled: [],\n warnings: [],\n flags: [],\n inventory: [],\n pending: [],\n assessments: [],\n notes: [],\n legacy: false,\n index: 0\n };\n}\nfunction assessProgram(site, property, modifiers) {\n const targetProperty = resolveProp(property);\n const assessment = assessFlatConversion(\n {\n property: targetProperty,\n modifiers,\n targets: site.targets,\n host: site.host\n },\n site.registry\n );\n if (assessment.verdict !== \"clean\") addAssessment(site, targetProperty, assessment);\n return assessment.verdict !== \"ineligible\";\n}\nfunction addAssessment(site, property, assessment) {\n if (assessment.verdict === \"clean\") return;\n if (!site.assessments.some(\n (finding) => finding.property === property && finding.verdict === assessment.verdict && JSON.stringify(finding.reasons) === JSON.stringify(assessment.reasons)\n )) {\n site.assessments.push({\n property,\n verdict: assessment.verdict,\n reasons: assessment.reasons\n });\n }\n}\nfunction legacyKeysInSpread(expression) {\n const names = /* @__PURE__ */ new Set();\n for (const object of expression.getDescendantsOfKind(\n SyntaxKind.ObjectLiteralExpression\n )) {\n for (const property of object.getProperties()) {\n if (!Node.isPropertyAssignment(property)) continue;\n const name = propertyName(property.getNameNode());\n if (name !== null && isLegacyConditionName(name)) names.add(name);\n }\n }\n return [...names];\n}\nfunction pushSpread(site, expression, text) {\n const keys = legacyKeysInSpread(expression);\n if (keys.length) {\n site.legacy = true;\n addFlag(\n site.flags,\n \"legacy-condition-in-spread\",\n `\"${compact(text)}\" is not an inline object literal, so its ${keys.map((key) => `\"${key}\"`).join(\", \")} ${keys.length === 1 ? \"entry stays\" : \"entries stay\"} authored`\n );\n }\n site.members.push({\n type: \"spread\",\n index: site.index++,\n text,\n legacy: keys.length > 0\n });\n}\nfunction converted(site, report) {\n return report.programs.length > 0 || site.extras.length > 0 || site.members.some(\n (member) => member.type === \"authored\" && member.activated || member.type === \"legacy\" && !member.failed\n );\n}\nfunction legacyLeft(site) {\n return site.members.filter(\n (member) => member.type === \"legacy\" && member.failed || member.type === \"spread\" && member.legacy\n ).length;\n}\nfunction isConvertedName(name) {\n return name === \"group\" || styleProps.has(name) || tokenVariantProps.has(name) || isLegacyConditionName(name);\n}\nfunction addFlag(list, code, detail) {\n if (!list.some((flag) => flag.code === code && flag.detail === detail)) {\n list.push({ code, detail });\n }\n}\nfunction addNote(site, note) {\n if (!site.notes.includes(note)) site.notes.push(note);\n}\nconst legacyPaletteStepPattern = /(?:^|[^\\w-])\\$?((?:gray|mauve|slate|sage|olive|sand|tomato|red|ruby|crimson|pink|plum|purple|violet|iris|indigo|blue|cyan|teal|jade|green|grass|bronze|gold|brown|orange|amber|yellow|lime|mint|sky)(?:1[0-2]|[1-9]))(?![\\w-])/g;\nconst legacyTrueTokenPattern = /(?:^|[^\\w-])\\$true(?![\\w-])/;\nfunction legacyTokenWarnings(prop, values) {\n const warnings = [];\n if (values.some((value) => legacyTrueTokenPattern.test(value))) {\n warnings.push({\n code: \"legacy-true-token\",\n detail: `${prop} spelled the \\`$true\\` alias, written as \\`4\\` because the default config aliased it there; confirm the app's tokens agree`\n });\n }\n const names = /* @__PURE__ */ new Set();\n for (const value of values) {\n legacyPaletteStepPattern.lastIndex = 0;\n for (const match of value.matchAll(legacyPaletteStepPattern)) names.add(match[1]);\n }\n if (!names.size) return warnings;\n const formatted = [...names].sort().map((name) => `\\`${name}\\``).join(\", \");\n warnings.push({\n code: \"legacy-palette-token\",\n detail: `${prop} preserves ${formatted}, which @tamagui/config/v6 does not define; choose an absolute palette token or an adaptive colorN value`\n });\n return warnings;\n}\nconst empty = {\n payload: null,\n text: null,\n dynamic: false,\n problem: null,\n warnings: [],\n blocked: null,\n inventory: null\n};\nfunction interpolate(prop, text, kind, registry) {\n return `\\${${text}}${kind === \"number\" ? unitSuffix(resolveProp(prop), registry) : \"\"}`;\n}\nfunction classifyStatic(prop, value, registry) {\n const probe = sharedPayload(prop, value, registry);\n const error = probe.errors[0];\n if (error || probe.payload === null) {\n const flag = {\n code: error?.code ?? \"unsupported-legacy-value\",\n detail: `${prop}: ${error?.message ?? `\"${String(value)}\" has no flat spelling`}`\n };\n return { ...empty, problem: flag, blocked: flag };\n }\n return { ...empty, payload: probe.payload };\n}\nfunction reparsesAsBase(value, registry) {\n const parsed = parseValue(value, registry);\n return parsed.ok && parsed.value.clauses.length === 0 && parsed.value.base === value.trim();\n}\nfunction classifyDynamic(prop, expression, registry) {\n const current = unwrapExpression(expression);\n const source = compact(current.getText());\n const structured = classifyStructuredNativeValue(\n resolveProp(prop),\n current,\n source,\n registry\n );\n if (structured) {\n return {\n ...empty,\n payload: structured.payload,\n blocked: structured.blocked\n };\n }\n const tree = literalTree(current, registry);\n if (tree && tree.error) {\n const flag2 = {\n code: tree.error.code,\n detail: `${prop}: ${tree.error.message}`\n };\n return { ...empty, problem: flag2, blocked: flag2 };\n }\n if (tree && tree.kind !== \"nullish\") {\n const rewrittenTokenText = /\\$(?=[\\w-])/.test(source) && tree.text !== source ? tree.text : null;\n return {\n ...empty,\n payload: interpolate(prop, tree.text, tree.kind, registry),\n text: rewrittenTokenText,\n dynamic: true,\n warnings: legacyTokenWarnings(prop, tree.strings)\n };\n }\n if (tree) {\n const flag2 = {\n code: \"empty-style-value\",\n detail: `${prop} value \"${source}\" is always nullish and cannot join a program`\n };\n return { ...empty, blocked: flag2 };\n }\n const runtime = runtimeType(current);\n if (runtime.kind === \"number\") {\n return {\n ...empty,\n payload: interpolate(prop, source, \"number\", registry),\n dynamic: true\n };\n }\n if (runtime.kind === \"string\") {\n const tokens = runtime.literals?.filter((literal) => literal.startsWith(\"$\"));\n if (tokens?.length) {\n const flag2 = {\n code: \"legacy-token-constant\",\n detail: `${prop} value \"${source}\" resolves to legacy token ${tokens.map((token) => `\"${token}\"`).join(\", \")}; migrate the constant it comes from`\n };\n return { ...empty, problem: flag2, blocked: flag2 };\n }\n if (runtime.literals === null) {\n return {\n ...empty,\n payload: interpolate(prop, source, \"string\", registry),\n dynamic: true,\n inventory: {\n code: \"dynamic-string-value\",\n detail: `${prop} value \"${source}\" is an open string; confirm it never holds a legacy \"$token\" spelling`\n }\n };\n }\n return {\n ...empty,\n payload: interpolate(prop, source, \"string\", registry),\n dynamic: true\n };\n }\n const flag = {\n code: \"unprovable-dynamic-value\",\n detail: `${prop} value \"${source}\" has no provable number or string type, so it cannot fold into a program`\n };\n return { ...empty, blocked: flag };\n}\nfunction pushBase(site, prop, text, value, literalString) {\n const index = site.index++;\n if (literalString !== null) {\n for (const warning of legacyTokenWarnings(prop, [literalString])) {\n addFlag(site.warnings, warning.code, warning.detail);\n }\n if (literalString.includes(\"$\")) {\n site.legacy = true;\n const allowed2 = assessProgram(site, prop, []);\n const flat = flatStringValue(literalString, site.registry);\n const problem = flat.text === null ? {\n code: flat.error?.code ?? \"unsupported-legacy-value\",\n detail: `${prop}: ${flat.error?.message ?? `${JSON.stringify(literalString)} has no flat spelling`}`\n } : !reparsesAsBase(flat.text, site.registry) ? {\n code: \"value-reparses-as-program\",\n detail: `${prop} value ${JSON.stringify(flat.text)} does not read back as one flat base value`\n } : null;\n if (problem !== null) addFlag(site.flags, problem.code, problem.detail);\n site.members.push({\n type: \"authored\",\n index,\n prop,\n text,\n payload: allowed2 && problem === null ? flat.text : null,\n dynamic: false,\n blocked: problem,\n token: allowed2,\n activated: false\n });\n return;\n }\n if (!reparsesAsBase(literalString, site.registry)) {\n const flag = {\n code: \"value-reparses-as-program\",\n detail: `${prop} value ${JSON.stringify(literalString)} does not read back as one flat base value`\n };\n addFlag(site.flags, flag.code, flag.detail);\n site.members.push({\n type: \"authored\",\n index,\n prop,\n text,\n payload: null,\n dynamic: false,\n blocked: flag,\n token: false,\n activated: false\n });\n return;\n }\n site.members.push({\n type: \"authored\",\n index,\n prop,\n text,\n payload: literalString,\n dynamic: false,\n blocked: null,\n token: false,\n activated: false\n });\n return;\n }\n const number = value ? numericValue(value) : null;\n if (number !== null) {\n const classified2 = classifyStatic(prop, number, site.registry);\n site.members.push({\n type: \"authored\",\n index,\n prop,\n text,\n payload: classified2.payload,\n dynamic: false,\n blocked: classified2.blocked,\n token: false,\n activated: false\n });\n return;\n }\n const kind = value?.getKind();\n if (value === null || kind === SyntaxKind.TrueKeyword || kind === SyntaxKind.FalseKeyword || kind === SyntaxKind.NullKeyword) {\n site.members.push({\n type: \"authored\",\n index,\n prop,\n text,\n payload: null,\n dynamic: false,\n blocked: {\n code: \"non-css-style-value\",\n detail: `${prop} value \"${compact(text)}\" is not a CSS value and cannot join a program`\n },\n token: false,\n activated: false\n });\n return;\n }\n const classified = classifyDynamic(prop, value, site.registry);\n if (classified.problem) {\n site.legacy = true;\n addFlag(site.flags, classified.problem.code, classified.problem.detail);\n }\n for (const warning of classified.warnings) {\n addFlag(site.warnings, warning.code, warning.detail);\n }\n if (classified.inventory) {\n addFlag(site.inventory, classified.inventory.code, classified.inventory.detail);\n }\n if (classified.text !== null) site.legacy = true;\n const allowed = classified.text === null || assessProgram(site, prop, []);\n site.members.push({\n type: \"authored\",\n index,\n prop,\n text,\n payload: allowed ? classified.payload : null,\n dynamic: classified.dynamic,\n blocked: classified.blocked,\n token: allowed && classified.text !== null,\n activated: false\n });\n}\nconst sentinelMark = \"\u0001\";\nfunction evaluateLegacyObject(object, rootPath) {\n const leaves = [];\n const visit = (current, currentPath) => {\n const value = {};\n for (const property of current.getProperties()) {\n if (Node.isSpreadAssignment(property)) {\n return {\n value: null,\n fatal: `spread \"${compact(property.getText())}\" hides legacy condition entries`\n };\n }\n if (!Node.isPropertyAssignment(property)) {\n return {\n value: null,\n fatal: `property \"${compact(property.getText())}\" is not a static assignment`\n };\n }\n const nameNode = property.getNameNode();\n if (Node.isComputedPropertyName(nameNode)) {\n return {\n value: null,\n fatal: `computed property \"${compact(nameNode.getText())}\" hides the affected style property`\n };\n }\n const name = propertyName(nameNode);\n if (name === null) {\n return {\n value: null,\n fatal: `property name \"${compact(nameNode.getText())}\" is not statically known`\n };\n }\n const path = `${currentPath}.${name}`;\n const initializer = unwrapExpression(property.getInitializerOrThrow());\n if (Node.isObjectLiteralExpression(initializer)) {\n const nested = visit(initializer, path);\n if (nested.fatal) return nested;\n value[name] = nested.value;\n continue;\n }\n const leaf = staticLeafValue(initializer);\n if (leaf) {\n value[name] = leaf.value;\n continue;\n }\n value[name] = `${sentinelMark}${leaves.length}${sentinelMark}`;\n leaves.push({ path, prop: name, expression: initializer });\n }\n return { value, fatal: null };\n };\n const result = visit(object, rootPath);\n return { ...result, leaves };\n}\nfunction conditionProperties(value) {\n const properties = /* @__PURE__ */ new Set();\n const visit = (object) => {\n for (const key in object) {\n const child = object[key];\n if (child !== null && typeof child === \"object\" && isLegacyConditionName(key)) {\n visit(child);\n continue;\n }\n if (!styleProps.has(key)) continue;\n for (const property of expandToLonghands(key, shorthands)) properties.add(property);\n }\n };\n visit(value);\n return properties;\n}\nfunction pushLegacy(site, name, text, initializer, node) {\n const index = site.index++;\n site.legacy = true;\n const keep = (properties2) => {\n site.members.push({\n type: \"legacy\",\n index,\n name,\n text,\n contributions: [],\n properties: properties2,\n failed: true\n });\n };\n if (initializer === null || !Node.isObjectLiteralExpression(initializer)) {\n addFlag(\n site.flags,\n \"dynamic-legacy-condition\",\n `\"${name}\" is not an inline object literal, so its entries are not statically known`\n );\n keep(null);\n return;\n }\n const evaluated = evaluateLegacyObject(initializer, name);\n if (evaluated.fatal || evaluated.value === null) {\n addFlag(site.flags, \"dynamic-legacy-condition\", evaluated.fatal ?? \"unresolved\");\n keep(null);\n return;\n }\n const properties = conditionProperties(evaluated.value);\n const eligibilityStack = [{ object: evaluated.value, path: name }];\n let hasRejectedProperty = false;\n while (eligibilityStack.length > 0) {\n const current = eligibilityStack.pop();\n for (const prop in current.object) {\n const value = current.object[prop];\n const targetProp = resolveProp(prop);\n if (styleProps.has(targetProp) && !isLegacyConditionName(prop)) {\n const assessment = assessFlatConversion(\n {\n property: targetProp,\n targets: site.targets,\n host: site.host\n },\n site.registry\n );\n if (assessment.verdict === \"ineligible\") {\n addAssessment(site, targetProp, assessment);\n hasRejectedProperty = true;\n }\n continue;\n }\n if (value !== null && typeof value === \"object\" && !Array.isArray(value) && isLegacyConditionName(prop)) {\n eligibilityStack.push({\n object: value,\n path: `${current.path}.${prop}`\n });\n }\n }\n }\n if (hasRejectedProperty) {\n keep(properties);\n return;\n }\n const unresolved = site.containers.unresolved.get(node);\n if (unresolved !== void 0) {\n addFlag(site.flags, unresolved.code, unresolved.detail);\n keep(properties);\n return;\n }\n const resolution = resolveLegacyName(name, site.registry);\n if (!resolution.ok) {\n addFlag(site.flags, resolution.code, resolution.message);\n keep(properties);\n return;\n }\n const payloads = /* @__PURE__ */ new Map();\n let failed = false;\n for (let index2 = 0; index2 < evaluated.leaves.length; index2++) {\n const leaf = evaluated.leaves[index2];\n const classified = classifyDynamic(leaf.prop, leaf.expression, site.registry);\n for (const warning of classified.warnings) {\n addFlag(site.warnings, warning.code, `${leaf.path}: ${warning.detail}`);\n }\n if (classified.payload === null) {\n const flag = classified.problem ?? classified.blocked;\n addFlag(\n site.flags,\n flag?.code ?? \"dynamic-condition-value\",\n `${leaf.path}: ${flag?.detail ?? \"the value is not statically known\"}`\n );\n failed = true;\n continue;\n }\n payloads.set(`${sentinelMark}${index2}${sentinelMark}`, classified.payload);\n }\n if (failed) {\n keep(properties);\n return;\n }\n const { canonical, replaceRoot } = resolution.resolved;\n const converted2 = convertLegacyConditionProp(canonical, evaluated.value, {\n registry: site.registry\n });\n if (converted2 === null) {\n addFlag(\n site.flags,\n \"unknown-legacy-condition\",\n `\"${name}\" is not a registered legacy condition spelling`\n );\n keep(properties);\n return;\n }\n for (const error of converted2.errors) {\n const path = error.path.startsWith(canonical) ? `${name}${error.path.slice(canonical.length)}` : error.path;\n addFlag(site.flags, error.code, `${path}: ${error.message}`);\n failed = true;\n }\n const contributions = [];\n for (const contribution of converted2.contributions) {\n if (!styleProps.has(contribution.prop)) {\n addFlag(\n site.flags,\n \"non-style-condition-entry\",\n `${name}.${contribution.prop} is not a style property, so a flat value cannot carry it`\n );\n failed = true;\n continue;\n }\n const modifiers = replaceRoot ? [...replaceRoot, ...contribution.clause.modifiers.slice(1)] : contribution.clause.modifiers;\n const dynamicPayload = payloads.get(contribution.clause.payload);\n contributions.push({\n prop: contribution.prop,\n clause: {\n modifiers,\n payload: dynamicPayload ?? contribution.clause.payload\n },\n dynamic: dynamicPayload !== void 0\n });\n if (!assessProgram(site, contribution.prop, modifiers)) failed = true;\n }\n if (failed) {\n keep(properties);\n return;\n }\n site.members.push({\n type: \"legacy\",\n index,\n name,\n text,\n contributions,\n properties,\n failed: false\n });\n}\nfunction activationName(prop) {\n return resolveProp(prop);\n}\nconst noProperties = /* @__PURE__ */ new Set();\nconst legacyStatePriorities = Object.freeze({\n hover: 2,\n press: 3,\n active: 3,\n focus: 4,\n \"focus-visible\": 4,\n \"focus-within\": 4,\n enter: 4,\n disabled: 5,\n exit: 5\n});\nfunction legacyStatePriority(modifiers) {\n let priority = null;\n for (const modifier of modifiers) {\n const candidate = legacyStatePriorities[modifier];\n if (candidate !== void 0 && (priority === null || candidate > priority)) {\n priority = candidate;\n }\n }\n return priority;\n}\nfunction orderedEntries(site) {\n const ordered = [];\n for (const member of site.members) {\n if (member.type === \"authored\") {\n if (!member.activated || member.payload === null) continue;\n ordered.push({\n prop: member.prop,\n value: { base: member.payload, clauses: [] },\n dynamic: member.dynamic,\n index: member.index,\n base: true,\n from: null,\n legacyStatePriority: null\n });\n continue;\n }\n if (member.type !== \"legacy\" || member.failed) continue;\n for (const contribution of member.contributions) {\n ordered.push({\n prop: contribution.prop,\n value: { base: null, clauses: [contribution.clause] },\n dynamic: contribution.dynamic,\n index: member.index,\n base: false,\n from: member,\n legacyStatePriority: legacyStatePriority(contribution.clause.modifiers)\n });\n }\n }\n const ranked = ordered.filter((entry) => entry.legacyStatePriority !== null).sort(\n (left, right) => left.legacyStatePriority - right.legacyStatePriority || left.index - right.index\n );\n if (ranked.length < 2) return ordered;\n let rankedIndex = 0;\n return ordered.map(\n (entry) => entry.legacyStatePriority === null ? entry : ranked[rankedIndex++]\n );\n}\nfunction buildSlots(ordered) {\n const slots = /* @__PURE__ */ new Map();\n for (const entry of ordered) {\n for (const property of expandToLonghands(entry.prop, shorthands)) {\n const previous = slots.get(property);\n const value = previous ? mergeProgramValues(previous.value, entry.value) : entry.value;\n slots.delete(property);\n slots.set(property, {\n property,\n sourceProp: entry.prop,\n value,\n anchor: previous ? Math.min(previous.anchor, entry.index) : entry.index,\n last: previous ? Math.max(previous.last, entry.index) : entry.index,\n dynamic: (previous?.dynamic ?? false) || entry.dynamic\n });\n }\n }\n return slots;\n}\nfunction barriers(site) {\n const list = [];\n for (const member of site.members) {\n if (member.type === \"spread\") {\n list.push({ index: member.index, source: member.text, bases: null, clauses: null });\n continue;\n }\n if (member.type === \"authored\" && !member.activated) {\n list.push({\n index: member.index,\n source: member.text,\n bases: new Set(expandToLonghands(member.prop, shorthands)),\n clauses: noProperties\n });\n continue;\n }\n if (member.type === \"legacy\" && member.failed) {\n list.push({\n index: member.index,\n source: member.name,\n bases: noProperties,\n clauses: member.properties\n });\n }\n }\n return list;\n}\nfunction resolveBarriers(site, ordered, slots) {\n let changed = false;\n for (const slot of slots.values()) {\n const contributions = ordered.filter(\n (entry) => expandToLonghands(entry.prop, shorthands).includes(slot.property)\n );\n for (const barrier of barriers(site)) {\n if (barrier.index <= slot.anchor || barrier.index >= slot.last) continue;\n if (barrier.clauses === null || barrier.clauses.has(slot.property)) {\n for (const entry of contributions) {\n if (entry.base || entry.index < barrier.index || !entry.from) continue;\n addFlag(\n site.flags,\n \"condition-order-not-preservable\",\n `\"${compact(barrier.source)}\" can set \"${slot.property}\" between the values contributing to it, so \"${entry.from.name}\" stays authored instead of merging`\n );\n entry.from.failed = true;\n changed = true;\n }\n }\n if (barrier.bases === null || barrier.bases.has(slot.property)) {\n for (const entry of contributions) {\n if (!entry.base || entry.index < barrier.index) continue;\n const authored = site.members.find(\n (member) => member.type === \"authored\" && member.index === entry.index && member.activated\n );\n if (authored && authored.type === \"authored\") {\n authored.payload = null;\n authored.blocked = {\n code: \"base-order-not-preservable\",\n detail: `\"${compact(barrier.source)}\" can set \"${slot.property}\" between the values contributing to it, so this base cannot move`\n };\n changed = true;\n continue;\n }\n addFlag(\n site.flags,\n \"base-order-not-preservable\",\n `\"${compact(barrier.source)}\" can set \"${slot.property}\" between the values contributing to it, so the merged base may win where it did not before`\n );\n }\n }\n }\n }\n return changed;\n}\nfunction assemble(site) {\n let slots = /* @__PURE__ */ new Map();\n for (; ; ) {\n let changed = false;\n const contributed = /* @__PURE__ */ new Set();\n for (const member of site.members) {\n if (member.type !== \"legacy\" || member.failed) continue;\n for (const contribution of member.contributions) {\n contributed.add(activationName(contribution.prop));\n }\n }\n for (const member of site.members) {\n if (member.type !== \"authored\") continue;\n const name = activationName(member.prop);\n member.activated = member.token && member.payload !== null || contributed.has(name);\n if (!member.activated || member.payload !== null) continue;\n const blocked = member.blocked;\n addFlag(\n site.flags,\n blocked?.code ?? \"unprovable-dynamic-value\",\n `a legacy condition targets \"${member.prop}\": ${blocked?.detail ?? `its base value \"${compact(member.text)}\" cannot join a program`}`\n );\n member.activated = false;\n for (const other of site.members) {\n if (other.type !== \"legacy\" || other.failed) continue;\n if (other.contributions.some((one) => activationName(one.prop) === name)) {\n other.failed = true;\n changed = true;\n }\n }\n }\n if (changed) continue;\n const ordered = orderedEntries(site);\n slots = buildSlots(ordered);\n if (!resolveBarriers(site, ordered, slots)) break;\n }\n const entries = [];\n for (const member of site.members) {\n if (member.type === \"authored\" && member.activated) continue;\n if (member.type === \"legacy\" && !member.failed) continue;\n entries.push({ index: member.index, text: member.text });\n }\n const printed = printSlots(site, slots);\n entries.push(...printed.output);\n entries.push(...site.extras);\n entries.sort((left, right) => left.index - right.index);\n return { entries, programs: printed.programs };\n}\nfunction printSlots(site, slots) {\n const printed = /* @__PURE__ */ new Set();\n const output = [];\n const programs = [];\n const outputCommentRanges = [];\n for (const [property, slot] of slots) {\n if (printed.has(property)) continue;\n const serialized = printProgram(slot.value);\n const expansion = expandToLonghands(slot.sourceProp, shorthands);\n const collapses = expansion.length > 0 && expansion.every((expanded) => {\n const candidate = slots.get(expanded);\n return candidate !== void 0 && candidate.sourceProp === slot.sourceProp && candidate.anchor === slot.anchor && candidate.dynamic === slot.dynamic && printProgram(candidate.value) === serialized;\n });\n const name = collapses ? slot.sourceProp : property;\n if (collapses) for (const expanded of expansion) printed.add(expanded);\n else printed.add(property);\n const value = slot.dynamic ? `\\`${serialized}\\`` : JSON.stringify(serialized);\n programs.push({ name, value: serialized, dynamic: slot.dynamic });\n const propertyText = site.kind === \"styled\" ? `${name}: ${value}` : `${name}=${slot.dynamic ? `{${value}}` : value}`;\n output.push({\n index: slot.anchor,\n text: propertyText\n });\n outputCommentRanges.push({\n outputIndex: output.length - 1,\n first: slot.anchor,\n last: slot.last\n });\n }\n verify(\n site,\n slots,\n [...output].sort((left, right) => left.index - right.index)\n );\n if (site.kind === \"styled\") {\n const commentedIndexes = /* @__PURE__ */ new Set();\n for (const range of outputCommentRanges) {\n const comments = [];\n for (const [index, texts] of site.comments) {\n if (index < range.first || index > range.last || commentedIndexes.has(index)) {\n continue;\n }\n comments.push(...texts);\n commentedIndexes.add(index);\n }\n if (comments.length) {\n output[range.outputIndex].text = `${comments.join(\"\\n\")}\n${output[range.outputIndex].text}`;\n }\n }\n }\n return { output, programs };\n}\nfunction sanitize(text) {\n let result = \"\";\n for (let index = 0; index < text.length; index++) {\n if (text[index] !== \"$\" || text[index + 1] !== \"{\") {\n result += text[index];\n continue;\n }\n let depth = 0;\n let end = index + 1;\n for (; end < text.length; end++) {\n if (text[end] === \"{\") depth++;\n else if (text[end] === \"}\" && --depth === 0) break;\n }\n result += \"zz\";\n index = end;\n }\n return result;\n}\nfunction verify(site, slots, output) {\n const separator = site.kind === \"styled\" ? \": \" : \"=\";\n const reparsed = /* @__PURE__ */ new Map();\n for (const entry of output) {\n const split = entry.text.indexOf(separator);\n const prop = entry.text.slice(0, split);\n let raw = entry.text.slice(split + separator.length);\n if (raw.startsWith(\"{\")) raw = raw.slice(1, -1);\n const text = sanitize(raw.slice(1, -1));\n const parsed = parseValue(text, site.registry);\n if (!parsed.ok) {\n addFlag(\n site.flags,\n \"emitted-value-invalid\",\n `\"${prop}=${text}\" does not parse: ${parsed.errors.map((error) => error.message).join(\"; \")}`\n );\n return;\n }\n for (const property of expandToLonghands(prop, shorthands)) {\n const previous = reparsed.get(property);\n reparsed.set(\n property,\n previous ? mergeProgramValues(previous, parsed.value) : parsed.value\n );\n }\n }\n for (const [property, slot] of slots) {\n const actual = reparsed.get(property);\n const expected = sanitize(printProgram(slot.value));\n if (actual === void 0 || sanitize(printProgram(actual)) !== expected) {\n addFlag(\n site.flags,\n \"emitted-program-mismatch\",\n `\"${property}\" reads back as \"${actual ? sanitize(printProgram(actual)) : \"(missing)\"}\" instead of \"${expected}\"`\n );\n }\n }\n}\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 jsxAttributeName(attribute) {\n const name = attribute.getNameNode();\n return Node.isIdentifier(name) ? name.getText() : null;\n}\nfunction jsxLiteralString(attribute) {\n const initializer = attribute.getInitializer();\n if (Node.isStringLiteral(initializer)) return initializer.getLiteralValue();\n const expression = jsxExpression(attribute);\n if (expression && (Node.isStringLiteral(expression) || Node.isNoSubstitutionTemplateLiteral(expression))) {\n return expression.getLiteralValue();\n }\n return null;\n}\nfunction jsxExpression(attribute) {\n const initializer = attribute.getInitializer();\n if (!Node.isJsxExpression(initializer)) return null;\n const expression = initializer.getExpression();\n return expression ? unwrapExpression(expression) : null;\n}\nfunction isConvertedJsxAttribute(attribute) {\n if (Node.isJsxSpreadAttribute(attribute)) return true;\n if (!Node.isJsxAttribute(attribute)) return false;\n const name = jsxAttributeName(attribute);\n return !!name && isConvertedName(name);\n}\nfunction rewriteJsxSite(opening, entries) {\n const attributes = opening.getAttributes();\n const rendered = [];\n let inserted = false;\n for (const attribute of attributes) {\n if (isConvertedJsxAttribute(attribute)) {\n if (!inserted) {\n rendered.push(...entries.map((entry) => entry.text));\n inserted = true;\n }\n } else {\n rendered.push(attribute.getText());\n }\n }\n const source = opening.getText();\n const start = opening.getStart();\n const first = attributes[0];\n const last = attributes[attributes.length - 1];\n const prefix = source.slice(0, first.getStart() - start);\n const suffix = source.slice(last.getEnd() - start);\n const authoredMultiline = prefix.includes(\"\\n\") || source.slice(first.getStart() - start, last.getEnd() - start).includes(\"\\n\");\n opening.replaceWithText(\n authoredMultiline ? `${prefix.replace(/[ \\t]+$/, \"\")}${rendered.map((text) => ` ${text}`).join(\"\\n\")}${suffix.replace(/\\n[ \\t]+/, \"\\n\")}` : `${prefix}${rendered.join(\" \")}${suffix}`\n );\n}\nfunction containerExtras(site, declaration, index) {\n const target = site.containers.targets.get(declaration);\n if (target === void 0) return;\n const name = target.named && target.group !== \"\" ? target.group : null;\n const text = site.kind === \"styled\" ? name === null ? \"container: true\" : `container: ${JSON.stringify(name)}` : name === null ? \"container\" : `container=${JSON.stringify(name)}`;\n site.legacy = true;\n site.extras.push({ index, text });\n if (target.flag !== null) addFlag(site.flags, target.flag.code, target.flag.detail);\n addNote(\n site,\n `a descendant uses a legacy container-size condition on this group, so it declares a query container`\n );\n}\nfunction convertJsxSite(opening, registry, containers, targets, host, write = false) {\n const site = createSite(\"jsx\", registry, containers, targets, host);\n const before = [];\n for (const attribute of opening.getAttributes()) {\n if (Node.isJsxSpreadAttribute(attribute)) {\n const expression = unwrapExpression(attribute.getExpression());\n if (Node.isObjectLiteralExpression(expression)) {\n before.push(compact(attribute.getText()));\n for (const property of expression.getProperties()) {\n if (Node.isPropertyAssignment(property)) {\n const name2 = propertyName(property.getNameNode());\n if (name2 !== null) {\n if (isConvertedName(name2)) {\n pushStyledProperty(\n site,\n name2,\n property,\n `${name2}={${property.getInitializerOrThrow().getText()}}`\n );\n } else {\n site.members.push({\n type: \"passthrough\",\n index: site.index++,\n text: `${name2}={${property.getInitializerOrThrow().getText()}}`\n });\n }\n continue;\n }\n }\n pushSpread(\n site,\n property,\n Node.isSpreadAssignment(property) ? `{${property.getText()}}` : `{...{ ${property.getText()} }}`\n );\n }\n continue;\n }\n before.push(compact(attribute.getText()));\n pushSpread(site, expression, attribute.getText());\n continue;\n }\n const name = jsxAttributeName(attribute);\n if (!name) continue;\n const text = compact(attribute.getText());\n if (name === \"group\") {\n before.push(text);\n containerExtras(site, attribute, site.index);\n site.members.push({ type: \"passthrough\", index: site.index++, text });\n continue;\n }\n if (isLegacyConditionName(name)) {\n before.push(text);\n pushLegacy(site, name, text, jsxExpression(attribute), attribute);\n continue;\n }\n if (tokenVariantProps.has(name)) {\n if (pushTokenVariant(site, name, attribute, text)) before.push(text);\n continue;\n }\n if (!styleProps.has(name)) continue;\n before.push(text);\n const literal = jsxLiteralString(attribute);\n pushBase(\n site,\n name,\n text,\n literal === null ? jsxExpression(attribute) : null,\n literal\n );\n }\n if (!site.legacy) return null;\n const { entries, programs } = assemble(site);\n const sourceFile = opening.getSourceFile();\n const report = {\n kind: \"jsx\",\n label: `<${opening.getTagNameNode().getText()}>`,\n line: sourceFile.getLineAndColumnAtPos(opening.getStart()).line,\n before: before.join(\" \"),\n after: entries.map((entry) => entry.text).join(\" \") || \"(no style props left)\",\n programs: [...programs, ...site.respelled],\n assessments: site.assessments,\n assessmentVerdict: assessmentVerdict(site.assessments),\n warnings: site.warnings,\n flags: site.flags,\n inventory: site.inventory,\n pending: site.pending,\n notes: site.notes,\n legacyLeft: legacyLeft(site)\n };\n if (write && converted(site, report) && !site.flags.some(\n (flag) => flag.code === \"emitted-program-mismatch\" || flag.code === \"emitted-value-invalid\"\n )) {\n rewriteJsxSite(opening, entries);\n }\n return report;\n}\nfunction pushStyledProperty(site, name, property, authoredText) {\n const comments = allCommentTexts(property);\n if (comments.length) site.comments.set(site.index, comments);\n const text = authoredText ?? textWithOuterComments(property);\n const initializer = unwrapExpression(property.getInitializerOrThrow());\n if (name === \"group\") {\n containerExtras(site, property, site.index);\n site.members.push({ type: \"passthrough\", index: site.index++, text });\n return;\n }\n if (isLegacyConditionName(name)) {\n pushLegacy(site, name, text, initializer, property);\n return;\n }\n if (tokenVariantProps.has(name)) {\n pushTokenVariant(site, name, property, text);\n return;\n }\n if (!styleProps.has(name)) return;\n const literal = Node.isStringLiteral(initializer) || Node.isNoSubstitutionTemplateLiteral(initializer) ? initializer.getLiteralValue() : null;\n pushBase(site, name, text, literal === null ? initializer : null, literal);\n}\nfunction pushTokenVariant(site, name, node, text) {\n const index = site.index++;\n const initializer = node.getInitializer();\n const value = initializer !== void 0 && Node.isJsxExpression(initializer) ? initializer.getExpression() : initializer;\n const literals = value === void 0 ? [] : [value, ...value.getDescendants()].filter(\n (candidate) => (Node.isStringLiteral(candidate) || Node.isNoSubstitutionTemplateLiteral(candidate)) && candidate.getLiteralValue().startsWith(\"$\")\n );\n if (value === void 0 || literals.length === 0) {\n site.members.push({ type: \"passthrough\", index, text });\n return false;\n }\n const source = value.getText();\n const start = value.getStart();\n let rewritten = \"\";\n let cursor = start;\n for (const literal of literals) {\n let replacement = \"true\";\n if (literal.getLiteralValue() !== \"$true\") {\n const flat = flatStringValue(literal.getLiteralValue(), site.registry);\n if (flat.text === null) {\n site.legacy = true;\n addFlag(\n site.flags,\n flat.error?.code ?? \"unsupported-legacy-value\",\n `${name}: ${flat.error?.message ?? `${literal.getText()} has no flat spelling`}`\n );\n site.members.push({ type: \"passthrough\", index, text });\n return true;\n }\n const quote = literal.getText()[0];\n replacement = `${quote}${flat.text}${quote}`;\n }\n rewritten += source.slice(cursor - start, literal.getStart() - start);\n rewritten += replacement;\n cursor = literal.getEnd();\n }\n rewritten += source.slice(cursor - start);\n site.legacy = true;\n const output = Node.isJsxAttribute(node) ? Node.isStringLiteral(initializer) ? rewritten === \"true\" ? name : `${name}=${rewritten}` : `${name}={${rewritten}}` : site.kind === \"jsx\" ? `${name}={${rewritten}}` : textWithOuterComments(node, `${node.getNameNode().getText()}: ${rewritten}`);\n site.members.push({ type: \"passthrough\", index, text: output });\n site.respelled.push({\n name,\n value: rewritten,\n dynamic: literals.length !== 1 || literals[0] !== value\n });\n return true;\n}\nfunction convertStyleObject(object, kind, label, registry, containers, targets, host, write = false) {\n const site = createSite(kind, registry, containers, targets, host);\n const before = [];\n for (const property of object.getProperties()) {\n if (Node.isSpreadAssignment(property)) {\n const expression = unwrapExpression(property.getExpression());\n before.push(compact(property.getText()));\n if (Node.isObjectLiteralExpression(expression)) {\n for (const nested of expression.getProperties()) {\n if (Node.isPropertyAssignment(nested)) {\n const name2 = propertyName(nested.getNameNode());\n if (name2 !== null) {\n if (isConvertedName(name2)) {\n pushStyledProperty(site, name2, nested);\n } else {\n site.members.push({\n type: \"passthrough\",\n index: site.index++,\n text: compact(nested.getText())\n });\n }\n continue;\n }\n }\n pushSpread(site, nested, compact(nested.getText()));\n }\n continue;\n }\n pushSpread(site, expression, compact(property.getText()));\n continue;\n }\n if (!Node.isPropertyAssignment(property)) continue;\n const nameNode = property.getNameNode();\n if (Node.isComputedPropertyName(nameNode)) {\n addFlag(\n site.flags,\n \"computed-property\",\n `\"${compact(nameNode.getText())}\" hides the affected style property`\n );\n continue;\n }\n const name = propertyName(nameNode);\n if (name === null) continue;\n if (!isConvertedName(name)) continue;\n before.push(compact(property.getText()));\n pushStyledProperty(site, name, property);\n }\n if (!site.legacy) return null;\n const { entries, programs } = assemble(site);\n const sourceFile = object.getSourceFile();\n const report = {\n kind,\n label,\n line: sourceFile.getLineAndColumnAtPos(object.getStart()).line,\n before: before.join(\", \"),\n after: entries.map((entry) => entry.text).join(\", \") || \"(no style props left)\",\n programs: [...programs, ...site.respelled],\n assessments: site.assessments,\n assessmentVerdict: assessmentVerdict(site.assessments),\n warnings: site.warnings,\n flags: site.flags,\n inventory: site.inventory,\n pending: site.pending,\n notes: site.notes,\n legacyLeft: legacyLeft(site)\n };\n if (write && converted(site, report) && !site.flags.some(\n (flag) => flag.code === \"emitted-program-mismatch\" || flag.code === \"emitted-value-invalid\"\n )) {\n rewriteStyleObject(object, entries);\n }\n return report;\n}\nfunction isConvertedStyledProperty(property) {\n if (Node.isSpreadAssignment(property)) return true;\n if (!Node.isPropertyAssignment(property)) return false;\n const nameNode = property.getNameNode();\n if (Node.isComputedPropertyName(nameNode)) return false;\n const name = propertyName(nameNode);\n return !!name && isConvertedName(name);\n}\nfunction allCommentTexts(node) {\n const comments = /* @__PURE__ */ new Map();\n for (const current of [node, ...node.getDescendants()]) {\n for (const range of [\n ...current.getLeadingCommentRanges(),\n ...current.getTrailingCommentRanges()\n ]) {\n comments.set(range.getPos(), range.getText());\n }\n }\n return [...comments.entries()].sort((left, right) => left[0] - right[0]).map((entry) => entry[1]);\n}\nfunction textWithOuterComments(node, text = node.getText()) {\n const comments = /* @__PURE__ */ new Map();\n for (const range of [\n ...node.getLeadingCommentRanges(),\n ...node.getTrailingCommentRanges()\n ]) {\n comments.set(range.getPos(), range.getText());\n }\n const prefix = [...comments.entries()].sort((left, right) => left[0] - right[0]).map((entry) => entry[1]);\n return [...prefix, text].join(\"\\n \");\n}\nfunction rewriteStyleObject(object, entries) {\n const rendered = [];\n let inserted = false;\n for (const property of object.getProperties()) {\n if (isConvertedStyledProperty(property)) {\n if (!inserted) {\n rendered.push(...entries.map((entry) => entry.text));\n inserted = true;\n }\n } else {\n rendered.push(textWithOuterComments(property));\n }\n }\n if (rendered.length === 0) {\n object.replaceWithText(\"{}\");\n return;\n }\n object.replaceWithText(`{\n${rendered.map((text) => ` ${text}`).join(\",\\n\")}\n}`);\n}\nexport {\n convertJsxSite,\n convertStyleObject,\n sanitize\n};\n//# sourceMappingURL=convert.js.map\n"],"mappings":";;;;;;;AA6BA,SAAS,kBAAkB,aAAa;C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,CAAC;EAC/C;CACF;CACA,IAAI,SAAS,WAAW,GAAG;EACzB,OAAO,gBAAgB,IAAI;EAC3B;CACF;CACA,OAAO,gBAAgB;EACvB,SAAS,KAAK,SAAS,KAAK,MAAM,CAAC,CAAC,KAAK,KAAK,EAAE;EAChD;AACF"}
|
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { planContainers } from "./containers.mjs";
|
|
|
8
8
|
import { convertJsxSite, convertStyleObject } from "./convert.mjs";
|
|
9
9
|
import { compact, unwrapExpression } from "./expressions.mjs";
|
|
10
10
|
import { addFunctionalVariantTypeImports, convertFunctionalVariants } from "./functionalVariants.mjs";
|
|
11
|
-
import { codemodMediaNames, createModifierRegistry, grammarPlatformNames } from "./grammar.mjs";
|
|
11
|
+
import { codemodMediaNames, createModifierRegistry, grammarPlatformNames, shorthands } from "./grammar.mjs";
|
|
12
12
|
import { createProvenance } from "./provenance.mjs";
|
|
13
13
|
import { renderReport } from "./report.mjs";
|
|
14
14
|
import { convertSheetFrames } from "./sheetAnatomy.mjs";
|
|
@@ -194,13 +194,24 @@ function conversionTargets(filePath) {
|
|
|
194
194
|
if (/\.native\.[cm]?[jt]sx?$/.test(filePath)) return "native";
|
|
195
195
|
return "shared";
|
|
196
196
|
}
|
|
197
|
+
const shorthandSpellings = /* @__PURE__ */ new Map();
|
|
198
|
+
for (const [shorthand, longhand] of Object.entries(shorthands)) {
|
|
199
|
+
const spellings = shorthandSpellings.get(longhand);
|
|
200
|
+
if (spellings) spellings.push(shorthand);
|
|
201
|
+
else shorthandSpellings.set(longhand, [shorthand]);
|
|
202
|
+
}
|
|
197
203
|
function typeAwareHost(node) {
|
|
198
204
|
const checker = node.getProject().getTypeChecker().compilerObject;
|
|
199
205
|
const host = resolveTamaguiHost(checker, node.compilerNode);
|
|
200
|
-
if (!host
|
|
206
|
+
if (!host) return host;
|
|
207
|
+
const accepts = (property) => host.accepts(property) || (shorthandSpellings.get(property)?.some((spelling) => host.accepts(spelling)) ?? false);
|
|
208
|
+
if (node.getText() !== "View") return {
|
|
209
|
+
...host,
|
|
210
|
+
accepts
|
|
211
|
+
};
|
|
201
212
|
return {
|
|
202
213
|
...host,
|
|
203
|
-
accepts: (property) => !(property in stylePropsTextOnly) &&
|
|
214
|
+
accepts: (property) => !(property in stylePropsTextOnly) && accepts(property)
|
|
204
215
|
};
|
|
205
216
|
}
|
|
206
217
|
function inspectFile(sourceFile, registry, provenance2, write2) {
|
package/dist/index.mjs.map
CHANGED
|
@@ -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} 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}\nfunction typeAwareHost(node) {\n const checker = node.getProject().getTypeChecker().compilerObject;\n const host = resolveTamaguiHost(\n checker,\n node.compilerNode\n );\n if (!host || node.getText() !== \"View\") return host;\n return {\n ...host,\n accepts: (property) => !(property in stylePropsTextOnly) && host.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":";;;;;;;;;;;;;;;;AA8BA,MAAM,cAAc,QAAQ,IAAI;AAChC,MAAM,oBAAoB,QAAQ,aAAa,+BAA+B;AAC9E,MAAM,eAAe;AACrB,MAAM,qCAAqC,IAAI,IAAI;AACnD,SAAS,UAAU,UAAU;CAC3B,IAAI,YAAY,QAAQ,QAAQ;CAChC,MAAM,UAAU,CAAC;CACjB,OAAO,cAAc,eAAe,CAAC,SAAS,aAAa,SAAS,CAAC,CAAC,WAAW,IAAI,GAAG;EACtF,MAAM,SAAS,mBAAmB,IAAI,SAAS;EAC/C,IAAI,WAAW,KAAK,GAAG;GACrB,KAAK,MAAM,QAAQ,SAAS,mBAAmB,IAAI,MAAM,MAAM;GAC/D,OAAO;EACT;EACA,QAAQ,KAAK,SAAS;EACtB,IAAI,WAAW,QAAQ,WAAW,YAAY,CAAC,GAAG;GAChD,KAAK,MAAM,QAAQ,SAAS,mBAAmB,IAAI,MAAM,IAAI;GAC7D,OAAO;EACT;EACA,IAAI,cAAc,aAAa;EAC/B,MAAM,SAAS,QAAQ,SAAS;EAChC,IAAI,WAAW,WAAW;EAC1B,YAAY;CACd;CACA,KAAK,MAAM,QAAQ,SAAS,mBAAmB,IAAI,MAAM,KAAK;CAC9D,OAAO;AACT;AACA,SAAS,aAAa,SAAS;CAC7B,MAAM,mBAAmB,QAAQ,aAAa,eAAe;CAC7D,IAAI,CAAC,WAAW,gBAAgB,GAAG;EACjC,QAAQ,MACN,uBAAuB,YAAY,yCACrC;EACA,QAAQ,KAAK,CAAC;CAChB;CACA,MAAM,UAAU,IAAI,QAAQ;EAC1B;EACA,6BAA6B;EAK7B,sBAAsB,EAAE,iBAAiB,gBAAgB,UAAU;EACnE,iBAAiB;GACf,SAAS;GACT,KAAK;GACL,QAAQ,aAAa;GACrB,QAAQ,WAAW;GACnB,kBAAkB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SAAS,aAAa,QAAQ,EAAE;EACzC,SACI;GACA,QAAQ,KAAK,CAAC;EAChB;CACF;AACF;AACA,MAAM,EAAE,MAAM,YAAY,aACxB,OACA,OAAO,KAAK,UAAU,SAAS,aAAa,QAAQ,aAAa,KAAK,CAAC,CAAC,GACxE,iBAAiB,aACjB,cACA,KACF;AACA,UAAU,QAAQ,UAAU,GAAG,EAAE,WAAW,KAAK,CAAC;AAClD,cAAc,YAAY,IAAI;AAC9B,IAAI,aAAa,MAAM;CACrB,UAAU,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAK,CAAC;CAChD,cAAc,UAAU,GAAG,KAAK,UAAU;EAAE;EAAO;CAAQ,GAAG,MAAM,CAAC,EAAE;CACxE;AACD;AACA,IAAI,UAAU;AACd,IAAI,OAAO;CACT,KAAK,MAAM,cAAc,aAAa;EACpC,MAAM,OAAO,WAAW,YAAY;EACpC,IAAI,SAAS,UAAU,IAAI,WAAW,YAAY,CAAC,GAAG;EACtD,cAAc,WAAW,YAAY,GAAG,IAAI;EAC5C;CACF;AACF;AACA,QAAQ,IAAI,SAAS,YAAY;AACjC,IAAI,OAAO,QAAQ,IAAI,WAAW,QAAQ,cAAc;AACxD,QAAQ,IACN,GAAG,QAAQ,MAAM,gBAAgB,QAAQ,QAAQ,QAAQ,QAAQ,UAAU,QAAQ,gBAAgB,oBAAoB,QAAQ,YAAY,iBAAiB,QAAQ,WAAW,eAAe,QAAQ,QAAQ,+BAA+B,QAAQ,QAAQ,mBAAmB,QAAQ,uBAAuB,wBAAwB,QAAQ,2BAA2B,cAAc,QAAQ,yBAAyB,YAAY,QAAQ,YAAY,sBAAsB,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 { 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,oBAAoB,QAAQ,aAAa,+BAA+B;AAC9E,MAAM,eAAe;AACrB,MAAM,qCAAqC,IAAI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1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/codemod-flat-values",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.917.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"typecheck": "tsc --noEmit"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@tamagui/helpers": "3.0.0-beta.
|
|
30
|
-
"@tamagui/language-service": "3.0.0-beta.
|
|
31
|
-
"@tamagui/shorthands": "3.0.0-beta.
|
|
32
|
-
"@tamagui/style-grammar": "3.0.0-beta.
|
|
29
|
+
"@tamagui/helpers": "3.0.0-beta.917.1",
|
|
30
|
+
"@tamagui/language-service": "3.0.0-beta.917.1",
|
|
31
|
+
"@tamagui/shorthands": "3.0.0-beta.917.1",
|
|
32
|
+
"@tamagui/style-grammar": "3.0.0-beta.917.1",
|
|
33
33
|
"ts-morph": "^28.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@tamagui/build": "3.0.0-beta.
|
|
36
|
+
"@tamagui/build": "3.0.0-beta.917.1",
|
|
37
37
|
"typescript": "~6.0.3"
|
|
38
38
|
},
|
|
39
39
|
"repository": {
|
package/src/convert.ts
CHANGED
|
@@ -126,6 +126,8 @@ interface SpreadMember {
|
|
|
126
126
|
type: 'spread'
|
|
127
127
|
index: number
|
|
128
128
|
text: string
|
|
129
|
+
/** it holds v1 condition keys the conversion could not reach, so a human must */
|
|
130
|
+
legacy: boolean
|
|
129
131
|
}
|
|
130
132
|
|
|
131
133
|
/** a prop the conversion keeps verbatim at its authored position */
|
|
@@ -269,6 +271,80 @@ function addAssessment(
|
|
|
269
271
|
}
|
|
270
272
|
}
|
|
271
273
|
|
|
274
|
+
/**
|
|
275
|
+
* The v1 condition keys written inside a spread the conversion cannot open. A
|
|
276
|
+
* spread of anything but an inline object literal keeps its members where they
|
|
277
|
+
* were authored, so `{...(wide && { $sm: { minW: '40%' } })}` used to survive
|
|
278
|
+
* `--write` untouched while the site still reported clean. The keys are visible
|
|
279
|
+
* in the source even when the spread's value is not, and naming them is what
|
|
280
|
+
* tells the author which element still needs a hand edit.
|
|
281
|
+
*/
|
|
282
|
+
function legacyKeysInSpread(expression: Node): string[] {
|
|
283
|
+
const names = new Set<string>()
|
|
284
|
+
for (const object of expression.getDescendantsOfKind(
|
|
285
|
+
SyntaxKind.ObjectLiteralExpression
|
|
286
|
+
)) {
|
|
287
|
+
for (const property of object.getProperties()) {
|
|
288
|
+
if (!Node.isPropertyAssignment(property)) continue
|
|
289
|
+
const name = propertyName(property.getNameNode())
|
|
290
|
+
if (name !== null && isLegacyConditionName(name)) names.add(name)
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return [...names]
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* A spread member, flagged when it hides v1 condition keys. Setting `legacy`
|
|
298
|
+
* makes the element a conversion site even when nothing else on it converts,
|
|
299
|
+
* and counts it as an open hand edit rather than a converted one.
|
|
300
|
+
*/
|
|
301
|
+
function pushSpread(site: Site, expression: Node, text: string): void {
|
|
302
|
+
const keys = legacyKeysInSpread(expression)
|
|
303
|
+
if (keys.length) {
|
|
304
|
+
site.legacy = true
|
|
305
|
+
addFlag(
|
|
306
|
+
site.flags,
|
|
307
|
+
'legacy-condition-in-spread',
|
|
308
|
+
`"${compact(text)}" is not an inline object literal, so its ${keys
|
|
309
|
+
.map((key) => `"${key}"`)
|
|
310
|
+
.join(', ')} ${keys.length === 1 ? 'entry stays' : 'entries stay'} authored`
|
|
311
|
+
)
|
|
312
|
+
}
|
|
313
|
+
site.members.push({
|
|
314
|
+
type: 'spread',
|
|
315
|
+
index: site.index++,
|
|
316
|
+
text,
|
|
317
|
+
legacy: keys.length > 0,
|
|
318
|
+
})
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Whether the rewrite would change anything: a printed program, a respelled
|
|
323
|
+
* token, an added container, or a member the entries drop. A site reported only
|
|
324
|
+
* for syntax it cannot convert has none of those, and reprinting it there
|
|
325
|
+
* reflows the source for no change at all.
|
|
326
|
+
*/
|
|
327
|
+
function converted(site: Site, report: SiteReport): boolean {
|
|
328
|
+
return (
|
|
329
|
+
report.programs.length > 0 ||
|
|
330
|
+
site.extras.length > 0 ||
|
|
331
|
+
site.members.some(
|
|
332
|
+
(member) =>
|
|
333
|
+
(member.type === 'authored' && member.activated) ||
|
|
334
|
+
(member.type === 'legacy' && !member.failed)
|
|
335
|
+
)
|
|
336
|
+
)
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/** the members a human still has to migrate by hand */
|
|
340
|
+
function legacyLeft(site: Site): number {
|
|
341
|
+
return site.members.filter(
|
|
342
|
+
(member) =>
|
|
343
|
+
(member.type === 'legacy' && member.failed) ||
|
|
344
|
+
(member.type === 'spread' && member.legacy)
|
|
345
|
+
).length
|
|
346
|
+
}
|
|
347
|
+
|
|
272
348
|
/** a member the conversion owns, so the rewrite prints it from the site's entries */
|
|
273
349
|
function isConvertedName(name: string): boolean {
|
|
274
350
|
return (
|
|
@@ -1539,22 +1615,18 @@ export function convertJsxSite(
|
|
|
1539
1615
|
}
|
|
1540
1616
|
// a nested spread or a member whose key is not statically known can set
|
|
1541
1617
|
// anything, so it stays where it was authored and orders the merge
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1618
|
+
pushSpread(
|
|
1619
|
+
site,
|
|
1620
|
+
property,
|
|
1621
|
+
Node.isSpreadAssignment(property)
|
|
1546
1622
|
? `{${property.getText()}}`
|
|
1547
|
-
: `{...{ ${property.getText()} }}
|
|
1548
|
-
|
|
1623
|
+
: `{...{ ${property.getText()} }}`
|
|
1624
|
+
)
|
|
1549
1625
|
}
|
|
1550
1626
|
continue
|
|
1551
1627
|
}
|
|
1552
1628
|
before.push(compact(attribute.getText()))
|
|
1553
|
-
site.
|
|
1554
|
-
type: 'spread',
|
|
1555
|
-
index: site.index++,
|
|
1556
|
-
text: attribute.getText(),
|
|
1557
|
-
})
|
|
1629
|
+
pushSpread(site, expression, attribute.getText())
|
|
1558
1630
|
continue
|
|
1559
1631
|
}
|
|
1560
1632
|
|
|
@@ -1609,11 +1681,11 @@ export function convertJsxSite(
|
|
|
1609
1681
|
inventory: site.inventory,
|
|
1610
1682
|
pending: site.pending,
|
|
1611
1683
|
notes: site.notes,
|
|
1612
|
-
legacyLeft: site
|
|
1613
|
-
.length,
|
|
1684
|
+
legacyLeft: legacyLeft(site),
|
|
1614
1685
|
}
|
|
1615
1686
|
if (
|
|
1616
1687
|
write &&
|
|
1688
|
+
converted(site, report) &&
|
|
1617
1689
|
!site.flags.some(
|
|
1618
1690
|
(flag) =>
|
|
1619
1691
|
flag.code === 'emitted-program-mismatch' || flag.code === 'emitted-value-invalid'
|
|
@@ -1774,19 +1846,11 @@ export function convertStyleObject(
|
|
|
1774
1846
|
}
|
|
1775
1847
|
// a nested spread or a member whose key is not statically known can set
|
|
1776
1848
|
// anything, so it stays where it was authored and orders the merge
|
|
1777
|
-
site.
|
|
1778
|
-
type: 'spread',
|
|
1779
|
-
index: site.index++,
|
|
1780
|
-
text: compact(nested.getText()),
|
|
1781
|
-
})
|
|
1849
|
+
pushSpread(site, nested, compact(nested.getText()))
|
|
1782
1850
|
}
|
|
1783
1851
|
continue
|
|
1784
1852
|
}
|
|
1785
|
-
site.
|
|
1786
|
-
type: 'spread',
|
|
1787
|
-
index: site.index++,
|
|
1788
|
-
text: compact(property.getText()),
|
|
1789
|
-
})
|
|
1853
|
+
pushSpread(site, expression, compact(property.getText()))
|
|
1790
1854
|
continue
|
|
1791
1855
|
}
|
|
1792
1856
|
if (!Node.isPropertyAssignment(property)) continue
|
|
@@ -1825,11 +1889,11 @@ export function convertStyleObject(
|
|
|
1825
1889
|
inventory: site.inventory,
|
|
1826
1890
|
pending: site.pending,
|
|
1827
1891
|
notes: site.notes,
|
|
1828
|
-
legacyLeft: site
|
|
1829
|
-
.length,
|
|
1892
|
+
legacyLeft: legacyLeft(site),
|
|
1830
1893
|
}
|
|
1831
1894
|
if (
|
|
1832
1895
|
write &&
|
|
1896
|
+
converted(site, report) &&
|
|
1833
1897
|
!site.flags.some(
|
|
1834
1898
|
(flag) =>
|
|
1835
1899
|
flag.code === 'emitted-program-mismatch' || flag.code === 'emitted-value-invalid'
|
package/src/index.ts
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
codemodMediaNames,
|
|
30
30
|
createModifierRegistry,
|
|
31
31
|
grammarPlatformNames,
|
|
32
|
+
shorthands,
|
|
32
33
|
type ConversionTargets,
|
|
33
34
|
type HostView,
|
|
34
35
|
type ModifierRegistryView,
|
|
@@ -314,13 +315,33 @@ function conversionTargets(filePath: string): ConversionTargets {
|
|
|
314
315
|
return 'shared'
|
|
315
316
|
}
|
|
316
317
|
|
|
318
|
+
/** every shorthand spelling a longhand can be written as, keyed by longhand */
|
|
319
|
+
const shorthandSpellings = new Map<string, string[]>()
|
|
320
|
+
for (const [shorthand, longhand] of Object.entries(shorthands)) {
|
|
321
|
+
const spellings = shorthandSpellings.get(longhand)
|
|
322
|
+
if (spellings) spellings.push(shorthand)
|
|
323
|
+
else shorthandSpellings.set(longhand, [shorthand])
|
|
324
|
+
}
|
|
325
|
+
|
|
317
326
|
function typeAwareHost(node: Node): HostView | undefined {
|
|
318
327
|
const checker = node.getProject().getTypeChecker().compilerObject
|
|
319
328
|
const host = resolveTamaguiHost(
|
|
320
329
|
checker as unknown as Parameters<typeof resolveTamaguiHost>[0],
|
|
321
330
|
node.compilerNode as unknown as Parameters<typeof resolveTamaguiHost>[1]
|
|
322
331
|
)
|
|
323
|
-
if (!host
|
|
332
|
+
if (!host) return host
|
|
333
|
+
|
|
334
|
+
// The conversion resolves an authored shorthand to its longhand before asking
|
|
335
|
+
// the host, and `onlyAllowShorthands: true` omits exactly those longhands from
|
|
336
|
+
// the component's prop type. Asking about `borderRadius` on an app configured
|
|
337
|
+
// that way therefore answered "the runtime drops it" for `rounded="$3"`. Host
|
|
338
|
+
// validity is a question about the property, so any spelling of it answers.
|
|
339
|
+
const accepts = (property: string): boolean =>
|
|
340
|
+
host.accepts(property) ||
|
|
341
|
+
(shorthandSpellings.get(property)?.some((spelling) => host.accepts(spelling)) ??
|
|
342
|
+
false)
|
|
343
|
+
|
|
344
|
+
if (node.getText() !== 'View') return { ...host, accepts }
|
|
324
345
|
|
|
325
346
|
// Flat value typing deliberately admits arbitrary strings on narrow style
|
|
326
347
|
// props, so TypeScript alone can no longer distinguish Text-only styles on
|
|
@@ -328,7 +349,7 @@ function typeAwareHost(node: Node): HostView | undefined {
|
|
|
328
349
|
// this canonical primitive; styled(View, …) and direct <View> share it.
|
|
329
350
|
return {
|
|
330
351
|
...host,
|
|
331
|
-
accepts: (property) => !(property in stylePropsTextOnly) &&
|
|
352
|
+
accepts: (property) => !(property in stylePropsTextOnly) && accepts(property),
|
|
332
353
|
}
|
|
333
354
|
}
|
|
334
355
|
|