1
0
Fork 0
mirror of https://github.com/dawidd6/action-ansible-playbook.git synced 2024-11-27 02:27:11 +00:00
action-ansible-playbook/node_modules/yaml/dist/nodes/Node.d.ts

47 lines
2.2 KiB
TypeScript
Raw Normal View History

2022-10-21 14:44:44 +00:00
import type { Document } from '../doc/Document.js';
2024-01-17 09:08:10 +00:00
import type { ToJSOptions } from '../options.js';
2022-10-21 14:44:44 +00:00
import { Token } from '../parse/cst.js';
import type { StringifyContext } from '../stringify/stringify.js';
import type { Alias } from './Alias.js';
2024-01-17 09:08:10 +00:00
import { NODE_TYPE } from './identity.js';
2022-10-21 14:44:44 +00:00
import type { Scalar } from './Scalar.js';
import type { YAMLMap } from './YAMLMap.js';
import type { YAMLSeq } from './YAMLSeq.js';
2024-01-17 09:08:10 +00:00
export type Node<T = unknown> = Alias | Scalar<T> | YAMLMap<unknown, T> | YAMLSeq<T>;
2022-10-21 14:44:44 +00:00
/** Utility type mapper */
2024-01-17 09:08:10 +00:00
export type NodeType<T> = T extends string | number | bigint | boolean | null | undefined ? Scalar<T> : T extends Date ? Scalar<string | Date> : T extends Array<any> ? YAMLSeq<NodeType<T[number]>> : T extends {
2022-10-21 14:44:44 +00:00
[key: string]: any;
} ? YAMLMap<NodeType<keyof T>, NodeType<T[keyof T]>> : T extends {
[key: number]: any;
} ? YAMLMap<NodeType<keyof T>, NodeType<T[keyof T]>> : Node;
2024-01-17 09:08:10 +00:00
export type ParsedNode = Alias.Parsed | Scalar.Parsed | YAMLMap.Parsed | YAMLSeq.Parsed;
export type Range = [number, number, number];
2022-10-21 14:44:44 +00:00
export declare abstract class NodeBase {
readonly [NODE_TYPE]: symbol;
/** A comment on or immediately after this */
comment?: string | null;
/** A comment before this */
commentBefore?: string | null;
/**
* The `[start, value-end, node-end]` character offsets for the part of the
* source parsed into this node (undefined if not parsed). The `value-end`
* and `node-end` positions are themselves not included in their respective
* ranges.
*/
range?: Range | null;
/** A blank line before this node and its commentBefore */
spaceBefore?: boolean;
/** The CST token that was composed into this node. */
srcToken?: Token;
/** A fully qualified tag, if required */
tag?: string;
/** A plain JS representation of this node */
abstract toJSON(): any;
abstract toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;
constructor(type: symbol);
/** Create a copy of this node. */
clone(): NodeBase;
2024-01-17 09:08:10 +00:00
/** A plain JavaScript representation of this node. */
toJS(doc: Document<Node, boolean>, { mapAsMap, maxAliasCount, onAnchor, reviver }?: ToJSOptions): any;
2022-10-21 14:44:44 +00:00
}