Releases: slevithan/oniguruma-to-es
Releases · slevithan/oniguruma-to-es
v3.1.0
🚀 Features
- Added support for lazy compilation of regexes (hat-tip @jeff-hykin for the idea).
- New option
lazyCompile
inEmulatedRegExp
. - New option
lazyCompileLength
intoRegExp
/toRegExpDetails
allows triggering the use of lazy compilation based on the length of the transpiled pattern.
- New option
toOnigurumaAst
: Allow compile-time optionrules.singleline
(already supported bytoRegExp
/toRegExpDetails
).
v3.0.0
🚨 Breaking
- Renamed
toDetails
astoRegExpDetails
. - Renamed type
OnigurumaToEsOptions
asToRegExpOptions
. - Renamed the browser bundle's global object as
OnigurumaToEs
. EmulatedRegExp
: Metadata for hidden/transfer captures no longer embedded in the pattern; provided viaoptions
.- Removed the
rawArgs
property ofEmulatedRegExp
instances; replaced withrawOptions
. Thepattern
andflags
properties ofrawArgs
are no longer needed for serialization.
🚀 Features
- Improved regex construction performance when using the
EmulatedRegExp
subclass. - Added support for the subroutine behavior of only transferring subpattern matches to earlier capture slots when a subroutine participates in the match; also covered for complex cases when subroutines are used for/within recursion.
- Improved some recursion-related error messages.
🐞 Fixes
- Fixed cases where valid nested character classes starting and ending with
:
were treated as invalid POSIX classes. (#23) - Fixed subroutine capture transfer for edge cases with recursion. Now transfers from the last expanded instance for recursively repeated captures that precede the recursion token in the recursed subpattern's contents.
v2.3.0
v2.2.0
🚀 Features
- Added option
rules.singleline
(Oniguruma compile-time optionONIG_OPTION_SINGLELINE
).- Handles
^
as\A
and$
as\Z
. - Improves performance of generated regexes without changing their meaning if used for line-by-line search.
- Handles
- Added support for invalid JS identifiers as group names, so long as they are valid in Oniguruma.
v2.1.0
🚀 Features
- Restored support for subclass-based
\G
emulation in strictaccuracy
mode, for patterns without lookbehind. - Added support for use of a leading flag modifier when using keep directives (
\K
). - Improved error specificity for some invalid group names.
v2.0.0
This release brings full support for Oniguruma's \G
anchor (which has no direct equivalent in JavaScript). This is a very flexible anchor, and previous versions supported some but not all ways that it could be used.
🚨 Breaking
- Subclass strategy names that were used to support some cases of
\G
have been combined into a new strategy.- This is an internal-only change, but it can be breaking if you call the updated
EmulatedRegExp
constructor with details serialized from a previous version of this library.
- This is an internal-only change, but it can be breaking if you call the updated
- The non-default strict
accuracy
mode no longer allows subclass-based emulation of\G
.
🚀 Features
- Added comprehensive support for the
\G
anchor via subclass-based emulation. - Added a CommonJS bundle. (#26, @vcschapp)
- Added support for using
\G
in some positions where it can never match and forces backtracking (without the need for subclass-based emulation). - Removed option
rules.ignoreUnsupportedGAnchors
since it's no longer useful.
🐞 Fixes
- Fixed some extremely unlikely uses of
\G
that could lead to mismatches with some target strings.
v1.0.0
Most of the changes and fixes in this release resulted from feedback by @RedCMD. ✨
Note that every fix and newly-supported syntax in this release addresses an extreme edge case that did not affect even one regex in the tens of thousands of Oniguruma regexes found in the TextMate grammars provided by Shiki.
🚨 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
torules.recursionLimit
. - Changed the default
recursionLimit
from5
to20
. - Reduced the max
recursionLimit
from100
to20
. - Removed the ability to disable support for recursion.
- Setting
accuracy
to'strict'
no longer disables recursion.
- Moved option
🚀 Features
- Support
\x{…}
values above10FFFF
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 optionverbose
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
🚨 Breaking
toDetails
: Thesubclass
property on result objects was renamed asoptions
, for consistency withEmulatedRegExp
.
🚀 Features
- Added a
rawArgs
property toEmulatedRegExp
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 useES2025
. - 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 alltarget
s. (#14) - With pre-
ES2025
target
s: 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
🚨 Breaking
- Option
allowUnhandledGAnchors
renamed asignoreUnsupportedGAnchors
.
🚀 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.