@ng-doc/builder
Version:
<!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://github.com/ng-doc/ng-doc"> <img src="https://ng-doc.com/assets/images/ng-doc.svg?raw=true" alt="Logo" height="150px"> </a>
31 lines • 1.06 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.watchFolder = watchFolder;
const core_1 = require("@ng-doc/core");
const operators_1 = require("rxjs/operators");
const watch_1 = require("./watch");
/**
*
* @param folderPath
* @param type
*/
function watchFolder(folderPath, type) {
return (0, watch_1.watch)(folderPath, true).pipe((0, operators_1.map)((events) => {
/*
* Subscribe to changes in the directory containing the file.
* Filter out events for other files in the directory.
* It's necessary because @parcel/watcher doesn't support watching a single file.
*/
if (type) {
const fileEvents = events.filter((event) => (0, core_1.asArray)(type).includes(event.type));
if (fileEvents.length) {
return fileEvents;
}
}
else {
return events;
}
return [];
}), (0, operators_1.filter)((events) => events.length > 0));
}
//# sourceMappingURL=watch-folder.js.map
;