@tamagui/codemod-flat-values 3.0.0-beta.891.1 → 3.0.0-beta.907.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builtInNames.mjs +2 -1
- package/dist/builtInNames.mjs.map +1 -1
- package/dist/convert.mjs +97 -22
- package/dist/convert.mjs.map +1 -1
- package/dist/grammar.mjs +6 -1
- package/dist/grammar.mjs.map +1 -1
- package/dist/index.mjs +8 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/builtInNames.ts +2 -0
- package/src/convert.ts +141 -40
- package/src/grammar.ts +10 -0
- package/src/index.ts +20 -0
package/dist/builtInNames.mjs
CHANGED
|
@@ -2,7 +2,8 @@ import { v6ThemeNameReplacements } from "@tamagui/style-grammar/tooling";
|
|
|
2
2
|
|
|
3
3
|
const v6CodemodBuiltInNameReplacements = {
|
|
4
4
|
...v6ThemeNameReplacements,
|
|
5
|
-
backgroundActive: "background-press"
|
|
5
|
+
backgroundActive: "background-press",
|
|
6
|
+
true: "4"
|
|
6
7
|
};
|
|
7
8
|
const builtInTokenPattern = new RegExp(`\\$(${Object.keys(v6CodemodBuiltInNameReplacements).join("|")})(?![\\w-])`, "g");
|
|
8
9
|
function replaceV6BuiltInTokens(value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtInNames.js","names":[],"sources":["builtInNames.js"],"sourcesContent":["import { v6ThemeNameReplacements } from \"@tamagui/style-grammar/tooling\";\nconst v6CodemodBuiltInNameReplacements = {\n ...v6ThemeNameReplacements,\n // v3 removed backgroundActive after its component defaults had already\n // stopped resolving; press is the corrected active-state default\n backgroundActive: \"background-press\"\n};\nconst builtInTokenPattern = new RegExp(\n `\\\\$(${Object.keys(v6CodemodBuiltInNameReplacements).join(\"|\")})(?![\\\\w-])`,\n \"g\"\n);\nfunction replaceV6BuiltInTokens(value) {\n return value.replace(\n builtInTokenPattern,\n (_, name) => `$${v6CodemodBuiltInNameReplacements[name]}`\n );\n}\nexport {\n replaceV6BuiltInTokens,\n v6CodemodBuiltInNameReplacements\n};\n//# sourceMappingURL=builtInNames.js.map\n"],"mappings":";;;AACA,MAAM,mCAAmC;CACvC,GAAG;CAGH,kBAAkB;
|
|
1
|
+
{"version":3,"file":"builtInNames.js","names":[],"sources":["builtInNames.js"],"sourcesContent":["import { v6ThemeNameReplacements } from \"@tamagui/style-grammar/tooling\";\nconst v6CodemodBuiltInNameReplacements = {\n ...v6ThemeNameReplacements,\n // v3 removed backgroundActive after its component defaults had already\n // stopped resolving; press is the corrected active-state default\n backgroundActive: \"background-press\",\n // v3 configs no longer alias `true`; the default config pointed it at `4`\n true: \"4\"\n};\nconst builtInTokenPattern = new RegExp(\n `\\\\$(${Object.keys(v6CodemodBuiltInNameReplacements).join(\"|\")})(?![\\\\w-])`,\n \"g\"\n);\nfunction replaceV6BuiltInTokens(value) {\n return value.replace(\n builtInTokenPattern,\n (_, name) => `$${v6CodemodBuiltInNameReplacements[name]}`\n );\n}\nexport {\n replaceV6BuiltInTokens,\n v6CodemodBuiltInNameReplacements\n};\n//# sourceMappingURL=builtInNames.js.map\n"],"mappings":";;;AACA,MAAM,mCAAmC;CACvC,GAAG;CAGH,kBAAkB;CAElB,MAAM;AACR;AACA,MAAM,sBAAsB,IAAI,OAC9B,OAAO,OAAO,KAAK,gCAAgC,CAAC,CAAC,KAAK,GAAG,EAAE,cAC/D,GACF;AACA,SAAS,uBAAuB,OAAO;CACrC,OAAO,MAAM,QACX,sBACC,GAAG,SAAS,IAAI,iCAAiC,OACpD;AACF"}
|
package/dist/convert.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Node, SyntaxKind } from "ts-morph";
|
|
2
2
|
import { compact, literalTree, numericValue, runtimeType, staticLeafValue, unwrapExpression } from "./expressions.mjs";
|
|
3
|
-
import { assessFlatConversion, convertLegacyConditionProp, expandToLonghands, flatStringValue, mergeProgramValues, parseValue, printProgram, resolveProp, sharedPayload, shorthands, styleProps, unitSuffix } from "./grammar.mjs";
|
|
3
|
+
import { assessFlatConversion, convertLegacyConditionProp, expandToLonghands, flatStringValue, mergeProgramValues, parseValue, printProgram, resolveProp, sharedPayload, shorthands, styleProps, tokenVariantProps, unitSuffix } from "./grammar.mjs";
|
|
4
4
|
import { isLegacyConditionName, resolveLegacyName } from "./legacyNames.mjs";
|
|
5
5
|
import { classifyStructuredNativeValue } from "./structuredNative.mjs";
|
|
6
6
|
|
|
@@ -23,6 +23,7 @@ function createSite(kind, registry, containers, targets, host) {
|
|
|
23
23
|
members: [],
|
|
24
24
|
comments: /* @__PURE__ */ new Map(),
|
|
25
25
|
extras: [],
|
|
26
|
+
respelled: [],
|
|
26
27
|
warnings: [],
|
|
27
28
|
flags: [],
|
|
28
29
|
inventory: [],
|
|
@@ -54,6 +55,9 @@ function addAssessment(site, property, assessment) {
|
|
|
54
55
|
});
|
|
55
56
|
}
|
|
56
57
|
}
|
|
58
|
+
function isConvertedName(name) {
|
|
59
|
+
return name === "group" || styleProps.has(name) || tokenVariantProps.has(name) || isLegacyConditionName(name);
|
|
60
|
+
}
|
|
57
61
|
function addFlag(list, code, detail) {
|
|
58
62
|
if (!list.some((flag) => flag.code === code && flag.detail === detail)) {
|
|
59
63
|
list.push({
|
|
@@ -66,25 +70,34 @@ function addNote(site, note) {
|
|
|
66
70
|
if (!site.notes.includes(note)) site.notes.push(note);
|
|
67
71
|
}
|
|
68
72
|
const 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;
|
|
69
|
-
|
|
73
|
+
const legacyTrueTokenPattern = /(?:^|[^\w-])\$true(?![\w-])/;
|
|
74
|
+
function legacyTokenWarnings(prop, values) {
|
|
75
|
+
const warnings = [];
|
|
76
|
+
if (values.some((value) => legacyTrueTokenPattern.test(value))) {
|
|
77
|
+
warnings.push({
|
|
78
|
+
code: "legacy-true-token",
|
|
79
|
+
detail: `${prop} spelled the \`$true\` alias, written as \`4\` because the default config aliased it there; confirm the app's tokens agree`
|
|
80
|
+
});
|
|
81
|
+
}
|
|
70
82
|
const names = /* @__PURE__ */ new Set();
|
|
71
83
|
for (const value of values) {
|
|
72
84
|
legacyPaletteStepPattern.lastIndex = 0;
|
|
73
85
|
for (const match of value.matchAll(legacyPaletteStepPattern)) names.add(match[1]);
|
|
74
86
|
}
|
|
75
|
-
if (!names.size) return
|
|
87
|
+
if (!names.size) return warnings;
|
|
76
88
|
const formatted = [...names].sort().map((name) => `\`${name}\``).join(", ");
|
|
77
|
-
|
|
89
|
+
warnings.push({
|
|
78
90
|
code: "legacy-palette-token",
|
|
79
91
|
detail: `${prop} preserves ${formatted}, which @tamagui/config/v6 does not define; choose an absolute palette token or an adaptive colorN value`
|
|
80
|
-
};
|
|
92
|
+
});
|
|
93
|
+
return warnings;
|
|
81
94
|
}
|
|
82
95
|
const empty = {
|
|
83
96
|
payload: null,
|
|
84
97
|
text: null,
|
|
85
98
|
dynamic: false,
|
|
86
99
|
problem: null,
|
|
87
|
-
|
|
100
|
+
warnings: [],
|
|
88
101
|
blocked: null,
|
|
89
102
|
inventory: null
|
|
90
103
|
};
|
|
@@ -144,7 +157,7 @@ function classifyDynamic(prop, expression, registry) {
|
|
|
144
157
|
payload: interpolate(prop, tree.text, tree.kind, registry),
|
|
145
158
|
text: rewrittenTokenText,
|
|
146
159
|
dynamic: true,
|
|
147
|
-
|
|
160
|
+
warnings: legacyTokenWarnings(prop, tree.strings)
|
|
148
161
|
};
|
|
149
162
|
}
|
|
150
163
|
if (tree) {
|
|
@@ -207,8 +220,9 @@ function classifyDynamic(prop, expression, registry) {
|
|
|
207
220
|
function pushBase(site, prop, text, value, literalString) {
|
|
208
221
|
const index = site.index++;
|
|
209
222
|
if (literalString !== null) {
|
|
210
|
-
const warning
|
|
211
|
-
|
|
223
|
+
for (const warning of legacyTokenWarnings(prop, [literalString])) {
|
|
224
|
+
addFlag(site.warnings, warning.code, warning.detail);
|
|
225
|
+
}
|
|
212
226
|
if (literalString.includes("$")) {
|
|
213
227
|
site.legacy = true;
|
|
214
228
|
const allowed2 = assessProgram(site, prop, []);
|
|
@@ -305,8 +319,8 @@ function pushBase(site, prop, text, value, literalString) {
|
|
|
305
319
|
site.legacy = true;
|
|
306
320
|
addFlag(site.flags, classified.problem.code, classified.problem.detail);
|
|
307
321
|
}
|
|
308
|
-
|
|
309
|
-
addFlag(site.warnings,
|
|
322
|
+
for (const warning of classified.warnings) {
|
|
323
|
+
addFlag(site.warnings, warning.code, warning.detail);
|
|
310
324
|
}
|
|
311
325
|
if (classified.inventory) {
|
|
312
326
|
addFlag(site.inventory, classified.inventory.code, classified.inventory.detail);
|
|
@@ -481,8 +495,8 @@ function pushLegacy(site, name, text, initializer, node) {
|
|
|
481
495
|
for (let index2 = 0; index2 < evaluated.leaves.length; index2++) {
|
|
482
496
|
const leaf = evaluated.leaves[index2];
|
|
483
497
|
const classified = classifyDynamic(leaf.prop, leaf.expression, site.registry);
|
|
484
|
-
|
|
485
|
-
addFlag(site.warnings,
|
|
498
|
+
for (const warning of classified.warnings) {
|
|
499
|
+
addFlag(site.warnings, warning.code, `${leaf.path}: ${warning.detail}`);
|
|
486
500
|
}
|
|
487
501
|
if (classified.payload === null) {
|
|
488
502
|
const flag = classified.problem ?? classified.blocked;
|
|
@@ -871,7 +885,7 @@ function isConvertedJsxAttribute(attribute) {
|
|
|
871
885
|
if (Node.isJsxSpreadAttribute(attribute)) return true;
|
|
872
886
|
if (!Node.isJsxAttribute(attribute)) return false;
|
|
873
887
|
const name = jsxAttributeName(attribute);
|
|
874
|
-
return !!name && (name
|
|
888
|
+
return !!name && isConvertedName(name);
|
|
875
889
|
}
|
|
876
890
|
function rewriteJsxSite(opening, entries) {
|
|
877
891
|
const attributes = opening.getAttributes();
|
|
@@ -921,7 +935,7 @@ function convertJsxSite(opening, registry, containers, targets, host, write = fa
|
|
|
921
935
|
if (Node.isPropertyAssignment(property)) {
|
|
922
936
|
const name2 = propertyName(property.getNameNode());
|
|
923
937
|
if (name2 !== null) {
|
|
924
|
-
if (
|
|
938
|
+
if (isConvertedName(name2)) {
|
|
925
939
|
pushStyledProperty(site, name2, property, `${name2}={${property.getInitializerOrThrow().getText()}}`);
|
|
926
940
|
} else {
|
|
927
941
|
site.members.push({
|
|
@@ -967,6 +981,10 @@ function convertJsxSite(opening, registry, containers, targets, host, write = fa
|
|
|
967
981
|
pushLegacy(site, name, text, jsxExpression(attribute), attribute);
|
|
968
982
|
continue;
|
|
969
983
|
}
|
|
984
|
+
if (tokenVariantProps.has(name)) {
|
|
985
|
+
if (pushTokenVariant(site, name, attribute, text)) before.push(text);
|
|
986
|
+
continue;
|
|
987
|
+
}
|
|
970
988
|
if (!styleProps.has(name)) continue;
|
|
971
989
|
before.push(text);
|
|
972
990
|
const literal = jsxLiteralString(attribute);
|
|
@@ -981,7 +999,7 @@ function convertJsxSite(opening, registry, containers, targets, host, write = fa
|
|
|
981
999
|
line: sourceFile.getLineAndColumnAtPos(opening.getStart()).line,
|
|
982
1000
|
before: before.join(" "),
|
|
983
1001
|
after: entries.map((entry) => entry.text).join(" ") || "(no style props left)",
|
|
984
|
-
programs,
|
|
1002
|
+
programs: [...programs, ...site.respelled],
|
|
985
1003
|
assessments: site.assessments,
|
|
986
1004
|
assessmentVerdict: assessmentVerdict(site.assessments),
|
|
987
1005
|
warnings: site.warnings,
|
|
@@ -1014,10 +1032,67 @@ function pushStyledProperty(site, name, property, authoredText) {
|
|
|
1014
1032
|
pushLegacy(site, name, text, initializer, property);
|
|
1015
1033
|
return;
|
|
1016
1034
|
}
|
|
1035
|
+
if (tokenVariantProps.has(name)) {
|
|
1036
|
+
pushTokenVariant(site, name, property, text);
|
|
1037
|
+
return;
|
|
1038
|
+
}
|
|
1017
1039
|
if (!styleProps.has(name)) return;
|
|
1018
1040
|
const literal = Node.isStringLiteral(initializer) || Node.isNoSubstitutionTemplateLiteral(initializer) ? initializer.getLiteralValue() : null;
|
|
1019
1041
|
pushBase(site, name, text, literal === null ? initializer : null, literal);
|
|
1020
1042
|
}
|
|
1043
|
+
function pushTokenVariant(site, name, node, text) {
|
|
1044
|
+
const index = site.index++;
|
|
1045
|
+
const initializer = node.getInitializer();
|
|
1046
|
+
const value = initializer !== void 0 && Node.isJsxExpression(initializer) ? initializer.getExpression() : initializer;
|
|
1047
|
+
const literals = value === void 0 ? [] : [value, ...value.getDescendants()].filter((candidate) => (Node.isStringLiteral(candidate) || Node.isNoSubstitutionTemplateLiteral(candidate)) && candidate.getLiteralValue().startsWith("$"));
|
|
1048
|
+
if (value === void 0 || literals.length === 0) {
|
|
1049
|
+
site.members.push({
|
|
1050
|
+
type: "passthrough",
|
|
1051
|
+
index,
|
|
1052
|
+
text
|
|
1053
|
+
});
|
|
1054
|
+
return false;
|
|
1055
|
+
}
|
|
1056
|
+
const source = value.getText();
|
|
1057
|
+
const start = value.getStart();
|
|
1058
|
+
let rewritten = "";
|
|
1059
|
+
let cursor = start;
|
|
1060
|
+
for (const literal of literals) {
|
|
1061
|
+
let replacement = "true";
|
|
1062
|
+
if (literal.getLiteralValue() !== "$true") {
|
|
1063
|
+
const flat = flatStringValue(literal.getLiteralValue(), site.registry);
|
|
1064
|
+
if (flat.text === null) {
|
|
1065
|
+
site.legacy = true;
|
|
1066
|
+
addFlag(site.flags, flat.error?.code ?? "unsupported-legacy-value", `${name}: ${flat.error?.message ?? `${literal.getText()} has no flat spelling`}`);
|
|
1067
|
+
site.members.push({
|
|
1068
|
+
type: "passthrough",
|
|
1069
|
+
index,
|
|
1070
|
+
text
|
|
1071
|
+
});
|
|
1072
|
+
return true;
|
|
1073
|
+
}
|
|
1074
|
+
const quote = literal.getText()[0];
|
|
1075
|
+
replacement = `${quote}${flat.text}${quote}`;
|
|
1076
|
+
}
|
|
1077
|
+
rewritten += source.slice(cursor - start, literal.getStart() - start);
|
|
1078
|
+
rewritten += replacement;
|
|
1079
|
+
cursor = literal.getEnd();
|
|
1080
|
+
}
|
|
1081
|
+
rewritten += source.slice(cursor - start);
|
|
1082
|
+
site.legacy = true;
|
|
1083
|
+
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}`);
|
|
1084
|
+
site.members.push({
|
|
1085
|
+
type: "passthrough",
|
|
1086
|
+
index,
|
|
1087
|
+
text: output
|
|
1088
|
+
});
|
|
1089
|
+
site.respelled.push({
|
|
1090
|
+
name,
|
|
1091
|
+
value: rewritten,
|
|
1092
|
+
dynamic: literals.length !== 1 || literals[0] !== value
|
|
1093
|
+
});
|
|
1094
|
+
return true;
|
|
1095
|
+
}
|
|
1021
1096
|
function convertStyleObject(object, kind, label, registry, containers, targets, host, write = false) {
|
|
1022
1097
|
const site = createSite(kind, registry, containers, targets, host);
|
|
1023
1098
|
const before = [];
|
|
@@ -1030,7 +1105,7 @@ function convertStyleObject(object, kind, label, registry, containers, targets,
|
|
|
1030
1105
|
if (Node.isPropertyAssignment(nested)) {
|
|
1031
1106
|
const name2 = propertyName(nested.getNameNode());
|
|
1032
1107
|
if (name2 !== null) {
|
|
1033
|
-
if (
|
|
1108
|
+
if (isConvertedName(name2)) {
|
|
1034
1109
|
pushStyledProperty(site, name2, nested);
|
|
1035
1110
|
} else {
|
|
1036
1111
|
site.members.push({
|
|
@@ -1065,7 +1140,7 @@ function convertStyleObject(object, kind, label, registry, containers, targets,
|
|
|
1065
1140
|
}
|
|
1066
1141
|
const name = propertyName(nameNode);
|
|
1067
1142
|
if (name === null) continue;
|
|
1068
|
-
if (!
|
|
1143
|
+
if (!isConvertedName(name)) continue;
|
|
1069
1144
|
before.push(compact(property.getText()));
|
|
1070
1145
|
pushStyledProperty(site, name, property);
|
|
1071
1146
|
}
|
|
@@ -1078,7 +1153,7 @@ function convertStyleObject(object, kind, label, registry, containers, targets,
|
|
|
1078
1153
|
line: sourceFile.getLineAndColumnAtPos(object.getStart()).line,
|
|
1079
1154
|
before: before.join(", "),
|
|
1080
1155
|
after: entries.map((entry) => entry.text).join(", ") || "(no style props left)",
|
|
1081
|
-
programs,
|
|
1156
|
+
programs: [...programs, ...site.respelled],
|
|
1082
1157
|
assessments: site.assessments,
|
|
1083
1158
|
assessmentVerdict: assessmentVerdict(site.assessments),
|
|
1084
1159
|
warnings: site.warnings,
|
|
@@ -1099,7 +1174,7 @@ function isConvertedStyledProperty(property) {
|
|
|
1099
1174
|
const nameNode = property.getNameNode();
|
|
1100
1175
|
if (Node.isComputedPropertyName(nameNode)) return false;
|
|
1101
1176
|
const name = propertyName(nameNode);
|
|
1102
|
-
return !!name && (name
|
|
1177
|
+
return !!name && isConvertedName(name);
|
|
1103
1178
|
}
|
|
1104
1179
|
function allCommentTexts(node) {
|
|
1105
1180
|
const comments = /* @__PURE__ */ new Map();
|
|
@@ -1110,13 +1185,13 @@ function allCommentTexts(node) {
|
|
|
1110
1185
|
}
|
|
1111
1186
|
return [...comments.entries()].sort((left, right) => left[0] - right[0]).map((entry) => entry[1]);
|
|
1112
1187
|
}
|
|
1113
|
-
function textWithOuterComments(node) {
|
|
1188
|
+
function textWithOuterComments(node, text = node.getText()) {
|
|
1114
1189
|
const comments = /* @__PURE__ */ new Map();
|
|
1115
1190
|
for (const range of [...node.getLeadingCommentRanges(), ...node.getTrailingCommentRanges()]) {
|
|
1116
1191
|
comments.set(range.getPos(), range.getText());
|
|
1117
1192
|
}
|
|
1118
1193
|
const prefix = [...comments.entries()].sort((left, right) => left[0] - right[0]).map((entry) => entry[1]);
|
|
1119
|
-
return [...prefix,
|
|
1194
|
+
return [...prefix, text].join("\n ");
|
|
1120
1195
|
}
|
|
1121
1196
|
function rewriteStyleObject(object, entries) {
|
|
1122
1197
|
const rendered = [];
|
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 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 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 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;\nfunction legacyPaletteStepWarning(prop, values) {\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 null;\n const formatted = [...names].sort().map((name) => `\\`${name}\\``).join(\", \");\n return {\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}\nconst empty = {\n payload: null,\n text: null,\n dynamic: false,\n problem: null,\n warning: null,\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 warning: legacyPaletteStepWarning(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 const warning = legacyPaletteStepWarning(prop, [literalString]);\n if (warning) addFlag(site.warnings, warning.code, warning.detail);\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 if (classified.warning) {\n addFlag(site.warnings, classified.warning.code, classified.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 if (classified.warning) {\n addFlag(\n site.warnings,\n classified.warning.code,\n `${leaf.path}: ${classified.warning.detail}`\n );\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 && (name === \"group\" || styleProps.has(name) || isLegacyConditionName(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 (name2 === \"group\" || styleProps.has(name2) || isLegacyConditionName(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 (!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,\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 (!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 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 (name2 === \"group\" || styleProps.has(name2) || isLegacyConditionName(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 (!styleProps.has(name) && !isLegacyConditionName(name) && name !== \"group\")\n 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,\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 && (name === \"group\" || styleProps.has(name) || isLegacyConditionName(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) {\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, node.getText()].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":";;;;;;;AA4BA,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,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GAAG,SAAS,QAAQ,CAAC,CAAC,CAAC,MAAM,MAAM,UAAU,KAAK,KAAK,MAAM,EAAE,CAAC,CAAC,KAAK,UAAU,MAAM,EAAE;CACxG,OAAO,CAAC,GAAG,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,IAAI;AAC9C;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 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,gBAA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object.keys(shorthands),
|
|
27
27
|
...Object.values(shorthands)
|
|
28
28
|
]);
|
|
29
|
+
const tokenVariantProps = /* @__PURE__ */ new Set([
|
|
30
|
+
"size",
|
|
31
|
+
"elevation",
|
|
32
|
+
"iconSize"
|
|
33
|
+
]);
|
|
29
34
|
const codemodMediaNames = [
|
|
30
35
|
...defaultMediaKeys,
|
|
31
36
|
"motionReduce",
|
|
@@ -64,5 +69,5 @@ function unitSuffix(prop, registry) {
|
|
|
64
69
|
}
|
|
65
70
|
const printProgram = grammar.formatParsedValue;
|
|
66
71
|
|
|
67
|
-
export { assessFlatConversion, codemodMediaNames, convertLegacyConditionProp, createModifierRegistry, defaultMediaKeys, evaluateProgram, expandToLonghands, flatStringValue, grammarEntries, grammarPlatformNames, legacyPartComposite, mergeProgramValues, parseTransformString, parseValue, printProgram, programEligibility, pseudoToModifier, resolveProp, sharedPayload, shorthands, standaloneValueProps, styleProps, unitSuffix };
|
|
72
|
+
export { assessFlatConversion, codemodMediaNames, convertLegacyConditionProp, createModifierRegistry, defaultMediaKeys, evaluateProgram, expandToLonghands, flatStringValue, grammarEntries, grammarPlatformNames, legacyPartComposite, mergeProgramValues, parseTransformString, parseValue, printProgram, programEligibility, pseudoToModifier, resolveProp, sharedPayload, shorthands, standaloneValueProps, styleProps, tokenVariantProps, unitSuffix };
|
|
68
73
|
//# sourceMappingURL=grammar.mjs.map
|
package/dist/grammar.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grammar.js","names":["convertLegacyConditionPropLocal"],"sources":["grammar.js"],"sourcesContent":["import { stylePropsAll } from \"@tamagui/helpers\";\nimport { shorthands } from \"@tamagui/shorthands/v6\";\nimport * as styleGrammarTooling from \"@tamagui/style-grammar/tooling\";\nimport { replaceV6BuiltInTokens } from \"./builtInNames\";\nimport {\n convertLegacyConditionProp as convertLegacyConditionPropLocal,\n pseudoToModifier\n} from \"./legacyConditions\";\nconst grammar = styleGrammarTooling;\nconst {\n assessFlatConversion,\n createModifierRegistry,\n defaultMediaKeys,\n evaluateProgram,\n expandToLonghands,\n grammarEntries,\n grammarPlatformNames,\n legacyPartComposite,\n mergeProgramValues,\n parseValue,\n programEligibility,\n standaloneValueProps,\n parseTransformString\n} = grammar;\nfunction renameBuiltInTokens(value) {\n if (typeof value === \"string\") return replaceV6BuiltInTokens(value);\n if (Array.isArray(value)) return value.map(renameBuiltInTokens);\n if (value === null || typeof value !== \"object\") return value;\n const renamed = {};\n for (const key in value) {\n renamed[key] = renameBuiltInTokens(value[key]);\n }\n return renamed;\n}\nfunction convertLegacyConditionProp(propName, value, options) {\n return convertLegacyConditionPropLocal(propName, renameBuiltInTokens(value), options);\n}\nconst styleProps = /* @__PURE__ */ new Set([\n ...grammarEntries.map((entry) => entry.prop),\n ...Object.keys(standaloneValueProps),\n ...Object.keys(stylePropsAll),\n ...Object.keys(shorthands),\n ...Object.values(shorthands)\n]);\nconst codemodMediaNames = [\n ...defaultMediaKeys,\n \"motionReduce\",\n \"motionSafe\"\n];\nfunction resolveProp(prop) {\n return shorthands[prop] ?? prop;\n}\nconst payloadProbeCondition = \"$platform-web\";\nfunction sharedPayload(prop, value, registry) {\n const converted = convertLegacyConditionProp(\n payloadProbeCondition,\n { [prop]: value },\n { registry }\n );\n if (converted === null) {\n throw new Error(\n `the payload probe condition \"${payloadProbeCondition}\" is unregistered`\n );\n }\n return {\n payload: converted.contributions[0]?.clause.payload ?? null,\n errors: converted.errors\n };\n}\nconst stringProbeProp = \"color\";\nfunction flatStringValue(value, registry) {\n const probe = sharedPayload(stringProbeProp, value, registry);\n return { text: probe.payload, error: probe.errors[0] ?? null };\n}\nconst unitSuffixes = /* @__PURE__ */ new Map();\nfunction unitSuffix(prop, registry) {\n const cached = unitSuffixes.get(prop);\n if (cached !== void 0) return cached;\n const probe = sharedPayload(prop, 1, registry);\n const suffix = probe.payload !== null && probe.payload.startsWith(\"1\") ? probe.payload.slice(1) : \"\";\n unitSuffixes.set(prop, suffix);\n return suffix;\n}\nconst printProgram = grammar.formatParsedValue;\nexport {\n assessFlatConversion,\n codemodMediaNames,\n convertLegacyConditionProp,\n createModifierRegistry,\n defaultMediaKeys,\n evaluateProgram,\n expandToLonghands,\n flatStringValue,\n grammarEntries,\n grammarPlatformNames,\n legacyPartComposite,\n mergeProgramValues,\n parseTransformString,\n parseValue,\n printProgram,\n programEligibility,\n pseudoToModifier,\n resolveProp,\n sharedPayload,\n shorthands,\n standaloneValueProps,\n styleProps,\n unitSuffix\n};\n//# sourceMappingURL=grammar.js.map\n"],"mappings":";;;;;;;AAQA,MAAM,UAAU;AAChB,MAAM,EACJ,sBACA,wBACA,kBACA,iBACA,mBACA,gBACA,sBACA,qBACA,oBACA,YACA,oBACA,sBACA,yBACE;AACJ,SAAS,oBAAoB,OAAO;CAClC,IAAI,OAAO,UAAU,UAAU,OAAO,uBAAuB,KAAK;CAClE,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,IAAI,mBAAmB;CAC9D,IAAI,UAAU,QAAQ,OAAO,UAAU,UAAU,OAAO;CACxD,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,OAAO,OAAO;EACvB,QAAQ,OAAO,oBAAoB,MAAM,IAAI;CAC/C;CACA,OAAO;AACT;AACA,SAAS,2BAA2B,UAAU,OAAO,SAAS;CAC5D,OAAOA,6BAAgC,UAAU,oBAAoB,KAAK,GAAG,OAAO;AACtF;AACA,MAAM,6BAA6B,IAAI,IAAI;CACzC,GAAG,eAAe,KAAK,UAAU,MAAM,IAAI;CAC3C,GAAG,OAAO,KAAK,oBAAoB;CACnC,GAAG,OAAO,KAAK,aAAa;CAC5B,GAAG,OAAO,KAAK,UAAU;CACzB,GAAG,OAAO,OAAO,UAAU;AAC7B,CAAC;AACD,MAAM,oBAAoB;CACxB,GAAG;CACH;CACA;AACF;AACA,SAAS,YAAY,MAAM;CACzB,OAAO,WAAW,SAAS;AAC7B;AACA,MAAM,wBAAwB;AAC9B,SAAS,cAAc,MAAM,OAAO,UAAU;CAC5C,MAAM,YAAY,2BAChB,uBACA,GAAG,OAAO,MAAM,GAChB,EAAE,SAAS,CACb;CACA,IAAI,cAAc,MAAM;EACtB,MAAM,IAAI,MACR,gCAAgC,sBAAsB,kBACxD;CACF;CACA,OAAO;EACL,SAAS,UAAU,cAAc,EAAE,EAAE,OAAO,WAAW;EACvD,QAAQ,UAAU;CACpB;AACF;AACA,MAAM,kBAAkB;AACxB,SAAS,gBAAgB,OAAO,UAAU;CACxC,MAAM,QAAQ,cAAc,iBAAiB,OAAO,QAAQ;CAC5D,OAAO;EAAE,MAAM,MAAM;EAAS,OAAO,MAAM,OAAO,MAAM;CAAK;AAC/D;AACA,MAAM,+BAA+B,IAAI,IAAI;AAC7C,SAAS,WAAW,MAAM,UAAU;CAClC,MAAM,SAAS,aAAa,IAAI,IAAI;CACpC,IAAI,WAAW,KAAK,GAAG,OAAO;CAC9B,MAAM,QAAQ,cAAc,MAAM,GAAG,QAAQ;CAC7C,MAAM,SAAS,MAAM,YAAY,QAAQ,MAAM,QAAQ,WAAW,GAAG,IAAI,MAAM,QAAQ,MAAM,CAAC,IAAI;CAClG,aAAa,IAAI,MAAM,MAAM;CAC7B,OAAO;AACT;AACA,MAAM,eAAe,QAAQ"}
|
|
1
|
+
{"version":3,"file":"grammar.js","names":["convertLegacyConditionPropLocal"],"sources":["grammar.js"],"sourcesContent":["import { stylePropsAll } from \"@tamagui/helpers\";\nimport { shorthands } from \"@tamagui/shorthands/v6\";\nimport * as styleGrammarTooling from \"@tamagui/style-grammar/tooling\";\nimport { replaceV6BuiltInTokens } from \"./builtInNames\";\nimport {\n convertLegacyConditionProp as convertLegacyConditionPropLocal,\n pseudoToModifier\n} from \"./legacyConditions\";\nconst grammar = styleGrammarTooling;\nconst {\n assessFlatConversion,\n createModifierRegistry,\n defaultMediaKeys,\n evaluateProgram,\n expandToLonghands,\n grammarEntries,\n grammarPlatformNames,\n legacyPartComposite,\n mergeProgramValues,\n parseValue,\n programEligibility,\n standaloneValueProps,\n parseTransformString\n} = grammar;\nfunction renameBuiltInTokens(value) {\n if (typeof value === \"string\") return replaceV6BuiltInTokens(value);\n if (Array.isArray(value)) return value.map(renameBuiltInTokens);\n if (value === null || typeof value !== \"object\") return value;\n const renamed = {};\n for (const key in value) {\n renamed[key] = renameBuiltInTokens(value[key]);\n }\n return renamed;\n}\nfunction convertLegacyConditionProp(propName, value, options) {\n return convertLegacyConditionPropLocal(propName, renameBuiltInTokens(value), options);\n}\nconst styleProps = /* @__PURE__ */ new Set([\n ...grammarEntries.map((entry) => entry.prop),\n ...Object.keys(standaloneValueProps),\n ...Object.keys(stylePropsAll),\n ...Object.keys(shorthands),\n ...Object.values(shorthands)\n]);\nconst tokenVariantProps = /* @__PURE__ */ new Set([\n \"size\",\n \"elevation\",\n \"iconSize\"\n]);\nconst codemodMediaNames = [\n ...defaultMediaKeys,\n \"motionReduce\",\n \"motionSafe\"\n];\nfunction resolveProp(prop) {\n return shorthands[prop] ?? prop;\n}\nconst payloadProbeCondition = \"$platform-web\";\nfunction sharedPayload(prop, value, registry) {\n const converted = convertLegacyConditionProp(\n payloadProbeCondition,\n { [prop]: value },\n { registry }\n );\n if (converted === null) {\n throw new Error(\n `the payload probe condition \"${payloadProbeCondition}\" is unregistered`\n );\n }\n return {\n payload: converted.contributions[0]?.clause.payload ?? null,\n errors: converted.errors\n };\n}\nconst stringProbeProp = \"color\";\nfunction flatStringValue(value, registry) {\n const probe = sharedPayload(stringProbeProp, value, registry);\n return { text: probe.payload, error: probe.errors[0] ?? null };\n}\nconst unitSuffixes = /* @__PURE__ */ new Map();\nfunction unitSuffix(prop, registry) {\n const cached = unitSuffixes.get(prop);\n if (cached !== void 0) return cached;\n const probe = sharedPayload(prop, 1, registry);\n const suffix = probe.payload !== null && probe.payload.startsWith(\"1\") ? probe.payload.slice(1) : \"\";\n unitSuffixes.set(prop, suffix);\n return suffix;\n}\nconst printProgram = grammar.formatParsedValue;\nexport {\n assessFlatConversion,\n codemodMediaNames,\n convertLegacyConditionProp,\n createModifierRegistry,\n defaultMediaKeys,\n evaluateProgram,\n expandToLonghands,\n flatStringValue,\n grammarEntries,\n grammarPlatformNames,\n legacyPartComposite,\n mergeProgramValues,\n parseTransformString,\n parseValue,\n printProgram,\n programEligibility,\n pseudoToModifier,\n resolveProp,\n sharedPayload,\n shorthands,\n standaloneValueProps,\n styleProps,\n tokenVariantProps,\n unitSuffix\n};\n//# sourceMappingURL=grammar.js.map\n"],"mappings":";;;;;;;AAQA,MAAM,UAAU;AAChB,MAAM,EACJ,sBACA,wBACA,kBACA,iBACA,mBACA,gBACA,sBACA,qBACA,oBACA,YACA,oBACA,sBACA,yBACE;AACJ,SAAS,oBAAoB,OAAO;CAClC,IAAI,OAAO,UAAU,UAAU,OAAO,uBAAuB,KAAK;CAClE,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,IAAI,mBAAmB;CAC9D,IAAI,UAAU,QAAQ,OAAO,UAAU,UAAU,OAAO;CACxD,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,OAAO,OAAO;EACvB,QAAQ,OAAO,oBAAoB,MAAM,IAAI;CAC/C;CACA,OAAO;AACT;AACA,SAAS,2BAA2B,UAAU,OAAO,SAAS;CAC5D,OAAOA,6BAAgC,UAAU,oBAAoB,KAAK,GAAG,OAAO;AACtF;AACA,MAAM,6BAA6B,IAAI,IAAI;CACzC,GAAG,eAAe,KAAK,UAAU,MAAM,IAAI;CAC3C,GAAG,OAAO,KAAK,oBAAoB;CACnC,GAAG,OAAO,KAAK,aAAa;CAC5B,GAAG,OAAO,KAAK,UAAU;CACzB,GAAG,OAAO,OAAO,UAAU;AAC7B,CAAC;AACD,MAAM,oCAAoC,IAAI,IAAI;CAChD;CACA;CACA;AACF,CAAC;AACD,MAAM,oBAAoB;CACxB,GAAG;CACH;CACA;AACF;AACA,SAAS,YAAY,MAAM;CACzB,OAAO,WAAW,SAAS;AAC7B;AACA,MAAM,wBAAwB;AAC9B,SAAS,cAAc,MAAM,OAAO,UAAU;CAC5C,MAAM,YAAY,2BAChB,uBACA,GAAG,OAAO,MAAM,GAChB,EAAE,SAAS,CACb;CACA,IAAI,cAAc,MAAM;EACtB,MAAM,IAAI,MACR,gCAAgC,sBAAsB,kBACxD;CACF;CACA,OAAO;EACL,SAAS,UAAU,cAAc,EAAE,EAAE,OAAO,WAAW;EACvD,QAAQ,UAAU;CACpB;AACF;AACA,MAAM,kBAAkB;AACxB,SAAS,gBAAgB,OAAO,UAAU;CACxC,MAAM,QAAQ,cAAc,iBAAiB,OAAO,QAAQ;CAC5D,OAAO;EAAE,MAAM,MAAM;EAAS,OAAO,MAAM,OAAO,MAAM;CAAK;AAC/D;AACA,MAAM,+BAA+B,IAAI,IAAI;AAC7C,SAAS,WAAW,MAAM,UAAU;CAClC,MAAM,SAAS,aAAa,IAAI,IAAI;CACpC,IAAI,WAAW,KAAK,GAAG,OAAO;CAC9B,MAAM,QAAQ,cAAc,MAAM,GAAG,QAAQ;CAC7C,MAAM,SAAS,MAAM,YAAY,QAAQ,MAAM,QAAQ,WAAW,GAAG,IAAI,MAAM,QAAQ,MAAM,CAAC,IAAI;CAClG,aAAa,IAAI,MAAM,MAAM;CAC7B,OAAO;AACT;AACA,MAAM,eAAe,QAAQ"}
|
package/dist/index.mjs
CHANGED
|
@@ -146,6 +146,14 @@ function variantStyleObjects(value) {
|
|
|
146
146
|
}
|
|
147
147
|
function variantSites(config, label, registry, containers, targets, host, write2) {
|
|
148
148
|
const sites = [];
|
|
149
|
+
const defaults = config.getProperty("defaultVariants");
|
|
150
|
+
if (Node.isPropertyAssignment(defaults)) {
|
|
151
|
+
const object = unwrapExpression(defaults.getInitializerOrThrow());
|
|
152
|
+
if (Node.isObjectLiteralExpression(object)) {
|
|
153
|
+
const site = convertStyleObject(object, "styled", `${label} defaultVariants`, registry, containers, targets, host, write2);
|
|
154
|
+
if (site) sites.push(site);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
149
157
|
const variants = config.getProperty("variants");
|
|
150
158
|
if (Node.isPropertyAssignment(variants)) {
|
|
151
159
|
const object = unwrapExpression(variants.getInitializerOrThrow());
|
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 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,MA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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} 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,a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
+
"version": "3.0.0-beta.907.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.907.1",
|
|
30
|
+
"@tamagui/language-service": "3.0.0-beta.907.1",
|
|
31
|
+
"@tamagui/shorthands": "3.0.0-beta.907.1",
|
|
32
|
+
"@tamagui/style-grammar": "3.0.0-beta.907.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.907.1",
|
|
37
37
|
"typescript": "~6.0.3"
|
|
38
38
|
},
|
|
39
39
|
"repository": {
|
package/src/builtInNames.ts
CHANGED
|
@@ -5,6 +5,8 @@ export const v6CodemodBuiltInNameReplacements = {
|
|
|
5
5
|
// v3 removed backgroundActive after its component defaults had already
|
|
6
6
|
// stopped resolving; press is the corrected active-state default
|
|
7
7
|
backgroundActive: 'background-press',
|
|
8
|
+
// v3 configs no longer alias `true`; the default config pointed it at `4`
|
|
9
|
+
true: '4',
|
|
8
10
|
} as const
|
|
9
11
|
|
|
10
12
|
const builtInTokenPattern = new RegExp(
|
package/src/convert.ts
CHANGED
|
@@ -21,8 +21,10 @@ import {
|
|
|
21
21
|
type JsxAttribute,
|
|
22
22
|
type JsxOpeningElement,
|
|
23
23
|
type JsxSelfClosingElement,
|
|
24
|
+
type NoSubstitutionTemplateLiteral,
|
|
24
25
|
type ObjectLiteralExpression,
|
|
25
26
|
type PropertyAssignment,
|
|
27
|
+
type StringLiteral,
|
|
26
28
|
} from 'ts-morph'
|
|
27
29
|
import type { ContainerPlan } from './containers'
|
|
28
30
|
import {
|
|
@@ -45,6 +47,7 @@ import {
|
|
|
45
47
|
sharedPayload,
|
|
46
48
|
shorthands,
|
|
47
49
|
styleProps,
|
|
50
|
+
tokenVariantProps,
|
|
48
51
|
unitSuffix,
|
|
49
52
|
type ConversionReason,
|
|
50
53
|
type ConversionTargets,
|
|
@@ -179,6 +182,8 @@ export interface Site {
|
|
|
179
182
|
members: Member[]
|
|
180
183
|
comments: Map<number, readonly string[]>
|
|
181
184
|
extras: Array<{ index: number; text: string }>
|
|
185
|
+
/** token variant values respelled in place; they count as converted output */
|
|
186
|
+
respelled: EmittedProgram[]
|
|
182
187
|
warnings: Flag[]
|
|
183
188
|
flags: Flag[]
|
|
184
189
|
inventory: Flag[]
|
|
@@ -206,6 +211,7 @@ function createSite(
|
|
|
206
211
|
members: [],
|
|
207
212
|
comments: new Map(),
|
|
208
213
|
extras: [],
|
|
214
|
+
respelled: [],
|
|
209
215
|
warnings: [],
|
|
210
216
|
flags: [],
|
|
211
217
|
inventory: [],
|
|
@@ -263,6 +269,16 @@ function addAssessment(
|
|
|
263
269
|
}
|
|
264
270
|
}
|
|
265
271
|
|
|
272
|
+
/** a member the conversion owns, so the rewrite prints it from the site's entries */
|
|
273
|
+
function isConvertedName(name: string): boolean {
|
|
274
|
+
return (
|
|
275
|
+
name === 'group' ||
|
|
276
|
+
styleProps.has(name) ||
|
|
277
|
+
tokenVariantProps.has(name) ||
|
|
278
|
+
isLegacyConditionName(name)
|
|
279
|
+
)
|
|
280
|
+
}
|
|
281
|
+
|
|
266
282
|
function addFlag(list: Flag[], code: string, detail: string): void {
|
|
267
283
|
if (!list.some((flag) => flag.code === code && flag.detail === detail)) {
|
|
268
284
|
list.push({ code, detail })
|
|
@@ -276,21 +292,32 @@ function addNote(site: Site, note: string): void {
|
|
|
276
292
|
const legacyPaletteStepPattern =
|
|
277
293
|
/(?:^|[^\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
|
|
278
294
|
|
|
279
|
-
|
|
295
|
+
const legacyTrueTokenPattern = /(?:^|[^\w-])\$true(?![\w-])/
|
|
296
|
+
|
|
297
|
+
/** configuration risks visible in the authored literals of one value */
|
|
298
|
+
function legacyTokenWarnings(prop: string, values: readonly string[]): Flag[] {
|
|
299
|
+
const warnings: Flag[] = []
|
|
300
|
+
if (values.some((value) => legacyTrueTokenPattern.test(value))) {
|
|
301
|
+
warnings.push({
|
|
302
|
+
code: 'legacy-true-token',
|
|
303
|
+
detail: `${prop} spelled the \`$true\` alias, written as \`4\` because the default config aliased it there; confirm the app's tokens agree`,
|
|
304
|
+
})
|
|
305
|
+
}
|
|
280
306
|
const names = new Set<string>()
|
|
281
307
|
for (const value of values) {
|
|
282
308
|
legacyPaletteStepPattern.lastIndex = 0
|
|
283
309
|
for (const match of value.matchAll(legacyPaletteStepPattern)) names.add(match[1])
|
|
284
310
|
}
|
|
285
|
-
if (!names.size) return
|
|
311
|
+
if (!names.size) return warnings
|
|
286
312
|
const formatted = [...names]
|
|
287
313
|
.sort()
|
|
288
314
|
.map((name) => `\`${name}\``)
|
|
289
315
|
.join(', ')
|
|
290
|
-
|
|
316
|
+
warnings.push({
|
|
291
317
|
code: 'legacy-palette-token',
|
|
292
318
|
detail: `${prop} preserves ${formatted}, which @tamagui/config/v6 does not define; choose an absolute palette token or an adaptive colorN value`,
|
|
293
|
-
}
|
|
319
|
+
})
|
|
320
|
+
return warnings
|
|
294
321
|
}
|
|
295
322
|
|
|
296
323
|
// —— value classification ————————————————————————————————————————————————
|
|
@@ -304,8 +331,8 @@ interface Classification {
|
|
|
304
331
|
dynamic: boolean
|
|
305
332
|
/** a problem with the value itself, raised on sight */
|
|
306
333
|
problem: Flag | null
|
|
307
|
-
/**
|
|
308
|
-
|
|
334
|
+
/** non-blocking configuration risks visible in the authored literals */
|
|
335
|
+
warnings: Flag[]
|
|
309
336
|
/** raised only when a clause forces the value into a program */
|
|
310
337
|
blocked: Flag | null
|
|
311
338
|
/** recorded for a migration that is not the flat-value migration */
|
|
@@ -317,7 +344,7 @@ const empty: Classification = {
|
|
|
317
344
|
text: null,
|
|
318
345
|
dynamic: false,
|
|
319
346
|
problem: null,
|
|
320
|
-
|
|
347
|
+
warnings: [],
|
|
321
348
|
blocked: null,
|
|
322
349
|
inventory: null,
|
|
323
350
|
}
|
|
@@ -402,7 +429,7 @@ function classifyDynamic(
|
|
|
402
429
|
payload: interpolate(prop, tree.text, tree.kind, registry),
|
|
403
430
|
text: rewrittenTokenText,
|
|
404
431
|
dynamic: true,
|
|
405
|
-
|
|
432
|
+
warnings: legacyTokenWarnings(prop, tree.strings),
|
|
406
433
|
}
|
|
407
434
|
}
|
|
408
435
|
if (tree) {
|
|
@@ -469,8 +496,9 @@ function pushBase(
|
|
|
469
496
|
const index = site.index++
|
|
470
497
|
|
|
471
498
|
if (literalString !== null) {
|
|
472
|
-
const warning
|
|
473
|
-
|
|
499
|
+
for (const warning of legacyTokenWarnings(prop, [literalString])) {
|
|
500
|
+
addFlag(site.warnings, warning.code, warning.detail)
|
|
501
|
+
}
|
|
474
502
|
if (literalString.includes('$')) {
|
|
475
503
|
site.legacy = true
|
|
476
504
|
const allowed = assessProgram(site, prop, [])
|
|
@@ -588,8 +616,8 @@ function pushBase(
|
|
|
588
616
|
site.legacy = true
|
|
589
617
|
addFlag(site.flags, classified.problem.code, classified.problem.detail)
|
|
590
618
|
}
|
|
591
|
-
|
|
592
|
-
addFlag(site.warnings,
|
|
619
|
+
for (const warning of classified.warnings) {
|
|
620
|
+
addFlag(site.warnings, warning.code, warning.detail)
|
|
593
621
|
}
|
|
594
622
|
if (classified.inventory) {
|
|
595
623
|
addFlag(site.inventory, classified.inventory.code, classified.inventory.detail)
|
|
@@ -824,12 +852,8 @@ function pushLegacy(
|
|
|
824
852
|
for (let index = 0; index < evaluated.leaves.length; index++) {
|
|
825
853
|
const leaf = evaluated.leaves[index]
|
|
826
854
|
const classified = classifyDynamic(leaf.prop, leaf.expression, site.registry)
|
|
827
|
-
|
|
828
|
-
addFlag(
|
|
829
|
-
site.warnings,
|
|
830
|
-
classified.warning.code,
|
|
831
|
-
`${leaf.path}: ${classified.warning.detail}`
|
|
832
|
-
)
|
|
855
|
+
for (const warning of classified.warnings) {
|
|
856
|
+
addFlag(site.warnings, warning.code, `${leaf.path}: ${warning.detail}`)
|
|
833
857
|
}
|
|
834
858
|
if (classified.payload === null) {
|
|
835
859
|
const flag = classified.problem ?? classified.blocked
|
|
@@ -1393,9 +1417,7 @@ function isConvertedJsxAttribute(attribute: Node): boolean {
|
|
|
1393
1417
|
if (Node.isJsxSpreadAttribute(attribute)) return true
|
|
1394
1418
|
if (!Node.isJsxAttribute(attribute)) return false
|
|
1395
1419
|
const name = jsxAttributeName(attribute)
|
|
1396
|
-
return (
|
|
1397
|
-
!!name && (name === 'group' || styleProps.has(name) || isLegacyConditionName(name))
|
|
1398
|
-
)
|
|
1420
|
+
return !!name && isConvertedName(name)
|
|
1399
1421
|
}
|
|
1400
1422
|
|
|
1401
1423
|
function rewriteJsxSite(
|
|
@@ -1498,11 +1520,7 @@ export function convertJsxSite(
|
|
|
1498
1520
|
if (name !== null) {
|
|
1499
1521
|
// a member the conversion leaves authored has to print as the JSX
|
|
1500
1522
|
// attribute it becomes here, not as the object member it was
|
|
1501
|
-
if (
|
|
1502
|
-
name === 'group' ||
|
|
1503
|
-
styleProps.has(name) ||
|
|
1504
|
-
isLegacyConditionName(name)
|
|
1505
|
-
) {
|
|
1523
|
+
if (isConvertedName(name)) {
|
|
1506
1524
|
pushStyledProperty(
|
|
1507
1525
|
site,
|
|
1508
1526
|
name,
|
|
@@ -1556,6 +1574,10 @@ export function convertJsxSite(
|
|
|
1556
1574
|
pushLegacy(site, name, text, jsxExpression(attribute), attribute)
|
|
1557
1575
|
continue
|
|
1558
1576
|
}
|
|
1577
|
+
if (tokenVariantProps.has(name)) {
|
|
1578
|
+
if (pushTokenVariant(site, name, attribute, text)) before.push(text)
|
|
1579
|
+
continue
|
|
1580
|
+
}
|
|
1559
1581
|
if (!styleProps.has(name)) continue
|
|
1560
1582
|
before.push(text)
|
|
1561
1583
|
|
|
@@ -1579,7 +1601,7 @@ export function convertJsxSite(
|
|
|
1579
1601
|
line: sourceFile.getLineAndColumnAtPos(opening.getStart()).line,
|
|
1580
1602
|
before: before.join(' '),
|
|
1581
1603
|
after: entries.map((entry) => entry.text).join(' ') || '(no style props left)',
|
|
1582
|
-
programs,
|
|
1604
|
+
programs: [...programs, ...site.respelled],
|
|
1583
1605
|
assessments: site.assessments,
|
|
1584
1606
|
assessmentVerdict: assessmentVerdict(site.assessments),
|
|
1585
1607
|
warnings: site.warnings,
|
|
@@ -1623,6 +1645,10 @@ function pushStyledProperty(
|
|
|
1623
1645
|
pushLegacy(site, name, text, initializer, property)
|
|
1624
1646
|
return
|
|
1625
1647
|
}
|
|
1648
|
+
if (tokenVariantProps.has(name)) {
|
|
1649
|
+
pushTokenVariant(site, name, property, text)
|
|
1650
|
+
return
|
|
1651
|
+
}
|
|
1626
1652
|
if (!styleProps.has(name)) return
|
|
1627
1653
|
|
|
1628
1654
|
const literal =
|
|
@@ -1632,6 +1658,86 @@ function pushStyledProperty(
|
|
|
1632
1658
|
pushBase(site, name, text, literal === null ? initializer : null, literal)
|
|
1633
1659
|
}
|
|
1634
1660
|
|
|
1661
|
+
/**
|
|
1662
|
+
* A variant prop whose value is a size token (`size="$4"`, `elevation="$2"`).
|
|
1663
|
+
* No program is built for it, but v3 looks the value up as written and `$4`
|
|
1664
|
+
* finds nothing, so every `$token` string literal in the value is respelled,
|
|
1665
|
+
* a conditional on both arms. `$true` aliased the default size, which v3
|
|
1666
|
+
* spells as the boolean. Returns whether the member is legacy at all:
|
|
1667
|
+
* respelled, or flagged because it cannot be.
|
|
1668
|
+
*/
|
|
1669
|
+
function pushTokenVariant(
|
|
1670
|
+
site: Site,
|
|
1671
|
+
name: string,
|
|
1672
|
+
node: JsxAttribute | PropertyAssignment,
|
|
1673
|
+
text: string
|
|
1674
|
+
): boolean {
|
|
1675
|
+
const index = site.index++
|
|
1676
|
+
const initializer = node.getInitializer()
|
|
1677
|
+
const value =
|
|
1678
|
+
initializer !== undefined && Node.isJsxExpression(initializer)
|
|
1679
|
+
? initializer.getExpression()
|
|
1680
|
+
: initializer
|
|
1681
|
+
const literals =
|
|
1682
|
+
value === undefined
|
|
1683
|
+
? []
|
|
1684
|
+
: [value, ...value.getDescendants()].filter(
|
|
1685
|
+
(candidate): candidate is StringLiteral | NoSubstitutionTemplateLiteral =>
|
|
1686
|
+
(Node.isStringLiteral(candidate) ||
|
|
1687
|
+
Node.isNoSubstitutionTemplateLiteral(candidate)) &&
|
|
1688
|
+
candidate.getLiteralValue().startsWith('$')
|
|
1689
|
+
)
|
|
1690
|
+
if (value === undefined || literals.length === 0) {
|
|
1691
|
+
site.members.push({ type: 'passthrough', index, text })
|
|
1692
|
+
return false
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
const source = value.getText()
|
|
1696
|
+
const start = value.getStart()
|
|
1697
|
+
let rewritten = ''
|
|
1698
|
+
let cursor = start
|
|
1699
|
+
for (const literal of literals) {
|
|
1700
|
+
let replacement = 'true'
|
|
1701
|
+
if (literal.getLiteralValue() !== '$true') {
|
|
1702
|
+
const flat = flatStringValue(literal.getLiteralValue(), site.registry)
|
|
1703
|
+
if (flat.text === null) {
|
|
1704
|
+
site.legacy = true
|
|
1705
|
+
addFlag(
|
|
1706
|
+
site.flags,
|
|
1707
|
+
flat.error?.code ?? 'unsupported-legacy-value',
|
|
1708
|
+
`${name}: ${flat.error?.message ?? `${literal.getText()} has no flat spelling`}`
|
|
1709
|
+
)
|
|
1710
|
+
site.members.push({ type: 'passthrough', index, text })
|
|
1711
|
+
return true
|
|
1712
|
+
}
|
|
1713
|
+
const quote = literal.getText()[0]
|
|
1714
|
+
replacement = `${quote}${flat.text}${quote}`
|
|
1715
|
+
}
|
|
1716
|
+
rewritten += source.slice(cursor - start, literal.getStart() - start)
|
|
1717
|
+
rewritten += replacement
|
|
1718
|
+
cursor = literal.getEnd()
|
|
1719
|
+
}
|
|
1720
|
+
rewritten += source.slice(cursor - start)
|
|
1721
|
+
|
|
1722
|
+
site.legacy = true
|
|
1723
|
+
const output = Node.isJsxAttribute(node)
|
|
1724
|
+
? Node.isStringLiteral(initializer)
|
|
1725
|
+
? rewritten === 'true'
|
|
1726
|
+
? name
|
|
1727
|
+
: `${name}=${rewritten}`
|
|
1728
|
+
: `${name}={${rewritten}}`
|
|
1729
|
+
: site.kind === 'jsx'
|
|
1730
|
+
? `${name}={${rewritten}}`
|
|
1731
|
+
: textWithOuterComments(node, `${node.getNameNode().getText()}: ${rewritten}`)
|
|
1732
|
+
site.members.push({ type: 'passthrough', index, text: output })
|
|
1733
|
+
site.respelled.push({
|
|
1734
|
+
name,
|
|
1735
|
+
value: rewritten,
|
|
1736
|
+
dynamic: literals.length !== 1 || literals[0] !== value,
|
|
1737
|
+
})
|
|
1738
|
+
return true
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1635
1741
|
export function convertStyleObject(
|
|
1636
1742
|
object: ObjectLiteralExpression,
|
|
1637
1743
|
kind: SiteKind,
|
|
@@ -1654,11 +1760,7 @@ export function convertStyleObject(
|
|
|
1654
1760
|
if (Node.isPropertyAssignment(nested)) {
|
|
1655
1761
|
const name = propertyName(nested.getNameNode())
|
|
1656
1762
|
if (name !== null) {
|
|
1657
|
-
if (
|
|
1658
|
-
name === 'group' ||
|
|
1659
|
-
styleProps.has(name) ||
|
|
1660
|
-
isLegacyConditionName(name)
|
|
1661
|
-
) {
|
|
1763
|
+
if (isConvertedName(name)) {
|
|
1662
1764
|
pushStyledProperty(site, name, nested)
|
|
1663
1765
|
} else {
|
|
1664
1766
|
site.members.push({
|
|
@@ -1700,8 +1802,7 @@ export function convertStyleObject(
|
|
|
1700
1802
|
}
|
|
1701
1803
|
const name = propertyName(nameNode)
|
|
1702
1804
|
if (name === null) continue
|
|
1703
|
-
if (!
|
|
1704
|
-
continue
|
|
1805
|
+
if (!isConvertedName(name)) continue
|
|
1705
1806
|
before.push(compact(property.getText()))
|
|
1706
1807
|
pushStyledProperty(site, name, property)
|
|
1707
1808
|
}
|
|
@@ -1716,7 +1817,7 @@ export function convertStyleObject(
|
|
|
1716
1817
|
line: sourceFile.getLineAndColumnAtPos(object.getStart()).line,
|
|
1717
1818
|
before: before.join(', '),
|
|
1718
1819
|
after: entries.map((entry) => entry.text).join(', ') || '(no style props left)',
|
|
1719
|
-
programs,
|
|
1820
|
+
programs: [...programs, ...site.respelled],
|
|
1720
1821
|
assessments: site.assessments,
|
|
1721
1822
|
assessmentVerdict: assessmentVerdict(site.assessments),
|
|
1722
1823
|
warnings: site.warnings,
|
|
@@ -1745,9 +1846,7 @@ function isConvertedStyledProperty(property: Node): boolean {
|
|
|
1745
1846
|
const nameNode = property.getNameNode()
|
|
1746
1847
|
if (Node.isComputedPropertyName(nameNode)) return false
|
|
1747
1848
|
const name = propertyName(nameNode)
|
|
1748
|
-
return (
|
|
1749
|
-
!!name && (name === 'group' || styleProps.has(name) || isLegacyConditionName(name))
|
|
1750
|
-
)
|
|
1849
|
+
return !!name && isConvertedName(name)
|
|
1751
1850
|
}
|
|
1752
1851
|
|
|
1753
1852
|
function allCommentTexts(node: Node): string[] {
|
|
@@ -1765,7 +1864,7 @@ function allCommentTexts(node: Node): string[] {
|
|
|
1765
1864
|
.map((entry) => entry[1])
|
|
1766
1865
|
}
|
|
1767
1866
|
|
|
1768
|
-
function textWithOuterComments(node: Node): string {
|
|
1867
|
+
function textWithOuterComments(node: Node, text = node.getText()): string {
|
|
1769
1868
|
const comments = new Map<number, string>()
|
|
1770
1869
|
for (const range of [
|
|
1771
1870
|
...node.getLeadingCommentRanges(),
|
|
@@ -1776,7 +1875,9 @@ function textWithOuterComments(node: Node): string {
|
|
|
1776
1875
|
const prefix = [...comments.entries()]
|
|
1777
1876
|
.sort((left, right) => left[0] - right[0])
|
|
1778
1877
|
.map((entry) => entry[1])
|
|
1779
|
-
|
|
1878
|
+
// the member sits one step inside its object and rewriteStyleObject supplies
|
|
1879
|
+
// that step for the first line only, so the lines after a comment carry it
|
|
1880
|
+
return [...prefix, text].join('\n ')
|
|
1780
1881
|
}
|
|
1781
1882
|
|
|
1782
1883
|
function rewriteStyleObject(
|
package/src/grammar.ts
CHANGED
|
@@ -87,6 +87,16 @@ export const styleProps: ReadonlySet<string> = new Set<string>([
|
|
|
87
87
|
...Object.values(shorthands),
|
|
88
88
|
])
|
|
89
89
|
|
|
90
|
+
/**
|
|
91
|
+
* variant props whose values are size tokens. no program is built for them,
|
|
92
|
+
* but v3 reads the value as a size-scale key and a `$` spelling finds nothing
|
|
93
|
+
*/
|
|
94
|
+
export const tokenVariantProps: ReadonlySet<string> = new Set<string>([
|
|
95
|
+
'size',
|
|
96
|
+
'elevation',
|
|
97
|
+
'iconSize',
|
|
98
|
+
])
|
|
99
|
+
|
|
90
100
|
/** the media keys of the V6 default config, plus the two motion queries */
|
|
91
101
|
export const codemodMediaNames: readonly string[] = [
|
|
92
102
|
...defaultMediaKeys,
|
package/src/index.ts
CHANGED
|
@@ -233,6 +233,26 @@ function variantSites(
|
|
|
233
233
|
): SiteReport[] {
|
|
234
234
|
const sites: SiteReport[] = []
|
|
235
235
|
|
|
236
|
+
// variant defaults are spelled like the props they set, so a size token here
|
|
237
|
+
// needs the same respelling as one on an element
|
|
238
|
+
const defaults = config.getProperty('defaultVariants')
|
|
239
|
+
if (Node.isPropertyAssignment(defaults)) {
|
|
240
|
+
const object = unwrapExpression(defaults.getInitializerOrThrow())
|
|
241
|
+
if (Node.isObjectLiteralExpression(object)) {
|
|
242
|
+
const site = convertStyleObject(
|
|
243
|
+
object,
|
|
244
|
+
'styled',
|
|
245
|
+
`${label} defaultVariants`,
|
|
246
|
+
registry,
|
|
247
|
+
containers,
|
|
248
|
+
targets,
|
|
249
|
+
host,
|
|
250
|
+
write
|
|
251
|
+
)
|
|
252
|
+
if (site) sites.push(site)
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
236
256
|
const variants = config.getProperty('variants')
|
|
237
257
|
if (Node.isPropertyAssignment(variants)) {
|
|
238
258
|
const object = unwrapExpression(variants.getInitializerOrThrow())
|