Innovenergy_trunk/frontend/node_modules/testcafe/lib/utils/get-options/compiler.js

35 lines
4.2 KiB
JavaScript

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const base_1 = __importDefault(require("./base"));
const unquote_1 = __importDefault(require("unquote"));
const OPTIONS_SEPARATOR = ';';
const ARRAY_ITEMS_SEPARATOR = ',';
const TYPESCRIPT_OPTIONS_PREFIX = 'typescript.options.';
const TYPESCRIPT_ARRAY_OPTION_NAMES = ['rootDirs', 'types', 'typeRoots', 'lib'].map(optionName => TYPESCRIPT_OPTIONS_PREFIX + optionName);
function isTypeScriptArrayOption(name) {
return !!name && TYPESCRIPT_ARRAY_OPTION_NAMES.includes(name);
}
function convertToArray(value) {
if (!value)
return [];
return value
.split(ARRAY_ITEMS_SEPARATOR)
.map(unquote_1.default);
}
function convertToArrayIfNecessary(key, value) {
return isTypeScriptArrayOption(key) ? convertToArray(value) : value;
}
async function default_1(options) {
return (0, base_1.default)(options, {
optionsSeparator: OPTIONS_SEPARATOR,
async onOptionParsed(key, value) {
return convertToArrayIfNecessary(key, value);
},
});
}
exports.default = default_1;
module.exports = exports.default;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcGlsZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdXRpbHMvZ2V0LW9wdGlvbnMvY29tcGlsZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxrREFBb0M7QUFFcEMsc0RBQThCO0FBRTlCLE1BQU0saUJBQWlCLEdBQU8sR0FBRyxDQUFDO0FBQ2xDLE1BQU0scUJBQXFCLEdBQUcsR0FBRyxDQUFDO0FBRWxDLE1BQU0seUJBQXlCLEdBQUcscUJBQXFCLENBQUM7QUFFeEQsTUFBTSw2QkFBNkIsR0FBRyxDQUFDL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