UNPKG

vue-svg-loader

Version:
17 lines (16 loc) 810 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const compiler_sfc_1 = require("@vue/compiler-sfc"); const chalk_1 = __importDefault(require("chalk")); function formatError(err, source, file) { if (err.loc) { const loc = `:${err.loc.start.line}:${err.loc.start.column}`; const filePath = chalk_1.default.gray(`at ${file}${loc}`); const codeframe = compiler_sfc_1.generateCodeFrame(source, err.loc.start.offset, err.loc.end.offset); err.message = `\n${chalk_1.default.red(`VueCompilerError: ${err.message}`)}\n${filePath}\n${chalk_1.default.yellow(codeframe)}\n`; } } exports.formatError = formatError;