Skip to content
Snippets Groups Projects
Unverified Commit f5595f33 authored by Rhys Arkins's avatar Rhys Arkins Committed by GitHub
Browse files

feat: RENOVATE_X_IGNORE_RE2 (#21391)

parent 2667ea16
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,10 @@ See [issue 8660](https://github.com/renovatebot/renovate/issues/8660) for backgr
Suppress the default warning when a deprecated version of Node.js is used to run Renovate.
## `RENOVATE_X_IGNORE_RE2`
Skip initializing `RE2` for regular expressions and instead use Node-native `RegExp` instead.
## `RENOVATE_X_PLATFORM_VERSION`
If set, Renovate will use this string as GitLab server version instead of checking via the GitLab API.
......
......@@ -8,16 +8,18 @@ let RegEx: RegExpConstructor;
const cache = new Map<string, RegExp>();
try {
const RE2 = re2();
// Test if native is working
new RE2('.*').exec('test');
logger.debug('Using RE2 as regex engine');
RegEx = RE2;
} catch (err) {
logger.warn({ err }, 'RE2 not usable, falling back to RegExp');
RegEx = RegExp;
if (!process.env.RENOVATE_X_IGNORE_RE2) {
try {
const RE2 = re2();
// Test if native is working
new RE2('.*').exec('test');
logger.debug('Using RE2 as regex engine');
RegEx = RE2;
} catch (err) {
logger.warn({ err }, 'RE2 not usable, falling back to RegExp');
}
}
RegEx ??= RegExp;
export function regEx(
pattern: string | RegExp,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment