1 | (function(e, a) { for(var i in a) e[i] = a[i]; }(exports, (function(modules) {
|
2 |
|
3 | var installedModules = {};
|
4 |
|
5 |
|
6 | function __webpack_require__(moduleId) {
|
7 |
|
8 |
|
9 | if(installedModules[moduleId]) {
|
10 | return installedModules[moduleId].exports;
|
11 | }
|
12 |
|
13 | var module = installedModules[moduleId] = {
|
14 | i: moduleId,
|
15 | l: false,
|
16 | exports: {}
|
17 | };
|
18 |
|
19 |
|
20 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21 |
|
22 |
|
23 | module.l = true;
|
24 |
|
25 |
|
26 | return module.exports;
|
27 | }
|
28 |
|
29 |
|
30 |
|
31 | __webpack_require__.m = modules;
|
32 |
|
33 |
|
34 | __webpack_require__.c = installedModules;
|
35 |
|
36 |
|
37 | __webpack_require__.d = function(exports, name, getter) {
|
38 | if(!__webpack_require__.o(exports, name)) {
|
39 | Object.defineProperty(exports, name, {
|
40 | configurable: false,
|
41 | enumerable: true,
|
42 | get: getter
|
43 | /******/ });
|
44 | /******/ }
|
45 | /******/ };
|
46 | /******/
|
47 | /******/ // getDefaultExport function for compatibility with non-harmony modules
|
48 | /******/ __webpack_require__.n = function(module) {
|
49 | var getter = module && module.__esModule ?
|
50 | function getDefault() { return module['default']; } :
|
51 | function getModuleExports() { return module; };
|
52 | __webpack_require__.d(getter, 'a', getter);
|
53 | return getter;
|
54 | };
|
55 |
|
56 |
|
57 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
58 |
|
59 |
|
60 | __webpack_require__.p = "";
|
61 |
|
62 |
|
63 | return __webpack_require__(__webpack_require__.s = 5);
|
64 | })
|
65 |
|
66 | ([
|
67 |
|
68 | (function(module, exports, __webpack_require__) {
|
69 |
|
70 | "use strict";
|
71 |
|
72 | Object.defineProperty(exports, "__esModule", { value: true });
|
73 | var Level;
|
74 | (function (Level) {
|
75 | Level[Level["DATA"] = 0] = "DATA";
|
76 | Level[Level["INFO"] = 1] = "INFO";
|
77 | Level[Level["WARN"] = 2] = "WARN";
|
78 | Level[Level["ERROR"] = 3] = "ERROR";
|
79 | Level[Level["__NOTHING"] = 4] = "__NOTHING";
|
80 | })(Level = exports.Level || (exports.Level = {}));
|
81 |
|
82 |
|
83 | }),
|
84 |
|
85 | (function(module, exports, __webpack_require__) {
|
86 |
|
87 | "use strict";
|
88 |
|
89 | Object.defineProperty(exports, "__esModule", { value: true });
|
90 | exports.isBrowser = (typeof window !== 'undefined' && window.document);
|
91 | exports.isNode = !exports.isBrowser;
|
92 |
|
93 |
|
94 | }),
|
95 |
|
96 | (function(module, exports, __webpack_require__) {
|
97 |
|
98 | "use strict";
|
99 |
|
100 | Object.defineProperty(exports, "__esModule", { value: true });
|
101 | const level_1 = __webpack_require__(0);
|
102 | const helper_1 = __webpack_require__(1);
|
103 | const backend_logging_1 = __webpack_require__(8);
|
104 | if (helper_1.isNode) {
|
105 | }
|
106 | class Display {
|
107 | static msg(message, params, moduleName, moduleColor, level, moduleWidth) {
|
108 | let color = 'gray';
|
109 | if (level === level_1.Level.INFO)
|
110 | color = 'deepskyblue';
|
111 | if (level === level_1.Level.ERROR)
|
112 | color = 'red';
|
113 | if (level === level_1.Level.WARN)
|
114 | color = 'orange';
|
115 | if (moduleWidth) {
|
116 | const diff = moduleWidth - moduleName.length;
|
117 | if (diff > 0) {
|
118 | for (let i = 0; i < diff; i++) {
|
119 | moduleName += ' ';
|
120 | }
|
121 | }
|
122 | }
|
123 | if (helper_1.isBrowser) {
|
124 | if (typeof message === 'string') {
|
125 | let a1 = '%c ' + moduleName + ' %c ' + message + ' ';
|
126 | let a2 = 'background: ' + moduleColor + ';color:white; border: 1px solid ' + moduleColor + '; ';
|
127 | let a3 = 'border: 1px solid ' + color + '; ';
|
128 | params.unshift(a3);
|
129 | params.unshift(a2);
|
130 | params.unshift(a1);
|
131 | }
|
132 | else {
|
133 | let a1 = '%c ' + moduleName + ' ';
|
134 | let a2 = 'background: ' + moduleColor + ';color:white; border: 1px solid ' + color + '; ';
|
135 | params.push(message);
|
136 | params.unshift(a2);
|
137 | params.unshift(a1);
|
138 | }
|
139 | console.log.apply(console, params);
|
140 | }
|
141 | if (helper_1.isNode) {
|
142 | let a1 = chalk.bgHex(moduleColor)(chalk.black(moduleName));
|
143 | let p = params;
|
144 | if (typeof message === 'string') {
|
145 | a1 = a1 + chalk.keyword(color)(' [') + chalk.dim(message) + chalk.keyword(color)('] ');
|
146 | }
|
147 | else {
|
148 | p = [message].concat(params);
|
149 | }
|
150 | backend_logging_1.consoleLog(a1, level);
|
151 | backend_logging_1.displayParams(p, level);
|
152 | }
|
153 | }
|
154 | }
|
155 | exports.Display = Display;
|
156 |
|
157 |
|
158 | }),
|
159 |
|
160 | (function(module, exports) {
|
161 |
|
162 |
|
163 | var process = module.exports = {};
|
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 | var cachedSetTimeout;
|
171 | var cachedClearTimeout;
|
172 |
|
173 | function defaultSetTimout() {
|
174 | throw new Error('setTimeout has not been defined');
|
175 | }
|
176 | function defaultClearTimeout () {
|
177 | throw new Error('clearTimeout has not been defined');
|
178 | }
|
179 | (function () {
|
180 | try {
|
181 | if (typeof setTimeout === 'function') {
|
182 | cachedSetTimeout = setTimeout;
|
183 | } else {
|
184 | cachedSetTimeout = defaultSetTimout;
|
185 | }
|
186 | } catch (e) {
|
187 | cachedSetTimeout = defaultSetTimout;
|
188 | }
|
189 | try {
|
190 | if (typeof clearTimeout === 'function') {
|
191 | cachedClearTimeout = clearTimeout;
|
192 | } else {
|
193 | cachedClearTimeout = defaultClearTimeout;
|
194 | }
|
195 | } catch (e) {
|
196 | cachedClearTimeout = defaultClearTimeout;
|
197 | }
|
198 | } ())
|
199 | function runTimeout(fun) {
|
200 | if (cachedSetTimeout === setTimeout) {
|
201 |
|
202 | return setTimeout(fun, 0);
|
203 | }
|
204 |
|
205 | if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
206 | cachedSetTimeout = setTimeout;
|
207 | return setTimeout(fun, 0);
|
208 | }
|
209 | try {
|
210 |
|
211 | return cachedSetTimeout(fun, 0);
|
212 | } catch(e){
|
213 | try {
|
214 |
|
215 | return cachedSetTimeout.call(null, fun, 0);
|
216 | } catch(e){
|
217 |
|
218 | return cachedSetTimeout.call(this, fun, 0);
|
219 | }
|
220 | }
|
221 |
|
222 |
|
223 | }
|
224 | function runClearTimeout(marker) {
|
225 | if (cachedClearTimeout === clearTimeout) {
|
226 |
|
227 | return clearTimeout(marker);
|
228 | }
|
229 |
|
230 | if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
231 | cachedClearTimeout = clearTimeout;
|
232 | return clearTimeout(marker);
|
233 | }
|
234 | try {
|
235 |
|
236 | return cachedClearTimeout(marker);
|
237 | } catch (e){
|
238 | try {
|
239 |
|
240 | return cachedClearTimeout.call(null, marker);
|
241 | } catch (e){
|
242 |
|
243 |
|
244 | return cachedClearTimeout.call(this, marker);
|
245 | }
|
246 | }
|
247 |
|
248 |
|
249 |
|
250 | }
|
251 | var queue = [];
|
252 | var draining = false;
|
253 | var currentQueue;
|
254 | var queueIndex = -1;
|
255 |
|
256 | function cleanUpNextTick() {
|
257 | if (!draining || !currentQueue) {
|
258 | return;
|
259 | }
|
260 | draining = false;
|
261 | if (currentQueue.length) {
|
262 | queue = currentQueue.concat(queue);
|
263 | } else {
|
264 | queueIndex = -1;
|
265 | }
|
266 | if (queue.length) {
|
267 | drainQueue();
|
268 | }
|
269 | }
|
270 |
|
271 | function drainQueue() {
|
272 | if (draining) {
|
273 | return;
|
274 | }
|
275 | var timeout = runTimeout(cleanUpNextTick);
|
276 | draining = true;
|
277 |
|
278 | var len = queue.length;
|
279 | while(len) {
|
280 | currentQueue = queue;
|
281 | queue = [];
|
282 | while (++queueIndex < len) {
|
283 | if (currentQueue) {
|
284 | currentQueue[queueIndex].run();
|
285 | }
|
286 | }
|
287 | queueIndex = -1;
|
288 | len = queue.length;
|
289 | }
|
290 | currentQueue = null;
|
291 | draining = false;
|
292 | runClearTimeout(timeout);
|
293 | }
|
294 |
|
295 | process.nextTick = function (fun) {
|
296 | var args = new Array(arguments.length - 1);
|
297 | if (arguments.length > 1) {
|
298 | for (var i = 1; i < arguments.length; i++) {
|
299 | args[i - 1] = arguments[i];
|
300 | }
|
301 | }
|
302 | queue.push(new Item(fun, args));
|
303 | if (queue.length === 1 && !draining) {
|
304 | runTimeout(drainQueue);
|
305 | }
|
306 | };
|
307 |
|
308 |
|
309 | function Item(fun, array) {
|
310 | this.fun = fun;
|
311 | this.array = array;
|
312 | }
|
313 | Item.prototype.run = function () {
|
314 | this.fun.apply(null, this.array);
|
315 | };
|
316 | process.title = 'browser';
|
317 | process.browser = true;
|
318 | process.env = {};
|
319 | process.argv = [];
|
320 | process.version = '';
|
321 | process.versions = {};
|
322 |
|
323 | function noop() {}
|
324 |
|
325 | process.on = noop;
|
326 | process.addListener = noop;
|
327 | process.once = noop;
|
328 | process.off = noop;
|
329 | process.removeListener = noop;
|
330 | process.removeAllListeners = noop;
|
331 | process.emit = noop;
|
332 | process.prependListener = noop;
|
333 | process.prependOnceListener = noop;
|
334 |
|
335 | process.listeners = function (name) { return [] }
|
336 |
|
337 | process.binding = function (name) {
|
338 | throw new Error('process.binding is not supported');
|
339 | };
|
340 |
|
341 | process.cwd = function () { return '/' };
|
342 | process.chdir = function (dir) {
|
343 | throw new Error('process.chdir is not supported');
|
344 | };
|
345 | process.umask = function() { return 0; };
|
346 |
|
347 |
|
348 | }),
|
349 |
|
350 | (function(module, exports, __webpack_require__) {
|
351 |
|
352 | "use strict";
|
353 |
|
354 | Object.defineProperty(exports, "__esModule", { value: true });
|
355 | function contain(arr, item) {
|
356 | return arr.filter(l => l === item || ((item.match && typeof item.match === 'function') ? item.match(l) : false)).length > 0;
|
357 | }
|
358 | exports.contain = contain;
|
359 | ;
|
360 |
|
361 |
|
362 | }),
|
363 |
|
364 | (function(module, exports, __webpack_require__) {
|
365 |
|
366 | "use strict";
|
367 |
|
368 | function __export(m) {
|
369 | for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
370 | }
|
371 | Object.defineProperty(exports, "__esModule", { value: true });
|
372 | __export(__webpack_require__(6));
|
373 | __export(__webpack_require__(0));
|
374 | __export(__webpack_require__(1));
|
375 |
|
376 |
|
377 | }),
|
378 |
|
379 | (function(module, exports, __webpack_require__) {
|
380 |
|
381 | "use strict";
|
382 |
|
383 | Object.defineProperty(exports, "__esModule", { value: true });
|
384 | const logger_1 = __webpack_require__(7);
|
385 | const level_1 = __webpack_require__(0);
|
386 | const display_1 = __webpack_require__(2);
|
387 | const include_1 = __webpack_require__(4);
|
388 | const helper_1 = __webpack_require__(1);
|
389 | if (helper_1.isNode) {
|
390 | var randomcolor = __webpack_require__(14);
|
391 | }
|
392 | class Log {
|
393 | static create(name, ...level) {
|
394 | let i;
|
395 | if (Log.instances[name] === undefined) {
|
396 | i = new logger_1.Logger(name, Log.getRandomColor(), Log.isDevelopmentMode, level, Log.isMutedModule(name), Log.levels.length > 0 ? Log.fixedWidth : undefined, Log.levels.length > 0 ? Log.display : undefined);
|
397 | Log.instances[name] = i;
|
398 | }
|
399 | else {
|
400 | i = Log.instances[name];
|
401 | }
|
402 | return i;
|
403 | }
|
404 | static getRandomColor() {
|
405 | if (helper_1.isNode) {
|
406 | return randomcolor({ luminosity: 'light', count: 10 });
|
407 | }
|
408 | let letters = '012345'.split('');
|
409 | let color = '#';
|
410 | color += letters[Math.round(Math.random() * 5)];
|
411 | letters = '0123456789ABCDEF'.split('');
|
412 | for (let i = 0; i < 5; i++) {
|
413 | color += letters[Math.round(Math.random() * 15)];
|
414 | }
|
415 | if (color === undefined)
|
416 | return this.getRandomColor();
|
417 | return color;
|
418 | }
|
419 | static display(name, data, incomming, moduleName) {
|
420 | if (!include_1.contain(Log.levels, incomming))
|
421 | return;
|
422 | if (incomming === level_1.Level.DATA) {
|
423 | display_1.Display.msg(name, data, name, Log.instances[moduleName].color, level_1.Level.DATA, Log.instances[moduleName].fixedWidth);
|
424 | }
|
425 | if (incomming === level_1.Level.ERROR) {
|
426 | display_1.Display.msg(name, data, name, Log.instances[moduleName].color, level_1.Level.ERROR, Log.instances[moduleName].fixedWidth);
|
427 | }
|
428 | if (incomming === level_1.Level.INFO) {
|
429 | display_1.Display.msg(name, data, name, Log.instances[moduleName].color, level_1.Level.INFO, Log.instances[moduleName].fixedWidth);
|
430 | }
|
431 | if (incomming === level_1.Level.WARN) {
|
432 | display_1.Display.msg(name, data, name, Log.instances[moduleName].color, level_1.Level.WARN, Log.instances[moduleName].fixedWidth);
|
433 | }
|
434 | }
|
435 | static onlyLevel(...level) {
|
436 | if (Log._logOnly) {
|
437 | console.error('You should use funcion onlyLevel only once');
|
438 | return;
|
439 | }
|
440 | if (Log._logOnly)
|
441 | Log._logOnly = true;
|
442 | if (level.length === 0)
|
443 | return;
|
444 | Log.levels = level;
|
445 | }
|
446 | static onlyModules(...modules) {
|
447 | if (Log._logModules) {
|
448 | console.error('You should use funcion onlyModules only once');
|
449 | return;
|
450 | }
|
451 | if (modules.length === 0)
|
452 | return;
|
453 | Log.modules = modules;
|
454 | Log.muteAllOtherModules();
|
455 | }
|
456 | static isMutedModule(moduleName) {
|
457 | if (Log.modules.length == 0)
|
458 | return false;
|
459 | if (!include_1.contain(Log.modules, moduleName))
|
460 | return true;
|
461 | return false;
|
462 | }
|
463 | static muteAllOtherModules() {
|
464 | for (var moduleName in Log.instances) {
|
465 | if (!include_1.contain(Log.modules, moduleName))
|
466 | Log.instances[moduleName].mute();
|
467 | }
|
468 | }
|
469 | static setProductionMode() {
|
470 | if (Log.modeIsSet) {
|
471 | console.error('Mode is already set');
|
472 | return;
|
473 | }
|
474 | if (console !== undefined && console.clear !== undefined) {
|
475 | setTimeout(() => {
|
476 | console.clear();
|
477 | console.log = () => { };
|
478 | console.error = () => { };
|
479 | console.warn = () => { };
|
480 | console.info = () => { };
|
481 | });
|
482 | }
|
483 | logger_1.Logger.isProductionMode = true;
|
484 | Log.isDevelopmentMode = false;
|
485 | }
|
486 | }
|
487 | Log.instances = {};
|
488 | Log.fixedWidth = 0;
|
489 | Log._logOnly = false;
|
490 | Log.levels = [];
|
491 | Log._logModules = false;
|
492 | Log.modules = [];
|
493 | Log.isDevelopmentMode = true;
|
494 | Log.modeIsSet = false;
|
495 | exports.Log = Log;
|
496 |
|
497 |
|
498 | }),
|
499 |
|
500 | (function(module, exports, __webpack_require__) {
|
501 |
|
502 | "use strict";
|
503 |
|
504 | Object.defineProperty(exports, "__esModule", { value: true });
|
505 | const level_1 = __webpack_require__(0);
|
506 | const display_1 = __webpack_require__(2);
|
507 | const include_1 = __webpack_require__(4);
|
508 | class Logger {
|
509 | constructor(name, color, developmentMode, allowed, isMuted, fixedWidth, display) {
|
510 | this.name = name;
|
511 | this.color = color;
|
512 | this.developmentMode = developmentMode;
|
513 | this.allowed = allowed;
|
514 | this.isMuted = isMuted;
|
515 | this.fixedWidth = fixedWidth;
|
516 | this.display = display;
|
517 | |
518 |
|
519 |
|
520 | this.d = (name, ...data) => this._data(name, data);
|
521 | |
522 |
|
523 |
|
524 | this.er = (name, ...data) => this._error(name, data);
|
525 | |
526 |
|
527 |
|
528 | this.i = (name, ...data) => this._info(name, data);
|
529 | |
530 |
|
531 |
|
532 | this.w = (name, ...data) => this._warn(name, data);
|
533 | |
534 |
|
535 |
|
536 |
|
537 |
|
538 | this.data = (message, ...otherParams) => { return this._data(message, otherParams); };
|
539 | |
540 |
|
541 |
|
542 |
|
543 |
|
544 | this.error = (message, ...otherParams) => this._error(message, otherParams);
|
545 | |
546 |
|
547 |
|
548 |
|
549 |
|
550 | this.info = (message, ...otherParams) => this._info(message, otherParams);
|
551 | |
552 |
|
553 |
|
554 |
|
555 |
|
556 | this.warn = (message, ...otherParams) => this._warn(message, otherParams);
|
557 | }
|
558 | _data(name, ...data) {
|
559 | if (this.allowed.length >= 1 && include_1.contain(this.allowed, level_1.Level.__NOTHING)
|
560 | && !include_1.contain(this.allowed, level_1.Level.DATA))
|
561 | return this;
|
562 | if (Logger.isProductionMode)
|
563 | return this;
|
564 | if (this.display !== undefined)
|
565 | this.display(name, data, level_1.Level.DATA, this.name);
|
566 | else if (this.allowed.length === 0 || include_1.contain(this.allowed, level_1.Level.DATA)) {
|
567 | display_1.Display.msg.apply(undefined, [name, ...data, this.name, this.color, level_1.Level.DATA, this.fixedWidth]);
|
568 | }
|
569 | return this;
|
570 | }
|
571 | _error(name, ...data) {
|
572 | if (this.allowed.length >= 1 && include_1.contain(this.allowed, level_1.Level.__NOTHING)
|
573 | && !include_1.contain(this.allowed, level_1.Level.ERROR))
|
574 | return this;
|
575 | if (Logger.isProductionMode)
|
576 | return this;
|
577 | if (this.display !== undefined)
|
578 | this.display(name, data, level_1.Level.ERROR, this.name);
|
579 | else if (this.allowed.length === 0 || include_1.contain(this.allowed, level_1.Level.ERROR)) {
|
580 | display_1.Display.msg.apply(undefined, [name, ...data, this.name, this.color, level_1.Level.ERROR, this.fixedWidth]);
|
581 | }
|
582 | return this;
|
583 | }
|
584 | _info(name, ...data) {
|
585 | if (this.allowed.length >= 1 && include_1.contain(this.allowed, level_1.Level.__NOTHING)
|
586 | && !include_1.contain(this.allowed, level_1.Level.INFO))
|
587 | return this;
|
588 | if (Logger.isProductionMode)
|
589 | return this;
|
590 | if (this.display !== undefined)
|
591 | this.display(name, data, level_1.Level.INFO, this.name);
|
592 | else if (this.allowed.length === 0 || include_1.contain(this.allowed, level_1.Level.INFO)) {
|
593 | display_1.Display.msg.apply(undefined, [name, ...data, this.name, this.color, level_1.Level.INFO, this.fixedWidth]);
|
594 | }
|
595 | return this;
|
596 | }
|
597 | _warn(name, ...data) {
|
598 | if (this.allowed.length >= 1 && include_1.contain(this.allowed, level_1.Level.__NOTHING)
|
599 | && !include_1.contain(this.allowed, level_1.Level.WARN))
|
600 | return this;
|
601 | if (Logger.isProductionMode)
|
602 | return this;
|
603 | if (this.display !== undefined)
|
604 | this.display(name, data, level_1.Level.WARN, this.name);
|
605 | else if (this.allowed.length === 0 || include_1.contain(this.allowed, level_1.Level.WARN)) {
|
606 | display_1.Display.msg.apply(undefined, [name, ...data, this.name, this.color, level_1.Level.WARN, this.fixedWidth]);
|
607 | }
|
608 | return this;
|
609 | }
|
610 | _logMessage(name, level, ...data) {
|
611 | if (this.isMuted)
|
612 | return this;
|
613 | if (this.allowed.length >= 1 && include_1.contain(this.allowed, level)
|
614 | && !include_1.contain(this.allowed, level))
|
615 | return this;
|
616 | if (Logger.isProductionMode)
|
617 | return this;
|
618 | if (this.display !== undefined)
|
619 | this.display(name, data, level, this.name);
|
620 | else if (this.allowed.length === 0 || include_1.contain(this.allowed, level)) {
|
621 | display_1.Display.msg(name, data, this.name, this.color, level, this.fixedWidth);
|
622 | }
|
623 | return this;
|
624 | }
|
625 | level(l) {
|
626 | this._level = l;
|
627 | return this;
|
628 | }
|
629 | mute() {
|
630 | this.isMuted = true;
|
631 | }
|
632 | }
|
633 | Logger.isProductionMode = false;
|
634 | exports.Logger = Logger;
|
635 |
|
636 |
|
637 | }),
|
638 |
|
639 | (function(module, exports, __webpack_require__) {
|
640 |
|
641 | "use strict";
|
642 | (function(process) {
|
643 | Object.defineProperty(exports, "__esModule", { value: true });
|
644 | const level_1 = __webpack_require__(0);
|
645 | const helper_1 = __webpack_require__(1);
|
646 | if (helper_1.isNode) {
|
647 | var chalk = __webpack_require__(9);
|
648 | var path = __webpack_require__(10);
|
649 | var fs = __webpack_require__(11);
|
650 | var JSON5 = __webpack_require__(12);
|
651 | var stringify = __webpack_require__(13);
|
652 | }
|
653 | function consoleLog(data, level) {
|
654 | if (level === level_1.Level.INFO)
|
655 | console.info(data);
|
656 | else if (level === level_1.Level.ERROR)
|
657 | console.error(data);
|
658 | else if (level === level_1.Level.WARN)
|
659 | console.warn(data);
|
660 | else
|
661 | console.log(data);
|
662 | }
|
663 | exports.consoleLog = consoleLog;
|
664 | function displayParams(params = [], level) {
|
665 | params.forEach(param => {
|
666 | if (typeof param === 'object') {
|
667 | handleObjectData(param, level);
|
668 | }
|
669 | else if (isObjectAfterStringify(param)) {
|
670 | handleObjectData(JSON5.parse(param), level);
|
671 | }
|
672 | else {
|
673 | consoleLog(param, level);
|
674 | }
|
675 | });
|
676 | }
|
677 | exports.displayParams = displayParams;
|
678 | function replace(out, match, char, color) {
|
679 | let m = out.match(match);
|
680 | let outer = out;
|
681 | if (m)
|
682 | m.forEach(p => {
|
683 | const rep = p
|
684 | .slice(1)
|
685 | .replace(char, '');
|
686 | outer = outer.replace(`"${rep}":`, `"${color.call(null, rep)}":`);
|
687 | });
|
688 | return outer;
|
689 | }
|
690 | function handleObjectData(param, level) {
|
691 | if (istartedInVscode()) {
|
692 | consoleLog(param, level);
|
693 | return;
|
694 | }
|
695 | let out = stringify(param, null, 4);
|
696 | out = replace(out, /\".*"\:\ \"/g, /\"\: "/, chalk.green);
|
697 | out = replace(out, /\".*"\:\ \{/g, /\"\: \{/, chalk.yellow);
|
698 | out = replace(out, /\".*"\:\ \[/g, /\"\: \[/, chalk.red);
|
699 | out = replace(out, /\".*"\:\ true/g, /\"\: true/, chalk.blue);
|
700 | out = replace(out, /\".*"\:\ false/g, /\"\: false/, chalk.blue);
|
701 | out = replace(out, /\".*"\:\ (\-|[0-9])/g, /\"\: (\-|[0-9])/, chalk.magenta);
|
702 | out = out.replace(/\"/g, chalk.dim('"'))
|
703 | .replace(/\{/g, chalk.dim('{'))
|
704 | .replace(/\}/g, chalk.dim('}'))
|
705 | .replace(/\}/g, chalk.dim('}'));
|
706 | if (process.stdout.columns && process.stdout.columns > 0) {
|
707 | out = out.split('\n').map(line => {
|
708 | return (line.length < process.stdout.columns ?
|
709 | line :
|
710 | line.slice(0, process.stdout.columns - 6) + chalk.dim('...'));
|
711 | }).join('\n');
|
712 | }
|
713 | consoleLog(out, level);
|
714 | }
|
715 | function istartedInVscode() {
|
716 | let args = process.execArgv;
|
717 | if (args) {
|
718 | return args.some((arg) => /^--debug=?/.test(arg) ||
|
719 | /^--debug-brk=?/.test(arg) ||
|
720 | /^--inspect=?/.test(arg) ||
|
721 | /^--inspect-brk=?/.test(arg));
|
722 | }
|
723 | return false;
|
724 | }
|
725 | exports.istartedInVscode = istartedInVscode;
|
726 | function isObjectAfterStringify(s) {
|
727 | try {
|
728 | const json = JSON5.parse(s);
|
729 | return true;
|
730 | }
|
731 | catch (error) {
|
732 | return false;
|
733 | }
|
734 | }
|
735 |
|
736 | }.call(exports, __webpack_require__(3)))
|
737 |
|
738 | }),
|
739 |
|
740 | (function(module, exports) {
|
741 |
|
742 | module.exports = require("chalk");
|
743 |
|
744 | }),
|
745 |
|
746 | (function(module, exports, __webpack_require__) {
|
747 |
|
748 | (function(process) {
|
749 |
|
750 |
|
751 |
|
752 |
|
753 |
|
754 |
|
755 |
|
756 |
|
757 |
|
758 |
|
759 |
|
760 |
|
761 |
|
762 |
|
763 |
|
764 |
|
765 |
|
766 |
|
767 |
|
768 |
|
769 |
|
770 |
|
771 |
|
772 |
|
773 | function normalizeArray(parts, allowAboveRoot) {
|
774 |
|
775 | var up = 0;
|
776 | for (var i = parts.length - 1; i >= 0; i--) {
|
777 | var last = parts[i];
|
778 | if (last === '.') {
|
779 | parts.splice(i, 1);
|
780 | } else if (last === '..') {
|
781 | parts.splice(i, 1);
|
782 | up++;
|
783 | } else if (up) {
|
784 | parts.splice(i, 1);
|
785 | up--;
|
786 | }
|
787 | }
|
788 |
|
789 |
|
790 | if (allowAboveRoot) {
|
791 | for (; up--; up) {
|
792 | parts.unshift('..');
|
793 | }
|
794 | }
|
795 |
|
796 | return parts;
|
797 | }
|
798 |
|
799 |
|
800 |
|
801 | var splitPathRe =
|
802 | /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
|
803 | var splitPath = function(filename) {
|
804 | return splitPathRe.exec(filename).slice(1);
|
805 | };
|
806 |
|
807 |
|
808 |
|
809 | exports.resolve = function() {
|
810 | var resolvedPath = '',
|
811 | resolvedAbsolute = false;
|
812 |
|
813 | for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
814 | var path = (i >= 0) ? arguments[i] : process.cwd();
|
815 |
|
816 |
|
817 | if (typeof path !== 'string') {
|
818 | throw new TypeError('Arguments to path.resolve must be strings');
|
819 | } else if (!path) {
|
820 | continue;
|
821 | }
|
822 |
|
823 | resolvedPath = path + '/' + resolvedPath;
|
824 | resolvedAbsolute = path.charAt(0) === '/';
|
825 | }
|
826 |
|
827 |
|
828 |
|
829 |
|
830 |
|
831 | resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
|
832 | return !!p;
|
833 | }), !resolvedAbsolute).join('/');
|
834 |
|
835 | return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
|
836 | };
|
837 |
|
838 |
|
839 |
|
840 | exports.normalize = function(path) {
|
841 | var isAbsolute = exports.isAbsolute(path),
|
842 | trailingSlash = substr(path, -1) === '/';
|
843 |
|
844 |
|
845 | path = normalizeArray(filter(path.split('/'), function(p) {
|
846 | return !!p;
|
847 | }), !isAbsolute).join('/');
|
848 |
|
849 | if (!path && !isAbsolute) {
|
850 | path = '.';
|
851 | }
|
852 | if (path && trailingSlash) {
|
853 | path += '/';
|
854 | }
|
855 |
|
856 | return (isAbsolute ? '/' : '') + path;
|
857 | };
|
858 |
|
859 |
|
860 | exports.isAbsolute = function(path) {
|
861 | return path.charAt(0) === '/';
|
862 | };
|
863 |
|
864 |
|
865 | exports.join = function() {
|
866 | var paths = Array.prototype.slice.call(arguments, 0);
|
867 | return exports.normalize(filter(paths, function(p, index) {
|
868 | if (typeof p !== 'string') {
|
869 | throw new TypeError('Arguments to path.join must be strings');
|
870 | }
|
871 | return p;
|
872 | }).join('/'));
|
873 | };
|
874 |
|
875 |
|
876 |
|
877 |
|
878 | exports.relative = function(from, to) {
|
879 | from = exports.resolve(from).substr(1);
|
880 | to = exports.resolve(to).substr(1);
|
881 |
|
882 | function trim(arr) {
|
883 | var start = 0;
|
884 | for (; start < arr.length; start++) {
|
885 | if (arr[start] !== '') break;
|
886 | }
|
887 |
|
888 | var end = arr.length - 1;
|
889 | for (; end >= 0; end--) {
|
890 | if (arr[end] !== '') break;
|
891 | }
|
892 |
|
893 | if (start > end) return [];
|
894 | return arr.slice(start, end - start + 1);
|
895 | }
|
896 |
|
897 | var fromParts = trim(from.split('/'));
|
898 | var toParts = trim(to.split('/'));
|
899 |
|
900 | var length = Math.min(fromParts.length, toParts.length);
|
901 | var samePartsLength = length;
|
902 | for (var i = 0; i < length; i++) {
|
903 | if (fromParts[i] !== toParts[i]) {
|
904 | samePartsLength = i;
|
905 | break;
|
906 | }
|
907 | }
|
908 |
|
909 | var outputParts = [];
|
910 | for (var i = samePartsLength; i < fromParts.length; i++) {
|
911 | outputParts.push('..');
|
912 | }
|
913 |
|
914 | outputParts = outputParts.concat(toParts.slice(samePartsLength));
|
915 |
|
916 | return outputParts.join('/');
|
917 | };
|
918 |
|
919 | exports.sep = '/';
|
920 | exports.delimiter = ':';
|
921 |
|
922 | exports.dirname = function(path) {
|
923 | var result = splitPath(path),
|
924 | root = result[0],
|
925 | dir = result[1];
|
926 |
|
927 | if (!root && !dir) {
|
928 |
|
929 | return '.';
|
930 | }
|
931 |
|
932 | if (dir) {
|
933 |
|
934 | dir = dir.substr(0, dir.length - 1);
|
935 | }
|
936 |
|
937 | return root + dir;
|
938 | };
|
939 |
|
940 |
|
941 | exports.basename = function(path, ext) {
|
942 | var f = splitPath(path)[2];
|
943 |
|
944 | if (ext && f.substr(-1 * ext.length) === ext) {
|
945 | f = f.substr(0, f.length - ext.length);
|
946 | }
|
947 | return f;
|
948 | };
|
949 |
|
950 |
|
951 | exports.extname = function(path) {
|
952 | return splitPath(path)[3];
|
953 | };
|
954 |
|
955 | function filter (xs, f) {
|
956 | if (xs.filter) return xs.filter(f);
|
957 | var res = [];
|
958 | for (var i = 0; i < xs.length; i++) {
|
959 | if (f(xs[i], i, xs)) res.push(xs[i]);
|
960 | }
|
961 | return res;
|
962 | }
|
963 |
|
964 |
|
965 | var substr = 'ab'.substr(-1) === 'b'
|
966 | ? function (str, start, len) { return str.substr(start, len) }
|
967 | : function (str, start, len) {
|
968 | if (start < 0) start = str.length + start;
|
969 | return str.substr(start, len);
|
970 | }
|
971 | ;
|
972 |
|
973 | }.call(exports, __webpack_require__(3)))
|
974 |
|
975 | }),
|
976 |
|
977 | (function(module, exports) {
|
978 |
|
979 |
|
980 |
|
981 | }),
|
982 |
|
983 | (function(module, exports) {
|
984 |
|
985 | module.exports = require("json5");
|
986 |
|
987 | }),
|
988 |
|
989 | (function(module, exports) {
|
990 |
|
991 | module.exports = require("json-stringify-safe");
|
992 |
|
993 | }),
|
994 |
|
995 | (function(module, exports) {
|
996 |
|
997 | module.exports = require("randomcolor");
|
998 |
|
999 | })
|
1000 | ]))); |
\ | No newline at end of file |