项目原始demo,不改动
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 

118 lines
3.5 KiB

  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.consoleInfo = consoleInfo;
  6. exports.consoleWarn = consoleWarn;
  7. exports.consoleError = consoleError;
  8. exports.deprecate = deprecate;
  9. exports.breaking = breaking;
  10. exports.removed = removed;
  11. function createMessage(message, vm, parent) {
  12. if (parent) {
  13. vm = {
  14. _isVue: true,
  15. $parent: parent,
  16. $options: vm
  17. };
  18. }
  19. if (vm) {
  20. // Only show each message once per instance
  21. vm.$_alreadyWarned = vm.$_alreadyWarned || [];
  22. if (vm.$_alreadyWarned.includes(message)) return;
  23. vm.$_alreadyWarned.push(message);
  24. }
  25. return "[Vuetify] ".concat(message) + (vm ? generateComponentTrace(vm) : '');
  26. }
  27. function consoleInfo(message, vm, parent) {
  28. var newMessage = createMessage(message, vm, parent);
  29. newMessage != null && console.info(newMessage);
  30. }
  31. function consoleWarn(message, vm, parent) {
  32. var newMessage = createMessage(message, vm, parent);
  33. newMessage != null && console.warn(newMessage);
  34. }
  35. function consoleError(message, vm, parent) {
  36. var newMessage = createMessage(message, vm, parent);
  37. newMessage != null && console.error(newMessage);
  38. }
  39. function deprecate(original, replacement, vm, parent) {
  40. consoleWarn("[UPGRADE] '".concat(original, "' is deprecated, use '").concat(replacement, "' instead."), vm, parent);
  41. }
  42. function breaking(original, replacement, vm, parent) {
  43. consoleError("[BREAKING] '".concat(original, "' has been removed, use '").concat(replacement, "' instead. For more information, see the upgrade guide https://github.com/vuetifyjs/vuetify/releases/tag/v2.0.0#user-content-upgrade-guide"), vm, parent);
  44. }
  45. function removed(original, vm, parent) {
  46. consoleWarn("[REMOVED] '".concat(original, "' has been removed. You can safely omit it."), vm, parent);
  47. }
  48. /**
  49. * Shamelessly stolen from vuejs/vue/blob/dev/src/core/util/debug.js
  50. */
  51. var classifyRE = /(?:^|[-_])(\w)/g;
  52. var classify = function classify(str) {
  53. return str.replace(classifyRE, function (c) {
  54. return c.toUpperCase();
  55. }).replace(/[-_]/g, '');
  56. };
  57. function formatComponentName(vm, includeFile) {
  58. if (vm.$root === vm) {
  59. return '<Root>';
  60. }
  61. var options = typeof vm === 'function' && vm.cid != null ? vm.options : vm._isVue ? vm.$options || vm.constructor.options : vm || {};
  62. var name = options.name || options._componentTag;
  63. var file = options.__file;
  64. if (!name && file) {
  65. var match = file.match(/([^/\\]+)\.vue$/);
  66. name = match && match[1];
  67. }
  68. return (name ? "<".concat(classify(name), ">") : "<Anonymous>") + (file && includeFile !== false ? " at ".concat(file) : '');
  69. }
  70. function generateComponentTrace(vm) {
  71. if (vm._isVue && vm.$parent) {
  72. var tree = [];
  73. var currentRecursiveSequence = 0;
  74. while (vm) {
  75. if (tree.length > 0) {
  76. var last = tree[tree.length - 1];
  77. if (last.constructor === vm.constructor) {
  78. currentRecursiveSequence++;
  79. vm = vm.$parent;
  80. continue;
  81. } else if (currentRecursiveSequence > 0) {
  82. tree[tree.length - 1] = [last, currentRecursiveSequence];
  83. currentRecursiveSequence = 0;
  84. }
  85. }
  86. tree.push(vm);
  87. vm = vm.$parent;
  88. }
  89. return '\n\nfound in\n\n' + tree.map(function (vm, i) {
  90. return "".concat(i === 0 ? '---> ' : ' '.repeat(5 + i * 2)).concat(Array.isArray(vm) ? "".concat(formatComponentName(vm[0]), "... (").concat(vm[1], " recursive calls)") : formatComponentName(vm));
  91. }).join('\n');
  92. } else {
  93. return "\n\n(found in ".concat(formatComponentName(vm), ")");
  94. }
  95. }
  96. //# sourceMappingURL=console.js.map