提交 29898690 编写于 作者: fxy060608's avatar fxy060608

chore: merge

......@@ -14,6 +14,7 @@ import {
parseVueRequest,
removeExt,
resolveMainPathOnce,
formatAtFilename,
} from '@dcloudio/uni-cli-shared'
import { parse } from '@dcloudio/uni-nvue-styler'
import { nvueOutDir } from '../../utils'
......@@ -121,13 +122,14 @@ export function uniAppNVuePlugin({
})
messages.forEach((message) => {
if (message.type === 'warning') {
let msg = `[vite:css] ${message.text}`
let msg = `[plugin:vite:css] ${message.text}`
if (message.line && message.column) {
msg += `\n${generateCodeFrame(source, {
line: message.line,
column: message.column,
})}`
}
msg += `\n${formatAtFilename(filename)}`
config.logger.warn(colors.yellow(msg))
}
})
......
......@@ -2,6 +2,8 @@ import path from 'path'
import { normalizePath } from '../utils'
import { uniConsolePlugin } from '../vite/plugins/console'
export { formatAtFilename } from './log'
export * from './env'
export {
initModuleAlias,
......
......@@ -10,6 +10,22 @@ const SIGNAL_H5_NETWORK = ' > Network:'
const networkLogs: string[] = []
export function formatAtFilename(
filename: string,
line?: number,
column?: number
) {
return `at ${colors.cyan(
normalizePath(
path.relative(process.env.UNI_INPUT_DIR, filename.split('?')[0])
) +
':' +
(line || 1) +
':' +
(column || 0)
)}`
}
export const h5ServeFormatter: Formatter = {
test(msg) {
return msg.includes(SIGNAL_H5_LOCAL) || msg.includes(SIGNAL_H5_NETWORK)
......@@ -83,17 +99,7 @@ function buildErrorMessage(
args.push(colors.red(err.message))
}
if (err.id) {
args.push(
`at ${colors.cyan(
normalizePath(
path.relative(process.env.UNI_INPUT_DIR, err.id.split('?')[0])
) +
':' +
(err.loc?.line || 1) +
':' +
(err.loc?.column || 0)
)}`
)
args.push(formatAtFilename(err.id, err.loc?.line, err.loc?.column))
}
if (err.frame) {
args.push(colors.yellow(pad(err.frame)))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册