From 707207bddb2900d6f7a57ff864cef26cda75a71a Mon Sep 17 00:00:00 2001 From: isaacs Date: Mon, 17 Aug 2020 16:24:46 -0700 Subject: [PATCH 1/8] add @npmcli/config, bump dep on nopt, remove direct dep on osenv --- node_modules/@npmcli/config/LICENSE | 15 + node_modules/@npmcli/config/README.md | 224 ++++++ .../@npmcli/config/lib/env-replace.js | 14 + node_modules/@npmcli/config/lib/index.js | 744 ++++++++++++++++++ node_modules/@npmcli/config/lib/nerf-dart.js | 18 + .../@npmcli/config/lib/parse-field.js | 75 ++ node_modules/@npmcli/config/lib/proc-log.js | 4 + node_modules/@npmcli/config/lib/set-envs.js | 99 +++ node_modules/@npmcli/config/lib/type-defs.js | 49 ++ .../@npmcli/config/lib/type-description.js | 18 + node_modules/@npmcli/config/lib/umask.js | 28 + node_modules/@npmcli/config/package.json | 38 + node_modules/node-gyp/node_modules/.bin/nopt | 1 + .../node-gyp/node_modules/nopt/CHANGELOG.md | 58 ++ .../node-gyp/node_modules/nopt/LICENSE | 15 + .../node-gyp/node_modules/nopt/README.md | 213 +++++ .../node-gyp/node_modules/nopt/bin/nopt.js | 54 ++ .../node-gyp/node_modules/nopt/lib/nopt.js | 441 +++++++++++ .../node-gyp/node_modules/nopt/package.json | 30 + node_modules/nopt/lib/nopt.js | 4 +- node_modules/nopt/package.json | 14 +- package-lock.json | 75 +- package.json | 8 +- 23 files changed, 2215 insertions(+), 24 deletions(-) create mode 100644 node_modules/@npmcli/config/LICENSE create mode 100644 node_modules/@npmcli/config/README.md create mode 100644 node_modules/@npmcli/config/lib/env-replace.js create mode 100644 node_modules/@npmcli/config/lib/index.js create mode 100644 node_modules/@npmcli/config/lib/nerf-dart.js create mode 100644 node_modules/@npmcli/config/lib/parse-field.js create mode 100644 node_modules/@npmcli/config/lib/proc-log.js create mode 100644 node_modules/@npmcli/config/lib/set-envs.js create mode 100644 node_modules/@npmcli/config/lib/type-defs.js create mode 100644 node_modules/@npmcli/config/lib/type-description.js create mode 100644 node_modules/@npmcli/config/lib/umask.js create mode 100644 node_modules/@npmcli/config/package.json create mode 120000 node_modules/node-gyp/node_modules/.bin/nopt create mode 100644 node_modules/node-gyp/node_modules/nopt/CHANGELOG.md create mode 100644 node_modules/node-gyp/node_modules/nopt/LICENSE create mode 100644 node_modules/node-gyp/node_modules/nopt/README.md create mode 100755 node_modules/node-gyp/node_modules/nopt/bin/nopt.js create mode 100644 node_modules/node-gyp/node_modules/nopt/lib/nopt.js create mode 100644 node_modules/node-gyp/node_modules/nopt/package.json diff --git a/node_modules/@npmcli/config/LICENSE b/node_modules/@npmcli/config/LICENSE new file mode 100644 index 0000000000000..19cec97b18468 --- /dev/null +++ b/node_modules/@npmcli/config/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) npm, Inc. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@npmcli/config/README.md b/node_modules/@npmcli/config/README.md new file mode 100644 index 0000000000000..38fd9b6ce14cb --- /dev/null +++ b/node_modules/@npmcli/config/README.md @@ -0,0 +1,224 @@ +# `@npmcli/config` + +Configuration management for the npm cli. + +This module is the spiritual decendant of +[`npmconf`](http://npm.im/npmconf), and the code that once lived in npm's +`lib/config/` folder. + +It does the management of configuration files that npm uses, but +importantly, does _not_ define all the configuration defaults or types, as +those parts make more sense to live within the npm CLI itself. + +The only exceptions: + +- The `prefix` config value has some special semantics, setting the local + prefix if specified on the CLI options and not in global mode, or the + global prefix otherwise. +- The `project` config file is loaded based on the local prefix (which can + only be set by the CLI config options, and otherwise defaults to a walk + up the folder tree to the first parent containing a `node_modules` + folder, `package.json` file, or `package-lock.json` file.) +- The `userconfig` value, as set by the environment and CLI (defaulting to + `~/.npmrc`, is used to load user configs. +- The `globalconfig` value, as set by the environment, CLI, and + `userconfig` file (defaulting to `$PREFIX/etc/npmrc`) is used to load + global configs. +- A `builtin` config, read from a `npmrc` file in the root of the npm + project itself, overrides all defaults. + +The resulting heirarchy of configs: + +- CLI switches. eg `--some-key=some-value` on the command line. These are + parsed by [`nopt`](http://npm.im/nopt), which is not a great choice, but + it's the one that npm has used forever, and changing it will be + difficult. +- Environment variables. eg `npm_config_some_key=some_value` in the + environment. There is no way at this time to modify this prefix. +- INI-formatted project configs. eg `some-key = some-value` in the + `localPrefix` folder (ie, the `cwd`, or its nearest parent that contains + either a `node_modules` folder or `package.json` file.) +- INI-formatted userconfig file. eg `some-key = some-value` in `~/.npmrc`. + The `userconfig` config value can be overridden by the `cli`, `env`, or + `project` configs to change this value. +- INI-formatted globalconfig file. eg `some-key = some-value` in + the `globalPrefix` folder, which is inferred by looking at the location + of the node executable, or the `prefix` setting in the `cli`, `env`, + `project`, or `userconfig`. The `globalconfig` value at any of those + levels can override this. +- INI-formatted builtin config file. eg `some-key = some-value` in + `/usr/local/lib/node_modules/npm/npmrc`. This is not configurable, and + is determined by looking in the `npmPath` folder. +- Default values (passed in by npm when it loads this module). + +## USAGE + +```js +const Config = require('@npmcli/config') +// the types of all the configs we know about +const types = require('./config/types.js') +// default values for all the configs we know about +const defaults = require('./config/defaults.js') +// if you want -c to be short for --call and so on, define it here +const shorthands = require('./config/shorthands.js') + +const conf = new Config({ + // path to the npm module being run + npmPath: resolve(__dirname, '..'), + types, + shorthands, + defaults, + // optional, defaults to process.argv + argv: process.argv, + // optional, defaults to process.env + env: process.env, + // optional, defaults to process.execPath + execPath: process.execPath, + // optional, defaults to process.platform + platform: process.platform, + // optional, defaults to process.cwd() + cwd: process.cwd(), + // optional, defaults to emitting 'log' events on process object + // only silly, verbose, warn, and error are logged by this module + log: require('npmlog') +}) + +// returns a promise that fails if config loading fails, and +// resolves when the config object is ready for action +conf.load().then(() => { + console.log('loaded ok! some-key = ' + conf.get('some-key')) +}).catch(er => { + console.error('error loading configs!', er) +}) +``` + +## API + +The `Config` class is the sole export. + +```js +const Config = require('@npmcli/config') +``` + +### static `Config.typeDefs` + +The type definitions passed to `nopt` for CLI option parsing and known +configuration validation. + +### constructor `new Config(options)` + +Options: + +- `types` Types of all known config values. Note that some are effectively + given semantic value in the config loading process itself. +- `shorthands` An object mapping a shorthand value to an array of CLI + arguments that replace it. +- `defaults` Default values for each of the known configuration keys. + These should be defined for all configs given a type, and must be valid. +- `npmPath` The path to the `npm` module, for loading the `builtin` config + file. +- `cwd` Optional, defaults to `process.cwd()`, used for inferring the + `localPrefix` and loading the `project` config. +- `platform` Optional, defaults to `process.platform`. Used when inferring + the `globalPrefix` from the `execPath`, since this is done diferently on + Windows. +- `execPath` Optional, defaults to `process.execPath`. Used to infer the + `globalPrefix`. +- `log` Optional, the object used to log debug messages, warnings, and + errors. Defaults to emitting on the `process` object. +- `env` Optional, defaults to `process.env`. Source of the environment + variables for configuration. +- `argv` Optional, defaults to `process.argv`. Source of the CLI options + used for configuration. + +Returns a `config` object, which is not yet loaded. + +Fields: + +- `config.globalPrefix` The prefix for `global` operations. Set by the + `prefix` config value, or defaults based on the location of the + `execPath` option. +- `config.localPrefix` The prefix for `local` operations. Set by the + `prefix` config value on the CLI only, or defaults to either the `cwd` or + its nearest ancestor containing a `node_modules` folder or `package.json` + file. +- `config.sources` A read-only `Map` of the file (or a comment, if no file + found, or relevant) to the config level loaded from that source. +- `config.data` A `Map` of config level to `ConfigData` objects. These + objects should not be modified directly under any circumstances. + - `source` The source where this data was loaded from. + - `raw` The raw data used to generate this config data, as it was parsed + initially from the environment, config file, or CLI options. + - `data` The data object reflecting the inheritance of configs up to this + point in the chain. + - `loadError` Any errors encountered that prevented the loading of this + config data. +- `config.list` A list sorted in priority of all the config data objects in + the prototype chain. `config.list[0]` is the `cli` level, + `config.list[1]` is the `env` level, and so on. +- `cwd` The `cwd` param +- `env` The `env` param +- `argv` The `argv` param +- `execPath` The `execPath` param +- `platform` The `platform` param +- `log` The `log` param +- `defaults` The `defaults` param +- `shorthands` The `shorthands` param +- `types` The `types` param +- `npmPath` The `npmPath` param +- `globalPrefix` The effective `globalPrefix` +- `localPrefix` The effective `localPrefix` +- `prefix` If `config.get('global')` is true, then `globalPrefix`, + otherwise `localPrefix` +- `home` The user's home directory, found by looking at `env.HOME` or + calling `os.homedir()`. +- `loaded` A boolean indicating whether or not configs are loaded +- `valid` A getter that returns `true` if all the config objects are valid. + Any data objects that have been modified with `config.set(...)` will be + re-evaluated when `config.valid` is read. + +### `config.load()` + +Load configuration from the various sources of information. + +Returns a `Promise` that resolves when configuration is loaded, and fails +if a fatal error is encountered. + +### `config.find(key)` + +Find the effective place in the configuration levels a given key is set. +Returns one of: `cli`, `env`, `project`, `user`, `global`, `builtin`, or +`default`. + +Returns `null` if the key is not set. + +### `config.get(key, where = 'cli')` + +Load the given key from the config stack. + +### `config.set(key, value, where = 'cli')` + +Set the key to the specified value, at the specified level in the config +stack. + +### `config.delete(key, where = 'cli')` + +Delete the configuration key from the specified level in the config stack. + +### `config.validate(where)` + +Verify that all known configuration options are set to valid values, and +log a warning if they are invalid. + +If `where` is not set, then all config objects are validated. + +Returns `true` if all configs are valid. + +Note that it's usually enough (and more efficient) to just check +`config.valid`, since each data object is marked for re-evaluation on every +`config.set()` operation. + +### `config.save(where)` + +Save the config file specified by the `where` param. Must be one of +`project`, `user`, `global`, `builtin`. diff --git a/node_modules/@npmcli/config/lib/env-replace.js b/node_modules/@npmcli/config/lib/env-replace.js new file mode 100644 index 0000000000000..b08017095f8be --- /dev/null +++ b/node_modules/@npmcli/config/lib/env-replace.js @@ -0,0 +1,14 @@ +// replace any ${ENV} values with the appropriate environ. + +const envExpr = /(\\*)\$\{([^}]+)\}/g + +module.exports = (f, env) => f.replace(envExpr, (orig, esc, name) => { + // consume the escape chars that are relevant. + if (esc.length % 2) + return orig.substr((esc.length + 1) / 2) + + if (undefined === env[name]) + throw new Error('Failed to replace env in config: ' + orig) + + return (esc.substr(esc.length / 2)) + env[name] +}) diff --git a/node_modules/@npmcli/config/lib/index.js b/node_modules/@npmcli/config/lib/index.js new file mode 100644 index 0000000000000..c6a95b14bfd4d --- /dev/null +++ b/node_modules/@npmcli/config/lib/index.js @@ -0,0 +1,744 @@ +// TODO: set the scope config from package.json or explicit cli config +const walkUp = require('walk-up-path') +const ini = require('ini') +const nopt = require('nopt') +const mkdirp = require('mkdirp-infer-owner') + +/* istanbul ignore next */ +const myUid = process.getuid && process.getuid() +/* istanbul ignore next */ +const myGid = process.getgid && process.getgid() + +const { resolve, dirname, join } = require('path') +const { homedir } = require('os') +const { promisify } = require('util') +const fs = require('fs') +const readFile = promisify(fs.readFile) +const writeFile = promisify(fs.writeFile) +const chmod = promisify(fs.chmod) +const chown = promisify(fs.chown) +const unlink = promisify(fs.unlink) +const stat = promisify(fs.stat) + +const hasOwnProperty = (obj, key) => + Object.prototype.hasOwnProperty.call(obj, key) + +// define a custom getter, but turn into a normal prop +// if we set it. otherwise it can't be set on child objects +const settableGetter = (obj, key, get) => { + Object.defineProperty(obj, key, { + get, + set (value) { + Object.defineProperty(obj, key, { + value, + configurable: true, + writable: true, + enumerable: true, + }) + }, + configurable: true, + enumerable: true, + }) +} + +const typeDefs = require('./type-defs.js') +const nerfDart = require('./nerf-dart.js') +const envReplace = require('./env-replace.js') +const parseField = require('./parse-field.js') +const typeDescription = require('./type-description.js') +const setEnvs = require('./set-envs.js') + +// types that can be saved back to +const confFileTypes = new Set([ + 'global', + 'user', + 'project', +]) + +const confTypes = new Set([ + 'default', + 'builtin', + ...confFileTypes, + 'env', + 'cli', +]) + +const _loaded = Symbol('loaded') +const _get = Symbol('get') +const _find = Symbol('find') +const _loadObject = Symbol('loadObject') +const _loadFile = Symbol('loadFile') + +class Config { + static get typeDefs () { + return typeDefs + } + + constructor ({ + types, + shorthands, + defaults, + npmPath, + + // options just to override in tests, mostly + env = process.env, + argv = process.argv, + log = require('./proc-log.js'), + platform = process.platform, + execPath = process.execPath, + cwd = process.cwd(), + }) { + this.npmPath = npmPath + this.types = types + this.shorthands = shorthands + this.defaults = defaults + this.log = log + this.argv = argv + this.env = env + this.execPath = execPath + this.platform = platform + this.cwd = cwd + + // set when we load configs + this.globalPrefix = null + this.localPrefix = null + + // defaults to env.HOME, but will always be *something* + this.home = null + + // set up the prototype chain of config objects + const wheres = [...confTypes] + this.data = new Map() + let parent = null + for (const where of wheres) { + this.data.set(where, parent = new ConfigData(parent)) + } + + this.data.set = () => { + throw new Error('cannot change internal config data structure') + } + this.data.delete = () => { + throw new Error('cannot change internal config data structure') + } + + this.sources = new Map([]) + + this.list = [] + for (const { data } of this.data.values()) { + this.list.unshift(data) + } + Object.freeze(this.list) + + this[_loaded] = false + } + + get loaded () { + return this[_loaded] + } + + get prefix () { + return this[_get]('global') ? this.globalPrefix : this.localPrefix + } + + // return the location where key is found. + find (key) { + if (!this.loaded) + throw new Error('call config.load() before reading values') + return this[_find](key) + } + [_find] (key) { + // have to look in reverse order + const entries = [...this.data.entries()] + for (let i = entries.length - 1; i > -1; i--) { + const [where, { data }] = entries[i] + if (hasOwnProperty(data, key)) + return where + } + return null + } + + get (key, where) { + if (!this.loaded) + throw new Error('call config.load() before reading values') + return this[_get](key, where) + } + // we need to get values sometimes, so use this internal one to do so + // while in the process of loading. + [_get] (key, where = null) { + if (where !== null && !confTypes.has(where)) { + throw new Error('invalid config location param: ' + where) + } + const { data, source } = this.data.get(where || 'cli') + return where === null || hasOwnProperty(data, key) ? data[key] : undefined + } + + set (key, val, where = 'cli') { + if (!this.loaded) + throw new Error('call config.load() before setting values') + if (!confTypes.has(where)) + throw new Error('invalid config location param: ' + where) + this.data.get(where).data[key] = val + + // this is now dirty, the next call to this.valid will have to check it + this.data.get(where)[_valid] = null + } + + delete (key, where = 'cli') { + if (!this.loaded) + throw new Error('call config.load() before deleting values') + if (!confTypes.has(where)) + throw new Error('invalid config location param: ' + where) + delete this.data.get(where).data[key] + } + + async load () { + if (this.loaded) + throw new Error('attempting to load npm config multiple times') + + process.emit('time', 'config:load') + // first load the defaults, which sets the global prefix + process.emit('time', 'config:load:defaults') + this.loadDefaults() + process.emit('timeEnd', 'config:load:defaults') + + // next load the builtin config, as this sets new effective defaults + process.emit('time', 'config:load:builtin') + await this.loadBuiltinConfig() + process.emit('timeEnd', 'config:load:builtin') + + // cli and env are not async, and can set the prefix, relevant to project + process.emit('time', 'config:load:cli') + this.loadCLI() + process.emit('timeEnd', 'config:load:cli') + process.emit('time', 'config:load:env') + this.loadEnv() + process.emit('timeEnd', 'config:load:env') + + // next project config, which can affect userconfig location + process.emit('time', 'config:load:project') + await this.loadProjectConfig() + process.emit('timeEnd', 'config:load:project') + // then user config, which can affect globalconfig location + process.emit('time', 'config:load:user') + await this.loadUserConfig() + process.emit('timeEnd', 'config:load:user') + // last but not least, global config file + process.emit('time', 'config:load:global') + await this.loadGlobalConfig() + process.emit('timeEnd', 'config:load:global') + + // now the extras + process.emit('time', 'config:load:cafile') + await this.loadCAFile() + process.emit('timeEnd', 'config:load:cafile') + + // warn if anything is not valid + process.emit('time', 'config:load:validate') + this.validate() + process.emit('timeEnd', 'config:load:validate') + + // set this before calling setEnvs, so that we don't have to share + // symbols, as that module also does a bunch of get operations + this[_loaded] = true + + process.emit('time', 'config:load:setEnvs') + this.setEnvs() + process.emit('timeEnd', 'config:load:setEnvs') + + process.emit('timeEnd', 'config:load') + } + + loadDefaults () { + this.loadGlobalPrefix() + this.loadHome() + + this[_loadObject]({ + ...this.defaults, + prefix: this.globalPrefix, + }, 'default', 'default values') + + const { data } = this.data.get('default') + + // the metrics-registry defaults to the current resolved value of + // the registry, unless overridden somewhere else. + settableGetter(data, 'metrics-registry', () => this[_get]('registry')) + + // if the prefix is set on cli, env, or userconfig, then we need to + // default the globalconfig file to that location, instead of the default + // global prefix. It's weird that `npm get globalconfig --prefix=/foo` + // returns `/foo/etc/npmrc`, but better to not change it at this point. + settableGetter(data, 'globalconfig', () => + resolve(this[_get]('prefix'), 'etc/npmrc')) + } + + loadHome () { + if (this.env.HOME) + return this.home = this.env.HOME + this.home = homedir() + } + + loadGlobalPrefix () { + if (this.globalPrefix) + throw new Error('cannot load default global prefix more than once') + + if (this.env.PREFIX) { + this.globalPrefix = this.env.PREFIX + } else if (this.platform === 'win32') { + // c:\node\node.exe --> prefix=c:\node\ + this.globalPrefix = dirname(this.execPath) + } else { + // /usr/local/bin/node --> prefix=/usr/local + this.globalPrefix = dirname(dirname(this.execPath)) + + // destdir only is respected on Unix + if (this.env.DESTDIR) + this.globalPrefix = join(this.env.DESTDIR, this.globalPrefix) + } + } + + loadEnv () { + const prefix = 'npm_config_' + const conf = Object.create(null) + for (const [envKey, envVal] of Object.entries(this.env)) { + if (!/^npm_config_/i.test(envKey)) + continue + const key = envKey.substr('npm_config_'.length) + .replace(/(?!^)_/g, '-') // don't replace _ at the start of the key + .toLowerCase() + conf[key] = envVal + } + this[_loadObject](conf, 'env', 'environment') + } + + loadCLI () { + nopt.invalidHandler = (k, val, type) => + this.invalidHandler(k, val, type, 'command line options', 'cli') + const conf = nopt(this.types, this.shorthands, this.argv) + nopt.invalidHandler = null + this.parsedArgv = conf.argv + delete conf.argv + this[_loadObject](conf, 'cli', 'command line options') + } + + get valid () { + for (const [where, {valid}] of this.data.entries()) { + if (valid === false || valid === null && !this.validate(where)) + return false + } + return true + } + + validate (where) { + if (!where) { + let valid = true + for (const [where, obj] of this.data.entries()) { + // no need to validate our defaults, we know they're fine + // cli was already validated when parsed the first time + if (where === 'default' || where === 'builtin' || where === 'cli') + continue + const ret = this.validate(where) + valid = valid && ret + } + return valid + } else { + const obj = this.data.get(where) + obj[_valid] = true + + nopt.invalidHandler = (k, val, type) => + this.invalidHandler(k, val, type, obj.source, where) + + nopt.clean(obj.data, this.types, this.typeDefs) + + nopt.invalidHandler = null + return obj[_valid] + } + } + + invalidHandler (k, val, type, source, where) { + this.log.warn( + 'invalid config', + k + '=' + JSON.stringify(val), + `set in ${source}` + ) + this.data.get(where)[_valid] = false + + if (Array.isArray(type)) { + if (type.indexOf(typeDefs.url.type) !== -1) + type = typeDefs.url.type + else { + /* istanbul ignore if - no actual configs matching this, but + * path types SHOULD be handled this way, like URLs, for the + * same reason */ + if (type.indexOf(typeDefs.path.type) !== -1) + type = typeDefs.path.type + } + } + + const typeDesc = typeDescription(type) + const oneOrMore = typeDesc.indexOf(Array) !== -1 + const mustBe = typeDesc + .filter(m => m !== undefined && m !== Array) + const oneOf = mustBe.length === 1 && oneOrMore ? ' one or more' + : mustBe.length > 1 && oneOrMore ? ' one or more of:' + : mustBe.length > 1 ? ' one of:' + : '' + const msg = 'Must be' + oneOf + const desc = mustBe.length === 1 ? mustBe[0] + : mustBe.filter(m => m !== Array) + .map(n => typeof n === 'string' ? n : JSON.stringify(n)) + .join(', ') + this.log.warn('invalid config', msg, desc) + } + + [_loadObject] (obj, where, source, er = null) { + const conf = this.data.get(where) + if (conf.source) { + const m = `double-loading "${where}" configs from ${source}, ` + + `previously loaded from ${conf.source}` + throw new Error(m) + } + + if (this.sources.has(source)) { + const m = `double-loading config "${source}" as "${where}", ` + + `previously loaded as "${this.sources.get(source)}"` + throw new Error(m) + } + + conf.source = source + this.sources.set(source, where) + if (er) { + conf.loadError = er + if (er.code !== 'ENOENT') + this.log.verbose('config', `error loading ${where} config`, er) + } else { + conf.raw = obj + for (const [key, value] of Object.entries(obj)) { + const k = envReplace(key, this.env) + const v = this.parseField(value, k) + conf.data[k] = v + } + } + } + + // Parse a field, coercing it to the best type available. + parseField (f, key, listElement = false) { + return parseField(f, key, this, listElement) + } + + async [_loadFile] (file, type) { + process.emit('time', 'config:load:file:' + file) + // only catch the error from readFile, not from the loadObject call + await readFile(file, 'utf8').then( + data => this[_loadObject](ini.parse(data), type, file), + er => this[_loadObject](null, type, file, er) + ) + process.emit('timeEnd', 'config:load:file:' + file) + } + + loadBuiltinConfig () { + return this[_loadFile](resolve(this.npmPath, 'npmrc'), 'builtin') + } + + async loadProjectConfig () { + // the localPrefix can be set by the CLI config, but otherwise is + // found by walking up the folder tree + await this.loadLocalPrefix() + const projectFile = resolve(this.localPrefix, '.npmrc') + // if we're in the ~ directory, and there happens to be a node_modules + // folder (which is not TOO uncommon, it turns out), then we can end + // up loading the "project" config where the "userconfig" will be, + // which causes some calamaties. So, we only load project config if + // it doesn't match what the userconfig will be. + if (projectFile !== this[_get]('userconfig')) + return this[_loadFile](projectFile, 'project') + else { + this.data.get('project').source = '(same as "user" config, ignored)' + this.sources.set(this.data.get('project').source, 'project') + } + } + + async loadLocalPrefix () { + const cliPrefix = this[_get]('prefix', 'cli') + if (cliPrefix) { + this.localPrefix = cliPrefix + return + } + + for (const p of walkUp(this.cwd)) { + // walk up until we have a nm dir or a pj file + const hasAny = (await Promise.all([ + stat(resolve(p, 'node_modules')) + .then(st => st.isDirectory()) + .catch(() => false), + stat(resolve(p, 'package.json')) + .then(st => st.isFile()) + .catch(() => false), + ])).some(is => is) + if (hasAny) { + this.localPrefix = p + return + } + } + + this.localPrefix = this.cwd + } + + loadUserConfig () { + return this[_loadFile](this[_get]('userconfig'), 'user') + } + + loadGlobalConfig () { + return this[_loadFile](this[_get]('globalconfig'), 'global') + } + + async save (where) { + if (!this.loaded) + throw new Error('call config.load() before saving') + if (!confFileTypes.has(where)) + throw new Error('invalid config location param: ' + where) + const conf = this.data.get(where) + conf[_raw] = { ...conf.data } + conf[_loadError] = null + + // upgrade auth configs to more secure variants before saving + if (where === 'user') { + const reg = this.get('registry') + const creds = this.getCredentialsByURI(reg) + try { this.setCredentialsByURI(reg, creds) } catch (_) {} + } + + const iniData = ini.stringify(conf.data).trim() + '\n' + if (!iniData.trim()) { + // ignore the unlink error (eg, if file doesn't exist) + await unlink(conf.source).catch(er => {}) + return + } + const dir = dirname(conf.source) + await mkdirp(dir) + await writeFile(conf.source, iniData, 'utf8') + // don't leave a root-owned config file lying around + /* istanbul ignore if - this is best-effort and a pita to test */ + if (myUid === 0) { + const st = await stat(dir).catch(() => null) + if (st && (st.uid !== myUid || st.gid !== myGid)) + await chown(conf.source, st.uid, st.gid).catch(() => {}) + } + const mode = where === 'user' ? 0o600 : 0o666 + await chmod(conf.source, mode) + } + + clearCredentialsByURI (uri) { + const nerfed = nerfDart(uri) + const def = nerfDart(this.get('registry')) + if (def === nerfed) { + this.delete(`-authtoken`, 'user') + this.delete(`_authToken`, 'user') + this.delete(`_auth`, 'user') + this.delete(`_password`, 'user') + this.delete(`username`, 'user') + this.delete(`email`, 'user') + } + this.delete(`${nerfed}:-authtoken`, 'user') + this.delete(`${nerfed}:_authToken`, 'user') + this.delete(`${nerfed}:_auth`, 'user') + this.delete(`${nerfed}:_password`, 'user') + this.delete(`${nerfed}:username`, 'user') + this.delete(`${nerfed}:email`, 'user') + } + + setCredentialsByURI (uri, { token, username, password, email, alwaysAuth }) { + const nerfed = nerfDart(uri) + const def = nerfDart(this.get('registry')) + + if (def === nerfed) { + // remove old style auth info not limited to a single registry + this.delete('_password', 'user') + this.delete('username', 'user') + this.delete('email', 'user') + this.delete('_auth', 'user') + this.delete('_authtoken', 'user') + this.delete('_authToken', 'user') + } + + this.delete(`${nerfed}:-authtoken`) + if (token) { + this.set(`${nerfed}:_authToken`, token, 'user') + this.delete(`${nerfed}:_password`, 'user') + this.delete(`${nerfed}:username`, 'user') + this.delete(`${nerfed}:email`, 'user') + this.delete(`${nerfed}:always-auth`, 'user') + } else if (username || password || email) { + if (!username) + throw new Error('must include username') + if (!password) + throw new Error('must include password') + if (!email) + throw new Error('must include email') + this.delete(`${nerfed}:_authToken`, 'user') + this.set(`${nerfed}:username`, username, 'user') + // note: not encrypted, no idea why we bothered to do this, but oh well + // protects against shoulder-hacks if password is memorable, I guess? + const encoded = Buffer.from(password, 'utf8').toString('base64') + this.set(`${nerfed}:_password`, encoded, 'user') + this.set(`${nerfed}:email`, email, 'user') + if (alwaysAuth !== undefined) + this.set(`${nerfed}:always-auth`, alwaysAuth, 'user') + else + this.delete(`${nerfed}:always-auth`, 'user') + } else { + throw new Error('No credentials to set.') + } + } + + // this has to be a bit more complicated to support legacy data of all forms + getCredentialsByURI (uri) { + const nerfed = nerfDart(uri) + const creds = {} + + // you can set always-auth for a single registry, or as a default + const alwaysAuthReg = this[_get](`${nerfed}:always-auth`) + if (alwaysAuthReg !== undefined) + creds.alwaysAuth = !!alwaysAuthReg + else + creds.alwaysAuth = this[_get]('always-auth') + + const email = this[_get](`${nerfed}:email`) || this[_get]('email') + if (email) + creds.email = email + + const tokenReg = this[_get](`${nerfed}:_authToken`) || + this[_get](`${nerfed}:-authtoken`) || + nerfed === nerfDart(this[_get]('registry')) && this[_get]('_authToken') + + if (tokenReg) { + creds.token = tokenReg + return creds + } + + const userReg = this[_get](`${nerfed}:username`) + const passReg = this[_get](`${nerfed}:_password`) + if (userReg && passReg) { + creds.username = userReg + creds.password = Buffer.from(passReg, 'base64').toString('utf8') + const auth = `${creds.username}:${creds.password}` + creds.auth = Buffer.from(auth, 'utf8').toString('base64') + return creds + } + + // at this point, we can only use the values if the URI is the + // default registry. + const defaultNerf = nerfDart(this[_get]('registry')) + if (nerfed !== defaultNerf) + return creds + + const userDef = this[_get]('username') + const passDef = this[_get]('_password') + if (userDef && passDef) { + creds.username = userDef + creds.password = Buffer.from(passDef, 'base64').toString('utf8') + const auth = `${creds.username}:${creds.password}` + creds.auth = Buffer.from(auth, 'utf8').toString('base64') + return creds + } + + // Handle the old-style _auth= style for the default + // registry, if set. + const auth = this[_get]('_auth') + if (!auth) + return creds + + const authDecode = Buffer.from(auth, 'base64').toString('utf8') + const authSplit = authDecode.split(':') + creds.username = authSplit.shift() + creds.password = authSplit.join(':') + creds.auth = auth + return creds + } + + async loadCAFile () { + const where = this[_find]('cafile') + + /* istanbul ignore if - it'll always be set in the defaults */ + if (!where) + return + + const cafile = this[_get]('cafile', where) + const ca = this[_get]('ca', where) + + // if you have a ca, or cafile is set to null, then nothing to do here. + if (ca || !cafile) + return + + const raw = await readFile(cafile, 'utf8').catch(er => { + if (er.code !== 'ENOENT') + throw er + }) + if (!raw) + return + + const delim = '-----END CERTIFICATE-----' + const output = raw.replace(/\r\n/g, '\n').split(delim) + .filter(section => section.trim()) + .map(section => section.trimLeft() + delim) + + // make it non-enumerable so we don't save it back by accident + const { data } = this.data.get(where) + Object.defineProperty(data, 'ca', { + value: output, + enumerable: false, + configurable: true, + writable: true, + }) + } + + // set up the environment object we have with npm_config_* environs + // for all configs that are different from their default values, and + // set EDITOR and HOME. + setEnvs () { setEnvs(this) } +} + +const _data = Symbol('data') +const _raw = Symbol('raw') +const _loadError = Symbol('loadError') +const _source = Symbol('source') +const _valid = Symbol('valid') +class ConfigData { + constructor (parent) { + this[_data] = Object.create(parent && parent.data) + this[_source] = null + this[_loadError] = null + this[_raw] = null + this[_valid] = true + } + + get data () { + return this[_data] + } + + get valid () { + return this[_valid] + } + + set source (s) { + if (this[_source]) + throw new Error('cannot set ConfigData source more than once') + this[_source] = s + } + get source () { return this[_source] } + + set loadError (e) { + if (this[_loadError] || this[_raw]) + throw new Error('cannot set ConfigData loadError after load') + this[_loadError] = e + } + get loadError () { return this[_loadError] } + + set raw (r) { + if (this[_raw] || this[_loadError]) + throw new Error('cannot set ConfigData raw after load') + this[_raw] = r + } + get raw () { return this[_raw] } +} + +module.exports = Config diff --git a/node_modules/@npmcli/config/lib/nerf-dart.js b/node_modules/@npmcli/config/lib/nerf-dart.js new file mode 100644 index 0000000000000..d6ae4aa2aa7e2 --- /dev/null +++ b/node_modules/@npmcli/config/lib/nerf-dart.js @@ -0,0 +1,18 @@ +const { URL } = require('url') + +/** + * Maps a URL to an identifier. + * + * Name courtesy schiffertronix media LLC, a New Jersey corporation + * + * @param {String} uri The URL to be nerfed. + * + * @returns {String} A nerfed URL. + */ +module.exports = (url) => { + const parsed = new URL(url) + const from = `${parsed.protocol}//${parsed.host}${parsed.pathname}` + const rel = new URL('.', from) + const res = `//${rel.host}${rel.pathname}` + return res +} diff --git a/node_modules/@npmcli/config/lib/parse-field.js b/node_modules/@npmcli/config/lib/parse-field.js new file mode 100644 index 0000000000000..216295a5f81d8 --- /dev/null +++ b/node_modules/@npmcli/config/lib/parse-field.js @@ -0,0 +1,75 @@ +// Parse a field, coercing it to the best type available. +const typeDefs = require('./type-defs.js') +const envReplace = require('./env-replace.js') +const { resolve } = require('path') + +const { parse: umaskParse } = require('./umask.js') + +const parseField = (f, key, opts, listElement = false) => { + if (typeof f !== 'string' && !Array.isArray(f)) + return f + + const { platform, types, log, home, env } = opts + + // type can be array or a single thing. coerce to array. + const typeList = new Set([].concat(types[key])) + const isPath = typeList.has(typeDefs.path.type) + const isBool = typeList.has(typeDefs.Boolean.type) + const isString = typeList.has(typeDefs.String.type) + const isUmask = typeList.has(typeDefs.Umask.type) + const isNumber = typeList.has(typeDefs.Number.type) + const isList = !listElement && typeList.has(Array) + + if (Array.isArray(f)) + return !isList ? f : f.map(field => parseField(field, key, opts, true)) + + // now we know it's a string + f = f.trim() + + // list types get put in the environment separated by double-\n + // usually a single \n would suffice, but ca/cert configs can contain + // line breaks and multiple entries. + if (isList) + return parseField(f.split('\n\n'), key, opts) + + // --foo is like --foo=true for boolean types + if (isBool && !isString && f === '') + return true + + // string types can be the string 'true', 'false', etc. + // otherwise, parse these values out + if (!isString) { + switch (f) { + case 'true': return true + case 'false': return false + case 'null': return null + case 'undefined': return undefined + } + } + + f = envReplace(f, env) + + if (isPath) { + const homePattern = platform === 'win32' ? /^~(\/|\\)/ : /^~\// + if (homePattern.test(f) && home) + f = resolve(home, f.substr(2)) + else + f = resolve(f) + } + + if (isUmask) { + try { + return umaskParse(f) + } catch (er) { + // let it warn later when we validate + return f + } + } + + if (isNumber && !isNaN(f)) + f = +f + + return f +} + +module.exports = parseField diff --git a/node_modules/@npmcli/config/lib/proc-log.js b/node_modules/@npmcli/config/lib/proc-log.js new file mode 100644 index 0000000000000..0492a26180756 --- /dev/null +++ b/node_modules/@npmcli/config/lib/proc-log.js @@ -0,0 +1,4 @@ +const log = (level) => (...args) => process.emit('log', level, ...args) +for (const level of ['silly', 'verbose', 'warn', 'error']) { + exports[level] = log(level) +} diff --git a/node_modules/@npmcli/config/lib/set-envs.js b/node_modules/@npmcli/config/lib/set-envs.js new file mode 100644 index 0000000000000..d41b044ed9298 --- /dev/null +++ b/node_modules/@npmcli/config/lib/set-envs.js @@ -0,0 +1,99 @@ +// Set environment variables for any non-default configs, +// so that they're already there when we run lifecycle scripts. +// +// See https://github.com/npm/rfcs/pull/90 + +// Return the env key if this is a thing that belongs in the env. +// Ie, if the key isn't a @scope, //nerf.dart, or _private, +// and the value is a string or array. Otherwise return false. +const envKey = (key, val) => { + return !/^[/@_]/.test(key) && + (typeof envVal(val) === 'string') && + `npm_config_${key.replace(/-/g, '_').toLowerCase()}` +} + +const envVal = val => Array.isArray(val) ? val.map(v => envVal(v)).join('\n\n') + : val === null || val === undefined || val === false ? '' + : typeof val === 'object' ? null + : String(val) + +const sameConfigValue = (def, val) => + !Array.isArray(val) || !Array.isArray(def) ? def === val + : sameArrayValue(def, val) + +const sameArrayValue = (def, val) => { + if (def.length !== val.length) + return false + + for (let i = 0; i < def.length; i++) { + /* istanbul ignore next - there are no array configs where the default + * is not an empty array, so this loop is a no-op, but it's the correct + * thing to do if we ever DO add a config like that. */ + if (def[i] !== val[i]) + return false + } + return true +} + +const setEnv = (env, rawKey, rawVal) => { + const val = envVal(rawVal) + const key = envKey(rawKey, val) + if (key && val !== null) + env[key] = val +} + +const setEnvs = (config) => { + // This ensures that all npm config values that are not the defaults are + // shared appropriately with child processes, without false positives. + const { + globalPrefix, + platform, + env, + defaults, + list: [cliConf, envConf], + } = config + + const { DESTDIR } = env + if (platform !== 'win32' && DESTDIR && globalPrefix.indexOf(DESTDIR) === 0) + env.PREFIX = globalPrefix.substr(DESTDIR.length) + else + env.PREFIX = globalPrefix + + // if the key is the default value, + // if the environ is NOT the default value, + // set the environ + // else skip it, it's fine + // if the key is NOT the default value, + // if the env is setting it, then leave it (already set) + // otherwise, set the env + const cliSet = new Set(Object.keys(cliConf)) + const envSet = new Set(Object.keys(envConf)) + for (const key in cliConf) { + if (sameConfigValue(defaults[key], cliConf[key])) { + // config is the default, if the env thought different, then we + // have to set it BACK to the default in the environment. + if (!sameConfigValue(envConf[key], cliConf[key])) + setEnv(env, key, cliConf[key]) + } else { + // config is not the default. if the env wasn't the one to set + // it that way, then we have to put it in the env + if (!(envSet.has(key) && !cliSet.has(key))) + setEnv(env, key, cliConf[key]) + } + } + + // also set some other common nice envs that we want to rely on + env.HOME = config.home + if (cliConf.editor) + env.EDITOR = cliConf.editor + + // note: this doesn't afect the *current* node process, of course, since + // it's already started, but it does affect the options passed to scripts. + if (cliConf['node-options']) + env.NODE_OPTIONS = cliConf['node-options'] + + env.npm_execpath = require.main.filename + env.npm_node_execpath = config.execPath +} + +module.exports = setEnvs diff --git a/node_modules/@npmcli/config/lib/type-defs.js b/node_modules/@npmcli/config/lib/type-defs.js new file mode 100644 index 0000000000000..07703206c5743 --- /dev/null +++ b/node_modules/@npmcli/config/lib/type-defs.js @@ -0,0 +1,49 @@ +const nopt = require('nopt') + +const { Umask, validate: validateUmask } = require('./umask.js') + +const semver = require('semver') +const validateSemver = (data, k, val) => { + const valid = semver.valid(val) + if (!valid) + return false + data[k] = valid +} + +// add descriptions so we can validate more usefully +module.exports = { + ...nopt.typeDefs, + semver: { + type: semver, + validate: validateSemver, + description: 'full valid SemVer string', + }, + Umask: { + type: Umask, + validate: validateUmask, + description: 'octal number in range 0o000..0o777 (0..511)', + }, + url: { + ...nopt.typeDefs.url, + description: 'full url with "http://"', + }, + path: { + ...nopt.typeDefs.path, + description: 'valid filesystem path', + }, + Number: { + ...nopt.typeDefs.Number, + description: 'numeric value', + }, + Boolean: { + ...nopt.typeDefs.Boolean, + description: 'boolean value (true or false)', + }, + Date: { + ...nopt.typeDefs.Date, + description: 'valid Date string', + }, +} + +// TODO: make nopt less of a global beast so this kludge isn't necessary +nopt.typeDefs = module.exports diff --git a/node_modules/@npmcli/config/lib/type-description.js b/node_modules/@npmcli/config/lib/type-description.js new file mode 100644 index 0000000000000..828a747db4aac --- /dev/null +++ b/node_modules/@npmcli/config/lib/type-description.js @@ -0,0 +1,18 @@ +// return the description of the valid values of a field +// returns a string for one thing, or an array of descriptions +const typeDefs = require('./type-defs.js') +const typeDescription = t => { + if (!t || typeof t !== 'function' && typeof t !== 'object') + return t + + if (Array.isArray(t)) + return t.map(t => typeDescription(t)) + + for (const { type, description } of Object.values(typeDefs)) { + if (type === t) + return description || type + } + + return t +} +module.exports = t => [].concat(typeDescription(t)).filter(t => t !== undefined) diff --git a/node_modules/@npmcli/config/lib/umask.js b/node_modules/@npmcli/config/lib/umask.js new file mode 100644 index 0000000000000..b445c6fca95bf --- /dev/null +++ b/node_modules/@npmcli/config/lib/umask.js @@ -0,0 +1,28 @@ +class Umask {} +const parse = val => { + if (typeof val === 'string') { + if (/^0o?[0-7]+$/.test(val)) + return parseInt(val.replace(/^0o?/, ''), 8) + else if (/^[1-9][0-9]*$/.test(val)) + return parseInt(val, 10) + else + throw new Error(`invalid umask value: ${val}`) + } + if (typeof val !== 'number') + throw new Error(`invalid umask value: ${val}`) + val = Math.floor(val) + if (val < 0 || val > 511) + throw new Error(`invalid umask value: ${val}`) + return val +} + +const validate = (data, k, val) => { + try { + data[k] = parse(val) + return true + } catch (er) { + return false + } +} + +module.exports = { Umask, parse, validate } diff --git a/node_modules/@npmcli/config/package.json b/node_modules/@npmcli/config/package.json new file mode 100644 index 0000000000000..c542b532b7195 --- /dev/null +++ b/node_modules/@npmcli/config/package.json @@ -0,0 +1,38 @@ +{ + "name": "@npmcli/config", + "version": "1.1.4", + "files": [ + "lib" + ], + "main": "lib/index.js", + "description": "Configuration management for the npm cli", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/npmconf" + }, + "author": "Isaac Z. Schlueter (https://izs.me)", + "license": "ISC", + "scripts": { + "test": "tap", + "snap": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags" + }, + "tap": { + "check-coverage": true, + "coverage-map": "map.js" + }, + "devDependencies": { + "tap": "^14.10.8" + }, + "dependencies": { + "walk-up-path": "^1.0.0", + "ini": "^1.3.5", + "nopt": "^5.0.0", + "mkdirp-infer-owner": "^2.0.0" + }, + "engines": { + "node": ">=10" + } +} diff --git a/node_modules/node-gyp/node_modules/.bin/nopt b/node_modules/node-gyp/node_modules/.bin/nopt new file mode 120000 index 0000000000000..6b6566ea7febb --- /dev/null +++ b/node_modules/node-gyp/node_modules/.bin/nopt @@ -0,0 +1 @@ +../nopt/bin/nopt.js \ No newline at end of file diff --git a/node_modules/node-gyp/node_modules/nopt/CHANGELOG.md b/node_modules/node-gyp/node_modules/nopt/CHANGELOG.md new file mode 100644 index 0000000000000..82a09fb4bf809 --- /dev/null +++ b/node_modules/node-gyp/node_modules/nopt/CHANGELOG.md @@ -0,0 +1,58 @@ +### v4.0.1 (2016-12-14) + +#### WHOOPS + +* [`fb9b1ce`](https://github.com/npm/nopt/commit/fb9b1ce57b3c69b4f7819015be87719204f77ef6) + Merged so many patches at once that the code fencing + ([@adius](https://github.com/adius)) added got broken. Sorry, + ([@adius](https://github.com/adius))! + ([@othiym23](https://github.com/othiym23)) + +### v4.0.0 (2016-12-13) + +#### BREAKING CHANGES + +* [`651d447`](https://github.com/npm/nopt/commit/651d4473946096d341a480bbe56793de3fc706aa) + When parsing String-typed arguments, if the next value is `""`, don't simply + swallow it. ([@samjonester](https://github.com/samjonester)) + +#### PERFORMANCE TWEAKS + +* [`3370ce8`](https://github.com/npm/nopt/commit/3370ce87a7618ba228883861db84ddbcdff252a9) + Simplify initialization. ([@elidoran](https://github.com/elidoran)) +* [`356e58e`](https://github.com/npm/nopt/commit/356e58e3b3b431a4b1af7fd7bdee44c2c0526a09) + Store `Array.isArray(types[arg])` for reuse. + ([@elidoran](https://github.com/elidoran)) +* [`0d95e90`](https://github.com/npm/nopt/commit/0d95e90515844f266015b56d2c80b94e5d14a07e) + Interpret single-item type arrays as a single type. + ([@samjonester](https://github.com/samjonester)) +* [`07c69d3`](https://github.com/npm/nopt/commit/07c69d38b5186450941fbb505550becb78a0e925) + Simplify key-value extraction. ([@elidoran](https://github.com/elidoran)) +* [`39b6e5c`](https://github.com/npm/nopt/commit/39b6e5c65ac47f60cd43a1fbeece5cd4c834c254) + Only call `Date.parse(val)` once. ([@elidoran](https://github.com/elidoran)) +* [`934943d`](https://github.com/npm/nopt/commit/934943dffecb55123a2b15959fe2a359319a5dbd) + Use `osenv.home()` to find a user's home directory instead of assuming it's + always `$HOME`. ([@othiym23](https://github.com/othiym23)) + +#### TEST & CI IMPROVEMENTS + +* [`326ffff`](https://github.com/npm/nopt/commit/326ffff7f78a00bcd316adecf69075f8a8093619) + Fix `/tmp` test to work on Windows. + ([@elidoran](https://github.com/elidoran)) +* [`c89d31a`](https://github.com/npm/nopt/commit/c89d31a49d14f2238bc6672db08da697bbc57f1b) + Only run Windows tests on Windows, only run Unix tests on a Unix. + ([@elidoran](https://github.com/elidoran)) +* [`affd3d1`](https://github.com/npm/nopt/commit/affd3d1d0addffa93006397b2013b18447339366) + Refresh Travis to run the tests against the currently-supported batch of npm + versions. ([@helio](https://github.com/helio)-frota) +* [`55f9449`](https://github.com/npm/nopt/commit/55f94497d163ed4d16dd55fd6c4fb95cc440e66d) + `tap@8.0.1` ([@othiym23](https://github.com/othiym23)) + +#### DOC TWEAKS + +* [`5271229`](https://github.com/npm/nopt/commit/5271229ee7c810217dd51616c086f5d9ab224581) + Use JavaScript code block for syntax highlighting. + ([@adius](https://github.com/adius)) +* [`c0d156f`](https://github.com/npm/nopt/commit/c0d156f229f9994c5dfcec4a8886eceff7a07682) + The code sample in the README had `many2: [ oneThing ]`, and now it has + `many2: [ two, things ]`. ([@silkentrance](https://github.com/silkentrance)) diff --git a/node_modules/node-gyp/node_modules/nopt/LICENSE b/node_modules/node-gyp/node_modules/nopt/LICENSE new file mode 100644 index 0000000000000..19129e315fe59 --- /dev/null +++ b/node_modules/node-gyp/node_modules/nopt/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/node-gyp/node_modules/nopt/README.md b/node_modules/node-gyp/node_modules/nopt/README.md new file mode 100644 index 0000000000000..a99531c04655f --- /dev/null +++ b/node_modules/node-gyp/node_modules/nopt/README.md @@ -0,0 +1,213 @@ +If you want to write an option parser, and have it be good, there are +two ways to do it. The Right Way, and the Wrong Way. + +The Wrong Way is to sit down and write an option parser. We've all done +that. + +The Right Way is to write some complex configurable program with so many +options that you hit the limit of your frustration just trying to +manage them all, and defer it with duct-tape solutions until you see +exactly to the core of the problem, and finally snap and write an +awesome option parser. + +If you want to write an option parser, don't write an option parser. +Write a package manager, or a source control system, or a service +restarter, or an operating system. You probably won't end up with a +good one of those, but if you don't give up, and you are relentless and +diligent enough in your procrastination, you may just end up with a very +nice option parser. + +## USAGE + +```javascript +// my-program.js +var nopt = require("nopt") + , Stream = require("stream").Stream + , path = require("path") + , knownOpts = { "foo" : [String, null] + , "bar" : [Stream, Number] + , "baz" : path + , "bloo" : [ "big", "medium", "small" ] + , "flag" : Boolean + , "pick" : Boolean + , "many1" : [String, Array] + , "many2" : [path, Array] + } + , shortHands = { "foofoo" : ["--foo", "Mr. Foo"] + , "b7" : ["--bar", "7"] + , "m" : ["--bloo", "medium"] + , "p" : ["--pick"] + , "f" : ["--flag"] + } + // everything is optional. + // knownOpts and shorthands default to {} + // arg list defaults to process.argv + // slice defaults to 2 + , parsed = nopt(knownOpts, shortHands, process.argv, 2) +console.log(parsed) +``` + +This would give you support for any of the following: + +```console +$ node my-program.js --foo "blerp" --no-flag +{ "foo" : "blerp", "flag" : false } + +$ node my-program.js ---bar 7 --foo "Mr. Hand" --flag +{ bar: 7, foo: "Mr. Hand", flag: true } + +$ node my-program.js --foo "blerp" -f -----p +{ foo: "blerp", flag: true, pick: true } + +$ node my-program.js -fp --foofoo +{ foo: "Mr. Foo", flag: true, pick: true } + +$ node my-program.js --foofoo -- -fp # -- stops the flag parsing. +{ foo: "Mr. Foo", argv: { remain: ["-fp"] } } + +$ node my-program.js --blatzk -fp # unknown opts are ok. +{ blatzk: true, flag: true, pick: true } + +$ node my-program.js --blatzk=1000 -fp # but you need to use = if they have a value +{ blatzk: 1000, flag: true, pick: true } + +$ node my-program.js --no-blatzk -fp # unless they start with "no-" +{ blatzk: false, flag: true, pick: true } + +$ node my-program.js --baz b/a/z # known paths are resolved. +{ baz: "/Users/isaacs/b/a/z" } + +# if Array is one of the types, then it can take many +# values, and will always be an array. The other types provided +# specify what types are allowed in the list. + +$ node my-program.js --many1 5 --many1 null --many1 foo +{ many1: ["5", "null", "foo"] } + +$ node my-program.js --many2 foo --many2 bar +{ many2: ["/path/to/foo", "path/to/bar"] } +``` + +Read the tests at the bottom of `lib/nopt.js` for more examples of +what this puppy can do. + +## Types + +The following types are supported, and defined on `nopt.typeDefs` + +* String: A normal string. No parsing is done. +* path: A file system path. Gets resolved against cwd if not absolute. +* url: A url. If it doesn't parse, it isn't accepted. +* Number: Must be numeric. +* Date: Must parse as a date. If it does, and `Date` is one of the options, + then it will return a Date object, not a string. +* Boolean: Must be either `true` or `false`. If an option is a boolean, + then it does not need a value, and its presence will imply `true` as + the value. To negate boolean flags, do `--no-whatever` or `--whatever + false` +* NaN: Means that the option is strictly not allowed. Any value will + fail. +* Stream: An object matching the "Stream" class in node. Valuable + for use when validating programmatically. (npm uses this to let you + supply any WriteStream on the `outfd` and `logfd` config options.) +* Array: If `Array` is specified as one of the types, then the value + will be parsed as a list of options. This means that multiple values + can be specified, and that the value will always be an array. + +If a type is an array of values not on this list, then those are +considered valid values. For instance, in the example above, the +`--bloo` option can only be one of `"big"`, `"medium"`, or `"small"`, +and any other value will be rejected. + +When parsing unknown fields, `"true"`, `"false"`, and `"null"` will be +interpreted as their JavaScript equivalents. + +You can also mix types and values, or multiple types, in a list. For +instance `{ blah: [Number, null] }` would allow a value to be set to +either a Number or null. When types are ordered, this implies a +preference, and the first type that can be used to properly interpret +the value will be used. + +To define a new type, add it to `nopt.typeDefs`. Each item in that +hash is an object with a `type` member and a `validate` method. The +`type` member is an object that matches what goes in the type list. The +`validate` method is a function that gets called with `validate(data, +key, val)`. Validate methods should assign `data[key]` to the valid +value of `val` if it can be handled properly, or return boolean +`false` if it cannot. + +You can also call `nopt.clean(data, types, typeDefs)` to clean up a +config object and remove its invalid properties. + +## Error Handling + +By default, nopt outputs a warning to standard error when invalid values for +known options are found. You can change this behavior by assigning a method +to `nopt.invalidHandler`. This method will be called with +the offending `nopt.invalidHandler(key, val, types)`. + +If no `nopt.invalidHandler` is assigned, then it will console.error +its whining. If it is assigned to boolean `false` then the warning is +suppressed. + +## Abbreviations + +Yes, they are supported. If you define options like this: + +```javascript +{ "foolhardyelephants" : Boolean +, "pileofmonkeys" : Boolean } +``` + +Then this will work: + +```bash +node program.js --foolhar --pil +node program.js --no-f --pileofmon +# etc. +``` + +## Shorthands + +Shorthands are a hash of shorter option names to a snippet of args that +they expand to. + +If multiple one-character shorthands are all combined, and the +combination does not unambiguously match any other option or shorthand, +then they will be broken up into their constituent parts. For example: + +```json +{ "s" : ["--loglevel", "silent"] +, "g" : "--global" +, "f" : "--force" +, "p" : "--parseable" +, "l" : "--long" +} +``` + +```bash +npm ls -sgflp +# just like doing this: +npm ls --loglevel silent --global --force --long --parseable +``` + +## The Rest of the args + +The config object returned by nopt is given a special member called +`argv`, which is an object with the following fields: + +* `remain`: The remaining args after all the parsing has occurred. +* `original`: The args as they originally appeared. +* `cooked`: The args after flags and shorthands are expanded. + +## Slicing + +Node programs are called with more or less the exact argv as it appears +in C land, after the v8 and node-specific options have been plucked off. +As such, `argv[0]` is always `node` and `argv[1]` is always the +JavaScript program being run. + +That's usually not very useful to you. So they're sliced off by +default. If you want them, then you can pass in `0` as the last +argument, or any other number that you'd like to slice off the start of +the list. diff --git a/node_modules/node-gyp/node_modules/nopt/bin/nopt.js b/node_modules/node-gyp/node_modules/nopt/bin/nopt.js new file mode 100755 index 0000000000000..3232d4c570fdc --- /dev/null +++ b/node_modules/node-gyp/node_modules/nopt/bin/nopt.js @@ -0,0 +1,54 @@ +#!/usr/bin/env node +var nopt = require("../lib/nopt") + , path = require("path") + , types = { num: Number + , bool: Boolean + , help: Boolean + , list: Array + , "num-list": [Number, Array] + , "str-list": [String, Array] + , "bool-list": [Boolean, Array] + , str: String + , clear: Boolean + , config: Boolean + , length: Number + , file: path + } + , shorthands = { s: [ "--str", "astring" ] + , b: [ "--bool" ] + , nb: [ "--no-bool" ] + , tft: [ "--bool-list", "--no-bool-list", "--bool-list", "true" ] + , "?": ["--help"] + , h: ["--help"] + , H: ["--help"] + , n: [ "--num", "125" ] + , c: ["--config"] + , l: ["--length"] + , f: ["--file"] + } + , parsed = nopt( types + , shorthands + , process.argv + , 2 ) + +console.log("parsed", parsed) + +if (parsed.help) { + console.log("") + console.log("nopt cli tester") + console.log("") + console.log("types") + console.log(Object.keys(types).map(function M (t) { + var type = types[t] + if (Array.isArray(type)) { + return [t, type.map(function (type) { return type.name })] + } + return [t, type && type.name] + }).reduce(function (s, i) { + s[i[0]] = i[1] + return s + }, {})) + console.log("") + console.log("shorthands") + console.log(shorthands) +} diff --git a/node_modules/node-gyp/node_modules/nopt/lib/nopt.js b/node_modules/node-gyp/node_modules/nopt/lib/nopt.js new file mode 100644 index 0000000000000..0ec5753d0cb89 --- /dev/null +++ b/node_modules/node-gyp/node_modules/nopt/lib/nopt.js @@ -0,0 +1,441 @@ +// info about each config option. + +var debug = process.env.DEBUG_NOPT || process.env.NOPT_DEBUG + ? function () { console.error.apply(console, arguments) } + : function () {} + +var url = require("url") + , path = require("path") + , Stream = require("stream").Stream + , abbrev = require("abbrev") + , osenv = require("osenv") + +module.exports = exports = nopt +exports.clean = clean + +exports.typeDefs = + { String : { type: String, validate: validateString } + , Boolean : { type: Boolean, validate: validateBoolean } + , url : { type: url, validate: validateUrl } + , Number : { type: Number, validate: validateNumber } + , path : { type: path, validate: validatePath } + , Stream : { type: Stream, validate: validateStream } + , Date : { type: Date, validate: validateDate } + } + +function nopt (types, shorthands, args, slice) { + args = args || process.argv + types = types || {} + shorthands = shorthands || {} + if (typeof slice !== "number") slice = 2 + + debug(types, shorthands, args, slice) + + args = args.slice(slice) + var data = {} + , key + , argv = { + remain: [], + cooked: args, + original: args.slice(0) + } + + parse(args, data, argv.remain, types, shorthands) + // now data is full + clean(data, types, exports.typeDefs) + data.argv = argv + Object.defineProperty(data.argv, 'toString', { value: function () { + return this.original.map(JSON.stringify).join(" ") + }, enumerable: false }) + return data +} + +function clean (data, types, typeDefs) { + typeDefs = typeDefs || exports.typeDefs + var remove = {} + , typeDefault = [false, true, null, String, Array] + + Object.keys(data).forEach(function (k) { + if (k === "argv") return + var val = data[k] + , isArray = Array.isArray(val) + , type = types[k] + if (!isArray) val = [val] + if (!type) type = typeDefault + if (type === Array) type = typeDefault.concat(Array) + if (!Array.isArray(type)) type = [type] + + debug("val=%j", val) + debug("types=", type) + val = val.map(function (val) { + // if it's an unknown value, then parse false/true/null/numbers/dates + if (typeof val === "string") { + debug("string %j", val) + val = val.trim() + if ((val === "null" && ~type.indexOf(null)) + || (val === "true" && + (~type.indexOf(true) || ~type.indexOf(Boolean))) + || (val === "false" && + (~type.indexOf(false) || ~type.indexOf(Boolean)))) { + val = JSON.parse(val) + debug("jsonable %j", val) + } else if (~type.indexOf(Number) && !isNaN(val)) { + debug("convert to number", val) + val = +val + } else if (~type.indexOf(Date) && !isNaN(Date.parse(val))) { + debug("convert to date", val) + val = new Date(val) + } + } + + if (!types.hasOwnProperty(k)) { + return val + } + + // allow `--no-blah` to set 'blah' to null if null is allowed + if (val === false && ~type.indexOf(null) && + !(~type.indexOf(false) || ~type.indexOf(Boolean))) { + val = null + } + + var d = {} + d[k] = val + debug("prevalidated val", d, val, types[k]) + if (!validate(d, k, val, types[k], typeDefs)) { + if (exports.invalidHandler) { + exports.invalidHandler(k, val, types[k], data) + } else if (exports.invalidHandler !== false) { + debug("invalid: "+k+"="+val, types[k]) + } + return remove + } + debug("validated val", d, val, types[k]) + return d[k] + }).filter(function (val) { return val !== remove }) + + // if we allow Array specifically, then an empty array is how we + // express 'no value here', not null. Allow it. + if (!val.length && type.indexOf(Array) === -1) { + debug('VAL HAS NO LENGTH, DELETE IT', val, k, type.indexOf(Array)) + delete data[k] + } + else if (isArray) { + debug(isArray, data[k], val) + data[k] = val + } else data[k] = val[0] + + debug("k=%s val=%j", k, val, data[k]) + }) +} + +function validateString (data, k, val) { + data[k] = String(val) +} + +function validatePath (data, k, val) { + if (val === true) return false + if (val === null) return true + + val = String(val) + + var isWin = process.platform === 'win32' + , homePattern = isWin ? /^~(\/|\\)/ : /^~\// + , home = osenv.home() + + if (home && val.match(homePattern)) { + data[k] = path.resolve(home, val.substr(2)) + } else { + data[k] = path.resolve(val) + } + return true +} + +function validateNumber (data, k, val) { + debug("validate Number %j %j %j", k, val, isNaN(val)) + if (isNaN(val)) return false + data[k] = +val +} + +function validateDate (data, k, val) { + var s = Date.parse(val) + debug("validate Date %j %j %j", k, val, s) + if (isNaN(s)) return false + data[k] = new Date(val) +} + +function validateBoolean (data, k, val) { + if (val instanceof Boolean) val = val.valueOf() + else if (typeof val === "string") { + if (!isNaN(val)) val = !!(+val) + else if (val === "null" || val === "false") val = false + else val = true + } else val = !!val + data[k] = val +} + +function validateUrl (data, k, val) { + val = url.parse(String(val)) + if (!val.host) return false + data[k] = val.href +} + +function validateStream (data, k, val) { + if (!(val instanceof Stream)) return false + data[k] = val +} + +function validate (data, k, val, type, typeDefs) { + // arrays are lists of types. + if (Array.isArray(type)) { + for (var i = 0, l = type.length; i < l; i ++) { + if (type[i] === Array) continue + if (validate(data, k, val, type[i], typeDefs)) return true + } + delete data[k] + return false + } + + // an array of anything? + if (type === Array) return true + + // NaN is poisonous. Means that something is not allowed. + if (type !== type) { + debug("Poison NaN", k, val, type) + delete data[k] + return false + } + + // explicit list of values + if (val === type) { + debug("Explicitly allowed %j", val) + // if (isArray) (data[k] = data[k] || []).push(val) + // else data[k] = val + data[k] = val + return true + } + + // now go through the list of typeDefs, validate against each one. + var ok = false + , types = Object.keys(typeDefs) + for (var i = 0, l = types.length; i < l; i ++) { + debug("test type %j %j %j", k, val, types[i]) + var t = typeDefs[types[i]] + if (t && + ((type && type.name && t.type && t.type.name) ? (type.name === t.type.name) : (type === t.type))) { + var d = {} + ok = false !== t.validate(d, k, val) + val = d[k] + if (ok) { + // if (isArray) (data[k] = data[k] || []).push(val) + // else data[k] = val + data[k] = val + break + } + } + } + debug("OK? %j (%j %j %j)", ok, k, val, types[i]) + + if (!ok) delete data[k] + return ok +} + +function parse (args, data, remain, types, shorthands) { + debug("parse", args, data, remain) + + var key = null + , abbrevs = abbrev(Object.keys(types)) + , shortAbbr = abbrev(Object.keys(shorthands)) + + for (var i = 0; i < args.length; i ++) { + var arg = args[i] + debug("arg", arg) + + if (arg.match(/^-{2,}$/)) { + // done with keys. + // the rest are args. + remain.push.apply(remain, args.slice(i + 1)) + args[i] = "--" + break + } + var hadEq = false + if (arg.charAt(0) === "-" && arg.length > 1) { + var at = arg.indexOf('=') + if (at > -1) { + hadEq = true + var v = arg.substr(at + 1) + arg = arg.substr(0, at) + args.splice(i, 1, arg, v) + } + + // see if it's a shorthand + // if so, splice and back up to re-parse it. + var shRes = resolveShort(arg, shorthands, shortAbbr, abbrevs) + debug("arg=%j shRes=%j", arg, shRes) + if (shRes) { + debug(arg, shRes) + args.splice.apply(args, [i, 1].concat(shRes)) + if (arg !== shRes[0]) { + i -- + continue + } + } + arg = arg.replace(/^-+/, "") + var no = null + while (arg.toLowerCase().indexOf("no-") === 0) { + no = !no + arg = arg.substr(3) + } + + if (abbrevs[arg]) arg = abbrevs[arg] + + var argType = types[arg] + var isTypeArray = Array.isArray(argType) + if (isTypeArray && argType.length === 1) { + isTypeArray = false + argType = argType[0] + } + + var isArray = argType === Array || + isTypeArray && argType.indexOf(Array) !== -1 + + // allow unknown things to be arrays if specified multiple times. + if (!types.hasOwnProperty(arg) && data.hasOwnProperty(arg)) { + if (!Array.isArray(data[arg])) + data[arg] = [data[arg]] + isArray = true + } + + var val + , la = args[i + 1] + + var isBool = typeof no === 'boolean' || + argType === Boolean || + isTypeArray && argType.indexOf(Boolean) !== -1 || + (typeof argType === 'undefined' && !hadEq) || + (la === "false" && + (argType === null || + isTypeArray && ~argType.indexOf(null))) + + if (isBool) { + // just set and move along + val = !no + // however, also support --bool true or --bool false + if (la === "true" || la === "false") { + val = JSON.parse(la) + la = null + if (no) val = !val + i ++ + } + + // also support "foo":[Boolean, "bar"] and "--foo bar" + if (isTypeArray && la) { + if (~argType.indexOf(la)) { + // an explicit type + val = la + i ++ + } else if ( la === "null" && ~argType.indexOf(null) ) { + // null allowed + val = null + i ++ + } else if ( !la.match(/^-{2,}[^-]/) && + !isNaN(la) && + ~argType.indexOf(Number) ) { + // number + val = +la + i ++ + } else if ( !la.match(/^-[^-]/) && ~argType.indexOf(String) ) { + // string + val = la + i ++ + } + } + + if (isArray) (data[arg] = data[arg] || []).push(val) + else data[arg] = val + + continue + } + + if (argType === String) { + if (la === undefined) { + la = "" + } else if (la.match(/^-{1,2}[^-]+/)) { + la = "" + i -- + } + } + + if (la && la.match(/^-{2,}$/)) { + la = undefined + i -- + } + + val = la === undefined ? true : la + if (isArray) (data[arg] = data[arg] || []).push(val) + else data[arg] = val + + i ++ + continue + } + remain.push(arg) + } +} + +function resolveShort (arg, shorthands, shortAbbr, abbrevs) { + // handle single-char shorthands glommed together, like + // npm ls -glp, but only if there is one dash, and only if + // all of the chars are single-char shorthands, and it's + // not a match to some other abbrev. + arg = arg.replace(/^-+/, '') + + // if it's an exact known option, then don't go any further + if (abbrevs[arg] === arg) + return null + + // if it's an exact known shortopt, same deal + if (shorthands[arg]) { + // make it an array, if it's a list of words + if (shorthands[arg] && !Array.isArray(shorthands[arg])) + shorthands[arg] = shorthands[arg].split(/\s+/) + + return shorthands[arg] + } + + // first check to see if this arg is a set of single-char shorthands + var singles = shorthands.___singles + if (!singles) { + singles = Object.keys(shorthands).filter(function (s) { + return s.length === 1 + }).reduce(function (l,r) { + l[r] = true + return l + }, {}) + shorthands.___singles = singles + debug('shorthand singles', singles) + } + + var chrs = arg.split("").filter(function (c) { + return singles[c] + }) + + if (chrs.join("") === arg) return chrs.map(function (c) { + return shorthands[c] + }).reduce(function (l, r) { + return l.concat(r) + }, []) + + + // if it's an arg abbrev, and not a literal shorthand, then prefer the arg + if (abbrevs[arg] && !shorthands[arg]) + return null + + // if it's an abbr for a shorthand, then use that + if (shortAbbr[arg]) + arg = shortAbbr[arg] + + // make it an array, if it's a list of words + if (shorthands[arg] && !Array.isArray(shorthands[arg])) + shorthands[arg] = shorthands[arg].split(/\s+/) + + return shorthands[arg] +} diff --git a/node_modules/node-gyp/node_modules/nopt/package.json b/node_modules/node-gyp/node_modules/nopt/package.json new file mode 100644 index 0000000000000..ac6e169ae2416 --- /dev/null +++ b/node_modules/node-gyp/node_modules/nopt/package.json @@ -0,0 +1,30 @@ +{ + "name": "nopt", + "version": "4.0.3", + "description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.", + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "main": "lib/nopt.js", + "scripts": { + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/nopt.git" + }, + "bin": "./bin/nopt.js", + "license": "ISC", + "dependencies": { + "abbrev": "1", + "osenv": "^0.1.4" + }, + "devDependencies": { + "tap": "^14.10.6" + }, + "files": [ + "bin", + "lib" + ] +} diff --git a/node_modules/nopt/lib/nopt.js b/node_modules/nopt/lib/nopt.js index 0ec5753d0cb89..ecfa5da933683 100644 --- a/node_modules/nopt/lib/nopt.js +++ b/node_modules/nopt/lib/nopt.js @@ -8,7 +8,7 @@ var url = require("url") , path = require("path") , Stream = require("stream").Stream , abbrev = require("abbrev") - , osenv = require("osenv") + , os = require("os") module.exports = exports = nopt exports.clean = clean @@ -140,7 +140,7 @@ function validatePath (data, k, val) { var isWin = process.platform === 'win32' , homePattern = isWin ? /^~(\/|\\)/ : /^~\// - , home = osenv.home() + , home = os.homedir() if (home && val.match(homePattern)) { data[k] = path.resolve(home, val.substr(2)) diff --git a/node_modules/nopt/package.json b/node_modules/nopt/package.json index ac6e169ae2416..12ed02da5a832 100644 --- a/node_modules/nopt/package.json +++ b/node_modules/nopt/package.json @@ -1,6 +1,6 @@ { "name": "nopt", - "version": "4.0.3", + "version": "5.0.0", "description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.", "author": "Isaac Z. Schlueter (http://blog.izs.me/)", "main": "lib/nopt.js", @@ -14,11 +14,12 @@ "type": "git", "url": "https://github.com/npm/nopt.git" }, - "bin": "./bin/nopt.js", + "bin": { + "nopt": "bin/nopt.js" + }, "license": "ISC", "dependencies": { - "abbrev": "1", - "osenv": "^0.1.4" + "abbrev": "1" }, "devDependencies": { "tap": "^14.10.6" @@ -26,5 +27,8 @@ "files": [ "bin", "lib" - ] + ], + "engines": { + "node": ">=6" + } } diff --git a/package-lock.json b/package-lock.json index 76a21c257bcf9..0313930bc7ed6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "bundleDependencies": [ "@npmcli/arborist", "@npmcli/ci-detect", + "@npmcli/config", "@npmcli/run-script", "abbrev", "ansicolors", @@ -61,7 +62,6 @@ "npmlog", "once", "opener", - "osenv", "pacote", "parse-conflict-json", "qrcode-terminal", @@ -89,6 +89,7 @@ "dependencies": { "@npmcli/arborist": "^0.0.16", "@npmcli/ci-detect": "^1.2.0", + "@npmcli/config": "^1.1.4", "@npmcli/run-script": "^1.5.0", "abbrev": "~1.1.1", "ansicolors": "~0.3.2", @@ -130,7 +131,7 @@ "mkdirp": "^1.0.4", "mkdirp-infer-owner": "^2.0.0", "ms": "^2.1.2", - "nopt": "^4.0.3", + "nopt": "^5.0.0", "npm-audit-report": "^2.1.3", "npm-package-arg": "^8.0.1", "npm-pick-manifest": "^6.1.0", @@ -140,7 +141,6 @@ "npmlog": "~4.1.2", "once": "~1.4.0", "opener": "^1.5.1", - "osenv": "^0.1.5", "pacote": "^11.1.10", "parse-conflict-json": "^1.1.0", "qrcode-terminal": "^0.12.0", @@ -429,6 +429,21 @@ "integrity": "sha512-oN3y7FAROHhrAt7Rr7PnTSwrHrZVRTS2ZbyxeQwSSYD0ifwM3YNgQqbaRmjcWoPyq77MjchusjJDspbzMmip1Q==", "inBundle": true }, + "node_modules/@npmcli/config": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@npmcli/config/-/config-1.1.4.tgz", + "integrity": "sha512-08hINRBFLaVlNNXFfgViejnDMfCpPgrN9iYTRuizCr/PAPhGkQ0lAhLjtdKN9MeT+tDwQQ9k/9C9B5F5/myN1w==", + "inBundle": true, + "dependencies": { + "ini": "^1.3.5", + "mkdirp-infer-owner": "^2.0.0", + "nopt": "^5.0.0", + "walk-up-path": "^1.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@npmcli/git": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-2.0.3.tgz", @@ -4322,6 +4337,19 @@ "mkdirp": "bin/cmd.js" } }, + "node_modules/node-gyp/node_modules/nopt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", + "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", + "inBundle": true, + "dependencies": { + "abbrev": "1", + "osenv": "^0.1.4" + }, + "bin": { + "nopt": "bin/nopt.js" + } + }, "node_modules/node-gyp/node_modules/semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", @@ -4377,16 +4405,18 @@ } }, "node_modules/nopt": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", - "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", + "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", "inBundle": true, "dependencies": { - "abbrev": "1", - "osenv": "^0.1.4" + "abbrev": "1" }, "bin": { "nopt": "bin/nopt.js" + }, + "engines": { + "node": ">=6" } }, "node_modules/normalize-package-data": { @@ -9464,6 +9494,17 @@ "resolved": "https://registry.npmjs.org/@npmcli/ci-detect/-/ci-detect-1.3.0.tgz", "integrity": "sha512-oN3y7FAROHhrAt7Rr7PnTSwrHrZVRTS2ZbyxeQwSSYD0ifwM3YNgQqbaRmjcWoPyq77MjchusjJDspbzMmip1Q==" }, + "@npmcli/config": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@npmcli/config/-/config-1.1.4.tgz", + "integrity": "sha512-08hINRBFLaVlNNXFfgViejnDMfCpPgrN9iYTRuizCr/PAPhGkQ0lAhLjtdKN9MeT+tDwQQ9k/9C9B5F5/myN1w==", + "requires": { + "ini": "^1.3.5", + "mkdirp-infer-owner": "^2.0.0", + "nopt": "^5.0.0", + "walk-up-path": "^1.0.0" + } + }, "@npmcli/git": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-2.0.3.tgz", @@ -12450,6 +12491,15 @@ "minimist": "^1.2.5" } }, + "nopt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", + "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", @@ -12491,12 +12541,11 @@ "dev": true }, "nopt": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", - "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", + "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", "requires": { - "abbrev": "1", - "osenv": "^0.1.4" + "abbrev": "1" } }, "normalize-package-data": { diff --git a/package.json b/package.json index d90e5704f85f4..965ab67e61a61 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "mkdirp": "^1.0.4", "mkdirp-infer-owner": "^2.0.0", "ms": "^2.1.2", - "nopt": "^4.0.3", + "nopt": "^5.0.0", "npm-audit-report": "^2.1.3", "npm-package-arg": "^8.0.1", "npm-pick-manifest": "^6.1.0", @@ -93,7 +93,6 @@ "npmlog": "~4.1.2", "once": "~1.4.0", "opener": "^1.5.1", - "osenv": "^0.1.5", "pacote": "^11.1.10", "parse-conflict-json": "^1.1.0", "qrcode-terminal": "^0.12.0", @@ -117,11 +116,13 @@ "which": "^2.0.2", "write-file-atomic": "^2.4.3", "make-fetch-happen": "^8.0.9", - "leven": "^3.1.0" + "leven": "^3.1.0", + "@npmcli/config": "^1.1.4" }, "bundleDependencies": [ "@npmcli/arborist", "@npmcli/ci-detect", + "@npmcli/config", "@npmcli/run-script", "abbrev", "ansicolors", @@ -173,7 +174,6 @@ "npmlog", "once", "opener", - "osenv", "pacote", "parse-conflict-json", "qrcode-terminal", From b983f47123533fc2e7650189490c4482cd76d129 Mon Sep 17 00:00:00 2001 From: isaacs Date: Mon, 17 Aug 2020 16:25:19 -0700 Subject: [PATCH 2/8] a utility for getting the PATH env as an array --- lib/utils/path.js | 4 ++++ test/lib/utils/path.js | 13 +++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 lib/utils/path.js create mode 100644 test/lib/utils/path.js diff --git a/lib/utils/path.js b/lib/utils/path.js new file mode 100644 index 0000000000000..ad0065a2c52f3 --- /dev/null +++ b/lib/utils/path.js @@ -0,0 +1,4 @@ +// return the PATH array in a cross-platform way +const PATH = process.env.PATH || process.env.Path || process.env.path +const { delimiter } = require('path') +module.exports = PATH.split(delimiter) diff --git a/test/lib/utils/path.js b/test/lib/utils/path.js new file mode 100644 index 0000000000000..facee06459d4c --- /dev/null +++ b/test/lib/utils/path.js @@ -0,0 +1,13 @@ +const t = require('tap') +const requireInject = require('require-inject') +const mod = '../../../lib/utils/path.js' +const delim = require('../../../lib/utils/is-windows.js') ? ';' : ':' +Object.defineProperty(process, 'env', { + value: {} +}) +process.env.path = ['foo', 'bar', 'baz'].join(delim) +t.strictSame(requireInject(mod), ['foo', 'bar', 'baz']) +process.env.Path = ['a', 'b', 'c'].join(delim) +t.strictSame(requireInject(mod), ['a', 'b', 'c']) +process.env.PATH = ['x', 'y', 'z'].join(delim) +t.strictSame(requireInject(mod), ['x', 'y', 'z']) From 48753bbdfdd4ef5986e4cebef8aa0972ea27d13d Mon Sep 17 00:00:00 2001 From: isaacs Date: Mon, 17 Aug 2020 16:25:41 -0700 Subject: [PATCH 3/8] a utility for config defaults, types, and shorthands --- lib/utils/config.js | 367 ++ .../test-lib-utils-config.js-TAP.test.js | 3398 +++++++++++++++++ test/lib/utils/config.js | 118 + 3 files changed, 3883 insertions(+) create mode 100644 lib/utils/config.js create mode 100644 tap-snapshots/test-lib-utils-config.js-TAP.test.js create mode 100644 test/lib/utils/config.js diff --git a/lib/utils/config.js b/lib/utils/config.js new file mode 100644 index 0000000000000..72d2fc3a0b2d3 --- /dev/null +++ b/lib/utils/config.js @@ -0,0 +1,367 @@ +// defaults, types, and shorthands + +const { + typeDefs: { + semver: { type: semver }, + Umask: { type: Umask }, + url: { type: url }, + path: { type: path } + } +} = require('@npmcli/config') + +const { dirname } = require('path') +const isWindows = require('./is-windows.js') + +const editor = process.env.EDITOR || + process.env.VISUAL || + (isWindows ? 'notepad.exe' : 'vi') + +const shell = isWindows ? process.env.ComSpec || 'cmd' + : process.env.SHELL || 'bash' + +const { tmpdir, networkInterfaces } = require('os') +const getLocalAddresses = () => { + try { + return Object.values(networkInterfaces()).map( + int => int.map(({ address }) => address) + ).reduce((set, addrs) => set.concat(addrs), [undefined]) + } catch (e) { + return [undefined] + } +} + +const unicode = /UTF-?8$/i.test( + process.env.LC_ALL || process.env.LC_CTYPE || process.env.LANG +) + +// use LOCALAPPDATA on Windows, if set +// https://github.com/npm/cli/pull/899 +const cacheRoot = isWindows && process.env.LOCALAPPDATA || '~' +const cacheExtra = isWindows ? 'npm-cache' : '.npm' +const cache = `${cacheRoot}/${cacheExtra}` + +const defaults = { + access: null, + all: false, + 'allow-same-version': false, + 'always-auth': false, + also: null, + audit: true, + 'audit-level': null, + 'auth-type': 'legacy', + + before: null, + 'bin-links': true, + browser: null, + + ca: null, + cafile: null, + + cache, + + 'cache-lock-stale': 60000, + 'cache-lock-retries': 10, + 'cache-lock-wait': 10000, + + 'cache-max': Infinity, + 'cache-min': 10, + + cert: null, + + cidr: null, + + color: process.env.NO_COLOR == null, + call: '', + depth: 0, + description: true, + dev: false, + 'dry-run': false, + editor, + 'engine-strict': false, + force: false, + 'format-package-lock': true, + + fund: true, + + 'fetch-retries': 2, + 'fetch-retry-factor': 10, + 'fetch-retry-mintimeout': 10000, + 'fetch-retry-maxtimeout': 60000, + + git: 'git', + 'git-tag-version': true, + 'commit-hooks': true, + + global: false, + 'global-style': false, + heading: 'npm', + 'if-present': false, + include: [], + 'include-staged': false, + 'ignore-prepublish': false, + 'ignore-scripts': false, + 'init-module': '~/.npm-init.js', + 'init-author-name': '', + 'init-author-email': '', + 'init-author-url': '', + 'init-version': '1.0.0', + 'init-license': 'ISC', + json: false, + key: null, + 'legacy-bundling': false, + 'legacy-peer-deps': false, + link: false, + 'local-address': undefined, + loglevel: 'notice', + 'logs-max': 10, + long: false, + maxsockets: 50, + message: '%s', + 'metrics-registry': null, + 'node-options': null, + 'node-version': process.version, + offline: false, + omit: [], + only: null, + optional: true, + otp: null, + package: [], + 'package-lock': true, + 'package-lock-only': false, + parseable: false, + 'prefer-offline': false, + 'prefer-online': false, + preid: '', + production: process.env.NODE_ENV === 'production', + progress: !process.env.TRAVIS && !process.env.CI, + proxy: null, + 'https-proxy': null, + noproxy: null, + 'user-agent': 'npm/{npm-version} ' + + 'node/{node-version} ' + + '{platform} ' + + '{arch} ' + + '{ci}', + 'read-only': false, + 'rebuild-bundle': true, + registry: 'https://registry.npmjs.org/', + rollback: true, + save: true, + 'save-bundle': false, + 'save-dev': false, + 'save-exact': false, + 'save-optional': false, + 'save-prefix': '^', + 'save-prod': false, + scope: '', + 'script-shell': null, + 'scripts-prepend-node-path': 'warn-only', + searchopts: '', + searchexclude: null, + searchlimit: 20, + searchstaleness: 15 * 60, + 'send-metrics': false, + shell, + shrinkwrap: true, + 'sign-git-commit': false, + 'sign-git-tag': false, + 'sso-poll-frequency': 500, + 'sso-type': 'oauth', + 'strict-ssl': true, + tag: 'latest', + 'tag-version-prefix': 'v', + timing: false, + tmp: tmpdir(), + unicode, + 'update-notifier': true, + usage: false, + userconfig: '~/.npmrc', + umask: process.umask ? process.umask() : 0o22, + version: false, + versions: false, + viewer: isWindows ? 'browser' : 'man' +} + +const types = { + access: [null, 'restricted', 'public'], + all: Boolean, + 'allow-same-version': Boolean, + 'always-auth': Boolean, + also: [null, 'dev', 'development'], + audit: Boolean, + 'audit-level': ['low', 'moderate', 'high', 'critical', 'none', null], + 'auth-type': ['legacy', 'sso', 'saml', 'oauth'], + before: [null, Date], + 'bin-links': Boolean, + browser: [null, Boolean, String], + ca: [null, String, Array], + cafile: path, + cache: path, + 'cache-lock-stale': Number, + 'cache-lock-retries': Number, + 'cache-lock-wait': Number, + 'cache-max': Number, + 'cache-min': Number, + cert: [null, String], + cidr: [null, String, Array], + color: ['always', Boolean], + call: String, + depth: Number, + description: Boolean, + dev: Boolean, + 'dry-run': Boolean, + editor: String, + 'engine-strict': Boolean, + force: Boolean, + fund: Boolean, + 'format-package-lock': Boolean, + 'fetch-retries': Number, + 'fetch-retry-factor': Number, + 'fetch-retry-mintimeout': Number, + 'fetch-retry-maxtimeout': Number, + git: String, + 'git-tag-version': Boolean, + 'commit-hooks': Boolean, + global: Boolean, + globalconfig: path, + 'global-style': Boolean, + group: [Number, String], + 'https-proxy': [null, url], + 'user-agent': String, + 'ham-it-up': Boolean, + heading: String, + 'if-present': Boolean, + include: [Array, 'prod', 'dev', 'optional', 'peer'], + 'include-staged': Boolean, + 'ignore-prepublish': Boolean, + 'ignore-scripts': Boolean, + 'init-module': path, + 'init-author-name': String, + 'init-author-email': String, + 'init-author-url': ['', url], + 'init-license': String, + 'init-version': semver, + json: Boolean, + key: [null, String], + 'legacy-bundling': Boolean, + 'legacy-peer-deps': Boolean, + link: Boolean, + 'local-address': getLocalAddresses(), + loglevel: [ + 'silent', + 'error', + 'warn', + 'notice', + 'http', + 'timing', + 'info', + 'verbose', + 'silly' + ], + 'logs-max': Number, + long: Boolean, + maxsockets: Number, + message: String, + 'metrics-registry': [null, String], + 'node-options': [null, String], + 'node-version': [null, semver], + noproxy: [null, String, Array], + offline: Boolean, + omit: [Array, 'dev', 'optional', 'peer'], + only: [null, 'dev', 'development', 'prod', 'production'], + optional: Boolean, + otp: [null, String], + package: [String, Array], + 'package-lock': Boolean, + 'package-lock-only': Boolean, + parseable: Boolean, + 'prefer-offline': Boolean, + 'prefer-online': Boolean, + prefix: path, + preid: String, + production: Boolean, + progress: Boolean, + proxy: [null, false, url], // allow proxy to be disabled explicitly + 'read-only': Boolean, + 'rebuild-bundle': Boolean, + registry: [null, url], + rollback: Boolean, + save: Boolean, + 'save-bundle': Boolean, + 'save-dev': Boolean, + 'save-exact': Boolean, + 'save-optional': Boolean, + 'save-prefix': String, + 'save-prod': Boolean, + scope: String, + 'script-shell': [null, String], + 'scripts-prepend-node-path': [Boolean, 'auto', 'warn-only'], + searchopts: String, + searchexclude: [null, String], + searchlimit: Number, + searchstaleness: Number, + 'send-metrics': Boolean, + shell: String, + shrinkwrap: Boolean, + 'sign-git-commit': Boolean, + 'sign-git-tag': Boolean, + 'sso-poll-frequency': Number, + 'sso-type': [null, 'oauth', 'saml'], + 'strict-ssl': Boolean, + tag: String, + timing: Boolean, + tmp: path, + unicode: Boolean, + 'update-notifier': Boolean, + usage: Boolean, + userconfig: path, + umask: Umask, + version: Boolean, + 'tag-version-prefix': String, + versions: Boolean, + viewer: String +} + +const shorthands = { + a: ['--all'], + 'enjoy-by': ['--before'], + c: ['--call'], + s: ['--loglevel', 'silent'], + d: ['--loglevel', 'info'], + dd: ['--loglevel', 'verbose'], + ddd: ['--loglevel', 'silly'], + noreg: ['--no-registry'], + N: ['--no-registry'], + reg: ['--registry'], + 'no-reg': ['--no-registry'], + silent: ['--loglevel', 'silent'], + verbose: ['--loglevel', 'verbose'], + quiet: ['--loglevel', 'warn'], + q: ['--loglevel', 'warn'], + h: ['--usage'], + H: ['--usage'], + '?': ['--usage'], + help: ['--usage'], + v: ['--version'], + f: ['--force'], + desc: ['--description'], + 'no-desc': ['--no-description'], + local: ['--no-global'], + l: ['--long'], + m: ['--message'], + p: ['--parseable'], + porcelain: ['--parseable'], + readonly: ['--read-only'], + g: ['--global'], + S: ['--save'], + D: ['--save-dev'], + E: ['--save-exact'], + O: ['--save-optional'], + P: ['--save-prod'], + y: ['--yes'], + n: ['--no-yes'], + B: ['--save-bundle'], + C: ['--prefix'] +} + +module.exports = { defaults, types, shorthands } diff --git a/tap-snapshots/test-lib-utils-config.js-TAP.test.js b/tap-snapshots/test-lib-utils-config.js-TAP.test.js new file mode 100644 index 0000000000000..f109597a0b540 --- /dev/null +++ b/tap-snapshots/test-lib-utils-config.js-TAP.test.js @@ -0,0 +1,3398 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`test/lib/utils/config.js TAP no process.umask() method > must match snapshot 1`] = ` +Object { + "defaults": Object { + "access": null, + "all": false, + "allow-same-version": false, + "also": null, + "always-auth": false, + "audit": true, + "audit-level": null, + "auth-type": "legacy", + "before": null, + "bin-links": true, + "browser": null, + "ca": null, + "cache": "~/npm-cache", + "cache-lock-retries": 10, + "cache-lock-stale": 60000, + "cache-lock-wait": 10000, + "cache-max": null, + "cache-min": 10, + "cafile": null, + "call": "", + "cert": null, + "cidr": null, + "color": true, + "commit-hooks": true, + "depth": 0, + "description": true, + "dev": false, + "dry-run": false, + "editor": "vim", + "engine-strict": false, + "fetch-retries": 2, + "fetch-retry-factor": 10, + "fetch-retry-maxtimeout": 60000, + "fetch-retry-mintimeout": 10000, + "force": false, + "format-package-lock": true, + "fund": true, + "git": "git", + "git-tag-version": true, + "global": false, + "global-style": false, + "heading": "npm", + "https-proxy": null, + "if-present": false, + "ignore-prepublish": false, + "ignore-scripts": false, + "include": Array [], + "include-staged": false, + "init-author-email": "", + "init-author-name": "", + "init-author-url": "", + "init-license": "ISC", + "init-module": "~/.npm-init.js", + "init-version": "1.0.0", + "json": false, + "key": null, + "legacy-bundling": false, + "legacy-peer-deps": false, + "link": false, + "local-address": undefined, + "loglevel": "notice", + "logs-max": 10, + "long": false, + "maxsockets": 50, + "message": "%s", + "metrics-registry": null, + "node-options": null, + "node-version": "v14.8.0", + "noproxy": null, + "offline": false, + "omit": Array [], + "only": null, + "optional": true, + "otp": null, + "package": Array [], + "package-lock": true, + "package-lock-only": false, + "parseable": false, + "prefer-offline": false, + "prefer-online": false, + "preid": "", + "production": false, + "progress": true, + "proxy": null, + "read-only": false, + "rebuild-bundle": true, + "registry": "https://registry.npmjs.org/", + "rollback": true, + "save": true, + "save-bundle": false, + "save-dev": false, + "save-exact": false, + "save-optional": false, + "save-prefix": "^", + "save-prod": false, + "scope": "", + "script-shell": null, + "scripts-prepend-node-path": "warn-only", + "searchexclude": null, + "searchlimit": 20, + "searchopts": "", + "searchstaleness": 900, + "send-metrics": false, + "shell": "cmd.exe", + "shrinkwrap": true, + "sign-git-commit": false, + "sign-git-tag": false, + "sso-poll-frequency": 500, + "sso-type": "oauth", + "strict-ssl": true, + "tag": "latest", + "tag-version-prefix": "v", + "timing": false, + "tmp": "/tmp", + "umask": 18, + "unicode": true, + "update-notifier": true, + "usage": false, + "user-agent": "npm/{npm-version} node/{node-version} {platform} {arch} {ci}", + "userconfig": "~/.npmrc", + "version": false, + "versions": false, + "viewer": "browser", + }, + "shorthands": Object { + "?": Array [ + "--usage", + ], + "a": Array [ + "--all", + ], + "B": Array [ + "--save-bundle", + ], + "c": Array [ + "--call", + ], + "C": Array [ + "--prefix", + ], + "d": Array [ + "--loglevel", + "info", + ], + "D": Array [ + "--save-dev", + ], + "dd": Array [ + "--loglevel", + "verbose", + ], + "ddd": Array [ + "--loglevel", + "silly", + ], + "desc": Array [ + "--description", + ], + "E": Array [ + "--save-exact", + ], + "enjoy-by": Array [ + "--before", + ], + "f": Array [ + "--force", + ], + "g": Array [ + "--global", + ], + "h": Array [ + "--usage", + ], + "H": Array [ + "--usage", + ], + "help": Array [ + "--usage", + ], + "l": Array [ + "--long", + ], + "local": Array [ + "--no-global", + ], + "m": Array [ + "--message", + ], + "n": Array [ + "--no-yes", + ], + "N": Array [ + "--no-registry", + ], + "no-desc": Array [ + "--no-description", + ], + "no-reg": Array [ + "--no-registry", + ], + "noreg": Array [ + "--no-registry", + ], + "O": Array [ + "--save-optional", + ], + "p": Array [ + "--parseable", + ], + "P": Array [ + "--save-prod", + ], + "porcelain": Array [ + "--parseable", + ], + "q": Array [ + "--loglevel", + "warn", + ], + "quiet": Array [ + "--loglevel", + "warn", + ], + "readonly": Array [ + "--read-only", + ], + "reg": Array [ + "--registry", + ], + "s": Array [ + "--loglevel", + "silent", + ], + "S": Array [ + "--save", + ], + "silent": Array [ + "--loglevel", + "silent", + ], + "v": Array [ + "--version", + ], + "verbose": Array [ + "--loglevel", + "verbose", + ], + "y": Array [ + "--yes", + ], + }, + "types": Object { + "access": Array [ + null, + "restricted", + "public", + ], + "all": Function Boolean(), + "allow-same-version": Function Boolean(), + "also": Array [ + null, + "dev", + "development", + ], + "always-auth": Function Boolean(), + "audit": Function Boolean(), + "audit-level": Array [ + "low", + "moderate", + "high", + "critical", + "none", + null, + ], + "auth-type": Array [ + "legacy", + "sso", + "saml", + "oauth", + ], + "before": Array [ + null, + Function Date(), + ], + "bin-links": Function Boolean(), + "browser": Array [ + null, + Function Boolean(), + Function String(), + ], + "ca": Array [ + null, + Function String(), + Function Array(), + ], + "cache": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "cache-lock-retries": Function Number(), + "cache-lock-stale": Function Number(), + "cache-lock-wait": Function Number(), + "cache-max": Function Number(), + "cache-min": Function Number(), + "cafile": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "call": Function String(), + "cert": Array [ + null, + Function String(), + ], + "cidr": Array [ + null, + Function String(), + Function Array(), + ], + "color": Array [ + "always", + Function Boolean(), + ], + "commit-hooks": Function Boolean(), + "depth": Function Number(), + "description": Function Boolean(), + "dev": Function Boolean(), + "dry-run": Function Boolean(), + "editor": Function String(), + "engine-strict": Function Boolean(), + "fetch-retries": Function Number(), + "fetch-retry-factor": Function Number(), + "fetch-retry-maxtimeout": Function Number(), + "fetch-retry-mintimeout": Function Number(), + "force": Function Boolean(), + "format-package-lock": Function Boolean(), + "fund": Function Boolean(), + "git": Function String(), + "git-tag-version": Function Boolean(), + "global": Function Boolean(), + "global-style": Function Boolean(), + "globalconfig": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "group": Array [ + Function Number(), + Function String(), + ], + "ham-it-up": Function Boolean(), + "heading": Function String(), + "https-proxy": Array [ + null, + Object { + "domainToASCII": Function domainToASCII(domain), + "domainToUnicode": Function domainToUnicode(domain), + "fileURLToPath": Function fileURLToPath(path), + "format": Function urlFormat(urlObject, options), + "parse": Function urlParse(url, parseQueryString, slashesDenoteHost), + "pathToFileURL": Function pathToFileURL(filepath), + "resolve": Function urlResolve(source, relative), + "resolveObject": Function urlResolveObject(source, relative), + "Url": Function Url(), + "URL": Function URL(classURL), + "URLSearchParams": Function URLSearchParams(classURLSearchParams), + }, + ], + "if-present": Function Boolean(), + "ignore-prepublish": Function Boolean(), + "ignore-scripts": Function Boolean(), + "include": Array [ + Function Array(), + "prod", + "dev", + "optional", + "peer", + ], + "include-staged": Function Boolean(), + "init-author-email": Function String(), + "init-author-name": Function String(), + "init-author-url": Array [ + "", + Object { + "domainToASCII": Function domainToASCII(domain), + "domainToUnicode": Function domainToUnicode(domain), + "fileURLToPath": Function fileURLToPath(path), + "format": Function urlFormat(urlObject, options), + "parse": Function urlParse(url, parseQueryString, slashesDenoteHost), + "pathToFileURL": Function pathToFileURL(filepath), + "resolve": Function urlResolve(source, relative), + "resolveObject": Function urlResolveObject(source, relative), + "Url": Function Url(), + "URL": Function URL(classURL), + "URLSearchParams": Function URLSearchParams(classURLSearchParams), + }, + ], + "init-license": Function String(), + "init-module": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "init-version": Object { + "clean": Function clean(version, options), + "cmp": Function cmp(a, op, b, loose), + "coerce": Function coerce(version, options), + "Comparator": Function Comparator(classComparator), + "compare": Function compare(a, b, loose), + "compareBuild": Function compareBuild(a, b, loose), + "compareIdentifiers": Function compareIdentifiers(a, b), + "compareLoose": Function compareLoose(a, b), + "diff": Function diff(version1, version2), + "eq": Function eq(a, b, loose), + "gt": Function gt(a, b, loose), + "gte": Function gte(a, b, loose), + "gtr": Function gtr(version, range, options), + "inc": Function inc(version, release, options, identifier), + "intersects": Function intersects(r1, r2, options), + "lt": Function lt(a, b, loose), + "lte": Function lte(a, b, loose), + "ltr": Function ltr(version, range, options), + "major": Function major(a, loose), + "maxSatisfying": Function maxSatisfying(versions, range, options), + "minor": Function minor(a, loose), + "minSatisfying": Function minSatisfying(versions, range, options), + "minVersion": Function minVersion(range, loose), + "neq": Function neq(a, b, loose), + "outside": Function outside(version, range, hilo, options), + "parse": Function parse(version, options), + "patch": Function patch(a, loose), + "prerelease": Function prerelease(version, options), + "Range": Function Range(classRange), + "rcompare": Function rcompare(a, b, loose), + "rcompareIdentifiers": Function rcompareIdentifiers(a, b), + "re": Array [ + /0|[1-9]\\d*/, + /[0-9]+/, + /\\d*[a-zA-Z-][a-zA-Z0-9-]*/, + /(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)/, + /([0-9]+)\\.([0-9]+)\\.([0-9]+)/, + /(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)/, + /(?:[0-9]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]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?)?)?)\\s+-\\s+([v=\\s]*(0|[1-9]\\d*|x|X|\\*)(?:\\.(0|[1-9]\\d*|x|X|\\*)(?:\\.(0|[1-9]\\d*|x|X|\\*)(?:(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?)?)?)\\s*$/, + /^\\s*([v=\\s]*([0-9]+|x|X|\\*)(?:\\.([0-9]+|x|X|\\*)(?:\\.([0-9]+|x|X|\\*)(?:(?:-?((?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?)?)?)\\s+-\\s+([v=\\s]*([0-9]+|x|X|\\*)(?:\\.([0-9]+|x|X|\\*)(?:\\.([0-9]+|x|X|\\*)(?:(?:-?((?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?)?)?)\\s*$/, + /(<|>)?=?\\s*\\*/, + /^\\s*>=\\s*0.0.0\\s*$/, + /^\\s*>=\\s*0.0.0-0\\s*$/, + ], + "rsort": Function rsort(list, loose), + "satisfies": Function satisfies(version, range, options), + "SemVer": Function SemVer(classSemVer), + "SEMVER_SPEC_VERSION": "2.0.0", + "simplifyRange": Function (versions, range, options), + "sort": Function sort(list, loose), + "src": Array [ + "0|[1-9]\\\\d*", + "[0-9]+", + "\\\\d*[a-zA-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s*$", + "^\\\\s*([v=\\\\s]*([0-9]+|x|X|\\\\*)(?:\\\\.([0-9]+|x|X|\\\\*)(?:\\\\.([0-9]+|x|X|\\\\*)(?:(?:-?((?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\\\.(?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\\\+([0-9A-Za-z-]+(?:\\\\.[0-9A-Za-z-]+)*))?)?)?)\\\\s+-\\\\s+([v=\\\\s]*([0-9]+|x|X|\\\\*)(?:\\\\.([0-9]+|x|X|\\\\*)(?:\\\\.([0-9]+|x|X|\\\\*)(?:(?:-?((?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\\\.(?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\\\+([0-9A-Za-z-]+(?:\\\\.[0-9A-Za-z-]+)*))?)?)?)\\\\s*$", + "(<|>)?=?\\\\s*\\\\*", + "^\\\\s*>=\\\\s*0.0.0\\\\s*$", + "^\\\\s*>=\\\\s*0.0.0-0\\\\s*$", + ], + "subset": Function subset(sub, dom, options), + "toComparators": Function toComparators(range, options), + "tokens": Object { + "BUILD": 10, + "BUILDIDENTIFIER": 9, + "CARET": 30, + "CARETLOOSE": 31, + "CARETTRIM": 29, + "COERCE": 22, + "COERCERTL": 23, + "COMPARATOR": 33, + "COMPARATORLOOSE": 32, + "COMPARATORTRIM": 34, + "FULL": 12, + "FULLPLAIN": 11, + "GTE0": 38, + "GTE0PRE": 39, + "GTLT": 15, + "HYPHENRANGE": 35, + "HYPHENRANGELOOSE": 36, + "LONECARET": 28, + "LONETILDE": 24, + "LOOSE": 14, + "LOOSEPLAIN": 13, + "MAINVERSION": 3, + "MAINVERSIONLOOSE": 4, + "NONNUMERICIDENTIFIER": 2, + "NUMERICIDENTIFIER": 0, + "NUMERICIDENTIFIERLOOSE": 1, + "PRERELEASE": 7, + "PRERELEASEIDENTIFIER": 5, + "PRERELEASEIDENTIFIERLOOSE": 6, + "PRERELEASELOOSE": 8, + "STAR": 37, + "TILDE": 26, + "TILDELOOSE": 27, + "TILDETRIM": 25, + "XRANGE": 20, + "XRANGEIDENTIFIER": 17, + "XRANGEIDENTIFIERLOOSE": 16, + "XRANGELOOSE": 21, + "XRANGEPLAIN": 18, + "XRANGEPLAINLOOSE": 19, + }, + "valid": Function valid(version, options), + "validRange": Function validRange(range, options), + }, + "json": Function Boolean(), + "key": Array [ + null, + Function String(), + ], + "legacy-bundling": Function Boolean(), + "legacy-peer-deps": Function Boolean(), + "link": Function Boolean(), + "local-address": Array [ + undefined, + ], + "loglevel": Array [ + "silent", + "error", + "warn", + "notice", + "http", + "timing", + "info", + "verbose", + "silly", + ], + "logs-max": Function Number(), + "long": Function Boolean(), + "maxsockets": Function Number(), + "message": Function String(), + "metrics-registry": Array [ + null, + Function String(), + ], + "node-options": Array [ + null, + Function String(), + ], + "node-version": Array [ + null, + Object { + "clean": Function clean(version, options), + "cmp": Function cmp(a, op, b, loose), + "coerce": Function coerce(version, options), + "Comparator": Function Comparator(classComparator), + "compare": Function compare(a, b, loose), + "compareBuild": Function compareBuild(a, b, loose), + "compareIdentifiers": Function compareIdentifiers(a, b), + "compareLoose": Function compareLoose(a, b), + "diff": Function diff(version1, version2), + "eq": Function eq(a, b, loose), + "gt": Function gt(a, b, loose), + "gte": Function gte(a, b, loose), + "gtr": Function gtr(version, range, options), + "inc": Function inc(version, release, options, identifier), + "intersects": Function intersects(r1, r2, options), + "lt": Function lt(a, b, loose), + "lte": Function lte(a, b, loose), + "ltr": Function ltr(version, range, options), + "major": Function major(a, loose), + "maxSatisfying": Function maxSatisfying(versions, range, options), + "minor": Function minor(a, loose), + "minSatisfying": Function minSatisfying(versions, range, options), + "minVersion": Function minVersion(range, loose), + "neq": Function neq(a, b, loose), + "outside": Function outside(version, range, hilo, options), + "parse": Function parse(version, options), + "patch": Function patch(a, loose), + "prerelease": Function prerelease(version, options), + "Range": Function Range(classRange), + "rcompare": Function rcompare(a, b, loose), + "rcompareIdentifiers": Function rcompareIdentifiers(a, b), + "re": Array [ + /0|[1-9]\\d*/, + /[0-9]+/, + /\\d*[a-zA-Z-][a-zA-Z0-9-]*/, + /(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)/, + /([0-9]+)\\.([0-9]+)\\.([0-9]+)/, + /(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)/, + /(?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*)/, + /(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))/, + /(?:-?((?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))/, + /[0-9A-Za-z-]+/, + /(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))/, + /v?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?/, + /^v?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?$/, + /[v=\\s]*([0-9]+)\\.([0-9]+)\\.([0-9]+)(?:-?((?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:[0-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z-]+)*))?)?)?)\\s*$/, + /(<|>)?=?\\s*\\*/, + /^\\s*>=\\s*0.0.0\\s*$/, + /^\\s*>=\\s*0.0.0-0\\s*$/, + ], + "rsort": Function rsort(list, loose), + "satisfies": Function satisfies(version, range, options), + "SemVer": Function SemVer(classSemVer), + "SEMVER_SPEC_VERSION": "2.0.0", + "simplifyRange": Function (versions, range, options), + "sort": Function sort(list, loose), + "src": Array [ + "0|[1-9]\\\\d*", + "[0-9]+", + "\\\\d*[a-zA-Z-][a-zA-Z0-9-]*", + "(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)", + "([0-9]+)\\\\.([0-9]+)\\\\.([0-9]+)", + "(?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)", + "(?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)", + "(?:-((?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\\\.(?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))", + "(?:-?((?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\\\.(?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))", + "[0-9A-Za-z-]+", + "(?:\\\\+([0-9A-Za-z-]+(?:\\\\.[0-9A-Za-z-]+)*))", + "v?(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)(?:-((?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\\\.(?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\\\\+([0-9A-Za-z-]+(?:\\\\.[0-9A-Za-z-]+)*))?", + "^v?(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)(?:-((?:0|[1-9]\\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|[1-9]\\\\d*|x|X|\\\\*)(?:\\\\.(0|[1-9]\\\\d*|x|X|\\\\*)(?:\\\\.(0|[1-9]\\\\d*|x|X|\\\\*)(?:(?:-((?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\\\.(?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\\\+([0-9A-Za-z-]+(?:\\\\.[0-9A-Za-z-]+)*))?)?)?)\\\\s*$", + "^\\\\s*([v=\\\\s]*([0-9]+|x|X|\\\\*)(?:\\\\.([0-9]+|x|X|\\\\*)(?:\\\\.([0-9]+|x|X|\\\\*)(?:(?:-?((?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\\\.(?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\\\+([0-9A-Za-z-]+(?:\\\\.[0-9A-Za-z-]+)*))?)?)?)\\\\s+-\\\\s+([v=\\\\s]*([0-9]+|x|X|\\\\*)(?:\\\\.([0-9]+|x|X|\\\\*)(?:\\\\.([0-9]+|x|X|\\\\*)(?:(?:-?((?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\\\.(?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\\\+([0-9A-Za-z-]+(?:\\\\.[0-9A-Za-z-]+)*))?)?)?)\\\\s*$", + "(<|>)?=?\\\\s*\\\\*", + "^\\\\s*>=\\\\s*0.0.0\\\\s*$", + "^\\\\s*>=\\\\s*0.0.0-0\\\\s*$", + ], + "subset": Function subset(sub, dom, options), + "toComparators": Function toComparators(range, options), + "tokens": Object { + "BUILD": 10, + "BUILDIDENTIFIER": 9, + "CARET": 30, + "CARETLOOSE": 31, + "CARETTRIM": 29, + "COERCE": 22, + "COERCERTL": 23, + "COMPARATOR": 33, + "COMPARATORLOOSE": 32, + "COMPARATORTRIM": 34, + "FULL": 12, + "FULLPLAIN": 11, + "GTE0": 38, + "GTE0PRE": 39, + "GTLT": 15, + "HYPHENRANGE": 35, + "HYPHENRANGELOOSE": 36, + "LONECARET": 28, + "LONETILDE": 24, + "LOOSE": 14, + "LOOSEPLAIN": 13, + "MAINVERSION": 3, + "MAINVERSIONLOOSE": 4, + "NONNUMERICIDENTIFIER": 2, + "NUMERICIDENTIFIER": 0, + "NUMERICIDENTIFIERLOOSE": 1, + "PRERELEASE": 7, + "PRERELEASEIDENTIFIER": 5, + "PRERELEASEIDENTIFIERLOOSE": 6, + "PRERELEASELOOSE": 8, + "STAR": 37, + "TILDE": 26, + "TILDELOOSE": 27, + "TILDETRIM": 25, + "XRANGE": 20, + "XRANGEIDENTIFIER": 17, + "XRANGEIDENTIFIERLOOSE": 16, + "XRANGELOOSE": 21, + "XRANGEPLAIN": 18, + "XRANGEPLAINLOOSE": 19, + }, + "valid": Function valid(version, options), + "validRange": Function validRange(range, options), + }, + ], + "noproxy": Array [ + null, + Function String(), + Function Array(), + ], + "offline": Function Boolean(), + "omit": Array [ + Function Array(), + "dev", + "optional", + "peer", + ], + "only": Array [ + null, + "dev", + "development", + "prod", + "production", + ], + "optional": Function Boolean(), + "otp": Array [ + null, + Function String(), + ], + "package": Array [ + Function String(), + Function Array(), + ], + "package-lock": Function Boolean(), + "package-lock-only": Function Boolean(), + "parseable": Function Boolean(), + "prefer-offline": Function Boolean(), + "prefer-online": Function Boolean(), + "prefix": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "preid": Function String(), + "production": Function Boolean(), + "progress": Function Boolean(), + "proxy": Array [ + null, + false, + Object { + "domainToASCII": Function domainToASCII(domain), + "domainToUnicode": Function domainToUnicode(domain), + "fileURLToPath": Function fileURLToPath(path), + "format": Function urlFormat(urlObject, options), + "parse": Function urlParse(url, parseQueryString, slashesDenoteHost), + "pathToFileURL": Function pathToFileURL(filepath), + "resolve": Function urlResolve(source, relative), + "resolveObject": Function urlResolveObject(source, relative), + "Url": Function Url(), + "URL": Function URL(classURL), + "URLSearchParams": Function URLSearchParams(classURLSearchParams), + }, + ], + "read-only": Function Boolean(), + "rebuild-bundle": Function Boolean(), + "registry": Array [ + null, + Object { + "domainToASCII": Function domainToASCII(domain), + "domainToUnicode": Function domainToUnicode(domain), + "fileURLToPath": Function fileURLToPath(path), + "format": Function urlFormat(urlObject, options), + "parse": Function urlParse(url, parseQueryString, slashesDenoteHost), + "pathToFileURL": Function pathToFileURL(filepath), + "resolve": Function urlResolve(source, relative), + "resolveObject": Function urlResolveObject(source, relative), + "Url": Function Url(), + "URL": Function URL(classURL), + "URLSearchParams": Function URLSearchParams(classURLSearchParams), + }, + ], + "rollback": Function Boolean(), + "save": Function Boolean(), + "save-bundle": Function Boolean(), + "save-dev": Function Boolean(), + "save-exact": Function Boolean(), + "save-optional": Function Boolean(), + "save-prefix": Function String(), + "save-prod": Function Boolean(), + "scope": Function String(), + "script-shell": Array [ + null, + Function String(), + ], + "scripts-prepend-node-path": Array [ + Function Boolean(), + "auto", + "warn-only", + ], + "searchexclude": Array [ + null, + Function String(), + ], + "searchlimit": Function Number(), + "searchopts": Function String(), + "searchstaleness": Function Number(), + "send-metrics": Function Boolean(), + "shell": Function String(), + "shrinkwrap": Function Boolean(), + "sign-git-commit": Function Boolean(), + "sign-git-tag": Function Boolean(), + "sso-poll-frequency": Function Number(), + "sso-type": Array [ + null, + "oauth", + "saml", + ], + "strict-ssl": Function Boolean(), + "tag": Function String(), + "tag-version-prefix": Function String(), + "timing": Function Boolean(), + "tmp": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "umask": Function Umask(classUmask), + "unicode": Function Boolean(), + "update-notifier": Function Boolean(), + "usage": Function Boolean(), + "user-agent": Function String(), + "userconfig": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "version": Function Boolean(), + "versions": Function Boolean(), + "viewer": Function String(), + }, +} +` + +exports[`test/lib/utils/config.js TAP no working network interfaces, on windows > must match snapshot 1`] = ` +Object { + "defaults": Object { + "access": null, + "all": false, + "allow-same-version": false, + "also": null, + "always-auth": false, + "audit": true, + "audit-level": null, + "auth-type": "legacy", + "before": null, + "bin-links": true, + "browser": null, + "ca": null, + "cache": "~/npm-cache", + "cache-lock-retries": 10, + "cache-lock-stale": 60000, + "cache-lock-wait": 10000, + "cache-max": null, + "cache-min": 10, + "cafile": null, + "call": "", + "cert": null, + "cidr": null, + "color": true, + "commit-hooks": true, + "depth": 0, + "description": true, + "dev": false, + "dry-run": false, + "editor": "vim", + "engine-strict": false, + "fetch-retries": 2, + "fetch-retry-factor": 10, + "fetch-retry-maxtimeout": 60000, + "fetch-retry-mintimeout": 10000, + "force": false, + "format-package-lock": true, + "fund": true, + "git": "git", + "git-tag-version": true, + "global": false, + "global-style": false, + "heading": "npm", + "https-proxy": null, + "if-present": false, + "ignore-prepublish": false, + "ignore-scripts": false, + "include": Array [], + "include-staged": false, + "init-author-email": "", + "init-author-name": "", + "init-author-url": "", + "init-license": "ISC", + "init-module": "~/.npm-init.js", + "init-version": "1.0.0", + "json": false, + "key": null, + "legacy-bundling": false, + "legacy-peer-deps": false, + "link": false, + "local-address": undefined, + "loglevel": "notice", + "logs-max": 10, + "long": false, + "maxsockets": 50, + "message": "%s", + "metrics-registry": null, + "node-options": null, + "node-version": "v14.8.0", + "noproxy": null, + "offline": false, + "omit": Array [], + "only": null, + "optional": true, + "otp": null, + "package": Array [], + "package-lock": true, + "package-lock-only": false, + "parseable": false, + "prefer-offline": false, + "prefer-online": false, + "preid": "", + "production": false, + "progress": true, + "proxy": null, + "read-only": false, + "rebuild-bundle": true, + "registry": "https://registry.npmjs.org/", + "rollback": true, + "save": true, + "save-bundle": false, + "save-dev": false, + "save-exact": false, + "save-optional": false, + "save-prefix": "^", + "save-prod": false, + "scope": "", + "script-shell": null, + "scripts-prepend-node-path": "warn-only", + "searchexclude": null, + "searchlimit": 20, + "searchopts": "", + "searchstaleness": 900, + "send-metrics": false, + "shell": "cmd.exe", + "shrinkwrap": true, + "sign-git-commit": false, + "sign-git-tag": false, + "sso-poll-frequency": 500, + "sso-type": "oauth", + "strict-ssl": true, + "tag": "latest", + "tag-version-prefix": "v", + "timing": false, + "tmp": "/tmp", + "umask": 22, + "unicode": true, + "update-notifier": true, + "usage": false, + "user-agent": "npm/{npm-version} node/{node-version} {platform} {arch} {ci}", + "userconfig": "~/.npmrc", + "version": false, + "versions": false, + "viewer": "browser", + }, + "shorthands": Object { + "?": Array [ + "--usage", + ], + "a": Array [ + "--all", + ], + "B": Array [ + "--save-bundle", + ], + "c": Array [ + "--call", + ], + "C": Array [ + "--prefix", + ], + "d": Array [ + "--loglevel", + "info", + ], + "D": Array [ + "--save-dev", + ], + "dd": Array [ + "--loglevel", + "verbose", + ], + "ddd": Array [ + "--loglevel", + "silly", + ], + "desc": Array [ + "--description", + ], + "E": Array [ + "--save-exact", + ], + "enjoy-by": Array [ + "--before", + ], + "f": Array [ + "--force", + ], + "g": Array [ + "--global", + ], + "h": Array [ + "--usage", + ], + "H": Array [ + "--usage", + ], + "help": Array [ + "--usage", + ], + "l": Array [ + "--long", + ], + "local": Array [ + "--no-global", + ], + "m": Array [ + "--message", + ], + "n": Array [ + "--no-yes", + ], + "N": Array [ + "--no-registry", + ], + "no-desc": Array [ + "--no-description", + ], + "no-reg": Array [ + "--no-registry", + ], + "noreg": Array [ + "--no-registry", + ], + "O": Array [ + "--save-optional", + ], + "p": Array [ + "--parseable", + ], + "P": Array [ + "--save-prod", + ], + "porcelain": Array [ + "--parseable", + ], + "q": Array [ + "--loglevel", + "warn", + ], + "quiet": Array [ + "--loglevel", + "warn", + ], + "readonly": Array [ + "--read-only", + ], + "reg": Array [ + "--registry", + ], + "s": Array [ + "--loglevel", + "silent", + ], + "S": Array [ + "--save", + ], + "silent": Array [ + "--loglevel", + "silent", + ], + "v": Array [ + "--version", + ], + "verbose": Array [ + "--loglevel", + "verbose", + ], + "y": Array [ + "--yes", + ], + }, + "types": Object { + "access": Array [ + null, + "restricted", + "public", + ], + "all": Function Boolean(), + "allow-same-version": Function Boolean(), + "also": Array [ + null, + "dev", + "development", + ], + "always-auth": Function Boolean(), + "audit": Function Boolean(), + "audit-level": Array [ + "low", + "moderate", + "high", + "critical", + "none", + null, + ], + "auth-type": Array [ + "legacy", + "sso", + "saml", + "oauth", + ], + "before": Array [ + null, + Function Date(), + ], + "bin-links": Function Boolean(), + "browser": Array [ + null, + Function Boolean(), + Function String(), + ], + "ca": Array [ + null, + Function String(), + Function Array(), + ], + "cache": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "cache-lock-retries": Function Number(), + "cache-lock-stale": Function Number(), + "cache-lock-wait": Function Number(), + "cache-max": Function Number(), + "cache-min": Function Number(), + "cafile": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "call": Function String(), + "cert": Array [ + null, + Function String(), + ], + "cidr": Array [ + null, + Function String(), + Function Array(), + ], + "color": Array [ + "always", + Function Boolean(), + ], + "commit-hooks": Function Boolean(), + "depth": Function Number(), + "description": Function Boolean(), + "dev": Function Boolean(), + "dry-run": Function Boolean(), + "editor": Function String(), + "engine-strict": Function Boolean(), + "fetch-retries": Function Number(), + "fetch-retry-factor": Function Number(), + "fetch-retry-maxtimeout": Function Number(), + "fetch-retry-mintimeout": Function Number(), + "force": Function Boolean(), + "format-package-lock": Function Boolean(), + "fund": Function Boolean(), + "git": Function String(), + "git-tag-version": Function Boolean(), + "global": Function Boolean(), + "global-style": Function Boolean(), + "globalconfig": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "group": Array [ + Function Number(), + Function String(), + ], + "ham-it-up": Function Boolean(), + "heading": Function String(), + "https-proxy": Array [ + null, + Object { + "domainToASCII": Function domainToASCII(domain), + "domainToUnicode": Function domainToUnicode(domain), + "fileURLToPath": Function fileURLToPath(path), + "format": Function urlFormat(urlObject, options), + "parse": Function urlParse(url, parseQueryString, slashesDenoteHost), + "pathToFileURL": Function pathToFileURL(filepath), + "resolve": Function urlResolve(source, relative), + "resolveObject": Function urlResolveObject(source, relative), + "Url": Function Url(), + "URL": Function URL(classURL), + "URLSearchParams": Function URLSearchParams(classURLSearchParams), + }, + ], + "if-present": Function Boolean(), + "ignore-prepublish": Function Boolean(), + "ignore-scripts": Function Boolean(), + "include": Array [ + Function Array(), + "prod", + "dev", + "optional", + "peer", + ], + "include-staged": Function Boolean(), + "init-author-email": Function String(), + "init-author-name": Function String(), + "init-author-url": Array [ + "", + Object { + "domainToASCII": Function domainToASCII(domain), + "domainToUnicode": Function domainToUnicode(domain), + "fileURLToPath": Function fileURLToPath(path), + "format": Function urlFormat(urlObject, options), + "parse": Function urlParse(url, parseQueryString, slashesDenoteHost), + "pathToFileURL": Function pathToFileURL(filepath), + "resolve": Function urlResolve(source, relative), + "resolveObject": Function urlResolveObject(source, relative), + "Url": Function Url(), + "URL": Function URL(classURL), + "URLSearchParams": Function URLSearchParams(classURLSearchParams), + }, + ], + "init-license": Function String(), + "init-module": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "init-version": Object { + "clean": Function clean(version, options), + "cmp": Function cmp(a, op, b, loose), + "coerce": Function coerce(version, options), + "Comparator": Function Comparator(classComparator), + "compare": Function compare(a, b, loose), + "compareBuild": Function compareBuild(a, b, loose), + "compareIdentifiers": Function compareIdentifiers(a, b), + "compareLoose": Function compareLoose(a, b), + "diff": Function diff(version1, version2), + "eq": Function eq(a, b, loose), + "gt": Function gt(a, b, loose), + "gte": Function gte(a, b, loose), + "gtr": Function gtr(version, range, options), + "inc": Function inc(version, release, options, identifier), + "intersects": Function intersects(r1, r2, options), + "lt": Function lt(a, b, loose), + "lte": Function lte(a, b, loose), + "ltr": Function ltr(version, range, options), + "major": Function major(a, loose), + "maxSatisfying": Function maxSatisfying(versions, range, options), + "minor": Function minor(a, loose), + "minSatisfying": Function minSatisfying(versions, range, options), + "minVersion": Function minVersion(range, loose), + "neq": Function neq(a, b, loose), + "outside": Function outside(version, range, hilo, options), + "parse": Function parse(version, options), + "patch": Function patch(a, loose), + "prerelease": Function prerelease(version, options), + "Range": Function Range(classRange), + "rcompare": Function rcompare(a, b, loose), + "rcompareIdentifiers": Function rcompareIdentifiers(a, b), + "re": Array [ + /0|[1-9]\\d*/, + /[0-9]+/, + /\\d*[a-zA-Z-][a-zA-Z0-9-]*/, + /(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)/, + /([0-9]+)\\.([0-9]+)\\.([0-9]+)/, + /(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)/, + /(?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*)/, + /(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))/, + /(?:-?((?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))/, + /[0-9A-Za-z-]+/, + /(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))/, + /v?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?/, + /^v?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?$/, + /[v=\\s]*([0-9]+)\\.([0-9]+)\\.([0-9]+)(?:-?((?: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Z0-9-]*))*)))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?)?)?)\\s*$/, + /(<|>)?=?\\s*\\*/, + /^\\s*>=\\s*0.0.0\\s*$/, + /^\\s*>=\\s*0.0.0-0\\s*$/, + ], + "rsort": Function rsort(list, loose), + "satisfies": Function satisfies(version, range, options), + "SemVer": Function SemVer(classSemVer), + "SEMVER_SPEC_VERSION": "2.0.0", + "simplifyRange": Function (versions, range, options), + "sort": Function sort(list, loose), + "src": Array [ + "0|[1-9]\\\\d*", + "[0-9]+", + "\\\\d*[a-zA-Z-][a-zA-Z0-9-]*", + "(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)", + "([0-9]+)\\\\.([0-9]+)\\\\.([0-9]+)", + "(?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)", + "(?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)", + "(?:-((?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\\\.(?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))", + "(?:-?((?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\\\.(?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))", + "[0-9A-Za-z-]+", + "(?:\\\\+([0-9A-Za-z-]+(?:\\\\.[0-9A-Za-z-]+)*))", + "v?(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)(?:-((?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\\\.(?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\\\\+([0-9A-Za-z-]+(?:\\\\.[0-9A-Za-z-]+)*))?", + "^v?(0|[1-9]\\\\d*)\\\\.(0|[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[0-9A-Za-z-]+)*))?)?)?)\\\\s+-\\\\s+([v=\\\\s]*(0|[1-9]\\\\d*|x|X|\\\\*)(?:\\\\.(0|[1-9]\\\\d*|x|X|\\\\*)(?:\\\\.(0|[1-9]\\\\d*|x|X|\\\\*)(?:(?:-((?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\\\.(?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\\\+([0-9A-Za-z-]+(?:\\\\.[0-9A-Za-z-]+)*))?)?)?)\\\\s*$", + "^\\\\s*([v=\\\\s]*([0-9]+|x|X|\\\\*)(?:\\\\.([0-9]+|x|X|\\\\*)(?:\\\\.([0-9]+|x|X|\\\\*)(?:(?:-?((?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\\\.(?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\\\+([0-9A-Za-z-]+(?:\\\\.[0-9A-Za-z-]+)*))?)?)?)\\\\s+-\\\\s+([v=\\\\s]*([0-9]+|x|X|\\\\*)(?:\\\\.([0-9]+|x|X|\\\\*)(?:\\\\.([0-9]+|x|X|\\\\*)(?:(?:-?((?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\\\.(?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\\\+([0-9A-Za-z-]+(?:\\\\.[0-9A-Za-z-]+)*))?)?)?)\\\\s*$", + "(<|>)?=?\\\\s*\\\\*", + "^\\\\s*>=\\\\s*0.0.0\\\\s*$", + "^\\\\s*>=\\\\s*0.0.0-0\\\\s*$", + ], + "subset": Function subset(sub, dom, options), + "toComparators": Function toComparators(range, options), + "tokens": Object { + "BUILD": 10, + "BUILDIDENTIFIER": 9, + "CARET": 30, + "CARETLOOSE": 31, + "CARETTRIM": 29, + "COERCE": 22, + "COERCERTL": 23, + "COMPARATOR": 33, + "COMPARATORLOOSE": 32, + "COMPARATORTRIM": 34, + "FULL": 12, + "FULLPLAIN": 11, + "GTE0": 38, + "GTE0PRE": 39, + "GTLT": 15, + "HYPHENRANGE": 35, + "HYPHENRANGELOOSE": 36, + "LONECARET": 28, + "LONETILDE": 24, + "LOOSE": 14, + "LOOSEPLAIN": 13, + "MAINVERSION": 3, + "MAINVERSIONLOOSE": 4, + "NONNUMERICIDENTIFIER": 2, + "NUMERICIDENTIFIER": 0, + "NUMERICIDENTIFIERLOOSE": 1, + "PRERELEASE": 7, + "PRERELEASEIDENTIFIER": 5, + "PRERELEASEIDENTIFIERLOOSE": 6, + "PRERELEASELOOSE": 8, + "STAR": 37, + "TILDE": 26, + "TILDELOOSE": 27, + "TILDETRIM": 25, + "XRANGE": 20, + "XRANGEIDENTIFIER": 17, + "XRANGEIDENTIFIERLOOSE": 16, + "XRANGELOOSE": 21, + "XRANGEPLAIN": 18, + "XRANGEPLAINLOOSE": 19, + }, + "valid": Function valid(version, options), + "validRange": Function validRange(range, options), + }, + "json": Function Boolean(), + "key": Array [ + null, + Function String(), + ], + "legacy-bundling": Function Boolean(), + "legacy-peer-deps": Function Boolean(), + "link": Function Boolean(), + "local-address": Array [ + undefined, + ], + "loglevel": Array [ + "silent", + "error", + "warn", + "notice", + "http", + "timing", + "info", + "verbose", + "silly", + ], + "logs-max": Function Number(), + "long": Function Boolean(), + "maxsockets": Function Number(), + "message": Function String(), + "metrics-registry": Array [ + null, + Function String(), + ], + "node-options": Array [ + null, + Function String(), + ], + "node-version": Array [ + null, + Object { + "clean": Function clean(version, options), + "cmp": Function cmp(a, op, b, loose), + "coerce": Function coerce(version, options), + "Comparator": Function Comparator(classComparator), + "compare": Function compare(a, b, loose), + "compareBuild": Function compareBuild(a, b, loose), + "compareIdentifiers": Function compareIdentifiers(a, b), + "compareLoose": Function compareLoose(a, b), + "diff": Function diff(version1, version2), + "eq": Function eq(a, b, loose), + "gt": Function gt(a, b, loose), + "gte": Function gte(a, b, loose), + "gtr": Function gtr(version, range, options), + "inc": Function inc(version, release, options, identifier), + "intersects": Function intersects(r1, r2, options), + "lt": Function lt(a, b, loose), + "lte": Function lte(a, b, loose), + "ltr": Function ltr(version, range, options), + "major": Function major(a, loose), + "maxSatisfying": Function maxSatisfying(versions, range, options), + "minor": Function minor(a, loose), + "minSatisfying": Function minSatisfying(versions, range, options), + "minVersion": Function minVersion(range, loose), + "neq": Function neq(a, b, loose), + "outside": Function outside(version, range, hilo, options), + "parse": Function parse(version, options), + "patch": Function patch(a, loose), + "prerelease": Function prerelease(version, options), + "Range": Function Range(classRange), + "rcompare": Function rcompare(a, b, loose), + "rcompareIdentifiers": Function rcompareIdentifiers(a, b), + "re": Array [ + /0|[1-9]\\d*/, + /[0-9]+/, + /\\d*[a-zA-Z-][a-zA-Z0-9-]*/, + /(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)/, + /([0-9]+)\\.([0-9]+)\\.([0-9]+)/, + /(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)/, + /(?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*)/, + /(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))/, + /(?:-?((?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))/, + /[0-9A-Za-z-]+/, + /(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))/, + /v?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\\+([0-9A-Za-z-]+(?:\\.[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0-9-]*)(?:\\.(?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?)?)?)\\s+-\\s+([v=\\s]*([0-9]+|x|X|\\*)(?:\\.([0-9]+|x|X|\\*)(?:\\.([0-9]+|x|X|\\*)(?:(?:-?((?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?)?)?)\\s*$/, + /(<|>)?=?\\s*\\*/, + /^\\s*>=\\s*0.0.0\\s*$/, + /^\\s*>=\\s*0.0.0-0\\s*$/, + ], + "rsort": Function rsort(list, loose), + "satisfies": Function satisfies(version, range, options), + "SemVer": Function SemVer(classSemVer), + "SEMVER_SPEC_VERSION": "2.0.0", + "simplifyRange": Function (versions, range, options), + "sort": Function sort(list, loose), + "src": Array [ + "0|[1-9]\\\\d*", + "[0-9]+", + "\\\\d*[a-zA-Z-][a-zA-Z0-9-]*", + "(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)", + "([0-9]+)\\\\.([0-9]+)\\\\.([0-9]+)", + "(?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)", + "(?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)", + "(?:-((?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\\\.(?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))", + "(?:-?((?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\\\.(?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))", + "[0-9A-Za-z-]+", + "(?:\\\\+([0-9A-Za-z-]+(?:\\\\.[0-9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9A-Za-z-]+)*))?)?)?)\\\\s*$", + "(<|>)?=?\\\\s*\\\\*", + "^\\\\s*>=\\\\s*0.0.0\\\\s*$", + "^\\\\s*>=\\\\s*0.0.0-0\\\\s*$", + ], + "subset": Function subset(sub, dom, options), + "toComparators": Function toComparators(range, options), + "tokens": Object { + "BUILD": 10, + "BUILDIDENTIFIER": 9, + "CARET": 30, + "CARETLOOSE": 31, + "CARETTRIM": 29, + "COERCE": 22, + "COERCERTL": 23, + "COMPARATOR": 33, + "COMPARATORLOOSE": 32, + "COMPARATORTRIM": 34, + "FULL": 12, + "FULLPLAIN": 11, + "GTE0": 38, + "GTE0PRE": 39, + "GTLT": 15, + "HYPHENRANGE": 35, + "HYPHENRANGELOOSE": 36, + "LONECARET": 28, + "LONETILDE": 24, + "LOOSE": 14, + "LOOSEPLAIN": 13, + "MAINVERSION": 3, + "MAINVERSIONLOOSE": 4, + "NONNUMERICIDENTIFIER": 2, + "NUMERICIDENTIFIER": 0, + "NUMERICIDENTIFIERLOOSE": 1, + "PRERELEASE": 7, + "PRERELEASEIDENTIFIER": 5, + "PRERELEASEIDENTIFIERLOOSE": 6, + "PRERELEASELOOSE": 8, + "STAR": 37, + "TILDE": 26, + "TILDELOOSE": 27, + "TILDETRIM": 25, + "XRANGE": 20, + "XRANGEIDENTIFIER": 17, + "XRANGEIDENTIFIERLOOSE": 16, + "XRANGELOOSE": 21, + "XRANGEPLAIN": 18, + "XRANGEPLAINLOOSE": 19, + }, + "valid": Function valid(version, options), + "validRange": Function validRange(range, options), + }, + ], + "noproxy": Array [ + null, + Function String(), + Function Array(), + ], + "offline": Function Boolean(), + "omit": Array [ + Function Array(), + "dev", + "optional", + "peer", + ], + "only": Array [ + null, + "dev", + "development", + "prod", + "production", + ], + "optional": Function Boolean(), + "otp": Array [ + null, + Function String(), + ], + "package": Array [ + Function String(), + Function Array(), + ], + "package-lock": Function Boolean(), + "package-lock-only": Function Boolean(), + "parseable": Function Boolean(), + "prefer-offline": Function Boolean(), + "prefer-online": Function Boolean(), + "prefix": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "preid": Function String(), + "production": Function Boolean(), + "progress": Function Boolean(), + "proxy": Array [ + null, + false, + Object { + "domainToASCII": Function domainToASCII(domain), + "domainToUnicode": Function domainToUnicode(domain), + "fileURLToPath": Function fileURLToPath(path), + "format": Function urlFormat(urlObject, options), + "parse": Function urlParse(url, parseQueryString, slashesDenoteHost), + "pathToFileURL": Function pathToFileURL(filepath), + "resolve": Function urlResolve(source, relative), + "resolveObject": Function urlResolveObject(source, relative), + "Url": Function Url(), + "URL": Function URL(classURL), + "URLSearchParams": Function URLSearchParams(classURLSearchParams), + }, + ], + "read-only": Function Boolean(), + "rebuild-bundle": Function Boolean(), + "registry": Array [ + null, + Object { + "domainToASCII": Function domainToASCII(domain), + "domainToUnicode": Function domainToUnicode(domain), + "fileURLToPath": Function fileURLToPath(path), + "format": Function urlFormat(urlObject, options), + "parse": Function urlParse(url, parseQueryString, slashesDenoteHost), + "pathToFileURL": Function pathToFileURL(filepath), + "resolve": Function urlResolve(source, relative), + "resolveObject": Function urlResolveObject(source, relative), + "Url": Function Url(), + "URL": Function URL(classURL), + "URLSearchParams": Function URLSearchParams(classURLSearchParams), + }, + ], + "rollback": Function Boolean(), + "save": Function Boolean(), + "save-bundle": Function Boolean(), + "save-dev": Function Boolean(), + "save-exact": Function Boolean(), + "save-optional": Function Boolean(), + "save-prefix": Function String(), + "save-prod": Function Boolean(), + "scope": Function String(), + "script-shell": Array [ + null, + Function String(), + ], + "scripts-prepend-node-path": Array [ + Function Boolean(), + "auto", + "warn-only", + ], + "searchexclude": Array [ + null, + Function String(), + ], + "searchlimit": Function Number(), + "searchopts": Function String(), + "searchstaleness": Function Number(), + "send-metrics": Function Boolean(), + "shell": Function String(), + "shrinkwrap": Function Boolean(), + "sign-git-commit": Function Boolean(), + "sign-git-tag": Function Boolean(), + "sso-poll-frequency": Function Number(), + "sso-type": Array [ + null, + "oauth", + "saml", + ], + "strict-ssl": Function Boolean(), + "tag": Function String(), + "tag-version-prefix": Function String(), + "timing": Function Boolean(), + "tmp": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "umask": Function Umask(classUmask), + "unicode": Function Boolean(), + "update-notifier": Function Boolean(), + "usage": Function Boolean(), + "user-agent": Function String(), + "userconfig": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "version": Function Boolean(), + "versions": Function Boolean(), + "viewer": Function String(), + }, +} +` + +exports[`test/lib/utils/config.js TAP working network interfaces, not windows > must match snapshot 1`] = ` +Object { + "defaults": Object { + "access": null, + "all": false, + "allow-same-version": false, + "also": null, + "always-auth": false, + "audit": true, + "audit-level": null, + "auth-type": "legacy", + "before": null, + "bin-links": true, + "browser": null, + "ca": null, + "cache": "~/.npm", + "cache-lock-retries": 10, + "cache-lock-stale": 60000, + "cache-lock-wait": 10000, + "cache-max": null, + "cache-min": 10, + "cafile": null, + "call": "", + "cert": null, + "cidr": null, + "color": true, + "commit-hooks": true, + "depth": 0, + "description": true, + "dev": false, + "dry-run": false, + "editor": "vim", + "engine-strict": false, + "fetch-retries": 2, + "fetch-retry-factor": 10, + "fetch-retry-maxtimeout": 60000, + "fetch-retry-mintimeout": 10000, + "force": false, + "format-package-lock": true, + "fund": true, + "git": "git", + "git-tag-version": true, + "global": false, + "global-style": false, + "heading": "npm", + "https-proxy": null, + "if-present": false, + "ignore-prepublish": false, + "ignore-scripts": false, + "include": Array [], + "include-staged": false, + "init-author-email": "", + "init-author-name": "", + "init-author-url": "", + "init-license": "ISC", + "init-module": "~/.npm-init.js", + "init-version": "1.0.0", + "json": false, + "key": null, + "legacy-bundling": false, + "legacy-peer-deps": false, + "link": false, + "local-address": undefined, + "loglevel": "notice", + "logs-max": 10, + "long": false, + "maxsockets": 50, + "message": "%s", + "metrics-registry": null, + "node-options": null, + "node-version": "v14.8.0", + "noproxy": null, + "offline": false, + "omit": Array [], + "only": null, + "optional": true, + "otp": null, + "package": Array [], + "package-lock": true, + "package-lock-only": false, + "parseable": false, + "prefer-offline": false, + "prefer-online": false, + "preid": "", + "production": false, + "progress": true, + "proxy": null, + "read-only": false, + "rebuild-bundle": true, + "registry": "https://registry.npmjs.org/", + "rollback": true, + "save": true, + "save-bundle": false, + "save-dev": false, + "save-exact": false, + "save-optional": false, + "save-prefix": "^", + "save-prod": false, + "scope": "", + "script-shell": null, + "scripts-prepend-node-path": "warn-only", + "searchexclude": null, + "searchlimit": 20, + "searchopts": "", + "searchstaleness": 900, + "send-metrics": false, + "shell": "/usr/local/bin/bash", + "shrinkwrap": true, + "sign-git-commit": false, + "sign-git-tag": false, + "sso-poll-frequency": 500, + "sso-type": "oauth", + "strict-ssl": true, + "tag": "latest", + "tag-version-prefix": "v", + "timing": false, + "tmp": "/tmp", + "umask": 22, + "unicode": true, + "update-notifier": true, + "usage": false, + "user-agent": "npm/{npm-version} node/{node-version} {platform} {arch} {ci}", + "userconfig": "~/.npmrc", + "version": false, + "versions": false, + "viewer": "man", + }, + "shorthands": Object { + "?": Array [ + "--usage", + ], + "a": Array [ + "--all", + ], + "B": Array [ + "--save-bundle", + ], + "c": Array [ + "--call", + ], + "C": Array [ + "--prefix", + ], + "d": Array [ + "--loglevel", + "info", + ], + "D": Array [ + "--save-dev", + ], + "dd": Array [ + "--loglevel", + "verbose", + ], + "ddd": Array [ + "--loglevel", + "silly", + ], + "desc": Array [ + "--description", + ], + "E": Array [ + "--save-exact", + ], + "enjoy-by": Array [ + "--before", + ], + "f": Array [ + "--force", + ], + "g": Array [ + "--global", + ], + "h": Array [ + "--usage", + ], + "H": Array [ + "--usage", + ], + "help": Array [ + "--usage", + ], + "l": Array [ + "--long", + ], + "local": Array [ + "--no-global", + ], + "m": Array [ + "--message", + ], + "n": Array [ + "--no-yes", + ], + "N": Array [ + "--no-registry", + ], + "no-desc": Array [ + "--no-description", + ], + "no-reg": Array [ + "--no-registry", + ], + "noreg": Array [ + "--no-registry", + ], + "O": Array [ + "--save-optional", + ], + "p": Array [ + "--parseable", + ], + "P": Array [ + "--save-prod", + ], + "porcelain": Array [ + "--parseable", + ], + "q": Array [ + "--loglevel", + "warn", + ], + "quiet": Array [ + "--loglevel", + "warn", + ], + "readonly": Array [ + "--read-only", + ], + "reg": Array [ + "--registry", + ], + "s": Array [ + "--loglevel", + "silent", + ], + "S": Array [ + "--save", + ], + "silent": Array [ + "--loglevel", + "silent", + ], + "v": Array [ + "--version", + ], + "verbose": Array [ + "--loglevel", + "verbose", + ], + "y": Array [ + "--yes", + ], + }, + "types": Object { + "access": Array [ + null, + "restricted", + "public", + ], + "all": Function Boolean(), + "allow-same-version": Function Boolean(), + "also": Array [ + null, + "dev", + "development", + ], + "always-auth": Function Boolean(), + "audit": Function Boolean(), + "audit-level": Array [ + "low", + "moderate", + "high", + "critical", + "none", + null, + ], + "auth-type": Array [ + "legacy", + "sso", + "saml", + "oauth", + ], + "before": Array [ + null, + Function Date(), + ], + "bin-links": Function Boolean(), + "browser": Array [ + null, + Function Boolean(), + Function String(), + ], + "ca": Array [ + null, + Function String(), + Function Array(), + ], + "cache": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "cache-lock-retries": Function Number(), + "cache-lock-stale": Function Number(), + "cache-lock-wait": Function Number(), + "cache-max": Function Number(), + "cache-min": Function Number(), + "cafile": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "call": Function String(), + "cert": Array [ + null, + Function String(), + ], + "cidr": Array [ + null, + Function String(), + Function Array(), + ], + "color": Array [ + "always", + Function Boolean(), + ], + "commit-hooks": Function Boolean(), + "depth": Function Number(), + "description": Function Boolean(), + "dev": Function Boolean(), + "dry-run": Function Boolean(), + "editor": Function String(), + "engine-strict": Function Boolean(), + "fetch-retries": Function Number(), + "fetch-retry-factor": Function Number(), + "fetch-retry-maxtimeout": Function Number(), + "fetch-retry-mintimeout": Function Number(), + "force": Function Boolean(), + "format-package-lock": Function Boolean(), + "fund": Function Boolean(), + "git": Function String(), + "git-tag-version": Function Boolean(), + "global": Function Boolean(), + "global-style": Function Boolean(), + "globalconfig": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "group": Array [ + Function Number(), + Function String(), + ], + "ham-it-up": Function Boolean(), + "heading": Function String(), + "https-proxy": Array [ + null, + Object { + "domainToASCII": Function domainToASCII(domain), + "domainToUnicode": Function domainToUnicode(domain), + "fileURLToPath": Function fileURLToPath(path), + "format": Function urlFormat(urlObject, options), + "parse": Function urlParse(url, parseQueryString, slashesDenoteHost), + "pathToFileURL": Function pathToFileURL(filepath), + "resolve": Function urlResolve(source, relative), + "resolveObject": Function urlResolveObject(source, relative), + "Url": Function Url(), + "URL": Function URL(classURL), + "URLSearchParams": Function URLSearchParams(classURLSearchParams), + }, + ], + "if-present": Function Boolean(), + "ignore-prepublish": Function Boolean(), + "ignore-scripts": Function Boolean(), + "include": Array [ + Function Array(), + "prod", + "dev", + "optional", + "peer", + ], + "include-staged": Function Boolean(), + "init-author-email": Function String(), + "init-author-name": Function String(), + "init-author-url": Array [ + "", + Object { + "domainToASCII": Function domainToASCII(domain), + "domainToUnicode": Function domainToUnicode(domain), + "fileURLToPath": Function fileURLToPath(path), + "format": Function urlFormat(urlObject, options), + "parse": Function urlParse(url, parseQueryString, slashesDenoteHost), + "pathToFileURL": Function pathToFileURL(filepath), + "resolve": Function urlResolve(source, relative), + "resolveObject": Function urlResolveObject(source, relative), + "Url": Function Url(), + "URL": Function URL(classURL), + "URLSearchParams": Function URLSearchParams(classURLSearchParams), + }, + ], + "init-license": Function String(), + "init-module": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "init-version": Object { + "clean": Function clean(version, options), + "cmp": Function cmp(a, op, b, loose), + "coerce": Function coerce(version, options), + "Comparator": Function Comparator(classComparator), + "compare": Function compare(a, b, loose), + "compareBuild": Function compareBuild(a, b, loose), + "compareIdentifiers": Function compareIdentifiers(a, b), + "compareLoose": Function compareLoose(a, b), + "diff": Function diff(version1, version2), + "eq": Function eq(a, b, loose), + "gt": Function gt(a, b, loose), + "gte": Function gte(a, b, loose), + "gtr": Function gtr(version, range, options), + "inc": Function inc(version, release, options, identifier), + "intersects": Function intersects(r1, r2, options), + "lt": Function lt(a, b, loose), + "lte": Function lte(a, b, loose), + "ltr": Function ltr(version, range, options), + "major": Function major(a, loose), + "maxSatisfying": Function maxSatisfying(versions, range, options), + "minor": Function minor(a, loose), + "minSatisfying": Function minSatisfying(versions, range, options), + "minVersion": Function minVersion(range, loose), + "neq": Function neq(a, b, loose), + "outside": Function outside(version, range, hilo, options), + "parse": Function parse(version, options), + "patch": Function patch(a, loose), + "prerelease": Function prerelease(version, options), + "Range": Function Range(classRange), + "rcompare": Function rcompare(a, b, loose), + "rcompareIdentifiers": Function rcompareIdentifiers(a, b), + "re": Array [ + /0|[1-9]\\d*/, + /[0-9]+/, + /\\d*[a-zA-Z-][a-zA-Z0-9-]*/, + /(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)/, + /([0-9]+)\\.([0-9]+)\\.([0-9]+)/, + /(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)/, + /(?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*)/, + /(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))/, + /(?:-?((?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))/, + /[0-9A-Za-z-]+/, + /(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))/, + /v?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA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|x|X|\\*)(?:(?:-?((?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?)?)?)\\s+-\\s+([v=\\s]*([0-9]+|x|X|\\*)(?:\\.([0-9]+|x|X|\\*)(?:\\.([0-9]+|x|X|\\*)(?:(?:-?((?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?)?)?)\\s*$/, + /(<|>)?=?\\s*\\*/, + /^\\s*>=\\s*0.0.0\\s*$/, + /^\\s*>=\\s*0.0.0-0\\s*$/, + ], + "rsort": Function rsort(list, loose), + "satisfies": Function satisfies(version, range, options), + "SemVer": Function SemVer(classSemVer), + "SEMVER_SPEC_VERSION": "2.0.0", + "simplifyRange": Function (versions, range, options), + "sort": Function sort(list, loose), + "src": Array [ + "0|[1-9]\\\\d*", + "[0-9]+", + "\\\\d*[a-zA-Z-][a-zA-Z0-9-]*", + "(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)", + "([0-9]+)\\\\.([0-9]+)\\\\.([0-9]+)", + "(?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)", + "(?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)", + "(?:-((?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\\\.(?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))", + "(?:-?((?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\\\.(?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))", + "[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zA-Z0-9-]*))*)))?(?:\\\\+([0-9A-Za-z-]+(?:\\\\.[0-9A-Za-z-]+)*))?)?)?)\\\\s*$", + "(<|>)?=?\\\\s*\\\\*", + "^\\\\s*>=\\\\s*0.0.0\\\\s*$", + "^\\\\s*>=\\\\s*0.0.0-0\\\\s*$", + ], + "subset": Function subset(sub, dom, options), + "toComparators": Function toComparators(range, options), + "tokens": Object { + "BUILD": 10, + "BUILDIDENTIFIER": 9, + "CARET": 30, + "CARETLOOSE": 31, + "CARETTRIM": 29, + "COERCE": 22, + "COERCERTL": 23, + "COMPARATOR": 33, + "COMPARATORLOOSE": 32, + "COMPARATORTRIM": 34, + "FULL": 12, + "FULLPLAIN": 11, + "GTE0": 38, + "GTE0PRE": 39, + "GTLT": 15, + "HYPHENRANGE": 35, + "HYPHENRANGELOOSE": 36, + "LONECARET": 28, + "LONETILDE": 24, + "LOOSE": 14, + "LOOSEPLAIN": 13, + "MAINVERSION": 3, + "MAINVERSIONLOOSE": 4, + "NONNUMERICIDENTIFIER": 2, + "NUMERICIDENTIFIER": 0, + "NUMERICIDENTIFIERLOOSE": 1, + "PRERELEASE": 7, + "PRERELEASEIDENTIFIER": 5, + "PRERELEASEIDENTIFIERLOOSE": 6, + "PRERELEASELOOSE": 8, + "STAR": 37, + "TILDE": 26, + "TILDELOOSE": 27, + "TILDETRIM": 25, + "XRANGE": 20, + "XRANGEIDENTIFIER": 17, + "XRANGEIDENTIFIERLOOSE": 16, + "XRANGELOOSE": 21, + "XRANGEPLAIN": 18, + "XRANGEPLAINLOOSE": 19, + }, + "valid": Function valid(version, options), + "validRange": Function validRange(range, options), + }, + "json": Function Boolean(), + "key": Array [ + null, + Function String(), + ], + "legacy-bundling": Function Boolean(), + "legacy-peer-deps": Function Boolean(), + "link": Function Boolean(), + "local-address": Array [ + undefined, + "127.0.0.1", + "no place like home", + ], + "loglevel": Array [ + "silent", + "error", + "warn", + "notice", + "http", + "timing", + "info", + "verbose", + "silly", + ], + "logs-max": Function Number(), + "long": Function Boolean(), + "maxsockets": Function Number(), + "message": Function String(), + "metrics-registry": Array [ + null, + Function String(), + ], + "node-options": Array [ + null, + Function String(), + ], + "node-version": Array [ + null, + Object { + "clean": Function clean(version, options), + "cmp": Function cmp(a, op, b, loose), + "coerce": Function coerce(version, options), + "Comparator": Function Comparator(classComparator), + "compare": Function compare(a, b, loose), + "compareBuild": Function compareBuild(a, b, loose), + "compareIdentifiers": Function compareIdentifiers(a, b), + "compareLoose": Function compareLoose(a, b), + "diff": Function diff(version1, version2), + "eq": Function eq(a, b, loose), + "gt": Function gt(a, b, loose), + "gte": Function gte(a, b, loose), + "gtr": Function gtr(version, range, options), + "inc": Function inc(version, release, options, identifier), + "intersects": Function intersects(r1, r2, options), + "lt": Function lt(a, b, loose), + "lte": Function lte(a, b, loose), + "ltr": Function ltr(version, range, options), + "major": Function major(a, loose), + "maxSatisfying": Function maxSatisfying(versions, range, options), + "minor": Function minor(a, loose), + "minSatisfying": Function minSatisfying(versions, range, options), + "minVersion": Function minVersion(range, loose), + "neq": Function neq(a, b, loose), + "outside": Function outside(version, range, hilo, options), + "parse": Function parse(version, options), + "patch": Function patch(a, loose), + "prerelease": Function prerelease(version, options), + "Range": Function Range(classRange), + "rcompare": Function rcompare(a, b, loose), + "rcompareIdentifiers": Function rcompareIdentifiers(a, b), + "re": Array [ + /0|[1-9]\\d*/, + /[0-9]+/, + /\\d*[a-zA-Z-][a-zA-Z0-9-]*/, + /(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)/, + /([0-9]+)\\.([0-9]+)\\.([0-9]+)/, + /(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)/, + /(?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*)/, + /(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))/, + /(?:-?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(?:\\.(0|[1-9]\\d*|x|X|\\*)(?:\\.(0|[1-9]\\d*|x|X|\\*)(?:(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?)?)?)\\s*$/, + /^\\s*([v=\\s]*([0-9]+|x|X|\\*)(?:\\.([0-9]+|x|X|\\*)(?:\\.([0-9]+|x|X|\\*)(?:(?:-?((?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?)?)?)\\s+-\\s+([v=\\s]*([0-9]+|x|X|\\*)(?:\\.([0-9]+|x|X|\\*)(?:\\.([0-9]+|x|X|\\*)(?:(?:-?((?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:[0-9]+|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?)?)?)\\s*$/, + /(<|>)?=?\\s*\\*/, + /^\\s*>=\\s*0.0.0\\s*$/, + /^\\s*>=\\s*0.0.0-0\\s*$/, + ], + "rsort": Function rsort(list, loose), + "satisfies": Function satisfies(version, range, options), + "SemVer": Function SemVer(classSemVer), + "SEMVER_SPEC_VERSION": "2.0.0", + "simplifyRange": Function (versions, range, options), + "sort": Function sort(list, loose), + "src": Array [ + "0|[1-9]\\\\d*", + "[0-9]+", + "\\\\d*[a-zA-Z-][a-zA-Z0-9-]*", + "(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)", + "([0-9]+)\\\\.([0-9]+)\\\\.([0-9]+)", + "(?:0|[1-9]\\\\d*|\\\\d*[a-zA-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\\\\.(?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\\\+([0-9A-Za-z-]+(?:\\\\.[0-9A-Za-z-]+)*))?)?)?)\\\\s+-\\\\s+([v=\\\\s]*([0-9]+|x|X|\\\\*)(?:\\\\.([0-9]+|x|X|\\\\*)(?:\\\\.([0-9]+|x|X|\\\\*)(?:(?:-?((?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\\\.(?:[0-9]+|\\\\d*[a-zA-Z-][a-zA-Z0-9-]*))*)))?(?:\\\\+([0-9A-Za-z-]+(?:\\\\.[0-9A-Za-z-]+)*))?)?)?)\\\\s*$", + "(<|>)?=?\\\\s*\\\\*", + "^\\\\s*>=\\\\s*0.0.0\\\\s*$", + "^\\\\s*>=\\\\s*0.0.0-0\\\\s*$", + ], + "subset": Function subset(sub, dom, options), + "toComparators": Function toComparators(range, options), + "tokens": Object { + "BUILD": 10, + "BUILDIDENTIFIER": 9, + "CARET": 30, + "CARETLOOSE": 31, + "CARETTRIM": 29, + "COERCE": 22, + "COERCERTL": 23, + "COMPARATOR": 33, + "COMPARATORLOOSE": 32, + "COMPARATORTRIM": 34, + "FULL": 12, + "FULLPLAIN": 11, + "GTE0": 38, + "GTE0PRE": 39, + "GTLT": 15, + "HYPHENRANGE": 35, + "HYPHENRANGELOOSE": 36, + "LONECARET": 28, + "LONETILDE": 24, + "LOOSE": 14, + "LOOSEPLAIN": 13, + "MAINVERSION": 3, + "MAINVERSIONLOOSE": 4, + "NONNUMERICIDENTIFIER": 2, + "NUMERICIDENTIFIER": 0, + "NUMERICIDENTIFIERLOOSE": 1, + "PRERELEASE": 7, + "PRERELEASEIDENTIFIER": 5, + "PRERELEASEIDENTIFIERLOOSE": 6, + "PRERELEASELOOSE": 8, + "STAR": 37, + "TILDE": 26, + "TILDELOOSE": 27, + "TILDETRIM": 25, + "XRANGE": 20, + "XRANGEIDENTIFIER": 17, + "XRANGEIDENTIFIERLOOSE": 16, + "XRANGELOOSE": 21, + "XRANGEPLAIN": 18, + "XRANGEPLAINLOOSE": 19, + }, + "valid": Function valid(version, options), + "validRange": Function validRange(range, options), + }, + ], + "noproxy": Array [ + null, + Function String(), + Function Array(), + ], + "offline": Function Boolean(), + "omit": Array [ + Function Array(), + "dev", + "optional", + "peer", + ], + "only": Array [ + null, + "dev", + "development", + "prod", + "production", + ], + "optional": Function Boolean(), + "otp": Array [ + null, + Function String(), + ], + "package": Array [ + Function String(), + Function Array(), + ], + "package-lock": Function Boolean(), + "package-lock-only": Function Boolean(), + "parseable": Function Boolean(), + "prefer-offline": Function Boolean(), + "prefer-online": Function Boolean(), + "prefix": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "preid": Function String(), + "production": Function Boolean(), + "progress": Function Boolean(), + "proxy": Array [ + null, + false, + Object { + "domainToASCII": Function domainToASCII(domain), + "domainToUnicode": Function domainToUnicode(domain), + "fileURLToPath": Function fileURLToPath(path), + "format": Function urlFormat(urlObject, options), + "parse": Function urlParse(url, parseQueryString, slashesDenoteHost), + "pathToFileURL": Function pathToFileURL(filepath), + "resolve": Function urlResolve(source, relative), + "resolveObject": Function urlResolveObject(source, relative), + "Url": Function Url(), + "URL": Function URL(classURL), + "URLSearchParams": Function URLSearchParams(classURLSearchParams), + }, + ], + "read-only": Function Boolean(), + "rebuild-bundle": Function Boolean(), + "registry": Array [ + null, + Object { + "domainToASCII": Function domainToASCII(domain), + "domainToUnicode": Function domainToUnicode(domain), + "fileURLToPath": Function fileURLToPath(path), + "format": Function urlFormat(urlObject, options), + "parse": Function urlParse(url, parseQueryString, slashesDenoteHost), + "pathToFileURL": Function pathToFileURL(filepath), + "resolve": Function urlResolve(source, relative), + "resolveObject": Function urlResolveObject(source, relative), + "Url": Function Url(), + "URL": Function URL(classURL), + "URLSearchParams": Function URLSearchParams(classURLSearchParams), + }, + ], + "rollback": Function Boolean(), + "save": Function Boolean(), + "save-bundle": Function Boolean(), + "save-dev": Function Boolean(), + "save-exact": Function Boolean(), + "save-optional": Function Boolean(), + "save-prefix": Function String(), + "save-prod": Function Boolean(), + "scope": Function String(), + "script-shell": Array [ + null, + Function String(), + ], + "scripts-prepend-node-path": Array [ + Function Boolean(), + "auto", + "warn-only", + ], + "searchexclude": Array [ + null, + Function String(), + ], + "searchlimit": Function Number(), + "searchopts": Function String(), + "searchstaleness": Function Number(), + "send-metrics": Function Boolean(), + "shell": Function String(), + "shrinkwrap": Function Boolean(), + "sign-git-commit": Function Boolean(), + "sign-git-tag": Function Boolean(), + "sso-poll-frequency": Function Number(), + "sso-type": Array [ + null, + "oauth", + "saml", + ], + "strict-ssl": Function Boolean(), + "tag": Function String(), + "tag-version-prefix": Function String(), + "timing": Function Boolean(), + "tmp": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "umask": Function Umask(classUmask), + "unicode": Function Boolean(), + "update-notifier": Function Boolean(), + "usage": Function Boolean(), + "user-agent": Function String(), + "userconfig": &ref_1 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ":", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "/", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": &ref_2 Object { + "_makeLong": Function toNamespacedPath(path), + "basename": Function basename(path, ext), + "delimiter": ";", + "dirname": Function dirname(path), + "extname": Function extname(path), + "format": Function bound _format(), + "isAbsolute": Function isAbsolute(path), + "join": Function join(...args), + "normalize": Function normalize(path), + "parse": Function parse(path), + "posix": <*ref_1>, + "relative": Function relative(from, to), + "resolve": Function resolve(...args), + "sep": "\\\\", + "toNamespacedPath": Function toNamespacedPath(path), + "win32": <*ref_2>, + }, + }, + "version": Function Boolean(), + "versions": Function Boolean(), + "viewer": Function String(), + }, +} +` diff --git a/test/lib/utils/config.js b/test/lib/utils/config.js new file mode 100644 index 0000000000000..bde3653b5f795 --- /dev/null +++ b/test/lib/utils/config.js @@ -0,0 +1,118 @@ +const t = require('tap') +const requireInject = require('require-inject') +Object.defineProperty(process, 'umask', { + value: () => 0o26, + writable: true, + configurable: true, + enumerable: true +}) + +process.env.ComSpec = 'cmd.exe' +process.env.SHELL = '/usr/local/bin/bash' +process.env.LANG = 'UTF-8' +delete process.env.LC_ALL +delete process.env.LC_CTYPE +process.env.EDITOR = 'vim' +process.env.VISUAL = 'mate' + +const networkInterfacesThrow = () => { + throw new Error('no network interfaces for some reason') +} +const networkInterfaces = () => ({ + 'eth420': [{ address: '127.0.0.1' }], + 'eth69': [{ address: 'no place like home' }] +}) +const tmpdir = () => '/tmp' +const os = { networkInterfaces, tmpdir } + +t.test('working network interfaces, not windows', t => { + const config = requireInject('../../../lib/utils/config.js', { + os, + '../../../lib/utils/is-windows.js': false + }) + t.matchSnapshot(config) + t.end() +}) + +t.test('no working network interfaces, on windows', t => { + const config = requireInject('../../../lib/utils/config.js', { + os: { tmpdir, networkInterfaces: networkInterfacesThrow }, + '../../../lib/utils/is-windows.js': true + }) + t.matchSnapshot(config) + t.end() +}) + +t.test('no process.umask() method', t => { + Object.defineProperty(process, 'umask', { + value: null, + writable: true, + configurable: true, + enumerable: true + }) + t.teardown(() => { + Object.defineProperty(process, 'umask', { + value: () => 0o26, + writable: true, + configurable: true, + enumerable: true + }) + }) + const config = requireInject('../../../lib/utils/config.js', { + os: { tmpdir, networkInterfaces: networkInterfacesThrow }, + '../../../lib/utils/is-windows.js': true + }) + t.equal(config.defaults.umask, 0o22) + t.matchSnapshot(config) + t.end() +}) + +t.test('no comspec on windows', t => { + delete process.env.ComSpec + const config = requireInject('../../../lib/utils/config.js', { + os: { tmpdir, networkInterfaces: networkInterfacesThrow }, + '../../../lib/utils/is-windows.js': true + }) + t.equal(config.defaults.shell, 'cmd') + t.end() +}) + +t.test('no shell on posix', t => { + delete process.env.SHELL + const config = requireInject('../../../lib/utils/config.js', { + os, + '../../../lib/utils/is-windows.js': false + }) + t.equal(config.defaults.shell, 'bash') + t.end() +}) + +t.test('no EDITOR env, use VISUAL', t => { + delete process.env.EDITOR + const config = requireInject('../../../lib/utils/config.js', { + os, + '../../../lib/utils/is-windows.js': false + }) + t.equal(config.defaults.editor, 'mate') + t.end() +}) + +t.test('no VISUAL, use system default, not windows', t => { + delete process.env.VISUAL + const config = requireInject('../../../lib/utils/config.js', { + os, + '../../../lib/utils/is-windows.js': false + }) + t.equal(config.defaults.editor, 'vi') + t.end() +}) + +t.test('no VISUAL, use system default, not windows', t => { + delete process.env.VISUAL + const config = requireInject('../../../lib/utils/config.js', { + os, + '../../../lib/utils/is-windows.js': true + }) + t.equal(config.defaults.editor, 'notepad.exe') + t.end() +}) From 5dadeb83845a27f59cf4adfeb19bc8f07c3eec0f Mon Sep 17 00:00:00 2001 From: isaacs Date: Mon, 17 Aug 2020 16:55:15 -0700 Subject: [PATCH 4/8] remove files replaced by the @npmcli/config module --- lib/config/clear-credentials-by-uri.js | 16 - lib/config/core.js | 378 --------------------- lib/config/defaults.js | 453 ------------------------- lib/config/get-credentials-by-uri.js | 78 ----- lib/config/load-cafile.js | 32 -- lib/config/load-prefix.js | 53 --- lib/config/nerf-dart.js | 18 - lib/config/set-credentials-by-uri.js | 39 --- lib/config/set-envs.js | 92 ----- lib/config/set-user.js | 28 -- test/lib/config/set-envs.js | 165 --------- 11 files changed, 1352 deletions(-) delete mode 100644 lib/config/clear-credentials-by-uri.js delete mode 100644 lib/config/core.js delete mode 100644 lib/config/defaults.js delete mode 100644 lib/config/get-credentials-by-uri.js delete mode 100644 lib/config/load-cafile.js delete mode 100644 lib/config/load-prefix.js delete mode 100644 lib/config/nerf-dart.js delete mode 100644 lib/config/set-credentials-by-uri.js delete mode 100644 lib/config/set-envs.js delete mode 100644 lib/config/set-user.js delete mode 100644 test/lib/config/set-envs.js diff --git a/lib/config/clear-credentials-by-uri.js b/lib/config/clear-credentials-by-uri.js deleted file mode 100644 index 13c356605f021..0000000000000 --- a/lib/config/clear-credentials-by-uri.js +++ /dev/null @@ -1,16 +0,0 @@ -var assert = require('assert') - -var toNerfDart = require('./nerf-dart.js') - -module.exports = clearCredentialsByURI - -function clearCredentialsByURI (uri) { - assert(uri && typeof uri === 'string', 'registry URL is required') - - var nerfed = toNerfDart(uri) - - this.del(nerfed + ':_authToken', 'user') - this.del(nerfed + ':_password', 'user') - this.del(nerfed + ':username', 'user') - this.del(nerfed + ':email', 'user') -} diff --git a/lib/config/core.js b/lib/config/core.js deleted file mode 100644 index 13dabc4a11ef6..0000000000000 --- a/lib/config/core.js +++ /dev/null @@ -1,378 +0,0 @@ -const CC = require('config-chain').ConfigChain -const inherits = require('inherits') -const configDefs = require('./defaults.js') -const types = configDefs.types -const fs = require('fs') -const path = require('path') -const nopt = require('nopt') -const ini = require('ini') -const Umask = configDefs.Umask -const mkdirp = require('mkdirp-infer-owner') -const umask = require('../utils/umask') -const isWindows = require('../utils/is-windows.js') - -const myUid = process.getuid && process.getuid() -const myGid = process.getgid && process.getgid() - -const { promisify } = require('util') -const load = async (cli, builtin) => { - // clone the cli object that's passed in, so we don't mutate it - cli = { ...cli } - - // check for a builtin if provided. - exports.usingBuiltin = !!builtin - const rc = exports.rootConf = new Conf() - if (builtin) { - rc.addFile(builtin, 'builtin') - } else { - rc.add({}, 'builtin') - } - - return load_(builtin, rc, cli) -} - -// XXX promisify this the rest of the way, and all the Conf class methods -const load_ = promisify(function load_ (builtin, rc, cli, cb) { - const defaults = configDefs.defaults - const conf = new Conf(rc) - - conf.usingBuiltin = !!builtin - conf.add(cli, 'cli') - conf.addEnv() - - conf.loadPrefix(er => { - if (er) return cb(er) - - // If you're doing `npm --userconfig=~/foo.npmrc` then you'd expect - // that ~/.npmrc won't override the stuff in ~/foo.npmrc (or, indeed - // be used at all). - // - // However, if the cwd is ~, then ~/.npmrc is the home for the project - // config, and will override the userconfig. - // - // If you're not setting the userconfig explicitly, then it will be loaded - // twice, which is harmless but excessive. If you *are* setting the - // userconfig explicitly then it will override your explicit intent, and - // that IS harmful and unexpected. - // - // Solution: Do not load project config file that is the same as either - // the default or resolved userconfig value. npm will log a "verbose" - // message about this when it happens, but it is a rare enough edge case - // that we don't have to be super concerned about it. - const projectConf = path.resolve(conf.localPrefix, '.npmrc') - const defaultUserConfig = rc.get('userconfig') - const resolvedUserConfig = conf.get('userconfig') - if (!conf.get('global') && - projectConf !== defaultUserConfig && - projectConf !== resolvedUserConfig) { - conf.addFile(projectConf, 'project') - conf.once('load', afterPrefix) - } else { - conf.add({}, 'project') - afterPrefix() - } - }) - - function afterPrefix () { - conf.addFile(conf.get('userconfig'), 'user') - conf.once('error', cb) - conf.once('load', afterUser) - } - - function afterUser () { - // globalconfig and globalignorefile defaults - // need to respond to the 'prefix' setting up to this point. - // Eg, `npm config get globalconfig --prefix ~/local` should - // return `~/local/etc/npmrc` - // annoying humans and their expectations! - if (conf.get('prefix')) { - const etc = path.resolve(conf.get('prefix'), 'etc') - defaults.globalconfig = path.resolve(etc, 'npmrc') - defaults.globalignorefile = path.resolve(etc, 'npmignore') - } - - conf.addFile(conf.get('globalconfig'), 'global') - - // move the builtin into the conf stack now. - conf.root = defaults - conf.add(rc.shift(), 'builtin') - conf.once('load', function () { - conf.loadExtras(afterExtras) - }) - } - - function afterExtras (er) { - if (er) return cb(er) - - // warn about invalid bits. - validate(conf) - - const cafile = conf.get('cafile') - - if (cafile) { - return conf.loadCAFile(cafile, finalize) - } - - finalize() - } - - function finalize (er) { - if (er) { - return cb(er) - } - - exports.loaded = conf - cb(er, conf) - } -}) - -// Basically the same as CC, but: -// 1. Always ini -// 2. Parses environment variable names in field values -// 3. Field values that start with ~/ are replaced with process.env.HOME -// 4. Can inherit from another Conf object, using it as the base. -inherits(Conf, CC) -function Conf (base) { - if (!(this instanceof Conf)) return new Conf(base) - - CC.call(this) - - if (base) { - if (base instanceof Conf) { - this.root = base.list[0] || base.root - } else { - this.root = base - } - } else { - this.root = configDefs.defaults - } -} - -Conf.prototype.loadPrefix = require('./load-prefix.js') -Conf.prototype.loadCAFile = require('./load-cafile.js') -Conf.prototype.setUser = require('./set-user.js') -Conf.prototype.getCredentialsByURI = require('./get-credentials-by-uri.js') -Conf.prototype.setCredentialsByURI = require('./set-credentials-by-uri.js') -Conf.prototype.clearCredentialsByURI = require('./clear-credentials-by-uri.js') - -Conf.prototype.loadExtras = function (cb) { - this.setUser(function (er) { - if (er) return cb(er) - // Without prefix, nothing will ever work - mkdirp(this.prefix).then(() => cb()).catch(cb) - }.bind(this)) -} - -Conf.prototype.save = function (where, cb) { - const target = this.sources[where] - if (!target || !(target.path || target.source) || !target.data) { - let er - if (where !== 'builtin') er = new Error('bad save target: ' + where) - if (cb) { - process.nextTick(() => cb(er)) - return this - } - return this.emit('error', er) - } - - if (target.source) { - const pref = target.prefix || '' - Object.keys(target.data).forEach(function (k) { - target.source[pref + k] = target.data[k] - }) - if (cb) process.nextTick(cb) - return this - } - - const data = ini.stringify(target.data) - - const then = er => { - if (er) return done(er) - fs.chmod(target.path, mode, done) - } - - const done = er => { - if (er) { - if (cb) return cb(er) - else return this.emit('error', er) - } - this._saving-- - if (this._saving === 0) { - if (cb) cb() - this.emit('save') - } - } - - this._saving++ - - const mode = where === 'user' ? 0o600 : 0o666 - if (!data.trim()) { - // ignore the possible error (e.g. the file doesn't exist) - fs.unlink(target.path, () => done()) - } else { - const dir = path.dirname(target.path) - mkdirp(dir).catch(then).then(() => { - fs.stat(dir, (er, st) => { - if (er) return then(er) - fs.writeFile(target.path, data, 'utf8', function (er) { - if (er) return then(er) - if (myUid === 0 && (myUid !== st.uid || myGid !== st.gid)) { - fs.chown(target.path, st.uid, st.gid, then) - } else { - then() - } - }) - }) - }) - } - - return this -} - -Conf.prototype.addFile = function (file, name) { - name = name || file - var marker = { __source__: name } - this.sources[name] = { path: file, type: 'ini' } - this.push(marker) - this._await() - fs.readFile(file, 'utf8', function (er, data) { - // just ignore missing files. - if (er) return this.add({}, marker) - - this.addString(data, file, 'ini', marker) - }.bind(this)) - return this -} - -// always ini files. -Conf.prototype.parse = function (content, file) { - return CC.prototype.parse.call(this, content, file, 'ini') -} - -Conf.prototype.add = function (data, marker) { - try { - Object.keys(data).forEach(function (k) { - const newKey = envReplace(k) - const newField = parseField(data[k], newKey) - delete data[k] - data[newKey] = newField - }) - } catch (e) { - this.emit('error', e) - return this - } - return CC.prototype.add.call(this, data, marker) -} - -Conf.prototype.addEnv = function (env) { - env = env || process.env - var conf = {} - Object.keys(env) - .filter(function (k) { return k.match(/^npm_config_/i) }) - .forEach(function (k) { - if (!env[k]) return - - // leave first char untouched, even if - // it is a '_' - convert all other to '-' - var p = k.toLowerCase() - .replace(/^npm_config_/, '') - .replace(/(?!^)_/g, '-') - conf[p] = env[k] - }) - return CC.prototype.addEnv.call(this, '', conf, 'env') -} - -function parseField (f, k, listElement = false) { - if (typeof f !== 'string' && !(f instanceof String)) return f - - // type can be an array or single thing. - const typeList = [].concat(types[k]) - const isPath = typeList.includes(path) - const isBool = typeList.includes(Boolean) - const isString = typeList.includes(String) - const isUmask = typeList.includes(Umask) - const isNumber = typeList.includes(Number) - const isList = typeList.includes(Array) && !listElement - - f = ('' + f).trim() - - // list types get put in the environment separated by double-\n - // usually a single \n would suffice, but ca/cert configs can contain - // line breaks and multiple entries. - if (isList) { - return f.split('\n').map(field => parseField(field, k, true)) - } - - if (isBool && !isString && f === '') return true - - switch (f) { - case 'true': return true - case 'false': return false - case 'null': return null - case 'undefined': return undefined - } - - f = envReplace(f) - - if (isPath) { - var homePattern = isWindows ? /^~(\/|\\)/ : /^~\// - if (f.match(homePattern) && process.env.HOME) { - f = path.resolve(process.env.HOME, f.substr(2)) - } - f = path.resolve(f) - } - - if (isUmask) f = umask.fromString(f) - - if (isNumber && !isNaN(f)) f = +f - - return f -} - -function envReplace (f) { - if (typeof f !== 'string' || !f) return f - - // replace any ${ENV} values with the appropriate environ. - var envExpr = /(\\*)\$\{([^}]+)\}/g - return f.replace(envExpr, function (orig, esc, name) { - esc = esc.length && esc.length % 2 - if (esc) return orig - if (undefined === process.env[name]) { - throw new Error('Failed to replace env in config: ' + orig) - } - - return process.env[name] - }) -} - -function validate (cl) { - // warn about invalid configs at every level. - cl.list.forEach(function (conf) { - nopt.clean(conf, configDefs.types) - }) - - nopt.clean(cl.root, configDefs.types) -} - -exports.load = load -exports.Conf = Conf -exports.loaded = false -exports.rootConf = null -exports.usingBuiltin = false -exports.defs = configDefs - -Object.defineProperty(exports, 'defaults', { - get: function () { - return configDefs.defaults - }, - enumerable: true -}) - -Object.defineProperty(exports, 'types', { - get: function () { - return configDefs.types - }, - enumerable: true -}) - -exports.validate = validate diff --git a/lib/config/defaults.js b/lib/config/defaults.js deleted file mode 100644 index 13e3c0c11c666..0000000000000 --- a/lib/config/defaults.js +++ /dev/null @@ -1,453 +0,0 @@ -// defaults, types, and shorthands. - -var path = require('path') -var url = require('url') -var Stream = require('stream').Stream -var semver = require('semver') -var nopt = require('nopt') -var os = require('os') -var osenv = require('osenv') -var umask = require('../utils/umask') -var hasUnicode = require('has-unicode') - -var log -try { - log = require('npmlog') -} catch (er) { - var util = require('util') - log = { - warn: function (m) { - console.warn(m + ' ' + util.format.apply(util, [].slice.call(arguments, 1))) - } - } -} - -exports.Umask = Umask -function Umask () {} -function validateUmask (data, k, val) { - return umask.validate(data, k, val) -} - -function validateSemver (data, k, val) { - if (!semver.valid(val)) return false - data[k] = semver.valid(val) -} - -function validateStream (data, k, val) { - if (!(val instanceof Stream)) return false - data[k] = val -} - -nopt.typeDefs.semver = { type: semver, validate: validateSemver } -nopt.typeDefs.Stream = { type: Stream, validate: validateStream } -nopt.typeDefs.Umask = { type: Umask, validate: validateUmask } - -nopt.invalidHandler = function (k, val, type) { - log.warn('invalid config', k + '=' + JSON.stringify(val)) - - if (Array.isArray(type)) { - if (type.indexOf(url) !== -1) type = url - else if (type.indexOf(path) !== -1) type = path - } - - switch (type) { - case Umask: - log.warn('invalid config', 'Must be umask, octal number in range 0000..0777') - break - case url: - log.warn('invalid config', "Must be a full url with 'http://'") - break - case path: - log.warn('invalid config', 'Must be a valid filesystem path') - break - case Number: - log.warn('invalid config', 'Must be a numeric value') - break - case Stream: - log.warn('invalid config', 'Must be an instance of the Stream class') - break - } -} - -var defaults - -var temp = osenv.tmpdir() -var home = osenv.home() - -var uidOrPid = process.getuid ? process.getuid() : process.pid - -if (home) process.env.HOME = home -else home = path.resolve(temp, 'npm-' + uidOrPid) - -var cacheExtra = process.platform === 'win32' ? 'npm-cache' : '.npm' -var cacheRoot = (process.platform === 'win32' && process.env.APPDATA) || home -var cache = path.resolve(cacheRoot, cacheExtra) - -var globalPrefix -Object.defineProperty(exports, 'defaults', { - get: function () { - if (defaults) return defaults - - if (process.env.PREFIX) { - globalPrefix = process.env.PREFIX - } else if (process.platform === 'win32') { - // c:\node\node.exe --> prefix=c:\node\ - globalPrefix = path.dirname(process.execPath) - } else { - // /usr/local/bin/node --> prefix=/usr/local - globalPrefix = path.dirname(path.dirname(process.execPath)) - - // destdir only is respected on Unix - if (process.env.DESTDIR) { - globalPrefix = path.join(process.env.DESTDIR, globalPrefix) - } - } - - defaults = { - access: null, - all: false, - 'allow-same-version': false, - 'always-auth': false, - also: null, - audit: true, - 'audit-level': null, - 'auth-type': 'legacy', - - before: null, - 'bin-links': true, - browser: null, - - ca: null, - cafile: null, - - cache: cache, - - 'cache-lock-stale': 60000, - 'cache-lock-retries': 10, - 'cache-lock-wait': 10000, - - 'cache-max': Infinity, - 'cache-min': 10, - - cert: null, - - cidr: null, - - color: process.env.NO_COLOR == null, - call: '', - depth: 0, - description: true, - dev: false, - 'dry-run': false, - editor: osenv.editor(), - 'engine-strict': false, - force: false, - 'format-package-lock': true, - - fund: true, - - 'fetch-retries': 2, - 'fetch-retry-factor': 10, - 'fetch-retry-mintimeout': 10000, - 'fetch-retry-maxtimeout': 60000, - - git: 'git', - 'git-tag-version': true, - 'commit-hooks': true, - - global: false, - globalconfig: path.resolve(globalPrefix, 'etc', 'npmrc'), - 'global-style': false, - group: process.platform === 'win32' ? 0 - : process.env.SUDO_GID || (process.getgid && process.getgid()), - 'ham-it-up': false, - heading: 'npm', - 'if-present': false, - include: [], - 'include-staged': false, - 'ignore-prepublish': false, - 'ignore-scripts': false, - 'init-module': path.resolve(home, '.npm-init.js'), - 'init-author-name': '', - 'init-author-email': '', - 'init-author-url': '', - 'init-version': '1.0.0', - 'init-license': 'ISC', - json: false, - key: null, - 'legacy-bundling': false, - 'legacy-peer-deps': false, - link: false, - 'local-address': undefined, - loglevel: 'notice', - 'logs-max': 10, - long: false, - maxsockets: 50, - message: '%s', - 'metrics-registry': null, - 'node-options': null, - 'node-version': process.version, - offline: false, - omit: [], - only: null, - optional: true, - otp: null, - package: [], - 'package-lock': true, - 'package-lock-only': false, - parseable: false, - 'prefer-offline': false, - 'prefer-online': false, - prefix: globalPrefix, - preid: '', - production: process.env.NODE_ENV === 'production', - progress: !process.env.TRAVIS && !process.env.CI, - proxy: null, - 'https-proxy': null, - noproxy: null, - 'user-agent': 'npm/{npm-version} ' + - 'node/{node-version} ' + - '{platform} ' + - '{arch} ' + - '{ci}', - 'read-only': false, - 'rebuild-bundle': true, - registry: 'https://registry.npmjs.org/', - rollback: true, - save: true, - 'save-bundle': false, - 'save-dev': false, - 'save-exact': false, - 'save-optional': false, - 'save-prefix': '^', - 'save-prod': false, - scope: '', - 'script-shell': null, - 'scripts-prepend-node-path': 'warn-only', - searchopts: '', - searchexclude: null, - searchlimit: 20, - searchstaleness: 15 * 60, - 'send-metrics': false, - shell: osenv.shell(), - shrinkwrap: true, - 'sign-git-commit': false, - 'sign-git-tag': false, - 'sso-poll-frequency': 500, - 'sso-type': 'oauth', - 'strict-ssl': true, - tag: 'latest', - 'tag-version-prefix': 'v', - timing: false, - tmp: temp, - unicode: hasUnicode(), - 'unsafe-perm': process.platform === 'win32' || - process.platform === 'cygwin' || - !(process.getuid && process.setuid && - process.getgid && process.setgid) || - process.getuid() !== 0, - 'update-notifier': true, - usage: false, - user: (process.platform === 'win32' || os.type() === 'OS400') ? 0 : 'nobody', - userconfig: path.resolve(home, '.npmrc'), - umask: process.umask ? process.umask() : umask.fromString('022'), - version: false, - versions: false, - viewer: process.platform === 'win32' ? 'browser' : 'man', - - _exit: true - } - - return defaults - } -}) - -exports.types = { - access: [null, 'restricted', 'public'], - all: Boolean, - 'allow-same-version': Boolean, - 'always-auth': Boolean, - also: [null, 'dev', 'development'], - audit: Boolean, - 'audit-level': ['low', 'moderate', 'high', 'critical', 'none', null], - 'auth-type': ['legacy', 'sso', 'saml', 'oauth'], - before: [null, Date], - 'bin-links': Boolean, - browser: [null, Boolean, String], - ca: [null, String, Array], - cafile: path, - cache: path, - 'cache-lock-stale': Number, - 'cache-lock-retries': Number, - 'cache-lock-wait': Number, - 'cache-max': Number, - 'cache-min': Number, - cert: [null, String], - cidr: [null, String, Array], - color: ['always', Boolean], - call: String, - depth: Number, - description: Boolean, - dev: Boolean, - 'dry-run': Boolean, - editor: String, - 'engine-strict': Boolean, - force: Boolean, - fund: Boolean, - 'format-package-lock': Boolean, - 'fetch-retries': Number, - 'fetch-retry-factor': Number, - 'fetch-retry-mintimeout': Number, - 'fetch-retry-maxtimeout': Number, - git: String, - 'git-tag-version': Boolean, - 'commit-hooks': Boolean, - global: Boolean, - globalconfig: path, - 'global-style': Boolean, - group: [Number, String], - 'https-proxy': [null, url], - 'user-agent': String, - 'ham-it-up': Boolean, - heading: String, - 'if-present': Boolean, - include: [Array, 'prod', 'dev', 'optional', 'peer'], - 'include-staged': Boolean, - 'ignore-prepublish': Boolean, - 'ignore-scripts': Boolean, - 'init-module': path, - 'init-author-name': String, - 'init-author-email': String, - 'init-author-url': ['', url], - 'init-license': String, - 'init-version': semver, - json: Boolean, - key: [null, String], - 'legacy-bundling': Boolean, - 'legacy-peer-deps': Boolean, - link: Boolean, - 'local-address': getLocalAddresses(), - loglevel: ['silent', 'error', 'warn', 'notice', 'http', 'timing', 'info', 'verbose', 'silly'], - 'logs-max': Number, - long: Boolean, - maxsockets: Number, - message: String, - 'metrics-registry': [null, String], - 'node-options': [null, String], - 'node-version': [null, semver], - noproxy: [null, String, Array], - offline: Boolean, - omit: [Array, 'dev', 'optional', 'peer'], - only: [null, 'dev', 'development', 'prod', 'production'], - optional: Boolean, - otp: [null, String], - package: [String, Array], - 'package-lock': Boolean, - 'package-lock-only': Boolean, - parseable: Boolean, - 'prefer-offline': Boolean, - 'prefer-online': Boolean, - prefix: path, - preid: String, - production: Boolean, - progress: Boolean, - proxy: [null, false, url], // allow proxy to be disabled explicitly - 'read-only': Boolean, - 'rebuild-bundle': Boolean, - registry: [null, url], - rollback: Boolean, - save: Boolean, - 'save-bundle': Boolean, - 'save-dev': Boolean, - 'save-exact': Boolean, - 'save-optional': Boolean, - 'save-prefix': String, - 'save-prod': Boolean, - scope: String, - 'script-shell': [null, String], - 'scripts-prepend-node-path': [Boolean, 'auto', 'warn-only'], - searchopts: String, - searchexclude: [null, String], - searchlimit: Number, - searchstaleness: Number, - 'send-metrics': Boolean, - shell: String, - shrinkwrap: Boolean, - 'sign-git-commit': Boolean, - 'sign-git-tag': Boolean, - 'sso-poll-frequency': Number, - 'sso-type': [null, 'oauth', 'saml'], - 'strict-ssl': Boolean, - tag: String, - timing: Boolean, - tmp: path, - unicode: Boolean, - 'unsafe-perm': Boolean, - 'update-notifier': Boolean, - usage: Boolean, - user: [Number, String], - userconfig: path, - umask: Umask, - version: Boolean, - 'tag-version-prefix': String, - versions: Boolean, - viewer: String, - _exit: Boolean -} - -function getLocalAddresses () { - var interfaces - // #8094: some environments require elevated permissions to enumerate - // interfaces, and synchronously throw EPERM when run without - // elevated privileges - try { - interfaces = os.networkInterfaces() - } catch (e) { - interfaces = {} - } - - return Object.keys(interfaces).map( - nic => interfaces[nic].map(({ address }) => address) - ).reduce((curr, next) => curr.concat(next), []).concat(undefined) -} - -exports.shorthands = { - 'enjoy-by': ['--before'], - c: ['--call'], - s: ['--loglevel', 'silent'], - d: ['--loglevel', 'info'], - dd: ['--loglevel', 'verbose'], - ddd: ['--loglevel', 'silly'], - noreg: ['--no-registry'], - N: ['--no-registry'], - reg: ['--registry'], - 'no-reg': ['--no-registry'], - silent: ['--loglevel', 'silent'], - verbose: ['--loglevel', 'verbose'], - quiet: ['--loglevel', 'warn'], - q: ['--loglevel', 'warn'], - h: ['--usage'], - H: ['--usage'], - '?': ['--usage'], - help: ['--usage'], - v: ['--version'], - f: ['--force'], - desc: ['--description'], - 'no-desc': ['--no-description'], - local: ['--no-global'], - l: ['--long'], - m: ['--message'], - p: ['--parseable'], - porcelain: ['--parseable'], - readonly: ['--read-only'], - g: ['--global'], - S: ['--save'], - D: ['--save-dev'], - E: ['--save-exact'], - O: ['--save-optional'], - P: ['--save-prod'], - y: ['--yes'], - n: ['--no-yes'], - B: ['--save-bundle'], - C: ['--prefix'] -} diff --git a/lib/config/get-credentials-by-uri.js b/lib/config/get-credentials-by-uri.js deleted file mode 100644 index 21926c6865993..0000000000000 --- a/lib/config/get-credentials-by-uri.js +++ /dev/null @@ -1,78 +0,0 @@ -var assert = require('assert') - -var toNerfDart = require('./nerf-dart.js') - -module.exports = getCredentialsByURI - -function getCredentialsByURI (uri) { - assert(uri && typeof uri === 'string', 'registry URL is required') - var nerfed = toNerfDart(uri) - var defnerf = toNerfDart(this.get('registry')) - - // hidden class micro-optimization - var c = { - scope: nerfed, - token: undefined, - password: undefined, - username: undefined, - email: undefined, - auth: undefined, - alwaysAuth: undefined - } - - // used to override scope matching for tokens as well as legacy auth - if (this.get(nerfed + ':always-auth') !== undefined) { - var val = this.get(nerfed + ':always-auth') - c.alwaysAuth = val === 'false' ? false : !!val - } else if (this.get('always-auth') !== undefined) { - c.alwaysAuth = this.get('always-auth') - } - - if (this.get(nerfed + ':_authToken')) { - c.token = this.get(nerfed + ':_authToken') - // the bearer token is enough, don't confuse things - return c - } - - if (this.get(nerfed + ':-authtoken')) { - c.token = this.get(nerfed + ':-authtoken') - // the bearer token is enough, don't confuse things - return c - } - - // Handle the old-style _auth= style for the default - // registry, if set. - var authDef = this.get('_auth') - var userDef = this.get('username') - var passDef = this.get('_password') - if (authDef && !(userDef && passDef)) { - authDef = Buffer.from(authDef, 'base64').toString() - authDef = authDef.split(':') - userDef = authDef.shift() - passDef = authDef.join(':') - } - - if (this.get(nerfed + ':_password')) { - c.password = Buffer.from(this.get(nerfed + ':_password'), 'base64').toString('utf8') - } else if (nerfed === defnerf && passDef) { - c.password = passDef - } - - if (this.get(nerfed + ':username')) { - c.username = this.get(nerfed + ':username') - } else if (nerfed === defnerf && userDef) { - c.username = userDef - } - - if (this.get(nerfed + ':email')) { - c.email = this.get(nerfed + ':email') - } else if (this.get('email')) { - c.email = this.get('email') - } - - if (c.username && c.password) { - c.auth = Buffer.from(c.username + ':' + c.password).toString('base64') - } - - return c -} diff --git a/lib/config/load-cafile.js b/lib/config/load-cafile.js deleted file mode 100644 index de8f61625a6b1..0000000000000 --- a/lib/config/load-cafile.js +++ /dev/null @@ -1,32 +0,0 @@ -module.exports = loadCAFile - -var fs = require('fs') - -function loadCAFile (cafilePath, cb) { - if (!cafilePath) return process.nextTick(cb) - - fs.readFile(cafilePath, 'utf8', afterCARead.bind(this)) - - function afterCARead (er, cadata) { - if (er) { - // previous cafile no longer exists, so just continue on gracefully - if (er.code === 'ENOENT') return cb() - return cb(er) - } - - var delim = '-----END CERTIFICATE-----' - var output - - output = cadata - .split(delim) - .filter(function (xs) { - return !!xs.trim() - }) - .map(function (xs) { - return xs.trimLeft() + delim - }) - - this.set('ca', output) - cb(null) - } -} diff --git a/lib/config/load-prefix.js b/lib/config/load-prefix.js deleted file mode 100644 index fd80e76345159..0000000000000 --- a/lib/config/load-prefix.js +++ /dev/null @@ -1,53 +0,0 @@ -module.exports = loadPrefix - -var findPrefix = require('find-npm-prefix') -var path = require('path') - -function loadPrefix (cb) { - var cli = this.list[0] - - Object.defineProperty(this, 'prefix', - { - set: function (prefix) { - var g = this.get('global') - this[g ? 'globalPrefix' : 'localPrefix'] = prefix - }.bind(this), - get: function () { - var g = this.get('global') - return g ? this.globalPrefix : this.localPrefix - }.bind(this), - enumerable: true - }) - - Object.defineProperty(this, 'globalPrefix', - { - set: function (prefix) { - this.set('prefix', prefix) - }.bind(this), - get: function () { - return path.resolve(this.get('prefix')) - }.bind(this), - enumerable: true - }) - - var p - Object.defineProperty(this, 'localPrefix', - { - set: function (prefix) { p = prefix }, - get: function () { return p }, - enumerable: true - }) - - // try to guess at a good node_modules location. - // If we are *explicitly* given a prefix on the cli, then - // always use that. otherwise, infer local prefix from cwd. - if (Object.prototype.hasOwnProperty.call(cli, 'prefix')) { - p = path.resolve(cli.prefix) - process.nextTick(cb) - } else { - findPrefix(process.cwd()).then((found) => { - p = found - cb() - }, cb) - } -} diff --git a/lib/config/nerf-dart.js b/lib/config/nerf-dart.js deleted file mode 100644 index d6ae4aa2aa7e2..0000000000000 --- a/lib/config/nerf-dart.js +++ /dev/null @@ -1,18 +0,0 @@ -const { URL } = require('url') - -/** - * Maps a URL to an identifier. - * - * Name courtesy schiffertronix media LLC, a New Jersey corporation - * - * @param {String} uri The URL to be nerfed. - * - * @returns {String} A nerfed URL. - */ -module.exports = (url) => { - const parsed = new URL(url) - const from = `${parsed.protocol}//${parsed.host}${parsed.pathname}` - const rel = new URL('.', from) - const res = `//${rel.host}${rel.pathname}` - return res -} diff --git a/lib/config/set-credentials-by-uri.js b/lib/config/set-credentials-by-uri.js deleted file mode 100644 index 4723d561a8af6..0000000000000 --- a/lib/config/set-credentials-by-uri.js +++ /dev/null @@ -1,39 +0,0 @@ -var assert = require('assert') - -var toNerfDart = require('./nerf-dart.js') - -module.exports = setCredentialsByURI - -function setCredentialsByURI (uri, c) { - assert(uri && typeof uri === 'string', 'registry URL is required') - assert(c && typeof c === 'object', 'credentials are required') - - var nerfed = toNerfDart(uri) - - if (c.token) { - this.set(nerfed + ':_authToken', c.token, 'user') - this.del(nerfed + ':_password', 'user') - this.del(nerfed + ':username', 'user') - this.del(nerfed + ':email', 'user') - this.del(nerfed + ':always-auth', 'user') - } else if (c.username || c.password || c.email) { - assert(c.username, 'must include username') - assert(c.password, 'must include password') - assert(c.email, 'must include email address') - - this.del(nerfed + ':_authToken', 'user') - - var encoded = Buffer.from(c.password, 'utf8').toString('base64') - this.set(nerfed + ':_password', encoded, 'user') - this.set(nerfed + ':username', c.username, 'user') - this.set(nerfed + ':email', c.email, 'user') - - if (c.alwaysAuth !== undefined) { - this.set(nerfed + ':always-auth', c.alwaysAuth, 'user') - } else { - this.del(nerfed + ':always-auth', 'user') - } - } else { - throw new Error('No credentials to set.') - } -} diff --git a/lib/config/set-envs.js b/lib/config/set-envs.js deleted file mode 100644 index 2a513fc908887..0000000000000 --- a/lib/config/set-envs.js +++ /dev/null @@ -1,92 +0,0 @@ -// Set environment variables for any non-default configs, -// so that they're already there when we run lifecycle scripts. -// -// See https://github.com/npm/rfcs/pull/90 - -// Return the env key if this is a thing that belongs in the env. -// Ie, if the key isn't a @scope, //nerf.dart, or _private, -// and the value is a string or array. Otherwise return false. -const envKey = (key, val) => { - return !/^[/@_]/.test(key) && - (typeof envVal(val) === 'string') && - `npm_config_${key.replace(/-/g, '_').toLowerCase()}` -} - -const envVal = val => Array.isArray(val) ? val.map(v => envVal(v)).join('\n\n') - : val === null || val === undefined || val === false ? '' - : typeof val === 'object' ? null - : String(val) - -const sameConfigValue = (def, val) => - !Array.isArray(val) || !Array.isArray(def) ? def === val - : sameArrayValue(def, val) - -const sameArrayValue = (def, val) => { - if (def.length !== val.length) { - return false - } - for (let i = 0; i < def.length; i++) { - /* istanbul ignore next - there are no array configs where the default - * is not an empty array, so this loop is a no-op, but it's the correct - * thing to do if we ever DO add a config like that. */ - if (def[i] !== val[i]) { - return false - } - } - return true -} - -const setEnv = (env, rawKey, rawVal) => { - const val = envVal(rawVal) - const key = envKey(rawKey, val) - if (key && val !== null) { - env[key] = val - } -} - -const setEnvs = (npm, env = process.env) => { - // This ensures that all npm config values that are not the defaults are - // shared appropriately with child processes, without false positives. - // - // if the key is the default value, - // if the environ is NOT the default value, - // set the environ - // else skip it, it's fine - // if the key is NOT the default value, - // if the env is setting it, then leave it (already set) - // otherwise, set the env - const { config: { list: [cliConf, envConf] } } = npm - const cliSet = new Set(Object.keys(cliConf)) - const envSet = new Set(Object.keys(envConf)) - const { defaults } = require('./defaults.js') - // the configs form a prototype chain, so we can for/in over cli to - // see all the current values, and hasOwnProperty to see if it's - // set therre. - for (const key in cliConf) { - if (sameConfigValue(defaults[key], cliConf[key])) { - if (!sameConfigValue(defaults[key], envConf[key])) { - // getting set back to the default in the cli config - setEnv(env, key, cliConf[key]) - } - } else { - // config is not the default - if (!(envSet.has(key) && !cliSet.has(key))) { - // was not set in the env, so we have to put it there - setEnv(env, key, cliConf[key]) - } - } - } - - // also set some other common ones. - env.npm_execpath = require.main.filename - env.npm_node_execpath = process.execPath - env.npm_command = npm.command - - // note: this doesn't afect the *current* node process, of course, since - // it's already started, but it does affect the options passed to scripts. - if (cliConf['node-options']) { - env.NODE_OPTIONS = cliConf['node-options'] - } -} - -module.exports = setEnvs diff --git a/lib/config/set-user.js b/lib/config/set-user.js deleted file mode 100644 index 8579a88634ee7..0000000000000 --- a/lib/config/set-user.js +++ /dev/null @@ -1,28 +0,0 @@ -module.exports = setUser - -const assert = require('assert') -const path = require('path') -const fs = require('fs') -const mkdirp = require('mkdirp-infer-owner') - -function setUser (cb) { - var defaultConf = this.root - assert(defaultConf !== Object.prototype) - - // If global, leave it as-is. - // If not global, then set the user to the owner of the prefix folder. - // Just set the default, so it can be overridden. - if (this.get('global')) return cb() - if (process.env.SUDO_UID) { - defaultConf.user = +(process.env.SUDO_UID) - return cb() - } - - const prefix = path.resolve(this.get('prefix')) - mkdirp(prefix).catch(cb).then(() => { - fs.stat(prefix, function (er, st) { - defaultConf.user = st && st.uid - return cb(er) - }) - }) -} diff --git a/test/lib/config/set-envs.js b/test/lib/config/set-envs.js deleted file mode 100644 index 869622c0f1686..0000000000000 --- a/test/lib/config/set-envs.js +++ /dev/null @@ -1,165 +0,0 @@ -const t = require('tap') -const setEnvs = require('../../../lib/config/set-envs.js') -const { defaults } = require('../../../lib/config/defaults.js') - -t.test('set envs that are not defaults and not already in env', t => { - const envConf = Object.create(defaults) - const cliConf = Object.create(envConf) - const npm = { - config: { - list: [cliConf, envConf] - } - } - const extras = { - npm_execpath: require.main.filename, - npm_node_execpath: process.execPath, - npm_command: undefined - } - const env = {} - setEnvs(npm, env) - t.strictSame(env, { ...extras }, 'no new environment vars to create') - envConf.call = 'me, maybe' - setEnvs(npm, env) - t.strictSame(env, { ...extras }, 'no new environment vars to create, already in env') - delete envConf.call - cliConf.call = 'me, maybe' - setEnvs(npm, env) - t.strictSame(env, { - ...extras, - npm_config_call: 'me, maybe' - }, 'set in env, because changed from default in cli') - envConf.call = 'me, maybe' - cliConf.call = '' - cliConf['node-options'] = 'some options for node' - setEnvs(npm, env) - t.strictSame(env, { - ...extras, - npm_config_call: '', - npm_config_node_options: 'some options for node', - NODE_OPTIONS: 'some options for node' - }, 'set in env, because changed from default in env, back to default in cli') - t.end() -}) - -t.test('set envs that are not defaults and not already in env, array style', t => { - const envConf = Object.create(defaults) - const cliConf = Object.create(envConf) - const npm = { - config: { - list: [cliConf, envConf] - } - } - const extras = { - npm_execpath: require.main.filename, - npm_node_execpath: process.execPath, - npm_command: undefined - } - const env = {} - setEnvs(npm, env) - t.strictSame(env, { ...extras }, 'no new environment vars to create') - envConf.omit = ['dev'] - setEnvs(npm, env) - t.strictSame(env, { ...extras }, 'no new environment vars to create, already in env') - delete envConf.omit - cliConf.omit = ['dev', 'optional'] - setEnvs(npm, env) - t.strictSame(env, { - ...extras, - npm_config_omit: 'dev\n\noptional' - }, 'set in env, because changed from default in cli') - envConf.omit = ['optional', 'peer'] - cliConf.omit = [] - setEnvs(npm, env) - t.strictSame(env, { - ...extras, - npm_config_omit: '' - }, 'set in env, because changed from default in env, back to default in cli') - t.end() -}) - -t.test('set envs that are not defaults and not already in env, boolean edition', t => { - const envConf = Object.create(defaults) - const cliConf = Object.create(envConf) - const npm = { - config: { - list: [cliConf, envConf] - } - } - const extras = { - npm_execpath: require.main.filename, - npm_node_execpath: process.execPath, - npm_command: undefined - } - const env = {} - setEnvs(npm, env) - t.strictSame(env, { ...extras }, 'no new environment vars to create') - envConf.audit = false - setEnvs(npm, env) - t.strictSame(env, { ...extras }, 'no new environment vars to create, already in env') - delete envConf.audit - cliConf.audit = false - cliConf.ignoreObjects = { - some: { object: 12345 } - } - setEnvs(npm, env) - t.strictSame(env, { - ...extras, - npm_config_audit: '' - }, 'set in env, because changed from default in cli') - envConf.audit = false - cliConf.audit = true - setEnvs(npm, env) - t.strictSame(env, { - ...extras, - npm_config_audit: 'true' - }, 'set in env, because changed from default in env, back to default in cli') - t.end() -}) - -t.test('default to process.env', t => { - const envConf = Object.create(defaults) - const cliConf = Object.create(envConf) - const npm = { - config: { - list: [cliConf, envConf] - } - } - const extras = { - npm_execpath: require.main.filename, - npm_node_execpath: process.execPath, - npm_command: undefined - } - const env = {} - const envDescriptor = Object.getOwnPropertyDescriptor(process, 'env') - Object.defineProperty(process, 'env', { - value: env, - configurable: true, - enumerable: true, - writable: true - }) - t.teardown(() => Object.defineProperty(process, env, envDescriptor)) - - setEnvs(npm) - t.strictSame(env, { ...extras }, 'no new environment vars to create') - envConf.audit = false - setEnvs(npm) - t.strictSame(env, { ...extras }, 'no new environment vars to create, already in env') - delete envConf.audit - cliConf.audit = false - cliConf.ignoreObjects = { - some: { object: 12345 } - } - setEnvs(npm) - t.strictSame(env, { - ...extras, - npm_config_audit: '' - }, 'set in env, because changed from default in cli') - envConf.audit = false - cliConf.audit = true - setEnvs(npm) - t.strictSame(env, { - ...extras, - npm_config_audit: 'true' - }, 'set in env, because changed from default in env, back to default in cli') - t.end() -}) From e929b28c0d9040d136d70534702ac2067aa0ff06 Mon Sep 17 00:00:00 2001 From: isaacs Date: Mon, 17 Aug 2020 16:55:33 -0700 Subject: [PATCH 5/8] bin: use our path util instead of osenv --- lib/bin.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/bin.js b/lib/bin.js index e2b2a31dab355..9861a7ed5bfdc 100644 --- a/lib/bin.js +++ b/lib/bin.js @@ -1,4 +1,3 @@ -const osenv = require('osenv') const npm = require('./npm.js') const output = require('./utils/output.js') const usageUtil = require('./utils/usage.js') @@ -7,7 +6,7 @@ const cmd = (args, cb) => bin(args).then(() => cb()).catch(cb) const usage = usageUtil('bin', 'npm bin [-g]') const bin = async (args, cb) => { const b = npm.bin - const PATH = osenv.path() + const PATH = require('./utils/path.js') output(b) if (npm.flatOptions.global && !PATH.includes(b)) { console.error('(not in PATH env variable)') From 5cb9a1d4d985aaa8e988c51fe5ae7f7ed3602811 Mon Sep 17 00:00:00 2001 From: isaacs Date: Tue, 18 Aug 2020 09:51:42 -0700 Subject: [PATCH 6/8] use @npmcli/config for configuration This also refactors the completion.js command, still pending proper tests. --- bin/npx-cli.js | 2 +- lib/adduser.js | 6 +- lib/cli.js | 27 +-- lib/completion.js | 337 +++++++++++++++++-------------- lib/config.js | 369 +++++++++++++++------------------- lib/doctor.js | 2 +- lib/help.js | 2 +- lib/logout.js | 5 +- lib/npm.js | 83 +++----- lib/profile.js | 4 +- test/lib/cli.js | 24 ++- test/lib/load-all-commands.js | 2 +- test/lib/npm.js | 170 ++++++++-------- 13 files changed, 501 insertions(+), 532 deletions(-) diff --git a/bin/npx-cli.js b/bin/npx-cli.js index 716dc958ec7f3..f4a419972f7cf 100755 --- a/bin/npx-cli.js +++ b/bin/npx-cli.js @@ -24,7 +24,7 @@ const removed = new Set([ ...removedOpts ]) -const { types, shorthands } = require('../lib/config/defaults.js') +const { types, shorthands } = require('../lib/utils/config.js') const npmSwitches = Object.entries(types) .filter(([key, type]) => type === Boolean || (Array.isArray(type) && type.includes(Boolean))) diff --git a/lib/adduser.js b/lib/adduser.js index 2f0be193fda4e..012601f055916 100644 --- a/lib/adduser.js +++ b/lib/adduser.js @@ -41,10 +41,6 @@ const getAuthType = ({ authType }) => { return type } -const saveConfig = () => new Promise((resolve, reject) => { - npm.config.save('user', er => er ? reject(er) : resolve()) -}) - const updateConfig = async ({ newCreds, registry, scope }) => { npm.config.del('_token', 'user') // prevent legacy pollution @@ -53,7 +49,7 @@ const updateConfig = async ({ newCreds, registry, scope }) => { } npm.config.setCredentialsByURI(registry, newCreds) - await saveConfig() + await npm.config.save('user') } const adduser = async (args) => { diff --git a/lib/cli.js b/lib/cli.js index b8ed9090207ed..71bdb1bac6a94 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -17,9 +17,7 @@ module.exports = (process) => { checkForUnsupportedNode() const npm = require('../lib/npm.js') - const { defs: { shorthands, types } } = require('../lib/config/core.js') const errorHandler = require('../lib/utils/error-handler.js') - const nopt = require('nopt') // if npm is called as "npmg" or "npm_g", then // run in global mode. @@ -29,19 +27,6 @@ module.exports = (process) => { log.verbose('cli', process.argv) - const conf = nopt(types, shorthands, process.argv) - npm.argv = conf.argv.remain - - if (conf.version) { - console.log(npm.version) - return errorHandler.exit(0) - } - - if (conf.versions) { - npm.argv = ['version'] - conf.usage = false - } - log.info('using', 'npm@%s', npm.version) log.info('using', 'node@%s', process.version) @@ -50,10 +35,18 @@ module.exports = (process) => { // now actually fire up npm and run the command. // this is how to use npm programmatically: - conf._exit = true const updateNotifier = require('../lib/utils/update-notifier.js') - npm.load(conf, async er => { + npm.load(async er => { if (er) return errorHandler(er) + if (npm.config.get('version', 'cli')) { + console.log(npm.version) + return errorHandler.exit(0) + } + + if (npm.config.get('versions', 'cli')) { + npm.argv = ['version'] + npm.config.set('usage', false, 'cli') + } npm.updateNotification = await updateNotifier(npm) diff --git a/lib/completion.js b/lib/completion.js index 9fb5da6816523..14c590081db75 100644 --- a/lib/completion.js +++ b/lib/completion.js @@ -1,60 +1,85 @@ -module.exports = completion - -completion.usage = 'source <(npm completion)' - -var npm = require('./npm.js') -var npmconf = require('./config/core.js') -var configDefs = npmconf.defs +// Each command has a completion function that takes an options object and a cb +// The callback gets called with an error and an array of possible completions. +// The options object is built up based on the environment variables set by +// zsh or bash when calling a function for completion, based on the cursor +// position and the command line thus far. These are: +// COMP_CWORD: the index of the "word" in the command line being completed +// COMP_LINE: the full command line thusfar as a string +// COMP_POINT: the cursor index at the point of triggering completion +// +// We parse the command line with nopt, like npm does, and then create an +// options object containing: +// words: array of words in the command line +// w: the index of the word being completed (ie, COMP_CWORD) +// word: the word being completed +// line: the COMP_LINE +// lineLength +// point: the COMP_POINT, usually equal to line length, but not always, eg if +// the user has pressed the left-arrow to complete an earlier word +// partialLine: the line up to the point +// partialWord: the word being completed (which might be ''), up to the point +// conf: a nopt parse of the command line +// +// When the implementation completion method returns its list of strings, +// and arrays of strings, we filter that by any that start with the +// partialWord, since only those can possibly be valid matches. +// +// Matches are wrapped with ' to escape them, if necessary, and then printed +// one per line for the shell completion method to consume in IFS=$'\n' mode +// as an array. +// +// TODO: make all the implementation completion methods promise-returning +// instead of callback-taking. + +const npm = require('./npm.js') +const { types, shorthands, defaults } = require('./utils/config.js') const deref = require('./utils/deref-command.js') const { aliases, cmdList, plumbing } = require('./config/cmd-list.js') const aliasNames = Object.keys(aliases) const fullList = cmdList.concat(aliasNames).filter(c => !plumbing.includes(c)) -var configTypes = configDefs.types -var shorthands = configDefs.shorthands -var nopt = require('nopt') -var configNames = Object.keys(configTypes) - .filter(function (e) { return e.charAt(0) !== '_' }) -var shorthandNames = Object.keys(shorthands) -var allConfs = configNames.concat(shorthandNames) -var once = require('once') -var isWindowsShell = require('./utils/is-windows-shell.js') -var output = require('./utils/output.js') - -completion.completion = function (opts, cb) { - if (opts.w > 3) return cb() - - var fs = require('graceful-fs') - var path = require('path') - var bashExists = null - var zshExists = null - fs.stat(path.resolve(process.env.HOME, '.bashrc'), function (er) { - bashExists = !er - next() - }) - fs.stat(path.resolve(process.env.HOME, '.zshrc'), function (er) { - zshExists = !er - next() - }) - function next () { - if (zshExists === null || bashExists === null) return - var out = [] - if (zshExists) out.push('~/.zshrc') - if (bashExists) out.push('~/.bashrc') - if (opts.w === 2) { - out = out.map(function (m) { - return ['>>', m] - }) - } - cb(null, out) +const nopt = require('nopt') +const configNames = Object.keys(types) +const shorthandNames = Object.keys(shorthands) +const allConfs = configNames.concat(shorthandNames) +const isWindowsShell = require('./utils/is-windows-shell.js') +const output = require('./utils/output.js') + +const usageUtil = require('./utils/usage.js') +const usage = usageUtil('completion', 'source <(npm completion)') +const { promisify } = require('util') + +const cmd = (args, cb) => compl(args).then(() => cb()).catch(cb) + +// completion for the completion command +const completion = async (opts, cb) => { + if (opts.w > 3) { + return cb() + } + + const fs = require('fs') + const exists = promisify(fs.exists) + const {resolve} = require('path') + const [bashExists, zshExists] = await Promise.all([ + exists(resolve(process.env.HOME, '.bashrc')), + exists(resolve(process.env.HOME, '.zshrc')) + ]) + const out = [] + if (zshExists) { + out.push('~/.zshrc') + } + if (bashExists) { + out.push('~/.bashrc') } + + cb(null, opts.w === 2 ? out.map(m => ['>>', m]) : out) } -function completion (args, cb) { +const compl = async args => { if (isWindowsShell) { - var e = new Error('npm completion supported only in MINGW / Git bash on Windows') - e.code = 'ENOTSUP' - e.errno = require('constants').ENOTSUP // eslint-disable-line node/no-deprecated-api - return cb(e) + const msg = 'npm completion supported only in MINGW / Git bash on Windows' + throw Object.assign(new Error(msg), { + code: 'ENOTSUP' + }) } const { COMP_CWORD, COMP_LINE, COMP_POINT } = process.env @@ -63,58 +88,61 @@ function completion (args, cb) { if (COMP_CWORD === undefined || COMP_LINE === undefined || COMP_POINT === undefined) { - return dumpScript(cb) + return dumpScript() } + // ok we're actually looking at the envs and outputting the suggestions console.error({ COMP_CWORD, COMP_LINE, COMP_POINT }) // get the partial line and partial word, // if the point isn't at the end. // ie, tabbing at: npm foo b|ar - var w = +COMP_CWORD - var words = args.map(unescape) - console.error({ words, args }) - var word = words[w] - var line = COMP_LINE - var point = +COMP_POINT - var partialLine = line.substr(0, point) - var partialWords = words.slice(0, w) + const w = +COMP_CWORD + const words = args.map(unescape) + console.error({ words, args, w }) + const word = words[w] + const line = COMP_LINE + const point = +COMP_POINT + const partialLine = line.substr(0, point) + const partialWords = words.slice(0, w) // figure out where in that last word the point is. - var partialWord = args[w] - var i = partialWord.length - while (partialWord.substr(0, i) !== partialLine.substr(-1 * i) && i > 0) { + const partialWordRaw = args[w] + console.error('partial word (args[%i])', w, partialWordRaw, args) + let i = partialWordRaw.length + while (partialWordRaw.substr(0, i) !== partialLine.substr(-1 * i) && i > 0) { i-- } - partialWord = unescape(partialWord.substr(0, i)) + const partialWord = unescape(partialWordRaw.substr(0, i)) partialWords.push(partialWord) - var opts = { - words: words, - w: w, - word: word, - line: line, + const opts = { + words, + w, + word, + line, lineLength: line.length, - point: point, - partialLine: partialLine, - partialWords: partialWords, - partialWord: partialWord, + point, + partialLine, + partialWords, + partialWord, raw: args } - cb = wrapCb(cb, opts) - console.error(opts) + const wrap = getWrap(opts) if (partialWords.slice(0, -1).indexOf('--') === -1) { - if (word.charAt(0) === '-') return configCompl(opts, cb) + if (word.charAt(0) === '-') { + return wrap(configCompl(opts)) + } if (words[w - 1] && words[w - 1].charAt(0) === '-' && !isFlag(words[w - 1])) { // awaiting a value for a non-bool config. // don't even try to do this for now console.error('configValueCompl') - return configValueCompl(opts, cb) + return wrap(configValueCompl(opts)) } } @@ -123,43 +151,52 @@ function completion (args, cb) { // take a little shortcut and use npm's arg parsing logic. // don't have to worry about the last arg being implicitly // boolean'ed, since the last block will catch that. - var parsed = opts.conf = - nopt(configTypes, shorthands, partialWords.slice(0, -1), 0) + const parsed = opts.conf = + nopt(types, shorthands, partialWords.slice(0, -1), 0) // check if there's a command already. console.error('PARSED', parsed) - var cmd = parsed.argv.remain[1] + const cmd = parsed.argv.remain[1] console.error('CMD', cmd) - if (!cmd) return cmdCompl(opts, cb) + if (!cmd) { + return wrap(cmdCompl(opts)) + } - Object.keys(parsed).forEach(function (k) { - npm.config.set(k, parsed[k]) - }) + Object.keys(parsed).forEach(k => npm.config.set(k, parsed[k])) // at this point, if words[1] is some kind of npm command, // then complete on it. // otherwise, do nothing - cmd = npm.commands[cmd] - if (cmd && cmd.completion) return cmd.completion(opts, cb) - - // nothing to do. - cb() + const impl = npm.commands[cmd] + if (impl && impl.completion) { + // XXX promisify all the cmd.completion functions + return await new Promise((res, rej) => { + impl.completion(opts, (er, comps) => er ? rej(er) : res(wrap(comps))) + }) + } } -function dumpScript (cb) { - var fs = require('graceful-fs') - var path = require('path') - var p = path.resolve(__dirname, 'utils/completion.sh') +const dumpScript = async () => { + const fs = require('fs') + const readFile = promisify(fs.readFile) + const {resolve} = require('path') + const p = resolve(__dirname, 'utils/completion.sh') + + const d = (await readFile(p, 'utf8')).replace(/^#!.*?\n/, '') + await new Promise((res, rej) => { + let done = false + process.stdout.write(d, () => { + if (done) + return + done = true + res() + }) - // The Darwin patch below results in callbacks first for the write and then - // for the error handler, so make sure we only call our callback once. - cb = once(cb) + process.stdout.on('error', er => { + if (done) + return - fs.readFile(p, 'utf8', function (er, d) { - if (er) return cb(er) - d = d.replace(/^#!.*?\n/, '') + done = true - process.stdout.write(d, function () { cb() }) - process.stdout.on('error', function (er) { // Darwin is a pain sometimes. // // This is necessary because the "source" or "." program in @@ -170,99 +207,93 @@ function dumpScript (cb) { // Really, one should not be tossing away EPIPE errors, or any // errors, so casually. But, without this, `. <(npm completion)` // can never ever work on OS X. - if (er.errno === 'EPIPE') er = null - cb(er) + if (er.errno === 'EPIPE') { + res() + } else { + rej(er) + } }) }) } -function unescape (w) { - if (w.charAt(0) === '\'') return w.replace(/^'|'$/g, '') - else return w.replace(/\\ /g, ' ') -} +const unescape = w => w.charAt(0) === '\'' ? w.replace(/^'|'$/g, '') + : w.replace(/\\ /g, ' ') -function escape (w) { - if (!w.match(/\s+/)) return w - return '\'' + w + '\'' -} +const escape = w => !/\s+/.test(w) ? w + : '\'' + w + '\'' // The command should respond with an array. Loop over that, // wrapping quotes around any that have spaces, and writing -// them to stdout. Use console.log, not the outfd config. +// them to stdout. // If any of the items are arrays, then join them with a space. // Ie, returning ['a', 'b c', ['d', 'e']] would allow it to expand // to: 'a', 'b c', or 'd' 'e' -function wrapCb (cb, opts) { - return function (er, compls) { - if (!Array.isArray(compls)) compls = compls ? [compls] : [] - compls = compls.map(function (c) { - if (Array.isArray(c)) c = c.map(escape).join(' ') - else c = escape(c) - return c - }) +const getWrap = opts => compls => { + console.error('WRAP', opts, compls) - if (opts.partialWord) { - compls = compls.filter(function (c) { - return c.indexOf(opts.partialWord) === 0 - }) - } + if (!Array.isArray(compls)) { + compls = compls ? [compls] : [] + } + + compls = compls.map(c => + Array.isArray(c) ? c.map(escape).join(' ') : escape(c)) - console.error([er && er.stack, compls, opts.partialWord]) - if (er || compls.length === 0) return cb(er) + if (opts.partialWord) { + console.error('HAS PARTIAL WORD', opts.partialWord, compls) + compls = compls.filter(c => c.startsWith(opts.partialWord)) + } + console.error(compls, opts.partialWord) + if (compls.length > 0) { output(compls.join('\n')) - cb() } } // the current word has a dash. Return the config names, // with the same number of dashes as the current word has. -function configCompl (opts, cb) { - var word = opts.word - var split = word.match(/^(-+)((?:no-)*)(.*)$/) - var dashes = split[1] - var no = split[2] - var flags = configNames.filter(isFlag) +const configCompl = opts => { + const word = opts.word + const split = word.match(/^(-+)((?:no-)*)(.*)$/) + const dashes = split[1] + const no = split[2] + const flags = configNames.filter(isFlag) console.error(flags) - - return cb(null, allConfs.map(function (c) { - return dashes + c - }).concat(flags.map(function (f) { - return dashes + (no || 'no-') + f - }))) + return allConfs.map(c => dashes + c) + .concat(flags.map(f => dashes + (no || 'no-') + f)) } // expand with the valid values of various config values. // not yet implemented. -function configValueCompl (opts, cb) { - console.error('configValue', opts) - return cb(null, []) -} +const configValueCompl = opts => [] // check if the thing is a flag or not. -function isFlag (word) { +const isFlag = word => { // shorthands never take args. - var split = word.match(/^(-*)((?:no-)+)?(.*)$/) - var no = split[2] - var conf = split[3] - return no || configTypes[conf] === Boolean || shorthands[conf] + const split = word.match(/^(-*)((?:no-)+)?(.*)$/) + const no = split[2] + const conf = split[3] + const type = types[conf] + return no || + type === Boolean || + Array.isArray(type) && type.includes(Boolean) || + shorthands[conf] } // complete against the npm commands // if they all resolve to the same thing, just return the thing it already is -function cmdCompl (opts, cb) { +const cmdCompl = opts => { console.error('CMD COMPL', opts.partialWord) const matches = fullList.filter(c => c.startsWith(opts.partialWord)) console.error('MATCHES', matches) if (!matches.length) { - return cb(null, matches) + return matches } const derefs = new Set([...matches.map(c => deref(c))]) if (derefs.size === 1) { console.error('ONLY ONE MATCH', derefs) - for (const d of derefs) { - return cb(null, [d]) - } + return [...derefs] } - return cb(null, fullList) + return fullList } + +module.exports = Object.assign(cmd, { completion, usage }) diff --git a/lib/config.js b/lib/config.js index 94f580f2498f9..aaa2155aad004 100644 --- a/lib/config.js +++ b/lib/config.js @@ -1,23 +1,19 @@ -/* eslint-disable standard/no-callback-literal */ -module.exports = config - -const log = require('npmlog') const npm = require('./npm.js') -const npmconf = require('./config/core.js') -const fs = require('graceful-fs') -const writeFileAtomic = require('write-file-atomic') -const types = npmconf.defs.types -const ini = require('ini') +const { defaults, types, shorthands } = require('./utils/config.js') +const usageUtil = require('./utils/usage.js') +const output = require('./utils/output.js') + const editor = require('editor') -const os = require('os') -const path = require('path') const mkdirp = require('mkdirp-infer-owner') -const umask = require('./utils/umask') -const usage = require('./utils/usage') -const output = require('./utils/output') -const noProgressTillDone = require('./utils/no-progress-while-running').tillDone +const { dirname } = require('path') +const { promisify } = require('util') +const fs = require('fs') +const readFile = promisify(fs.readFile) +const writeFile = promisify(fs.writeFile) +const { EOL } = require('os') +const ini = require('ini') -config.usage = usage( +const usage = usageUtil( 'config', 'npm config set ' + '\nnpm config get []' + @@ -27,16 +23,19 @@ config.usage = usage( '\nnpm set ' + '\nnpm get []' ) -config.completion = function (opts, cb) { - var argv = opts.conf.argv.remain + +const cmd = (args, cb) => config(args).then(() => cb()).catch(cb) + +const completion = (opts, cb) => { + const argv = opts.conf.argv.remain if (argv[1] !== 'config') argv.unshift('config') if (argv.length === 2) { - var cmds = ['get', 'set', 'delete', 'ls', 'rm', 'edit'] + const cmds = ['get', 'set', 'delete', 'ls', 'rm', 'edit'] if (opts.partialWord !== 'l') cmds.push('list') return cb(null, cmds) } - var action = argv[2] + const action = argv[2] switch (action) { case 'set': // todo: complete with valid values, if possible. @@ -56,232 +55,182 @@ config.completion = function (opts, cb) { } } -// npm config set key value -// npm config get key -// npm config list -function config (args, cb) { - var action = args.shift() - switch (action) { - case 'set': - return set(args[0], args[1], cb) - case 'get': - return get(args[0], cb) - case 'delete': - case 'rm': - case 'del': - return del(args[0], cb) - case 'list': - case 'ls': - return npm.config.get('json') ? listJson(cb) : list(cb) - case 'edit': - return edit(cb) - default: - return unknown(action, cb) +const config = async ([action, key, val]) => { + npm.log.disableProgress() + try { + switch (action) { + case 'set': + await set(key, val) + break + case 'get': + await get(key) + break + case 'delete': + case 'rm': + case 'del': + await del(key) + break + case 'list': + case 'ls': + await (npm.config.get('json') ? listJson() : list()) + break + case 'edit': + await edit() + break + default: + throw usage + } + } finally { + npm.log.enableProgress() } } -function edit (cb) { - var e = npm.config.get('editor') - var which = npm.config.get('global') ? 'global' : 'user' - var f = npm.config.get(which + 'config') - if (!e) return cb(new Error('No EDITOR config or environ set.')) - npm.config.save(which, function (er) { - if (er) return cb(er) - fs.readFile(f, 'utf8', function (er, data) { - if (er) data = '' - data = [ - ';;;;', - '; npm ' + (npm.config.get('global') - ? 'globalconfig' : 'userconfig') + ' file', - '; this is a simple ini-formatted file', - '; lines that start with semi-colons are comments.', - '; read `npm help config` for help on the various options', - ';;;;', - '', - data - ].concat([ - ';;;;', - '; all options with default values', - ';;;;' - ]).concat(Object.keys(npmconf.defaults).reduce(function (arr, key) { - var obj = {} - obj[key] = npmconf.defaults[key] - return arr.concat( - ini.stringify(obj) - .replace(/\n$/m, '') - .replace(/^/g, '; ') - .replace(/\n/g, '\n; ') - .split('\n')) - }, [])) - .concat(['']) - .join(os.EOL) - mkdirp(path.dirname(f)).catch(cb).then(() => { - writeFileAtomic( - f, - data, - function (er) { - if (er) return cb(er) - editor(f, { editor: e }, noProgressTillDone(cb)) - } - ) - }) - }) - }) -} - -function del (key, cb) { - if (!key) return cb(new Error('no key provided')) - var where = npm.config.get('global') ? 'global' : 'user' - npm.config.del(key, where) - npm.config.save(where, cb) -} - -function set (key, val, cb) { +const set = async (key, val) => { if (key === undefined) { - return unknown('', cb) + throw usage } + if (val === undefined) { if (key.indexOf('=') !== -1) { - var k = key.split('=') + const k = key.split('=') key = k.shift() val = k.join('=') } else { val = '' } } + key = key.trim() val = val.trim() - log.info('config', 'set %j %j', key, val) - var where = npm.config.get('global') ? 'global' : 'user' - if (key.match(/umask/)) val = umask.fromString(val) + npm.log.info('config', 'set %j %j', key, val) + const where = npm.config.get('global') ? 'global' : 'user' + const validBefore = npm.config.data.get(where).valid + console.error('validBefore?', validBefore) npm.config.set(key, val, where) - npm.config.save(where, cb) -} - -function get (key, cb) { - if (!key) return list(cb) - if (!publicVar(key)) { - return cb(new Error('---sekretz---')) + if (!npm.config.validate(where)) { + npm.log.warn('config', 'omitting invalid config values') } - var val = npm.config.get(key) - if (key.match(/umask/)) val = umask.toString(val) - output(val) - cb() -} - -function sort (a, b) { - return a > b ? 1 : -1 + await npm.config.save(where) } -function publicVar (k) { - return !(k.charAt(0) === '_' || k.indexOf(':_') !== -1) -} - -function getKeys (data) { - return Object.keys(data).filter(publicVar).sort(sort) -} - -function listJson (cb) { - const publicConf = npm.config.keys.reduce((publicConf, k) => { - var value = npm.config.get(k) - - // argv is not really config, it's command config - if (publicVar(k) && k !== 'argv') { - publicConf[k] = value - } +const get = async key => { + if (!key) { + return list() + } - return publicConf - }, {}) + if (!publicVar(key)) { + throw `The ${key} option is protected, and cannot be retrieved in this way` + } - output(JSON.stringify(publicConf, null, 2)) - return cb() + output(npm.config.get(key)) } -function listFromSource (title, conf, long) { - var confKeys = getKeys(conf) - var msg = '' - - if (confKeys.length) { - msg += '; ' + title + '\n' - confKeys.forEach(function (k) { - var val = JSON.stringify(conf[k]) - if (conf[k] !== npm.config.get(k)) { - if (!long) return - msg += '; ' + k + ' = ' + val + ' (overridden)\n' - } else msg += k + ' = ' + val + '\n' - }) - msg += '\n' +const del = async key => { + if (!key) { + throw usage } - return msg + const where = npm.config.get('global') ? 'global' : 'user' + npm.config.del(key, where) + await npm.config.save(where) } -function list (cb) { - var msg = '' - var long = npm.config.get('long') - - var cli = npm.config.sources.cli.data - var cliKeys = getKeys(cli) - if (cliKeys.length) { - msg += '; cli configs\n' - cliKeys.forEach(function (k) { - if (cli[k] && typeof cli[k] === 'object') return - if (k === 'argv') return - msg += k + ' = ' + JSON.stringify(cli[k]) + '\n' - }) - msg += '\n' +const edit = async () => { + const { editor: e, global } = npm.flatOptions + if (!e) { + throw new Error('No `editor` config or EDITOR envionment variable set') } - // env configs - msg += listFromSource('environment configs', npm.config.sources.env.data, long) - - // project config file - var project = npm.config.sources.project - msg += listFromSource('project config ' + project.path, project.data, long) - - // user config file - msg += listFromSource('userconfig ' + npm.config.get('userconfig'), npm.config.sources.user.data, long) + const where = global ? 'global' : 'user' + const file = npm.config.data.get(where).source + + // save first, just to make sure it's synced up + // this also removes all the comments from the last time we edited it. + await npm.config.save(where) + const data = (await readFile(file, 'utf8').catch(() => '')).replace(/\r\n/g, '\n') + const defData = Object.entries(defaults).reduce((str, [key, val]) => { + const obj = { [key]: val } + const i = ini.stringify(obj) + .replace(/\n$/m, '') + .replace(/^/g, '; ') + .replace(/\n/g, '\n; ') + .split('\n') + return str + '\n' + i + }, '') + + const tmpData = `;;;; +; npm ${where}config file: ${file} +; this is a simple ini-formatted file +; lines that start with semi-colons are comments +; run \`npm help 7 config\` for documentation of the various options +; +; Configs like \`@scope:registry\` map a scope to a given registry url. +; +; Configs like \`///:_authToken\` are auth that is restricted +; to the registry host specified. + +${data.split('\n').sort((a, b) => a.localeCompare(b)).join('\n').trim()} + +;;;; +; all available options shown below with default values +;;;; + +${defData} +`.split('\n').join(EOL) + await mkdirp(dirname(file)) + await writeFile(file, tmpData, 'utf8') + await new Promise((res, rej) => { + editor(file, { editor: e }, (er) => er ? rej(er) : res()) + }) +} - // global config file - msg += listFromSource('globalconfig ' + npm.config.get('globalconfig'), npm.config.sources.global.data, long) +const publicVar = k => !/^(\/\/[^:]+:)?_/.test(k) +const getKeys = o => Object.keys(o).filter(publicVar) + .sort((a, b) => a.localeCompare(b)) - // builtin config file - var builtin = npm.config.sources.builtin || {} - if (builtin && builtin.data) { - msg += listFromSource('builtin config ' + builtin.path, builtin.data, long) +const list = async () => { + const msg = [] + const { long } = npm.flatOptions + for (const [where, { data, source }] of npm.config.data.entries()) { + if (where === 'default' && !long) { + continue + } + const keys = Object.keys(data) + if (!keys.length) { + continue + } + msg.push(`; "${where}" config from ${source}`, '') + for (const k of keys) { + const v = publicVar(k) ? JSON.stringify(data[k]) : '(protected)' + const src = npm.config.find(k) + const overridden = src !== where + msg.push((overridden ? '; ' : '') + + `${k} = ${v} ${overridden ? `; overridden by ${src}` : ''}`) + } + msg.push('') } - // only show defaults if --long if (!long) { - msg += '; node bin location = ' + process.execPath + '\n' + - '; cwd = ' + process.cwd() + '\n' + - '; HOME = ' + process.env.HOME + '\n' + - '; "npm config ls -l" to show all defaults.\n' - - output(msg) - return cb() + msg.push( + `; node bin location = ${process.execPath}`, + `; cwd = ${process.cwd()}`, + `; HOME = ${process.env.HOME}`, + `; Run \`npm config ls -l\` to show all defaults.` + ) } - var defaults = npmconf.defaults - var defKeys = getKeys(defaults) - msg += '; default values\n' - defKeys.forEach(function (k) { - const def = defaults[k] - // XXX remove this skip when we stop putting log in the npm.config set. - if (def && typeof def === 'object' && !Array.isArray(def)) { - return - } - var val = JSON.stringify(def) - if (def !== npm.config.get(k)) { - msg += '; ' + k + ' = ' + val + ' (overridden)\n' - } else msg += k + ' = ' + val + '\n' - }) - msg += '\n' - - output(msg) - return cb() + output(msg.join('\n').trim()) } -function unknown (action, cb) { - cb('Usage:\n' + config.usage) +const listJson = async () => { + const publicConf = {} + for (const key in npm.config.list[0]) { + if (!publicVar(key)) { + continue + } + publicConf[key] = npm.config.get(key) + } + output(JSON.stringify(publicConf, null, 2)) } + +module.exports = Object.assign(cmd, { usage, completion }) diff --git a/lib/doctor.js b/lib/doctor.js index dc78eca1110cb..1e781dc596afe 100644 --- a/lib/doctor.js +++ b/lib/doctor.js @@ -206,7 +206,7 @@ const verifyCachedFiles = async () => { } } -const { defaults: { registry: defaultRegistry } } = require('./config/defaults.js') +const { defaults: { registry: defaultRegistry } } = require('./utils/config.js') const checkNpmRegistry = async () => { if (npm.flatOptions.registry !== defaultRegistry) { throw `Try \`npm config set registry=${defaultRegistry}\`` diff --git a/lib/help.js b/lib/help.js index 7d20489b532e1..ab2dc4060cfc8 100644 --- a/lib/help.js +++ b/lib/help.js @@ -22,7 +22,7 @@ const usage = require('./utils/usage.js') help.usage = usage('help', 'npm help []') function help (args, cb) { - var argv = npm.config.get('argv').cooked + var argv = npm.config.parsedArgv.cooked var argnum = 0 if (args.length === 2 && ~~args[0]) { diff --git a/lib/logout.js b/lib/logout.js index 68442791aeab9..08b1223a124a5 100644 --- a/lib/logout.js +++ b/lib/logout.js @@ -33,10 +33,7 @@ const logout = async args => { npm.config.del(`${scope}:registry`) } npm.config.clearCredentialsByURI(reg) - // make npm.config.save() return a promise - await new Promise((res, rej) => { - npm.config.save('user', er => er ? rej(er) : res()) - }) + await npm.config.save('user') } module.exports = Object.assign(cmd, { completion, usage }) diff --git a/lib/npm.js b/lib/npm.js index d8a325a79889f..15b4141336bb9 100644 --- a/lib/npm.js +++ b/lib/npm.js @@ -5,23 +5,14 @@ // these are all dependencies used in the ctor const EventEmitter = require('events') -const { resolve } = require('path') +const { resolve, dirname } = require('path') +const Config = require('@npmcli/config') // Patch the global fs module here at the app level require('graceful-fs').gracefulify(require('fs')) const procLogListener = require('./utils/proc-log-listener.js') -const notYetLoadedConfig = { - loaded: false, - get: () => { - throw new Error('npm.load() required') - }, - set: () => { - throw new Error('npm.load() required') - } -} - const hasOwnProperty = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key) // the first time `npm.commands.xyz` is loaded, it gets added @@ -57,6 +48,8 @@ const makeCmd = cmd => { return fn } +const { types, defaults, shorthands } = require('./utils/config.js') + let warnedNonDashArg = false const _runCmd = Symbol('_runCmd') const _load = Symbol('_load') @@ -77,9 +70,12 @@ const npm = module.exports = new class extends EventEmitter { procLogListener() process.emit('time', 'npm') this.version = require('../package.json').version - this.config = notYetLoadedConfig - this.loading = false - this.loaded = false + this.config = new Config({ + npmPath: dirname(__dirname), + types, + defaults, + shorthands + }) this.updateNotification = null } @@ -91,7 +87,7 @@ const npm = module.exports = new class extends EventEmitter { [_runCmd] (cmd, impl, args, cb) { if (!this.loaded) { throw new Error( - 'Call npm.load(config, cb) before using this command.\n' + + 'Call npm.load(cb) before using this command.\n' + 'See the README.md or bin/npm-cli.js for example usage.' ) } @@ -121,9 +117,10 @@ const npm = module.exports = new class extends EventEmitter { } // call with parsed CLI options and a callback when done loading - load (cli, cb) { - if (!cli || !cb || typeof cli !== 'object' || typeof cb !== 'function') { - throw new TypeError('must call as: npm.load(options, callback)') + // XXX promisify this and stop taking a callback + load (cb) { + if (!cb || typeof cb !== 'function') { + throw new TypeError('must call as: npm.load(callback)') } this.once('load', cb) if (this.loaded || this.loadErr) { @@ -137,69 +134,56 @@ const npm = module.exports = new class extends EventEmitter { process.emit('time', 'npm:load') this.log.pause() - return this[_load](cli).catch(er => er).then((er) => { + return this[_load]().catch(er => er).then((er) => { this.loading = false - this.loaded = true - this.config.loaded = true this.loadErr = er if (!er && this.config.get('force')) { this.log.warn('using --force', 'Recommended protections disabled.') } if (!er && !this[_flatOptions]) { this[_flatOptions] = require('./config/flat-options.js')(this) - require('./config/set-envs.js')(this) + process.env.npm_command = this.command } process.emit('timeEnd', 'npm:load') this.emit('load', er) }) } - async [_load] (cli) { + get loaded () { + return this.config.loaded + } + + async [_load] () { const node = await which(process.argv[0]).catch(er => null) if (node && node.toUpperCase() !== process.execPath.toUpperCase()) { log.verbose('node symlink', node) process.execPath = node } + this.config.execPath = node - const builtin = resolve(__dirname, '../npmrc') - const config = this.config = await npmconf.load(cli, builtin) - - // if the 'project' config is not a filename, and we're - // not in global mode, then that means that it collided - // with either the default or effective userland config - if (!config.get('global') && - config.sources.project && - config.sources.project.type !== 'ini') { - log.verbose( - 'config', - 'Skipping project config: %s. (matches userconfig)', - config.localPrefix + '/.npmrc' - ) - } + await this.config.load() + this.argv = this.config.parsedArgv.remain - setUserAgent(config) - - if (config.get('metrics-registry') === null) { - config.set('metrics-registry', config.get('registry')) - } + setUserAgent(this.config) - this.color = setupLog(config, this) + this.color = setupLog(this.config, this) + process.env.COLOR = this.color ? '1' : '0' - cleanUpLogFiles(this.cache, config.get('logs-max'), log.warn) + cleanUpLogFiles(this.cache, this.config.get('logs-max'), log.warn) log.resume() - const umask = config.get('umask') + const umask = this.config.get('umask') this.modes = { exec: 0o777 & (~umask), file: 0o666 & (~umask), umask } - const configScope = config.get('scope') + const configScope = this.config.get('scope') if (configScope && !/^@/.test(configScope)) { - config.set('scope', `@${configScope}`) + this.config.set('scope', `@${configScope}`, this.config.find('scope')) } - this.projectScope = config.get('scope') || + this.projectScope = this.config.get('scope') || getProjectScope(this.prefix) startMetrics() @@ -289,7 +273,6 @@ const npm = module.exports = new class extends EventEmitter { // now load everything required by the class methods -const npmconf = require('./config/core.js') const log = require('npmlog') const { promisify } = require('util') const startMetrics = require('./utils/metrics.js').start diff --git a/lib/profile.js b/lib/profile.js index 216adac229f45..a9e0325943c3d 100644 --- a/lib/profile.js +++ b/lib/profile.js @@ -236,9 +236,7 @@ function enable2fa (args) { ).then((result) => { if (!result.token) throw new Error('Your registry ' + conf.registry + 'does not seem to support bearer tokens. Bearer tokens are required for two-factor authentication') npm.config.setCredentialsByURI(conf.registry, { token: result.token }) - return new Promise((res, rej) => { - npm.config.save('user', er => er ? rej(er) : res()) - }) + return npm.config.save('user') }) } }).then(() => { diff --git a/test/lib/cli.js b/test/lib/cli.js index daa8e56dee6b8..0d9b6ad6a5a8a 100644 --- a/test/lib/cli.js +++ b/test/lib/cli.js @@ -3,7 +3,7 @@ const t = require('tap') let LOAD_ERROR = null const npmock = { version: '99.99.99', - load: (config, cb) => cb(LOAD_ERROR), + load: cb => cb(LOAD_ERROR), argv: [], config: { settings: {}, @@ -46,10 +46,14 @@ t.test('print the version, and treat npm_g to npm -g', t => { const { log } = console const consoleLogs = [] console.log = (...msg) => consoleLogs.push(msg) + const { argv } = process const proc = { argv: ['node', 'npm_g', '-v'], + version: '420.69.lol', on: () => {} } + process.argv = proc.argv + npmock.config.settings.version = true cli(proc) @@ -57,13 +61,17 @@ t.test('print the version, and treat npm_g to npm -g', t => { t.strictSame(proc.argv, [ 'node', 'npm', '-g', '-v' ]) t.strictSame(logs, [ 'pause', - [ 'verbose', 'cli', [ 'node', 'npm', '-g', '-v' ] ] + [ 'verbose', 'cli', [ 'node', 'npm', '-g', '-v' ] ], + [ 'info', 'using', 'npm@%s', '99.99.99' ], + [ 'info', 'using', 'node@%s', '420.69.lol' ] ]) t.strictSame(consoleLogs, [ [ '99.99.99' ] ]) t.strictSame(errorHandlerExitCalled, 0) + delete npmock.config.settings.version + process.argv = argv console.log = log - npmock.argv = 0 + npmock.argv.length = 0 proc.argv.length = 0 logs.length = 0 consoleLogs.length = 0 @@ -76,14 +84,19 @@ t.test('calling with --versions calls npm version with no args', t => { const { log } = console const consoleLogs = [] console.log = (...msg) => consoleLogs.push(msg) + const processArgv = process.argv const proc = { argv: ['node', 'npm', 'install', 'or', 'whatever', '--versions'], on: () => {} } + process.argv = proc.argv + npmock.config.set('versions', true) t.teardown(() => { + delete npmock.config.settings.versions + process.argv = processArgv console.log = log - npmock.argv = 0 + npmock.argv.length = 0 proc.argv.length = 0 logs.length = 0 consoleLogs.length = 0 @@ -120,10 +133,11 @@ t.test('print usage if -h provided', t => { argv: ['node', 'npm', 'asdf'], on: () => {} } + npmock.argv = ['asdf'] t.teardown(() => { console.log = log - npmock.argv = 0 + npmock.argv.length = 0 proc.argv.length = 0 logs.length = 0 consoleLogs.length = 0 diff --git a/test/lib/load-all-commands.js b/test/lib/load-all-commands.js index 3160b5da2bee4..c9df47ac1410f 100644 --- a/test/lib/load-all-commands.js +++ b/test/lib/load-all-commands.js @@ -3,7 +3,7 @@ const npm = require('../../lib/npm.js') const t = require('tap') const { cmdList } = require('../../lib/config/cmd-list.js') -t.test('load npm', t => npm.load({}, er => { +t.test('load npm', t => npm.load(er => { if (er) { throw er } diff --git a/test/lib/npm.js b/test/lib/npm.js index 3c62643fcea2f..0185f8de33ea7 100644 --- a/test/lib/npm.js +++ b/test/lib/npm.js @@ -1,9 +1,10 @@ +'use strict' const t = require('tap') const fs = require('fs') // delete this so that we don't have configs from the fact that it // is being run by 'npm test' -for (env of Object.keys(process.env).filter(e => /^npm_/.test(e))) { +for (const env of Object.keys(process.env).filter(e => /^npm_/.test(e))) { delete process.env[env] } @@ -26,7 +27,25 @@ const bePosix = () => { } const npmlog = require('npmlog') -const npmconf = require('../../lib/config/core.js') + +const npmPath = resolve(__dirname, '..', '..') +const Config = require('@npmcli/config') +const { types, defaults, shorthands } = require('../../lib/utils/config.js') +const freshConfig = (opts = {}) => { + for (const env of Object.keys(process.env).filter(e => /^npm_/.test(e))) { + delete process.env[env] + } + process.env.npm_config_cache = CACHE + + npm.config = new Config({ + types, + defaults, + shorthands, + npmPath, + log: npmlog, + ...opts + }) +} const logs = [] for (const level of ['silly', 'verbose', 'timing', 'notice', 'warn', 'error']) { @@ -36,6 +55,7 @@ for (const level of ['silly', 'verbose', 'timing', 'notice', 'warn', 'error']) { const npm = require('../../lib/npm.js') const CACHE = t.testdir() +process.env.npm_config_cache = CACHE t.test('not yet loaded', t => { t.match(npm, { @@ -63,28 +83,26 @@ t.test('not yet loaded', t => { t.test('npm.load', t => { t.test('must be called with proper args', t => { - const er = new TypeError('must call as: npm.load(options, callback)') + const er = new TypeError('must call as: npm.load(callback)') t.throws(() => npm.load(), er) t.throws(() => npm.load({}), er) - t.throws(() => npm.load(() => {}), er) t.same(logs, []) logs.length = 0 t.end() }) t.test('load error', t => { - const { load } = npmconf + const { load } = npm.config const loadError = new Error('load error') - npmconf.load = async () => { throw loadError } - npm.load({}, er => { + npm.config.load = async () => { throw loadError } + npm.load(er => { t.equal(er, loadError) t.equal(npm.loadErr, loadError) - npmconf.load = load + npm.config.load = load // loading again just returns the same error - npm.load({}, er => { + npm.load(er => { t.equal(er, loadError) t.equal(npm.loadErr, loadError) - npm.loaded = false npm.loadErr = null t.end() }) @@ -110,7 +128,7 @@ t.test('npm.load', t => { const second = () => { secondCalled = true } t.equal(npm.loading, false, 'not loading yet') - const p = npm.load({ global: false, cache: CACHE }, first).then(() => { + const p = npm.load(first).then(() => { npm.config.set('prefix', dir) t.match(npm, { loaded: true, @@ -121,7 +139,7 @@ t.test('npm.load', t => { t.equal(secondCalled, true, 'second callback got called') let thirdCalled = false const third = () => { thirdCalled = true } - npm.load({}, third) + npm.load(third) t.equal(thirdCalled, true, 'third callbback got called') t.match(logs, [ ['timing', 'npm:load', /Completed in [0-9]+ms/] @@ -181,7 +199,7 @@ t.test('npm.load', t => { t.equal(npm.loaded, false, 'not loaded yet') t.equal(npm.loading, true, 'working on it tho') t.isa(p, Promise, 'npm.load() returned a Promise first time') - t.equal(npm.load({ global: true }, second), undefined, + t.equal(npm.load(second), undefined, 'npm.load() returns nothing second time') return p @@ -193,30 +211,24 @@ t.test('npm.load', t => { t.teardown(() => { process.argv[0] = argv0 }) + freshConfig({ argv: [...process.argv, '--force', '--color', 'always'] }) process.argv[0] = 'this exe does not exist or else this test will fail' - npm.config.set('force', true) - npm.loaded = false - return npm.load({force: true}, er => { + return npm.load(er => { if (er) { throw er } - t.match(logs, [ + t.match(logs.filter(l => l[0] !== 'timing'), [ [ 'warn', 'using --force', 'Recommended protections disabled.' - ], - [ - 'timing', - 'npm:load', - /Completed in [0-9]+ms/ - ], + ] ]) logs.length = 0 }) }) - t.test('node is a symlink', t => { + t.test('node is a symlink', async t => { const node = actualPlatform === 'win32' ? 'node.exe' : 'node' const dir = t.testdir({ '.npmrc': 'foo = bar' @@ -227,12 +239,18 @@ t.test('npm.load', t => { const PATH = process.env.PATH || process.env.Path process.env.PATH = dir - const { execPath } = process - const [ argv0 ] = process.argv - process.argv[0] = node - - npm.loaded = false - npm.config.loaded = false + const { execPath, argv: processArgv } = process + process.argv = [ + node, + process.argv[1], + '--metrics-registry', 'http://example.com', + '--prefix', dir, + '--userconfig', `${dir}/.npmrc`, + '--usage', + '--scope=foo' + ] + + freshConfig() const { log } = console const consoleLogs = [] console.log = (...msg) => consoleLogs.push(msg) @@ -240,37 +258,26 @@ t.test('npm.load', t => { t.teardown(() => { console.log = log process.env.PATH = PATH - npm.loaded = false + process.argv = processArgv + freshConfig() logs.length = 0 process.execPath = execPath - process.argv[0] = argv0 }) logs.length = 0 - return npm.load({ - 'metrics-registry': 'http://example.com', - prefix: dir, - userconfig: `${dir}/.npmrc`, - usage: true, - scope: 'foo' - }, er => { + + await npm.load(er => { if (er) { throw er } t.equal(npm.config.get('scope'), '@foo', 'added the @ sign to scope') t.equal(npm.config.get('metrics-registry'), 'http://example.com') - t.match(logs, [ + t.match(logs.filter(l => l[0] !== 'timing' || !/^config:/.test(l[1])), [ [ 'verbose', 'node symlink', resolve(dir, node) ], - [ - 'verbose', - 'config', - 'Skipping project config: %s. (matches userconfig)', - /\.npmrc$/ - ], [ 'timing', 'npm:load', @@ -279,41 +286,42 @@ t.test('npm.load', t => { ]) logs.length = 0 t.equal(process.execPath, resolve(dir, node)) - }).then(() => { - return npm.commands.ll([], (er) => { - if (er) { - throw er - } - t.same(consoleLogs, [[require('../../lib/ls.js').usage]], 'print usage') - consoleLogs.length = 0 - npm.config.set('usage', false) - t.equal(npm.commands.ll, npm.commands.la, 'same command, different name') - logs.length = 0 - return npm.commands.get(['scope', '\u2010not-a-dash'], (er) => { - if (er) { - throw er - } - t.match(logs, [ - [ - 'error', - 'arg', - 'Argument starts with non-ascii dash, this is probably invalid:', - '\u2010not-a-dash', - ], - [ - 'timing', - 'command:config', - /Completed in [0-9]+ms/, - ], - [ - 'timing', - 'command:get', - /Completed in [0-9]+ms/, - ], - ]) - t.same(consoleLogs, [['@foo']]) - }) - }) + }) + + await npm.commands.ll([], (er) => { + if (er) { + throw er + } + t.same(consoleLogs, [[require('../../lib/ls.js').usage]], 'print usage') + consoleLogs.length = 0 + npm.config.set('usage', false) + t.equal(npm.commands.ll, npm.commands.la, 'same command, different name') + logs.length = 0 + }) + + await npm.commands.get(['scope', '\u2010not-a-dash'], (er) => { + if (er) { + throw er + } + t.match(logs, [ + [ + 'error', + 'arg', + 'Argument starts with non-ascii dash, this is probably invalid:', + '\u2010not-a-dash', + ], + [ + 'timing', + 'command:config', + /Completed in [0-9]+ms/, + ], + [ + 'timing', + 'command:get', + /Completed in [0-9]+ms/, + ], + ]) + t.same(consoleLogs, [['@foo']]) }) }) From 8872be9cafd2a8dae4df3424b7ae3e4cbc662522 Mon Sep 17 00:00:00 2001 From: isaacs Date: Tue, 18 Aug 2020 09:56:05 -0700 Subject: [PATCH 7/8] move cmd-list from lib/config/ to lib/utils/ --- lib/completion.js | 2 +- lib/help.js | 2 +- lib/{config => utils}/cmd-list.js | 0 lib/utils/deref-command.js | 2 +- lib/utils/usage.js | 2 +- ...st.js-TAP.test.js => test-lib-utils-cmd-list.js-TAP.test.js} | 2 +- test/lib/load-all-commands.js | 2 +- test/lib/{config => utils}/cmd-list.js | 2 +- 8 files changed, 7 insertions(+), 7 deletions(-) rename lib/{config => utils}/cmd-list.js (100%) rename tap-snapshots/{test-lib-config-cmd-list.js-TAP.test.js => test-lib-utils-cmd-list.js-TAP.test.js} (98%) rename test/lib/{config => utils}/cmd-list.js (66%) diff --git a/lib/completion.js b/lib/completion.js index 14c590081db75..3ce390adb900a 100644 --- a/lib/completion.js +++ b/lib/completion.js @@ -34,7 +34,7 @@ const npm = require('./npm.js') const { types, shorthands, defaults } = require('./utils/config.js') const deref = require('./utils/deref-command.js') -const { aliases, cmdList, plumbing } = require('./config/cmd-list.js') +const { aliases, cmdList, plumbing } = require('./utils/cmd-list.js') const aliasNames = Object.keys(aliases) const fullList = cmdList.concat(aliasNames).filter(c => !plumbing.includes(c)) const nopt = require('nopt') diff --git a/lib/help.js b/lib/help.js index ab2dc4060cfc8..7dddadf879a07 100644 --- a/lib/help.js +++ b/lib/help.js @@ -13,7 +13,7 @@ var log = require('npmlog') var openUrl = require('./utils/open-url') var glob = require('glob') var didYouMean = require('./utils/did-you-mean') -var cmdList = require('./config/cmd-list').cmdList +var cmdList = require('./utils/cmd-list').cmdList var commands = cmdList var output = require('./utils/output.js') diff --git a/lib/config/cmd-list.js b/lib/utils/cmd-list.js similarity index 100% rename from lib/config/cmd-list.js rename to lib/utils/cmd-list.js diff --git a/lib/utils/deref-command.js b/lib/utils/deref-command.js index f2d4c36981f3a..18e11689e9b1d 100644 --- a/lib/utils/deref-command.js +++ b/lib/utils/deref-command.js @@ -1,6 +1,6 @@ // de-reference abbreviations and shorthands into canonical command name -const { aliases, cmdList, plumbing } = require('../config/cmd-list.js') +const { aliases, cmdList, plumbing } = require('../utils/cmd-list.js') const aliasNames = Object.keys(aliases) const fullList = cmdList.concat(aliasNames).filter(c => !plumbing.includes(c)) const abbrev = require('abbrev') diff --git a/lib/utils/usage.js b/lib/utils/usage.js index ba069e645e156..1eda734c0fcf9 100644 --- a/lib/utils/usage.js +++ b/lib/utils/usage.js @@ -1,5 +1,5 @@ 'use strict' -var aliases = require('../config/cmd-list').aliases +var aliases = require('../utils/cmd-list').aliases module.exports = function usage (cmd, txt, opt) { var post = Object.keys(aliases).reduce(function (p, c) { diff --git a/tap-snapshots/test-lib-config-cmd-list.js-TAP.test.js b/tap-snapshots/test-lib-utils-cmd-list.js-TAP.test.js similarity index 98% rename from tap-snapshots/test-lib-config-cmd-list.js-TAP.test.js rename to tap-snapshots/test-lib-utils-cmd-list.js-TAP.test.js index d7db532f402b8..1b0118d262d1e 100644 --- a/tap-snapshots/test-lib-config-cmd-list.js-TAP.test.js +++ b/tap-snapshots/test-lib-utils-cmd-list.js-TAP.test.js @@ -5,7 +5,7 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' -exports[`test/lib/config/cmd-list.js TAP > must match snapshot 1`] = ` +exports[`test/lib/utils/cmd-list.js TAP > must match snapshot 1`] = ` Object { "affordances": Object { "add": "install", diff --git a/test/lib/load-all-commands.js b/test/lib/load-all-commands.js index c9df47ac1410f..1669f435e9b09 100644 --- a/test/lib/load-all-commands.js +++ b/test/lib/load-all-commands.js @@ -1,7 +1,7 @@ // just for gathering coverage info const npm = require('../../lib/npm.js') const t = require('tap') -const { cmdList } = require('../../lib/config/cmd-list.js') +const { cmdList } = require('../../lib/utils/cmd-list.js') t.test('load npm', t => npm.load(er => { if (er) { diff --git a/test/lib/config/cmd-list.js b/test/lib/utils/cmd-list.js similarity index 66% rename from test/lib/config/cmd-list.js rename to test/lib/utils/cmd-list.js index 1bbb5186ac6e8..8e936946b9938 100644 --- a/test/lib/config/cmd-list.js +++ b/test/lib/utils/cmd-list.js @@ -1,4 +1,4 @@ const t = require('tap') -const cmdList = require('../../../lib/config/cmd-list.js') +const cmdList = require('../../../lib/utils/cmd-list.js') // just snapshot it so we are made aware if it changes unexpectedly t.matchSnapshot(cmdList) From 2432c2f34463a0a76c1c75eed35de0fcdd58b934 Mon Sep 17 00:00:00 2001 From: isaacs Date: Tue, 18 Aug 2020 09:57:38 -0700 Subject: [PATCH 8/8] move flat-options.js from lib/config/ to lib/utils/ --- lib/npm.js | 2 +- lib/{config => utils}/flat-options.js | 0 ...s-TAP.test.js => test-lib-utils-flat-options.js-TAP.test.js} | 2 +- test/lib/{config => utils}/flat-options.js | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename lib/{config => utils}/flat-options.js (100%) rename tap-snapshots/{test-lib-config-flat-options.js-TAP.test.js => test-lib-utils-flat-options.js-TAP.test.js} (97%) rename test/lib/{config => utils}/flat-options.js (99%) diff --git a/lib/npm.js b/lib/npm.js index 15b4141336bb9..79d2767229806 100644 --- a/lib/npm.js +++ b/lib/npm.js @@ -141,7 +141,7 @@ const npm = module.exports = new class extends EventEmitter { this.log.warn('using --force', 'Recommended protections disabled.') } if (!er && !this[_flatOptions]) { - this[_flatOptions] = require('./config/flat-options.js')(this) + this[_flatOptions] = require('./utils/flat-options.js')(this) process.env.npm_command = this.command } process.emit('timeEnd', 'npm:load') diff --git a/lib/config/flat-options.js b/lib/utils/flat-options.js similarity index 100% rename from lib/config/flat-options.js rename to lib/utils/flat-options.js diff --git a/tap-snapshots/test-lib-config-flat-options.js-TAP.test.js b/tap-snapshots/test-lib-utils-flat-options.js-TAP.test.js similarity index 97% rename from tap-snapshots/test-lib-config-flat-options.js-TAP.test.js rename to tap-snapshots/test-lib-utils-flat-options.js-TAP.test.js index b360c5ac8967f..27ad10e5ed8ac 100644 --- a/tap-snapshots/test-lib-config-flat-options.js-TAP.test.js +++ b/tap-snapshots/test-lib-utils-flat-options.js-TAP.test.js @@ -5,7 +5,7 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' -exports[`test/lib/config/flat-options.js TAP basic > flat options 1`] = ` +exports[`test/lib/utils/flat-options.js TAP basic > flat options 1`] = ` Object { "@scope:registry": "@scope:registry", "//nerf.dart:_authToken": "//nerf.dart:_authToken", diff --git a/test/lib/config/flat-options.js b/test/lib/utils/flat-options.js similarity index 99% rename from test/lib/config/flat-options.js rename to test/lib/utils/flat-options.js index 864ea9f1dd220..8ababa9826b71 100644 --- a/test/lib/config/flat-options.js +++ b/test/lib/utils/flat-options.js @@ -119,7 +119,7 @@ class MockConfig { } } -const flatOptions = require('../../../lib/config/flat-options.js') +const flatOptions = require('../../../lib/utils/flat-options.js') t.match(logs, [[ 'verbose', 'npm-session',