* One branch of a negative lookahead, as a regex of our own: a literal path * prefix (`api`, `_next/static`, `favicon.ico`, `api(?:/|$)`) or a pattern for * files with an extension (`[^?]*\.(?:html?|css)`, `.*\.(?:svg|png)$`, * `.*\..*`). Every such pattern reads the same way: a route with a dot
(branch: string)
| 229 | * takes every path, so that app's proxy really does skip its pages. |
| 230 | */ |
| 231 | function readExclusion(branch: string): string | null { |
| 232 | if (/^(?:\[\^\?\]\*|\.\*|\.\+|\[[^\]]*\]\+)\\\./.test(branch)) return FILE_WITH_EXTENSION; |
| 233 | const literal = /^((?:[\w/~-]|\\?\.)+)(\$|\(\?:\/\|\$\))?$/.exec(branch); |
| 234 | if (!literal) return null; |
| 235 | return escapeRegex(literal[1]!.replace(/\\\./g, '.')) + (literal[2] ?? ''); |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * The inside of a matcher's group: `.*`, `.+`, `a|b` of literals, or |
nothing calls this directly
no test coverage detected