MCPcopy
hub / github.com/vitejs/vite / formatParseError

Function formatParseError

packages/vite/src/node/plugins/html.ts:299–315  ·  view source on GitHub ↗

* Format parse5 @type {ParserError} to @type {RollupError}

(parserError: ParserError, id: string, html: string)

Source from the content-addressed store, hash-verified

297 * Format parse5 @type {ParserError} to @type {RollupError}
298 */
299function formatParseError(parserError: ParserError, id: string, html: string) {
300 const formattedError = {
301 code: parserError.code,
302 message: `parse5 error code ${parserError.code}`,
303 frame: generateCodeFrame(
304 html,
305 parserError.startOffset,
306 parserError.endOffset,
307 ),
308 loc: {
309 file: id,
310 line: parserError.startLine,
311 column: parserError.startCol,
312 },
313 } satisfies RollupError
314 return formattedError
315}
316
317function handleParseError(
318 parserError: ParserError,

Callers 1

handleParseErrorFunction · 0.85

Calls 1

generateCodeFrameFunction · 0.90

Tested by

no test coverage detected