@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
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { dirname, relative, resolve } from "node:path";
|
|
4
|
+
import { resolveTamaguiHost } from "@tamagui/language-service/host";
|
|
5
|
+
import { stylePropsTextOnly } from "@tamagui/helpers";
|
|
6
|
+
import { IndentationText, ModuleKind, ModuleResolutionKind, Node, Project, ScriptTarget, SyntaxKind, ts } from "ts-morph";
|
|
7
|
+
import { planContainers } from "./containers.mjs";
|
|
8
|
+
import { convertJsxSite, convertStyleObject } from "./convert.mjs";
|
|
9
|
+
import { compact, unwrapExpression } from "./expressions.mjs";
|
|
10
|
+
import { addFunctionalVariantTypeImports, convertFunctionalVariants } from "./functionalVariants.mjs";
|
|
11
|
+
import { codemodMediaNames, createModifierRegistry, grammarPlatformNames, shorthands } from "./grammar.mjs";
|
|
12
|
+
import { createProvenance } from "./provenance.mjs";
|
|
13
|
+
import { renderReport } from "./report.mjs";
|
|
14
|
+
import { convertSheetFrames } from "./sheetAnatomy.mjs";
|
|
15
|
+
import { convertTransitions } from "./transition.mjs";
|
|
16
|
+
|
|
17
|
+
const projectRoot = process.cwd();
|
|
18
|
+
const defaultReportPath = resolve(projectRoot, "tamagui-flat-values-report.md");
|
|
19
|
+
const ignoreMarker = ".tamagui-flat-values-ignore";
|
|
20
|
+
const ignoredDirectories = /* @__PURE__ */ new Map();
|
|
21
|
+
function isIgnored(filePath) {
|
|
22
|
+
let directory = dirname(filePath);
|
|
23
|
+
const visited = [];
|
|
24
|
+
while (directory === projectRoot || !relative(projectRoot, directory).startsWith("..")) {
|
|
25
|
+
const cached = ignoredDirectories.get(directory);
|
|
26
|
+
if (cached !== void 0) {
|
|
27
|
+
for (const seen of visited) ignoredDirectories.set(seen, cached);
|
|
28
|
+
return cached;
|
|
29
|
+
}
|
|
30
|
+
visited.push(directory);
|
|
31
|
+
if (existsSync(resolve(directory, ignoreMarker))) {
|
|
32
|
+
for (const seen of visited) ignoredDirectories.set(seen, true);
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
if (directory === projectRoot) break;
|
|
36
|
+
const parent = dirname(directory);
|
|
37
|
+
if (parent === directory) break;
|
|
38
|
+
directory = parent;
|
|
39
|
+
}
|
|
40
|
+
for (const seen of visited) ignoredDirectories.set(seen, false);
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
function collectFiles(inputs2) {
|
|
44
|
+
const tsConfigFilePath = resolve(projectRoot, "tsconfig.json");
|
|
45
|
+
if (!existsSync(tsConfigFilePath)) {
|
|
46
|
+
console.error(`no tsconfig.json in ${projectRoot}; run the codemod from your project root`);
|
|
47
|
+
process.exit(2);
|
|
48
|
+
}
|
|
49
|
+
const project = new Project({
|
|
50
|
+
tsConfigFilePath,
|
|
51
|
+
skipAddingFilesFromTsConfig: true,
|
|
52
|
+
manipulationSettings: { indentationText: IndentationText.TwoSpaces },
|
|
53
|
+
compilerOptions: {
|
|
54
|
+
allowJs: false,
|
|
55
|
+
jsx: 4,
|
|
56
|
+
target: ScriptTarget.ES2020,
|
|
57
|
+
module: ModuleKind.ESNext,
|
|
58
|
+
moduleResolution: ModuleResolutionKind.NodeJs,
|
|
59
|
+
skipLibCheck: true,
|
|
60
|
+
strictNullChecks: true,
|
|
61
|
+
baseUrl: projectRoot
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
const files2 = /* @__PURE__ */ new Map();
|
|
65
|
+
const ignored = /* @__PURE__ */ new Set();
|
|
66
|
+
const missing = [];
|
|
67
|
+
for (const input of inputs2) {
|
|
68
|
+
const path = resolve(projectRoot, input);
|
|
69
|
+
if (!existsSync(path)) {
|
|
70
|
+
missing.push(input);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const pattern = /\.[cm]?[jt]sx?$/.test(path) ? path : `${path}/**/*.{ts,tsx}`;
|
|
74
|
+
const matched = project.addSourceFilesAtPaths(pattern);
|
|
75
|
+
if (!matched.length) missing.push(input);
|
|
76
|
+
for (const file of matched) {
|
|
77
|
+
const filePath = file.getFilePath();
|
|
78
|
+
if (isIgnored(filePath)) ignored.add(filePath);
|
|
79
|
+
else files2.set(filePath, file);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (missing.length) {
|
|
83
|
+
console.error(`no source file matched ${missing.map((input) => `"${input}"`).join(", ")}`);
|
|
84
|
+
process.exit(2);
|
|
85
|
+
}
|
|
86
|
+
if (files2.size === 0 && ignored.size > 0) {
|
|
87
|
+
console.error(`all ${ignored.size} matched source ${ignored.size === 1 ? "file was" : "files were"} skipped by ${ignoreMarker}; no migration report was written`);
|
|
88
|
+
process.exit(2);
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
sourceFiles: [...files2.values()].sort((left, right) => left.getFilePath().localeCompare(right.getFilePath())),
|
|
92
|
+
ignoredFiles: ignored.size
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function themeNames(sourceFiles2) {
|
|
96
|
+
const names = /* @__PURE__ */ new Set(["light", "dark"]);
|
|
97
|
+
for (const sourceFile of sourceFiles2) {
|
|
98
|
+
for (const name of conditionNames(sourceFile)) {
|
|
99
|
+
if (name.startsWith("$theme-")) names.add(name.slice("$theme-".length));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return names;
|
|
103
|
+
}
|
|
104
|
+
function mediaNames(sourceFiles2) {
|
|
105
|
+
const names = new Set(codemodMediaNames);
|
|
106
|
+
for (const sourceFile of sourceFiles2) {
|
|
107
|
+
for (const name of conditionNames(sourceFile)) {
|
|
108
|
+
if (!name.startsWith("$")) continue;
|
|
109
|
+
if (name.startsWith("$theme-") || name.startsWith("$platform-") || name.startsWith("$group-") || grammarPlatformNames.has(name.slice(1))) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
names.add(name.slice(1));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return names;
|
|
116
|
+
}
|
|
117
|
+
function conditionNames(sourceFile) {
|
|
118
|
+
const names = [];
|
|
119
|
+
for (const attribute of sourceFile.getDescendantsOfKind(SyntaxKind.JsxAttribute)) {
|
|
120
|
+
const name = attribute.getNameNode();
|
|
121
|
+
if (Node.isIdentifier(name)) names.push(name.getText());
|
|
122
|
+
}
|
|
123
|
+
for (const property of sourceFile.getDescendantsOfKind(SyntaxKind.PropertyAssignment)) {
|
|
124
|
+
const name = property.getNameNode();
|
|
125
|
+
if (Node.isComputedPropertyName(name)) continue;
|
|
126
|
+
names.push(name.getText().replace(/^['"]|['"]$/g, ""));
|
|
127
|
+
}
|
|
128
|
+
return names;
|
|
129
|
+
}
|
|
130
|
+
function variantStyleObjects(value) {
|
|
131
|
+
const current = unwrapExpression(value);
|
|
132
|
+
if (Node.isObjectLiteralExpression(current)) return [current];
|
|
133
|
+
if (Node.isConditionalExpression(current)) {
|
|
134
|
+
return [...variantStyleObjects(current.getWhenTrue()), ...variantStyleObjects(current.getWhenFalse())];
|
|
135
|
+
}
|
|
136
|
+
if (Node.isArrowFunction(current) || Node.isFunctionExpression(current)) {
|
|
137
|
+
const body = current.getBody();
|
|
138
|
+
if (Node.isBlock(body)) {
|
|
139
|
+
return body.getDescendantsOfKind(SyntaxKind.ReturnStatement).flatMap((statement) => {
|
|
140
|
+
const returned = statement.getExpression();
|
|
141
|
+
return returned ? variantStyleObjects(returned) : [];
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
return variantStyleObjects(body);
|
|
145
|
+
}
|
|
146
|
+
return [];
|
|
147
|
+
}
|
|
148
|
+
function variantSites(config, label, registry, containers, targets, host, write2) {
|
|
149
|
+
const sites = [];
|
|
150
|
+
const defaults = config.getProperty("defaultVariants");
|
|
151
|
+
if (Node.isPropertyAssignment(defaults)) {
|
|
152
|
+
const object = unwrapExpression(defaults.getInitializerOrThrow());
|
|
153
|
+
if (Node.isObjectLiteralExpression(object)) {
|
|
154
|
+
const site = convertStyleObject(object, "styled", `${label} defaultVariants`, registry, containers, targets, host, write2);
|
|
155
|
+
if (site) sites.push(site);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const variants = config.getProperty("variants");
|
|
159
|
+
if (Node.isPropertyAssignment(variants)) {
|
|
160
|
+
const object = unwrapExpression(variants.getInitializerOrThrow());
|
|
161
|
+
if (Node.isObjectLiteralExpression(object)) {
|
|
162
|
+
for (const variant of object.getProperties()) {
|
|
163
|
+
if (!Node.isPropertyAssignment(variant)) continue;
|
|
164
|
+
const variantName = compact(variant.getNameNode().getText());
|
|
165
|
+
const branches = unwrapExpression(variant.getInitializerOrThrow());
|
|
166
|
+
if (Node.isCallExpression(branches)) {
|
|
167
|
+
const callee = branches.getExpression();
|
|
168
|
+
if (Node.isPropertyAccessExpression(callee) && callee.getName() === "dynamic") {
|
|
169
|
+
const body = branches.getArguments()[0];
|
|
170
|
+
if (body && Node.isExpression(body)) {
|
|
171
|
+
for (const style of variantStyleObjects(body)) {
|
|
172
|
+
const site = convertStyleObject(style, "styled", `${label} variants.${variantName}`, registry, containers, targets, host, write2);
|
|
173
|
+
if (site) sites.push(site);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
if (!Node.isObjectLiteralExpression(branches)) continue;
|
|
180
|
+
for (const branch of branches.getProperties()) {
|
|
181
|
+
if (!Node.isPropertyAssignment(branch)) continue;
|
|
182
|
+
const branchName = compact(branch.getNameNode().getText());
|
|
183
|
+
for (const style of variantStyleObjects(branch.getInitializerOrThrow())) {
|
|
184
|
+
const site = convertStyleObject(style, "styled", `${label} variants.${variantName}.${branchName}`, registry, containers, targets, host, write2);
|
|
185
|
+
if (site) sites.push(site);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return sites;
|
|
192
|
+
}
|
|
193
|
+
function conversionTargets(filePath) {
|
|
194
|
+
if (/\.web\.[cm]?[jt]sx?$/.test(filePath)) return "web";
|
|
195
|
+
if (/\.native\.[cm]?[jt]sx?$/.test(filePath)) return "native";
|
|
196
|
+
return "shared";
|
|
197
|
+
}
|
|
198
|
+
const shorthandSpellings = /* @__PURE__ */ new Map();
|
|
199
|
+
for (const [shorthand, longhand] of Object.entries(shorthands)) {
|
|
200
|
+
const spellings = shorthandSpellings.get(longhand);
|
|
201
|
+
if (spellings) spellings.push(shorthand);
|
|
202
|
+
else shorthandSpellings.set(longhand, [shorthand]);
|
|
203
|
+
}
|
|
204
|
+
function typeAwareHost(node) {
|
|
205
|
+
const checker = node.getProject().getTypeChecker().compilerObject;
|
|
206
|
+
const host = resolveTamaguiHost(checker, node.compilerNode);
|
|
207
|
+
if (!host) return host;
|
|
208
|
+
const accepts = (property) => host.accepts(property) || (shorthandSpellings.get(property)?.some((spelling) => host.accepts(spelling)) ?? false);
|
|
209
|
+
if (node.getText() !== "View") return {
|
|
210
|
+
...host,
|
|
211
|
+
accepts
|
|
212
|
+
};
|
|
213
|
+
return {
|
|
214
|
+
...host,
|
|
215
|
+
accepts: (property) => !(property in stylePropsTextOnly) && accepts(property)
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
function inspectFile(sourceFile, registry, provenance2, write2) {
|
|
219
|
+
const sheetFrames = convertSheetFrames(sourceFile, provenance2, write2);
|
|
220
|
+
const transitions = convertTransitions(sourceFile, provenance2, write2);
|
|
221
|
+
const containers = planContainers(sourceFile, registry);
|
|
222
|
+
const targets = conversionTargets(sourceFile.getFilePath());
|
|
223
|
+
const sites = [];
|
|
224
|
+
const functionalVariants = [];
|
|
225
|
+
const requiredTypeImports = [];
|
|
226
|
+
const styledCalls = sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression).filter((call) => provenance2.isTamaguiStyledCall(call)).sort((left, right) => right.getStart() - left.getStart());
|
|
227
|
+
const jsxOpenings = [...sourceFile.getDescendantsOfKind(SyntaxKind.JsxOpeningElement), ...sourceFile.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement)].filter((opening) => provenance2.isTamaguiElement(opening)).sort((left, right) => right.getStart() - left.getStart());
|
|
228
|
+
for (const opening of jsxOpenings) {
|
|
229
|
+
const site = convertJsxSite(opening, registry, containers, targets, typeAwareHost(opening.getTagNameNode()), write2);
|
|
230
|
+
if (site) sites.push(site);
|
|
231
|
+
}
|
|
232
|
+
for (const call of styledCalls) {
|
|
233
|
+
const component = call.getArguments()[0];
|
|
234
|
+
const host = component ? typeAwareHost(component) : void 0;
|
|
235
|
+
const config = unwrapExpression(call.getArguments()[1] ?? call);
|
|
236
|
+
if (!Node.isObjectLiteralExpression(config)) continue;
|
|
237
|
+
const label = `styled(${compact(call.getArguments()[0]?.getText() ?? "unknown")}, \u2026)`;
|
|
238
|
+
sites.push(...variantSites(config, label, registry, containers, targets, host, write2));
|
|
239
|
+
const functional = convertFunctionalVariants(config, label, write2);
|
|
240
|
+
functionalVariants.push(...functional.sites);
|
|
241
|
+
requiredTypeImports.push(...functional.requiredTypeImports);
|
|
242
|
+
const site = convertStyleObject(config, "styled", label, registry, containers, targets, host, write2);
|
|
243
|
+
if (site) sites.push(site);
|
|
244
|
+
}
|
|
245
|
+
sites.sort((left, right) => left.line - right.line || left.label.localeCompare(right.label));
|
|
246
|
+
functionalVariants.sort((left, right) => left.line - right.line || left.label.localeCompare(right.label));
|
|
247
|
+
if (write2) addFunctionalVariantTypeImports(sourceFile, requiredTypeImports);
|
|
248
|
+
return {
|
|
249
|
+
file: relative(projectRoot, sourceFile.getFilePath()),
|
|
250
|
+
sites,
|
|
251
|
+
functionalVariants,
|
|
252
|
+
sheetFrames,
|
|
253
|
+
transitions
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
const usage = `Converts Tamagui style syntax to V3 flat property values and reports what it cannot convert.
|
|
257
|
+
|
|
258
|
+
npx @tamagui/codemod-flat-values [options] <files or directories...>
|
|
259
|
+
|
|
260
|
+
--report <path> where to write the Markdown report (default: ${relative(projectRoot, defaultReportPath)})
|
|
261
|
+
--json <path> also write the machine-readable report
|
|
262
|
+
--write rewrite every statically safe conversion in place
|
|
263
|
+
--help print this
|
|
264
|
+
|
|
265
|
+
Run it from your project root, which is where paths and the tsconfig resolve from.
|
|
266
|
+
Source files are only written with --write.`;
|
|
267
|
+
function parseArguments(argv) {
|
|
268
|
+
const inputs2 = [];
|
|
269
|
+
let reportPath2 = defaultReportPath;
|
|
270
|
+
let jsonPath2 = null;
|
|
271
|
+
let write2 = false;
|
|
272
|
+
for (let index = 0; index < argv.length; index++) {
|
|
273
|
+
const argument = argv[index];
|
|
274
|
+
if (argument === "--help" || argument === "-h") {
|
|
275
|
+
console.log(usage);
|
|
276
|
+
process.exit(0);
|
|
277
|
+
}
|
|
278
|
+
if (argument === "--write") {
|
|
279
|
+
write2 = true;
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
if (argument === "--report" || argument === "--json") {
|
|
283
|
+
const next = argv[index + 1];
|
|
284
|
+
if (!next) {
|
|
285
|
+
console.error(`${argument} requires a path
|
|
286
|
+
|
|
287
|
+
${usage}`);
|
|
288
|
+
process.exit(2);
|
|
289
|
+
}
|
|
290
|
+
if (argument === "--report") reportPath2 = resolve(next);
|
|
291
|
+
else jsonPath2 = resolve(next);
|
|
292
|
+
index++;
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
if (argument.startsWith("-")) {
|
|
296
|
+
console.error(`unknown option "${argument}"
|
|
297
|
+
|
|
298
|
+
${usage}`);
|
|
299
|
+
process.exit(2);
|
|
300
|
+
}
|
|
301
|
+
inputs2.push(argument);
|
|
302
|
+
}
|
|
303
|
+
if (!inputs2.length) {
|
|
304
|
+
console.error(`no files or directories given
|
|
305
|
+
|
|
306
|
+
${usage}`);
|
|
307
|
+
process.exit(2);
|
|
308
|
+
}
|
|
309
|
+
return {
|
|
310
|
+
reportPath: reportPath2,
|
|
311
|
+
jsonPath: jsonPath2,
|
|
312
|
+
inputs: inputs2,
|
|
313
|
+
write: write2
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
const { reportPath, jsonPath, inputs, write } = parseArguments(process.argv.slice(2));
|
|
317
|
+
const { sourceFiles, ignoredFiles } = collectFiles(inputs);
|
|
318
|
+
for (const sourceFile of sourceFiles) {
|
|
319
|
+
const diagnostics = sourceFile.compilerNode.parseDiagnostics;
|
|
320
|
+
if (diagnostics?.length) {
|
|
321
|
+
console.error(`${relative(projectRoot, sourceFile.getFilePath())}: source has parse errors; no files were written`);
|
|
322
|
+
process.exit(2);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
const originals = new Map(sourceFiles.map((sourceFile) => [sourceFile.getFilePath(), sourceFile.getFullText()]));
|
|
326
|
+
const modifierRegistry = createModifierRegistry({
|
|
327
|
+
mediaNames: mediaNames(sourceFiles),
|
|
328
|
+
themeNames: themeNames(sourceFiles)
|
|
329
|
+
});
|
|
330
|
+
const provenance = createProvenance();
|
|
331
|
+
const files = sourceFiles.map((sourceFile) => inspectFile(sourceFile, modifierRegistry.registry, provenance, write));
|
|
332
|
+
if (write) {
|
|
333
|
+
for (const sourceFile of sourceFiles) {
|
|
334
|
+
const filePath = sourceFile.getFilePath();
|
|
335
|
+
const parsed = ts.createSourceFile(filePath, sourceFile.getFullText(), ScriptTarget.Latest, true, filePath.endsWith("x") ? ts.ScriptKind.TSX : ts.ScriptKind.TS);
|
|
336
|
+
if (parsed.parseDiagnostics?.length) {
|
|
337
|
+
const details = parsed.parseDiagnostics.map((diagnostic) => {
|
|
338
|
+
const start = diagnostic.start ?? 0;
|
|
339
|
+
const position = parsed.getLineAndCharacterOfPosition(start);
|
|
340
|
+
const line = parsed.text.split(/\r?\n/)[position.line] ?? "";
|
|
341
|
+
return `${position.line + 1}:${position.character + 1} ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}
|
|
342
|
+
${line.trim()}`;
|
|
343
|
+
}).join("\n");
|
|
344
|
+
console.error(`${relative(projectRoot, filePath)}: rewrite produced parse errors; no files were written
|
|
345
|
+
${details}`);
|
|
346
|
+
process.exit(2);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
const { text, summary } = renderReport(files, inputs.map((input) => relative(projectRoot, resolve(projectRoot, input))), modifierRegistry.diagnostics, ignoredFiles, write);
|
|
351
|
+
mkdirSync(dirname(reportPath), { recursive: true });
|
|
352
|
+
writeFileSync(reportPath, text);
|
|
353
|
+
if (jsonPath !== null) {
|
|
354
|
+
mkdirSync(dirname(jsonPath), { recursive: true });
|
|
355
|
+
writeFileSync(jsonPath, `${JSON.stringify({
|
|
356
|
+
files,
|
|
357
|
+
summary
|
|
358
|
+
}, null, 2)}
|
|
359
|
+
`);
|
|
360
|
+
}
|
|
361
|
+
let written = 0;
|
|
362
|
+
if (write) {
|
|
363
|
+
for (const sourceFile of sourceFiles) {
|
|
364
|
+
const next = sourceFile.getFullText();
|
|
365
|
+
if (next === originals.get(sourceFile.getFilePath())) continue;
|
|
366
|
+
writeFileSync(sourceFile.getFilePath(), next);
|
|
367
|
+
written++;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
console.log(`wrote ${reportPath}`);
|
|
371
|
+
if (write) console.log(`rewrote ${written} source files`);
|
|
372
|
+
console.log(`${summary.sites} style sites: ${summary.clean - summary.waiting} clean, ${summary.needsRelocation} need relocation, ${summary.unknownHost} unknown host, ${summary.ineligible} ineligible, ${summary.waiting} waiting on runtime support, ${summary.flagged} syntax-flagged; ${summary.functionalVariantSites} functional variants: ${summary.functionalVariantConverted} automatic, ${summary.functionalVariantFlagged} flagged; ${summary.sheetFrames} Sheet.Frame sites: ${summary.sheetFramesFlagged} need review; ${summary.transitions} v2 transitions: ${summary.transitionsFlagged} need review; ${summary.ignoredFiles} source files ignored`);
|
|
373
|
+
|
|
374
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["index.js"],"sourcesContent":["#!/usr/bin/env node\nimport { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, relative, resolve } from \"node:path\";\nimport { resolveTamaguiHost } from \"@tamagui/language-service/host\";\nimport { stylePropsTextOnly } from \"@tamagui/helpers\";\nimport {\n IndentationText,\n ModuleKind,\n ModuleResolutionKind,\n Node,\n Project,\n ScriptTarget,\n SyntaxKind,\n ts\n} from \"ts-morph\";\nimport { planContainers } from \"./containers\";\nimport { convertJsxSite, convertStyleObject } from \"./convert\";\nimport { compact, unwrapExpression } from \"./expressions\";\nimport {\n addFunctionalVariantTypeImports,\n convertFunctionalVariants\n} from \"./functionalVariants\";\nimport {\n codemodMediaNames,\n createModifierRegistry,\n grammarPlatformNames,\n shorthands\n} from \"./grammar\";\nimport { createProvenance } from \"./provenance\";\nimport { renderReport } from \"./report\";\nimport { convertSheetFrames } from \"./sheetAnatomy\";\nimport { convertTransitions } from \"./transition\";\nconst projectRoot = process.cwd();\nconst defaultReportPath = resolve(projectRoot, \"tamagui-flat-values-report.md\");\nconst ignoreMarker = \".tamagui-flat-values-ignore\";\nconst ignoredDirectories = /* @__PURE__ */ new Map();\nfunction isIgnored(filePath) {\n let directory = dirname(filePath);\n const visited = [];\n while (directory === projectRoot || !relative(projectRoot, directory).startsWith(\"..\")) {\n const cached = ignoredDirectories.get(directory);\n if (cached !== void 0) {\n for (const seen of visited) ignoredDirectories.set(seen, cached);\n return cached;\n }\n visited.push(directory);\n if (existsSync(resolve(directory, ignoreMarker))) {\n for (const seen of visited) ignoredDirectories.set(seen, true);\n return true;\n }\n if (directory === projectRoot) break;\n const parent = dirname(directory);\n if (parent === directory) break;\n directory = parent;\n }\n for (const seen of visited) ignoredDirectories.set(seen, false);\n return false;\n}\nfunction collectFiles(inputs2) {\n const tsConfigFilePath = resolve(projectRoot, \"tsconfig.json\");\n if (!existsSync(tsConfigFilePath)) {\n console.error(\n `no tsconfig.json in ${projectRoot}; run the codemod from your project root`\n );\n process.exit(2);\n }\n const project = new Project({\n tsConfigFilePath,\n skipAddingFilesFromTsConfig: true,\n // ts-morph re-indents every multi-line replacement from the indentation it\n // computes for the node with this unit. The default four-space unit puts a\n // JSX child two columns past where two-space source authored it, and every\n // attribute line of a rewritten element staggered with it\n manipulationSettings: { indentationText: IndentationText.TwoSpaces },\n compilerOptions: {\n allowJs: false,\n jsx: 4,\n target: ScriptTarget.ES2020,\n module: ModuleKind.ESNext,\n moduleResolution: ModuleResolutionKind.NodeJs,\n skipLibCheck: true,\n strictNullChecks: true,\n baseUrl: projectRoot\n }\n });\n const files2 = /* @__PURE__ */ new Map();\n const ignored = /* @__PURE__ */ new Set();\n const missing = [];\n for (const input of inputs2) {\n const path = resolve(projectRoot, input);\n if (!existsSync(path)) {\n missing.push(input);\n continue;\n }\n const pattern = /\\.[cm]?[jt]sx?$/.test(path) ? path : `${path}/**/*.{ts,tsx}`;\n const matched = project.addSourceFilesAtPaths(pattern);\n if (!matched.length) missing.push(input);\n for (const file of matched) {\n const filePath = file.getFilePath();\n if (isIgnored(filePath)) ignored.add(filePath);\n else files2.set(filePath, file);\n }\n }\n if (missing.length) {\n console.error(\n `no source file matched ${missing.map((input) => `\"${input}\"`).join(\", \")}`\n );\n process.exit(2);\n }\n if (files2.size === 0 && ignored.size > 0) {\n console.error(\n `all ${ignored.size} matched source ${ignored.size === 1 ? \"file was\" : \"files were\"} skipped by ${ignoreMarker}; no migration report was written`\n );\n process.exit(2);\n }\n return {\n sourceFiles: [...files2.values()].sort(\n (left, right) => left.getFilePath().localeCompare(right.getFilePath())\n ),\n ignoredFiles: ignored.size\n };\n}\nfunction themeNames(sourceFiles2) {\n const names = /* @__PURE__ */ new Set([\"light\", \"dark\"]);\n for (const sourceFile of sourceFiles2) {\n for (const name of conditionNames(sourceFile)) {\n if (name.startsWith(\"$theme-\")) names.add(name.slice(\"$theme-\".length));\n }\n }\n return names;\n}\nfunction mediaNames(sourceFiles2) {\n const names = new Set(codemodMediaNames);\n for (const sourceFile of sourceFiles2) {\n for (const name of conditionNames(sourceFile)) {\n if (!name.startsWith(\"$\")) continue;\n if (name.startsWith(\"$theme-\") || name.startsWith(\"$platform-\") || name.startsWith(\"$group-\") || grammarPlatformNames.has(name.slice(1))) {\n continue;\n }\n names.add(name.slice(1));\n }\n }\n return names;\n}\nfunction conditionNames(sourceFile) {\n const names = [];\n for (const attribute of sourceFile.getDescendantsOfKind(SyntaxKind.JsxAttribute)) {\n const name = attribute.getNameNode();\n if (Node.isIdentifier(name)) names.push(name.getText());\n }\n for (const property of sourceFile.getDescendantsOfKind(SyntaxKind.PropertyAssignment)) {\n const name = property.getNameNode();\n if (Node.isComputedPropertyName(name)) continue;\n names.push(name.getText().replace(/^['\"]|['\"]$/g, \"\"));\n }\n return names;\n}\nfunction variantStyleObjects(value) {\n const current = unwrapExpression(value);\n if (Node.isObjectLiteralExpression(current)) return [current];\n if (Node.isConditionalExpression(current)) {\n return [\n ...variantStyleObjects(current.getWhenTrue()),\n ...variantStyleObjects(current.getWhenFalse())\n ];\n }\n if (Node.isArrowFunction(current) || Node.isFunctionExpression(current)) {\n const body = current.getBody();\n if (Node.isBlock(body)) {\n return body.getDescendantsOfKind(SyntaxKind.ReturnStatement).flatMap((statement) => {\n const returned = statement.getExpression();\n return returned ? variantStyleObjects(returned) : [];\n });\n }\n return variantStyleObjects(body);\n }\n return [];\n}\nfunction variantSites(config, label, registry, containers, targets, host, write2) {\n const sites = [];\n const defaults = config.getProperty(\"defaultVariants\");\n if (Node.isPropertyAssignment(defaults)) {\n const object = unwrapExpression(defaults.getInitializerOrThrow());\n if (Node.isObjectLiteralExpression(object)) {\n const site = convertStyleObject(\n object,\n \"styled\",\n `${label} defaultVariants`,\n registry,\n containers,\n targets,\n host,\n write2\n );\n if (site) sites.push(site);\n }\n }\n const variants = config.getProperty(\"variants\");\n if (Node.isPropertyAssignment(variants)) {\n const object = unwrapExpression(variants.getInitializerOrThrow());\n if (Node.isObjectLiteralExpression(object)) {\n for (const variant of object.getProperties()) {\n if (!Node.isPropertyAssignment(variant)) continue;\n const variantName = compact(variant.getNameNode().getText());\n const branches = unwrapExpression(variant.getInitializerOrThrow());\n if (Node.isCallExpression(branches)) {\n const callee = branches.getExpression();\n if (Node.isPropertyAccessExpression(callee) && callee.getName() === \"dynamic\") {\n const body = branches.getArguments()[0];\n if (body && Node.isExpression(body)) {\n for (const style of variantStyleObjects(body)) {\n const site = convertStyleObject(\n style,\n \"styled\",\n `${label} variants.${variantName}`,\n registry,\n containers,\n targets,\n host,\n write2\n );\n if (site) sites.push(site);\n }\n }\n }\n continue;\n }\n if (!Node.isObjectLiteralExpression(branches)) continue;\n for (const branch of branches.getProperties()) {\n if (!Node.isPropertyAssignment(branch)) continue;\n const branchName = compact(branch.getNameNode().getText());\n for (const style of variantStyleObjects(branch.getInitializerOrThrow())) {\n const site = convertStyleObject(\n style,\n \"styled\",\n `${label} variants.${variantName}.${branchName}`,\n registry,\n containers,\n targets,\n host,\n write2\n );\n if (site) sites.push(site);\n }\n }\n }\n }\n }\n return sites;\n}\nfunction conversionTargets(filePath) {\n if (/\\.web\\.[cm]?[jt]sx?$/.test(filePath)) return \"web\";\n if (/\\.native\\.[cm]?[jt]sx?$/.test(filePath)) return \"native\";\n return \"shared\";\n}\nconst shorthandSpellings = /* @__PURE__ */ new Map();\nfor (const [shorthand, longhand] of Object.entries(shorthands)) {\n const spellings = shorthandSpellings.get(longhand);\n if (spellings) spellings.push(shorthand);\n else shorthandSpellings.set(longhand, [shorthand]);\n}\nfunction typeAwareHost(node) {\n const checker = node.getProject().getTypeChecker().compilerObject;\n const host = resolveTamaguiHost(\n checker,\n node.compilerNode\n );\n if (!host) return host;\n const accepts = (property) => host.accepts(property) || (shorthandSpellings.get(property)?.some((spelling) => host.accepts(spelling)) ?? false);\n if (node.getText() !== \"View\") return { ...host, accepts };\n return {\n ...host,\n accepts: (property) => !(property in stylePropsTextOnly) && accepts(property)\n };\n}\nfunction inspectFile(sourceFile, registry, provenance2, write2) {\n const sheetFrames = convertSheetFrames(sourceFile, provenance2, write2);\n const transitions = convertTransitions(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 transitions\n };\n}\nconst usage = `Converts Tamagui style syntax to V3 flat property values and reports what it cannot convert.\n\n npx @tamagui/codemod-flat-values [options] <files or directories...>\n\n --report <path> where to write the Markdown report (default: ${relative(\n projectRoot,\n defaultReportPath\n)})\n --json <path> also write the machine-readable report\n --write rewrite every statically safe conversion in place\n --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.transitions} v2 transitions: ${summary.transitionsFlagged} need review; ${summary.ignoredFiles} source files ignored`\n);\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;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