@reliverse/relinka 1.1.7 → 1.1.9

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 (121) hide show
  1. package/dist-npm/components/anykey/index.js +57 -77
  2. package/dist-npm/components/block/block.js +48 -61
  3. package/dist-npm/components/checkbox/index.js +178 -211
  4. package/dist-npm/components/confirm/confirm-main.js +85 -122
  5. package/dist-npm/components/confirm/confirm-three.js +24 -27
  6. package/dist-npm/components/confirm/index.js +36 -45
  7. package/dist-npm/components/core/Separator.js +15 -17
  8. package/dist-npm/components/core/create-prompt.js +101 -124
  9. package/dist-npm/components/core/errors.js +19 -15
  10. package/dist-npm/components/core/hook-engine.js +91 -120
  11. package/dist-npm/components/core/index.js +12 -12
  12. package/dist-npm/components/core/key.js +16 -6
  13. package/dist-npm/components/core/lines.js +45 -54
  14. package/dist-npm/components/core/make-theme.js +21 -30
  15. package/dist-npm/components/core/position.js +27 -23
  16. package/dist-npm/components/core/promise-polyfill.js +11 -14
  17. package/dist-npm/components/core/screen-manager.js +59 -74
  18. package/dist-npm/components/core/theme.js +22 -32
  19. package/dist-npm/components/core/use-effect.js +9 -15
  20. package/dist-npm/components/core/use-keypress.js +19 -23
  21. package/dist-npm/components/core/use-memo.js +10 -16
  22. package/dist-npm/components/core/use-pagination.js +33 -32
  23. package/dist-npm/components/core/use-prefix.js +40 -38
  24. package/dist-npm/components/core/use-ref.js +2 -5
  25. package/dist-npm/components/core/use-state.js +15 -23
  26. package/dist-npm/components/core/useKeyPress.js +14 -17
  27. package/dist-npm/components/core/usePromptState.js +8 -14
  28. package/dist-npm/components/core/utils.js +7 -16
  29. package/dist-npm/components/date/date.js +187 -204
  30. package/dist-npm/components/editor/index.js +71 -92
  31. package/dist-npm/components/expand/index.js +96 -124
  32. package/dist-npm/components/figures/index.js +283 -294
  33. package/dist-npm/components/input/index.js +61 -87
  34. package/dist-npm/components/input/text-main.js +97 -124
  35. package/dist-npm/components/input/text.js +24 -28
  36. package/dist-npm/components/instance/basic.js +17 -25
  37. package/dist-npm/components/instance/browser.js +14 -18
  38. package/dist-npm/components/instance/reporter/basic.js +46 -65
  39. package/dist-npm/components/instance/reporter/browser.js +44 -47
  40. package/dist-npm/components/instance/reporter/fancy.js +83 -96
  41. package/dist-npm/components/instance/shared.js +2 -2
  42. package/dist-npm/components/mono/mono.js +52 -62
  43. package/dist-npm/components/mono/monoTwo.js +35 -49
  44. package/dist-npm/components/multiselect/group-multiselect.js +55 -71
  45. package/dist-npm/components/multiselect/multi-select-two.js +97 -130
  46. package/dist-npm/components/multiselect/multi-select.js +43 -49
  47. package/dist-npm/components/multiselect/multiselect-main.d.ts +1 -0
  48. package/dist-npm/components/multiselect/multiselect-main.js +158 -145
  49. package/dist-npm/components/multiselect/num-multi-select.js +97 -130
  50. package/dist-npm/components/multiselect/num-multiselect-main.js +24 -35
  51. package/dist-npm/components/next-steps/next-steps.js +23 -25
  52. package/dist-npm/components/number/index.js +78 -112
  53. package/dist-npm/components/number/number-main.js +95 -2
  54. package/dist-npm/components/password/index.js +54 -73
  55. package/dist-npm/components/password/password-main.js +119 -2
  56. package/dist-npm/components/password/password-three.js +26 -30
  57. package/dist-npm/components/progressbar/ProgressBar.js +45 -64
  58. package/dist-npm/components/progressbar/helper.js +33 -40
  59. package/dist-npm/components/progressbar/index.js +1 -1
  60. package/dist-npm/components/prompts/create.js +29 -44
  61. package/dist-npm/components/prompts/index.d.ts +1 -0
  62. package/dist-npm/components/prompts/index.js +46 -45
  63. package/dist-npm/components/prompts/prompt.js +211 -260
  64. package/dist-npm/components/prompts/promptTwo.js +561 -605
  65. package/dist-npm/components/prompts/relinka.js +237 -295
  66. package/dist-npm/components/range/range.js +247 -294
  67. package/dist-npm/components/rawlist/index.js +87 -107
  68. package/dist-npm/components/results/results.js +31 -37
  69. package/dist-npm/components/search/index.js +148 -193
  70. package/dist-npm/components/select/index.js +148 -186
  71. package/dist-npm/components/select/num-select-main.js +27 -27
  72. package/dist-npm/components/select/num-select.js +124 -5
  73. package/dist-npm/components/select/select-key.js +24 -25
  74. package/dist-npm/components/select/select-main.d.ts +1 -0
  75. package/dist-npm/components/select/select-main.js +143 -133
  76. package/dist-npm/components/select/select-three.js +32 -36
  77. package/dist-npm/components/select/select-two.js +94 -87
  78. package/dist-npm/components/spinner/index.js +107 -136
  79. package/dist-npm/components/st-end/end.js +34 -26
  80. package/dist-npm/components/st-end/start.js +29 -15
  81. package/dist-npm/components/toggle/index.js +113 -137
  82. package/dist-npm/components/visual/animate/animate.js +53 -10
  83. package/dist-npm/components/visual/ascii-art/ascii-art.js +12 -1
  84. package/dist-npm/main.js +1 -0
  85. package/dist-npm/testing/index.js +58 -83
  86. package/dist-npm/types/general.d.ts +1 -1
  87. package/dist-npm/types/general.js +0 -1
  88. package/dist-npm/types/index.js +2 -3
  89. package/dist-npm/types/keypress.js +35 -36
  90. package/dist-npm/types/readline.js +0 -1
  91. package/dist-npm/types/relinka.js +0 -1
  92. package/dist-npm/types/utils.js +0 -1
  93. package/dist-npm/utils/box.js +135 -137
  94. package/dist-npm/utils/color.js +65 -74
  95. package/dist-npm/utils/colorize.js +124 -156
  96. package/dist-npm/utils/component.js +532 -657
  97. package/dist-npm/utils/constants.js +64 -63
  98. package/dist-npm/utils/core.js +2 -3
  99. package/dist-npm/utils/decoder.js +244 -223
  100. package/dist-npm/utils/error.js +4 -9
  101. package/dist-npm/utils/errors.js +14 -4
  102. package/dist-npm/utils/format.js +19 -24
  103. package/dist-npm/utils/keypress.js +316 -414
  104. package/dist-npm/utils/log.js +11 -15
  105. package/dist-npm/utils/mapping.js +45 -52
  106. package/dist-npm/utils/messages.js +196 -183
  107. package/dist-npm/utils/platforms.js +16 -20
  108. package/dist-npm/utils/prompt-tmp.js +235 -286
  109. package/dist-npm/utils/prompt-two.js +235 -286
  110. package/dist-npm/utils/readline.js +5 -7
  111. package/dist-npm/utils/skeleton.js +130 -170
  112. package/dist-npm/utils/stream.js +2 -2
  113. package/dist-npm/utils/string.js +44 -58
  114. package/dist-npm/utils/terminal.js +23 -34
  115. package/dist-npm/utils/tree.js +30 -41
  116. package/dist-npm/utils/types.js +0 -1
  117. package/dist-npm/utils/utils.js +8 -8
  118. package/dist-npm/utils/variants.js +36 -44
  119. package/package.json +14 -14
  120. package/dist-npm/mod.js +0 -2
  121. /package/dist-npm/{mod.d.ts → main.d.ts} +0 -0
@@ -1,338 +1,280 @@
1
- import {defu} from 'defu';
2
- import {LogTypes} from '../../utils/constants.js';
3
- import {isLogObj} from '../../utils/log.js';
4
-
5
- const {isArray} = Array;
6
- const isNumber = (a) => typeof a === 'number';
7
- const isString = (a) => typeof a === 'string';
8
- const isFn = (a) => typeof a === 'function';
9
- const maybeArray = (a) => isArray(a) ? a : [a];
1
+ import { defu } from "defu";
2
+ import { LogTypes } from "../../utils/constants.js";
3
+ import { isLogObj } from "../../utils/log.js";
10
4
  let paused = false;
11
5
  const queue = [];
12
-
13
6
  export class Relinka {
14
- options;
15
- _lastLog;
16
- _mockFn;
7
+ options;
8
+ _lastLog;
9
+ _mockFn;
17
10
  constructor(options = {}) {
18
- const types = options.types || LogTypes;
19
-
20
- this.options = defu({
21
- ...options,
22
- defaults: {...options.defaults},
23
- level: _normalizeLogLevel(options.level, types),
24
- reporters: options.reporters || [].slice(),
25
- }, {
26
- types: LogTypes,
27
- throttle: 1e3,
28
- throttleMin: 5,
29
- formatOptions: {
30
- date: true,
31
- colors: false,
32
- compact: true,
33
- },
34
- });
35
- for (const type in types) {
36
- const defaults = {
37
- type,
38
- ...this.options.defaults,
39
- ...types[type],
40
- };
41
-
42
- this[type] = this._wrapLogFn(defaults);
43
- this[type].raw = this._wrapLogFn(defaults, true);
11
+ const types = options.types || LogTypes;
12
+ this.options = defu(
13
+ {
14
+ ...options,
15
+ defaults: { ...options.defaults },
16
+ level: _normalizeLogLevel(options.level, types),
17
+ reporters: [...options.reporters || []]
18
+ },
19
+ {
20
+ types: LogTypes,
21
+ throttle: 1e3,
22
+ throttleMin: 5,
23
+ formatOptions: {
24
+ date: true,
25
+ colors: false,
26
+ compact: true
44
27
  }
45
- if (this.options.mockFn) {
46
- this.mockTypes();
47
- }
48
-
49
- this._lastLog = {};
28
+ }
29
+ );
30
+ for (const type in types) {
31
+ const defaults = {
32
+ type,
33
+ ...this.options.defaults,
34
+ ...types[type]
35
+ };
36
+ this[type] = this._wrapLogFn(defaults);
37
+ this[type].raw = this._wrapLogFn(
38
+ defaults,
39
+ true
40
+ );
50
41
  }
51
-
52
- get level() {
53
- return this.options.level;
42
+ if (this.options.mockFn) {
43
+ this.mockTypes();
54
44
  }
55
-
45
+ this._lastLog = {};
46
+ }
47
+ get level() {
48
+ return this.options.level;
49
+ }
56
50
  set level(level) {
57
- this.options.level = _normalizeLogLevel(level, this.options.types, this.options.level);
58
- }
59
-
51
+ this.options.level = _normalizeLogLevel(
52
+ level,
53
+ this.options.types,
54
+ this.options.level
55
+ );
56
+ }
60
57
  prompt(message, opts) {
61
- if (!this.options.prompt) {
62
- throw Error('prompt is not supported!');
63
- }
64
-
65
- return this.options.prompt(message, opts);
58
+ if (!this.options.prompt) {
59
+ throw new Error("prompt is not supported!");
66
60
  }
67
-
61
+ return this.options.prompt(message, opts);
62
+ }
68
63
  create(options) {
69
- const instance = new Relinka({
70
- ...this.options,
71
- ...options,
72
- });
73
-
74
- if (this._mockFn) {
75
- instance.mockTypes(this._mockFn);
76
- }
77
-
78
- return instance;
64
+ const instance = new Relinka({
65
+ ...this.options,
66
+ ...options
67
+ });
68
+ if (this._mockFn) {
69
+ instance.mockTypes(this._mockFn);
79
70
  }
80
-
71
+ return instance;
72
+ }
81
73
  withDefaults(defaults) {
82
- return this.create({
83
- ...this.options,
84
- defaults: {
85
- ...this.options.defaults,
86
- ...defaults,
87
- },
88
- });
89
- }
90
-
74
+ return this.create({
75
+ ...this.options,
76
+ defaults: {
77
+ ...this.options.defaults,
78
+ ...defaults
79
+ }
80
+ });
81
+ }
91
82
  withTag(tag) {
92
- return this.withDefaults({
93
- tag: this.options.defaults.tag ? this.options.defaults.tag + ':' + tag : tag,
94
- });
95
- }
96
-
83
+ return this.withDefaults({
84
+ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
85
+ });
86
+ }
97
87
  addReporter(reporter) {
98
- this.options.reporters.push(reporter);
99
- return this;
100
- }
101
-
88
+ this.options.reporters.push(reporter);
89
+ return this;
90
+ }
102
91
  removeReporter(reporter) {
103
- if (reporter) {
104
- const i = this.options.reporters.indexOf(reporter);
105
-
106
- if (i >= 0) {
107
- return this.options.reporters.splice(i, 1);
108
- }
109
- } else {
110
- this.options.reporters.splice(0);
111
- }
112
-
113
- return this;
92
+ if (reporter) {
93
+ const i = this.options.reporters.indexOf(reporter);
94
+ if (i >= 0) {
95
+ return this.options.reporters.splice(i, 1);
96
+ }
97
+ } else {
98
+ this.options.reporters.splice(0);
114
99
  }
115
-
100
+ return this;
101
+ }
116
102
  setReporters(reporters) {
117
- this.options.reporters = maybeArray(reporters);
118
- return this;
119
- }
120
-
121
- wrapAll() {
122
- this.wrapConsole();
123
- this.wrapStd();
124
- }
125
-
126
- restoreAll() {
127
- this.restoreConsole();
128
- this.restoreStd();
129
- }
130
-
103
+ this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
104
+ return this;
105
+ }
106
+ wrapAll() {
107
+ this.wrapConsole();
108
+ this.wrapStd();
109
+ }
110
+ restoreAll() {
111
+ this.restoreConsole();
112
+ this.restoreStd();
113
+ }
131
114
  wrapConsole() {
132
- for (const type in this.options.types) {
133
- if (!console[`__${type}`]) {
134
- console[`__${type}`] = console[type];
135
- }
136
-
137
- console[type] = this[type].raw;
138
- }
115
+ for (const type in this.options.types) {
116
+ if (!console["__" + type]) {
117
+ console["__" + type] = console[type];
118
+ }
119
+ console[type] = this[type].raw;
139
120
  }
140
-
121
+ }
141
122
  restoreConsole() {
142
- for (const type in this.options.types) {
143
- if (console[`__${type}`]) {
144
- console[type] = console[`__${type}`];
145
- delete console[`__${type}`];
146
- }
147
- }
123
+ for (const type in this.options.types) {
124
+ if (console["__" + type]) {
125
+ console[type] = console["__" + type];
126
+ delete console["__" + type];
127
+ }
148
128
  }
149
-
129
+ }
150
130
  wrapStd() {
151
- this._wrapStream(this.options.stdout, 'log');
152
- this._wrapStream(this.options.stderr, 'log');
131
+ this._wrapStream(this.options.stdout, "log");
132
+ this._wrapStream(this.options.stderr, "log");
133
+ }
134
+ _wrapStream(stream, type) {
135
+ if (!stream) {
136
+ return;
153
137
  }
154
-
155
- _wrapStream(stream, type) {
156
- if (!stream) {
157
- return;
158
- }
159
-
160
- if (!stream.__write) {
161
- stream.__write = stream.write;
162
- }
163
-
164
- stream.write = (data) => {
165
- this[type].raw(String(data).trim());
166
- };
138
+ if (!stream.__write) {
139
+ stream.__write = stream.write;
167
140
  }
168
-
141
+ stream.write = (data) => {
142
+ this[type].raw(String(data).trim());
143
+ };
144
+ }
169
145
  restoreStd() {
170
- this._restoreStream(this.options.stdout);
171
- this._restoreStream(this.options.stderr);
146
+ this._restoreStream(this.options.stdout);
147
+ this._restoreStream(this.options.stderr);
148
+ }
149
+ _restoreStream(stream) {
150
+ if (!stream) {
151
+ return;
172
152
  }
173
-
174
- _restoreStream(stream) {
175
- if (!stream) {
176
- return;
177
- }
178
-
179
- if (stream.__write) {
180
- stream.write = stream.__write;
181
- delete stream.__write;
182
- }
153
+ if (stream.__write) {
154
+ stream.write = stream.__write;
155
+ delete stream.__write;
183
156
  }
184
-
157
+ }
185
158
  pauseLogs() {
186
- paused = true;
187
- }
188
-
159
+ paused = true;
160
+ }
189
161
  resumeLogs() {
190
- paused = false;
191
- const _queue = queue.splice(0);
192
-
193
- for (const item of _queue) {
194
- item[0]._logFn(item[1], item[2]);
195
- }
162
+ paused = false;
163
+ const _queue = queue.splice(0);
164
+ for (const item of _queue) {
165
+ item[0]._logFn(item[1], item[2]);
196
166
  }
197
-
167
+ }
198
168
  mockTypes(mockFn) {
199
- const _mockFn = mockFn || this.options.mockFn;
200
-
201
- this._mockFn = _mockFn;
202
- if (!isFn(_mockFn)) {
203
- return;
204
- }
205
-
206
- for (const type in this.options.types) {
207
- this[type] = _mockFn(type, this.options.types[type]) || this[type];
208
- this[type].raw = this[type];
209
- }
169
+ const _mockFn = mockFn || this.options.mockFn;
170
+ this._mockFn = _mockFn;
171
+ if (typeof _mockFn !== "function") {
172
+ return;
210
173
  }
211
-
212
- _wrapLogFn(defaults, isRaw) {
213
- return (...args) => {
214
- if (paused) {
215
- queue.push([
216
- this,
217
- defaults,
218
- args,
219
- isRaw,
220
- ]);
221
- return;
222
- }
223
-
224
- return this._logFn(defaults, args, isRaw);
225
- };
174
+ for (const type in this.options.types) {
175
+ this[type] = _mockFn(type, this.options.types[type]) || this[type];
176
+ this[type].raw = this[type];
226
177
  }
227
-
228
- _logFn(defaults, args, isRaw) {
229
- if (this.level < (defaults.level || 0)) {
230
- return false;
231
- }
232
-
233
- const logObj = {
234
- date: new Date(),
235
- args: [],
236
- ...defaults,
237
- level: _normalizeLogLevel(defaults.level, this.options.types),
238
- };
239
-
240
- if (!isRaw && args.length === 1 && isLogObj(args[0])) {
241
- Object.assign(logObj, args[0]);
242
- } else {
243
- logObj.args = args.slice();
244
- }
245
-
246
- if (logObj.message) {
247
- logObj.args.unshift(logObj.message);
248
- delete logObj.message;
249
- }
250
-
251
- if (logObj.additional) {
252
- if (!Array.isArray(logObj.additional)) {
253
- logObj.additional = logObj.additional.split('\n');
254
- }
255
-
256
- logObj.args.push('\n' + logObj.additional.join('\n'));
257
- delete logObj.additional;
258
- }
259
-
260
- logObj.type = isString(logObj.type) ? logObj.type.toLowerCase() : 'log';
261
- if (!isString(logObj.tag))
262
- logObj.tag = '';
263
-
264
- const resolveLog = (newLog = false) => {
265
- const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
266
-
267
- if (this._lastLog.object && repeated > 0) {
268
- const args2 = this._lastLog.object.args.slice();
269
-
270
- if (repeated > 1) {
271
- args2.push(`(repeated ${repeated} times)`);
272
- }
273
-
274
- this._log({ ...this._lastLog.object,
275
- args: args2});
276
- this._lastLog.count = 1;
277
- }
278
-
279
- if (newLog) {
280
- this._lastLog.object = logObj;
281
- this._log(logObj);
282
- }
283
- };
284
-
285
- clearTimeout(this._lastLog.timeout);
286
- const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
287
-
288
- this._lastLog.time = logObj.date;
289
- if (diffTime < this.options.throttle) {
290
- try {
291
- const serializedLog = JSON.stringify([
292
- logObj.type,
293
- logObj.tag,
294
- logObj.args,
295
- ]);
296
-
297
- const isSameLog = this._lastLog.serialized === serializedLog;
298
-
299
- this._lastLog.serialized = serializedLog;
300
- if (isSameLog) {
301
- this._lastLog.count = (this._lastLog.count || 0) + 1;
302
- if (this._lastLog.count > this.options.throttleMin) {
303
- this._lastLog.timeout = setTimeout(resolveLog, this.options.throttle);
304
- return;
305
- }
306
- }
307
- } catch {}
308
- }
309
-
310
- resolveLog(true);
178
+ }
179
+ _wrapLogFn(defaults, isRaw) {
180
+ return (...args) => {
181
+ if (paused) {
182
+ queue.push([this, defaults, args, isRaw]);
183
+ return;
184
+ }
185
+ return this._logFn(defaults, args, isRaw);
186
+ };
187
+ }
188
+ _logFn(defaults, args, isRaw) {
189
+ if ((defaults.level || 0) > this.level) {
190
+ return false;
311
191
  }
312
-
313
- _log(logObj) {
314
- for (const reporter of this.options.reporters) {
315
- reporter.log(logObj, {
316
- options: this.options,
317
- });
318
- }
192
+ const logObj = {
193
+ date: new Date(),
194
+ args: [],
195
+ ...defaults,
196
+ level: _normalizeLogLevel(defaults.level, this.options.types)
197
+ };
198
+ if (!isRaw && args.length === 1 && isLogObj(args[0])) {
199
+ Object.assign(logObj, args[0]);
200
+ } else {
201
+ logObj.args = [...args];
319
202
  }
320
- }function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
321
- if (input === void 0) {
322
- return defaultLevel;
203
+ if (logObj.message) {
204
+ logObj.args.unshift(logObj.message);
205
+ delete logObj.message;
323
206
  }
324
-
325
- if (isNumber(input)) {
326
- return input;
207
+ if (logObj.additional) {
208
+ if (!Array.isArray(logObj.additional)) {
209
+ logObj.additional = logObj.additional.split("\n");
210
+ }
211
+ logObj.args.push("\n" + logObj.additional.join("\n"));
212
+ delete logObj.additional;
327
213
  }
328
-
329
- if (types[input] && types[input].level !== void 0) {
330
- return types[input].level;
214
+ logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
215
+ logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
216
+ const resolveLog = (newLog = false) => {
217
+ const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
218
+ if (this._lastLog.object && repeated > 0) {
219
+ const args2 = [...this._lastLog.object.args];
220
+ if (repeated > 1) {
221
+ args2.push(`(repeated ${repeated} times)`);
222
+ }
223
+ this._log({ ...this._lastLog.object, args: args2 });
224
+ this._lastLog.count = 1;
225
+ }
226
+ if (newLog) {
227
+ this._lastLog.object = logObj;
228
+ this._log(logObj);
229
+ }
230
+ };
231
+ clearTimeout(this._lastLog.timeout);
232
+ const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
233
+ this._lastLog.time = logObj.date;
234
+ if (diffTime < this.options.throttle) {
235
+ try {
236
+ const serializedLog = JSON.stringify([
237
+ logObj.type,
238
+ logObj.tag,
239
+ logObj.args
240
+ ]);
241
+ const isSameLog = this._lastLog.serialized === serializedLog;
242
+ this._lastLog.serialized = serializedLog;
243
+ if (isSameLog) {
244
+ this._lastLog.count = (this._lastLog.count || 0) + 1;
245
+ if (this._lastLog.count > this.options.throttleMin) {
246
+ this._lastLog.timeout = setTimeout(
247
+ resolveLog,
248
+ this.options.throttle
249
+ );
250
+ return;
251
+ }
252
+ }
253
+ } catch {
254
+ }
331
255
  }
332
-
256
+ resolveLog(true);
257
+ }
258
+ _log(logObj) {
259
+ for (const reporter of this.options.reporters) {
260
+ reporter.log(logObj, {
261
+ options: this.options
262
+ });
263
+ }
264
+ }
265
+ }
266
+ function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
267
+ if (input === void 0) {
333
268
  return defaultLevel;
269
+ }
270
+ if (typeof input === "number") {
271
+ return input;
272
+ }
273
+ if (types[input] && types[input].level !== void 0) {
274
+ return types[input].level;
275
+ }
276
+ return defaultLevel;
334
277
  }
335
-
336
278
  Relinka.prototype.add = Relinka.prototype.addReporter;
337
279
  Relinka.prototype.remove = Relinka.prototype.removeReporter;
338
280
  Relinka.prototype.clear = Relinka.prototype.removeReporter;
@@ -341,5 +283,5 @@ Relinka.prototype.mock = Relinka.prototype.mockTypes;
341
283
  Relinka.prototype.pause = Relinka.prototype.pauseLogs;
342
284
  Relinka.prototype.resume = Relinka.prototype.resumeLogs;
343
285
  export function createRelinka(options = {}) {
344
- return new Relinka(options);
286
+ return new Relinka(options);
345
287
  }