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-11-30.

53 breaking9 security3 deprecations23 new APIs and options4 behavior and defaults1 tooling28 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 582 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 3

  • 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

  • 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 438 changes

Breaking changes 19

  • 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

  • dump() no longer encodes astral characters.

    4.0.0release notes

  • Loading !!binary now always returns a Uint8Array.

    4.0.0release notes

  • An error is now thrown if block sequence or mapping indentation contains a tab.

    4.0.0release notes

  • Custom tags starting with ! are dumped as !tag instead of !<!tag>.

    4.0.0release notes

  • Custom tags with this prefix are now shorthanded using !!.

    4.0.0release notes

  • dump() no longer quotes :, [, ], (, and ) except when necessary.

    4.0.0release notes

  • dump() serializes undefined as null in collections and removes mapping keys whose values are undefined.

    4.0.0release notes

  • Exceptions format line and column as (X:Y) instead of “at line X, column Y,” including compact format.

    4.0.0release notes

  • Extra commas in flow collections such as [foo,,bar] now throw an exception instead of producing null.

    4.0.0release notes

  • The unsafe tags !!js/function, !!js/regexp, and !!js/undefined moved to the js-yaml-js-types package.

    4.0.0release notes

  • Tags are URL-decoded in load(), and URL-encoded in dump(), preventing invalid YAML from custom non-ASCII tags.

    4.0.0release notes

  • A __proto__ key no longer overrides the object prototype.

    4.0.0release notes

  • The safe* functions were removed; use load, loadAll, and dump, which are safe by default.

    4.0.0release notes

  • Numbers are parsed according to YAML 1.2 rather than YAML 1.1; for example, 01234 is decimal, 0o1234 is octal, and 1:23 is a string.

    4.0.0release notes

  • DEFAULT_FULL_SCHEMA was removed; use yaml.DEFAULT_SCHEMA instead.

    4.0.0release notes

  • DEFAULT_SAFE_SCHEMA was removed; use yaml.DEFAULT_SCHEMA instead.

    4.0.0release notes

  • Schema.create(schema, tags) was removed; use schema.extend(tags) instead.

    4.0.0release notes

Security 3

New APIs and options 6

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

    4.2.0release notes

  • The dumper's forceQuotes option configures string literal style.

    4.0.0release notes

  • The dumper's quotingType option configures string literal style.

    4.0.0release notes

  • dump() gained a replacer option similar to the option in JSON.stringify.

    4.0.0release notes

  • The styles option supports {'!!null': 'empty'}, serializing { foo: null } as “foo: ”.

    4.0.0release notes

  • The package now supports ES modules through .mjs.

    4.0.0release notes

Behavior and default changes 2

  • Code snippets in exceptions now contain multiple lines with line numbers.

    4.0.0release notes

  • Custom Tag can now handle all tags or multiple tags with the same prefix.

    4.0.0release notes

Tooling 1

Fixes and other changes 7

  • 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

  • Anchors now work correctly with empty nodes.

    4.0.0release notes

  • Invalid block mapping syntax is now parsed correctly.

    4.0.0release notes

  • The exception now points at the correct column.

    4.0.0release notes

js-yaml 31 changes

Security 1