Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gonzales-pe

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gonzales-pe - npm Package Compare versions

Comparing version 3.0.0-28 to 3.0.0-29

543

lib/css/parse.js

@@ -31,3 +31,3 @@ var Node = require('../node');

'block': function() { return checkBlock(pos) && getBlock(); },
'braces': function() { return checkBraces(pos) && getBraces(); },
'brackets': function() { return checkBrackets(pos) && getBrackets(); },
'class': function() { return checkClass(pos) && getClass(); },

@@ -40,5 +40,3 @@ 'combinator': function() { return checkCombinator(pos) && getCombinator(); },

'dimension': function() { return checkDimension(pos) && getDimension(); },
'filter': function() { return checkFilter(pos) && getFilter(); },
'filterv': function() { return checkFilterv(pos) && getFilterv(); },
'functionExpression': function() { return checkFunctionExpression(pos) && getFunctionExpression(); },
'expression': function() { return checkExpression(pos) && getExpression(); },
'function': function() { return checkFunction(pos) && getFunction(); },

@@ -52,2 +50,3 @@ 'ident': function() { return checkIdent(pos) && getIdent(); },

'operator': function() { return checkOperator(pos) && getOperator(); },
'parentheses': function() { return checkParentheses(pos) && getParentheses(); },
'percentage': function() { return checkPercentage(pos) && getPercentage(); },

@@ -129,3 +128,89 @@ 'progid': function() { return checkProgid(pos) && getProgid(); },

function getLastPosition(content, line, column, colOffset) {
return typeof content === 'string' ?
getLastPositionForString(content, line, column, colOffset) :
getLastPositionForArray(content, line, column, colOffset);
}
function getLastPositionForString(content, line, column, colOffset) {
var position = [];
if (!content) {
position = [line, column];
if (colOffset) position[1] += colOffset - 1;
return position;
}
var lastLinebreak = content.lastIndexOf('\n');
var endsWithLinebreak = lastLinebreak === content.length - 1;
var splitContent = content.split('\n');
var linebreaksCount = splitContent.length - 1;
var prevLinebreak = linebreaksCount === 0 || linebreaksCount === 1 ?
-1 : content.length - splitContent[linebreaksCount - 1].length - 2;
// Line:
var offset = endsWithLinebreak ? linebreaksCount - 1 : linebreaksCount;
position[0] = line + offset;
// Column:
if (endsWithLinebreak) {
offset = prevLinebreak !== -1 ?
content.length - prevLinebreak :
content.length - 1;
} else {
offset = linebreaksCount !== 0 ?
content.length - lastLinebreak - column - 1 :
content.length - 1;
}
position[1] = column + offset;
if (!colOffset) return position;
if (endsWithLinebreak) {
position[0]++;
position[1] = colOffset;
} else {
position[1] += colOffset;
}
return position;
}
function getLastPositionForArray(content, line, column, colOffset) {
var position;
if (content.length === 0) {
position = [line, column];
} else {
var c = content[content.length - 1];
if (c.hasOwnProperty('end')) {
position = [c.end.line, c.end.column];
} else {
position = getLastPosition(c.content, line, column);
}
}
if (!colOffset) return position;
if (tokens[pos - 1].type !== 'Newline') {
position[1] += colOffset;
} else {
position[0]++;
position[1] = 1;
}
return position;
}
function newNode(type, content, line, column, end) {
if (!end) end = getLastPosition(content, line, column);
return new Node({
type: type,
content: content,
start: [line, column],
end: end
});
}
/////////////////////////////////////

@@ -143,13 +228,14 @@ /////////////////////////////////////

if (l = checkBraces(i)) tokens[i].any_child = 1;
else if (l = checkString(i)) tokens[i].any_child = 2;
else if (l = checkPercentage(i)) tokens[i].any_child = 3;
else if (l = checkDimension(i)) tokens[i].any_child = 4;
else if (l = checkNumber(i)) tokens[i].any_child = 5;
else if (l = checkUri(i)) tokens[i].any_child = 6;
else if (l = checkFunctionExpression(i)) tokens[i].any_child = 7;
else if (l = checkFunction(i)) tokens[i].any_child = 8;
else if (l = checkIdent(i)) tokens[i].any_child = 9;
else if (l = checkClass(i)) tokens[i].any_child = 10;
else if (l = checkUnary(i)) tokens[i].any_child = 11;
if (l = checkBrackets(i)) tokens[i].any_child = 1;
else if (l = checkParentheses(i)) tokens[i].any_child = 2;
else if (l = checkString(i)) tokens[i].any_child = 3;
else if (l = checkPercentage(i)) tokens[i].any_child = 4;
else if (l = checkDimension(i)) tokens[i].any_child = 5;
else if (l = checkNumber(i)) tokens[i].any_child = 6;
else if (l = checkUri(i)) tokens[i].any_child = 7;
else if (l = checkExpression(i)) tokens[i].any_child = 8;
else if (l = checkFunction(i)) tokens[i].any_child = 9;
else if (l = checkIdent(i)) tokens[i].any_child = 10;
else if (l = checkClass(i)) tokens[i].any_child = 11;
else if (l = checkUnary(i)) tokens[i].any_child = 12;

@@ -165,13 +251,14 @@ return l;

if (childType === 1) return getBraces();
else if (childType === 2) return getString();
else if (childType === 3) return getPercentage();
else if (childType === 4) return getDimension();
else if (childType === 5) return getNumber();
else if (childType === 6) return getUri();
else if (childType === 7) return getFunctionExpression();
else if (childType === 8) return getFunction();
else if (childType === 9) return getIdent();
else if (childType === 10) return getClass();
else if (childType === 11) return getUnary();
if (childType === 1) return getBrackets();
else if (childType === 2) return getParentheses();
else if (childType === 3) return getString();
else if (childType === 4) return getPercentage();
else if (childType === 5) return getDimension();
else if (childType === 6) return getNumber();
else if (childType === 7) return getUri();
else if (childType === 8) return getExpression();
else if (childType === 9) return getFunction();
else if (childType === 10) return getIdent();
else if (childType === 11) return getClass();
else if (childType === 12) return getUnary();
}

@@ -209,3 +296,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -289,5 +376,7 @@

var end = getLastPosition(content, line, column+1, 1);
pos++;
return new Node(type, content, line, column);
return newNode(type, content, line, column, end);
}

@@ -335,5 +424,6 @@

var end = getLastPosition(content, line, column+1, 1);
pos++;
return new Node(type, content, line, column);
return newNode(type, content, line, column, end);
}

@@ -389,3 +479,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -466,3 +556,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -508,9 +598,5 @@

pos++;
content.push(getAtrulers());
pos++;
return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -536,3 +622,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -572,3 +658,3 @@

var type = NodeType.AtrulersType,
token = tokens[pos],
token = tokens[pos++],
line = token.ln,

@@ -587,3 +673,6 @@ column = token.col,

return new Node(type, content, line, column);
var end = getLastPosition(content, line, column, 1);
pos++;
return newNode(type, content, line, column, end);
}

@@ -619,3 +708,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -651,5 +740,6 @@

var end_ = getLastPosition(content, line, column, 1);
pos = end + 1;
return new Node(type, content, line, column);
return newNode(type, content, line, column, end_);
}

@@ -698,5 +788,4 @@

if (l = checkFilter(i)) tokens[i].bd_kind = 1;
else if (l = checkDeclaration(i)) tokens[i].bd_kind = 2;
else if (l = checkAtrule(i)) tokens[i].bd_kind = 3;
if (l = checkDeclaration(i)) tokens[i].bd_kind = 1;
else if (l = checkAtrule(i)) tokens[i].bd_kind = 2;
else return 0;

@@ -726,8 +815,5 @@

case 1:
x = getFilter();
x = getDeclaration();
break;
case 2:
x = getDeclaration();
break;
case 3:
x = getAtrule();

@@ -754,5 +840,4 @@ break;

if (l = checkFilter(i)) tokens[i].bd_kind = 1;
else if (l = checkDeclaration(i)) tokens[i].bd_kind = 2;
else if (l = checkAtrule(i)) tokens[i].bd_kind = 3;
if (l = checkDeclaration(i)) tokens[i].bd_kind = 1;
else if (l = checkAtrule(i)) tokens[i].bd_kind = 2;
else return 0;

@@ -776,8 +861,5 @@

case 1:
x = getFilter();
x = getDeclaration();
break;
case 2:
x = getDeclaration();
break;
case 3:
x = getAtrule();

@@ -835,11 +917,9 @@ break;

/**
* Check if token is part of text inside parentheses or square brackets
* (e.g. `(1)`)
* Check if token is part of text inside square brackets, e.g. `[1]`
* @param {Number} i Token's index number
* @return {Number}
*/
function checkBraces(i) {
function checkBrackets(i) {
if (i >= tokensLength ||
(tokens[i].type !== TokenType.LeftParenthesis &&
tokens[i].type !== TokenType.LeftSquareBracket)) return 0;
tokens[i].type !== TokenType.LeftSquareBracket) return 0;

@@ -850,7 +930,7 @@ return tokens[i].right - i + 1;

/**
* Get node with text inside parentheses or square brackets (e.g. `(1)`)
* Get node with text inside square brackets, e.g. `[1]`
* @return {Node}
*/
function getBraces() {
var type = NodeType.BracesType,
function getBrackets() {
var type = NodeType.BracketsType,
token = tokens[pos],

@@ -860,9 +940,9 @@ line = token.ln,

left = pos,
right = tokens[pos++].right;
content = [tokens[left].value, tokens[right].value]
.concat(getTsets());
right = tokens[pos++].right,
tsets = getTsets();
var end = getLastPosition(tsets, line, column, 1);
pos++;
return new Node(type, content, line, column);
return newNode(type, tsets, line, column, end);
}

@@ -901,3 +981,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -934,3 +1014,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -962,5 +1042,7 @@

var end = getLastPosition(content, line, column, 2);
if (end[0] === line) end[1] += 2;
pos++;
return new Node(type, content, line, column);
return newNode(type, content, line, column, end);
}

@@ -1011,3 +1093,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -1037,3 +1119,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -1053,2 +1135,3 @@

ident.start.column -= 1;
ident.end.column += 5;
pos = _pos + 3;

@@ -1080,3 +1163,3 @@ return ident;

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -1112,7 +1195,7 @@

token = tokens[pos];
var ident = new Node(NodeType.IdentType, getNmName2(), token.ln, token.col);
var ident = newNode(NodeType.IdentType, getNmName2(), token.ln, token.col);
content.push(ident);
return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -1124,147 +1207,3 @@

*/
function checkFilter(i) {
var start = i,
l;
if (i >= tokensLength) return 0;
if (l = checkFilterp(i)) i += l;
else return 0;
if (tokens[i].type === TokenType.Colon) i++;
else return 0;
if (l = checkFilterv(i)) i += l;
else return 0;
return i - start;
}
/**
* @return {Node}
*/
function getFilter() {
var type = NodeType.FilterType,
token = tokens[pos],
line = token.ln,
column = token.col,
content = [getFilterp()];
pos++;
content.push(getFilterv());
return new Node(type, content, line, column);
}
/**
* @param {Number} i Token's index number
* @return {Number}
*/
function checkFilterp(i) {
var start = i,
l,
x;
if (i >= tokensLength) return 0;
if (tokens[i].value === 'filter') l = 1;
else {
x = joinValues2(i, 2);
if (x === '-filter' || x === '_filter' || x === '*filter') l = 2;
else {
x = joinValues2(i, 4);
if (x === '-ms-filter') l = 4;
else return 0;
}
}
tokens[start].filterp_l = l;
i += l;
if (checkSC(i)) i += l;
return i - start;
}
/**
* @return {Node}
*/
function getFilterp() {
var type = NodeType.PropertyType,
token = tokens[pos],
line = token.ln,
column = token.col,
content;
token = tokens[pos];
var ident = new Node(NodeType.IdentType, joinValues2(pos, token.filterp_l), token.ln, token.col);
pos += token.filterp_l;
content = [ident].concat(getSC());
return new Node(type, content, line, column);
}
/**
* @param {Number} i Token's index number
* @return {Number}
*/
function checkFilterv(i) {
var start = i,
l;
if (i >= tokensLength) return 0;
if (l = checkSC(i)) i += l;
if (l = checkProgid(i)) i += l;
else return 0;
while (l = checkProgid(i)) {
i += l;
}
tokens[start].last_progid = i;
if (i < tokensLength && (l = checkSC(i))) i += l;
if (i < tokensLength && (l = checkImportant(i))) i += l;
return i - start;
}
/**
* @return {Node}
*/
function getFilterv() {
var type = NodeType.FiltervType,
token = tokens[pos],
line = token.ln,
column = token.col,
content = [],
last_progid = token.last_progid;
content = content.concat(getSC());
while (pos < last_progid) {
content.push(getProgid());
}
if (checkSC(pos)) content = content.concat(getSC());
if (pos < tokensLength && checkImportant(pos)) content.push(getImportant());
return new Node(type, content, line, column);
}
/**
* @param {Number} i Token's index number
* @return {Number}
*/
function checkFunctionExpression(i) {
function checkExpression(i) {
var start = i;

@@ -1281,16 +1220,16 @@

*/
function getFunctionExpression() {
var type = NodeType.FunctionExpressionType,
function getExpression() {
var type = NodeType.ExpressionType,
token = tokens[pos],
line = token.ln,
column = token.col,
content = [];
column = token.col;
pos++;
content.push(joinValues(pos + 1, tokens[pos].right - 1));
var content = joinValues(pos + 1, tokens[pos].right - 1);
var end = getLastPosition(content, line, column, 1);
if (end[0] === line) end[1] += 11;
pos = tokens[pos].right + 1;
return new Node(type, content, line, column);
return newNode(type, content, line, column, end);
}

@@ -1328,3 +1267,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -1355,5 +1294,6 @@

var end = getLastPosition(content, line, column, 1);
pos++;
return new Node(type, content, line, column);
return newNode(type, content, line, column, end);
}

@@ -1405,5 +1345,6 @@

var end = getLastPosition(content, line, column, 1);
pos++;
return new Node(type, content, line, column);
return newNode(type, content, line, column, end);
}

@@ -1490,3 +1431,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -1522,7 +1463,6 @@

if (!content || !content.length) content = '';
var end = getLastPosition(content, line, column, 9);
pos++;
return new Node(type, content, line, column);
return newNode(type, content, line, column, end);
}

@@ -1550,3 +1490,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -1668,3 +1608,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -1776,3 +1716,3 @@

var nthf = new Node(NodeType.IdentType, getNthf(), line, column);
var nthf = newNode(NodeType.IdentType, getNthf(), line, column+1);
content.push(nthf);

@@ -1789,5 +1729,6 @@

var end = getLastPosition(content, line, column, 1);
pos++;
return new Node(type, content, line, column);
return newNode(type, content, line, column, end);
}

@@ -1852,3 +1793,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -1888,6 +1829,37 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}
/**
* Check if token is part of text inside parentheses, e.g. `(1)`
* @param {Number} i Token's index number
* @return {Number}
*/
function checkParentheses(i) {
if (i >= tokensLength ||
tokens[i].type !== TokenType.LeftParenthesis) return 0;
return tokens[i].right - i + 1;
}
/**
* Get node with text inside parentheses, e.g. `(1)`
* @return {Node}
*/
function getParentheses() {
var type = NodeType.ParenthesesType,
token = tokens[pos],
line = token.ln,
column = token.col,
left = pos,
right = tokens[pos++].right,
tsets = getTsets();
var end = getLastPosition(tsets, line, column, 1);
pos++;
return newNode(type, tsets, line, column, end);
}
/**
* Check if token is part of a number with percent sign (e.g. `10%`)

@@ -1920,5 +1892,6 @@ * @param {Number} i Token's index number

var end = getLastPosition(content, line, column, 1);
pos++;
return new Node(type, content, line, column);
return newNode(type, content, line, column, end);
}

@@ -1936,4 +1909,2 @@

if (l = checkSC(i)) i += l;
if (joinValues2(i, 6) === 'progid:DXImageTransform.Microsoft.') i += 6;

@@ -1952,4 +1923,2 @@ else return 0;

if (l = checkSC(i)) i += l;
return i - start;

@@ -1967,19 +1936,2 @@ }

progid_end = token.progid_end,
content = []
.concat(getSC())
.concat([_getProgid(progid_end)])
.concat(getSC());
return new Node(type, content, line, column);
}
/**
* @param {Number} progid_end
* @return {Node}
*/
function _getProgid(progid_end) {
var type = NodeType.RawType,
token = tokens[pos],
line = token.ln,
column = token.col,
content = joinValues(pos, progid_end);

@@ -1989,3 +1941,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -2021,3 +1973,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -2045,3 +1997,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -2093,3 +2045,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -2127,3 +2079,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -2176,3 +2128,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -2203,3 +2155,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -2285,3 +2237,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -2317,5 +2269,8 @@

content.push(getNmName());
var ln = tokens[pos].ln;
var col = tokens[pos].col;
var ident = newNode(NodeType.IdentType, getNmName(), ln, col);
content.push(ident);
return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -2359,3 +2314,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -2422,3 +2377,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -2471,3 +2426,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -2557,3 +2512,3 @@

return new Node(type, content, line, column);
return newNode(type, content, line, column);
}

@@ -2604,4 +2559,2 @@

.concat(getSC());
pos++;
} else {

@@ -2612,3 +2565,3 @@ uri = checkSC(pos) ? getSC() : [];

t = tokens[pos];
raw = new Node(NodeType.RawType, rawContent, t.ln, t.col);
raw = newNode(NodeType.RawType, rawContent, t.ln, t.col);

@@ -2620,8 +2573,11 @@ uri.push(raw);

if (checkSC(pos)) uri = uri.concat(getSC());
pos++;
}
t = tokens[startPos];
return new Node(NodeType.UriType, uri, t.ln, t.col);
var line = t.ln;
var column = t.col;
var end = getLastPosition(uri, line, column, 1);
pos++;
return newNode(NodeType.UriType, uri, line, column, end);
}

@@ -2686,3 +2642,3 @@

var t = tokens[startPos];
return new Node(NodeType.ValueType, x, t.ln, t.col);
return newNode(NodeType.ValueType, x, t.ln, t.col);
}

@@ -2697,6 +2653,7 @@

if (l = checkVhash(i)) tokens[i].value_child = 1;
else if (l = checkAny(i)) tokens[i].value_child = 2;
else if (l = checkOperator(i)) tokens[i].value_child = 3;
else if (l = checkImportant(i)) tokens[i].value_child = 4;
if (l = checkProgid(i)) tokens[i].value_child = 1;
else if (l = checkVhash(i)) tokens[i].value_child = 2;
else if (l = checkAny(i)) tokens[i].value_child = 3;
else if (l = checkOperator(i)) tokens[i].value_child = 4;
else if (l = checkImportant(i)) tokens[i].value_child = 5;

@@ -2711,6 +2668,7 @@ return l;

var childType = tokens[pos].value_child;
if (childType === 1) return getVhash();
else if (childType === 2) return getAny();
else if (childType === 3) return getOperator();
else if (childType === 4) return getImportant();
if (childType === 1) return getProgid();
else if (childType === 2) return getVhash();
else if (childType === 3) return getAny();
else if (childType === 4) return getOperator();
else if (childType === 5) return getImportant();
}

@@ -2747,3 +2705,4 @@

content = getNmName2();
return new Node(type, content, line, column);
var end = getLastPosition(content, line, column+1);
return newNode(type, content, line, column, end);
}

@@ -2750,0 +2709,0 @@

@@ -38,4 +38,4 @@ module.exports = function stringify(tree) {

},
'braces': function(t) {
return t.content[0] + _composite(t.content.slice(2)) + t.content[1];
'brackets': function(t) {
return '[' + _composite(t.content) + ']';
},

@@ -48,10 +48,7 @@ 'class': function(t) {

},
'filter': function(t) {
return _t(t.content[0]) + ':' + _t(t.content[1]);
},
'functionExpression': function(t) {
'expression': function(t) {
return 'expression(' + t.content + ')';
},
'id': function (t) {
return '#' + t.content;
return '#' + _composite(t.content);
},

@@ -67,2 +64,5 @@ 'important': function(t) {

},
'parentheses': function(t) {
return '(' + _composite(t.content) + ')';
},
'percentage': function(t) {

@@ -69,0 +69,0 @@ return _composite(t.content) + '%';

@@ -6,5 +6,5 @@ var Node = require('./node');

createNode: function(options) {
return new Node(options.type, options.content);
return new Node(options);
},
parse: parse
}

@@ -38,4 +38,4 @@ module.exports = function stringify(tree) {

},
'braces': function(t) {
return t.content[0] + _composite(t.content.slice(2)) + t.content[1];
'brackets': function(t) {
return '[' + _composite(t.content) + ']';
},

@@ -51,10 +51,7 @@ 'class': function(t) {

},
'filter': function(t) {
return _t(t.content[0]) + ':' + _t(t.content[1]);
},
'functionExpression': function(t) {
'expression': function(t) {
return 'expression(' + t.content + ')';
},
'id': function (t) {
return '#' + t.content;
return '#' + _composite(t.content);
},

@@ -73,4 +70,7 @@ 'important': function(t) {

},
'parentheses': function(t) {
return '(' + _composite(t.content) + ')';
},
'percentage': function(t) {
return _t(t.content) + '%';
return _composite(t.content) + '%';
},

@@ -77,0 +77,0 @@ 'pseudoClass': function(t) {

@@ -12,3 +12,3 @@ module.exports = {

BlockType: 'block',
BracesType: 'braces',
BracketsType: 'brackets',
ClassType: 'class',

@@ -26,6 +26,4 @@ CombinatorType: 'combinator',

EscapedStringType: 'escapedString',
FilterType: 'filter',
FiltervType: 'filterValue',
ExpressionType: 'expression',
FunctionType: 'function',
FunctionExpressionType: 'functionExpression',
IdentType: 'ident',

@@ -43,2 +41,3 @@ ImportantType: 'important',

OperatorType: 'operator',
ParenthesesType: 'parentheses',
ParentSelectorType: 'parentSelector',

@@ -45,0 +44,0 @@ PercentageType: 'percentage',

@@ -8,9 +8,17 @@ /**

*/
function Node(type, content, line, column) {
this.type = type;
this.content = content;
this.start = {
line: line,
column: column
};
function Node(options) {
this.type = options.type;
this.content = options.content;
if (options.start)
this.start = {
line: options.start[0],
column: options.start[1]
};
if (options.end)
this.end = {
line: options.end[0],
column: options.end[1]
};
}

@@ -17,0 +25,0 @@

@@ -35,26 +35,5 @@ var parserPackage = require('../package.json');

/**
* @return {String}
*/
toString: function() {
return this.name + ': ' + this.message;
},
/**
* @type {String}
*/
get message() {
return [
'Please check the validity of the block starting from line #' + this.line,
'',
this.codeFragment_,
'',
'Gonzales PE version: ' + this.version,
'Syntax: ' + this.syntax
].join('\n');
},
/**
* @type {String}
*/
get codeFragment_() {
get context() {
var LINES_AROUND = 2;

@@ -77,2 +56,26 @@

return result.join('\n');
},
/**
* @type {String}
*/
get message() {
var message = 'Please check validity of the block';
if (typeof this.line === 'number')
message += ' starting from line #' + this.line;
return message;
},
/**
* @return {String}
*/
toString: function() {
return [
this.name + ': ' + this.message,
'',
this.context,
'',
'Syntax: ' + this.syntax,
'Gonzales PE version: ' + this.version
].join('\n');
}

@@ -79,0 +82,0 @@ };

@@ -30,3 +30,3 @@ module.exports = function stringify(tree) {

'atruler': function(t) {
return _t(t.content[0]) + _t(t.content[1]) + '{' + _t(t.content[2]) + '}';
return _composite(t.content);
},

@@ -39,4 +39,4 @@ 'attribute': function(t) {

},
'braces': function(t) {
return t.content[0] + _composite(t.content.slice(2)) + t.content[1];
'brackets': function(t) {
return '[' + _composite(t.content) +']';
},

@@ -52,10 +52,7 @@ 'class': function(t) {

},
'filter': function(t) {
return _t(t.content[0]) + ':' + _t(t.content[1]);
},
'functionExpression': function(t) {
'expression': function(t) {
return 'expression(' + t.content + ')';
},
'id': function (t) {
return '#' + t.content;
return '#' + _composite(t.content);
},

@@ -74,2 +71,5 @@ 'important': function(t) {

},
'parentheses': function(t) {
return '(' + _composite(t.content) + ')';
},
'percentage': function(t) {

@@ -76,0 +76,0 @@ return _composite(t.content) + '%';

@@ -184,2 +184,3 @@ module.exports = function(css) {

var start = pos;
var col_ = col;

@@ -206,3 +207,6 @@ // Get current indent level:

pos += _pos - pos;
} else break;
} else {
pos--;
break;
}
}

@@ -213,3 +217,3 @@ }

var comment = css.substring(start, pos + 1);
pushToken(TokenType.CommentML, comment, col);
pushToken(TokenType.CommentML, comment, col_);

@@ -231,2 +235,3 @@ var newlines = comment.split('\n');

var start = pos;
var col_ = col;

@@ -269,3 +274,5 @@ // Check if comment is the only token on the line, and if so,

pos += _pos - pos;
} else break;
} else {
break;
}
}

@@ -276,4 +283,12 @@ }

// Add comment (including `//` and line break) to the list of tokens:
pushToken(TokenType.CommentSL, css.substring(start, pos--), col);
col += pos - start;
var comment = css.substring(start, pos--);
pushToken(TokenType.CommentSL, comment, col_);
var newlines = comment.split('\n');
if (newlines.length > 1) {
ln += newlines.length - 1;
col = newlines[newlines.length - 1].length;
} else {
col += (pos - start);
}
}

@@ -280,0 +295,0 @@

@@ -38,4 +38,4 @@ module.exports = function stringify(tree) {

},
'braces': function(t) {
return t.content[0] + _composite(t.content.slice(2)) + t.content[1];
'brackets': function(t) {
return '[' + _composite(t.content) + ']';
},

@@ -51,10 +51,7 @@ 'class': function(t) {

},
'filter': function(t) {
return _t(t.content[0]) + ':' + _t(t.content[1]);
},
'functionExpression': function(t) {
'expression': function(t) {
return 'expression(' + t.content + ')';
},
'id': function (t) {
return '#' + t.content;
return '#' + _composite(t.content);
},

@@ -73,2 +70,5 @@ 'important': function(t) {

},
'parentheses': function(t) {
return '(' + _composite(t.content) + ')';
},
'percentage': function(t) {

@@ -75,0 +75,0 @@ return _composite(t.content) + '%';

{
"name": "gonzales-pe",
"description": "Gonzales Preprocessor Edition (fast CSS parser)",
"version": "3.0.0-28",
"version": "3.0.0-29",
"homepage": "http://github.com/tonyganch/gonzales-pe",

@@ -27,3 +27,3 @@ "bugs": "http://github.com/tonyganch/gonzales-pe/issues",

"coffee-script": "~1.7.1",
"mocha": "~1.20.0"
"mocha": "2.2.x"
},

@@ -30,0 +30,0 @@ "engines": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc