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

postcss-less

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-less - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

6

dist/less-parser.js

@@ -218,3 +218,7 @@ 'use strict';

} else if (tokn[0] === 'brackets') {
directives.push(tokn);
if (node.urlFunc) {
node.importPath = tokn[1].replace(/[()]/g, '');
} else {
directives.push(tokn);
}
} else if (tokn[0] === 'space') {

@@ -221,0 +225,0 @@ if (directives.length) {

2

dist/less-parser.min.js

@@ -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 r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),_get=function e(t,r,n){null===t&&(t=Function.prototype);var s=Object.getOwnPropertyDescriptor(t,r);if(void 0===s){var i=Object.getPrototypeOf(t);return null===i?void 0:e(i,r,n)}if("value"in s)return s.value;var o=s.get;if(void 0!==o)return o.call(n)},_comment=require("postcss/lib/comment"),_comment2=_interopRequireDefault(_comment),_import2=require("./import"),_import3=_interopRequireDefault(_import2),_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,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"atrule",value:function(e){"@import"===e[1]?this.import(e):_get(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"atrule",this).call(this,e)}},{key:"comment",value:function(e){var t=new _comment2.default,r=e[1],n=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(n))t.text="",t.raws.left=n,t.raws.right="";else{var s=n.match(/^(\s*)([^]*[^\s])(\s*)$/);t.text=s[2],t.raws.left=s[1]||" ",t.raws.right=s[3]||" "}}},{key:"createDeclaration",value:function(e){this.decl(this.tokens.slice(e.start,this.pos+1))}},{key:"createRule",value:function(e){var t=";"===this.tokens[this.pos][0],r=this.pos+(e.empty&&t?2:1),n=this.tokens.slice(e.start,r),s=this.rule(n);e.params[0]&&(e.mixin||e.extend)&&this.raw(s,"params",e.params),e.empty&&(t&&(s.raws.semicolon=this.semicolon=!0,s.selector=s.selector.replace(/;$/,"")),e.extend&&(s.extend=!0),e.mixin&&(s.mixin=!0),s.empty=!0,delete this.current.nodes,s.selector.indexOf("!important")>=0&&(s.important=!0,s.selector=s.selector.replace(/\s!important/,"")),t||this.pos--,this.end(this.tokens[this.pos]))}},{key:"end",value:function(e){var r=this.current;r.nodes&&r.nodes.length&&r.last.raws.semicolon&&!r.last.nodes&&(this.semicolon=!0),_get(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"end",this).call(this,e)}},{key:"import",value:function(e){var t=!1,r=!1,n={line:0,column:0},s=[],i=new _import3.default;for(i.name=e[1].slice(1),this.init(i,e[2],e[3]),this.pos+=1;this.pos<this.tokens.length;){var o=this.tokens[this.pos];if(";"===o[0]){n={line:o[2],column:o[3]},i.raws.semicolon=!0;break}if("{"===o[0]){r=!0;break}if("}"===o[0]){this.end(o);break}if("brackets"===o[0]?s.push(o):"space"===o[0]?s.length?i.raws.between=o[1]:i.urlFunc?i.raws.beforeUrl=o[1]:i.importPath?i.urlFunc?i.raws.afterUrl=o[1]:i.raws.after=o[1]:i.raws.afterName=o[1]:"word"===o[0]&&"url"===o[1]?i.urlFunc=!0:"("!==o[0]&&")"!==o[0]&&(i.importPath=o[1]),this.pos===this.tokens.length){t=!0;break}this.pos+=1}i.raws.between&&!i.raws.afterName&&(i.raws.afterName=i.raws.between,i.raws.between=""),i.source.end=n,s.length?(this.raw(i,"directives",s),t&&(e=s[s.length-1],i.source.end={line:e[4],column:e[5]},this.spaces=i.raws.between,i.raws.between="")):i.directives="",r&&(i.nodes=[],this.current=i)}},{key:"other",value:function(){var e=[],t=[],r=this.pos,n=!1,s=!1,i=null;if("brackets"===this.tokens[r][0])return void(this.spaces+=this.tokens[r][1]);for(var o=(0,_isMixinToken2.default)(this.tokens[r]),a=Boolean((0,_findExtendRule2.default)(this.tokens,r));this.pos<this.tokens.length;){var l=this.tokens[this.pos],u=l[0];if("("===u||"["===u)i||(i=l),e.push("("===u?")":"]");else if(0===e.length){if(";"===u){var c=this.ruleEnd({start:r,params:t,colon:s,mixin:o,extend:a});if(c)return;break}if("{"===u)return void this.createRule({start:r,params:t,mixin:o});if("}"===u){this.pos-=1,n=!0;break}":"===u&&(s=!0)}else u===e[e.length-1]&&(e.pop(),0===e.length&&(i=null));!a&&s||!(e.length>0||"brackets"===u||t[0])||t.push(l),this.pos+=1}if(this.pos===this.tokens.length&&(this.pos-=1,n=!0),e.length>0&&this.unclosedBracket(i),n&&this.tokens.length>1){if(this.ruleEnd({start:r,params:t,colon:s,mixin:o,extend:a,isEndOfBlock:!0}))return}this.unknownWord(r)}},{key:"rule",value:function(e){e.pop();var t=new _rule2.default;return this.init(t,e[0][2],e[0][3]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t,t}},{key:"ruleEnd",value:function(e){var t=e.start;if(e.extend||e.mixin)return this.createRule(Object.assign(e,{empty:!0})),!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:"tokenize",value:function(){this.tokens=(0,_lessTokenize2.default)(this.input)}}]),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 n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),_get=function e(t,r,n){null===t&&(t=Function.prototype);var s=Object.getOwnPropertyDescriptor(t,r);if(void 0===s){var i=Object.getPrototypeOf(t);return null===i?void 0:e(i,r,n)}if("value"in s)return s.value;var o=s.get;if(void 0!==o)return o.call(n)},_comment=require("postcss/lib/comment"),_comment2=_interopRequireDefault(_comment),_import2=require("./import"),_import3=_interopRequireDefault(_import2),_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,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"atrule",value:function(e){"@import"===e[1]?this.import(e):_get(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"atrule",this).call(this,e)}},{key:"comment",value:function(e){var t=new _comment2.default,r=e[1],n=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(n))t.text="",t.raws.left=n,t.raws.right="";else{var s=n.match(/^(\s*)([^]*[^\s])(\s*)$/);t.text=s[2],t.raws.left=s[1]||" ",t.raws.right=s[3]||" "}}},{key:"createDeclaration",value:function(e){this.decl(this.tokens.slice(e.start,this.pos+1))}},{key:"createRule",value:function(e){var t=";"===this.tokens[this.pos][0],r=this.pos+(e.empty&&t?2:1),n=this.tokens.slice(e.start,r),s=this.rule(n);e.params[0]&&(e.mixin||e.extend)&&this.raw(s,"params",e.params),e.empty&&(t&&(s.raws.semicolon=this.semicolon=!0,s.selector=s.selector.replace(/;$/,"")),e.extend&&(s.extend=!0),e.mixin&&(s.mixin=!0),s.empty=!0,delete this.current.nodes,s.selector.indexOf("!important")>=0&&(s.important=!0,s.selector=s.selector.replace(/\s!important/,"")),t||this.pos--,this.end(this.tokens[this.pos]))}},{key:"end",value:function(e){var r=this.current;r.nodes&&r.nodes.length&&r.last.raws.semicolon&&!r.last.nodes&&(this.semicolon=!0),_get(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"end",this).call(this,e)}},{key:"import",value:function(e){var t=!1,r=!1,n={line:0,column:0},s=[],i=new _import3.default;for(i.name=e[1].slice(1),this.init(i,e[2],e[3]),this.pos+=1;this.pos<this.tokens.length;){var o=this.tokens[this.pos];if(";"===o[0]){n={line:o[2],column:o[3]},i.raws.semicolon=!0;break}if("{"===o[0]){r=!0;break}if("}"===o[0]){this.end(o);break}if("brackets"===o[0]?i.urlFunc?i.importPath=o[1].replace(/[()]/g,""):s.push(o):"space"===o[0]?s.length?i.raws.between=o[1]:i.urlFunc?i.raws.beforeUrl=o[1]:i.importPath?i.urlFunc?i.raws.afterUrl=o[1]:i.raws.after=o[1]:i.raws.afterName=o[1]:"word"===o[0]&&"url"===o[1]?i.urlFunc=!0:"("!==o[0]&&")"!==o[0]&&(i.importPath=o[1]),this.pos===this.tokens.length){t=!0;break}this.pos+=1}i.raws.between&&!i.raws.afterName&&(i.raws.afterName=i.raws.between,i.raws.between=""),i.source.end=n,s.length?(this.raw(i,"directives",s),t&&(e=s[s.length-1],i.source.end={line:e[4],column:e[5]},this.spaces=i.raws.between,i.raws.between="")):i.directives="",r&&(i.nodes=[],this.current=i)}},{key:"other",value:function(){var e=[],t=[],r=this.pos,n=!1,s=!1,i=null;if("brackets"===this.tokens[r][0])return void(this.spaces+=this.tokens[r][1]);for(var o=(0,_isMixinToken2.default)(this.tokens[r]),a=Boolean((0,_findExtendRule2.default)(this.tokens,r));this.pos<this.tokens.length;){var l=this.tokens[this.pos],u=l[0];if("("===u||"["===u)i||(i=l),e.push("("===u?")":"]");else if(0===e.length){if(";"===u){var c=this.ruleEnd({start:r,params:t,colon:s,mixin:o,extend:a});if(c)return;break}if("{"===u)return void this.createRule({start:r,params:t,mixin:o});if("}"===u){this.pos-=1,n=!0;break}":"===u&&(s=!0)}else u===e[e.length-1]&&(e.pop(),0===e.length&&(i=null));!a&&s||!(e.length>0||"brackets"===u||t[0])||t.push(l),this.pos+=1}if(this.pos===this.tokens.length&&(this.pos-=1,n=!0),e.length>0&&this.unclosedBracket(i),n&&this.tokens.length>1){if(this.ruleEnd({start:r,params:t,colon:s,mixin:o,extend:a,isEndOfBlock:!0}))return}this.unknownWord(r)}},{key:"rule",value:function(e){e.pop();var t=new _rule2.default;return this.init(t,e[0][2],e[0][3]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t,t}},{key:"ruleEnd",value:function(e){var t=e.start;if(e.extend||e.mixin)return this.createRule(Object.assign(e,{empty:!0})),!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:"tokenize",value:function(){this.tokens=(0,_lessTokenize2.default)(this.input)}}]),t}(_parser2.default);exports.default=LessParser,module.exports=exports.default;
{
"name": "postcss-less",
"version": "1.0.1",
"version": "1.0.2",
"description": "LESS parser for PostCSS",

@@ -5,0 +5,0 @@ "keywords": [

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