@aws-solutions-constructs/core 2.51.0 → 2.52.0
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/.eslintignore +2 -0
- package/.jsii +49 -4
- package/node_modules/ansi-regex/index.js +8 -2
- package/node_modules/ansi-regex/license +4 -16
- package/node_modules/ansi-regex/package.json +53 -62
- package/node_modules/ansi-regex/readme.md +48 -9
- package/node_modules/aproba/index.js +33 -33
- package/node_modules/aproba/package.json +5 -4
- package/node_modules/are-we-there-yet/LICENSE.md +18 -0
- package/node_modules/are-we-there-yet/README.md +16 -3
- package/node_modules/are-we-there-yet/lib/tracker-base.js +13 -0
- package/node_modules/are-we-there-yet/lib/tracker-group.js +112 -0
- package/node_modules/are-we-there-yet/lib/tracker-stream.js +42 -0
- package/node_modules/are-we-there-yet/lib/tracker.js +34 -0
- package/node_modules/are-we-there-yet/package.json +38 -20
- package/node_modules/color-support/README.md +129 -0
- package/node_modules/color-support/bin.js +3 -0
- package/node_modules/color-support/browser.js +14 -0
- package/node_modules/color-support/index.js +134 -0
- package/node_modules/color-support/package.json +36 -0
- package/node_modules/gauge/LICENSE.md +20 -0
- package/node_modules/gauge/README.md +19 -16
- package/node_modules/gauge/{base-theme.js → lib/base-theme.js} +7 -3
- package/node_modules/gauge/lib/has-color.js +4 -0
- package/node_modules/gauge/{index.js → lib/index.js} +90 -34
- package/node_modules/gauge/{plumbing.js → lib/plumbing.js} +3 -1
- package/node_modules/gauge/{progress-bar.js → lib/progress-bar.js} +12 -6
- package/node_modules/gauge/{render-template.js → lib/render-template.js} +69 -28
- package/node_modules/gauge/{template-item.js → lib/template-item.js} +21 -7
- package/node_modules/gauge/{theme-set.js → lib/theme-set.js} +31 -24
- package/node_modules/gauge/lib/themes.js +56 -0
- package/node_modules/gauge/{wide-truncate.js → lib/wide-truncate.js} +9 -3
- package/node_modules/gauge/package.json +47 -42
- package/node_modules/is-fullwidth-code-point/index.js +40 -36
- package/node_modules/is-fullwidth-code-point/license +4 -16
- package/node_modules/is-fullwidth-code-point/package.json +40 -43
- package/node_modules/is-fullwidth-code-point/readme.md +8 -8
- package/node_modules/npmlog/LICENSE.md +20 -0
- package/node_modules/npmlog/{log.js → lib/log.js} +149 -58
- package/node_modules/npmlog/package.json +36 -12
- package/node_modules/signal-exit/LICENSE.txt +1 -1
- package/node_modules/signal-exit/README.md +56 -21
- package/node_modules/signal-exit/dist/cjs/browser.d.ts +12 -0
- package/node_modules/signal-exit/dist/cjs/browser.d.ts.map +1 -0
- package/node_modules/signal-exit/dist/cjs/browser.js +10 -0
- package/node_modules/signal-exit/dist/cjs/browser.js.map +1 -0
- package/node_modules/signal-exit/dist/cjs/index.d.ts +48 -0
- package/node_modules/signal-exit/dist/cjs/index.d.ts.map +1 -0
- package/node_modules/signal-exit/dist/cjs/index.js +279 -0
- package/node_modules/signal-exit/dist/cjs/index.js.map +1 -0
- package/node_modules/signal-exit/dist/cjs/package.json +3 -0
- package/node_modules/signal-exit/dist/cjs/signals.d.ts +29 -0
- package/node_modules/signal-exit/dist/cjs/signals.d.ts.map +1 -0
- package/node_modules/signal-exit/dist/cjs/signals.js +42 -0
- package/node_modules/signal-exit/dist/cjs/signals.js.map +1 -0
- package/node_modules/signal-exit/dist/mjs/browser.d.ts +12 -0
- package/node_modules/signal-exit/dist/mjs/browser.d.ts.map +1 -0
- package/node_modules/signal-exit/dist/mjs/browser.js +4 -0
- package/node_modules/signal-exit/dist/mjs/browser.js.map +1 -0
- package/node_modules/signal-exit/dist/mjs/index.d.ts +48 -0
- package/node_modules/signal-exit/dist/mjs/index.d.ts.map +1 -0
- package/node_modules/signal-exit/dist/mjs/index.js +275 -0
- package/node_modules/signal-exit/dist/mjs/index.js.map +1 -0
- package/node_modules/signal-exit/dist/mjs/package.json +3 -0
- package/node_modules/signal-exit/dist/mjs/signals.d.ts +29 -0
- package/node_modules/signal-exit/dist/mjs/signals.d.ts.map +1 -0
- package/node_modules/signal-exit/dist/mjs/signals.js +39 -0
- package/node_modules/signal-exit/dist/mjs/signals.js.map +1 -0
- package/node_modules/signal-exit/package.json +87 -19
- package/node_modules/string-width/index.js +29 -19
- package/node_modules/string-width/license +4 -16
- package/node_modules/string-width/package.json +54 -54
- package/node_modules/string-width/readme.md +17 -9
- package/node_modules/strip-ansi/index.js +2 -4
- package/node_modules/strip-ansi/license +4 -16
- package/node_modules/strip-ansi/package.json +52 -55
- package/node_modules/strip-ansi/readme.md +20 -7
- package/package.json +8 -7
- package/test/test-helper.d.ts +1 -1
- package/test/test-helper.js +5 -5
- package/node_modules/are-we-there-yet/CHANGES.md +0 -37
- package/node_modules/are-we-there-yet/LICENSE +0 -5
- package/node_modules/are-we-there-yet/tracker-base.js +0 -11
- package/node_modules/are-we-there-yet/tracker-group.js +0 -107
- package/node_modules/are-we-there-yet/tracker-stream.js +0 -36
- package/node_modules/are-we-there-yet/tracker.js +0 -30
- package/node_modules/code-point-at/index.js +0 -32
- package/node_modules/code-point-at/license +0 -21
- package/node_modules/code-point-at/package.json +0 -38
- package/node_modules/code-point-at/readme.md +0 -32
- package/node_modules/core-util-is/LICENSE +0 -19
- package/node_modules/core-util-is/README.md +0 -3
- package/node_modules/core-util-is/lib/util.js +0 -107
- package/node_modules/core-util-is/package.json +0 -38
- package/node_modules/delegates/.npmignore +0 -1
- package/node_modules/delegates/History.md +0 -22
- package/node_modules/delegates/License +0 -20
- package/node_modules/delegates/Makefile +0 -8
- package/node_modules/delegates/Readme.md +0 -94
- package/node_modules/delegates/index.js +0 -121
- package/node_modules/delegates/package.json +0 -13
- package/node_modules/delegates/test/index.js +0 -94
- package/node_modules/gauge/CHANGELOG.md +0 -160
- package/node_modules/gauge/LICENSE +0 -13
- package/node_modules/gauge/has-color.js +0 -12
- package/node_modules/gauge/themes.js +0 -54
- package/node_modules/inherits/LICENSE +0 -16
- package/node_modules/inherits/README.md +0 -42
- package/node_modules/inherits/inherits.js +0 -9
- package/node_modules/inherits/inherits_browser.js +0 -27
- package/node_modules/inherits/package.json +0 -29
- package/node_modules/isarray/.npmignore +0 -1
- package/node_modules/isarray/.travis.yml +0 -4
- package/node_modules/isarray/Makefile +0 -6
- package/node_modules/isarray/README.md +0 -60
- package/node_modules/isarray/component.json +0 -19
- package/node_modules/isarray/index.js +0 -5
- package/node_modules/isarray/package.json +0 -45
- package/node_modules/isarray/test.js +0 -20
- package/node_modules/number-is-nan/index.js +0 -4
- package/node_modules/number-is-nan/license +0 -21
- package/node_modules/number-is-nan/package.json +0 -35
- package/node_modules/number-is-nan/readme.md +0 -28
- package/node_modules/object-assign/index.js +0 -90
- package/node_modules/object-assign/license +0 -21
- package/node_modules/object-assign/package.json +0 -42
- package/node_modules/object-assign/readme.md +0 -61
- package/node_modules/process-nextick-args/index.js +0 -45
- package/node_modules/process-nextick-args/license.md +0 -19
- package/node_modules/process-nextick-args/package.json +0 -25
- package/node_modules/process-nextick-args/readme.md +0 -18
- package/node_modules/readable-stream/.travis.yml +0 -34
- package/node_modules/readable-stream/CONTRIBUTING.md +0 -38
- package/node_modules/readable-stream/GOVERNANCE.md +0 -136
- package/node_modules/readable-stream/LICENSE +0 -47
- package/node_modules/readable-stream/README.md +0 -58
- package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
- package/node_modules/readable-stream/duplex-browser.js +0 -1
- package/node_modules/readable-stream/duplex.js +0 -1
- package/node_modules/readable-stream/lib/_stream_duplex.js +0 -131
- package/node_modules/readable-stream/lib/_stream_passthrough.js +0 -47
- package/node_modules/readable-stream/lib/_stream_readable.js +0 -1019
- package/node_modules/readable-stream/lib/_stream_transform.js +0 -214
- package/node_modules/readable-stream/lib/_stream_writable.js +0 -685
- package/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -78
- package/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -84
- package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
- package/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
- package/node_modules/readable-stream/package.json +0 -52
- package/node_modules/readable-stream/passthrough.js +0 -1
- package/node_modules/readable-stream/readable-browser.js +0 -7
- package/node_modules/readable-stream/readable.js +0 -19
- package/node_modules/readable-stream/transform.js +0 -1
- package/node_modules/readable-stream/writable-browser.js +0 -1
- package/node_modules/readable-stream/writable.js +0 -8
- package/node_modules/safe-buffer/LICENSE +0 -21
- package/node_modules/safe-buffer/README.md +0 -584
- package/node_modules/safe-buffer/index.d.ts +0 -187
- package/node_modules/safe-buffer/index.js +0 -62
- package/node_modules/safe-buffer/package.json +0 -37
- package/node_modules/signal-exit/index.js +0 -202
- package/node_modules/signal-exit/signals.js +0 -53
- package/node_modules/string_decoder/.travis.yml +0 -50
- package/node_modules/string_decoder/LICENSE +0 -48
- package/node_modules/string_decoder/README.md +0 -47
- package/node_modules/string_decoder/lib/string_decoder.js +0 -296
- package/node_modules/string_decoder/package.json +0 -31
- package/node_modules/util-deprecate/History.md +0 -16
- package/node_modules/util-deprecate/LICENSE +0 -24
- package/node_modules/util-deprecate/README.md +0 -53
- package/node_modules/util-deprecate/browser.js +0 -67
- package/node_modules/util-deprecate/node.js +0 -6
- package/node_modules/util-deprecate/package.json +0 -27
- package/node_modules/wide-align/node_modules/ansi-regex/index.js +0 -10
- package/node_modules/wide-align/node_modules/ansi-regex/license +0 -9
- package/node_modules/wide-align/node_modules/ansi-regex/package.json +0 -55
- package/node_modules/wide-align/node_modules/ansi-regex/readme.md +0 -78
- package/node_modules/wide-align/node_modules/is-fullwidth-code-point/index.js +0 -50
- package/node_modules/wide-align/node_modules/is-fullwidth-code-point/license +0 -9
- package/node_modules/wide-align/node_modules/is-fullwidth-code-point/package.json +0 -42
- package/node_modules/wide-align/node_modules/is-fullwidth-code-point/readme.md +0 -39
- package/node_modules/wide-align/node_modules/string-width/index.js +0 -47
- package/node_modules/wide-align/node_modules/string-width/license +0 -9
- package/node_modules/wide-align/node_modules/string-width/package.json +0 -56
- package/node_modules/wide-align/node_modules/string-width/readme.md +0 -50
- package/node_modules/wide-align/node_modules/strip-ansi/index.js +0 -4
- package/node_modules/wide-align/node_modules/strip-ansi/license +0 -9
- package/node_modules/wide-align/node_modules/strip-ansi/package.json +0 -54
- package/node_modules/wide-align/node_modules/strip-ansi/readme.md +0 -46
- /package/node_modules/{wide-align/node_modules/ansi-regex → ansi-regex}/index.d.ts +0 -0
- /package/node_modules/are-we-there-yet/{index.js → lib/index.js} +0 -0
- /package/node_modules/{npmlog → color-support}/LICENSE +0 -0
- /package/node_modules/gauge/{error.js → lib/error.js} +0 -0
- /package/node_modules/gauge/{process.js → lib/process.js} +0 -0
- /package/node_modules/gauge/{set-immediate.js → lib/set-immediate.js} +0 -0
- /package/node_modules/gauge/{set-interval.js → lib/set-interval.js} +0 -0
- /package/node_modules/gauge/{spin.js → lib/spin.js} +0 -0
- /package/node_modules/{wide-align/node_modules/is-fullwidth-code-point → is-fullwidth-code-point}/index.d.ts +0 -0
- /package/node_modules/{wide-align/node_modules/string-width → string-width}/index.d.ts +0 -0
- /package/node_modules/{wide-align/node_modules/strip-ansi → strip-ansi}/index.d.ts +0 -0
|
@@ -13,11 +13,13 @@ var stream = process.stderr
|
|
|
13
13
|
Object.defineProperty(log, 'stream', {
|
|
14
14
|
set: function (newStream) {
|
|
15
15
|
stream = newStream
|
|
16
|
-
if (this.gauge)
|
|
16
|
+
if (this.gauge) {
|
|
17
|
+
this.gauge.setWriteTo(stream, stream)
|
|
18
|
+
}
|
|
17
19
|
},
|
|
18
20
|
get: function () {
|
|
19
21
|
return stream
|
|
20
|
-
}
|
|
22
|
+
},
|
|
21
23
|
})
|
|
22
24
|
|
|
23
25
|
// by default, decide based on tty-ness.
|
|
@@ -28,11 +30,11 @@ log.useColor = function () {
|
|
|
28
30
|
|
|
29
31
|
log.enableColor = function () {
|
|
30
32
|
colorEnabled = true
|
|
31
|
-
this.gauge.setTheme({hasColor: colorEnabled, hasUnicode: unicodeEnabled})
|
|
33
|
+
this.gauge.setTheme({ hasColor: colorEnabled, hasUnicode: unicodeEnabled })
|
|
32
34
|
}
|
|
33
35
|
log.disableColor = function () {
|
|
34
36
|
colorEnabled = false
|
|
35
|
-
this.gauge.setTheme({hasColor: colorEnabled, hasUnicode: unicodeEnabled})
|
|
37
|
+
this.gauge.setTheme({ hasColor: colorEnabled, hasUnicode: unicodeEnabled })
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
// default level
|
|
@@ -40,14 +42,14 @@ log.level = 'info'
|
|
|
40
42
|
|
|
41
43
|
log.gauge = new Gauge(stream, {
|
|
42
44
|
enabled: false, // no progress bars unless asked
|
|
43
|
-
theme: {hasColor: log.useColor()},
|
|
45
|
+
theme: { hasColor: log.useColor() },
|
|
44
46
|
template: [
|
|
45
|
-
{type: 'progressbar', length: 20},
|
|
46
|
-
{type: 'activityIndicator', kerning: 1, length: 1},
|
|
47
|
-
{type: 'section', default: ''},
|
|
47
|
+
{ type: 'progressbar', length: 20 },
|
|
48
|
+
{ type: 'activityIndicator', kerning: 1, length: 1 },
|
|
49
|
+
{ type: 'section', default: '' },
|
|
48
50
|
':',
|
|
49
|
-
{type: 'logline', kerning: 1, default: ''}
|
|
50
|
-
]
|
|
51
|
+
{ type: 'logline', kerning: 1, default: '' },
|
|
52
|
+
],
|
|
51
53
|
})
|
|
52
54
|
|
|
53
55
|
log.tracker = new Progress.TrackerGroup()
|
|
@@ -60,12 +62,12 @@ var unicodeEnabled
|
|
|
60
62
|
|
|
61
63
|
log.enableUnicode = function () {
|
|
62
64
|
unicodeEnabled = true
|
|
63
|
-
this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled})
|
|
65
|
+
this.gauge.setTheme({ hasColor: this.useColor(), hasUnicode: unicodeEnabled })
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
log.disableUnicode = function () {
|
|
67
69
|
unicodeEnabled = false
|
|
68
|
-
this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled})
|
|
70
|
+
this.gauge.setTheme({ hasColor: this.useColor(), hasUnicode: unicodeEnabled })
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
log.setGaugeThemeset = function (themes) {
|
|
@@ -77,15 +79,19 @@ log.setGaugeTemplate = function (template) {
|
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
log.enableProgress = function () {
|
|
80
|
-
if (this.progressEnabled)
|
|
82
|
+
if (this.progressEnabled || this._paused) {
|
|
83
|
+
return
|
|
84
|
+
}
|
|
85
|
+
|
|
81
86
|
this.progressEnabled = true
|
|
82
87
|
this.tracker.on('change', this.showProgress)
|
|
83
|
-
if (this._pause) return
|
|
84
88
|
this.gauge.enable()
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
log.disableProgress = function () {
|
|
88
|
-
if (!this.progressEnabled)
|
|
92
|
+
if (!this.progressEnabled) {
|
|
93
|
+
return
|
|
94
|
+
}
|
|
89
95
|
this.progressEnabled = false
|
|
90
96
|
this.tracker.removeListener('change', this.showProgress)
|
|
91
97
|
this.gauge.disable()
|
|
@@ -97,10 +103,24 @@ var mixinLog = function (tracker) {
|
|
|
97
103
|
// mixin the public methods from log into the tracker
|
|
98
104
|
// (except: conflicts and one's we handle specially)
|
|
99
105
|
Object.keys(log).forEach(function (P) {
|
|
100
|
-
if (P[0] === '_')
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
106
|
+
if (P[0] === '_') {
|
|
107
|
+
return
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (trackerConstructors.filter(function (C) {
|
|
111
|
+
return C === P
|
|
112
|
+
}).length) {
|
|
113
|
+
return
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (tracker[P]) {
|
|
117
|
+
return
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (typeof log[P] !== 'function') {
|
|
121
|
+
return
|
|
122
|
+
}
|
|
123
|
+
|
|
104
124
|
var func = log[P]
|
|
105
125
|
tracker[P] = function () {
|
|
106
126
|
return func.apply(log, arguments)
|
|
@@ -111,7 +131,9 @@ var mixinLog = function (tracker) {
|
|
|
111
131
|
if (tracker instanceof Progress.TrackerGroup) {
|
|
112
132
|
trackerConstructors.forEach(function (C) {
|
|
113
133
|
var func = tracker[C]
|
|
114
|
-
tracker[C] = function () {
|
|
134
|
+
tracker[C] = function () {
|
|
135
|
+
return mixinLog(func.apply(tracker, arguments))
|
|
136
|
+
}
|
|
115
137
|
})
|
|
116
138
|
}
|
|
117
139
|
return tracker
|
|
@@ -119,24 +141,38 @@ var mixinLog = function (tracker) {
|
|
|
119
141
|
|
|
120
142
|
// Add tracker constructors to the top level log object
|
|
121
143
|
trackerConstructors.forEach(function (C) {
|
|
122
|
-
log[C] = function () {
|
|
144
|
+
log[C] = function () {
|
|
145
|
+
return mixinLog(this.tracker[C].apply(this.tracker, arguments))
|
|
146
|
+
}
|
|
123
147
|
})
|
|
124
148
|
|
|
125
149
|
log.clearProgress = function (cb) {
|
|
126
|
-
if (!this.progressEnabled)
|
|
150
|
+
if (!this.progressEnabled) {
|
|
151
|
+
return cb && process.nextTick(cb)
|
|
152
|
+
}
|
|
153
|
+
|
|
127
154
|
this.gauge.hide(cb)
|
|
128
155
|
}
|
|
129
156
|
|
|
130
157
|
log.showProgress = function (name, completed) {
|
|
131
|
-
if (!this.progressEnabled)
|
|
158
|
+
if (!this.progressEnabled) {
|
|
159
|
+
return
|
|
160
|
+
}
|
|
161
|
+
|
|
132
162
|
var values = {}
|
|
133
|
-
if (name)
|
|
163
|
+
if (name) {
|
|
164
|
+
values.section = name
|
|
165
|
+
}
|
|
166
|
+
|
|
134
167
|
var last = log.record[log.record.length - 1]
|
|
135
168
|
if (last) {
|
|
136
169
|
values.subsection = last.prefix
|
|
137
170
|
var disp = log.disp[last.level] || last.level
|
|
138
171
|
var logline = this._format(disp, log.style[last.level])
|
|
139
|
-
if (last.prefix)
|
|
172
|
+
if (last.prefix) {
|
|
173
|
+
logline += ' ' + this._format(last.prefix, this.prefixStyle)
|
|
174
|
+
}
|
|
175
|
+
|
|
140
176
|
logline += ' ' + last.message.split(/\r?\n/)[0]
|
|
141
177
|
values.logline = logline
|
|
142
178
|
}
|
|
@@ -147,11 +183,16 @@ log.showProgress = function (name, completed) {
|
|
|
147
183
|
// temporarily stop emitting, but don't drop
|
|
148
184
|
log.pause = function () {
|
|
149
185
|
this._paused = true
|
|
150
|
-
if (this.progressEnabled)
|
|
186
|
+
if (this.progressEnabled) {
|
|
187
|
+
this.gauge.disable()
|
|
188
|
+
}
|
|
151
189
|
}
|
|
152
190
|
|
|
153
191
|
log.resume = function () {
|
|
154
|
-
if (!this._paused)
|
|
192
|
+
if (!this._paused) {
|
|
193
|
+
return
|
|
194
|
+
}
|
|
195
|
+
|
|
155
196
|
this._paused = false
|
|
156
197
|
|
|
157
198
|
var b = this._buffer
|
|
@@ -159,7 +200,9 @@ log.resume = function () {
|
|
|
159
200
|
b.forEach(function (m) {
|
|
160
201
|
this.emitLog(m)
|
|
161
202
|
}, this)
|
|
162
|
-
if (this.progressEnabled)
|
|
203
|
+
if (this.progressEnabled) {
|
|
204
|
+
this.gauge.enable()
|
|
205
|
+
}
|
|
163
206
|
}
|
|
164
207
|
|
|
165
208
|
log._buffer = []
|
|
@@ -180,28 +223,32 @@ log.log = function (lvl, prefix, message) {
|
|
|
180
223
|
var arg = a[i - 2] = arguments[i]
|
|
181
224
|
|
|
182
225
|
// resolve stack traces to a plain string.
|
|
183
|
-
if (typeof arg === 'object' && arg &&
|
|
184
|
-
(arg instanceof Error) && arg.stack) {
|
|
185
|
-
|
|
226
|
+
if (typeof arg === 'object' && arg instanceof Error && arg.stack) {
|
|
186
227
|
Object.defineProperty(arg, 'stack', {
|
|
187
228
|
value: stack = arg.stack + '',
|
|
188
229
|
enumerable: true,
|
|
189
|
-
writable: true
|
|
230
|
+
writable: true,
|
|
190
231
|
})
|
|
191
232
|
}
|
|
192
233
|
}
|
|
193
|
-
if (stack)
|
|
234
|
+
if (stack) {
|
|
235
|
+
a.unshift(stack + '\n')
|
|
236
|
+
}
|
|
194
237
|
message = util.format.apply(util, a)
|
|
195
238
|
|
|
196
|
-
var m = {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
239
|
+
var m = {
|
|
240
|
+
id: id++,
|
|
241
|
+
level: lvl,
|
|
242
|
+
prefix: String(prefix || ''),
|
|
243
|
+
message: message,
|
|
244
|
+
messageRaw: a,
|
|
245
|
+
}
|
|
201
246
|
|
|
202
247
|
this.emit('log', m)
|
|
203
248
|
this.emit('log.' + lvl, m)
|
|
204
|
-
if (m.prefix)
|
|
249
|
+
if (m.prefix) {
|
|
250
|
+
this.emit(m.prefix, m)
|
|
251
|
+
}
|
|
205
252
|
|
|
206
253
|
this.record.push(m)
|
|
207
254
|
var mrs = this.maxRecordSize
|
|
@@ -219,24 +266,39 @@ log.emitLog = function (m) {
|
|
|
219
266
|
this._buffer.push(m)
|
|
220
267
|
return
|
|
221
268
|
}
|
|
222
|
-
if (this.progressEnabled)
|
|
269
|
+
if (this.progressEnabled) {
|
|
270
|
+
this.gauge.pulse(m.prefix)
|
|
271
|
+
}
|
|
272
|
+
|
|
223
273
|
var l = this.levels[m.level]
|
|
224
|
-
if (l === undefined)
|
|
225
|
-
|
|
226
|
-
|
|
274
|
+
if (l === undefined) {
|
|
275
|
+
return
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (l < this.levels[this.level]) {
|
|
279
|
+
return
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (l > 0 && !isFinite(l)) {
|
|
283
|
+
return
|
|
284
|
+
}
|
|
227
285
|
|
|
228
286
|
// If 'disp' is null or undefined, use the lvl as a default
|
|
229
287
|
// Allows: '', 0 as valid disp
|
|
230
288
|
var disp = log.disp[m.level] != null ? log.disp[m.level] : m.level
|
|
231
289
|
this.clearProgress()
|
|
232
290
|
m.message.split(/\r?\n/).forEach(function (line) {
|
|
233
|
-
|
|
234
|
-
|
|
291
|
+
var heading = this.heading
|
|
292
|
+
if (heading) {
|
|
293
|
+
this.write(heading, this.headingStyle)
|
|
235
294
|
this.write(' ')
|
|
236
295
|
}
|
|
237
296
|
this.write(disp, log.style[m.level])
|
|
238
297
|
var p = m.prefix || ''
|
|
239
|
-
if (p)
|
|
298
|
+
if (p) {
|
|
299
|
+
this.write(' ')
|
|
300
|
+
}
|
|
301
|
+
|
|
240
302
|
this.write(p, this.prefixStyle)
|
|
241
303
|
this.write(' ' + line + '\n')
|
|
242
304
|
}, this)
|
|
@@ -244,36 +306,64 @@ log.emitLog = function (m) {
|
|
|
244
306
|
}
|
|
245
307
|
|
|
246
308
|
log._format = function (msg, style) {
|
|
247
|
-
if (!stream)
|
|
309
|
+
if (!stream) {
|
|
310
|
+
return
|
|
311
|
+
}
|
|
248
312
|
|
|
249
313
|
var output = ''
|
|
250
314
|
if (this.useColor()) {
|
|
251
315
|
style = style || {}
|
|
252
316
|
var settings = []
|
|
253
|
-
if (style.fg)
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
if (style.
|
|
258
|
-
|
|
259
|
-
|
|
317
|
+
if (style.fg) {
|
|
318
|
+
settings.push(style.fg)
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
if (style.bg) {
|
|
322
|
+
settings.push('bg' + style.bg[0].toUpperCase() + style.bg.slice(1))
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (style.bold) {
|
|
326
|
+
settings.push('bold')
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
if (style.underline) {
|
|
330
|
+
settings.push('underline')
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
if (style.inverse) {
|
|
334
|
+
settings.push('inverse')
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if (settings.length) {
|
|
338
|
+
output += consoleControl.color(settings)
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (style.beep) {
|
|
342
|
+
output += consoleControl.beep()
|
|
343
|
+
}
|
|
260
344
|
}
|
|
261
345
|
output += msg
|
|
262
346
|
if (this.useColor()) {
|
|
263
347
|
output += consoleControl.color('reset')
|
|
264
348
|
}
|
|
349
|
+
|
|
265
350
|
return output
|
|
266
351
|
}
|
|
267
352
|
|
|
268
353
|
log.write = function (msg, style) {
|
|
269
|
-
if (!stream)
|
|
354
|
+
if (!stream) {
|
|
355
|
+
return
|
|
356
|
+
}
|
|
270
357
|
|
|
271
358
|
stream.write(this._format(msg, style))
|
|
272
359
|
}
|
|
273
360
|
|
|
274
361
|
log.addLevel = function (lvl, n, style, disp) {
|
|
275
362
|
// If 'disp' is null or undefined, use the lvl as a default
|
|
276
|
-
if (disp == null)
|
|
363
|
+
if (disp == null) {
|
|
364
|
+
disp = lvl
|
|
365
|
+
}
|
|
366
|
+
|
|
277
367
|
this.levels[lvl] = n
|
|
278
368
|
this.style[lvl] = style
|
|
279
369
|
if (!this[lvl]) {
|
|
@@ -283,6 +373,7 @@ log.addLevel = function (lvl, n, style, disp) {
|
|
|
283
373
|
for (var i = 0; i < arguments.length; i++) {
|
|
284
374
|
a[i + 1] = arguments[i]
|
|
285
375
|
}
|
|
376
|
+
|
|
286
377
|
return this.log.apply(this, a)
|
|
287
378
|
}.bind(this)
|
|
288
379
|
}
|
|
@@ -296,11 +387,11 @@ log.style = {}
|
|
|
296
387
|
log.levels = {}
|
|
297
388
|
log.disp = {}
|
|
298
389
|
log.addLevel('silly', -Infinity, { inverse: true }, 'sill')
|
|
299
|
-
log.addLevel('verbose', 1000, { fg: '
|
|
390
|
+
log.addLevel('verbose', 1000, { fg: 'cyan', bg: 'black' }, 'verb')
|
|
300
391
|
log.addLevel('info', 2000, { fg: 'green' })
|
|
301
392
|
log.addLevel('timing', 2500, { fg: 'green', bg: 'black' })
|
|
302
393
|
log.addLevel('http', 3000, { fg: 'green', bg: 'black' })
|
|
303
|
-
log.addLevel('notice', 3500, { fg: '
|
|
394
|
+
log.addLevel('notice', 3500, { fg: 'cyan', bg: 'black' })
|
|
304
395
|
log.addLevel('warn', 4000, { fg: 'black', bg: 'yellow' }, 'WARN')
|
|
305
396
|
log.addLevel('error', 5000, { fg: 'red', bg: 'black' }, 'ERR!')
|
|
306
397
|
log.addLevel('silent', Infinity)
|
|
@@ -1,28 +1,52 @@
|
|
|
1
1
|
{
|
|
2
|
-
"author": "
|
|
2
|
+
"author": "GitHub Inc.",
|
|
3
3
|
"name": "npmlog",
|
|
4
4
|
"description": "logger for npm",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "7.0.1",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/npm/npmlog.git"
|
|
9
9
|
},
|
|
10
|
-
"main": "log.js",
|
|
10
|
+
"main": "lib/log.js",
|
|
11
11
|
"files": [
|
|
12
|
-
"
|
|
12
|
+
"bin/",
|
|
13
|
+
"lib/"
|
|
13
14
|
],
|
|
14
15
|
"scripts": {
|
|
15
|
-
"test": "
|
|
16
|
+
"test": "tap",
|
|
17
|
+
"npmclilint": "npmcli-lint",
|
|
18
|
+
"lint": "eslint \"**/*.js\"",
|
|
19
|
+
"lintfix": "npm run lint -- --fix",
|
|
20
|
+
"posttest": "npm run lint",
|
|
21
|
+
"postsnap": "npm run lintfix --",
|
|
22
|
+
"postlint": "template-oss-check",
|
|
23
|
+
"snap": "tap",
|
|
24
|
+
"template-oss-apply": "template-oss-apply --force"
|
|
16
25
|
},
|
|
17
26
|
"dependencies": {
|
|
18
|
-
"are-we-there-yet": "
|
|
19
|
-
"console-control-strings": "
|
|
20
|
-
"gauge": "
|
|
21
|
-
"set-blocking": "
|
|
27
|
+
"are-we-there-yet": "^4.0.0",
|
|
28
|
+
"console-control-strings": "^1.1.0",
|
|
29
|
+
"gauge": "^5.0.0",
|
|
30
|
+
"set-blocking": "^2.0.0"
|
|
22
31
|
},
|
|
23
32
|
"devDependencies": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
33
|
+
"@npmcli/eslint-config": "^4.0.0",
|
|
34
|
+
"@npmcli/template-oss": "4.6.1",
|
|
35
|
+
"tap": "^16.0.1"
|
|
26
36
|
},
|
|
27
|
-
"license": "ISC"
|
|
37
|
+
"license": "ISC",
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
|
|
40
|
+
},
|
|
41
|
+
"tap": {
|
|
42
|
+
"branches": 95,
|
|
43
|
+
"nyc-arg": [
|
|
44
|
+
"--exclude",
|
|
45
|
+
"tap-snapshots/**"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"templateOSS": {
|
|
49
|
+
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
|
50
|
+
"version": "4.6.1"
|
|
51
|
+
}
|
|
28
52
|
}
|
|
@@ -1,39 +1,74 @@
|
|
|
1
1
|
# signal-exit
|
|
2
2
|
|
|
3
|
-
[](https://travis-ci.org/tapjs/signal-exit)
|
|
4
|
-
[](https://coveralls.io/r/tapjs/signal-exit?branch=master)
|
|
5
|
-
[](https://www.npmjs.com/package/signal-exit)
|
|
6
|
-
[](https://github.com/conventional-changelog/standard-version)
|
|
7
|
-
|
|
8
3
|
When you want to fire an event no matter how a process exits:
|
|
9
4
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
- reaching the end of execution.
|
|
6
|
+
- explicitly having `process.exit(code)` called.
|
|
7
|
+
- having `process.kill(pid, sig)` called.
|
|
8
|
+
- receiving a fatal signal from outside the process
|
|
14
9
|
|
|
15
10
|
Use `signal-exit`.
|
|
16
11
|
|
|
17
12
|
```js
|
|
18
|
-
|
|
13
|
+
// Hybrid module, either works
|
|
14
|
+
import { onExit } from 'signal-exit'
|
|
15
|
+
// or:
|
|
16
|
+
// const { onExit } = require('signal-exit')
|
|
19
17
|
|
|
20
|
-
onExit(
|
|
21
|
-
console.log('process exited!')
|
|
18
|
+
onExit((code, signal) => {
|
|
19
|
+
console.log('process exited!', code, signal)
|
|
22
20
|
})
|
|
23
21
|
```
|
|
24
22
|
|
|
25
23
|
## API
|
|
26
24
|
|
|
27
|
-
`
|
|
25
|
+
`remove = onExit((code, signal) => {}, options)`
|
|
26
|
+
|
|
27
|
+
The return value of the function is a function that will remove
|
|
28
|
+
the handler.
|
|
29
|
+
|
|
30
|
+
Note that the function _only_ fires for signals if the signal
|
|
31
|
+
would cause the process to exit. That is, there are no other
|
|
32
|
+
listeners, and it is a fatal signal.
|
|
33
|
+
|
|
34
|
+
If the global `process` object is not suitable for this purpose
|
|
35
|
+
(ie, it's unset, or doesn't have an `emit` method, etc.) then the
|
|
36
|
+
`onExit` function is a no-op that returns a no-op `remove` method.
|
|
37
|
+
|
|
38
|
+
### Options
|
|
39
|
+
|
|
40
|
+
- `alwaysLast`: Run this handler after any other signal or exit
|
|
41
|
+
handlers. This causes `process.emit` to be monkeypatched.
|
|
42
|
+
|
|
43
|
+
### Capturing Signal Exits
|
|
44
|
+
|
|
45
|
+
If the handler returns an exact boolean `true`, and the exit is a
|
|
46
|
+
due to signal, then the signal will be considered handled, and
|
|
47
|
+
will _not_ trigger a synthetic `process.kill(process.pid,
|
|
48
|
+
signal)` after firing the `onExit` handlers.
|
|
49
|
+
|
|
50
|
+
In this case, it your responsibility as the caller to exit with a
|
|
51
|
+
signal (for example, by calling `process.kill()`) if you wish to
|
|
52
|
+
preserve the same exit status that would otherwise have occurred.
|
|
53
|
+
If you do not, then the process will likely exit gracefully with
|
|
54
|
+
status 0 at some point, assuming that no other terminating signal
|
|
55
|
+
or other exit trigger occurs.
|
|
56
|
+
|
|
57
|
+
Prior to calling handlers, the `onExit` machinery is unloaded, so
|
|
58
|
+
any subsequent exits or signals will not be handled, even if the
|
|
59
|
+
signal is captured and the exit is thus prevented.
|
|
28
60
|
|
|
29
|
-
|
|
30
|
-
|
|
61
|
+
Note that numeric code exits may indicate that the process is
|
|
62
|
+
already committed to exiting, for example due to a fatal
|
|
63
|
+
exception or unhandled promise rejection, and so there is no way to
|
|
64
|
+
prevent it safely.
|
|
31
65
|
|
|
32
|
-
|
|
33
|
-
cause the process to exit. That is, there are no other listeners, and
|
|
34
|
-
it is a fatal signal.
|
|
66
|
+
### Browser Fallback
|
|
35
67
|
|
|
36
|
-
|
|
68
|
+
The `'signal-exit/browser'` module is the same fallback shim that
|
|
69
|
+
just doesn't do anything, but presents the same function
|
|
70
|
+
interface.
|
|
37
71
|
|
|
38
|
-
|
|
39
|
-
|
|
72
|
+
Patches welcome to add something that hooks onto
|
|
73
|
+
`window.onbeforeunload` or similar, but it might just not be a
|
|
74
|
+
thing that makes sense there.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a browser shim that provides the same functional interface
|
|
3
|
+
* as the main node export, but it does nothing.
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import type { Handler } from './index.js';
|
|
7
|
+
export declare const onExit: (cb: Handler, opts: {
|
|
8
|
+
alwaysLast?: boolean;
|
|
9
|
+
}) => () => void;
|
|
10
|
+
export declare const load: () => void;
|
|
11
|
+
export declare const unload: () => void;
|
|
12
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,eAAO,MAAM,MAAM,EAAE,CACnB,EAAE,EAAE,OAAO,EACX,IAAI,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,KAC3B,MAAM,IAAqB,CAAA;AAChC,eAAO,MAAM,IAAI,YAAW,CAAA;AAC5B,eAAO,MAAM,MAAM,YAAW,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unload = exports.load = exports.onExit = void 0;
|
|
4
|
+
const onExit = () => () => { };
|
|
5
|
+
exports.onExit = onExit;
|
|
6
|
+
const load = () => { };
|
|
7
|
+
exports.load = load;
|
|
8
|
+
const unload = () => { };
|
|
9
|
+
exports.unload = unload;
|
|
10
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":";;;AAMO,MAAM,MAAM,GAGD,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC,CAAA;AAHnB,QAAA,MAAM,UAGa;AACzB,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA;AAAf,QAAA,IAAI,QAAW;AACrB,MAAM,MAAM,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA;AAAjB,QAAA,MAAM,UAAW","sourcesContent":["/**\n * This is a browser shim that provides the same functional interface\n * as the main node export, but it does nothing.\n * @module\n */\nimport type { Handler } from './index.js'\nexport const onExit: (\n cb: Handler,\n opts: { alwaysLast?: boolean }\n) => () => void = () => () => {}\nexport const load = () => {}\nexport const unload = () => {}\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { signals } from './signals.js';
|
|
3
|
+
export { signals };
|
|
4
|
+
/**
|
|
5
|
+
* A function that takes an exit code and signal as arguments
|
|
6
|
+
*
|
|
7
|
+
* In the case of signal exits *only*, a return value of true
|
|
8
|
+
* will indicate that the signal is being handled, and we should
|
|
9
|
+
* not synthetically exit with the signal we received. Regardless
|
|
10
|
+
* of the handler return value, the handler is unloaded when an
|
|
11
|
+
* otherwise fatal signal is received, so you get exactly 1 shot
|
|
12
|
+
* at it, unless you add another onExit handler at that point.
|
|
13
|
+
*
|
|
14
|
+
* In the case of numeric code exits, we may already have committed
|
|
15
|
+
* to exiting the process, for example via a fatal exception or
|
|
16
|
+
* unhandled promise rejection, so it is impossible to stop safely.
|
|
17
|
+
*/
|
|
18
|
+
export type Handler = (code: number | null | undefined, signal: NodeJS.Signals | null) => true | void;
|
|
19
|
+
export declare const
|
|
20
|
+
/**
|
|
21
|
+
* Called when the process is exiting, whether via signal, explicit
|
|
22
|
+
* exit, or running out of stuff to do.
|
|
23
|
+
*
|
|
24
|
+
* If the global process object is not suitable for instrumentation,
|
|
25
|
+
* then this will be a no-op.
|
|
26
|
+
*
|
|
27
|
+
* Returns a function that may be used to unload signal-exit.
|
|
28
|
+
*/
|
|
29
|
+
onExit: (cb: Handler, opts?: {
|
|
30
|
+
alwaysLast?: boolean | undefined;
|
|
31
|
+
} | undefined) => () => void,
|
|
32
|
+
/**
|
|
33
|
+
* Load the listeners. Likely you never need to call this, unless
|
|
34
|
+
* doing a rather deep integration with signal-exit functionality.
|
|
35
|
+
* Mostly exposed for the benefit of testing.
|
|
36
|
+
*
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
load: () => void,
|
|
40
|
+
/**
|
|
41
|
+
* Unload the listeners. Likely you never need to call this, unless
|
|
42
|
+
* doing a rather deep integration with signal-exit functionality.
|
|
43
|
+
* Mostly exposed for the benefit of testing.
|
|
44
|
+
*
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
unload: () => void;
|
|
48
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,CAAA;AAuBlB;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,OAAO,GAAG,CACpB,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC/B,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,KAC1B,IAAI,GAAG,IAAI,CAAA;AA8QhB,eAAO;AACL;;;;;;;;GAQG;AACH,MAAM,OAzMO,OAAO;;wBAPiD,IAAI;AAkNzE;;;;;;GAMG;AACH,IAAI;AAEJ;;;;;;GAMG;AACH,MAAM,YAGP,CAAA"}
|