* 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)
| 984 | * @returns {{runtimeName: string, kind: 'record'|'union'}|null} |
| 985 | */ |
| 986 | function resolveAliasRuntime(node, types) { |
| 987 | const seen = new Set() |
| 988 | let current = node |
| 989 | while (current?.kind === 'alias' && current.type?.ref && !seen.has(current.type.ref)) { |
| 990 | seen.add(current.type.ref) |
| 991 | const targetName = current.type.ref |
| 992 | const target = types[targetName] |
| 993 | if (target === undefined) return null // not in this domain — cross-domain, left unresolved |
| 994 | if (target.kind === 'record') return { runtimeName: normalizeDottedName(targetName), kind: 'record' } |
| 995 | if (target.kind === 'union') return { runtimeName: `${normalizeDottedName(targetName)}Union`, kind: 'union' } |
| 996 | current = target // another alias — keep resolving |
| 997 | } |
| 998 | return null |
| 999 | } |
| 1000 | |
| 1001 | function generateDomainFile({ domain, className, types, commands, events, vendorModules = [], specVersion }) { |
| 1002 | const parts = [LICENSE_HEADER, '', GENERATED_NOTE] |
no test coverage detected