@tamagui/codemod-flat-values 0.0.0-bootstrap.0 → 3.0.0-beta.1093.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +234 -1
- package/dist/builtInNames.mjs +14 -0
- package/dist/builtInNames.mjs.map +1 -0
- package/dist/containers.mjs +141 -0
- package/dist/containers.mjs.map +1 -0
- package/dist/convert.mjs +1233 -0
- package/dist/convert.mjs.map +1 -0
- package/dist/expressions.mjs +188 -0
- package/dist/expressions.mjs.map +1 -0
- package/dist/functionalVariants.mjs +469 -0
- package/dist/functionalVariants.mjs.map +1 -0
- package/dist/grammar.mjs +73 -0
- package/dist/grammar.mjs.map +1 -0
- package/dist/index.mjs +374 -0
- package/dist/index.mjs.map +1 -0
- package/dist/legacyConditions.mjs +293 -0
- package/dist/legacyConditions.mjs.map +1 -0
- package/dist/legacyNames.mjs +130 -0
- package/dist/legacyNames.mjs.map +1 -0
- package/dist/provenance.mjs +137 -0
- package/dist/provenance.mjs.map +1 -0
- package/dist/report.mjs +188 -0
- package/dist/report.mjs.map +1 -0
- package/dist/sheetAnatomy.mjs +200 -0
- package/dist/sheetAnatomy.mjs.map +1 -0
- package/dist/structuredNative.mjs +275 -0
- package/dist/structuredNative.mjs.map +1 -0
- package/dist/transition.mjs +257 -0
- package/dist/transition.mjs.map +1 -0
- package/package.json +35 -7
- package/src/builtInNames.ts +23 -0
- package/src/containers.ts +227 -0
- package/src/convert.ts +1977 -0
- package/src/expressions.ts +220 -0
- package/src/functionalVariants.ts +642 -0
- package/src/grammar.ts +190 -0
- package/src/index.ts +589 -0
- package/src/legacyConditions.ts +357 -0
- package/src/legacyNames.ts +160 -0
- package/src/provenance.ts +210 -0
- package/src/report.ts +362 -0
- package/src/sheetAnatomy.ts +277 -0
- package/src/structuredNative.ts +459 -0
- package/src/transition.ts +415 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { Node, SyntaxKind } from "ts-morph";
|
|
2
|
+
import { numericValue, unwrapExpression } from "./expressions.mjs";
|
|
3
|
+
import { parseTransformString, sharedPayload } from "./grammar.mjs";
|
|
4
|
+
|
|
5
|
+
const staticTransformOperations = /* @__PURE__ */ new Set([
|
|
6
|
+
"perspective",
|
|
7
|
+
"rotate",
|
|
8
|
+
"rotateX",
|
|
9
|
+
"rotateY",
|
|
10
|
+
"rotateZ",
|
|
11
|
+
"scale",
|
|
12
|
+
"scaleX",
|
|
13
|
+
"scaleY",
|
|
14
|
+
"skewX",
|
|
15
|
+
"skewY",
|
|
16
|
+
"translateX",
|
|
17
|
+
"translateY"
|
|
18
|
+
]);
|
|
19
|
+
function blocked(code, detail) {
|
|
20
|
+
return {
|
|
21
|
+
payload: null,
|
|
22
|
+
blocked: {
|
|
23
|
+
code,
|
|
24
|
+
detail
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function staticString(expression) {
|
|
29
|
+
const current = unwrapExpression(expression);
|
|
30
|
+
return Node.isStringLiteral(current) || Node.isNoSubstitutionTemplateLiteral(current) ? current.getLiteralValue() : null;
|
|
31
|
+
}
|
|
32
|
+
function hasOnlyStringValues(expression) {
|
|
33
|
+
const current = unwrapExpression(expression);
|
|
34
|
+
if (Node.isStringLiteral(current) || Node.isNoSubstitutionTemplateLiteral(current) || Node.isTemplateExpression(current)) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
const type = current.getType();
|
|
38
|
+
const parts = type.isUnion() ? type.getUnionTypes() : [type];
|
|
39
|
+
let strings = 0;
|
|
40
|
+
for (const part of parts) {
|
|
41
|
+
if (part.isNull() || part.isUndefined()) continue;
|
|
42
|
+
if (!part.isString() && !part.isStringLiteral()) return false;
|
|
43
|
+
strings++;
|
|
44
|
+
}
|
|
45
|
+
return strings > 0;
|
|
46
|
+
}
|
|
47
|
+
function staticTransformArray(expression, source) {
|
|
48
|
+
const array = unwrapExpression(expression);
|
|
49
|
+
if (!Node.isArrayLiteralExpression(array)) {
|
|
50
|
+
return blocked("structured-transform-dynamic", `transform value "${source}" is not an inline transform array; keep dynamic and Animated arrays authored`);
|
|
51
|
+
}
|
|
52
|
+
const functions = [];
|
|
53
|
+
for (const element of array.getElements()) {
|
|
54
|
+
if (!Node.isObjectLiteralExpression(element)) {
|
|
55
|
+
return blocked("structured-transform-dynamic", `transform value "${source}" contains a spread or computed entry; keep dynamic and Animated arrays authored`);
|
|
56
|
+
}
|
|
57
|
+
const properties = element.getProperties();
|
|
58
|
+
if (properties.length !== 1 || !Node.isPropertyAssignment(properties[0])) {
|
|
59
|
+
return blocked("structured-transform-entry", `transform value "${source}" must have exactly one static operation per array entry`);
|
|
60
|
+
}
|
|
61
|
+
const property = properties[0];
|
|
62
|
+
const nameNode = property.getNameNode();
|
|
63
|
+
if (!Node.isIdentifier(nameNode) && !Node.isStringLiteral(nameNode)) {
|
|
64
|
+
return blocked("structured-transform-entry", `transform value "${source}" contains a computed operation name`);
|
|
65
|
+
}
|
|
66
|
+
const operation = Node.isStringLiteral(nameNode) ? nameNode.getLiteralValue() : nameNode.getText();
|
|
67
|
+
const initializer = unwrapExpression(property.getInitializerOrThrow());
|
|
68
|
+
if (operation === "matrix" || operation === "matrix3d") {
|
|
69
|
+
return blocked("structured-transform-matrix", `transform value "${source}" contains "${operation}", whose React Native array and portable CSS function shapes do not match; keep it authored`);
|
|
70
|
+
}
|
|
71
|
+
if (!staticTransformOperations.has(operation)) {
|
|
72
|
+
return blocked("structured-transform-operation", `transform value "${source}" uses unsupported operation "${operation}"`);
|
|
73
|
+
}
|
|
74
|
+
const number = numericValue(initializer);
|
|
75
|
+
let value;
|
|
76
|
+
if (number !== null) {
|
|
77
|
+
if (operation === "rotate" || operation === "rotateX" || operation === "rotateY" || operation === "rotateZ" || operation === "skewX" || operation === "skewY") {
|
|
78
|
+
return blocked("structured-transform-unit", `transform operation "${operation}" in "${source}" needs an explicit deg or rad string`);
|
|
79
|
+
}
|
|
80
|
+
value = operation === "scale" || operation === "scaleX" || operation === "scaleY" ? String(number) : `${number}px`;
|
|
81
|
+
} else if (Node.isStringLiteral(initializer) || Node.isNoSubstitutionTemplateLiteral(initializer)) {
|
|
82
|
+
value = initializer.getLiteralValue();
|
|
83
|
+
} else {
|
|
84
|
+
return blocked("structured-transform-dynamic", `transform operation "${operation}" in "${source}" is computed; keep dynamic and Animated arrays authored`);
|
|
85
|
+
}
|
|
86
|
+
functions.push(`${operation}(${value})`);
|
|
87
|
+
}
|
|
88
|
+
if (functions.length === 0) {
|
|
89
|
+
return blocked("structured-transform-empty", `transform value "${source}" is empty; no portable flat base can preserve its reset semantics`);
|
|
90
|
+
}
|
|
91
|
+
const payload = functions.join(" ");
|
|
92
|
+
const parsed = parseTransformString(payload);
|
|
93
|
+
if (parsed.errors.length) {
|
|
94
|
+
return blocked(`structured-transform-${parsed.errors[0].code}`, `${parsed.errors[0].message}; keep "${source}" authored`);
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
payload,
|
|
98
|
+
blocked: null
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function staticFontVariantArray(expression, source) {
|
|
102
|
+
const array = unwrapExpression(expression);
|
|
103
|
+
if (!Node.isArrayLiteralExpression(array)) {
|
|
104
|
+
return blocked("structured-font-variant-dynamic", `fontVariant value "${source}" is not an inline string array`);
|
|
105
|
+
}
|
|
106
|
+
const variants = [];
|
|
107
|
+
for (const element of array.getElements()) {
|
|
108
|
+
const variant = staticString(element);
|
|
109
|
+
if (variant === null) {
|
|
110
|
+
return blocked("structured-font-variant-dynamic", `fontVariant value "${source}" contains a computed entry; keep it authored`);
|
|
111
|
+
}
|
|
112
|
+
variants.push(variant);
|
|
113
|
+
}
|
|
114
|
+
return variants.length ? {
|
|
115
|
+
payload: variants.join(" "),
|
|
116
|
+
blocked: null
|
|
117
|
+
} : blocked("structured-font-variant-empty", `fontVariant value "${source}" is empty; no CSS token list preserves that reset`);
|
|
118
|
+
}
|
|
119
|
+
function staticBackgroundImageArray(expression, source) {
|
|
120
|
+
const array = unwrapExpression(expression);
|
|
121
|
+
if (!Node.isArrayLiteralExpression(array)) {
|
|
122
|
+
return blocked("structured-background-image-dynamic", `backgroundImage value "${source}" is not an inline gradient array`);
|
|
123
|
+
}
|
|
124
|
+
if (array.getElements().length !== 1) {
|
|
125
|
+
return blocked("structured-background-image-layers", `backgroundImage value "${source}" must contain exactly one gradient; native conditional evaluation does not accept multiple layers`);
|
|
126
|
+
}
|
|
127
|
+
const gradient = array.getElements()[0];
|
|
128
|
+
if (!Node.isObjectLiteralExpression(gradient)) {
|
|
129
|
+
return blocked("structured-background-image-dynamic", `backgroundImage value "${source}" contains a spread or computed gradient`);
|
|
130
|
+
}
|
|
131
|
+
const fields = /* @__PURE__ */ new Map();
|
|
132
|
+
for (const member of gradient.getProperties()) {
|
|
133
|
+
if (!Node.isPropertyAssignment(member)) {
|
|
134
|
+
return blocked("structured-background-image-dynamic", `backgroundImage value "${source}" contains a spread or computed gradient field`);
|
|
135
|
+
}
|
|
136
|
+
const nameNode = member.getNameNode();
|
|
137
|
+
if (!Node.isIdentifier(nameNode) && !Node.isStringLiteral(nameNode)) {
|
|
138
|
+
return blocked("structured-background-image-dynamic", `backgroundImage value "${source}" contains a computed gradient field`);
|
|
139
|
+
}
|
|
140
|
+
const name = Node.isStringLiteral(nameNode) ? nameNode.getLiteralValue() : nameNode.getText();
|
|
141
|
+
if (fields.has(name) || name !== "type" && name !== "direction" && name !== "colorStops") {
|
|
142
|
+
return blocked("structured-background-image-shape", `backgroundImage value "${source}" contains unsupported field "${name}"`);
|
|
143
|
+
}
|
|
144
|
+
fields.set(name, member.getInitializerOrThrow());
|
|
145
|
+
}
|
|
146
|
+
const type = fields.get("type");
|
|
147
|
+
const typeName = type ? staticString(type) : null;
|
|
148
|
+
if (typeName !== "linear-gradient") {
|
|
149
|
+
return blocked("structured-background-image-kind", `backgroundImage value "${source}" is not a static linear-gradient object`);
|
|
150
|
+
}
|
|
151
|
+
const parts = [];
|
|
152
|
+
const direction = fields.get("direction");
|
|
153
|
+
if (direction) {
|
|
154
|
+
const value = staticString(direction);
|
|
155
|
+
if (value === null) {
|
|
156
|
+
return blocked("structured-background-image-dynamic", `backgroundImage value "${source}" has a computed direction`);
|
|
157
|
+
}
|
|
158
|
+
parts.push(value);
|
|
159
|
+
}
|
|
160
|
+
const colorStopsExpression = fields.get("colorStops");
|
|
161
|
+
const colorStops = colorStopsExpression ? unwrapExpression(colorStopsExpression) : void 0;
|
|
162
|
+
if (!colorStops || !Node.isArrayLiteralExpression(colorStops)) {
|
|
163
|
+
return blocked("structured-background-image-dynamic", `backgroundImage value "${source}" does not have an inline colorStops array`);
|
|
164
|
+
}
|
|
165
|
+
if (colorStops.getElements().length < 2) {
|
|
166
|
+
return blocked("structured-background-image-stops", `backgroundImage value "${source}" needs at least two color stops`);
|
|
167
|
+
}
|
|
168
|
+
const stopElements = colorStops.getElements();
|
|
169
|
+
for (const [stopIndex, stop] of stopElements.entries()) {
|
|
170
|
+
if (!Node.isObjectLiteralExpression(stop)) {
|
|
171
|
+
return blocked("structured-background-image-dynamic", `backgroundImage value "${source}" contains a spread or computed color stop`);
|
|
172
|
+
}
|
|
173
|
+
let color;
|
|
174
|
+
let hasColor = false;
|
|
175
|
+
let positions = [];
|
|
176
|
+
let hasPositions = false;
|
|
177
|
+
for (const member of stop.getProperties()) {
|
|
178
|
+
if (!Node.isPropertyAssignment(member)) {
|
|
179
|
+
return blocked("structured-background-image-dynamic", `backgroundImage value "${source}" contains a spread or computed color-stop field`);
|
|
180
|
+
}
|
|
181
|
+
const nameNode = member.getNameNode();
|
|
182
|
+
if (!Node.isIdentifier(nameNode) && !Node.isStringLiteral(nameNode)) {
|
|
183
|
+
return blocked("structured-background-image-dynamic", `backgroundImage value "${source}" contains a computed color-stop field`);
|
|
184
|
+
}
|
|
185
|
+
const name = Node.isStringLiteral(nameNode) ? nameNode.getLiteralValue() : nameNode.getText();
|
|
186
|
+
if (name === "color" && !hasColor) {
|
|
187
|
+
hasColor = true;
|
|
188
|
+
const value = unwrapExpression(member.getInitializerOrThrow());
|
|
189
|
+
if (value.getKind() === SyntaxKind.NullKeyword) {
|
|
190
|
+
color = null;
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
const staticColor = staticString(value);
|
|
194
|
+
if (staticColor === null) {
|
|
195
|
+
return blocked("structured-background-image-dynamic", `backgroundImage value "${source}" contains a computed color`);
|
|
196
|
+
}
|
|
197
|
+
color = staticColor;
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
if (name === "positions" && !hasPositions) {
|
|
201
|
+
hasPositions = true;
|
|
202
|
+
const value = unwrapExpression(member.getInitializerOrThrow());
|
|
203
|
+
if (!Node.isArrayLiteralExpression(value)) {
|
|
204
|
+
return blocked("structured-background-image-dynamic", `backgroundImage value "${source}" contains computed color-stop positions`);
|
|
205
|
+
}
|
|
206
|
+
positions = [];
|
|
207
|
+
for (const positionExpression of value.getElements()) {
|
|
208
|
+
const number = numericValue(positionExpression);
|
|
209
|
+
if (number !== null) {
|
|
210
|
+
positions.push(`${number}px`);
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
const position = staticString(positionExpression);
|
|
214
|
+
if (position === null) {
|
|
215
|
+
return blocked("structured-background-image-dynamic", `backgroundImage value "${source}" contains a computed color-stop position`);
|
|
216
|
+
}
|
|
217
|
+
if (!position.endsWith("%")) {
|
|
218
|
+
return blocked("structured-background-image-position", `backgroundImage value "${source}" has position "${position}"; React Native gradient objects accept numeric points or percentage strings`);
|
|
219
|
+
}
|
|
220
|
+
positions.push(position);
|
|
221
|
+
}
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
return blocked("structured-background-image-shape", `backgroundImage value "${source}" contains unsupported or repeated color-stop field "${name}"`);
|
|
225
|
+
}
|
|
226
|
+
if (!hasColor || color === void 0) {
|
|
227
|
+
return blocked("structured-background-image-shape", `backgroundImage value "${source}" contains a color stop without a color`);
|
|
228
|
+
}
|
|
229
|
+
if (color === null) {
|
|
230
|
+
if (positions.length !== 1 || stopIndex === 0 || stopIndex === stopElements.length - 1) {
|
|
231
|
+
return blocked("structured-background-image-hint", `backgroundImage value "${source}" has an invalid transition hint; it needs one position between two colored stops`);
|
|
232
|
+
}
|
|
233
|
+
parts.push(positions[0]);
|
|
234
|
+
} else if (positions.length > 2) {
|
|
235
|
+
for (const position of positions) parts.push(`${color} ${position}`);
|
|
236
|
+
} else {
|
|
237
|
+
parts.push([color, ...positions].join(" "));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return {
|
|
241
|
+
payload: `linear-gradient(${parts.join(", ")})`,
|
|
242
|
+
blocked: null
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
const structuredNativeSerializers = Object.freeze({
|
|
246
|
+
backgroundImage: staticBackgroundImageArray,
|
|
247
|
+
fontVariant: staticFontVariantArray,
|
|
248
|
+
transform: staticTransformArray
|
|
249
|
+
});
|
|
250
|
+
function classifyStructuredNativeValue(property, expression, source, registry) {
|
|
251
|
+
const serializer = structuredNativeSerializers[property];
|
|
252
|
+
if (serializer) {
|
|
253
|
+
if (hasOnlyStringValues(expression)) return null;
|
|
254
|
+
const result = serializer(expression, source);
|
|
255
|
+
if (result.payload === null) return result;
|
|
256
|
+
const flattened = sharedPayload(property, result.payload, registry);
|
|
257
|
+
const error = flattened.errors[0];
|
|
258
|
+
if (error || flattened.payload === null) {
|
|
259
|
+
return blocked(error?.code ?? "unsupported-structured-value", `${property}: ${error?.message ?? `"${result.payload}" has no flat spelling`}`);
|
|
260
|
+
}
|
|
261
|
+
return {
|
|
262
|
+
payload: flattened.payload,
|
|
263
|
+
blocked: null
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
const current = unwrapExpression(expression);
|
|
267
|
+
if (!Node.isObjectLiteralExpression(current) && !Node.isArrayLiteralExpression(current)) {
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
const code = property.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
271
|
+
return blocked(`structured-${code}`, `${property} value "${source}" has no verified CSS-shaped migration rule; keep it authored`);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export { classifyStructuredNativeValue };
|
|
275
|
+
//# sourceMappingURL=structuredNative.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structuredNative.js","names":[],"sources":["structuredNative.js"],"sourcesContent":["import { Node, SyntaxKind } from \"ts-morph\";\nimport { numericValue, unwrapExpression } from \"./expressions\";\nimport { parseTransformString, sharedPayload } from \"./grammar\";\nconst staticTransformOperations = /* @__PURE__ */ new Set([\n \"perspective\",\n \"rotate\",\n \"rotateX\",\n \"rotateY\",\n \"rotateZ\",\n \"scale\",\n \"scaleX\",\n \"scaleY\",\n \"skewX\",\n \"skewY\",\n \"translateX\",\n \"translateY\"\n]);\nfunction blocked(code, detail) {\n return { payload: null, blocked: { code, detail } };\n}\nfunction staticString(expression) {\n const current = unwrapExpression(expression);\n return Node.isStringLiteral(current) || Node.isNoSubstitutionTemplateLiteral(current) ? current.getLiteralValue() : null;\n}\nfunction hasOnlyStringValues(expression) {\n const current = unwrapExpression(expression);\n if (Node.isStringLiteral(current) || Node.isNoSubstitutionTemplateLiteral(current) || Node.isTemplateExpression(current)) {\n return true;\n }\n const type = current.getType();\n const parts = type.isUnion() ? type.getUnionTypes() : [type];\n let strings = 0;\n for (const part of parts) {\n if (part.isNull() || part.isUndefined()) continue;\n if (!part.isString() && !part.isStringLiteral()) return false;\n strings++;\n }\n return strings > 0;\n}\nfunction staticTransformArray(expression, source) {\n const array = unwrapExpression(expression);\n if (!Node.isArrayLiteralExpression(array)) {\n return blocked(\n \"structured-transform-dynamic\",\n `transform value \"${source}\" is not an inline transform array; keep dynamic and Animated arrays authored`\n );\n }\n const functions = [];\n for (const element of array.getElements()) {\n if (!Node.isObjectLiteralExpression(element)) {\n return blocked(\n \"structured-transform-dynamic\",\n `transform value \"${source}\" contains a spread or computed entry; keep dynamic and Animated arrays authored`\n );\n }\n const properties = element.getProperties();\n if (properties.length !== 1 || !Node.isPropertyAssignment(properties[0])) {\n return blocked(\n \"structured-transform-entry\",\n `transform value \"${source}\" must have exactly one static operation per array entry`\n );\n }\n const property = properties[0];\n const nameNode = property.getNameNode();\n if (!Node.isIdentifier(nameNode) && !Node.isStringLiteral(nameNode)) {\n return blocked(\n \"structured-transform-entry\",\n `transform value \"${source}\" contains a computed operation name`\n );\n }\n const operation = Node.isStringLiteral(nameNode) ? nameNode.getLiteralValue() : nameNode.getText();\n const initializer = unwrapExpression(property.getInitializerOrThrow());\n if (operation === \"matrix\" || operation === \"matrix3d\") {\n return blocked(\n \"structured-transform-matrix\",\n `transform value \"${source}\" contains \"${operation}\", whose React Native array and portable CSS function shapes do not match; keep it authored`\n );\n }\n if (!staticTransformOperations.has(operation)) {\n return blocked(\n \"structured-transform-operation\",\n `transform value \"${source}\" uses unsupported operation \"${operation}\"`\n );\n }\n const number = numericValue(initializer);\n let value;\n if (number !== null) {\n if (operation === \"rotate\" || operation === \"rotateX\" || operation === \"rotateY\" || operation === \"rotateZ\" || operation === \"skewX\" || operation === \"skewY\") {\n return blocked(\n \"structured-transform-unit\",\n `transform operation \"${operation}\" in \"${source}\" needs an explicit deg or rad string`\n );\n }\n value = operation === \"scale\" || operation === \"scaleX\" || operation === \"scaleY\" ? String(number) : `${number}px`;\n } else if (Node.isStringLiteral(initializer) || Node.isNoSubstitutionTemplateLiteral(initializer)) {\n value = initializer.getLiteralValue();\n } else {\n return blocked(\n \"structured-transform-dynamic\",\n `transform operation \"${operation}\" in \"${source}\" is computed; keep dynamic and Animated arrays authored`\n );\n }\n functions.push(`${operation}(${value})`);\n }\n if (functions.length === 0) {\n return blocked(\n \"structured-transform-empty\",\n `transform value \"${source}\" is empty; no portable flat base can preserve its reset semantics`\n );\n }\n const payload = functions.join(\" \");\n const parsed = parseTransformString(payload);\n if (parsed.errors.length) {\n return blocked(\n `structured-transform-${parsed.errors[0].code}`,\n `${parsed.errors[0].message}; keep \"${source}\" authored`\n );\n }\n return { payload, blocked: null };\n}\nfunction staticFontVariantArray(expression, source) {\n const array = unwrapExpression(expression);\n if (!Node.isArrayLiteralExpression(array)) {\n return blocked(\n \"structured-font-variant-dynamic\",\n `fontVariant value \"${source}\" is not an inline string array`\n );\n }\n const variants = [];\n for (const element of array.getElements()) {\n const variant = staticString(element);\n if (variant === null) {\n return blocked(\n \"structured-font-variant-dynamic\",\n `fontVariant value \"${source}\" contains a computed entry; keep it authored`\n );\n }\n variants.push(variant);\n }\n return variants.length ? { payload: variants.join(\" \"), blocked: null } : blocked(\n \"structured-font-variant-empty\",\n `fontVariant value \"${source}\" is empty; no CSS token list preserves that reset`\n );\n}\nfunction staticBackgroundImageArray(expression, source) {\n const array = unwrapExpression(expression);\n if (!Node.isArrayLiteralExpression(array)) {\n return blocked(\n \"structured-background-image-dynamic\",\n `backgroundImage value \"${source}\" is not an inline gradient array`\n );\n }\n if (array.getElements().length !== 1) {\n return blocked(\n \"structured-background-image-layers\",\n `backgroundImage value \"${source}\" must contain exactly one gradient; native conditional evaluation does not accept multiple layers`\n );\n }\n const gradient = array.getElements()[0];\n if (!Node.isObjectLiteralExpression(gradient)) {\n return blocked(\n \"structured-background-image-dynamic\",\n `backgroundImage value \"${source}\" contains a spread or computed gradient`\n );\n }\n const fields = /* @__PURE__ */ new Map();\n for (const member of gradient.getProperties()) {\n if (!Node.isPropertyAssignment(member)) {\n return blocked(\n \"structured-background-image-dynamic\",\n `backgroundImage value \"${source}\" contains a spread or computed gradient field`\n );\n }\n const nameNode = member.getNameNode();\n if (!Node.isIdentifier(nameNode) && !Node.isStringLiteral(nameNode)) {\n return blocked(\n \"structured-background-image-dynamic\",\n `backgroundImage value \"${source}\" contains a computed gradient field`\n );\n }\n const name = Node.isStringLiteral(nameNode) ? nameNode.getLiteralValue() : nameNode.getText();\n if (fields.has(name) || name !== \"type\" && name !== \"direction\" && name !== \"colorStops\") {\n return blocked(\n \"structured-background-image-shape\",\n `backgroundImage value \"${source}\" contains unsupported field \"${name}\"`\n );\n }\n fields.set(name, member.getInitializerOrThrow());\n }\n const type = fields.get(\"type\");\n const typeName = type ? staticString(type) : null;\n if (typeName !== \"linear-gradient\") {\n return blocked(\n \"structured-background-image-kind\",\n `backgroundImage value \"${source}\" is not a static linear-gradient object`\n );\n }\n const parts = [];\n const direction = fields.get(\"direction\");\n if (direction) {\n const value = staticString(direction);\n if (value === null) {\n return blocked(\n \"structured-background-image-dynamic\",\n `backgroundImage value \"${source}\" has a computed direction`\n );\n }\n parts.push(value);\n }\n const colorStopsExpression = fields.get(\"colorStops\");\n const colorStops = colorStopsExpression ? unwrapExpression(colorStopsExpression) : void 0;\n if (!colorStops || !Node.isArrayLiteralExpression(colorStops)) {\n return blocked(\n \"structured-background-image-dynamic\",\n `backgroundImage value \"${source}\" does not have an inline colorStops array`\n );\n }\n if (colorStops.getElements().length < 2) {\n return blocked(\n \"structured-background-image-stops\",\n `backgroundImage value \"${source}\" needs at least two color stops`\n );\n }\n const stopElements = colorStops.getElements();\n for (const [stopIndex, stop] of stopElements.entries()) {\n if (!Node.isObjectLiteralExpression(stop)) {\n return blocked(\n \"structured-background-image-dynamic\",\n `backgroundImage value \"${source}\" contains a spread or computed color stop`\n );\n }\n let color;\n let hasColor = false;\n let positions = [];\n let hasPositions = false;\n for (const member of stop.getProperties()) {\n if (!Node.isPropertyAssignment(member)) {\n return blocked(\n \"structured-background-image-dynamic\",\n `backgroundImage value \"${source}\" contains a spread or computed color-stop field`\n );\n }\n const nameNode = member.getNameNode();\n if (!Node.isIdentifier(nameNode) && !Node.isStringLiteral(nameNode)) {\n return blocked(\n \"structured-background-image-dynamic\",\n `backgroundImage value \"${source}\" contains a computed color-stop field`\n );\n }\n const name = Node.isStringLiteral(nameNode) ? nameNode.getLiteralValue() : nameNode.getText();\n if (name === \"color\" && !hasColor) {\n hasColor = true;\n const value = unwrapExpression(member.getInitializerOrThrow());\n if (value.getKind() === SyntaxKind.NullKeyword) {\n color = null;\n continue;\n }\n const staticColor = staticString(value);\n if (staticColor === null) {\n return blocked(\n \"structured-background-image-dynamic\",\n `backgroundImage value \"${source}\" contains a computed color`\n );\n }\n color = staticColor;\n continue;\n }\n if (name === \"positions\" && !hasPositions) {\n hasPositions = true;\n const value = unwrapExpression(member.getInitializerOrThrow());\n if (!Node.isArrayLiteralExpression(value)) {\n return blocked(\n \"structured-background-image-dynamic\",\n `backgroundImage value \"${source}\" contains computed color-stop positions`\n );\n }\n positions = [];\n for (const positionExpression of value.getElements()) {\n const number = numericValue(positionExpression);\n if (number !== null) {\n positions.push(`${number}px`);\n continue;\n }\n const position = staticString(positionExpression);\n if (position === null) {\n return blocked(\n \"structured-background-image-dynamic\",\n `backgroundImage value \"${source}\" contains a computed color-stop position`\n );\n }\n if (!position.endsWith(\"%\")) {\n return blocked(\n \"structured-background-image-position\",\n `backgroundImage value \"${source}\" has position \"${position}\"; React Native gradient objects accept numeric points or percentage strings`\n );\n }\n positions.push(position);\n }\n continue;\n }\n return blocked(\n \"structured-background-image-shape\",\n `backgroundImage value \"${source}\" contains unsupported or repeated color-stop field \"${name}\"`\n );\n }\n if (!hasColor || color === void 0) {\n return blocked(\n \"structured-background-image-shape\",\n `backgroundImage value \"${source}\" contains a color stop without a color`\n );\n }\n if (color === null) {\n if (positions.length !== 1 || stopIndex === 0 || stopIndex === stopElements.length - 1) {\n return blocked(\n \"structured-background-image-hint\",\n `backgroundImage value \"${source}\" has an invalid transition hint; it needs one position between two colored stops`\n );\n }\n parts.push(positions[0]);\n } else if (positions.length > 2) {\n for (const position of positions) parts.push(`${color} ${position}`);\n } else {\n parts.push([color, ...positions].join(\" \"));\n }\n }\n return { payload: `linear-gradient(${parts.join(\", \")})`, blocked: null };\n}\nconst structuredNativeSerializers = Object.freeze({\n backgroundImage: staticBackgroundImageArray,\n fontVariant: staticFontVariantArray,\n transform: staticTransformArray\n});\nfunction classifyStructuredNativeValue(property, expression, source, registry) {\n const serializer = structuredNativeSerializers[property];\n if (serializer) {\n if (hasOnlyStringValues(expression)) return null;\n const result = serializer(expression, source);\n if (result.payload === null) return result;\n const flattened = sharedPayload(property, result.payload, registry);\n const error = flattened.errors[0];\n if (error || flattened.payload === null) {\n return blocked(\n error?.code ?? \"unsupported-structured-value\",\n `${property}: ${error?.message ?? `\"${result.payload}\" has no flat spelling`}`\n );\n }\n return { payload: flattened.payload, blocked: null };\n }\n const current = unwrapExpression(expression);\n if (!Node.isObjectLiteralExpression(current) && !Node.isArrayLiteralExpression(current)) {\n return null;\n }\n const code = property.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);\n return blocked(\n `structured-${code}`,\n `${property} value \"${source}\" has no verified CSS-shaped migration rule; keep it authored`\n );\n}\nexport {\n classifyStructuredNativeValue\n};\n//# sourceMappingURL=structuredNative.js.map\n"],"mappings":";;;;;AAGA,MAAM,4CAA4C,IAAI,IAAI;CACxD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,SAAS,QAAQ,MAAM,QAAQ;CAC7B,OAAO;EAAE,SAAS;EAAM,SAAS;GAAE;GAAM;EAAO;CAAE;AACpD;AACA,SAAS,aAAa,YAAY;CAChC,MAAM,UAAU,iBAAiB,UAAU;CAC3C,OAAO,KAAK,gBAAgB,OAAO,KAAK,KAAK,gCAAgC,OAAO,IAAI,QAAQ,gBAAgB,IAAI;AACtH;AACA,SAAS,oBAAoB,YAAY;CACvC,MAAM,UAAU,iBAAiB,UAAU;CAC3C,IAAI,KAAK,gBAAgB,OAAO,KAAK,KAAK,gCAAgC,OAAO,KAAK,KAAK,qBAAqB,OAAO,GAAG;EACxH,OAAO;CACT;CACA,MAAM,OAAO,QAAQ,QAAQ;CAC7B,MAAM,QAAQ,KAAK,QAAQ,IAAI,KAAK,cAAc,IAAI,CAAC,IAAI;CAC3D,IAAI,UAAU;CACd,KAAK,MAAM,QAAQ,OAAO;EACxB,IAAI,KAAK,OAAO,KAAK,KAA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;EAAI,SAAS;CAAK;AAC1E;AACA,MAAM,8BAA8B,OAAO,OAAO;CAChD,iBAAiB;CACjB,aAAa;CACb,WAAW;AACb,CAAC;AACD,SAAS,8BAA8B,UAAU,YAAY,QAAQ,UAAU;CAC7E,MAAM,aAAa,4BAA4B;CAC/C,IAAI,YAAY;EACd,IAAI,oBAAoB,UAAU,GAAG,OAAO;EAC5C,MAAM,SAAS,WAAW,YAAY,MAAM;EAC5C,IAAI,OAAO,YAAY,MAAM,OAAO;EACpC,MAAM,YAAY,cAAc,UAAU,OAAO,SAAS,QAAQ;EAClE,MAAM,QAAQ,UAAU,OAAO;EAC/B,IAAI,SAAS,UAAU,YAAY,MAAM;GACvC,OAAO,QACL,OAAO,QAAQ,gCACf,GAAG,SAAS,IAAI,OAAO,WAAW,IAAI,OAAO,QAAQ,yBACvD;EACF;EACA,OAAO;GAAE,SAAS,UAAU;GAAS,SAAS;EAAK;CACrD;CACA,MAAM,UAAU,iBAAiB,UAAU;CAC3C,IAAI,CAAC,KAAK,0BAA0B,OAAO,KAAK,CAAC,KAAK,yBAAyB,OAAO,GAAG;EACvF,OAAO;CACT;CACA,MAAM,OAAO,SAAS,QAAQ,WAAW,WAAW,IAAI,OAAO,YAAY,GAAG;CAC9E,OAAO,QACL,cAAc,QACd,GAAG,SAAS,UAAU,OAAO,8DAC/B;AACF"}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { Node, SyntaxKind } from "ts-morph";
|
|
2
|
+
import { TRANSITION_RESERVED_KEYS, migrateLegacyTransition, printMigratedTransition } from "@tamagui/style-grammar/tooling";
|
|
3
|
+
import { staticLeafValue, unwrapExpression } from "./expressions.mjs";
|
|
4
|
+
|
|
5
|
+
const legacySpringKeys = /* @__PURE__ */ new Set([
|
|
6
|
+
"stiffness",
|
|
7
|
+
"damping",
|
|
8
|
+
"mass",
|
|
9
|
+
"velocity",
|
|
10
|
+
"overshootClamping",
|
|
11
|
+
"restDisplacementThreshold",
|
|
12
|
+
"restSpeedThreshold",
|
|
13
|
+
"tension",
|
|
14
|
+
"friction",
|
|
15
|
+
"bounciness",
|
|
16
|
+
"speed"
|
|
17
|
+
]);
|
|
18
|
+
const identifierPattern = /^[A-Za-z_$][A-Za-z0-9_$-]*$/;
|
|
19
|
+
function staticValue(expression) {
|
|
20
|
+
const current = unwrapExpression(expression);
|
|
21
|
+
const leaf = staticLeafValue(current);
|
|
22
|
+
if (leaf) return { value: leaf.value };
|
|
23
|
+
if (Node.isArrayLiteralExpression(current)) {
|
|
24
|
+
const values = [];
|
|
25
|
+
for (const element of current.getElements()) {
|
|
26
|
+
const item = staticValue(element);
|
|
27
|
+
if (!item) return null;
|
|
28
|
+
values.push(item.value);
|
|
29
|
+
}
|
|
30
|
+
return { value: values };
|
|
31
|
+
}
|
|
32
|
+
if (Node.isObjectLiteralExpression(current)) {
|
|
33
|
+
const value = {};
|
|
34
|
+
for (const property of current.getProperties()) {
|
|
35
|
+
if (!Node.isPropertyAssignment(property)) return null;
|
|
36
|
+
const nameNode = property.getNameNode();
|
|
37
|
+
if (Node.isComputedPropertyName(nameNode)) return null;
|
|
38
|
+
const name = Node.isIdentifier(nameNode) ? nameNode.getText() : Node.isStringLiteral(nameNode) ? nameNode.getLiteralValue() : null;
|
|
39
|
+
if (name === null) return null;
|
|
40
|
+
const item = staticValue(property.getInitializerOrThrow());
|
|
41
|
+
if (!item) return null;
|
|
42
|
+
value[name] = item.value;
|
|
43
|
+
}
|
|
44
|
+
return { value };
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
function animateOnlyList(expression) {
|
|
49
|
+
const evaluated = staticValue(expression);
|
|
50
|
+
if (!evaluated || !Array.isArray(evaluated.value)) return null;
|
|
51
|
+
const list = [];
|
|
52
|
+
for (const item of evaluated.value) {
|
|
53
|
+
if (typeof item !== "string") return null;
|
|
54
|
+
list.push(item);
|
|
55
|
+
}
|
|
56
|
+
return list;
|
|
57
|
+
}
|
|
58
|
+
function isLegacyTransition(value) {
|
|
59
|
+
if (Array.isArray(value)) return true;
|
|
60
|
+
if (!value || typeof value !== "object") return false;
|
|
61
|
+
const object = value;
|
|
62
|
+
if (object.default !== void 0) return true;
|
|
63
|
+
for (const key in object) {
|
|
64
|
+
if (legacySpringKeys.has(key)) return true;
|
|
65
|
+
if (TRANSITION_RESERVED_KEYS.has(key)) continue;
|
|
66
|
+
const entry = object[key];
|
|
67
|
+
if (!entry || typeof entry !== "object") continue;
|
|
68
|
+
const config = entry;
|
|
69
|
+
if (config.type !== void 0) return true;
|
|
70
|
+
for (const nested in config) {
|
|
71
|
+
if (legacySpringKeys.has(nested)) return true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
function presetNamesIn(value, names) {
|
|
77
|
+
if (typeof value === "string") {
|
|
78
|
+
if (identifierPattern.test(value)) names.add(value);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (Array.isArray(value)) {
|
|
82
|
+
for (const item of value) presetNamesIn(item, names);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (!value || typeof value !== "object") return;
|
|
86
|
+
for (const key in value) {
|
|
87
|
+
presetNamesIn(value[key], names);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function migrateTransitionValue(expression, animateOnly) {
|
|
91
|
+
if (expression === null) return null;
|
|
92
|
+
const evaluated = staticValue(expression);
|
|
93
|
+
if (!evaluated) {
|
|
94
|
+
if (animateOnly) {
|
|
95
|
+
return {
|
|
96
|
+
text: null,
|
|
97
|
+
isString: false,
|
|
98
|
+
error: "the removed `animateOnly` narrows a computed transition, so it needs a hand migration to `properties`"
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return Node.isArrayLiteralExpression(unwrapExpression(expression)) ? {
|
|
102
|
+
text: null,
|
|
103
|
+
isString: false,
|
|
104
|
+
error: "the v2 transition array form holds a computed value, so it needs a hand migration to `{ preset }`"
|
|
105
|
+
} : null;
|
|
106
|
+
}
|
|
107
|
+
if (!animateOnly && !isLegacyTransition(evaluated.value)) return null;
|
|
108
|
+
const names = /* @__PURE__ */ new Set();
|
|
109
|
+
presetNamesIn(evaluated.value, names);
|
|
110
|
+
const migrated = migrateLegacyTransition(evaluated.value, names, animateOnly);
|
|
111
|
+
if (!migrated.ok) {
|
|
112
|
+
return {
|
|
113
|
+
text: null,
|
|
114
|
+
isString: false,
|
|
115
|
+
error: migrated.diagnostics.map((one) => one.message).join("; ")
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
text: printMigratedTransition(migrated.value),
|
|
120
|
+
isString: typeof migrated.value === "string",
|
|
121
|
+
error: null
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function convertTransitions(sourceFile, provenance, write) {
|
|
125
|
+
const found = [];
|
|
126
|
+
const readAnimateOnly = (node) => {
|
|
127
|
+
if (!node) return { list: void 0 };
|
|
128
|
+
const initializer = Node.isJsxAttribute(node) ? node.getInitializer() : Node.isPropertyAssignment(node) ? node.getInitializer() : void 0;
|
|
129
|
+
const expression = initializer && Node.isJsxExpression(initializer) ? initializer.getExpression() : initializer;
|
|
130
|
+
return { list: (expression && animateOnlyList(expression)) ?? void 0 };
|
|
131
|
+
};
|
|
132
|
+
for (const opening of [...sourceFile.getDescendantsOfKind(SyntaxKind.JsxOpeningElement), ...sourceFile.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement)]) {
|
|
133
|
+
if (!provenance.isTamaguiElement(opening)) continue;
|
|
134
|
+
let transitionNode = null;
|
|
135
|
+
let animateOnlyNode = null;
|
|
136
|
+
for (const attribute of opening.getAttributes()) {
|
|
137
|
+
if (!Node.isJsxAttribute(attribute)) continue;
|
|
138
|
+
const name = attribute.getNameNode().getText();
|
|
139
|
+
if (name === "transition") transitionNode = attribute;
|
|
140
|
+
else if (name === "animateOnly") animateOnlyNode = attribute;
|
|
141
|
+
}
|
|
142
|
+
const initializer = transitionNode?.getInitializer();
|
|
143
|
+
const expression = Node.isJsxExpression(initializer) ? initializer.getExpression() ?? null : Node.isStringLiteral(initializer) ? initializer : null;
|
|
144
|
+
const { list: animateOnly } = readAnimateOnly(animateOnlyNode);
|
|
145
|
+
const tag = opening.getTagNameNode().getText();
|
|
146
|
+
if (animateOnlyNode && (!transitionNode || !animateOnly)) {
|
|
147
|
+
found.push({
|
|
148
|
+
label: `<${tag} animateOnly>`,
|
|
149
|
+
node: animateOnlyNode,
|
|
150
|
+
value: null,
|
|
151
|
+
animateOnly: void 0,
|
|
152
|
+
animateOnlyNode: null,
|
|
153
|
+
blocked: transitionNode ? "the removed `animateOnly` holds a computed list; spell it as `properties` inside the transition" : "the removed `animateOnly` has no `transition` next to it; spell it as `properties` wherever the transition is authored",
|
|
154
|
+
replace: () => {}
|
|
155
|
+
});
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
if (!transitionNode) continue;
|
|
159
|
+
found.push({
|
|
160
|
+
label: `<${tag} transition>`,
|
|
161
|
+
node: transitionNode,
|
|
162
|
+
value: expression,
|
|
163
|
+
animateOnly,
|
|
164
|
+
animateOnlyNode,
|
|
165
|
+
blocked: null,
|
|
166
|
+
replace: (text) => transitionNode.replaceWithText(text.startsWith("\"") ? `transition=${text}` : `transition={${text}}`)
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
for (const call of sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression)) {
|
|
170
|
+
if (!provenance.isTamaguiStyledCall(call)) continue;
|
|
171
|
+
for (const literal of call.getDescendantsOfKind(SyntaxKind.ObjectLiteralExpression)) {
|
|
172
|
+
let transitionNode;
|
|
173
|
+
let animateOnlyNode;
|
|
174
|
+
for (const property of literal.getProperties()) {
|
|
175
|
+
if (!Node.isPropertyAssignment(property)) continue;
|
|
176
|
+
const nameNode = property.getNameNode();
|
|
177
|
+
const name = Node.isIdentifier(nameNode) ? nameNode.getText() : Node.isStringLiteral(nameNode) ? nameNode.getLiteralValue() : null;
|
|
178
|
+
if (name === "transition") transitionNode = property;
|
|
179
|
+
else if (name === "animateOnly") animateOnlyNode = property;
|
|
180
|
+
}
|
|
181
|
+
const { list: animateOnly } = readAnimateOnly(animateOnlyNode ?? null);
|
|
182
|
+
if (animateOnlyNode && (!transitionNode || !animateOnly)) {
|
|
183
|
+
found.push({
|
|
184
|
+
label: `styled(\u2026) animateOnly`,
|
|
185
|
+
node: animateOnlyNode,
|
|
186
|
+
value: null,
|
|
187
|
+
animateOnly: void 0,
|
|
188
|
+
animateOnlyNode: null,
|
|
189
|
+
blocked: transitionNode ? "the removed `animateOnly` holds a computed list; spell it as `properties` inside the transition" : "the removed `animateOnly` has no `transition` next to it; spell it as `properties` wherever the transition is authored",
|
|
190
|
+
replace: () => {}
|
|
191
|
+
});
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
if (!transitionNode || !Node.isPropertyAssignment(transitionNode)) continue;
|
|
195
|
+
const assignment = transitionNode;
|
|
196
|
+
found.push({
|
|
197
|
+
label: `styled(\u2026) transition`,
|
|
198
|
+
node: assignment,
|
|
199
|
+
value: assignment.getInitializerOrThrow(),
|
|
200
|
+
animateOnly,
|
|
201
|
+
animateOnlyNode: animateOnlyNode ?? null,
|
|
202
|
+
blocked: null,
|
|
203
|
+
replace: (text) => assignment.replaceWithText(`transition: ${text}`)
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const reports = [];
|
|
208
|
+
const edits = [];
|
|
209
|
+
for (const candidate of found) {
|
|
210
|
+
const migrated = candidate.blocked ? {
|
|
211
|
+
text: null,
|
|
212
|
+
isString: false,
|
|
213
|
+
error: candidate.blocked
|
|
214
|
+
} : migrateTransitionValue(candidate.value, candidate.animateOnly);
|
|
215
|
+
if (migrated === null) continue;
|
|
216
|
+
const report = {
|
|
217
|
+
label: candidate.label,
|
|
218
|
+
line: candidate.node.getStartLineNumber(),
|
|
219
|
+
before: candidate.node.getText(),
|
|
220
|
+
after: candidate.node.getText(),
|
|
221
|
+
flags: []
|
|
222
|
+
};
|
|
223
|
+
if (migrated.text === null) {
|
|
224
|
+
report.flags.push({
|
|
225
|
+
code: "unsupported-legacy-value",
|
|
226
|
+
detail: migrated.error ?? ""
|
|
227
|
+
});
|
|
228
|
+
} else {
|
|
229
|
+
const text = migrated.isString && Node.isJsxAttribute(candidate.node) ? `"${migrated.text.slice(1, -1).replace(/"/g, """)}"` : migrated.text;
|
|
230
|
+
report.after = Node.isJsxAttribute(candidate.node) ? migrated.isString ? `transition=${text}` : `transition={${text}}` : `transition: ${text}`;
|
|
231
|
+
edits.push({
|
|
232
|
+
start: candidate.node.getStart(),
|
|
233
|
+
apply: () => candidate.replace(text)
|
|
234
|
+
});
|
|
235
|
+
const removed = candidate.animateOnlyNode;
|
|
236
|
+
if (removed) {
|
|
237
|
+
edits.push({
|
|
238
|
+
start: removed.getStart(),
|
|
239
|
+
apply: () => {
|
|
240
|
+
if (Node.isJsxAttribute(removed)) removed.remove();
|
|
241
|
+
else if (Node.isPropertyAssignment(removed)) removed.remove();
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
reports.push(report);
|
|
247
|
+
}
|
|
248
|
+
if (write) {
|
|
249
|
+
edits.sort((left, right) => right.start - left.start);
|
|
250
|
+
for (const edit of edits) edit.apply();
|
|
251
|
+
}
|
|
252
|
+
reports.sort((left, right) => left.line - right.line);
|
|
253
|
+
return reports;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export { convertTransitions };
|
|
257
|
+
//# sourceMappingURL=transition.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transition.js","names":[],"sources":["transition.js"],"sourcesContent":["import { Node, SyntaxKind } from \"ts-morph\";\nimport {\n migrateLegacyTransition,\n printMigratedTransition,\n TRANSITION_RESERVED_KEYS\n} from \"@tamagui/style-grammar/tooling\";\nimport { staticLeafValue, unwrapExpression } from \"./expressions\";\nconst legacySpringKeys = /* @__PURE__ */ new Set([\n \"stiffness\",\n \"damping\",\n \"mass\",\n \"velocity\",\n \"overshootClamping\",\n \"restDisplacementThreshold\",\n \"restSpeedThreshold\",\n \"tension\",\n \"friction\",\n \"bounciness\",\n \"speed\"\n]);\nconst identifierPattern = /^[A-Za-z_$][A-Za-z0-9_$-]*$/;\nfunction staticValue(expression) {\n const current = unwrapExpression(expression);\n const leaf = staticLeafValue(current);\n if (leaf) return { value: leaf.value };\n if (Node.isArrayLiteralExpression(current)) {\n const values = [];\n for (const element of current.getElements()) {\n const item = staticValue(element);\n if (!item) return null;\n values.push(item.value);\n }\n return { value: values };\n }\n if (Node.isObjectLiteralExpression(current)) {\n const value = {};\n for (const property of current.getProperties()) {\n if (!Node.isPropertyAssignment(property)) return null;\n const nameNode = property.getNameNode();\n if (Node.isComputedPropertyName(nameNode)) return null;\n const name = Node.isIdentifier(nameNode) ? nameNode.getText() : Node.isStringLiteral(nameNode) ? nameNode.getLiteralValue() : null;\n if (name === null) return null;\n const item = staticValue(property.getInitializerOrThrow());\n if (!item) return null;\n value[name] = item.value;\n }\n return { value };\n }\n return null;\n}\nfunction animateOnlyList(expression) {\n const evaluated = staticValue(expression);\n if (!evaluated || !Array.isArray(evaluated.value)) return null;\n const list = [];\n for (const item of evaluated.value) {\n if (typeof item !== \"string\") return null;\n list.push(item);\n }\n return list;\n}\nfunction isLegacyTransition(value) {\n if (Array.isArray(value)) return true;\n if (!value || typeof value !== \"object\") return false;\n const object = value;\n if (object.default !== void 0) return true;\n for (const key in object) {\n if (legacySpringKeys.has(key)) return true;\n if (TRANSITION_RESERVED_KEYS.has(key)) continue;\n const entry = object[key];\n if (!entry || typeof entry !== \"object\") continue;\n const config = entry;\n if (config.type !== void 0) return true;\n for (const nested in config) {\n if (legacySpringKeys.has(nested)) return true;\n }\n }\n return false;\n}\nfunction presetNamesIn(value, names) {\n if (typeof value === \"string\") {\n if (identifierPattern.test(value)) names.add(value);\n return;\n }\n if (Array.isArray(value)) {\n for (const item of value) presetNamesIn(item, names);\n return;\n }\n if (!value || typeof value !== \"object\") return;\n for (const key in value) {\n presetNamesIn(value[key], names);\n }\n}\nfunction migrateTransitionValue(expression, animateOnly) {\n if (expression === null) return null;\n const evaluated = staticValue(expression);\n if (!evaluated) {\n if (animateOnly) {\n return {\n text: null,\n isString: false,\n error: \"the removed `animateOnly` narrows a computed transition, so it needs a hand migration to `properties`\"\n };\n }\n return Node.isArrayLiteralExpression(unwrapExpression(expression)) ? {\n text: null,\n isString: false,\n error: \"the v2 transition array form holds a computed value, so it needs a hand migration to `{ preset }`\"\n } : null;\n }\n if (!animateOnly && !isLegacyTransition(evaluated.value)) return null;\n const names = /* @__PURE__ */ new Set();\n presetNamesIn(evaluated.value, names);\n const migrated = migrateLegacyTransition(\n evaluated.value,\n names,\n animateOnly\n );\n if (!migrated.ok) {\n return {\n text: null,\n isString: false,\n error: migrated.diagnostics.map((one) => one.message).join(\"; \")\n };\n }\n return {\n text: printMigratedTransition(migrated.value),\n isString: typeof migrated.value === \"string\",\n error: null\n };\n}\nfunction convertTransitions(sourceFile, provenance, write) {\n const found = [];\n const readAnimateOnly = (node) => {\n if (!node) return { list: void 0 };\n const initializer = Node.isJsxAttribute(node) ? node.getInitializer() : Node.isPropertyAssignment(node) ? node.getInitializer() : void 0;\n const expression = initializer && Node.isJsxExpression(initializer) ? initializer.getExpression() : initializer;\n return { list: (expression && animateOnlyList(expression)) ?? void 0 };\n };\n for (const opening of [\n ...sourceFile.getDescendantsOfKind(SyntaxKind.JsxOpeningElement),\n ...sourceFile.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement)\n ]) {\n if (!provenance.isTamaguiElement(opening)) continue;\n let transitionNode = null;\n let animateOnlyNode = null;\n for (const attribute of opening.getAttributes()) {\n if (!Node.isJsxAttribute(attribute)) continue;\n const name = attribute.getNameNode().getText();\n if (name === \"transition\") transitionNode = attribute;\n else if (name === \"animateOnly\") animateOnlyNode = attribute;\n }\n const initializer = transitionNode?.getInitializer();\n const expression = Node.isJsxExpression(initializer) ? initializer.getExpression() ?? null : Node.isStringLiteral(initializer) ? initializer : null;\n const { list: animateOnly } = readAnimateOnly(animateOnlyNode);\n const tag = opening.getTagNameNode().getText();\n if (animateOnlyNode && (!transitionNode || !animateOnly)) {\n found.push({\n label: `<${tag} animateOnly>`,\n node: animateOnlyNode,\n value: null,\n animateOnly: void 0,\n animateOnlyNode: null,\n blocked: transitionNode ? \"the removed `animateOnly` holds a computed list; spell it as `properties` inside the transition\" : \"the removed `animateOnly` has no `transition` next to it; spell it as `properties` wherever the transition is authored\",\n replace: () => {\n }\n });\n continue;\n }\n if (!transitionNode) continue;\n found.push({\n label: `<${tag} transition>`,\n node: transitionNode,\n value: expression,\n animateOnly,\n animateOnlyNode,\n blocked: null,\n replace: (text) => transitionNode.replaceWithText(\n text.startsWith('\"') ? `transition=${text}` : `transition={${text}}`\n )\n });\n }\n for (const call of sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression)) {\n if (!provenance.isTamaguiStyledCall(call)) continue;\n for (const literal of call.getDescendantsOfKind(SyntaxKind.ObjectLiteralExpression)) {\n let transitionNode;\n let animateOnlyNode;\n for (const property of literal.getProperties()) {\n if (!Node.isPropertyAssignment(property)) continue;\n const nameNode = property.getNameNode();\n const name = Node.isIdentifier(nameNode) ? nameNode.getText() : Node.isStringLiteral(nameNode) ? nameNode.getLiteralValue() : null;\n if (name === \"transition\") transitionNode = property;\n else if (name === \"animateOnly\") animateOnlyNode = property;\n }\n const { list: animateOnly } = readAnimateOnly(animateOnlyNode ?? null);\n if (animateOnlyNode && (!transitionNode || !animateOnly)) {\n found.push({\n label: `styled(\\u2026) animateOnly`,\n node: animateOnlyNode,\n value: null,\n animateOnly: void 0,\n animateOnlyNode: null,\n blocked: transitionNode ? \"the removed `animateOnly` holds a computed list; spell it as `properties` inside the transition\" : \"the removed `animateOnly` has no `transition` next to it; spell it as `properties` wherever the transition is authored\",\n replace: () => {\n }\n });\n continue;\n }\n if (!transitionNode || !Node.isPropertyAssignment(transitionNode)) continue;\n const assignment = transitionNode;\n found.push({\n label: `styled(\\u2026) transition`,\n node: assignment,\n value: assignment.getInitializerOrThrow(),\n animateOnly,\n animateOnlyNode: animateOnlyNode ?? null,\n blocked: null,\n replace: (text) => assignment.replaceWithText(`transition: ${text}`)\n });\n }\n }\n const reports = [];\n const edits = [];\n for (const candidate of found) {\n const migrated = candidate.blocked ? { text: null, isString: false, error: candidate.blocked } : migrateTransitionValue(candidate.value, candidate.animateOnly);\n if (migrated === null) continue;\n const report = {\n label: candidate.label,\n line: candidate.node.getStartLineNumber(),\n before: candidate.node.getText(),\n after: candidate.node.getText(),\n flags: []\n };\n if (migrated.text === null) {\n report.flags.push({\n code: \"unsupported-legacy-value\",\n detail: migrated.error ?? \"\"\n });\n } else {\n const text = migrated.isString && Node.isJsxAttribute(candidate.node) ? `\"${migrated.text.slice(1, -1).replace(/\"/g, \""\")}\"` : migrated.text;\n report.after = Node.isJsxAttribute(candidate.node) ? migrated.isString ? `transition=${text}` : `transition={${text}}` : `transition: ${text}`;\n edits.push({\n start: candidate.node.getStart(),\n apply: () => candidate.replace(text)\n });\n const removed = candidate.animateOnlyNode;\n if (removed) {\n edits.push({\n start: removed.getStart(),\n apply: () => {\n if (Node.isJsxAttribute(removed)) removed.remove();\n else if (Node.isPropertyAssignment(removed)) removed.remove();\n }\n });\n }\n }\n reports.push(report);\n }\n if (write) {\n edits.sort((left, right) => right.start - left.start);\n for (const edit of edits) edit.apply();\n }\n reports.sort((left, right) => left.line - right.line);\n return reports;\n}\nexport {\n convertTransitions\n};\n//# sourceMappingURL=transition.js.map\n"],"mappings":";;;;;AAOA,MAAM,mCAAmC,IAAI,IAAI;CAC/C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,MAAM,oBAAoB;AAC1B,SAAS,YAAY,YAAY;CAC/B,MAAM,UAAU,iBAAiB,UAAU;CAC3C,MAAM,OAAO,gBAAgB,OAAO;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