unstale

npm / yaml

yaml

What changed in yaml 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

15 breaking1 security1 deprecations17 new APIs and options3 behavior and defaults1 tooling13 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

yaml 251 changes

Breaking changes 15

  • Recursive merge aliases are limited, changing how YAML documents with recursive merge aliases are handled.

    2.9.1release notes

  • CST tokens now always include an offset.

    2.0.0release notes

  • directives.marker was renamed to directives.docStart.

    2.0.0release notes

  • error.pos: [number, number] replaces error.offset.

    2.0.0release notes

  • The COMMENT_SPACE error special case was dropped and now uses MISSING_CHAR.

    2.0.0release notes

  • Node ranges now use the [start, value-end, node-end] structure.

    2.0.0release notes

  • Node.js 10 support was dropped.

    2.0.0release notes

  • Node.js 12 support was dropped.

    2.0.0release notes

  • Pair no longer extends NodeBase and no longer forwards its properties.

    2.0.0release notes

  • The tokens namespace was renamed to CST.

    2.0.0release notes

  • Top-level block scalars are stringified with the header on the marker line.

    2.0.0release notes

  • Creating a mapping from a JS Object now drops undefined values.

    2.0.0release notes

  • The yaml/parse-cst endpoint was dropped.

    2.0.0release notes

  • All of yaml/types and some of yaml/util were merged into yaml.

    2.0.0release notes

  • YAML.defaultOptions was removed.

    2.0.0release notes

Security 1

  • yaml is vulnerable to Stack Overflow via deeply nested YAML collections

    2.8.3security advisory

Deprecations 1

  • A warning is now emitted for aliases and anchors ending with a colon.

    2.0.0release notes

New APIs and options 17

  • Adds the trailingComma option for multiline flow formatting.

    2.8.3release notes

  • A createNode option named aliasDuplicateObjects was added.

    2.0.0release notes

  • The asBigInt option is supported for sexagesimal integer values.

    2.0.0release notes

  • clone() methods were added to Document, Directives, Schema, and all Nodes.

    2.0.0release notes

  • A compatibility checker was added.

    2.0.0release notes

  • Tags and types required by custom composers are exposed.

    2.0.0release notes

  • A custom schema id is allowed when customTags is defined.

    2.0.0release notes

  • The defaultKeyType option provides finer control of scalar output.

    2.0.0release notes

  • directives.docEnd was added for the ... marker.

    2.0.0release notes

  • The keepSoureToken parse option adds srcToken values to Nodes.

    2.0.0release notes

  • Logging control was refactored and the logLevel option was added.

    2.0.0release notes

  • Support for Non-YAML Schemas was added.

    2.0.0release notes

  • Single and block quotes can now be disabled completely.

    2.0.0release notes

  • Key uniqueness is checked, with uniqueKeys added as an option.

    2.0.0release notes

  • visit(node, visitor) was added to yaml.

    2.0.0release notes

  • The version: 'next' option enables experimental YAML spec features that may change or be removed in minor releases.

    2.0.0release notes

  • YAML.visitAsync() was added.

    2.0.0release notes

Behavior and default changes 3

  • Setting maxAliasCount to 0 disables alias resolution.

    2.8.4release notes

  • The Lexer, Parser, and Composer were turned into generators.

    2.0.0release notes

  • The << merge key now supports immediate map values as well as alias values.

    2.0.0release notes

Tooling 1

Fixes and other changes 13

  • Avoids calling Array.prototype.push.apply() with a large source array.

    2.9.0release notes

  • Avoids recursive lexer calls that may exhaust the call stack.

    2.9.0release notes

  • Invalid unicode escapes are now handled.

    2.8.4release notes

  • minFractionDigits is applied only to decimal strings.

    2.8.4release notes

  • Catches stack overflows during node composition.

    2.8.3release notes

  • Empty map values are no longer serialized with double newlines.

    2.8.2release notes

  • Serialization preserves -0 as -0.

    2.8.2release notes

  • The TypeScript type now indicates that doc.directives is optional.

    2.0.0release notes

  • JSON compatibility was improved.

    2.0.0release notes

  • Known tags are now resolved in the core schema.

    2.0.0release notes

  • Using set() in mappings and sequences retains existing nodes.

    2.0.0release notes

  • set() and setIn() create intermediate nodes when used on a document with empty contents.

    2.0.0release notes

  • The tag resolve() API was refactored.

    2.0.0release notes