sync.js 802 B

1234567891011121314151617181920212223
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const sync_1 = require("../readers/sync");
  4. const provider_1 = require("./provider");
  5. class ProviderSync extends provider_1.default {
  6. constructor() {
  7. super(...arguments);
  8. this._reader = new sync_1.default(this._settings);
  9. }
  10. read(task) {
  11. const root = this._getRootDirectory(task);
  12. const options = this._getReaderOptions(task);
  13. const entries = this.api(root, task, options);
  14. return entries.map(options.transform);
  15. }
  16. api(root, task, options) {
  17. if (task.dynamic) {
  18. return this._reader.dynamic(root, options);
  19. }
  20. return this._reader.static(task.patterns, options);
  21. }
  22. }
  23. exports.default = ProviderSync;