Skip to content

v3.2.0

Choose a tag to compare

@github-actions github-actions released this 26 Sep 05:43

Added

  • Packaging: Ship an edit-only patch-lite distribution that updates existing values while preserving comments formatting. (#309)
  • Patching: accept smol-toml date objects when patching and stringifying values. (#309)
  • Formatting: Add escapeSequenceUpperCase option to TomlFormat to control the case of generated hex escape sequences. When patching, the case is auto-detected from the first hex escape in the document. (#309)
  • Patching: keep the sign of a negative zero. Editing a value to -0 writes it as -0.0 instead of leaving the existing zero in place. (#309)

Changed

  • Stringify: Improve stringification performance for inline arrays and tables that fit on one line (#314)

Fixed

  • Patching: preserve the number formatting of edited values. Floats with an explicit zero fraction keep their decimal places (1.0 -> 2.0, 1.00 -> 2.00), exponent notation is kept when the source used it (1.0e10 -> 1.0e11), and floats with a non-zero fraction collapse to a plain integer when their value becomes whole (1.5 -> 2, 1.25e10 -> 1e11). minimumDecimals still forces the requested decimal places. (#309)
  • Patching: preserve underscore grouping in integer literals, counted from the right, when the value changes (1_000_000 -> 10000 becomes 10_000). (#309)
  • Patching: preserve hexadecimal, octal and binary integer notation (0x, 0o, 0b) and the exponent marker case (e vs E) when editing numbers. (#309)
  • Patching: fall back to a multiline literal ('''...''') or a basic string when an edited literal string value cannot be written literally, instead of emitting TOML that the parser rejects. (#309)
  • Patching: keep escape sequences that are string content intact when writing basic strings. A value holding text such as \u000c was written back as \u000C, changing the value, in both patch() and stringify(). (#309)
  • Patching: escape a standalone carriage return written into a multiline basic string, instead of emitting a raw CR that the parser rejects when the document is read back. (#309)
  • Patching: keep a leading newline in an edited multiline string. (#309)
  • Patching: keep the raw form of inf, nan and -0 when the edited value came from a document that used exponent notation. (#309)
  • Escape sequences: do not take the document's escape sequence case from escaped content such as the text \uabcd. (#309)
  • Patching: keep the sign of a negative NaN reliably. The sign was read through a typed array that occasionally loses it, so patch() or stringify() could write nan where the value was -nan. (#309)

Full Changelog: v3.1.2...v3.2.0


Version specific links

Registry Link
npm https://www.npmjs.com/package/@decimalturn/toml-patch/v/3.2.0
jsr https://jsr.io/@decimalturn/toml-patch@3.2.0