@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":"convert.js","names":[],"sources":["convert.js"],"sourcesContent":["import {\n Node,\n SyntaxKind\n} from \"ts-morph\";\nimport {\n compact,\n literalTree,\n numericValue,\n runtimeType,\n staticLeafValue,\n unwrapExpression\n} from \"./expressions\";\nimport {\n assessFlatConversion,\n convertLegacyConditionProp,\n expandToLonghands,\n flatStringValue,\n mergeProgramValues,\n parseValue,\n printProgram,\n resolveProp,\n sharedPayload,\n shorthands,\n styleProps,\n unitSuffix\n} from \"./grammar\";\nimport { isLegacyConditionName, resolveLegacyName } from \"./legacyNames\";\nimport { classifyStructuredNativeValue } from \"./structuredNative\";\nfunction assessmentVerdict(assessments) {\n if (assessments.some((assessment) => assessment.verdict === \"ineligible\")) {\n return \"ineligible\";\n }\n if (assessments.some((assessment) => assessment.verdict === \"needs-relocation\")) {\n return \"needs-relocation\";\n }\n return assessments.length ? \"unknown-host\" : \"clean\";\n}\nfunction createSite(kind, registry, containers, targets, host) {\n return {\n kind,\n registry,\n containers,\n targets,\n host,\n members: [],\n comments: /* @__PURE__ */ new Map(),\n extras: [],\n warnings: [],\n flags: [],\n inventory: [],\n pending: [],\n assessments: [],\n notes: [],\n legacy: false,\n index: 0\n };\n}\nfunction assessProgram(site, property, modifiers) {\n const targetProperty = resolveProp(property);\n const assessment = assessFlatConversion(\n {\n property: targetProperty,\n modifiers,\n targets: site.targets,\n host: site.host\n },\n site.registry\n );\n if (assessment.verdict !== \"clean\") addAssessment(site, targetProperty, assessment);\n return assessment.verdict !== \"ineligible\";\n}\nfunction addAssessment(site, property, assessment) {\n if (assessment.verdict === \"clean\") return;\n if (!site.assessments.some(\n (finding) => finding.property === property && finding.verdict === assessment.verdict && JSON.stringify(finding.reasons) === JSON.stringify(assessment.reasons)\n )) {\n site.assessments.push({\n property,\n verdict: assessment.verdict,\n reasons: assessment.reasons\n });\n }\n}\nfunction addFlag(list, code, detail) {\n if (!list.some((flag) => flag.code === code && flag.detail === detail)) {\n list.push({ code, detail });\n }\n}\nfunction addNote(site, note) {\n if (!site.notes.includes(note)) site.notes.push(note);\n}\nconst legacyPaletteStepPattern = /(?:^|[^\\w-])\\$?((?:gray|mauve|slate|sage|olive|sand|tomato|red|ruby|crimson|pink|plum|purple|violet|iris|indigo|blue|cyan|teal|jade|green|grass|bronze|gold|brown|orange|amber|yellow|lime|mint|sky)(?:1[0-2]|[1-9]))(?![\\w-])/g;\nfunction legacyPaletteStepWarning(prop, values) {\n const names = /* @__PURE__ */ new Set();\n for (const value of values) {\n legacyPaletteStepPattern.lastIndex = 0;\n for (const match of value.matchAll(legacyPaletteStepPattern)) names.add(match[1]);\n }\n if (!names.size) return null;\n const formatted = [...names].sort().map((name) => `\\`${name}\\``).join(\", \");\n return {\n code: \"legacy-palette-token\",\n detail: `${prop} preserves ${formatted}, which @tamagui/config/v6 does not define; choose an absolute palette token or an adaptive colorN value`\n };\n}\nconst empty = {\n payload: null,\n text: null,\n dynamic: false,\n problem: null,\n warning: null,\n blocked: null,\n inventory: null\n};\nfunction interpolate(prop, text, kind, registry) {\n return `\\${${text}}${kind === \"number\" ? unitSuffix(resolveProp(prop), registry) : \"\"}`;\n}\nfunction classifyStatic(prop, value, registry) {\n const probe = sharedPayload(prop, value, registry);\n const error = probe.errors[0];\n if (error || probe.payload === null) {\n const flag = {\n code: error?.code ?? \"unsupported-legacy-value\",\n detail: `${prop}: ${error?.message ?? `\"${String(value)}\" has no flat spelling`}`\n };\n return { ...empty, problem: flag, blocked: flag };\n }\n return { ...empty, payload: probe.payload };\n}\nfunction reparsesAsBase(value, registry) {\n const parsed = parseValue(value, registry);\n return parsed.ok && parsed.value.clauses.length === 0 && parsed.value.base === value.trim();\n}\nfunction classifyDynamic(prop, expression, registry) {\n const current = unwrapExpression(expression);\n const source = compact(current.getText());\n const structured = classifyStructuredNativeValue(\n resolveProp(prop),\n current,\n source,\n registry\n );\n if (structured) {\n return {\n ...empty,\n payload: structured.payload,\n blocked: structured.blocked\n };\n }\n const tree = literalTree(current, registry);\n if (tree && tree.error) {\n const flag2 = {\n code: tree.error.code,\n detail: `${prop}: ${tree.error.message}`\n };\n return { ...empty, problem: flag2, blocked: flag2 };\n }\n if (tree && tree.kind !== \"nullish\") {\n const rewrittenTokenText = /\\$(?=[\\w-])/.test(source) && tree.text !== source ? tree.text : null;\n return {\n ...empty,\n payload: interpolate(prop, tree.text, tree.kind, registry),\n text: rewrittenTokenText,\n dynamic: true,\n warning: legacyPaletteStepWarning(prop, tree.strings)\n };\n }\n if (tree) {\n const flag2 = {\n code: \"empty-style-value\",\n detail: `${prop} value \"${source}\" is always nullish and cannot join a program`\n };\n return { ...empty, blocked: flag2 };\n }\n const runtime = runtimeType(current);\n if (runtime.kind === \"number\") {\n return {\n ...empty,\n payload: interpolate(prop, source, \"number\", registry),\n dynamic: true\n };\n }\n if (runtime.kind === \"string\") {\n const tokens = runtime.literals?.filter((literal) => literal.startsWith(\"$\"));\n if (tokens?.length) {\n const flag2 = {\n code: \"legacy-token-constant\",\n detail: `${prop} value \"${source}\" resolves to legacy token ${tokens.map((token) => `\"${token}\"`).join(\", \")}; migrate the constant it comes from`\n };\n return { ...empty, problem: flag2, blocked: flag2 };\n }\n if (runtime.literals === null) {\n return {\n ...empty,\n payload: interpolate(prop, source, \"string\", registry),\n dynamic: true,\n inventory: {\n code: \"dynamic-string-value\",\n detail: `${prop} value \"${source}\" is an open string; confirm it never holds a legacy \"$token\" spelling`\n }\n };\n }\n return {\n ...empty,\n payload: interpolate(prop, source, \"string\", registry),\n dynamic: true\n };\n }\n const flag = {\n code: \"unprovable-dynamic-value\",\n detail: `${prop} value \"${source}\" has no provable number or string type, so it cannot fold into a program`\n };\n return { ...empty, blocked: flag };\n}\nfunction pushBase(site, prop, text, value, literalString) {\n const index = site.index++;\n if (literalString !== null) {\n const warning = legacyPaletteStepWarning(prop, [literalString]);\n if (warning) addFlag(site.warnings, warning.code, warning.detail);\n if (literalString.includes(\"$\")) {\n site.legacy = true;\n const allowed2 = assessProgram(site, prop, []);\n const flat = flatStringValue(literalString, site.registry);\n const problem = flat.text === null ? {\n code: flat.error?.code ?? \"unsupported-legacy-value\",\n detail: `${prop}: ${flat.error?.message ?? `${JSON.stringify(literalString)} has no flat spelling`}`\n } : !reparsesAsBase(flat.text, site.registry) ? {\n code: \"value-reparses-as-program\",\n detail: `${prop} value ${JSON.stringify(flat.text)} does not read back as one flat base value`\n } : null;\n if (problem !== null) addFlag(site.flags, problem.code, problem.detail);\n site.members.push({\n type: \"authored\",\n index,\n prop,\n text,\n payload: allowed2 && problem === null ? flat.text : null,\n dynamic: false,\n blocked: problem,\n token: allowed2,\n activated: false\n });\n return;\n }\n if (!reparsesAsBase(literalString, site.registry)) {\n const flag = {\n code: \"value-reparses-as-program\",\n detail: `${prop} value ${JSON.stringify(literalString)} does not read back as one flat base value`\n };\n addFlag(site.flags, flag.code, flag.detail);\n site.members.push({\n type: \"authored\",\n index,\n prop,\n text,\n payload: null,\n dynamic: false,\n blocked: flag,\n token: false,\n activated: false\n });\n return;\n }\n site.members.push({\n type: \"authored\",\n index,\n prop,\n text,\n payload: literalString,\n dynamic: false,\n blocked: null,\n token: false,\n activated: false\n });\n return;\n }\n const number = value ? numericValue(value) : null;\n if (number !== null) {\n const classified2 = classifyStatic(prop, number, site.registry);\n site.members.push({\n type: \"authored\",\n index,\n prop,\n text,\n payload: classified2.payload,\n dynamic: false,\n blocked: classified2.blocked,\n token: false,\n activated: false\n });\n return;\n }\n const kind = value?.getKind();\n if (value === null || kind === SyntaxKind.TrueKeyword || kind === SyntaxKind.FalseKeyword || kind === SyntaxKind.NullKeyword) {\n site.members.push({\n type: \"authored\",\n index,\n prop,\n text,\n payload: null,\n dynamic: false,\n blocked: {\n code: \"non-css-style-value\",\n detail: `${prop} value \"${compact(text)}\" is not a CSS value and cannot join a program`\n },\n token: false,\n activated: false\n });\n return;\n }\n const classified = classifyDynamic(prop, value, site.registry);\n if (classified.problem) {\n site.legacy = true;\n addFlag(site.flags, classified.problem.code, classified.problem.detail);\n }\n if (classified.warning) {\n addFlag(site.warnings, classified.warning.code, classified.warning.detail);\n }\n if (classified.inventory) {\n addFlag(site.inventory, classified.inventory.code, classified.inventory.detail);\n }\n if (classified.text !== null) site.legacy = true;\n const allowed = classified.text === null || assessProgram(site, prop, []);\n site.members.push({\n type: \"authored\",\n index,\n prop,\n text,\n payload: allowed ? classified.payload : null,\n dynamic: classified.dynamic,\n blocked: classified.blocked,\n token: allowed && classified.text !== null,\n activated: false\n });\n}\nconst sentinelMark = \"\u0001\";\nfunction evaluateLegacyObject(object, rootPath) {\n const leaves = [];\n const visit = (current, currentPath) => {\n const value = {};\n for (const property of current.getProperties()) {\n if (Node.isSpreadAssignment(property)) {\n return {\n value: null,\n fatal: `spread \"${compact(property.getText())}\" hides legacy condition entries`\n };\n }\n if (!Node.isPropertyAssignment(property)) {\n return {\n value: null,\n fatal: `property \"${compact(property.getText())}\" is not a static assignment`\n };\n }\n const nameNode = property.getNameNode();\n if (Node.isComputedPropertyName(nameNode)) {\n return {\n value: null,\n fatal: `computed property \"${compact(nameNode.getText())}\" hides the affected style property`\n };\n }\n const name = propertyName(nameNode);\n if (name === null) {\n return {\n value: null,\n fatal: `property name \"${compact(nameNode.getText())}\" is not statically known`\n };\n }\n const path = `${currentPath}.${name}`;\n const initializer = unwrapExpression(property.getInitializerOrThrow());\n if (Node.isObjectLiteralExpression(initializer)) {\n const nested = visit(initializer, path);\n if (nested.fatal) return nested;\n value[name] = nested.value;\n continue;\n }\n const leaf = staticLeafValue(initializer);\n if (leaf) {\n value[name] = leaf.value;\n continue;\n }\n value[name] = `${sentinelMark}${leaves.length}${sentinelMark}`;\n leaves.push({ path, prop: name, expression: initializer });\n }\n return { value, fatal: null };\n };\n const result = visit(object, rootPath);\n return { ...result, leaves };\n}\nfunction conditionProperties(value) {\n const properties = /* @__PURE__ */ new Set();\n const visit = (object) => {\n for (const key in object) {\n const child = object[key];\n if (child !== null && typeof child === \"object\" && isLegacyConditionName(key)) {\n visit(child);\n continue;\n }\n if (!styleProps.has(key)) continue;\n for (const property of expandToLonghands(key, shorthands)) properties.add(property);\n }\n };\n visit(value);\n return properties;\n}\nfunction pushLegacy(site, name, text, initializer, node) {\n const index = site.index++;\n site.legacy = true;\n const keep = (properties2) => {\n site.members.push({\n type: \"legacy\",\n index,\n name,\n text,\n contributions: [],\n properties: properties2,\n failed: true\n });\n };\n if (initializer === null || !Node.isObjectLiteralExpression(initializer)) {\n addFlag(\n site.flags,\n \"dynamic-legacy-condition\",\n `\"${name}\" is not an inline object literal, so its entries are not statically known`\n );\n keep(null);\n return;\n }\n const evaluated = evaluateLegacyObject(initializer, name);\n if (evaluated.fatal || evaluated.value === null) {\n addFlag(site.flags, \"dynamic-legacy-condition\", evaluated.fatal ?? \"unresolved\");\n keep(null);\n return;\n }\n const properties = conditionProperties(evaluated.value);\n const eligibilityStack = [{ object: evaluated.value, path: name }];\n let hasRejectedProperty = false;\n while (eligibilityStack.length > 0) {\n const current = eligibilityStack.pop();\n for (const prop in current.object) {\n const value = current.object[prop];\n const targetProp = resolveProp(prop);\n if (styleProps.has(targetProp) && !isLegacyConditionName(prop)) {\n const assessment = assessFlatConversion(\n {\n property: targetProp,\n targets: site.targets,\n host: site.host\n },\n site.registry\n );\n if (assessment.verdict === \"ineligible\") {\n addAssessment(site, targetProp, assessment);\n hasRejectedProperty = true;\n }\n continue;\n }\n if (value !== null && typeof value === \"object\" && !Array.isArray(value) && isLegacyConditionName(prop)) {\n eligibilityStack.push({\n object: value,\n path: `${current.path}.${prop}`\n });\n }\n }\n }\n if (hasRejectedProperty) {\n keep(properties);\n return;\n }\n const unresolved = site.containers.unresolved.get(node);\n if (unresolved !== void 0) {\n addFlag(site.flags, unresolved.code, unresolved.detail);\n keep(properties);\n return;\n }\n const resolution = resolveLegacyName(name, site.registry);\n if (!resolution.ok) {\n addFlag(site.flags, resolution.code, resolution.message);\n keep(properties);\n return;\n }\n const payloads = /* @__PURE__ */ new Map();\n let failed = false;\n for (let index2 = 0; index2 < evaluated.leaves.length; index2++) {\n const leaf = evaluated.leaves[index2];\n const classified = classifyDynamic(leaf.prop, leaf.expression, site.registry);\n if (classified.warning) {\n addFlag(\n site.warnings,\n classified.warning.code,\n `${leaf.path}: ${classified.warning.detail}`\n );\n }\n if (classified.payload === null) {\n const flag = classified.problem ?? classified.blocked;\n addFlag(\n site.flags,\n flag?.code ?? \"dynamic-condition-value\",\n `${leaf.path}: ${flag?.detail ?? \"the value is not statically known\"}`\n );\n failed = true;\n continue;\n }\n payloads.set(`${sentinelMark}${index2}${sentinelMark}`, classified.payload);\n }\n if (failed) {\n keep(properties);\n return;\n }\n const { canonical, replaceRoot } = resolution.resolved;\n const converted = convertLegacyConditionProp(canonical, evaluated.value, {\n registry: site.registry\n });\n if (converted === null) {\n addFlag(\n site.flags,\n \"unknown-legacy-condition\",\n `\"${name}\" is not a registered legacy condition spelling`\n );\n keep(properties);\n return;\n }\n for (const error of converted.errors) {\n const path = error.path.startsWith(canonical) ? `${name}${error.path.slice(canonical.length)}` : error.path;\n addFlag(site.flags, error.code, `${path}: ${error.message}`);\n failed = true;\n }\n const contributions = [];\n for (const contribution of converted.contributions) {\n if (!styleProps.has(contribution.prop)) {\n addFlag(\n site.flags,\n \"non-style-condition-entry\",\n `${name}.${contribution.prop} is not a style property, so a flat value cannot carry it`\n );\n failed = true;\n continue;\n }\n const modifiers = replaceRoot ? [...replaceRoot, ...contribution.clause.modifiers.slice(1)] : contribution.clause.modifiers;\n const dynamicPayload = payloads.get(contribution.clause.payload);\n contributions.push({\n prop: contribution.prop,\n clause: {\n modifiers,\n payload: dynamicPayload ?? contribution.clause.payload\n },\n dynamic: dynamicPayload !== void 0\n });\n if (!assessProgram(site, contribution.prop, modifiers)) failed = true;\n }\n if (failed) {\n keep(properties);\n return;\n }\n site.members.push({\n type: \"legacy\",\n index,\n name,\n text,\n contributions,\n properties,\n failed: false\n });\n}\nfunction activationName(prop) {\n return resolveProp(prop);\n}\nconst noProperties = /* @__PURE__ */ new Set();\nconst legacyStatePriorities = Object.freeze({\n hover: 2,\n press: 3,\n active: 3,\n focus: 4,\n \"focus-visible\": 4,\n \"focus-within\": 4,\n enter: 4,\n disabled: 5,\n exit: 5\n});\nfunction legacyStatePriority(modifiers) {\n let priority = null;\n for (const modifier of modifiers) {\n const candidate = legacyStatePriorities[modifier];\n if (candidate !== void 0 && (priority === null || candidate > priority)) {\n priority = candidate;\n }\n }\n return priority;\n}\nfunction orderedEntries(site) {\n const ordered = [];\n for (const member of site.members) {\n if (member.type === \"authored\") {\n if (!member.activated || member.payload === null) continue;\n ordered.push({\n prop: member.prop,\n value: { base: member.payload, clauses: [] },\n dynamic: member.dynamic,\n index: member.index,\n base: true,\n from: null,\n legacyStatePriority: null\n });\n continue;\n }\n if (member.type !== \"legacy\" || member.failed) continue;\n for (const contribution of member.contributions) {\n ordered.push({\n prop: contribution.prop,\n value: { base: null, clauses: [contribution.clause] },\n dynamic: contribution.dynamic,\n index: member.index,\n base: false,\n from: member,\n legacyStatePriority: legacyStatePriority(contribution.clause.modifiers)\n });\n }\n }\n const ranked = ordered.filter((entry) => entry.legacyStatePriority !== null).sort(\n (left, right) => left.legacyStatePriority - right.legacyStatePriority || left.index - right.index\n );\n if (ranked.length < 2) return ordered;\n let rankedIndex = 0;\n return ordered.map(\n (entry) => entry.legacyStatePriority === null ? entry : ranked[rankedIndex++]\n );\n}\nfunction buildSlots(ordered) {\n const slots = /* @__PURE__ */ new Map();\n for (const entry of ordered) {\n for (const property of expandToLonghands(entry.prop, shorthands)) {\n const previous = slots.get(property);\n const value = previous ? mergeProgramValues(previous.value, entry.value) : entry.value;\n slots.delete(property);\n slots.set(property, {\n property,\n sourceProp: entry.prop,\n value,\n anchor: previous ? Math.min(previous.anchor, entry.index) : entry.index,\n last: previous ? Math.max(previous.last, entry.index) : entry.index,\n dynamic: (previous?.dynamic ?? false) || entry.dynamic\n });\n }\n }\n return slots;\n}\nfunction barriers(site) {\n const list = [];\n for (const member of site.members) {\n if (member.type === \"spread\") {\n list.push({ index: member.index, source: member.text, bases: null, clauses: null });\n continue;\n }\n if (member.type === \"authored\" && !member.activated) {\n list.push({\n index: member.index,\n source: member.text,\n bases: new Set(expandToLonghands(member.prop, shorthands)),\n clauses: noProperties\n });\n continue;\n }\n if (member.type === \"legacy\" && member.failed) {\n list.push({\n index: member.index,\n source: member.name,\n bases: noProperties,\n clauses: member.properties\n });\n }\n }\n return list;\n}\nfunction resolveBarriers(site, ordered, slots) {\n let changed = false;\n for (const slot of slots.values()) {\n const contributions = ordered.filter(\n (entry) => expandToLonghands(entry.prop, shorthands).includes(slot.property)\n );\n for (const barrier of barriers(site)) {\n if (barrier.index <= slot.anchor || barrier.index >= slot.last) continue;\n if (barrier.clauses === null || barrier.clauses.has(slot.property)) {\n for (const entry of contributions) {\n if (entry.base || entry.index < barrier.index || !entry.from) continue;\n addFlag(\n site.flags,\n \"condition-order-not-preservable\",\n `\"${compact(barrier.source)}\" can set \"${slot.property}\" between the values contributing to it, so \"${entry.from.name}\" stays authored instead of merging`\n );\n entry.from.failed = true;\n changed = true;\n }\n }\n if (barrier.bases === null || barrier.bases.has(slot.property)) {\n for (const entry of contributions) {\n if (!entry.base || entry.index < barrier.index) continue;\n const authored = site.members.find(\n (member) => member.type === \"authored\" && member.index === entry.index && member.activated\n );\n if (authored && authored.type === \"authored\") {\n authored.payload = null;\n authored.blocked = {\n code: \"base-order-not-preservable\",\n detail: `\"${compact(barrier.source)}\" can set \"${slot.property}\" between the values contributing to it, so this base cannot move`\n };\n changed = true;\n continue;\n }\n addFlag(\n site.flags,\n \"base-order-not-preservable\",\n `\"${compact(barrier.source)}\" can set \"${slot.property}\" between the values contributing to it, so the merged base may win where it did not before`\n );\n }\n }\n }\n }\n return changed;\n}\nfunction assemble(site) {\n let slots = /* @__PURE__ */ new Map();\n for (; ; ) {\n let changed = false;\n const contributed = /* @__PURE__ */ new Set();\n for (const member of site.members) {\n if (member.type !== \"legacy\" || member.failed) continue;\n for (const contribution of member.contributions) {\n contributed.add(activationName(contribution.prop));\n }\n }\n for (const member of site.members) {\n if (member.type !== \"authored\") continue;\n const name = activationName(member.prop);\n member.activated = member.token && member.payload !== null || contributed.has(name);\n if (!member.activated || member.payload !== null) continue;\n const blocked = member.blocked;\n addFlag(\n site.flags,\n blocked?.code ?? \"unprovable-dynamic-value\",\n `a legacy condition targets \"${member.prop}\": ${blocked?.detail ?? `its base value \"${compact(member.text)}\" cannot join a program`}`\n );\n member.activated = false;\n for (const other of site.members) {\n if (other.type !== \"legacy\" || other.failed) continue;\n if (other.contributions.some((one) => activationName(one.prop) === name)) {\n other.failed = true;\n changed = true;\n }\n }\n }\n if (changed) continue;\n const ordered = orderedEntries(site);\n slots = buildSlots(ordered);\n if (!resolveBarriers(site, ordered, slots)) break;\n }\n const entries = [];\n for (const member of site.members) {\n if (member.type === \"authored\" && member.activated) continue;\n if (member.type === \"legacy\" && !member.failed) continue;\n entries.push({ index: member.index, text: member.text });\n }\n const printed = printSlots(site, slots);\n entries.push(...printed.output);\n entries.push(...site.extras);\n entries.sort((left, right) => left.index - right.index);\n return { entries, programs: printed.programs };\n}\nfunction printSlots(site, slots) {\n const printed = /* @__PURE__ */ new Set();\n const output = [];\n const programs = [];\n const outputCommentRanges = [];\n for (const [property, slot] of slots) {\n if (printed.has(property)) continue;\n const serialized = printProgram(slot.value);\n const expansion = expandToLonghands(slot.sourceProp, shorthands);\n const collapses = expansion.length > 0 && expansion.every((expanded) => {\n const candidate = slots.get(expanded);\n return candidate !== void 0 && candidate.sourceProp === slot.sourceProp && candidate.anchor === slot.anchor && candidate.dynamic === slot.dynamic && printProgram(candidate.value) === serialized;\n });\n const name = collapses ? slot.sourceProp : property;\n if (collapses) for (const expanded of expansion) printed.add(expanded);\n else printed.add(property);\n const value = slot.dynamic ? `\\`${serialized}\\`` : JSON.stringify(serialized);\n programs.push({ name, value: serialized, dynamic: slot.dynamic });\n const propertyText = site.kind === \"styled\" ? `${name}: ${value}` : `${name}=${slot.dynamic ? `{${value}}` : value}`;\n output.push({\n index: slot.anchor,\n text: propertyText\n });\n outputCommentRanges.push({\n outputIndex: output.length - 1,\n first: slot.anchor,\n last: slot.last\n });\n }\n verify(\n site,\n slots,\n [...output].sort((left, right) => left.index - right.index)\n );\n if (site.kind === \"styled\") {\n const commentedIndexes = /* @__PURE__ */ new Set();\n for (const range of outputCommentRanges) {\n const comments = [];\n for (const [index, texts] of site.comments) {\n if (index < range.first || index > range.last || commentedIndexes.has(index)) {\n continue;\n }\n comments.push(...texts);\n commentedIndexes.add(index);\n }\n if (comments.length) {\n output[range.outputIndex].text = `${comments.join(\"\\n\")}\n${output[range.outputIndex].text}`;\n }\n }\n }\n return { output, programs };\n}\nfunction sanitize(text) {\n let result = \"\";\n for (let index = 0; index < text.length; index++) {\n if (text[index] !== \"$\" || text[index + 1] !== \"{\") {\n result += text[index];\n continue;\n }\n let depth = 0;\n let end = index + 1;\n for (; end < text.length; end++) {\n if (text[end] === \"{\") depth++;\n else if (text[end] === \"}\" && --depth === 0) break;\n }\n result += \"zz\";\n index = end;\n }\n return result;\n}\nfunction verify(site, slots, output) {\n const separator = site.kind === \"styled\" ? \": \" : \"=\";\n const reparsed = /* @__PURE__ */ new Map();\n for (const entry of output) {\n const split = entry.text.indexOf(separator);\n const prop = entry.text.slice(0, split);\n let raw = entry.text.slice(split + separator.length);\n if (raw.startsWith(\"{\")) raw = raw.slice(1, -1);\n const text = sanitize(raw.slice(1, -1));\n const parsed = parseValue(text, site.registry);\n if (!parsed.ok) {\n addFlag(\n site.flags,\n \"emitted-value-invalid\",\n `\"${prop}=${text}\" does not parse: ${parsed.errors.map((error) => error.message).join(\"; \")}`\n );\n return;\n }\n for (const property of expandToLonghands(prop, shorthands)) {\n const previous = reparsed.get(property);\n reparsed.set(\n property,\n previous ? mergeProgramValues(previous, parsed.value) : parsed.value\n );\n }\n }\n for (const [property, slot] of slots) {\n const actual = reparsed.get(property);\n const expected = sanitize(printProgram(slot.value));\n if (actual === void 0 || sanitize(printProgram(actual)) !== expected) {\n addFlag(\n site.flags,\n \"emitted-program-mismatch\",\n `\"${property}\" reads back as \"${actual ? sanitize(printProgram(actual)) : \"(missing)\"}\" instead of \"${expected}\"`\n );\n }\n }\n}\nfunction propertyName(node) {\n if (Node.isIdentifier(node) || Node.isStringLiteral(node) || Node.isNumericLiteral(node)) {\n return node.getText().replace(/^['\"]|['\"]$/g, \"\");\n }\n return null;\n}\nfunction jsxAttributeName(attribute) {\n const name = attribute.getNameNode();\n return Node.isIdentifier(name) ? name.getText() : null;\n}\nfunction jsxLiteralString(attribute) {\n const initializer = attribute.getInitializer();\n if (Node.isStringLiteral(initializer)) return initializer.getLiteralValue();\n const expression = jsxExpression(attribute);\n if (expression && (Node.isStringLiteral(expression) || Node.isNoSubstitutionTemplateLiteral(expression))) {\n return expression.getLiteralValue();\n }\n return null;\n}\nfunction jsxExpression(attribute) {\n const initializer = attribute.getInitializer();\n if (!Node.isJsxExpression(initializer)) return null;\n const expression = initializer.getExpression();\n return expression ? unwrapExpression(expression) : null;\n}\nfunction isConvertedJsxAttribute(attribute) {\n if (Node.isJsxSpreadAttribute(attribute)) return true;\n if (!Node.isJsxAttribute(attribute)) return false;\n const name = jsxAttributeName(attribute);\n return !!name && (name === \"group\" || styleProps.has(name) || isLegacyConditionName(name));\n}\nfunction rewriteJsxSite(opening, entries) {\n const attributes = opening.getAttributes();\n const rendered = [];\n let inserted = false;\n for (const attribute of attributes) {\n if (isConvertedJsxAttribute(attribute)) {\n if (!inserted) {\n rendered.push(...entries.map((entry) => entry.text));\n inserted = true;\n }\n } else {\n rendered.push(attribute.getText());\n }\n }\n const source = opening.getText();\n const start = opening.getStart();\n const first = attributes[0];\n const last = attributes[attributes.length - 1];\n const prefix = source.slice(0, first.getStart() - start);\n const suffix = source.slice(last.getEnd() - start);\n opening.replaceWithText(`${prefix}${rendered.join(\" \")}${suffix}`);\n}\nfunction containerExtras(site, declaration, index) {\n const target = site.containers.targets.get(declaration);\n if (target === void 0) return;\n const name = target.named && target.group !== \"\" ? target.group : null;\n const text = site.kind === \"styled\" ? name === null ? \"container: true\" : `container: true, containerName: ${JSON.stringify(name)}` : name === null ? \"container\" : `container containerName=${JSON.stringify(name)}`;\n site.legacy = true;\n site.extras.push({ index, text });\n if (target.flag !== null) addFlag(site.flags, target.flag.code, target.flag.detail);\n addNote(\n site,\n `a descendant uses a legacy container-size condition on this group, so it declares a query container`\n );\n}\nfunction convertJsxSite(opening, registry, containers, targets, host, write = false) {\n const site = createSite(\"jsx\", registry, containers, targets, host);\n const before = [];\n for (const attribute of opening.getAttributes()) {\n if (Node.isJsxSpreadAttribute(attribute)) {\n const expression = unwrapExpression(attribute.getExpression());\n if (Node.isObjectLiteralExpression(expression)) {\n before.push(compact(attribute.getText()));\n for (const property of expression.getProperties()) {\n if (Node.isPropertyAssignment(property)) {\n const name2 = propertyName(property.getNameNode());\n if (name2 !== null) {\n if (name2 === \"group\" || styleProps.has(name2) || isLegacyConditionName(name2)) {\n pushStyledProperty(\n site,\n name2,\n property,\n `${name2}={${property.getInitializerOrThrow().getText()}}`\n );\n } else {\n site.members.push({\n type: \"passthrough\",\n index: site.index++,\n text: `${name2}={${property.getInitializerOrThrow().getText()}}`\n });\n }\n continue;\n }\n }\n site.members.push({\n type: \"spread\",\n index: site.index++,\n text: Node.isSpreadAssignment(property) ? `{${property.getText()}}` : `{...{ ${property.getText()} }}`\n });\n }\n continue;\n }\n before.push(compact(attribute.getText()));\n site.members.push({\n type: \"spread\",\n index: site.index++,\n text: attribute.getText()\n });\n continue;\n }\n const name = jsxAttributeName(attribute);\n if (!name) continue;\n const text = compact(attribute.getText());\n if (name === \"group\") {\n before.push(text);\n containerExtras(site, attribute, site.index);\n site.members.push({ type: \"passthrough\", index: site.index++, text });\n continue;\n }\n if (isLegacyConditionName(name)) {\n before.push(text);\n pushLegacy(site, name, text, jsxExpression(attribute), attribute);\n continue;\n }\n if (!styleProps.has(name)) continue;\n before.push(text);\n const literal = jsxLiteralString(attribute);\n pushBase(\n site,\n name,\n text,\n literal === null ? jsxExpression(attribute) : null,\n literal\n );\n }\n if (!site.legacy) return null;\n const { entries, programs } = assemble(site);\n const sourceFile = opening.getSourceFile();\n const report = {\n kind: \"jsx\",\n label: `<${opening.getTagNameNode().getText()}>`,\n line: sourceFile.getLineAndColumnAtPos(opening.getStart()).line,\n before: before.join(\" \"),\n after: entries.map((entry) => entry.text).join(\" \") || \"(no style props left)\",\n programs,\n assessments: site.assessments,\n assessmentVerdict: assessmentVerdict(site.assessments),\n warnings: site.warnings,\n flags: site.flags,\n inventory: site.inventory,\n pending: site.pending,\n notes: site.notes,\n legacyLeft: site.members.filter((member) => member.type === \"legacy\" && member.failed).length\n };\n if (write && !site.flags.some(\n (flag) => flag.code === \"emitted-program-mismatch\" || flag.code === \"emitted-value-invalid\"\n )) {\n rewriteJsxSite(opening, entries);\n }\n return report;\n}\nfunction pushStyledProperty(site, name, property, authoredText) {\n const comments = allCommentTexts(property);\n if (comments.length) site.comments.set(site.index, comments);\n const text = authoredText ?? textWithOuterComments(property);\n const initializer = unwrapExpression(property.getInitializerOrThrow());\n if (name === \"group\") {\n containerExtras(site, property, site.index);\n site.members.push({ type: \"passthrough\", index: site.index++, text });\n return;\n }\n if (isLegacyConditionName(name)) {\n pushLegacy(site, name, text, initializer, property);\n return;\n }\n if (!styleProps.has(name)) return;\n const literal = Node.isStringLiteral(initializer) || Node.isNoSubstitutionTemplateLiteral(initializer) ? initializer.getLiteralValue() : null;\n pushBase(site, name, text, literal === null ? initializer : null, literal);\n}\nfunction convertStyleObject(object, kind, label, registry, containers, targets, host, write = false) {\n const site = createSite(kind, registry, containers, targets, host);\n const before = [];\n for (const property of object.getProperties()) {\n if (Node.isSpreadAssignment(property)) {\n const expression = unwrapExpression(property.getExpression());\n before.push(compact(property.getText()));\n if (Node.isObjectLiteralExpression(expression)) {\n for (const nested of expression.getProperties()) {\n if (Node.isPropertyAssignment(nested)) {\n const name2 = propertyName(nested.getNameNode());\n if (name2 !== null) {\n if (name2 === \"group\" || styleProps.has(name2) || isLegacyConditionName(name2)) {\n pushStyledProperty(site, name2, nested);\n } else {\n site.members.push({\n type: \"passthrough\",\n index: site.index++,\n text: compact(nested.getText())\n });\n }\n continue;\n }\n }\n site.members.push({\n type: \"spread\",\n index: site.index++,\n text: compact(nested.getText())\n });\n }\n continue;\n }\n site.members.push({\n type: \"spread\",\n index: site.index++,\n text: compact(property.getText())\n });\n continue;\n }\n if (!Node.isPropertyAssignment(property)) continue;\n const nameNode = property.getNameNode();\n if (Node.isComputedPropertyName(nameNode)) {\n addFlag(\n site.flags,\n \"computed-property\",\n `\"${compact(nameNode.getText())}\" hides the affected style property`\n );\n continue;\n }\n const name = propertyName(nameNode);\n if (name === null) continue;\n if (!styleProps.has(name) && !isLegacyConditionName(name) && name !== \"group\")\n continue;\n before.push(compact(property.getText()));\n pushStyledProperty(site, name, property);\n }\n if (!site.legacy) return null;\n const { entries, programs } = assemble(site);\n const sourceFile = object.getSourceFile();\n const report = {\n kind,\n label,\n line: sourceFile.getLineAndColumnAtPos(object.getStart()).line,\n before: before.join(\", \"),\n after: entries.map((entry) => entry.text).join(\", \") || \"(no style props left)\",\n programs,\n assessments: site.assessments,\n assessmentVerdict: assessmentVerdict(site.assessments),\n warnings: site.warnings,\n flags: site.flags,\n inventory: site.inventory,\n pending: site.pending,\n notes: site.notes,\n legacyLeft: site.members.filter((member) => member.type === \"legacy\" && member.failed).length\n };\n if (write && !site.flags.some(\n (flag) => flag.code === \"emitted-program-mismatch\" || flag.code === \"emitted-value-invalid\"\n )) {\n rewriteStyleObject(object, entries);\n }\n return report;\n}\nfunction isConvertedStyledProperty(property) {\n if (Node.isSpreadAssignment(property)) return true;\n if (!Node.isPropertyAssignment(property)) return false;\n const nameNode = property.getNameNode();\n if (Node.isComputedPropertyName(nameNode)) return false;\n const name = propertyName(nameNode);\n return !!name && (name === \"group\" || styleProps.has(name) || isLegacyConditionName(name));\n}\nfunction allCommentTexts(node) {\n const comments = /* @__PURE__ */ new Map();\n for (const current of [node, ...node.getDescendants()]) {\n for (const range of [\n ...current.getLeadingCommentRanges(),\n ...current.getTrailingCommentRanges()\n ]) {\n comments.set(range.getPos(), range.getText());\n }\n }\n return [...comments.entries()].sort((left, right) => left[0] - right[0]).map((entry) => entry[1]);\n}\nfunction textWithOuterComments(node) {\n const comments = /* @__PURE__ */ new Map();\n for (const range of [\n ...node.getLeadingCommentRanges(),\n ...node.getTrailingCommentRanges()\n ]) {\n comments.set(range.getPos(), range.getText());\n }\n const prefix = [...comments.entries()].sort((left, right) => left[0] - right[0]).map((entry) => entry[1]);\n return [...prefix, node.getText()].join(\"\\n\");\n}\nfunction rewriteStyleObject(object, entries) {\n const rendered = [];\n let inserted = false;\n for (const property of object.getProperties()) {\n if (isConvertedStyledProperty(property)) {\n if (!inserted) {\n rendered.push(...entries.map((entry) => entry.text));\n inserted = true;\n }\n } else {\n rendered.push(textWithOuterComments(property));\n }\n }\n object.replaceWithText(\n rendered.length ? `{\n${rendered.join(\",\\n\")}\n}` : \"{}\"\n );\n}\nexport {\n convertJsxSite,\n convertStyleObject,\n sanitize\n};\n//# sourceMappingURL=convert.js.map\n"],"mappings":";;;;;;;AA4BA,SAAS,kBAAkB,aAAa;CACtC,IAAI,YAAY,MAAM,eAAe,WAAW,YAAY,YAAY,GAAG;EACzE,OAAO;CACT;CACA,IAAI,YAAY,MAAM,eAAe,WAAW,YAAY,kBAAkB,GAAG;EAC/E,OAAO;CACT;CACA,OAAO,YAAY,SAAS,iBAAiB;AAC/C;AACA,SAAS,WAAW,MAAM,UAAU,YAAY,SAAS,MAAM;CAC7D,OAAO;EACL;EACA;EACA;EACA;EACA;EACA,SAAS,CAAC;EACV,0BAA0B,IAAI,IAAI;EAClC,QAAQ,CAAC;EACT,UAAU,CAAC;EACX,OAAO,CAAC;EACR,WAAW,CAAC;EACZ,SAAS,CAAC;EACV,aAAa,CAAC;EACd,OAAO,CAAC;EACR,QAAQ;EACR,OAAO;CACT;AACF;AACA,SAAS,cAAc,MAAM,UAAU,WAAW;CAChD,MAAM,iBAAiB,YAAY,QAAQ;CAC3C,MAAM,aAAa,qBACjB;EACE,UAAU;EACV;EACA,SAAS,KAAK;EACd,MAAM,KAAK;CACb,GACA,KAAK,QACP;CACA,IAAI,WAAW,YAAY,SAAS,cAAc,MAAM,gBAAgB,UAAU;CAClF,OAAO,WAAW,YAAY;AAChC;AACA,SAAS,cAAc,MAAM,UAAU,YAAY;CACjD,IAAI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M,UAAU,KAAK,KAAK,MAAM,EAAE,EAAE,KAAK,UAAU,MAAM,EAAE;AAClG;AACA,SAAS,sBAAsB,MAAM;CACnC,MAAM,2BAA2B,IAAI,IAAI;CACzC,KAAK,MAAM,SAAS,CAClB,GAAG,KAAK,wBAAwB,GAChC,GAAG,KAAK,yBAAyB,CACnC,GAAG;EACD,SAAS,IAAI,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC;CAC9C;CACA,MAAM,SAAS,CAAC,GAAG,SAAS,QAAQ,CAAC,EAAE,MAAM,MAAM,UAAU,KAAK,KAAK,MAAM,EAAE,EAAE,KAAK,UAAU,MAAM,EAAE;CACxG,OAAO,CAAC,GAAG,QAAQ,KAAK,QAAQ,CAAC,EAAE,KAAK,IAAI;AAC9C;AACA,SAAS,mBAAmB,QAAQ,SAAS;CAC3C,MAAM,WAAW,CAAC;CAClB,IAAI,WAAW;CACf,KAAK,MAAM,YAAY,OAAO,cAAc,GAAG;EAC7C,IAAI,0BAA0B,QAAQ,GAAG;GACvC,IAAI,CAAC,UAAU;IACb,SAAS,KAAK,GAAG,QAAQ,KAAK,UAAU,MAAM,IAAI,CAAC;IACnD,WAAW;GACb;EACF,OAAO;GACL,SAAS,KAAK,sBAAsB,QAAQ,CAAC;EAC/C;CACF;CACA,OAAO,gBACL,SAAS,SAAS;EACpB,SAAS,KAAK,KAAK,EAAE;KAClB,IACH;AACF"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { Node, SyntaxKind } from "ts-morph";
|
|
2
|
+
import { flatStringValue } from "./grammar.mjs";
|
|
3
|
+
|
|
4
|
+
function unwrapExpression(expression) {
|
|
5
|
+
let current = expression;
|
|
6
|
+
while (Node.isParenthesizedExpression(current) || Node.isAsExpression(current) || Node.isTypeAssertion(current) || Node.isNonNullExpression(current)) {
|
|
7
|
+
current = current.getExpression();
|
|
8
|
+
}
|
|
9
|
+
return current;
|
|
10
|
+
}
|
|
11
|
+
function numericValue(expression) {
|
|
12
|
+
const current = unwrapExpression(expression);
|
|
13
|
+
if (Node.isNumericLiteral(current)) return Number(current.getText());
|
|
14
|
+
if (Node.isPrefixUnaryExpression(current)) {
|
|
15
|
+
const operand = current.getOperand();
|
|
16
|
+
if (!Node.isNumericLiteral(operand)) return null;
|
|
17
|
+
const value = Number(operand.getText());
|
|
18
|
+
const operator = current.getOperatorToken();
|
|
19
|
+
if (operator === SyntaxKind.MinusToken) return -value;
|
|
20
|
+
if (operator === SyntaxKind.PlusToken) return value;
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
function staticLeafValue(expression) {
|
|
25
|
+
const current = unwrapExpression(expression);
|
|
26
|
+
if (Node.isStringLiteral(current) || Node.isNoSubstitutionTemplateLiteral(current)) {
|
|
27
|
+
return {
|
|
28
|
+
found: true,
|
|
29
|
+
value: current.getLiteralValue()
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const number = numericValue(current);
|
|
33
|
+
if (number !== null) return {
|
|
34
|
+
found: true,
|
|
35
|
+
value: number
|
|
36
|
+
};
|
|
37
|
+
if (current.getKind() === SyntaxKind.TrueKeyword) return {
|
|
38
|
+
found: true,
|
|
39
|
+
value: true
|
|
40
|
+
};
|
|
41
|
+
if (current.getKind() === SyntaxKind.FalseKeyword) return {
|
|
42
|
+
found: true,
|
|
43
|
+
value: false
|
|
44
|
+
};
|
|
45
|
+
if (current.getKind() === SyntaxKind.NullKeyword) return {
|
|
46
|
+
found: true,
|
|
47
|
+
value: null
|
|
48
|
+
};
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
function literalText(value, registry) {
|
|
52
|
+
if (!value.includes("$")) return {
|
|
53
|
+
text: value,
|
|
54
|
+
error: null
|
|
55
|
+
};
|
|
56
|
+
const flat = flatStringValue(value, registry);
|
|
57
|
+
if (flat.text === null) {
|
|
58
|
+
return {
|
|
59
|
+
text: value,
|
|
60
|
+
error: {
|
|
61
|
+
code: flat.error?.code ?? "unsupported-legacy-value",
|
|
62
|
+
message: flat.error?.message ?? `"${value}" has no flat spelling`
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
text: flat.text,
|
|
68
|
+
error: null
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function templateTree(template, registry) {
|
|
72
|
+
const head = literalText(template.getHead().getLiteralText(), registry);
|
|
73
|
+
let error = head.error;
|
|
74
|
+
let text = `\`${head.text}`;
|
|
75
|
+
const strings = [template.getHead().getLiteralText()];
|
|
76
|
+
for (const span of template.getTemplateSpans()) {
|
|
77
|
+
const literal = span.getLiteral().getLiteralText();
|
|
78
|
+
const tail = literalText(literal, registry);
|
|
79
|
+
error ??= tail.error;
|
|
80
|
+
strings.push(literal);
|
|
81
|
+
text += `\${${span.getExpression().getText().trim()}}${tail.text}`;
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
kind: "string",
|
|
85
|
+
text: `${text}\``,
|
|
86
|
+
strings,
|
|
87
|
+
error
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function literalTree(expression, registry) {
|
|
91
|
+
const current = unwrapExpression(expression);
|
|
92
|
+
if (Node.isStringLiteral(current) || Node.isNoSubstitutionTemplateLiteral(current)) {
|
|
93
|
+
const value = current.getLiteralValue();
|
|
94
|
+
const literal = literalText(value, registry);
|
|
95
|
+
return {
|
|
96
|
+
kind: "string",
|
|
97
|
+
text: JSON.stringify(literal.text),
|
|
98
|
+
strings: [value],
|
|
99
|
+
error: literal.error
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
if (Node.isTemplateExpression(current)) return templateTree(current, registry);
|
|
103
|
+
const number = numericValue(current);
|
|
104
|
+
if (number !== null) {
|
|
105
|
+
return {
|
|
106
|
+
kind: "number",
|
|
107
|
+
text: String(number),
|
|
108
|
+
strings: [],
|
|
109
|
+
error: null
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
if (current.getKind() === SyntaxKind.UndefinedKeyword || current.getKind() === SyntaxKind.NullKeyword || Node.isIdentifier(current) && current.getText() === "undefined") {
|
|
113
|
+
return {
|
|
114
|
+
kind: "nullish",
|
|
115
|
+
text: current.getText(),
|
|
116
|
+
strings: [],
|
|
117
|
+
error: null
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
if (Node.isConditionalExpression(current)) {
|
|
121
|
+
const whenTrue = literalTree(current.getWhenTrue(), registry);
|
|
122
|
+
const whenFalse = literalTree(current.getWhenFalse(), registry);
|
|
123
|
+
if (!whenTrue || !whenFalse) return null;
|
|
124
|
+
if (whenTrue.kind !== whenFalse.kind && whenTrue.kind !== "nullish" && whenFalse.kind !== "nullish") {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
kind: whenTrue.kind === "nullish" ? whenFalse.kind : whenTrue.kind,
|
|
129
|
+
text: `${current.getCondition().getText().trim()} ? ${whenTrue.text} : ${whenFalse.text}`,
|
|
130
|
+
strings: [...whenTrue.strings, ...whenFalse.strings],
|
|
131
|
+
error: whenTrue.error ?? whenFalse.error
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
function runtimeType(expression) {
|
|
137
|
+
const type = unwrapExpression(expression).getType();
|
|
138
|
+
const parts = type.isUnion() ? type.getUnionTypes() : [type];
|
|
139
|
+
const literals = [];
|
|
140
|
+
let numbers = 0;
|
|
141
|
+
let strings = 0;
|
|
142
|
+
let known = 0;
|
|
143
|
+
for (const part of parts) {
|
|
144
|
+
if (part.isUndefined() || part.isNull()) continue;
|
|
145
|
+
known++;
|
|
146
|
+
if (part.isNumber() || part.isNumberLiteral()) {
|
|
147
|
+
numbers++;
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
if (part.isStringLiteral()) {
|
|
151
|
+
strings++;
|
|
152
|
+
literals.push(String(part.getLiteralValue()));
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
if (part.isString()) {
|
|
156
|
+
strings++;
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
kind: "unknown",
|
|
161
|
+
literals: null
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
if (!known) return {
|
|
165
|
+
kind: "unknown",
|
|
166
|
+
literals: null
|
|
167
|
+
};
|
|
168
|
+
if (numbers === known) return {
|
|
169
|
+
kind: "number",
|
|
170
|
+
literals: null
|
|
171
|
+
};
|
|
172
|
+
if (strings === known) {
|
|
173
|
+
return {
|
|
174
|
+
kind: "string",
|
|
175
|
+
literals: literals.length === known ? literals : null
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
kind: "unknown",
|
|
180
|
+
literals: null
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
function compact(text) {
|
|
184
|
+
return text.replace(/\s+/g, " ").trim();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export { compact, literalTree, numericValue, runtimeType, staticLeafValue, unwrapExpression };
|
|
188
|
+
//# sourceMappingURL=expressions.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expressions.js","names":[],"sources":["expressions.js"],"sourcesContent":["import { Node, SyntaxKind } from \"ts-morph\";\nimport { flatStringValue } from \"./grammar\";\nfunction unwrapExpression(expression) {\n let current = expression;\n while (Node.isParenthesizedExpression(current) || Node.isAsExpression(current) || Node.isTypeAssertion(current) || Node.isNonNullExpression(current)) {\n current = current.getExpression();\n }\n return current;\n}\nfunction numericValue(expression) {\n const current = unwrapExpression(expression);\n if (Node.isNumericLiteral(current)) return Number(current.getText());\n if (Node.isPrefixUnaryExpression(current)) {\n const operand = current.getOperand();\n if (!Node.isNumericLiteral(operand)) return null;\n const value = Number(operand.getText());\n const operator = current.getOperatorToken();\n if (operator === SyntaxKind.MinusToken) return -value;\n if (operator === SyntaxKind.PlusToken) return value;\n }\n return null;\n}\nfunction staticLeafValue(expression) {\n const current = unwrapExpression(expression);\n if (Node.isStringLiteral(current) || Node.isNoSubstitutionTemplateLiteral(current)) {\n return { found: true, value: current.getLiteralValue() };\n }\n const number = numericValue(current);\n if (number !== null) return { found: true, value: number };\n if (current.getKind() === SyntaxKind.TrueKeyword) return { found: true, value: true };\n if (current.getKind() === SyntaxKind.FalseKeyword) return { found: true, value: false };\n if (current.getKind() === SyntaxKind.NullKeyword) return { found: true, value: null };\n return null;\n}\nfunction literalText(value, registry) {\n if (!value.includes(\"$\")) return { text: value, error: null };\n const flat = flatStringValue(value, registry);\n if (flat.text === null) {\n return {\n text: value,\n error: {\n code: flat.error?.code ?? \"unsupported-legacy-value\",\n message: flat.error?.message ?? `\"${value}\" has no flat spelling`\n }\n };\n }\n return { text: flat.text, error: null };\n}\nfunction templateTree(template, registry) {\n const head = literalText(template.getHead().getLiteralText(), registry);\n let error = head.error;\n let text = `\\`${head.text}`;\n const strings = [template.getHead().getLiteralText()];\n for (const span of template.getTemplateSpans()) {\n const literal = span.getLiteral().getLiteralText();\n const tail = literalText(literal, registry);\n error ??= tail.error;\n strings.push(literal);\n text += `\\${${span.getExpression().getText().trim()}}${tail.text}`;\n }\n return { kind: \"string\", text: `${text}\\``, strings, error };\n}\nfunction literalTree(expression, registry) {\n const current = unwrapExpression(expression);\n if (Node.isStringLiteral(current) || Node.isNoSubstitutionTemplateLiteral(current)) {\n const value = current.getLiteralValue();\n const literal = literalText(value, registry);\n return {\n kind: \"string\",\n text: JSON.stringify(literal.text),\n strings: [value],\n error: literal.error\n };\n }\n if (Node.isTemplateExpression(current)) return templateTree(current, registry);\n const number = numericValue(current);\n if (number !== null) {\n return { kind: \"number\", text: String(number), strings: [], error: null };\n }\n if (current.getKind() === SyntaxKind.UndefinedKeyword || current.getKind() === SyntaxKind.NullKeyword || Node.isIdentifier(current) && current.getText() === \"undefined\") {\n return { kind: \"nullish\", text: current.getText(), strings: [], error: null };\n }\n if (Node.isConditionalExpression(current)) {\n const whenTrue = literalTree(current.getWhenTrue(), registry);\n const whenFalse = literalTree(current.getWhenFalse(), registry);\n if (!whenTrue || !whenFalse) return null;\n if (whenTrue.kind !== whenFalse.kind && whenTrue.kind !== \"nullish\" && whenFalse.kind !== \"nullish\") {\n return null;\n }\n return {\n kind: whenTrue.kind === \"nullish\" ? whenFalse.kind : whenTrue.kind,\n text: `${current.getCondition().getText().trim()} ? ${whenTrue.text} : ${whenFalse.text}`,\n strings: [...whenTrue.strings, ...whenFalse.strings],\n error: whenTrue.error ?? whenFalse.error\n };\n }\n return null;\n}\nfunction runtimeType(expression) {\n const type = unwrapExpression(expression).getType();\n const parts = type.isUnion() ? type.getUnionTypes() : [type];\n const literals = [];\n let numbers = 0;\n let strings = 0;\n let known = 0;\n for (const part of parts) {\n if (part.isUndefined() || part.isNull()) continue;\n known++;\n if (part.isNumber() || part.isNumberLiteral()) {\n numbers++;\n continue;\n }\n if (part.isStringLiteral()) {\n strings++;\n literals.push(String(part.getLiteralValue()));\n continue;\n }\n if (part.isString()) {\n strings++;\n continue;\n }\n return { kind: \"unknown\", literals: null };\n }\n if (!known) return { kind: \"unknown\", literals: null };\n if (numbers === known) return { kind: \"number\", literals: null };\n if (strings === known) {\n return { kind: \"string\", literals: literals.length === known ? literals : null };\n }\n return { kind: \"unknown\", literals: null };\n}\nfunction compact(text) {\n return text.replace(/\\s+/g, \" \").trim();\n}\nexport {\n compact,\n literalTree,\n numericValue,\n runtimeType,\n staticLeafValue,\n unwrapExpression\n};\n//# sourceMappingURL=expressions.js.map\n"],"mappings":";;;;AAEA,SAAS,iBAAiB,YAAY;CACpC,IAAI,UAAU;CACd,OAAO,KAAK,0BAA0B,OAAO,KAAK,KAAK,eAAe,OAAO,KAAK,KAAK,gBAAgB,OAAO,KAAK,KAAK,oBAAoB,OAAO,GAAG;EACpJ,UAAU,QAAQ,cAAc;CAClC;CACA,OAAO;AACT;AACA,SAAS,aAAa,YAAY;CAChC,MAAM,UAAU,iBAAiB,UAAU;CAC3C,IAAI,KAAK,iBAAiB,OAAO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AAM;EAAU,UAAU;CAAK;CAC/D,IAAI,YAAY,OAAO;EACrB,OAAO;GAAE,MAAM;GAAU,UAAU,SAAS,WAAW,QAAQ,WAAW;EAAK;CACjF;CACA,OAAO;EAAE,MAAM;EAAW,UAAU;CAAK;AAC3C;AACA,SAAS,QAAQ,MAAM;CACrB,OAAO,KAAK,QAAQ,QAAQ,GAAG,EAAE,KAAK;AACxC"}
|
package/dist/grammar.mjs
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { stylePropsAll } from "@tamagui/helpers";
|
|
2
|
+
import { shorthands } from "@tamagui/shorthands/v6";
|
|
3
|
+
import * as styleGrammarTooling from "@tamagui/style-grammar/tooling";
|
|
4
|
+
import { replaceV6BuiltInTokens } from "./builtInNames.mjs";
|
|
5
|
+
import { convertLegacyConditionProp as convertLegacyConditionProp$1, pseudoToModifier } from "./legacyConditions.mjs";
|
|
6
|
+
|
|
7
|
+
const grammar = styleGrammarTooling;
|
|
8
|
+
const { assessFlatConversion, createModifierRegistry, defaultMediaKeys, evaluateProgram, expandToLonghands, grammarEntries, grammarPlatformNames, legacyPartComposite, mergeProgramValues, parseValue, programEligibility, standaloneValueProps, parseTransformString } = grammar;
|
|
9
|
+
function renameBuiltInTokens(value) {
|
|
10
|
+
if (typeof value === "string") return replaceV6BuiltInTokens(value);
|
|
11
|
+
if (Array.isArray(value)) return value.map(renameBuiltInTokens);
|
|
12
|
+
if (value === null || typeof value !== "object") return value;
|
|
13
|
+
const renamed = {};
|
|
14
|
+
for (const key in value) {
|
|
15
|
+
renamed[key] = renameBuiltInTokens(value[key]);
|
|
16
|
+
}
|
|
17
|
+
return renamed;
|
|
18
|
+
}
|
|
19
|
+
function convertLegacyConditionProp(propName, value, options) {
|
|
20
|
+
return convertLegacyConditionProp$1(propName, renameBuiltInTokens(value), options);
|
|
21
|
+
}
|
|
22
|
+
const styleProps = /* @__PURE__ */ new Set([
|
|
23
|
+
...grammarEntries.map((entry) => entry.prop),
|
|
24
|
+
...Object.keys(standaloneValueProps),
|
|
25
|
+
...Object.keys(stylePropsAll),
|
|
26
|
+
...Object.keys(shorthands),
|
|
27
|
+
...Object.values(shorthands)
|
|
28
|
+
]);
|
|
29
|
+
const codemodMediaNames = [
|
|
30
|
+
...defaultMediaKeys,
|
|
31
|
+
"motionReduce",
|
|
32
|
+
"motionSafe"
|
|
33
|
+
];
|
|
34
|
+
function resolveProp(prop) {
|
|
35
|
+
return shorthands[prop] ?? prop;
|
|
36
|
+
}
|
|
37
|
+
const payloadProbeCondition = "$platform-web";
|
|
38
|
+
function sharedPayload(prop, value, registry) {
|
|
39
|
+
const converted = convertLegacyConditionProp(payloadProbeCondition, { [prop]: value }, { registry });
|
|
40
|
+
if (converted === null) {
|
|
41
|
+
throw new Error(`the payload probe condition "${payloadProbeCondition}" is unregistered`);
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
payload: converted.contributions[0]?.clause.payload ?? null,
|
|
45
|
+
errors: converted.errors
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const stringProbeProp = "color";
|
|
49
|
+
function flatStringValue(value, registry) {
|
|
50
|
+
const probe = sharedPayload(stringProbeProp, value, registry);
|
|
51
|
+
return {
|
|
52
|
+
text: probe.payload,
|
|
53
|
+
error: probe.errors[0] ?? null
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const unitSuffixes = /* @__PURE__ */ new Map();
|
|
57
|
+
function unitSuffix(prop, registry) {
|
|
58
|
+
const cached = unitSuffixes.get(prop);
|
|
59
|
+
if (cached !== void 0) return cached;
|
|
60
|
+
const probe = sharedPayload(prop, 1, registry);
|
|
61
|
+
const suffix = probe.payload !== null && probe.payload.startsWith("1") ? probe.payload.slice(1) : "";
|
|
62
|
+
unitSuffixes.set(prop, suffix);
|
|
63
|
+
return suffix;
|
|
64
|
+
}
|
|
65
|
+
const printProgram = grammar.formatParsedValue;
|
|
66
|
+
|
|
67
|
+
export { assessFlatConversion, codemodMediaNames, convertLegacyConditionProp, createModifierRegistry, defaultMediaKeys, evaluateProgram, expandToLonghands, flatStringValue, grammarEntries, grammarPlatformNames, legacyPartComposite, mergeProgramValues, parseTransformString, parseValue, printProgram, programEligibility, pseudoToModifier, resolveProp, sharedPayload, shorthands, standaloneValueProps, styleProps, unitSuffix };
|
|
68
|
+
//# sourceMappingURL=grammar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grammar.js","names":["convertLegacyConditionPropLocal"],"sources":["grammar.js"],"sourcesContent":["import { stylePropsAll } from \"@tamagui/helpers\";\nimport { shorthands } from \"@tamagui/shorthands/v6\";\nimport * as styleGrammarTooling from \"@tamagui/style-grammar/tooling\";\nimport { replaceV6BuiltInTokens } from \"./builtInNames\";\nimport {\n convertLegacyConditionProp as convertLegacyConditionPropLocal,\n pseudoToModifier\n} from \"./legacyConditions\";\nconst grammar = styleGrammarTooling;\nconst {\n assessFlatConversion,\n createModifierRegistry,\n defaultMediaKeys,\n evaluateProgram,\n expandToLonghands,\n grammarEntries,\n grammarPlatformNames,\n legacyPartComposite,\n mergeProgramValues,\n parseValue,\n programEligibility,\n standaloneValueProps,\n parseTransformString\n} = grammar;\nfunction renameBuiltInTokens(value) {\n if (typeof value === \"string\") return replaceV6BuiltInTokens(value);\n if (Array.isArray(value)) return value.map(renameBuiltInTokens);\n if (value === null || typeof value !== \"object\") return value;\n const renamed = {};\n for (const key in value) {\n renamed[key] = renameBuiltInTokens(value[key]);\n }\n return renamed;\n}\nfunction convertLegacyConditionProp(propName, value, options) {\n return convertLegacyConditionPropLocal(propName, renameBuiltInTokens(value), options);\n}\nconst styleProps = /* @__PURE__ */ new Set([\n ...grammarEntries.map((entry) => entry.prop),\n ...Object.keys(standaloneValueProps),\n ...Object.keys(stylePropsAll),\n ...Object.keys(shorthands),\n ...Object.values(shorthands)\n]);\nconst codemodMediaNames = [\n ...defaultMediaKeys,\n \"motionReduce\",\n \"motionSafe\"\n];\nfunction resolveProp(prop) {\n return shorthands[prop] ?? prop;\n}\nconst payloadProbeCondition = \"$platform-web\";\nfunction sharedPayload(prop, value, registry) {\n const converted = convertLegacyConditionProp(\n payloadProbeCondition,\n { [prop]: value },\n { registry }\n );\n if (converted === null) {\n throw new Error(\n `the payload probe condition \"${payloadProbeCondition}\" is unregistered`\n );\n }\n return {\n payload: converted.contributions[0]?.clause.payload ?? null,\n errors: converted.errors\n };\n}\nconst stringProbeProp = \"color\";\nfunction flatStringValue(value, registry) {\n const probe = sharedPayload(stringProbeProp, value, registry);\n return { text: probe.payload, error: probe.errors[0] ?? null };\n}\nconst unitSuffixes = /* @__PURE__ */ new Map();\nfunction unitSuffix(prop, registry) {\n const cached = unitSuffixes.get(prop);\n if (cached !== void 0) return cached;\n const probe = sharedPayload(prop, 1, registry);\n const suffix = probe.payload !== null && probe.payload.startsWith(\"1\") ? probe.payload.slice(1) : \"\";\n unitSuffixes.set(prop, suffix);\n return suffix;\n}\nconst printProgram = grammar.formatParsedValue;\nexport {\n assessFlatConversion,\n codemodMediaNames,\n convertLegacyConditionProp,\n createModifierRegistry,\n defaultMediaKeys,\n evaluateProgram,\n expandToLonghands,\n flatStringValue,\n grammarEntries,\n grammarPlatformNames,\n legacyPartComposite,\n mergeProgramValues,\n parseTransformString,\n parseValue,\n printProgram,\n programEligibility,\n pseudoToModifier,\n resolveProp,\n sharedPayload,\n shorthands,\n standaloneValueProps,\n styleProps,\n unitSuffix\n};\n//# sourceMappingURL=grammar.js.map\n"],"mappings":";;;;;;;AAQA,MAAM,UAAU;AAChB,MAAM,EACJ,sBACA,wBACA,kBACA,iBACA,mBACA,gBACA,sBACA,qBACA,oBACA,YACA,oBACA,sBACA,yBACE;AACJ,SAAS,oBAAoB,OAAO;CAClC,IAAI,OAAO,UAAU,UAAU,OAAO,uBAAuB,KAAK;CAClE,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,IAAI,mBAAmB;CAC9D,IAAI,UAAU,QAAQ,OAAO,UAAU,UAAU,OAAO;CACxD,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