Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/smanonr..../lib/node_mod.../npm/lib
File: npm.js
;(function () {
[0] Fix | Delete
// windows: running 'npm blah' in this folder will invoke WSH, not node.
[1] Fix | Delete
/* globals WScript */
[2] Fix | Delete
if (typeof WScript !== 'undefined') {
[3] Fix | Delete
WScript.echo(
[4] Fix | Delete
'npm does not work when run\n' +
[5] Fix | Delete
'with the Windows Scripting Host\n\n' +
[6] Fix | Delete
'"cd" to a different directory,\n' +
[7] Fix | Delete
'or type "npm.cmd <args>",\n' +
[8] Fix | Delete
'or type "node npm <args>".'
[9] Fix | Delete
)
[10] Fix | Delete
WScript.quit(1)
[11] Fix | Delete
return
[12] Fix | Delete
}
[13] Fix | Delete
[14] Fix | Delete
var unsupported = require('../lib/utils/unsupported.js')
[15] Fix | Delete
unsupported.checkForBrokenNode()
[16] Fix | Delete
[17] Fix | Delete
var gfs = require('graceful-fs')
[18] Fix | Delete
// Patch the global fs module here at the app level
[19] Fix | Delete
var fs = gfs.gracefulify(require('fs'))
[20] Fix | Delete
[21] Fix | Delete
var EventEmitter = require('events').EventEmitter
[22] Fix | Delete
var npm = module.exports = new EventEmitter()
[23] Fix | Delete
var npmconf = require('./config/core.js')
[24] Fix | Delete
var log = require('npmlog')
[25] Fix | Delete
var inspect = require('util').inspect
[26] Fix | Delete
[27] Fix | Delete
// capture global logging
[28] Fix | Delete
process.on('log', function (level) {
[29] Fix | Delete
try {
[30] Fix | Delete
return log[level].apply(log, [].slice.call(arguments, 1))
[31] Fix | Delete
} catch (ex) {
[32] Fix | Delete
log.verbose('attempt to log ' + inspect(arguments) + ' crashed: ' + ex.message)
[33] Fix | Delete
}
[34] Fix | Delete
})
[35] Fix | Delete
[36] Fix | Delete
var path = require('path')
[37] Fix | Delete
var abbrev = require('abbrev')
[38] Fix | Delete
var which = require('which')
[39] Fix | Delete
var glob = require('glob')
[40] Fix | Delete
var rimraf = require('rimraf')
[41] Fix | Delete
var parseJSON = require('./utils/parse-json.js')
[42] Fix | Delete
var aliases = require('./config/cmd-list').aliases
[43] Fix | Delete
var cmdList = require('./config/cmd-list').cmdList
[44] Fix | Delete
var plumbing = require('./config/cmd-list').plumbing
[45] Fix | Delete
var output = require('./utils/output.js')
[46] Fix | Delete
var startMetrics = require('./utils/metrics.js').start
[47] Fix | Delete
var perf = require('./utils/perf.js')
[48] Fix | Delete
[49] Fix | Delete
perf.emit('time', 'npm')
[50] Fix | Delete
perf.on('timing', function (name, finished) {
[51] Fix | Delete
log.timing(name, 'Completed in', finished + 'ms')
[52] Fix | Delete
})
[53] Fix | Delete
[54] Fix | Delete
npm.config = {
[55] Fix | Delete
loaded: false,
[56] Fix | Delete
get: function () {
[57] Fix | Delete
throw new Error('npm.load() required')
[58] Fix | Delete
},
[59] Fix | Delete
set: function () {
[60] Fix | Delete
throw new Error('npm.load() required')
[61] Fix | Delete
}
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
npm.commands = {}
[65] Fix | Delete
[66] Fix | Delete
// TUNING
[67] Fix | Delete
npm.limit = {
[68] Fix | Delete
fetch: 10,
[69] Fix | Delete
action: 50
[70] Fix | Delete
}
[71] Fix | Delete
// ***
[72] Fix | Delete
[73] Fix | Delete
npm.lockfileVersion = 1
[74] Fix | Delete
[75] Fix | Delete
npm.rollbacks = []
[76] Fix | Delete
[77] Fix | Delete
try {
[78] Fix | Delete
// startup, ok to do this synchronously
[79] Fix | Delete
var j = parseJSON(fs.readFileSync(
[80] Fix | Delete
path.join(__dirname, '../package.json')) + '')
[81] Fix | Delete
npm.name = j.name
[82] Fix | Delete
npm.version = j.version
[83] Fix | Delete
} catch (ex) {
[84] Fix | Delete
try {
[85] Fix | Delete
log.info('error reading version', ex)
[86] Fix | Delete
} catch (er) {}
[87] Fix | Delete
npm.version = ex
[88] Fix | Delete
}
[89] Fix | Delete
[90] Fix | Delete
var commandCache = {}
[91] Fix | Delete
var aliasNames = Object.keys(aliases)
[92] Fix | Delete
[93] Fix | Delete
var littleGuys = [ 'isntall', 'verison' ]
[94] Fix | Delete
var fullList = cmdList.concat(aliasNames).filter(function (c) {
[95] Fix | Delete
return plumbing.indexOf(c) === -1
[96] Fix | Delete
})
[97] Fix | Delete
var abbrevs = abbrev(fullList)
[98] Fix | Delete
[99] Fix | Delete
// we have our reasons
[100] Fix | Delete
fullList = npm.fullList = fullList.filter(function (c) {
[101] Fix | Delete
return littleGuys.indexOf(c) === -1
[102] Fix | Delete
})
[103] Fix | Delete
[104] Fix | Delete
var registryRefer
[105] Fix | Delete
[106] Fix | Delete
Object.keys(abbrevs).concat(plumbing).forEach(function addCommand (c) {
[107] Fix | Delete
Object.defineProperty(npm.commands, c, { get: function () {
[108] Fix | Delete
if (!loaded) {
[109] Fix | Delete
throw new Error(
[110] Fix | Delete
'Call npm.load(config, cb) before using this command.\n' +
[111] Fix | Delete
'See the README.md or bin/npm-cli.js for example usage.'
[112] Fix | Delete
)
[113] Fix | Delete
}
[114] Fix | Delete
var a = npm.deref(c)
[115] Fix | Delete
if (c === 'la' || c === 'll') {
[116] Fix | Delete
npm.config.set('long', true)
[117] Fix | Delete
}
[118] Fix | Delete
[119] Fix | Delete
npm.command = c
[120] Fix | Delete
if (commandCache[a]) return commandCache[a]
[121] Fix | Delete
[122] Fix | Delete
var cmd = require(path.join(__dirname, a + '.js'))
[123] Fix | Delete
[124] Fix | Delete
commandCache[a] = function () {
[125] Fix | Delete
var args = Array.prototype.slice.call(arguments, 0)
[126] Fix | Delete
if (typeof args[args.length - 1] !== 'function') {
[127] Fix | Delete
args.push(defaultCb)
[128] Fix | Delete
}
[129] Fix | Delete
if (args.length === 1) args.unshift([])
[130] Fix | Delete
[131] Fix | Delete
// Options are prefixed by a hyphen-minus (-, \u2d).
[132] Fix | Delete
// Other dash-type chars look similar but are invalid.
[133] Fix | Delete
Array(args[0]).forEach(function (arg) {
[134] Fix | Delete
if (/^[\u2010-\u2015\u2212\uFE58\uFE63\uFF0D]/.test(arg)) {
[135] Fix | Delete
log.error('arg', 'Argument starts with non-ascii dash, this is probably invalid:', arg)
[136] Fix | Delete
}
[137] Fix | Delete
})
[138] Fix | Delete
[139] Fix | Delete
if (!registryRefer) {
[140] Fix | Delete
registryRefer = [a].concat(args[0]).map(function (arg) {
[141] Fix | Delete
// exclude anything that might be a URL, path, or private module
[142] Fix | Delete
// Those things will always have a slash in them somewhere
[143] Fix | Delete
if (arg && arg.match && arg.match(/\/|\\/)) {
[144] Fix | Delete
return '[REDACTED]'
[145] Fix | Delete
} else {
[146] Fix | Delete
return arg
[147] Fix | Delete
}
[148] Fix | Delete
}).filter(function (arg) {
[149] Fix | Delete
return arg && arg.match
[150] Fix | Delete
}).join(' ')
[151] Fix | Delete
npm.referer = registryRefer
[152] Fix | Delete
}
[153] Fix | Delete
[154] Fix | Delete
cmd.apply(npm, args)
[155] Fix | Delete
}
[156] Fix | Delete
[157] Fix | Delete
Object.keys(cmd).forEach(function (k) {
[158] Fix | Delete
commandCache[a][k] = cmd[k]
[159] Fix | Delete
})
[160] Fix | Delete
[161] Fix | Delete
return commandCache[a]
[162] Fix | Delete
},
[163] Fix | Delete
enumerable: fullList.indexOf(c) !== -1,
[164] Fix | Delete
configurable: true })
[165] Fix | Delete
[166] Fix | Delete
// make css-case commands callable via camelCase as well
[167] Fix | Delete
if (c.match(/-([a-z])/)) {
[168] Fix | Delete
addCommand(c.replace(/-([a-z])/g, function (a, b) {
[169] Fix | Delete
return b.toUpperCase()
[170] Fix | Delete
}))
[171] Fix | Delete
}
[172] Fix | Delete
})
[173] Fix | Delete
[174] Fix | Delete
function defaultCb (er, data) {
[175] Fix | Delete
log.disableProgress()
[176] Fix | Delete
if (er) console.error(er.stack || er.message)
[177] Fix | Delete
else output(data)
[178] Fix | Delete
}
[179] Fix | Delete
[180] Fix | Delete
npm.deref = function (c) {
[181] Fix | Delete
if (!c) return ''
[182] Fix | Delete
if (c.match(/[A-Z]/)) {
[183] Fix | Delete
c = c.replace(/([A-Z])/g, function (m) {
[184] Fix | Delete
return '-' + m.toLowerCase()
[185] Fix | Delete
})
[186] Fix | Delete
}
[187] Fix | Delete
if (plumbing.indexOf(c) !== -1) return c
[188] Fix | Delete
var a = abbrevs[c]
[189] Fix | Delete
while (aliases[a]) {
[190] Fix | Delete
a = aliases[a]
[191] Fix | Delete
}
[192] Fix | Delete
return a
[193] Fix | Delete
}
[194] Fix | Delete
[195] Fix | Delete
var loaded = false
[196] Fix | Delete
var loading = false
[197] Fix | Delete
var loadErr = null
[198] Fix | Delete
var loadListeners = []
[199] Fix | Delete
[200] Fix | Delete
function loadCb (er) {
[201] Fix | Delete
loadListeners.forEach(function (cb) {
[202] Fix | Delete
process.nextTick(cb.bind(npm, er, npm))
[203] Fix | Delete
})
[204] Fix | Delete
loadListeners.length = 0
[205] Fix | Delete
}
[206] Fix | Delete
[207] Fix | Delete
npm.load = function (cli, cb_) {
[208] Fix | Delete
if (!cb_ && typeof cli === 'function') {
[209] Fix | Delete
cb_ = cli
[210] Fix | Delete
cli = {}
[211] Fix | Delete
}
[212] Fix | Delete
if (!cb_) cb_ = function () {}
[213] Fix | Delete
if (!cli) cli = {}
[214] Fix | Delete
loadListeners.push(cb_)
[215] Fix | Delete
if (loaded || loadErr) return cb(loadErr)
[216] Fix | Delete
if (loading) return
[217] Fix | Delete
loading = true
[218] Fix | Delete
var onload = true
[219] Fix | Delete
[220] Fix | Delete
function cb (er) {
[221] Fix | Delete
if (loadErr) return
[222] Fix | Delete
loadErr = er
[223] Fix | Delete
if (er) return cb_(er)
[224] Fix | Delete
if (npm.config.get('force')) {
[225] Fix | Delete
log.warn('using --force', 'I sure hope you know what you are doing.')
[226] Fix | Delete
}
[227] Fix | Delete
npm.config.loaded = true
[228] Fix | Delete
loaded = true
[229] Fix | Delete
loadCb(loadErr = er)
[230] Fix | Delete
onload = onload && npm.config.get('onload-script')
[231] Fix | Delete
if (onload) {
[232] Fix | Delete
try {
[233] Fix | Delete
require(onload)
[234] Fix | Delete
} catch (err) {
[235] Fix | Delete
log.warn('onload-script', 'failed to require onload script', onload)
[236] Fix | Delete
log.warn('onload-script', err)
[237] Fix | Delete
}
[238] Fix | Delete
onload = false
[239] Fix | Delete
}
[240] Fix | Delete
}
[241] Fix | Delete
[242] Fix | Delete
log.pause()
[243] Fix | Delete
[244] Fix | Delete
load(npm, cli, cb)
[245] Fix | Delete
}
[246] Fix | Delete
[247] Fix | Delete
function load (npm, cli, cb) {
[248] Fix | Delete
which(process.argv[0], function (er, node) {
[249] Fix | Delete
if (!er && node.toUpperCase() !== process.execPath.toUpperCase()) {
[250] Fix | Delete
log.verbose('node symlink', node)
[251] Fix | Delete
process.execPath = node
[252] Fix | Delete
process.installPrefix = path.resolve(node, '..', '..')
[253] Fix | Delete
}
[254] Fix | Delete
[255] Fix | Delete
// look up configs
[256] Fix | Delete
var builtin = path.resolve(__dirname, '..', 'npmrc')
[257] Fix | Delete
npmconf.load(cli, builtin, function (er, config) {
[258] Fix | Delete
if (er === config) er = null
[259] Fix | Delete
[260] Fix | Delete
npm.config = config
[261] Fix | Delete
if (er) return cb(er)
[262] Fix | Delete
[263] Fix | Delete
// if the 'project' config is not a filename, and we're
[264] Fix | Delete
// not in global mode, then that means that it collided
[265] Fix | Delete
// with either the default or effective userland config
[266] Fix | Delete
if (!config.get('global') &&
[267] Fix | Delete
config.sources.project &&
[268] Fix | Delete
config.sources.project.type !== 'ini') {
[269] Fix | Delete
log.verbose(
[270] Fix | Delete
'config',
[271] Fix | Delete
'Skipping project config: %s. (matches userconfig)',
[272] Fix | Delete
config.localPrefix + '/.npmrc'
[273] Fix | Delete
)
[274] Fix | Delete
}
[275] Fix | Delete
[276] Fix | Delete
// Include npm-version and node-version in user-agent
[277] Fix | Delete
var ua = config.get('user-agent') || ''
[278] Fix | Delete
ua = ua.replace(/\{node-version\}/gi, process.version)
[279] Fix | Delete
ua = ua.replace(/\{npm-version\}/gi, npm.version)
[280] Fix | Delete
ua = ua.replace(/\{platform\}/gi, process.platform)
[281] Fix | Delete
ua = ua.replace(/\{arch\}/gi, process.arch)
[282] Fix | Delete
[283] Fix | Delete
// continuous integration platforms
[284] Fix | Delete
const ciName = process.env.GERRIT_PROJECT ? 'gerrit'
[285] Fix | Delete
: process.env.GITLAB_CI ? 'gitlab'
[286] Fix | Delete
: process.env.APPVEYOR ? 'appveyor'
[287] Fix | Delete
: process.env.CIRCLECI ? 'circle-ci'
[288] Fix | Delete
: process.env.SEMAPHORE ? 'semaphore'
[289] Fix | Delete
: process.env.DRONE ? 'drone'
[290] Fix | Delete
: process.env.GITHUB_ACTION ? 'github-actions'
[291] Fix | Delete
: process.env.TDDIUM ? 'tddium'
[292] Fix | Delete
: process.env.JENKINS_URL ? 'jenkins'
[293] Fix | Delete
: process.env['bamboo.buildKey'] ? 'bamboo'
[294] Fix | Delete
: process.env.GO_PIPELINE_NAME ? 'gocd'
[295] Fix | Delete
// codeship and a few others
[296] Fix | Delete
: process.env.CI_NAME ? process.env.CI_NAME
[297] Fix | Delete
// test travis after the others, since several CI systems mimic it
[298] Fix | Delete
: process.env.TRAVIS ? 'travis-ci'
[299] Fix | Delete
// aws CodeBuild/CodePipeline
[300] Fix | Delete
: process.env.CODEBUILD_SRC_DIR ? 'aws-codebuild'
[301] Fix | Delete
: process.env.CI === 'true' || process.env.CI === '1' ? 'custom'
[302] Fix | Delete
// Google Cloud Build - it sets almost nothing
[303] Fix | Delete
: process.env.BUILDER_OUTPUT ? 'builder'
[304] Fix | Delete
: false
[305] Fix | Delete
const ci = ciName ? `ci/${ciName}` : ''
[306] Fix | Delete
ua = ua.replace(/\{ci\}/gi, ci)
[307] Fix | Delete
[308] Fix | Delete
config.set('user-agent', ua.trim())
[309] Fix | Delete
[310] Fix | Delete
if (config.get('metrics-registry') == null) {
[311] Fix | Delete
config.set('metrics-registry', config.get('registry'))
[312] Fix | Delete
}
[313] Fix | Delete
[314] Fix | Delete
var color = config.get('color')
[315] Fix | Delete
[316] Fix | Delete
if (npm.config.get('timing') && npm.config.get('loglevel') === 'notice') {
[317] Fix | Delete
log.level = 'timing'
[318] Fix | Delete
} else {
[319] Fix | Delete
log.level = config.get('loglevel')
[320] Fix | Delete
}
[321] Fix | Delete
log.heading = config.get('heading') || 'npm'
[322] Fix | Delete
log.stream = config.get('logstream')
[323] Fix | Delete
[324] Fix | Delete
switch (color) {
[325] Fix | Delete
case 'always':
[326] Fix | Delete
npm.color = true
[327] Fix | Delete
break
[328] Fix | Delete
case false:
[329] Fix | Delete
npm.color = false
[330] Fix | Delete
break
[331] Fix | Delete
default:
[332] Fix | Delete
npm.color = process.stdout.isTTY && process.env['TERM'] !== 'dumb'
[333] Fix | Delete
break
[334] Fix | Delete
}
[335] Fix | Delete
if (npm.color) {
[336] Fix | Delete
log.enableColor()
[337] Fix | Delete
} else {
[338] Fix | Delete
log.disableColor()
[339] Fix | Delete
}
[340] Fix | Delete
[341] Fix | Delete
if (config.get('unicode')) {
[342] Fix | Delete
log.enableUnicode()
[343] Fix | Delete
} else {
[344] Fix | Delete
log.disableUnicode()
[345] Fix | Delete
}
[346] Fix | Delete
[347] Fix | Delete
if (config.get('progress') && process.stderr.isTTY && process.env['TERM'] !== 'dumb') {
[348] Fix | Delete
log.enableProgress()
[349] Fix | Delete
} else {
[350] Fix | Delete
log.disableProgress()
[351] Fix | Delete
}
[352] Fix | Delete
[353] Fix | Delete
glob(path.resolve(npm.cache, '_logs', '*-debug.log'), function (er, files) {
[354] Fix | Delete
if (er) return cb(er)
[355] Fix | Delete
[356] Fix | Delete
while (files.length >= npm.config.get('logs-max')) {
[357] Fix | Delete
rimraf.sync(files[0])
[358] Fix | Delete
files.splice(0, 1)
[359] Fix | Delete
}
[360] Fix | Delete
})
[361] Fix | Delete
[362] Fix | Delete
log.resume()
[363] Fix | Delete
[364] Fix | Delete
var umask = npm.config.get('umask')
[365] Fix | Delete
npm.modes = {
[366] Fix | Delete
exec: parseInt('0777', 8) & (~umask),
[367] Fix | Delete
file: parseInt('0666', 8) & (~umask),
[368] Fix | Delete
umask: umask
[369] Fix | Delete
}
[370] Fix | Delete
[371] Fix | Delete
var gp = Object.getOwnPropertyDescriptor(config, 'globalPrefix')
[372] Fix | Delete
Object.defineProperty(npm, 'globalPrefix', gp)
[373] Fix | Delete
[374] Fix | Delete
var lp = Object.getOwnPropertyDescriptor(config, 'localPrefix')
[375] Fix | Delete
Object.defineProperty(npm, 'localPrefix', lp)
[376] Fix | Delete
[377] Fix | Delete
config.set('scope', scopeifyScope(config.get('scope')))
[378] Fix | Delete
npm.projectScope = config.get('scope') ||
[379] Fix | Delete
scopeifyScope(getProjectScope(npm.prefix))
[380] Fix | Delete
[381] Fix | Delete
startMetrics()
[382] Fix | Delete
[383] Fix | Delete
return cb(null, npm)
[384] Fix | Delete
})
[385] Fix | Delete
})
[386] Fix | Delete
}
[387] Fix | Delete
[388] Fix | Delete
Object.defineProperty(npm, 'prefix',
[389] Fix | Delete
{
[390] Fix | Delete
get: function () {
[391] Fix | Delete
return npm.config.get('global') ? npm.globalPrefix : npm.localPrefix
[392] Fix | Delete
},
[393] Fix | Delete
set: function (r) {
[394] Fix | Delete
var k = npm.config.get('global') ? 'globalPrefix' : 'localPrefix'
[395] Fix | Delete
npm[k] = r
[396] Fix | Delete
return r
[397] Fix | Delete
},
[398] Fix | Delete
enumerable: true
[399] Fix | Delete
})
[400] Fix | Delete
[401] Fix | Delete
Object.defineProperty(npm, 'bin',
[402] Fix | Delete
{
[403] Fix | Delete
get: function () {
[404] Fix | Delete
if (npm.config.get('global')) return npm.globalBin
[405] Fix | Delete
return path.resolve(npm.root, '.bin')
[406] Fix | Delete
},
[407] Fix | Delete
enumerable: true
[408] Fix | Delete
})
[409] Fix | Delete
[410] Fix | Delete
Object.defineProperty(npm, 'globalBin',
[411] Fix | Delete
{
[412] Fix | Delete
get: function () {
[413] Fix | Delete
var b = npm.globalPrefix
[414] Fix | Delete
if (process.platform !== 'win32') b = path.resolve(b, 'bin')
[415] Fix | Delete
return b
[416] Fix | Delete
}
[417] Fix | Delete
})
[418] Fix | Delete
[419] Fix | Delete
Object.defineProperty(npm, 'dir',
[420] Fix | Delete
{
[421] Fix | Delete
get: function () {
[422] Fix | Delete
if (npm.config.get('global')) return npm.globalDir
[423] Fix | Delete
return path.resolve(npm.prefix, 'node_modules')
[424] Fix | Delete
},
[425] Fix | Delete
enumerable: true
[426] Fix | Delete
})
[427] Fix | Delete
[428] Fix | Delete
Object.defineProperty(npm, 'globalDir',
[429] Fix | Delete
{
[430] Fix | Delete
get: function () {
[431] Fix | Delete
return (process.platform !== 'win32')
[432] Fix | Delete
? path.resolve(npm.globalPrefix, 'lib', 'node_modules')
[433] Fix | Delete
: path.resolve(npm.globalPrefix, 'node_modules')
[434] Fix | Delete
},
[435] Fix | Delete
enumerable: true
[436] Fix | Delete
})
[437] Fix | Delete
[438] Fix | Delete
Object.defineProperty(npm, 'root',
[439] Fix | Delete
{ get: function () { return npm.dir } })
[440] Fix | Delete
[441] Fix | Delete
Object.defineProperty(npm, 'cache',
[442] Fix | Delete
{ get: function () { return npm.config.get('cache') },
[443] Fix | Delete
set: function (r) { return npm.config.set('cache', r) },
[444] Fix | Delete
enumerable: true
[445] Fix | Delete
})
[446] Fix | Delete
[447] Fix | Delete
var tmpFolder
[448] Fix | Delete
var rand = require('crypto').randomBytes(4).toString('hex')
[449] Fix | Delete
Object.defineProperty(npm, 'tmp',
[450] Fix | Delete
{
[451] Fix | Delete
get: function () {
[452] Fix | Delete
if (!tmpFolder) tmpFolder = 'npm-' + process.pid + '-' + rand
[453] Fix | Delete
return path.resolve(npm.config.get('tmp'), tmpFolder)
[454] Fix | Delete
},
[455] Fix | Delete
enumerable: true
[456] Fix | Delete
})
[457] Fix | Delete
[458] Fix | Delete
// the better to repl you with
[459] Fix | Delete
Object.getOwnPropertyNames(npm.commands).forEach(function (n) {
[460] Fix | Delete
if (npm.hasOwnProperty(n) || n === 'config') return
[461] Fix | Delete
[462] Fix | Delete
Object.defineProperty(npm, n, { get: function () {
[463] Fix | Delete
return function () {
[464] Fix | Delete
var args = Array.prototype.slice.call(arguments, 0)
[465] Fix | Delete
var cb = defaultCb
[466] Fix | Delete
[467] Fix | Delete
if (args.length === 1 && Array.isArray(args[0])) {
[468] Fix | Delete
args = args[0]
[469] Fix | Delete
}
[470] Fix | Delete
[471] Fix | Delete
if (typeof args[args.length - 1] === 'function') {
[472] Fix | Delete
cb = args.pop()
[473] Fix | Delete
}
[474] Fix | Delete
npm.commands[n](args, cb)
[475] Fix | Delete
}
[476] Fix | Delete
},
[477] Fix | Delete
enumerable: false,
[478] Fix | Delete
configurable: true })
[479] Fix | Delete
})
[480] Fix | Delete
[481] Fix | Delete
if (require.main === module) {
[482] Fix | Delete
require('../bin/npm-cli.js')
[483] Fix | Delete
}
[484] Fix | Delete
[485] Fix | Delete
function scopeifyScope (scope) {
[486] Fix | Delete
return (!scope || scope[0] === '@') ? scope : ('@' + scope)
[487] Fix | Delete
}
[488] Fix | Delete
[489] Fix | Delete
function getProjectScope (prefix) {
[490] Fix | Delete
try {
[491] Fix | Delete
var pkg = JSON.parse(fs.readFileSync(path.join(prefix, 'package.json')))
[492] Fix | Delete
if (typeof pkg.name !== 'string') return ''
[493] Fix | Delete
var sep = pkg.name.indexOf('/')
[494] Fix | Delete
if (sep === -1) return ''
[495] Fix | Delete
return pkg.name.slice(0, sep)
[496] Fix | Delete
} catch (ex) {
[497] Fix | Delete
return ''
[498] Fix | Delete
}
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function