Skip to content

Releases: eemeli/yaml

v1.10.2

13 Mar 21:05
Compare
Choose a tag to compare

v1.10.1

13 Mar 11:09
Compare
Choose a tag to compare

This release backports the following non-breaking fixes made during the work on yaml@2 on top of yaml@1.10.0:

  • Support for __proto__ as mapping key & anchor identifier (#192)
  • Fix broken TS type for BigInt toggle
  • 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)
  • Do not break escaped chars with escaped newlines (#237, cdk8s-team/cdk8s#494)
  • Set type: "module" within browser/dist/ (#208)
  • Use CommonJS for the browser endpoints yaml/types & yaml/util (#208)
  • Always stringify non-Node object keys using explicit notation (#218)
  • Specify node type of Document.Parsed.contents (#221)
  • Add missing type for CST Node.rangeAsLinePos (#222)
  • Prefer literal over folded block scalar when lineWidth=0 is set (#232)
  • Allow for empty lines after node props (#242)
  • Update dev dependencies

v2.0.0-3

31 Jan 21:31
Compare
Choose a tag to compare

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

npm install --save-exact yaml@next

This is the last release before the CST parser rewrite (#203), and some of the changes here are in preparation for that.

The preceding prerelease (2.0.0-2) had a visit() bug that was identified immediately after release, and is fixed here.

BREAKING CHANGES

Drop 'yaml/parse-cst' endpoint (#223)

Users will need to update their code:

-import parseCST from 'yaml/parse-cst'
+import YAML from 'yaml'
+const parseCST = YAML.parseCST

Update build configs & minimum supported versions (#224)

  • Drop IE 11 support
  • Switch minimum Node.js target from 6.5 to 10.0
  • Refactor browser exports as pure ES modules rather than CommonJS (#208)
  • Add "default" fields to package.json "exports"
  • Add preserveModules: true & treeshake config to Rollup configs

New Features

  • Refactor logging control, adding logLevel option (#215)
  • Add visit(node, visitor) to 'yaml' (#225)

Bugfixes

  • Remember source string for boolean scalars (#199)
  • Add missing extension to Document.js import path (#210)
  • Do not break escaped chars with escaped newlines (cdk8s-team/cdk8s#494)
  • Always stringify non-Node object keys using explicit notation (#218)
  • Add missing type for CST Node.rangeAsLinePos (#222)
  • Specify node type of Document.Parsed.contents (#221)

Internal Stuff

  • Add issue templates (#219)
  • Update dev dependencies
  • Include Babel plugin for nullish coalescing operator
  • Update playground to Webpack 5

v2.0.0-1

05 Oct 22:38
Compare
Choose a tag to compare

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)

v2.0.0-0

23 Aug 15:26
Compare
Choose a tag to compare

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)

v1.10.0

16 May 10:00
Compare
Choose a tag to compare

This will probably be the last minor release of yaml@1. I'm aiming to release yaml@2 within a few months; prereleases of that will be published using the next dist-tag on npm. Patch releases for 1.10 may still happen, if necessary.

New Features

  • Use Rollup for Node.js & browser builds (#165)
    • This removes most of the internal dist/ paths from the release. If you want/need to use a class or function that is no longer public, please file an issue and we can add it to the exports.
    • Drop dependency on @babel/runtime. After this, the package has 0 runtime dependencies. 🎉
    • Add exports { Alias, Collection, Merge, Node } to 'yaml/types'
  • Document Schema.createPair() & make its ctx arg optional (#157)
  • Always indent top-level scalars with lines starting with document markers or % directives (#162)
  • Use double-space when forcing top-level block scalar indent, for clarity (#162)
  • Add getNodes(): string[] method to Anchors (#166)
  • Refactor Jest config, adding tests for compiled dist/ endpoints
  • Rename & refactor source files. This should have no effect on the results, but lots of stuff moved around

Improved Errors & Warnings

  • Throw more helpful error when setting Pair.commentBefore incorrectly (#157)
  • Better errors for bad indents (#169)
  • Drop incorrect error for flow mapping keys with length > 1024 chars
  • Add errors for plain scalars that start with reserved indicators
  • Add more explicit errors for block scalar values with bad indents
  • Enable log prints during npm start debugging

Improved TypeScript declarations

  • Fix/simplify export mapping of 'yaml/types' and 'yaml/util'
  • Fix types, dropping AST.{AstNode,ScalarNode,CollectionNode} (#160)
  • Add missing toString() methods to AST nodes (#159)
  • Add directivesEndMarker to Document type (#167)

Bugfixes

  • Use CommonJS for top-level default-exporting browser endpoints (#163)
  • docs: Add note about simpleKeys for null values (#170)
  • Update dev & playground dependencies, including eslint 7 & jest 26
  • Update yaml-test-suite, fixing errors in remaining invalid-input tests
    • Add explicit error for block scalars with more-indented leading empty lines (S98Z)
    • Properly add error for tab-indented map values (4EJS)
    • Add error for multiline implicit flow sequence pair key (DK4H & ZXT5)
    • Require space after comma before comment in flow collections (CVW2)
    • Use mapAsMap: true for out.yaml tests (4FJ6)

v1.9.2

20 Apr 09:29
Compare
Choose a tag to compare
  • ts: Fix Node.toJSON() type (#154)

v1.9.1

18 Apr 12:03
Compare
Choose a tag to compare
  • Add onAnchor callback arg to doc.toJSON()
  • Use a Map for anchors in doc.toJSON()
  • Update dependencies

v1.9.0

17 Apr 16:46
Compare
Choose a tag to compare

New Features

  • Add custom ES module exports for browsers (#145)
  • Drop __esModule markers from CJS transpilation (#145)
  • Support BigInt values (#146)
  • Add YAML.scalarOptions (#146)
  • Add indent option: number of spaces (default: 2) (#147)
  • Add indentSeq option: if false, consider - as indentation (default: true) (#147)
  • Add TypeScript typings, based on @types/yaml by @ikatyang, with contributions from @ColinBradley and @shirk3y (#153)

Bugfixes

  • Only use named exports internally (#145)
  • Clean up & document warning silencing, also supporting process.env (Fixes #148)
  • Fix typo in flow collection parsing (Fixes #149)
  • Accept that multiple blank lines generate multiple nodes (Closes #150)
  • Use cross-env to enable building on Windows (#152 by @shirk3y)
  • Specify Document.cstNode type
  • Add Pair.Type enum
  • Export YAMLError from 'yaml/util'

v1.8.3

21 Mar 00:53
Compare
Choose a tag to compare
  • Add "browser" mappings for types.mjs & util.mjs (#142)
  • Fix parsing of floats like .8 and 00.4 in the core schema (#144)
  • Fix !!binary resolution on IE 11
  • Add Jest workaround to file deprecation tests