postcss-less
Advanced tools
Comparing version 0.12.0 to 0.13.0
@@ -0,1 +1,4 @@ | ||
## 0.13.0 | ||
* set the default stringifier for Rule | ||
## 0.3.0 | ||
@@ -2,0 +5,0 @@ * Merged in webschik's changes |
@@ -17,2 +17,6 @@ 'use strict'; | ||
var _rule = require('./rule'); | ||
var _rule2 = _interopRequireDefault(_rule); | ||
var _findExtendRule = require('./find-extend-rule'); | ||
@@ -55,2 +59,14 @@ | ||
}, { | ||
key: 'rule', | ||
value: function rule(tokens) { | ||
tokens.pop(); | ||
var node = new _rule2.default(); | ||
this.init(node, tokens[0][2], tokens[0][3]); | ||
node.raws.between = this.spacesFromEnd(tokens); | ||
this.raw(node, 'selector', tokens); | ||
this.current = node; | ||
} | ||
}, { | ||
key: 'comment', | ||
@@ -57,0 +73,0 @@ value: function comment(token) { |
@@ -1,1 +0,1 @@ | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var s=0;s<t.length;s++){var i=t[s];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,s,i){return s&&e(t.prototype,s),i&&e(t,i),t}}(),_comment=require("postcss/lib/comment"),_comment2=_interopRequireDefault(_comment),_parser=require("postcss/lib/parser"),_parser2=_interopRequireDefault(_parser),_findExtendRule=require("./find-extend-rule"),_findExtendRule2=_interopRequireDefault(_findExtendRule),_isMixinToken=require("./is-mixin-token"),_isMixinToken2=_interopRequireDefault(_isMixinToken),_lessTokenize=require("./less-tokenize"),_lessTokenize2=_interopRequireDefault(_lessTokenize),blockCommentEndPattern=/\*\/$/,LessParser=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,Object.getPrototypeOf(t).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"tokenize",value:function(){this.tokens=(0,_lessTokenize2["default"])(this.input)}},{key:"comment",value:function(e){var t=new _comment2["default"],s=e[1],i=s.slice(2).replace(blockCommentEndPattern,"");if(this.init(t,e[2],e[3]),t.source.end={line:e[4],column:e[5]},t.raws.content=s,t.raws.begin=s[0]+s[1],t.inline="inline"===e[6],t.block=!t.inline,/^\s*$/.test(i))t.text="",t.raws.left=i,t.raws.right="";else{var n=i.match(/^(\s*)([^]*[^\s])(\s*)$/);t.text=n[2],t.raws.left=n[1]||" ",t.raws.right=n[3]||" "}}},{key:"createRule",value:function(e){this.rule(this.tokens.slice(e.start,this.pos+1)),e.params[0]&&(e.isMixin||e.isExtendRule)&&this.raw(this.current,"params",e.params)}},{key:"createDeclaration",value:function(e){this.decl(this.tokens.slice(e.start,this.pos+1))}},{key:"ruleWithoutBody",value:function(e){this.createRule(e),this.current.ruleWithoutBody=!0,delete this.current.nodes,this.current.extendRule=this.current.selector.indexOf("&:extend")>=0,this.current.important=this.current.selector.indexOf("!important")>=0,this.pos--,this.end(this.tokens[this.pos])}},{key:"processEndOfRule",value:function(e){var t=e.start;if(e.isExtendRule||e.isMixin)return this.ruleWithoutBody(e),!0;if(e.colon){if(e.isEndOfBlock)for(;this.pos>t;){var s=this.tokens[this.pos][0];if("space"!==s&&"comment"!==s)break;this.pos-=1}return this.createDeclaration({start:t}),!0}return!1}},{key:"word",value:function(){var e=!1,t=!1,s=null,i=0,n=this.pos,r=(0,_isMixinToken2["default"])(this.tokens[n]),o=Boolean((0,_findExtendRule2["default"])(this.tokens,n)),u=[];for(this.pos+=1;this.pos<this.tokens.length;){var a=this.tokens[this.pos],l=a[0];if("("===l)s||(s=a),i+=1;else if(0===i){if(";"===l){var c=this.processEndOfRule({start:n,params:u,colon:t,isMixin:r,isExtendRule:o});if(c)return;break}if("{"===l)return void this.createRule({start:n,params:u,isMixin:r});if("}"===l){this.pos-=1,e=!0;break}":"===l&&(t=!0)}else")"===l&&(i-=1,0===i&&(s=null));(i||"brackets"===l||u[0])&&u.push(a),this.pos+=1}if(this.pos===this.tokens.length&&(this.pos-=1,e=!0),i>0&&this.unclosedBracket(s),e){var f=this.processEndOfRule({start:n,params:u,colon:t,isMixin:r,isExtendRule:o,isEndOfBlock:!0});if(f)return}this.unknownWord(n)}}]),t}(_parser2["default"]);exports["default"]=LessParser,module.exports=exports["default"]; | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),_comment=require("postcss/lib/comment"),_comment2=_interopRequireDefault(_comment),_parser=require("postcss/lib/parser"),_parser2=_interopRequireDefault(_parser),_rule=require("./rule"),_rule2=_interopRequireDefault(_rule),_findExtendRule=require("./find-extend-rule"),_findExtendRule2=_interopRequireDefault(_findExtendRule),_isMixinToken=require("./is-mixin-token"),_isMixinToken2=_interopRequireDefault(_isMixinToken),_lessTokenize=require("./less-tokenize"),_lessTokenize2=_interopRequireDefault(_lessTokenize),blockCommentEndPattern=/\*\/$/,LessParser=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,Object.getPrototypeOf(t).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"tokenize",value:function(){this.tokens=(0,_lessTokenize2["default"])(this.input)}},{key:"rule",value:function(e){e.pop();var t=new _rule2["default"];this.init(t,e[0][2],e[0][3]),t.raws.between=this.spacesFromEnd(e),this.raw(t,"selector",e),this.current=t}},{key:"comment",value:function(e){var t=new _comment2["default"],r=e[1],i=r.slice(2).replace(blockCommentEndPattern,"");if(this.init(t,e[2],e[3]),t.source.end={line:e[4],column:e[5]},t.raws.content=r,t.raws.begin=r[0]+r[1],t.inline="inline"===e[6],t.block=!t.inline,/^\s*$/.test(i))t.text="",t.raws.left=i,t.raws.right="";else{var s=i.match(/^(\s*)([^]*[^\s])(\s*)$/);t.text=s[2],t.raws.left=s[1]||" ",t.raws.right=s[3]||" "}}},{key:"createRule",value:function(e){this.rule(this.tokens.slice(e.start,this.pos+1)),e.params[0]&&(e.isMixin||e.isExtendRule)&&this.raw(this.current,"params",e.params)}},{key:"createDeclaration",value:function(e){this.decl(this.tokens.slice(e.start,this.pos+1))}},{key:"ruleWithoutBody",value:function(e){this.createRule(e),this.current.ruleWithoutBody=!0,delete this.current.nodes,this.current.extendRule=this.current.selector.indexOf("&:extend")>=0,this.current.important=this.current.selector.indexOf("!important")>=0,this.pos--,this.end(this.tokens[this.pos])}},{key:"processEndOfRule",value:function(e){var t=e.start;if(e.isExtendRule||e.isMixin)return this.ruleWithoutBody(e),!0;if(e.colon){if(e.isEndOfBlock)for(;this.pos>t;){var r=this.tokens[this.pos][0];if("space"!==r&&"comment"!==r)break;this.pos-=1}return this.createDeclaration({start:t}),!0}return!1}},{key:"word",value:function(){var e=!1,t=!1,r=null,i=0,s=this.pos,n=(0,_isMixinToken2["default"])(this.tokens[s]),o=Boolean((0,_findExtendRule2["default"])(this.tokens,s)),u=[];for(this.pos+=1;this.pos<this.tokens.length;){var l=this.tokens[this.pos],a=l[0];if("("===a)r||(r=l),i+=1;else if(0===i){if(";"===a){var c=this.processEndOfRule({start:s,params:u,colon:t,isMixin:n,isExtendRule:o});if(c)return;break}if("{"===a)return void this.createRule({start:s,params:u,isMixin:n});if("}"===a){this.pos-=1,e=!0;break}":"===a&&(t=!0)}else")"===a&&(i-=1,0===i&&(r=null));(i||"brackets"===a||u[0])&&u.push(l),this.pos+=1}if(this.pos===this.tokens.length&&(this.pos-=1,e=!0),i>0&&this.unclosedBracket(r),e){var f=this.processEndOfRule({start:s,params:u,colon:t,isMixin:n,isExtendRule:o,isEndOfBlock:!0});if(f)return}this.unknownWord(s)}}]),t}(_parser2["default"]);exports["default"]=LessParser,module.exports=exports["default"]; |
{ | ||
"name": "postcss-less", | ||
"version": "0.12.0", | ||
"version": "0.13.0", | ||
"description": "LESS parser for PostCSS", | ||
@@ -5,0 +5,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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
75007
54
915
20