* Follows an alias chain (an alias can point at another alias) to the record/union * it ultimately resolves to, within `types` — one domain's own type map, the same * shape generateDomainFile already has, so this needs no extra generator plumbing. * Only a same-domain target is resolvable this wa
(node, types)
| 925 | * @returns {{runtimeName: string, kind: 'record'|'union'}|null} |
| 926 | */ |
| 927 | function resolveAliasRuntime(node, types) { |
| 928 | const seen = new Set() |
| 929 | let current = node |
| 930 | while (current?.kind === 'alias' && current.type?.ref && !seen.has(current.type.ref)) { |
| 931 | seen.add(current.type.ref) |
| 932 | const targetName = current.type.ref |
| 933 | const target = types[targetName] |
| 934 | if (target === undefined) return null // not in this domain — cross-domain, left unresolved |
| 935 | if (target.kind === 'record') return { runtimeName: normalizeDottedName(targetName), kind: 'record' } |
| 936 | if (target.kind === 'union') return { runtimeName: `${normalizeDottedName(targetName)}Union`, kind: 'union' } |
| 937 | current = target // another alias — keep resolving |
| 938 | } |
| 939 | return null |
| 940 | } |
| 941 | |
| 942 | function generateDomainFile({ domain, className, types, commands, events, vendorModules = [], specVersion }) { |
| 943 | const parts = [LICENSE_HEADER, '', GENERATED_NOTE] |
no test coverage detected