From 43dd49c9782848c25e5b03448c8a0f923f13c158 Mon Sep 17 00:00:00 2001 From: Kat Marchán Date: Tue, 29 Jan 2019 14:43:00 -0800 Subject: deps: upgrade npm to 6.7.0 PR-URL: https://github.com/nodejs/node/pull/25804 Reviewed-By: Myles Borins --- deps/npm/node_modules/pacote/lib/util/opt-check.js | 105 +++++++++------------ 1 file changed, 44 insertions(+), 61 deletions(-) (limited to 'deps/npm/node_modules/pacote/lib/util/opt-check.js') diff --git a/deps/npm/node_modules/pacote/lib/util/opt-check.js b/deps/npm/node_modules/pacote/lib/util/opt-check.js index d13a69e4dc..e6afc21c84 100644 --- a/deps/npm/node_modules/pacote/lib/util/opt-check.js +++ b/deps/npm/node_modules/pacote/lib/util/opt-check.js @@ -1,64 +1,47 @@ 'use strict' -const pkg = require('../../package.json') -const silentlog = require('./silentlog') +const figgyPudding = require('figgy-pudding') +const logger = require('./proclog.js') -function PacoteOptions (opts) { - opts = opts || {} - this._isPacoteOptions = true - this.agent = opts.agent - this.annotate = opts.annotate - this.auth = opts.auth - this.scopeTargets = opts.scopeTargets || {} - this.defaultTag = opts.defaultTag || 'latest' - this.cache = opts.cache - this.ca = opts.ca - this.cert = opts.cert - this.integrity = opts.integrity - this.key = opts.key - this.localAddress = opts.localAddress - this.log = opts.log || silentlog - this.memoize = opts.memoize - this.maxSockets = opts.maxSockets || 10 - this.offline = opts.offline - this.preferOffline = opts.preferOffline - this.proxy = opts.proxy - this.noProxy = opts.noProxy - this.registry = opts.registry || 'https://registry.npmjs.org' - this.resolved = opts.resolved - this.retry = opts.retry // for npm-registry-client - this.scope = opts.scope - this.userAgent = opts.userAgent || `${pkg.name}@${pkg.version}/node@${process.version}+${process.arch} (${process.platform})` - this.where = opts.where - this.preferOnline = opts.preferOnline - this.strictSSL = !!opts.strictSSL - this.isFromCI = !!( - opts.isFromCI || - process.env['CI'] === 'true' || - process.env['TDDIUM'] || - process.env['JENKINS_URL'] || - process.env['bamboo.buildKey'] - ) - this.npmSession = opts.npmSession - this.refer = opts.referer || opts.refer - this.projectScope = opts.projectScope - this.fullMetadata = opts.fullMetadata - this.alwaysAuth = opts.alwaysAuth - this.includeDeprecated = opts.includeDeprecated == null - ? true - : opts.includeDeprecated - - this.dirPacker = opts.dirPacker || null - - this.uid = opts.uid - this.gid = opts.gid - - this.dmode = opts.dmode - this.fmode = opts.fmode - this.umask = opts.umask -} - -module.exports = optCheck -function optCheck (opts) { - return new PacoteOptions(opts) -} +const AUTH_REGEX = /^(?:.*:)?(token|_authToken|username|_password|password|email|always-auth|_auth|otp)$/ +const SCOPE_REGISTRY_REGEX = /@.*:registry$/gi +module.exports = figgyPudding({ + annotate: {}, + cache: {}, + defaultTag: 'tag', + dirPacker: {}, + dmode: {}, + 'enjoy-by': 'enjoyBy', + enjoyBy: {}, + fmode: {}, + 'fetch-retries': { default: 2 }, + 'fetch-retry-factor': { default: 10 }, + 'fetch-retry-maxtimeout': { default: 60000 }, + 'fetch-retry-mintimeout': { default: 10000 }, + fullMetadata: 'full-metadata', + 'full-metadata': { default: false }, + gid: {}, + git: {}, + includeDeprecated: { default: true }, + 'include-deprecated': 'includeDeprecated', + integrity: {}, + log: { default: logger }, + memoize: {}, + offline: {}, + preferOffline: 'prefer-offline', + 'prefer-offline': {}, + preferOnline: 'prefer-online', + 'prefer-online': {}, + registry: { default: 'https://registry.npmjs.org/' }, + resolved: {}, + retry: {}, + scope: {}, + tag: { default: 'latest' }, + uid: {}, + umask: {}, + where: {} +}, { + other (key) { + return key.match(AUTH_REGEX) || key.match(SCOPE_REGISTRY_REGEX) + } +}) -- cgit v1.2.3