diff options
Diffstat (limited to 'deps/npm/node_modules')
165 files changed, 2261 insertions, 2448 deletions
diff --git a/deps/npm/node_modules/@npmcli/arborist/README.md b/deps/npm/node_modules/@npmcli/arborist/README.md index 8722b7a43c..ee79a3bf2f 100644 --- a/deps/npm/node_modules/@npmcli/arborist/README.md +++ b/deps/npm/node_modules/@npmcli/arborist/README.md @@ -333,3 +333,13 @@ pruning nodes from the tree. Note: `devOptional` is only set in the shrinkwrap/package-lock file if _neither_ `dev` nor `optional` are set, as it would be redundant. + +## BIN + +Arborist ships with a cli that can be used to run arborist specific commands outside of the context of the npm CLI. This script is currently not part of the public API and is subject to breaking changes outside of major version bumps. + +To see the usage run: + +``` +npx @npmcli/arborist --help +``` diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/actual.js b/deps/npm/node_modules/@npmcli/arborist/bin/actual.js index eb0495997a..866b2cd82f 100644 --- a/deps/npm/node_modules/@npmcli/arborist/bin/actual.js +++ b/deps/npm/node_modules/@npmcli/arborist/bin/actual.js @@ -1,23 +1,19 @@ const Arborist = require('../') -const print = require('./lib/print-tree.js') -const options = require('./lib/options.js') -require('./lib/logging.js') -require('./lib/timers.js') -const start = process.hrtime() -new Arborist(options).loadActual(options).then(tree => { - const end = process.hrtime(start) - if (!process.argv.includes('--quiet')) { - print(tree) - } +const printTree = require('./lib/print-tree.js') - console.error(`read ${tree.inventory.size} deps in ${end[0] * 1000 + end[1] / 1e6}ms`) - if (options.save) { - tree.meta.save() - } - if (options.saveHidden) { - tree.meta.hiddenLockfile = true - tree.meta.filename = options.path + '/node_modules/.package-lock.json' - tree.meta.save() - } -}).catch(er => console.error(er)) +module.exports = (options, time) => new Arborist(options) + .loadActual(options) + .then(time) + .then(async ({ timing, result: tree }) => { + printTree(tree) + if (options.save) { + await tree.meta.save() + } + if (options.saveHidden) { + tree.meta.hiddenLockfile = true + tree.meta.filename = options.path + '/node_modules/.package-lock.json' + await tree.meta.save() + } + return `read ${tree.inventory.size} deps in ${timing.ms}` + }) diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/audit.js b/deps/npm/node_modules/@npmcli/arborist/bin/audit.js index d9ac532d3e..0e32833d4a 100644 --- a/deps/npm/node_modules/@npmcli/arborist/bin/audit.js +++ b/deps/npm/node_modules/@npmcli/arborist/bin/audit.js @@ -1,19 +1,17 @@ const Arborist = require('../') -const print = require('./lib/print-tree.js') -const options = require('./lib/options.js') -require('./lib/timers.js') -require('./lib/logging.js') +const printTree = require('./lib/print-tree.js') +const log = require('./lib/logging.js') const Vuln = require('../lib/vuln.js') const printReport = report => { for (const vuln of report.values()) { - console.log(printVuln(vuln)) + log.info(printVuln(vuln)) } if (report.topVulns.size) { - console.log('\n# top-level vulnerabilities') + log.info('\n# top-level vulnerabilities') for (const vuln of report.topVulns.values()) { - console.log(printVuln(vuln)) + log.info(printVuln(vuln)) } } } @@ -33,22 +31,21 @@ const printVuln = vuln => { const printAdvisory = a => `${a.title}${a.url ? ' ' + a.url : ''}` -const start = process.hrtime() -process.emit('time', 'audit script') -const arb = new Arborist(options) -arb.audit(options).then(tree => { - process.emit('timeEnd', 'audit script') - const end = process.hrtime(start) - if (options.fix) { - print(tree) - } - if (!options.quiet) { - printReport(arb.auditReport) - } - if (options.fix) { - console.error(`resolved ${tree.inventory.size} deps in ${end[0] + end[1] / 1e9}s`) - } - if (tree.meta && options.save) { - tree.meta.save() - } -}).catch(er => console.error(er)) +module.exports = (options, time) => { + const arb = new Arborist(options) + return arb + .audit(options) + .then(time) + .then(async ({ timing, result: tree }) => { + if (options.fix) { + printTree(tree) + } + printReport(arb.auditReport) + if (tree.meta && options.save) { + await tree.meta.save() + } + return options.fix + ? `resolved ${tree.inventory.size} deps in ${timing.seconds}` + : `done in ${timing.seconds}` + }) +} diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/funding.js b/deps/npm/node_modules/@npmcli/arborist/bin/funding.js index d0f4f31654..cf25976d94 100644 --- a/deps/npm/node_modules/@npmcli/arborist/bin/funding.js +++ b/deps/npm/node_modules/@npmcli/arborist/bin/funding.js @@ -1,34 +1,38 @@ -const options = require('./lib/options.js') -require('./lib/logging.js') -require('./lib/timers.js') - const Arborist = require('../') -const a = new Arborist(options) -const query = options._.shift() -const start = process.hrtime() -a.loadVirtual().then(tree => { - // only load the actual tree if the virtual one doesn't have modern metadata - if (!tree.meta || !(tree.meta.originalLockfileVersion >= 2)) { - console.error('old metadata, load actual') - throw 'load actual' - } else { - console.error('meta ok, return virtual tree') - return tree - } -}).catch(() => a.loadActual()).then(tree => { - const end = process.hrtime(start) - if (!query) { - for (const node of tree.inventory.values()) { - if (node.package.funding) { - console.log(node.name, node.location, node.package.funding) + +const log = require('./lib/logging.js') + +module.exports = (options, time) => { + const query = options._.shift() + const a = new Arborist(options) + return a + .loadVirtual() + .then(tree => { + // only load the actual tree if the virtual one doesn't have modern metadata + if (!tree.meta || !(tree.meta.originalLockfileVersion >= 2)) { + log.error('old metadata, load actual') + throw 'load actual' + } else { + log.error('meta ok, return virtual tree') + return tree } - } - } else { - for (const node of tree.inventory.query('name', query)) { - if (node.package.funding) { - console.log(node.name, node.location, node.package.funding) + }) + .catch(() => a.loadActual()) + .then(time) + .then(({ timing, result: tree }) => { + if (!query) { + for (const node of tree.inventory.values()) { + if (node.package.funding) { + log.info(node.name, node.location, node.package.funding) + } + } + } else { + for (const node of tree.inventory.query('name', query)) { + if (node.package.funding) { + log.info(node.name, node.location, node.package.funding) + } + } } - } - } - console.error(`read ${tree.inventory.size} deps in ${end[0] * 1000 + end[1] / 1e6}ms`) -}) + return `read ${tree.inventory.size} deps in ${timing.ms}` + }) +} diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/ideal.js b/deps/npm/node_modules/@npmcli/arborist/bin/ideal.js index 5d1ed0dcd9..1dd206e81f 100644 --- a/deps/npm/node_modules/@npmcli/arborist/bin/ideal.js +++ b/deps/npm/node_modules/@npmcli/arborist/bin/ideal.js @@ -1,21 +1,14 @@ const Arborist = require('../') -const { inspect } = require('util') -const options = require('./lib/options.js') -const print = require('./lib/print-tree.js') -require('./lib/logging.js') -require('./lib/timers.js') +const printTree = require('./lib/print-tree.js') -const start = process.hrtime() -new Arborist(options).buildIdealTree(options).then(tree => { - const end = process.hrtime(start) - print(tree) - console.error(`resolved ${tree.inventory.size} deps in ${end[0] + end[1] / 10e9}s`) - if (tree.meta && options.save) { - tree.meta.save() - } -}).catch(er => { - const opt = { depth: Infinity, color: true } - console.error(er.code === 'ERESOLVE' ? inspect(er, opt) : er) - process.exitCode = 1 -}) +module.exports = (options, time) => new Arborist(options) + .buildIdealTree(options) + .then(time) + .then(async ({ timing, result: tree }) => { + printTree(tree) + if (tree.meta && options.save) { + await tree.meta.save() + } + return `resolved ${tree.inventory.size} deps in ${timing.seconds}` + }) diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/index.js b/deps/npm/node_modules/@npmcli/arborist/bin/index.js index 5449a50e67..0c1e984453 100755 --- a/deps/npm/node_modules/@npmcli/arborist/bin/index.js +++ b/deps/npm/node_modules/@npmcli/arborist/bin/index.js @@ -1,81 +1,110 @@ #!/usr/bin/env node -const [cmd] = process.argv.splice(2, 1) -const usage = () => `Arborist - the npm tree doctor +const fs = require('fs') +const path = require('path') -Version: ${require('../package.json').version} +const { bin, arb: options } = require('./lib/options') +const version = require('../package.json').version +const usage = (message = '') => `Arborist - the npm tree doctor + +Version: ${version} +${message && '\n' + message + '\n'} # USAGE arborist <cmd> [path] [options...] # COMMANDS -* reify: reify ideal tree to node_modules (install, update, rm, ...) -* prune: prune the ideal tree and reify (like npm prune) -* ideal: generate and print the ideal tree -* actual: read and print the actual tree in node_modules -* virtual: read and print the virtual tree in the local shrinkwrap file -* shrinkwrap: load a local shrinkwrap and print its data -* audit: perform a security audit on project dependencies -* funding: query funding information in the local package tree. A second - positional argument after the path name can limit to a package name. -* license: query license information in the local package tree. A second - positional argument after the path name can limit to a license type. -* help: print this text + * reify: reify ideal tree to node_modules (install, update, rm, ...) + * prune: prune the ideal tree and reify (like npm prune) + * ideal: generate and print the ideal tree + * actual: read and print the actual tree in node_modules + * virtual: read and print the virtual tree in the local shrinkwrap file + * shrinkwrap: load a local shrinkwrap and print its data + * audit: perform a security audit on project dependencies + * funding: query funding information in the local package tree. A second + positional argument after the path name can limit to a package name. + * license: query license information in the local package tree. A second + positional argument after the path name can limit to a license type. + * help: print this text + * version: print the version # OPTIONS -Most npm options are supported, but in camelCase rather than css-case. For -example, instead of '--dry-run', use '--dryRun'. + Most npm options are supported, but in camelCase rather than css-case. For + example, instead of '--dry-run', use '--dryRun'. -Additionally: + Additionally: -* --quiet will supppress the printing of package trees -* Instead of 'npm install <pkg>', use 'arborist reify --add=<pkg>'. - The '--add=<pkg>' option can be specified multiple times. -* Instead of 'npm rm <pkg>', use 'arborist reify --rm=<pkg>'. - The '--rm=<pkg>' option can be specified multiple times. -* Instead of 'npm update', use 'arborist reify --update-all'. -* 'npm audit fix' is 'arborist audit --fix' + * --loglevel=warn|--quiet will supppress the printing of package trees + * --logfile <file|bool> will output logs to a file + * --timing will show timing information + * Instead of 'npm install <pkg>', use 'arborist reify --add=<pkg>'. + The '--add=<pkg>' option can be specified multiple times. + * Instead of 'npm rm <pkg>', use 'arborist reify --rm=<pkg>'. + The '--rm=<pkg>' option can be specified multiple times. + * Instead of 'npm update', use 'arborist reify --update-all'. + * 'npm audit fix' is 'arborist audit --fix' ` -const help = () => console.log(usage()) - -switch (cmd) { - case 'actual': - require('./actual.js') - break - case 'virtual': - require('./virtual.js') - break - case 'ideal': - require('./ideal.js') - break - case 'prune': - require('./prune.js') - break - case 'reify': - require('./reify.js') - break - case 'audit': - require('./audit.js') - break - case 'funding': - require('./funding.js') - break - case 'license': - require('./license.js') - break - case 'shrinkwrap': - require('./shrinkwrap.js') - break - case 'help': - case '-h': - case '--help': - help() - break - default: +const commands = { + version: () => console.log(version), + help: () => console.log(usage()), + exit: () => { process.exitCode = 1 - console.error(usage()) - break + console.error( + usage(`Error: command '${bin.command}' does not exist.`) + ) + }, +} + +const commandFiles = fs.readdirSync(__dirname).filter((f) => path.extname(f) === '.js' && f !== __filename) + +for (const file of commandFiles) { + const command = require(`./${file}`) + const name = path.basename(file, '.js') + const totalTime = `bin:${name}:init` + const scriptTime = `bin:${name}:script` + + commands[name] = () => { + const timers = require('./lib/timers') + const log = require('./lib/logging') + + log.info(name, options) + + process.emit('time', totalTime) + process.emit('time', scriptTime) + + return command(options, (result) => { + process.emit('timeEnd', scriptTime) + return { + result, + timing: { + seconds: `${timers.get(scriptTime) / 1e9}s`, + ms: `${timers.get(scriptTime) / 1e6}ms`, + }, + } + }) + .then((result) => { + log.info(result) + return result + }) + .catch((err) => { + process.exitCode = 1 + log.error(err) + return err + }) + .then((r) => { + process.emit('timeEnd', totalTime) + if (bin.loglevel !== 'silent') { + console[process.exitCode ? 'error' : 'log'](r) + } + }) + } +} + +if (commands[bin.command]) { + commands[bin.command]() +} else { + commands.exit() } diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/lib/logging.js b/deps/npm/node_modules/@npmcli/arborist/bin/lib/logging.js index 8183ece1fd..8b04d6370e 100644 --- a/deps/npm/node_modules/@npmcli/arborist/bin/lib/logging.js +++ b/deps/npm/node_modules/@npmcli/arborist/bin/lib/logging.js @@ -1,42 +1,78 @@ -const options = require('./options.js') -const { quiet = false } = options -const { loglevel = quiet ? 'warn' : 'silly' } = options +const log = require('proc-log') +const mkdirp = require('mkdirp') +const fs = require('fs') +const { dirname } = require('path') +const os = require('os') +const { inspect, format } = require('util') + +const { bin: options } = require('./options.js') -const levels = [ +// add a meta method to proc-log for passing optional +// metadata through to log handlers +const META = Symbol('meta') +const parseArgs = (...args) => { + const { [META]: isMeta } = args[args.length - 1] || {} + return isMeta + ? [args[args.length - 1], ...args.slice(0, args.length - 1)] + : [{}, ...args] +} +log.meta = (meta = {}) => ({ [META]: true, ...meta }) + +const levels = new Map([ 'silly', 'verbose', 'info', - 'timing', 'http', 'notice', 'warn', 'error', 'silent', -] +].map((level, index) => [level, index])) -const levelMap = new Map(levels.reduce((set, level, index) => { - set.push([level, index], [index, level]) - return set -}, [])) +const addLogListener = (write, { eol = os.EOL, loglevel = 'silly', colors = false } = {}) => { + const levelIndex = levels.get(loglevel) -const { inspect, format } = require('util') -const colors = process.stderr.isTTY -const magenta = colors ? msg => `\x1B[35m${msg}\x1B[39m` : m => m -if (loglevel !== 'silent') { - process.on('log', (level, ...args) => { - if (levelMap.get(level) < levelMap.get(loglevel)) { - return + const magenta = m => colors ? `\x1B[35m${m}\x1B[39m` : m + const dim = m => colors ? `\x1B[2m${m}\x1B[22m` : m + const red = m => colors ? `\x1B[31m${m}\x1B[39m` : m + + const formatter = (level, ...args) => { + const depth = level === 'error' && args[0] && args[0].code === 'ERESOLVE' ? Infinity : 10 + + if (level === 'info' && args[0] === 'timeEnd') { + args[1] = dim(args[1]) + } else if (level === 'error' && args[0] === 'timeError') { + args[1] = red(args[1]) } + + const messages = args.map(a => typeof a === 'string' ? a : inspect(a, { depth, colors })) const pref = `${process.pid} ${magenta(level)} ` - if (level === 'warn' && args[0] === 'ERESOLVE') { - args[2] = inspect(args[2], { depth: 10, colors }) - } else { - args = args.map(a => { - return typeof a === 'string' ? a - : inspect(a, { depth: 10, colors }) - }) + + return pref + format(...messages).trim().split('\n').join(`${eol}${pref}`) + eol + } + + process.on('log', (...args) => { + const [meta, level, ...logArgs] = parseArgs(...args) + + if (levelIndex <= levels.get(level) || meta.force) { + write(formatter(level, ...logArgs)) } - const msg = pref + format(...args).trim().split('\n').join(`\n${pref}`) - console.error(msg) }) } + +if (options.loglevel !== 'silent') { + addLogListener((v) => process.stderr.write(v), { + eol: '\n', + colors: options.colors, + loglevel: options.loglevel, + }) +} + +if (options.logfile) { + log.silly('logfile', options.logfile) + mkdirp.sync(dirname(options.logfile)) + const fd = fs.openSync(options.logfile, 'a') + addLogListener((str) => fs.writeSync(fd, str)) +} + +module.exports = log diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/lib/options.js b/deps/npm/node_modules/@npmcli/arborist/bin/lib/options.js index 23e89ddce6..8dbaf13dac 100644 --- a/deps/npm/node_modules/@npmcli/arborist/bin/lib/options.js +++ b/deps/npm/node_modules/@npmcli/arborist/bin/lib/options.js @@ -1,59 +1,123 @@ -const options = module.exports = { - path: undefined, - cache: `${process.env.HOME}/.npm/_cacache`, - _: [], +const nopt = require('nopt') +const path = require('path') + +const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k) + +const cleanPath = (val) => { + const k = Symbol('key') + const data = {} + nopt.typeDefs.path.validate(data, k, val) + return data[k] } -for (const arg of process.argv.slice(2)) { - if (/^--add=/.test(arg)) { - options.add = options.add || [] - options.add.push(arg.substr('--add='.length)) - } else if (/^--rm=/.test(arg)) { - options.rm = options.rm || [] - options.rm.push(arg.substr('--rm='.length)) - } else if (arg === '--global') { - options.global = true - } else if (arg === '--global-style') { - options.globalStyle = true - } else if (arg === '--prefer-dedupe') { - options.preferDedupe = true - } else if (arg === '--legacy-peer-deps') { - options.legacyPeerDeps = true - } else if (arg === '--force') { - options.force = true - } else if (arg === '--update-all') { - options.update = options.update || {} - options.update.all = true - } else if (/^--update=/.test(arg)) { - options.update = options.update || {} - options.update.names = options.update.names || [] - options.update.names.push(arg.substr('--update='.length)) - } else if (/^--omit=/.test(arg)) { - options.omit = options.omit || [] - options.omit.push(arg.substr('--omit='.length)) - } else if (/^--before=/.test(arg)) { - options.before = new Date(arg.substr('--before='.length)) - } else if (/^-w.+/.test(arg)) { - options.workspaces = options.workspaces || [] - options.workspaces.push(arg.replace(/^-w/, '')) - } else if (/^--workspace=/.test(arg)) { - options.workspaces = options.workspaces || [] - options.workspaces.push(arg.replace(/^--workspace=/, '')) - } else if (/^--[^=]+=/.test(arg)) { - const [key, ...v] = arg.replace(/^--/, '').split('=') - const val = v.join('=') - options[key] = val === 'false' ? false : val === 'true' ? true : val - } else if (/^--.+/.test(arg)) { - options[arg.replace(/^--/, '')] = true - } else if (options.path === undefined) { - options.path = arg - } else { - options._.push(arg) +const parse = (...noptArgs) => { + const binOnlyOpts = { + command: String, + loglevel: String, + colors: Boolean, + timing: ['always', Boolean], + logfile: String, + } + + const arbOpts = { + add: Array, + rm: Array, + omit: Array, + update: Array, + workspaces: Array, + global: Boolean, + force: Boolean, + 'global-style': Boolean, + 'prefer-dedupe': Boolean, + 'legacy-peer-deps': Boolean, + 'update-all': Boolean, + before: Date, + path: path, + cache: path, + ...binOnlyOpts, + } + + const short = { + quiet: ['--loglevel', 'warn'], + logs: ['--logfile', 'true'], + w: '--workspaces', + g: '--global', + f: '--force', + } + + const defaults = { + // key order is important for command and path + // since they shift positional args + // command is 1st, path is 2nd + command: (o) => o.argv.remain.shift(), + path: (o) => cleanPath(o.argv.remain.shift() || '.'), + colors: has(process.env, 'NO_COLOR') ? false : !!process.stderr.isTTY, + loglevel: 'silly', + timing: (o) => o.loglevel === 'silly', + cache: `${process.env.HOME}/.npm/_cacache`, + } + + const derived = [ + // making update either `all` or an array of names but not both + ({ updateAll: all, update: names, ...o }) => { + if (all || names) { + o.update = all != null ? { all } : { names } + } + return o + }, + ({ logfile, ...o }) => { + // logfile is parsed as a string so if its true or set but empty + // then set the default logfile + if (logfile === 'true' || logfile === '') { + logfile = `arb-log-${new Date().toISOString().replace(/[.:]/g, '_')}.log` + } + // then parse it the same as nopt parses other paths + if (logfile) { + o.logfile = cleanPath(logfile) + } + return o + }, + ] + + const transforms = [ + // Camelcase all top level keys + (o) => { + const entries = Object.entries(o).map(([k, v]) => [ + k.replace(/-./g, s => s[1].toUpperCase()), + v, + ]) + return Object.fromEntries(entries) + }, + // Set defaults on unset keys + (o) => { + for (const [k, v] of Object.entries(defaults)) { + if (!has(o, k)) { + o[k] = typeof v === 'function' ? v(o) : v + } + } + return o + }, + // Set/unset derived values + ...derived.map((derive) => (o) => derive(o) || o), + // Separate bin and arborist options + ({ argv: { remain: _ }, ...o }) => { + const bin = { _ } + for (const k of Object.keys(binOnlyOpts)) { + if (has(o, k)) { + bin[k] = o[k] + delete o[k] + } + } + return { bin, arb: o } + }, + ] + + let options = nopt(arbOpts, short, ...noptArgs) + for (const t of transforms) { + options = t(options) } -} -if (options.path === undefined) { - options.path = '.' + return options } -console.error(options) +module.exports = parse() diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/lib/print-tree.js b/deps/npm/node_modules/@npmcli/arborist/bin/lib/print-tree.js index 1ea2a72187..55398190b9 100644 --- a/deps/npm/node_modules/@npmcli/arborist/bin/lib/print-tree.js +++ b/deps/npm/node_modules/@npmcli/arborist/bin/lib/print-tree.js @@ -1,5 +1,4 @@ const { inspect } = require('util') -const { quiet } = require('./options.js') +const log = require('./logging.js') -module.exports = quiet ? () => {} - : tree => console.log(inspect(tree.toJSON(), { depth: Infinity })) +module.exports = tree => log.info(inspect(tree.toJSON(), { depth: Infinity })) diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/lib/timers.js b/deps/npm/node_modules/@npmcli/arborist/bin/lib/timers.js index 242431980e..586dee7806 100644 --- a/deps/npm/node_modules/@npmcli/arborist/bin/lib/timers.js +++ b/deps/npm/node_modules/@npmcli/arborist/bin/lib/timers.js @@ -1,31 +1,33 @@ -const timers = Object.create(null) -const { format } = require('util') -const options = require('./options.js') +const { bin: options } = require('./options.js') +const log = require('./logging.js') + +const timers = new Map() +const finished = new Map() process.on('time', name => { - if (timers[name]) { + if (timers.has(name)) { throw new Error('conflicting timer! ' + name) } - timers[name] = process.hrtime() + timers.set(name, process.hrtime.bigint()) }) -const dim = process.stderr.isTTY ? msg => `\x1B[2m${msg}\x1B[22m` : m => m -const red = process.stderr.isTTY ? msg => `\x1B[31m${msg}\x1B[39m` : m => m process.on('timeEnd', name => { - if (!timers[name]) { + if (!timers.has(name)) { throw new Error('timer not started! ' + name) } - const res = process.hrtime(timers[name]) - delete timers[name] - const msg = format(`${process.pid} ${name}`, res[0] * 1e3 + res[1] / 1e6) - if (options.timers !== false) { - console.error(dim(msg)) + const elapsed = Number(process.hrtime.bigint() - timers.get(name)) + timers.delete(name) + finished.set(name, elapsed) + if (options.timing) { + log.info('timeEnd', `${name} ${elapsed / 1e9}s`, log.meta({ force: options.timing === 'always' })) } }) process.on('exit', () => { - for (const name of Object.keys(timers)) { - console.error(red('Dangling timer:'), name) + for (const name of timers.keys()) { + log.error('timeError', 'Dangling timer:', name) process.exitCode = 1 } }) + +module.exports = finished diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/license.js b/deps/npm/node_modules/@npmcli/arborist/bin/license.js index 7fc08dd83e..77d5796793 100644 --- a/deps/npm/node_modules/@npmcli/arborist/bin/license.js +++ b/deps/npm/node_modules/@npmcli/arborist/bin/license.js @@ -1,38 +1,48 @@ +const localeCompare = require('@isaacs/string-locale-compare')('en') const Arborist = require('../') -const options = require('./lib/options.js') -require('./lib/logging.js') -require('./lib/timers.js') +const log = require('./lib/logging.js') -const a = new Arborist(options) -const query = options._.shift() +module.exports = (options, time) => { + const query = options._.shift() + const a = new Arborist(options) + return a + .loadVirtual() + .then(tree => { + // only load the actual tree if the virtual one doesn't have modern metadata + if (!tree.meta || !(tree.meta.originalLockfileVersion >= 2)) { + throw 'load actual' + } else { + return tree + } + }).catch((er) => { + log.error('loading actual tree', er) + return a.loadActual() + }) + .then(time) + .then(({ result: tree }) => { + const output = [] + if (!query) { + const set = [] + for (const license of tree.inventory.query('license')) { + set.push([tree.inventory.query('license', license).size, license]) + } -a.loadVirtual().then(tree => { - // only load the actual tree if the virtual one doesn't have modern metadata - if (!tree.meta || !(tree.meta.originalLockfileVersion >= 2)) { - throw 'load actual' - } else { - return tree - } -}).catch((er) => { - console.error('loading actual tree', er) - return a.loadActual() -}).then(tree => { - if (!query) { - const set = [] - for (const license of tree.inventory.query('license')) { - set.push([tree.inventory.query('license', license).size, license]) - } + for (const [count, license] of set.sort((a, b) => + a[1] && b[1] ? b[0] - a[0] || localeCompare(a[1], b[1]) + : a[1] ? -1 + : b[1] ? 1 + : 0)) { + output.push(`${count} ${license}`) + log.info(count, license) + } + } else { + for (const node of tree.inventory.query('license', query === 'undefined' ? undefined : query)) { + const msg = `${node.name} ${node.location} ${node.package.description || ''}` + output.push(msg) + log.info(msg) + } + } - for (const [count, license] of set.sort((a, b) => - a[1] && b[1] ? b[0] - a[0] || a[1].localeCompare(b[1], 'en') - : a[1] ? -1 - : b[1] ? 1 - : 0)) { - console.log(count, license) - } - } else { - for (const node of tree.inventory.query('license', query === 'undefined' ? undefined : query)) { - console.log(`${node.name} ${node.location} ${node.package.description || ''}`) - } - } -}) + return output.join('\n') + }) +} diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/prune.js b/deps/npm/node_modules/@npmcli/arborist/bin/prune.js index e11858c209..3c52bc13af 100644 --- a/deps/npm/node_modules/@npmcli/arborist/bin/prune.js +++ b/deps/npm/node_modules/@npmcli/arborist/bin/prune.js @@ -1,9 +1,7 @@ const Arborist = require('../') -const options = require('./lib/options.js') -const print = require('./lib/print-tree.js') -require('./lib/logging.js') -require('./lib/timers.js') +const printTree = require('./lib/print-tree.js') +const log = require('./lib/logging.js') const printDiff = diff => { const { depth } = require('treeverse') @@ -15,13 +13,13 @@ const printDiff = diff => { } switch (d.action) { case 'REMOVE': - console.error('REMOVE', d.actual.location) + log.info('REMOVE', d.actual.location) break case 'ADD': - console.error('ADD', d.ideal.location, d.ideal.resolved) + log.info('ADD', d.ideal.location, d.ideal.resolved) break case 'CHANGE': - console.error('CHANGE', d.actual.location, { + log.info('CHANGE', d.actual.location, { from: d.actual.resolved, to: d.ideal.resolved, }) @@ -32,18 +30,19 @@ const printDiff = diff => { }) } -const start = process.hrtime() -process.emit('time', 'install') -const arb = new Arborist(options) -arb.prune(options).then(tree => { - process.emit('timeEnd', 'install') - const end = process.hrtime(start) - print(tree) - if (options.dryRun) { - printDiff(arb.diff) - } - console.error(`resolved ${tree.inventory.size} deps in ${end[0] + end[1] / 1e9}s`) - if (tree.meta && options.save) { - tree.meta.save() - } -}).catch(er => console.error(require('util').inspect(er, { depth: Infinity }))) +module.exports = (options, time) => { + const arb = new Arborist(options) + return arb + .prune(options) + .then(time) + .then(async ({ timing, result: tree }) => { + printTree(tree) + if (options.dryRun) { + printDiff(arb.diff) + } + if (tree.meta && options.save) { + await tree.meta.save() + } + return `resolved ${tree.inventory.size} deps in ${timing.seconds}` + }) +} diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/reify.js b/deps/npm/node_modules/@npmcli/arborist/bin/reify.js index 9dc26d2b96..3f3aafe8ab 100644 --- a/deps/npm/node_modules/@npmcli/arborist/bin/reify.js +++ b/deps/npm/node_modules/@npmcli/arborist/bin/reify.js @@ -1,9 +1,7 @@ const Arborist = require('../') -const options = require('./lib/options.js') -const print = require('./lib/print-tree.js') -require('./lib/logging.js') -require('./lib/timers.js') +const printTree = require('./lib/print-tree.js') +const log = require('./lib/logging.js') const printDiff = diff => { const { depth } = require('treeverse') @@ -15,13 +13,13 @@ const printDiff = diff => { } switch (d.action) { case 'REMOVE': - console.error('REMOVE', d.actual.location) + log.info('REMOVE', d.actual.location) break case 'ADD': - console.error('ADD', d.ideal.location, d.ideal.resolved) + log.info('ADD', d.ideal.location, d.ideal.resolved) break case 'CHANGE': - console.error('CHANGE', d.actual.location, { + log.info('CHANGE', d.actual.location, { from: d.actual.resolved, to: d.ideal.resolved, }) @@ -32,18 +30,19 @@ const printDiff = diff => { }) } -const start = process.hrtime() -process.emit('time', 'install') -const arb = new Arborist(options) -arb.reify(options).then(tree => { - process.emit('timeEnd', 'install') - const end = process.hrtime(start) - print(tree) - if (options.dryRun) { - printDiff(arb.diff) - } - console.error(`resolved ${tree.inventory.size} deps in ${end[0] + end[1] / 1e9}s`) - if (tree.meta && options.save) { - tree.meta.save() - } -}).catch(er => console.error(require('util').inspect(er, { depth: Infinity }))) +module.exports = (options, time) => { + const arb = new Arborist(options) + return arb + .reify(options) + .then(time) + .then(async ({ timing, result: tree }) => { + printTree(tree) + if (options.dryRun) { + printDiff(arb.diff) + } + if (tree.meta && options.save) { + await tree.meta.save() + } + return `resolved ${tree.inventory.size} deps in ${timing.seconds}` + }) +} diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/shrinkwrap.js b/deps/npm/node_modules/@npmcli/arborist/bin/shrinkwrap.js index b40416b7b9..56603224e9 100644 --- a/deps/npm/node_modules/@npmcli/arborist/bin/shrinkwrap.js +++ b/deps/npm/node_modules/@npmcli/arborist/bin/shrinkwrap.js @@ -1,12 +1,7 @@ const Shrinkwrap = require('../lib/shrinkwrap.js') -const options = require('./lib/options.js') -require('./lib/logging.js') -require('./lib/timers.js') -const { quiet } = options -Shrinkwrap.load(options) - .then(s => quiet || console.log(JSON.stringify(s.commit(), 0, 2))) - .catch(er => { - console.error('shrinkwrap load failure', er) - process.exit(1) - }) +module.exports = (options, time) => Shrinkwrap + .load(options) + .then((s) => s.commit()) + .then(time) + .then(({ result: s }) => JSON.stringify(s, 0, 2)) diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/virtual.js b/deps/npm/node_modules/@npmcli/arborist/bin/virtual.js index 457c945e72..95b1de282e 100644 --- a/deps/npm/node_modules/@npmcli/arborist/bin/virtual.js +++ b/deps/npm/node_modules/@npmcli/arborist/bin/virtual.js @@ -1,18 +1,14 @@ const Arborist = require('../') -const print = require('./lib/print-tree.js') -const options = require('./lib/options.js') -require('./lib/logging.js') -require('./lib/timers.js') +const printTree = require('./lib/print-tree.js') -const start = process.hrtime() -new Arborist(options).loadVirtual().then(tree => { - const end = process.hrtime(start) - if (!options.quiet) { - print(tree) - } - if (options.save) { - tree.meta.save() - } - console.error(`read ${tree.inventory.size} deps in ${end[0] * 1000 + end[1] / 1e6}ms`) -}).catch(er => console.error(er)) +module.exports = (options, time) => new Arborist(options) + .loadVirtual() + .then(time) + .then(async ({ timing, result: tree }) => { + printTree(tree) + if (options.save) { + await tree.meta.save() + } + return `read ${tree.inventory.size} deps in ${timing.ms}` + }) diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js b/deps/npm/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js index ae813186fb..f59df359e9 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js @@ -1,10 +1,11 @@ // add and remove dependency specs to/from pkg manifest +const log = require('proc-log') const localeCompare = require('@isaacs/string-locale-compare')('en') -const add = ({ pkg, add, saveBundle, saveType, log }) => { +const add = ({ pkg, add, saveBundle, saveType }) => { for (const spec of add) { - addSingle({ pkg, spec, saveBundle, saveType, log }) + addSingle({ pkg, spec, saveBundle, saveType }) } return pkg @@ -20,7 +21,7 @@ const saveTypeMap = new Map([ ['peer', 'peerDependencies'], ]) -const addSingle = ({ pkg, spec, saveBundle, saveType, log }) => { +const addSingle = ({ pkg, spec, saveBundle, saveType }) => { const { name, rawSpec } = spec // if the user does not give us a type, we infer which type(s) @@ -34,19 +35,19 @@ const addSingle = ({ pkg, spec, saveBundle, saveType, log }) => { if (saveType === 'prod') { // a production dependency can only exist as production (rpj ensures it // doesn't coexist w/ optional) - deleteSubKey(pkg, 'devDependencies', name, 'dependencies', log) - deleteSubKey(pkg, 'peerDependencies', name, 'dependencies', log) + deleteSubKey(pkg, 'devDependencies', name, 'dependencies') + deleteSubKey(pkg, 'peerDependencies', name, 'dependencies') } else if (saveType === 'dev') { // a dev dependency may co-exist as peer, or optional, but not production - deleteSubKey(pkg, 'dependencies', name, 'devDependencies', log) + deleteSubKey(pkg, 'dependencies', name, 'devDependencies') } else if (saveType === 'optional') { // an optional dependency may co-exist as dev (rpj ensures it doesn't // coexist w/ prod) - deleteSubKey(pkg, 'peerDependencies', name, 'optionalDependencies', log) + deleteSubKey(pkg, 'peerDependencies', name, 'optionalDependencies') } else { // peer or peerOptional is all that's left // a peer dependency may coexist as dev - deleteSubKey(pkg, 'dependencies', name, 'peerDependencies', log) - deleteSubKey(pkg, 'optionalDependencies', name, 'peerDependencies', log) + deleteSubKey(pkg, 'dependencies', name, 'peerDependencies') + deleteSubKey(pkg, 'optionalDependencies', name, 'peerDependencies') } const depType = saveTypeMap.get(saveType) @@ -108,9 +109,9 @@ const hasSubKey = (pkg, depType, name) => { } // Removes a subkey and warns about it if it's being replaced -const deleteSubKey = (pkg, depType, name, replacedBy, log) => { +const deleteSubKey = (pkg, depType, name, replacedBy) => { if (hasSubKey(pkg, depType, name)) { - if (replacedBy && log) { + if (replacedBy) { log.warn('idealTree', `Removing ${depType}.${name} in favor of ${replacedBy}.${name}`) } delete pkg[depType][name] diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js index b7bc56f3e9..3f001f9e9e 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js @@ -14,6 +14,7 @@ const fs = require('fs') const lstat = promisify(fs.lstat) const readlink = promisify(fs.readlink) const { depth } = require('treeverse') +const log = require('proc-log') const { OK, @@ -248,7 +249,7 @@ module.exports = cls => class IdealTreeBuilder extends cls { try { c() } catch (er) { - this.log.warn(er.code, er.message, { + log.warn(er.code, er.message, { package: er.pkgid, required: er.required, current: er.current, @@ -532,7 +533,6 @@ Try using the package name instead, e.g: saveBundle, saveType, path: this.path, - log: this.log, }) }) } @@ -602,7 +602,7 @@ Try using the package name instead, e.g: // be printed by npm-audit-report as if they can be fixed, because // they can't. if (bundler) { - this.log.warn(`audit fix ${node.name}@${node.version}`, + log.warn(`audit fix ${node.name}@${node.version}`, `${node.location}\nis a bundled dependency of\n${ bundler.name}@${bundler.version} at ${bundler.location}\n` + 'It cannot be fixed automatically.\n' + @@ -637,14 +637,14 @@ Try using the package name instead, e.g: if (!node.isProjectRoot && !node.isWorkspace) { // not something we're going to fix, sorry. have to cd into // that directory and fix it yourself. - this.log.warn('audit', 'Manual fix required in linked project ' + + log.warn('audit', 'Manual fix required in linked project ' + `at ./${node.location} for ${name}@${simpleRange}.\n` + `'cd ./${node.location}' and run 'npm audit' for details.`) continue } if (!fixAvailable) { - this.log.warn('audit', `No fix available for ${name}@${simpleRange}`) + log.warn('audit', `No fix available for ${name}@${simpleRange}`) continue } @@ -652,7 +652,7 @@ Try using the package name instead, e.g: const breakingMessage = isSemVerMajor ? 'a SemVer major change' : 'outside your stated dependency range' - this.log.warn('audit', `Updating ${name} to ${version},` + + log.warn('audit', `Updating ${name} to ${version},` + `which is ${breakingMessage}.`) await this[_add](node, { add: [`${name}@${version}`] }) @@ -727,7 +727,7 @@ Try using the package name instead, e.g: const heading = ancient ? 'ancient lockfile' : 'old lockfile' if (ancient || !this.options.lockfileVersion || this.options.lockfileVersion >= defaultLockfileVersion) { - this.log.warn(heading, + log.warn(heading, ` The ${meta.type} file was created with an old version of npm, so supplemental metadata must be fetched from the registry. @@ -744,7 +744,7 @@ This is a one-time fix-up, please be patient... } queue.push(async () => { - this.log.silly('inflate', node.location) + log.silly('inflate', node.location) const { resolved, version, path, name, location, integrity } = node // don't try to hit the registry for linked deps const useResolved = resolved && ( @@ -753,8 +753,7 @@ This is a one-time fix-up, please be patient... const id = useResolved ? resolved : version || `file:${node.path}` const spec = npa.resolve(name, id, dirname(path)) - const sloc = location.substr('node_modules/'.length) - const t = `idealTree:inflate:${sloc}` + const t = `idealTree:inflate:${location}` this.addTracker(t) await pacote.manifest(spec, { ...this.options, @@ -765,7 +764,7 @@ This is a one-time fix-up, please be patient... node.package = { ...mani, _id: `${mani.name}@${mani.version}` } }).catch((er) => { const warning = `Could not fetch metadata for ${name}@${id}` - this.log.warn(heading, warning, er) + log.warn(heading, warning, er) }) this.finishTracker(t) }) @@ -794,7 +793,7 @@ This is a one-time fix-up, please be patient... this[_depsQueue].push(tree) // XXX also push anything that depends on a node with a name // in the override list - this.log.silly('idealTree', 'buildDeps') + log.silly('idealTree', 'buildDeps') this.addTracker('idealTree', tree.name, '') return this[_buildDepStep]() .then(() => process.emit('timeEnd', 'idealTree:buildDeps')) @@ -1233,7 +1232,7 @@ This is a one-time fix-up, please be patient... if (this[_manifests].has(spec.raw)) { return this[_manifests].get(spec.raw) } else { - this.log.silly('fetch manifest', spec.raw) + log.silly('fetch manifest', spec.raw) const p = pacote.manifest(spec, options) .then(mani => { this[_manifests].set(spec.raw, mani) diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js index de625e9b76..cb6ef1e0c2 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js @@ -28,7 +28,6 @@ const { resolve } = require('path') const { homedir } = require('os') -const procLog = require('proc-log') const { depth } = require('treeverse') const { saveTypeMap } = require('../add-rm-pkg-deps.js') @@ -74,7 +73,6 @@ class Arborist extends Base { path: options.path || '.', cache: options.cache || `${homedir()}/.npm/_cacache`, packumentCache: options.packumentCache || new Map(), - log: options.log || procLog, workspacesEnabled: options.workspacesEnabled !== false, lockfileVersion: lockfileVersion(options.lockfileVersion), } @@ -94,7 +92,7 @@ class Arborist extends Base { // returns an array of the actual nodes for all the workspaces workspaceNodes (tree, workspaces) { - return getWorkspaceNodes(tree, workspaces, this.log) + return getWorkspaceNodes(tree, workspaces) } // returns a set of workspace nodes and all their deps diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js index 1a05e52735..09b4419f5b 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js @@ -13,6 +13,7 @@ const { isNodeGypPackage, defaultGypInstallScript, } = require('@npmcli/node-gyp') +const log = require('proc-log') const boolEnv = b => b ? '1' : '' const sortNodes = (a, b) => @@ -297,7 +298,7 @@ module.exports = cls => class Builder extends cls { const timer = `build:run:${event}:${location}` process.emit('time', timer) - this.log.info('run', pkg._id, event, location, pkg.scripts[event]) + log.info('run', pkg._id, event, location, pkg.scripts[event]) const env = { npm_package_resolved: resolved, npm_package_integrity: integrity, @@ -319,7 +320,7 @@ module.exports = cls => class Builder extends cls { } const p = runScript(runOpts).catch(er => { const { code, signal } = er - this.log.info('run', pkg._id, event, { code, signal }) + log.info('run', pkg._id, event, { code, signal }) throw er }).then(({ args, code, signal, stdout, stderr }) => { this.scriptsRun.add({ @@ -333,7 +334,7 @@ module.exports = cls => class Builder extends cls { stdout, stderr, }) - this.log.info('run', pkg._id, event, { code, signal }) + log.info('run', pkg._id, event, { code, signal }) }) await (this[_doHandleOptionalFailure] diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js index 91507fd791..4bc1c7ee4e 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js @@ -8,6 +8,7 @@ const npa = require('npm-package-arg') const semver = require('semver') const debug = require('../debug.js') const walkUp = require('walk-up-path') +const log = require('proc-log') const { dirname, resolve, relative } = require('path') const { depth: dfwalk } = require('treeverse') @@ -390,7 +391,7 @@ module.exports = cls => class Reifier extends cls { [_addNodeToTrashList] (node, retire = false) { const paths = [node.path, ...node.binPaths] const moves = this[_retiredPaths] - this.log.silly('reify', 'mark', retire ? 'retired' : 'deleted', paths) + log.silly('reify', 'mark', retire ? 'retired' : 'deleted', paths) for (const path of paths) { if (retire) { const retired = retirePath(path) @@ -413,7 +414,7 @@ module.exports = cls => class Reifier extends cls { this[_addNodeToTrashList](diff.actual, true) } } - this.log.silly('reify', 'moves', moves) + log.silly('reify', 'moves', moves) const movePromises = Object.entries(moves) .map(([from, to]) => this[_renamePath](from, to)) return promiseAllRejectLate(movePromises) @@ -532,7 +533,7 @@ module.exports = cls => class Reifier extends cls { return promiseAllRejectLate(unlinks) .then(() => { if (failures.length) { - this.log.warn('cleanup', 'Failed to remove some directories', failures) + log.warn('cleanup', 'Failed to remove some directories', failures) } }) .then(() => process.emit('timeEnd', 'reify:rollback:createSparse')) @@ -624,7 +625,7 @@ module.exports = cls => class Reifier extends cls { this[_nmValidated].add(nm) return } - this.log.warn('reify', 'Removing non-directory', nm) + log.warn('reify', 'Removing non-directory', nm) await rimraf(nm) } @@ -647,8 +648,8 @@ module.exports = cls => class Reifier extends cls { 'please re-try this operation once it completes\n' + 'so that the damage can be corrected, or perform\n' + 'a fresh install with no lockfile if the problem persists.' - this.log.warn('reify', warning) - this.log.verbose('reify', 'unrecognized node in tree', node.path) + log.warn('reify', warning) + log.verbose('reify', 'unrecognized node in tree', node.path) node.parent = null node.fsParent = null this[_addNodeToTrashList](node) @@ -691,7 +692,7 @@ module.exports = cls => class Reifier extends cls { [_warnDeprecated] (node) { const { _id, deprecated } = node.package if (deprecated) { - this.log.warn('deprecated', `${_id}: ${deprecated}`) + log.warn('deprecated', `${_id}: ${deprecated}`) } } @@ -701,7 +702,7 @@ module.exports = cls => class Reifier extends cls { return (node.optional ? p.catch(er => { const set = optionalSet(node) for (node of set) { - this.log.verbose('reify', 'failed optional dependency', node.path) + log.verbose('reify', 'failed optional dependency', node.path) this[_addNodeToTrashList](node) } }) : p).then(() => node) @@ -716,7 +717,7 @@ module.exports = cls => class Reifier extends cls { // Shrinkwrap and Node classes carefully, so for now, just treat // the default reg as the magical animal that it has been. return resolved && resolved - .replace(/^https?:\/\/registry.npmjs.org\//, this.registry) + .replace(/^https?:\/\/registry\.npmjs\.org\//, this.registry) } // bundles are *sort of* like shrinkwraps, in that the branch is defined @@ -1129,7 +1130,7 @@ module.exports = cls => class Reifier extends cls { return promiseAllRejectLate(promises).then(() => { if (failures.length) { - this.log.warn('cleanup', 'Failed to remove some directories', failures) + log.warn('cleanup', 'Failed to remove some directories', failures) } }) .then(() => process.emit('timeEnd', 'reify:trash')) diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js b/deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js index b7d8249b12..4dc6dd177c 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js @@ -13,7 +13,7 @@ const _fixAvailable = Symbol('fixAvailable') const _checkTopNode = Symbol('checkTopNode') const _init = Symbol('init') const _omit = Symbol('omit') -const procLog = require('proc-log') +const log = require('proc-log') const fetch = require('npm-registry-fetch') @@ -98,14 +98,13 @@ class AuditReport extends Map { this.calculator = new Calculator(opts) this.error = null this.options = opts - this.log = opts.log || procLog this.tree = tree this.filterSet = opts.filterSet } async run () { this.report = await this[_getReport]() - this.log.silly('audit report', this.report) + log.silly('audit report', this.report) if (this.report) { await this[_init]() } @@ -313,7 +312,7 @@ class AuditReport extends Map { try { // first try the super fast bulk advisory listing const body = prepareBulkData(this.tree, this[_omit], this.filterSet) - this.log.silly('audit', 'bulk request', body) + log.silly('audit', 'bulk request', body) // no sense asking if we don't have anything to audit, // we know it'll be empty @@ -331,7 +330,7 @@ class AuditReport extends Map { return await res.json() } catch (er) { - this.log.silly('audit', 'bulk request failed', String(er.body)) + log.silly('audit', 'bulk request failed', String(er.body)) // that failed, try the quick audit endpoint const body = prepareData(this.tree, this.options) const res = await fetch('/-/npm/v1/security/audits/quick', { @@ -344,8 +343,8 @@ class AuditReport extends Map { return AuditReport.auditToBulk(await res.json()) } } catch (er) { - this.log.verbose('audit error', er) - this.log.silly('audit error', String(er.body)) + log.verbose('audit error', er) + log.silly('audit error', String(er.body)) this.error = er return null } finally { diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/get-workspace-nodes.js b/deps/npm/node_modules/@npmcli/arborist/lib/get-workspace-nodes.js index 6db489f69c..91002dab57 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/get-workspace-nodes.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/get-workspace-nodes.js @@ -1,7 +1,10 @@ // Get the actual nodes corresponding to a root node's child workspaces, // given a list of workspace names. + +const log = require('proc-log') const relpath = require('./relpath.js') -const getWorkspaceNodes = (tree, workspaces, log) => { + +const getWorkspaceNodes = (tree, workspaces) => { const wsMap = tree.workspaces if (!wsMap) { log.warn('workspaces', 'filter set, but no workspaces present') diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js index bb6971f7ad..ead9aed364 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js @@ -33,7 +33,7 @@ const mismatch = (a, b) => a && b && a !== b // After calling this.commit(), any nodes not present in the tree will have // been removed from the shrinkwrap data as well. -const procLog = require('proc-log') +const log = require('proc-log') const YarnLock = require('./yarn-lock.js') const { promisify } = require('util') const rimraf = promisify(require('rimraf')) @@ -80,8 +80,8 @@ const swKeyOrder = [ ] // used to rewrite from yarn registry to npm registry -const yarnRegRe = /^https?:\/\/registry.yarnpkg.com\// -const npmRegRe = /^https?:\/\/registry.npmjs.org\// +const yarnRegRe = /^https?:\/\/registry\.yarnpkg\.com\// +const npmRegRe = /^https?:\/\/registry\.npmjs\.org\// // sometimes resolved: is weird or broken, or something npa can't handle const specFromResolved = resolved => { @@ -329,14 +329,12 @@ class Shrinkwrap { newline = '\n', shrinkwrapOnly = false, hiddenLockfile = false, - log = procLog, lockfileVersion, } = options this.lockfileVersion = hiddenLockfile ? 3 : lockfileVersion ? parseInt(lockfileVersion, 10) : null - this.log = log this[_awaitingUpdate] = new Map() this.tree = null this.path = resolve(path || '.') @@ -479,9 +477,9 @@ class Shrinkwrap { /* istanbul ignore else */ if (typeof this.filename === 'string') { const rel = relpath(this.path, this.filename) - this.log.verbose('shrinkwrap', `failed to load ${rel}`, er) + log.verbose('shrinkwrap', `failed to load ${rel}`, er) } else { - this.log.verbose('shrinkwrap', `failed to load ${this.path}`, er) + log.verbose('shrinkwrap', `failed to load ${this.path}`, er) } this.loadingError = er this.loadedFromDisk = false diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/tracker.js b/deps/npm/node_modules/@npmcli/arborist/lib/tracker.js index b50f06eaa5..c2a456e483 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/tracker.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/tracker.js @@ -1,20 +1,14 @@ const _progress = Symbol('_progress') const _onError = Symbol('_onError') -const procLog = require('proc-log') +const npmlog = require('npmlog') module.exports = cls => class Tracker extends cls { constructor (options = {}) { super(options) - this.log = options.log || procLog this[_progress] = new Map() } addTracker (section, subsection = null, key = null) { - // TrackerGroup type object not found - if (!this.log.newGroup) { - return - } - if (section === null || section === undefined) { this[_onError](`Tracker can't be null or undefined`) } @@ -31,13 +25,13 @@ module.exports = cls => class Tracker extends cls { this[_onError](`Tracker "${section}" already exists`) } else if (!hasTracker && subsection === null) { // 1. no existing tracker, no subsection - // Create a new tracker from this.log + // Create a new tracker from npmlog // starts progress bar if (this[_progress].size === 0) { - this.log.enableProgress() + npmlog.enableProgress() } - this[_progress].set(section, this.log.newGroup(section)) + this[_progress].set(section, npmlog.newGroup(section)) } else if (!hasTracker && subsection !== null) { // 2. no parent tracker and subsection this[_onError](`Parent tracker "${section}" does not exist`) @@ -53,11 +47,6 @@ module.exports = cls => class Tracker extends cls { } finishTracker (section, subsection = null, key = null) { - // TrackerGroup type object not found - if (!this.log.newGroup) { - return - } - if (section === null || section === undefined) { this[_onError](`Tracker can't be null or undefined`) } @@ -88,7 +77,7 @@ module.exports = cls => class Tracker extends cls { // remove progress bar if all // trackers are finished if (this[_progress].size === 0) { - this.log.disableProgress() + npmlog.disableProgress() } } else if (!hasTracker && subsection === null) { // 1. no existing parent tracker, no subsection @@ -103,7 +92,7 @@ module.exports = cls => class Tracker extends cls { } [_onError] (msg) { - this.log.disableProgress() + npmlog.disableProgress() throw new Error(msg) } } diff --git a/deps/npm/node_modules/@npmcli/arborist/package.json b/deps/npm/node_modules/@npmcli/arborist/package.json index a915c9d8b1..520c457487 100644 --- a/deps/npm/node_modules/@npmcli/arborist/package.json +++ b/deps/npm/node_modules/@npmcli/arborist/package.json @@ -1,17 +1,17 @@ { "name": "@npmcli/arborist", - "version": "4.3.1", + "version": "5.0.0", "description": "Manage node_modules trees", "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", "@npmcli/installed-package-contents": "^1.0.7", "@npmcli/map-workspaces": "^2.0.0", - "@npmcli/metavuln-calculator": "^2.0.0", + "@npmcli/metavuln-calculator": "^3.0.0", "@npmcli/move-file": "^1.1.0", "@npmcli/name-from-folder": "^1.0.1", "@npmcli/node-gyp": "^1.0.3", "@npmcli/package-json": "^1.0.1", - "@npmcli/run-script": "^2.0.0", + "@npmcli/run-script": "^3.0.0", "bin-links": "^3.0.0", "cacache": "^15.0.3", "common-ancestor-path": "^1.0.1", @@ -19,13 +19,15 @@ "json-stringify-nice": "^1.1.4", "mkdirp": "^1.0.4", "mkdirp-infer-owner": "^2.0.0", + "nopt": "^5.0.0", "npm-install-checks": "^4.0.0", - "npm-package-arg": "^8.1.5", - "npm-pick-manifest": "^6.1.0", - "npm-registry-fetch": "^12.0.1", - "pacote": "^12.0.2", + "npm-package-arg": "^9.0.0", + "npm-pick-manifest": "^7.0.0", + "npm-registry-fetch": "^13.0.0", + "npmlog": "^6.0.1", + "pacote": "^13.0.2", "parse-conflict-json": "^2.0.1", - "proc-log": "^1.0.0", + "proc-log": "^2.0.0", "promise-all-reject-late": "^1.0.0", "promise-call-limit": "^1.0.1", "read-package-json-fast": "^2.0.2", diff --git a/deps/npm/node_modules/@npmcli/config/lib/env-replace.js b/deps/npm/node_modules/@npmcli/config/lib/env-replace.js index a6e4b2968d..e0f7276b1e 100644 --- a/deps/npm/node_modules/@npmcli/config/lib/env-replace.js +++ b/deps/npm/node_modules/@npmcli/config/lib/env-replace.js @@ -1,6 +1,6 @@ // replace any ${ENV} values with the appropriate environ. -const envExpr = /(\\*)\$\{([^}]+)\}/g +const envExpr = /(?<!\\)(\\*)\$\{([^${}]+)\}/g module.exports = (f, env) => f.replace(envExpr, (orig, esc, name) => { const val = env[name] !== undefined ? env[name] : `$\{${name}}` diff --git a/deps/npm/node_modules/@npmcli/config/lib/index.js b/deps/npm/node_modules/@npmcli/config/lib/index.js index dc839a5389..82e369938d 100644 --- a/deps/npm/node_modules/@npmcli/config/lib/index.js +++ b/deps/npm/node_modules/@npmcli/config/lib/index.js @@ -5,6 +5,7 @@ const nopt = require('nopt') const mkdirp = require('mkdirp-infer-owner') const mapWorkspaces = require('@npmcli/map-workspaces') const rpj = require('read-package-json-fast') +const log = require('proc-log') /* istanbul ignore next */ const myUid = process.getuid && process.getuid() @@ -88,7 +89,6 @@ class Config { // options just to override in tests, mostly env = process.env, argv = process.argv, - log = require('./proc-log.js'), platform = process.platform, execPath = process.execPath, cwd = process.cwd(), @@ -114,7 +114,6 @@ class Config { this.defaults = defaults this.npmPath = npmPath - this.log = log this.argv = argv this.env = env this.execPath = execPath @@ -436,7 +435,7 @@ class Config { } invalidHandler (k, val, type, source, where) { - this.log.warn( + log.warn( 'invalid config', k + '=' + JSON.stringify(val), `set in ${source}` @@ -469,7 +468,7 @@ class Config { : mustBe.filter(m => m !== Array) .map(n => typeof n === 'string' ? n : JSON.stringify(n)) .join(', ') - this.log.warn('invalid config', msg, desc) + log.warn('invalid config', msg, desc) } [_loadObject] (obj, where, source, er = null) { @@ -491,7 +490,7 @@ class Config { if (er) { conf.loadError = er if (er.code !== 'ENOENT') { - this.log.verbose('config', `error loading ${where} config`, er) + log.verbose('config', `error loading ${where} config`, er) } } else { conf.raw = obj @@ -510,7 +509,7 @@ class Config { // XXX a future npm version will make this a warning. // An even more future npm version will make this an error. if (this.deprecated[key]) { - this.log.verbose('config', key, this.deprecated[key]) + log.verbose('config', key, this.deprecated[key]) } } @@ -607,14 +606,14 @@ class Config { .catch(() => false) if (hasNpmrc) { - this.log.warn(`ignoring workspace config at ${this.localPrefix}/.npmrc`) + log.warn(`ignoring workspace config at ${this.localPrefix}/.npmrc`) } // set the workspace in the default layer, which allows it to be overridden easily const { data } = this.data.get('default') data.workspace = [this.localPrefix] this.localPrefix = p - this.log.info(`found workspace root at ${this.localPrefix}`) + log.info(`found workspace root at ${this.localPrefix}`) // we found a root, so we return now return } diff --git a/deps/npm/node_modules/@npmcli/config/lib/proc-log.js b/deps/npm/node_modules/@npmcli/config/lib/proc-log.js deleted file mode 100644 index 0492a26180..0000000000 --- a/deps/npm/node_modules/@npmcli/config/lib/proc-log.js +++ /dev/null @@ -1,4 +0,0 @@ -const log = (level) => (...args) => process.emit('log', level, ...args) -for (const level of ['silly', 'verbose', 'warn', 'error']) { - exports[level] = log(level) -} diff --git a/deps/npm/node_modules/@npmcli/config/package.json b/deps/npm/node_modules/@npmcli/config/package.json index b0722db413..ea03f957f8 100644 --- a/deps/npm/node_modules/@npmcli/config/package.json +++ b/deps/npm/node_modules/@npmcli/config/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/config", - "version": "3.0.0", + "version": "4.0.0", "files": [ "bin", "lib" @@ -30,22 +30,23 @@ "coverage-map": "map.js" }, "devDependencies": { - "@npmcli/template-oss": "^2.5.1", - "tap": "^15.0.4" + "@npmcli/template-oss": "^2.7.1", + "tap": "^15.1.6" }, "dependencies": { "@npmcli/map-workspaces": "^2.0.0", "ini": "^2.0.0", "mkdirp-infer-owner": "^2.0.0", "nopt": "^5.0.0", + "proc-log": "^2.0.0", "read-package-json-fast": "^2.0.3", - "semver": "^7.3.4", + "semver": "^7.3.5", "walk-up-path": "^1.0.0" }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16" }, "templateOSS": { - "version": "2.6.0" + "version": "2.7.1" } } diff --git a/deps/npm/node_modules/@npmcli/git/lib/clone.js b/deps/npm/node_modules/@npmcli/git/lib/clone.js index 6754fd7606..ac5f86b144 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/clone.js +++ b/deps/npm/node_modules/@npmcli/git/lib/clone.js @@ -15,7 +15,7 @@ const shallowHosts = new Set([ 'gist.github.com', 'gitlab.com', 'bitbucket.com', - 'bitbucket.org' + 'bitbucket.org', ]) // we have to use url.parse until we add the same shim that hosted-git-info has // to handle scp:// urls @@ -113,10 +113,14 @@ const branch = (repo, revDoc, target, opts) => { revDoc.ref, repo, target, - '--recurse-submodules' + '--recurse-submodules', ] - if (maybeShallow(repo, opts)) { args.push('--depth=1') } - if (isWindows(opts)) { args.push('--config', 'core.longpaths=true') } + if (maybeShallow(repo, opts)) { + args.push('--depth=1') + } + if (isWindows(opts)) { + args.push('--config', 'core.longpaths=true') + } return spawn(args, opts).then(() => revDoc.sha) } @@ -126,10 +130,14 @@ const plain = (repo, revDoc, target, opts) => { 'clone', repo, target, - '--recurse-submodules' + '--recurse-submodules', ] - if (maybeShallow(repo, opts)) { args.push('--depth=1') } - if (isWindows(opts)) { args.push('--config', 'core.longpaths=true') } + if (maybeShallow(repo, opts)) { + args.push('--depth=1') + } + if (isWindows(opts)) { + args.push('--config', 'core.longpaths=true') + } return spawn(args, opts).then(() => revDoc.sha) } @@ -143,7 +151,7 @@ const updateSubmodules = (target, opts) => new Promise(resolve => 'update', '-q', '--init', - '--recursive' + '--recursive', ], { ...opts, cwd: target })) })) diff --git a/deps/npm/node_modules/@npmcli/git/lib/errors.js b/deps/npm/node_modules/@npmcli/git/lib/errors.js index 25b2b9f9fd..7aeac47628 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/errors.js +++ b/deps/npm/node_modules/@npmcli/git/lib/errors.js @@ -32,5 +32,5 @@ class GitUnknownError extends GitError { module.exports = { GitConnectionError, GitPathspecError, - GitUnknownError + GitUnknownError, } diff --git a/deps/npm/node_modules/@npmcli/git/lib/index.js b/deps/npm/node_modules/@npmcli/git/lib/index.js index 20d7cfd01c..10a65f782e 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/index.js +++ b/deps/npm/node_modules/@npmcli/git/lib/index.js @@ -5,5 +5,5 @@ module.exports = { is: require('./is.js'), find: require('./find.js'), isClean: require('./is-clean.js'), - errors: require('./errors.js') + errors: require('./errors.js'), } diff --git a/deps/npm/node_modules/@npmcli/git/lib/lines-to-revs.js b/deps/npm/node_modules/@npmcli/git/lib/lines-to-revs.js index 9f879ca247..3cf3778fe9 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/lines-to-revs.js +++ b/deps/npm/node_modules/@npmcli/git/lib/lines-to-revs.js @@ -7,7 +7,7 @@ module.exports = lines => finish(lines.reduce(linesToRevsReducer, { versions: {}, 'dist-tags': {}, refs: {}, - shas: {} + shas: {}, })) const finish = revs => distTags(shaList(peelTags(revs))) @@ -52,7 +52,9 @@ const distTags = revs => { revs['dist-tags'].latest = v } else if (ver.sha === HEAD.sha) { revs['dist-tags'].HEAD = v - if (!revs.refs.latest) { revs['dist-tags'].latest = v } + if (!revs.refs.latest) { + revs['dist-tags'].latest = v + } } }) return revs @@ -79,7 +81,9 @@ const refType = ref => { // return the doc, or null if we should ignore it. const lineToRevDoc = line => { const split = line.trim().split(/\s+/, 2) - if (split.length < 2) { return null } + if (split.length < 2) { + return null + } const sha = split[0].trim() const rawRef = split[1].trim() @@ -122,7 +126,9 @@ const lineToRevDoc = line => { const linesToRevsReducer = (revs, line) => { const doc = lineToRevDoc(line) - if (!doc) { return revs } + if (!doc) { + return revs + } revs.refs[doc.ref] = doc revs.refs[doc.rawRef] = doc diff --git a/deps/npm/node_modules/@npmcli/git/lib/make-error.js b/deps/npm/node_modules/@npmcli/git/lib/make-error.js index 043a8e6e95..7540ec7c8b 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/make-error.js +++ b/deps/npm/node_modules/@npmcli/git/lib/make-error.js @@ -1,7 +1,7 @@ const { GitConnectionError, GitPathspecError, - GitUnknownError + GitUnknownError, } = require('./errors.js') const connectionErrorRe = new RegExp([ @@ -12,7 +12,7 @@ const connectionErrorRe = new RegExp([ 'Failed to connect to .* Timed out', 'Connection reset by peer', 'SSL_ERROR_SYSCALL', - 'The requested URL returned error: 503' + 'The requested URL returned error: 503', ].join('|')) const missingPathspecRe = /pathspec .* did not match any file\(s\) known to git/ diff --git a/deps/npm/node_modules/@npmcli/git/lib/opts.js b/deps/npm/node_modules/@npmcli/git/lib/opts.js index 144e0a3aaf..3119af16e0 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/opts.js +++ b/deps/npm/node_modules/@npmcli/git/lib/opts.js @@ -2,11 +2,11 @@ // This defaults to accepting new ssh host key fingerprints const gitEnv = { GIT_ASKPASS: 'echo', - GIT_SSH_COMMAND: 'ssh -oStrictHostKeyChecking=accept-new' + GIT_SSH_COMMAND: 'ssh -oStrictHostKeyChecking=accept-new', } module.exports = (opts = {}) => ({ stdioString: true, ...opts, shell: false, - env: opts.env || { ...gitEnv, ...process.env } + env: opts.env || { ...gitEnv, ...process.env }, }) diff --git a/deps/npm/node_modules/@npmcli/git/lib/proc-log.js b/deps/npm/node_modules/@npmcli/git/lib/proc-log.js deleted file mode 100644 index b2bdd9dc90..0000000000 --- a/deps/npm/node_modules/@npmcli/git/lib/proc-log.js +++ /dev/null @@ -1,21 +0,0 @@ -// default logger. -// emits 'log' events on the process -const LEVELS = [ - 'notice', - 'error', - 'warn', - 'info', - 'verbose', - 'http', - 'silly', - 'pause', - 'resume' -] - -const log = level => (...args) => process.emit('log', level, ...args) - -const logger = {} -for (const level of LEVELS) { - logger[level] = log(level) -} -module.exports = logger diff --git a/deps/npm/node_modules/@npmcli/git/lib/revs.js b/deps/npm/node_modules/@npmcli/git/lib/revs.js index 81059594f7..ee72370d5b 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/revs.js +++ b/deps/npm/node_modules/@npmcli/git/lib/revs.js @@ -4,7 +4,7 @@ const LRU = require('lru-cache') const revsCache = new LRU({ max: 100, - maxAge: 5 * 60 * 1000 + ttl: 5 * 60 * 1000, }) const linesToRevs = require('./lines-to-revs.js') diff --git a/deps/npm/node_modules/@npmcli/git/lib/spawn.js b/deps/npm/node_modules/@npmcli/git/lib/spawn.js index 1c89a4c53c..40972a509c 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/spawn.js +++ b/deps/npm/node_modules/@npmcli/git/lib/spawn.js @@ -1,28 +1,29 @@ const spawn = require('@npmcli/promise-spawn') const promiseRetry = require('promise-retry') +const log = require('proc-log') const makeError = require('./make-error.js') const whichGit = require('./which.js') const makeOpts = require('./opts.js') -const procLog = require('./proc-log.js') module.exports = (gitArgs, opts = {}) => { const gitPath = whichGit(opts) - if (gitPath instanceof Error) { return Promise.reject(gitPath) } + if (gitPath instanceof Error) { + return Promise.reject(gitPath) + } // undocumented option, mostly only here for tests const args = opts.allowReplace || gitArgs[0] === '--no-replace-objects' ? gitArgs : ['--no-replace-objects', ...gitArgs] - const log = opts.log || procLog let retry = opts.retry if (retry === null || retry === undefined) { retry = { retries: opts.fetchRetries || 2, factor: opts.fetchRetryFactor || 10, maxTimeout: opts.fetchRetryMaxtimeout || 60000, - minTimeout: opts.fetchRetryMintimeout || 1000 + minTimeout: opts.fetchRetryMintimeout || 1000, } } return promiseRetry((retry, number) => { diff --git a/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/LICENSE b/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/LICENSE new file mode 100644 index 0000000000..9b58a3e03d --- /dev/null +++ b/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2010-2022 Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/index.js b/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/index.js new file mode 100644 index 0000000000..ede2f30cc4 --- /dev/null +++ b/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/index.js @@ -0,0 +1,581 @@ +const perf = typeof performance === 'object' && performance && + typeof performance.now === 'function' ? performance : Date + +const warned = new Set() +const deprecatedOption = (opt, msg) => { + const code = `LRU_CACHE_OPTION_${opt}` + if (shouldWarn(code)) { + warn(code, `The ${opt} option is deprecated. ${msg}`, LRUCache) + } +} +const deprecatedMethod = (method, msg) => { + const code = `LRU_CACHE_METHOD_${method}` + if (shouldWarn(code)) { + const { prototype } = LRUCache + const { get } = Object.getOwnPropertyDescriptor(prototype, method) + warn(code, `The ${method} method is deprecated. ${msg}`, get) + } +} +const deprecatedProperty = (field, msg) => { + const code = `LRU_CACHE_PROPERTY_${field}` + if (shouldWarn(code)) { + const { prototype } = LRUCache + const { get } = Object.getOwnPropertyDescriptor(prototype, field) + warn(code, `The ${field} property is deprecated. ${msg}`, get) + } +} +const shouldWarn = (code) => !(process.noDeprecation || warned.has(code)) +const warn = (code, msg, fn) => { + warned.add(code) + process.emitWarning(msg, 'DeprecationWarning', code, fn) +} + +const isPosInt = n => n && n === Math.floor(n) && n > 0 && isFinite(n) + +/* istanbul ignore next - This is a little bit ridiculous, tbh. + * The maximum array length is 2^32-1 or thereabouts on most JS impls. + * And well before that point, you're caching the entire world, I mean, + * that's ~32GB of just integers for the next/prev links, plus whatever + * else to hold that many keys and values. Just filling the memory with + * zeroes at init time is brutal when you get that big. + * But why not be complete? + * Maybe in the future, these limits will have expanded. */ +const getUintArray = max => !isPosInt(max) ? null +: max <= Math.pow(2, 8) ? Uint8Array +: max <= Math.pow(2, 16) ? Uint16Array +: max <= Math.pow(2, 32) ? Uint32Array +: max <= Number.MAX_SAFE_INTEGER ? ZeroArray +: null + +class ZeroArray extends Array { + constructor (size) { + super(size) + this.fill(0) + } +} + +class Stack { + constructor (max) { + const UintArray = getUintArray(max) + this.heap = new UintArray(max) + this.length = 0 + } + push (n) { + this.heap[this.length++] = n + } + pop () { + return this.heap[--this.length] + } +} + +class LRUCache { + constructor (options = {}) { + const { + max, + ttl, + ttlResolution = 1, + ttlAutopurge, + updateAgeOnGet, + allowStale, + dispose, + disposeAfter, + noDisposeOnSet, + maxSize, + sizeCalculation, + } = options + + // deprecated options, don't trigger a warning for getting them if + // the thing being passed in is another LRUCache we're copying. + const { + length, + maxAge, + stale, + } = options instanceof LRUCache ? {} : options + + if (!isPosInt(max)) { + throw new TypeError('max option must be an integer') + } + + const UintArray = getUintArray(max) + if (!UintArray) { + throw new Error('invalid max value: ' + max) + } + + this.max = max + this.maxSize = maxSize || 0 + this.sizeCalculation = sizeCalculation || length + if (this.sizeCalculation) { + if (!this.maxSize) { + throw new TypeError('cannot set sizeCalculation without setting maxSize') + } + if (typeof this.sizeCalculation !== 'function') { + throw new TypeError('sizeCalculating set to non-function') + } + } + this.keyMap = new Map() + this.keyList = new Array(max).fill(null) + this.valList = new Array(max).fill(null) + this.next = new UintArray(max) + this.prev = new UintArray(max) + this.head = 0 + this.tail = 0 + this.free = new Stack(max) + this.initialFill = 1 + this.size = 0 + + if (typeof dispose === 'function') { + this.dispose = dispose + } + if (typeof disposeAfter === 'function') { + this.disposeAfter = disposeAfter + this.disposed = [] + } else { + this.disposeAfter = null + this.disposed = null + } + this.noDisposeOnSet = !!noDisposeOnSet + + if (this.maxSize) { + if (!isPosInt(this.maxSize)) { + throw new TypeError('maxSize must be a positive integer if specified') + } + this.initializeSizeTracking() + } + + this.allowStale = !!allowStale || !!stale + this.updateAgeOnGet = !!updateAgeOnGet + this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0 + ? ttlResolution : 1 + this.ttlAutopurge = !!ttlAutopurge + this.ttl = ttl || maxAge || 0 + if (this.ttl) { + if (!isPosInt(this.ttl)) { + throw new TypeError('ttl must be a positive integer if specified') + } + this.initializeTTLTracking() + } + + if (stale) { + deprecatedOption('stale', 'please use options.allowStale instead') + } + if (maxAge) { + deprecatedOption('maxAge', 'please use options.ttl instead') + } + if (length) { + deprecatedOption('length', 'please use options.sizeCalculation instead') + } + } + + initializeTTLTracking () { + this.ttls = new ZeroArray(this.max) + this.starts = new ZeroArray(this.max) + this.setItemTTL = (index, ttl) => { + this.starts[index] = ttl !== 0 ? perf.now() : 0 + this.ttls[index] = ttl + if (ttl !== 0 && this.ttlAutopurge) { + const t = setTimeout(() => { + if (this.isStale(index)) { + this.delete(this.keyList[index]) + } + }, ttl + 1) + /* istanbul ignore else - unref() not supported on all platforms */ + if (t.unref) { + t.unref() + } + } + } + this.updateItemAge = (index) => { + this.starts[index] = this.ttls[index] !== 0 ? perf.now() : 0 + } + // debounce calls to perf.now() to 1s so we're not hitting + // that costly call repeatedly. + let cachedNow = 0 + const getNow = () => { + const n = perf.now() + if (this.ttlResolution > 0) { + cachedNow = n + const t = setTimeout(() => cachedNow = 0, this.ttlResolution) + /* istanbul ignore else - not available on all platforms */ + if (t.unref) { + t.unref() + } + } + return n + } + this.isStale = (index) => { + return this.ttls[index] !== 0 && this.starts[index] !== 0 && + ((cachedNow || getNow()) - this.starts[index] > this.ttls[index]) + } + } + updateItemAge (index) {} + setItemTTL (index, ttl) {} + isStale (index) { return false } + + initializeSizeTracking () { + this.calculatedSize = 0 + this.sizes = new ZeroArray(this.max) + this.removeItemSize = index => this.calculatedSize -= this.sizes[index] + this.addItemSize = (index, v, k, size, sizeCalculation) => { + const s = size || (sizeCalculation ? sizeCalculation(v, k) : 0) + this.sizes[index] = isPosInt(s) ? s : 0 + const maxSize = this.maxSize - this.sizes[index] + while (this.calculatedSize > maxSize) { + this.evict() + } + this.calculatedSize += this.sizes[index] + } + this.delete = k => { + if (this.size !== 0) { + const index = this.keyMap.get(k) + if (index !== undefined) { + this.calculatedSize -= this.sizes[index] + } + } + return LRUCache.prototype.delete.call(this, k) + } + } + removeItemSize (index) {} + addItemSize (index, v, k, size, sizeCalculation) {} + + *indexes () { + if (this.size) { + for (let i = this.tail; true; i = this.prev[i]) { + if (!this.isStale(i)) { + yield i + } + if (i === this.head) { + break + } + } + } + } + *rindexes () { + if (this.size) { + for (let i = this.head; true; i = this.next[i]) { + if (!this.isStale(i)) { + yield i + } + if (i === this.tail) { + break + } + } + } + } + + *entries () { + for (const i of this.indexes()) { + yield [this.keyList[i], this.valList[i]] + } + } + + *keys () { + for (const i of this.indexes()) { + yield this.keyList[i] + } + } + + *values () { + for (const i of this.indexes()) { + yield this.valList[i] + } + } + + [Symbol.iterator] () { + return this.entries() + } + + find (fn, getOptions = {}) { + for (const i of this.indexes()) { + if (fn(this.valList[i], this.keyList[i], this)) { + return this.get(this.keyList[i], getOptions) + } + } + } + + forEach (fn, thisp = this) { + for (const i of this.indexes()) { + fn.call(thisp, this.valList[i], this.keyList[i], this) + } + } + + rforEach (fn, thisp = this) { + for (const i of this.rindexes()) { + fn.call(thisp, this.valList[i], this.keyList[i], this) + } + } + + get prune () { + deprecatedMethod('prune', 'Please use cache.purgeStale() instead.') + return this.purgeStale + } + + purgeStale () { + let deleted = false + if (this.size) { + for (let i = this.head; true; i = this.next[i]) { + const b = i === this.tail + if (this.isStale(i)) { + this.delete(this.keyList[i]) + deleted = true + } + if (b) { + break + } + } + } + return deleted + } + + dump () { + const arr = [] + for (const i of this.indexes()) { + const key = this.keyList[i] + const value = this.valList[i] + const entry = { value } + if (this.ttls) { + entry.ttl = this.ttls[i] + } + if (this.sizes) { + entry.size = this.sizes[i] + } + arr.unshift([key, entry]) + } + return arr + } + + load (arr) { + this.clear() + for (const [key, entry] of arr) { + this.set(key, entry.value, entry) + } + } + + dispose (v, k, reason) {} + + set (k, v, { + ttl = this.ttl, + noDisposeOnSet = this.noDisposeOnSet, + size = 0, + sizeCalculation = this.sizeCalculation, + } = {}) { + let index = this.size === 0 ? undefined : this.keyMap.get(k) + if (index === undefined) { + // addition + index = this.newIndex() + this.keyList[index] = k + this.valList[index] = v + this.keyMap.set(k, index) + this.next[this.tail] = index + this.prev[index] = this.tail + this.tail = index + this.size ++ + this.addItemSize(index, v, k, size, sizeCalculation) + } else { + // update + const oldVal = this.valList[index] + if (v !== oldVal) { + if (!noDisposeOnSet) { + this.dispose(oldVal, k, 'set') + if (this.disposeAfter) { + this.disposed.push([oldVal, k, 'set']) + } + } + this.removeItemSize(index) + this.valList[index] = v + this.addItemSize(index, v, k, size, sizeCalculation) + } + this.moveToTail(index) + } + if (ttl !== 0 && this.ttl === 0 && !this.ttls) { + this.initializeTTLTracking() + } + this.setItemTTL(index, ttl) + if (this.disposeAfter) { + while (this.disposed.length) { + this.disposeAfter(...this.disposed.shift()) + } + } + return this + } + + newIndex () { + if (this.size === 0) { + return this.tail + } + if (this.size === this.max) { + return this.evict() + } + if (this.free.length !== 0) { + return this.free.pop() + } + // initial fill, just keep writing down the list + return this.initialFill++ + } + + pop () { + if (this.size) { + const val = this.valList[this.head] + this.evict() + return val + } + } + + evict () { + const head = this.head + const k = this.keyList[head] + const v = this.valList[head] + this.dispose(v, k, 'evict') + if (this.disposeAfter) { + this.disposed.push([v, k, 'evict']) + } + this.removeItemSize(head) + this.head = this.next[head] + this.keyMap.delete(k) + this.size -- + return head + } + + has (k) { + return this.keyMap.has(k) && !this.isStale(this.keyMap.get(k)) + } + + // like get(), but without any LRU updating or TTL expiration + peek (k, { allowStale = this.allowStale } = {}) { + const index = this.keyMap.get(k) + if (index !== undefined && (allowStale || !this.isStale(index))) { + return this.valList[index] + } + } + + get (k, { + allowStale = this.allowStale, + updateAgeOnGet = this.updateAgeOnGet, + } = {}) { + const index = this.keyMap.get(k) + if (index !== undefined) { + if (this.isStale(index)) { + const value = allowStale ? this.valList[index] : undefined + this.delete(k) + return value + } else { + this.moveToTail(index) + if (updateAgeOnGet) { + this.updateItemAge(index) + } + return this.valList[index] + } + } + } + + connect (p, n) { + this.prev[n] = p + this.next[p] = n + } + + moveToTail (index) { + // if tail already, nothing to do + // if head, move head to next[index] + // else + // move next[prev[index]] to next[index] (head has no prev) + // move prev[next[index]] to prev[index] + // prev[index] = tail + // next[tail] = index + // tail = index + if (index !== this.tail) { + if (index === this.head) { + this.head = this.next[index] + } else { + this.connect(this.prev[index], this.next[index]) + } + this.connect(this.tail, index) + this.tail = index + } + } + + get del () { + deprecatedMethod('del', 'Please use cache.delete() instead.') + return this.delete + } + delete (k) { + let deleted = false + if (this.size !== 0) { + const index = this.keyMap.get(k) + if (index !== undefined) { + deleted = true + if (this.size === 1) { + this.clear() + } else { + this.removeItemSize(index) + this.dispose(this.valList[index], k, 'delete') + if (this.disposeAfter) { + this.disposed.push([this.valList[index], k, 'delete']) + } + this.keyMap.delete(k) + this.keyList[index] = null + this.valList[index] = null + if (index === this.tail) { + this.tail = this.prev[index] + } else if (index === this.head) { + this.head = this.next[index] + } else { + this.next[this.prev[index]] = this.next[index] + this.prev[this.next[index]] = this.prev[index] + } + this.size -- + this.free.push(index) + } + } + } + if (this.disposed) { + while (this.disposed.length) { + this.disposeAfter(...this.disposed.shift()) + } + } + return deleted + } + + clear () { + if (this.dispose !== LRUCache.prototype.dispose) { + for (const index of this.rindexes()) { + this.dispose(this.valList[index], this.keyList[index], 'delete') + } + } + if (this.disposeAfter) { + for (const index of this.rindexes()) { + this.disposed.push([this.valList[index], this.keyList[index], 'delete']) + } + } + this.keyMap.clear() + this.valList.fill(null) + this.keyList.fill(null) + if (this.ttls) { + this.ttls.fill(0) + this.starts.fill(0) + } + if (this.sizes) { + this.sizes.fill(0) + } + this.head = 0 + this.tail = 0 + this.initialFill = 1 + this.free.length = 0 + this.calculatedSize = 0 + this.size = 0 + if (this.disposed) { + while (this.disposed.length) { + this.disposeAfter(...this.disposed.shift()) + } + } + } + get reset () { + deprecatedMethod('reset', 'Please use cache.clear() instead.') + return this.clear + } + + get length () { + deprecatedProperty('length', 'Please use cache.size instead.') + return this.size + } +} + +module.exports = LRUCache diff --git a/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/package.json b/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/package.json new file mode 100644 index 0000000000..66dbbd9c11 --- /dev/null +++ b/deps/npm/node_modules/@npmcli/git/node_modules/lru-cache/package.json @@ -0,0 +1,34 @@ +{ + "name": "lru-cache", + "description": "A cache object that deletes the least-recently-used items.", + "version": "7.3.1", + "author": "Isaac Z. Schlueter <i@izs.me>", + "keywords": [ + "mru", + "lru", + "cache" + ], + "scripts": { + "test": "tap", + "snap": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags" + }, + "main": "index.js", + "repository": "git://github.com/isaacs/node-lru-cache.git", + "devDependencies": { + "benchmark": "^2.1.4", + "tap": "^15.1.6" + }, + "license": "ISC", + "files": [ + "index.js" + ], + "engines": { + "node": ">=12" + }, + "tap": { + "coverage-map": "map.js" + } +} diff --git a/deps/npm/node_modules/@npmcli/git/package.json b/deps/npm/node_modules/@npmcli/git/package.json index 9475da5007..02cd37fa22 100644 --- a/deps/npm/node_modules/@npmcli/git/package.json +++ b/deps/npm/node_modules/@npmcli/git/package.json @@ -1,44 +1,57 @@ { "name": "@npmcli/git", - "version": "2.1.0", + "version": "3.0.0", "main": "lib/index.js", "files": [ - "lib/*.js" + "bin", + "lib" ], "description": "a util for spawning git from npm CLI contexts", "repository": { "type": "git", "url": "git+https://github.com/npm/git" }, - "author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)", + "author": "GitHub Inc.", "license": "ISC", "scripts": { - "lint": "standard", + "lint": "eslint '**/*.js'", "lint:fix": "standard --fix", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", "preversion": "npm test", "snap": "tap", "test": "tap", - "posttest": "npm run lint" + "posttest": "npm run lint", + "postlint": "npm-template-check", + "template-copy": "npm-template-copy --force", + "lintfix": "npm run lint -- --fix" }, "tap": { "check-coverage": true, "coverage-map": "map.js" }, "devDependencies": { + "@npmcli/template-oss": "^2.7.1", "slash": "^3.0.0", "standard": "^16.0.3", - "tap": "^15.0.6" + "tap": "^15.1.6" }, "dependencies": { "@npmcli/promise-spawn": "^1.3.2", - "lru-cache": "^6.0.0", + "lru-cache": "^7.3.1", "mkdirp": "^1.0.4", - "npm-pick-manifest": "^6.1.1", + "npm-pick-manifest": "^7.0.0", + "proc-log": "^2.0.0", "promise-inflight": "^1.0.1", "promise-retry": "^2.0.1", "semver": "^7.3.5", "which": "^2.0.2" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16" + }, + "templateOSS": { + "windowsCI": false, + "version": "2.7.1" } } diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js index d0900e3732..5b58ef6370 100644 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js +++ b/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js @@ -22,8 +22,9 @@ class Advisory { this[_source] = source this[_options] = options this.name = name - if (!source.name) + if (!source.name) { source.name = name + } this.dependency = source.name @@ -70,11 +71,13 @@ class Advisory { // load up the data from a cache entry and a fetched packument load (cached, packument) { // basic data integrity gutcheck - if (!cached || typeof cached !== 'object') + if (!cached || typeof cached !== 'object') { throw new TypeError('invalid cached data, expected object') + } - if (!packument || typeof packument !== 'object') + if (!packument || typeof packument !== 'object') { throw new TypeError('invalid packument data, expected object') + } if (cached.id && cached.id !== this.id) { throw Object.assign(new Error('loading from incorrect cache entry'), { @@ -88,14 +91,16 @@ class Advisory { actual: packument.name, }) } - if (this[_packument]) + if (this[_packument]) { throw new Error('advisory object already loaded') + } // if we have a range from the initialization, and the cached // data has a *different* range, then we know we have to recalc. // just don't use the cached data, so we will definitely not match later - if (!this.range || cached.range && cached.range === this.range) + if (!this.range || cached.range && cached.range === this.range) { Object.assign(this, cached) + } this[_packument] = packument @@ -107,8 +112,9 @@ class Advisory { if (!this.versions.includes(v)) { versionsAdded.push(v) this.versions.push(v) - } else if (!pakuVersions.includes(v)) + } else if (!pakuVersions.includes(v)) { versionsRemoved.push(v) + } } // strip out any removed versions from our lists, and sort by semver @@ -138,14 +144,16 @@ class Advisory { this[_updated] = true // test any versions newly added - if (!unchanged || versionsAdded.length) + if (!unchanged || versionsAdded.length) { this[_testVersions](unchanged ? versionsAdded : this.versions) + } this.vulnerableVersions = semver.sort(this.vulnerableVersions, semverOpt) // metavulns have to calculate their range, since cache is invalidated // advisories just get their range from the advisory above - if (this.type === 'metavuln') + if (this.type === 'metavuln') { this[_calculateRange]() + } return this } @@ -170,10 +178,11 @@ class Advisory { } break } - if (vr.length > 1) + if (vr.length > 1) { vr[1] = this.versions[v] - else + } else { vr.push(this.versions[v]) + } v++ vulnVer++ } @@ -198,26 +207,30 @@ class Advisory { // we use the dependency version from the manifest. testVersion (version, spec = null) { const sv = String(version) - if (this[_versionVulnMemo].has(sv)) + if (this[_versionVulnMemo].has(sv)) { return this[_versionVulnMemo].get(sv) + } const result = this[_testVersion](version, spec) - if (result) + if (result) { this[_markVulnerable](version) + } this[_versionVulnMemo].set(sv, !!result) return result } [_markVulnerable] (version) { const sv = String(version) - if (!this.vulnerableVersions.includes(sv)) + if (!this.vulnerableVersions.includes(sv)) { this.vulnerableVersions.push(sv) + } } [_testVersion] (version, spec) { const sv = String(version) - if (this.vulnerableVersions.includes(sv)) + if (this.vulnerableVersions.includes(sv)) { return true + } if (this.type === 'advisory') { // advisory, just test range @@ -233,12 +246,14 @@ class Advisory { }, } - if (!spec) + if (!spec) { spec = getDepSpec(mani, this.dependency) + } // no dep, no vuln - if (spec === null) + if (spec === null) { return false + } if (!semver.validRange(spec, semverOpt)) { // not a semver range, nothing we can hope to do about it @@ -252,8 +267,9 @@ class Advisory { // try to pick a version of the dep that isn't vulnerable const avoid = this[_source].range - if (bundled) + if (bundled) { return semver.intersects(spec, avoid, semverOpt) + } return this[_source].testSpec(spec) } @@ -263,8 +279,9 @@ class Advisory { // consistent across multiple versions, so memoize this as well, in case // we're testing lots of versions. const memo = this[_specVulnMemo] - if (memo.has(spec)) + if (memo.has(spec)) { return memo.get(spec) + } const res = this[_testSpec](spec) memo.set(spec, res) @@ -274,10 +291,12 @@ class Advisory { [_testSpec] (spec) { for (const v of this.versions) { const satisfies = semver.satisfies(v, spec) - if (!satisfies) + if (!satisfies) { continue - if (!this.testVersion(v)) + } + if (!this.testVersion(v)) { return false + } } // either vulnerable, or not installable because nothing satisfied // either way, best avoided. @@ -285,8 +304,9 @@ class Advisory { } [_testVersions] (versions) { - if (!versions.length) + if (!versions.length) { return + } // set of lists of versions const versionSets = new Set() @@ -328,30 +348,34 @@ class Advisory { // version in the list, then start there instead. let h = 0 const origHeadVuln = this.testVersion(list[h]) - while (h < list.length && /-/.test(String(list[h]))) + while (h < list.length && /-/.test(String(list[h]))) { h++ + } // don't filter out the whole list! they might all be pr's - if (h === list.length) + if (h === list.length) { h = 0 - else if (origHeadVuln) { + } else if (origHeadVuln) { // if the original was vulnerable, assume so are all of these - for (let hh = 0; hh < h; hh++) + for (let hh = 0; hh < h; hh++) { this[_markVulnerable](list[hh]) + } } let t = list.length - 1 const origTailVuln = this.testVersion(list[t]) - while (t > h && /-/.test(String(list[t]))) + while (t > h && /-/.test(String(list[t]))) { t-- + } // don't filter out the whole list! might all be pr's - if (t === h) + if (t === h) { t = list.length - 1 - else if (origTailVuln) { + } else if (origTailVuln) { // if original tail was vulnerable, assume these are as well - for (let tt = list.length - 1; tt > t; tt--) + for (let tt = list.length - 1; tt > t; tt--) { this[_markVulnerable](list[tt]) + } } const headVuln = h === 0 ? origHeadVuln @@ -362,14 +386,16 @@ class Advisory { // if head and tail both vulnerable, whole list is thrown out if (headVuln && tailVuln) { - for (let v = h; v < t; v++) + for (let v = h; v < t; v++) { this[_markVulnerable](list[v]) + } continue } // if length is 2 or 1, then we marked them all already - if (t < h + 2) + if (t < h + 2) { continue + } const mid = Math.floor(list.length / 2) const pre = list.slice(0, mid) @@ -382,8 +408,9 @@ class Advisory { const midVuln = this.testVersion(pre[pre.length - 1]) while (/-/.test(String(pre[pre.length - 1]))) { const v = pre.pop() - if (midVuln) + if (midVuln) { this[_markVulnerable](v) + } } } @@ -391,8 +418,9 @@ class Advisory { const midVuln = this.testVersion(post[0]) while (/-/.test(String(post[0]))) { const v = post.shift() - if (midVuln) + if (midVuln) { this[_markVulnerable](v) + } } } diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/hash.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/hash.js index 79c0678c75..634bf99de0 100644 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/hash.js +++ b/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/hash.js @@ -1,5 +1,5 @@ -const {createHash} = require('crypto') +const { createHash } = require('crypto') -module.exports = ({name, source}) => createHash('sha512') +module.exports = ({ name, source }) => createHash('sha512') .update(JSON.stringify([name, source])) .digest('base64') diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/index.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/index.js index 02c1ed018b..668f55942c 100644 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/index.js +++ b/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/index.js @@ -4,7 +4,7 @@ const pacote = require('pacote') const cacache = require('cacache') const Advisory = require('./advisory.js') -const {homedir} = require('os') +const { homedir } = require('os') const jsonParse = require('json-parse-even-better-errors') const _packument = Symbol('packument') @@ -37,8 +37,9 @@ class Calculator { async calculate (name, source) { const k = `security-advisory:${name}:${source.id}` - if (this[_advisories].has(k)) + if (this[_advisories].has(k)) { return this[_advisories].get(k) + } const p = this[_calculate](name, source) this[_advisories].set(k, p) @@ -58,8 +59,9 @@ class Calculator { process.emit('time', `metavuln:load:${k}`) advisory.load(cached, packument) process.emit('timeEnd', `metavuln:load:${k}`) - if (advisory.updated) + if (advisory.updated) { await this[_cachePut](advisory) + } this[_advisories].set(k, advisory) process.emit('timeEnd', t) return advisory @@ -81,8 +83,9 @@ class Calculator { const key = `security-advisory:${name}:${id}` /* istanbul ignore if - should be impossible, since we memoize the * advisory object itself using the same key, just being cautious */ - if (this[_cacheData].has(key)) + if (this[_cacheData].has(key)) { return this[_cacheData].get(key) + } process.emit('time', `metavuln:cache:get:${key}`) const p = cacache.get(this[_cache], key, { ...this[_options] }) @@ -98,8 +101,9 @@ class Calculator { } async [_packument] (name) { - if (this[_packuments].has(name)) + if (this[_packuments].has(name)) { return this[_packuments].get(name) + } process.emit('time', `metavuln:packument:${name}`) const p = pacote.packument(name, { ...this[_options] }) diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json b/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json index 131cff6723..385a34b85a 100644 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json +++ b/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json @@ -1,13 +1,14 @@ { "name": "@npmcli/metavuln-calculator", - "version": "2.0.0", + "version": "3.0.0", "main": "lib/index.js", "files": [ + "bin", "lib" ], "description": "Calculate meta-vulnerabilities from package security advisories", "repository": "https://github.com/npm/metavuln-calculator", - "author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)", + "author": "GitHub Inc.", "license": "ISC", "scripts": { "test": "tap", @@ -18,29 +19,30 @@ "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", "eslint": "eslint", - "lint": "npm run eslint -- \"lib/**/*.js\" \"test/**/*.js\"", - "lintfix": "npm run lint -- --fix" + "lint": "eslint '**/*.js'", + "lintfix": "npm run lint -- --fix", + "postlint": "npm-template-check", + "template-copy": "npm-template-copy --force" }, "tap": { "check-coverage": true, "coverage-map": "map.js" }, "devDependencies": { - "eslint": "^7.20.0", - "eslint-plugin-import": "^2.22.1", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^4.3.1", - "eslint-plugin-standard": "^4.1.0", + "@npmcli/template-oss": "^2.7.1", "require-inject": "^1.4.4", - "tap": "^14.10.8" + "tap": "^15.1.6" }, "dependencies": { - "cacache": "^15.0.5", + "cacache": "^15.3.0", "json-parse-even-better-errors": "^2.3.1", - "pacote": "^12.0.0", - "semver": "^7.3.2" + "pacote": "^13.0.1", + "semver": "^7.3.5" }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16" + }, + "templateOSS": { + "version": "2.7.1" } } diff --git a/deps/npm/node_modules/@npmcli/run-script/lib/make-spawn-args.js b/deps/npm/node_modules/@npmcli/run-script/lib/make-spawn-args.js index 8f299954a7..9cfc84b0e0 100644 --- a/deps/npm/node_modules/@npmcli/run-script/lib/make-spawn-args.js +++ b/deps/npm/node_modules/@npmcli/run-script/lib/make-spawn-args.js @@ -1,7 +1,7 @@ /* eslint camelcase: "off" */ const isWindows = require('./is-windows.js') const setPATH = require('./set-path.js') -const {resolve} = require('path') +const { resolve } = require('path') const npm_config_node_gyp = require.resolve('node-gyp/bin/node-gyp.js') const makeSpawnArgs = options => { diff --git a/deps/npm/node_modules/@npmcli/run-script/lib/package-envs.js b/deps/npm/node_modules/@npmcli/run-script/lib/package-envs.js index 47791fb991..6b538e5024 100644 --- a/deps/npm/node_modules/@npmcli/run-script/lib/package-envs.js +++ b/deps/npm/node_modules/@npmcli/run-script/lib/package-envs.js @@ -6,12 +6,13 @@ const envVal = val => Array.isArray(val) ? val.map(v => envVal(v)).join('\n\n') const packageEnvs = (env, vals, prefix) => { for (const [key, val] of Object.entries(vals)) { - if (val === undefined) + if (val === undefined) { continue - else if (val && !Array.isArray(val) && typeof val === 'object') + } else if (val && !Array.isArray(val) && typeof val === 'object') { packageEnvs(env, val, `${prefix}${key}_`) - else + } else { env[`${prefix}${key}`] = envVal(val) + } } return env } diff --git a/deps/npm/node_modules/@npmcli/run-script/lib/run-script-pkg.js b/deps/npm/node_modules/@npmcli/run-script/lib/run-script-pkg.js index ccde173e01..a6fa4d2b38 100644 --- a/deps/npm/node_modules/@npmcli/run-script/lib/run-script-pkg.js +++ b/deps/npm/node_modules/@npmcli/run-script/lib/run-script-pkg.js @@ -26,25 +26,28 @@ const runScriptPkg = async options => { signalTimeout = 500, } = options - const {scripts = {}, gypfile} = pkg + const { scripts = {}, gypfile } = pkg let cmd = null - if (options.cmd) + if (options.cmd) { cmd = options.cmd - else if (pkg.scripts && pkg.scripts[event]) + } else if (pkg.scripts && pkg.scripts[event]) { cmd = pkg.scripts[event] + args.map(a => ` ${JSON.stringify(a)}`).join('') - else if ( // If there is no preinstall or install script, default to rebuilding node-gyp packages. + } else if ( + // If there is no preinstall or install script, default to rebuilding node-gyp packages. event === 'install' && !scripts.install && !scripts.preinstall && gypfile !== false && await isNodeGypPackage(path) - ) + ) { cmd = defaultGypInstallScript - else if (event === 'start' && await isServerPackage(path)) + } else if (event === 'start' && await isServerPackage(path)) { cmd = 'node server.js' + args.map(a => ` ${JSON.stringify(a)}`).join('') + } - if (!cmd) + if (!cmd) { return { code: 0, signal: null } + } if (stdio === 'inherit' && banner !== false) { // we're dumping to the parent's stdout, so print the banner @@ -66,11 +69,13 @@ const runScriptPkg = async options => { path, }) - if (stdio === 'inherit') + if (stdio === 'inherit') { signalManager.add(p.process) + } - if (p.stdin) + if (p.stdin) { p.stdin.end() + } return p.catch(er => { const { signal } = er @@ -80,8 +85,9 @@ const runScriptPkg = async options => { // this also keeps the node process open long enough to actually // get the signal, rather than terminating gracefully. return new Promise((res, rej) => setTimeout(() => rej(er), signalTimeout)) - } else + } else { throw er + } }) } diff --git a/deps/npm/node_modules/@npmcli/run-script/lib/run-script.js b/deps/npm/node_modules/@npmcli/run-script/lib/run-script.js index af33d2113f..6bb4a2e666 100644 --- a/deps/npm/node_modules/@npmcli/run-script/lib/run-script.js +++ b/deps/npm/node_modules/@npmcli/run-script/lib/run-script.js @@ -5,9 +5,9 @@ const isServerPackage = require('./is-server-package.js') const runScript = options => { validateOptions(options) - const {pkg, path} = options + const { pkg, path } = options return pkg ? runScriptPkg(options) - : rpj(path + '/package.json').then(pkg => runScriptPkg({...options, pkg})) + : rpj(path + '/package.json').then(pkg => runScriptPkg({ ...options, pkg })) } module.exports = Object.assign(runScript, { isServerPackage }) diff --git a/deps/npm/node_modules/@npmcli/run-script/lib/set-path.js b/deps/npm/node_modules/@npmcli/run-script/lib/set-path.js index d7bd2c2886..d5f8707efc 100644 --- a/deps/npm/node_modules/@npmcli/run-script/lib/set-path.js +++ b/deps/npm/node_modules/@npmcli/run-script/lib/set-path.js @@ -1,4 +1,4 @@ -const {resolve, dirname} = require('path') +const { resolve, dirname } = require('path') const isWindows = require('./is-windows.js') // the path here is relative, even though it does not need to be // in order to make the posix tests pass in windows @@ -34,8 +34,9 @@ const setPATH = (projectPath, env) => { // npm or arborist or whoever to just provide that by putting it in // the PATH environ, since that's preserved anyway. for (const key of Object.keys(env)) { - if (/^path$/i.test(key)) + if (/^path$/i.test(key)) { env[key] = pathVal + } } return env diff --git a/deps/npm/node_modules/@npmcli/run-script/lib/signal-manager.js b/deps/npm/node_modules/@npmcli/run-script/lib/signal-manager.js index 556e758c25..7e10f859e0 100644 --- a/deps/npm/node_modules/@npmcli/run-script/lib/signal-manager.js +++ b/deps/npm/node_modules/@npmcli/run-script/lib/signal-manager.js @@ -3,7 +3,7 @@ let handlersInstalled = false const forwardedSignals = [ 'SIGINT', - 'SIGTERM' + 'SIGTERM', ] const handleSignal = signal => { @@ -30,8 +30,9 @@ const cleanupListeners = () => { const add = proc => { runningProcs.add(proc) - if (!handlersInstalled) + if (!handlersInstalled) { setupListeners() + } proc.once('exit', () => { runningProcs.delete(proc) @@ -42,5 +43,5 @@ const add = proc => { module.exports = { add, handleSignal, - forwardedSignals + forwardedSignals, } diff --git a/deps/npm/node_modules/@npmcli/run-script/lib/validate-options.js b/deps/npm/node_modules/@npmcli/run-script/lib/validate-options.js index 48ac5c5d9e..8d855916ec 100644 --- a/deps/npm/node_modules/@npmcli/run-script/lib/validate-options.js +++ b/deps/npm/node_modules/@npmcli/run-script/lib/validate-options.js @@ -1,6 +1,7 @@ const validateOptions = options => { - if (typeof options !== 'object' || !options) + if (typeof options !== 'object' || !options) { throw new TypeError('invalid options object provided to runScript') + } const { event, @@ -12,20 +13,27 @@ const validateOptions = options => { cmd, } = options - if (!event || typeof event !== 'string') + if (!event || typeof event !== 'string') { throw new TypeError('valid event not provided to runScript') - if (!path || typeof path !== 'string') + } + if (!path || typeof path !== 'string') { throw new TypeError('valid path not provided to runScript') - if (scriptShell !== undefined && typeof scriptShell !== 'string') + } + if (scriptShell !== undefined && typeof scriptShell !== 'string') { throw new TypeError('invalid scriptShell option provided to runScript') - if (typeof env !== 'object' || !env) + } + if (typeof env !== 'object' || !env) { throw new TypeError('invalid env option provided to runScript') - if (typeof stdio !== 'string' && !Array.isArray(stdio)) + } + if (typeof stdio !== 'string' && !Array.isArray(stdio)) { throw new TypeError('invalid stdio option provided to runScript') - if (!Array.isArray(args) || args.some(a => typeof a !== 'string')) + } + if (!Array.isArray(args) || args.some(a => typeof a !== 'string')) { throw new TypeError('invalid args option provided to runScript') - if (cmd !== undefined && typeof cmd !== 'string') + } + if (cmd !== undefined && typeof cmd !== 'string') { throw new TypeError('invalid cmd option provided to runScript') + } } module.exports = validateOptions diff --git a/deps/npm/node_modules/@npmcli/run-script/package.json b/deps/npm/node_modules/@npmcli/run-script/package.json index 9e744e639e..bb069a7a0a 100644 --- a/deps/npm/node_modules/@npmcli/run-script/package.json +++ b/deps/npm/node_modules/@npmcli/run-script/package.json @@ -1,8 +1,8 @@ { "name": "@npmcli/run-script", - "version": "2.0.0", + "version": "3.0.0", "description": "Run a lifecycle script for a package (descendant of npm-lifecycle)", - "author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)", + "author": "GitHub Inc.", "license": "ISC", "scripts": { "test": "tap", @@ -10,36 +10,42 @@ "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", "eslint": "eslint", - "lint": "npm run eslint -- \"lib/**/*.js\"", - "lintfix": "npm run lint -- --fix" + "lint": "eslint '**/*.js'", + "lintfix": "npm run lint -- --fix", + "postlint": "npm-template-check", + "template-copy": "npm-template-copy --force", + "snap": "tap", + "posttest": "npm run lint" }, "tap": { "check-coverage": true, "coverage-map": "map.js" }, "devDependencies": { - "eslint": "^7.19.0", - "eslint-plugin-import": "^2.22.1", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^4.2.1", - "eslint-plugin-standard": "^5.0.0", - "minipass": "^3.1.1", + "@npmcli/template-oss": "^2.7.1", + "minipass": "^3.1.6", "require-inject": "^1.4.4", "tap": "^15.0.4" }, "dependencies": { - "@npmcli/node-gyp": "^1.0.2", + "@npmcli/node-gyp": "^1.0.3", "@npmcli/promise-spawn": "^1.3.2", - "node-gyp": "^8.2.0", - "read-package-json-fast": "^2.0.1" + "node-gyp": "^8.4.1", + "read-package-json-fast": "^2.0.3" }, "files": [ - "lib/**/*.js", - "lib/node-gyp-bin" + "bin", + "lib" ], "main": "lib/run-script.js", "repository": { "type": "git", "url": "git+https://github.com/npm/run-script.git" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16" + }, + "templateOSS": { + "version": "2.7.1" } } diff --git a/deps/npm/node_modules/ansi-regex/index.js b/deps/npm/node_modules/ansi-regex/index.js deleted file mode 100644 index b9574ed7e8..0000000000 --- a/deps/npm/node_modules/ansi-regex/index.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; -module.exports = function () { - return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g; -}; diff --git a/deps/npm/node_modules/ansi-regex/license b/deps/npm/node_modules/ansi-regex/license deleted file mode 100644 index 654d0bfe94..0000000000 --- a/deps/npm/node_modules/ansi-regex/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/deps/npm/node_modules/ansi-regex/package.json b/deps/npm/node_modules/ansi-regex/package.json deleted file mode 100644 index eb44fb5c1f..0000000000 --- a/deps/npm/node_modules/ansi-regex/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "ansi-regex", - "version": "2.1.1", - "description": "Regular expression for matching ANSI escape codes", - "license": "MIT", - "repository": "chalk/ansi-regex", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "maintainers": [ - "Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)", - "Joshua Appelman <jappelman@xebia.com> (jbnicolai.com)", - "JD Ballard <i.am.qix@gmail.com> (github.com/qix-)" - ], - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "xo && ava --verbose", - "view-supported": "node fixtures/view-codes.js" - }, - "files": [ - "index.js" - ], - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "text", - "regex", - "regexp", - "re", - "match", - "test", - "find", - "pattern" - ], - "devDependencies": { - "ava": "0.17.0", - "xo": "0.16.0" - }, - "xo": { - "rules": { - "guard-for-in": 0, - "no-loop-func": 0 - } - } -} diff --git a/deps/npm/node_modules/ansi-regex/readme.md b/deps/npm/node_modules/ansi-regex/readme.md deleted file mode 100644 index 6a928edf0f..0000000000 --- a/deps/npm/node_modules/ansi-regex/readme.md +++ /dev/null @@ -1,39 +0,0 @@ -# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex) - -> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -``` -$ npm install --save ansi-regex -``` - - -## Usage - -```js -const ansiRegex = require('ansi-regex'); - -ansiRegex().test('\u001b[4mcake\u001b[0m'); -//=> true - -ansiRegex().test('cake'); -//=> false - -'\u001b[4mcake\u001b[0m'.match(ansiRegex()); -//=> ['\u001b[4m', '\u001b[0m'] -``` - -## FAQ - -### Why do you test for codes not in the ECMA 48 standard? - -Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. If I recall correctly, we test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. - -On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/deps/npm/node_modules/cli-columns/node_modules/is-fullwidth-code-point/index.js b/deps/npm/node_modules/cli-columns/node_modules/is-fullwidth-code-point/index.js deleted file mode 100644 index 671f97f760..0000000000 --- a/deps/npm/node_modules/cli-columns/node_modules/is-fullwidth-code-point/index.js +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-disable yoda */ -'use strict'; - -const isFullwidthCodePoint = codePoint => { - if (Number.isNaN(codePoint)) { - return false; - } - - // Code points are derived from: - // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt - if ( - codePoint >= 0x1100 && ( - codePoint <= 0x115F || // Hangul Jamo - codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET - codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET - // CJK Radicals Supplement .. Enclosed CJK Letters and Months - (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) || - // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A - (0x3250 <= codePoint && codePoint <= 0x4DBF) || - // CJK Unified Ideographs .. Yi Radicals - (0x4E00 <= codePoint && codePoint <= 0xA4C6) || - // Hangul Jamo Extended-A - (0xA960 <= codePoint && codePoint <= 0xA97C) || - // Hangul Syllables - (0xAC00 <= codePoint && codePoint <= 0xD7A3) || - // CJK Compatibility Ideographs - (0xF900 <= codePoint && codePoint <= 0xFAFF) || - // Vertical Forms - (0xFE10 <= codePoint && codePoint <= 0xFE19) || - // CJK Compatibility Forms .. Small Form Variants - (0xFE30 <= codePoint && codePoint <= 0xFE6B) || - // Halfwidth and Fullwidth Forms - (0xFF01 <= codePoint && codePoint <= 0xFF60) || - (0xFFE0 <= codePoint && codePoint <= 0xFFE6) || - // Kana Supplement - (0x1B000 <= codePoint && codePoint <= 0x1B001) || - // Enclosed Ideographic Supplement - (0x1F200 <= codePoint && codePoint <= 0x1F251) || - // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane - (0x20000 <= codePoint && codePoint <= 0x3FFFD) - ) - ) { - return true; - } - - return false; -}; - -module.exports = isFullwidthCodePoint; -module.exports.default = isFullwidthCodePoint; diff --git a/deps/npm/node_modules/cli-columns/node_modules/is-fullwidth-code-point/package.json b/deps/npm/node_modules/cli-columns/node_modules/is-fullwidth-code-point/package.json deleted file mode 100644 index 2137e888fa..0000000000 --- a/deps/npm/node_modules/cli-columns/node_modules/is-fullwidth-code-point/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "is-fullwidth-code-point", - "version": "3.0.0", - "description": "Check if the character represented by a given Unicode code point is fullwidth", - "license": "MIT", - "repository": "sindresorhus/is-fullwidth-code-point", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd-check" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "fullwidth", - "full-width", - "full", - "width", - "unicode", - "character", - "string", - "codepoint", - "code", - "point", - "is", - "detect", - "check" - ], - "devDependencies": { - "ava": "^1.3.1", - "tsd-check": "^0.5.0", - "xo": "^0.24.0" - } -} diff --git a/deps/npm/node_modules/cli-columns/node_modules/string-width/index.js b/deps/npm/node_modules/cli-columns/node_modules/string-width/index.js deleted file mode 100644 index f4d261a96a..0000000000 --- a/deps/npm/node_modules/cli-columns/node_modules/string-width/index.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; -const stripAnsi = require('strip-ansi'); -const isFullwidthCodePoint = require('is-fullwidth-code-point'); -const emojiRegex = require('emoji-regex'); - -const stringWidth = string => { - if (typeof string !== 'string' || string.length === 0) { - return 0; - } - - string = stripAnsi(string); - - if (string.length === 0) { - return 0; - } - - string = string.replace(emojiRegex(), ' '); - - let width = 0; - - for (let i = 0; i < string.length; i++) { - const code = string.codePointAt(i); - - // Ignore control characters - if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) { - continue; - } - - // Ignore combining characters - if (code >= 0x300 && code <= 0x36F) { - continue; - } - - // Surrogates - if (code > 0xFFFF) { - i++; - } - - width += isFullwidthCodePoint(code) ? 2 : 1; - } - - return width; -}; - -module.exports = stringWidth; -// TODO: remove this in the next major version -module.exports.default = stringWidth; diff --git a/deps/npm/node_modules/cli-columns/node_modules/string-width/package.json b/deps/npm/node_modules/cli-columns/node_modules/string-width/package.json deleted file mode 100644 index 28ba7b4cae..0000000000 --- a/deps/npm/node_modules/cli-columns/node_modules/string-width/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "string-width", - "version": "4.2.3", - "description": "Get the visual width of a string - the number of columns required to display it", - "license": "MIT", - "repository": "sindresorhus/string-width", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "string", - "character", - "unicode", - "width", - "visual", - "column", - "columns", - "fullwidth", - "full-width", - "full", - "ansi", - "escape", - "codes", - "cli", - "command-line", - "terminal", - "console", - "cjk", - "chinese", - "japanese", - "korean", - "fixed-width" - ], - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.1", - "xo": "^0.24.0" - } -} diff --git a/deps/npm/node_modules/cli-table3/node_modules/ansi-regex/license b/deps/npm/node_modules/cli-table3/node_modules/ansi-regex/license deleted file mode 100644 index e7af2f7710..0000000000 --- a/deps/npm/node_modules/cli-table3/node_modules/ansi-regex/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/cli-table3/node_modules/ansi-regex/readme.md b/deps/npm/node_modules/cli-table3/node_modules/ansi-regex/readme.md deleted file mode 100644 index 3c2b77c435..0000000000 --- a/deps/npm/node_modules/cli-table3/node_modules/ansi-regex/readme.md +++ /dev/null @@ -1,78 +0,0 @@ -# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex) - -> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -``` -$ npm install ansi-regex -``` - - -## Usage - -```js -const ansiRegex = require('ansi-regex'); - -ansiRegex().test('\u001B[4mcake\u001B[0m'); -//=> true - -ansiRegex().test('cake'); -//=> false - -'\u001B[4mcake\u001B[0m'.match(ansiRegex()); -//=> ['\u001B[4m', '\u001B[0m'] - -'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); -//=> ['\u001B[4m'] - -'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); -//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] -``` - - -## API - -### ansiRegex(options?) - -Returns a regex for matching ANSI escape codes. - -#### options - -Type: `object` - -##### onlyFirst - -Type: `boolean`<br> -Default: `false` *(Matches any ANSI escape codes in a string)* - -Match only the first ANSI escape. - - -## FAQ - -### Why do you test for codes not in the ECMA 48 standard? - -Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. - -On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. - - -## Maintainers - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Josh Junon](https://github.com/qix-) - - ---- - -<div align="center"> - <b> - <a href="https://tidelift.com/subscription/pkg/npm-ansi-regex?utm_source=npm-ansi-regex&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> - </b> - <br> - <sub> - Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. - </sub> -</div> diff --git a/deps/npm/node_modules/cli-table3/node_modules/is-fullwidth-code-point/index.d.ts b/deps/npm/node_modules/cli-table3/node_modules/is-fullwidth-code-point/index.d.ts deleted file mode 100644 index 729d202051..0000000000 --- a/deps/npm/node_modules/cli-table3/node_modules/is-fullwidth-code-point/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** -Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms). - -@param codePoint - The [code point](https://en.wikipedia.org/wiki/Code_point) of a character. - -@example -``` -import isFullwidthCodePoint from 'is-fullwidth-code-point'; - -isFullwidthCodePoint('谢'.codePointAt(0)); -//=> true - -isFullwidthCodePoint('a'.codePointAt(0)); -//=> false -``` -*/ -export default function isFullwidthCodePoint(codePoint: number): boolean; diff --git a/deps/npm/node_modules/cli-table3/node_modules/is-fullwidth-code-point/index.js b/deps/npm/node_modules/cli-table3/node_modules/is-fullwidth-code-point/index.js deleted file mode 100644 index 671f97f760..0000000000 --- a/deps/npm/node_modules/cli-table3/node_modules/is-fullwidth-code-point/index.js +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-disable yoda */ -'use strict'; - -const isFullwidthCodePoint = codePoint => { - if (Number.isNaN(codePoint)) { - return false; - } - - // Code points are derived from: - // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt - if ( - codePoint >= 0x1100 && ( - codePoint <= 0x115F || // Hangul Jamo - codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET - codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET - // CJK Radicals Supplement .. Enclosed CJK Letters and Months - (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) || - // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A - (0x3250 <= codePoint && codePoint <= 0x4DBF) || - // CJK Unified Ideographs .. Yi Radicals - (0x4E00 <= codePoint && codePoint <= 0xA4C6) || - // Hangul Jamo Extended-A - (0xA960 <= codePoint && codePoint <= 0xA97C) || - // Hangul Syllables - (0xAC00 <= codePoint && codePoint <= 0xD7A3) || - // CJK Compatibility Ideographs - (0xF900 <= codePoint && codePoint <= 0xFAFF) || - // Vertical Forms - (0xFE10 <= codePoint && codePoint <= 0xFE19) || - // CJK Compatibility Forms .. Small Form Variants - (0xFE30 <= codePoint && codePoint <= 0xFE6B) || - // Halfwidth and Fullwidth Forms - (0xFF01 <= codePoint && codePoint <= 0xFF60) || - (0xFFE0 <= codePoint && codePoint <= 0xFFE6) || - // Kana Supplement - (0x1B000 <= codePoint && codePoint <= 0x1B001) || - // Enclosed Ideographic Supplement - (0x1F200 <= codePoint && codePoint <= 0x1F251) || - // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane - (0x20000 <= codePoint && codePoint <= 0x3FFFD) - ) - ) { - return true; - } - - return false; -}; - -module.exports = isFullwidthCodePoint; -module.exports.default = isFullwidthCodePoint; diff --git a/deps/npm/node_modules/cli-table3/node_modules/is-fullwidth-code-point/license b/deps/npm/node_modules/cli-table3/node_modules/is-fullwidth-code-point/license deleted file mode 100644 index e7af2f7710..0000000000 --- a/deps/npm/node_modules/cli-table3/node_modules/is-fullwidth-code-point/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/cli-table3/node_modules/is-fullwidth-code-point/package.json b/deps/npm/node_modules/cli-table3/node_modules/is-fullwidth-code-point/package.json deleted file mode 100644 index 2137e888fa..0000000000 --- a/deps/npm/node_modules/cli-table3/node_modules/is-fullwidth-code-point/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "is-fullwidth-code-point", - "version": "3.0.0", - "description": "Check if the character represented by a given Unicode code point is fullwidth", - "license": "MIT", - "repository": "sindresorhus/is-fullwidth-code-point", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd-check" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "fullwidth", - "full-width", - "full", - "width", - "unicode", - "character", - "string", - "codepoint", - "code", - "point", - "is", - "detect", - "check" - ], - "devDependencies": { - "ava": "^1.3.1", - "tsd-check": "^0.5.0", - "xo": "^0.24.0" - } -} diff --git a/deps/npm/node_modules/cli-table3/node_modules/is-fullwidth-code-point/readme.md b/deps/npm/node_modules/cli-table3/node_modules/is-fullwidth-code-point/readme.md deleted file mode 100644 index 4236bba980..0000000000 --- a/deps/npm/node_modules/cli-table3/node_modules/is-fullwidth-code-point/readme.md +++ /dev/null @@ -1,39 +0,0 @@ -# is-fullwidth-code-point [![Build Status](https://travis-ci.org/sindresorhus/is-fullwidth-code-point.svg?branch=master)](https://travis-ci.org/sindresorhus/is-fullwidth-code-point) - -> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) - - -## Install - -``` -$ npm install is-fullwidth-code-point -``` - - -## Usage - -```js -const isFullwidthCodePoint = require('is-fullwidth-code-point'); - -isFullwidthCodePoint('谢'.codePointAt(0)); -//=> true - -isFullwidthCodePoint('a'.codePointAt(0)); -//=> false -``` - - -## API - -### isFullwidthCodePoint(codePoint) - -#### codePoint - -Type: `number` - -The [code point](https://en.wikipedia.org/wiki/Code_point) of a character. - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/deps/npm/node_modules/cli-table3/node_modules/string-width/index.d.ts b/deps/npm/node_modules/cli-table3/node_modules/string-width/index.d.ts deleted file mode 100644 index 12b5309751..0000000000 --- a/deps/npm/node_modules/cli-table3/node_modules/string-width/index.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -declare const stringWidth: { - /** - Get the visual width of a string - the number of columns required to display it. - - Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width. - - @example - ``` - import stringWidth = require('string-width'); - - stringWidth('a'); - //=> 1 - - stringWidth('古'); - //=> 2 - - stringWidth('\u001B[1m古\u001B[22m'); - //=> 2 - ``` - */ - (string: string): number; - - // TODO: remove this in the next major version, refactor the whole definition to: - // declare function stringWidth(string: string): number; - // export = stringWidth; - default: typeof stringWidth; -} - -export = stringWidth; diff --git a/deps/npm/node_modules/cli-table3/node_modules/string-width/index.js b/deps/npm/node_modules/cli-table3/node_modules/string-width/index.js deleted file mode 100644 index f4d261a96a..0000000000 --- a/deps/npm/node_modules/cli-table3/node_modules/string-width/index.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; -const stripAnsi = require('strip-ansi'); -const isFullwidthCodePoint = require('is-fullwidth-code-point'); -const emojiRegex = require('emoji-regex'); - -const stringWidth = string => { - if (typeof string !== 'string' || string.length === 0) { - return 0; - } - - string = stripAnsi(string); - - if (string.length === 0) { - return 0; - } - - string = string.replace(emojiRegex(), ' '); - - let width = 0; - - for (let i = 0; i < string.length; i++) { - const code = string.codePointAt(i); - - // Ignore control characters - if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) { - continue; - } - - // Ignore combining characters - if (code >= 0x300 && code <= 0x36F) { - continue; - } - - // Surrogates - if (code > 0xFFFF) { - i++; - } - - width += isFullwidthCodePoint(code) ? 2 : 1; - } - - return width; -}; - -module.exports = stringWidth; -// TODO: remove this in the next major version -module.exports.default = stringWidth; diff --git a/deps/npm/node_modules/cli-table3/node_modules/string-width/license b/deps/npm/node_modules/cli-table3/node_modules/string-width/license deleted file mode 100644 index e7af2f7710..0000000000 --- a/deps/npm/node_modules/cli-table3/node_modules/string-width/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/cli-table3/node_modules/string-width/package.json b/deps/npm/node_modules/cli-table3/node_modules/string-width/package.json deleted file mode 100644 index b9b20caaf6..0000000000 --- a/deps/npm/node_modules/cli-table3/node_modules/string-width/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "string-width", - "version": "4.2.2", - "description": "Get the visual width of a string - the number of columns required to display it", - "license": "MIT", - "repository": "sindresorhus/string-width", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "string", - "character", - "unicode", - "width", - "visual", - "column", - "columns", - "fullwidth", - "full-width", - "full", - "ansi", - "escape", - "codes", - "cli", - "command-line", - "terminal", - "console", - "cjk", - "chinese", - "japanese", - "korean", - "fixed-width" - ], - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.1", - "xo": "^0.24.0" - } -} diff --git a/deps/npm/node_modules/cli-table3/node_modules/string-width/readme.md b/deps/npm/node_modules/cli-table3/node_modules/string-width/readme.md deleted file mode 100644 index bdd314129c..0000000000 --- a/deps/npm/node_modules/cli-table3/node_modules/string-width/readme.md +++ /dev/null @@ -1,50 +0,0 @@ -# string-width - -> Get the visual width of a string - the number of columns required to display it - -Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width. - -Useful to be able to measure the actual width of command-line output. - - -## Install - -``` -$ npm install string-width -``` - - -## Usage - -```js -const stringWidth = require('string-width'); - -stringWidth('a'); -//=> 1 - -stringWidth('古'); -//=> 2 - -stringWidth('\u001B[1m古\u001B[22m'); -//=> 2 -``` - - -## Related - -- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module -- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string -- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string - - ---- - -<div align="center"> - <b> - <a href="https://tidelift.com/subscription/pkg/npm-string-width?utm_source=npm-string-width&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> - </b> - <br> - <sub> - Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. - </sub> -</div> diff --git a/deps/npm/node_modules/cli-table3/node_modules/strip-ansi/license b/deps/npm/node_modules/cli-table3/node_modules/strip-ansi/license deleted file mode 100644 index e7af2f7710..0000000000 --- a/deps/npm/node_modules/cli-table3/node_modules/strip-ansi/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/cli-table3/node_modules/strip-ansi/readme.md b/deps/npm/node_modules/cli-table3/node_modules/strip-ansi/readme.md deleted file mode 100644 index 7c4b56d46d..0000000000 --- a/deps/npm/node_modules/cli-table3/node_modules/strip-ansi/readme.md +++ /dev/null @@ -1,46 +0,0 @@ -# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi) - -> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string - - -## Install - -``` -$ npm install strip-ansi -``` - - -## Usage - -```js -const stripAnsi = require('strip-ansi'); - -stripAnsi('\u001B[4mUnicorn\u001B[0m'); -//=> 'Unicorn' - -stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); -//=> 'Click' -``` - - -## strip-ansi for enterprise - -Available as part of the Tidelift Subscription. - -The maintainers of strip-ansi and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-strip-ansi?utm_source=npm-strip-ansi&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - - -## Related - -- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module -- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Streaming version of this module -- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes -- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes -- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right - - -## Maintainers - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Josh Junon](https://github.com/qix-) - diff --git a/deps/npm/node_modules/columnify/Readme.md b/deps/npm/node_modules/columnify/Readme.md index 4a37928a76..868a4a4aa0 100644 --- a/deps/npm/node_modules/columnify/Readme.md +++ b/deps/npm/node_modules/columnify/Readme.md @@ -1,13 +1,8 @@ # columnify -[![NPM](https://nodei.co/npm/columnify.png?downloads=true&downloadRank=true&stars=true&chrome)](https://nodei.co/npm-dl/columnify/) -[![NPM](https://nodei.co/npm-dl/columnify.png?months=3&height=3&chrome)](https://nodei.co/npm/columnify/) - -[![Build Status](https://img.shields.io/travis/timoxley/columnify.svg?style=flat)](https://travis-ci.org/timoxley/columnify) +[![Columnify Unit Tests](https://github.com/timoxley/columnify/actions/workflows/test.yml/badge.svg)](https://github.com/timoxley/columnify/actions/workflows/test.yml) [![NPM Version](https://img.shields.io/npm/v/columnify.svg?style=flat)](https://npmjs.org/package/columnify) [![License](http://img.shields.io/npm/l/columnify.svg?style=flat)](LICENSE) -[![Dependency Status](https://david-dm.org/timoxley/columnify.svg)](https://david-dm.org/timoxley/columnify) -[![devDependency Status](https://david-dm.org/timoxley/columnify/dev-status.svg)](https://david-dm.org/timoxley/columnify#info=devDependencies) Create text-based columns suitable for console output from objects or arrays of objects. @@ -22,10 +17,10 @@ Designed to [handle sensible wrapping in npm search results](https://github.com/ ![npm-tidy-search](https://f.cloud.github.com/assets/43438/1848959/ae02ad04-76a1-11e3-8255-4781debffc26.gif) -## Installation & Update +## Installation ``` -$ npm install --save columnify@latest +$ npm install columnify ``` ## Usage @@ -379,7 +374,7 @@ var columns = columnify(data, { ``` ### Transforming Column Data and Headers -If you need to modify the presentation of column content or heading content there are two useful options for doing that: `dataTransform` and `headerTransform`. Both of these take a function and need to return a valid string. +If you need to modify the presentation of column content or heading content there are two useful options for doing that: `dataTransform` and `headingTransform`. Both of these take a function and need to return a valid string. ```javascript var columns = columnify([{ @@ -392,6 +387,9 @@ var columns = columnify([{ dataTransform: function(data) { return data.toLowerCase() }, + headingTransform: function(heading) { + return heading.toLowerCase() + }, config: { name: { headingTransform: function(heading) { @@ -404,7 +402,7 @@ var columns = columnify([{ ``` #### Output: ``` -*MODULE NAME* DESCRIPTION +*MODULE NAME* description mod1 some description text. module-two some slightly longer description text. ``` @@ -450,19 +448,26 @@ module-one some description 0.0.1 ``` project : columnify - repo age : 1 year, 2 months - active : 32 days - commits : 120 - files : 54 + repo age : 8 years + active : 47 days + commits : 180 + files : 57 authors : - 90 Tim Oxley 75.0% - 8 Tim 6.7% - 7 Arjun Mehta 5.8% - 6 Dany 5.0% - 5 Wei Gao 4.2% - 2 Dany Shaanan 1.7% - 1 Seth Miller 0.8% - 1 Isaac Z. Schlueter 0.8% + 123 Tim Oxley 68.3% + 11 Nicholas Hoffman 6.1% + 8 Tim 4.4% + 7 Arjun Mehta 3.9% + 6 Dany 3.3% + 5 Tim Kevin Oxley 2.8% + 5 Wei Gao 2.8% + 4 Matias Singers 2.2% + 3 Michael Kriese 1.7% + 2 sreekanth370 1.1% + 2 Dany Shaanan 1.1% + 1 Tim Malone 0.6% + 1 Seth Miller 0.6% + 1 andyfusniak 0.6% + 1 Isaac Z. Schlueter 0.6% ``` ## License diff --git a/deps/npm/node_modules/columnify/columnify.js b/deps/npm/node_modules/columnify/columnify.js index 334d5509ae..dcef9236e1 100644 --- a/deps/npm/node_modules/columnify/columnify.js +++ b/deps/npm/node_modules/columnify/columnify.js @@ -2,14 +2,13 @@ var wcwidth = require('./width'); -var _require = require('./utils'); - -var padRight = _require.padRight; -var padCenter = _require.padCenter; -var padLeft = _require.padLeft; -var splitIntoLines = _require.splitIntoLines; -var splitLongWords = _require.splitLongWords; -var truncateString = _require.truncateString; +var _require = require('./utils'), + padRight = _require.padRight, + padCenter = _require.padCenter, + padLeft = _require.padLeft, + splitIntoLines = _require.splitIntoLines, + splitLongWords = _require.splitLongWords, + truncateString = _require.truncateString; var DEFAULT_HEADING_TRANSFORM = function DEFAULT_HEADING_TRANSFORM(key) { return key.toUpperCase(); @@ -33,7 +32,8 @@ var DEFAULTS = Object.freeze({ }); module.exports = function (items) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var columnConfigs = options.config || {}; delete options.config; // remove config so doesn't appear on every column. @@ -244,9 +244,7 @@ function createRows(items, columns, columnNames, paddingChr) { */ function mixin() { - var _Object; - - if (Object.assign) return (_Object = Object).assign.apply(_Object, arguments); + if (Object.assign) return Object.assign.apply(Object, arguments); return ObjectAssign.apply(undefined, arguments); } diff --git a/deps/npm/node_modules/cli-table3/node_modules/ansi-regex/index.d.ts b/deps/npm/node_modules/columnify/node_modules/ansi-regex/index.d.ts index 2dbf6af2b6..2dbf6af2b6 100644 --- a/deps/npm/node_modules/cli-table3/node_modules/ansi-regex/index.d.ts +++ b/deps/npm/node_modules/columnify/node_modules/ansi-regex/index.d.ts diff --git a/deps/npm/node_modules/cli-table3/node_modules/ansi-regex/index.js b/deps/npm/node_modules/columnify/node_modules/ansi-regex/index.js index 35054aa677..616ff837d3 100644 --- a/deps/npm/node_modules/cli-table3/node_modules/ansi-regex/index.js +++ b/deps/npm/node_modules/columnify/node_modules/ansi-regex/index.js @@ -2,7 +2,7 @@ module.exports = ({onlyFirst = false} = {}) => { const pattern = [ - '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', + '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' ].join('|'); diff --git a/deps/npm/node_modules/cli-columns/node_modules/is-fullwidth-code-point/license b/deps/npm/node_modules/columnify/node_modules/ansi-regex/license index e7af2f7710..e7af2f7710 100644 --- a/deps/npm/node_modules/cli-columns/node_modules/is-fullwidth-code-point/license +++ b/deps/npm/node_modules/columnify/node_modules/ansi-regex/license diff --git a/deps/npm/node_modules/cli-table3/node_modules/ansi-regex/package.json b/deps/npm/node_modules/columnify/node_modules/ansi-regex/package.json index 7af801f352..017f53116a 100644 --- a/deps/npm/node_modules/cli-table3/node_modules/ansi-regex/package.json +++ b/deps/npm/node_modules/columnify/node_modules/ansi-regex/package.json @@ -1,6 +1,6 @@ { "name": "ansi-regex", - "version": "5.0.0", + "version": "5.0.1", "description": "Regular expression for matching ANSI escape codes", "license": "MIT", "repository": "chalk/ansi-regex", diff --git a/deps/npm/node_modules/cli-table3/node_modules/strip-ansi/index.d.ts b/deps/npm/node_modules/columnify/node_modules/strip-ansi/index.d.ts index 907fccc292..907fccc292 100644 --- a/deps/npm/node_modules/cli-table3/node_modules/strip-ansi/index.d.ts +++ b/deps/npm/node_modules/columnify/node_modules/strip-ansi/index.d.ts diff --git a/deps/npm/node_modules/cli-table3/node_modules/strip-ansi/index.js b/deps/npm/node_modules/columnify/node_modules/strip-ansi/index.js index 9a593dfcd1..9a593dfcd1 100644 --- a/deps/npm/node_modules/cli-table3/node_modules/strip-ansi/index.js +++ b/deps/npm/node_modules/columnify/node_modules/strip-ansi/index.js diff --git a/deps/npm/node_modules/cli-columns/node_modules/string-width/license b/deps/npm/node_modules/columnify/node_modules/strip-ansi/license index e7af2f7710..e7af2f7710 100644 --- a/deps/npm/node_modules/cli-columns/node_modules/string-width/license +++ b/deps/npm/node_modules/columnify/node_modules/strip-ansi/license diff --git a/deps/npm/node_modules/cli-table3/node_modules/strip-ansi/package.json b/deps/npm/node_modules/columnify/node_modules/strip-ansi/package.json index 65a6c95161..1a41108d42 100644 --- a/deps/npm/node_modules/cli-table3/node_modules/strip-ansi/package.json +++ b/deps/npm/node_modules/columnify/node_modules/strip-ansi/package.json @@ -1,6 +1,6 @@ { "name": "strip-ansi", - "version": "6.0.0", + "version": "6.0.1", "description": "Strip ANSI escape codes from a string", "license": "MIT", "repository": "chalk/strip-ansi", @@ -44,7 +44,7 @@ "text" ], "dependencies": { - "ansi-regex": "^5.0.0" + "ansi-regex": "^5.0.1" }, "devDependencies": { "ava": "^2.4.0", diff --git a/deps/npm/node_modules/columnify/package.json b/deps/npm/node_modules/columnify/package.json index 4bff7f5268..29565407a8 100644 --- a/deps/npm/node_modules/columnify/package.json +++ b/deps/npm/node_modules/columnify/package.json @@ -1,6 +1,6 @@ { "name": "columnify", - "version": "1.5.4", + "version": "1.6.0", "description": "Render data in text columns. Supports in-column text-wrap.", "main": "columnify.js", "scripts": { @@ -17,11 +17,10 @@ "author": "Tim Oxley", "license": "MIT", "devDependencies": { - "babel": "^6.3.26", - "babel-cli": "^6.3.17", + "babel-cli": "^6.26.0", "babel-preset-es2015": "^6.3.13", "chalk": "^1.1.1", - "tap-spec": "^4.1.1", + "tap-spec": "^5.0.0", "tape": "^4.4.0" }, "repository": { @@ -41,8 +40,11 @@ "url": "https://github.com/timoxley/columnify/issues" }, "homepage": "https://github.com/timoxley/columnify", + "engines": { + "node": ">=8.0.0" + }, "dependencies": { - "strip-ansi": "^3.0.0", + "strip-ansi": "^6.0.1", "wcwidth": "^1.0.0" }, "directories": { diff --git a/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/index.d.ts b/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/index.d.ts deleted file mode 100644 index 729d202051..0000000000 --- a/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** -Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms). - -@param codePoint - The [code point](https://en.wikipedia.org/wiki/Code_point) of a character. - -@example -``` -import isFullwidthCodePoint from 'is-fullwidth-code-point'; - -isFullwidthCodePoint('谢'.codePointAt(0)); -//=> true - -isFullwidthCodePoint('a'.codePointAt(0)); -//=> false -``` -*/ -export default function isFullwidthCodePoint(codePoint: number): boolean; diff --git a/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/index.js b/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/index.js deleted file mode 100644 index 671f97f760..0000000000 --- a/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/index.js +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-disable yoda */ -'use strict'; - -const isFullwidthCodePoint = codePoint => { - if (Number.isNaN(codePoint)) { - return false; - } - - // Code points are derived from: - // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt - if ( - codePoint >= 0x1100 && ( - codePoint <= 0x115F || // Hangul Jamo - codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET - codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET - // CJK Radicals Supplement .. Enclosed CJK Letters and Months - (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) || - // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A - (0x3250 <= codePoint && codePoint <= 0x4DBF) || - // CJK Unified Ideographs .. Yi Radicals - (0x4E00 <= codePoint && codePoint <= 0xA4C6) || - // Hangul Jamo Extended-A - (0xA960 <= codePoint && codePoint <= 0xA97C) || - // Hangul Syllables - (0xAC00 <= codePoint && codePoint <= 0xD7A3) || - // CJK Compatibility Ideographs - (0xF900 <= codePoint && codePoint <= 0xFAFF) || - // Vertical Forms - (0xFE10 <= codePoint && codePoint <= 0xFE19) || - // CJK Compatibility Forms .. Small Form Variants - (0xFE30 <= codePoint && codePoint <= 0xFE6B) || - // Halfwidth and Fullwidth Forms - (0xFF01 <= codePoint && codePoint <= 0xFF60) || - (0xFFE0 <= codePoint && codePoint <= 0xFFE6) || - // Kana Supplement - (0x1B000 <= codePoint && codePoint <= 0x1B001) || - // Enclosed Ideographic Supplement - (0x1F200 <= codePoint && codePoint <= 0x1F251) || - // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane - (0x20000 <= codePoint && codePoint <= 0x3FFFD) - ) - ) { - return true; - } - - return false; -}; - -module.exports = isFullwidthCodePoint; -module.exports.default = isFullwidthCodePoint; diff --git a/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/license b/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/license deleted file mode 100644 index e7af2f7710..0000000000 --- a/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/package.json b/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/package.json deleted file mode 100644 index 2137e888fa..0000000000 --- a/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "is-fullwidth-code-point", - "version": "3.0.0", - "description": "Check if the character represented by a given Unicode code point is fullwidth", - "license": "MIT", - "repository": "sindresorhus/is-fullwidth-code-point", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd-check" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "fullwidth", - "full-width", - "full", - "width", - "unicode", - "character", - "string", - "codepoint", - "code", - "point", - "is", - "detect", - "check" - ], - "devDependencies": { - "ava": "^1.3.1", - "tsd-check": "^0.5.0", - "xo": "^0.24.0" - } -} diff --git a/deps/npm/node_modules/gauge/node_modules/string-width/index.d.ts b/deps/npm/node_modules/gauge/node_modules/string-width/index.d.ts deleted file mode 100644 index 12b5309751..0000000000 --- a/deps/npm/node_modules/gauge/node_modules/string-width/index.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -declare const stringWidth: { - /** - Get the visual width of a string - the number of columns required to display it. - - Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width. - - @example - ``` - import stringWidth = require('string-width'); - - stringWidth('a'); - //=> 1 - - stringWidth('古'); - //=> 2 - - stringWidth('\u001B[1m古\u001B[22m'); - //=> 2 - ``` - */ - (string: string): number; - - // TODO: remove this in the next major version, refactor the whole definition to: - // declare function stringWidth(string: string): number; - // export = stringWidth; - default: typeof stringWidth; -} - -export = stringWidth; diff --git a/deps/npm/node_modules/gauge/node_modules/string-width/index.js b/deps/npm/node_modules/gauge/node_modules/string-width/index.js deleted file mode 100644 index f4d261a96a..0000000000 --- a/deps/npm/node_modules/gauge/node_modules/string-width/index.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; -const stripAnsi = require('strip-ansi'); -const isFullwidthCodePoint = require('is-fullwidth-code-point'); -const emojiRegex = require('emoji-regex'); - -const stringWidth = string => { - if (typeof string !== 'string' || string.length === 0) { - return 0; - } - - string = stripAnsi(string); - - if (string.length === 0) { - return 0; - } - - string = string.replace(emojiRegex(), ' '); - - let width = 0; - - for (let i = 0; i < string.length; i++) { - const code = string.codePointAt(i); - - // Ignore control characters - if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) { - continue; - } - - // Ignore combining characters - if (code >= 0x300 && code <= 0x36F) { - continue; - } - - // Surrogates - if (code > 0xFFFF) { - i++; - } - - width += isFullwidthCodePoint(code) ? 2 : 1; - } - - return width; -}; - -module.exports = stringWidth; -// TODO: remove this in the next major version -module.exports.default = stringWidth; diff --git a/deps/npm/node_modules/gauge/node_modules/string-width/license b/deps/npm/node_modules/gauge/node_modules/string-width/license deleted file mode 100644 index e7af2f7710..0000000000 --- a/deps/npm/node_modules/gauge/node_modules/string-width/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/gauge/node_modules/string-width/package.json b/deps/npm/node_modules/gauge/node_modules/string-width/package.json deleted file mode 100644 index 28ba7b4cae..0000000000 --- a/deps/npm/node_modules/gauge/node_modules/string-width/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "string-width", - "version": "4.2.3", - "description": "Get the visual width of a string - the number of columns required to display it", - "license": "MIT", - "repository": "sindresorhus/string-width", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "string", - "character", - "unicode", - "width", - "visual", - "column", - "columns", - "fullwidth", - "full-width", - "full", - "ansi", - "escape", - "codes", - "cli", - "command-line", - "terminal", - "console", - "cjk", - "chinese", - "japanese", - "korean", - "fixed-width" - ], - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.1", - "xo": "^0.24.0" - } -} diff --git a/deps/npm/node_modules/init-package-json/lib/init-package-json.js b/deps/npm/node_modules/init-package-json/lib/init-package-json.js index bee79351ca..f13a34ce6f 100644 --- a/deps/npm/node_modules/init-package-json/lib/init-package-json.js +++ b/deps/npm/node_modules/init-package-json/lib/init-package-json.js @@ -127,7 +127,7 @@ function init (dir, input, config, cb) { return write(true) } console.log('About to write to %s:\n\n%s\n', packageFile, d) - read({prompt: 'Is this OK? ', default: 'yes'}, function (er, ok) { + read({ prompt: 'Is this OK? ', default: 'yes' }, function (er, ok) { if (er) { return cb(er) } diff --git a/deps/npm/node_modules/init-package-json/package.json b/deps/npm/node_modules/init-package-json/package.json index 6d642f6cf6..7649c503de 100644 --- a/deps/npm/node_modules/init-package-json/package.json +++ b/deps/npm/node_modules/init-package-json/package.json @@ -1,6 +1,6 @@ { "name": "init-package-json", - "version": "2.0.5", + "version": "3.0.0", "main": "lib/init-package-json.js", "scripts": { "test": "tap", @@ -11,7 +11,8 @@ "postlint": "npm-template-check", "lintfix": "npm run lint -- --fix", "snap": "tap", - "posttest": "npm run lint" + "posttest": "npm run lint", + "template-copy": "npm-template-copy --force" }, "repository": { "type": "git", @@ -21,21 +22,21 @@ "license": "ISC", "description": "A node module to get your node module started", "dependencies": { - "npm-package-arg": "^8.1.5", + "npm-package-arg": "^9.0.0", "promzard": "^0.3.0", - "read": "~1.0.1", + "read": "^1.0.7", "read-package-json": "^4.1.1", "semver": "^7.3.5", "validate-npm-package-license": "^3.0.4", "validate-npm-package-name": "^3.0.0" }, "devDependencies": { - "@npmcli/config": "^2.1.0", - "@npmcli/template-oss": "^1.0.3", - "tap": "^15.0.9" + "@npmcli/config": "^4.0.0", + "@npmcli/template-oss": "^2.7.1", + "tap": "^15.1.6" }, "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16" }, "tap": { "statements": "94", @@ -56,5 +57,7 @@ "bin", "lib" ], - "templateVersion": "1.0.3" + "templateOSS": { + "version": "2.7.1" + } } diff --git a/deps/npm/node_modules/cli-columns/node_modules/is-fullwidth-code-point/index.d.ts b/deps/npm/node_modules/is-fullwidth-code-point/index.d.ts index 729d202051..729d202051 100644 --- a/deps/npm/node_modules/cli-columns/node_modules/is-fullwidth-code-point/index.d.ts +++ b/deps/npm/node_modules/is-fullwidth-code-point/index.d.ts diff --git a/deps/npm/node_modules/is-fullwidth-code-point/index.js b/deps/npm/node_modules/is-fullwidth-code-point/index.js index d506327c3e..671f97f760 100644 --- a/deps/npm/node_modules/is-fullwidth-code-point/index.js +++ b/deps/npm/node_modules/is-fullwidth-code-point/index.js @@ -1,42 +1,43 @@ -'use strict'; /* eslint-disable yoda */ -module.exports = x => { - if (Number.isNaN(x)) { +'use strict'; + +const isFullwidthCodePoint = codePoint => { + if (Number.isNaN(codePoint)) { return false; } - // code points are derived from: + // Code points are derived from: // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt if ( - x >= 0x1100 && ( - x <= 0x115f || // Hangul Jamo - x === 0x2329 || // LEFT-POINTING ANGLE BRACKET - x === 0x232a || // RIGHT-POINTING ANGLE BRACKET + codePoint >= 0x1100 && ( + codePoint <= 0x115F || // Hangul Jamo + codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET + codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET // CJK Radicals Supplement .. Enclosed CJK Letters and Months - (0x2e80 <= x && x <= 0x3247 && x !== 0x303f) || + (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A - (0x3250 <= x && x <= 0x4dbf) || + (0x3250 <= codePoint && codePoint <= 0x4DBF) || // CJK Unified Ideographs .. Yi Radicals - (0x4e00 <= x && x <= 0xa4c6) || + (0x4E00 <= codePoint && codePoint <= 0xA4C6) || // Hangul Jamo Extended-A - (0xa960 <= x && x <= 0xa97c) || + (0xA960 <= codePoint && codePoint <= 0xA97C) || // Hangul Syllables - (0xac00 <= x && x <= 0xd7a3) || + (0xAC00 <= codePoint && codePoint <= 0xD7A3) || // CJK Compatibility Ideographs - (0xf900 <= x && x <= 0xfaff) || + (0xF900 <= codePoint && codePoint <= 0xFAFF) || // Vertical Forms - (0xfe10 <= x && x <= 0xfe19) || + (0xFE10 <= codePoint && codePoint <= 0xFE19) || // CJK Compatibility Forms .. Small Form Variants - (0xfe30 <= x && x <= 0xfe6b) || + (0xFE30 <= codePoint && codePoint <= 0xFE6B) || // Halfwidth and Fullwidth Forms - (0xff01 <= x && x <= 0xff60) || - (0xffe0 <= x && x <= 0xffe6) || + (0xFF01 <= codePoint && codePoint <= 0xFF60) || + (0xFFE0 <= codePoint && codePoint <= 0xFFE6) || // Kana Supplement - (0x1b000 <= x && x <= 0x1b001) || + (0x1B000 <= codePoint && codePoint <= 0x1B001) || // Enclosed Ideographic Supplement - (0x1f200 <= x && x <= 0x1f251) || + (0x1F200 <= codePoint && codePoint <= 0x1F251) || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane - (0x20000 <= x && x <= 0x3fffd) + (0x20000 <= codePoint && codePoint <= 0x3FFFD) ) ) { return true; @@ -44,3 +45,6 @@ module.exports = x => { return false; }; + +module.exports = isFullwidthCodePoint; +module.exports.default = isFullwidthCodePoint; diff --git a/deps/npm/node_modules/is-fullwidth-code-point/license b/deps/npm/node_modules/is-fullwidth-code-point/license index 654d0bfe94..e7af2f7710 100644 --- a/deps/npm/node_modules/is-fullwidth-code-point/license +++ b/deps/npm/node_modules/is-fullwidth-code-point/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/is-fullwidth-code-point/package.json b/deps/npm/node_modules/is-fullwidth-code-point/package.json index 3049d9e030..2137e888fa 100644 --- a/deps/npm/node_modules/is-fullwidth-code-point/package.json +++ b/deps/npm/node_modules/is-fullwidth-code-point/package.json @@ -1,45 +1,42 @@ { - "name": "is-fullwidth-code-point", - "version": "2.0.0", - "description": "Check if the character represented by a given Unicode code point is fullwidth", - "license": "MIT", - "repository": "sindresorhus/is-fullwidth-code-point", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=4" - }, - "scripts": { - "test": "xo && ava" - }, - "files": [ - "index.js" - ], - "keywords": [ - "fullwidth", - "full-width", - "full", - "width", - "unicode", - "character", - "char", - "string", - "str", - "codepoint", - "code", - "point", - "is", - "detect", - "check" - ], - "devDependencies": { - "ava": "*", - "xo": "*" - }, - "xo": { - "esnext": true - } + "name": "is-fullwidth-code-point", + "version": "3.0.0", + "description": "Check if the character represented by a given Unicode code point is fullwidth", + "license": "MIT", + "repository": "sindresorhus/is-fullwidth-code-point", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd-check" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "fullwidth", + "full-width", + "full", + "width", + "unicode", + "character", + "string", + "codepoint", + "code", + "point", + "is", + "detect", + "check" + ], + "devDependencies": { + "ava": "^1.3.1", + "tsd-check": "^0.5.0", + "xo": "^0.24.0" + } } diff --git a/deps/npm/node_modules/is-fullwidth-code-point/readme.md b/deps/npm/node_modules/is-fullwidth-code-point/readme.md index 093b0281b2..4236bba980 100644 --- a/deps/npm/node_modules/is-fullwidth-code-point/readme.md +++ b/deps/npm/node_modules/is-fullwidth-code-point/readme.md @@ -6,7 +6,7 @@ ## Install ``` -$ npm install --save is-fullwidth-code-point +$ npm install is-fullwidth-code-point ``` @@ -15,23 +15,23 @@ $ npm install --save is-fullwidth-code-point ```js const isFullwidthCodePoint = require('is-fullwidth-code-point'); -isFullwidthCodePoint('谢'.codePointAt()); +isFullwidthCodePoint('谢'.codePointAt(0)); //=> true -isFullwidthCodePoint('a'.codePointAt()); +isFullwidthCodePoint('a'.codePointAt(0)); //=> false ``` ## API -### isFullwidthCodePoint(input) +### isFullwidthCodePoint(codePoint) -#### input +#### codePoint Type: `number` -[Code point](https://en.wikipedia.org/wiki/Code_point) of a character. +The [code point](https://en.wikipedia.org/wiki/Code_point) of a character. ## License diff --git a/deps/npm/node_modules/libnpmaccess/package.json b/deps/npm/node_modules/libnpmaccess/package.json index 760da6cc1b..33085ffd7c 100644 --- a/deps/npm/node_modules/libnpmaccess/package.json +++ b/deps/npm/node_modules/libnpmaccess/package.json @@ -1,6 +1,6 @@ { "name": "libnpmaccess", - "version": "5.0.1", + "version": "6.0.0", "description": "programmatic library for `npm access` commands", "author": "GitHub Inc.", "license": "ISC", @@ -31,8 +31,8 @@ "dependencies": { "aproba": "^2.0.0", "minipass": "^3.1.1", - "npm-package-arg": "^8.1.2", - "npm-registry-fetch": "^12.0.1" + "npm-package-arg": "^9.0.0", + "npm-registry-fetch": "^13.0.0" }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16" diff --git a/deps/npm/node_modules/libnpmdiff/package.json b/deps/npm/node_modules/libnpmdiff/package.json index 24846f39cf..fbfc1eaf9c 100644 --- a/deps/npm/node_modules/libnpmdiff/package.json +++ b/deps/npm/node_modules/libnpmdiff/package.json @@ -1,6 +1,6 @@ { "name": "libnpmdiff", - "version": "3.0.0", + "version": "4.0.0", "description": "The registry diff", "repository": "https://github.com/npm/libnpmdiff", "main": "lib/index.js", @@ -53,8 +53,8 @@ "binary-extensions": "^2.2.0", "diff": "^5.0.0", "minimatch": "^3.0.4", - "npm-package-arg": "^8.1.4", - "pacote": "^12.0.0", + "npm-package-arg": "^9.0.0", + "pacote": "^13.0.2", "tar": "^6.1.0" }, "templateOSS": { diff --git a/deps/npm/node_modules/libnpmexec/README.md b/deps/npm/node_modules/libnpmexec/README.md index a48552714d..74d6f5211e 100644 --- a/deps/npm/node_modules/libnpmexec/README.md +++ b/deps/npm/node_modules/libnpmexec/README.md @@ -35,7 +35,6 @@ await libexec({ - `color`: Output should use color? **Boolean**, defaults to `false` - `localBin`: Location to the `node_modules/.bin` folder of the local project to start scanning for bin files **String**, defaults to `./node_modules/.bin`. **libexec** will walk up the directory structure looking for `node_modules/.bin` folders in parent folders that might satisfy the current `arg` and will use that bin if found. - `locationMsg`: Overrides "at location" message when entering interactive mode **String** - - `log`: Sets an optional logger **Object**, defaults to `proc-log` module usage. - `globalBin`: Location to the global space bin folder, same as: `$(npm bin -g)` **String**, defaults to empty string. - `output`: A function to print output to **Function** - `packages`: A list of packages to be used (possibly fetch from the registry) **Array<String>**, defaults to `[]` diff --git a/deps/npm/node_modules/libnpmexec/lib/index.js b/deps/npm/node_modules/libnpmexec/lib/index.js index facafb035d..3c7be11491 100644 --- a/deps/npm/node_modules/libnpmexec/lib/index.js +++ b/deps/npm/node_modules/libnpmexec/lib/index.js @@ -4,7 +4,8 @@ const read = promisify(require('read')) const Arborist = require('@npmcli/arborist') const ciDetect = require('@npmcli/ci-detect') -const logger = require('proc-log') +const log = require('proc-log') +const npmlog = require('npmlog') const mkdirp = require('mkdirp-infer-owner') const npa = require('npm-package-arg') const pacote = require('pacote') @@ -39,7 +40,6 @@ const exec = async (opts) => { yes = undefined, ...flatOptions } = opts - const log = flatOptions.log || logger // dereferences values because we manipulate it later const packages = [..._packages] @@ -50,7 +50,6 @@ const exec = async (opts) => { color, flatOptions, locationMsg, - log, output, path, pathArr, @@ -169,9 +168,7 @@ const exec = async (opts) => { const prompt = `Need to install the following packages:\n${ addList }Ok to proceed? ` - if (typeof log.clearProgress === 'function') { - log.clearProgress() - } + npmlog.clearProgress() const confirm = await read({ prompt, default: 'y' }) if (confirm.trim().toLowerCase().charAt(0) !== 'y') { throw new Error('canceled') diff --git a/deps/npm/node_modules/libnpmexec/lib/run-script.js b/deps/npm/node_modules/libnpmexec/lib/run-script.js index 851f5c60bd..97543e6ff0 100644 --- a/deps/npm/node_modules/libnpmexec/lib/run-script.js +++ b/deps/npm/node_modules/libnpmexec/lib/run-script.js @@ -4,6 +4,8 @@ const chalk = require('chalk') const ciDetect = require('@npmcli/ci-detect') const runScript = require('@npmcli/run-script') const readPackageJson = require('read-package-json-fast') +const npmlog = require('npmlog') +const log = require('proc-log') const noTTY = require('./no-tty.js') const nocolor = { @@ -18,7 +20,6 @@ const run = async ({ color, flatOptions, locationMsg, - log, output = () => {}, path, pathArr, @@ -41,9 +42,7 @@ const run = async ({ }, } - if (log && log.disableProgress) { - log.disableProgress() - } + npmlog.disableProgress() try { if (script === scriptShell) { @@ -80,9 +79,7 @@ const run = async ({ stdio: 'inherit', }) } finally { - if (log && log.enableProgress) { - log.enableProgress() - } + npmlog.enableProgress() } } diff --git a/deps/npm/node_modules/libnpmexec/package.json b/deps/npm/node_modules/libnpmexec/package.json index 4410f187ec..9ce05bf968 100644 --- a/deps/npm/node_modules/libnpmexec/package.json +++ b/deps/npm/node_modules/libnpmexec/package.json @@ -1,6 +1,6 @@ { "name": "libnpmexec", - "version": "3.0.3", + "version": "4.0.0", "files": [ "bin", "lib" @@ -50,14 +50,15 @@ "tap": "^15.0.6" }, "dependencies": { - "@npmcli/arborist": "^4.0.0", + "@npmcli/arborist": "^5.0.0", "@npmcli/ci-detect": "^2.0.0", - "@npmcli/run-script": "^2.0.0", + "@npmcli/run-script": "^3.0.0", "chalk": "^4.1.0", "mkdirp-infer-owner": "^2.0.0", - "npm-package-arg": "^8.1.2", - "pacote": "^12.0.0", - "proc-log": "^1.0.0", + "npm-package-arg": "^9.0.0", + "npmlog": "^6.0.1", + "pacote": "^13.0.2", + "proc-log": "^2.0.0", "read": "^1.0.7", "read-package-json-fast": "^2.0.2", "walk-up-path": "^1.0.0" diff --git a/deps/npm/node_modules/libnpmfund/package.json b/deps/npm/node_modules/libnpmfund/package.json index 4b7ffc8f30..eae757f04e 100644 --- a/deps/npm/node_modules/libnpmfund/package.json +++ b/deps/npm/node_modules/libnpmfund/package.json @@ -1,6 +1,6 @@ { "name": "libnpmfund", - "version": "2.0.2", + "version": "3.0.0", "main": "lib/index.js", "files": [ "bin", @@ -46,7 +46,7 @@ "tap": "^15.0.9" }, "dependencies": { - "@npmcli/arborist": "^4.0.0" + "@npmcli/arborist": "^5.0.0" }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16" diff --git a/deps/npm/node_modules/libnpmhook/package.json b/deps/npm/node_modules/libnpmhook/package.json index 4f30555273..8b749d1809 100644 --- a/deps/npm/node_modules/libnpmhook/package.json +++ b/deps/npm/node_modules/libnpmhook/package.json @@ -1,6 +1,6 @@ { "name": "libnpmhook", - "version": "7.0.1", + "version": "8.0.0", "description": "programmatic API for managing npm registry hooks", "main": "lib/index.js", "files": [ @@ -34,7 +34,7 @@ "license": "ISC", "dependencies": { "aproba": "^2.0.0", - "npm-registry-fetch": "^12.0.1" + "npm-registry-fetch": "^13.0.0" }, "devDependencies": { "@npmcli/template-oss": "^2.4.2", diff --git a/deps/npm/node_modules/libnpmorg/package.json b/deps/npm/node_modules/libnpmorg/package.json index 5c4909b1c9..913030066d 100644 --- a/deps/npm/node_modules/libnpmorg/package.json +++ b/deps/npm/node_modules/libnpmorg/package.json @@ -1,6 +1,6 @@ { "name": "libnpmorg", - "version": "3.0.1", + "version": "4.0.0", "description": "Programmatic api for `npm org` commands", "author": "GitHub Inc.", "main": "lib/index.js", @@ -45,7 +45,7 @@ "homepage": "https://npmjs.com/package/libnpmorg", "dependencies": { "aproba": "^2.0.0", - "npm-registry-fetch": "^12.0.1" + "npm-registry-fetch": "^13.0.0" }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16" diff --git a/deps/npm/node_modules/libnpmpack/lib/index.js b/deps/npm/node_modules/libnpmpack/lib/index.js index a2c95cf938..dc9cfd2c4e 100644 --- a/deps/npm/node_modules/libnpmpack/lib/index.js +++ b/deps/npm/node_modules/libnpmpack/lib/index.js @@ -16,7 +16,7 @@ async function pack (spec = 'file:.', opts = {}) { // Default to true if no log options passed, set to false if we're in silent // mode - const banner = !opts.log || (opts.log.level !== 'silent') + const banner = !opts.silent if (spec.type === 'directory') { // prepack diff --git a/deps/npm/node_modules/libnpmpack/package.json b/deps/npm/node_modules/libnpmpack/package.json index 7317c272f7..579b4efa23 100644 --- a/deps/npm/node_modules/libnpmpack/package.json +++ b/deps/npm/node_modules/libnpmpack/package.json @@ -1,6 +1,6 @@ { "name": "libnpmpack", - "version": "3.1.0", + "version": "4.0.0", "description": "Programmatic API for the bits behind npm pack", "author": "GitHub Inc.", "main": "lib/index.js", @@ -38,9 +38,9 @@ "bugs": "https://github.com/npm/libnpmpack/issues", "homepage": "https://npmjs.com/package/libnpmpack", "dependencies": { - "@npmcli/run-script": "^2.0.0", - "npm-package-arg": "^8.1.0", - "pacote": "^12.0.0" + "@npmcli/run-script": "^3.0.0", + "npm-package-arg": "^9.0.0", + "pacote": "^13.0.2" }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16" diff --git a/deps/npm/node_modules/libnpmpublish/lib/publish.js b/deps/npm/node_modules/libnpmpublish/lib/publish.js index f6d88f7325..75b764c989 100644 --- a/deps/npm/node_modules/libnpmpublish/lib/publish.js +++ b/deps/npm/node_modules/libnpmpublish/lib/publish.js @@ -58,7 +58,7 @@ Remove the 'private' field from the package.json to publish it.`), ...opts, query: { write: true }, }) - const newMetadata = patchMetadata(current, metadata, opts) + const newMetadata = patchMetadata(current, metadata) return npmFetch(spec.escapedName, { ...opts, method: 'PUT', diff --git a/deps/npm/node_modules/libnpmpublish/package.json b/deps/npm/node_modules/libnpmpublish/package.json index 3fd2d6d5a3..2e15c08f17 100644 --- a/deps/npm/node_modules/libnpmpublish/package.json +++ b/deps/npm/node_modules/libnpmpublish/package.json @@ -1,6 +1,6 @@ { "name": "libnpmpublish", - "version": "5.0.1", + "version": "6.0.0", "description": "Programmatic API for the bits behind npm publish and unpublish", "author": "GitHub Inc.", "main": "lib/index.js", @@ -30,7 +30,7 @@ }, "devDependencies": { "@npmcli/template-oss": "^2.4.2", - "libnpmpack": "^3.0.0", + "libnpmpack": "^4.0.0", "lodash.clonedeep": "^4.5.0", "nock": "^12.0.2", "tap": "^15" @@ -43,8 +43,8 @@ "homepage": "https://npmjs.com/package/libnpmpublish", "dependencies": { "normalize-package-data": "^3.0.2", - "npm-package-arg": "^8.1.2", - "npm-registry-fetch": "^12.0.1", + "npm-package-arg": "^9.0.0", + "npm-registry-fetch": "^13.0.0", "semver": "^7.1.3", "ssri": "^8.0.1" }, diff --git a/deps/npm/node_modules/libnpmsearch/package.json b/deps/npm/node_modules/libnpmsearch/package.json index f524426dc6..ba296930c2 100644 --- a/deps/npm/node_modules/libnpmsearch/package.json +++ b/deps/npm/node_modules/libnpmsearch/package.json @@ -1,6 +1,6 @@ { "name": "libnpmsearch", - "version": "4.0.1", + "version": "5.0.0", "description": "Programmatic API for searching in npm and compatible registries.", "author": "GitHub Inc.", "main": "lib/index.js", @@ -41,7 +41,7 @@ "bugs": "https://github.com/npm/libnpmsearch/issues", "homepage": "https://npmjs.com/package/libnpmsearch", "dependencies": { - "npm-registry-fetch": "^12.0.1" + "npm-registry-fetch": "^13.0.0" }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16" diff --git a/deps/npm/node_modules/libnpmteam/package.json b/deps/npm/node_modules/libnpmteam/package.json index 23903551aa..1c4633accb 100644 --- a/deps/npm/node_modules/libnpmteam/package.json +++ b/deps/npm/node_modules/libnpmteam/package.json @@ -1,7 +1,7 @@ { "name": "libnpmteam", "description": "npm Team management APIs", - "version": "3.0.1", + "version": "4.0.0", "author": "GitHub Inc.", "license": "ISC", "main": "lib/index.js", @@ -32,7 +32,7 @@ "homepage": "https://npmjs.com/package/libnpmteam", "dependencies": { "aproba": "^2.0.0", - "npm-registry-fetch": "^12.0.1" + "npm-registry-fetch": "^13.0.0" }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16" diff --git a/deps/npm/node_modules/libnpmversion/README.md b/deps/npm/node_modules/libnpmversion/README.md index e82e7cd6f8..165d16a2b6 100644 --- a/deps/npm/node_modules/libnpmversion/README.md +++ b/deps/npm/node_modules/libnpmversion/README.md @@ -27,6 +27,7 @@ npmVersion(arg, { ignoreScripts: false, // do not run pre/post/version lifecycle scripts scriptShell: '/bin/bash', // shell to run lifecycle scripts in message: 'v%s', // message for tag and commit, replace %s with the version + silent: false, // passed to @npmcli/run-script to control whether it logs }).then(newVersion => { console.error('version updated!', newVersion) }) diff --git a/deps/npm/node_modules/libnpmversion/lib/enforce-clean.js b/deps/npm/node_modules/libnpmversion/lib/enforce-clean.js index 6103da9bd9..721f146221 100644 --- a/deps/npm/node_modules/libnpmversion/lib/enforce-clean.js +++ b/deps/npm/node_modules/libnpmversion/lib/enforce-clean.js @@ -1,9 +1,10 @@ const git = require('@npmcli/git') +const log = require('proc-log') // returns true if it's cool to do git stuff // throws if it's unclean, and not forced. module.exports = async opts => { - const { force, log } = opts + const { force } = opts let hadError = false const clean = await git.isClean(opts).catch(er => { if (er.code === 'ENOGIT') { diff --git a/deps/npm/node_modules/libnpmversion/lib/index.js b/deps/npm/node_modules/libnpmversion/lib/index.js index 683941cdea..95acd11b5e 100644 --- a/deps/npm/node_modules/libnpmversion/lib/index.js +++ b/deps/npm/node_modules/libnpmversion/lib/index.js @@ -1,6 +1,5 @@ const readJson = require('./read-json.js') const version = require('./version.js') -const proclog = require('./proc-log.js') module.exports = async (newversion, opts = {}) => { const { @@ -15,8 +14,8 @@ module.exports = async (newversion, opts = {}) => { ignoreScripts = false, scriptShell = undefined, preid = null, - log = proclog, message = 'v%s', + silent, } = opts const pkg = opts.pkg || await readJson(path + '/package.json') @@ -35,7 +34,7 @@ module.exports = async (newversion, opts = {}) => { scriptShell, preid, pkg, - log, message, + silent, }) } diff --git a/deps/npm/node_modules/libnpmversion/lib/version.js b/deps/npm/node_modules/libnpmversion/lib/version.js index 116a375553..12be89b040 100644 --- a/deps/npm/node_modules/libnpmversion/lib/version.js +++ b/deps/npm/node_modules/libnpmversion/lib/version.js @@ -8,6 +8,7 @@ const readJson = require('./read-json.js') const git = require('@npmcli/git') const commit = require('./commit.js') const tag = require('./tag.js') +const log = require('proc-log') const runScript = require('@npmcli/run-script') @@ -19,7 +20,7 @@ module.exports = async (newversion, opts) => { ignoreScripts, preid, pkg, - log, + silent, } = opts const { valid, clean, inc } = semver @@ -64,7 +65,7 @@ module.exports = async (newversion, opts) => { pkg, stdio: 'inherit', event: 'preversion', - banner: log.level !== 'silent', + banner: !silent, env: { npm_old_version: current, npm_new_version: newV, @@ -98,7 +99,7 @@ module.exports = async (newversion, opts) => { pkg, stdio: 'inherit', event: 'version', - banner: log.level !== 'silent', + banner: !silent, env: { npm_old_version: current, npm_new_version: newV, @@ -125,7 +126,7 @@ module.exports = async (newversion, opts) => { pkg, stdio: 'inherit', event: 'postversion', - banner: log.level !== 'silent', + banner: !silent, env: { npm_old_version: current, npm_new_version: newV, diff --git a/deps/npm/node_modules/libnpmversion/package.json b/deps/npm/node_modules/libnpmversion/package.json index 6d7823f5d0..e0f5097a3f 100644 --- a/deps/npm/node_modules/libnpmversion/package.json +++ b/deps/npm/node_modules/libnpmversion/package.json @@ -1,6 +1,6 @@ { "name": "libnpmversion", - "version": "2.0.2", + "version": "3.0.0", "main": "lib/index.js", "files": [ "bin", @@ -34,9 +34,10 @@ "tap": "^15" }, "dependencies": { - "@npmcli/git": "^2.0.7", - "@npmcli/run-script": "^2.0.0", + "@npmcli/git": "^3.0.0", + "@npmcli/run-script": "^3.0.0", "json-parse-even-better-errors": "^2.3.1", + "proc-log": "^2.0.0", "semver": "^7.3.5", "stringify-package": "^1.0.1" }, diff --git a/deps/npm/node_modules/npm-package-arg/npa.js b/deps/npm/node_modules/npm-package-arg/lib/npa.js index 191befeb5e..cc1eddaec7 100644 --- a/deps/npm/node_modules/npm-package-arg/npa.js +++ b/deps/npm/node_modules/npm-package-arg/lib/npa.js @@ -20,30 +20,32 @@ function npa (arg, where) { let name let spec if (typeof arg === 'object') { - if (arg instanceof Result && (!where || where === arg.where)) + if (arg instanceof Result && (!where || where === arg.where)) { return arg - else if (arg.name && arg.rawSpec) + } else if (arg.name && arg.rawSpec) { return npa.resolve(arg.name, arg.rawSpec, where || arg.where) - else + } else { return npa(arg.raw, where || arg.where) + } } const nameEndsAt = arg[0] === '@' ? arg.slice(1).indexOf('@') + 1 : arg.indexOf('@') const namePart = nameEndsAt > 0 ? arg.slice(0, nameEndsAt) : arg - if (isURL.test(arg)) + if (isURL.test(arg)) { spec = arg - else if (isGit.test(arg)) + } else if (isGit.test(arg)) { spec = `git+ssh://${arg}` - else if (namePart[0] !== '@' && (hasSlashes.test(namePart) || isFilename.test(namePart))) + } else if (namePart[0] !== '@' && (hasSlashes.test(namePart) || isFilename.test(namePart))) { spec = arg - else if (nameEndsAt > 0) { + } else if (nameEndsAt > 0) { name = namePart spec = arg.slice(nameEndsAt + 1) } else { const valid = validatePackageName(arg) - if (valid.validForOldPackages) + if (valid.validForOldPackages) { name = arg - else + } else { spec = arg + } } return resolve(name, spec, where, arg) } @@ -58,35 +60,41 @@ function resolve (name, spec, where, arg) { fromArgument: arg != null, }) - if (name) + if (name) { res.setName(name) + } - if (spec && (isFilespec.test(spec) || /^file:/i.test(spec))) + if (spec && (isFilespec.test(spec) || /^file:/i.test(spec))) { return fromFile(res, where) - else if (spec && /^npm:/i.test(spec)) + } else if (spec && /^npm:/i.test(spec)) { return fromAlias(res, where) + } const hosted = HostedGit.fromUrl(spec, { noGitPlus: true, noCommittish: true, }) - if (hosted) + if (hosted) { return fromHostedGit(res, hosted) - else if (spec && isURL.test(spec)) + } else if (spec && isURL.test(spec)) { return fromURL(res) - else if (spec && (hasSlashes.test(spec) || isFilename.test(spec))) + } else if (spec && (hasSlashes.test(spec) || isFilename.test(spec))) { return fromFile(res, where) - else + } else { return fromRegistry(res) + } } -function invalidPackageName (name, valid) { - const err = new Error(`Invalid package name "${name}": ${valid.errors.join('; ')}`) +function invalidPackageName (name, valid, raw) { + // eslint-disable-next-line max-len + const err = new Error(`Invalid package name "${name}" of package "${raw}": ${valid.errors.join('; ')}.`) err.code = 'EINVALIDPACKAGENAME' return err } -function invalidTagName (name) { - const err = new Error(`Invalid tag name "${name}": Tags may not have any characters that encodeURIComponent encodes.`) + +function invalidTagName (name, raw) { + // eslint-disable-next-line max-len + const err = new Error(`Invalid tag name "${name}" of package "${raw}": Tags may not have any characters that encodeURIComponent encodes.`) err.code = 'EINVALIDTAGNAME' return err } @@ -95,10 +103,11 @@ function Result (opts) { this.type = opts.type this.registry = opts.registry this.where = opts.where - if (opts.raw == null) + if (opts.raw == null) { this.raw = opts.name ? opts.name + '@' + opts.rawSpec : opts.rawSpec - else + } else { this.raw = opts.raw + } this.name = undefined this.escapedName = undefined @@ -106,8 +115,9 @@ function Result (opts) { this.rawSpec = opts.rawSpec == null ? '' : opts.rawSpec this.saveSpec = opts.saveSpec this.fetchSpec = opts.fetchSpec - if (opts.name) + if (opts.name) { this.setName(opts.name) + } this.gitRange = opts.gitRange this.gitCommittish = opts.gitCommittish this.hosted = opts.hosted @@ -115,8 +125,9 @@ function Result (opts) { Result.prototype.setName = function (name) { const valid = validatePackageName(name) - if (!valid.validForOldPackages) - throw invalidPackageName(name, valid) + if (!valid.validForOldPackages) { + throw invalidPackageName(name, valid, this.raw) + } this.name = name this.scope = name[0] === '@' ? name.slice(0, name.indexOf('/')) : undefined @@ -127,11 +138,13 @@ Result.prototype.setName = function (name) { Result.prototype.toString = function () { const full = [] - if (this.name != null && this.name !== '') + if (this.name != null && this.name !== '') { full.push(this.name) + } const spec = this.saveSpec || this.fetchSpec || this.rawSpec - if (spec != null && spec !== '') + if (spec != null && spec !== '') { full.push(spec) + } return full.length ? full.join('@') : this.raw } @@ -145,21 +158,23 @@ function setGitCommittish (res, committish) { if (committish != null && committish.length >= 7 && committish.slice(0, 7) === 'semver:') { res.gitRange = decodeURIComponent(committish.slice(7)) res.gitCommittish = null - } else + } else { res.gitCommittish = committish === '' ? null : committish + } return res } function fromFile (res, where) { - if (!where) + if (!where) { where = process.cwd() + } res.type = isFilename.test(res.rawSpec) ? 'file' : 'directory' res.where = where // always put the '/' on where when resolving urls, or else // file:foo from /path/to/bar goes to /path/to/foo, when we want - // it to be /path/to/foo/bar + // it to be /path/to/bar/foo let specUrl let resolvedUrl @@ -225,10 +240,11 @@ function fromFile (res, where) { if (/^\/~(\/|$)/.test(specPath)) { res.saveSpec = `file:${specPath.substr(1)}` resolvedPath = path.resolve(homedir(), specPath.substr(3)) - } else if (!path.isAbsolute(rawNoPrefix)) + } else if (!path.isAbsolute(rawNoPrefix)) { res.saveSpec = `file:${path.relative(where, resolvedPath)}` - else + } else { res.saveSpec = `file:${path.resolve(resolvedPath)}` + } res.fetchSpec = path.resolve(where, resolvedPath) return res @@ -311,11 +327,13 @@ function fromURL (res) { function fromAlias (res, where) { const subSpec = npa(res.rawSpec.substr(4), where) - if (subSpec.type === 'alias') + if (subSpec.type === 'alias') { throw new Error('nested aliases not supported') + } - if (!subSpec.registry) + if (!subSpec.registry) { throw new Error('aliases only work for registry deps') + } res.subSpec = subSpec res.registry = true @@ -334,14 +352,14 @@ function fromRegistry (res) { res.fetchSpec = spec const version = semver.valid(spec, true) const range = semver.validRange(spec, true) - if (version) + if (version) { res.type = 'version' - else if (range) + } else if (range) { res.type = 'range' - else { - if (encodeURIComponent(spec) !== spec) - throw invalidTagName(spec) - + } else { + if (encodeURIComponent(spec) !== spec) { + throw invalidTagName(spec, res.raw) + } res.type = 'tag' } return res diff --git a/deps/npm/node_modules/npm-package-arg/package.json b/deps/npm/node_modules/npm-package-arg/package.json index bf5f597e6d..b0821312a7 100644 --- a/deps/npm/node_modules/npm-package-arg/package.json +++ b/deps/npm/node_modules/npm-package-arg/package.json @@ -1,22 +1,23 @@ { "name": "npm-package-arg", - "version": "8.1.5", + "version": "9.0.0", "description": "Parse the things that can be arguments to `npm install`", - "main": "npa.js", + "main": "./lib/npa.js", "directories": { "test": "test" }, "files": [ - "npa.js" + "bin", + "lib" ], "dependencies": { - "hosted-git-info": "^4.0.1", - "semver": "^7.3.4", + "hosted-git-info": "^4.1.0", + "semver": "^7.3.5", "validate-npm-package-name": "^3.0.0" }, "devDependencies": { - "@npmcli/lint": "^1.0.1", - "tap": "^15.0.9" + "@npmcli/template-oss": "^2.7.1", + "tap": "^15.1.6" }, "scripts": { "preversion": "npm test", @@ -25,22 +26,30 @@ "test": "tap", "snap": "tap", "npmclilint": "npmcli-lint", - "lint": "npm run npmclilint -- \"*.*js\" \"test/**/*.*js\"", + "lint": "eslint '**/*.js'", "lintfix": "npm run lint -- --fix", - "posttest": "npm run lint --", - "postsnap": "npm run lintfix --" + "posttest": "npm run lint", + "postsnap": "npm run lintfix --", + "postlint": "npm-template-check", + "template-copy": "npm-template-copy --force" }, "repository": { "type": "git", "url": "https://github.com/npm/npm-package-arg" }, - "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", + "author": "GitHub Inc.", "license": "ISC", "bugs": { "url": "https://github.com/npm/npm-package-arg/issues" }, "homepage": "https://github.com/npm/npm-package-arg", "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16" + }, + "tap": { + "branches": 97 + }, + "templateOSS": { + "version": "2.7.1" } } diff --git a/deps/npm/node_modules/npm-pick-manifest/index.js b/deps/npm/node_modules/npm-pick-manifest/lib/index.js index 695450524d..f2934e9ca1 100644 --- a/deps/npm/node_modules/npm-pick-manifest/index.js +++ b/deps/npm/node_modules/npm-pick-manifest/lib/index.js @@ -34,7 +34,7 @@ const pickManifest = (packument, wanted, opts) => { npmVersion = null, includeStaged = false, avoid = null, - avoidStrict = false + avoidStrict = false, } = opts const { name, time: verTimes } = packument @@ -43,7 +43,7 @@ const pickManifest = (packument, wanted, opts) => { if (avoidStrict) { const looseOpts = { ...opts, - avoidStrict: false + avoidStrict: false, } const result = pickManifest(packument, wanted, looseOpts) @@ -56,7 +56,7 @@ const pickManifest = (packument, wanted, opts) => { return { ...caret, _outsideDependencyRange: true, - _isSemVerMajor: false + _isSemVerMajor: false, } } @@ -65,7 +65,7 @@ const pickManifest = (packument, wanted, opts) => { return { ...star, _outsideDependencyRange: true, - _isSemVerMajor: true + _isSemVerMajor: true, } } @@ -75,7 +75,7 @@ const pickManifest = (packument, wanted, opts) => { wanted, avoid, before, - versions: Object.keys(versions) + versions: Object.keys(versions), }) } @@ -143,7 +143,7 @@ const pickManifest = (packument, wanted, opts) => { type, wanted, before, - versions: Object.keys(versions) + versions: Object.keys(versions), }) } @@ -213,6 +213,6 @@ module.exports = (packument, wanted, opts = {}) => { versions: Object.keys(packument.versions), name, distTags: packument['dist-tags'], - defaultTag + defaultTag, }) } diff --git a/deps/npm/node_modules/npm-pick-manifest/package.json b/deps/npm/node_modules/npm-pick-manifest/package.json index 4b4866cbf8..ece1d174db 100644 --- a/deps/npm/node_modules/npm-pick-manifest/package.json +++ b/deps/npm/node_modules/npm-pick-manifest/package.json @@ -1,19 +1,24 @@ { "name": "npm-pick-manifest", - "version": "6.1.1", + "version": "7.0.0", "description": "Resolves a matching manifest from a package metadata document according to standard npm semver resolution rules.", - "main": "index.js", + "main": "./lib", "files": [ - "*.js" + "bin", + "lib" ], "scripts": { "coverage": "tap", - "lint": "standard", + "lint": "eslint '**/*.js'", "test": "tap", "posttest": "npm run lint", "preversion": "npm test", "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" + "prepublishOnly": "git push origin --follow-tags", + "postlint": "npm-template-check", + "template-copy": "npm-template-copy --force", + "lintfix": "npm run lint -- --fix", + "snap": "tap" }, "repository": "https://github.com/npm/npm-pick-manifest", "keywords": [ @@ -21,23 +26,25 @@ "semver", "package manager" ], - "author": { - "name": "Kat Marchán", - "email": "kzm@sykosomatic.org", - "twitter": "maybekatz" - }, + "author": "GitHub Inc.", "license": "ISC", "dependencies": { "npm-install-checks": "^4.0.0", "npm-normalize-package-bin": "^1.0.1", - "npm-package-arg": "^8.1.2", - "semver": "^7.3.4" + "npm-package-arg": "^9.0.0", + "semver": "^7.3.5" }, "devDependencies": { - "standard": "^14.3.1", - "tap": "^14.11.0" + "@npmcli/template-oss": "^2.7.1", + "tap": "^15.1.6" }, "tap": { "check-coverage": true + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16" + }, + "templateOSS": { + "version": "2.7.1" } } diff --git a/deps/npm/node_modules/npm-profile/lib/index.js b/deps/npm/node_modules/npm-profile/lib/index.js index aa322e37f4..74a8084292 100644 --- a/deps/npm/node_modules/npm-profile/lib/index.js +++ b/deps/npm/node_modules/npm-profile/lib/index.js @@ -4,13 +4,14 @@ const fetch = require('npm-registry-fetch') const { HttpErrorBase } = require('npm-registry-fetch/lib/errors') const os = require('os') const { URL } = require('url') +const log = require('proc-log') // try loginWeb, catch the "not supported" message and fall back to couch const login = (opener, prompter, opts = {}) => { const { creds } = opts return loginWeb(opener, opts).catch(er => { if (er instanceof WebLoginNotSupported) { - process.emit('log', 'verbose', 'web login not supported, trying couch') + log.verbose('web login not supported, trying couch') return prompter(creds) .then(data => loginCouch(data.username, data.password, opts)) } else { @@ -23,7 +24,7 @@ const adduser = (opener, prompter, opts = {}) => { const { creds } = opts return adduserWeb(opener, opts).catch(er => { if (er instanceof WebLoginNotSupported) { - process.emit('log', 'verbose', 'web adduser not supported, trying couch') + log.verbose('web adduser not supported, trying couch') return prompter(creds) .then(data => adduserCouch(data.username, data.email, data.password, opts)) } else { @@ -33,12 +34,12 @@ const adduser = (opener, prompter, opts = {}) => { } const adduserWeb = (opener, opts = {}) => { - process.emit('log', 'verbose', 'web adduser', 'before first POST') + log.verbose('web adduser', 'before first POST') return webAuth(opener, opts, { create: true }) } const loginWeb = (opener, opts = {}) => { - process.emit('log', 'verbose', 'web login', 'before first POST') + log.verbose('web login', 'before first POST') return webAuth(opener, opts, {}) } @@ -62,13 +63,13 @@ const webAuth = (opener, opts, body) => { return Promise.all([res, res.json()]) }).then(([res, content]) => { const { doneUrl, loginUrl } = content - process.emit('log', 'verbose', 'web auth', 'got response', content) + log.verbose('web auth', 'got response', content) if (!isValidUrl(doneUrl) || !isValidUrl(loginUrl)) { throw new WebLoginInvalidResponse('POST', res, content) } return content }).then(({ doneUrl, loginUrl }) => { - process.emit('log', 'verbose', 'web auth', 'opening url pair') + log.verbose('web auth', 'opening url pair') return opener(loginUrl).then( () => webAuthCheckLogin(doneUrl, { ...opts, cache: false }) ) @@ -121,7 +122,7 @@ const adduserCouch = (username, email, password, opts = {}) => { ...body, password: 'XXXXX', } - process.emit('log', 'verbose', 'adduser', 'before first PUT', logObj) + log.verbose('adduser', 'before first PUT', logObj) const target = '/-/user/org.couchdb.user:' + encodeURIComponent(username) return fetch.json(target, { @@ -147,9 +148,9 @@ const loginCouch = (username, password, opts = {}) => { ...body, password: 'XXXXX', } - process.emit('log', 'verbose', 'login', 'before first PUT', logObj) + log.verbose('login', 'before first PUT', logObj) - const target = '-/user/org.couchdb.user:' + encodeURIComponent(username) + const target = '/-/user/org.couchdb.user:' + encodeURIComponent(username) return fetch.json(target, { ...opts, method: 'PUT', diff --git a/deps/npm/node_modules/npm-profile/package.json b/deps/npm/node_modules/npm-profile/package.json index 8745c2559f..68b04bba6d 100644 --- a/deps/npm/node_modules/npm-profile/package.json +++ b/deps/npm/node_modules/npm-profile/package.json @@ -1,12 +1,13 @@ { "name": "npm-profile", - "version": "6.0.0", + "version": "6.0.2", "description": "Library for updating an npmjs.com profile", "keywords": [], "author": "GitHub Inc.", "license": "ISC", "dependencies": { - "npm-registry-fetch": "^12.0.0" + "npm-registry-fetch": "^13.0.0", + "proc-log": "^2.0.0" }, "main": "./lib/index.js", "repository": { @@ -18,9 +19,9 @@ "lib" ], "devDependencies": { - "@npmcli/template-oss": "^2.5.1", - "nock": "^13.2.1", - "tap": "^15.1.5" + "@npmcli/template-oss": "^2.7.1", + "nock": "^13.2.4", + "tap": "^15.1.6" }, "scripts": { "preversion": "npm test", @@ -31,7 +32,8 @@ "snap": "tap", "lint": "eslint '**/*.js'", "postlint": "npm-template-check", - "lintfix": "npm run lint -- --fix" + "lintfix": "npm run lint -- --fix", + "template-copy": "npm-template-copy --force" }, "tap": { "check-coverage": true @@ -40,6 +42,6 @@ "node": "^12.13.0 || ^14.15.0 || >=16" }, "templateOSS": { - "version": "2.5.1" + "version": "2.7.1" } } diff --git a/deps/npm/node_modules/npm-registry-fetch/lib/check-response.js b/deps/npm/node_modules/npm-registry-fetch/lib/check-response.js index 26043a96de..872ec8a888 100644 --- a/deps/npm/node_modules/npm-registry-fetch/lib/check-response.js +++ b/deps/npm/node_modules/npm-registry-fetch/lib/check-response.js @@ -3,23 +3,24 @@ const errors = require('./errors.js') const { Response } = require('minipass-fetch') const defaultOpts = require('./default-opts.js') +const log = require('proc-log') /* eslint-disable-next-line max-len */ const moreInfoUrl = 'https://github.com/npm/cli/wiki/No-auth-for-URI,-but-auth-present-for-scoped-registry' const checkResponse = - async ({ method, uri, res, registry, startTime, auth, opts }) => { + async ({ method, uri, res, startTime, auth, opts }) => { opts = { ...defaultOpts, ...opts } if (res.headers.has('npm-notice') && !res.headers.has('x-local-cache')) { - opts.log.notice('', res.headers.get('npm-notice')) + log.notice('', res.headers.get('npm-notice')) } if (res.status >= 400) { - logRequest(method, res, startTime, opts) + logRequest(method, res, startTime) if (auth && auth.scopeAuthKey && !auth.token && !auth.auth) { // we didn't have auth for THIS request, but we do have auth for // requests to the registry indicated by the spec's scope value. // Warn the user. - opts.log.warn('registry', `No auth for URI, but auth present for scoped registry. + log.warn('registry', `No auth for URI, but auth present for scoped registry. URI: ${uri} Scoped Registry Key: ${auth.scopeAuthKey} @@ -38,7 +39,7 @@ More info here: ${moreInfoUrl}`) } module.exports = checkResponse -function logRequest (method, res, startTime, opts) { +function logRequest (method, res, startTime) { const elapsedTime = Date.now() - startTime const attempt = res.headers.get('x-fetch-attempts') const attemptStr = attempt && attempt > 1 ? ` attempt #${attempt}` : '' @@ -58,7 +59,7 @@ function logRequest (method, res, startTime, opts) { urlStr = res.url } - opts.log.http( + log.http( 'fetch', `${method.toUpperCase()} ${res.status} ${urlStr} ${elapsedTime}ms${attemptStr}${cacheStr}` ) diff --git a/deps/npm/node_modules/npm-registry-fetch/lib/default-opts.js b/deps/npm/node_modules/npm-registry-fetch/lib/default-opts.js index e8e8221da4..f0847f0b50 100644 --- a/deps/npm/node_modules/npm-registry-fetch/lib/default-opts.js +++ b/deps/npm/node_modules/npm-registry-fetch/lib/default-opts.js @@ -1,6 +1,5 @@ const pkg = require('../package.json') module.exports = { - log: require('./silentlog.js'), maxSockets: 12, method: 'GET', registry: 'https://registry.npmjs.org/', diff --git a/deps/npm/node_modules/npm-registry-fetch/package.json b/deps/npm/node_modules/npm-registry-fetch/package.json index f1aab5c7bb..9349619e99 100644 --- a/deps/npm/node_modules/npm-registry-fetch/package.json +++ b/deps/npm/node_modules/npm-registry-fetch/package.json @@ -1,6 +1,6 @@ { "name": "npm-registry-fetch", - "version": "12.0.2", + "version": "13.0.0", "description": "Fetch-based http client for use with npm registry APIs", "main": "lib", "files": [ @@ -31,18 +31,18 @@ "author": "GitHub Inc.", "license": "ISC", "dependencies": { - "make-fetch-happen": "^10.0.1", + "make-fetch-happen": "^10.0.2", "minipass": "^3.1.6", "minipass-fetch": "^1.4.1", "minipass-json-stream": "^1.0.1", "minizlib": "^2.1.2", - "npm-package-arg": "^8.1.5" + "npm-package-arg": "^9.0.0", + "proc-log": "^2.0.0" }, "devDependencies": { "@npmcli/template-oss": "^2.7.1", "cacache": "^15.3.0", "nock": "^13.2.4", - "npmlog": "^6.0.0", "require-inject": "^1.4.4", "ssri": "^8.0.1", "tap": "^15.1.6" diff --git a/deps/npm/node_modules/pacote/README.md b/deps/npm/node_modules/pacote/README.md index 2328c0a4a5..11822dbb48 100644 --- a/deps/npm/node_modules/pacote/README.md +++ b/deps/npm/node_modules/pacote/README.md @@ -146,10 +146,6 @@ resolved, and other properties, as they are determined. `0o666`. See "Extracted File Modes" below. * `dmode` Minimum permission mode for extracted directories. Defaults to `0o777`. See "Extracted File Modes" below. -* `log` A logger object with methods for various log levels. Typically, - this will be [`npmlog`](http://npm.im/npmlog) in the npm CLI use case, - but if not specified, the default is a logger that emits `'log'` events - on the `process` object. * `preferOnline` Prefer to revalidate cache entries, even when it would not be strictly necessary. Default `false`. * `before` When picking a manifest from a packument, only consider @@ -162,11 +158,16 @@ resolved, and other properties, as they are determined. including information not strictly required for installation (author, description, etc.) Defaults to `true` when `before` is set, since the version publish time is part of the extended packument metadata. +* `fullReadJson` Use the slower `read-package-json` package insted of + `read-package-json-fast` in order to include extra fields like "readme" in + the manifest. Defaults to `false`. * `packumentCache` For registry packuments only, you may provide a `Map` object which will be used to cache packument requests between pacote calls. This allows you to easily avoid hitting the registry multiple times (even just to validate the cache) for a given packument, since it is unlikely to change in the span of a single command. +* `silent` A boolean that determines whether the banner is displayed + when calling `@npmcli/run-script`. ### Advanced API diff --git a/deps/npm/node_modules/pacote/lib/bin.js b/deps/npm/node_modules/pacote/lib/bin.js index c0409be1ff..369304adaa 100755 --- a/deps/npm/node_modules/pacote/lib/bin.js +++ b/deps/npm/node_modules/pacote/lib/bin.js @@ -4,26 +4,28 @@ const run = conf => { const pacote = require('../') switch (conf._[0]) { case 'resolve': - if (conf.long) + case 'manifest': + case 'packument': + if (conf._[0] === 'resolve' && conf.long) { return pacote.manifest(conf._[1], conf).then(mani => ({ resolved: mani._resolved, integrity: mani._integrity, from: mani._from, })) - case 'manifest': - case 'packument': + } return pacote[conf._[0]](conf._[1], conf) case 'tarball': if (!conf._[2] || conf._[2] === '-') { return pacote.tarball.stream(conf._[1], stream => { stream.pipe(conf.testStdout || - /* istanbul ignore next */ process.stdout) + /* istanbul ignore next */ process.stdout) // make sure it resolves something falsey return stream.promise().then(() => {}) }, conf) - } else + } else { return pacote.tarball.file(conf._[1], conf._[2], conf) + } case 'extract': return pacote.extract(conf._[1], conf._[2], conf) @@ -81,8 +83,9 @@ const pretty = (conf, result) => let addedLogListener = false const main = args => { const conf = parse(args) - if (conf.help || conf.h) + if (conf.help || conf.h) { return console.log(usage()) + } if (!addedLogListener) { process.on('log', console.error) @@ -121,14 +124,14 @@ const parse = args => { } let dashdash = false args.forEach(arg => { - if (dashdash) + if (dashdash) { conf._.push(arg) - else if (arg === '--') + } else if (arg === '--') { dashdash = true - else if (arg === '-h') + } else if (arg === '-h') { conf.help = true - else if (/^--/.test(arg)) { - const {key, value} = parseArg(arg) + } else if (/^--/.test(arg)) { + const { key, value } = parseArg(arg) conf[key] = value } else { conf._.push(arg) @@ -137,9 +140,9 @@ const parse = args => { return conf } -if (module === require.main) +if (module === require.main) { main(process.argv.slice(2)) -else +} else { module.exports = { main, run, @@ -147,3 +150,4 @@ else parseArg, parse, } +} diff --git a/deps/npm/node_modules/pacote/lib/dir.js b/deps/npm/node_modules/pacote/lib/dir.js index 0d3a00d95a..598b029f7a 100644 --- a/deps/npm/node_modules/pacote/lib/dir.js +++ b/deps/npm/node_modules/pacote/lib/dir.js @@ -1,14 +1,12 @@ const Fetcher = require('./fetcher.js') const FileFetcher = require('./file.js') -const cacache = require('cacache') const Minipass = require('minipass') -const { promisify } = require('util') -const readPackageJson = require('read-package-json-fast') const tarCreateOptions = require('./util/tar-create-options.js') const packlist = require('npm-packlist') const tar = require('tar') const _prepareDir = Symbol('_prepareDir') const { resolve } = require('path') +const _readPackageJson = Symbol.for('package.Fetcher._readPackageJson') const runScript = require('@npmcli/run-script') @@ -31,18 +29,18 @@ class DirFetcher extends Fetcher { [_prepareDir] () { return this.manifest().then(mani => { - if (!mani.scripts || !mani.scripts.prepare) + if (!mani.scripts || !mani.scripts.prepare) { return + } // we *only* run prepare. // pre/post-pack is run by the npm CLI for publish and pack, // but this function is *also* run when installing git deps const stdio = this.opts.foregroundScripts ? 'inherit' : 'pipe' - // hide the banner if loglevel is silent, or if prepare running + // hide the banner if silent opt is passed in, or if prepare running // in the background. - const banner = this.opts.log && this.opts.log.level === 'silent' ? false - : stdio === 'inherit' + const banner = this.opts.silent ? false : stdio === 'inherit' return runScript({ pkg: mani, @@ -76,10 +74,11 @@ class DirFetcher extends Fetcher { } manifest () { - if (this.package) + if (this.package) { return Promise.resolve(this.package) + } - return readPackageJson(this.resolved + '/package.json') + return this[_readPackageJson](this.resolved + '/package.json') .then(mani => this.package = { ...mani, _integrity: this.integrity && String(this.integrity), diff --git a/deps/npm/node_modules/pacote/lib/fetcher.js b/deps/npm/node_modules/pacote/lib/fetcher.js index 69dd025b7b..78b13a9637 100644 --- a/deps/npm/node_modules/pacote/lib/fetcher.js +++ b/deps/npm/node_modules/pacote/lib/fetcher.js @@ -9,12 +9,15 @@ const { promisify } = require('util') const { basename, dirname } = require('path') const rimraf = promisify(require('rimraf')) const tar = require('tar') -const procLog = require('./util/proc-log.js') +const log = require('proc-log') const retry = require('promise-retry') const fsm = require('fs-minipass') const cacache = require('cacache') const isPackageBin = require('./util/is-package-bin.js') +const removeTrailingSlashes = require('./util/trailing-slashes.js') const getContents = require('@npmcli/installed-package-contents') +const readPackageJsonFast = require('read-package-json-fast') +const readPackageJson = promisify(require('read-package-json')) // we only change ownership on unix platforms, and only if uid is 0 const selfOwner = process.getuid && process.getuid() === 0 ? { @@ -41,11 +44,13 @@ const _assertType = Symbol('_assertType') const _tarballFromCache = Symbol('_tarballFromCache') const _tarballFromResolved = Symbol.for('pacote.Fetcher._tarballFromResolved') const _cacheFetches = Symbol.for('pacote.Fetcher._cacheFetches') +const _readPackageJson = Symbol.for('package.Fetcher._readPackageJson') class FetcherBase { constructor (spec, opts) { - if (!opts || typeof opts !== 'object') + if (!opts || typeof opts !== 'object') { throw new TypeError('options object is required') + } this.spec = npa(spec, opts.where) this.allowGitIgnore = !!opts.allowGitIgnore @@ -62,7 +67,7 @@ class FetcherBase { this[_assertType]() // clone the opts object so that others aren't upset when we mutate it // by adding/modifying the integrity value. - this.opts = {...opts} + this.opts = { ...opts } this.cache = opts.cache || cacheDir() this.resolved = opts.resolved || null @@ -72,8 +77,9 @@ class FetcherBase { // is no longer strong enough. this.defaultIntegrityAlgorithm = opts.defaultIntegrityAlgorithm || 'sha512' - if (typeof opts.integrity === 'string') + if (typeof opts.integrity === 'string') { this.opts.integrity = ssri.parse(opts.integrity) + } this.package = null this.type = this.constructor.name @@ -85,7 +91,6 @@ class FetcherBase { // the process's umask setting do its job. but if configured, we do // respect it. this.umask = opts.umask || 0 - this.log = opts.log || procLog this.preferOnline = !!opts.preferOnline this.preferOffline = !!opts.preferOffline @@ -93,10 +98,15 @@ class FetcherBase { this.before = opts.before this.fullMetadata = this.before ? true : !!opts.fullMetadata + this.fullReadJson = !!opts.fullReadJson + if (this.fullReadJson) { + this[_readPackageJson] = readPackageJson + } else { + this[_readPackageJson] = readPackageJsonFast + } this.defaultTag = opts.defaultTag || 'latest' - this.registry = (opts.registry || 'https://registry.npmjs.org') - .replace(/\/+$/, '') + this.registry = removeTrailingSlashes(opts.registry || 'https://registry.npmjs.org') // command to run 'prepare' scripts on directories and git dirs // To use pacote with yarn, for example, set npmBin to 'yarn' @@ -104,7 +114,7 @@ class FetcherBase { this.npmBin = opts.npmBin || 'npm' // command to install deps for preparing - this.npmInstallCmd = opts.npmInstallCmd || [ 'install', '--force' ] + this.npmInstallCmd = opts.npmInstallCmd || ['install', '--force'] // XXX fill more of this in based on what we know from this.opts // we explicitly DO NOT fill in --tag, though, since we are often @@ -132,19 +142,22 @@ class FetcherBase { get integrity () { return this.opts.integrity || null } + set integrity (i) { - if (!i) + if (!i) { return + } i = ssri.parse(i) const current = this.opts.integrity // do not ever update an existing hash value, but do // merge in NEW algos and hashes that we don't already have. - if (current) + if (current) { current.merge(i) - else + } else { this.opts.integrity = i + } } get notImplementedError () { @@ -212,8 +225,9 @@ class FetcherBase { stream.on('error', er => istream.emit('error', er)) // if not caching this, just pipe through to the istream and return it - if (!this.opts.cache || !this[_cacheFetches]) + if (!this.opts.cache || !this[_cacheFetches]) { return stream.pipe(istream) + } // we have to return a stream that gets ALL the data, and proxies errors, // but then pipe from the original tarball stream into the cache as well. @@ -288,39 +302,42 @@ class FetcherBase { this.integrity && this.resolved ) ? streamHandler(this[_tarballFromCache]()).catch(er => { - if (this.isDataCorruptionError(er)) { - this.log.warn('tarball', `cached data for ${ + if (this.isDataCorruptionError(er)) { + log.warn('tarball', `cached data for ${ this.spec } (${this.integrity}) seems to be corrupted. Refreshing cache.`) - return this.cleanupCached().then(() => { throw er }) - } else { - throw er - } - }) : null + return this.cleanupCached().then(() => { + throw er + }) + } else { + throw er + } + }) : null const fromResolved = er => { if (er) { - if (!this.isRetriableError(er)) + if (!this.isRetriableError(er)) { throw er - this.log.silly('tarball', `no local data for ${ + } + log.silly('tarball', `no local data for ${ this.spec }. Extracting by manifest.`) } return this.resolve().then(() => retry(tryAgain => streamHandler(this[_istream](this[_tarballFromResolved]())) - .catch(er => { + .catch(er => { // Most likely data integrity. A cache ENOENT error is unlikely // here, since we're definitely not reading from the cache, but it // IS possible that the fetch subsystem accessed the cache, and the // entry got blown away or something. Try one more time to be sure. - if (this.isRetriableError(er)) { - this.log.warn('tarball', `tarball data for ${ + if (this.isRetriableError(er)) { + log.warn('tarball', `tarball data for ${ this.spec } (${this.integrity}) seems to be corrupted. Trying again.`) - return this.cleanupCached().then(() => tryAgain(er)) - } - throw er - }), { retries: 1, minTimeout: 0, maxTimeout: 0 })) + return this.cleanupCached().then(() => tryAgain(er)) + } + throw er + }), { retries: 1, minTimeout: 0, maxTimeout: 0 })) } return fromCache ? fromCache.catch(fromResolved) : fromResolved() @@ -337,7 +354,7 @@ class FetcherBase { } [_empty] (path) { - return getContents({path, depth: 1}).then(contents => Promise.all( + return getContents({ path, depth: 1 }).then(contents => Promise.all( contents.map(entry => rimraf(entry)))) } @@ -350,7 +367,7 @@ class FetcherBase { // parent folder (rare, but probably happens sometimes). return !inferOwner ? this[_empty](dest).then(() => mkdirp(dest)).then(() => ({})) - : inferOwner(dest).then(({uid, gid}) => + : inferOwner(dest).then(({ uid, gid }) => this[_empty](dest) .then(() => mkdirp(dest)) .then(made => { @@ -360,13 +377,13 @@ class FetcherBase { const dir = made || /* istanbul ignore next */ dest return this[_chown](dir, uid, gid) }) - .then(() => ({uid, gid}))) + .then(() => ({ uid, gid }))) } // extraction is always the same. the only difference is where // the tarball comes from. extract (dest) { - return this[_mkdir](dest).then(({uid, gid}) => + return this[_mkdir](dest).then(({ uid, gid }) => this.tarballStream(tarball => this[_extract](dest, tarball, uid, gid))) } @@ -389,7 +406,7 @@ class FetcherBase { const dir = dirname(dest) return !inferOwner ? mkdirp(dir).then(() => this[_toFile](dest)) - : inferOwner(dest).then(({uid, gid}) => + : inferOwner(dest).then(({ uid, gid }) => mkdirp(dir).then(made => this[_toFile](dest) .then(res => this[_chown](made || dir, uid, gid) .then(() => res)))) @@ -407,8 +424,8 @@ class FetcherBase { }) extractor.on('error', er => { - this.log.warn('tar', er.message) - this.log.silly('tar', er) + log.warn('tar', er.message) + log.silly('tar', er) reject(er) }) @@ -439,21 +456,23 @@ class FetcherBase { noChmod: true, noMtime: true, filter: (name, entry) => { - if (/Link$/.test(entry.type)) + if (/Link$/.test(entry.type)) { return false + } entry.mode = this[_entryMode](entry.path, entry.mode, entry.type) // this replicates the npm pack behavior where .gitignore files // are treated like .npmignore files, but only if a .npmignore // file is not present. if (/File$/.test(entry.type)) { const base = basename(entry.path) - if (base === '.npmignore') + if (base === '.npmignore') { sawIgnores.add(entry.path) - else if (base === '.gitignore' && !this.allowGitIgnore) { + } else if (base === '.gitignore' && !this.allowGitIgnore) { // rename, but only if there's not already a .npmignore const ni = entry.path.replace(/\.gitignore$/, '.npmignore') - if (sawIgnores.has(ni)) + if (sawIgnores.has(ni)) { return false + } entry.path = ni } return true @@ -462,8 +481,8 @@ class FetcherBase { strip: 1, onwarn: /* istanbul ignore next - we can trust that tar logs */ (code, msg, data) => { - this.log.warn('tar', code, msg) - this.log.silly('tar', code, msg, data) + log.warn('tar', code, msg) + log.silly('tar', code, msg, data) }, uid, gid, diff --git a/deps/npm/node_modules/pacote/lib/file.js b/deps/npm/node_modules/pacote/lib/file.js index d5c601aabd..bf99bb86e3 100644 --- a/deps/npm/node_modules/pacote/lib/file.js +++ b/deps/npm/node_modules/pacote/lib/file.js @@ -1,12 +1,11 @@ const Fetcher = require('./fetcher.js') const fsm = require('fs-minipass') const cacache = require('cacache') -const { promisify } = require('util') -const readPackageJson = require('read-package-json-fast') const _tarballFromResolved = Symbol.for('pacote.Fetcher._tarballFromResolved') const _exeBins = Symbol('_exeBins') const { resolve } = require('path') const fs = require('fs') +const _readPackageJson = Symbol.for('package.Fetcher._readPackageJson') class FileFetcher extends Fetcher { constructor (spec, opts) { @@ -20,24 +19,26 @@ class FileFetcher extends Fetcher { } manifest () { - if (this.package) + if (this.package) { return Promise.resolve(this.package) + } // have to unpack the tarball for this. return cacache.tmp.withTmp(this.cache, this.opts, dir => this.extract(dir) - .then(() => readPackageJson(dir + '/package.json')) - .then(mani => this.package = { - ...mani, - _integrity: this.integrity && String(this.integrity), - _resolved: this.resolved, - _from: this.from, - })) + .then(() => this[_readPackageJson](dir + '/package.json')) + .then(mani => this.package = { + ...mani, + _integrity: this.integrity && String(this.integrity), + _resolved: this.resolved, + _from: this.from, + })) } [_exeBins] (pkg, dest) { - if (!pkg.bin) + if (!pkg.bin) { return Promise.resolve() + } return Promise.all(Object.keys(pkg.bin).map(k => new Promise(res => { const script = resolve(dest, pkg.bin[k]) @@ -46,11 +47,13 @@ class FileFetcher extends Fetcher { // something, we just leave it for a later stage to trip over // when we can provide a more useful contextual error. fs.stat(script, (er, st) => { - if (er) + if (er) { return res() + } const mode = st.mode | 0o111 - if (mode === st.mode) + if (mode === st.mode) { return res() + } fs.chmod(script, mode, res) }) }))) @@ -61,8 +64,8 @@ class FileFetcher extends Fetcher { // but if not, read the unpacked manifest and chmod properly. return super.extract(dest) .then(result => this.package ? result - : readPackageJson(dest + '/package.json').then(pkg => - this[_exeBins](pkg, dest)).then(() => result)) + : this[_readPackageJson](dest + '/package.json').then(pkg => + this[_exeBins](pkg, dest)).then(() => result)) } [_tarballFromResolved] () { @@ -75,7 +78,7 @@ class FileFetcher extends Fetcher { return this.manifest().then(mani => ({ name: mani.name, 'dist-tags': { - [this.defaultTag]: mani.version + [this.defaultTag]: mani.version, }, versions: { [mani.version]: { @@ -83,9 +86,9 @@ class FileFetcher extends Fetcher { dist: { tarball: `file:${this.resolved}`, integrity: this.integrity && String(this.integrity), - } - } - } + }, + }, + }, })) } } diff --git a/deps/npm/node_modules/pacote/lib/git.js b/deps/npm/node_modules/pacote/lib/git.js index ab87d494ce..9d84d95fa6 100644 --- a/deps/npm/node_modules/pacote/lib/git.js +++ b/deps/npm/node_modules/pacote/lib/git.js @@ -6,11 +6,9 @@ const hashre = /^[a-f0-9]{40}$/ const git = require('@npmcli/git') const pickManifest = require('npm-pick-manifest') const npa = require('npm-package-arg') -const url = require('url') const Minipass = require('minipass') const cacache = require('cacache') -const { promisify } = require('util') -const readPackageJson = require('read-package-json-fast') +const log = require('proc-log') const npm = require('./util/npm.js') const _resolvedFromRepo = Symbol('_resolvedFromRepo') @@ -24,6 +22,7 @@ const _cloneHosted = Symbol('_cloneHosted') const _cloneRepo = Symbol('_cloneRepo') const _setResolvedWithSha = Symbol('_setResolvedWithSha') const _prepareDir = Symbol('_prepareDir') +const _readPackageJson = Symbol.for('package.Fetcher._readPackageJson') // get the repository url. // prefer https if there's auth, since ssh will drop that. @@ -39,9 +38,17 @@ const addGitPlus = url => url && `git+${url}`.replace(/^(git\+)+/, 'git+') class GitFetcher extends Fetcher { constructor (spec, opts) { super(spec, opts) + + // we never want to compare integrity for git dependencies: npm/rfcs#525 + if (this.opts.integrity) { + delete this.opts.integrity + log.warn(`skipping integrity check for git dependency ${this.spec.fetchSpec}`) + } + this.resolvedRef = null - if (this.spec.hosted) + if (this.spec.hosted) { this.from = this.spec.hosted.shortcut({ noCommittish: false }) + } // shortcut: avoid full clone when we can go straight to the tgz // if we have the full sha and it's a hosted git platform @@ -51,8 +58,9 @@ class GitFetcher extends Fetcher { this.resolved = this.spec.hosted ? repoUrl(this.spec.hosted, { noCommittish: false }) : this.spec.rawSpec - } else + } else { this.resolvedSha = '' + } } // just exposed to make it easier to test all the combinations @@ -67,8 +75,9 @@ class GitFetcher extends Fetcher { resolve () { // likely a hosted git repo with a sha, so get the tarball url // but in general, no reason to resolve() more than necessary! - if (this.resolved) + if (this.resolved) { return super.resolve() + } // fetch the git repo and then look at the current hash const h = this.spec.hosted @@ -86,37 +95,41 @@ class GitFetcher extends Fetcher { return this[_resolvedFromRepo](hosted.https && hosted.https()) .catch(er => { // Throw early since we know pathspec errors will fail again if retried - if (er instanceof git.errors.GitPathspecError) + if (er instanceof git.errors.GitPathspecError) { throw er + } const ssh = hosted.sshurl && hosted.sshurl() // no fallthrough if we can't fall through or have https auth - if (!ssh || hosted.auth) + if (!ssh || hosted.auth) { throw er + } return this[_resolvedFromRepo](ssh) }) } [_resolvedFromRepo] (gitRemote) { // XXX make this a custom error class - if (!gitRemote) + if (!gitRemote) { return Promise.reject(new Error(`No git url for ${this.spec}`)) + } const gitRange = this.spec.gitRange const name = this.spec.name return git.revs(gitRemote, this.opts).then(remoteRefs => { return gitRange ? pickManifest({ - versions: remoteRefs.versions, - 'dist-tags': remoteRefs['dist-tags'], - name, - }, gitRange, this.opts) + versions: remoteRefs.versions, + 'dist-tags': remoteRefs['dist-tags'], + name, + }, gitRange, this.opts) : this.spec.gitCommittish ? remoteRefs.refs[this.spec.gitCommittish] || remoteRefs.refs[remoteRefs.shas[this.spec.gitCommittish]] - : remoteRefs.refs.HEAD // no git committish, get default head + : remoteRefs.refs.HEAD // no git committish, get default head }).then(revDoc => { // the committish provided isn't in the rev list // things like HEAD~3 or @yesterday can land here. - if (!revDoc || !revDoc.sha) + if (!revDoc || !revDoc.sha) { return this[_resolvedFromClone]() + } this.resolvedRef = revDoc this.resolvedSha = revDoc.sha @@ -145,16 +158,18 @@ class GitFetcher extends Fetcher { } [_prepareDir] (dir) { - return readPackageJson(dir + '/package.json').then(mani => { + return this[_readPackageJson](dir + '/package.json').then(mani => { // no need if we aren't going to do any preparation. const scripts = mani.scripts - if (!scripts || !( - scripts.postinstall || + if (!mani.workspaces && (!scripts || !( + scripts.postinstall || scripts.build || scripts.preinstall || scripts.install || - scripts.prepare)) + scripts.prepack || + scripts.prepare))) { return + } // to avoid cases where we have an cycle of git deps that depend // on one another, we only ever do preparation for one instance @@ -166,7 +181,7 @@ class GitFetcher extends Fetcher { const noPrepare = !process.env._PACOTE_NO_PREPARE_ ? [] : process.env._PACOTE_NO_PREPARE_.split('\n') if (noPrepare.includes(this.resolved)) { - this.log.info('prepare', 'skip prepare, already seen', this.resolved) + log.info('prepare', 'skip prepare, already seen', this.resolved) return } noPrepare.push(this.resolved) @@ -186,7 +201,6 @@ class GitFetcher extends Fetcher { [_tarballFromResolved] () { const stream = new Minipass() stream.resolved = this.resolved - stream.integrity = this.integrity stream.from = this.from // check it out and then shell out to the DirFetcher tarball packer @@ -202,9 +216,9 @@ class GitFetcher extends Fetcher { dirStream.on('end', res) dirStream.pipe(stream) }))).catch( - /* istanbul ignore next: very unlikely and hard to test */ - er => stream.emit('error', er) - ) + /* istanbul ignore next: very unlikely and hard to test */ + er => stream.emit('error', er) + ) return stream } @@ -237,10 +251,11 @@ class GitFetcher extends Fetcher { integrity: null, // it'll always be different, if we have one }).extract(tmp).then(() => handler(tmp), er => { // fall back to ssh download if tarball fails - if (er.constructor.name.match(/^Http/)) + if (er.constructor.name.match(/^Http/)) { return this[_clone](handler, false) - else + } else { throw er + } }) } @@ -249,10 +264,11 @@ class GitFetcher extends Fetcher { : this[_cloneRepo](this.spec.fetchSpec, ref, tmp) ).then(sha => { this.resolvedSha = sha - if (!this.resolved) + if (!this.resolved) { this[_addGitSha](sha) + } }) - .then(() => handler(tmp)) + .then(() => handler(tmp)) }) } @@ -266,12 +282,14 @@ class GitFetcher extends Fetcher { return this[_cloneRepo](hosted.https({ noCommittish: true }), ref, tmp) .catch(er => { // Throw early since we know pathspec errors will fail again if retried - if (er instanceof git.errors.GitPathspecError) + if (er instanceof git.errors.GitPathspecError) { throw er + } const ssh = hosted.sshurl && hosted.sshurl({ noCommittish: true }) // no fallthrough if we can't fall through or have https auth - if (!ssh || hosted.auth) + if (!ssh || hosted.auth) { throw er + } return this[_cloneRepo](ssh, ref, tmp) }) } @@ -282,19 +300,19 @@ class GitFetcher extends Fetcher { } manifest () { - if (this.package) + if (this.package) { return Promise.resolve(this.package) + } return this.spec.hosted && this.resolved ? FileFetcher.prototype.manifest.apply(this) : this[_clone](dir => - readPackageJson(dir + '/package.json') - .then(mani => this.package = { - ...mani, - _integrity: this.integrity && String(this.integrity), - _resolved: this.resolved, - _from: this.from, - })) + this[_readPackageJson](dir + '/package.json') + .then(mani => this.package = { + ...mani, + _resolved: this.resolved, + _from: this.from, + })) } packument () { diff --git a/deps/npm/node_modules/pacote/lib/registry.js b/deps/npm/node_modules/pacote/lib/registry.js index e0a3107174..b4f890d310 100644 --- a/deps/npm/node_modules/pacote/lib/registry.js +++ b/deps/npm/node_modules/pacote/lib/registry.js @@ -2,11 +2,11 @@ const Fetcher = require('./fetcher.js') const RemoteFetcher = require('./remote.js') const _tarballFromResolved = Symbol.for('pacote.Fetcher._tarballFromResolved') const pacoteVersion = require('../package.json').version +const removeTrailingSlashes = require('./util/trailing-slashes.js') const npa = require('npm-package-arg') const rpj = require('read-package-json-fast') const pickManifest = require('npm-pick-manifest') const ssri = require('ssri') -const Minipass = require('minipass') // Corgis are cute. 🐕🐶 const corgiDoc = 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*' @@ -32,10 +32,11 @@ class RegistryFetcher extends Fetcher { // handle case when npm-package-arg guesses wrong. if (this.spec.type === 'tag' && this.spec.rawSpec === '' && - this.defaultTag !== 'latest') + this.defaultTag !== 'latest') { this.spec = npa(`${this.spec.name}@${this.defaultTag}`) + } this.registry = fetch.pickRegistry(spec, opts) - this.packumentUrl = this.registry.replace(/\/*$/, '/') + + this.packumentUrl = removeTrailingSlashes(this.registry) + '/' + this.spec.escapedName // XXX pacote <=9 has some logic to ignore opts.resolved if @@ -45,13 +46,15 @@ class RegistryFetcher extends Fetcher { } resolve () { - if (this.resolved) + if (this.resolved) { return Promise.resolve(this.resolved) + } // fetching the manifest sets resolved and (usually) integrity return this.manifest().then(() => { - if (this.resolved) + if (this.resolved) { return this.resolved + } throw Object.assign( new Error('Invalid package manifest: no `dist.tarball` field'), @@ -77,8 +80,9 @@ class RegistryFetcher extends Fetcher { // note this might be either an in-flight promise for a request, // or the actual packument, but we never want to make more than // one request at a time for the same thing regardless. - if (this.packumentCache && this.packumentCache.has(this.packumentUrl)) + if (this.packumentCache && this.packumentCache.has(this.packumentUrl)) { return this.packumentCache.get(this.packumentUrl) + } // npm-registry-fetch the packument // set the appropriate header for corgis if fullMetadata isn't set @@ -92,12 +96,14 @@ class RegistryFetcher extends Fetcher { }).then(res => res.json().then(packument => { packument._cached = res.headers.has('x-local-cache') packument._contentLength = +res.headers.get('content-length') - if (this.packumentCache) + if (this.packumentCache) { this.packumentCache.set(this.packumentUrl, packument) + } return packument })).catch(er => { - if (this.packumentCache) + if (this.packumentCache) { this.packumentCache.delete(this.packumentUrl) + } if (er.code === 'E404' && !this.fullMetadata) { // possible that corgis are not supported by this registry this.fullMetadata = true @@ -105,14 +111,16 @@ class RegistryFetcher extends Fetcher { } throw er }) - if (this.packumentCache) + if (this.packumentCache) { this.packumentCache.set(this.packumentUrl, p) + } return p } manifest () { - if (this.package) + if (this.package) { return Promise.resolve(this.package) + } return this.packument() .then(packument => pickManifest(packument, this.spec.fetchSpec, { @@ -127,12 +135,12 @@ class RegistryFetcher extends Fetcher { this.resolved = mani._resolved = dist.tarball mani._from = this.from const distIntegrity = dist.integrity ? ssri.parse(dist.integrity) - : dist.shasum ? ssri.fromHex(dist.shasum, 'sha1', {...this.opts}) + : dist.shasum ? ssri.fromHex(dist.shasum, 'sha1', { ...this.opts }) : null if (distIntegrity) { - if (!this.integrity) + if (!this.integrity) { this.integrity = distIntegrity - else if (!this.integrity.match(distIntegrity)) { + } else if (!this.integrity.match(distIntegrity)) { // only bork if they have algos in common. // otherwise we end up breaking if we have saved a sha512 // previously for the tarball, but the manifest only @@ -143,7 +151,7 @@ class RegistryFetcher extends Fetcher { for (const algo of Object.keys(this.integrity)) { if (distIntegrity[algo]) { throw Object.assign(new Error( - `Integrity checksum failed when using ${algo}: `+ + `Integrity checksum failed when using ${algo}: ` + `wanted ${this.integrity} but got ${distIntegrity}.` ), { code: 'EINTEGRITY' }) } @@ -155,8 +163,9 @@ class RegistryFetcher extends Fetcher { } } } - if (this.integrity) + if (this.integrity) { mani._integrity = String(this.integrity) + } this.package = rpj.normalize(mani) return this.package }) diff --git a/deps/npm/node_modules/pacote/lib/remote.js b/deps/npm/node_modules/pacote/lib/remote.js index 727a8bfc8e..5cabfe4fcd 100644 --- a/deps/npm/node_modules/pacote/lib/remote.js +++ b/deps/npm/node_modules/pacote/lib/remote.js @@ -3,7 +3,6 @@ const FileFetcher = require('./file.js') const _tarballFromResolved = Symbol.for('pacote.Fetcher._tarballFromResolved') const pacoteVersion = require('../package.json').version const fetch = require('npm-registry-fetch') -const ssri = require('ssri') const Minipass = require('minipass') // The default registry URL is a string of great magic. const magic = /^https?:\/\/registry\.npmjs\.org\// @@ -14,8 +13,9 @@ class RemoteFetcher extends Fetcher { constructor (spec, opts) { super(spec, opts) this.resolved = this.spec.fetchSpec - if (magic.test(this.resolved) && !magic.test(this.registry + '/')) + if (magic.test(this.resolved) && !magic.test(this.registry + '/')) { this.resolved = this.resolved.replace(magic, this.registry + '/') + } // nam is a fermented pork sausage that is good to eat const nameat = this.spec.name ? `${this.spec.name}@` : '' @@ -35,7 +35,7 @@ class RemoteFetcher extends Fetcher { headers: this[_headers](), spec: this.spec, integrity: this.integrity, - algorithms: [ this.pickIntegrityAlgorithm() ], + algorithms: [this.pickIntegrityAlgorithm()], } fetch(this.resolved, fetchOpts).then(res => { const hash = res.headers.get('x-local-cache-hash') @@ -62,7 +62,7 @@ class RemoteFetcher extends Fetcher { 'pacote-req-type': 'tarball', 'pacote-pkg-id': this.pkgid, ...(this.integrity ? { 'pacote-integrity': String(this.integrity) } - : {}), + : {}), ...(this.opts.headers || {}), } } diff --git a/deps/npm/node_modules/pacote/lib/util/cache-dir.js b/deps/npm/node_modules/pacote/lib/util/cache-dir.js index abd2453232..4236213edd 100644 --- a/deps/npm/node_modules/pacote/lib/util/cache-dir.js +++ b/deps/npm/node_modules/pacote/lib/util/cache-dir.js @@ -1,5 +1,5 @@ const os = require('os') -const {resolve} = require('path') +const { resolve } = require('path') module.exports = (fakePlatform = false) => { const temp = os.tmpdir() diff --git a/deps/npm/node_modules/pacote/lib/util/is-package-bin.js b/deps/npm/node_modules/pacote/lib/util/is-package-bin.js index 35cf064270..49a3f73f53 100644 --- a/deps/npm/node_modules/pacote/lib/util/is-package-bin.js +++ b/deps/npm/node_modules/pacote/lib/util/is-package-bin.js @@ -12,10 +12,11 @@ const binObj = (name, bin) => const hasBin = (pkg, path) => { const bin = binObj(pkg.name, pkg.bin) - const p = path.replace(/^[^\\\/]*\//, '') - for (const [k, v] of Object.entries(bin)) { - if (v === p) + const p = path.replace(/^[^\\/]*\//, '') + for (const kv of Object.entries(bin)) { + if (kv[1] === p) { return true + } } return false } diff --git a/deps/npm/node_modules/pacote/lib/util/npm.js b/deps/npm/node_modules/pacote/lib/util/npm.js index f2f29bd0ac..c444d788ad 100644 --- a/deps/npm/node_modules/pacote/lib/util/npm.js +++ b/deps/npm/node_modules/pacote/lib/util/npm.js @@ -1,6 +1,5 @@ // run an npm command const spawn = require('@npmcli/promise-spawn') -const {dirname} = require('path') module.exports = (npmBin, npmCommand, cwd, env, extra) => { const isJS = npmBin.endsWith('.js') diff --git a/deps/npm/node_modules/pacote/lib/util/proc-log.js b/deps/npm/node_modules/pacote/lib/util/proc-log.js deleted file mode 100644 index b2bdd9dc90..0000000000 --- a/deps/npm/node_modules/pacote/lib/util/proc-log.js +++ /dev/null @@ -1,21 +0,0 @@ -// default logger. -// emits 'log' events on the process -const LEVELS = [ - 'notice', - 'error', - 'warn', - 'info', - 'verbose', - 'http', - 'silly', - 'pause', - 'resume' -] - -const log = level => (...args) => process.emit('log', level, ...args) - -const logger = {} -for (const level of LEVELS) { - logger[level] = log(level) -} -module.exports = logger diff --git a/deps/npm/node_modules/pacote/lib/util/tar-create-options.js b/deps/npm/node_modules/pacote/lib/util/tar-create-options.js index 31ab34c9d9..d070f0f7ba 100644 --- a/deps/npm/node_modules/pacote/lib/util/tar-create-options.js +++ b/deps/npm/node_modules/pacote/lib/util/tar-create-options.js @@ -9,7 +9,7 @@ const tarCreateOptions = manifest => ({ // platform specific optimizations that cause // integrity mismatch errors due to differing // end results after compression - level: 9 + level: 9, }, // ensure that package bins are always executable @@ -17,8 +17,9 @@ const tarCreateOptions = manifest => ({ // anything that is not a regular file, ignored by // .npmignore or package.json "files", etc. filter: (path, stat) => { - if (isPackageBin(manifest, path)) + if (isPackageBin(manifest, path)) { stat.mode |= 0o111 + } return true }, diff --git a/deps/npm/node_modules/pacote/lib/util/trailing-slashes.js b/deps/npm/node_modules/pacote/lib/util/trailing-slashes.js new file mode 100644 index 0000000000..ff75dfd9c0 --- /dev/null +++ b/deps/npm/node_modules/pacote/lib/util/trailing-slashes.js @@ -0,0 +1,10 @@ +const removeTrailingSlashes = (input) => { + // in order to avoid regexp redos detection + let output = input + while (output.endsWith('/')) { + output = output.substr(0, output.length - 1) + } + return output +} + +module.exports = removeTrailingSlashes diff --git a/deps/npm/node_modules/pacote/package.json b/deps/npm/node_modules/pacote/package.json index ffbc067f68..fc6ab52fa9 100644 --- a/deps/npm/node_modules/pacote/package.json +++ b/deps/npm/node_modules/pacote/package.json @@ -1,8 +1,8 @@ { "name": "pacote", - "version": "12.0.3", + "version": "13.0.3", "description": "JavaScript package downloader", - "author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)", + "author": "GitHub Inc.", "bin": { "pacote": "lib/bin.js" }, @@ -13,19 +13,26 @@ "snap": "tap", "preversion": "npm test", "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" + "prepublishOnly": "git push origin --follow-tags", + "lint": "eslint '**/*.js'", + "postlint": "npm-template-check", + "lintfix": "npm run lint -- --fix", + "posttest": "npm run lint", + "template-copy": "npm-template-copy --force" }, "tap": { "timeout": 300, "coverage-map": "map.js" }, "devDependencies": { + "@npmcli/template-oss": "^2.7.1", "mutate-fs": "^2.1.1", "npm-registry-mock": "^1.3.1", - "tap": "^15.0.4" + "tap": "^15.1.6" }, "files": [ - "lib/**/*.js" + "bin", + "lib" ], "keywords": [ "packages", @@ -33,28 +40,34 @@ "git" ], "dependencies": { - "@npmcli/git": "^2.1.0", - "@npmcli/installed-package-contents": "^1.0.6", + "@npmcli/git": "^3.0.0", + "@npmcli/installed-package-contents": "^1.0.7", "@npmcli/promise-spawn": "^1.2.0", - "@npmcli/run-script": "^2.0.0", - "cacache": "^15.0.5", + "@npmcli/run-script": "^3.0.0", + "cacache": "^15.3.0", "chownr": "^2.0.0", "fs-minipass": "^2.1.0", "infer-owner": "^1.0.4", - "minipass": "^3.1.3", - "mkdirp": "^1.0.3", - "npm-package-arg": "^8.0.1", + "minipass": "^3.1.6", + "mkdirp": "^1.0.4", + "npm-package-arg": "^9.0.0", "npm-packlist": "^3.0.0", - "npm-pick-manifest": "^6.0.0", - "npm-registry-fetch": "^12.0.0", + "npm-pick-manifest": "^7.0.0", + "npm-registry-fetch": "^13.0.0", + "proc-log": "^2.0.0", "promise-retry": "^2.0.1", - "read-package-json-fast": "^2.0.1", + "read-package-json": "^4.1.1", + "read-package-json-fast": "^2.0.3", "rimraf": "^3.0.2", "ssri": "^8.0.1", - "tar": "^6.1.0" + "tar": "^6.1.11" }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16" }, - "repository": "git@github.com:npm/pacote" + "repository": "git@github.com:npm/pacote", + "templateOSS": { + "version": "2.7.1", + "windowsCI": false + } } diff --git a/deps/npm/node_modules/proc-log/index.js b/deps/npm/node_modules/proc-log/index.js deleted file mode 100644 index 9b58713ff3..0000000000 --- a/deps/npm/node_modules/proc-log/index.js +++ /dev/null @@ -1,22 +0,0 @@ -// emits 'log' events on the process -const LEVELS = [ - 'notice', - 'error', - 'warn', - 'info', - 'verbose', - 'http', - 'silly', - 'pause', - 'resume', -] - -const log = level => (...args) => process.emit('log', level, ...args) - -const logger = {} -for (const level of LEVELS) - logger[level] = log(level) - -logger.LEVELS = LEVELS - -module.exports = logger diff --git a/deps/npm/node_modules/libnpmversion/lib/proc-log.js b/deps/npm/node_modules/proc-log/lib/index.js index a7c683ba2f..7c5dfad3b7 100644 --- a/deps/npm/node_modules/libnpmversion/lib/proc-log.js +++ b/deps/npm/node_modules/proc-log/lib/index.js @@ -1,4 +1,3 @@ -// default logger. // emits 'log' events on the process const LEVELS = [ 'notice', @@ -18,4 +17,7 @@ const logger = {} for (const level of LEVELS) { logger[level] = log(level) } + +logger.LEVELS = LEVELS + module.exports = logger diff --git a/deps/npm/node_modules/proc-log/package.json b/deps/npm/node_modules/proc-log/package.json index 178009f61b..17e9249b7c 100644 --- a/deps/npm/node_modules/proc-log/package.json +++ b/deps/npm/node_modules/proc-log/package.json @@ -1,28 +1,36 @@ { "name": "proc-log", - "version": "1.0.0", + "version": "2.0.0", "files": [ - "index.js" + "bin", + "lib" ], + "main": "lib/index.js", "description": "just emit 'log' events on the process object", "repository": "https://github.com/npm/proc-log", - "author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)", + "author": "GitHub Inc.", "license": "ISC", "scripts": { "test": "tap", "snap": "tap", - "posttest": "eslint index.js test/*.js", + "posttest": "npm run lint", "postsnap": "eslint index.js test/*.js --fix", "preversion": "npm test", "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" + "prepublishOnly": "git push origin --follow-tags", + "lint": "eslint '**/*.js'", + "postlint": "npm-template-check", + "template-copy": "npm-template-copy --force", + "lintfix": "npm run lint -- --fix" }, "devDependencies": { - "eslint": "^7.9.0", - "eslint-plugin-import": "^2.22.0", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^4.2.1", - "eslint-plugin-standard": "^4.0.1", - "tap": "^15.0.2" + "@npmcli/template-oss": "^2.7.1", + "tap": "^15.1.6" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16" + }, + "templateOSS": { + "version": "2.7.1" } } diff --git a/deps/npm/node_modules/cli-columns/node_modules/string-width/index.d.ts b/deps/npm/node_modules/string-width/index.d.ts index 12b5309751..12b5309751 100644 --- a/deps/npm/node_modules/cli-columns/node_modules/string-width/index.d.ts +++ b/deps/npm/node_modules/string-width/index.d.ts diff --git a/deps/npm/node_modules/string-width/index.js b/deps/npm/node_modules/string-width/index.js index bbc49d29b1..f4d261a96a 100644 --- a/deps/npm/node_modules/string-width/index.js +++ b/deps/npm/node_modules/string-width/index.js @@ -1,18 +1,25 @@ 'use strict'; const stripAnsi = require('strip-ansi'); const isFullwidthCodePoint = require('is-fullwidth-code-point'); +const emojiRegex = require('emoji-regex'); -module.exports = str => { - if (typeof str !== 'string' || str.length === 0) { +const stringWidth = string => { + if (typeof string !== 'string' || string.length === 0) { return 0; } - str = stripAnsi(str); + string = stripAnsi(string); + + if (string.length === 0) { + return 0; + } + + string = string.replace(emojiRegex(), ' '); let width = 0; - for (let i = 0; i < str.length; i++) { - const code = str.codePointAt(i); + for (let i = 0; i < string.length; i++) { + const code = string.codePointAt(i); // Ignore control characters if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) { @@ -34,3 +41,7 @@ module.exports = str => { return width; }; + +module.exports = stringWidth; +// TODO: remove this in the next major version +module.exports.default = stringWidth; diff --git a/deps/npm/node_modules/string-width/node_modules/ansi-regex/index.d.ts b/deps/npm/node_modules/string-width/node_modules/ansi-regex/index.d.ts new file mode 100644 index 0000000000..2dbf6af2b6 --- /dev/null +++ b/deps/npm/node_modules/string-width/node_modules/ansi-regex/index.d.ts @@ -0,0 +1,37 @@ +declare namespace ansiRegex { + interface Options { + /** + Match only the first ANSI escape. + + @default false + */ + onlyFirst: boolean; + } +} + +/** +Regular expression for matching ANSI escape codes. + +@example +``` +import ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001B[4mcake\u001B[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001B[4mcake\u001B[0m'.match(ansiRegex()); +//=> ['\u001B[4m', '\u001B[0m'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] +``` +*/ +declare function ansiRegex(options?: ansiRegex.Options): RegExp; + +export = ansiRegex; diff --git a/deps/npm/node_modules/string-width/node_modules/ansi-regex/index.js b/deps/npm/node_modules/string-width/node_modules/ansi-regex/index.js index c4aaecf505..616ff837d3 100644 --- a/deps/npm/node_modules/string-width/node_modules/ansi-regex/index.js +++ b/deps/npm/node_modules/string-width/node_modules/ansi-regex/index.js @@ -1,10 +1,10 @@ 'use strict'; -module.exports = () => { +module.exports = ({onlyFirst = false} = {}) => { const pattern = [ - '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)', - '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))' + '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' ].join('|'); - return new RegExp(pattern, 'g'); + return new RegExp(pattern, onlyFirst ? undefined : 'g'); }; diff --git a/deps/npm/node_modules/string-width/node_modules/ansi-regex/package.json b/deps/npm/node_modules/string-width/node_modules/ansi-regex/package.json index e94852fd70..017f53116a 100644 --- a/deps/npm/node_modules/string-width/node_modules/ansi-regex/package.json +++ b/deps/npm/node_modules/string-width/node_modules/ansi-regex/package.json @@ -1,53 +1,55 @@ { - "name": "ansi-regex", - "version": "3.0.0", - "description": "Regular expression for matching ANSI escape codes", - "license": "MIT", - "repository": "chalk/ansi-regex", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=4" - }, - "scripts": { - "test": "xo && ava", - "view-supported": "node fixtures/view-codes.js" - }, - "files": [ - "index.js" - ], - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "text", - "regex", - "regexp", - "re", - "match", - "test", - "find", - "pattern" - ], - "devDependencies": { - "ava": "*", - "xo": "*" - } + "name": "ansi-regex", + "version": "5.0.1", + "description": "Regular expression for matching ANSI escape codes", + "license": "MIT", + "repository": "chalk/ansi-regex", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd", + "view-supported": "node fixtures/view-codes.js" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "devDependencies": { + "ava": "^2.4.0", + "tsd": "^0.9.0", + "xo": "^0.25.3" + } } diff --git a/deps/npm/node_modules/string-width/node_modules/ansi-regex/readme.md b/deps/npm/node_modules/string-width/node_modules/ansi-regex/readme.md index 22db1c3405..4d848bc36f 100644 --- a/deps/npm/node_modules/string-width/node_modules/ansi-regex/readme.md +++ b/deps/npm/node_modules/string-width/node_modules/ansi-regex/readme.md @@ -1,4 +1,4 @@ -# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex) +# ansi-regex > Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) @@ -23,9 +23,33 @@ ansiRegex().test('cake'); '\u001B[4mcake\u001B[0m'.match(ansiRegex()); //=> ['\u001B[4m', '\u001B[0m'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] ``` +## API + +### ansiRegex(options?) + +Returns a regex for matching ANSI escape codes. + +#### options + +Type: `object` + +##### onlyFirst + +Type: `boolean`<br> +Default: `false` *(Matches any ANSI escape codes in a string)* + +Match only the first ANSI escape. + + ## FAQ ### Why do you test for codes not in the ECMA 48 standard? @@ -41,6 +65,14 @@ On the historical side, those ECMA standards were established in the early 90's - [Josh Junon](https://github.com/qix-) -## License +--- -MIT +<div align="center"> + <b> + <a href="https://tidelift.com/subscription/pkg/npm-ansi-regex?utm_source=npm-ansi-regex&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> + </b> + <br> + <sub> + Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. + </sub> +</div> diff --git a/deps/npm/node_modules/string-width/node_modules/strip-ansi/index.d.ts b/deps/npm/node_modules/string-width/node_modules/strip-ansi/index.d.ts new file mode 100644 index 0000000000..907fccc292 --- /dev/null +++ b/deps/npm/node_modules/string-width/node_modules/strip-ansi/index.d.ts @@ -0,0 +1,17 @@ +/** +Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string. + +@example +``` +import stripAnsi = require('strip-ansi'); + +stripAnsi('\u001B[4mUnicorn\u001B[0m'); +//=> 'Unicorn' + +stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); +//=> 'Click' +``` +*/ +declare function stripAnsi(string: string): string; + +export = stripAnsi; diff --git a/deps/npm/node_modules/string-width/node_modules/strip-ansi/index.js b/deps/npm/node_modules/string-width/node_modules/strip-ansi/index.js index 96e0292c8e..9a593dfcd1 100644 --- a/deps/npm/node_modules/string-width/node_modules/strip-ansi/index.js +++ b/deps/npm/node_modules/string-width/node_modules/strip-ansi/index.js @@ -1,4 +1,4 @@ 'use strict'; const ansiRegex = require('ansi-regex'); -module.exports = input => typeof input === 'string' ? input.replace(ansiRegex(), '') : input; +module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; diff --git a/deps/npm/node_modules/string-width/node_modules/strip-ansi/package.json b/deps/npm/node_modules/string-width/node_modules/strip-ansi/package.json index 555f194616..1a41108d42 100644 --- a/deps/npm/node_modules/string-width/node_modules/strip-ansi/package.json +++ b/deps/npm/node_modules/string-width/node_modules/strip-ansi/package.json @@ -1,52 +1,54 @@ { - "name": "strip-ansi", - "version": "4.0.0", - "description": "Strip ANSI escape codes", - "license": "MIT", - "repository": "chalk/strip-ansi", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=4" - }, - "scripts": { - "test": "xo && ava" - }, - "files": [ - "index.js" - ], - "keywords": [ - "strip", - "trim", - "remove", - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "dependencies": { - "ansi-regex": "^3.0.0" - }, - "devDependencies": { - "ava": "*", - "xo": "*" - } + "name": "strip-ansi", + "version": "6.0.1", + "description": "Strip ANSI escape codes from a string", + "license": "MIT", + "repository": "chalk/strip-ansi", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "strip", + "trim", + "remove", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "devDependencies": { + "ava": "^2.4.0", + "tsd": "^0.10.0", + "xo": "^0.25.3" + } } diff --git a/deps/npm/node_modules/string-width/node_modules/strip-ansi/readme.md b/deps/npm/node_modules/string-width/node_modules/strip-ansi/readme.md index dc76f0cb1a..7c4b56d46d 100644 --- a/deps/npm/node_modules/string-width/node_modules/strip-ansi/readme.md +++ b/deps/npm/node_modules/string-width/node_modules/strip-ansi/readme.md @@ -1,6 +1,6 @@ # strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi) -> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) +> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string ## Install @@ -17,12 +17,23 @@ const stripAnsi = require('strip-ansi'); stripAnsi('\u001B[4mUnicorn\u001B[0m'); //=> 'Unicorn' + +stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); +//=> 'Click' ``` +## strip-ansi for enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of strip-ansi and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-strip-ansi?utm_source=npm-strip-ansi&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) + + ## Related - [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module +- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Streaming version of this module - [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes - [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes - [chalk](https://github.com/chalk/chalk) - Terminal string styling done right @@ -33,7 +44,3 @@ stripAnsi('\u001B[4mUnicorn\u001B[0m'); - [Sindre Sorhus](https://github.com/sindresorhus) - [Josh Junon](https://github.com/qix-) - -## License - -MIT diff --git a/deps/npm/node_modules/string-width/package.json b/deps/npm/node_modules/string-width/package.json index 89f0b6a6c6..28ba7b4cae 100644 --- a/deps/npm/node_modules/string-width/package.json +++ b/deps/npm/node_modules/string-width/package.json @@ -1,6 +1,6 @@ { "name": "string-width", - "version": "2.1.1", + "version": "4.2.3", "description": "Get the visual width of a string - the number of columns required to display it", "license": "MIT", "repository": "sindresorhus/string-width", @@ -10,19 +10,18 @@ "url": "sindresorhus.com" }, "engines": { - "node": ">=4" + "node": ">=8" }, "scripts": { - "test": "xo && ava" + "test": "xo && ava && tsd" }, "files": [ - "index.js" + "index.js", + "index.d.ts" ], "keywords": [ "string", - "str", "character", - "char", "unicode", "width", "visual", @@ -45,11 +44,13 @@ "fixed-width" ], "dependencies": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" }, "devDependencies": { - "ava": "*", - "xo": "*" + "ava": "^1.4.1", + "tsd": "^0.7.1", + "xo": "^0.24.0" } } diff --git a/deps/npm/node_modules/string-width/readme.md b/deps/npm/node_modules/string-width/readme.md index df5b7199f9..bdd314129c 100644 --- a/deps/npm/node_modules/string-width/readme.md +++ b/deps/npm/node_modules/string-width/readme.md @@ -1,4 +1,4 @@ -# string-width [![Build Status](https://travis-ci.org/sindresorhus/string-width.svg?branch=master)](https://travis-ci.org/sindresorhus/string-width) +# string-width > Get the visual width of a string - the number of columns required to display it @@ -19,14 +19,14 @@ $ npm install string-width ```js const stringWidth = require('string-width'); +stringWidth('a'); +//=> 1 + stringWidth('古'); //=> 2 -stringWidth('\u001b[1m古\u001b[22m'); +stringWidth('\u001B[1m古\u001B[22m'); //=> 2 - -stringWidth('a'); -//=> 1 ``` @@ -37,6 +37,14 @@ stringWidth('a'); - [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string -## License +--- -MIT © [Sindre Sorhus](https://sindresorhus.com) +<div align="center"> + <b> + <a href="https://tidelift.com/subscription/pkg/npm-string-width?utm_source=npm-string-width&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> + </b> + <br> + <sub> + Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. + </sub> +</div> diff --git a/deps/npm/node_modules/strip-ansi/index.js b/deps/npm/node_modules/strip-ansi/index.js deleted file mode 100644 index 099480fbfc..0000000000 --- a/deps/npm/node_modules/strip-ansi/index.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict'; -var ansiRegex = require('ansi-regex')(); - -module.exports = function (str) { - return typeof str === 'string' ? str.replace(ansiRegex, '') : str; -}; diff --git a/deps/npm/node_modules/strip-ansi/license b/deps/npm/node_modules/strip-ansi/license deleted file mode 100644 index 654d0bfe94..0000000000 --- a/deps/npm/node_modules/strip-ansi/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/deps/npm/node_modules/strip-ansi/package.json b/deps/npm/node_modules/strip-ansi/package.json deleted file mode 100644 index 301685ba32..0000000000 --- a/deps/npm/node_modules/strip-ansi/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "strip-ansi", - "version": "3.0.1", - "description": "Strip ANSI escape codes", - "license": "MIT", - "repository": "chalk/strip-ansi", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "maintainers": [ - "Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)", - "Joshua Boy Nicolai Appelman <joshua@jbna.nl> (jbna.nl)", - "JD Ballard <i.am.qix@gmail.com> (github.com/qix-)" - ], - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "xo && ava" - }, - "files": [ - "index.js" - ], - "keywords": [ - "strip", - "trim", - "remove", - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "devDependencies": { - "ava": "*", - "xo": "*" - } -} diff --git a/deps/npm/node_modules/strip-ansi/readme.md b/deps/npm/node_modules/strip-ansi/readme.md deleted file mode 100644 index cb7d9ff7ee..0000000000 --- a/deps/npm/node_modules/strip-ansi/readme.md +++ /dev/null @@ -1,33 +0,0 @@ -# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi) - -> Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -``` -$ npm install --save strip-ansi -``` - - -## Usage - -```js -var stripAnsi = require('strip-ansi'); - -stripAnsi('\u001b[4mcake\u001b[0m'); -//=> 'cake' -``` - - -## Related - -- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module -- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes -- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes -- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) |