File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,14 @@ function findRegexLiterals(source) {
16
16
const pattern = m . captures [ 0 ] . node . text ;
17
17
const flags = m . captures [ 1 ] ?. node . text || "" ;
18
18
// transpile unicode property escapes
19
- const patternTranspiled = regexpuc ( pattern , flags , { unicodePropertyEscapes : 'transform' } ) ;
19
+ let patternTranspiled ;
20
+ try {
21
+ patternTranspiled = regexpuc ( pattern , flags , { unicodePropertyEscapes : 'transform' } ) ;
22
+ } catch {
23
+ // swallow regex parse errors here to instead throw them at the engine level
24
+ // this then also avoids regex parser bugs being thrown unnecessarily
25
+ patternTranspiled = pattern ;
26
+ }
20
27
regexLiterals . push ( {
21
28
patternStart : m . captures [ 0 ] . node . startIndex ,
22
29
patternEnd : m . captures [ 0 ] . node . endIndex ,
You can’t perform that action at this time.
0 commit comments