@riotjs/parser
Advanced tools
Comparing version 4.1.2 to 4.2.0
# Changes for riot-parser | ||
### v4.1.2 | ||
- Update generated bundle fixing discrepancy between source files and bundled output | ||
### v4.1.1 | ||
@@ -4,0 +7,0 @@ - Fix end value of the root node |
24
index.js
@@ -1248,9 +1248,17 @@ 'use strict'; | ||
const pos = start + 2; // skip '<!' | ||
const str = data.substr(pos, 2) === '--' ? '-->' : '>'; | ||
const isLongComment = data.substr(pos, 2) === '--'; | ||
const str = isLongComment ? '-->' : '>'; | ||
const end = data.indexOf(str, pos); | ||
if (end < 0) { | ||
panic(data, unclosedComment, start); | ||
} | ||
pushComment(state, start, end + str.length); | ||
pushComment( | ||
state, | ||
start, | ||
end + str.length, | ||
data.substring(start, end + str.length) | ||
); | ||
return TEXT | ||
@@ -1265,10 +1273,16 @@ } | ||
* @param {number} end - Ending position (last char of the tag) | ||
* @param {string} text - Comment content | ||
* @returns {undefined} void function | ||
* @private | ||
*/ | ||
function pushComment(state, start, end) { | ||
flush(state); | ||
function pushComment(state, start, end, text) { | ||
state.pos = end; | ||
if (state.options.comments === true) { | ||
state.last = { type: COMMENT, start, end }; | ||
flush(state); | ||
state.last = { | ||
type: COMMENT, | ||
start, | ||
end, | ||
text | ||
}; | ||
} | ||
@@ -1275,0 +1289,0 @@ } |
{ | ||
"name": "@riotjs/parser", | ||
"version": "4.1.2", | ||
"version": "4.2.0", | ||
"description": "The parser for Riot tags", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -18,9 +18,17 @@ import {COMMENT, TEXT} from '../node-types' | ||
const pos = start + 2 // skip '<!' | ||
const str = data.substr(pos, 2) === '--' ? '-->' : '>' | ||
const isLongComment = data.substr(pos, 2) === '--' | ||
const str = isLongComment ? '-->' : '>' | ||
const end = data.indexOf(str, pos) | ||
if (end < 0) { | ||
panic(data, unclosedComment, start) | ||
} | ||
pushComment(state, start, end + str.length) | ||
pushComment( | ||
state, | ||
start, | ||
end + str.length, | ||
data.substring(start, end + str.length) | ||
) | ||
return TEXT | ||
@@ -35,11 +43,17 @@ } | ||
* @param {number} end - Ending position (last char of the tag) | ||
* @param {string} text - Comment content | ||
* @returns {undefined} void function | ||
* @private | ||
*/ | ||
export function pushComment(state, start, end) { | ||
flush(state) | ||
export function pushComment(state, start, end, text) { | ||
state.pos = end | ||
if (state.options.comments === true) { | ||
state.last = { type: COMMENT, start, end } | ||
flush(state) | ||
state.last = { | ||
type: COMMENT, | ||
start, | ||
end, | ||
text | ||
} | ||
} | ||
} |
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
94169
2825