import { Data, Effect, Option, Result, Schema, Stream } from "effect"; //#region src/YamlDiagnostic.d.ts /** * Error codes emitted by the lexer stage. * * @public */ declare const YamlLexErrorCode: Schema.Literals; /** * The union of all lexer-stage error code string literals. * * @public */ type YamlLexErrorCode = typeof YamlLexErrorCode.Type; /** * Error codes emitted by the CST-parser stage. * * @public */ declare const YamlParseErrorCode: Schema.Literals; /** * The union of all parser-stage error code string literals. * * @public */ type YamlParseErrorCode = typeof YamlParseErrorCode.Type; /** * Error codes emitted by the composer stage. * * @public */ declare const YamlComposerErrorCode: Schema.Literals; /** * The union of all composer-stage error code string literals. * * @public */ type YamlComposerErrorCode = typeof YamlComposerErrorCode.Type; /** * Error codes emitted by the stringifier (the circular-reference guard). * * @public */ declare const YamlStringifyErrorCode: Schema.Literals; /** * The union of all stringifier-stage error code string literals. * * @public */ type YamlStringifyErrorCode = typeof YamlStringifyErrorCode.Type; /** * Error codes emitted by `YamlFormat.modify`'s path navigation against an * already-composed AST — not raised by the parser/composer/stringifier. * * @public */ declare const YamlModifyErrorCode: Schema.Literals; /** * The union of all modify-stage error code string literals. * * @public */ type YamlModifyErrorCode = typeof YamlModifyErrorCode.Type; /** * Union of all YAML error codes across all pipeline stages. Stage * discrimination lives here (in the code), not in separate error classes. * * @public */ declare const YamlErrorCode: Schema.Union, Schema.Literals, Schema.Literals, Schema.Literals, Schema.Literals]>; /** * The union of all YAML error code string literals. * * @public */ type YamlErrorCode = typeof YamlErrorCode.Type; declare const YamlDiagnostic_base: Schema.Class, Schema.Literals, Schema.Literals, Schema.Literals, Schema.Literals]>; readonly message: Schema.String; readonly offset: Schema.Number; readonly length: Schema.Number; readonly line: Schema.Number; readonly character: Schema.Number; }>, {}>; /** * One structured diagnostic: its {@link (YamlErrorCode:type)}, a * human-readable `message`, and its exact position (`offset`/`length`, plus * zero-based `line`/`character`). Used for both errors and warnings-as-data; * fatality is a property of the code — see {@link YamlDiagnostic.isFatal}. * * @remarks * The five-field positional core (`code`/`offset`/`length`/`line`/`character`) * is structurally identical to `@effected/jsonc`'s parse-error detail shape; * `message` is this package's additive extra. * * @public */ declare class YamlDiagnostic extends YamlDiagnostic_base { /** * The single fatal-code predicate: whether diagnostics with this code * abort a parse (vs. being recoverable warnings-as-data). Declared once, * as a property of the code — replacing the v3 source's three * subtly-differing inline fatal lists. */ static isFatal(code: YamlErrorCode): boolean; /** * Materialize a raw engine diagnostic record into a `YamlDiagnostic`, * deriving `line`/`character` from `offset` against the source `text`. * Advanced — the parse/stringify entry points call this for you. */ static fromRaw(raw: { readonly code: YamlErrorCode; readonly message: string; readonly offset: number; readonly length: number; }, text: string): YamlDiagnostic; } //#endregion //#region src/Yaml.d.ts declare const YamlParseOptions_base: Schema.Class; readonly maxAliasCount: Schema.optionalKey; readonly uniqueKeys: Schema.optionalKey; }>, {}>; /** * Options controlling parse behavior. All fields are omissible; absent fields * resolve to `strict` `true`, `maxAliasCount` `100` (the alias-based * denial-of-service guard) and `uniqueKeys` `true` (duplicate mapping keys * are errors). * * Construct with the validated `YamlParseOptions.make({ ... })` static — the * kit convention (never `new`). Call sites that take a `YamlParseOptions` * also accept a structurally-matching plain literal. * * @example * ```ts * import { Yaml, YamlParseOptions } from "@effected/yaml"; * * const options = YamlParseOptions.make({ maxAliasCount: 50 }); * const parsed = Yaml.parse("a: 1", options); * ``` * * @public */ declare class YamlParseOptions extends YamlParseOptions_base {} declare const YamlStringifyOptions_base: Schema.Class; /** * Column at which to fold long scalars. Default `0` (and any value `<= 0`) * never wraps; a positive value folds plain, double-quoted and block-folded * (`>`) scalars at approximately that column, never block-literal (`|`). * * Takes effect only through {@link Yaml.stringify} and * {@link Yaml.stringifyResult} — the two entry points that accept these * options on the value path. The schema factories ({@link Yaml.fromString}, * {@link Yaml.schema}, {@link Yaml.YamlFromString}) encode with default * stringify options (`lineWidth` `0`), so their output never folds. The * document/node path — `YamlDocument#stringify` and the `YamlFormat` * helpers built on it — threads the field into its render context but * never reads it, so it is inert there. */ readonly lineWidth: Schema.optionalKey; readonly defaultScalarStyle: Schema.optionalKey>; readonly defaultCollectionStyle: Schema.optionalKey>; readonly sortKeys: Schema.optionalKey; readonly indentSequences: Schema.optionalKey; /** * Quote style used when a `plain`-styled scalar requires quoting. Default * `"single"` — the released byte-compatible behavior. `"double"` renders * the same scalars double-quoted instead, matching the `yaml` npm * package's `singleQuote: false` output. * * Affects only the plain fallback: scalars that need no quoting stay * plain, and an explicit `defaultScalarStyle` of `"single-quoted"` or * `"double-quoted"` is unaffected. */ readonly quoteStyle: Schema.optionalKey>; /** * Additionally quote plain scalars a foreign resolution dialect would * coerce to a non-string. Absent (the default) adds no quoting beyond the * YAML 1.2 Core Schema rules — byte-identical to the released output. * * `"yaml-1.1"` quotes every plain scalar a YAML 1.1 parser (js-yaml, * PyYAML, libyaml, and the `yaml` npm package's YAML 1.1 schema, whose * lenient resolvers set the outer bound) would implicitly resolve to a * non-string: the extended * boolean spellings (`y`/`yes`/`on`/`off` and case variants — the "Norway * problem"), timestamps (`2024-01-15`, `2001-12-15T02:59:43.1Z`, the * space-separated 1.1 forms), sexagesimal numbers (`1:30`, * `190:20:30.15`), underscore-separated numbers (`1_000`) and the * base-2/8/16 integer forms (`0b1010_0111`, `0777`, `0x_FF`). Use it when * emitted output is parsed downstream by a YAML 1.1 consumer and blanket * `defaultScalarStyle` quoting is too noisy. * * Strictly additive: it never un-quotes anything the 1.2 rules require * quoted, strings no 1.1 parser coerces stay plain, and the quote * character stays governed by `quoteStyle`. Scalars carrying an explicit * tag are exempt, exactly like the 1.2 type-conflict check. Applies * wherever the plain fallback renders — values, mapping keys, flow items — * on both the value path ({@link Yaml.stringify}, * {@link Yaml.stringifyResult}) and the node path (`YamlDocument#stringify` * and the `YamlFormat` helpers). */ readonly quoteCompat: Schema.optionalKey>; readonly finalNewline: Schema.optionalKey; readonly forceDefaultStyles: Schema.optionalKey; }>, {}>; /** * Options controlling stringify behavior. All fields are omissible; absent * fields resolve to `indent` `2`, `lineWidth` `0`, `defaultScalarStyle` * `"plain"`, `defaultCollectionStyle` `"block"`, `sortKeys` `false`, * `indentSequences` `false`, `quoteStyle` `"single"`, `quoteCompat` absent * (no dialect-compat quoting), `finalNewline` `true` and `forceDefaultStyles` * `false`. * * `lineWidth` controls column-based scalar folding. The default `0` (and any * value `<= 0`) never wraps, emitting byte-identical output to the historic * no-fold behavior; a positive value folds long plain, double-quoted and * block-folded (`>`) scalars at approximately that column, inserting only * semantically transparent line breaks. Block-literal (`|`) content is never * folded — literal blocks preserve their bytes by definition. Folding is a * value-path feature only: `YamlDocument#stringify` and the `YamlFormat` * helpers accept these options but do not fold (see `lineWidth`). * * `indentSequences` controls the presentation of block sequences nested under * a mapping key: `false` (the default) emits them at the key's column — the * kit's byte-compatible legacy form — while `true` indents them one level, * matching the `yaml` npm package's default output. Top-level sequences stay * at column zero in both modes. * * `quoteStyle` selects the quote character used when a `plain`-styled scalar * (the `defaultScalarStyle` default) turns out to require quoting: `"single"` * (the default) emits `'@parcel/watcher'` — the kit's byte-compatible legacy * form — while `"double"` emits `"@parcel/watcher"`, matching the `yaml` npm * package's `singleQuote: false` output. It is a fallback selector only: * scalars that need no quoting stay plain, and an explicit * `defaultScalarStyle` of `"single-quoted"` or `"double-quoted"` still wins. * On that plain fallback path, values carrying a tab, a carriage return or * any other C0 control character are always emitted double-quoted whichever * `quoteStyle` is set, since only double quotes can escape them into a form * that round-trips exactly. * * Construct with the validated `YamlStringifyOptions.make({ ... })` static — * the kit convention (never `new`). Call sites that take a * `YamlStringifyOptions` also accept a structurally-matching plain literal. * * @example * ```ts * import { Yaml, YamlStringifyOptions } from "@effected/yaml"; * * const options = YamlStringifyOptions.make({ indentSequences: true }); * const yaml = Yaml.stringify({ key: ["a", "b"] }, options); * // key: * // - a * // - b * ``` * * @public */ declare class YamlStringifyOptions extends YamlStringifyOptions_base {} declare const YamlParseError_base: Schema.Class; readonly input: Schema.String; }>, import("effect/Cause").YieldableError>; /** * Error-recovery parse failure: aggregates every fatal {@link YamlDiagnostic} * encountered, so a single failure reports the whole batch. Raised by * {@link Yaml.parse}, {@link Yaml.parseAll}, `YamlDocument.parse`/`parseAll` * and the decode direction of the schema factories. The error itself has no * `code` field: read the code from the diagnostics — * `error.diagnostics[0].code` is the primary failure. * * @public */ declare class YamlParseError extends YamlParseError_base { get message(): string; } declare const YamlStringifyError_base: Schema.Class; readonly value: Schema.Unknown; }>, import("effect/Cause").YieldableError>; /** * Stringification failure (the circular-reference guard), carrying structured * {@link YamlDiagnostic} entries and the offending value. Raised by * {@link Yaml.stringify}, `YamlDocument#stringify` and the encode direction of * the schema factories. The error itself has no `code` field: read the code * from the diagnostics — `error.diagnostics[0].code` is the primary failure. * * @public */ declare class YamlStringifyError extends YamlStringifyError_base { get message(): string; } /** * A domain codec pre-bound to its two directions, returned by * {@link Yaml.bind}: the composed `schema` (what {@link Yaml.schema} returns) * plus `decode` and `encode` functions derived from it once, so callers need * no generic `Schema` machinery at the use site. * * @public */ interface YamlBoundCodec { /** The composed codec decoding a YAML `string` straight into `T`. */ readonly schema: Schema.Codec; /** Decode a single-document YAML string into a validated `T`. */ readonly decode: (text: string) => Effect.Effect; /** Encode a `T` back to YAML text with default stringify options. */ readonly encode: (value: T) => Effect.Effect; } /** * Static entry points for YAML parsing, stringification, comment stripping, * semantic equality and the schema factories. Not instantiable. * * @remarks * `parse`/`parseAll`/`stringify` and the schema factories carry real typed * error channels — including the hardening guards (an alias-expansion budget * on decode, a nesting-depth cap on encode) that keep malformed or * adversarial input on the typed channel instead of surfacing as an unhandled * defect. `stripComments`/`equals`/`equalsValue` are pure total functions. * * @example * ```ts * import { Yaml } from "@effected/yaml"; * import { Effect } from "effect"; * * const program = Effect.gen(function* () { * const value = yield* Yaml.parse("name: Alice\nage: 30"); * return value; // { name: "Alice", age: 30 } * }); * ``` * * @public */ declare class Yaml { private constructor(); /** * Parse a single YAML document into a plain JavaScript value, resolving * anchors and aliases. Error-recovery parsing: collects every fatal * diagnostic and fails once with the aggregate {@link YamlParseError}. * Returns `unknown`, never `any`. * * A "billion laughs" alias-expansion blow-up (an alias chain whose * resolved size grows exponentially relative to `maxAliasCount`) also * fails through {@link YamlParseError} with an `AliasCountExceeded` * diagnostic, never as an unhandled defect. * * Defined in terms of {@link Yaml.parseResult} — synchronous callers can * use that variant directly. */ static readonly parse: (text: string, options?: YamlParseOptions | undefined) => Effect.Effect; /** * Parse a multi-document YAML stream into an array of plain JavaScript * values (one per document, in order). Any fatal diagnostic in any * document — or a stream-level directive-placement error — fails the * whole Effect with the aggregate {@link YamlParseError}. * * A "billion laughs" alias-expansion blow-up in any document also fails * through {@link YamlParseError} with an `AliasCountExceeded` diagnostic, * never as an unhandled defect. * * Defined in terms of {@link Yaml.parseAllResult} — synchronous callers * can use that variant directly. */ static readonly parseAll: (text: string, options?: YamlParseOptions | undefined) => Effect.Effect; /** * Stringify a plain JavaScript value as YAML. Fails with * {@link YamlStringifyError} on circular references (`CircularReference`) * or on a value nested deeper than the stringifier's recursion budget * (`NestingDepthExceeded`) — both surface through the typed error channel * rather than as an unhandled stack-overflow defect. * * @remarks * A `"<<"` object key is emitted **quoted** (`'<<': …`). This is the * opposite of the document path ({@link YamlFormat.format} and * `YamlDocument#stringify`), which leaves a parsed plain `<<` key unquoted * so it keeps its merge-key meaning, and the asymmetry is deliberate: a * `"<<"` key on a plain JavaScript object is an ordinary string key that * never carried merge semantics, so emitting it plain would silently turn * ordinary data into a merge directive. */ static readonly stringify: (value: unknown, options?: YamlStringifyOptions | undefined) => Effect.Effect; /** * Synchronous single-document parse, returning a `Result` instead of * an `Effect`. A pure escape hatch for config-time callers that cannot * `await` an Effect (a `vitest.config.ts` is the motivating case). * * @remarks * This is the package's single parse path. {@link Yaml.parse} is defined in * terms of it (`Effect.fromResult` behind the named span), so the two * variants cannot diverge. Reach for the `Effect` variant inside Effect * code — it carries the `Yaml.parse` tracing span — and for this one at * synchronous boundaries. * * Preserves the package contract — malformed and adversarial input fails * typed, never as a defect. Fatal diagnostics, duplicate keys and a * "billion laughs" alias-expansion blow-up all yield a `Failure` carrying a * {@link YamlParseError}; the method never throws. * * @example * ```ts * import { Yaml } from "@effected/yaml"; * import { Result } from "effect"; * * const result = Yaml.parseResult("name: Alice\nage: 30"); * if (Result.isSuccess(result)) { * result.success; // { name: "Alice", age: 30 } * } else { * result.failure; // YamlParseError * } * ``` * * @public */ static parseResult(text: string, options?: YamlParseOptions): Result.Result; /** * Synchronous multi-document parse, returning a `Result` instead of an * `Effect` — the {@link Yaml.parseResult} counterpart to * {@link Yaml.parseAll}. Empty input succeeds with `[null]` (the engine * reads `""` as one empty document, exactly as {@link Yaml.parse} yields * `null` for it); a single-document stream succeeds with a one-element * array whose value is exactly what {@link Yaml.parseResult} yields. * * @remarks * This is the package's single multi-document parse path. * {@link Yaml.parseAll} is defined in terms of it (`Effect.fromResult` * behind the named span), so the two variants cannot diverge. Anchors are * document-scoped: each document's aliases resolve against its own anchor * map, never a neighbor's. * * Fails with the aggregate {@link YamlParseError} when **any** document in * the stream carries a fatal diagnostic (or a stream-level * directive-placement error), which makes it a whole-stream validity * check: a `Success` means every document parsed clean. Preserves the * package contract — malformed and adversarial input (including a * "billion laughs" alias bomb in any document) fails typed, never as a * defect; the method never throws. * * @example * ```ts * import { Yaml } from "@effected/yaml"; * import { Result } from "effect"; * * // Whole-stream validity check: fails if ANY document is invalid. * const result = Yaml.parseAllResult("a: 1\n---\nb: 2\n"); * if (Result.isSuccess(result)) { * result.success; // [{ a: 1 }, { b: 2 }] * } else { * result.failure; // YamlParseError aggregating every fatal diagnostic * } * ``` * * @public */ static parseAllResult(text: string, options?: YamlParseOptions): Result.Result, YamlParseError>; /** * Synchronous stringify, returning a `Result` instead of an `Effect`. * The pure counterpart to {@link Yaml.stringify} for config-time callers * that cannot `await`. * * Preserves the package contract — a circular reference (`CircularReference`) * or a value nested past the recursion budget (`NestingDepthExceeded`) * yields a `Failure` carrying a {@link YamlStringifyError} rather than a * thrown stack-overflow defect; the method never throws. * * @example * ```ts * import { Yaml } from "@effected/yaml"; * import { Result } from "effect"; * * const result = Yaml.stringifyResult({ name: "Alice" }); * if (Result.isFailure(result)) { * result.failure; // YamlStringifyError * } else { * result.success; // "name: Alice\n" * } * ``` * * @public */ static stringifyResult(value: unknown, options?: YamlStringifyOptions): Result.Result; /** * Strip comments from YAML text. Without `replaceCh`, comment characters * are removed (line breaks are kept, so line numbers stay stable); with a * `replaceCh` (e.g. `" "`), each comment character is replaced instead, * keeping all offsets stable. Quote-aware: `#` inside quoted scalars is * content, not a comment. Pure and total. */ static stripComments(text: string, replaceCh?: string): string; /** * Compare two YAML strings for semantic equality: comments, whitespace, * formatting and mapping key order are ignored; sequence order is * significant. Malformed input is never equal to anything — parse errors * (or duplicate keys) on either side yield `false` rather than comparing * recovery-parser artifacts. Pure and total. */ static equals(a: string, b: string): boolean; /** * Compare a YAML string against an existing JavaScript value with the * same semantics as {@link Yaml.equals}: malformed `text` yields `false`. * Pure and total. */ static equalsValue(text: string, value: unknown): boolean; /** * A `Schema` decoding a single YAML document with the * given `options` (defaults when omitted) and encoding values back to * YAML text with default stringify options. * * Schema-producing: each call returns a fresh schema whose derivation * caches are not shared across calls. Bind the result to a `const` on hot * paths; for the default-options case use {@link Yaml.YamlFromString}. */ static fromString(options?: YamlParseOptions): Schema.Codec; /** * The zero-config `Schema` — `Yaml.fromString()` with * default options, pre-bound so the common case needs no memoization * discipline. */ static readonly YamlFromString: Schema.Codec; /** * A `Schema, string>` decoding a multi-document * YAML stream into one value per document, and encoding an array of * values back into a `---`-separated stream. * * Schema-producing: bind the result to a `const` on hot paths (see * {@link Yaml.fromString}). */ static allFromString(options?: YamlParseOptions): Schema.Codec, string>; /** * Compose {@link Yaml.fromString} with a target schema, yielding a * `Schema` that decodes YAML straight into a validated domain * value — the single best consumer-facing feature of the library. The * target's decoding/encoding service requirements flow through. * * Schema-producing: bind the result to a `const` on hot paths (see * {@link Yaml.fromString}). */ static schema(target: Schema.Codec, options?: YamlParseOptions): Schema.Codec; /** * Bind a target schema to the YAML codec once, yielding the composed * schema plus pre-derived `decode`/`encode` directions — the * {@link Yaml.schema} composition without the generic `Schema` machinery * at every use site. Binds the plain single-document form only: default * {@link YamlParseOptions} on decode, default stringify options on encode; * for multi-document streams compose over {@link Yaml.allFromString} * directly. * * Both directions fail with `Schema.SchemaError`, exactly as * `Schema.decodeEffect`/`Schema.encodeEffect` over {@link Yaml.schema} * would; the target's decoding/encoding service requirements flow through. * * @remarks * Schema-producing: each call composes a fresh schema and derives both * directions from it. Bind the result to a `const` — that single binding is * the point. * * @example * ```ts * import { Yaml } from "@effected/yaml"; * import { Effect, Schema } from "effect"; * * const Config = Schema.Struct({ port: Schema.Number }); * const config = Yaml.bind(Config); * * const program = Effect.gen(function* () { * const value = yield* config.decode("port: 3000"); * const text = yield* config.encode(value); * return [value, text] as const; * }); * ``` * * @param target - The domain schema decoded values must satisfy. * @returns A {@link YamlBoundCodec} carrying the composed schema and its * two pre-bound directions. */ static bind(target: Schema.Codec): YamlBoundCodec; } //#endregion //#region src/YamlEdit.d.ts /** * A single path segment: a `string` for mapping keys or a `number` for * sequence indices. * * @public */ type YamlSegment = string | number; /** * An ordered sequence of {@link (YamlSegment:type)} values describing a * location within a YAML document tree. * * @public */ type YamlPath = ReadonlyArray; declare const YamlRange_base: Schema.Class, {}>; /** * A range within a YAML document, expressed as a zero-based character * `offset` and a `length` in UTF-16 code units. Pass to `YamlFormat.format` * to restrict formatting to a region. * * @public */ declare class YamlRange extends YamlRange_base {} declare const YamlEdit_base: Schema.Class, {}>; /** * A non-mutating text edit: replace the span `[offset, offset + length)` with * `content`. Set `length` to `0` to insert, `content` to `""` to delete. * * @remarks * Structurally identical to `@effected/jsonc`'s edit shape (same field names, * types and semantics) per the jsonc/yaml parity convention, so consumer code * can be written once over "a document codec's Edit/Range/Path". * * @public */ declare class YamlEdit extends YamlEdit_base { /** * Apply `edits` to `text`, producing a new string. Edits are applied in * reverse-offset order so earlier offsets stay valid; the input `edits` * array is not mutated. Overlapping edits are a programmer error and throw * as a defect — `YamlFormat` never produces them. */ static applyAll(text: string, edits: ReadonlyArray): string; } //#endregion //#region src/YamlNode.d.ts /** * YAML scalar presentation styles. * * @public */ declare const ScalarStyle: Schema.Literals; /** * The union of all scalar style string literals. * * @public */ type ScalarStyle = typeof ScalarStyle.Type; /** * YAML collection presentation styles. * * @public */ declare const CollectionStyle: Schema.Literals; /** * The union of all collection style string literals. * * @public */ type CollectionStyle = typeof CollectionStyle.Type; /** * Quote characters available to the stringifier's plain-scalar fallback: the * style a `plain`-styled scalar is rendered in when it turns out to require * quoting. Referenced by the `quoteStyle` field of `YamlStringifyOptions`; * unlike `ScalarStyle` it is a stringify-option vocabulary, never a property * of a composed node. * * @public */ declare const QuoteStyle: Schema.Literals; /** * The union of all fallback quote style string literals. * * @public */ type QuoteStyle = typeof QuoteStyle.Type; /** * Foreign resolution dialects the stringifier's plain-scalar fallback can * defend against: setting the `quoteCompat` field of `YamlStringifyOptions` * to `"yaml-1.1"` additionally quotes every plain scalar a YAML 1.1 parser * (js-yaml, PyYAML, libyaml, and the `yaml` npm package's YAML 1.1 schema, * whose lenient resolvers set the outer bound) would implicitly resolve to a * non-string — * `yes`/`no`/`on`/`off` booleans, ISO 8601 and space-separated timestamps, * sexagesimal `1:30`, underscored `1_000` and base-2/8/16 numbers. Like * `QuoteStyle` it is a stringify-option vocabulary, never a property of a * composed node. * * @public */ declare const QuoteCompat: Schema.Literals; /** * The union of all quote-compat dialect string literals. * * @public */ type QuoteCompat = typeof QuoteCompat.Type; /** * Block-scalar chomping indicators (`-` strip, default clip, `+` keep). * Referenced by the {@link YamlScalar} `chomp` field schema. * * @public */ declare const ScalarChomp: Schema.Literals; /** * The union of all block-scalar chomping indicator string literals. * * @public */ type ScalarChomp = typeof ScalarChomp.Type; declare const YamlScalar_base: Schema.Class; readonly style: Schema.Literals; readonly anchor: Schema.optionalKey; readonly commentBefore: Schema.optionalKey; readonly comment: Schema.optionalKey; readonly spaceBefore: Schema.optionalKey; readonly chomp: Schema.optionalKey>; readonly blockIndent: Schema.optionalKey; readonly raw: Schema.optionalKey; readonly sourceMultiline: Schema.optionalKey; readonly offset: Schema.Number; readonly length: Schema.Number; }>, {}>; /** * A YAML scalar AST node, representing a leaf value such as a string, * number, boolean, or null. * * - `value` — the resolved JavaScript value (null, boolean, number, bigint or * string). * - `style` — the scalar presentation style in the source document. * - `tag` — optional explicit YAML tag (e.g. `!!str`, `!!int`). * - `anchor` — optional anchor name for aliasing. * - `commentBefore` — own-line comment text directly above the node * (multiple consecutive comment lines join with `\n`). * - `comment` — trailing comment text on the node's line (strictly trailing; * own-line comments live on `commentBefore`). * - `spaceBefore` — `true` when a blank line precedes the node (and its * `commentBefore` block, when present) in the source. * - `chomp` — block-scalar chomping indicator, when the scalar is a block * scalar. * - `blockIndent` — the EXPLICIT indentation-indicator digit from a block * scalar's header (`|2`, `>1+`), when the source spelled one; absent when * the header let the reader auto-detect the indent. * - `raw` — the raw source text, preserved when it differs from the resolved * value in a way stringification needs to know about. * - `sourceMultiline` — `true` when the source span covers two or more lines; * absent on synthetic nodes. * - `offset` / `length` — the node's span in the source. * * @public */ declare class YamlScalar extends YamlScalar_base { /** * Navigate to a descendant by path (string segments for mapping keys, * numbers for sequence indices). `Option.none()` when any segment cannot * be resolved. Pure. */ find(path: YamlPath): Option.Option; /** * Find the deepest node whose span contains `offset` (half-open interval), * or `Option.none()` when the offset falls outside this subtree. Pure. */ findAtOffset(offset: number): Option.Option; /** * Return the path from this node to the given descendant node (matched by * reference identity), or `Option.none()` when it is not in this subtree. * The inverse of {@link YamlScalar.find}. Pure. */ pathOf(node: YamlNode): Option.Option; /** * Reconstruct the plain JavaScript value of this subtree. Aliases resolve * through `anchors` (anchors encountered during the walk register * incrementally, so an alias sees the most recent definition at its point * of use); unresolvable aliases yield `null`. Pure and total. */ toValue(anchors?: Map): unknown; } declare const YamlAlias_base: Schema.Class; readonly comment: Schema.optionalKey; readonly spaceBefore: Schema.optionalKey; }>, {}>; /** * A YAML alias AST node, referencing a previously defined anchor by name * (without the leading `*`). * * Carries the same comment triple as every other node class — see * {@link YamlScalar} for the field semantics. An alias is a node like any * other and a comment can legally sit above or after one. * * @public */ declare class YamlAlias extends YamlAlias_base { /** See `YamlScalar.find`. Pure. */ find(path: YamlPath): Option.Option; /** See `YamlScalar.findAtOffset`. Pure. */ findAtOffset(offset: number): Option.Option; /** See `YamlScalar.pathOf`. Pure. */ pathOf(node: YamlNode): Option.Option; /** See `YamlScalar.toValue`. Pure and total. */ toValue(anchors?: Map): unknown; } /** * The encoded (plain-object) form of a {@link YamlScalar} — the class fields * without the instance methods. Named so the recursive {@link (YamlNode:variable)} * codec can state its encoded side without a circular type annotation. * * @public */ interface YamlScalarEncoded extends Schema.Codec.Encoded {} /** * The encoded (plain-object) form of a {@link YamlMap}. See * {@link YamlScalarEncoded} for why the encoded forms are named interfaces. * * @public */ interface YamlMapEncoded extends Schema.Codec.Encoded {} /** * The encoded (plain-object) form of a {@link YamlSeq}. See * {@link YamlScalarEncoded} for why the encoded forms are named interfaces. * * @public */ interface YamlSeqEncoded extends Schema.Codec.Encoded {} /** * The encoded (plain-object) form of a {@link YamlAlias}. See * {@link YamlScalarEncoded} for why the encoded forms are named interfaces. * * @public */ interface YamlAliasEncoded extends Schema.Codec.Encoded {} /** * A discriminated-union schema covering all four YAML AST value node types: * {@link YamlScalar}, {@link YamlMap}, {@link YamlSeq} and {@link YamlAlias}. * Defined lazily via `Schema.suspend` to break the recursive reference chain * `YamlNode → YamlMap → YamlPair → YamlNode`. * * @remarks * Construct member nodes via their `.make(...)` static (e.g. * `YamlScalar.make(...)`), never `new YamlScalar(...)` — the internal * composer's hot-path `new` construction is the one recorded exception, kept * internal to the engine for its allocation-sensitive walk. * * @public */ declare const YamlNode: Schema.Codec; /** * The union of all YAML AST value node types. * * @public */ type YamlNode = YamlScalar | YamlMap | YamlSeq | YamlAlias; declare const YamlPair_base: Schema.Class>; readonly value: Schema.NullOr>>; }>, {}>; /** * A YAML key-value pair AST node, representing one entry within a mapping. * `value` is `null` when absent (e.g. `key:` with no value). * * A pair carries **no comment fields**. Comments belong to the pair's `key` * and `value` nodes, which have one comment slot each: an own-line comment * above the entry leads the `key`, and a trailing comment on the entry's line * follows the `value`. Two slots rather than one is what lets `a: # kc` keep * its comment where the author wrote it instead of relocating it onto the * value's line. * * @public */ declare class YamlPair extends YamlPair_base {} declare const YamlMap_base: Schema.Class>; readonly tag: Schema.optionalKey; readonly anchor: Schema.optionalKey; readonly style: Schema.Literals; readonly commentBefore: Schema.optionalKey; readonly comment: Schema.optionalKey; readonly spaceBefore: Schema.optionalKey; readonly sourceMultiline: Schema.optionalKey; readonly offset: Schema.Number; readonly length: Schema.Number; }>, {}>; /** * A YAML mapping AST node, representing a collection of {@link YamlPair} * entries. * * - `style` — the presentation style: `"block"` or `"flow"`. * - `commentBefore` — own-line comment text directly above the mapping. * - `comment` — trailing comment text: own-line comment lines after the * mapping's last entry (still at the mapping's item indent), or a same-line * trailing comment for a flow mapping. * - `spaceBefore` — `true` when a blank line precedes the mapping. * - `sourceMultiline` — `true` when the source span covers two or more lines; * used by the canonical stringifier. Absent on synthetic nodes. * * @public */ declare class YamlMap extends YamlMap_base { /** See `YamlScalar.find`. Pure. */ find(path: YamlPath): Option.Option; /** See `YamlScalar.findAtOffset`. Pure. */ findAtOffset(offset: number): Option.Option; /** See `YamlScalar.pathOf`. Pure. */ pathOf(node: YamlNode): Option.Option; /** See `YamlScalar.toValue`. Pure and total. */ toValue(anchors?: Map): unknown; } declare const YamlSeq_base: Schema.Class>>; readonly tag: Schema.optionalKey; readonly anchor: Schema.optionalKey; readonly style: Schema.Literals; readonly commentBefore: Schema.optionalKey; readonly comment: Schema.optionalKey; readonly spaceBefore: Schema.optionalKey; readonly sourceMultiline: Schema.optionalKey; readonly offset: Schema.Number; readonly length: Schema.Number; }>, {}>; /** * A YAML sequence AST node, representing an ordered list of * {@link (YamlNode:type)} values. * * - `commentBefore` — own-line comment text directly above the sequence. * - `comment` — trailing comment text: own-line comment lines after the * sequence's last item (still at the sequence's item indent), or a * same-line trailing comment for a flow sequence. * - `spaceBefore` — `true` when a blank line precedes the sequence. * * @public */ declare class YamlSeq extends YamlSeq_base { /** See `YamlScalar.find`. Pure. */ find(path: YamlPath): Option.Option; /** See `YamlScalar.findAtOffset`. Pure. */ findAtOffset(offset: number): Option.Option; /** See `YamlScalar.pathOf`. Pure. */ pathOf(node: YamlNode): Option.Option; /** See `YamlScalar.toValue`. Pure and total. */ toValue(anchors?: Map): unknown; } //#endregion //#region src/YamlDocument.d.ts declare const YamlDirective_base: Schema.Class; }>, {}>; /** * A YAML directive appearing before a document (e.g. `%YAML 1.2` or * `%TAG ! tag:example.com,2000:`). `"YAML"` and `"TAG"` are the YAML 1.2 * spec-defined directives; any other name is a reserved directive preserved * for round-trip fidelity. * * @public */ declare class YamlDirective extends YamlDirective_base {} declare const YamlDocument_base: Schema.Class>>; readonly errors: Schema.$Array; readonly warnings: Schema.$Array; readonly directives: Schema.$Array; readonly commentBefore: Schema.optionalKey; readonly comment: Schema.optionalKey; readonly hasDocumentStart: Schema.optionalKey; readonly hasDocumentEnd: Schema.optionalKey; readonly hasDocumentStartTab: Schema.optionalKey; }>, {}>; /** * A parsed YAML document: the root {@link (YamlNode:type)} (or `null` when * empty), recovered `errors` and `warnings` as {@link YamlDiagnostic} data, * the {@link YamlDirective} list, the optional document-level comments and the * `---`/`...` framing flags (absent flags read as `false`). * * `commentBefore` is a header block sitting AHEAD of a `---` marker; `comment` * is the trailing block after the content or the `...` marker. A header with * no marker, or one after the marker, belongs to the content rather than the * document — it leads the root node, or the first entry when there is no * marker to separate it from the item stream. * * Construct via `YamlDocument.parse` / `parseAll`; `YamlDocument.make` is for * synthetic documents. * * @public */ declare class YamlDocument extends YamlDocument_base { /** * Parse a single YAML document, keeping the full AST, directives and * recovered diagnostics. Fails with the aggregate {@link YamlParseError} * when any fatal-code diagnostic is present; non-fatal diagnostics are * data on the returned document. */ static readonly parse: (text: string, options?: YamlParseOptions | undefined) => Effect.Effect; /** * Parse a multi-document YAML stream into one {@link YamlDocument} per * document. Any fatal diagnostic in any document — or a stream-level * directive-placement error — fails the whole Effect. */ static readonly parseAll: (text: string, options?: YamlParseOptions | undefined) => Effect.Effect; /** * A `Schema` decoding YAML text into a full * document (AST, directives, diagnostics) and encoding a document back to * YAML text. * * Schema-producing: each call returns a fresh schema whose derivation * caches are not shared across calls; bind the result to a `const` on hot * paths. */ static schema(options?: YamlParseOptions): Schema.Codec; /** * Stringify this document (contents, directives and framing) as YAML. * Fails with {@link YamlStringifyError} on circular references introduced * into a synthetic AST (`CircularReference`) or on a synthetic AST nested * deeper than the stringifier's recursion budget (`NestingDepthExceeded`) * — both surface through the typed error channel rather than as an * unhandled stack-overflow defect. * * @remarks * `YamlStringifyOptions.lineWidth` is not honored here: column-based * scalar folding exists only on the value path, through the entry points * that accept stringify options ({@link Yaml.stringify} and * {@link Yaml.stringifyResult}). The * document/node path threads `lineWidth` into its render context but * never reads it, so long scalars are emitted unfolded regardless of the * option. Callers that need folding should render the plain value * instead — `Yaml.stringify(doc.toValue(), options)` — at the cost of * the document-level framing and styles this path preserves. */ stringify(options?: YamlStringifyOptions): Effect.Effect; /** * Reconstruct the plain JavaScript value of this document's contents, * resolving anchors and aliases. `null` for an empty document. Pure and * total. */ toValue(): unknown; } //#endregion //#region src/YamlFormat.d.ts /** * A range accepted at the `format`/`formatToString`/etc. call sites: either a * {@link YamlRange} instance or a plain `{ offset, length }` literal (the two * are structurally interchangeable — only `offset`/`length` are read). * * @public */ type YamlRangeLike = YamlRange | { readonly offset: number; readonly length: number; }; declare const YamlFormattingOptions_base: Schema.Class; readonly lineWidth: Schema.optionalKey; readonly defaultScalarStyle: Schema.optionalKey>; readonly defaultCollectionStyle: Schema.optionalKey>; readonly sortKeys: Schema.optionalKey; readonly indentSequences: Schema.optionalKey; readonly quoteStyle: Schema.optionalKey>; readonly quoteCompat: Schema.optionalKey>; readonly finalNewline: Schema.optionalKey; readonly forceDefaultStyles: Schema.optionalKey; readonly preserveComments: Schema.optionalKey; readonly range: Schema.optionalKey; readonly requoteScalars: Schema.optionalKey; }>, {}>; /** * Options controlling formatting behavior: every {@link YamlStringifyOptions} * field (derived, not hand-duplicated — including `indentSequences`, * `quoteStyle` and `quoteCompat`) plus * `preserveComments` (default `true`), `range` (restrict edits to a * region; see the module-level remarks on the `range` parameter vs. this * field) and `requoteScalars` (default `false`). * * `requoteScalars` makes `quoteStyle` apply to scalars **already quoted in * the source** on the format path — by default formatting preserves an * existing scalar's own quote style, and `quoteStyle` governs only quotes the * stringifier introduces. When enabled, a re-quote happens only when it * provably preserves the parsed value: single→double applies proper * double-quote escaping, double→single is skipped whenever the value carries * characters single quotes cannot express (newlines, tabs, control and other * non-printable characters — single-quoted style can escape nothing but * `'`). Plain scalars stay plain, block scalars stay block, and scalars * carrying a tag or anchor — or spanning multiple source lines — are left * untouched. The option exists only where a source quote exists to re-quote: * it is read by {@link YamlFormat.format} / {@link YamlFormat.formatToString} * and is deliberately absent from `Yaml.stringify` (which serializes plain * values) and {@link YamlFormat.modify} (which takes a bare * {@link YamlStringifyOptions}). * * Construct with the validated `YamlFormattingOptions.make({ ... })` static — * the kit convention (never `new`). Call sites that take a * `YamlFormattingOptions` also accept a structurally-matching plain literal. * * @example * ```ts * import { YamlFormat, YamlFormattingOptions } from "@effected/yaml"; * * const options = YamlFormattingOptions.make({ indentSequences: true }); * const formatted = YamlFormat.formatToString("key:\n- a\n- b\n", undefined, options); * // key: * // - a * // - b * ``` * * @public */ declare class YamlFormattingOptions extends YamlFormattingOptions_base {} declare const YamlModificationError_base: Schema.Class>; readonly diagnostics: Schema.$Array; }>, import("effect/Cause").YieldableError>; /** * Raised when `YamlFormat.modify` cannot navigate the requested path against * the composed AST (a structural mismatch), the source fails to parse, the * source is a multi-document stream (`MultiDocumentStream` — a path names no * particular document of a stream, so modify refuses rather than guessing), * or the document carries `%YAML`/`%TAG` directives * (`DirectiveCarryingDocument` — modify does not re-emit directive lines, and * dropping a `%TAG` would orphan the shorthand tags that depend on it). * Carries structured {@link YamlDiagnostic} entries — never a collapsed * `reason` string (the structure-preserving-errors house rule). The error * itself has no `code` field: read the code from the diagnostics — * `error.diagnostics[0].code` is the primary failure. * * @public */ declare class YamlModificationError extends YamlModificationError_base { get message(): string; } /** * Formatting and modification statics. Not instantiable. * * @remarks * `format`/`formatToString` are pure and total (edit computation never fails * — malformed input yields no edits rather than corrupting the document). * `modify`/`modifyToString` carry a real error channel: navigation failures * against the composed AST raise {@link YamlModificationError}, which — per * the structure-preserving-errors house rule — carries * `diagnostics: ReadonlyArray`, never a collapsed `reason` * string. * * `format`/`formatToString` handle multi-document streams whole — every * document is re-emitted in order with its own framing, never a silently * truncated stream. `modify`/`modifyToString` are **single-document**: a * {@link YamlPath} carries no document index, so which document of a stream * a path names is a rule the format does not define, and a multi-document * stream fails typed with a `MultiDocumentStream` diagnostic rather than * guessing. Parse a stream with {@link Yaml.parseAll} / * `Yaml.parseAllResult`. * * **Directive-carrying input is refused on every path.** The stringifier does * not re-emit `%YAML`/`%TAG` directive lines, and re-emitting a document * without its `%TAG` while keeping the shorthand tags that depend on it * (`!e!foo`) turns a valid file into one no parser can read. So * `format`/`formatToString` leave such input byte-identical (no edits), and * `modify`/`modifyToString` fail typed with a `DirectiveCarryingDocument` * diagnostic. Directive re-emission is unimplemented, not undesired — the * refusal is the floor that stops corruption until it lands. * * @public */ declare class YamlFormat { private constructor(); /** * Compute formatting edits for a YAML document. Non-mutating — apply the * result with `YamlEdit.applyAll` (or use {@link YamlFormat.formatToString}). * Pure and total: malformed input (a fatal parse error) yields `[]` rather * than corrupting the document. * * **Multi-document streams format whole.** Input containing more than one * document (a `---`-separated stream — a Kubernetes manifest, a pnpm 11 * `pnpm-lock.yaml` with a config-dependency preamble) formats every * document in order, re-emitting each document's own framing (`---`, * `...`, comment blocks); no document is ever dropped. Document detection * is CST-level, so a `---` inside a block scalar or quoted string is * content, not a document boundary. Two multi-document shapes yield `[]` * (untouched) because they cannot be re-emitted faithfully: a stream with * a fatal diagnostic in any document (the same posture as single-document * input) and a stream carrying `%YAML`/`%TAG` directives. * * **Directive-carrying documents yield `[]` on the single-document path * too.** Directive lines are not re-emitted, and dropping a `%TAG` while * keeping the shorthand tags that depend on it would turn a valid document * into an unparseable one — so a document carrying `%YAML`/`%TAG` * directives is left untouched. Detection is directive-token-level: a * literal `%TAG` inside a scalar is content and formats normally. * * @remarks * The positional `range` argument takes precedence over * `options?.range` when both are given; either accepts a plain * `{ offset, length }` object as well as a {@link YamlRange} instance, so * callers do not need `YamlRange.make(...)` for the common case. * * Formatting preserves an existing scalar's own quote style by default — * `quoteStyle` governs only quotes the stringifier introduces. The opt-in * `options.requoteScalars` makes `quoteStyle` apply to already-quoted * source scalars too, re-quoting only where the parsed value is provably * preserved; see {@link YamlFormattingOptions} for the exact skip rules. * * A plain `<<` mapping key is preserved unquoted, keeping its merge-key * meaning (`tag:yaml.org,2002:merge`) — quoting it to `'<<'` would produce * an ordinary string key that merges nothing, changing what the document * means with no error raised. A key the author quoted explicitly keeps its * quotes, since that is a literal string key they wrote deliberately. Note * that {@link Yaml.stringify} is deliberately the other way round for a * `"<<"` key on a plain JavaScript object. */ static format(text: string, range?: YamlRangeLike, options?: YamlFormattingOptions): ReadonlyArray; /** * Format `text` and apply the resulting edits in one step * (`YamlEdit.applyAll ∘ format`). Pure and total. * * Inherits the {@link YamlFormat.format} contract: a multi-document stream * is formatted whole — every document re-emitted in order — and input * that cannot be formatted faithfully (a fatal parse error, or any * document — single or in a stream — carrying `%YAML`/`%TAG` directives) * is returned byte-identical — never a truncated first document, never a * document re-emitted without the directive its tags depend on. */ static formatToString(text: string, range?: YamlRangeLike, options?: YamlFormattingOptions): string; /** * Compute the edits that insert, replace, or remove a value at `path`. * Passing `value === undefined` removes the target key/element; a missing * insertion target appends after the last pair/element. Only * scalar-compatible values are supported (matching v3 — arbitrary object * graphs are not recursively lowered into AST nodes). Fails with * {@link YamlModificationError} on a fatal parse error or a structural * navigation mismatch. * * **Single-document contract.** A `path` carries no document index, so on * a multi-document stream there is no rule for which document it names — * `modify` fails with {@link YamlModificationError} carrying a * `MultiDocumentStream` diagnostic rather than guessing document 1 (and * unlike {@link YamlFormat.format}, which formats a stream whole because * formatting needs no target). Detection is CST-level: a `---` inside a * block scalar or quoted string is content, not a document boundary. * * **Directive-carrying documents are refused.** A document carrying * `%YAML`/`%TAG` directives fails with {@link YamlModificationError} * carrying a `DirectiveCarryingDocument` diagnostic: modify re-emits the * whole document and does not re-emit directive lines, so applying it * would drop the `%TAG` while keeping the shorthand tags that depend on * it — unparseable output. A typed refusal beats silent corruption; * directive re-emission is unimplemented, not undesired. A literal * `%TAG` inside a scalar is content and does not trigger the refusal. * * @remarks * `options` is a bare {@link YamlStringifyOptions} — it controls only the * internal re-stringify step, not a range (there is no range to restrict * for a path-targeted modification). */ static readonly modify: (text: string, path: YamlPath, value: unknown, options?: YamlStringifyOptions | undefined) => Effect.Effect; /** * Modify `text` and apply the resulting edits in one step * (`YamlEdit.applyAll ∘ modify`). Inherits the {@link YamlFormat.modify} * error channel, including the single-document contract's * `MultiDocumentStream` refusal and the `DirectiveCarryingDocument` * refusal of `%YAML`/`%TAG`-carrying documents. */ static readonly modifyToString: (text: string, path: YamlPath, value: unknown, options?: YamlStringifyOptions | undefined) => Effect.Effect; } //#endregion //#region src/YamlToken.d.ts /** * The 22 lexical token kinds produced by the YAML tokenizer. * * @public */ declare const YamlTokenKind: Schema.Literals; /** * The union of all lexical token kind string literals. * * @public */ type YamlTokenKind = typeof YamlTokenKind.Type; declare const YamlToken_base: Schema.Class; readonly text: Schema.String; readonly offset: Schema.Number; readonly length: Schema.Number; readonly line: Schema.Number; readonly character: Schema.Number; }>, {}>; /** * A single positioned YAML lexical token. * * - `kind` — the {@link (YamlTokenKind:type)}. * - `text` — the raw source slice the token covers; the position-fidelity * invariant is `source.slice(offset, offset + length) === text`. * - `offset` / `length` — the token's span in UTF-16 code units. * - `line` / `character` — the zero-based position of the token's start, * matching the `YamlDiagnostic` position vocabulary. * * @public */ declare class YamlToken extends YamlToken_base {} /** * Tokenizer statics. Not instantiable. * * @public */ declare class YamlTokens { private constructor(); /** * Tokenize YAML text into the full positioned token array — the sync * `Result` primitive (tokenizing is a pure batch transform; the * {@link YamlTokens.stream} form is derived from this one, per the kit's * sync-primitive policy). * * @remarks * The failure channel is **reserved** (for future input-hardening guards) * and never fires today: the lexer is total, and lexical errors surface as * `"error"`-kind tokens **in the success array** so that linting can run * on malformed input — the `parse-validity` lint rule exists precisely for * documents that do not parse. Do not "fix" this method to fail on * `"error"` tokens; that would make malformed documents unlintable. * * @example * ```ts * import { YamlTokens } from "@effected/yaml"; * import { Result } from "effect"; * * const result = YamlTokens.tokenize("a: 1\n"); * if (Result.isSuccess(result)) { * result.success.map((t) => t.kind); // ["scalar", "block-map-start", ...] * } * ``` */ static tokenize(text: string): Result.Result, YamlParseError>; /** * Tokenize YAML text as a lazy `Stream` of tokens — the derived form of * {@link YamlTokens.tokenize} for genuinely incremental (SAX-style) * consumers, parallel to `YamlVisitor.visit`. * * @remarks * Derived from the sync primitive, so it shares its contract: lexical * errors arrive as `"error"`-kind tokens in the stream, never as a stream * failure. (The primitive's reserved failure channel would surface as a * defect here; it never fires today.) */ static stream(text: string): Stream.Stream; } //#endregion //#region src/YamlLintRule.d.ts /** * Lint diagnostic severities. `"off"` is a config-level disable only and * never reaches a diagnostic — a rule set to `"off"` is not run. * * @public */ declare const YamlLintSeverity: Schema.Literals; /** * The union of lint severity string literals. * * @public */ type YamlLintSeverity = typeof YamlLintSeverity.Type; declare const YamlLintDiagnostic_base: Schema.Class; readonly message: Schema.String; readonly offset: Schema.Number; readonly length: Schema.Number; readonly line: Schema.Number; readonly character: Schema.Number; readonly fix: Schema.optionalKey; }>, {}>; /** * A single lint finding: the reporting rule, its severity, a positioned span * and optionally a surgical fix. * * Deliberately separate from the engine's `YamlDiagnostic`: that type is the * lexer/parser/composer/stringifier error-code union and the single source * of truth for engine fatality — it carries no severity and no fix, and * lint-layer concerns must not pollute it. The `parse-validity` rule bridges * the two by mapping engine diagnostics into this shape. * * @public */ declare class YamlLintDiagnostic extends YamlLintDiagnostic_base {} /** * One source line of the linted document: its text (without the line * terminator — the `\n`, and for CRLF input the `\r\n` pair), the offset of * its first character, and its zero-based line number. * * @public */ interface LintLine { readonly text: string; readonly offset: number; readonly number: number; } /** * The context handed to every rule. The engine tokenizes ONCE and every rule * shares the one materialized `tokens` array — linting is inherently * multi-pass and random-access (layout rules need lookahead and lookbehind), * so the context is eager by nature; the streaming token form exists for * other consumers. * * `text`, `lines` and `tokens` cover the FULL source; `document` is the * FIRST document of the stream (matching `Yaml.parse` — split the stream * `Yaml.parseAll`-style to lint every document). It is always present, * including for input that does not parse: it is built from the engine's * recovered compose, and its `errors`/`warnings` carry what went wrong (the * `parse-validity` rule reports them). * * @public */ interface LintContext { readonly text: string; readonly lines: ReadonlyArray; readonly tokens: ReadonlyArray; readonly document: YamlDocument; } declare const StyleVote_base: Schema.Class; readonly offset: Schema.Number; readonly length: Schema.Number; readonly line: Schema.Number; readonly character: Schema.Number; }>, {}>; /** * One categorical style observation (#345): a single occurrence of a style * choice in the source, voting a `value` for an inference `dimension`. * * The `dimension` IS the rule's option key and the `value` IS that option's * value (`"double"` for `quoteType`, `2` for `spaces`, `false` for * `present`), so the inference resolvers can turn unanimous or dominant * votes into a config entry with no per-rule knowledge — which is what lets * custom rules participate in inference for free. The position points at the * occurrence that voted, so a strict-resolution conflict can name where each * spelling was seen. * * The `_tag` literal is the RUNTIME discriminator between the two * observation kinds: class instances are structurally assignable, so a * custom rule may yield a plain object shaped like a vote, and the evidence * builder must still sort it into the right tally without `instanceof`. * `.make` defaults it — construction sites never pass `_tag`. * * @public */ declare class StyleVote extends StyleVote_base {} declare const StyleFloor_base: Schema.Class, {}>; /** * One measured style floor (#345): a value the source PROVES is at least * `value`, without proving what the configured limit should be — the longest * observed line proves `line-length.max` is at least that long, not what it * is. Floors are carried in the evidence for callers that want them and are * never resolved into config options; fabricating a max from the largest * value one happened to see would be lying with a straight face. * * The `_tag` literal discriminates a floor from a {@link StyleVote} at * runtime (see there); `.make` defaults it. * * @public */ declare class StyleFloor extends StyleFloor_base {} /** * What a rule's `infer` hook yields per occurrence: a categorical * {@link StyleVote} or a measured {@link StyleFloor}. * * @public */ type StyleObservation = StyleVote | StyleFloor; /** * The public rule interface — built-ins and custom rules are the same * shape, and config references either by `id`; there is no privileged * built-in mechanism a custom rule cannot reach. * * `options` is the validated per-rule options object from the config entry * (or `undefined` when the entry was a bare severity literal); built-in * rules receive options already validated against their exported options * schema, custom rules validate their own. * * `infer` is the optional config-inference hook (#345): it reports the style * the source already follows as per-occurrence {@link StyleObservation}s, so * detection logic lives beside the check logic that polices the same * dimension (and shares its fixtures). Rules with no detectable style — the * policy rules, whose only evidence is violations — simply omit the hook and * stay default-driven under every resolver. * * @public */ interface YamlRule { readonly id: string; readonly check: (ctx: LintContext, options: unknown) => Iterable; readonly infer?: (ctx: LintContext) => Iterable; } //#endregion //#region src/YamlLint.d.ts /** * One entry of the config `rules` map: a bare severity literal (the common * case), `"off"` to disable, or a typed per-rule options object (the tuning * case; may carry its own `severity`). * * @public */ declare const YamlLintRuleSetting: Schema.Union, Schema.$Record]>; /** * The union type of one `rules`-map entry. * * @public */ type YamlLintRuleSetting = typeof YamlLintRuleSetting.Type; declare const YamlLintConfig_base: Schema.Class, Schema.$Record]>>; }>, {}>; /** * The lint configuration: a `rules` map keying rule ids (built-in or custom) * to a severity literal or a typed per-rule options object. * * Validation is rule-aware for the built-in catalog — a mistyped option on a * built-in rule fails schema validation with a typed error naming the rule, * and any attempt to demote or disable the always-on `parse-validity` rule * is rejected. Custom rule ids are accepted with a bare severity or an * opaque options object the custom rule validates itself. * * Presets ship as the statics {@link YamlLintConfig.default} and * {@link YamlLintConfig.relaxed} — composing one is object spread over a * static, not an `extends` string resolution step (this package owns no * config-file loader). * * @public */ declare class YamlLintConfig extends YamlLintConfig_base { /** * The default preset. Rule entries accrete as built-ins land; the * `quoted-strings` rule defaults to DOUBLE quotes here (the one taste * call the design pins). */ static readonly default: YamlLintConfig; /** The relaxed preset: style rules demoted to warnings. */ static readonly relaxed: YamlLintConfig; } declare const StyleVoteTally_base: Schema.Class; readonly count: Schema.Number; readonly offset: Schema.Number; readonly length: Schema.Number; readonly line: Schema.Number; readonly character: Schema.Number; }>, {}>; /** * An accumulated tally of one {@link StyleVote} spelling: how many times a * `value` was voted for a `(rule, dimension)` pair, and the position of the * FIRST occurrence seen (merging keeps the left operand's position, so on a * multi-file merge the first file that exhibited the spelling names it). * * @public */ declare class StyleVoteTally extends StyleVoteTally_base {} declare const StyleFloorTally_base: Schema.Class, {}>; /** * An accumulated {@link StyleFloor} for a `(rule, dimension)` pair: the * largest value the observed sources prove the limit is AT LEAST. Merging * takes the maximum. Floors are informational — never resolved into config * options (see {@link StyleFloor}). * * @public */ declare class StyleFloorTally extends StyleFloorTally_base {} declare const StyleEvidence_base: Schema.Class; readonly floors: Schema.$Array; }>, {}>; /** * Per-dimension style evidence (#345): what the observed sources say about * each inferable `(rule, dimension)` — vote histograms with first-seen * positions, and measured floors. * * Evidence is a MONOID: {@link StyleEvidence.empty} is the identity and * {@link StyleEvidence.combine} is associative, so multi-file inference is * observe-per-file, merge, resolve — and the N-file loop stays the caller's * (no IO enters the package). `combine` normalizes: counts of the same * `(rule, dimension, value)` add, the left operand's first-seen position * wins, floors take the maximum, and the result is canonically sorted — so * every value `observe`/`combine`/`fromObservations` produces is canonical * and the monoid laws hold structurally over them. * * @public */ declare class StyleEvidence extends StyleEvidence_base { /** The monoid identity: no observations. */ static readonly empty: StyleEvidence; /** * Merge two bodies of evidence (associative; {@link StyleEvidence.empty} * is the identity). Vote counts add, the left operand's first-seen * position wins per spelling, floors take the maximum. */ static combine(a: StyleEvidence, b: StyleEvidence): StyleEvidence; /** * Build canonical evidence from one rule's raw observations — the * homomorphism from observation lists into the monoid * (`fromObservations(r, [...a, ...b])` equals * `combine(fromObservations(r, a), fromObservations(r, b))`). `observe` * uses it per rule; it is public so custom tooling can construct evidence * without a {@link LintContext}. */ static fromObservations(rule: string, observations: Iterable): StyleEvidence; } declare const StyleConflict_base: Schema.Class; }>, {}>; /** * One strict-resolution conflict: a `(rule, dimension)` whose observed * spellings disagree. `candidates` carries every spelling with its count and * first-seen position, ordered by count descending (dominant first). * * @public */ declare class StyleConflict extends StyleConflict_base {} declare const YamlStyleConflictError_base: Schema.Class; }>, import("effect/Cause").YieldableError>; /** * Raised by strict config inference when observed evidence is not unanimous: * carries every conflicting `(rule, dimension)` as a structured * {@link StyleConflict} — dimension, all spellings, counts and positions — * never a collapsed `reason` string (the structure-preserving-errors house * rule). Unobserved dimensions never conflict: they fall back to the base * config's defaults. * * @public */ declare class YamlStyleConflictError extends YamlStyleConflictError_base { get message(): string; } /** * A lenient inference report: the inferred config plus the residual — the * diagnostics that config still produces on the observed text ("here is your * config, and the places that do not match it"). * * @public */ interface YamlLintInference { readonly config: YamlLintConfig; readonly residual: ReadonlyArray; } /** * Linting statics. Not instantiable. * * @remarks * Pure and synchronous throughout — the lint engine is the pure half only: * strings in, diagnostics or a fixed string out. File discovery, config-file * loading and autofix-to-disk belong to a consumer's tier, not here. * * @public */ declare class YamlLint { private constructor(); /** * The built-in rule catalog. Custom usage is array concatenation: * `YamlLint.run(text, [...YamlLint.builtins, myRule], config)`. */ static readonly builtins: ReadonlyArray; /** * Run `rules` over `text` under `config`, returning every finding sorted * by position. * * Document-driven rules see the FIRST document of the stream (matching * `Yaml.parse`; split the stream `Yaml.parseAll`-style to lint every * document), while token- and line-driven rules cover the full source — * see {@link LintContext}. * * A rule runs when its config entry is a severity or an options object; * `"off"` and absent entries skip it — except `parse-validity`, which is * always-on. The resolved severity (explicit-in-options, else the bare * literal, else `"error"`) overrides what the rule emitted, again except * for `parse-validity`, whose bridged engine diagnostics keep the * engine's own grading. */ static run(text: string, rules: ReadonlyArray, config: YamlLintConfig): ReadonlyArray; /** * Run `rules` and apply every non-overlapping surgical fix, returning the * fixed text. Fails with {@link YamlParseError} when the FIRST document * of the stream has a fatal parse error — a document the engine cannot * compose is not safely fixable. The gate matches `Yaml.parse`'s scope: * later documents of a multi-document stream are not composed (split the * stream `Yaml.parseAll`-style to lint every document), though token- and * line-driven fixes still cover the full source. Fixes route exclusively through `YamlEdit.applyAll` (never a * reformat), so applying them is comment-safe by construction; when two * fixes overlap — or start at the same offset — the earlier one in * {@link YamlLint.run} order (position, then rule id) wins and the later * is dropped (its diagnostic remains reported by {@link YamlLint.run}). */ static fix(text: string, rules: ReadonlyArray, config: YamlLintConfig): Result.Result; /** * Observe the style `text` already follows (#345): run every rule's * optional `infer` hook over one eagerly-built context and merge the * observations into canonical {@link StyleEvidence}. Pure and total — * strings in, evidence out; observing N files is N `observe` calls merged * with {@link StyleEvidence.combine}, and the N-file loop stays the * caller's (no IO enters the package). */ static observe(text: string, rules: ReadonlyArray): StyleEvidence; /** * Strict resolution: every OBSERVED dimension must be unanimous, and the * unanimous picks overlay `base` (default {@link YamlLintConfig.default}) * into an exact config. Conflicting evidence fails with * {@link YamlStyleConflictError} naming every conflicting dimension, all * spellings, counts and first-seen positions. Unobserved is NOT * conflicting: a corpus with no comments says nothing about * `comments-spacing`, so that dimension falls back to `base` rather than * failing. A rule `base` sets to `"off"` stays off — an explicit disable * outranks inference. */ static resolveStrict(evidence: StyleEvidence, base?: YamlLintConfig): Result.Result; /** * Lenient resolution: the dominant (plurality) spelling per observed * dimension overlays `base` (default {@link YamlLintConfig.default}); a * tie breaks deterministically to the first candidate in canonical * value order. Total — lenient resolution cannot fail; the places that do * not match the inferred config surface as the residual report (run the * lint with the inferred config, or use {@link YamlLint.inferLenient}). */ static resolveLenient(evidence: StyleEvidence, base?: YamlLintConfig): YamlLintConfig; /** * Single-text strict inference: `observe` then {@link YamlLint.resolveStrict} * in one step. Multi-file callers observe each file and merge with * {@link StyleEvidence.combine} before resolving. */ static inferStrict(text: string, rules: ReadonlyArray, base?: YamlLintConfig): Result.Result; /** * Single-text lenient inference: `observe`, resolve dominant picks over * `base`, then run the lint with the inferred config — returning the * config AND the residual diagnostics it still produces ("here is your * config, and the places that do not match it"). One context serves both * the observation and the residual run. Multi-file callers compose the * primitives instead: observe each file, {@link StyleEvidence.combine}, * {@link YamlLint.resolveLenient}, then {@link YamlLint.run} per file. */ static inferLenient(text: string, rules: ReadonlyArray, base?: YamlLintConfig): YamlLintInference; } //#endregion //#region src/YamlVisitor.d.ts /** * The discriminated union of YAML AST visitor events. Every variant carries * `path` (segments from the document root) and `depth` (zero-based nesting * level); collection/scalar begin events also carry `style` and the optional * `tag`/`anchor`. `Error` carries a materialized {@link YamlDiagnostic} for * every diagnostic recorded while composing the document — fatal or not. * * @public */ type YamlVisitorEvent = Data.TaggedEnum<{ DocumentStart: { readonly path: YamlPath; readonly depth: number; readonly directives: ReadonlyArray<{ readonly name: string; readonly parameters: ReadonlyArray; }>; }; DocumentEnd: { readonly path: YamlPath; readonly depth: number; }; MapStart: { readonly path: YamlPath; readonly depth: number; readonly style: CollectionStyle; readonly tag?: string; readonly anchor?: string; }; MapEnd: { readonly path: YamlPath; readonly depth: number; }; SeqStart: { readonly path: YamlPath; readonly depth: number; readonly style: CollectionStyle; readonly tag?: string; readonly anchor?: string; }; SeqEnd: { readonly path: YamlPath; readonly depth: number; }; Pair: { readonly path: YamlPath; readonly depth: number; readonly key: unknown; readonly value: unknown; }; Scalar: { readonly path: YamlPath; readonly depth: number; readonly value: unknown; readonly style: ScalarStyle; readonly tag?: string; readonly anchor?: string; }; Alias: { readonly path: YamlPath; readonly depth: number; readonly name: string; }; Comment: { readonly path: YamlPath; readonly depth: number; readonly text: string; /** Where the comment sits relative to its construct: own-line above (`"leading"`) or same-line after (`"trailing"`). */ readonly placement: "leading" | "trailing"; }; Directive: { readonly path: YamlPath; readonly depth: number; readonly name: string; readonly parameters: string; }; Error: { readonly path: YamlPath; readonly depth: number; readonly diagnostic: YamlDiagnostic; }; }>; /** * Constructors and matchers for the `YamlVisitorEvent` union (e.g. * `YamlVisitorEvent.Scalar({ path, depth, value, style })`, * `YamlVisitorEvent.$is("MapStart")`). * * @public */ declare const YamlVisitorEvent: { readonly $is: (tag: Tag) => (u: unknown) => u is Extract<{ readonly _tag: "Alias"; readonly path: YamlPath; readonly depth: number; readonly name: string; }, { readonly _tag: Tag; }> | Extract<{ readonly _tag: "Comment"; readonly path: YamlPath; readonly depth: number; readonly text: string; readonly placement: "leading" | "trailing"; }, { readonly _tag: Tag; }> | Extract<{ readonly _tag: "Directive"; readonly path: YamlPath; readonly depth: number; readonly name: string; readonly parameters: string; }, { readonly _tag: Tag; }> | Extract<{ readonly _tag: "DocumentEnd"; readonly path: YamlPath; readonly depth: number; }, { readonly _tag: Tag; }> | Extract<{ readonly _tag: "DocumentStart"; readonly path: YamlPath; readonly depth: number; readonly directives: ReadonlyArray<{ readonly name: string; readonly parameters: ReadonlyArray; }>; }, { readonly _tag: Tag; }> | Extract<{ readonly _tag: "Error"; readonly path: YamlPath; readonly depth: number; readonly diagnostic: YamlDiagnostic; }, { readonly _tag: Tag; }> | Extract<{ readonly _tag: "MapEnd"; readonly path: YamlPath; readonly depth: number; }, { readonly _tag: Tag; }> | Extract<{ readonly _tag: "MapStart"; readonly path: YamlPath; readonly depth: number; readonly style: CollectionStyle; readonly tag?: string; readonly anchor?: string; }, { readonly _tag: Tag; }> | Extract<{ readonly _tag: "Pair"; readonly path: YamlPath; readonly depth: number; readonly key: unknown; readonly value: unknown; }, { readonly _tag: Tag; }> | Extract<{ readonly _tag: "Scalar"; readonly path: YamlPath; readonly depth: number; readonly value: unknown; readonly style: ScalarStyle; readonly tag?: string; readonly anchor?: string; }, { readonly _tag: Tag; }> | Extract<{ readonly _tag: "SeqEnd"; readonly path: YamlPath; readonly depth: number; }, { readonly _tag: Tag; }> | Extract<{ readonly _tag: "SeqStart"; readonly path: YamlPath; readonly depth: number; readonly style: CollectionStyle; readonly tag?: string; readonly anchor?: string; }, { readonly _tag: Tag; }>; readonly $match: { any; readonly Comment: (args: { readonly _tag: "Comment"; readonly path: YamlPath; readonly depth: number; readonly text: string; readonly placement: "leading" | "trailing"; }) => any; readonly Directive: (args: { readonly _tag: "Directive"; readonly path: YamlPath; readonly depth: number; readonly name: string; readonly parameters: string; }) => any; readonly DocumentEnd: (args: { readonly _tag: "DocumentEnd"; readonly path: YamlPath; readonly depth: number; }) => any; readonly DocumentStart: (args: { readonly _tag: "DocumentStart"; readonly path: YamlPath; readonly depth: number; readonly directives: ReadonlyArray<{ readonly name: string; readonly parameters: ReadonlyArray; }>; }) => any; readonly Error: (args: { readonly _tag: "Error"; readonly path: YamlPath; readonly depth: number; readonly diagnostic: YamlDiagnostic; }) => any; readonly MapEnd: (args: { readonly _tag: "MapEnd"; readonly path: YamlPath; readonly depth: number; }) => any; readonly MapStart: (args: { readonly _tag: "MapStart"; readonly path: YamlPath; readonly depth: number; readonly style: CollectionStyle; readonly tag?: string; readonly anchor?: string; }) => any; readonly Pair: (args: { readonly _tag: "Pair"; readonly path: YamlPath; readonly depth: number; readonly key: unknown; readonly value: unknown; }) => any; readonly Scalar: (args: { readonly _tag: "Scalar"; readonly path: YamlPath; readonly depth: number; readonly value: unknown; readonly style: ScalarStyle; readonly tag?: string; readonly anchor?: string; }) => any; readonly SeqEnd: (args: { readonly _tag: "SeqEnd"; readonly path: YamlPath; readonly depth: number; }) => any; readonly SeqStart: (args: { readonly _tag: "SeqStart"; readonly path: YamlPath; readonly depth: number; readonly style: CollectionStyle; readonly tag?: string; readonly anchor?: string; }) => any; }>(cases: Cases): (value: { readonly _tag: "Alias"; readonly path: YamlPath; readonly depth: number; readonly name: string; } | { readonly _tag: "Comment"; readonly path: YamlPath; readonly depth: number; readonly text: string; readonly placement: "leading" | "trailing"; } | { readonly _tag: "Directive"; readonly path: YamlPath; readonly depth: number; readonly name: string; readonly parameters: string; } | { readonly _tag: "DocumentEnd"; readonly path: YamlPath; readonly depth: number; } | { readonly _tag: "DocumentStart"; readonly path: YamlPath; readonly depth: number; readonly directives: ReadonlyArray<{ readonly name: string; readonly parameters: ReadonlyArray; }>; } | { readonly _tag: "Error"; readonly path: YamlPath; readonly depth: number; readonly diagnostic: YamlDiagnostic; } | { readonly _tag: "MapEnd"; readonly path: YamlPath; readonly depth: number; } | { readonly _tag: "MapStart"; readonly path: YamlPath; readonly depth: number; readonly style: CollectionStyle; readonly tag?: string; readonly anchor?: string; } | { readonly _tag: "Pair"; readonly path: YamlPath; readonly depth: number; readonly key: unknown; readonly value: unknown; } | { readonly _tag: "Scalar"; readonly path: YamlPath; readonly depth: number; readonly value: unknown; readonly style: ScalarStyle; readonly tag?: string; readonly anchor?: string; } | { readonly _tag: "SeqEnd"; readonly path: YamlPath; readonly depth: number; } | { readonly _tag: "SeqStart"; readonly path: YamlPath; readonly depth: number; readonly style: CollectionStyle; readonly tag?: string; readonly anchor?: string; }) => import("effect/Unify").Unify>; any; readonly Comment: (args: { readonly _tag: "Comment"; readonly path: YamlPath; readonly depth: number; readonly text: string; readonly placement: "leading" | "trailing"; }) => any; readonly Directive: (args: { readonly _tag: "Directive"; readonly path: YamlPath; readonly depth: number; readonly name: string; readonly parameters: string; }) => any; readonly DocumentEnd: (args: { readonly _tag: "DocumentEnd"; readonly path: YamlPath; readonly depth: number; }) => any; readonly DocumentStart: (args: { readonly _tag: "DocumentStart"; readonly path: YamlPath; readonly depth: number; readonly directives: ReadonlyArray<{ readonly name: string; readonly parameters: ReadonlyArray; }>; }) => any; readonly Error: (args: { readonly _tag: "Error"; readonly path: YamlPath; readonly depth: number; readonly diagnostic: YamlDiagnostic; }) => any; readonly MapEnd: (args: { readonly _tag: "MapEnd"; readonly path: YamlPath; readonly depth: number; }) => any; readonly MapStart: (args: { readonly _tag: "MapStart"; readonly path: YamlPath; readonly depth: number; readonly style: CollectionStyle; readonly tag?: string; readonly anchor?: string; }) => any; readonly Pair: (args: { readonly _tag: "Pair"; readonly path: YamlPath; readonly depth: number; readonly key: unknown; readonly value: unknown; }) => any; readonly Scalar: (args: { readonly _tag: "Scalar"; readonly path: YamlPath; readonly depth: number; readonly value: unknown; readonly style: ScalarStyle; readonly tag?: string; readonly anchor?: string; }) => any; readonly SeqEnd: (args: { readonly _tag: "SeqEnd"; readonly path: YamlPath; readonly depth: number; }) => any; readonly SeqStart: (args: { readonly _tag: "SeqStart"; readonly path: YamlPath; readonly depth: number; readonly style: CollectionStyle; readonly tag?: string; readonly anchor?: string; }) => any; }>(value: { readonly _tag: "Alias"; readonly path: YamlPath; readonly depth: number; readonly name: string; } | { readonly _tag: "Comment"; readonly path: YamlPath; readonly depth: number; readonly text: string; readonly placement: "leading" | "trailing"; } | { readonly _tag: "Directive"; readonly path: YamlPath; readonly depth: number; readonly name: string; readonly parameters: string; } | { readonly _tag: "DocumentEnd"; readonly path: YamlPath; readonly depth: number; } | { readonly _tag: "DocumentStart"; readonly path: YamlPath; readonly depth: number; readonly directives: ReadonlyArray<{ readonly name: string; readonly parameters: ReadonlyArray; }>; } | { readonly _tag: "Error"; readonly path: YamlPath; readonly depth: number; readonly diagnostic: YamlDiagnostic; } | { readonly _tag: "MapEnd"; readonly path: YamlPath; readonly depth: number; } | { readonly _tag: "MapStart"; readonly path: YamlPath; readonly depth: number; readonly style: CollectionStyle; readonly tag?: string; readonly anchor?: string; } | { readonly _tag: "Pair"; readonly path: YamlPath; readonly depth: number; readonly key: unknown; readonly value: unknown; } | { readonly _tag: "Scalar"; readonly path: YamlPath; readonly depth: number; readonly value: unknown; readonly style: ScalarStyle; readonly tag?: string; readonly anchor?: string; } | { readonly _tag: "SeqEnd"; readonly path: YamlPath; readonly depth: number; } | { readonly _tag: "SeqStart"; readonly path: YamlPath; readonly depth: number; readonly style: CollectionStyle; readonly tag?: string; readonly anchor?: string; }, cases: Cases): import("effect/Unify").Unify>; }; readonly Alias: Data.TaggedEnum.ConstructorFrom<{ readonly _tag: "Alias"; readonly path: YamlPath; readonly depth: number; readonly name: string; }, "_tag">; readonly Comment: Data.TaggedEnum.ConstructorFrom<{ readonly _tag: "Comment"; readonly path: YamlPath; readonly depth: number; readonly text: string; readonly placement: "leading" | "trailing"; }, "_tag">; readonly Directive: Data.TaggedEnum.ConstructorFrom<{ readonly _tag: "Directive"; readonly path: YamlPath; readonly depth: number; readonly name: string; readonly parameters: string; }, "_tag">; readonly DocumentEnd: Data.TaggedEnum.ConstructorFrom<{ readonly _tag: "DocumentEnd"; readonly path: YamlPath; readonly depth: number; }, "_tag">; readonly DocumentStart: Data.TaggedEnum.ConstructorFrom<{ readonly _tag: "DocumentStart"; readonly path: YamlPath; readonly depth: number; readonly directives: ReadonlyArray<{ readonly name: string; readonly parameters: ReadonlyArray; }>; }, "_tag">; readonly Error: Data.TaggedEnum.ConstructorFrom<{ readonly _tag: "Error"; readonly path: YamlPath; readonly depth: number; readonly diagnostic: YamlDiagnostic; }, "_tag">; readonly MapEnd: Data.TaggedEnum.ConstructorFrom<{ readonly _tag: "MapEnd"; readonly path: YamlPath; readonly depth: number; }, "_tag">; readonly MapStart: Data.TaggedEnum.ConstructorFrom<{ readonly _tag: "MapStart"; readonly path: YamlPath; readonly depth: number; readonly style: CollectionStyle; readonly tag?: string; readonly anchor?: string; }, "_tag">; readonly Pair: Data.TaggedEnum.ConstructorFrom<{ readonly _tag: "Pair"; readonly path: YamlPath; readonly depth: number; readonly key: unknown; readonly value: unknown; }, "_tag">; readonly Scalar: Data.TaggedEnum.ConstructorFrom<{ readonly _tag: "Scalar"; readonly path: YamlPath; readonly depth: number; readonly value: unknown; readonly style: ScalarStyle; readonly tag?: string; readonly anchor?: string; }, "_tag">; readonly SeqEnd: Data.TaggedEnum.ConstructorFrom<{ readonly _tag: "SeqEnd"; readonly path: YamlPath; readonly depth: number; }, "_tag">; readonly SeqStart: Data.TaggedEnum.ConstructorFrom<{ readonly _tag: "SeqStart"; readonly path: YamlPath; readonly depth: number; readonly style: CollectionStyle; readonly tag?: string; readonly anchor?: string; }, "_tag">; }; /** * SAX-style YAML AST visitor statics. Not instantiable. * * @public */ declare class YamlVisitor { private constructor(); /** * Create a lazy `Stream` of `YamlVisitorEvent` from YAML text, in document * order. Multi-document streams (separated by `---`) produce a separate * `DocumentStart`/`DocumentEnd` pair per document. Events are produced on * demand, so combining with `Stream.take` allows efficient partial scans * of large documents without materializing the whole event sequence. * * @remarks * Infallible at the type level: diagnostics recorded while composing * (fatal or not, including an exceeded `maxAliasCount`, recorded as * `AliasCountExceeded`) surface as `Error` events inside the stream rather * than failing it. */ static visit(text: string, options?: YamlParseOptions): Stream.Stream; } //#endregion export { CollectionStyle, type LintContext, type LintLine, QuoteCompat, QuoteStyle, ScalarChomp, ScalarStyle, StyleConflict, StyleEvidence, StyleFloor, StyleFloorTally, type StyleObservation, StyleVote, StyleVoteTally, Yaml, YamlAlias, type YamlAliasEncoded, type YamlBoundCodec, YamlComposerErrorCode, YamlDiagnostic, YamlDirective, YamlDocument, YamlEdit, YamlErrorCode, YamlFormat, YamlFormattingOptions, YamlLexErrorCode, YamlLint, YamlLintConfig, YamlLintDiagnostic, type YamlLintInference, YamlLintRuleSetting, YamlLintSeverity, YamlMap, type YamlMapEncoded, YamlModificationError, YamlModifyErrorCode, YamlNode, YamlPair, YamlParseError, YamlParseErrorCode, YamlParseOptions, type YamlPath, YamlRange, type YamlRangeLike, type YamlRule, YamlScalar, type YamlScalarEncoded, type YamlSegment, YamlSeq, type YamlSeqEncoded, YamlStringifyError, YamlStringifyErrorCode, YamlStringifyOptions, YamlStyleConflictError, YamlToken, YamlTokenKind, YamlTokens, YamlVisitor, YamlVisitorEvent }; //# sourceMappingURL=index.d.ts.map