Commit 4d7f537
committed
fix(scanner): fix regex catastrophic backtracking in import parser
The STATIC_IMPORT_RE regex used [\s\S]*? which causes exponential
backtracking on files with complex import statements. Replaced with
[^'"]*? which is bounded and cannot backtrack. Also split out
side-effect imports into a separate regex for clarity.
This was causing mex setup to hang on "Scanning codebase..." step.1 parent 4b64e1a commit 4d7f537
1 file changed
+6
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
| |||
85 | 89 | | |
86 | 90 | | |
87 | 91 | | |
88 | | - | |
| 92 | + | |
89 | 93 | | |
90 | 94 | | |
91 | 95 | | |
| |||
0 commit comments