stringify.d.ts 874 B

123456789101112131415161718192021
  1. import type { Document } from '../doc/Document.js';
  2. import type { Alias } from '../nodes/Alias.js';
  3. import type { ToStringOptions } from '../options.js';
  4. export type StringifyContext = {
  5. actualString?: boolean;
  6. allNullValues?: boolean;
  7. anchors: Set<string>;
  8. doc: Document;
  9. forceBlockIndent?: boolean;
  10. implicitKey?: boolean;
  11. indent: string;
  12. indentStep: string;
  13. indentAtStart?: number;
  14. inFlow: boolean | null;
  15. inStringifyKey?: boolean;
  16. flowCollectionPadding: string;
  17. options: Readonly<Required<Omit<ToStringOptions, 'collectionStyle' | 'indent'>>>;
  18. resolvedAliases?: Set<Alias>;
  19. };
  20. export declare function createStringifyContext(doc: Document, options: ToStringOptions): StringifyContext;
  21. export declare function stringify(item: unknown, ctx: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;