compose-node.d.ts 1.2 KB

123456789101112131415161718192021222324252627
  1. import type { Directives } from '../doc/directives.js';
  2. import type { ParsedNode } from '../nodes/Node.js';
  3. import type { ParseOptions } from '../options.js';
  4. import type { SourceToken, Token } from '../parse/cst.js';
  5. import type { Schema } from '../schema/Schema.js';
  6. import type { ComposeErrorHandler } from './composer.js';
  7. export interface ComposeContext {
  8. atRoot: boolean;
  9. directives: Directives;
  10. options: Readonly<Required<Omit<ParseOptions, 'lineCounter'>>>;
  11. schema: Readonly<Schema>;
  12. }
  13. interface Props {
  14. spaceBefore: boolean;
  15. comment: string;
  16. anchor: SourceToken | null;
  17. tag: SourceToken | null;
  18. end: number;
  19. }
  20. declare const CN: {
  21. composeNode: typeof composeNode;
  22. composeEmptyNode: typeof composeEmptyNode;
  23. };
  24. export type ComposeNode = typeof CN;
  25. export declare function composeNode(ctx: ComposeContext, token: Token, props: Props, onError: ComposeErrorHandler): ParsedNode;
  26. export declare function composeEmptyNode(ctx: ComposeContext, offset: number, before: Token[] | undefined, pos: number | null, { spaceBefore, comment, anchor, tag, end }: Props, onError: ComposeErrorHandler): import("../index.js").Scalar.Parsed;
  27. export {};