push all website files

This commit is contained in:
Jacob Levine
2019-01-06 13:14:45 -06:00
parent d7301e26c3
commit d2d5d4c04e
15662 changed files with 2166516 additions and 0 deletions

7
website/node_modules/npm/lib/utils/ansi-trim.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
function ansiTrim (str) {
var r = new RegExp('\x1b(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|' +
'\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)', 'g')
return str.replace(r, '')
}
module.exports = ansiTrim

10
website/node_modules/npm/lib/utils/child-path.js generated vendored Normal file
View File

@@ -0,0 +1,10 @@
'use strict'
var path = require('path')
var validate = require('aproba')
var moduleName = require('../utils/module-name.js')
module.exports = childPath
function childPath (parentPath, child) {
validate('SO', arguments)
return path.join(parentPath, 'node_modules', moduleName(child))
}

61
website/node_modules/npm/lib/utils/completion.sh generated vendored Normal file
View File

@@ -0,0 +1,61 @@
#!/bin/bash
###-begin-npm-completion-###
#
# npm command completion script
#
# Installation: npm completion >> ~/.bashrc (or ~/.zshrc)
# Or, maybe: npm completion > /usr/local/etc/bash_completion.d/npm
#
if type complete &>/dev/null; then
_npm_completion () {
local words cword
if type _get_comp_words_by_ref &>/dev/null; then
_get_comp_words_by_ref -n = -n @ -n : -w words -i cword
else
cword="$COMP_CWORD"
words=("${COMP_WORDS[@]}")
fi
local si="$IFS"
IFS=$'\n' COMPREPLY=($(COMP_CWORD="$cword" \
COMP_LINE="$COMP_LINE" \
COMP_POINT="$COMP_POINT" \
npm completion -- "${words[@]}" \
2>/dev/null)) || return $?
IFS="$si"
if type __ltrim_colon_completions &>/dev/null; then
__ltrim_colon_completions "${words[cword]}"
fi
}
complete -o default -F _npm_completion npm
elif type compdef &>/dev/null; then
_npm_completion() {
local si=$IFS
compadd -- $(COMP_CWORD=$((CURRENT-1)) \
COMP_LINE=$BUFFER \
COMP_POINT=0 \
npm completion -- "${words[@]}" \
2>/dev/null)
IFS=$si
}
compdef _npm_completion npm
elif type compctl &>/dev/null; then
_npm_completion () {
local cword line point words si
read -Ac words
read -cn cword
let cword-=1
read -l line
read -ln point
si="$IFS"
IFS=$'\n' reply=($(COMP_CWORD="$cword" \
COMP_LINE="$line" \
COMP_POINT="$point" \
npm completion -- "${words[@]}" \
2>/dev/null)) || return $?
IFS="$si"
}
compctl -K _npm_completion npm
fi
###-end-npm-completion-###

View File

@@ -0,0 +1,24 @@
module.exports = fileCompletion
var mkdir = require('mkdirp')
var glob = require('glob')
function fileCompletion (root, req, depth, cb) {
if (typeof cb !== 'function') {
cb = depth
depth = Infinity
}
mkdir(root, function (er) {
if (er) return cb(er)
// can be either exactly the req, or a descendent
var pattern = root + '/{' + req + ',' + req + '/**/*}'
var opts = { mark: true, dot: true, maxDepth: depth }
glob(pattern, opts, function (er, files) {
if (er) return cb(er)
return cb(null, (files || []).map(function (f) {
return f.substr(root.length + 1).replace(/^\/|\/$/g, '')
}))
})
})
}

View File

@@ -0,0 +1,52 @@
module.exports = installedDeep
var npm = require('../../npm.js')
var readInstalled = require('read-installed')
function installedDeep (opts, cb) {
var local
var global
var depth = npm.config.get('depth')
var opt = { depth: depth, dev: true }
if (npm.config.get('global')) {
local = []
next()
} else {
readInstalled(npm.prefix, opt, function (er, data) {
local = getNames(data || {})
next()
})
}
readInstalled(npm.config.get('prefix'), opt, function (er, data) {
global = getNames(data || {})
next()
})
function getNames_ (d, n) {
if (d.realName && n) {
if (n[d.realName]) return n
n[d.realName] = true
}
if (!n) n = {}
Object.keys(d.dependencies || {}).forEach(function (dep) {
getNames_(d.dependencies[dep], n)
})
return n
}
function getNames (d) {
return Object.keys(getNames_(d))
}
function next () {
if (!local || !global) return
if (!npm.config.get('global')) {
global = global.map(function (g) {
return [g, '-g']
})
}
var names = local.concat(global)
return cb(null, names)
}
}

View File

@@ -0,0 +1,87 @@
module.exports = installedShallow
var npm = require('../../npm.js')
var fs = require('graceful-fs')
var path = require('path')
var readJson = require('read-package-json')
var asyncMap = require('slide').asyncMap
function installedShallow (opts, filter, cb) {
if (typeof cb !== 'function') {
cb = filter
filter = null
}
var conf = opts.conf
var args = conf.argv.remain
if (args.length > 3) return cb()
var local
var global
var localDir = npm.dir
var globalDir = npm.globalDir
if (npm.config.get('global')) {
local = []
next()
} else {
fs.readdir(localDir, function (er, pkgs) {
local = (pkgs || []).filter(function (p) {
return p.charAt(0) !== '.'
})
next()
})
}
fs.readdir(globalDir, function (er, pkgs) {
global = (pkgs || []).filter(function (p) {
return p.charAt(0) !== '.'
})
next()
})
function next () {
if (!local || !global) return
filterInstalled(local, global, filter, cb)
}
}
function filterInstalled (local, global, filter, cb) {
var fl
var fg
if (!filter) {
fl = local
fg = global
return next()
}
asyncMap(local, function (p, cb) {
readJson(path.join(npm.dir, p, 'package.json'), function (er, d) {
if (!d || !filter(d)) return cb(null, [])
return cb(null, d.name)
})
}, function (er, local) {
fl = local || []
next()
})
var globalDir = npm.globalDir
asyncMap(global, function (p, cb) {
readJson(path.join(globalDir, p, 'package.json'), function (er, d) {
if (!d || !filter(d)) return cb(null, [])
return cb(null, d.name)
})
}, function (er, global) {
fg = global || []
next()
})
function next () {
if (!fg || !fl) return
if (!npm.config.get('global')) {
fg = fg.map(function (g) {
return [g, '-g']
})
}
console.error('filtered', fl, fg)
return cb(null, fl.concat(fg))
}
}

123
website/node_modules/npm/lib/utils/correct-mkdir.js generated vendored Normal file
View File

@@ -0,0 +1,123 @@
var chownr = require('chownr')
var dezalgo = require('dezalgo')
var fs = require('graceful-fs')
var inflight = require('inflight')
var log = require('npmlog')
var mkdirp = require('mkdirp')
// memoize the directories created by this step
var stats = {}
var effectiveOwner
module.exports = function correctMkdir (path, cb) {
cb = dezalgo(cb)
cb = inflight('correctMkdir:' + path, cb)
if (!cb) {
return log.verbose('correctMkdir', path, 'correctMkdir already in flight; waiting')
} else {
log.verbose('correctMkdir', path, 'correctMkdir not in flight; initializing')
}
if (stats[path]) return cb(null, stats[path])
fs.stat(path, function (er, st) {
if (er) return makeDirectory(path, cb)
if (!st.isDirectory()) {
log.error('correctMkdir', 'invalid dir %s', path)
return cb(er)
}
var ownerStats = calculateOwner()
// there's always a chance the permissions could have been frobbed, so fix
if (st.uid !== ownerStats.uid) {
stats[path] = ownerStats
setPermissions(path, ownerStats, cb)
} else {
stats[path] = st
cb(null, stats[path])
}
})
}
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
}
function makeDirectory (path, cb) {
cb = inflight('makeDirectory:' + path, cb)
if (!cb) {
return log.verbose('makeDirectory', path, 'creation already in flight; waiting')
} else {
log.verbose('makeDirectory', path, 'creation not in flight; initializing')
}
var owner = calculateOwner()
if (!process.getuid) {
return mkdirp(path, function (er) {
log.verbose('makeCacheDir', 'UID & GID are irrelevant on', process.platform)
stats[path] = owner
return cb(er, stats[path])
})
}
if (owner.uid !== 0 || !process.env.HOME) {
log.silly(
'makeDirectory', path,
'uid:', owner.uid,
'gid:', owner.gid
)
stats[path] = owner
mkdirp(path, afterMkdir)
} else {
fs.stat(process.env.HOME, function (er, st) {
if (er) {
log.error('makeDirectory', 'homeless?')
return cb(er)
}
log.silly(
'makeDirectory', path,
'uid:', st.uid,
'gid:', st.gid
)
stats[path] = st
mkdirp(path, afterMkdir)
})
}
function afterMkdir (er, made) {
if (er || !stats[path] || isNaN(stats[path].uid) || isNaN(stats[path].gid)) {
return cb(er, stats[path])
}
if (!made) return cb(er, stats[path])
setPermissions(made, stats[path], cb)
}
}
function setPermissions (path, st, cb) {
chownr(path, st.uid, st.gid, function (er) {
if (er && er.code === 'ENOENT') return cb(null, st)
return cb(er, st)
})
}

14
website/node_modules/npm/lib/utils/deep-sort-object.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
'use strict'
var sortedObject = require('sorted-object')
module.exports = function deepSortObject (obj) {
if (obj == null || typeof obj !== 'object') return obj
if (obj instanceof Array) {
return obj.map(deepSortObject)
}
obj = sortedObject(obj)
Object.keys(obj).forEach(function (key) {
obj[key] = deepSortObject(obj[key])
})
return obj
}

23
website/node_modules/npm/lib/utils/depr-check.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
'use strict'
const log = require('npmlog')
const deprecated = {}
const deprWarned = {}
module.exports = deprCheck
function deprCheck (data) {
if (deprecated[data._id]) {
data.deprecated = deprecated[data._id]
}
if (data.deprecated) {
deprecated[data._id] = data.deprecated
if (!deprWarned[data._id]) {
deprWarned[data._id] = true
log.warn('deprecated', '%s: %s', data._id, data.deprecated)
}
}
return data
}

17
website/node_modules/npm/lib/utils/did-you-mean.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
var meant = require('meant')
function didYouMean (scmd, commands) {
var bestSimilarity = meant(scmd, commands).map(function (str) {
return ' ' + str
})
if (bestSimilarity.length === 0) return ''
if (bestSimilarity.length === 1) {
return '\nDid you mean this?\n' + bestSimilarity[0]
} else {
return ['\nDid you mean one of these?']
.concat(bestSimilarity.slice(0, 3)).join('\n')
}
}
module.exports = didYouMean

252
website/node_modules/npm/lib/utils/error-handler.js generated vendored Normal file
View File

@@ -0,0 +1,252 @@
module.exports = errorHandler
module.exports.exit = exit
var cbCalled = false
var log = require('npmlog')
var npm = require('../npm.js')
var itWorked = false
var path = require('path')
var wroteLogFile = false
var exitCode = 0
var rollbacks = npm.rollbacks
var chain = require('slide').chain
var writeFileAtomic = require('write-file-atomic')
var errorMessage = require('./error-message.js')
var stopMetrics = require('./metrics.js').stop
var mkdirp = require('mkdirp')
var fs = require('graceful-fs')
var logFileName
function getLogFile () {
if (!logFileName) {
logFileName = path.resolve(npm.config.get('cache'), '_logs', (new Date()).toISOString().replace(/[.:]/g, '_') + '-debug.log')
}
return logFileName
}
var timings = {
version: npm.version,
command: process.argv.slice(2),
logfile: null
}
process.on('timing', function (name, value) {
if (timings[name]) { timings[name] += value } else { timings[name] = value }
})
process.on('exit', function (code) {
process.emit('timeEnd', 'npm')
log.disableProgress()
if (npm.config.loaded && npm.config.get('timing')) {
try {
timings.logfile = getLogFile()
fs.appendFileSync(path.join(npm.config.get('cache'), '_timing.json'), JSON.stringify(timings) + '\n')
} catch (_) {
// ignore
}
}
// kill any outstanding stats reporter if it hasn't finished yet
stopMetrics()
if (code) itWorked = false
if (itWorked) {
log.info('ok')
} else {
if (!cbCalled) {
log.error('', 'cb() never called!')
console.error('')
log.error('', 'This is an error with npm itself. Please report this error at:')
log.error('', ' <https://npm.community>')
writeLogFile()
}
if (code) {
log.verbose('code', code)
}
}
if (npm.config.loaded && npm.config.get('timing') && !wroteLogFile) writeLogFile()
if (wroteLogFile) {
// just a line break
if (log.levels[log.level] <= log.levels.error) console.error('')
log.error(
'',
[
'A complete log of this run can be found in:',
' ' + getLogFile()
].join('\n')
)
wroteLogFile = false
}
var doExit = npm.config.loaded && npm.config.get('_exit')
if (doExit) {
// actually exit.
if (exitCode === 0 && !itWorked) {
exitCode = 1
}
if (exitCode !== 0) process.exit(exitCode)
} else {
itWorked = false // ready for next exit
}
})
function exit (code, noLog) {
exitCode = exitCode || process.exitCode || code
var doExit = npm.config.loaded ? npm.config.get('_exit') : true
log.verbose('exit', [code, doExit])
if (log.level === 'silent') noLog = true
if (rollbacks.length) {
chain(rollbacks.map(function (f) {
return function (cb) {
npm.commands.unbuild([f], true, cb)
}
}), function (er) {
if (er) {
log.error('error rolling back', er)
if (!code) {
errorHandler(er)
} else {
if (!noLog) writeLogFile()
reallyExit(er)
}
} else {
if (!noLog && code) writeLogFile()
reallyExit()
}
})
rollbacks.length = 0
} else if (code && !noLog) {
writeLogFile()
} else {
reallyExit()
}
function reallyExit (er) {
if (er && !code) code = typeof er.errno === 'number' ? er.errno : 1
itWorked = !code
// Exit directly -- nothing in the CLI should still be running in the
// background at this point, and this makes sure anything left dangling
// for whatever reason gets thrown away, instead of leaving the CLI open
//
// Commands that expect long-running actions should just delay `cb()`
process.stdout.write('', () => {
process.exit(code)
})
}
}
function errorHandler (er) {
log.disableProgress()
if (!npm.config || !npm.config.loaded) {
// logging won't work unless we pretend that it's ready
er = er || new Error('Exit prior to config file resolving.')
console.error(er.stack || er.message)
}
if (cbCalled) {
er = er || new Error('Callback called more than once.')
}
cbCalled = true
if (!er) return exit(0)
if (typeof er === 'string') {
log.error('', er)
return exit(1, true)
} else if (!(er instanceof Error)) {
log.error('weird error', er)
return exit(1, true)
}
var m = er.code || er.message.match(/^(?:Error: )?(E[A-Z]+)/)
if (m && !er.code) {
er.code = m
}
;[
'type',
'stack',
'statusCode',
'pkgid'
].forEach(function (k) {
var v = er[k]
if (!v) return
log.verbose(k, v)
})
log.verbose('cwd', process.cwd())
var os = require('os')
log.verbose('', os.type() + ' ' + os.release())
log.verbose('argv', process.argv.map(JSON.stringify).join(' '))
log.verbose('node', process.version)
log.verbose('npm ', 'v' + npm.version)
;[
'file',
'path',
'code',
'errno',
'syscall'
].forEach(function (k) {
var v = er[k]
if (v) log.error(k, v)
})
var msg = errorMessage(er)
msg.summary.concat(msg.detail).forEach(function (errline) {
log.error.apply(log, errline)
})
if (npm.config.get('json')) {
var error = {
error: {
code: er.code,
summary: messageText(msg.summary),
detail: messageText(msg.detail)
}
}
console.log(JSON.stringify(error, null, 2))
}
exit(typeof er.errno === 'number' ? er.errno : 1)
}
function messageText (msg) {
return msg.map(function (line) {
return line.slice(1).join(' ')
}).join('\n')
}
function writeLogFile () {
if (wroteLogFile) return
var os = require('os')
try {
mkdirp.sync(path.resolve(npm.config.get('cache'), '_logs'))
var logOutput = ''
log.record.forEach(function (m) {
var pref = [m.id, m.level]
if (m.prefix) pref.push(m.prefix)
pref = pref.join(' ')
m.message.trim().split(/\r?\n/).map(function (line) {
return (pref + ' ' + line).trim()
}).forEach(function (line) {
logOutput += line + os.EOL
})
})
writeFileAtomic.sync(getLogFile(), logOutput)
// truncate once it's been written.
log.record.length = 0
wroteLogFile = true
} catch (ex) {
}
}

368
website/node_modules/npm/lib/utils/error-message.js generated vendored Normal file
View File

@@ -0,0 +1,368 @@
'use strict'
var npm = require('../npm.js')
var util = require('util')
var nameValidator = require('validate-npm-package-name')
module.exports = errorMessage
function errorMessage (er) {
var short = []
var detail = []
switch (er.code) {
case 'ENOAUDIT':
short.push(['audit', er.message])
break
case 'EAUDITNOPJSON':
short.push(['audit', er.message])
break
case 'EAUDITNOLOCK':
short.push(['audit', er.message])
detail.push(['audit', 'Try creating one first with: npm i --package-lock-only'])
break
case 'ECONNREFUSED':
short.push(['', er])
detail.push([
'',
[
'\nIf you are behind a proxy, please make sure that the',
"'proxy' config is set properly. See: 'npm help config'"
].join('\n')
])
break
case 'EACCES':
case 'EPERM':
short.push(['', er])
detail.push([
'',
[
'\nThe operation was rejected by your operating system.',
(process.platform === 'win32'
? 'It\'s possible that the file was already in use (by a text editor or antivirus),\nor that you lack permissions to access it.'
: 'It is likely you do not have the permissions to access this file as the current user'),
'\nIf you believe this might be a permissions issue, please double-check the',
'permissions of the file and its containing directories, or try running',
'the command again as root/Administrator (though this is not recommended).'
].join('\n')])
break
case 'ELIFECYCLE':
short.push(['', er.message])
detail.push([
'',
[
'',
'Failed at the ' + er.pkgid + ' ' + er.stage + ' script.',
'This is probably not a problem with npm. There is likely additional logging output above.'
].join('\n')]
)
break
case 'ENOGIT':
short.push(['', er.message])
detail.push([
'',
[
'',
'Failed using git.',
'Please check if you have git installed and in your PATH.'
].join('\n')
])
break
case 'EJSONPARSE':
const path = require('path')
// Check whether we ran into a conflict in our own package.json
if (er.file === path.join(npm.prefix, 'package.json')) {
const isDiff = require('../install/read-shrinkwrap.js')._isDiff
const txt = require('fs').readFileSync(er.file, 'utf8')
if (isDiff(txt)) {
detail.push([
'',
[
'Merge conflict detected in your package.json.',
'',
'Please resolve the package.json conflict and retry the command:',
'',
`$ ${process.argv.join(' ')}`
].join('\n')
])
break
}
}
short.push(['JSON.parse', er.message])
detail.push([
'JSON.parse',
[
'Failed to parse package.json data.',
'package.json must be actual JSON, not just JavaScript.'
].join('\n')
])
break
case 'EOTP':
case 'E401':
// the E401 message checking is a hack till we replace npm-registry-client with something
// OTP aware.
if (er.code === 'EOTP' || /one-time pass/.test(er.message)) {
short.push(['', 'This operation requires a one-time password from your authenticator.'])
detail.push([
'',
[
'You can provide a one-time password by passing --otp=<code> to the command you ran.',
'If you already provided a one-time password then it is likely that you either typoed',
'it, or it timed out. Please try again.'
].join('\n')
])
} else {
// npm ERR! code E401
// npm ERR! Unable to authenticate, need: Basic
const auth = (er.headers && er.headers['www-authenticate'] && er.headers['www-authenticate'].map((au) => au.split(/,\s*/))[0]) || []
if (auth.indexOf('Bearer') !== -1) {
short.push(['', 'Unable to authenticate, your authentication token seems to be invalid.'])
detail.push([
'',
[
'To correct this please trying logging in again with:',
' npm login'
].join('\n')
])
} else if (auth.indexOf('Basic') !== -1) {
short.push(['', 'Incorrect or missing password.'])
detail.push([
'',
[
'If you were trying to login, change your password, create an',
'authentication token or enable two-factor authentication then',
'that means you likely typed your password in incorrectly.',
'Please try again, or recover your password at:',
' https://www.npmjs.com/forgot',
'',
'If you were doing some other operation then your saved credentials are',
'probably out of date. To correct this please try logging in again with:',
' npm login'
].join('\n')
])
} else {
short.push(['', er.message || er])
}
}
break
case 'E404':
// There's no need to have 404 in the message as well.
var msg = er.message.replace(/^404\s+/, '')
short.push(['404', msg])
if (er.pkgid && er.pkgid !== '-') {
detail.push(['404', ''])
detail.push(['404', '', "'" + er.pkgid + "' is not in the npm registry."])
var valResult = nameValidator(er.pkgid)
if (valResult.validForNewPackages) {
detail.push(['404', 'You should bug the author to publish it (or use the name yourself!)'])
} else {
detail.push(['404', 'Your package name is not valid, because', ''])
var errorsArray = (valResult.errors || []).concat(valResult.warnings || [])
errorsArray.forEach(function (item, idx) {
detail.push(['404', ' ' + (idx + 1) + '. ' + item])
})
}
if (er.parent) {
detail.push(['404', "It was specified as a dependency of '" + er.parent + "'"])
}
detail.push(['404', '\nNote that you can also install from a'])
detail.push(['404', 'tarball, folder, http url, or git url.'])
}
break
case 'EPUBLISHCONFLICT':
short.push(['publish fail', 'Cannot publish over existing version.'])
detail.push(['publish fail', "Update the 'version' field in package.json and try again."])
detail.push(['publish fail', ''])
detail.push(['publish fail', 'To automatically increment version numbers, see:'])
detail.push(['publish fail', ' npm help version'])
break
case 'EISGIT':
short.push(['git', er.message])
short.push(['git', ' ' + er.path])
detail.push([
'git',
[
'Refusing to remove it. Update manually,',
'or move it out of the way first.'
].join('\n')
])
break
case 'ECYCLE':
short.push([
'cycle',
[
er.message,
'While installing: ' + er.pkgid
].join('\n')
])
detail.push([
'cycle',
[
'Found a pathological dependency case that npm cannot solve.',
'Please report this to the package author.'
].join('\n')
])
break
case 'EBADPLATFORM':
var validOs = er.os.join ? er.os.join(',') : er.os
var validArch = er.cpu.join ? er.cpu.join(',') : er.cpu
var expected = {os: validOs, arch: validArch}
var actual = {os: process.platform, arch: process.arch}
short.push([
'notsup',
[
util.format('Unsupported platform for %s: wanted %j (current: %j)', er.pkgid, expected, actual)
].join('\n')
])
detail.push([
'notsup',
[
'Valid OS: ' + validOs,
'Valid Arch: ' + validArch,
'Actual OS: ' + process.platform,
'Actual Arch: ' + process.arch
].join('\n')
])
break
case 'EEXIST':
short.push(['', er.message])
short.push(['', 'File exists: ' + er.path])
detail.push(['', 'Move it away, and try again.'])
break
case 'ENEEDAUTH':
short.push(['need auth', er.message])
detail.push(['need auth', 'You need to authorize this machine using `npm adduser`'])
break
case 'ECONNRESET':
case 'ENOTFOUND':
case 'ETIMEDOUT':
case 'EAI_FAIL':
short.push(['network', er.message])
detail.push([
'network',
[
'This is a problem related to network connectivity.',
'In most cases you are behind a proxy or have bad network settings.',
'\nIf you are behind a proxy, please make sure that the',
"'proxy' config is set properly. See: 'npm help config'"
].join('\n')
])
break
case 'ENOPACKAGEJSON':
short.push(['package.json', er.message])
detail.push([
'package.json',
[
"npm can't find a package.json file in your current directory."
].join('\n')
])
break
case 'ETARGET':
short.push(['notarget', er.message])
msg = [
'In most cases you or one of your dependencies are requesting',
"a package version that doesn't exist."
]
if (er.parent) {
msg.push("\nIt was specified as a dependency of '" + er.parent + "'\n")
}
detail.push(['notarget', msg.join('\n')])
break
case 'ENOTSUP':
if (er.required) {
short.push(['notsup', er.message])
short.push(['notsup', 'Not compatible with your version of node/npm: ' + er.pkgid])
detail.push([
'notsup',
[
'Not compatible with your version of node/npm: ' + er.pkgid,
'Required: ' + JSON.stringify(er.required),
'Actual: ' + JSON.stringify({
npm: npm.version,
node: npm.config.get('node-version')
})
].join('\n')
])
break
} // else passthrough
/* eslint no-fallthrough:0 */
case 'ENOSPC':
short.push(['nospc', er.message])
detail.push([
'nospc',
[
'There appears to be insufficient space on your system to finish.',
'Clear up some disk space and try again.'
].join('\n')
])
break
case 'EROFS':
short.push(['rofs', er.message])
detail.push([
'rofs',
[
'Often virtualized file systems, or other file systems',
"that don't support symlinks, give this error."
].join('\n')
])
break
case 'ENOENT':
short.push(['enoent', er.message])
detail.push([
'enoent',
[
'This is related to npm not being able to find a file.',
er.file ? "\nCheck if the file '" + er.file + "' is present." : ''
].join('\n')
])
break
case 'EMISSINGARG':
case 'EUNKNOWNTYPE':
case 'EINVALIDTYPE':
case 'ETOOMANYARGS':
short.push(['typeerror', er.stack])
detail.push([
'typeerror',
[
'This is an error with npm itself. Please report this error at:',
' <https://npm.community>'
].join('\n')
])
break
default:
short.push(['', er.message || er])
break
}
if (er.optional) {
short.unshift(['optional', er.optional + ' (' + er.location + '):'])
short.concat(detail).forEach(function (msg) {
if (!msg[0]) msg[0] = 'optional'
if (msg[1]) msg[1] = msg[1].toString().replace(/(^|\n)/g, '$1SKIPPING OPTIONAL DEPENDENCY: ')
})
}
return {summary: short, detail: detail}
}

27
website/node_modules/npm/lib/utils/escape-arg.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
'use strict'
var path = require('path')
var isWindowsShell = require('./is-windows-shell.js')
/*
Escape the name of an executable suitable for passing to the system shell.
Windows is easy, wrap in double quotes and you're done, as there's no
facility to create files with quotes in their names.
Unix-likes are a little more complicated, wrap in single quotes and escape
any single quotes in the filename.
*/
module.exports = escapify
function escapify (str) {
if (isWindowsShell) {
return '"' + path.normalize(str) + '"'
} else {
if (/[^-_.~/\w]/.test(str)) {
return "'" + str.replace(/'/g, "'\"'\"'") + "'"
} else {
return str
}
}
}

30
website/node_modules/npm/lib/utils/escape-exec-path.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
'use strict'
var path = require('path')
var isWindowsShell = require('./is-windows-shell.js')
/*
Escape the name of an executable suitable for passing to the system shell.
Windows is easy, wrap in double quotes and you're done, as there's no
facility to create files with quotes in their names.
Unix-likes are a little more complicated, wrap in single quotes and escape
any single quotes in the filename.
*/
module.exports = escapify
function windowsQuotes (str) {
if (!/ /.test(str)) return str
return '"' + str + '"'
}
function escapify (str) {
if (isWindowsShell) {
return path.normalize(str).split(/\\/).map(windowsQuotes).join('\\')
} else if (/[^-_.~/\w]/.test(str)) {
return "'" + str.replace(/'/g, "'\"'\"'") + "'"
} else {
return str
}
}

21
website/node_modules/npm/lib/utils/gently-rm.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
// only remove the thing if it's a symlink into a specific folder. This is
// a very common use-case of npm's, but not so common elsewhere.
exports = module.exports = gentlyRm
var gentleFS = require('gentle-fs')
var gentleFSOpts = require('../config/gentle-fs.js')
function gentlyRm (target, gently, base, cb) {
if (!cb) {
cb = base
base = undefined
}
if (!cb) {
cb = gently
gently = false
}
return gentleFS.rm(target, gentleFSOpts(gently, base), cb)
}

View File

@@ -0,0 +1,29 @@
'use strict'
const clientConfig = require('../config/reg-client.js')
const Conf = require('../config/core.js').Conf
const log = require('npmlog')
const npm = require('../npm.js')
const RegClient = require('npm-registry-client')
module.exports = getPublishConfig
function getPublishConfig (publishConfig, defaultConfig, defaultClient) {
let config = defaultConfig
let client = defaultClient
log.verbose('getPublishConfig', publishConfig)
if (publishConfig) {
config = new Conf(defaultConfig)
config.save = defaultConfig.save.bind(defaultConfig)
// don't modify the actual publishConfig object, in case we have
// to set a login token or some other data.
config.unshift(Object.keys(publishConfig).reduce(function (s, k) {
s[k] = publishConfig[k]
return s
}, {}))
client = new RegClient(clientConfig(npm, log, config))
}
return { config: config, client: client }
}

50
website/node_modules/npm/lib/utils/git.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
'use strict'
const BB = require('bluebird')
const exec = require('child_process').execFile
const spawn = require('./spawn')
const npm = require('../npm.js')
const which = require('which')
const git = npm.config.get('git')
const assert = require('assert')
const log = require('npmlog')
const noProgressTillDone = require('./no-progress-while-running.js').tillDone
exports.spawn = spawnGit
exports.exec = BB.promisify(execGit)
exports.chainableExec = chainableExec
exports.whichAndExec = whichAndExec
function prefixGitArgs () {
return process.platform === 'win32' ? ['-c', 'core.longpaths=true'] : []
}
function execGit (args, options, cb) {
log.info('git', args)
const fullArgs = prefixGitArgs().concat(args || [])
return exec(git, fullArgs, options, noProgressTillDone(cb))
}
function spawnGit (args, options) {
log.info('git', args)
return spawn(git, prefixGitArgs().concat(args || []), options)
}
function chainableExec () {
var args = Array.prototype.slice.call(arguments)
return [execGit].concat(args)
}
function whichAndExec (args, options, cb) {
assert.equal(typeof cb, 'function', 'no callback provided')
// check for git
which(git, function (err) {
if (err) {
err.code = 'ENOGIT'
return cb(err)
}
execGit(args, options, cb)
})
}

22
website/node_modules/npm/lib/utils/gunzip-maybe.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
var duplex = require('mississippi').duplex
var through = require('mississippi').through
var zlib = require('zlib')
function hasGzipHeader (c) {
return c[0] === 0x1F && c[1] === 0x8B && c[2] === 0x08
}
module.exports = gunzip
function gunzip () {
var stream = duplex()
var peeker = through(function (chunk, enc, cb) {
var newStream = hasGzipHeader(chunk)
? zlib.createGunzip()
: through()
stream.setReadable(newStream)
stream.setWritable(newStream)
stream.write(chunk)
})
stream.setWritable(peeker)
return stream
}

11
website/node_modules/npm/lib/utils/is-registry.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
'use strict'
module.exports = isRegistry
function isRegistry (req) {
if (req == null) return false
// modern metadata
if ('registry' in req) return req.registry
// legacy metadata
if (req.type === 'range' || req.type === 'version' || req.type === 'tag') return true
return false
}

View File

@@ -0,0 +1,4 @@
'use strict'
var isWindows = require('./is-windows.js')
module.exports = isWindows &&
(/^MINGW(32|64)$/.test(process.env.MSYSTEM) || process.env.TERM === 'cygwin')

View File

@@ -0,0 +1,4 @@
'use strict'
var isWindows = require('./is-windows.js')
var isWindowsBash = require('./is-windows-bash.js')
module.exports = isWindows && !isWindowsBash

2
website/node_modules/npm/lib/utils/is-windows.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
'use strict'
module.exports = process.platform === 'win32'

18
website/node_modules/npm/lib/utils/lifecycle-cmd.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
exports = module.exports = cmd
var npm = require('../npm.js')
var usage = require('./usage.js')
function cmd (stage) {
function CMD (args, cb) {
npm.commands['run-script']([stage].concat(args), cb)
}
CMD.usage = usage(stage, 'npm ' + stage + ' [-- <args>]')
var installedShallow = require('./completion/installed-shallow.js')
CMD.completion = function (opts, cb) {
installedShallow(opts, function (d) {
return d.scripts && d.scripts[stage]
}, cb)
}
return CMD
}

14
website/node_modules/npm/lib/utils/lifecycle.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
exports = module.exports = runLifecycle
const lifecycleOpts = require('../config/lifecycle')
const lifecycle = require('npm-lifecycle')
function runLifecycle (pkg, stage, wd, moreOpts, cb) {
if (typeof moreOpts === 'function') {
cb = moreOpts
moreOpts = null
}
const opts = lifecycleOpts(moreOpts)
lifecycle(pkg, stage, wd, opts).then(cb, cb)
}

8
website/node_modules/npm/lib/utils/link.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
module.exports = link
var gentleFS = require('gentle-fs')
var gentleFSOpts = require('../config/gentle-fs.js')
function link (from, to, gently, abs, cb) {
return gentleFS.link(from, to, gentleFSOpts(gently, undefined, abs), cb)
}

73
website/node_modules/npm/lib/utils/locker.js generated vendored Normal file
View File

@@ -0,0 +1,73 @@
var crypto = require('crypto')
var resolve = require('path').resolve
var lockfile = require('lockfile')
var log = require('npmlog')
var npm = require('../npm.js')
var correctMkdir = require('../utils/correct-mkdir.js')
var installLocks = {}
function lockFileName (base, name) {
var c = name.replace(/[^a-zA-Z0-9]+/g, '-').replace(/^-+|-+$/g, '')
var p = resolve(base, name)
var h = crypto.createHash('sha1').update(p).digest('hex')
var l = resolve(npm.cache, '_locks')
return resolve(l, c.substr(0, 24) + '-' + h.substr(0, 16) + '.lock')
}
function lock (base, name, cb) {
var lockDir = resolve(npm.cache, '_locks')
correctMkdir(lockDir, function (er) {
if (er) return cb(er)
var opts = {
stale: npm.config.get('cache-lock-stale'),
retries: npm.config.get('cache-lock-retries'),
wait: npm.config.get('cache-lock-wait')
}
var lf = lockFileName(base, name)
lockfile.lock(lf, opts, function (er) {
if (er) log.warn('locking', lf, 'failed', er)
if (!er) {
log.verbose('lock', 'using', lf, 'for', resolve(base, name))
installLocks[lf] = true
}
cb(er)
})
})
}
function unlock (base, name, cb) {
var lf = lockFileName(base, name)
var locked = installLocks[lf]
if (locked === false) {
return process.nextTick(cb)
} else if (locked === true) {
lockfile.unlock(lf, function (er) {
if (er) {
log.warn('unlocking', lf, 'failed', er)
} else {
installLocks[lf] = false
log.verbose('unlock', 'done using', lf, 'for', resolve(base, name))
}
cb(er)
})
} else {
var notLocked = new Error(
'Attempt to unlock ' + resolve(base, name) + ", which hasn't been locked"
)
notLocked.code = 'ENOTLOCKED'
throw notLocked
}
}
module.exports = {
lock: lock,
unlock: unlock
}

103
website/node_modules/npm/lib/utils/map-to-registry.js generated vendored Normal file
View File

@@ -0,0 +1,103 @@
var url = require('url')
var log = require('npmlog')
var npa = require('npm-package-arg')
var config
module.exports = mapToRegistry
function mapToRegistry (name, config, cb) {
log.silly('mapToRegistry', 'name', name)
var registry
// the name itself takes precedence
var data = npa(name)
if (data.scope) {
// the name is definitely scoped, so escape now
name = name.replace('/', '%2f')
log.silly('mapToRegistry', 'scope (from package name)', data.scope)
registry = config.get(data.scope + ':registry')
if (!registry) {
log.verbose('mapToRegistry', 'no registry URL found in name for scope', data.scope)
}
}
// ...then --scope=@scope or --scope=scope
var scope = config.get('scope')
if (!registry && scope) {
// I'm an enabler, sorry
if (scope.charAt(0) !== '@') scope = '@' + scope
log.silly('mapToRegistry', 'scope (from config)', scope)
registry = config.get(scope + ':registry')
if (!registry) {
log.verbose('mapToRegistry', 'no registry URL found in config for scope', scope)
}
}
// ...and finally use the default registry
if (!registry) {
log.silly('mapToRegistry', 'using default registry')
registry = config.get('registry')
}
log.silly('mapToRegistry', 'registry', registry)
var auth = config.getCredentialsByURI(registry)
// normalize registry URL so resolution doesn't drop a piece of registry URL
var normalized = registry.slice(-1) !== '/' ? registry + '/' : registry
var uri
log.silly('mapToRegistry', 'data', data)
if (data.type === 'remote') {
uri = data.fetchSpec
} else {
uri = url.resolve(normalized, name)
}
log.silly('mapToRegistry', 'uri', uri)
cb(null, uri, scopeAuth(uri, registry, auth), normalized)
}
function scopeAuth (uri, registry, auth) {
var cleaned = {
scope: auth.scope,
email: auth.email,
alwaysAuth: auth.alwaysAuth,
token: undefined,
username: undefined,
password: undefined,
auth: undefined
}
var requestHost
var registryHost
if (auth.token || auth.auth || (auth.username && auth.password)) {
requestHost = url.parse(uri).hostname
registryHost = url.parse(registry).hostname
if (requestHost === registryHost) {
cleaned.token = auth.token
cleaned.auth = auth.auth
cleaned.username = auth.username
cleaned.password = auth.password
} else if (auth.alwaysAuth) {
log.verbose('scopeAuth', 'alwaysAuth set for', registry)
cleaned.token = auth.token
cleaned.auth = auth.auth
cleaned.username = auth.username
cleaned.password = auth.password
} else {
log.silly('scopeAuth', uri, "doesn't share host with registry", registry)
}
if (!config) config = require('../npm').config
if (config.get('otp')) cleaned.otp = config.get('otp')
}
return cleaned
}

40
website/node_modules/npm/lib/utils/metrics-launch.js generated vendored Normal file
View File

@@ -0,0 +1,40 @@
'use strict'
/* eslint-disable camelcase */
module.exports = launchSendMetrics
var fs = require('graceful-fs')
var child_process = require('child_process')
if (require.main === module) main()
function launchSendMetrics () {
var path = require('path')
var npm = require('../npm.js')
try {
if (!npm.config.get('send-metrics')) return
var cliMetrics = path.join(npm.config.get('cache'), 'anonymous-cli-metrics.json')
var targetRegistry = npm.config.get('metrics-registry')
fs.statSync(cliMetrics)
return runInBackground(__filename, [cliMetrics, targetRegistry])
} catch (ex) {
// if the metrics file doesn't exist, don't run
}
}
function runInBackground (js, args, opts) {
if (!args) args = []
args.unshift(js)
if (!opts) opts = {}
opts.stdio = 'ignore'
opts.detached = true
var child = child_process.spawn(process.execPath, args, opts)
child.unref()
return child
}
function main () {
var sendMetrics = require('./metrics.js').send
var metricsFile = process.argv[2]
var metricsRegistry = process.argv[3]
sendMetrics(metricsFile, metricsRegistry)
}

73
website/node_modules/npm/lib/utils/metrics.js generated vendored Normal file
View File

@@ -0,0 +1,73 @@
'use strict'
exports.start = startMetrics
exports.stop = stopMetrics
exports.save = saveMetrics
exports.send = sendMetrics
var fs = require('fs')
var path = require('path')
var npm = require('../npm.js')
var uuid = require('uuid')
var inMetrics = false
function startMetrics () {
if (inMetrics) return
// loaded on demand to avoid any recursive deps when `./metrics-launch` requires us.
var metricsLaunch = require('./metrics-launch.js')
npm.metricsProcess = metricsLaunch()
}
function stopMetrics () {
if (inMetrics) return
if (npm.metricsProcess) npm.metricsProcess.kill('SIGKILL')
}
function saveMetrics (itWorked) {
if (inMetrics) return
// If the metrics reporter hasn't managed to PUT yet then kill it so that it doesn't
// step on our updating the anonymous-cli-metrics json
stopMetrics()
var metricsFile = path.join(npm.config.get('cache'), 'anonymous-cli-metrics.json')
var metrics
try {
metrics = JSON.parse(fs.readFileSync(metricsFile))
metrics.metrics.to = new Date().toISOString()
if (itWorked) {
++metrics.metrics.successfulInstalls
} else {
++metrics.metrics.failedInstalls
}
} catch (ex) {
metrics = {
metricId: uuid.v4(),
metrics: {
from: new Date().toISOString(),
to: new Date().toISOString(),
successfulInstalls: itWorked ? 1 : 0,
failedInstalls: itWorked ? 0 : 1
}
}
}
try {
fs.writeFileSync(metricsFile, JSON.stringify(metrics))
} catch (ex) {
// we couldn't write the error metrics file, um, well, oh well.
}
}
function sendMetrics (metricsFile, metricsRegistry) {
inMetrics = true
var cliMetrics = JSON.parse(fs.readFileSync(metricsFile))
npm.load({}, function (err) {
if (err) return
npm.registry.config.retry.retries = 0
npm.registry.sendAnonymousCLIMetrics(metricsRegistry, cliMetrics, function (err) {
if (err) {
fs.writeFileSync(path.join(path.dirname(metricsFile), 'last-send-metrics-error.txt'), err.stack)
} else {
fs.unlinkSync(metricsFile)
}
})
})
}

31
website/node_modules/npm/lib/utils/module-name.js generated vendored Normal file
View File

@@ -0,0 +1,31 @@
'use strict'
var path = require('path')
module.exports = moduleName
module.exports.test = {}
module.exports.test.pathToPackageName = pathToPackageName
function pathToPackageName (dir) {
if (dir == null) return ''
if (dir === '') return ''
var name = path.relative(path.resolve(dir, '..'), dir)
var scoped = path.relative(path.resolve(dir, '../..'), dir)
if (scoped[0] === '@') return scoped.replace(/\\/g, '/')
return name.trim()
}
module.exports.test.isNotEmpty = isNotEmpty
function isNotEmpty (str) {
return str != null && str !== ''
}
var unknown = 0
function moduleName (tree) {
var pkg = tree.package || tree
if (isNotEmpty(pkg.name) && typeof pkg.name === 'string') return pkg.name.trim()
var pkgName = pathToPackageName(tree.path)
if (pkgName !== '') return pkgName
if (tree._invalidName != null) return tree._invalidName
tree._invalidName = '!invalid#' + (++unknown)
return tree._invalidName
}

12
website/node_modules/npm/lib/utils/move.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
'use strict'
module.exports = wrappedMove
const fs = require('graceful-fs')
const move = require('move-concurrently')
const Bluebird = require('bluebird')
const options = {fs: fs, Promise: Bluebird, maxConcurrency: 4}
function wrappedMove (from, to) {
return move(from, to, options)
}

View File

@@ -0,0 +1,23 @@
'use strict'
var log = require('npmlog')
var progressEnabled
var running = 0
var startRunning = exports.startRunning = function () {
if (progressEnabled == null) progressEnabled = log.progressEnabled
if (progressEnabled) log.disableProgress()
++running
}
var stopRunning = exports.stopRunning = function () {
--running
if (progressEnabled && running === 0) log.enableProgress()
}
exports.tillDone = function noProgressTillDone (cb) {
startRunning()
return function () {
stopRunning()
cb.apply(this, arguments)
}
}

16
website/node_modules/npm/lib/utils/open-url.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
'use strict'
const npm = require('../npm.js')
const output = require('./output.js')
const opener = require('opener')
// attempt to open URL in web-browser, print address otherwise:
module.exports = function open (url, errMsg, cb, browser = npm.config.get('browser')) {
opener(url, { command: npm.config.get('browser') }, (er) => {
if (er && er.code === 'ENOENT') {
output(`${errMsg}:\n\n${url}`)
return cb()
} else {
return cb(er)
}
})
}

8
website/node_modules/npm/lib/utils/output.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
'use strict'
var log = require('npmlog')
// output to stdout in a progress bar compatible way
module.exports = function () {
log.clearProgress()
console.log.apply(console, arguments)
log.showProgress()
}

15
website/node_modules/npm/lib/utils/package-id.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
'use strict'
var moduleName = require('./module-name.js')
module.exports = function (tree) {
var pkg = tree.package || tree
// FIXME: Excluding the '@' here is cleaning up after the mess that
// read-package-json makes. =(
if (pkg._id && pkg._id !== '@') return pkg._id
var name = moduleName(tree)
if (pkg.version) {
return name + '@' + pkg.version
} else {
return name
}
}

25
website/node_modules/npm/lib/utils/parse-json.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
'use strict'
var parseJsonWithErrors = require('json-parse-better-errors')
var parseJSON = module.exports = function (content) {
return parseJsonWithErrors(stripBOM(content))
}
parseJSON.noExceptions = function (content) {
try {
return parseJSON(content)
} catch (ex) {
}
}
// from read-package-json
function stripBOM (content) {
content = content.toString()
// Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
// because the buffer-to-string conversion in `fs.readFileSync()`
// translates it to FEFF, the UTF-16 BOM.
if (content.charCodeAt(0) === 0xFEFF) {
content = content.slice(1)
}
return content
}

26
website/node_modules/npm/lib/utils/perf.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
'use strict'
var log = require('npmlog')
var EventEmitter = require('events').EventEmitter
var perf = new EventEmitter()
module.exports = perf
var timings = {}
process.on('time', time)
process.on('timeEnd', timeEnd)
perf.on('time', time)
perf.on('timeEnd', timeEnd)
function time (name) {
timings[name] = Date.now()
}
function timeEnd (name) {
if (name in timings) {
perf.emit('timing', name, Date.now() - timings[name])
delete timings[name]
} else {
log.silly('timing', "Tried to end timer that doesn't exist:", name)
}
}

View File

@@ -0,0 +1,26 @@
'use strict'
module.exports = pickManifestFromRegistryMetadata
var log = require('npmlog')
var semver = require('semver')
function pickManifestFromRegistryMetadata (spec, tag, versions, metadata) {
log.silly('pickManifestFromRegistryMetadata', 'spec', spec, 'tag', tag, 'versions', versions)
// if the tagged version satisfies, then use that.
var tagged = metadata['dist-tags'][tag]
if (tagged &&
metadata.versions[tagged] &&
semver.satisfies(tagged, spec, true)) {
return {resolvedTo: tag, manifest: metadata.versions[tagged]}
}
// find the max satisfying version.
var ms = semver.maxSatisfying(versions, spec, true)
if (ms) {
return {resolvedTo: ms, manifest: metadata.versions[ms]}
} else if (spec === '*' && versions.length && tagged && metadata.versions[tagged]) {
return {resolvedTo: tag, manifest: metadata.versions[tagged]}
} else {
}
}

38
website/node_modules/npm/lib/utils/pulse-till-done.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
'use strict'
const validate = require('aproba')
const log = require('npmlog')
const Bluebird = require('bluebird')
let pulsers = 0
let pulse
function pulseStart (prefix) {
if (++pulsers > 1) return
pulse = setInterval(function () {
log.gauge.pulse(prefix)
}, 150)
}
function pulseStop () {
if (--pulsers > 0) return
clearInterval(pulse)
}
module.exports = function (prefix, cb) {
validate('SF', [prefix, cb])
if (!prefix) prefix = 'network'
pulseStart(prefix)
return function () {
pulseStop()
cb.apply(null, arguments)
}
}
module.exports.withPromise = pulseWhile
function pulseWhile (prefix, promise) {
if (!promise) {
promise = prefix
prefix = ''
}
pulseStart(prefix)
return Bluebird.resolve(promise).finally(() => pulseStop())
}

View File

@@ -0,0 +1,12 @@
exports = module.exports = readLocalPkg
var npm = require('../npm.js')
var readJson = require('read-package-json')
function readLocalPkg (cb) {
if (npm.config.get('global')) return cb()
var path = require('path')
readJson(path.resolve(npm.prefix, 'package.json'), function (er, d) {
return cb(er, d && d.name)
})
}

73
website/node_modules/npm/lib/utils/read-user-info.js generated vendored Normal file
View File

@@ -0,0 +1,73 @@
'use strict'
const Bluebird = require('bluebird')
const readAsync = Bluebird.promisify(require('read'))
const userValidate = require('npm-user-validate')
const log = require('npmlog')
exports.otp = readOTP
exports.password = readPassword
exports.username = readUsername
exports.email = readEmail
function read (opts) {
return Bluebird.try(() => {
log.clearProgress()
return readAsync(opts)
}).finally(() => {
log.showProgress()
})
}
function readOTP (msg, otp, isRetry) {
if (!msg) {
msg = [
'This command requires a one-time password (OTP) from your authenticator app.',
'Enter one below. You can also pass one on the command line by appending --otp=123456.',
'For more information, see:',
'https://docs.npmjs.com/getting-started/using-two-factor-authentication',
'Enter OTP: '
].join('\n')
}
if (isRetry && otp && /^[\d ]+$|^[A-Fa-f0-9]{64,64}$/.test(otp)) return otp.replace(/\s+/g, '')
return read({prompt: msg, default: otp || ''})
.then((otp) => readOTP(msg, otp, true))
}
function readPassword (msg, password, isRetry) {
if (!msg) msg = 'npm password: '
if (isRetry && password) return password
return read({prompt: msg, silent: true, default: password || ''})
.then((password) => readPassword(msg, password, true))
}
function readUsername (msg, username, opts, isRetry) {
if (!msg) msg = 'npm username: '
if (isRetry && username) {
const error = userValidate.username(username)
if (error) {
opts.log && opts.log.warn(error.message)
} else {
return Promise.resolve(username.trim())
}
}
return read({prompt: msg, default: username || ''})
.then((username) => readUsername(msg, username, opts, true))
}
function readEmail (msg, email, opts, isRetry) {
if (!msg) msg = 'email (this IS public): '
if (isRetry && email) {
const error = userValidate.email(email)
if (error) {
opts.log && opts.log.warn(error.message)
} else {
return email.trim()
}
}
return read({prompt: msg, default: email || ''})
.then((username) => readEmail(msg, username, opts, true))
}

16
website/node_modules/npm/lib/utils/save-stack.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
'use strict'
var inherits = require('inherits')
module.exports = SaveStack
function SaveStack (fn) {
Error.call(this)
Error.captureStackTrace(this, fn || SaveStack)
}
inherits(SaveStack, Error)
SaveStack.prototype.completeWith = function (er) {
this['__' + 'proto' + '__'] = er
this.stack = this.stack + '\n\n' + er.stack
return this
}

50
website/node_modules/npm/lib/utils/spawn.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
module.exports = spawn
var _spawn = require('child_process').spawn
var EventEmitter = require('events').EventEmitter
var npwr = require('./no-progress-while-running.js')
function willCmdOutput (stdio) {
if (stdio === 'inherit') return true
if (!Array.isArray(stdio)) return false
for (var fh = 1; fh <= 2; ++fh) {
if (stdio[fh] === 'inherit') return true
if (stdio[fh] === 1 || stdio[fh] === 2) return true
}
return false
}
function spawn (cmd, args, options) {
var cmdWillOutput = willCmdOutput(options && options.stdio)
if (cmdWillOutput) npwr.startRunning()
var raw = _spawn(cmd, args, options)
var cooked = new EventEmitter()
raw.on('error', function (er) {
if (cmdWillOutput) npwr.stopRunning()
er.file = cmd
cooked.emit('error', er)
}).on('close', function (code, signal) {
if (cmdWillOutput) npwr.stopRunning()
// Create ENOENT error because Node.js v0.8 will not emit
// an `error` event if the command could not be found.
if (code === 127) {
var er = new Error('spawn ENOENT')
er.code = 'ENOENT'
er.errno = 'ENOENT'
er.syscall = 'spawn'
er.file = cmd
cooked.emit('error', er)
} else {
cooked.emit('close', code, signal)
}
})
cooked.stdin = raw.stdin
cooked.stdout = raw.stdout
cooked.stderr = raw.stderr
cooked.kill = function (sig) { return raw.kill(sig) }
return cooked
}

7
website/node_modules/npm/lib/utils/temp-filename.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
'use strict'
var uniqueFilename = require('unique-filename')
var npm = require('../npm.js')
module.exports = function (prefix) {
return uniqueFilename(npm.tmp, prefix)
}

17
website/node_modules/npm/lib/utils/umask.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
var umask = require('umask')
var npmlog = require('npmlog')
var _fromString = umask.fromString
module.exports = umask
// fromString with logging callback
umask.fromString = function (val) {
_fromString(val, function (err, result) {
if (err) {
npmlog.warn('invalid umask', err.message)
}
val = result
})
return val
}

View File

@@ -0,0 +1,5 @@
'use strict'
module.exports = function (path) {
return path.replace(/\\/g, '/')
}

53
website/node_modules/npm/lib/utils/unsupported.js generated vendored Normal file
View File

@@ -0,0 +1,53 @@
'use strict'
var semver = require('semver')
var supportedNode = [
{ver: '6', min: '6.0.0'},
{ver: '8', min: '8.0.0'},
{ver: '9', min: '9.0.0'},
{ver: '10', min: '10.0.0'},
{ver: '11', min: '11.0.0'},
{ver: '12', min: '12.0.0'}
]
var knownBroken = '<4.7.0'
var checkVersion = exports.checkVersion = function (version) {
var versionNoPrerelease = version.replace(/-.*$/, '')
return {
version: versionNoPrerelease,
broken: semver.satisfies(versionNoPrerelease, knownBroken),
unsupported: !semver.satisfies(versionNoPrerelease, supportedNode.map(function (n) { return '^' + n.min }).join('||'))
}
}
exports.checkForBrokenNode = function () {
var nodejs = checkVersion(process.version)
if (nodejs.broken) {
console.error('ERROR: npm is known not to run on Node.js ' + process.version)
supportedNode.forEach(function (rel) {
if (semver.satisfies(nodejs.version, rel.ver)) {
console.error('Node.js ' + rel.ver + " is supported but the specific version you're running has")
console.error('a bug known to break npm. Please update to at least ' + rel.min + ' to use this')
console.error('version of npm. You can find the latest release of Node.js at https://nodejs.org/')
process.exit(1)
}
})
var supportedMajors = supportedNode.map(function (n) { return n.ver }).join(', ')
console.error("You'll need to upgrade to a newer version in order to use this")
console.error('version of npm. Supported versions are ' + supportedMajors + '. You can find the')
console.error('latest version at https://nodejs.org/')
process.exit(1)
}
}
exports.checkForUnsupportedNode = function () {
var nodejs = checkVersion(process.version)
if (nodejs.unsupported) {
var log = require('npmlog')
var supportedMajors = supportedNode.map(function (n) { return n.ver }).join(', ')
log.warn('npm', 'npm does not support Node.js ' + process.version)
log.warn('npm', 'You should probably upgrade to a newer version of node as we')
log.warn('npm', "can't make any promises that npm will work with this version.")
log.warn('npm', 'Supported releases of Node.js are the latest release of ' + supportedMajors + '.')
log.warn('npm', 'You can find the latest version at https://nodejs.org/')
}
}

27
website/node_modules/npm/lib/utils/usage.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
'use strict'
var aliases = require('../config/cmd-list').aliases
module.exports = function usage (cmd, txt, opt) {
var post = Object.keys(aliases).reduce(function (p, c) {
var val = aliases[c]
if (val !== cmd) return p
return p.concat(c)
}, [])
if (opt || post.length > 0) txt += '\n\n'
if (post.length === 1) {
txt += 'alias: '
txt += post.join(', ')
} else if (post.length > 1) {
txt += 'aliases: '
txt += post.join(', ')
}
if (opt) {
if (post.length > 0) txt += '\n'
txt += 'common options: ' + opt
}
return txt
}

23
website/node_modules/npm/lib/utils/warn-deprecated.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
module.exports = warnDeprecated
var log = require('npmlog')
var deprecations = {}
function warnDeprecated (type) {
return function warn (messages, instance) {
if (!instance) {
if (!deprecations[type]) {
deprecations[type] = {}
messages.forEach(function (m) { log.warn(type, m) })
}
} else {
if (!deprecations[type]) deprecations[type] = {}
if (!deprecations[type][instance]) {
deprecations[type][instance] = true
messages.forEach(function (m) { log.warn(type, m) })
}
}
}
}