-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathalias.ts
More file actions
24 lines (22 loc) · 793 Bytes
/
alias.ts
File metadata and controls
24 lines (22 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import type * as YAML from "yaml";
import { createAlias } from "../factories/alias.js";
import { type Alias } from "../types.js";
import { extractComments } from "../utils/extract-comments.js";
import type Context from "./context.js";
import { type TransformNodeProperties } from "./transform.js";
export function transformAlias(
alias: YAML.Alias.Parsed,
context: Context,
props: TransformNodeProperties,
): Alias {
const srcToken = alias.srcToken!;
for (const token of extractComments(srcToken.end, context)) {
// istanbul ignore next -- @preserve
throw new Error(`Unexpected token type in alias end: ${token.type}`);
}
return createAlias(
context.transformRange(alias.range),
context.transformContentProperties(alias, props.tokens),
alias.source,
);
}