Skip to content

Releases: slevithan/oniguruma-to-es

v1.0.0

08 Jan 13:41
Compare
Choose a tag to compare

Most of the changes and fixes in this release resulted from feedback by @RedCMD. ✨

🚨 Breaking

  • Redesigned the recursion depth limit around the fact that Oniguruma uses a limit of 20 (rather than an infinite or high-value depth like other regex flavors). (#19)
    • Moved option maxRecursionDepth to rules.recursionLimit.
    • Changed the default recursionLimit from 5 to 20.
    • Reduced the max recursionLimit from 100 to 20.
    • Removed the ability to disable support for recursion.
    • Setting accuracy to 'strict' no longer disables recursion.

🚀 Features

  • Support \x{…} values above 10FFFF at the end of character class ranges. (#22)
  • Validate lookbehind contents and throw if not supported by Oniguruma. (#24)
  • Support possessive interval quantifiers specified using a reversed range. (#25)
  • Error at compile time rather than runtime for Unicode property names that start with a digit.
  • Improved test coverage.

🐞 Fixes

  • Don't remove negation for negated character classes used in intersection that contain a single token (bug applied when using target ES2024 or later and option verbose not enabled).
  • Ignore insignificant hyphens in Unicode property names. (#16)
  • Don't throw for intersection with an empty set. (#17)
  • Don't throw for character class ranges ending with literal hyphens followed by character or character-set tokens. (#18)

v0.10.0

01 Jan 22:26
Compare
Choose a tag to compare

🚨 Breaking

  • toDetails: The subclass property on result objects was renamed as options, for consistency with EmulatedRegExp.

🚀 Features

  • Added a rawArgs property to EmulatedRegExp instances that can be used to serialize the object.
  • Added support for use of lone \G in any top-level alternative.
  • Environment support for duplicate group names is no longer required as a condition for target auto to use ES2025.
  • Improved EmulatedRegExp types.

🐞 Fixes

  • With target ES2025: Subpattern details on match results did not match Oniguruma in some cases when duplicate group names were used across mutually exclusive alternation paths. Results are now the same across all targets. (#14)
  • With pre-ES2025 targets: Duplicate characters were added in edge cases during mixed case-insensitivity expansion of character class ranges that included the same character in multiple cases. This had no effect on resulting matches, but generated regex source is now cleaner in these cases.

v0.9.0

27 Dec 02:39
Compare
Choose a tag to compare

🚨 Breaking

  • Option allowUnhandledGAnchors renamed as ignoreUnsupportedGAnchors.

🚀 Features

  • Externalized dependencies for the ESM bundle. (#12, @bluwy)
  • No longer restricting Unicode properties based on target. (#10)

🐞 Fixes

  • Switched to preserving duplicate group names on the first instance (rather than the last per mutually exclusive alternation path), to match Oniguruma's match results in cases affected by subroutines and duplicate group names.
  • When option avoidSubclass is not enabled:
    • Hide subpattern details from match results for captures created by emulated subroutines.
    • Transfer subroutine (and descendent) capture details on match results to the indexes of groups they reference (if preceding) to match Oniguruma's subpattern match results/ordering.

v0.8.1

21 Dec 01:12
Compare
Choose a tag to compare

🐞 Fixes

  • When the following conditions were all met, the indices values of result arrays could be incorrect.
    1. Options hasIndices and global both enabled.
    2. The pattern included (^|\G) or similar.
    3. The generated regex was used with a lastIndex greater than 0.

v0.8.0

19 Dec 07:52
Compare
Choose a tag to compare

🚨 Breaking

  • When option allowUnhandledGAnchors is enabled, an unsupported use of \G no longer adds flag y (provides better tradeoffs).

🚀 Features

  • Added option rules.captureGroup (equivalent to Oniguruma compile-time option ONIG_OPTION_CAPTURE_GROUP) to toDetails, toRegExp, and toOnigurumaAst. Allows unnamed captures and numbered backreferences/subroutines when using named capture (with complex resulting rules in edge cases).

🐞 Fixes

  • Prevent ^ from matching after a string-terminating line feed. (#9)
  • When option avoidSubclass is not enabled, use emulation groups (which prevent captured values from appearing on match results) for copies of capturing groups created by recursion.

v0.7.0

27 Nov 15:53
Compare
Choose a tag to compare

🚀 Features

  • Added support for backreferences in patterns with recursion, in cases when the recursed subpattern doesn't contain captures.

🐞 Fixes

  • Allow unescaped, leading ] in character classes.

v0.6.1

23 Nov 22:36
Compare
Choose a tag to compare

🐞 Fixes

  • With target ES2018, some advanced patterns that contained \[ within a character class were resulting in invalid syntax. (#5)

v0.6.0

22 Nov 15:44
Compare
Choose a tag to compare

🚨 Breaking

  • Replaced option accuracy: 'loose' with rules.allowUnhandledGAnchors.
  • Replaced option tmGrammar with rules.allowOrphanBackrefs.

🚀 Features

  • Added support for flags D (Digit is ASCII) and S (Space is ASCII) at top-level.
  • Added option rules.asciiWordBoundaries.

🐞 Fixes

  • \w, \d, \s, and their inversions are Unicode-based by default. (#4)
  • Unicode combining marks qualify as \b word boundaries by default.
  • In edge cases, using nested character classes that combined union and intersection led to invalid patterns.
  • In edge cases, some characters were not escaped appropriately in nested character classes.

v0.5.0

19 Nov 11:32
Compare
Choose a tag to compare

🚀 Features

  • Added support for flag W (Word is ASCII) at top-level.
  • Minor type changes.

v0.4.1

17 Nov 08:24
Compare
Choose a tag to compare

🐞 Fixes

  • Worked around a parser bug in versions of Bun prior to v1.1.35. (#2)