Comparing version 0.52.0 to 0.52.1
@@ -1050,15 +1050,11 @@ | ||
(exports.substr = function substr(val, start, length){ | ||
utils.assertPresent(val, 'string'); | ||
utils.assertPresent(start, 'start'); | ||
var valNode = utils.unwrap(val).nodes[0]; | ||
start = utils.unwrap(start).nodes[0].val; | ||
if (length) { | ||
length = utils.unwrap(length).nodes[0].val; | ||
} | ||
var res = valNode.string.substr(start, length); | ||
return valNode instanceof nodes.Ident | ||
exports.substr = function substr(val, start, length){ | ||
utils.assertString(val, 'val'); | ||
utils.assertType(start, 'unit', 'start'); | ||
length = length && length.val; | ||
var res = val.string.substr(start.val, length); | ||
return val instanceof nodes.Ident | ||
? new nodes.Ident(res) | ||
: new nodes.String(res); | ||
}).raw = true; | ||
}; | ||
@@ -1075,14 +1071,12 @@ /** | ||
(exports.replace = function replace(pattern, replacement, val){ | ||
utils.assertPresent(pattern, 'pattern'); | ||
utils.assertPresent(replacement, 'replacement'); | ||
utils.assertPresent(val, 'val'); | ||
pattern = new RegExp(utils.unwrap(pattern).nodes[0].string, 'g'); | ||
replacement = utils.unwrap(replacement).nodes[0].string; | ||
var valNode = utils.unwrap(val).nodes[0]; | ||
var res = valNode.string.replace(pattern, replacement); | ||
return valNode instanceof nodes.Ident | ||
exports.replace = function replace(pattern, replacement, val){ | ||
utils.assertString(pattern, 'pattern'); | ||
utils.assertString(replacement, 'replacement'); | ||
utils.assertString(val, 'val'); | ||
pattern = new RegExp(pattern.string, 'g'); | ||
var res = val.string.replace(pattern, replacement.string); | ||
return val instanceof nodes.Ident | ||
? new nodes.Ident(res) | ||
: new nodes.String(res); | ||
}).raw = true; | ||
}; | ||
@@ -1097,10 +1091,8 @@ /** | ||
*/ | ||
(exports.split = function split(delim, val){ | ||
utils.assertPresent(delim, 'delimiter'); | ||
utils.assertPresent(val, 'val'); | ||
delim = utils.unwrap(delim).nodes[0].string; | ||
var valNode = utils.unwrap(val).nodes[0]; | ||
var splitted = valNode.string.split(delim); | ||
exports.split = function split(delim, val){ | ||
utils.assertString(delim, 'delimiter'); | ||
utils.assertString(val, 'val'); | ||
var splitted = val.string.split(delim.string); | ||
var expr = new nodes.Expression(); | ||
var ItemNode = valNode instanceof nodes.Ident | ||
var ItemNode = val instanceof nodes.Ident | ||
? nodes.Ident | ||
@@ -1112,3 +1104,3 @@ : nodes.String; | ||
return expr; | ||
}).raw = true; | ||
}; | ||
@@ -1115,0 +1107,0 @@ /** |
@@ -363,3 +363,6 @@ | ||
case '}': --braces; break; | ||
case '\n': ++this.lineno; break; | ||
case '\n': | ||
case '\r': | ||
++this.lineno; | ||
break; | ||
} | ||
@@ -604,3 +607,3 @@ css += c; | ||
var str = this.str.substr(0, end + 2) | ||
, lines = str.split('\n').length - 1 | ||
, lines = str.split(/\n|\r/).length - 1 | ||
, suppress = true | ||
@@ -607,0 +610,0 @@ , inline = false; |
@@ -67,2 +67,3 @@ | ||
} | ||
clone.isList = this.isList; | ||
clone.lineno = this.lineno; | ||
@@ -69,0 +70,0 @@ clone.column = this.column; |
@@ -502,3 +502,4 @@ /*! | ||
while ('ident' == this.lookahead(i).type | ||
&& 'newline' == this.lookahead(i + 1).type) i += 2; | ||
&& ('newline' == this.lookahead(i + 1).type | ||
|| ',' == this.lookahead(i + 1).type)) i += 2; | ||
@@ -520,6 +521,2 @@ while (this.isSelectorToken(i) | ||
if (':' == this.lookahead(i).type | ||
&& ':' == this.lookahead(i + 1).type) | ||
return true; | ||
// #a after an ident and newline | ||
@@ -537,7 +534,2 @@ if ('color' == this.lookahead(i).type | ||
if (':' == this.lookahead(i).type | ||
&& !this.isPseudoSelector(i + 1) | ||
&& this.lineContains('.')) | ||
return false; | ||
// the ':' token within braces signifies | ||
@@ -549,3 +541,3 @@ // a selector. ex: "foo{bar:'baz'}" | ||
// '}' preceded by a space is considered a selector. | ||
// '{' preceded by a space is considered a selector. | ||
// for example "foo{bar}{baz}" may be a property, | ||
@@ -557,2 +549,5 @@ // however "foo{bar} {baz}" is a selector | ||
// Trailing space | ||
while ('space' == this.lookahead(i).type) ++i; | ||
// Assume pseudo selectors are NOT properties | ||
@@ -565,13 +560,4 @@ // as 'td:th-child(1)' may look like a property | ||
return true; | ||
if (',' == this.lookahead(i).type | ||
&& 'newline' == this.lookahead(i + 1).type) | ||
return true; | ||
} | ||
// Trailing comma | ||
if (',' == this.lookahead(i).type | ||
&& 'newline' == this.lookahead(i + 1).type) | ||
return true; | ||
// Trailing brace | ||
@@ -854,2 +840,3 @@ if ('{' == this.lookahead(i).type | ||
} | ||
if ('eos' == this.peek().type) return block; | ||
stmt = this.statement(); | ||
@@ -990,3 +977,4 @@ this.accept(';'); | ||
tok = this.peek().type; | ||
if ('indent' == tok || '{' == tok) { | ||
if ('indent' == tok || '{' == tok || ('newline' == tok | ||
&& '{' == this.lookahead(2).type)) { | ||
this.state.push('atrule'); | ||
@@ -993,0 +981,0 @@ node.block = this.block(node); |
@@ -181,5 +181,2 @@ | ||
// Don't show JS stack trace for Stylus errors | ||
if (err.fromStylus) err.stack = ''; | ||
err.message = filename | ||
@@ -192,2 +189,5 @@ + ':' + lineno | ||
// Don't show JS stack trace for Stylus errors | ||
if (err.fromStylus) err.stack = 'Error: ' + err.message; | ||
return err; | ||
@@ -194,0 +194,0 @@ }; |
@@ -878,3 +878,3 @@ | ||
// Absolute URL or hash | ||
if (/url\s*\(\s*['"]?(?:#|(?:https?:)?\/\/)/i.test(path)) { | ||
if (/(?:url\s*\(\s*)?['"]?(?:#|(?:https?:)?\/\/)/i.test(path)) { | ||
if (imported.once) throw new Error('You cannot @require a url'); | ||
@@ -1096,2 +1096,3 @@ return imported; | ||
this._mixin(nodes, head, block); | ||
block.index = 0; | ||
block.nodes = head.concat(tail); | ||
@@ -1133,3 +1134,2 @@ }; | ||
default: | ||
if (0 == i) node = this.visit(node); | ||
dest.push(node); | ||
@@ -1136,0 +1136,0 @@ } |
{ | ||
"name": "stylus", | ||
"description": "Robust, expressive, and feature-rich CSS superset", | ||
"version": "0.52.0", | ||
"version": "0.52.1", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
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
344504
13073