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.
16 lines
674 B
16 lines
674 B
"use strict"; |
|
Object.defineProperty(exports, "__esModule", { value: true }); |
|
exports.formatError = void 0; |
|
const compiler_sfc_1 = require("vue/compiler-sfc"); |
|
const chalk = require("chalk"); |
|
function formatError(err, source, file) { |
|
const loc = err.loc; |
|
if (!loc) { |
|
return; |
|
} |
|
const locString = `:${loc.start.line}:${loc.start.column}`; |
|
const filePath = chalk.gray(`at ${file}${locString}`); |
|
const codeframe = (0, compiler_sfc_1.generateCodeFrame)(source, loc.start.offset, loc.end.offset); |
|
err.message = `\n${chalk.red(`VueCompilerError: ${err.message}`)}\n${filePath}\n${chalk.yellow(codeframe)}\n`; |
|
} |
|
exports.formatError = formatError;
|
|
|