Repository navigation
Releases: squirrelchat/smol-toml
Release list
v1.9.1
What's Changed
- fix: reject invalid extra exponent sign by @cyyynthia
Full Changelog: v1.9.0...v1.9.1
v1.9.0
Huge update!!! This is most likely the largest update the library received since its release, with lots of new features and improvements.
Performance improvements
Significant parts of the internal parse logic have been rewritten, improving performance by 1.5x-2x. The library was already comfortably ahead of the others, but it is now faster than ever, sitting at 4x faster parse performance than the closest maintained implementation.
Problematic code paths have also been replaced by safer implementations, solving potential DoS vectors. See GHSA-r4xh-jqrq-34v2.
Note: the objects returned by the library now have a null prototype. This is a transparent change for 99.9% of users, and is one of the most significant contributors to the major performance gains in this version.
Full Temporal support
Version 1.8.0 brought support for Temporal in stringify; now the library is also able to emit Temporal objects instead of its own ad-hoc TomlDate object. It is not enabled by default, but it will become the default in v2. Enable by setting useLegacyDate: false in the parser's options.
Better Temporal support in stringify
Temporal support has been improved since it released: Temporal objects that cannot be represented (such as Temporal.PlainMonthDay) now throw an error (instead of silently emitting a bogus object).
A new option has been added to stringify to disallow Temporal objects that cannot be fully represented in TOML. This includes ZonedDateTime objects with a IANA timezone attached instead of a plain offset, and dates with a specific calendar value set. Enable by setting strictTemporal: true in the options.
Handling of unsafe keys
Since its release the library has been protected against prototype pollution attacks, setting properties like __proto__ using safe mechanisms that do not trigger prototype pollution. However, while the returned objects are safe on their own, they may become problematic if used carelessly.
Inspired by secure-json-parse, the library now offers a way to either drop unsafe properties from the returned object, or to throw an error and reject documents altogether. By default, these potentially unsafe keys are preserved and returned.
Miscellaneous updates
- Unicode BOM is now gracefully accepted and ignored.
- Table array headers are now properly checked again. Reported in #65.
- Closed certain gaps where invalid whitespace would be accepted. Reported in #61.
- Bogus local date and local time values with a UTC offset are no longer accepted.
- Certain error messages are more accurate and handle errors at line boundaries better.
- The default export of the lib is now formally deprecated; use a
import *instead. Proposed in #50. - On Node 20+, strings that contain lone surrogates are now normalised to well-formed strings.
- On Node 20+, keys that contain lone surrogates are now rejected.
Full Changelog: v1.8.0...v1.9.0
v1.8.0
What's Changed
- feat: stringify temporal objects by @Gouvernathor and @cyyynthia
Full Changelog: v1.7.2...v1.8.0
v1.7.2
What's Changed
- refactor: improve performance of the parser by @cyyynthia
- chore: revert sourcemap publishing by @cyyynthia
Full Changelog: v1.7.1...v1.7.2
v1.7.1
This release includes flagging internal functions as @internal to strip them from the emitted type declarations.
Full Changelog: v1.7.0...v1.7.1
v1.7.0
This version slightly changes the behaviour of stringify: integers beyond the safe range are always emitted as float numbers.
String decode logic has been rewritten, it is a bit faster now and uses a single-pass approach instead of a dual-pass approach as it did previously. The code should be a bit smaller too, though I didn't actually measure that.
The package is now published with source-maps, declaration-maps, and a copy of the original TypeScript source files. This will improve your DX if you're like me and like Ctrl+Click'ing things a lot. ;)
What's Changed
- improve performance of the string decode logic by @cyyynthia
- fix(stringify): emit integer-valued numbers beyond the safe-integer range as floats by @spokodev in #56
- publish source-maps, declaration-maps, and original source files by @cyyynthia
- miscellaneous repository maintenance tasks by @cyyynthia
New Contributors
Full Changelog: v1.6.1...v1.7.0
v1.6.1
This release addresses a minor security vulnerability where an attacker-controlled TOML document can exploit an unrestricted recustion and cause a stack overflow error with a document that contains thousands of sucessive commented lines. Security advisory: GHSA-v3rj-xjv7-4jmq
v1.6.0
As of this version, smol-toml now supports the newly released TOML 1.1.0 specification!
Highlights
Multiline inline tables
TOML 1.1.0 now allows inline tables to have newlines, as well as trailing commas.
database = {
driver = "postgresql",
server = {
host = "127.0.0.1",
port = 3307,
},
}Omitting seconds in datetime and time
TOML 1.1.0 renders the seconds component of time elements optional.
datetime-tz = 1979-05-27 07:32Z
datetime = 2001-09-21 10:17
time = 13:37
New string escapes
Strings now support 2 additional escape sequences:
\xHHfor code points between 0 and 255\efor the escape character (U+001B)
What's Changed
- feat: toml 1.1 support by @cyyynthia in #49
Full Changelog: v1.5.2...v1.6.0
v1.5.2
Hot fix for v1.5.1... 🙃
What's Changed
- fix: properly stringify arrays of tables by @cyyynthia
Full Changelog: v1.5.1...v1.5.2
v1.5.1
Smol fix that makes newlines actually consistent when stringifying objects to TOML.
What's Changed
- fix: actually consistent newlines by @cyyynthia
Full Changelog: v1.5.0...v1.5.1
