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.48.0.\n * Original file: /npm/node-gyp@13.0.1/lib/node-gyp.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\nconst path = require('path')\nconst nopt = require('nopt')\nconst log = require('./log')\nconst childProcess = require('child_process')\nconst { EventEmitter } = require('events')\n\nconst commands = [\n  // Module build commands\n  'build',\n  'clean',\n  'configure',\n  'rebuild',\n  // Development Header File management commands\n  'install',\n  'list',\n  'remove'\n]\n\nclass Gyp extends EventEmitter {\n  /**\n   * Export the contents of the package.json.\n   */\n  package = require('../package.json')\n\n  /**\n   * nopt configuration definitions\n   */\n  configDefs = {\n    help: Boolean, // everywhere\n    arch: String, // 'configure'\n    cafile: String, // 'install'\n    debug: Boolean, // 'build'\n    directory: String, // bin\n    make: String, // 'build'\n    'msvs-version': String, // 'configure'\n    ensure: Boolean, // 'install'\n    solution: String, // 'build' (windows only)\n    proxy: String, // 'install'\n    noproxy: String, // 'install'\n    devdir: String, // everywhere\n    nodedir: String, // 'configure'\n    loglevel: String, // everywhere\n    python: String, // 'configure'\n    'dist-url': String, // 'install'\n    tarball: String, // 'install'\n    jobs: String, // 'build'\n    thin: String, // 'configure'\n    'force-process-config': Boolean // 'configure'\n  }\n\n  /**\n   * nopt shorthands\n   */\n  shorthands = {\n    release: '--no-debug',\n    C: '--directory',\n    debug: '--debug',\n    j: '--jobs',\n    silly: '--loglevel=silly',\n    verbose: '--loglevel=verbose',\n    silent: '--loglevel=silent'\n  }\n\n  /**\n   * expose the command aliases for the bin file to use.\n   */\n  aliases = {\n    ls: 'list',\n    rm: 'remove'\n  }\n\n  constructor (...args) {\n    super(...args)\n\n    this.devDir = ''\n\n    this.commands = commands.reduce((acc, command) => {\n      acc[command] = (argv) => require('./' + command)(this, argv)\n      return acc\n    }, {})\n\n    Object.defineProperty(this, 'version', {\n      enumerable: true,\n      get: function () { return this.package.version }\n    })\n  }\n\n  /**\n   * Parses the given argv array and sets the 'opts',\n   * 'argv' and 'command' properties.\n   */\n  parseArgv (argv) {\n    this.opts = nopt(this.configDefs, this.shorthands, argv)\n    this.argv = this.opts.argv.remain.slice()\n\n    const commands = this.todo = []\n\n    // create a copy of the argv array with aliases mapped\n    argv = this.argv.map((arg) => {\n    // is this an alias?\n      if (arg in this.aliases) {\n        arg = this.aliases[arg]\n      }\n      return arg\n    })\n\n    // process the mapped args into \"command\" objects (\"name\" and \"args\" props)\n    argv.slice().forEach((arg) => {\n      if (arg in this.commands) {\n        const args = argv.splice(0, argv.indexOf(arg))\n        argv.shift()\n        if (commands.length > 0) {\n          commands[commands.length - 1].args = args\n        }\n        commands.push({ name: arg, args: [] })\n      }\n    })\n    if (commands.length > 0) {\n      commands[commands.length - 1].args = argv.splice(0)\n    }\n\n    // support for inheriting config env variables from npm\n    // npm will set environment variables in the following forms:\n    // - `npm_config_<key>` for values from npm's own config. Setting arbitrary\n    //   options on npm's config was deprecated in npm v11 but node-gyp still\n    //   supports it for backwards compatibility.\n    //   See https://github.com/nodejs/node-gyp/issues/3156\n    // - `npm_package_config_node_gyp_<key>` for values from the `config` object\n    //   in package.json. This is the preferred way to set options for node-gyp\n    //   since npm v11. The `node_gyp_` prefix is used to avoid conflicts with\n    //   other tools.\n    // The `npm_package_config_node_gyp_` prefix will take precedence over\n    // `npm_config_` keys.\n    const npmConfigPrefix = /^npm_config_/i\n    const npmPackageConfigPrefix = /^npm_package_config_node_gyp_/i\n\n    const configEnvKeys = Object.keys(process.env)\n      .filter((k) => npmConfigPrefix.test(k) || npmPackageConfigPrefix.test(k))\n      // sort so that npm_package_config_node_gyp_ keys come last and will override\n      .sort((a) => npmConfigPrefix.test(a) ? -1 : 1)\n\n    for (const key of configEnvKeys) {\n      // add the user-defined options to the config\n      const name = npmConfigPrefix.test(key)\n        ? key.replace(npmConfigPrefix, '')\n        : key.replace(npmPackageConfigPrefix, '')\n      // gyp@741b7f1 enters an infinite loop when it encounters\n      // zero-length options so ensure those don't get through.\n      if (name) {\n        // convert names like force_process_config to force-process-config\n        // and convert to lowercase\n        this.opts[name.replaceAll('_', '-').toLowerCase()] = process.env[key]\n      }\n    }\n\n    if (this.opts.loglevel) {\n      log.logger.level = this.opts.loglevel\n      delete this.opts.loglevel\n    }\n    log.resume()\n  }\n\n  /**\n   * Spawns a child process and emits a 'spawn' event.\n   */\n  spawn (command, args, opts) {\n    if (!opts) {\n      opts = {}\n    }\n    if (!opts.silent && !opts.stdio) {\n      opts.stdio = [0, 1, 2]\n    }\n    const cp = childProcess.spawn(command, args, opts)\n    log.info('spawn', command)\n    log.info('spawn args', args)\n    return cp\n  }\n\n  /**\n   * Returns the usage instructions for node-gyp.\n   */\n  usage () {\n    return [\n      '',\n      '  Usage: node-gyp <command> [options]',\n      '',\n      '  where <command> is one of:',\n      commands.map((c) => '    - ' + c + ' - ' + require('./' + c).usage).join('\\n'),\n      '',\n      'node-gyp@' + this.version + '  ' + path.resolve(__dirname, '..'),\n      'node@' + process.versions.node\n    ].join('\\n')\n  }\n}\n\nmodule.exports = () => new Gyp()\nmodule.exports.Gyp = Gyp\n"]}