in src/config/AgentConfig.ts [48:110]
export function finalizeConfig(config: AgentConfig): void {
const escapeRegExp = (s: string) => s.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1');
config.reDisablePlugins = RegExp(
`^(?:${config
.disablePlugins!.split(',')
.map((s) => escapeRegExp(s.trim()))
.join('|')})$`,
'i',
);
const convertIgnoreSuffix = (configuredIgnoreSuffix: string | undefined) => {
if (!configuredIgnoreSuffix) {
// This regexp will never match => no files are ignored.
return '\\A(?!x)x';
} else {
return `^.+(?:${configuredIgnoreSuffix!
.split(',')
.map((s) => escapeRegExp(s.trim()))
.join('|')})$`;
}
};
const ignoreSuffix = convertIgnoreSuffix(config.ignoreSuffix);
const ignorePath =
'^(?:' +
config
.traceIgnorePath!.split(',')
.map(
(s0) =>
s0
.trim()
.split('/**/')
.map(
(s1) =>
s1
.trim()
.split('**')
.map(
(s2) =>
s2
.split('*')
.map(
(s3) => s3.split('?').map(escapeRegExp).join('[^/]'), // replaces "?"
)
.join('[^/]*'), // replaces "*"
)
.join('(?:(?:[^/]+/)*[^/]+)?'), // replaces "**"
)
.join('/(?:[^/]*/)*'), // replaces "/**/"
)
.join('|') +
')$'; // replaces ","
config.reIgnoreOperation = RegExp(`${ignoreSuffix}|${ignorePath}`);
config.reHttpIgnoreMethod = RegExp(
`^(?:${config
.httpIgnoreMethod!.split(',')
.map((s) => escapeRegExp(s.trim()))
.join('|')})$`,
'i',
);
}