4 lat temu link-template.php d01d7cf85d first commit 4 lat temu load.php d01d7cf85d first commit 4 lat temu locale.php d01d7cf85d first commit 4 lat temu media-template.php d01d7cf85d first commit 4 lat temu media.php d01d7cf85d first commit 4 lat temu meta.php d01d7cf85d first commit 4 lat temu ms-blogs.php d01d7cf85d first commit 4 lat temu ms-default-constants.php d01d7cf85d first commit 4 lat temu ms-default-filters.php d01d7cf85d first commit 4 lat temu ms-deprecated.php d01d7cf85d first commit 4 lat temu ms-files.php d01d7cf85d first commit 4 lat temu ms-functions.php d01d7cf85d first commit 4 lat temu ms-load.php d01d7cf85d first commit 4 lat temu ms-network.php d01d7cf85d first commit 4 lat temu ms-settings.php d01d7cf85d first commit 4 lat temu ms-site.php d01d7cf85d first commit 4 lat temu nav-menu-template.php d01d7cf85d first commit 4 lat temu nav-menu.php d01d7cf85d first commit 4 lat temu option.php d01d7cf85d first commit 4 lat temu pluggable-deprecated.php d01d7cf85d first commit 4 lat temu pluggable.php d01d7cf85d first commit 4 lat temu plugin.php d01d7cf85d first commit 4 lat temu post-formats.php d01d7cf85d first commit 4 lat temu post-template.php d01d7cf85d first commit 4 lat temu post-thumbnail-template.php d01d7cf85d first commit 4 lat temu post.php d01d7cf85d first commit 4 lat temu query.php d01d7cf85d first commit 4 lat temu registration-functions.php d01d7cf85d first commit 4 lat temu registration.php d01d7cf85d first commit 4 lat temu rest-api.php d01d7cf85d first commit 4 lat temu revision.php d01d7cf85d first commit 4 lat temu rewrite.php d01d7cf85d first commit 4 lat temu robots-template.php d01d7cf85d first commit 4 lat temu rss-functions.php d01d7cf85d first commit 4 lat temu rss.php d01d7cf85d first commit 4 lat temu script-loader.php d01d7cf85d first commit 4 lat temu session.php d01d7cf85d first commit 4 lat temu shortcodes.php d01d7cf85d first commit 4 lat temu sitemaps.php d01d7cf85d first commit 4 lat temu spl-autoload-compat.php d01d7cf85d first commit 4 lat temu taxonomy.php d01d7cf85d first commit 4 lat temu template-canvas.php d01d7cf85d first commit 4 lat temu template-loader.php d01d7cf85d first commit 4 lat temu template.php d01d7cf85d first commit 4 lat temu theme-i18n.json d01d7cf85d first commit 4 lat temu theme-templates.php d01d7cf85d first commit 4 lat temu theme.json d01d7cf85d first commit 4 lat temu theme.php d01d7cf85d first commit 4 lat temu update.php d01d7cf85d first commit 4 lat temu user.php d01d7cf85d first commit 4 lat temu vars.php d01d7cf85d first commit 4 lat temu version.php d01d7cf85d first commit 4 lat temu widgets.php d01d7cf85d first commit 4 lat temu wlwmanifest.xml d01d7cf85d first commit 4 lat temu wp-db.php d01d7cf85d first commit 4 lat temu wp-diff.php d01d7cf85d first commit 4 lat temu golf/tge - Gogs: Simplico Git Service

Nav apraksta

sync.js 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const fsScandir = require("@nodelib/fs.scandir");
  4. const common = require("./common");
  5. const reader_1 = require("./reader");
  6. class SyncReader extends reader_1.default {
  7. constructor() {
  8. super(...arguments);
  9. this._scandir = fsScandir.scandirSync;
  10. this._storage = [];
  11. this._queue = new Set();
  12. }
  13. read() {
  14. this._pushToQueue(this._root, this._settings.basePath);
  15. this._handleQueue();
  16. return this._storage;
  17. }
  18. _pushToQueue(directory, base) {
  19. this._queue.add({ directory, base });
  20. }
  21. _handleQueue() {
  22. for (const item of this._queue.values()) {
  23. this._handleDirectory(item.directory, item.base);
  24. }
  25. }
  26. _handleDirectory(directory, base) {
  27. try {
  28. const entries = this._scandir(directory, this._settings.fsScandirSettings);
  29. for (const entry of entries) {
  30. this._handleEntry(entry, base);
  31. }
  32. }
  33. catch (error) {
  34. this._handleError(error);
  35. }
  36. }
  37. _handleError(error) {
  38. if (!common.isFatalError(this._settings, error)) {
  39. return;
  40. }
  41. throw error;
  42. }
  43. _handleEntry(entry, base) {
  44. const fullpath = entry.path;
  45. if (base !== undefined) {
  46. entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
  47. }
  48. if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
  49. this._pushToStorage(entry);
  50. }
  51. if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
  52. this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
  53. }
  54. }
  55. _pushToStorage(entry) {
  56. this._storage.push(entry);
  57. }
  58. }
  59. exports.default = SyncReader;