UNPKG

yaml-unist-parser

Version:

A YAML parser that produces output compatible with unist

13 lines (12 loc) 795 B
import { Alias, BlockFolded, BlockLiteral, FlowMapping, FlowSequence, Mapping, Plain, QuoteDouble, QuoteSingle, Sequence } from "../types.mjs"; import { ContentPropertyToken } from "../cst.mjs"; import "./context.mjs"; import * as YAML from "yaml"; //#region src/transforms/transform.d.ts type YamlNode = null | YAML.ParsedNode; type YamlToUnist<T extends YamlNode> = T extends null ? null : T extends YAML.Alias.Parsed ? Alias : T extends YAML.YAMLMap.Parsed ? (Mapping | FlowMapping) : T extends YAML.YAMLSeq.Parsed ? (Sequence | FlowSequence) : T extends YAML.Scalar.Parsed ? (BlockLiteral | BlockFolded | Plain | QuoteSingle | QuoteDouble) : never; type TransformNodeProperties = { tokens: ContentPropertyToken[]; }; //#endregion export { TransformNodeProperties, YamlNode, YamlToUnist };