mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2025-09-06 15:07:21 +00:00
push all website files
This commit is contained in:
32
website/node_modules/npm/lib/config/bin-links.js
generated
vendored
Normal file
32
website/node_modules/npm/lib/config/bin-links.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
'use strict'
|
||||
|
||||
const npm = require('../npm.js')
|
||||
var packageId = require('../utils/package-id.js')
|
||||
const log = require('npmlog')
|
||||
|
||||
module.exports = binLinksOpts
|
||||
|
||||
function binLinksOpts (pkg) {
|
||||
return {
|
||||
ignoreScripts: npm.config.get('ignore-scripts'),
|
||||
force: npm.config.get('force'),
|
||||
globalBin: npm.globalBin,
|
||||
globalDir: npm.globalDir,
|
||||
json: npm.config.get('json'),
|
||||
log: log,
|
||||
name: 'npm',
|
||||
parseable: npm.config.get('parseable'),
|
||||
pkgId: packageId(pkg),
|
||||
prefix: npm.config.get('prefix'),
|
||||
prefixes: [
|
||||
npm.prefix,
|
||||
npm.globalPrefix,
|
||||
npm.dir,
|
||||
npm.root,
|
||||
npm.globalDir,
|
||||
npm.bin,
|
||||
npm.globalBin
|
||||
],
|
||||
umask: npm.config.get('umask')
|
||||
}
|
||||
}
|
16
website/node_modules/npm/lib/config/clear-credentials-by-uri.js
generated
vendored
Normal file
16
website/node_modules/npm/lib/config/clear-credentials-by-uri.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
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')
|
||||
}
|
132
website/node_modules/npm/lib/config/cmd-list.js
generated
vendored
Normal file
132
website/node_modules/npm/lib/config/cmd-list.js
generated
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
// short names for common things
|
||||
var shorthands = {
|
||||
'un': 'uninstall',
|
||||
'rb': 'rebuild',
|
||||
'list': 'ls',
|
||||
'ln': 'link',
|
||||
'create': 'init',
|
||||
'i': 'install',
|
||||
'it': 'install-test',
|
||||
'cit': 'install-ci-test',
|
||||
'up': 'update',
|
||||
'c': 'config',
|
||||
's': 'search',
|
||||
'se': 'search',
|
||||
'unstar': 'star', // same function
|
||||
'tst': 'test',
|
||||
't': 'test',
|
||||
'ddp': 'dedupe',
|
||||
'v': 'view',
|
||||
'run': 'run-script',
|
||||
'clean-install': 'ci',
|
||||
'clean-install-test': 'cit'
|
||||
}
|
||||
|
||||
var affordances = {
|
||||
'la': 'ls',
|
||||
'll': 'ls',
|
||||
'verison': 'version',
|
||||
'ic': 'ci',
|
||||
'innit': 'init',
|
||||
'isntall': 'install',
|
||||
'install-clean': 'ci',
|
||||
'isntall-clean': 'ci',
|
||||
'dist-tags': 'dist-tag',
|
||||
'apihelp': 'help',
|
||||
'find-dupes': 'dedupe',
|
||||
'upgrade': 'update',
|
||||
'udpate': 'update',
|
||||
'login': 'adduser',
|
||||
'add-user': 'adduser',
|
||||
'author': 'owner',
|
||||
'home': 'docs',
|
||||
'issues': 'bugs',
|
||||
'info': 'view',
|
||||
'show': 'view',
|
||||
'find': 'search',
|
||||
'add': 'install',
|
||||
'unlink': 'uninstall',
|
||||
'remove': 'uninstall',
|
||||
'rm': 'uninstall',
|
||||
'r': 'uninstall',
|
||||
'rum': 'run-script',
|
||||
'sit': 'cit'
|
||||
}
|
||||
|
||||
// these are filenames in .
|
||||
var cmdList = [
|
||||
'ci',
|
||||
'install-ci-test',
|
||||
'install',
|
||||
'install-test',
|
||||
'uninstall',
|
||||
'cache',
|
||||
'config',
|
||||
'set',
|
||||
'get',
|
||||
'update',
|
||||
'outdated',
|
||||
'prune',
|
||||
'pack',
|
||||
'dedupe',
|
||||
'hook',
|
||||
|
||||
'rebuild',
|
||||
'link',
|
||||
|
||||
'publish',
|
||||
'star',
|
||||
'stars',
|
||||
'adduser',
|
||||
'login', // This is an alias for `adduser` but it can be confusing
|
||||
'logout',
|
||||
'unpublish',
|
||||
'owner',
|
||||
'access',
|
||||
'team',
|
||||
'deprecate',
|
||||
'shrinkwrap',
|
||||
'token',
|
||||
'profile',
|
||||
'audit',
|
||||
|
||||
'help',
|
||||
'help-search',
|
||||
'ls',
|
||||
'search',
|
||||
'view',
|
||||
'init',
|
||||
'version',
|
||||
'edit',
|
||||
'explore',
|
||||
'docs',
|
||||
'repo',
|
||||
'bugs',
|
||||
'root',
|
||||
'prefix',
|
||||
'bin',
|
||||
'whoami',
|
||||
'dist-tag',
|
||||
'ping',
|
||||
|
||||
'test',
|
||||
'stop',
|
||||
'start',
|
||||
'restart',
|
||||
'run-script',
|
||||
'completion',
|
||||
'doctor'
|
||||
]
|
||||
|
||||
var plumbing = [
|
||||
'build',
|
||||
'unbuild',
|
||||
'xmas',
|
||||
'substack',
|
||||
'visnup'
|
||||
]
|
||||
module.exports.aliases = Object.assign({}, shorthands, affordances)
|
||||
module.exports.shorthands = shorthands
|
||||
module.exports.affordances = affordances
|
||||
module.exports.cmdList = cmdList
|
||||
module.exports.plumbing = plumbing
|
429
website/node_modules/npm/lib/config/core.js
generated
vendored
Normal file
429
website/node_modules/npm/lib/config/core.js
generated
vendored
Normal file
@@ -0,0 +1,429 @@
|
||||
var CC = require('config-chain').ConfigChain
|
||||
var inherits = require('inherits')
|
||||
var configDefs = require('./defaults.js')
|
||||
var types = configDefs.types
|
||||
var once = require('once')
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
var nopt = require('nopt')
|
||||
var ini = require('ini')
|
||||
var Umask = configDefs.Umask
|
||||
var mkdirp = require('mkdirp')
|
||||
var umask = require('../utils/umask')
|
||||
var isWindows = require('../utils/is-windows.js')
|
||||
|
||||
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
|
||||
|
||||
var myUid = process.env.SUDO_UID !== undefined
|
||||
? process.env.SUDO_UID : (process.getuid && process.getuid())
|
||||
var myGid = process.env.SUDO_GID !== undefined
|
||||
? process.env.SUDO_GID : (process.getgid && process.getgid())
|
||||
|
||||
var loading = false
|
||||
var loadCbs = []
|
||||
function load () {
|
||||
var cli, builtin, cb
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
switch (typeof arguments[i]) {
|
||||
case 'string': builtin = arguments[i]; break
|
||||
case 'object': cli = arguments[i]; break
|
||||
case 'function': cb = arguments[i]; break
|
||||
}
|
||||
}
|
||||
|
||||
if (!cb) cb = function () {}
|
||||
|
||||
if (exports.loaded) {
|
||||
var ret = exports.loaded
|
||||
if (cli) {
|
||||
ret = new Conf(ret)
|
||||
ret.unshift(cli)
|
||||
}
|
||||
return process.nextTick(cb.bind(null, null, ret))
|
||||
}
|
||||
|
||||
// either a fresh object, or a clone of the passed in obj
|
||||
if (!cli) {
|
||||
cli = {}
|
||||
} else {
|
||||
cli = Object.keys(cli).reduce(function (c, k) {
|
||||
c[k] = cli[k]
|
||||
return c
|
||||
}, {})
|
||||
}
|
||||
|
||||
loadCbs.push(cb)
|
||||
if (loading) return
|
||||
|
||||
loading = true
|
||||
|
||||
cb = once(function (er, conf) {
|
||||
if (!er) {
|
||||
exports.loaded = conf
|
||||
loading = false
|
||||
}
|
||||
loadCbs.forEach(function (fn) {
|
||||
fn(er, conf)
|
||||
})
|
||||
loadCbs.length = 0
|
||||
})
|
||||
|
||||
// check for a builtin if provided.
|
||||
exports.usingBuiltin = !!builtin
|
||||
var rc = exports.rootConf = new Conf()
|
||||
if (builtin) {
|
||||
rc.addFile(builtin, 'builtin')
|
||||
} else {
|
||||
rc.add({}, 'builtin')
|
||||
}
|
||||
|
||||
rc.on('load', function () {
|
||||
load_(builtin, rc, cli, cb)
|
||||
})
|
||||
rc.on('error', cb)
|
||||
}
|
||||
|
||||
function load_ (builtin, rc, cli, cb) {
|
||||
var defaults = configDefs.defaults
|
||||
var conf = new Conf(rc)
|
||||
|
||||
conf.usingBuiltin = !!builtin
|
||||
conf.add(cli, 'cli')
|
||||
conf.addEnv()
|
||||
|
||||
conf.loadPrefix(function (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.
|
||||
var projectConf = path.resolve(conf.localPrefix, '.npmrc')
|
||||
var defaultUserConfig = rc.get('userconfig')
|
||||
var 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')) {
|
||||
var 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)
|
||||
|
||||
var 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.loadUid = require('./load-uid.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)
|
||||
this.loadUid(function (er) {
|
||||
if (er) return cb(er)
|
||||
// Without prefix, nothing will ever work
|
||||
mkdirp(this.prefix, cb)
|
||||
}.bind(this))
|
||||
}.bind(this))
|
||||
}
|
||||
|
||||
Conf.prototype.save = function (where, cb) {
|
||||
var target = this.sources[where]
|
||||
if (!target || !(target.path || target.source) || !target.data) {
|
||||
var er
|
||||
if (where !== 'builtin') er = new Error('bad save target: ' + where)
|
||||
if (cb) {
|
||||
process.nextTick(cb.bind(null, er))
|
||||
return this
|
||||
}
|
||||
return this.emit('error', er)
|
||||
}
|
||||
|
||||
if (target.source) {
|
||||
var pref = target.prefix || ''
|
||||
Object.keys(target.data).forEach(function (k) {
|
||||
target.source[pref + k] = target.data[k]
|
||||
})
|
||||
if (cb) process.nextTick(cb)
|
||||
return this
|
||||
}
|
||||
|
||||
var data = ini.stringify(target.data)
|
||||
|
||||
var then = function then (er) {
|
||||
if (er) return done(er)
|
||||
|
||||
fs.chmod(target.path, mode, done)
|
||||
}
|
||||
|
||||
var done = function 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')
|
||||
}
|
||||
}
|
||||
|
||||
then = then.bind(this)
|
||||
done = done.bind(this)
|
||||
this._saving++
|
||||
|
||||
var mode = where === 'user' ? '0600' : '0666'
|
||||
if (!data.trim()) {
|
||||
fs.unlink(target.path, function () {
|
||||
// ignore the possible error (e.g. the file doesn't exist)
|
||||
done(null)
|
||||
})
|
||||
} else {
|
||||
mkdirp(path.dirname(target.path), function (er) {
|
||||
if (er) return then(er)
|
||||
fs.writeFile(target.path, data, 'utf8', function (er) {
|
||||
if (er) return then(er)
|
||||
if (where === 'user' && myUid && myGid) {
|
||||
fs.chown(target.path, +myUid, +myGid, 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) {
|
||||
if (typeof f !== 'string' && !(f instanceof String)) return f
|
||||
|
||||
// type can be an array or single thing.
|
||||
var typeList = [].concat(types[k])
|
||||
var isPath = typeList.indexOf(path) !== -1
|
||||
var isBool = typeList.indexOf(Boolean) !== -1
|
||||
var isString = typeList.indexOf(String) !== -1
|
||||
var isUmask = typeList.indexOf(Umask) !== -1
|
||||
var isNumber = typeList.indexOf(Number) !== -1
|
||||
|
||||
f = ('' + f).trim()
|
||||
|
||||
if (f.match(/^".*"$/)) {
|
||||
try {
|
||||
f = JSON.parse(f)
|
||||
} catch (e) {
|
||||
throw new Error('Failed parsing JSON config key ' + k + ': ' + f)
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
433
website/node_modules/npm/lib/config/defaults.js
generated
vendored
Normal file
433
website/node_modules/npm/lib/config/defaults.js
generated
vendored
Normal file
@@ -0,0 +1,433 @@
|
||||
// defaults, types, and shorthands.
|
||||
|
||||
var path = require('path')
|
||||
var url = require('url')
|
||||
var Stream = require('stream').Stream
|
||||
var semver = require('semver')
|
||||
var stableFamily = semver.parse(process.version)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
if (!stableFamily || (+stableFamily.minor % 2)) stableFamily = null
|
||||
else stableFamily = stableFamily.major + '.' + stableFamily.minor
|
||||
|
||||
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,
|
||||
'allow-same-version': false,
|
||||
'always-auth': false,
|
||||
also: null,
|
||||
audit: true,
|
||||
'audit-level': 'low',
|
||||
'auth-type': 'legacy',
|
||||
|
||||
'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,
|
||||
depth: Infinity,
|
||||
description: true,
|
||||
dev: false,
|
||||
'dry-run': false,
|
||||
editor: osenv.editor(),
|
||||
'engine-strict': false,
|
||||
force: false,
|
||||
|
||||
'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,
|
||||
'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,
|
||||
link: false,
|
||||
'local-address': undefined,
|
||||
loglevel: 'notice',
|
||||
logstream: process.stderr,
|
||||
'logs-max': 10,
|
||||
long: false,
|
||||
maxsockets: 50,
|
||||
message: '%s',
|
||||
'metrics-registry': null,
|
||||
'node-options': null,
|
||||
'node-version': process.version,
|
||||
'offline': false,
|
||||
'onload-script': false,
|
||||
only: null,
|
||||
optional: true,
|
||||
otp: null,
|
||||
'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}',
|
||||
'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' ? 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'],
|
||||
'allow-same-version': Boolean,
|
||||
'always-auth': Boolean,
|
||||
also: [null, 'dev', 'development'],
|
||||
audit: Boolean,
|
||||
'audit-level': ['low', 'moderate', 'high', 'critical'],
|
||||
'auth-type': ['legacy', 'sso', 'saml', 'oauth'],
|
||||
'bin-links': Boolean,
|
||||
browser: [null, 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],
|
||||
depth: Number,
|
||||
description: Boolean,
|
||||
dev: Boolean,
|
||||
'dry-run': Boolean,
|
||||
editor: String,
|
||||
'engine-strict': Boolean,
|
||||
force: 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,
|
||||
'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,
|
||||
link: Boolean,
|
||||
'local-address': getLocalAddresses(),
|
||||
loglevel: ['silent', 'error', 'warn', 'notice', 'http', 'timing', 'info', 'verbose', 'silly'],
|
||||
logstream: Stream,
|
||||
'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,
|
||||
'onload-script': [null, String],
|
||||
only: [null, 'dev', 'development', 'prod', 'production'],
|
||||
optional: Boolean,
|
||||
'package-lock': Boolean,
|
||||
otp: [null, String],
|
||||
'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': [false, true, '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 = {
|
||||
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']
|
||||
}
|
77
website/node_modules/npm/lib/config/fetch-opts.js
generated
vendored
Normal file
77
website/node_modules/npm/lib/config/fetch-opts.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
'use strict'
|
||||
|
||||
const url = require('url')
|
||||
|
||||
module.exports.fromPacote = fromPacote
|
||||
|
||||
function fromPacote (opts) {
|
||||
return {
|
||||
cache: getCacheMode(opts),
|
||||
cacheManager: opts.cache,
|
||||
ca: opts.ca,
|
||||
cert: opts.cert,
|
||||
headers: getHeaders('', opts.registry, opts),
|
||||
key: opts.key,
|
||||
localAddress: opts.localAddress,
|
||||
maxSockets: opts.maxSockets,
|
||||
proxy: opts.proxy,
|
||||
referer: opts.refer,
|
||||
retry: opts.retry,
|
||||
strictSSL: !!opts.strictSSL,
|
||||
timeout: opts.timeout,
|
||||
uid: opts.uid,
|
||||
gid: opts.gid
|
||||
}
|
||||
}
|
||||
|
||||
function getCacheMode (opts) {
|
||||
return opts.offline
|
||||
? 'only-if-cached'
|
||||
: opts.preferOffline
|
||||
? 'force-cache'
|
||||
: opts.preferOnline
|
||||
? 'no-cache'
|
||||
: 'default'
|
||||
}
|
||||
|
||||
function getHeaders (uri, registry, opts) {
|
||||
const headers = Object.assign({
|
||||
'npm-in-ci': opts.isFromCI,
|
||||
'npm-scope': opts.projectScope,
|
||||
'npm-session': opts.npmSession,
|
||||
'user-agent': opts.userAgent,
|
||||
'referer': opts.refer
|
||||
}, opts.headers)
|
||||
// check for auth settings specific to this registry
|
||||
let auth = (
|
||||
opts.auth &&
|
||||
opts.auth[registryKey(registry)]
|
||||
) || opts.auth
|
||||
// If a tarball is hosted on a different place than the manifest, only send
|
||||
// credentials on `alwaysAuth`
|
||||
const shouldAuth = auth && (
|
||||
auth.alwaysAuth ||
|
||||
url.parse(uri).host === url.parse(registry).host
|
||||
)
|
||||
if (shouldAuth && auth.token) {
|
||||
headers.authorization = `Bearer ${auth.token}`
|
||||
} else if (shouldAuth && auth.username && auth.password) {
|
||||
const encoded = Buffer.from(
|
||||
`${auth.username}:${auth.password}`, 'utf8'
|
||||
).toString('base64')
|
||||
headers.authorization = `Basic ${encoded}`
|
||||
} else if (shouldAuth && auth._auth) {
|
||||
headers.authorization = `Basic ${auth._auth}`
|
||||
}
|
||||
return headers
|
||||
}
|
||||
|
||||
function registryKey (registry) {
|
||||
const parsed = url.parse(registry)
|
||||
const formatted = url.format({
|
||||
host: parsed.host,
|
||||
pathname: parsed.pathname,
|
||||
slashes: parsed.slashes
|
||||
})
|
||||
return url.resolve(formatted, '.')
|
||||
}
|
32
website/node_modules/npm/lib/config/gentle-fs.js
generated
vendored
Normal file
32
website/node_modules/npm/lib/config/gentle-fs.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
'use strict'
|
||||
|
||||
const npm = require('../npm.js')
|
||||
const log = require('npmlog')
|
||||
|
||||
module.exports = gentleFSOpts
|
||||
|
||||
function gentleFSOpts (gently, base, abs) {
|
||||
return {
|
||||
// never rm the root, prefix, or bin dirs
|
||||
//
|
||||
// globals included because of `npm link` -- as far as the package
|
||||
// requesting the link is concerned, the linked package is always
|
||||
// installed globally
|
||||
prefixes: [
|
||||
npm.prefix,
|
||||
npm.globalPrefix,
|
||||
npm.dir,
|
||||
npm.root,
|
||||
npm.globalDir,
|
||||
npm.bin,
|
||||
npm.globalBin
|
||||
],
|
||||
absolute: abs,
|
||||
log: log,
|
||||
prefix: npm.prefix,
|
||||
force: npm.config.get('force'),
|
||||
gently: gently,
|
||||
base: base,
|
||||
name: 'npm'
|
||||
}
|
||||
}
|
78
website/node_modules/npm/lib/config/get-credentials-by-uri.js
generated
vendored
Normal file
78
website/node_modules/npm/lib/config/get-credentials-by-uri.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
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=<base64> 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
|
||||
}
|
31
website/node_modules/npm/lib/config/lifecycle.js
generated
vendored
Normal file
31
website/node_modules/npm/lib/config/lifecycle.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
'use strict'
|
||||
|
||||
const npm = require('../npm.js')
|
||||
const log = require('npmlog')
|
||||
|
||||
module.exports = lifecycleOpts
|
||||
|
||||
let opts
|
||||
|
||||
function lifecycleOpts (moreOpts) {
|
||||
if (!opts) {
|
||||
opts = {
|
||||
config: npm.config.snapshot,
|
||||
dir: npm.dir,
|
||||
failOk: false,
|
||||
force: npm.config.get('force'),
|
||||
group: npm.config.get('group'),
|
||||
ignorePrepublish: npm.config.get('ignore-prepublish'),
|
||||
ignoreScripts: npm.config.get('ignore-scripts'),
|
||||
log: log,
|
||||
nodeOptions: npm.config.get('node-options'),
|
||||
production: npm.config.get('production'),
|
||||
scriptShell: npm.config.get('script-shell'),
|
||||
scriptsPrependNodePath: npm.config.get('scripts-prepend-node-path'),
|
||||
unsafePerm: npm.config.get('unsafe-perm'),
|
||||
user: npm.config.get('user')
|
||||
}
|
||||
}
|
||||
|
||||
return moreOpts ? Object.assign({}, opts, moreOpts) : opts
|
||||
}
|
32
website/node_modules/npm/lib/config/load-cafile.js
generated
vendored
Normal file
32
website/node_modules/npm/lib/config/load-cafile.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
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)
|
||||
}
|
||||
}
|
51
website/node_modules/npm/lib/config/load-prefix.js
generated
vendored
Normal file
51
website/node_modules/npm/lib/config/load-prefix.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
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)
|
||||
}
|
||||
}
|
15
website/node_modules/npm/lib/config/load-uid.js
generated
vendored
Normal file
15
website/node_modules/npm/lib/config/load-uid.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
module.exports = loadUid
|
||||
|
||||
var getUid = require('uid-number')
|
||||
|
||||
// Call in the context of a npmconf object
|
||||
|
||||
function loadUid (cb) {
|
||||
// if we're not in unsafe-perm mode, then figure out who
|
||||
// to run stuff as. Do this first, to support `npm update npm -g`
|
||||
if (!this.get('unsafe-perm')) {
|
||||
getUid(this.get('user'), this.get('group'), cb)
|
||||
} else {
|
||||
process.nextTick(cb)
|
||||
}
|
||||
}
|
23
website/node_modules/npm/lib/config/nerf-dart.js
generated
vendored
Normal file
23
website/node_modules/npm/lib/config/nerf-dart.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
var url = require('url')
|
||||
|
||||
module.exports = toNerfDart
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
function toNerfDart (uri) {
|
||||
var parsed = url.parse(uri)
|
||||
delete parsed.protocol
|
||||
delete parsed.auth
|
||||
delete parsed.query
|
||||
delete parsed.search
|
||||
delete parsed.hash
|
||||
|
||||
return url.resolve(url.format(parsed), '.')
|
||||
}
|
141
website/node_modules/npm/lib/config/pacote.js
generated
vendored
Normal file
141
website/node_modules/npm/lib/config/pacote.js
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
'use strict'
|
||||
|
||||
const Buffer = require('safe-buffer').Buffer
|
||||
|
||||
const crypto = require('crypto')
|
||||
const npm = require('../npm')
|
||||
const log = require('npmlog')
|
||||
let pack
|
||||
const path = require('path')
|
||||
|
||||
let effectiveOwner
|
||||
|
||||
const npmSession = crypto.randomBytes(8).toString('hex')
|
||||
log.verbose('npm-session', npmSession)
|
||||
|
||||
module.exports = pacoteOpts
|
||||
function pacoteOpts (moreOpts) {
|
||||
if (!pack) {
|
||||
pack = require('../pack.js')
|
||||
}
|
||||
const ownerStats = calculateOwner()
|
||||
const opts = {
|
||||
cache: path.join(npm.config.get('cache'), '_cacache'),
|
||||
ca: npm.config.get('ca'),
|
||||
cert: npm.config.get('cert'),
|
||||
defaultTag: npm.config.get('tag'),
|
||||
dirPacker: pack.packGitDep,
|
||||
hashAlgorithm: 'sha1',
|
||||
includeDeprecated: false,
|
||||
key: npm.config.get('key'),
|
||||
localAddress: npm.config.get('local-address'),
|
||||
log: log,
|
||||
maxAge: npm.config.get('cache-min'),
|
||||
maxSockets: npm.config.get('maxsockets'),
|
||||
npmSession: npmSession,
|
||||
offline: npm.config.get('offline'),
|
||||
preferOffline: npm.config.get('prefer-offline') || npm.config.get('cache-min') > 9999,
|
||||
preferOnline: npm.config.get('prefer-online') || npm.config.get('cache-max') <= 0,
|
||||
projectScope: npm.projectScope,
|
||||
proxy: npm.config.get('https-proxy') || npm.config.get('proxy'),
|
||||
noProxy: npm.config.get('noproxy'),
|
||||
refer: npm.registry.refer,
|
||||
registry: npm.config.get('registry'),
|
||||
retry: {
|
||||
retries: npm.config.get('fetch-retries'),
|
||||
factor: npm.config.get('fetch-retry-factor'),
|
||||
minTimeout: npm.config.get('fetch-retry-mintimeout'),
|
||||
maxTimeout: npm.config.get('fetch-retry-maxtimeout')
|
||||
},
|
||||
scope: npm.config.get('scope'),
|
||||
strictSSL: npm.config.get('strict-ssl'),
|
||||
userAgent: npm.config.get('user-agent'),
|
||||
|
||||
dmode: npm.modes.exec,
|
||||
fmode: npm.modes.file,
|
||||
umask: npm.modes.umask
|
||||
}
|
||||
|
||||
if (ownerStats.uid != null || ownerStats.gid != null) {
|
||||
Object.assign(opts, ownerStats)
|
||||
}
|
||||
|
||||
npm.config.keys.forEach(function (k) {
|
||||
const authMatchGlobal = k.match(
|
||||
/^(_authToken|username|_password|password|email|always-auth|_auth)$/
|
||||
)
|
||||
const authMatchScoped = k[0] === '/' && k.match(
|
||||
/(.*):(_authToken|username|_password|password|email|always-auth|_auth)$/
|
||||
)
|
||||
|
||||
// if it matches scoped it will also match global
|
||||
if (authMatchGlobal || authMatchScoped) {
|
||||
let nerfDart = null
|
||||
let key = null
|
||||
let val = null
|
||||
|
||||
if (!opts.auth) { opts.auth = {} }
|
||||
|
||||
if (authMatchScoped) {
|
||||
nerfDart = authMatchScoped[1]
|
||||
key = authMatchScoped[2]
|
||||
val = npm.config.get(k)
|
||||
if (!opts.auth[nerfDart]) {
|
||||
opts.auth[nerfDart] = {
|
||||
alwaysAuth: !!npm.config.get('always-auth')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
key = authMatchGlobal[1]
|
||||
val = npm.config.get(k)
|
||||
opts.auth.alwaysAuth = !!npm.config.get('always-auth')
|
||||
}
|
||||
|
||||
const auth = authMatchScoped ? opts.auth[nerfDart] : opts.auth
|
||||
if (key === '_authToken') {
|
||||
auth.token = val
|
||||
} else if (key.match(/password$/i)) {
|
||||
auth.password =
|
||||
// the config file stores password auth already-encoded. pacote expects
|
||||
// the actual username/password pair.
|
||||
Buffer.from(val, 'base64').toString('utf8')
|
||||
} else if (key === 'always-auth') {
|
||||
auth.alwaysAuth = val === 'false' ? false : !!val
|
||||
} else {
|
||||
auth[key] = val
|
||||
}
|
||||
}
|
||||
|
||||
if (k[0] === '@') {
|
||||
if (!opts.scopeTargets) { opts.scopeTargets = {} }
|
||||
opts.scopeTargets[k.replace(/:registry$/, '')] = npm.config.get(k)
|
||||
}
|
||||
})
|
||||
|
||||
Object.keys(moreOpts || {}).forEach((k) => {
|
||||
opts[k] = moreOpts[k]
|
||||
})
|
||||
|
||||
return opts
|
||||
}
|
||||
|
||||
function calculateOwner () {
|
||||
if (!effectiveOwner) {
|
||||
effectiveOwner = { uid: 0, gid: 0 }
|
||||
|
||||
// Pretty much only on windows
|
||||
if (!process.getuid) {
|
||||
return effectiveOwner
|
||||
}
|
||||
|
||||
effectiveOwner.uid = +process.getuid()
|
||||
effectiveOwner.gid = +process.getgid()
|
||||
|
||||
if (effectiveOwner.uid === 0) {
|
||||
if (process.env.SUDO_UID) effectiveOwner.uid = +process.env.SUDO_UID
|
||||
if (process.env.SUDO_GID) effectiveOwner.gid = +process.env.SUDO_GID
|
||||
}
|
||||
}
|
||||
|
||||
return effectiveOwner
|
||||
}
|
29
website/node_modules/npm/lib/config/reg-client.js
generated
vendored
Normal file
29
website/node_modules/npm/lib/config/reg-client.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = regClientConfig
|
||||
function regClientConfig (npm, log, config) {
|
||||
return {
|
||||
proxy: {
|
||||
http: config.get('proxy'),
|
||||
https: config.get('https-proxy'),
|
||||
localAddress: config.get('local-address')
|
||||
},
|
||||
ssl: {
|
||||
certificate: config.get('cert'),
|
||||
key: config.get('key'),
|
||||
ca: config.get('ca'),
|
||||
strict: config.get('strict-ssl')
|
||||
},
|
||||
retry: {
|
||||
retries: config.get('fetch-retries'),
|
||||
factor: config.get('fetch-retry-factor'),
|
||||
minTimeout: config.get('fetch-retry-mintimeout'),
|
||||
maxTimeout: config.get('fetch-retry-maxtimeout')
|
||||
},
|
||||
userAgent: config.get('user-agent'),
|
||||
log: log,
|
||||
defaultTag: config.get('tag'),
|
||||
maxSockets: config.get('maxsockets'),
|
||||
scope: npm.projectScope
|
||||
}
|
||||
}
|
39
website/node_modules/npm/lib/config/set-credentials-by-uri.js
generated
vendored
Normal file
39
website/node_modules/npm/lib/config/set-credentials-by-uri.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
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.')
|
||||
}
|
||||
}
|
29
website/node_modules/npm/lib/config/set-user.js
generated
vendored
Normal file
29
website/node_modules/npm/lib/config/set-user.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
module.exports = setUser
|
||||
|
||||
var assert = require('assert')
|
||||
var path = require('path')
|
||||
var fs = require('fs')
|
||||
var mkdirp = require('mkdirp')
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
var prefix = path.resolve(this.get('prefix'))
|
||||
mkdirp(prefix, function (er) {
|
||||
if (er) return cb(er)
|
||||
fs.stat(prefix, function (er, st) {
|
||||
defaultConf.user = st && st.uid
|
||||
return cb(er)
|
||||
})
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user