@tamagui/codemod-flat-values 0.0.0-bootstrap.0 → 3.0.0-beta.643.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 +211 -1
- package/dist/builtInNames.mjs +13 -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 +1139 -0
- package/dist/convert.mjs.map +1 -0
- package/dist/expressions.mjs +188 -0
- package/dist/expressions.mjs.map +1 -0
- package/dist/grammar.mjs +68 -0
- package/dist/grammar.mjs.map +1 -0
- package/dist/index.mjs +342 -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 +129 -0
- package/dist/report.mjs.map +1 -0
- package/dist/structuredNative.mjs +275 -0
- package/dist/structuredNative.mjs.map +1 -0
- package/package.json +35 -7
- package/src/builtInNames.ts +21 -0
- package/src/containers.ts +227 -0
- package/src/convert.ts +1784 -0
- package/src/expressions.ts +220 -0
- package/src/grammar.ts +180 -0
- package/src/index.ts +517 -0
- package/src/legacyConditions.ts +346 -0
- package/src/legacyNames.ts +160 -0
- package/src/provenance.ts +210 -0
- package/src/report.ts +235 -0
- package/src/structuredNative.ts +459 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacyConditions.js","names":[],"sources":["legacyConditions.js"],"sourcesContent":["import {\n transformFamilyProps,\n unitlessNumberProperties\n} from \"@tamagui/style-grammar/tooling\";\nconst pseudoToModifier = Object.freeze({\n hoverStyle: \"hover\",\n pressStyle: \"press\",\n focusStyle: \"focus\",\n focusVisibleStyle: \"focus-visible\",\n focusWithinStyle: \"focus-within\",\n disabledStyle: \"disabled\",\n enterStyle: \"enter\",\n exitStyle: \"exit\"\n});\nconst transformPartProperties = /* @__PURE__ */ new Set([\n \"scale\",\n \"scaleX\",\n \"scaleY\",\n \"rotate\",\n \"rotateX\",\n \"rotateY\",\n \"rotateZ\",\n \"x\",\n \"y\",\n \"skewX\",\n \"skewY\",\n \"perspective\"\n]);\nfunction resolveLegacyCondition(propName, registry) {\n const pseudoModifier = pseudoToModifier[propName];\n if (pseudoModifier !== void 0) {\n return registry.get(pseudoModifier) === \"state\" ? { recognized: true, modifiers: [pseudoModifier] } : {\n recognized: true,\n error: {\n code: \"unregistered-legacy-condition\",\n message: `legacy condition \"${propName}\" maps to unregistered state modifier \"${pseudoModifier}\"`\n }\n };\n }\n if (propName.startsWith(\"$theme-\")) {\n const modifier = propName.slice(\"$theme-\".length);\n return modifier && registry.get(modifier) === \"theme\" ? { recognized: true, modifiers: [modifier] } : {\n recognized: true,\n error: {\n code: \"unregistered-legacy-condition\",\n message: `legacy theme condition \"${propName}\" does not name a registered theme`\n }\n };\n }\n if (propName.startsWith(\"$platform-\")) {\n const modifier = propName.slice(\"$platform-\".length);\n return modifier && registry.get(modifier) === \"platform\" ? { recognized: true, modifiers: [modifier] } : {\n recognized: true,\n error: {\n code: \"unregistered-legacy-condition\",\n message: `legacy platform condition \"${propName}\" does not name a registered platform`\n }\n };\n }\n if (propName.startsWith(\"$group-\")) {\n const remainder = propName.slice(\"$group-\".length);\n const candidates = [];\n let start = 0;\n while (start < remainder.length) {\n const state2 = remainder.slice(start);\n if (registry.get(state2) === \"state\") candidates.push(state2);\n const dash = remainder.indexOf(\"-\", start);\n if (dash === -1) break;\n start = dash + 1;\n }\n const longestLength = candidates.reduce(\n (length, state2) => Math.max(length, state2.length),\n 0\n );\n const longest = candidates.filter((state2) => state2.length === longestLength);\n if (longest.length > 1) {\n return {\n recognized: true,\n error: {\n code: \"ambiguous-legacy-group\",\n message: `legacy group condition \"${propName}\" has more than one equally specific state suffix`\n }\n };\n }\n const state = longest.length === 1 ? longest[0] : null;\n let namePart = state === null ? remainder : state.length === remainder.length ? \"\" : remainder.slice(0, -(state.length + 1));\n let media = null;\n if (namePart) {\n let scanStart = 0;\n while (scanStart < namePart.length) {\n const suffix2 = namePart.slice(scanStart);\n if (registry.get(`@${suffix2}`) === \"container\") {\n media = suffix2;\n break;\n }\n const dash = namePart.indexOf(\"-\", scanStart);\n if (dash === -1) break;\n scanStart = dash + 1;\n }\n if (media !== null) {\n namePart = media.length === namePart.length ? \"\" : namePart.slice(0, -(media.length + 1));\n } else if (state === null) {\n return {\n recognized: true,\n error: {\n code: \"unregistered-legacy-condition\",\n message: `legacy group condition \"${propName}\" has no registered state or container-size suffix`\n }\n };\n }\n } else if (state === null) {\n return {\n recognized: true,\n error: {\n code: \"unregistered-legacy-condition\",\n message: `legacy group condition \"${propName}\" has no registered state suffix`\n }\n };\n }\n const suffix = namePart ? `/${namePart}` : \"\";\n const modifiers = [];\n if (media !== null) modifiers.push(`@${media}${suffix}`);\n if (state !== null) modifiers.push(`group-${state}${suffix}`);\n return { recognized: true, modifiers };\n }\n if (propName[0] === \"$\") {\n const modifier = propName.slice(1);\n const kind = registry.get(modifier);\n if (kind === \"media\" || kind === \"container\") {\n return { recognized: true, modifiers: [modifier] };\n }\n }\n return { recognized: false };\n}\nfunction isConditionObject(value) {\n if (value === null || typeof value !== \"object\" || Array.isArray(value)) return false;\n const prototype = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n}\nfunction convertStyleValue(prop, value, path, errors) {\n if (transformPartProperties.has(prop) && !transformFamilyProps.has(prop)) {\n errors.push({\n code: \"legacy-transform-part\",\n path,\n message: `legacy transform part \"${prop}\" has no flat spelling; author it inside a flat \\`transform\\` value (only x, y, scale, scaleX, scaleY, and rotate are first-class)`\n });\n return null;\n }\n if (typeof value === \"number\" && Number.isFinite(value) && transformFamilyProps.has(prop)) {\n if (prop === \"rotate\") return value === 0 ? \"0deg\" : `${value}deg`;\n if (prop === \"x\" || prop === \"y\") return value === 0 ? \"0\" : `${value}px`;\n return String(value);\n }\n if (typeof value === \"string\") {\n if (!value.length) {\n errors.push({\n code: \"unsupported-legacy-value\",\n path,\n message: \"an empty string cannot become a condition clause payload\"\n });\n return null;\n }\n if (value.indexOf(\"$\") === -1) return value;\n if (value.includes('\"') || value.includes(\"'\") || value.includes(\"url(\")) {\n errors.push({\n code: \"unsupported-legacy-value\",\n path,\n message: `\"${value}\" mixes \"$\" with quoted or url() content; migrate the token spelling by hand`\n });\n return null;\n }\n if (/\\$[\\w-]*\\./.test(value)) {\n errors.push({\n code: \"legacy-token-dot-path\",\n path,\n message: `legacy token in \"${value}\" uses dot-path naming; rename it to one configured flat token name before conversion`\n });\n return null;\n }\n if (/\\$-?\\d/.test(value) && !/^\\$-?[\\w-]+$/.test(value)) {\n errors.push({\n code: \"legacy-numeric-composite-token\",\n path,\n message: `numeric token in \"${value}\" is embedded in a composite value; replace it with its resolved CSS value before conversion`\n });\n return null;\n }\n if (/\\$(?![\\w-])/.test(value)) {\n errors.push({\n code: \"unsupported-legacy-value\",\n path,\n message: `\"$\" in \"${value}\" is not followed by a token name`\n });\n return null;\n }\n return value.replace(/\\$([\\w-]+)/g, \"$1\");\n }\n if (typeof value === \"number\") {\n if (Number.isFinite(value)) {\n return unitlessNumberProperties.has(prop) ? String(value) : `${value}px`;\n }\n errors.push({\n code: \"unsupported-legacy-value\",\n path,\n message: `non-finite number ${String(value)} cannot become a CSS payload`\n });\n return null;\n }\n errors.push({\n code: \"unsupported-legacy-value\",\n path,\n message: `legacy condition value for \"${prop}\" must be a string or finite number`\n });\n return null;\n}\nfunction convertLegacyConditionProp(propName, value, options) {\n const root = resolveLegacyCondition(propName, options.registry);\n if (!root.recognized) return null;\n const result = { contributions: [], errors: [] };\n if (\"error\" in root) {\n result.errors.push({ ...root.error, path: propName });\n return result;\n }\n if (!isConditionObject(value)) {\n result.errors.push({\n code: \"legacy-condition-object\",\n path: propName,\n message: `legacy condition \"${propName}\" must contain a style object`\n });\n return result;\n }\n const modifiers = root.modifiers.slice();\n const visit = (object, objectPath) => {\n for (const childProp in object) {\n if (!Object.prototype.hasOwnProperty.call(object, childProp)) continue;\n const childValue = object[childProp];\n const childPath = `${objectPath}.${childProp}`;\n const condition = resolveLegacyCondition(childProp, options.registry);\n if (condition.recognized) {\n if (\"error\" in condition) {\n result.errors.push({ ...condition.error, path: childPath });\n continue;\n }\n if (!isConditionObject(childValue)) {\n result.errors.push({\n code: \"legacy-condition-object\",\n path: childPath,\n message: `legacy condition \"${childProp}\" must contain a style object`\n });\n continue;\n }\n modifiers.push(...condition.modifiers);\n visit(childValue, childPath);\n modifiers.length -= condition.modifiers.length;\n continue;\n }\n const payload = convertStyleValue(childProp, childValue, childPath, result.errors);\n if (payload !== null) {\n result.contributions.push({\n prop: childProp,\n clause: { modifiers: modifiers.slice(), payload }\n });\n }\n }\n };\n visit(value, propName);\n return result;\n}\nexport {\n convertLegacyConditionProp,\n pseudoToModifier\n};\n//# sourceMappingURL=legacyConditions.js.map\n"],"mappings":";;;AAIA,MAAM,mBAAmB,OAAO,OAAO;CACrC,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,mBAAmB;CACnB,kBAAkB;CAClB,eAAe;CACf,YAAY;CACZ,WAAW;AACb,CAAC;AACD,MAAM,0CAA0C,IAAI,IAAI;CACtD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,SAAS,uBAAuB,UAAU,UAAU;CAClD,MAAM,iBAAiB,iBAAiB;CACxC,IAAI,mBAAmB,KAAK,GAAG;EAC7B,OAAO,SAAS,IAAI,cAAc,MAAM,UAAU;GAAE,YAAY;GAAM,WAAW,CAAC,cAAc;EAAE,IAAI;GACpG,YAAY;GACZ,OAAO;IACL,MAAM;IACN,SAAS,qBAAqB,SAAS,yCAAyC,eAAe;GACjG;EACF;CACF;CACA,IAAI,SAAS,WAAW,SAAS,GAAG;EAClC,MAAM,WAAW,SAAS,MAAM,UAAU,MAAM;EAChD,OAA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AM;MACN,MAAM;MACN,SAAS,qBAAqB,UAAU;KAC1C,CAAC;KACD;IACF;IACA,UAAU,KAAK,GAAG,UAAU,SAAS;IACrC,MAAM,YAAY,SAAS;IAC3B,UAAU,UAAU,UAAU,UAAU;IACxC;GACF;GACA,MAAM,UAAU,kBAAkB,WAAW,YAAY,WAAW,OAAO,MAAM;GACjF,IAAI,YAAY,MAAM;IACpB,OAAO,cAAc,KAAK;KACxB,MAAM;KACN,QAAQ;MAAE,WAAW,UAAU,MAAM;MAAG;KAAQ;IAClD,CAAC;GACH;EACF;CACF;CACA,MAAM,OAAO,QAAQ;CACrB,OAAO;AACT"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { grammarPlatformNames, pseudoToModifier } from "./grammar.mjs";
|
|
2
|
+
|
|
3
|
+
function isLegacyConditionName(name) {
|
|
4
|
+
return name.startsWith("$") || pseudoToModifier[name] !== void 0;
|
|
5
|
+
}
|
|
6
|
+
function kebab(name) {
|
|
7
|
+
return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
8
|
+
}
|
|
9
|
+
function mediaName(name, registry) {
|
|
10
|
+
if (registry.get(name) === "media") return name;
|
|
11
|
+
const kebabbed = kebab(name);
|
|
12
|
+
return registry.get(kebabbed) === "media" ? kebabbed : null;
|
|
13
|
+
}
|
|
14
|
+
function longestSuffix(parts, resolve) {
|
|
15
|
+
for (let start = 0; start < parts.length; start++) {
|
|
16
|
+
const resolved = resolve(parts.slice(start).join("-"));
|
|
17
|
+
if (resolved !== null) return {
|
|
18
|
+
value: resolved,
|
|
19
|
+
rest: parts.slice(0, start)
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
function resolveGroupName(name, registry) {
|
|
25
|
+
const parts = name.slice("$group-".length).split("-");
|
|
26
|
+
const state = longestSuffix(parts, (candidate) => registry.get(candidate) === "state" ? candidate : null);
|
|
27
|
+
const beforeState = state ? state.rest : parts;
|
|
28
|
+
const size = longestSuffix(beforeState, (candidate) => mediaName(candidate, registry));
|
|
29
|
+
const group = (size ? size.rest : beforeState).join("-") || null;
|
|
30
|
+
const suffix = group === null ? "" : `/${group}`;
|
|
31
|
+
if (!state && !size) {
|
|
32
|
+
return {
|
|
33
|
+
ok: false,
|
|
34
|
+
code: "legacy-group-presence",
|
|
35
|
+
message: `"${name}" styles every descendant of the group unconditionally; V3 has no group-presence condition, so move the value to the base program or add a state`
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (!size) {
|
|
39
|
+
return {
|
|
40
|
+
ok: true,
|
|
41
|
+
resolved: {
|
|
42
|
+
canonical: name,
|
|
43
|
+
replaceRoot: null,
|
|
44
|
+
container: null
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const modifiers = [`@${size.value}${suffix}`];
|
|
49
|
+
if (state) modifiers.push(`group-${state.value}${suffix}`);
|
|
50
|
+
for (const modifier of modifiers) {
|
|
51
|
+
if (registry.get(modifier) === void 0) {
|
|
52
|
+
return {
|
|
53
|
+
ok: false,
|
|
54
|
+
code: "unregistered-legacy-condition",
|
|
55
|
+
message: `"${name}" needs modifier "${modifier}", which is not registered`
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
ok: true,
|
|
61
|
+
resolved: {
|
|
62
|
+
canonical: state ? `$group-${group === null ? "" : `${group}-`}${state.value}` : `$${size.value}`,
|
|
63
|
+
replaceRoot: modifiers,
|
|
64
|
+
container: {
|
|
65
|
+
size: size.value,
|
|
66
|
+
group
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function resolveLegacyName(name, registry) {
|
|
72
|
+
if (pseudoToModifier[name] !== void 0 || name.startsWith("$theme-")) {
|
|
73
|
+
return {
|
|
74
|
+
ok: true,
|
|
75
|
+
resolved: {
|
|
76
|
+
canonical: name,
|
|
77
|
+
replaceRoot: null,
|
|
78
|
+
container: null
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
if (name.startsWith("$platform-")) {
|
|
83
|
+
return {
|
|
84
|
+
ok: true,
|
|
85
|
+
resolved: {
|
|
86
|
+
canonical: name,
|
|
87
|
+
replaceRoot: null,
|
|
88
|
+
container: null
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
if (name.startsWith("$group-")) return resolveGroupName(name, registry);
|
|
93
|
+
if (name.startsWith("$")) {
|
|
94
|
+
const bare = name.slice(1);
|
|
95
|
+
if (grammarPlatformNames.has(bare)) {
|
|
96
|
+
return {
|
|
97
|
+
ok: true,
|
|
98
|
+
resolved: {
|
|
99
|
+
canonical: `$platform-${bare}`,
|
|
100
|
+
replaceRoot: null,
|
|
101
|
+
container: null
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
const media = mediaName(bare, registry);
|
|
106
|
+
if (media !== null) {
|
|
107
|
+
return {
|
|
108
|
+
ok: true,
|
|
109
|
+
resolved: {
|
|
110
|
+
canonical: `$${media}`,
|
|
111
|
+
replaceRoot: null,
|
|
112
|
+
container: null
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
ok: false,
|
|
118
|
+
code: "unknown-legacy-condition",
|
|
119
|
+
message: `"${name}" is not a registered legacy condition spelling`
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
ok: false,
|
|
124
|
+
code: "unknown-legacy-condition",
|
|
125
|
+
message: `"${name}" is not a registered legacy condition spelling`
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export { isLegacyConditionName, resolveLegacyName };
|
|
130
|
+
//# sourceMappingURL=legacyNames.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacyNames.js","names":[],"sources":["legacyNames.js"],"sourcesContent":["import {\n grammarPlatformNames,\n pseudoToModifier\n} from \"./grammar\";\nfunction isLegacyConditionName(name) {\n return name.startsWith(\"$\") || pseudoToModifier[name] !== void 0;\n}\nfunction kebab(name) {\n return name.replace(/([a-z0-9])([A-Z])/g, \"$1-$2\").toLowerCase();\n}\nfunction mediaName(name, registry) {\n if (registry.get(name) === \"media\") return name;\n const kebabbed = kebab(name);\n return registry.get(kebabbed) === \"media\" ? kebabbed : null;\n}\nfunction longestSuffix(parts, resolve) {\n for (let start = 0; start < parts.length; start++) {\n const resolved = resolve(parts.slice(start).join(\"-\"));\n if (resolved !== null) return { value: resolved, rest: parts.slice(0, start) };\n }\n return null;\n}\nfunction resolveGroupName(name, registry) {\n const parts = name.slice(\"$group-\".length).split(\"-\");\n const state = longestSuffix(\n parts,\n (candidate) => registry.get(candidate) === \"state\" ? candidate : null\n );\n const beforeState = state ? state.rest : parts;\n const size = longestSuffix(beforeState, (candidate) => mediaName(candidate, registry));\n const group = (size ? size.rest : beforeState).join(\"-\") || null;\n const suffix = group === null ? \"\" : `/${group}`;\n if (!state && !size) {\n return {\n ok: false,\n code: \"legacy-group-presence\",\n message: `\"${name}\" styles every descendant of the group unconditionally; V3 has no group-presence condition, so move the value to the base program or add a state`\n };\n }\n if (!size) {\n return { ok: true, resolved: { canonical: name, replaceRoot: null, container: null } };\n }\n const modifiers = [`@${size.value}${suffix}`];\n if (state) modifiers.push(`group-${state.value}${suffix}`);\n for (const modifier of modifiers) {\n if (registry.get(modifier) === void 0) {\n return {\n ok: false,\n code: \"unregistered-legacy-condition\",\n message: `\"${name}\" needs modifier \"${modifier}\", which is not registered`\n };\n }\n }\n return {\n ok: true,\n resolved: {\n // any registered root works: `replaceRoot` substitutes the whole chain\n canonical: state ? `$group-${group === null ? \"\" : `${group}-`}${state.value}` : `$${size.value}`,\n replaceRoot: modifiers,\n container: { size: size.value, group }\n }\n };\n}\nfunction resolveLegacyName(name, registry) {\n if (pseudoToModifier[name] !== void 0 || name.startsWith(\"$theme-\")) {\n return { ok: true, resolved: { canonical: name, replaceRoot: null, container: null } };\n }\n if (name.startsWith(\"$platform-\")) {\n return { ok: true, resolved: { canonical: name, replaceRoot: null, container: null } };\n }\n if (name.startsWith(\"$group-\")) return resolveGroupName(name, registry);\n if (name.startsWith(\"$\")) {\n const bare = name.slice(1);\n if (grammarPlatformNames.has(bare)) {\n return {\n ok: true,\n resolved: {\n canonical: `$platform-${bare}`,\n replaceRoot: null,\n container: null\n }\n };\n }\n const media = mediaName(bare, registry);\n if (media !== null) {\n return {\n ok: true,\n resolved: { canonical: `$${media}`, replaceRoot: null, container: null }\n };\n }\n return {\n ok: false,\n code: \"unknown-legacy-condition\",\n message: `\"${name}\" is not a registered legacy condition spelling`\n };\n }\n return {\n ok: false,\n code: \"unknown-legacy-condition\",\n message: `\"${name}\" is not a registered legacy condition spelling`\n };\n}\nexport {\n isLegacyConditionName,\n resolveLegacyName\n};\n//# sourceMappingURL=legacyNames.js.map\n"],"mappings":";;;AAIA,SAAS,sBAAsB,MAAM;CACnC,OAAO,KAAK,WAAW,GAAG,KAAK,iBAAiB,UAAU,KAAK;AACjE;AACA,SAAS,MAAM,MAAM;CACnB,OAAO,KAAK,QAAQ,sBAAsB,OAAO,EAAE,YAAY;AACjE;AACA,SAAS,UAAU,MAAM,UAAU;CACjC,IAAI,SAAS,IAAI,IAAI,MAAM,SAAS,OAAO;CAC3C,MAAM,WAAW,MAAM,IAAI;CAC3B,OAAO,SAAS,IAAI,QAAQ,MAAM,UAAU,WAAW;AACzD;AACA,SAAS,cAAc,OAAO,SAAS;CACrC,KAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS;EACjD,MAAM,WAAW,QAAQ,MAAM,MAAM,KAAK,EAAE,KAAK,GAAG,CAAC;EACrD,IAAI,aAAa,MAAM,OAAO;GAAE,OAAO;GAAU,MAAM,MAAM,MAAM,GAAG,KAAK;EAAE;CAC/E;CACA,OAAO;AACT;AACA,SAAS,iBAAiB,MAAM,UAAU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,GAAG;EACjC,OAAO;GAAE,IAAI;GAAM,UAAU;IAAE,WAAW;IAAM,aAAa;IAAM,WAAW;GAAK;EAAE;CACvF;CACA,IAAI,KAAK,WAAW,SAAS,GAAG,OAAO,iBAAiB,MAAM,QAAQ;CACtE,IAAI,KAAK,WAAW,GAAG,GAAG;EACxB,MAAM,OAAO,KAAK,MAAM,CAAC;EACzB,IAAI,qBAAqB,IAAI,IAAI,GAAG;GAClC,OAAO;IACL,IAAI;IACJ,UAAU;KACR,WAAW,aAAa;KACxB,aAAa;KACb,WAAW;IACb;GACF;EACF;EACA,MAAM,QAAQ,UAAU,MAAM,QAAQ;EACtC,IAAI,UAAU,MAAM;GAClB,OAAO;IACL,IAAI;IACJ,UAAU;KAAE,WAAW,IAAI;KAAS,aAAa;KAAM,WAAW;IAAK;GACzE;EACF;EACA,OAAO;GACL,IAAI;GACJ,MAAM;GACN,SAAS,IAAI,KAAK;EACpB;CACF;CACA,OAAO;EACL,IAAI;EACJ,MAAM;EACN,SAAS,IAAI,KAAK;CACpB;AACF"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { Node, SyntaxKind } from "ts-morph";
|
|
2
|
+
|
|
3
|
+
const tamaguiModule = /^(tamagui|@tamagui\/)/;
|
|
4
|
+
function rootIdentifier(node) {
|
|
5
|
+
let current = node;
|
|
6
|
+
while (Node.isPropertyAccessExpression(current)) current = current.getExpression();
|
|
7
|
+
return Node.isIdentifier(current) ? current : null;
|
|
8
|
+
}
|
|
9
|
+
function createProvenance() {
|
|
10
|
+
const resolved = /* @__PURE__ */ new Map();
|
|
11
|
+
const active = /* @__PURE__ */ new Set();
|
|
12
|
+
const fromDeclaration = (declaration) => {
|
|
13
|
+
const cached = resolved.get(declaration);
|
|
14
|
+
if (cached !== void 0) return cached;
|
|
15
|
+
if (active.has(declaration)) return false;
|
|
16
|
+
active.add(declaration);
|
|
17
|
+
const answer = computeDeclaration(declaration);
|
|
18
|
+
active.delete(declaration);
|
|
19
|
+
resolved.set(declaration, answer);
|
|
20
|
+
return answer;
|
|
21
|
+
};
|
|
22
|
+
const fromModule = (specifier, source, name) => {
|
|
23
|
+
if (tamaguiModule.test(specifier)) return true;
|
|
24
|
+
if (source === void 0) return false;
|
|
25
|
+
return exportedBinding(source, name);
|
|
26
|
+
};
|
|
27
|
+
const bindings = /* @__PURE__ */ new Map();
|
|
28
|
+
const openBindings = /* @__PURE__ */ new Set();
|
|
29
|
+
const exportedBinding = (source, name) => {
|
|
30
|
+
const key = `${source.getFilePath()}#${name}`;
|
|
31
|
+
const cached = bindings.get(key);
|
|
32
|
+
if (cached !== void 0) return cached;
|
|
33
|
+
if (openBindings.has(key)) return false;
|
|
34
|
+
openBindings.add(key);
|
|
35
|
+
const answer = computeBinding(source, name);
|
|
36
|
+
openBindings.delete(key);
|
|
37
|
+
bindings.set(key, answer);
|
|
38
|
+
return answer;
|
|
39
|
+
};
|
|
40
|
+
const computeBinding = (source, name) => {
|
|
41
|
+
for (const declaration of source.getExportDeclarations()) {
|
|
42
|
+
const specifier = declaration.getModuleSpecifierValue();
|
|
43
|
+
const named = declaration.getNamedExports();
|
|
44
|
+
if (specifier === void 0) {
|
|
45
|
+
for (const element of named) {
|
|
46
|
+
if ((element.getAliasNode() ?? element.getNameNode()).getText() !== name) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (fromDeclaration(element)) return true;
|
|
50
|
+
}
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (!named.length && !declaration.getNamespaceExport()) {
|
|
54
|
+
if (fromModule(specifier, declaration.getModuleSpecifierSourceFile(), name)) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
for (const element of named) {
|
|
60
|
+
if ((element.getAliasNode() ?? element.getNameNode()).getText() !== name) continue;
|
|
61
|
+
if (fromModule(specifier, declaration.getModuleSpecifierSourceFile(), element.getName())) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
for (const [exportName, declarations] of source.getExportedDeclarations()) {
|
|
67
|
+
if (exportName !== name) continue;
|
|
68
|
+
for (const declaration of declarations) {
|
|
69
|
+
if (fromDeclaration(declaration)) return true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return false;
|
|
73
|
+
};
|
|
74
|
+
const computeDeclaration = (declaration) => {
|
|
75
|
+
if (Node.isImportSpecifier(declaration)) {
|
|
76
|
+
const importDeclaration = declaration.getImportDeclaration();
|
|
77
|
+
return fromModule(importDeclaration.getModuleSpecifierValue(), importDeclaration.getModuleSpecifierSourceFile(), declaration.getName());
|
|
78
|
+
}
|
|
79
|
+
if (Node.isImportClause(declaration) || Node.isNamespaceImport(declaration)) {
|
|
80
|
+
const importDeclaration = declaration.getFirstAncestorByKindOrThrow(SyntaxKind.ImportDeclaration);
|
|
81
|
+
return tamaguiModule.test(importDeclaration.getModuleSpecifierValue());
|
|
82
|
+
}
|
|
83
|
+
if (Node.isExportSpecifier(declaration)) {
|
|
84
|
+
const exportDeclaration = declaration.getExportDeclaration();
|
|
85
|
+
const specifier = exportDeclaration.getModuleSpecifierValue();
|
|
86
|
+
if (specifier !== void 0) {
|
|
87
|
+
return fromModule(specifier, exportDeclaration.getModuleSpecifierSourceFile(), declaration.getName());
|
|
88
|
+
}
|
|
89
|
+
for (const local of declaration.getLocalTargetDeclarations()) {
|
|
90
|
+
if (fromDeclaration(local)) return true;
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
if (Node.isVariableDeclaration(declaration)) {
|
|
95
|
+
const initializer = declaration.getInitializer();
|
|
96
|
+
return initializer !== void 0 && isTamaguiValue(initializer);
|
|
97
|
+
}
|
|
98
|
+
return false;
|
|
99
|
+
};
|
|
100
|
+
const fromIdentifier = (identifier) => {
|
|
101
|
+
const symbol = identifier.getSymbol();
|
|
102
|
+
if (symbol === void 0) return false;
|
|
103
|
+
for (const declaration of symbol.getDeclarations()) {
|
|
104
|
+
if (fromDeclaration(declaration)) return true;
|
|
105
|
+
}
|
|
106
|
+
const aliased = symbol.getAliasedSymbol();
|
|
107
|
+
if (aliased === void 0) return false;
|
|
108
|
+
for (const declaration of aliased.getDeclarations()) {
|
|
109
|
+
if (fromDeclaration(declaration)) return true;
|
|
110
|
+
}
|
|
111
|
+
return false;
|
|
112
|
+
};
|
|
113
|
+
const isTamaguiStyledCall = (call) => {
|
|
114
|
+
const callee = rootIdentifier(call.getExpression());
|
|
115
|
+
if (callee === null || callee.getText() !== "styled") return false;
|
|
116
|
+
return fromIdentifier(callee);
|
|
117
|
+
};
|
|
118
|
+
function isTamaguiValue(expression) {
|
|
119
|
+
let current = expression;
|
|
120
|
+
while (Node.isParenthesizedExpression(current) || Node.isAsExpression(current) || Node.isNonNullExpression(current)) {
|
|
121
|
+
current = current.getExpression();
|
|
122
|
+
}
|
|
123
|
+
const identifier = rootIdentifier(Node.isCallExpression(current) ? current.getExpression() : current);
|
|
124
|
+
return identifier !== null && fromIdentifier(identifier);
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
isTamaguiElement: (opening) => {
|
|
128
|
+
const tag = rootIdentifier(opening.getTagNameNode());
|
|
129
|
+
if (tag === null || !/^[A-Z_$]/.test(tag.getText())) return false;
|
|
130
|
+
return fromIdentifier(tag);
|
|
131
|
+
},
|
|
132
|
+
isTamaguiStyledCall
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export { createProvenance };
|
|
137
|
+
//# sourceMappingURL=provenance.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provenance.js","names":[],"sources":["provenance.js"],"sourcesContent":["import {\n Node,\n SyntaxKind\n} from \"ts-morph\";\nconst tamaguiModule = /^(tamagui|@tamagui\\/)/;\nfunction rootIdentifier(node) {\n let current = node;\n while (Node.isPropertyAccessExpression(current)) current = current.getExpression();\n return Node.isIdentifier(current) ? current : null;\n}\nfunction createProvenance() {\n const resolved = /* @__PURE__ */ new Map();\n const active = /* @__PURE__ */ new Set();\n const fromDeclaration = (declaration) => {\n const cached = resolved.get(declaration);\n if (cached !== void 0) return cached;\n if (active.has(declaration)) return false;\n active.add(declaration);\n const answer = computeDeclaration(declaration);\n active.delete(declaration);\n resolved.set(declaration, answer);\n return answer;\n };\n const fromModule = (specifier, source, name) => {\n if (tamaguiModule.test(specifier)) return true;\n if (source === void 0) return false;\n return exportedBinding(source, name);\n };\n const bindings = /* @__PURE__ */ new Map();\n const openBindings = /* @__PURE__ */ new Set();\n const exportedBinding = (source, name) => {\n const key = `${source.getFilePath()}#${name}`;\n const cached = bindings.get(key);\n if (cached !== void 0) return cached;\n if (openBindings.has(key)) return false;\n openBindings.add(key);\n const answer = computeBinding(source, name);\n openBindings.delete(key);\n bindings.set(key, answer);\n return answer;\n };\n const computeBinding = (source, name) => {\n for (const declaration of source.getExportDeclarations()) {\n const specifier = declaration.getModuleSpecifierValue();\n const named = declaration.getNamedExports();\n if (specifier === void 0) {\n for (const element of named) {\n if ((element.getAliasNode() ?? element.getNameNode()).getText() !== name) {\n continue;\n }\n if (fromDeclaration(element)) return true;\n }\n continue;\n }\n if (!named.length && !declaration.getNamespaceExport()) {\n if (fromModule(specifier, declaration.getModuleSpecifierSourceFile(), name)) {\n return true;\n }\n continue;\n }\n for (const element of named) {\n if ((element.getAliasNode() ?? element.getNameNode()).getText() !== name) continue;\n if (fromModule(\n specifier,\n declaration.getModuleSpecifierSourceFile(),\n element.getName()\n )) {\n return true;\n }\n }\n }\n for (const [exportName, declarations] of source.getExportedDeclarations()) {\n if (exportName !== name) continue;\n for (const declaration of declarations) {\n if (fromDeclaration(declaration)) return true;\n }\n }\n return false;\n };\n const computeDeclaration = (declaration) => {\n if (Node.isImportSpecifier(declaration)) {\n const importDeclaration = declaration.getImportDeclaration();\n return fromModule(\n importDeclaration.getModuleSpecifierValue(),\n importDeclaration.getModuleSpecifierSourceFile(),\n declaration.getName()\n );\n }\n if (Node.isImportClause(declaration) || Node.isNamespaceImport(declaration)) {\n const importDeclaration = declaration.getFirstAncestorByKindOrThrow(\n SyntaxKind.ImportDeclaration\n );\n return tamaguiModule.test(importDeclaration.getModuleSpecifierValue());\n }\n if (Node.isExportSpecifier(declaration)) {\n const exportDeclaration = declaration.getExportDeclaration();\n const specifier = exportDeclaration.getModuleSpecifierValue();\n if (specifier !== void 0) {\n return fromModule(\n specifier,\n exportDeclaration.getModuleSpecifierSourceFile(),\n declaration.getName()\n );\n }\n for (const local of declaration.getLocalTargetDeclarations()) {\n if (fromDeclaration(local)) return true;\n }\n return false;\n }\n if (Node.isVariableDeclaration(declaration)) {\n const initializer = declaration.getInitializer();\n return initializer !== void 0 && isTamaguiValue(initializer);\n }\n return false;\n };\n const fromIdentifier = (identifier) => {\n const symbol = identifier.getSymbol();\n if (symbol === void 0) return false;\n for (const declaration of symbol.getDeclarations()) {\n if (fromDeclaration(declaration)) return true;\n }\n const aliased = symbol.getAliasedSymbol();\n if (aliased === void 0) return false;\n for (const declaration of aliased.getDeclarations()) {\n if (fromDeclaration(declaration)) return true;\n }\n return false;\n };\n const isTamaguiStyledCall = (call) => {\n const callee = rootIdentifier(call.getExpression());\n if (callee === null || callee.getText() !== \"styled\") return false;\n return fromIdentifier(callee);\n };\n function isTamaguiValue(expression) {\n let current = expression;\n while (Node.isParenthesizedExpression(current) || Node.isAsExpression(current) || Node.isNonNullExpression(current)) {\n current = current.getExpression();\n }\n const identifier = rootIdentifier(\n Node.isCallExpression(current) ? current.getExpression() : current\n );\n return identifier !== null && fromIdentifier(identifier);\n }\n return {\n isTamaguiElement: (opening) => {\n const tag = rootIdentifier(opening.getTagNameNode());\n if (tag === null || !/^[A-Z_$]/.test(tag.getText())) return false;\n return fromIdentifier(tag);\n },\n isTamaguiStyledCall\n };\n}\nexport {\n createProvenance\n};\n//# sourceMappingURL=provenance.js.map\n"],"mappings":";;;AAIA,MAAM,gBAAgB;AACtB,SAAS,eAAe,MAAM;C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js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
function countCodes(flags) {
|
|
2
|
+
const counts = /* @__PURE__ */ new Map();
|
|
3
|
+
for (const flag of flags) counts.set(flag.code, (counts.get(flag.code) ?? 0) + 1);
|
|
4
|
+
return [...counts].sort(([leftCode, leftCount], [rightCode, rightCount]) => rightCount - leftCount || leftCode.localeCompare(rightCode));
|
|
5
|
+
}
|
|
6
|
+
function renderReport(files, corpus, registryDiagnostics, ignoredFiles = 0, write = false) {
|
|
7
|
+
const sites = files.flatMap((file) => file.sites);
|
|
8
|
+
const clean = sites.filter((site) => site.flags.length === 0 && site.warnings.length === 0 && site.assessmentVerdict === "clean");
|
|
9
|
+
const flagged = sites.filter((site) => site.flags.length > 0);
|
|
10
|
+
const warnings = sites.filter((site) => site.warnings.length > 0);
|
|
11
|
+
const needsRelocation = sites.filter((site) => site.assessmentVerdict === "needs-relocation");
|
|
12
|
+
const unknownHost = sites.filter((site) => site.assessmentVerdict === "unknown-host");
|
|
13
|
+
const ineligible = sites.filter((site) => site.assessmentVerdict === "ineligible");
|
|
14
|
+
const waiting = clean.filter((site) => site.programs.length === 0);
|
|
15
|
+
const jsx = sites.filter((site) => site.kind === "jsx");
|
|
16
|
+
const styled = sites.filter((site) => site.kind === "styled");
|
|
17
|
+
const cleanJsx = jsx.filter((site) => site.flags.length === 0 && site.warnings.length === 0 && site.assessmentVerdict === "clean").length;
|
|
18
|
+
const cleanStyled = styled.filter((site) => site.flags.length === 0 && site.warnings.length === 0 && site.assessmentVerdict === "clean").length;
|
|
19
|
+
const readyFiles = files.filter((file) => file.sites.length > 0 && file.sites.every((site) => site.legacyLeft === 0));
|
|
20
|
+
const filesWithSites = files.filter((file) => file.sites.length > 0).length;
|
|
21
|
+
const blockedFiles = files.filter((file) => file.sites.some((site) => site.legacyLeft > 0)).map((file) => file.file);
|
|
22
|
+
const lines = [
|
|
23
|
+
"# Flat-values codemod dry-run",
|
|
24
|
+
"",
|
|
25
|
+
`Corpus: ${corpus.map((entry) => `\`${entry}\``).join(", ")}.`,
|
|
26
|
+
"",
|
|
27
|
+
write ? "Statically safe conversions were written in place. Flagged legacy syntax remains for manual migration." : "Dry run only: no source files were written. Pass `--write` to apply statically safe conversions.",
|
|
28
|
+
"",
|
|
29
|
+
"## Summary",
|
|
30
|
+
"",
|
|
31
|
+
`- ${sites.length} conversion sites found`,
|
|
32
|
+
`- ${clean.length - waiting.length} converted with no open questions`,
|
|
33
|
+
`- ${needsRelocation.length} need relocation because the authored target or host cannot evaluate the conversion`,
|
|
34
|
+
`- ${unknownHost.length} have an unverified host type`,
|
|
35
|
+
`- ${ineligible.length} use properties that cannot carry flat clauses`,
|
|
36
|
+
`- ${waiting.length} have nothing to convert until the runtime catches up (see below)`,
|
|
37
|
+
`- ${flagged.length} have syntax or ordering flags for manual work`,
|
|
38
|
+
`- ${warnings.length} have configuration warnings for manual review`,
|
|
39
|
+
`- ${ignoredFiles} source files skipped by \`.tamagui-flat-values-ignore\` markers`,
|
|
40
|
+
`- ${jsx.length} JSX sites: ${cleanJsx} clean, ${jsx.length - cleanJsx} need review`,
|
|
41
|
+
`- ${styled.length} styled config sites: ${cleanStyled} clean, ${styled.length - cleanStyled} need review`,
|
|
42
|
+
"",
|
|
43
|
+
"### Remaining manual migration",
|
|
44
|
+
"",
|
|
45
|
+
`${readyFiles.length} of ${filesWithSites} files have no legacy condition object left after`,
|
|
46
|
+
"conversion. V3 has no compatibility setting; finish the remaining files directly:",
|
|
47
|
+
blockedFiles.length ? blockedFiles.map((file) => `\`${file}\``).join(", ") : "every file in this corpus is fully migrated.",
|
|
48
|
+
"",
|
|
49
|
+
"### Flag reasons",
|
|
50
|
+
""
|
|
51
|
+
];
|
|
52
|
+
const flagCounts = countCodes(flagged.flatMap((site) => site.flags));
|
|
53
|
+
lines.push(...flagCounts.length ? flagCounts.map(([code, count]) => `- ${code}: ${count}`) : ["- none"]);
|
|
54
|
+
const warningCounts = countCodes(warnings.flatMap((site) => site.warnings));
|
|
55
|
+
lines.push("", "### Configuration warning reasons", "", ...warningCounts.length ? warningCounts.map(([code, count]) => `- ${code}: ${count}`) : ["- none"]);
|
|
56
|
+
const inventoryCounts = countCodes(sites.flatMap((site) => site.inventory));
|
|
57
|
+
if (inventoryCounts.length) {
|
|
58
|
+
lines.push("", "### Values left authored for another migration", "", "These are not flat-value migration work. The conversion keeps them exactly as", "authored and records them so their follow-up migrations have a corpus inventory.", "", ...inventoryCounts.map(([code, count]) => `- ${code}: ${count}`));
|
|
59
|
+
}
|
|
60
|
+
const pendingCounts = countCodes(sites.flatMap((site) => site.pending));
|
|
61
|
+
if (pendingCounts.length) {
|
|
62
|
+
lines.push("", "### Waiting on runtime support", "", "The conversion is known but not offered, because the runtime cannot read it yet.", "Each pending reason below names the exact host or merge contract that must land", "before the suggested source is safe to apply.", "", ...pendingCounts.map(([code, count]) => `- ${code}: ${count}`));
|
|
63
|
+
}
|
|
64
|
+
if (registryDiagnostics.length) {
|
|
65
|
+
lines.push("", "### Modifier registry diagnostics", "");
|
|
66
|
+
for (const diagnostic of registryDiagnostics) lines.push(`- ${diagnostic}`);
|
|
67
|
+
}
|
|
68
|
+
for (const file of files) {
|
|
69
|
+
if (!file.sites.length) continue;
|
|
70
|
+
lines.push("", `## \`${file.file}\``, "");
|
|
71
|
+
for (const site of file.sites) {
|
|
72
|
+
const status = [
|
|
73
|
+
site.assessmentVerdict === "clean" ? null : site.assessmentVerdict,
|
|
74
|
+
site.flags.length ? "syntax-blocked" : null,
|
|
75
|
+
site.warnings.length ? "configuration-warning" : null
|
|
76
|
+
].filter(Boolean).join(", ");
|
|
77
|
+
lines.push(`### ${site.label} at line ${site.line} (${status || "clean"})`, "", "Before:", "", "```tsx", site.before, "```", "", "After:", "", "```tsx", site.after, "```");
|
|
78
|
+
if (site.flags.length) {
|
|
79
|
+
lines.push("", "Flags:", "");
|
|
80
|
+
for (const flag of site.flags) lines.push(`- **${flag.code}**: ${flag.detail}`);
|
|
81
|
+
}
|
|
82
|
+
if (site.warnings.length) {
|
|
83
|
+
lines.push("", "Configuration warnings:", "");
|
|
84
|
+
for (const warning of site.warnings) {
|
|
85
|
+
lines.push(`- **${warning.code}**: ${warning.detail}`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (site.assessments.length) {
|
|
89
|
+
lines.push("", "Conversion assessment:", "");
|
|
90
|
+
for (const assessment of site.assessments) {
|
|
91
|
+
for (const reason of assessment.reasons) {
|
|
92
|
+
lines.push(`- **${assessment.verdict}: ${assessment.property}**: ${reason.message}. Remedy: ${reason.remedy}.`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (site.inventory.length) {
|
|
97
|
+
lines.push("", "Left authored:", "");
|
|
98
|
+
for (const flag of site.inventory) lines.push(`- **${flag.code}**: ${flag.detail}`);
|
|
99
|
+
}
|
|
100
|
+
if (site.pending.length) {
|
|
101
|
+
lines.push("", "Waiting on runtime support:", "");
|
|
102
|
+
for (const flag of site.pending) lines.push(`- **${flag.code}**: ${flag.detail}`);
|
|
103
|
+
}
|
|
104
|
+
if (site.notes.length) {
|
|
105
|
+
lines.push("", "Notes:", "");
|
|
106
|
+
for (const note of site.notes) lines.push(`- ${note}`);
|
|
107
|
+
}
|
|
108
|
+
lines.push("");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
text: `${lines.join("\n")}
|
|
113
|
+
`,
|
|
114
|
+
summary: {
|
|
115
|
+
sites: sites.length,
|
|
116
|
+
clean: clean.length,
|
|
117
|
+
needsRelocation: needsRelocation.length,
|
|
118
|
+
unknownHost: unknownHost.length,
|
|
119
|
+
ineligible: ineligible.length,
|
|
120
|
+
flagged: flagged.length,
|
|
121
|
+
warnings: warnings.length,
|
|
122
|
+
waiting: waiting.length,
|
|
123
|
+
ignoredFiles
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export { renderReport };
|
|
129
|
+
//# sourceMappingURL=report.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.js","names":[],"sources":["report.js"],"sourcesContent":["function countCodes(flags) {\n const counts = /* @__PURE__ */ new Map();\n for (const flag of flags) counts.set(flag.code, (counts.get(flag.code) ?? 0) + 1);\n return [...counts].sort(\n ([leftCode, leftCount], [rightCode, rightCount]) => rightCount - leftCount || leftCode.localeCompare(rightCode)\n );\n}\nfunction renderReport(files, corpus, registryDiagnostics, ignoredFiles = 0, write = false) {\n const sites = files.flatMap((file) => file.sites);\n const clean = sites.filter(\n (site) => site.flags.length === 0 && site.warnings.length === 0 && site.assessmentVerdict === \"clean\"\n );\n const flagged = sites.filter((site) => site.flags.length > 0);\n const warnings = sites.filter((site) => site.warnings.length > 0);\n const needsRelocation = sites.filter(\n (site) => site.assessmentVerdict === \"needs-relocation\"\n );\n const unknownHost = sites.filter((site) => site.assessmentVerdict === \"unknown-host\");\n const ineligible = sites.filter((site) => site.assessmentVerdict === \"ineligible\");\n const waiting = clean.filter((site) => site.programs.length === 0);\n const jsx = sites.filter((site) => site.kind === \"jsx\");\n const styled = sites.filter((site) => site.kind === \"styled\");\n const cleanJsx = jsx.filter(\n (site) => site.flags.length === 0 && site.warnings.length === 0 && site.assessmentVerdict === \"clean\"\n ).length;\n const cleanStyled = styled.filter(\n (site) => site.flags.length === 0 && site.warnings.length === 0 && site.assessmentVerdict === \"clean\"\n ).length;\n const readyFiles = files.filter(\n (file) => file.sites.length > 0 && file.sites.every((site) => site.legacyLeft === 0)\n );\n const filesWithSites = files.filter((file) => file.sites.length > 0).length;\n const blockedFiles = files.filter((file) => file.sites.some((site) => site.legacyLeft > 0)).map((file) => file.file);\n const lines = [\n \"# Flat-values codemod dry-run\",\n \"\",\n `Corpus: ${corpus.map((entry) => `\\`${entry}\\``).join(\", \")}.`,\n \"\",\n write ? \"Statically safe conversions were written in place. Flagged legacy syntax remains for manual migration.\" : \"Dry run only: no source files were written. Pass `--write` to apply statically safe conversions.\",\n \"\",\n \"## Summary\",\n \"\",\n `- ${sites.length} conversion sites found`,\n `- ${clean.length - waiting.length} converted with no open questions`,\n `- ${needsRelocation.length} need relocation because the authored target or host cannot evaluate the conversion`,\n `- ${unknownHost.length} have an unverified host type`,\n `- ${ineligible.length} use properties that cannot carry flat clauses`,\n `- ${waiting.length} have nothing to convert until the runtime catches up (see below)`,\n `- ${flagged.length} have syntax or ordering flags for manual work`,\n `- ${warnings.length} have configuration warnings for manual review`,\n `- ${ignoredFiles} source files skipped by \\`.tamagui-flat-values-ignore\\` markers`,\n `- ${jsx.length} JSX sites: ${cleanJsx} clean, ${jsx.length - cleanJsx} need review`,\n `- ${styled.length} styled config sites: ${cleanStyled} clean, ${styled.length - cleanStyled} need review`,\n \"\",\n \"### Remaining manual migration\",\n \"\",\n `${readyFiles.length} of ${filesWithSites} files have no legacy condition object left after`,\n \"conversion. V3 has no compatibility setting; finish the remaining files directly:\",\n blockedFiles.length ? blockedFiles.map((file) => `\\`${file}\\``).join(\", \") : \"every file in this corpus is fully migrated.\",\n \"\",\n \"### Flag reasons\",\n \"\"\n ];\n const flagCounts = countCodes(flagged.flatMap((site) => site.flags));\n lines.push(\n ...flagCounts.length ? flagCounts.map(([code, count]) => `- ${code}: ${count}`) : [\"- none\"]\n );\n const warningCounts = countCodes(warnings.flatMap((site) => site.warnings));\n lines.push(\n \"\",\n \"### Configuration warning reasons\",\n \"\",\n ...warningCounts.length ? warningCounts.map(([code, count]) => `- ${code}: ${count}`) : [\"- none\"]\n );\n const inventoryCounts = countCodes(sites.flatMap((site) => site.inventory));\n if (inventoryCounts.length) {\n lines.push(\n \"\",\n \"### Values left authored for another migration\",\n \"\",\n \"These are not flat-value migration work. The conversion keeps them exactly as\",\n \"authored and records them so their follow-up migrations have a corpus inventory.\",\n \"\",\n ...inventoryCounts.map(([code, count]) => `- ${code}: ${count}`)\n );\n }\n const pendingCounts = countCodes(sites.flatMap((site) => site.pending));\n if (pendingCounts.length) {\n lines.push(\n \"\",\n \"### Waiting on runtime support\",\n \"\",\n \"The conversion is known but not offered, because the runtime cannot read it yet.\",\n \"Each pending reason below names the exact host or merge contract that must land\",\n \"before the suggested source is safe to apply.\",\n \"\",\n ...pendingCounts.map(([code, count]) => `- ${code}: ${count}`)\n );\n }\n if (registryDiagnostics.length) {\n lines.push(\"\", \"### Modifier registry diagnostics\", \"\");\n for (const diagnostic of registryDiagnostics) lines.push(`- ${diagnostic}`);\n }\n for (const file of files) {\n if (!file.sites.length) continue;\n lines.push(\"\", `## \\`${file.file}\\``, \"\");\n for (const site of file.sites) {\n const status = [\n site.assessmentVerdict === \"clean\" ? null : site.assessmentVerdict,\n site.flags.length ? \"syntax-blocked\" : null,\n site.warnings.length ? \"configuration-warning\" : null\n ].filter(Boolean).join(\", \");\n lines.push(\n `### ${site.label} at line ${site.line} (${status || \"clean\"})`,\n \"\",\n \"Before:\",\n \"\",\n \"```tsx\",\n site.before,\n \"```\",\n \"\",\n \"After:\",\n \"\",\n \"```tsx\",\n site.after,\n \"```\"\n );\n if (site.flags.length) {\n lines.push(\"\", \"Flags:\", \"\");\n for (const flag of site.flags) lines.push(`- **${flag.code}**: ${flag.detail}`);\n }\n if (site.warnings.length) {\n lines.push(\"\", \"Configuration warnings:\", \"\");\n for (const warning of site.warnings) {\n lines.push(`- **${warning.code}**: ${warning.detail}`);\n }\n }\n if (site.assessments.length) {\n lines.push(\"\", \"Conversion assessment:\", \"\");\n for (const assessment of site.assessments) {\n for (const reason of assessment.reasons) {\n lines.push(\n `- **${assessment.verdict}: ${assessment.property}**: ${reason.message}. Remedy: ${reason.remedy}.`\n );\n }\n }\n }\n if (site.inventory.length) {\n lines.push(\"\", \"Left authored:\", \"\");\n for (const flag of site.inventory)\n lines.push(`- **${flag.code}**: ${flag.detail}`);\n }\n if (site.pending.length) {\n lines.push(\"\", \"Waiting on runtime support:\", \"\");\n for (const flag of site.pending) lines.push(`- **${flag.code}**: ${flag.detail}`);\n }\n if (site.notes.length) {\n lines.push(\"\", \"Notes:\", \"\");\n for (const note of site.notes) lines.push(`- ${note}`);\n }\n lines.push(\"\");\n }\n }\n return {\n text: `${lines.join(\"\\n\")}\n`,\n summary: {\n sites: sites.length,\n clean: clean.length,\n needsRelocation: needsRelocation.length,\n unknownHost: unknownHost.length,\n ineligible: ineligible.length,\n flagged: flagged.length,\n warnings: warnings.length,\n waiting: waiting.length,\n ignoredFiles\n }\n };\n}\nexport {\n renderReport\n};\n//# sourceMappingURL=report.js.map\n"],"mappings":";AAAA,SAAS,WAAW,OAAO;CACzB,MAAM,yBAAyB,IAAI,IAAI;CACvC,KAAK,MAAM,QAAQ,OAAO,OAAO,IAAI,KAAK,OAAO,OAAO,IAAI,KAAK,IAAI,KAAK,KAAK,CAAC;CAChF,OAAO,CAAC,GAAG,MAAM,EAAE,MAChB,CAAC,UAAU,YAAY,CAAC,WAAW,gBAAgB,aAAa,aAAa,SAAS,cAAc,SAAS,CAChH;AACF;AACA,SAAS,aAAa,OAAO,QAAQ,qBAAqB,eAAe,GAAG,QAAQ,OAAO;CACzF,MAAM,QAAQ,MAAM,SAAS,SAAS,KAAK,KAAK;CAChD,MAAM,QAAQ,MAAM,QACjB,SAAS,KAAK,MAAM,WAAW,KAAK,KAAK,SAAS,WAAW,KAAK,KAAK,sBAAsB,OAChG;CACA,MAAM,UAAU,MAAM,QAAQ,SAAS,KAAK,MAAM,SAAS,CAAC;CAC5D,MAAM,WAAW,MAAM,QAAQ,SAAS,KAAK,SAAS,SAAS,CAAC;CAChE,MAAM,kBAAkB,MAAM,QAC3B,SAAS,KAAK,sBAAsB,kBACvC;CACA,MAAM,cAAc,MAAM,QAAQ,SAAS,KAAK,sBAAsB,cAAc;CACpF,MAAM,aAAa,MAAM,QAAQ,SAAS,KAAK,sBAAsB,YAAY;CACjF,MAAM,UAAU,MAAM,QAAQ,SAAS,KAAK,SAAS,WAAW,CAAC;CACjE,MAAM,MAAM,MAAM,QAAQ,SAAS,KAAK,SAAS,KAAK;CACtD,MAAM,S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