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 ...@@ -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. 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` ## `RENOVATE_X_PLATFORM_VERSION`
If set, Renovate will use this string as GitLab server version instead of checking via the GitLab API. 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; ...@@ -8,16 +8,18 @@ let RegEx: RegExpConstructor;
const cache = new Map<string, RegExp>(); const cache = new Map<string, RegExp>();
try { if (!process.env.RENOVATE_X_IGNORE_RE2) {
const RE2 = re2(); try {
// Test if native is working const RE2 = re2();
new RE2('.*').exec('test'); // Test if native is working
logger.debug('Using RE2 as regex engine'); new RE2('.*').exec('test');
RegEx = RE2; logger.debug('Using RE2 as regex engine');
} catch (err) { RegEx = RE2;
logger.warn({ err }, 'RE2 not usable, falling back to RegExp'); } catch (err) {
RegEx = RegExp; logger.warn({ err }, 'RE2 not usable, falling back to RegExp');
}
} }
RegEx ??= RegExp;
export function regEx( export function regEx(
pattern: string | RegExp, 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