unstale

npm / js-yaml

js-yaml

What changed in js-yaml 3 to 5, from its official release notes, upgrade guides and advisories. Also covers @types/js-yaml. Sources checked 2026-10-19.

36 breaking9 security6 deprecations18 new APIs and options2 behavior and defaults1 tooling25 fixes and other

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

npx @unstale/cli init

@unstale/cli on npm

js-yaml 585 changes

Breaking changes 34

  • Reject ,, ], and } at the start of block plain scalars.

    5.5.0release notes

  • forceQuotes no longer quotes non-string scalars.

    5.4.2release notes

  • Merge sequence size is hard-limited to 100.

    5.4.1release notes

  • Scalar and collection nodes now use SCALAR_STYLE and COLLECTION_STYLE values; explicit tags use the separate tagged property, and alias nodes contain only kind and anchor.

    5.4.0release notes

  • Scalar style selection was reworked and can change formatting without changing loaded values; whitespace-only strings are now double-quoted.

    5.4.0release notes

  • Custom tag definitions must provide identify; use identify: () => false for load-only tags.

    5.3.0release notes

  • Removes the unused MERGE_KEY export.

    5.3.0release notes

  • Validates << sequence items at merge time, including aliased merge sources.

    5.3.0release notes

  • Reject unpaired mapping event streams.

    5.2.3release notes

  • Removes this loader option; maxTotalMergeKeys replaces it for limiting YAML merge processing.

    5.2.0release notes

  • Object-based mappings now reject complex keys instead of stringifying them.

    5.0.0release notes

  • Removes the dumper option condenseFlow.

    5.0.0release notes

  • Uses spec-compliant scalar resolution rules and is the default schema for load.

    5.0.0release notes

  • Removes the DEFAULT_SCHEMA export.

    5.0.0release notes

  • Removes the dumper option forceQuotes.

    5.0.0release notes

  • Browser builds are now accessed through the js-yaml/browser export.

    5.0.0release notes

  • Reworks the schema with spec-compliant scalar resolution rules.

    5.0.0release notes

  • Removes the loader option legacy.

    5.0.0release notes

  • Removes support for importing internal files from lib/.

    5.0.0release notes

  • Removes the loader option listener.

    5.0.0release notes

  • Throws on empty input instead of returning undefined.

    5.0.0release notes

  • Removes the dumper option noCompatMode.

    5.0.0release notes

  • Removes the loader option onWarning.

    5.0.0release notes

  • Removes the dumper option quotingType.

    5.0.0release notes

  • Removes the dumper option replacer.

    5.0.0release notes

  • Removes the deprecated safeDump() export.

    5.0.0release notes

  • Removes the deprecated safeLoad() export.

    5.0.0release notes

  • Removes the deprecated safeLoadAll() export.

    5.0.0release notes

  • Renames Schema.extend() to Schema.withTags().

    5.0.0release notes

  • Renames the dumper option noArrayIndent to seqNoIndent.

    5.0.0release notes

  • Loads !!set values as JavaScript Set instances.

    5.0.0release notes

  • Removes the dumper option styles.

    5.0.0release notes

  • Replaces the Type API with a more precise and simpler tags API, including helpers to define scalar, sequence, and mapping tags.

    5.0.0release notes

  • Removes the nested types export.

    5.0.0release notes

Security 5

Deprecations 6

  • Provides a grouped constant export in place of flat constant exports; the old exports remain available but are deprecated.

    5.3.0release notes

  • Provides a grouped constant export in place of flat constant exports; the old exports remain available but are deprecated.

    5.3.0release notes

  • Provides a grouped constant export in place of flat constant exports; the old exports remain available but are deprecated.

    5.3.0release notes

  • Flat constant exports are deprecated; use the grouped exports instead.

    5.3.0release notes

  • Provides a grouped constant export in place of flat constant exports; the old exports remain available but are deprecated.

    5.3.0release notes

  • The loadAll signature with an iterator is deprecated, though it still works.

    5.0.0release notes

New APIs and options 17

  • Adds a dumper option to customize string formatting.

    5.4.0release notes

  • Exports the default schema used by the dumper, allowing developers to use it directly.

    5.3.0release notes

  • Adds a method for throwing an error at a source position.

    5.3.0release notes

  • Adds a loader option, defaulting to -1, to limit the number of YAML aliases per document.

    5.2.0release notes

  • Adds the flowBracketPadding dumper option.

    5.0.0release notes

  • Adds the flowSkipColonSpace dumper option.

    5.0.0release notes

  • Adds the flowSkipCommaSpace dumper option.

    5.0.0release notes

  • Adds the quoteFlowKeys dumper option.

    5.0.0release notes

  • Adds the quoteStyle dumper option.

    5.0.0release notes

  • Adds the seqInlineFirst dumper option.

    5.0.0release notes

  • Adds the tagBeforeAnchor dumper option.

    5.0.0release notes

  • Adds an option to change the generated AST before rendering.

    5.0.0release notes

  • Adds a low-level parser that produces events.

    5.0.0release notes

  • Adds the presenter API for modular data pipelines.

    5.0.0release notes

  • Adds a tag for lossless mappings with non-string and complex keys.

    5.0.0release notes

  • Adds the visitor API for modular data pipelines.

    5.0.0release notes

  • Adds a schema combining all YAML 1.1 tags.

    5.0.0release notes

Behavior and default changes 2

  • Collection tags can finalize an incrementally populated carrier into a different result value.

    5.1.0release notes

  • quoteStyle now selects the preferred quote style; use forceQuotes to force quoting non-key strings.

    5.1.0release notes

Fixes and other changes 21

  • Errors report the exact position of non-printable characters.

    5.5.0release notes

  • Correct percent-encoding of shorthand and verbatim tags.

    5.5.0release notes

  • Fixed loading a whitespace-only block scalar followed by a less indented line.

    5.4.3release notes

  • Accepts a byte order mark at the start of each document in a stream.

    5.4.0release notes

  • Preserves empty scalar items when converting block sequences to flow style.

    5.4.0release notes

  • Produces valid flow mappings with quoteFlowKeys and flowSkipColonSpace, including alias and property-only keys.

    5.4.0release notes

  • The 1024-character simple-key limit no longer applies to flow mapping keys.

    5.4.0release notes

  • Counts Unicode code points rather than UTF-16 code units for the 1024-character simple-key limit.

    5.4.0release notes

  • The option was rewritten using AST mutation to avoid side effects.

    5.4.0release notes

  • Adds an explicit document-end marker after keep-chomped block scalars when needed to preserve trailing newlines.

    5.4.0release notes

  • Resolves << outside of a mapping key as the plain string '<<', matching v4.

    5.3.0release notes

  • Preserve implicit null mapping values before document markers.

    5.2.3release notes

  • Preserve folded scalar values with tab-indented lines when round-tripping a parsed AST through present(); dump() and loading are unaffected.

    5.2.3release notes

  • Prevent prototype fallback when resolving tags and mapping entries.

    5.2.3release notes

  • Resolve years 0000–0099 correctly.

    5.2.3release notes

  • Flow scalars are quoted when a colon precedes a flow indicator.

    5.2.2release notes

  • !!omap now supports Map when realMapTag is used.

    5.2.1release notes

  • Fixes round-tripping of integers with exponential form at or above 1e21.

    5.2.0release notes

  • The restored forceQuotes option forces quoting of non-key strings.

    5.1.0release notes

  • Uses YAML11_SCHEMA and CORE_SCHEMA for the quoting check to guarantee backward compatibility by default.

    5.0.0release notes

  • Expands YAML 1.2 conformance and improves handling of directives, document markers, block keys, multiline scalars, and tag syntax.

    5.0.0release notes

js-yaml 411 changes

Breaking changes 2

  • Numbers with underscores are no longer resolved as numeric scalars.

    4.2.0release notes

  • Rejects top-level block scalars without content indentation.

    4.2.0release notes

Security 3

New APIs and options 1

  • Adds a loader option with a default of 100 to provide a better exception than RangeError on stack overflow.

    4.2.0release notes

Tooling 1

Fixes and other changes 4

  • Fixes trailing whitespace handling when folding flow scalar lines.

    4.2.0release notes

  • Fixes parsing of properties on the first implicit block mapping key.

    4.2.0release notes

  • Ensures numbers survive round-trip.

    4.2.0release notes

  • Fixes handling of digits in YAML named tag handles.

    4.2.0release notes

js-yaml 31 changes

Security 1