text: "use strict";
  const plugin_1 = require("./plugin");
  const logger_1 = require("./logger");
  const settings_1 = require("./settings");
  const mockRequire = require("mock-require");
  function isValidTypeScriptVersion(typescript) {
      const [major] = typescript.version.split('.');
      return +major >= 3;
  }
  module.exports = function init({ typescript }) {
      const configManager = new settings_1.ConfigurationManager(typescript);
      let logger;
      // Make sure TS Lint imports the correct version of TS
      mockRequire('typescript', typescript);
      return {
          create(info) {
              logger = logger_1.Logger.forPlugin(info);
              logger.info('Create');
              configManager.setProject(info.project, logger);
              configManager.updateFromPluginConfig(info.config);
              if (!isValidTypeScriptVersion(typescript)) {
                  logger.info('Invalid typescript version detected. The TSLint plugin requires TypeScript 3.x');
                  return info.languageService;
              }
              return new plugin_1.TSLintPlugin(typescript, info.languageServiceHost, logger, info.project, configManager)
                  .decorate(info.languageService);
          },
          onConfigurationChanged(config) {
              if (logger) {
                  logger.info('onConfigurationChanged');
              }
              configManager.updateFromPluginConfig(config);
          },
      };
  };
  //# sourceMappingURL=index.js.map