@fimbul/ve
Advanced tools
Comparing version 0.17.0-dev.20181218 to 0.17.0-dev.20181220
{ | ||
"name": "@fimbul/ve", | ||
"version": "0.17.0-dev.20181218", | ||
"version": "0.17.0-dev.20181220", | ||
"description": "Vue processor for wotan", | ||
@@ -5,0 +5,0 @@ "main": "src/index", |
@@ -14,2 +14,3 @@ "use strict"; | ||
line: 0, | ||
firstLineOffset: 0, | ||
}; | ||
@@ -33,2 +34,12 @@ if (path.extname(this.sourceFileName) === '.vue') { | ||
parser.end(); | ||
const lineBreakAfterStart = /^\r?\n/.exec(this.source.substr(this.range.start)); | ||
if (lineBreakAfterStart !== null) { | ||
this.range.start += lineBreakAfterStart[0].length; | ||
} | ||
else { | ||
let lineBreakBeforeStart = this.source.lastIndexOf('\n', this.range.start); | ||
if (lineBreakBeforeStart === -1) | ||
lineBreakBeforeStart = 0; | ||
this.range.firstLineOffset = this.range.start - lineBreakBeforeStart; | ||
} | ||
const match = this.source.substring(0, this.range.start).match(/(\r?\n)/g); | ||
@@ -83,11 +94,3 @@ if (match !== null) | ||
mapFailure(f) { | ||
return Object.assign({}, f, { start: { | ||
character: f.start.character, | ||
line: f.start.line + this.range.line, | ||
position: f.start.position + this.range.start, | ||
}, end: { | ||
character: f.end.character, | ||
line: f.end.line + this.range.line, | ||
position: f.end.position + this.range.start, | ||
}, fix: f.fix === undefined | ||
return Object.assign({}, f, { start: this.adjustPosition(f.start), end: this.adjustPosition(f.end), fix: f.fix === undefined | ||
? undefined | ||
@@ -98,2 +101,9 @@ : { | ||
} | ||
adjustPosition(pos) { | ||
return { | ||
character: pos.line === 0 ? pos.character + this.range.firstLineOffset : pos.character, | ||
line: pos.line + this.range.line, | ||
position: pos.position + this.range.start, | ||
}; | ||
} | ||
mapReplacement(r) { | ||
@@ -100,0 +110,0 @@ return { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22832
113