Skip to content
This repository has been archived by the owner on May 14, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' into fix_column
Browse files Browse the repository at this point in the history
  • Loading branch information
chinesedfan authored and xianming.zhong committed Nov 18, 2018
2 parents b26a14f + 18ba737 commit 70fb264
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ const isCausedBySubstitution = require('./utils/result').isCausedBySubstitution
const getCorrectColumn = require('./utils/result').getCorrectColumn

let inputId = 1

// Make sure that state for particular path will be cleaned before each run
// module may be kept in memory when used with vscode-stylelint
const taggedTemplateLocsMap = {}
const interpolationLinesMap = {}
const sourceMapsCorrections = {}
Expand All @@ -25,25 +28,20 @@ module.exports = options => ({
}

try {
sourceMapsCorrections[absolutePath] = {}
const { extractedCSS, interpolationLines, taggedTemplateLocs, sourceMap } = parse(
input,
absolutePath,
Object.assign({}, DEFAULT_OPTIONS, options)
)
// Save `loc` of template literals
taggedTemplateLocsMap[absolutePath] = taggedTemplateLocs.concat(
taggedTemplateLocsMap[absolutePath] || []
)
taggedTemplateLocsMap[absolutePath] = taggedTemplateLocs
// Save dummy interpolation lines
interpolationLinesMap[absolutePath] = interpolationLines.concat(
interpolationLinesMap[absolutePath] || []
)
// Save source location, merging existing corrections with current corrections
sourceMapsCorrections[absolutePath] = Object.assign(
sourceMapsCorrections[absolutePath],
sourceMap
)
interpolationLinesMap[absolutePath] = interpolationLines
// Save source location
sourceMapsCorrections[absolutePath] = sourceMap
// Clean errors
delete errorWasThrown[absolutePath]

return extractedCSS
} catch (e) {
// Always save the error
Expand Down

0 comments on commit 70fb264

Please sign in to comment.