pnpm 6.22.2 → 6.23.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node_modules/ansi-regex/index.js +8 -2
- package/dist/node_modules/ansi-regex/license +4 -16
- package/dist/node_modules/ansi-regex/package.json +53 -62
- package/dist/node_modules/aproba/index.js +33 -33
- package/dist/node_modules/aproba/package.json +5 -4
- package/dist/node_modules/are-we-there-yet/{index.js → lib/index.js} +0 -0
- package/dist/node_modules/are-we-there-yet/{tracker-base.js → lib/tracker-base.js} +0 -0
- package/dist/node_modules/are-we-there-yet/{tracker-group.js → lib/tracker-group.js} +14 -5
- package/dist/node_modules/are-we-there-yet/{tracker-stream.js → lib/tracker-stream.js} +0 -0
- package/dist/node_modules/are-we-there-yet/{tracker.js → lib/tracker.js} +3 -1
- package/dist/node_modules/are-we-there-yet/package.json +35 -17
- package/dist/node_modules/{npmlog → color-support}/LICENSE +0 -0
- package/dist/node_modules/color-support/bin.js +3 -0
- package/dist/node_modules/color-support/browser.js +14 -0
- package/dist/node_modules/color-support/index.js +134 -0
- package/dist/node_modules/color-support/package.json +36 -0
- package/dist/node_modules/debug/LICENSE +10 -9
- package/dist/node_modules/debug/package.json +6 -6
- package/dist/node_modules/debug/src/common.js +1 -1
- package/dist/node_modules/gauge/{base-theme.js → lib/base-theme.js} +7 -3
- package/dist/node_modules/gauge/lib/demo.js +45 -0
- package/dist/node_modules/gauge/{error.js → lib/error.js} +0 -0
- package/dist/node_modules/gauge/lib/has-color.js +4 -0
- package/dist/node_modules/gauge/{index.js → lib/index.js} +90 -33
- package/dist/node_modules/gauge/{plumbing.js → lib/plumbing.js} +3 -1
- package/dist/node_modules/gauge/{process.js → lib/process.js} +0 -0
- package/dist/node_modules/gauge/{progress-bar.js → lib/progress-bar.js} +12 -6
- package/dist/node_modules/gauge/{render-template.js → lib/render-template.js} +69 -28
- package/dist/node_modules/gauge/{set-immediate.js → lib/set-immediate.js} +0 -0
- package/dist/node_modules/gauge/{set-interval.js → lib/set-interval.js} +0 -0
- package/dist/node_modules/gauge/{spin.js → lib/spin.js} +0 -0
- package/dist/node_modules/gauge/{template-item.js → lib/template-item.js} +21 -7
- package/dist/node_modules/gauge/{theme-set.js → lib/theme-set.js} +31 -24
- package/dist/node_modules/gauge/lib/themes.js +56 -0
- package/dist/node_modules/gauge/{wide-truncate.js → lib/wide-truncate.js} +9 -3
- package/dist/node_modules/gauge/package.json +39 -40
- package/dist/node_modules/is-fullwidth-code-point/index.js +40 -36
- package/dist/node_modules/is-fullwidth-code-point/license +4 -16
- package/dist/node_modules/is-fullwidth-code-point/package.json +40 -43
- package/dist/node_modules/node-gyp/package.json +2 -2
- package/dist/node_modules/npmlog/{log.js → lib/log.js} +148 -54
- package/dist/node_modules/npmlog/package.json +30 -12
- package/dist/node_modules/readable-stream/errors-browser.js +127 -0
- package/dist/node_modules/readable-stream/errors.js +116 -0
- package/dist/node_modules/readable-stream/experimentalWarning.js +17 -0
- package/dist/node_modules/readable-stream/lib/_stream_duplex.js +52 -44
- package/dist/node_modules/readable-stream/lib/_stream_passthrough.js +1 -9
- package/dist/node_modules/readable-stream/lib/_stream_readable.js +446 -341
- package/dist/node_modules/readable-stream/lib/_stream_transform.js +29 -42
- package/dist/node_modules/readable-stream/lib/_stream_writable.js +200 -190
- package/dist/node_modules/readable-stream/lib/internal/streams/async_iterator.js +207 -0
- package/dist/node_modules/readable-stream/lib/internal/streams/buffer_list.js +210 -0
- package/dist/node_modules/readable-stream/lib/internal/streams/destroy.js +48 -17
- package/dist/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +104 -0
- package/dist/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
- package/dist/node_modules/readable-stream/lib/internal/streams/from.js +64 -0
- package/dist/node_modules/readable-stream/lib/internal/streams/pipeline.js +97 -0
- package/dist/node_modules/readable-stream/lib/internal/streams/state.js +27 -0
- package/dist/node_modules/readable-stream/package.json +35 -19
- package/dist/node_modules/readable-stream/readable-browser.js +2 -0
- package/dist/node_modules/readable-stream/readable.js +5 -8
- package/dist/node_modules/safe-buffer/index.js +3 -0
- package/dist/node_modules/safe-buffer/package.json +18 -4
- package/dist/node_modules/signal-exit/index.js +30 -8
- package/dist/node_modules/signal-exit/package.json +7 -5
- package/dist/node_modules/socks-proxy-agent/package.json +2 -2
- package/dist/node_modules/string-width/index.js +29 -19
- package/dist/node_modules/string-width/license +4 -16
- package/dist/node_modules/string-width/package.json +54 -54
- package/dist/node_modules/string_decoder/package.json +5 -2
- package/dist/node_modules/strip-ansi/index.js +2 -4
- package/dist/node_modules/strip-ansi/license +4 -16
- package/dist/node_modules/strip-ansi/package.json +52 -55
- package/dist/pnpm.cjs +52779 -4337
- package/package.json +18 -18
- package/dist/node_modules/are-we-there-yet/LICENSE +0 -5
- package/dist/node_modules/code-point-at/index.js +0 -32
- package/dist/node_modules/code-point-at/license +0 -21
- package/dist/node_modules/code-point-at/package.json +0 -38
- package/dist/node_modules/core-util-is/LICENSE +0 -19
- package/dist/node_modules/core-util-is/lib/util.js +0 -107
- package/dist/node_modules/core-util-is/package.json +0 -38
- package/dist/node_modules/gauge/LICENSE +0 -13
- package/dist/node_modules/gauge/has-color.js +0 -12
- package/dist/node_modules/gauge/themes.js +0 -54
- package/dist/node_modules/isarray/component.json +0 -19
- package/dist/node_modules/isarray/index.js +0 -5
- package/dist/node_modules/isarray/package.json +0 -45
- package/dist/node_modules/isarray/test.js +0 -20
- package/dist/node_modules/number-is-nan/index.js +0 -4
- package/dist/node_modules/number-is-nan/license +0 -21
- package/dist/node_modules/number-is-nan/package.json +0 -35
- package/dist/node_modules/object-assign/index.js +0 -90
- package/dist/node_modules/object-assign/license +0 -21
- package/dist/node_modules/object-assign/package.json +0 -42
- package/dist/node_modules/process-nextick-args/index.js +0 -45
- package/dist/node_modules/process-nextick-args/package.json +0 -25
- package/dist/node_modules/readable-stream/duplex-browser.js +0 -1
- package/dist/node_modules/readable-stream/duplex.js +0 -1
- package/dist/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -79
- package/dist/node_modules/readable-stream/passthrough.js +0 -1
- package/dist/node_modules/readable-stream/transform.js +0 -1
- package/dist/node_modules/readable-stream/writable-browser.js +0 -1
- package/dist/node_modules/readable-stream/writable.js +0 -8
- package/dist/node_modules/wide-align/node_modules/ansi-regex/index.js +0 -10
- package/dist/node_modules/wide-align/node_modules/ansi-regex/license +0 -9
- package/dist/node_modules/wide-align/node_modules/ansi-regex/package.json +0 -55
- package/dist/node_modules/wide-align/node_modules/is-fullwidth-code-point/index.js +0 -50
- package/dist/node_modules/wide-align/node_modules/is-fullwidth-code-point/license +0 -9
- package/dist/node_modules/wide-align/node_modules/is-fullwidth-code-point/package.json +0 -42
- package/dist/node_modules/wide-align/node_modules/string-width/index.js +0 -47
- package/dist/node_modules/wide-align/node_modules/string-width/license +0 -9
- package/dist/node_modules/wide-align/node_modules/string-width/package.json +0 -56
- package/dist/node_modules/wide-align/node_modules/strip-ansi/index.js +0 -4
- package/dist/node_modules/wide-align/node_modules/strip-ansi/license +0 -9
- package/dist/node_modules/wide-align/node_modules/strip-ansi/package.json +0 -54
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
module.exports = ({onlyFirst = false} = {}) => {
|
|
4
|
+
const pattern = [
|
|
5
|
+
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
|
|
6
|
+
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
|
|
7
|
+
].join('|');
|
|
8
|
+
|
|
9
|
+
return new RegExp(pattern, onlyFirst ? undefined : 'g');
|
|
4
10
|
};
|
|
@@ -1,21 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
3
|
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
4
4
|
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
5
|
+
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:
|
|
11
6
|
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
14
8
|
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|
|
9
|
+
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.
|
|
@@ -1,64 +1,55 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"ava": "0.17.0",
|
|
56
|
-
"xo": "0.16.0"
|
|
57
|
-
},
|
|
58
|
-
"xo": {
|
|
59
|
-
"rules": {
|
|
60
|
-
"guard-for-in": 0,
|
|
61
|
-
"no-loop-func": 0
|
|
62
|
-
}
|
|
63
|
-
}
|
|
2
|
+
"name": "ansi-regex",
|
|
3
|
+
"version": "5.0.1",
|
|
4
|
+
"description": "Regular expression for matching ANSI escape codes",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "chalk/ansi-regex",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Sindre Sorhus",
|
|
9
|
+
"email": "sindresorhus@gmail.com",
|
|
10
|
+
"url": "sindresorhus.com"
|
|
11
|
+
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=8"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test": "xo && ava && tsd",
|
|
17
|
+
"view-supported": "node fixtures/view-codes.js"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"index.js",
|
|
21
|
+
"index.d.ts"
|
|
22
|
+
],
|
|
23
|
+
"keywords": [
|
|
24
|
+
"ansi",
|
|
25
|
+
"styles",
|
|
26
|
+
"color",
|
|
27
|
+
"colour",
|
|
28
|
+
"colors",
|
|
29
|
+
"terminal",
|
|
30
|
+
"console",
|
|
31
|
+
"cli",
|
|
32
|
+
"string",
|
|
33
|
+
"tty",
|
|
34
|
+
"escape",
|
|
35
|
+
"formatting",
|
|
36
|
+
"rgb",
|
|
37
|
+
"256",
|
|
38
|
+
"shell",
|
|
39
|
+
"xterm",
|
|
40
|
+
"command-line",
|
|
41
|
+
"text",
|
|
42
|
+
"regex",
|
|
43
|
+
"regexp",
|
|
44
|
+
"re",
|
|
45
|
+
"match",
|
|
46
|
+
"test",
|
|
47
|
+
"find",
|
|
48
|
+
"pattern"
|
|
49
|
+
],
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"ava": "^2.4.0",
|
|
52
|
+
"tsd": "^0.9.0",
|
|
53
|
+
"xo": "^0.25.3"
|
|
54
|
+
}
|
|
64
55
|
}
|
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
'use strict'
|
|
2
|
+
module.exports = validate
|
|
2
3
|
|
|
3
4
|
function isArguments (thingy) {
|
|
4
5
|
return thingy != null && typeof thingy === 'object' && thingy.hasOwnProperty('callee')
|
|
5
6
|
}
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
'*': {label: 'any', check:
|
|
9
|
-
A: {label: 'array', check:
|
|
10
|
-
S: {label: 'string', check:
|
|
11
|
-
N: {label: 'number', check:
|
|
12
|
-
F: {label: 'function', check:
|
|
13
|
-
O: {label: 'object', check:
|
|
14
|
-
B: {label: 'boolean', check:
|
|
15
|
-
E: {label: 'error', check:
|
|
16
|
-
Z: {label: 'null', check:
|
|
8
|
+
const types = {
|
|
9
|
+
'*': {label: 'any', check: () => true},
|
|
10
|
+
A: {label: 'array', check: _ => Array.isArray(_) || isArguments(_)},
|
|
11
|
+
S: {label: 'string', check: _ => typeof _ === 'string'},
|
|
12
|
+
N: {label: 'number', check: _ => typeof _ === 'number'},
|
|
13
|
+
F: {label: 'function', check: _ => typeof _ === 'function'},
|
|
14
|
+
O: {label: 'object', check: _ => typeof _ === 'object' && _ != null && !types.A.check(_) && !types.E.check(_)},
|
|
15
|
+
B: {label: 'boolean', check: _ => typeof _ === 'boolean'},
|
|
16
|
+
E: {label: 'error', check: _ => _ instanceof Error},
|
|
17
|
+
Z: {label: 'null', check: _ => _ == null}
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
function addSchema (schema, arity) {
|
|
20
|
-
|
|
21
|
+
const group = arity[schema.length] = arity[schema.length] || []
|
|
21
22
|
if (group.indexOf(schema) === -1) group.push(schema)
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
function validate (rawSchemas, args) {
|
|
25
26
|
if (arguments.length !== 2) throw wrongNumberOfArgs(['SA'], arguments.length)
|
|
26
27
|
if (!rawSchemas) throw missingRequiredArg(0, 'rawSchemas')
|
|
27
28
|
if (!args) throw missingRequiredArg(1, 'args')
|
|
28
29
|
if (!types.S.check(rawSchemas)) throw invalidType(0, ['string'], rawSchemas)
|
|
29
30
|
if (!types.A.check(args)) throw invalidType(1, ['array'], args)
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
const schemas = rawSchemas.split('|')
|
|
32
|
+
const arity = {}
|
|
32
33
|
|
|
33
|
-
schemas.forEach(
|
|
34
|
-
for (
|
|
35
|
-
|
|
34
|
+
schemas.forEach(schema => {
|
|
35
|
+
for (let ii = 0; ii < schema.length; ++ii) {
|
|
36
|
+
const type = schema[ii]
|
|
36
37
|
if (!types[type]) throw unknownType(ii, type)
|
|
37
38
|
}
|
|
38
39
|
if (/E.*E/.test(schema)) throw moreThanOneError(schema)
|
|
@@ -43,20 +44,18 @@ var validate = module.exports = function (rawSchemas, args) {
|
|
|
43
44
|
if (schema.length === 1) addSchema('', arity)
|
|
44
45
|
}
|
|
45
46
|
})
|
|
46
|
-
|
|
47
|
+
let matching = arity[args.length]
|
|
47
48
|
if (!matching) {
|
|
48
49
|
throw wrongNumberOfArgs(Object.keys(arity), args.length)
|
|
49
50
|
}
|
|
50
|
-
for (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
for (let ii = 0; ii < args.length; ++ii) {
|
|
52
|
+
let newMatching = matching.filter(schema => {
|
|
53
|
+
const type = schema[ii]
|
|
54
|
+
const typeCheck = types[type].check
|
|
54
55
|
return typeCheck(args[ii])
|
|
55
56
|
})
|
|
56
57
|
if (!newMatching.length) {
|
|
57
|
-
|
|
58
|
-
return types[schema[ii]].label
|
|
59
|
-
}).filter(function (schema) { return schema != null })
|
|
58
|
+
const labels = matching.map(_ => types[_[ii]].label).filter(_ => _ != null)
|
|
60
59
|
throw invalidType(ii, labels, args[ii])
|
|
61
60
|
}
|
|
62
61
|
matching = newMatching
|
|
@@ -72,8 +71,8 @@ function unknownType (num, type) {
|
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
function invalidType (num, expectedTypes, value) {
|
|
75
|
-
|
|
76
|
-
Object.keys(types).forEach(
|
|
74
|
+
let valueType
|
|
75
|
+
Object.keys(types).forEach(typeCode => {
|
|
77
76
|
if (types[typeCode].check(value)) valueType = types[typeCode].label
|
|
78
77
|
})
|
|
79
78
|
return newException('EINVALIDTYPE', 'Argument #' + (num + 1) + ': Expected ' +
|
|
@@ -85,8 +84,8 @@ function englishList (list) {
|
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
function wrongNumberOfArgs (expected, got) {
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
const english = englishList(expected)
|
|
88
|
+
const args = expected.every(ex => ex.length === 1)
|
|
90
89
|
? 'argument'
|
|
91
90
|
: 'arguments'
|
|
92
91
|
return newException('EWRONGARGCOUNT', 'Expected ' + english + ' ' + args + ' but got ' + got)
|
|
@@ -98,8 +97,9 @@ function moreThanOneError (schema) {
|
|
|
98
97
|
}
|
|
99
98
|
|
|
100
99
|
function newException (code, msg) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
const err = new Error(msg)
|
|
101
|
+
err.code = code
|
|
102
|
+
/* istanbul ignore else */
|
|
103
|
+
if (Error.captureStackTrace) Error.captureStackTrace(err, validate)
|
|
104
|
+
return err
|
|
105
105
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aproba",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A ridiculously light-weight argument validator (now browser friendly)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"directories": {
|
|
@@ -8,14 +8,15 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {},
|
|
10
10
|
"devDependencies": {
|
|
11
|
-
"standard": "^
|
|
12
|
-
"tap": "^
|
|
11
|
+
"standard": "^11.0.1",
|
|
12
|
+
"tap": "^12.0.1"
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"index.js"
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
|
-
"
|
|
18
|
+
"pretest": "standard",
|
|
19
|
+
"test": "tap --100 -J test/*.js"
|
|
19
20
|
},
|
|
20
21
|
"repository": {
|
|
21
22
|
"type": "git",
|
|
File without changes
|
|
File without changes
|
|
@@ -19,7 +19,9 @@ util.inherits(TrackerGroup, TrackerBase)
|
|
|
19
19
|
function bubbleChange (trackerGroup) {
|
|
20
20
|
return function (name, completed, tracker) {
|
|
21
21
|
trackerGroup.completion[tracker.id] = completed
|
|
22
|
-
if (trackerGroup.finished)
|
|
22
|
+
if (trackerGroup.finished) {
|
|
23
|
+
return
|
|
24
|
+
}
|
|
23
25
|
trackerGroup.emit('change', name || trackerGroup.name, trackerGroup.completed(), trackerGroup)
|
|
24
26
|
}
|
|
25
27
|
}
|
|
@@ -53,17 +55,22 @@ TrackerGroup.prototype.addUnit = function (unit, weight) {
|
|
|
53
55
|
this.trackers.push(unit)
|
|
54
56
|
this.completion[unit.id] = unit.completed()
|
|
55
57
|
unit.on('change', this.bubbleChange)
|
|
56
|
-
if (!this.finished)
|
|
58
|
+
if (!this.finished) {
|
|
59
|
+
this.emit('change', unit.name, this.completion[unit.id], unit)
|
|
60
|
+
}
|
|
57
61
|
return unit
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
TrackerGroup.prototype.completed = function () {
|
|
61
|
-
if (this.trackers.length === 0)
|
|
65
|
+
if (this.trackers.length === 0) {
|
|
66
|
+
return 0
|
|
67
|
+
}
|
|
62
68
|
var valPerWeight = 1 / this.totalWeight
|
|
63
69
|
var completed = 0
|
|
64
70
|
for (var ii = 0; ii < this.trackers.length; ii++) {
|
|
65
71
|
var trackerId = this.trackers[ii].id
|
|
66
|
-
completed +=
|
|
72
|
+
completed +=
|
|
73
|
+
valPerWeight * this.weight[trackerId] * this.completion[trackerId]
|
|
67
74
|
}
|
|
68
75
|
return completed
|
|
69
76
|
}
|
|
@@ -82,7 +89,9 @@ TrackerGroup.prototype.newStream = function (name, todo, weight) {
|
|
|
82
89
|
|
|
83
90
|
TrackerGroup.prototype.finish = function () {
|
|
84
91
|
this.finished = true
|
|
85
|
-
if (!this.trackers.length)
|
|
92
|
+
if (!this.trackers.length) {
|
|
93
|
+
this.addUnit(new Tracker(), 1, true)
|
|
94
|
+
}
|
|
86
95
|
for (var ii = 0; ii < this.trackers.length; ii++) {
|
|
87
96
|
var tracker = this.trackers[ii]
|
|
88
97
|
tracker.finish()
|
|
File without changes
|
|
@@ -20,7 +20,9 @@ Tracker.prototype.addWork = function (work) {
|
|
|
20
20
|
|
|
21
21
|
Tracker.prototype.completeWork = function (work) {
|
|
22
22
|
this.workDone += work
|
|
23
|
-
if (this.workDone > this.workTodo)
|
|
23
|
+
if (this.workDone > this.workTodo) {
|
|
24
|
+
this.workDone = this.workTodo
|
|
25
|
+
}
|
|
24
26
|
this.emit('change', this.name, this.completed(), this)
|
|
25
27
|
}
|
|
26
28
|
|
|
@@ -1,35 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "are-we-there-yet",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Keep track of the overall completion of many disparate processes",
|
|
5
|
-
"main": "index.js",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "
|
|
7
|
+
"test": "tap",
|
|
8
|
+
"npmclilint": "npmcli-lint",
|
|
9
|
+
"lint": "eslint '**/*.js'",
|
|
10
|
+
"lintfix": "npm run lint -- --fix",
|
|
11
|
+
"posttest": "npm run lint",
|
|
12
|
+
"postsnap": "npm run lintfix --",
|
|
13
|
+
"preversion": "npm test",
|
|
14
|
+
"postversion": "npm publish",
|
|
15
|
+
"prepublishOnly": "git push origin --follow-tags",
|
|
16
|
+
"snap": "tap"
|
|
8
17
|
},
|
|
9
18
|
"repository": {
|
|
10
19
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/
|
|
20
|
+
"url": "https://github.com/npm/are-we-there-yet.git"
|
|
12
21
|
},
|
|
13
|
-
"author": "
|
|
22
|
+
"author": "GitHub Inc.",
|
|
14
23
|
"license": "ISC",
|
|
15
24
|
"bugs": {
|
|
16
|
-
"url": "https://github.com/
|
|
25
|
+
"url": "https://github.com/npm/are-we-there-yet/issues"
|
|
17
26
|
},
|
|
18
|
-
"homepage": "https://github.com/
|
|
27
|
+
"homepage": "https://github.com/npm/are-we-there-yet",
|
|
19
28
|
"devDependencies": {
|
|
20
|
-
"
|
|
21
|
-
"
|
|
29
|
+
"@npmcli/eslint-config": "^1.0.0",
|
|
30
|
+
"@npmcli/template-oss": "^1.0.2",
|
|
31
|
+
"eslint": "^7.32.0",
|
|
32
|
+
"eslint-plugin-node": "^11.1.0",
|
|
33
|
+
"tap": "^15.0.9"
|
|
22
34
|
},
|
|
23
35
|
"dependencies": {
|
|
24
36
|
"delegates": "^1.0.0",
|
|
25
|
-
"readable-stream": "^
|
|
37
|
+
"readable-stream": "^3.6.0"
|
|
26
38
|
},
|
|
27
39
|
"files": [
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
"bin",
|
|
41
|
+
"lib"
|
|
42
|
+
],
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=10"
|
|
45
|
+
},
|
|
46
|
+
"tap": {
|
|
47
|
+
"branches": 68,
|
|
48
|
+
"statements": 92,
|
|
49
|
+
"functions": 86,
|
|
50
|
+
"lines": 92
|
|
51
|
+
},
|
|
52
|
+
"templateVersion": "1.0.2"
|
|
35
53
|
}
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module.exports = colorSupport({ alwaysReturn: true }, colorSupport)
|
|
2
|
+
|
|
3
|
+
function colorSupport(options, obj) {
|
|
4
|
+
obj = obj || {}
|
|
5
|
+
options = options || {}
|
|
6
|
+
obj.level = 0
|
|
7
|
+
obj.hasBasic = false
|
|
8
|
+
obj.has256 = false
|
|
9
|
+
obj.has16m = false
|
|
10
|
+
if (!options.alwaysReturn) {
|
|
11
|
+
return false
|
|
12
|
+
}
|
|
13
|
+
return obj
|
|
14
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// call it on itself so we can test the export val for basic stuff
|
|
2
|
+
module.exports = colorSupport({ alwaysReturn: true }, colorSupport)
|
|
3
|
+
|
|
4
|
+
function hasNone (obj, options) {
|
|
5
|
+
obj.level = 0
|
|
6
|
+
obj.hasBasic = false
|
|
7
|
+
obj.has256 = false
|
|
8
|
+
obj.has16m = false
|
|
9
|
+
if (!options.alwaysReturn) {
|
|
10
|
+
return false
|
|
11
|
+
}
|
|
12
|
+
return obj
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function hasBasic (obj) {
|
|
16
|
+
obj.hasBasic = true
|
|
17
|
+
obj.has256 = false
|
|
18
|
+
obj.has16m = false
|
|
19
|
+
obj.level = 1
|
|
20
|
+
return obj
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function has256 (obj) {
|
|
24
|
+
obj.hasBasic = true
|
|
25
|
+
obj.has256 = true
|
|
26
|
+
obj.has16m = false
|
|
27
|
+
obj.level = 2
|
|
28
|
+
return obj
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function has16m (obj) {
|
|
32
|
+
obj.hasBasic = true
|
|
33
|
+
obj.has256 = true
|
|
34
|
+
obj.has16m = true
|
|
35
|
+
obj.level = 3
|
|
36
|
+
return obj
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function colorSupport (options, obj) {
|
|
40
|
+
options = options || {}
|
|
41
|
+
|
|
42
|
+
obj = obj || {}
|
|
43
|
+
|
|
44
|
+
// if just requesting a specific level, then return that.
|
|
45
|
+
if (typeof options.level === 'number') {
|
|
46
|
+
switch (options.level) {
|
|
47
|
+
case 0:
|
|
48
|
+
return hasNone(obj, options)
|
|
49
|
+
case 1:
|
|
50
|
+
return hasBasic(obj)
|
|
51
|
+
case 2:
|
|
52
|
+
return has256(obj)
|
|
53
|
+
case 3:
|
|
54
|
+
return has16m(obj)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
obj.level = 0
|
|
59
|
+
obj.hasBasic = false
|
|
60
|
+
obj.has256 = false
|
|
61
|
+
obj.has16m = false
|
|
62
|
+
|
|
63
|
+
if (typeof process === 'undefined' ||
|
|
64
|
+
!process ||
|
|
65
|
+
!process.stdout ||
|
|
66
|
+
!process.env ||
|
|
67
|
+
!process.platform) {
|
|
68
|
+
return hasNone(obj, options)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
var env = options.env || process.env
|
|
72
|
+
var stream = options.stream || process.stdout
|
|
73
|
+
var term = options.term || env.TERM || ''
|
|
74
|
+
var platform = options.platform || process.platform
|
|
75
|
+
|
|
76
|
+
if (!options.ignoreTTY && !stream.isTTY) {
|
|
77
|
+
return hasNone(obj, options)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!options.ignoreDumb && term === 'dumb' && !env.COLORTERM) {
|
|
81
|
+
return hasNone(obj, options)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (platform === 'win32') {
|
|
85
|
+
return hasBasic(obj)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (env.TMUX) {
|
|
89
|
+
return has256(obj)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (!options.ignoreCI && (env.CI || env.TEAMCITY_VERSION)) {
|
|
93
|
+
if (env.TRAVIS) {
|
|
94
|
+
return has256(obj)
|
|
95
|
+
} else {
|
|
96
|
+
return hasNone(obj, options)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// TODO: add more term programs
|
|
101
|
+
switch (env.TERM_PROGRAM) {
|
|
102
|
+
case 'iTerm.app':
|
|
103
|
+
var ver = env.TERM_PROGRAM_VERSION || '0.'
|
|
104
|
+
if (/^[0-2]\./.test(ver)) {
|
|
105
|
+
return has256(obj)
|
|
106
|
+
} else {
|
|
107
|
+
return has16m(obj)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
case 'HyperTerm':
|
|
111
|
+
case 'Hyper':
|
|
112
|
+
return has16m(obj)
|
|
113
|
+
|
|
114
|
+
case 'MacTerm':
|
|
115
|
+
return has16m(obj)
|
|
116
|
+
|
|
117
|
+
case 'Apple_Terminal':
|
|
118
|
+
return has256(obj)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (/^xterm-256/.test(term)) {
|
|
122
|
+
return has256(obj)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(term)) {
|
|
126
|
+
return hasBasic(obj)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (env.COLORTERM) {
|
|
130
|
+
return hasBasic(obj)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return hasNone(obj, options)
|
|
134
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "color-support",
|
|
3
|
+
"version": "1.1.3",
|
|
4
|
+
"description": "A module which will endeavor to guess your terminal's level of color support.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"browser": "browser.js",
|
|
7
|
+
"bin": "bin.js",
|
|
8
|
+
"devDependencies": {
|
|
9
|
+
"tap": "^10.3.3"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"test": "tap test/*.js --100 -J",
|
|
13
|
+
"preversion": "npm test",
|
|
14
|
+
"postversion": "npm publish",
|
|
15
|
+
"postpublish": "git push origin --all; git push origin --tags"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/isaacs/color-support.git"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"terminal",
|
|
23
|
+
"color",
|
|
24
|
+
"support",
|
|
25
|
+
"xterm",
|
|
26
|
+
"truecolor",
|
|
27
|
+
"256"
|
|
28
|
+
],
|
|
29
|
+
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
|
30
|
+
"license": "ISC",
|
|
31
|
+
"files": [
|
|
32
|
+
"browser.js",
|
|
33
|
+
"index.js",
|
|
34
|
+
"bin.js"
|
|
35
|
+
]
|
|
36
|
+
}
|