text: "use strict";
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
      if (k2 === undefined) k2 = k;
      Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  }) : (function(o, m, k, k2) {
      if (k2 === undefined) k2 = k;
      o[k2] = m[k];
  }));
  var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
  }) : function(o, v) {
      o["default"] = v;
  });
  var __importStar = (this && this.__importStar) || function (mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
      __setModuleDefault(result, mod);
      return result;
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.loadFromDir = void 0;
  var module_interop_1 = require("@textlint/module-interop");
  var fs = __importStar(require("fs"));
  var path = __importStar(require("path"));
  /**
   * Load all rule modules from specified directory.
   * These are filtered by [extname]
   * @param {String} [rulesDir] Path to rules directory, may be relative. Defaults to `lib/rules`.
   * @param {String} [extname] extension name
   * @returns {Object} Loaded rule modules by rule ids (file names).
   */
  function loadFromDir(rulesDir, extname) {
      if (extname === void 0) { extname = ".js"; }
      var rulesDirAbsolutePath;
      if (!rulesDir) {
          rulesDirAbsolutePath = path.join(__dirname, "rules");
      }
      else {
          rulesDirAbsolutePath = path.resolve(process.cwd(), rulesDir);
      }
      var rules = Object.create(null);
      fs.readdirSync(rulesDirAbsolutePath).forEach(function (file) {
          if (path.extname(file) !== extname) {
              return;
          }
          var withoutExt = path.basename(file, extname);
          rules[withoutExt] = module_interop_1.moduleInterop(require(path.join(rulesDirAbsolutePath, file)));
      });
      return rules;
  }
  exports.loadFromDir = loadFromDir;
  //# sourceMappingURL=rule-loader.js.map