npm yaml 2.0.0-0

latest releases: 2.6.0, 2.5.1, 2.5.0...
4 years ago

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

npm install --save-exact yaml@next

Be aware that further breaking changes are likely before we get to a final 2.0.0 release. However, at least so far the basic YAML.parse() and YAML.stringify() APIs are pretty much unaffected by any of the breaking changes.

BREAKING CHANGES

Drop deprecated end points, members, options & defaults (#171)

  • The following entry points are removed:
    • 'yaml/map'
    • 'yaml/pair'
    • 'yaml/scalar'
    • 'yaml/schema'
    • 'yaml/seq'
    • 'yaml/types/binary'
    • 'yaml/types/omap'
    • 'yaml/types/pairs'
    • 'yaml/types/set'
    • 'yaml/types/timestamp'
  • The package.json "exports" no longer include an "./": "./" escape hatch.
  • Schema.defaultTags and Schema.defaultPrefix are removed.
  • The tags alias for the customTags option is removed, and prettyErrors is now default-true.
  • Custom tags that use class instead of identify() are no longer supported.

Breaking changes to Document & createNode APIs (#186)

See the PR for usage examples of:

  • new YAML.Document(value, options?) - The Document constructor gets a new first argument value. This allows for much more ergonomic document creation.
  • doc.createNode(value, options?) - The methods YAML.createNode() and doc.schema.createNode() are replaced by a single doc.createNode(). Their non-value arguments are also collected into an options object.
  • doc.createPair(key, value, options?) - The method doc.schema.createPair() is replaced by doc.createPair(), and also uses an options bag instead of named positional arguments.

When creating a mapping from a JS Object, drop undefined values (#173)

When creating a YAML mapping from a JS Object, keys with undefined values are not included. This matches the behaviour of JSON.stringify(). In all other cases, the handling of undefined is unchanged, so e.g. [1, undefined, 2] will still result in a sequence of three items, the second of which has a null value. This too matches the behaviour of JSON.stringify().

Previously, undefined object values were mapped to null.

Retain existing nodes when using set() in mappings & sequences (#185)

When overwriting a Scalar value with a scalar using set(), the original node is retained.

New Features

  • Resolve known tags in core schema (#172)
  • Create intermediates for set() & setIn() on doc with empty contents (#174)
  • Fix intermediate collection creation for parsed documents (#174)
  • Improve quoted string flexibility (#177)
  • Add defaultKeyType option for finer control of scalar output (#179)

Don't miss a new yaml release

NewReleases is sending notifications on new releases.