@aws-solutions-constructs/core 2.78.0 → 2.79.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/.jsii +303 -29
- package/lib/cloudfront-distribution-helper.d.ts +29 -0
- package/lib/cloudfront-distribution-helper.js +81 -1
- package/node_modules/deep-diff/.circleci/config.yml +76 -0
- package/node_modules/deep-diff/.eslintrc +72 -0
- package/node_modules/deep-diff/.vscode/launch.json +30 -0
- package/node_modules/deep-diff/.vscode/tasks.json +12 -0
- package/node_modules/deep-diff/ChangeLog.md +63 -0
- package/node_modules/deep-diff/LICENSE +7 -0
- package/node_modules/deep-diff/Readme.md +239 -0
- package/node_modules/deep-diff/dist/deep-diff.min.js +1 -0
- package/node_modules/deep-diff/dist/deep-diff.min.js.map +1 -0
- package/node_modules/deep-diff/examples/apply-diff-from-any.js +39 -0
- package/node_modules/deep-diff/examples/array-change.js +45 -0
- package/node_modules/deep-diff/examples/capture_change_apply_elsewhere.js +53 -0
- package/node_modules/deep-diff/examples/diff-ignoring-fun.js +88 -0
- package/node_modules/deep-diff/examples/diff-scenarios.js +49 -0
- package/node_modules/deep-diff/examples/example1.js +41 -0
- package/node_modules/deep-diff/examples/issue-111.js +6 -0
- package/node_modules/deep-diff/examples/issue-113-1.js +14 -0
- package/node_modules/deep-diff/examples/issue-113-2.js +11 -0
- package/node_modules/deep-diff/examples/issue-115.js +17 -0
- package/node_modules/deep-diff/examples/issue-124.js +8 -0
- package/node_modules/deep-diff/examples/issue-125.js +19 -0
- package/node_modules/deep-diff/examples/issue-126.js +33 -0
- package/node_modules/deep-diff/examples/issue-35.js +11 -0
- package/node_modules/deep-diff/examples/issue-47.js +17 -0
- package/node_modules/deep-diff/examples/issue-48.js +48 -0
- package/node_modules/deep-diff/examples/issue-62.js +14 -0
- package/node_modules/deep-diff/examples/issue-70.js +6 -0
- package/node_modules/deep-diff/examples/issue-71.js +15 -0
- package/node_modules/deep-diff/examples/issue-72.js +21 -0
- package/node_modules/deep-diff/examples/issue-74.js +9 -0
- package/node_modules/deep-diff/examples/issue-78.js +24 -0
- package/node_modules/deep-diff/examples/issue-83.js +11 -0
- package/node_modules/deep-diff/examples/issue-88.js +26 -0
- package/node_modules/deep-diff/examples/performance.js +64 -0
- package/node_modules/deep-diff/examples/practice-data.json +2501 -0
- package/node_modules/deep-diff/index.js +526 -0
- package/node_modules/deep-diff/package.json +74 -0
- package/node_modules/deep-diff/test/.eslintrc +10 -0
- package/node_modules/deep-diff/test/tests.html +34 -0
- package/node_modules/deep-diff/test/tests.js +759 -0
- package/node_modules/deepmerge/.editorconfig +7 -0
- package/node_modules/deepmerge/.eslintcache +1 -0
- package/node_modules/deepmerge/changelog.md +167 -0
- package/node_modules/deepmerge/dist/cjs.js +133 -0
- package/node_modules/deepmerge/dist/umd.js +139 -0
- package/node_modules/deepmerge/index.d.ts +20 -0
- package/node_modules/deepmerge/index.js +106 -0
- package/node_modules/deepmerge/license.txt +21 -0
- package/node_modules/deepmerge/package.json +42 -0
- package/node_modules/deepmerge/readme.md +264 -0
- package/node_modules/deepmerge/rollup.config.js +22 -0
- package/node_modules/npmlog/LICENSE.md +20 -0
- package/node_modules/npmlog/README.md +216 -0
- package/node_modules/npmlog/lib/log.js +400 -0
- package/node_modules/npmlog/package.json +52 -0
- package/nohoist.sh +11 -0
- package/package.json +3 -2
- package/test/cloudfront-distribution-s3-helper.test.js +455 -1
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# deepmerge
|
|
2
|
+
|
|
3
|
+
Merges the enumerable properties of two or more objects deeply.
|
|
4
|
+
|
|
5
|
+
> UMD bundle is 723B minified+gzipped
|
|
6
|
+
|
|
7
|
+
## Getting Started
|
|
8
|
+
|
|
9
|
+
### Example Usage
|
|
10
|
+
<!--js
|
|
11
|
+
const merge = require('./')
|
|
12
|
+
-->
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
const x = {
|
|
16
|
+
foo: { bar: 3 },
|
|
17
|
+
array: [{
|
|
18
|
+
does: 'work',
|
|
19
|
+
too: [ 1, 2, 3 ]
|
|
20
|
+
}]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const y = {
|
|
24
|
+
foo: { baz: 4 },
|
|
25
|
+
quux: 5,
|
|
26
|
+
array: [{
|
|
27
|
+
does: 'work',
|
|
28
|
+
too: [ 4, 5, 6 ]
|
|
29
|
+
}, {
|
|
30
|
+
really: 'yes'
|
|
31
|
+
}]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const output = {
|
|
35
|
+
foo: {
|
|
36
|
+
bar: 3,
|
|
37
|
+
baz: 4
|
|
38
|
+
},
|
|
39
|
+
array: [{
|
|
40
|
+
does: 'work',
|
|
41
|
+
too: [ 1, 2, 3 ]
|
|
42
|
+
}, {
|
|
43
|
+
does: 'work',
|
|
44
|
+
too: [ 4, 5, 6 ]
|
|
45
|
+
}, {
|
|
46
|
+
really: 'yes'
|
|
47
|
+
}],
|
|
48
|
+
quux: 5
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
merge(x, y) // => output
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Installation
|
|
56
|
+
|
|
57
|
+
With [npm](http://npmjs.org) do:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
npm install deepmerge
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
deepmerge can be used directly in the browser without the use of package managers/bundlers as well: [UMD version from unpkg.com](https://unpkg.com/deepmerge/dist/umd.js).
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Include
|
|
67
|
+
|
|
68
|
+
deepmerge exposes a CommonJS entry point:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
const merge = require('deepmerge')
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The ESM entry point was dropped due to a [Webpack bug](https://github.com/webpack/webpack/issues/6584).
|
|
75
|
+
|
|
76
|
+
# API
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
## `merge(x, y, [options])`
|
|
80
|
+
|
|
81
|
+
Merge two objects `x` and `y` deeply, returning a new merged object with the
|
|
82
|
+
elements from both `x` and `y`.
|
|
83
|
+
|
|
84
|
+
If an element at the same key is present for both `x` and `y`, the value from
|
|
85
|
+
`y` will appear in the result.
|
|
86
|
+
|
|
87
|
+
Merging creates a new object, so that neither `x` or `y` is modified.
|
|
88
|
+
|
|
89
|
+
**Note:** By default, arrays are merged by concatenating them.
|
|
90
|
+
|
|
91
|
+
## `merge.all(arrayOfObjects, [options])`
|
|
92
|
+
|
|
93
|
+
Merges any number of objects into a single result object.
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
const foobar = { foo: { bar: 3 } }
|
|
97
|
+
const foobaz = { foo: { baz: 4 } }
|
|
98
|
+
const bar = { bar: 'yay!' }
|
|
99
|
+
|
|
100
|
+
merge.all([ foobar, foobaz, bar ]) // => { foo: { bar: 3, baz: 4 }, bar: 'yay!' }
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
## Options
|
|
105
|
+
|
|
106
|
+
### `arrayMerge`
|
|
107
|
+
|
|
108
|
+
There are multiple ways to merge two arrays, below are a few examples but you can also create your own custom function.
|
|
109
|
+
|
|
110
|
+
Your `arrayMerge` function will be called with three arguments: a `target` array, the `source` array, and an `options` object with these properties:
|
|
111
|
+
|
|
112
|
+
- `isMergeableObject(value)`
|
|
113
|
+
- `cloneUnlessOtherwiseSpecified(value, options)`
|
|
114
|
+
|
|
115
|
+
#### `arrayMerge` example: overwrite target array
|
|
116
|
+
|
|
117
|
+
Overwrites the existing array values completely rather than concatenating them:
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
const overwriteMerge = (destinationArray, sourceArray, options) => sourceArray
|
|
121
|
+
|
|
122
|
+
merge(
|
|
123
|
+
[1, 2, 3],
|
|
124
|
+
[3, 2, 1],
|
|
125
|
+
{ arrayMerge: overwriteMerge }
|
|
126
|
+
) // => [3, 2, 1]
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
#### `arrayMerge` example: combine arrays
|
|
130
|
+
|
|
131
|
+
Combines objects at the same index in the two arrays.
|
|
132
|
+
|
|
133
|
+
This was the default array merging algorithm pre-version-2.0.0.
|
|
134
|
+
|
|
135
|
+
```js
|
|
136
|
+
const combineMerge = (target, source, options) => {
|
|
137
|
+
const destination = target.slice()
|
|
138
|
+
|
|
139
|
+
source.forEach((item, index) => {
|
|
140
|
+
if (typeof destination[index] === 'undefined') {
|
|
141
|
+
destination[index] = options.cloneUnlessOtherwiseSpecified(item, options)
|
|
142
|
+
} else if (options.isMergeableObject(item)) {
|
|
143
|
+
destination[index] = merge(target[index], item, options)
|
|
144
|
+
} else if (target.indexOf(item) === -1) {
|
|
145
|
+
destination.push(item)
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
return destination
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
merge(
|
|
152
|
+
[{ a: true }],
|
|
153
|
+
[{ b: true }, 'ah yup'],
|
|
154
|
+
{ arrayMerge: combineMerge }
|
|
155
|
+
) // => [{ a: true, b: true }, 'ah yup']
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### `isMergeableObject`
|
|
159
|
+
|
|
160
|
+
By default, deepmerge clones every property from almost every kind of object.
|
|
161
|
+
|
|
162
|
+
You may not want this, if your objects are of special types, and you want to copy the whole object instead of just copying its properties.
|
|
163
|
+
|
|
164
|
+
You can accomplish this by passing in a function for the `isMergeableObject` option.
|
|
165
|
+
|
|
166
|
+
If you only want to clone properties of plain objects, and ignore all "special" kinds of instantiated objects, you probably want to drop in [`is-plain-object`](https://github.com/jonschlinkert/is-plain-object).
|
|
167
|
+
|
|
168
|
+
```js
|
|
169
|
+
const { isPlainObject } = require('is-plain-object')
|
|
170
|
+
|
|
171
|
+
function SuperSpecial() {
|
|
172
|
+
this.special = 'oh yeah man totally'
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const instantiatedSpecialObject = new SuperSpecial()
|
|
176
|
+
|
|
177
|
+
const target = {
|
|
178
|
+
someProperty: {
|
|
179
|
+
cool: 'oh for sure'
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const source = {
|
|
184
|
+
someProperty: instantiatedSpecialObject
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const defaultOutput = merge(target, source)
|
|
188
|
+
|
|
189
|
+
defaultOutput.someProperty.cool // => 'oh for sure'
|
|
190
|
+
defaultOutput.someProperty.special // => 'oh yeah man totally'
|
|
191
|
+
defaultOutput.someProperty instanceof SuperSpecial // => false
|
|
192
|
+
|
|
193
|
+
const customMergeOutput = merge(target, source, {
|
|
194
|
+
isMergeableObject: isPlainObject
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
customMergeOutput.someProperty.cool // => undefined
|
|
198
|
+
customMergeOutput.someProperty.special // => 'oh yeah man totally'
|
|
199
|
+
customMergeOutput.someProperty instanceof SuperSpecial // => true
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### `customMerge`
|
|
203
|
+
|
|
204
|
+
Specifies a function which can be used to override the default merge behavior for a property, based on the property name.
|
|
205
|
+
|
|
206
|
+
The `customMerge` function will be passed the key for each property, and should return the function which should be used to merge the values for that property.
|
|
207
|
+
|
|
208
|
+
It may also return undefined, in which case the default merge behaviour will be used.
|
|
209
|
+
|
|
210
|
+
```js
|
|
211
|
+
const alex = {
|
|
212
|
+
name: {
|
|
213
|
+
first: 'Alex',
|
|
214
|
+
last: 'Alexson'
|
|
215
|
+
},
|
|
216
|
+
pets: ['Cat', 'Parrot']
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const tony = {
|
|
220
|
+
name: {
|
|
221
|
+
first: 'Tony',
|
|
222
|
+
last: 'Tonison'
|
|
223
|
+
},
|
|
224
|
+
pets: ['Dog']
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const mergeNames = (nameA, nameB) => `${nameA.first} and ${nameB.first}`
|
|
228
|
+
|
|
229
|
+
const options = {
|
|
230
|
+
customMerge: (key) => {
|
|
231
|
+
if (key === 'name') {
|
|
232
|
+
return mergeNames
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const result = merge(alex, tony, options)
|
|
238
|
+
|
|
239
|
+
result.name // => 'Alex and Tony'
|
|
240
|
+
result.pets // => ['Cat', 'Parrot', 'Dog']
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
### `clone`
|
|
245
|
+
|
|
246
|
+
*Deprecated.*
|
|
247
|
+
|
|
248
|
+
Defaults to `true`.
|
|
249
|
+
|
|
250
|
+
If `clone` is `false` then child objects will be copied directly instead of being cloned. This was the default behavior before version 2.x.
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
# Testing
|
|
254
|
+
|
|
255
|
+
With [npm](http://npmjs.org) do:
|
|
256
|
+
|
|
257
|
+
```sh
|
|
258
|
+
npm test
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
# License
|
|
263
|
+
|
|
264
|
+
MIT
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import resolve from 'rollup-plugin-node-resolve'
|
|
2
|
+
import commonjs from 'rollup-plugin-commonjs'
|
|
3
|
+
import pkg from './package.json'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
input: `index.js`,
|
|
7
|
+
plugins: [
|
|
8
|
+
commonjs(),
|
|
9
|
+
resolve(),
|
|
10
|
+
],
|
|
11
|
+
output: [
|
|
12
|
+
{
|
|
13
|
+
file: pkg.main,
|
|
14
|
+
format: `cjs`
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'deepmerge',
|
|
18
|
+
file: 'dist/umd.js',
|
|
19
|
+
format: `umd`
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!-- This file is automatically added by @npmcli/template-oss. Do not edit. -->
|
|
2
|
+
|
|
3
|
+
ISC License
|
|
4
|
+
|
|
5
|
+
Copyright npm, Inc.
|
|
6
|
+
|
|
7
|
+
Permission to use, copy, modify, and/or distribute this
|
|
8
|
+
software for any purpose with or without fee is hereby
|
|
9
|
+
granted, provided that the above copyright notice and this
|
|
10
|
+
permission notice appear in all copies.
|
|
11
|
+
|
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND NPM DISCLAIMS ALL
|
|
13
|
+
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
|
|
14
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
|
15
|
+
EVENT SHALL NPM BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
16
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
17
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
18
|
+
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
19
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
|
|
20
|
+
USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# npmlog
|
|
2
|
+
|
|
3
|
+
The logger util that npm uses.
|
|
4
|
+
|
|
5
|
+
This logger is very basic. It does the logging for npm. It supports
|
|
6
|
+
custom levels and colored output.
|
|
7
|
+
|
|
8
|
+
By default, logs are written to stderr. If you want to send log messages
|
|
9
|
+
to outputs other than streams, then you can change the `log.stream`
|
|
10
|
+
member, or you can just listen to the events that it emits, and do
|
|
11
|
+
whatever you want with them.
|
|
12
|
+
|
|
13
|
+
# Installation
|
|
14
|
+
|
|
15
|
+
```console
|
|
16
|
+
npm install npmlog --save
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
# Basic Usage
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
var log = require('npmlog')
|
|
23
|
+
|
|
24
|
+
// additional stuff ---------------------------+
|
|
25
|
+
// message ----------+ |
|
|
26
|
+
// prefix ----+ | |
|
|
27
|
+
// level -+ | | |
|
|
28
|
+
// v v v v
|
|
29
|
+
log.info('fyi', 'I have a kitty cat: %j', myKittyCat)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## log.level
|
|
33
|
+
|
|
34
|
+
* {String}
|
|
35
|
+
|
|
36
|
+
The level to display logs at. Any logs at or above this level will be
|
|
37
|
+
displayed. The special level `silent` will prevent anything from being
|
|
38
|
+
displayed ever.
|
|
39
|
+
|
|
40
|
+
## log.record
|
|
41
|
+
|
|
42
|
+
* {Array}
|
|
43
|
+
|
|
44
|
+
An array of all the log messages that have been entered.
|
|
45
|
+
|
|
46
|
+
## log.maxRecordSize
|
|
47
|
+
|
|
48
|
+
* {Number}
|
|
49
|
+
|
|
50
|
+
The maximum number of records to keep. If log.record gets bigger than
|
|
51
|
+
10% over this value, then it is sliced down to 90% of this value.
|
|
52
|
+
|
|
53
|
+
The reason for the 10% window is so that it doesn't have to resize a
|
|
54
|
+
large array on every log entry.
|
|
55
|
+
|
|
56
|
+
## log.prefixStyle
|
|
57
|
+
|
|
58
|
+
* {Object}
|
|
59
|
+
|
|
60
|
+
A style object that specifies how prefixes are styled. (See below)
|
|
61
|
+
|
|
62
|
+
## log.headingStyle
|
|
63
|
+
|
|
64
|
+
* {Object}
|
|
65
|
+
|
|
66
|
+
A style object that specifies how the heading is styled. (See below)
|
|
67
|
+
|
|
68
|
+
## log.heading
|
|
69
|
+
|
|
70
|
+
* {String} Default: ""
|
|
71
|
+
|
|
72
|
+
If set, a heading that is printed at the start of every line.
|
|
73
|
+
|
|
74
|
+
## log.stream
|
|
75
|
+
|
|
76
|
+
* {Stream} Default: `process.stderr`
|
|
77
|
+
|
|
78
|
+
The stream where output is written.
|
|
79
|
+
|
|
80
|
+
## log.enableColor()
|
|
81
|
+
|
|
82
|
+
Force colors to be used on all messages, regardless of the output
|
|
83
|
+
stream.
|
|
84
|
+
|
|
85
|
+
## log.disableColor()
|
|
86
|
+
|
|
87
|
+
Disable colors on all messages.
|
|
88
|
+
|
|
89
|
+
## log.enableProgress()
|
|
90
|
+
|
|
91
|
+
Enable the display of log activity spinner and progress bar
|
|
92
|
+
|
|
93
|
+
## log.disableProgress()
|
|
94
|
+
|
|
95
|
+
Disable the display of a progress bar
|
|
96
|
+
|
|
97
|
+
## log.enableUnicode()
|
|
98
|
+
|
|
99
|
+
Force the unicode theme to be used for the progress bar.
|
|
100
|
+
|
|
101
|
+
## log.disableUnicode()
|
|
102
|
+
|
|
103
|
+
Disable the use of unicode in the progress bar.
|
|
104
|
+
|
|
105
|
+
## log.setGaugeTemplate(template)
|
|
106
|
+
|
|
107
|
+
Set a template for outputting the progress bar. See the [gauge documentation] for details.
|
|
108
|
+
|
|
109
|
+
[gauge documentation]: https://npmjs.com/package/gauge
|
|
110
|
+
|
|
111
|
+
## log.setGaugeThemeset(themes)
|
|
112
|
+
|
|
113
|
+
Select a themeset to pick themes from for the progress bar. See the [gauge documentation] for details.
|
|
114
|
+
|
|
115
|
+
## log.pause()
|
|
116
|
+
|
|
117
|
+
Stop emitting messages to the stream, but do not drop them.
|
|
118
|
+
|
|
119
|
+
## log.resume()
|
|
120
|
+
|
|
121
|
+
Emit all buffered messages that were written while paused.
|
|
122
|
+
|
|
123
|
+
## log.log(level, prefix, message, ...)
|
|
124
|
+
|
|
125
|
+
* `level` {String} The level to emit the message at
|
|
126
|
+
* `prefix` {String} A string prefix. Set to "" to skip.
|
|
127
|
+
* `message...` Arguments to `util.format`
|
|
128
|
+
|
|
129
|
+
Emit a log message at the specified level.
|
|
130
|
+
|
|
131
|
+
## log\[level](prefix, message, ...)
|
|
132
|
+
|
|
133
|
+
For example,
|
|
134
|
+
|
|
135
|
+
* log.silly(prefix, message, ...)
|
|
136
|
+
* log.verbose(prefix, message, ...)
|
|
137
|
+
* log.info(prefix, message, ...)
|
|
138
|
+
* log.http(prefix, message, ...)
|
|
139
|
+
* log.warn(prefix, message, ...)
|
|
140
|
+
* log.error(prefix, message, ...)
|
|
141
|
+
|
|
142
|
+
Like `log.log(level, prefix, message, ...)`. In this way, each level is
|
|
143
|
+
given a shorthand, so you can do `log.info(prefix, message)`.
|
|
144
|
+
|
|
145
|
+
## log.addLevel(level, n, style, disp)
|
|
146
|
+
|
|
147
|
+
* `level` {String} Level indicator
|
|
148
|
+
* `n` {Number} The numeric level
|
|
149
|
+
* `style` {Object} Object with fg, bg, inverse, etc.
|
|
150
|
+
* `disp` {String} Optional replacement for `level` in the output.
|
|
151
|
+
|
|
152
|
+
Sets up a new level with a shorthand function and so forth.
|
|
153
|
+
|
|
154
|
+
Note that if the number is `Infinity`, then setting the level to that
|
|
155
|
+
will cause all log messages to be suppressed. If the number is
|
|
156
|
+
`-Infinity`, then the only way to show it is to enable all log messages.
|
|
157
|
+
|
|
158
|
+
## log.newItem(name, todo, weight)
|
|
159
|
+
|
|
160
|
+
* `name` {String} Optional; progress item name.
|
|
161
|
+
* `todo` {Number} Optional; total amount of work to be done. Default 0.
|
|
162
|
+
* `weight` {Number} Optional; the weight of this item relative to others. Default 1.
|
|
163
|
+
|
|
164
|
+
This adds a new `are-we-there-yet` item tracker to the progress tracker. The
|
|
165
|
+
object returned has the `log[level]` methods but is otherwise an
|
|
166
|
+
`are-we-there-yet` `Tracker` object.
|
|
167
|
+
|
|
168
|
+
## log.newStream(name, todo, weight)
|
|
169
|
+
|
|
170
|
+
This adds a new `are-we-there-yet` stream tracker to the progress tracker. The
|
|
171
|
+
object returned has the `log[level]` methods but is otherwise an
|
|
172
|
+
`are-we-there-yet` `TrackerStream` object.
|
|
173
|
+
|
|
174
|
+
## log.newGroup(name, weight)
|
|
175
|
+
|
|
176
|
+
This adds a new `are-we-there-yet` tracker group to the progress tracker. The
|
|
177
|
+
object returned has the `log[level]` methods but is otherwise an
|
|
178
|
+
`are-we-there-yet` `TrackerGroup` object.
|
|
179
|
+
|
|
180
|
+
# Events
|
|
181
|
+
|
|
182
|
+
Events are all emitted with the message object.
|
|
183
|
+
|
|
184
|
+
* `log` Emitted for all messages
|
|
185
|
+
* `log.<level>` Emitted for all messages with the `<level>` level.
|
|
186
|
+
* `<prefix>` Messages with prefixes also emit their prefix as an event.
|
|
187
|
+
|
|
188
|
+
# Style Objects
|
|
189
|
+
|
|
190
|
+
Style objects can have the following fields:
|
|
191
|
+
|
|
192
|
+
* `fg` {String} Color for the foreground text
|
|
193
|
+
* `bg` {String} Color for the background
|
|
194
|
+
* `bold`, `inverse`, `underline` {Boolean} Set the associated property
|
|
195
|
+
* `bell` {Boolean} Make a noise (This is pretty annoying, probably.)
|
|
196
|
+
|
|
197
|
+
# Message Objects
|
|
198
|
+
|
|
199
|
+
Every log event is emitted with a message object, and the `log.record`
|
|
200
|
+
list contains all of them that have been created. They have the
|
|
201
|
+
following fields:
|
|
202
|
+
|
|
203
|
+
* `id` {Number}
|
|
204
|
+
* `level` {String}
|
|
205
|
+
* `prefix` {String}
|
|
206
|
+
* `message` {String} Result of `util.format()`
|
|
207
|
+
* `messageRaw` {Array} Arguments to `util.format()`
|
|
208
|
+
|
|
209
|
+
# Blocking TTYs
|
|
210
|
+
|
|
211
|
+
We use [`set-blocking`](https://npmjs.com/package/set-blocking) to set
|
|
212
|
+
stderr and stdout blocking if they are tty's and have the setBlocking call.
|
|
213
|
+
This is a work around for an issue in early versions of Node.js 6.x, which
|
|
214
|
+
made stderr and stdout non-blocking on OSX. (They are always blocking
|
|
215
|
+
Windows and were never blocking on Linux.) `npmlog` needs them to be blocking
|
|
216
|
+
so that it can allow output to stdout and stderr to be interlaced.
|