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K,OAEP,KAAK,KAAK,EAEd","file":"/npm/comfort@5.0.2/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/comfort@5.0.2/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict'\n\n// ### design\n//  commander({\n//      commands: './lib/command',\n//      options: './opt/',\n//      name: 'cortex'\n//  }).cli()\nmodule.exports = comfort\ncomfort.errorHandler = require('./lib/error-handler')\n\nfunction comfort(options) {\n  options || (options = {})\n  return new Comfort(options)\n}\n\n\nvar node_path = require('path')\nvar EE = require('events').EventEmitter\nvar util = require('util')\nvar spawn = require('spawns')\nvar fs = require('fs')\nvar expand = require('fs-expand')\nvar async = require('async')\nvar clean = require('clean')\nvar mix = require('mix2')\n\nvar BUILTIN_COMMAND_ROOT = node_path.join(__dirname, 'lib', 'built-in', 'command')\nvar BUILTIN_OPTION_ROOT = node_path.join(__dirname, 'lib', 'built-in', 'option')\n\n\nfunction Comfort(options) {\n  this.options = options\n\n  this.commands = options.commands\n  options.offset = 'offset' in options ? options.offset : 3\n\n  this._context = {\n    commander: this\n  }\n  this._commander_proto = {}\n  this._commander = {}\n}\n\nutil.inherits(Comfort, EE)\n\n\nComfort.prototype.context = function (context) {\n  mix(this._context, context)\n  return this\n}\n\n\n// comfort().setup(async_setup_method).cli()\nComfort.prototype.setup = function(setup) {\n  if (this.pending) {\n    return this\n  }\n\n  if (typeof setup === 'function') {\n    this.pending = true\n    var done = function () {\n      this.pending = false\n      this.emit('setup')\n    }.bind(this)\n\n    setup.call(this, done)\n  }\n\n  return this\n}\n\n\n// 'abc.js' -> 'abc'\n// 'abc.js.js' -> 'abc'\nvar REGEX_REPLACE_EXTENSION = /\\..+$/\n\n// Get all commands\nComfort.prototype._get_commands = function(callback) {\n  if (this.commands) {\n    return callback(null, this.commands)\n  }\n\n  var self = this\n  expand('*.js', {\n      cwd: this.options.command_root\n  }, function (err, files) {\n    if (err) {\n      return callback(err)\n    }\n\n    var commands = files.map(function(command) {\n      return command.replace(REGEX_REPLACE_EXTENSION, '')\n    })\n    // Cache it\n    self.commands = commands\n    callback(null, commands)\n  })\n}\n\n\nComfort.prototype.parse = function(argv, callback) {\n  var self = this\n  this._get_commands(function (err) {\n    if (err) {\n      return callback(err)\n    }\n\n    self._parse(argv, callback)\n  })\n}\n\n\nvar BUILTIN_COMMANDS = [\n  'help',\n  'version'\n]\n\n// parse a specified argument vector\n// @param {Array} argv process.argv or something like that\n// @param {function(err, result, details)} callback\n// @param {boolean} strict if strict,\nComfort.prototype._parse = function(argv, callback, strict) {\n  // argv ->\n  // ['node', __dirname, '<command>', ...]\n  var command = argv[2]\n  var is_entry = !command\n\n  var is_command = this._is_command(command)\n  var is_normal = is_command && this._is_normal(command)\n  var is_builtin = is_command && this._is_builtin(command)\n\n  // Plugins\n  ////////////////////////////////////////////////////////////////////////////////////\n  // cortex <plugin> --version\n  // cortex <plugin> -v\n  // Plugin command needs special treatment.\n  if (is_command && !is_normal && !is_builtin) {\n    if (strict) {\n      return this._command_not_found(command, callback)\n    }\n\n    return callback(null, {\n      argv: argv,\n      command: command,\n\n      // 'normal', 'builtin', 'plugin'\n      type: 'plugin'\n    })\n  }\n\n  // Version\n  ////////////////////////////////////////////////////////////////////////////////////\n  if (\n    command === 'version' ||\n    ~argv.indexOf('-v') ||\n    ~argv.indexOf('--version')\n  ) {\n    command = 'version'\n    return callback(null, {\n      argv: argv,\n      command: command,\n      options: {\n        root: this.options.root\n      },\n      type: this._is_builtin(command)\n        ? 'builtin'\n        : 'normal'\n    })\n  }\n\n  // Help -h, --help\n  ////////////////////////////////////////////////////////////////////////////////////\n  var index_h = argv.indexOf('-h')\n  var index_help = argv.indexOf('--help')\n\n  var help_extra_options = {\n    commands      : this.commands,\n    builtins      : BUILTIN_COMMANDS,\n    name          : this.options.name,\n    normal_root   : this.options.option_root,\n    builtin_root  : BUILTIN_OPTION_ROOT\n  }\n\n  // 'help' command need special treatment\n  if (\n    // cortex -h\n    ~index_h ||\n    // cortex --help\n    ~index_help ||\n    // root command will be help command\n    is_entry ||\n    // cortex --wrong-argument\n    !is_command\n  ) {\n    // 1      2       3\n    // cortex install -h\n    // cortex install --help\n    // -> cortex help\n    var command_for_help =\n      index_h !== 2 &&\n      index_help !== 2 &&\n      argv[2]\n\n    // Wrong usage\n    // cortex --abc -h\n    if (!this._is_command(command_for_help)) {\n      command_for_help = null\n    }\n\n    command = 'help'\n\n    if (is_entry) {\n      this.emit('entry')\n    }\n\n    return callback(null, {\n      argv: argv,\n      command: command,\n      type: this._is_builtin(command)\n        ? 'builtin'\n        : 'normal',\n      options: mix({\n        command: command_for_help,\n        // if there's only root command, an `entrance` option will be added\n        entry: is_entry\n      }, help_extra_options)\n    })\n  }\n\n  // Normal & Builtin\n  ////////////////////////////////////////////////////////////////////////////////////\n  this._parse_argv(command, argv, function (err, result) {\n    if (err) {\n      return callback(err)\n    }\n\n    if (command === 'help') {\n      mix(result.options, help_extra_options)\n    }\n\n    callback(null, result)\n  })\n}\n\n\nComfort.prototype._is_command = function(command) {\n  return command && command.indexOf('-') !== 0\n}\n\n\nComfort.prototype._is_builtin = function(command) {\n  return ~BUILTIN_COMMANDS.indexOf(command)\n}\n\n\nComfort.prototype._is_normal = function(command) {\n  return ~this.commands.indexOf(command)\n}\n\n\nComfort.prototype._command_not_found = function(command, callback) {\n  var name = this.options.name\n  callback({\n    code: 'COMMAND_NOT_FOUND',\n    message: name + ': \"' + command + '\" is not a \"' + name + '\" command. See \"' + name + ' --help\".',\n    data: {\n      name: name,\n      command: command\n    }\n  })\n}\n\n\n// Parse the argv of a normal or builtin command\nComfort.prototype._parse_argv = function(command, argv, callback) {\n  // builtin command is less\n  var is_builtin = this._is_builtin(command)\n  var option_root = is_builtin\n    ? BUILTIN_OPTION_ROOT\n    : this.options.option_root\n\n  var type = is_builtin\n    ? 'builtin'\n    : 'normal'\n\n  var self = this\n  this._get_option_rule(command, option_root, function (err, rule) {\n    if (err) {\n      return callback(err)\n    }\n\n    if (!rule) {\n      return callback(null, {\n        argv: argv,\n        command: command,\n        type: type,\n        options: {}\n      })\n    }\n\n    // parse argv\n    clean({\n      schema: rule.options,\n      shorthands: rule.shorthands,\n      offset: self.options.offset\n\n    }).parse(argv, function(err, results, details) {\n      callback(err, {\n        command: command,\n        options: results,\n        argv: argv,\n        type: type\n      })\n    })\n  })\n}\n\n\nComfort.prototype._get_option_rule = function(command, root, callback) {\n  var file = node_path.join(root, command + '.js')\n  fs.exists(file, function (exists) {\n    if (!exists) {\n      return callback(null, null)\n    }\n\n    var rule\n    try {\n      rule = require(file)\n    } catch(e) {\n      return callback({\n        code: 'FAIL_READ_OPTION',\n        message: 'Fails to read option file \"' + file + '\": ' + e.stack,\n        data: {\n          command: command,\n          file: file,\n          error: e\n        }\n      })\n    }\n\n    callback(null, rule)\n  })\n}\n\n\nComfort.prototype._get_command_proto = function(command, root, callback) {\n  var file = node_path.join(root, command + '.js')\n  var self = this\n  fs.exists(file, function (exists) {\n    if (!exists) {\n      return self._command_not_found(command, callback)\n    }\n\n    var proto\n    try {\n      proto = require(file)\n    } catch(e) {\n      return callback({\n        code: 'FAIL_READ_COMMAND',\n        message: 'Fails to read command file \"' + file + '\": ' + e.stack,\n        data: {\n          command: command,\n          file: file,\n          error: e\n        }\n      })\n    }\n\n    callback(null, proto)\n  })\n}\n\n\n// Run from argv\nComfort.prototype.run = function(argv, callback) {\n  var self = this\n  this.parse(argv, function (err, result) {\n    if (err) {\n      return callback(err)\n    }\n\n    var command = result.command\n\n    if (result.type === 'plugin') {\n      return self._plugin(command, result.argv.slice(3), callback)\n    }\n\n    self.commander(command, function (err, commander) {\n      if (err) {\n        return callback(err)\n      }\n\n      commander.run(result.options, callback)\n    })\n  })\n}\n\n\n// Try to run the given command from the `PATH`\nComfort.prototype._plugin = function(command, args, callback) {\n  this.emit('plugin', {\n    name: name,\n    command: command,\n    args: args\n  })\n\n  var name = this.options.name\n  var bin = name + '-' + command\n  var paths = process.env.PATH.split(':').map(function (path) {\n    return node_path.resolve(path, bin)\n  })\n\n  var self = this\n  this._try_files(paths, function (found) {\n    if (!found) {\n      return self._command_not_found(command, callback)\n    }\n\n    var plugin = spawn(found, args, {\n      stdio: 'inherit',\n      // `options.customFds` is now DEPRECATED.\n      // just for backward compatibility.\n      customFds: [0, 1, 2]\n    })\n\n    // for node <= 0.6, 'close' event often could not be triggered\n    plugin.on('exit', function(code) {\n      callback(code)\n    })\n  })\n}\n\n\nComfort.prototype._try_files = function(files, callback) {\n  async.eachSeries(files, function (file, done) {\n    fs.exists(file, function (exists) {\n      if (!exists) {\n        return done(null)\n      }\n\n      fs.stat(file, function (err, stat) {\n        if (!err && stat.isFile()) {\n          return done(file)\n        }\n\n        done(null)\n      })\n    })\n  }, callback)\n}\n\n\n// @returns {Object|false}\nComfort.prototype.commander = function(command, callback, create_new) {\n  if (!create_new) {\n    var commander = this._commander[command]\n    if (commander) {\n      return callback(null, commander)\n    }\n  }\n\n  function create_commander(_proto) {\n    var proto = {}\n    mix(proto, EE.prototype)\n    mix(proto, _proto)\n\n    var commander = {}\n    commander.__proto__ = proto\n\n    // Equivalent to `constructor.call(this)`\n    mix(commander, self._context)\n\n    setImmediate(function () {\n      // There might be more than one comfort instances,\n      // so `Object.create` a new commander object to prevent reference pollution.\n      // Equivalent to prototype inheritance\n      callback(null, commander)\n    })\n\n    return commander\n  }\n\n  // cache commander to improve performance\n  var proto = this._commander_proto[command]\n  if (proto) {\n    return create_commander(proto)\n  }\n\n  var is_builtin = this._is_builtin(command)\n  var command_root = is_builtin\n    ? BUILTIN_COMMAND_ROOT\n    : this.options.command_root\n\n  var self = this\n  this._get_command_proto(command, command_root, function (err, proto) {\n    if (err) {\n      return callback(err)\n    }\n\n    var commander = create_commander(proto)\n    self._commander_proto[command] = proto\n    self._commander[command] = commander\n  })\n}\n\n\n// # Design spec\n\n// ## method to run in cli (bin):\n// - .cli()\n\n// Should:\n// - driven by events\n\n// ## method used by users or utility methods:\n// - .run(),\n// - .command_exists(),\n// - .get_commander()\n\n// Should:\n// - driven by callbacks\n// - handle errors with node-favored async way\n\n// ****\n\n// # Events:\n// ## plugin\n// {\n//     name: {string},\n//     command: {string} plugin name,\n//     args: {Array}\n// }\n\n// ## complete\n// {\n//     name   : {string}\n//     command: {string} command name\n//     err    : {mixed}\n//     data   : []\n// }\n\n// run cli\nComfort.prototype._cli = function(argv) {\n  argv = argv || process.argv\n\n  var self = this\n  this.run(argv, function (err) {\n    if (err) {\n      return self.emit('error', err)\n    }\n\n    self.emit('finish')\n  })\n}\n\n\nComfort.prototype.cli = function(argv) {\n  if (this.pending) {\n    this.on('setup', function () {\n      this._cli(argv)\n    }.bind(this))\n  } else {\n    this._cli(argv)\n  }\n}\n"]}