nightingale-formatter 11.7.0 → 12.0.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/.eslintrc.json +1 -1
- package/CHANGELOG.md +55 -0
- package/dist/formatObject.d.ts.map +1 -1
- package/dist/index-browser.cjs.js +167 -131
- package/dist/index-browser.cjs.js.map +1 -1
- package/dist/index-browser.es.js +152 -114
- package/dist/index-browser.es.js.map +1 -1
- package/dist/index-browsermodern.es.js +17 -5
- package/dist/index-browsermodern.es.js.map +1 -1
- package/dist/{index-node12.cjs.js → index-node14.cjs.js} +32 -25
- package/dist/index-node14.cjs.js.map +1 -0
- package/dist/{index-browsermodern-dev.es.js → index-node14.mjs} +17 -5
- package/dist/index-node14.mjs.map +1 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/levelToStyles.d.ts +1 -3
- package/dist/levelToStyles.d.ts.map +1 -1
- package/dist/levelToSymbol.d.ts +1 -3
- package/dist/levelToSymbol.d.ts.map +1 -1
- package/dist/styleToHexColor.d.ts +1 -3
- package/dist/styleToHexColor.d.ts.map +1 -1
- package/dist/styleToHtmlStyle.d.ts +1 -3
- package/dist/styleToHtmlStyle.d.ts.map +1 -1
- package/package.json +21 -78
- package/rollup.config.mjs +3 -0
- package/src/formatObject.test.ts +23 -1
- package/src/formatObject.ts +14 -1
- package/src/formatRecordToString.ts +2 -2
- package/src/index.test.ts +23 -9
- package/src/index.ts +0 -2
- package/src/levelToStyles.ts +2 -4
- package/src/levelToSymbol.ts +2 -4
- package/src/styleToHexColor.ts +1 -3
- package/src/styleToHtmlStyle.ts +1 -3
- package/dist/index-browser-dev.cjs.js +0 -573
- package/dist/index-browser-dev.cjs.js.map +0 -1
- package/dist/index-browser-dev.es.js +0 -557
- package/dist/index-browser-dev.es.js.map +0 -1
- package/dist/index-browsermodern-dev.es.js.map +0 -1
- package/dist/index-node12-dev.cjs.js +0 -573
- package/dist/index-node12-dev.cjs.js.map +0 -1
- package/dist/index-node12-dev.mjs +0 -558
- package/dist/index-node12-dev.mjs.map +0 -1
- package/dist/index-node12.cjs.js.map +0 -1
- package/dist/index-node12.mjs +0 -558
- package/dist/index-node12.mjs.map +0 -1
- package/index.js +0 -6
package/.eslintrc.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,61 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [12.0.0](https://github.com/christophehurpeau/nightingale/compare/v11.9.0...v12.0.0) (2021-12-11)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Build System
|
|
10
|
+
|
|
11
|
+
* node 14 and remove dev builds ([432ecd1](https://github.com/christophehurpeau/nightingale/commit/432ecd1faafd0419f57dea00fce560e4cccc207f))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **nightingale-formatter:** remove deprecated styleToHtmlStyle export ([24e7391](https://github.com/christophehurpeau/nightingale/commit/24e73919fe1bdcd746deefab4f07506a6d83f567))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### BREAKING CHANGES
|
|
20
|
+
|
|
21
|
+
* **nightingale-formatter:** removed deprecated styleToHtmlStyle export
|
|
22
|
+
* requires node 14
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## [11.7.4](https://github.com/christophehurpeau/nightingale/compare/v11.7.3...v11.7.4) (2021-11-27)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* build all packages ([dbb4785](https://github.com/christophehurpeau/nightingale/commit/dbb4785cbb8c75942935c4a5935df32fd2e93690))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## [11.7.2](https://github.com/christophehurpeau/nightingale/compare/v11.7.1...v11.7.2) (2021-11-27)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Bug Fixes
|
|
43
|
+
|
|
44
|
+
* support formatting symbol and bigint ([f4205b0](https://github.com/christophehurpeau/nightingale/commit/f4205b0add9d570e470f93ac525db1adbfacf1db))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## [11.7.1](https://github.com/christophehurpeau/nightingale/compare/v11.7.0...v11.7.1) (2021-06-29)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Bug Fixes
|
|
54
|
+
|
|
55
|
+
* update pob-babel to bring back webpack 4 support ([4887431](https://github.com/christophehurpeau/nightingale/commit/4887431b3b272496511f879af022638723b9056e))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
6
61
|
# [11.7.0](https://github.com/christophehurpeau/nightingale/compare/v11.6.0...v11.7.0) (2021-03-29)
|
|
7
62
|
|
|
8
63
|
**Note:** Version bump only for package nightingale-formatter
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatObject.d.ts","sourceRoot":"","sources":["../src/formatObject.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,oBAAY,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;AAEhE,oBAAY,YAAY,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"formatObject.d.ts","sourceRoot":"","sources":["../src/formatObject.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,oBAAY,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;AAEhE,oBAAY,YAAY,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAya9E,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,GAAE,OAAmB,EAC5B,YAAY,CAAC,EAAE,YAAY,EAC3B,EAAE,OAAc,EAAE,QAAa,EAAE,GAAE,mBAAwB,GAC1D,MAAM,CAkBR"}
|
|
@@ -2,43 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var nightingaleLevels = require('nightingale-levels');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/esm/extends');
|
|
7
7
|
|
|
8
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e[
|
|
8
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
|
|
9
9
|
|
|
10
|
-
var Level__default = /*#__PURE__*/_interopDefaultLegacy(Level);
|
|
11
10
|
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
[
|
|
15
|
-
[
|
|
12
|
+
var levelToStyles = {
|
|
13
|
+
[nightingaleLevels.Level.TRACE]: ['gray'],
|
|
14
|
+
[nightingaleLevels.Level.DEBUG]: ['gray'],
|
|
16
15
|
// [Level.INFO]: ['gray'],
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
16
|
+
[nightingaleLevels.Level.WARN]: ['yellow'],
|
|
17
|
+
[nightingaleLevels.Level.ERROR]: ['red', 'bold'],
|
|
18
|
+
[nightingaleLevels.Level.CRITICAL]: ['red', 'bold'],
|
|
19
|
+
[nightingaleLevels.Level.FATAL]: ['bgRed', 'white'],
|
|
20
|
+
[nightingaleLevels.Level.EMERGENCY]: ['bgRed', 'white']
|
|
22
21
|
};
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
[
|
|
26
|
-
[
|
|
27
|
-
[
|
|
28
|
-
[
|
|
29
|
-
[
|
|
30
|
-
[
|
|
31
|
-
[
|
|
32
|
-
[
|
|
23
|
+
var levelToSymbol = {
|
|
24
|
+
[nightingaleLevels.Level.TRACE]: '•',
|
|
25
|
+
[nightingaleLevels.Level.DEBUG]: '•',
|
|
26
|
+
[nightingaleLevels.Level.INFO]: '→',
|
|
27
|
+
[nightingaleLevels.Level.WARN]: '⚠',
|
|
28
|
+
[nightingaleLevels.Level.ERROR]: '✖',
|
|
29
|
+
[nightingaleLevels.Level.CRITICAL]: '!',
|
|
30
|
+
[nightingaleLevels.Level.FATAL]: '‼',
|
|
31
|
+
[nightingaleLevels.Level.EMERGENCY]: '‼'
|
|
33
32
|
};
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
var styleToHexColor = {
|
|
36
35
|
orange: 'ff5f00',
|
|
37
36
|
grayLight: '808080',
|
|
38
37
|
'gray-light': '808080'
|
|
39
38
|
};
|
|
40
39
|
|
|
41
|
-
|
|
40
|
+
var styleToHtmlStyleThemeLight = {
|
|
42
41
|
// text style
|
|
43
42
|
bold: {
|
|
44
43
|
open: 'font-weight: bold',
|
|
@@ -141,7 +140,7 @@ const styleToHtmlStyleThemeLight = {
|
|
|
141
140
|
close: 'color: currentcolor'
|
|
142
141
|
}
|
|
143
142
|
};
|
|
144
|
-
|
|
143
|
+
var styleToHtmlStyleThemeDark = _extends__default({}, styleToHtmlStyleThemeLight, {
|
|
145
144
|
black: styleToHtmlStyleThemeLight.white,
|
|
146
145
|
bgBlack: styleToHtmlStyleThemeLight.bgWhite,
|
|
147
146
|
white: styleToHtmlStyleThemeLight.black,
|
|
@@ -153,7 +152,9 @@ const styleToHtmlStyleThemeDark = _extends__default({}, styleToHtmlStyleThemeLig
|
|
|
153
152
|
});
|
|
154
153
|
|
|
155
154
|
/* eslint-disable max-lines, @typescript-eslint/no-use-before-define */
|
|
156
|
-
|
|
155
|
+
var noStyleFn = function noStyleFn(styles, value) {
|
|
156
|
+
return value;
|
|
157
|
+
};
|
|
157
158
|
|
|
158
159
|
function tryStringify(arg) {
|
|
159
160
|
try {
|
|
@@ -163,24 +164,29 @@ function tryStringify(arg) {
|
|
|
163
164
|
}
|
|
164
165
|
}
|
|
165
166
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
var sameRawFormattedValue = function sameRawFormattedValue(value) {
|
|
168
|
+
return {
|
|
169
|
+
stringValue: value,
|
|
170
|
+
formattedValue: value
|
|
171
|
+
};
|
|
172
|
+
};
|
|
170
173
|
|
|
171
|
-
function internalFormatValue(value, styleFn, styles, {
|
|
172
|
-
padding,
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const typeofValue = typeof value;
|
|
174
|
+
function internalFormatValue(value, styleFn, styles, _ref) {
|
|
175
|
+
var padding = _ref.padding,
|
|
176
|
+
depth = _ref.depth,
|
|
177
|
+
maxDepth = _ref.maxDepth,
|
|
178
|
+
objects = _ref.objects;
|
|
179
|
+
var typeofValue = typeof value;
|
|
178
180
|
|
|
179
181
|
if (!styles) {
|
|
180
182
|
if (value == null) {
|
|
181
183
|
styles = ['cyan'];
|
|
182
184
|
} else {
|
|
183
185
|
switch (typeofValue) {
|
|
186
|
+
case 'undefined':
|
|
187
|
+
styles = ['cyan'];
|
|
188
|
+
break;
|
|
189
|
+
|
|
184
190
|
case 'boolean':
|
|
185
191
|
styles = ['green'];
|
|
186
192
|
break;
|
|
@@ -189,6 +195,10 @@ function internalFormatValue(value, styleFn, styles, {
|
|
|
189
195
|
styles = ['yellow'];
|
|
190
196
|
break;
|
|
191
197
|
|
|
198
|
+
case 'bigint':
|
|
199
|
+
styles = ['red'];
|
|
200
|
+
break;
|
|
201
|
+
|
|
192
202
|
case 'string':
|
|
193
203
|
styles = ['orange'];
|
|
194
204
|
break;
|
|
@@ -200,7 +210,7 @@ function internalFormatValue(value, styleFn, styles, {
|
|
|
200
210
|
}
|
|
201
211
|
}
|
|
202
212
|
|
|
203
|
-
|
|
213
|
+
var stringValue;
|
|
204
214
|
|
|
205
215
|
if (value === null) {
|
|
206
216
|
stringValue = 'null';
|
|
@@ -232,10 +242,10 @@ function internalFormatValue(value, styleFn, styles, {
|
|
|
232
242
|
});
|
|
233
243
|
}
|
|
234
244
|
} else if (value instanceof Error) {
|
|
235
|
-
|
|
245
|
+
var stack = value.stack;
|
|
236
246
|
stringValue = stack != null && stack.startsWith(value.message) ? stack : `${value.message}\n${stack || ''}`;
|
|
237
247
|
} else if (value instanceof Map) {
|
|
238
|
-
|
|
248
|
+
var name = value.constructor.name;
|
|
239
249
|
|
|
240
250
|
if (depth >= maxDepth) {
|
|
241
251
|
stringValue = `{${name}...}`;
|
|
@@ -247,13 +257,17 @@ function internalFormatValue(value, styleFn, styles, {
|
|
|
247
257
|
objects
|
|
248
258
|
});
|
|
249
259
|
}
|
|
260
|
+
} else if (typeofValue === 'bigint') {
|
|
261
|
+
stringValue = value.toString();
|
|
262
|
+
} else if (typeofValue === 'symbol') {
|
|
263
|
+
stringValue = value.toString();
|
|
250
264
|
} else if (value instanceof Set) {
|
|
251
|
-
|
|
265
|
+
var _name = value.constructor.name;
|
|
252
266
|
|
|
253
267
|
if (depth >= maxDepth) {
|
|
254
|
-
stringValue = `{${
|
|
268
|
+
stringValue = `{${_name}...}`;
|
|
255
269
|
} else {
|
|
256
|
-
return internalFormatSet(
|
|
270
|
+
return internalFormatSet(_name, value, styleFn, {
|
|
257
271
|
padding,
|
|
258
272
|
depth: depth + 1,
|
|
259
273
|
maxDepth,
|
|
@@ -268,33 +282,33 @@ function internalFormatValue(value, styleFn, styles, {
|
|
|
268
282
|
stringValue = tryStringify(value);
|
|
269
283
|
}
|
|
270
284
|
|
|
271
|
-
|
|
285
|
+
var formattedValue = styleFn(styles, stringValue);
|
|
272
286
|
return {
|
|
273
287
|
stringValue,
|
|
274
288
|
formattedValue
|
|
275
289
|
};
|
|
276
290
|
}
|
|
277
291
|
|
|
278
|
-
|
|
292
|
+
var separator = ',';
|
|
279
293
|
|
|
280
|
-
|
|
294
|
+
var internalFormatKey = function internalFormatKey(key, styleFn) {
|
|
281
295
|
return {
|
|
282
296
|
stringKey: `${key}: `,
|
|
283
297
|
formattedKey: `${styleFn(['gray-light', 'bold'], `${key}:`)} `
|
|
284
298
|
};
|
|
285
299
|
};
|
|
286
300
|
|
|
287
|
-
|
|
301
|
+
var internalNoKey = function internalNoKey() {
|
|
288
302
|
return {
|
|
289
303
|
stringKey: '',
|
|
290
304
|
formattedKey: ''
|
|
291
305
|
};
|
|
292
306
|
};
|
|
293
307
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
308
|
+
var internalFormatMapKey = function internalFormatMapKey(key, styleFn, internalFormatParams) {
|
|
309
|
+
var _internalFormatValue = internalFormatValue(key, noStyleFn, undefined, internalFormatParams),
|
|
310
|
+
stringValue = _internalFormatValue.stringValue,
|
|
311
|
+
formattedValue = _internalFormatValue.formattedValue;
|
|
298
312
|
|
|
299
313
|
return {
|
|
300
314
|
stringKey: `${stringValue} => `,
|
|
@@ -302,38 +316,38 @@ const internalFormatMapKey = (key, styleFn, internalFormatParams) => {
|
|
|
302
316
|
};
|
|
303
317
|
};
|
|
304
318
|
|
|
305
|
-
|
|
306
|
-
padding,
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
319
|
+
var internalFormatIterator = function internalFormatIterator(values, styleFn, objectStyles, _ref2, _ref3) {
|
|
320
|
+
var padding = _ref2.padding,
|
|
321
|
+
depth = _ref2.depth,
|
|
322
|
+
maxDepth = _ref2.maxDepth,
|
|
323
|
+
objects = _ref2.objects;
|
|
324
|
+
var prefix = _ref3.prefix,
|
|
325
|
+
suffix = _ref3.suffix,
|
|
326
|
+
_ref3$prefixSuffixSpa = _ref3.prefixSuffixSpace,
|
|
327
|
+
prefixSuffixSpace = _ref3$prefixSuffixSpa === void 0 ? ' ' : _ref3$prefixSuffixSpa,
|
|
328
|
+
formatKey = _ref3.formatKey;
|
|
329
|
+
var breakLine = false;
|
|
330
|
+
|
|
331
|
+
var formattedSeparator = function formattedSeparator() {
|
|
332
|
+
return styleFn(['gray'], separator);
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
var valuesMaxIndex = values.length - 1;
|
|
336
|
+
var formattedValues = values.map(function (_ref4, index) {
|
|
337
|
+
var key = _ref4.key,
|
|
338
|
+
value = _ref4.value;
|
|
339
|
+
var internalFormatParams = {
|
|
326
340
|
padding,
|
|
327
341
|
depth: depth + 1,
|
|
328
342
|
maxDepth,
|
|
329
343
|
objects
|
|
330
344
|
}; // key must be formatted before value (browser-formatter needs order)
|
|
331
345
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
346
|
+
var _formatKey = formatKey(key, styleFn, internalFormatParams),
|
|
347
|
+
stringKey = _formatKey.stringKey,
|
|
348
|
+
formattedKey = _formatKey.formattedKey;
|
|
335
349
|
|
|
336
|
-
|
|
350
|
+
var _internalFormatValue2 = internalFormatValue(value, styleFn, key && objectStyles ? objectStyles[key] : undefined, internalFormatParams),
|
|
337
351
|
stringValue = _internalFormatValue2.stringValue,
|
|
338
352
|
formattedValue = _internalFormatValue2.formattedValue;
|
|
339
353
|
|
|
@@ -350,32 +364,42 @@ const internalFormatIterator = (values, styleFn, objectStyles, {
|
|
|
350
364
|
};
|
|
351
365
|
});
|
|
352
366
|
return {
|
|
353
|
-
stringValue: prefix + formattedValues.map(breakLine ?
|
|
354
|
-
|
|
367
|
+
stringValue: prefix + formattedValues.map(breakLine ? function (v) {
|
|
368
|
+
return `\n${padding}${v.stringValue}`;
|
|
369
|
+
} : function (fv) {
|
|
370
|
+
return fv.stringValue;
|
|
371
|
+
}).join(breakLine ? '\n' : ' ') + suffix,
|
|
372
|
+
formattedValue: `${prefix}${breakLine ? '' : prefixSuffixSpace}${formattedValues.map(breakLine ? function (v) {
|
|
373
|
+
return `\n${padding}${v.formattedValue}`;
|
|
374
|
+
} : function (v) {
|
|
375
|
+
return v.formattedValue;
|
|
376
|
+
}).join(breakLine ? '' : ' ')}${breakLine ? ',\n' : prefixSuffixSpace}${suffix}`
|
|
355
377
|
};
|
|
356
378
|
};
|
|
357
379
|
|
|
358
|
-
function internalFormatObject(object, styleFn, objectStyles, {
|
|
359
|
-
padding,
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
380
|
+
function internalFormatObject(object, styleFn, objectStyles, _ref5) {
|
|
381
|
+
var padding = _ref5.padding,
|
|
382
|
+
depth = _ref5.depth,
|
|
383
|
+
maxDepth = _ref5.maxDepth,
|
|
384
|
+
objects = _ref5.objects;
|
|
385
|
+
|
|
364
386
|
if (objects.has(object)) {
|
|
365
387
|
return sameRawFormattedValue('{Circular Object}');
|
|
366
388
|
}
|
|
367
389
|
|
|
368
|
-
|
|
390
|
+
var keys = Object.keys(object);
|
|
369
391
|
|
|
370
392
|
if (keys.length === 0) {
|
|
371
393
|
return sameRawFormattedValue('{}');
|
|
372
394
|
}
|
|
373
395
|
|
|
374
396
|
objects.add(object);
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
397
|
+
var result = internalFormatIterator(keys.map(function (key) {
|
|
398
|
+
return {
|
|
399
|
+
key,
|
|
400
|
+
value: object[key]
|
|
401
|
+
};
|
|
402
|
+
}), styleFn, objectStyles, {
|
|
379
403
|
padding,
|
|
380
404
|
depth,
|
|
381
405
|
maxDepth,
|
|
@@ -389,27 +413,29 @@ function internalFormatObject(object, styleFn, objectStyles, {
|
|
|
389
413
|
return result;
|
|
390
414
|
}
|
|
391
415
|
|
|
392
|
-
function internalFormatMap(name, map, styleFn, {
|
|
393
|
-
padding,
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
416
|
+
function internalFormatMap(name, map, styleFn, _ref6) {
|
|
417
|
+
var padding = _ref6.padding,
|
|
418
|
+
depth = _ref6.depth,
|
|
419
|
+
maxDepth = _ref6.maxDepth,
|
|
420
|
+
objects = _ref6.objects;
|
|
421
|
+
|
|
398
422
|
if (objects.has(map)) {
|
|
399
423
|
return sameRawFormattedValue(`{Circular ${name}}`);
|
|
400
424
|
}
|
|
401
425
|
|
|
402
|
-
|
|
426
|
+
var keys = [].concat(map.keys());
|
|
403
427
|
|
|
404
428
|
if (keys.length === 0) {
|
|
405
429
|
return sameRawFormattedValue(`${name} {}`);
|
|
406
430
|
}
|
|
407
431
|
|
|
408
432
|
objects.add(map);
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
433
|
+
var result = internalFormatIterator(keys.map(function (key) {
|
|
434
|
+
return {
|
|
435
|
+
key,
|
|
436
|
+
value: map.get(key)
|
|
437
|
+
};
|
|
438
|
+
}), styleFn, undefined, {
|
|
413
439
|
padding,
|
|
414
440
|
depth,
|
|
415
441
|
maxDepth,
|
|
@@ -423,12 +449,12 @@ function internalFormatMap(name, map, styleFn, {
|
|
|
423
449
|
return result;
|
|
424
450
|
}
|
|
425
451
|
|
|
426
|
-
function internalFormatArray(array, styleFn, {
|
|
427
|
-
padding,
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
452
|
+
function internalFormatArray(array, styleFn, _ref7) {
|
|
453
|
+
var padding = _ref7.padding,
|
|
454
|
+
depth = _ref7.depth,
|
|
455
|
+
maxDepth = _ref7.maxDepth,
|
|
456
|
+
objects = _ref7.objects;
|
|
457
|
+
|
|
432
458
|
if (objects.has(array)) {
|
|
433
459
|
return sameRawFormattedValue('{Circular Array}');
|
|
434
460
|
}
|
|
@@ -438,10 +464,12 @@ function internalFormatArray(array, styleFn, {
|
|
|
438
464
|
}
|
|
439
465
|
|
|
440
466
|
objects.add(array);
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
467
|
+
var result = internalFormatIterator(array.map(function (value) {
|
|
468
|
+
return {
|
|
469
|
+
key: undefined,
|
|
470
|
+
value
|
|
471
|
+
};
|
|
472
|
+
}), styleFn, undefined, {
|
|
445
473
|
padding,
|
|
446
474
|
depth,
|
|
447
475
|
maxDepth,
|
|
@@ -456,27 +484,29 @@ function internalFormatArray(array, styleFn, {
|
|
|
456
484
|
return result;
|
|
457
485
|
}
|
|
458
486
|
|
|
459
|
-
function internalFormatSet(name, set, styleFn, {
|
|
460
|
-
padding,
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
487
|
+
function internalFormatSet(name, set, styleFn, _ref8) {
|
|
488
|
+
var padding = _ref8.padding,
|
|
489
|
+
depth = _ref8.depth,
|
|
490
|
+
maxDepth = _ref8.maxDepth,
|
|
491
|
+
objects = _ref8.objects;
|
|
492
|
+
|
|
465
493
|
if (objects.has(set)) {
|
|
466
494
|
return sameRawFormattedValue(`{Circular ${name}}`);
|
|
467
495
|
}
|
|
468
496
|
|
|
469
|
-
|
|
497
|
+
var values = [].concat(set.values());
|
|
470
498
|
|
|
471
499
|
if (values.length === 0) {
|
|
472
500
|
return sameRawFormattedValue(`${name} []`);
|
|
473
501
|
}
|
|
474
502
|
|
|
475
503
|
objects.add(set);
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
504
|
+
var result = internalFormatIterator(values.map(function (value) {
|
|
505
|
+
return {
|
|
506
|
+
key: undefined,
|
|
507
|
+
value
|
|
508
|
+
};
|
|
509
|
+
}), styleFn, undefined, {
|
|
480
510
|
padding,
|
|
481
511
|
depth,
|
|
482
512
|
maxDepth,
|
|
@@ -490,17 +520,24 @@ function internalFormatSet(name, set, styleFn, {
|
|
|
490
520
|
return result;
|
|
491
521
|
}
|
|
492
522
|
|
|
493
|
-
function formatObject(object, styleFn
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
}
|
|
497
|
-
|
|
523
|
+
function formatObject(object, styleFn, objectStyles, _temp) {
|
|
524
|
+
if (styleFn === void 0) {
|
|
525
|
+
styleFn = noStyleFn;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
var _ref9 = _temp === void 0 ? {} : _temp,
|
|
529
|
+
_ref9$padding = _ref9.padding,
|
|
530
|
+
padding = _ref9$padding === void 0 ? ' ' : _ref9$padding,
|
|
531
|
+
_ref9$maxDepth = _ref9.maxDepth,
|
|
532
|
+
maxDepth = _ref9$maxDepth === void 0 ? 10 : _ref9$maxDepth;
|
|
533
|
+
|
|
534
|
+
var _internalFormatObject = internalFormatObject(object, styleFn, objectStyles, {
|
|
498
535
|
padding,
|
|
499
536
|
maxDepth,
|
|
500
537
|
depth: 0,
|
|
501
538
|
objects: new Set()
|
|
502
539
|
}),
|
|
503
|
-
|
|
540
|
+
result = _internalFormatObject.formattedValue;
|
|
504
541
|
|
|
505
542
|
if (result === '{}') {
|
|
506
543
|
return '';
|
|
@@ -510,7 +547,7 @@ function formatObject(object, styleFn = noStyleFn, objectStyles, {
|
|
|
510
547
|
}
|
|
511
548
|
|
|
512
549
|
function formatRecordToString(record, style) {
|
|
513
|
-
|
|
550
|
+
var parts = [];
|
|
514
551
|
|
|
515
552
|
if (record.displayName) {
|
|
516
553
|
parts.push(style(['gray-light'], record.displayName));
|
|
@@ -523,8 +560,8 @@ function formatRecordToString(record, style) {
|
|
|
523
560
|
/* new Date().toFormat('HH24:MI:SS') */
|
|
524
561
|
}
|
|
525
562
|
|
|
526
|
-
|
|
527
|
-
|
|
563
|
+
var message = record.symbol || levelToSymbol[record.level];
|
|
564
|
+
var styles = record.styles || levelToStyles[record.level];
|
|
528
565
|
|
|
529
566
|
if (record.message) {
|
|
530
567
|
if (message) {
|
|
@@ -542,12 +579,12 @@ function formatRecordToString(record, style) {
|
|
|
542
579
|
parts.push(message);
|
|
543
580
|
}
|
|
544
581
|
|
|
545
|
-
|
|
582
|
+
var formatRecordObject = function formatRecordObject(key, object, objectStyles) {
|
|
546
583
|
if (!object) {
|
|
547
584
|
return;
|
|
548
585
|
}
|
|
549
586
|
|
|
550
|
-
|
|
587
|
+
var stringObject = formatObject(object, style, objectStyles);
|
|
551
588
|
|
|
552
589
|
if (!stringObject) {
|
|
553
590
|
return;
|
|
@@ -567,7 +604,6 @@ exports.formatRecordToString = formatRecordToString;
|
|
|
567
604
|
exports.levelToStyles = levelToStyles;
|
|
568
605
|
exports.levelToSymbol = levelToSymbol;
|
|
569
606
|
exports.styleToHexColor = styleToHexColor;
|
|
570
|
-
exports.styleToHtmlStyle = styleToHtmlStyleThemeLight;
|
|
571
607
|
exports.styleToHtmlStyleThemeDark = styleToHtmlStyleThemeDark;
|
|
572
608
|
exports.styleToHtmlStyleThemeLight = styleToHtmlStyleThemeLight;
|
|
573
609
|
//# sourceMappingURL=index-browser.cjs.js.map
|