lib0 0.2.68 → 0.2.70

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.
Files changed (104) hide show
  1. package/README.md +4 -4
  2. package/bin/0serve.js +1 -1
  3. package/broadcastchannel.d.ts.map +1 -1
  4. package/broadcastchannel.js +9 -1
  5. package/coverage/tmp/coverage-29565-1679338304477-0.json +1 -0
  6. package/decoding.js +2 -2
  7. package/deno.json +4 -1
  8. package/diff.d.ts.map +1 -1
  9. package/diff.js +12 -0
  10. package/diff.test.d.ts.map +1 -1
  11. package/dist/{broadcastchannel-4e5909e2.cjs → broadcastchannel-1097a8e1.cjs} +11 -3
  12. package/dist/broadcastchannel-1097a8e1.cjs.map +1 -0
  13. package/dist/broadcastchannel.cjs +3 -3
  14. package/dist/broadcastchannel.d.ts.map +1 -1
  15. package/dist/{buffer-9b566988.cjs → buffer-0021c8c3.cjs} +6 -6
  16. package/dist/buffer-0021c8c3.cjs.map +1 -0
  17. package/dist/buffer.cjs +2 -2
  18. package/dist/component.cjs +1 -1
  19. package/dist/decoding.cjs +2 -2
  20. package/dist/{diff-55061848.cjs → diff-6b03292e.cjs} +13 -1
  21. package/dist/diff-6b03292e.cjs.map +1 -0
  22. package/dist/diff.cjs +1 -1
  23. package/dist/diff.d.ts.map +1 -1
  24. package/dist/diff.test.d.ts.map +1 -1
  25. package/dist/encoding.cjs +2 -2
  26. package/dist/{environment-01c0e75b.cjs → environment-7991e0f6.cjs} +1 -1
  27. package/dist/{environment-01c0e75b.cjs.map → environment-7991e0f6.cjs.map} +1 -1
  28. package/dist/environment.cjs +1 -1
  29. package/dist/index.cjs +27 -7
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.ts +1 -1
  32. package/dist/{logging-641c32f4.cjs → logging.browser.cjs} +38 -193
  33. package/dist/logging.browser.cjs.map +1 -0
  34. package/dist/{logging.d.ts → logging.browser.d.ts} +2 -10
  35. package/dist/logging.browser.d.ts.map +1 -0
  36. package/dist/logging.common.cjs +99 -0
  37. package/dist/logging.common.cjs.map +1 -0
  38. package/dist/logging.common.d.ts +12 -0
  39. package/dist/logging.common.d.ts.map +1 -0
  40. package/dist/logging.node.cjs +196 -0
  41. package/dist/logging.node.cjs.map +1 -0
  42. package/dist/logging.node.d.ts +14 -0
  43. package/dist/logging.node.d.ts.map +1 -0
  44. package/dist/performance.browser.cjs +14 -0
  45. package/dist/performance.browser.cjs.map +1 -0
  46. package/dist/performance.browser.d.ts +4 -0
  47. package/dist/performance.browser.d.ts.map +1 -0
  48. package/dist/performance.node.cjs +35 -0
  49. package/dist/performance.node.cjs.map +1 -0
  50. package/dist/performance.node.d.ts +15 -0
  51. package/dist/performance.node.d.ts.map +1 -0
  52. package/dist/{prng-cd2451c9.cjs → prng-98750e19.cjs} +2 -2
  53. package/dist/{prng-cd2451c9.cjs.map → prng-98750e19.cjs.map} +1 -1
  54. package/dist/prng.cjs +3 -3
  55. package/dist/random.cjs +3 -3
  56. package/dist/random.cjs.map +1 -1
  57. package/dist/random.d.ts.map +1 -1
  58. package/dist/storage.cjs +11 -1
  59. package/dist/storage.cjs.map +1 -1
  60. package/dist/storage.d.ts +5 -0
  61. package/dist/storage.d.ts.map +1 -1
  62. package/dist/testing.cjs +66 -48
  63. package/dist/testing.cjs.map +1 -1
  64. package/dist/testing.d.ts +1 -1
  65. package/dist/testing.d.ts.map +1 -1
  66. package/encoding.js +2 -2
  67. package/index.d.ts +1 -1
  68. package/index.js +1 -1
  69. package/isomorphic.js +2 -0
  70. package/{logging.d.ts → logging.browser.d.ts} +2 -10
  71. package/logging.browser.d.ts.map +1 -0
  72. package/{logging.js → logging.browser.js} +16 -152
  73. package/logging.common.d.ts +12 -0
  74. package/logging.common.d.ts.map +1 -0
  75. package/logging.common.js +76 -0
  76. package/logging.node.d.ts +14 -0
  77. package/logging.node.d.ts.map +1 -0
  78. package/logging.node.js +159 -0
  79. package/package.json +29 -7
  80. package/performance.browser.d.ts +4 -0
  81. package/performance.browser.d.ts.map +1 -0
  82. package/performance.browser.js +5 -0
  83. package/performance.node.d.ts +15 -0
  84. package/performance.node.d.ts.map +1 -0
  85. package/performance.node.js +21 -0
  86. package/random.d.ts.map +1 -1
  87. package/random.js +3 -3
  88. package/storage.d.ts +5 -0
  89. package/storage.d.ts.map +1 -1
  90. package/storage.js +10 -1
  91. package/test.html +2 -3
  92. package/test.js +1 -1
  93. package/testing.d.ts +1 -1
  94. package/testing.d.ts.map +1 -1
  95. package/testing.js +2 -3
  96. package/coverage/tmp/coverage-53209-1678990177518-0.json +0 -1
  97. package/dist/broadcastchannel-4e5909e2.cjs.map +0 -1
  98. package/dist/buffer-9b566988.cjs.map +0 -1
  99. package/dist/diff-55061848.cjs.map +0 -1
  100. package/dist/logging-641c32f4.cjs.map +0 -1
  101. package/dist/logging.cjs +0 -49
  102. package/dist/logging.cjs.map +0 -1
  103. package/dist/logging.d.ts.map +0 -1
  104. package/logging.d.ts.map +0 -1
package/dist/index.cjs CHANGED
@@ -4,26 +4,26 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var array = require('./array-a1682de6.cjs');
6
6
  var binary = require('./binary-ac8e39e2.cjs');
7
- var broadcastchannel = require('./broadcastchannel-4e5909e2.cjs');
8
- var encoding = require('./buffer-9b566988.cjs');
7
+ var broadcastchannel = require('./broadcastchannel-1097a8e1.cjs');
8
+ var encoding = require('./buffer-0021c8c3.cjs');
9
9
  var conditions = require('./conditions-f5c0c102.cjs');
10
- var diff = require('./diff-55061848.cjs');
10
+ var diff = require('./diff-6b03292e.cjs');
11
11
  var dom = require('./dom-7ef10fba.cjs');
12
- var environment = require('./environment-01c0e75b.cjs');
12
+ var environment = require('./environment-7991e0f6.cjs');
13
13
  var error = require('./error-8582d695.cjs');
14
14
  var eventloop = require('./eventloop-d0571621.cjs');
15
15
  var _function = require('./function-35e8ddea.cjs');
16
16
  var indexeddb = require('./indexeddb-38ee46bd.cjs');
17
17
  var iterator = require('./iterator-9fc627c1.cjs');
18
18
  var json = require('./json-092190a1.cjs');
19
- var logging = require('./logging-641c32f4.cjs');
19
+ var log = require('lib0/logging');
20
20
  var map = require('./map-9a5915e4.cjs');
21
21
  var math = require('./math-08e068f9.cjs');
22
22
  var mutex = require('./mutex-63f09c81.cjs');
23
23
  var number = require('./number-f97e141a.cjs');
24
24
  var object = require('./object-aad630ed.cjs');
25
25
  var pair = require('./pair-ab022bc3.cjs');
26
- var prng = require('./prng-cd2451c9.cjs');
26
+ var prng = require('./prng-98750e19.cjs');
27
27
  var promise = require('./promise-a4f32c85.cjs');
28
28
  var set = require('./set-0f209abb.cjs');
29
29
  var sort = require('./sort-b8702761.cjs');
@@ -37,6 +37,26 @@ require('./storage.cjs');
37
37
  require('./metric.cjs');
38
38
  require('./observable.cjs');
39
39
 
40
+ function _interopNamespace(e) {
41
+ if (e && e.__esModule) return e;
42
+ var n = Object.create(null);
43
+ if (e) {
44
+ Object.keys(e).forEach(function (k) {
45
+ if (k !== 'default') {
46
+ var d = Object.getOwnPropertyDescriptor(e, k);
47
+ Object.defineProperty(n, k, d.get ? d : {
48
+ enumerable: true,
49
+ get: function () { return e[k]; }
50
+ });
51
+ }
52
+ });
53
+ }
54
+ n["default"] = e;
55
+ return Object.freeze(n);
56
+ }
57
+
58
+ var log__namespace = /*#__PURE__*/_interopNamespace(log);
59
+
40
60
 
41
61
 
42
62
  exports.array = array.array;
@@ -55,7 +75,7 @@ exports.func = _function._function;
55
75
  exports.indexeddb = indexeddb.indexeddb;
56
76
  exports.iterator = iterator.iterator;
57
77
  exports.json = json.json;
58
- exports.logging = logging.logging;
78
+ exports.logging = log__namespace;
59
79
  exports.map = map.map$1;
60
80
  exports.math = math.math;
61
81
  exports.mutex = mutex.mutex;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -14,7 +14,7 @@ import * as func from "./function.js";
14
14
  import * as indexeddb from "./indexeddb.js";
15
15
  import * as iterator from "./iterator.js";
16
16
  import * as json from "./json.js";
17
- import * as logging from "./logging.js";
17
+ import * as logging from "lib0/logging";
18
18
  import * as map from "./map.js";
19
19
  import * as math from "./math.js";
20
20
  import * as mutex from "./mutex.js";
@@ -1,16 +1,25 @@
1
1
  'use strict';
2
2
 
3
- var environment = require('./environment-01c0e75b.cjs');
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var environment = require('./environment-7991e0f6.cjs');
4
6
  var set = require('./set-0f209abb.cjs');
5
- var symbol = require('./symbol-c5caa724.cjs');
6
7
  var pair = require('./pair-ab022bc3.cjs');
7
8
  var dom = require('./dom-7ef10fba.cjs');
8
9
  var json = require('./json-092190a1.cjs');
9
10
  var map = require('./map-9a5915e4.cjs');
10
11
  var eventloop = require('./eventloop-d0571621.cjs');
11
12
  var math = require('./math-08e068f9.cjs');
12
- var time = require('./time-bc2081b9.cjs');
13
- var _function = require('./function-35e8ddea.cjs');
13
+ var logging_common = require('./logging.common.cjs');
14
+ require('./string-b1bee84b.cjs');
15
+ require('./conditions-f5c0c102.cjs');
16
+ require('./storage.cjs');
17
+ require('./function-35e8ddea.cjs');
18
+ require('./array-a1682de6.cjs');
19
+ require('./object-aad630ed.cjs');
20
+ require('./symbol-c5caa724.cjs');
21
+ require('./time-bc2081b9.cjs');
22
+ require('./metric.cjs');
14
23
 
15
24
  /**
16
25
  * Isomorphic logging module with support for colors!
@@ -18,41 +27,19 @@ var _function = require('./function-35e8ddea.cjs');
18
27
  * @module logging
19
28
  */
20
29
 
21
- const BOLD = symbol.create();
22
- const UNBOLD = symbol.create();
23
- const BLUE = symbol.create();
24
- const GREY = symbol.create();
25
- const GREEN = symbol.create();
26
- const RED = symbol.create();
27
- const PURPLE = symbol.create();
28
- const ORANGE = symbol.create();
29
- const UNCOLOR = symbol.create();
30
-
31
30
  /**
32
31
  * @type {Object<Symbol,pair.Pair<string,string>>}
33
32
  */
34
33
  const _browserStyleMap = {
35
- [BOLD]: pair.create('font-weight', 'bold'),
36
- [UNBOLD]: pair.create('font-weight', 'normal'),
37
- [BLUE]: pair.create('color', 'blue'),
38
- [GREEN]: pair.create('color', 'green'),
39
- [GREY]: pair.create('color', 'grey'),
40
- [RED]: pair.create('color', 'red'),
41
- [PURPLE]: pair.create('color', 'purple'),
42
- [ORANGE]: pair.create('color', 'orange'), // not well supported in chrome when debugging node with inspector - TODO: deprecate
43
- [UNCOLOR]: pair.create('color', 'black')
44
- };
45
-
46
- const _nodeStyleMap = {
47
- [BOLD]: '\u001b[1m',
48
- [UNBOLD]: '\u001b[2m',
49
- [BLUE]: '\x1b[34m',
50
- [GREEN]: '\x1b[32m',
51
- [GREY]: '\u001b[37m',
52
- [RED]: '\x1b[31m',
53
- [PURPLE]: '\x1b[35m',
54
- [ORANGE]: '\x1b[38;5;208m',
55
- [UNCOLOR]: '\x1b[0m'
34
+ [logging_common.BOLD]: pair.create('font-weight', 'bold'),
35
+ [logging_common.UNBOLD]: pair.create('font-weight', 'normal'),
36
+ [logging_common.BLUE]: pair.create('color', 'blue'),
37
+ [logging_common.GREEN]: pair.create('color', 'green'),
38
+ [logging_common.GREY]: pair.create('color', 'grey'),
39
+ [logging_common.RED]: pair.create('color', 'red'),
40
+ [logging_common.PURPLE]: pair.create('color', 'purple'),
41
+ [logging_common.ORANGE]: pair.create('color', 'orange'), // not well supported in chrome when debugging node with inspector - TODO: deprecate
42
+ [logging_common.UNCOLOR]: pair.create('color', 'black')
56
43
  };
57
44
 
58
45
  /**
@@ -106,90 +93,10 @@ const computeBrowserLoggingArgs = (args) => {
106
93
  };
107
94
  /* c8 ignore stop */
108
95
 
109
- /* c8 ignore start */
110
- /**
111
- * @param {Array<string|Symbol|Object|number>} args
112
- * @return {Array<string|object|number>}
113
- */
114
- const computeNoColorLoggingArgs = args => {
115
- const strBuilder = [];
116
- const logArgs = [];
117
- // try with formatting until we find something unsupported
118
- let i = 0;
119
- for (; i < args.length; i++) {
120
- const arg = args[i];
121
- // @ts-ignore
122
- const style = _nodeStyleMap[arg];
123
- if (style === undefined) {
124
- if (arg.constructor === String || arg.constructor === Number) {
125
- strBuilder.push(arg);
126
- } else {
127
- break
128
- }
129
- }
130
- }
131
- if (i > 0) {
132
- logArgs.push(strBuilder.join(''));
133
- }
134
- // append the rest
135
- for (; i < args.length; i++) {
136
- const arg = args[i];
137
- if (!(arg instanceof Symbol)) {
138
- if (arg.constructor === Object) {
139
- logArgs.push(JSON.stringify(arg));
140
- } else {
141
- logArgs.push(arg);
142
- }
143
- }
144
- }
145
- return logArgs
146
- };
147
- /* c8 ignore stop */
148
-
149
- /* c8 ignore start */
150
- /**
151
- * @param {Array<string|Symbol|Object|number>} args
152
- * @return {Array<string|object|number>}
153
- */
154
- const computeNodeLoggingArgs = (args) => {
155
- const strBuilder = [];
156
- const logArgs = [];
157
- // try with formatting until we find something unsupported
158
- let i = 0;
159
- for (; i < args.length; i++) {
160
- const arg = args[i];
161
- // @ts-ignore
162
- const style = _nodeStyleMap[arg];
163
- if (style !== undefined) {
164
- strBuilder.push(style);
165
- } else {
166
- if (arg.constructor === String || arg.constructor === Number) {
167
- strBuilder.push(arg);
168
- } else {
169
- break
170
- }
171
- }
172
- }
173
- if (i > 0) {
174
- // create logArgs with what we have so far
175
- strBuilder.push('\x1b[0m');
176
- logArgs.push(strBuilder.join(''));
177
- }
178
- // append the rest
179
- for (; i < args.length; i++) {
180
- const arg = args[i];
181
- if (!(arg instanceof Symbol)) {
182
- logArgs.push(arg);
183
- }
184
- }
185
- return logArgs
186
- };
187
- /* c8 ignore stop */
188
-
189
96
  /* c8 ignore start */
190
97
  const computeLoggingArgs = environment.supportsColor
191
- ? (environment.isNode ? computeNodeLoggingArgs : computeBrowserLoggingArgs)
192
- : computeNoColorLoggingArgs;
98
+ ? computeBrowserLoggingArgs
99
+ : logging_common.computeNoColorLoggingArgs;
193
100
  /* c8 ignore stop */
194
101
 
195
102
  /**
@@ -207,7 +114,7 @@ const print = (...args) => {
207
114
  */
208
115
  const warn = (...args) => {
209
116
  console.warn(...computeLoggingArgs(args));
210
- args.unshift(ORANGE);
117
+ args.unshift(logging_common.ORANGE);
211
118
  vconsoles.forEach((vc) => vc.print(args));
212
119
  };
213
120
  /* c8 ignore stop */
@@ -430,7 +337,7 @@ class VConsole {
430
337
  * @param {Error} err
431
338
  */
432
339
  printError (err) {
433
- this.print([RED, BOLD, err.toString()]);
340
+ this.print([logging_common.RED, logging_common.BOLD, err.toString()]);
434
341
  }
435
342
 
436
343
  /**
@@ -471,89 +378,27 @@ class VConsole {
471
378
  /* c8 ignore next */
472
379
  const createVConsole = (dom) => new VConsole(dom);
473
380
 
474
- const loggingColors = [GREEN, PURPLE, ORANGE, BLUE];
475
- let nextColor = 0;
476
- let lastLoggingTime = time.getUnixTime();
477
-
478
- /* c8 ignore start */
479
381
  /**
480
382
  * @param {string} moduleName
481
383
  * @return {function(...any):void}
482
384
  */
483
- const createModuleLogger = (moduleName) => {
484
- const color = loggingColors[nextColor];
485
- const debugRegexVar = environment.getVariable('log');
486
- const doLogging = debugRegexVar !== null &&
487
- (debugRegexVar === '*' || debugRegexVar === 'true' ||
488
- new RegExp(debugRegexVar, 'gi').test(moduleName));
489
- nextColor = (nextColor + 1) % loggingColors.length;
490
- moduleName += ': ';
491
-
492
- return !doLogging
493
- ? _function.nop
494
- : (...args) => {
495
- const timeNow = time.getUnixTime();
496
- const timeDiff = timeNow - lastLoggingTime;
497
- lastLoggingTime = timeNow;
498
- print(
499
- color,
500
- moduleName,
501
- UNCOLOR,
502
- ...args.map((arg) =>
503
- (typeof arg === 'string' || typeof arg === 'symbol')
504
- ? arg
505
- : JSON.stringify(arg)
506
- ),
507
- color,
508
- ' +' + timeDiff + 'ms'
509
- );
510
- }
511
- };
512
- /* c8 ignore stop */
513
-
514
- var logging = /*#__PURE__*/Object.freeze({
515
- __proto__: null,
516
- BOLD: BOLD,
517
- UNBOLD: UNBOLD,
518
- BLUE: BLUE,
519
- GREY: GREY,
520
- GREEN: GREEN,
521
- RED: RED,
522
- PURPLE: PURPLE,
523
- ORANGE: ORANGE,
524
- UNCOLOR: UNCOLOR,
525
- print: print,
526
- warn: warn,
527
- printError: printError,
528
- printImg: printImg,
529
- printImgBase64: printImgBase64,
530
- group: group,
531
- groupCollapsed: groupCollapsed,
532
- groupEnd: groupEnd,
533
- printDom: printDom,
534
- printCanvas: printCanvas,
535
- vconsoles: vconsoles,
536
- VConsole: VConsole,
537
- createVConsole: createVConsole,
538
- createModuleLogger: createModuleLogger
539
- });
540
-
541
- exports.BLUE = BLUE;
542
- exports.BOLD = BOLD;
543
- exports.GREEN = GREEN;
544
- exports.GREY = GREY;
545
- exports.ORANGE = ORANGE;
546
- exports.PURPLE = PURPLE;
547
- exports.RED = RED;
548
- exports.UNBOLD = UNBOLD;
549
- exports.UNCOLOR = UNCOLOR;
385
+ const createModuleLogger = (moduleName) => logging_common.createModuleLogger(print, moduleName);
386
+
387
+ exports.BLUE = logging_common.BLUE;
388
+ exports.BOLD = logging_common.BOLD;
389
+ exports.GREEN = logging_common.GREEN;
390
+ exports.GREY = logging_common.GREY;
391
+ exports.ORANGE = logging_common.ORANGE;
392
+ exports.PURPLE = logging_common.PURPLE;
393
+ exports.RED = logging_common.RED;
394
+ exports.UNBOLD = logging_common.UNBOLD;
395
+ exports.UNCOLOR = logging_common.UNCOLOR;
550
396
  exports.VConsole = VConsole;
551
397
  exports.createModuleLogger = createModuleLogger;
552
398
  exports.createVConsole = createVConsole;
553
399
  exports.group = group;
554
400
  exports.groupCollapsed = groupCollapsed;
555
401
  exports.groupEnd = groupEnd;
556
- exports.logging = logging;
557
402
  exports.print = print;
558
403
  exports.printCanvas = printCanvas;
559
404
  exports.printDom = printDom;
@@ -562,4 +407,4 @@ exports.printImg = printImg;
562
407
  exports.printImgBase64 = printImgBase64;
563
408
  exports.vconsoles = vconsoles;
564
409
  exports.warn = warn;
565
- //# sourceMappingURL=logging-641c32f4.cjs.map
410
+ //# sourceMappingURL=logging.browser.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logging.browser.cjs","sources":["../logging.browser.js"],"sourcesContent":["/**\n * Isomorphic logging module with support for colors!\n *\n * @module logging\n */\n\nimport * as env from './environment.js'\nimport * as set from './set.js'\nimport * as pair from './pair.js'\nimport * as dom from './dom.js'\nimport * as json from './json.js'\nimport * as map from './map.js'\nimport * as eventloop from './eventloop.js'\nimport * as math from './math.js'\nimport * as common from './logging.common.js'\n\nexport { BOLD, UNBOLD, BLUE, GREY, GREEN, RED, PURPLE, ORANGE, UNCOLOR } from './logging.common.js'\n\n/**\n * @type {Object<Symbol,pair.Pair<string,string>>}\n */\nconst _browserStyleMap = {\n [common.BOLD]: pair.create('font-weight', 'bold'),\n [common.UNBOLD]: pair.create('font-weight', 'normal'),\n [common.BLUE]: pair.create('color', 'blue'),\n [common.GREEN]: pair.create('color', 'green'),\n [common.GREY]: pair.create('color', 'grey'),\n [common.RED]: pair.create('color', 'red'),\n [common.PURPLE]: pair.create('color', 'purple'),\n [common.ORANGE]: pair.create('color', 'orange'), // not well supported in chrome when debugging node with inspector - TODO: deprecate\n [common.UNCOLOR]: pair.create('color', 'black')\n}\n\n/**\n * @param {Array<string|Symbol|Object|number>} args\n * @return {Array<string|object|number>}\n */\n/* c8 ignore start */\nconst computeBrowserLoggingArgs = (args) => {\n const strBuilder = []\n const styles = []\n const currentStyle = map.create()\n /**\n * @type {Array<string|Object|number>}\n */\n let logArgs = []\n // try with formatting until we find something unsupported\n let i = 0\n for (; i < args.length; i++) {\n const arg = args[i]\n // @ts-ignore\n const style = _browserStyleMap[arg]\n if (style !== undefined) {\n currentStyle.set(style.left, style.right)\n } else {\n if (arg.constructor === String || arg.constructor === Number) {\n const style = dom.mapToStyleString(currentStyle)\n if (i > 0 || style.length > 0) {\n strBuilder.push('%c' + arg)\n styles.push(style)\n } else {\n strBuilder.push(arg)\n }\n } else {\n break\n }\n }\n }\n if (i > 0) {\n // create logArgs with what we have so far\n logArgs = styles\n logArgs.unshift(strBuilder.join(''))\n }\n // append the rest\n for (; i < args.length; i++) {\n const arg = args[i]\n if (!(arg instanceof Symbol)) {\n logArgs.push(arg)\n }\n }\n return logArgs\n}\n/* c8 ignore stop */\n\n/* c8 ignore start */\nconst computeLoggingArgs = env.supportsColor\n ? computeBrowserLoggingArgs\n : common.computeNoColorLoggingArgs\n/* c8 ignore stop */\n\n/**\n * @param {Array<string|Symbol|Object|number>} args\n */\nexport const print = (...args) => {\n console.log(...computeLoggingArgs(args))\n /* c8 ignore next */\n vconsoles.forEach((vc) => vc.print(args))\n}\n\n/* c8 ignore start */\n/**\n * @param {Array<string|Symbol|Object|number>} args\n */\nexport const warn = (...args) => {\n console.warn(...computeLoggingArgs(args))\n args.unshift(common.ORANGE)\n vconsoles.forEach((vc) => vc.print(args))\n}\n/* c8 ignore stop */\n\n/**\n * @param {Error} err\n */\n/* c8 ignore start */\nexport const printError = (err) => {\n console.error(err)\n vconsoles.forEach((vc) => vc.printError(err))\n}\n/* c8 ignore stop */\n\n/**\n * @param {string} url image location\n * @param {number} height height of the image in pixel\n */\n/* c8 ignore start */\nexport const printImg = (url, height) => {\n if (env.isBrowser) {\n console.log(\n '%c ',\n `font-size: ${height}px; background-size: contain; background-repeat: no-repeat; background-image: url(${url})`\n )\n // console.log('%c ', `font-size: ${height}x; background: url(${url}) no-repeat;`)\n }\n vconsoles.forEach((vc) => vc.printImg(url, height))\n}\n/* c8 ignore stop */\n\n/**\n * @param {string} base64\n * @param {number} height\n */\n/* c8 ignore next 2 */\nexport const printImgBase64 = (base64, height) =>\n printImg(`data:image/gif;base64,${base64}`, height)\n\n/**\n * @param {Array<string|Symbol|Object|number>} args\n */\nexport const group = (...args) => {\n console.group(...computeLoggingArgs(args))\n /* c8 ignore next */\n vconsoles.forEach((vc) => vc.group(args))\n}\n\n/**\n * @param {Array<string|Symbol|Object|number>} args\n */\nexport const groupCollapsed = (...args) => {\n console.groupCollapsed(...computeLoggingArgs(args))\n /* c8 ignore next */\n vconsoles.forEach((vc) => vc.groupCollapsed(args))\n}\n\nexport const groupEnd = () => {\n console.groupEnd()\n /* c8 ignore next */\n vconsoles.forEach((vc) => vc.groupEnd())\n}\n\n/**\n * @param {function():Node} createNode\n */\n/* c8 ignore next 2 */\nexport const printDom = (createNode) =>\n vconsoles.forEach((vc) => vc.printDom(createNode()))\n\n/**\n * @param {HTMLCanvasElement} canvas\n * @param {number} height\n */\n/* c8 ignore next 2 */\nexport const printCanvas = (canvas, height) =>\n printImg(canvas.toDataURL(), height)\n\nexport const vconsoles = set.create()\n\n/**\n * @param {Array<string|Symbol|Object|number>} args\n * @return {Array<Element>}\n */\n/* c8 ignore start */\nconst _computeLineSpans = (args) => {\n const spans = []\n const currentStyle = new Map()\n // try with formatting until we find something unsupported\n let i = 0\n for (; i < args.length; i++) {\n const arg = args[i]\n // @ts-ignore\n const style = _browserStyleMap[arg]\n if (style !== undefined) {\n currentStyle.set(style.left, style.right)\n } else {\n if (arg.constructor === String || arg.constructor === Number) {\n // @ts-ignore\n const span = dom.element('span', [\n pair.create('style', dom.mapToStyleString(currentStyle))\n ], [dom.text(arg.toString())])\n if (span.innerHTML === '') {\n span.innerHTML = '&nbsp;'\n }\n spans.push(span)\n } else {\n break\n }\n }\n }\n // append the rest\n for (; i < args.length; i++) {\n let content = args[i]\n if (!(content instanceof Symbol)) {\n if (content.constructor !== String && content.constructor !== Number) {\n content = ' ' + json.stringify(content) + ' '\n }\n spans.push(\n dom.element('span', [], [dom.text(/** @type {string} */ (content))])\n )\n }\n }\n return spans\n}\n/* c8 ignore stop */\n\nconst lineStyle =\n 'font-family:monospace;border-bottom:1px solid #e2e2e2;padding:2px;'\n\n/* c8 ignore start */\nexport class VConsole {\n /**\n * @param {Element} dom\n */\n constructor (dom) {\n this.dom = dom\n /**\n * @type {Element}\n */\n this.ccontainer = this.dom\n this.depth = 0\n vconsoles.add(this)\n }\n\n /**\n * @param {Array<string|Symbol|Object|number>} args\n * @param {boolean} collapsed\n */\n group (args, collapsed = false) {\n eventloop.enqueue(() => {\n const triangleDown = dom.element('span', [\n pair.create('hidden', collapsed),\n pair.create('style', 'color:grey;font-size:120%;')\n ], [dom.text('▼')])\n const triangleRight = dom.element('span', [\n pair.create('hidden', !collapsed),\n pair.create('style', 'color:grey;font-size:125%;')\n ], [dom.text('▶')])\n const content = dom.element(\n 'div',\n [pair.create(\n 'style',\n `${lineStyle};padding-left:${this.depth * 10}px`\n )],\n [triangleDown, triangleRight, dom.text(' ')].concat(\n _computeLineSpans(args)\n )\n )\n const nextContainer = dom.element('div', [\n pair.create('hidden', collapsed)\n ])\n const nextLine = dom.element('div', [], [content, nextContainer])\n dom.append(this.ccontainer, [nextLine])\n this.ccontainer = nextContainer\n this.depth++\n // when header is clicked, collapse/uncollapse container\n dom.addEventListener(content, 'click', (_event) => {\n nextContainer.toggleAttribute('hidden')\n triangleDown.toggleAttribute('hidden')\n triangleRight.toggleAttribute('hidden')\n })\n })\n }\n\n /**\n * @param {Array<string|Symbol|Object|number>} args\n */\n groupCollapsed (args) {\n this.group(args, true)\n }\n\n groupEnd () {\n eventloop.enqueue(() => {\n if (this.depth > 0) {\n this.depth--\n // @ts-ignore\n this.ccontainer = this.ccontainer.parentElement.parentElement\n }\n })\n }\n\n /**\n * @param {Array<string|Symbol|Object|number>} args\n */\n print (args) {\n eventloop.enqueue(() => {\n dom.append(this.ccontainer, [\n dom.element('div', [\n pair.create(\n 'style',\n `${lineStyle};padding-left:${this.depth * 10}px`\n )\n ], _computeLineSpans(args))\n ])\n })\n }\n\n /**\n * @param {Error} err\n */\n printError (err) {\n this.print([common.RED, common.BOLD, err.toString()])\n }\n\n /**\n * @param {string} url\n * @param {number} height\n */\n printImg (url, height) {\n eventloop.enqueue(() => {\n dom.append(this.ccontainer, [\n dom.element('img', [\n pair.create('src', url),\n pair.create('height', `${math.round(height * 1.5)}px`)\n ])\n ])\n })\n }\n\n /**\n * @param {Node} node\n */\n printDom (node) {\n eventloop.enqueue(() => {\n dom.append(this.ccontainer, [node])\n })\n }\n\n destroy () {\n eventloop.enqueue(() => {\n vconsoles.delete(this)\n })\n }\n}\n/* c8 ignore stop */\n\n/**\n * @param {Element} dom\n */\n/* c8 ignore next */\nexport const createVConsole = (dom) => new VConsole(dom)\n\n/**\n * @param {string} moduleName\n * @return {function(...any):void}\n */\nexport const createModuleLogger = (moduleName) => common.createModuleLogger(print, moduleName)\n"],"names":["common.BOLD","pair.create","common.UNBOLD","common.BLUE","common.GREEN","common.GREY","common.RED","common.PURPLE","common.ORANGE","common.UNCOLOR","map.create","dom.mapToStyleString","env.supportsColor","common.computeNoColorLoggingArgs","env.isBrowser","set.create","dom.element","dom.text","json.stringify","eventloop.enqueue","dom.append","dom.addEventListener","math.round","common.createModuleLogger"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA,MAAM,gBAAgB,GAAG;AACzB,EAAE,CAACA,mBAAW,GAAGC,WAAW,CAAC,aAAa,EAAE,MAAM,CAAC;AACnD,EAAE,CAACC,qBAAa,GAAGD,WAAW,CAAC,aAAa,EAAE,QAAQ,CAAC;AACvD,EAAE,CAACE,mBAAW,GAAGF,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC;AAC7C,EAAE,CAACG,oBAAY,GAAGH,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC;AAC/C,EAAE,CAACI,mBAAW,GAAGJ,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC;AAC7C,EAAE,CAACK,kBAAU,GAAGL,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC;AAC3C,EAAE,CAAC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
@@ -1,12 +1,3 @@
1
- export const BOLD: symbol;
2
- export const UNBOLD: symbol;
3
- export const BLUE: symbol;
4
- export const GREY: symbol;
5
- export const GREEN: symbol;
6
- export const RED: symbol;
7
- export const PURPLE: symbol;
8
- export const ORANGE: symbol;
9
- export const UNCOLOR: symbol;
10
1
  export function print(...args: Array<string | Symbol | Object | number>): void;
11
2
  export function warn(...args: Array<string | Symbol | Object | number>): void;
12
3
  export function printError(err: Error): void;
@@ -60,4 +51,5 @@ export class VConsole {
60
51
  }
61
52
  export function createVConsole(dom: Element): VConsole;
62
53
  export function createModuleLogger(moduleName: string): (...args: any[]) => void;
63
- //# sourceMappingURL=logging.d.ts.map
54
+ export { BOLD, UNBOLD, BLUE, GREY, GREEN, RED, PURPLE, ORANGE, UNCOLOR } from "./logging.common.js";
55
+ //# sourceMappingURL=logging.browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logging.browser.d.ts","sourceRoot":"","sources":["../logging.browser.js"],"names":[],"mappings":"AA6FO,+BAFI,MAAM,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAM5C;AAMM,8BAFI,MAAM,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAM5C;AAOM,gCAHI,KAAK,QAMf;AAQM,8BAJI,MAAM,UACN,MAAM,QAYhB;AAQM,uCAJI,MAAM,UACN,MAAM,QAIoC;AAK9C,+BAFI,MAAM,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAM5C;AAKM,wCAFI,MAAM,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAM5C;AAEM,iCAIN;AAMM,2CAHe,IAAI,QAI4B;AAO/C,oCAJI,iBAAiB,UACjB,MAAM,QAIqB;AAEtC,iCAAqC;AAqDrC;IACE;;OAEG;IACH,iBAFW,OAAO,EAUjB;IAPC,aAAc;IACd;;OAEG;IACH,YAFU,OAAO,CAES;IAC1B,cAAc;IAIhB;;;OAGG;IACH,YAHW,MAAM,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,cAClC,OAAO,QAoCjB;IAED;;OAEG;IACH,qBAFW,MAAM,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAI5C;IAED,iBAQC;IAED;;OAEG;IACH,YAFW,MAAM,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,QAa5C;IAED;;OAEG;IACH,gBAFW,KAAK,QAIf;IAED;;;OAGG;IACH,cAHW,MAAM,UACN,MAAM,QAWhB;IAED;;OAEG;IACH,eAFW,IAAI,QAMd;IAED,gBAIC;CACF;AAOM,oCAHI,OAAO,YAGsC;AAMjD,+CAHI,MAAM,aACO,GAAG,OAAE,IAAI,CAE6D"}
@@ -0,0 +1,99 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var symbol = require('./symbol-c5caa724.cjs');
6
+ var time = require('./time-bc2081b9.cjs');
7
+ var environment = require('./environment-7991e0f6.cjs');
8
+ var _function = require('./function-35e8ddea.cjs');
9
+ require('./metric.cjs');
10
+ require('./math-08e068f9.cjs');
11
+ require('./map-9a5915e4.cjs');
12
+ require('./string-b1bee84b.cjs');
13
+ require('./conditions-f5c0c102.cjs');
14
+ require('./storage.cjs');
15
+ require('./array-a1682de6.cjs');
16
+ require('./set-0f209abb.cjs');
17
+ require('./object-aad630ed.cjs');
18
+
19
+ const BOLD = symbol.create();
20
+ const UNBOLD = symbol.create();
21
+ const BLUE = symbol.create();
22
+ const GREY = symbol.create();
23
+ const GREEN = symbol.create();
24
+ const RED = symbol.create();
25
+ const PURPLE = symbol.create();
26
+ const ORANGE = symbol.create();
27
+ const UNCOLOR = symbol.create();
28
+
29
+ /* c8 ignore start */
30
+ /**
31
+ * @param {Array<string|Symbol|Object|number>} args
32
+ * @return {Array<string|object|number>}
33
+ */
34
+ const computeNoColorLoggingArgs = args => {
35
+ const logArgs = [];
36
+ // try with formatting until we find something unsupported
37
+ let i = 0;
38
+ for (; i < args.length; i++) {
39
+ const arg = args[i];
40
+ if (arg.constructor === String || arg.constructor === Number) ; else if (arg.constructor === Object) {
41
+ logArgs.push(JSON.stringify(arg));
42
+ }
43
+ }
44
+ return logArgs
45
+ };
46
+ /* c8 ignore stop */
47
+
48
+ const loggingColors = [GREEN, PURPLE, ORANGE, BLUE];
49
+ let nextColor = 0;
50
+ let lastLoggingTime = time.getUnixTime();
51
+
52
+ /* c8 ignore start */
53
+ /**
54
+ * @param {function(...any):void} _print
55
+ * @param {string} moduleName
56
+ * @return {function(...any):void}
57
+ */
58
+ const createModuleLogger = (_print, moduleName) => {
59
+ const color = loggingColors[nextColor];
60
+ const debugRegexVar = environment.getVariable('log');
61
+ const doLogging = debugRegexVar !== null &&
62
+ (debugRegexVar === '*' || debugRegexVar === 'true' ||
63
+ new RegExp(debugRegexVar, 'gi').test(moduleName));
64
+ nextColor = (nextColor + 1) % loggingColors.length;
65
+ moduleName += ': ';
66
+ return !doLogging
67
+ ? _function.nop
68
+ : (...args) => {
69
+ const timeNow = time.getUnixTime();
70
+ const timeDiff = timeNow - lastLoggingTime;
71
+ lastLoggingTime = timeNow;
72
+ _print(
73
+ color,
74
+ moduleName,
75
+ UNCOLOR,
76
+ ...args.map((arg) =>
77
+ (typeof arg === 'string' || typeof arg === 'symbol')
78
+ ? arg
79
+ : JSON.stringify(arg)
80
+ ),
81
+ color,
82
+ ' +' + timeDiff + 'ms'
83
+ );
84
+ }
85
+ };
86
+ /* c8 ignore stop */
87
+
88
+ exports.BLUE = BLUE;
89
+ exports.BOLD = BOLD;
90
+ exports.GREEN = GREEN;
91
+ exports.GREY = GREY;
92
+ exports.ORANGE = ORANGE;
93
+ exports.PURPLE = PURPLE;
94
+ exports.RED = RED;
95
+ exports.UNBOLD = UNBOLD;
96
+ exports.UNCOLOR = UNCOLOR;
97
+ exports.computeNoColorLoggingArgs = computeNoColorLoggingArgs;
98
+ exports.createModuleLogger = createModuleLogger;
99
+ //# sourceMappingURL=logging.common.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logging.common.cjs","sources":["../logging.common.js"],"sourcesContent":["import * as symbol from './symbol.js'\nimport * as time from './time.js'\nimport * as env from './environment.js'\nimport * as func from './function.js'\n\nexport const BOLD = symbol.create()\nexport const UNBOLD = symbol.create()\nexport const BLUE = symbol.create()\nexport const GREY = symbol.create()\nexport const GREEN = symbol.create()\nexport const RED = symbol.create()\nexport const PURPLE = symbol.create()\nexport const ORANGE = symbol.create()\nexport const UNCOLOR = symbol.create()\n\n/* c8 ignore start */\n/**\n * @param {Array<string|Symbol|Object|number>} args\n * @return {Array<string|object|number>}\n */\nexport const computeNoColorLoggingArgs = args => {\n const strBuilder = []\n const logArgs = []\n // try with formatting until we find something unsupported\n let i = 0\n for (; i < args.length; i++) {\n const arg = args[i]\n if (arg.constructor === String || arg.constructor === Number) {\n strBuilder.push(arg)\n } else if (arg.constructor === Object) {\n logArgs.push(JSON.stringify(arg))\n }\n }\n return logArgs\n}\n/* c8 ignore stop */\n\nconst loggingColors = [GREEN, PURPLE, ORANGE, BLUE]\nlet nextColor = 0\nlet lastLoggingTime = time.getUnixTime()\n\n/* c8 ignore start */\n/**\n * @param {function(...any):void} _print\n * @param {string} moduleName\n * @return {function(...any):void}\n */\nexport const createModuleLogger = (_print, moduleName) => {\n const color = loggingColors[nextColor]\n const debugRegexVar = env.getVariable('log')\n const doLogging = debugRegexVar !== null &&\n (debugRegexVar === '*' || debugRegexVar === 'true' ||\n new RegExp(debugRegexVar, 'gi').test(moduleName))\n nextColor = (nextColor + 1) % loggingColors.length\n moduleName += ': '\n return !doLogging\n ? func.nop\n : (...args) => {\n const timeNow = time.getUnixTime()\n const timeDiff = timeNow - lastLoggingTime\n lastLoggingTime = timeNow\n _print(\n color,\n moduleName,\n UNCOLOR,\n ...args.map((arg) =>\n (typeof arg === 'string' || typeof arg === 'symbol')\n ? arg\n : JSON.stringify(arg)\n ),\n color,\n ' +' + timeDiff + 'ms'\n )\n }\n}\n/* c8 ignore stop */\n"],"names":["symbol.create","time.getUnixTime","env.getVariable","func.nop"],"mappings":";;;;;;;;;;;;;;;;;;AAKY,MAAC,IAAI,GAAGA,aAAa,GAAE;AACvB,MAAC,MAAM,GAAGA,aAAa,GAAE;AACzB,MAAC,IAAI,GAAGA,aAAa,GAAE;AACvB,MAAC,IAAI,GAAGA,aAAa,GAAE;AACvB,MAAC,KAAK,GAAGA,aAAa,GAAE;AACxB,MAAC,GAAG,GAAGA,aAAa,GAAE;AACtB,MAAC,MAAM,GAAGA,aAAa,GAAE;AACzB,MAAC,MAAM,GAAGA,aAAa,GAAE;AACzB,MAAC,OAAO,GAAGA,aAAa,GAAE;AACtC;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,yBAAyB,GAAG,IAAI,IAAI;AAEjD,EAAE,MAAM,OAAO,GAAG,GAAE;AACpB;AACA,EAAE,IAAI,CAAC,GAAG,EAAC;AACX,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC/B,IAAI,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,EAAC;AACvB,IAAI,IAAI,GAAG,CAAC,WAAW,KAAK,MAAM,IAAI,GAAG,CAAC,WAAW,KAAK,MAAM,EAAE,CAE7D,MAAM,IAAI,GAAG,CAAC,WAAW,KAAK,MAAM,EAAE;AAC3C,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAC;AACvC,KAAK;AACL,GAAG;AACH,EAAE,OAAO,OAAO;AAChB,EAAC;AACD;AACA;AACA,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAC;AACnD,IAAI,SAAS,GAAG,EAAC;AACjB,IAAI,eAAe,GAAGC,gBAAgB,GAAE;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,kBAAkB,GAAG,CAAC,MAAM,EAAE,UAAU,KAAK;AAC1D,EAAE,MAAM,KAAK,GAAG,aAAa,CAAC,SAAS,EAAC;AACxC,EAAE,MAAM,aAAa,GAAGC,uBAAe,CAAC,KAAK,EAAC;AAC9C,EAAE,MAAM,SAAS,GAAG,aAAa,KAAK,IAAI;AAC1C,KAAK,aAAa,KAAK,GAAG,IAAI,aAAa,KAAK,MAAM;AACtD,MAAM,IAAI,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,EAAC;AACvD,EAAE,SAAS,GAAG,CAAC,SAAS,GAAG,CAAC,IAAI,aAAa,CAAC,OAAM;AACpD,EAAE,UAAU,IAAI,KAAI;AACpB,EAAE,OAAO,CAAC,SAAS;AACnB,MAAMC,aAAQ;AACd,MAAM,CAAC,GAAG,IAAI,KAAK;AACnB,MAAM,MAAM,OAAO,GAAGF,gBAAgB,GAAE;AACxC,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,gBAAe;AAChD,MAAM,eAAe,GAAG,QAAO;AAC/B,MAAM,MAAM;AACZ,QAAQ,KAAK;AACb,QAAQ,UAAU;AAClB,QAAQ,OAAO;AACf,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG;AACxB,UAAU,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,QAAQ;AAC7D,cAAc,GAAG;AACjB,cAAc,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC;AACjC,SAAS;AACT,QAAQ,KAAK;AACb,QAAQ,IAAI,GAAG,QAAQ,GAAG,IAAI;AAC9B,QAAO;AACP,KAAK;AACL,EAAC;AACD;;;;;;;;;;;;;;"}
@@ -0,0 +1,12 @@
1
+ export const BOLD: symbol;
2
+ export const UNBOLD: symbol;
3
+ export const BLUE: symbol;
4
+ export const GREY: symbol;
5
+ export const GREEN: symbol;
6
+ export const RED: symbol;
7
+ export const PURPLE: symbol;
8
+ export const ORANGE: symbol;
9
+ export const UNCOLOR: symbol;
10
+ export function computeNoColorLoggingArgs(args: Array<string | Symbol | Object | number>): Array<string | object | number>;
11
+ export function createModuleLogger(_print: (...args: any[]) => void, moduleName: string): (...args: any[]) => void;
12
+ //# sourceMappingURL=logging.common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logging.common.d.ts","sourceRoot":"","sources":["../logging.common.js"],"names":[],"mappings":"AAKA,0BAAmC;AACnC,4BAAqC;AACrC,0BAAmC;AACnC,0BAAmC;AACnC,2BAAoC;AACpC,yBAAkC;AAClC,4BAAqC;AACrC,4BAAqC;AACrC,6BAAsC;AAO/B,gDAHI,MAAM,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,GACjC,MAAM,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC,CAgBtC;AAaM,qDAJgB,GAAG,OAAE,IAAI,cACrB,MAAM,aACO,GAAG,OAAE,IAAI,CA6BhC"}