Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

console.js 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. function createMessage(message, vm, parent) {
  2. if (parent) {
  3. vm = {
  4. _isVue: true,
  5. $parent: parent,
  6. $options: vm
  7. };
  8. }
  9. if (vm) {
  10. // Only show each message once per instance
  11. vm.$_alreadyWarned = vm.$_alreadyWarned || [];
  12. if (vm.$_alreadyWarned.includes(message)) return;
  13. vm.$_alreadyWarned.push(message);
  14. }
  15. return '[Vuetify] ' + message + (vm ? generateComponentTrace(vm) : '');
  16. }
  17. export function consoleInfo(message, vm, parent) {
  18. var newMessage = createMessage(message, vm, parent);
  19. newMessage != null && console.info(newMessage);
  20. }
  21. export function consoleWarn(message, vm, parent) {
  22. var newMessage = createMessage(message, vm, parent);
  23. newMessage != null && console.warn(newMessage);
  24. }
  25. export function consoleError(message, vm, parent) {
  26. var newMessage = createMessage(message, vm, parent);
  27. newMessage != null && console.error(newMessage);
  28. }
  29. export function deprecate(original, replacement, vm, parent) {
  30. consoleWarn('\'' + original + '\' is deprecated, use \'' + replacement + '\' instead', vm, parent);
  31. }
  32. /**
  33. * Shamelessly stolen from vuejs/vue/blob/dev/src/core/util/debug.js
  34. */
  35. var classifyRE = /(?:^|[-_])(\w)/g;
  36. var classify = function classify(str) {
  37. return str.replace(classifyRE, function (c) {
  38. return c.toUpperCase();
  39. }).replace(/[-_]/g, '');
  40. };
  41. function formatComponentName(vm, includeFile) {
  42. if (vm.$root === vm) {
  43. return '<Root>';
  44. }
  45. var options = typeof vm === 'function' && vm.cid != null ? vm.options : vm._isVue ? vm.$options || vm.constructor.options : vm || {};
  46. var name = options.name || options._componentTag;
  47. var file = options.__file;
  48. if (!name && file) {
  49. var match = file.match(/([^/\\]+)\.vue$/);
  50. name = match && match[1];
  51. }
  52. return (name ? '<' + classify(name) + '>' : '<Anonymous>') + (file && includeFile !== false ? ' at ' + file : '');
  53. }
  54. function generateComponentTrace(vm) {
  55. if (vm._isVue && vm.$parent) {
  56. var tree = [];
  57. var currentRecursiveSequence = 0;
  58. while (vm) {
  59. if (tree.length > 0) {
  60. var last = tree[tree.length - 1];
  61. if (last.constructor === vm.constructor) {
  62. currentRecursiveSequence++;
  63. vm = vm.$parent;
  64. continue;
  65. } else if (currentRecursiveSequence > 0) {
  66. tree[tree.length - 1] = [last, currentRecursiveSequence];
  67. currentRecursiveSequence = 0;
  68. }
  69. }
  70. tree.push(vm);
  71. vm = vm.$parent;
  72. }
  73. return '\n\nfound in\n\n' + tree.map(function (vm, i) {
  74. return '' + (i === 0 ? '---> ' : ' '.repeat(5 + i * 2)) + (Array.isArray(vm) ? formatComponentName(vm[0]) + '... (' + vm[1] + ' recursive calls)' : formatComponentName(vm));
  75. }).join('\n');
  76. } else {
  77. return '\n\n(found in ' + formatComponentName(vm) + ')';
  78. }
  79. }
  80. //# sourceMappingURL=console.js.map