Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGar <gar+gh@danger.computer>2021-09-02 17:36:26 +0300
committerGar <gar+gh@danger.computer>2021-09-02 17:36:26 +0300
commit4b913417c4e30980505a02eec50810f895dd52d7 (patch)
tree6ea6cf413ab2a255dd42391e713f10158b2077f1 /node_modules
parent0dcda73b022083338c4cb755390a275757b9627b (diff)
deps: npmlog@5.0.1
Diffstat (limited to 'node_modules')
-rw-r--r--node_modules/npmlog/log.js102
-rw-r--r--node_modules/npmlog/node_modules/are-we-there-yet/LICENSE.md18
-rw-r--r--node_modules/npmlog/node_modules/are-we-there-yet/lib/index.js4
-rw-r--r--node_modules/npmlog/node_modules/are-we-there-yet/lib/tracker-base.js11
-rw-r--r--node_modules/npmlog/node_modules/are-we-there-yet/lib/tracker-group.js116
-rw-r--r--node_modules/npmlog/node_modules/are-we-there-yet/lib/tracker-stream.js36
-rw-r--r--node_modules/npmlog/node_modules/are-we-there-yet/lib/tracker.js32
-rw-r--r--node_modules/npmlog/node_modules/are-we-there-yet/package.json53
-rw-r--r--node_modules/npmlog/package.json4
9 files changed, 340 insertions, 36 deletions
diff --git a/node_modules/npmlog/log.js b/node_modules/npmlog/log.js
index 069154262..85ab8a4c7 100644
--- a/node_modules/npmlog/log.js
+++ b/node_modules/npmlog/log.js
@@ -13,8 +13,9 @@ var stream = process.stderr
Object.defineProperty(log, 'stream', {
set: function (newStream) {
stream = newStream
- if (this.gauge)
+ if (this.gauge) {
this.gauge.setWriteTo(stream, stream)
+ }
},
get: function () {
return stream
@@ -78,20 +79,23 @@ log.setGaugeTemplate = function (template) {
}
log.enableProgress = function () {
- if (this.progressEnabled)
+ if (this.progressEnabled) {
return
+ }
this.progressEnabled = true
this.tracker.on('change', this.showProgress)
- if (this._paused)
+ if (this._paused) {
return
+ }
this.gauge.enable()
}
log.disableProgress = function () {
- if (!this.progressEnabled)
+ if (!this.progressEnabled) {
return
+ }
this.progressEnabled = false
this.tracker.removeListener('change', this.showProgress)
this.gauge.disable()
@@ -103,19 +107,23 @@ var mixinLog = function (tracker) {
// mixin the public methods from log into the tracker
// (except: conflicts and one's we handle specially)
Object.keys(log).forEach(function (P) {
- if (P[0] === '_')
+ if (P[0] === '_') {
return
+ }
if (trackerConstructors.filter(function (C) {
return C === P
- }).length)
+ }).length) {
return
+ }
- if (tracker[P])
+ if (tracker[P]) {
return
+ }
- if (typeof log[P] !== 'function')
+ if (typeof log[P] !== 'function') {
return
+ }
var func = log[P]
tracker[P] = function () {
@@ -143,27 +151,31 @@ trackerConstructors.forEach(function (C) {
})
log.clearProgress = function (cb) {
- if (!this.progressEnabled)
+ if (!this.progressEnabled) {
return cb && process.nextTick(cb)
+ }
this.gauge.hide(cb)
}
log.showProgress = function (name, completed) {
- if (!this.progressEnabled)
+ if (!this.progressEnabled) {
return
+ }
var values = {}
- if (name)
+ if (name) {
values.section = name
+ }
var last = log.record[log.record.length - 1]
if (last) {
values.subsection = last.prefix
var disp = log.disp[last.level] || last.level
var logline = this._format(disp, log.style[last.level])
- if (last.prefix)
+ if (last.prefix) {
logline += ' ' + this._format(last.prefix, this.prefixStyle)
+ }
logline += ' ' + last.message.split(/\r?\n/)[0]
values.logline = logline
@@ -175,13 +187,15 @@ log.showProgress = function (name, completed) {
// temporarily stop emitting, but don't drop
log.pause = function () {
this._paused = true
- if (this.progressEnabled)
+ if (this.progressEnabled) {
this.gauge.disable()
+ }
}
log.resume = function () {
- if (!this._paused)
+ if (!this._paused) {
return
+ }
this._paused = false
@@ -190,8 +204,9 @@ log.resume = function () {
b.forEach(function (m) {
this.emitLog(m)
}, this)
- if (this.progressEnabled)
+ if (this.progressEnabled) {
this.gauge.enable()
+ }
}
log._buffer = []
@@ -220,8 +235,9 @@ log.log = function (lvl, prefix, message) {
})
}
}
- if (stack)
+ if (stack) {
a.unshift(stack + '\n')
+ }
message = util.format.apply(util, a)
var m = {
@@ -234,8 +250,9 @@ log.log = function (lvl, prefix, message) {
this.emit('log', m)
this.emit('log.' + lvl, m)
- if (m.prefix)
+ if (m.prefix) {
this.emit(m.prefix, m)
+ }
this.record.push(m)
var mrs = this.maxRecordSize
@@ -253,18 +270,22 @@ log.emitLog = function (m) {
this._buffer.push(m)
return
}
- if (this.progressEnabled)
+ if (this.progressEnabled) {
this.gauge.pulse(m.prefix)
+ }
var l = this.levels[m.level]
- if (l === undefined)
+ if (l === undefined) {
return
+ }
- if (l < this.levels[this.level])
+ if (l < this.levels[this.level]) {
return
+ }
- if (l > 0 && !isFinite(l))
+ if (l > 0 && !isFinite(l)) {
return
+ }
// If 'disp' is null or undefined, use the lvl as a default
// Allows: '', 0 as valid disp
@@ -277,8 +298,9 @@ log.emitLog = function (m) {
}
this.write(disp, log.style[m.level])
var p = m.prefix || ''
- if (p)
+ if (p) {
this.write(' ')
+ }
this.write(p, this.prefixStyle)
this.write(' ' + line + '\n')
@@ -287,52 +309,63 @@ log.emitLog = function (m) {
}
log._format = function (msg, style) {
- if (!stream)
+ if (!stream) {
return
+ }
var output = ''
if (this.useColor()) {
style = style || {}
var settings = []
- if (style.fg)
+ if (style.fg) {
settings.push(style.fg)
+ }
- if (style.bg)
+ if (style.bg) {
settings.push('bg' + style.bg[0].toUpperCase() + style.bg.slice(1))
+ }
- if (style.bold)
+ if (style.bold) {
settings.push('bold')
+ }
- if (style.underline)
+ if (style.underline) {
settings.push('underline')
+ }
- if (style.inverse)
+ if (style.inverse) {
settings.push('inverse')
+ }
- if (settings.length)
+ if (settings.length) {
output += consoleControl.color(settings)
+ }
- if (style.beep)
+ if (style.beep) {
output += consoleControl.beep()
+ }
}
output += msg
- if (this.useColor())
+ if (this.useColor()) {
output += consoleControl.color('reset')
+ }
return output
}
log.write = function (msg, style) {
- if (!stream)
+ if (!stream) {
return
+ }
stream.write(this._format(msg, style))
}
log.addLevel = function (lvl, n, style, disp) {
// If 'disp' is null or undefined, use the lvl as a default
- if (disp == null)
+ if (disp == null) {
disp = lvl
+ }
this.levels[lvl] = n
this.style[lvl] = style
@@ -340,8 +373,9 @@ log.addLevel = function (lvl, n, style, disp) {
this[lvl] = function () {
var a = new Array(arguments.length + 1)
a[0] = lvl
- for (var i = 0; i < arguments.length; i++)
+ for (var i = 0; i < arguments.length; i++) {
a[i + 1] = arguments[i]
+ }
return this.log.apply(this, a)
}.bind(this)
diff --git a/node_modules/npmlog/node_modules/are-we-there-yet/LICENSE.md b/node_modules/npmlog/node_modules/are-we-there-yet/LICENSE.md
new file mode 100644
index 000000000..845be76f6
--- /dev/null
+++ b/node_modules/npmlog/node_modules/are-we-there-yet/LICENSE.md
@@ -0,0 +1,18 @@
+ISC License
+
+Copyright npm, Inc.
+
+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 NPM DISCLAIMS ALL
+WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
+EVENT SHALL NPM 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/node_modules/npmlog/node_modules/are-we-there-yet/lib/index.js b/node_modules/npmlog/node_modules/are-we-there-yet/lib/index.js
new file mode 100644
index 000000000..57d8743fd
--- /dev/null
+++ b/node_modules/npmlog/node_modules/are-we-there-yet/lib/index.js
@@ -0,0 +1,4 @@
+'use strict'
+exports.TrackerGroup = require('./tracker-group.js')
+exports.Tracker = require('./tracker.js')
+exports.TrackerStream = require('./tracker-stream.js')
diff --git a/node_modules/npmlog/node_modules/are-we-there-yet/lib/tracker-base.js b/node_modules/npmlog/node_modules/are-we-there-yet/lib/tracker-base.js
new file mode 100644
index 000000000..6f4368755
--- /dev/null
+++ b/node_modules/npmlog/node_modules/are-we-there-yet/lib/tracker-base.js
@@ -0,0 +1,11 @@
+'use strict'
+var EventEmitter = require('events').EventEmitter
+var util = require('util')
+
+var trackerId = 0
+var TrackerBase = module.exports = function (name) {
+ EventEmitter.call(this)
+ this.id = ++trackerId
+ this.name = name
+}
+util.inherits(TrackerBase, EventEmitter)
diff --git a/node_modules/npmlog/node_modules/are-we-there-yet/lib/tracker-group.js b/node_modules/npmlog/node_modules/are-we-there-yet/lib/tracker-group.js
new file mode 100644
index 000000000..9da13f8a7
--- /dev/null
+++ b/node_modules/npmlog/node_modules/are-we-there-yet/lib/tracker-group.js
@@ -0,0 +1,116 @@
+'use strict'
+var util = require('util')
+var TrackerBase = require('./tracker-base.js')
+var Tracker = require('./tracker.js')
+var TrackerStream = require('./tracker-stream.js')
+
+var TrackerGroup = module.exports = function (name) {
+ TrackerBase.call(this, name)
+ this.parentGroup = null
+ this.trackers = []
+ this.completion = {}
+ this.weight = {}
+ this.totalWeight = 0
+ this.finished = false
+ this.bubbleChange = bubbleChange(this)
+}
+util.inherits(TrackerGroup, TrackerBase)
+
+function bubbleChange (trackerGroup) {
+ return function (name, completed, tracker) {
+ trackerGroup.completion[tracker.id] = completed
+ if (trackerGroup.finished) {
+ return
+ }
+ trackerGroup.emit('change', name || trackerGroup.name, trackerGroup.completed(), trackerGroup)
+ }
+}
+
+TrackerGroup.prototype.nameInTree = function () {
+ var names = []
+ var from = this
+ while (from) {
+ names.unshift(from.name)
+ from = from.parentGroup
+ }
+ return names.join('/')
+}
+
+TrackerGroup.prototype.addUnit = function (unit, weight) {
+ if (unit.addUnit) {
+ var toTest = this
+ while (toTest) {
+ if (unit === toTest) {
+ throw new Error(
+ 'Attempted to add tracker group ' +
+ unit.name + ' to tree that already includes it ' +
+ this.nameInTree(this))
+ }
+ toTest = toTest.parentGroup
+ }
+ unit.parentGroup = this
+ }
+ this.weight[unit.id] = weight || 1
+ this.totalWeight += this.weight[unit.id]
+ this.trackers.push(unit)
+ this.completion[unit.id] = unit.completed()
+ unit.on('change', this.bubbleChange)
+ if (!this.finished) {
+ this.emit('change', unit.name, this.completion[unit.id], unit)
+ }
+ return unit
+}
+
+TrackerGroup.prototype.completed = function () {
+ if (this.trackers.length === 0) {
+ return 0
+ }
+ var valPerWeight = 1 / this.totalWeight
+ var completed = 0
+ for (var ii = 0; ii < this.trackers.length; ii++) {
+ var trackerId = this.trackers[ii].id
+ completed +=
+ valPerWeight * this.weight[trackerId] * this.completion[trackerId]
+ }
+ return completed
+}
+
+TrackerGroup.prototype.newGroup = function (name, weight) {
+ return this.addUnit(new TrackerGroup(name), weight)
+}
+
+TrackerGroup.prototype.newItem = function (name, todo, weight) {
+ return this.addUnit(new Tracker(name, todo), weight)
+}
+
+TrackerGroup.prototype.newStream = function (name, todo, weight) {
+ return this.addUnit(new TrackerStream(name, todo), weight)
+}
+
+TrackerGroup.prototype.finish = function () {
+ this.finished = true
+ if (!this.trackers.length) {
+ this.addUnit(new Tracker(), 1, true)
+ }
+ for (var ii = 0; ii < this.trackers.length; ii++) {
+ var tracker = this.trackers[ii]
+ tracker.finish()
+ tracker.removeListener('change', this.bubbleChange)
+ }
+ this.emit('change', this.name, 1, this)
+}
+
+var buffer = ' '
+TrackerGroup.prototype.debug = function (depth) {
+ depth = depth || 0
+ var indent = depth ? buffer.substr(0, depth) : ''
+ var output = indent + (this.name || 'top') + ': ' + this.completed() + '\n'
+ this.trackers.forEach(function (tracker) {
+ if (tracker instanceof TrackerGroup) {
+ output += tracker.debug(depth + 1)
+ } else {
+ output += indent + ' ' + tracker.name + ': ' + tracker.completed() + '\n'
+ }
+ })
+ return output
+}
diff --git a/node_modules/npmlog/node_modules/are-we-there-yet/lib/tracker-stream.js b/node_modules/npmlog/node_modules/are-we-there-yet/lib/tracker-stream.js
new file mode 100644
index 000000000..e1cf85055
--- /dev/null
+++ b/node_modules/npmlog/node_modules/are-we-there-yet/lib/tracker-stream.js
@@ -0,0 +1,36 @@
+'use strict'
+var util = require('util')
+var stream = require('readable-stream')
+var delegate = require('delegates')
+var Tracker = require('./tracker.js')
+
+var TrackerStream = module.exports = function (name, size, options) {
+ stream.Transform.call(this, options)
+ this.tracker = new Tracker(name, size)
+ this.name = name
+ this.id = this.tracker.id
+ this.tracker.on('change', delegateChange(this))
+}
+util.inherits(TrackerStream, stream.Transform)
+
+function delegateChange (trackerStream) {
+ return function (name, completion, tracker) {
+ trackerStream.emit('change', name, completion, trackerStream)
+ }
+}
+
+TrackerStream.prototype._transform = function (data, encoding, cb) {
+ this.tracker.completeWork(data.length ? data.length : 1)
+ this.push(data)
+ cb()
+}
+
+TrackerStream.prototype._flush = function (cb) {
+ this.tracker.finish()
+ cb()
+}
+
+delegate(TrackerStream.prototype, 'tracker')
+ .method('completed')
+ .method('addWork')
+ .method('finish')
diff --git a/node_modules/npmlog/node_modules/are-we-there-yet/lib/tracker.js b/node_modules/npmlog/node_modules/are-we-there-yet/lib/tracker.js
new file mode 100644
index 000000000..a8f8b3ba0
--- /dev/null
+++ b/node_modules/npmlog/node_modules/are-we-there-yet/lib/tracker.js
@@ -0,0 +1,32 @@
+'use strict'
+var util = require('util')
+var TrackerBase = require('./tracker-base.js')
+
+var Tracker = module.exports = function (name, todo) {
+ TrackerBase.call(this, name)
+ this.workDone = 0
+ this.workTodo = todo || 0
+}
+util.inherits(Tracker, TrackerBase)
+
+Tracker.prototype.completed = function () {
+ return this.workTodo === 0 ? 0 : this.workDone / this.workTodo
+}
+
+Tracker.prototype.addWork = function (work) {
+ this.workTodo += work
+ this.emit('change', this.name, this.completed(), this)
+}
+
+Tracker.prototype.completeWork = function (work) {
+ this.workDone += work
+ if (this.workDone > this.workTodo) {
+ this.workDone = this.workTodo
+ }
+ this.emit('change', this.name, this.completed(), this)
+}
+
+Tracker.prototype.finish = function () {
+ this.workTodo = this.workDone = 1
+ this.emit('change', this.name, 1, this)
+}
diff --git a/node_modules/npmlog/node_modules/are-we-there-yet/package.json b/node_modules/npmlog/node_modules/are-we-there-yet/package.json
new file mode 100644
index 000000000..5714e09c3
--- /dev/null
+++ b/node_modules/npmlog/node_modules/are-we-there-yet/package.json
@@ -0,0 +1,53 @@
+{
+ "name": "are-we-there-yet",
+ "version": "2.0.0",
+ "description": "Keep track of the overall completion of many disparate processes",
+ "main": "lib/index.js",
+ "scripts": {
+ "test": "tap",
+ "npmclilint": "npmcli-lint",
+ "lint": "eslint '**/*.js'",
+ "lintfix": "npm run lint -- --fix",
+ "posttest": "npm run lint",
+ "postsnap": "npm run lintfix --",
+ "preversion": "npm test",
+ "postversion": "npm publish",
+ "prepublishOnly": "git push origin --follow-tags",
+ "snap": "tap"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/npm/are-we-there-yet.git"
+ },
+ "author": "GitHub Inc.",
+ "license": "ISC",
+ "bugs": {
+ "url": "https://github.com/npm/are-we-there-yet/issues"
+ },
+ "homepage": "https://github.com/npm/are-we-there-yet",
+ "devDependencies": {
+ "@npmcli/eslint-config": "^1.0.0",
+ "@npmcli/template-oss": "^1.0.2",
+ "eslint": "^7.32.0",
+ "eslint-plugin-node": "^11.1.0",
+ "tap": "^15.0.9"
+ },
+ "dependencies": {
+ "delegates": "^1.0.0",
+ "readable-stream": "^3.6.0"
+ },
+ "files": [
+ "bin",
+ "lib"
+ ],
+ "engines": {
+ "node": ">=10"
+ },
+ "tap": {
+ "branches": 68,
+ "statements": 92,
+ "functions": 86,
+ "lines": 92
+ },
+ "templateVersion": "1.0.2"
+}
diff --git a/node_modules/npmlog/package.json b/node_modules/npmlog/package.json
index 5288b9ca0..960ea9250 100644
--- a/node_modules/npmlog/package.json
+++ b/node_modules/npmlog/package.json
@@ -2,7 +2,7 @@
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
"name": "npmlog",
"description": "logger for npm",
- "version": "5.0.0",
+ "version": "5.0.1",
"repository": {
"type": "git",
"url": "https://github.com/npm/npmlog.git"
@@ -20,7 +20,7 @@
"postsnap": "npm run lintfix --"
},
"dependencies": {
- "are-we-there-yet": "^1.1.5",
+ "are-we-there-yet": "^2.0.0",
"console-control-strings": "^1.1.0",
"gauge": "^3.0.0",
"set-blocking": "^2.0.0"