Skip to content

v2.0.0-1

Compare
Choose a tag to compare
@eemeli eemeli released this 05 Oct 22:38

This version yaml has been published to npm using the next dist-tag, so install it with:

npm install --save-exact yaml@next

This release continues from where 2.0.0-0 left off to make incremental changes to the library, mostly in order to further improve JSON compatibility and to make custom tags easier to write. For details on the breaking changes, please see PRs #189 and #201.

It's likely that the next release after this will incorporate #203, which is a rather more significant change to the parsing internals and the CST API.

BREAKING CHANGES

Improve JSON compatibility (#189)

  • Add doc.toJS(), replacing most doc.toJSON() calls
  • Drop keepBlobsInJSON option
  • The toJSON() utility exported by 'yaml/util' is renamed as toJS().
  • Add keepUndefined option & by default return undefined for stringify(undefined) (#187)
  • Add optional replacer argument for stringify, new Document & doc.createNode
  • Add JSON reviver support to parse() and doc.toJS()
  • Encode strings with unpaired surrogate code points as double-quoted
  • Allow third arg of stringify to be a number or string setting indent

Refactor tag resolve() API (#201)

All tag resolvers are now called with two arguments:

  • value: string | YAMLMap | YAMLSeq
  • onError(message: string): void

with the value being determined solely by the node's shape, rather than
any explicit tag it may have.

Also:

  • Drop exports of { parseMap, parseSeq } from 'yaml/util'
  • Refactor resolveString() arguments
  • Use re.test(str) rather than str.match(re) for default tags
  • Refactor away schema.tags.scalarFallback

New Features

  • Remember source string for null scalars (#193)
  • Support asBigInt option for sexagesimal integer values (04b2d65)

Bugfixes

  • Correct the output of the readme example (#188)
  • Support for __proto__ as mapping key & anchor identifier (#192)
  • Dump long keys properly (#195)
  • When folding highly indented lines, require at least minContentWidth chars on the first line (#196)
  • Fix YAML.stringify() for certain null values (#197)
  • Drop obsolete Travis CI badge from README (3b807a1)

Internal Refactorings

  • Remove Document wrapper class; include schema in Set (3587e76)
  • Export members directly from src/index.js (eb8f0d3)