@stencil/sass
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -10,6 +10,6 @@ export function loadDiagnostic(context, sassError, filePath) { | ||
header: 'sass error', | ||
code: sassError.status && sassError.status.toString(), | ||
code: formatCode(sassError.status), | ||
relFilePath: null, | ||
absFilePath: null, | ||
messageText: sassError.message, | ||
messageText: formatMessage(sassError.message), | ||
lines: [] | ||
@@ -20,3 +20,2 @@ }; | ||
diagnostic.relFilePath = formatFileName(context.config.rootDir, diagnostic.absFilePath); | ||
diagnostic.header = formatHeader('sass', diagnostic.absFilePath, context.config.rootDir, sassError.line); | ||
const errorLineNumber = sassError.line; | ||
@@ -84,2 +83,16 @@ const errorLineIndex = errorLineNumber - 1; | ||
} | ||
function formatCode(input) { | ||
let output = ''; | ||
if (input != null) { | ||
output = String(input); | ||
} | ||
return output; | ||
} | ||
function formatMessage(input) { | ||
let output = ''; | ||
if (typeof input === 'string') { | ||
output = input.split('╷')[0]; | ||
} | ||
return output; | ||
} | ||
function formatFileName(rootDir, fileName) { | ||
@@ -97,14 +110,2 @@ if (!rootDir || !fileName) | ||
} | ||
function formatHeader(type, fileName, rootDir, startLineNumber = null, endLineNumber = null) { | ||
let header = `${type}: ${formatFileName(rootDir, fileName)}`; | ||
if (startLineNumber !== null && startLineNumber > 0) { | ||
if (endLineNumber !== null && endLineNumber > startLineNumber) { | ||
header += `, lines: ${startLineNumber} - ${endLineNumber}`; | ||
} | ||
else { | ||
header += `, line: ${startLineNumber}`; | ||
} | ||
} | ||
return header; | ||
} | ||
const STOP_CHARS = ['', '\n', '\r', '\t', ' ', ':', ';', ',', '{', '}', '.', '#', '@', '!', '[', ']', '(', ')', '&', '+', '~', '^', '*', '$']; |
{ | ||
"name": "@stencil/sass", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
49996
1413044