Skip to content

v0.4.0

Latest

Choose a tag to compare

@bgotink bgotink released this 30 Nov 00:15
· 6 commits to main since this release
v0.4.0
6afe779

This release contains quite a lot of changes, but only a few breaking changes.
First the highlight:

This release contains opt-in support for a version of the experimental number suffix feature currently under discussion in the KDL language repository.

import {parse} from "@bgotink/kdl";
import assert from "node:assert";

assert.throws(() => parse("node 10xp"));

assert.doesNotThrow(() =>
	parse("node 10px", {
		flags: {
			experimentalSuffixedNumbers: true,
		},
	}),
);

Changes:

  • Start on KDL Query implementation
  • Rewrite the entire tokenizer to use a lookup table, which provides a drastic speed boost
  • The v1 parser is rebuilt from scratch and uses the same infrastructure as the existing v2 parser.
    This makes parsing a v1 document not only 2x faster but it stops us from having to bundle chevrotain with its heavy footprint.
  • Fix issues with the format() function: improve its ability to format bare identifiers and fix unicode escapes.
  • BREAKING CHANGE: in case multiple errors occur the parser will now throw an InvalidKdlError rather than an AggregateError.
    The InvalidKdlError can now have sub-errors in its errors property. You can use the flat() method to easily iterate over all errors contained within an InvalidKdlError.
  • Add support for (a version of) the number suffix feature under discussion in the KDL language repository.
  • BREAKING CHANGE: place support for number suffixes behind a parser flag.
    Note this is only a breaking change if you are updating from one of the 0.4.0-next releases.
  • Expose value tags in the DeserializationContext API (#12).
  • BREAKING CHANGE: The DeserializationContext#run function now leave the DeserializationContext unchanged if the deserializer throws an error instead of leaving the context in an inconsistent and unpredictable state.
    This means you can safely try multiple deserializers, which is further aided by the new context.run.try() function.

Full Changelog: v0.3.1...v0.4.0