the-forest/client/node_modules/fork-ts-checker-webpack-plugin/lib/issue/IssueConfiguration.js

29 lines
1.2 KiB
JavaScript
Raw Normal View History

2024-09-17 20:35:18 -04:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const IssueMatch_1 = require("./IssueMatch");
const IssuePredicate_1 = require("./IssuePredicate");
function createIssuePredicateFromOption(context, option) {
if (Array.isArray(option)) {
return IssuePredicate_1.composeIssuePredicates(option.map((option) => typeof option === 'function' ? option : IssueMatch_1.createIssuePredicateFromIssueMatch(context, option)));
}
return typeof option === 'function'
? option
: IssueMatch_1.createIssuePredicateFromIssueMatch(context, option);
}
function createIssueConfiguration(compiler, options) {
const context = compiler.options.context || process.cwd();
if (!options) {
options = {};
}
const include = options.include
? createIssuePredicateFromOption(context, options.include)
: IssuePredicate_1.createTrivialIssuePredicate(true);
const exclude = options.exclude
? createIssuePredicateFromOption(context, options.exclude)
: IssuePredicate_1.createTrivialIssuePredicate(false);
return {
predicate: (issue) => include(issue) && !exclude(issue),
};
}
exports.createIssueConfiguration = createIssueConfiguration;