fix(tools): replace replaceAll with replace for ES2020 compatibility

Use regex replace instead of replaceAll to support older target versions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Jiang Bohan 2026-01-30 21:54:55 +08:00
parent ae6d516952
commit 7d04253791

View file

@ -60,7 +60,7 @@ function compilePattern(pattern: string): CompiledPattern {
const escaped = normalized.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
return {
kind: "regex",
value: new RegExp(`^${escaped.replaceAll("\\*", ".*")}$`),
value: new RegExp(`^${escaped.replace(/\\\*/g, ".*")}$`),
};
}