dgeni-packages
Version:
A collection of dgeni packages for generating documentation from source code
26 lines • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.expandSourceFiles = void 0;
const glob_1 = require("glob");
// Note that we have to use `require()` here because the `lodash.difference`
// has a `module.exports = difference` style export.
const difference = require("lodash.difference");
function expandSourceFiles(sourceFiles, basePath) {
let filePaths = [];
sourceFiles.forEach(sourcePattern => {
if (isSourcePattern(sourcePattern)) {
const include = (0, glob_1.sync)(sourcePattern.include, { cwd: basePath });
const exclude = sourcePattern.exclude ? (0, glob_1.sync)(sourcePattern.exclude, { cwd: basePath }) : [];
filePaths = filePaths.concat(difference(include, exclude));
}
else {
filePaths = filePaths.concat((0, glob_1.sync)(sourcePattern, { cwd: basePath }));
}
});
return filePaths;
}
exports.expandSourceFiles = expandSourceFiles;
function isSourcePattern(pattern) {
return !!pattern.include;
}
//# sourceMappingURL=SourcePattern.js.map